@import url("https://fonts.googleapis.com/css2?family=Figtree:wght@400;500;600;700&display=swap");

/* =========================================================
   PORTAL FRAMEWORK CSS
   Shared by all forecast reports
   ========================================================= */

/* ---------- Fonts ---------- */
@font-face {
  font-family: 'Manrope';
  font-style: normal;
  font-weight: 400;
  src: url('../fonts/manrope-v20-latin-regular.woff2') format('woff2');
}
@font-face {
  font-family: 'Manrope';
  font-style: normal;
  font-weight: 700;
  src: url('../fonts/manrope-v20-latin-700.woff2') format('woff2');
}

/* ---------- Theme Variables ---------- */
:root {
    --page-bg: #e9eef5;
    --card-bg: #ffffff;
    --text: #111111;
    --muted: #555555;
    --brand: #1d3f6e;
    --shadow: rgba(0,0,0,.18);
    --period-bg: #e5e5e5;
    --period-text: #111111;
}

body.dark {
    --page-bg: #1b2430;
    --card-bg: #273445;
    --text: #f3f5f7;
    --muted: #c7d1dd;
    --brand: #7ab4ff;
    --shadow: rgba(0,0,0,.45);
    --period-bg: #344357;
    --period-text: #f3f5f7;
}

/* ---------- Base Layout ---------- */
body {
    margin: 0;
    background: var(--page-bg);
    font-family: "Manrope", Arial, Helvetica, sans-serif;
    color: var(--text);
}

.report-toolbar {
    box-sizing: border-box;
    width: 100%;
    min-height: 42px;
    padding: 6px 12px;
    text-align: right;
}

.report-toolbar .theme-toggle {
    position: static;
    display: inline-block;
}

.forecast-page {
    max-width: 1100px;
    margin: 30px auto;
    padding: 36px;
    background: var(--card-bg);
    box-shadow: 0 8px 24px var(--shadow);
    box-sizing: border-box;
    position: relative;
}

/* ---------- Controls ---------- */
.theme-toggle {
    position: absolute;
    top: 10px;
    right: 36px;
    border: 1px solid var(--brand);
    background: transparent;
    color: var(--brand);
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    padding: 6px 12px;
    border-radius: 20px;
    cursor: pointer;
}

.theme-toggle:hover {
    background: var(--brand);
    color: var(--card-bg);
}

/* ---------- Header ---------- */
.masthead {
    text-align: center;
}

.masthead img {
    width: 100%;
    max-width: 700px;
    height: auto;
    display: block;
    margin: 0 auto 4px;
}

.client-title {
    text-align: center;
    margin: -28px 0 16px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--brand);
}

.client-title h1 {
    margin: 0;
    font-size: 28px;
    font-weight: 700;
    color: var(--brand);
}

.client-title h2 {
    margin: 2px 0 0;
    font-size: 16px;
    color: var(--muted);
}

/* ---------- Metadata ---------- */
.meta {
    margin: 24px 0 28px;
    display: grid;
    grid-template-columns: 150px 1fr;
    font-size: 14px;
}

.label {
    font-weight: 700;
}

/* ---------- Common Sections ---------- */
.section-title {
    font-weight: 700;
    margin-top: 22px;
    margin-bottom: 8px;
    font-size: 16px;
    color: var(--brand);
}

.climate {
    border-collapse: collapse;
    width: max-content;
    font-size: 14px;
}

.climate td {
    padding: 0;
    line-height: 1.4;
}

.climate td:first-child {
    white-space: nowrap;
    padding-right: 14px;
}

.footer {
    margin-top: 36px;
    border-top: 2px solid var(--brand);
    padding-top: 14px;
    text-align: center;
    font-size: 13px;
    color: var(--muted);
}

/* ---------- Shared Print Rules ---------- */
@page {
    size: Letter;
    margin: .5in;
}

@media print {
    .theme-toggle {
        display: none !important;
    }

    html, body {
        font-family: "Manrope", Arial, Helvetica, sans-serif !important;
        margin: 0 !important;
        padding: 0 !important;
        background: #fff !important;
    }

    .forecast-page {
        width: auto !important;
        max-width: none !important;
        margin: 0 !important;
        padding: 0 !important;
        box-shadow: none !important;
        background: #fff !important;
    }
}

/* Portal screens: scoped separately from forecast reports and their print rules. */
body.portal-ui {
    --page-bg: #fff;
    --card-bg: #f8fafc;
    --text: #333;
    --muted: #64748b;
    --brand: #2563eb;
    --brand-light: #eff6ff;
    --border: #e2e8f0;
    margin: 0;
    padding: 20px;
    background: var(--page-bg);
    color: var(--text);
    font-family: 'Figtree', 'Manrope', Arial, sans-serif;
    font-size: 15px;
    line-height: 1.5;
}
.portal-ui *, .portal-ui *::before, .portal-ui *::after { box-sizing: border-box; }
.portal-ui input, .portal-ui select, .portal-ui textarea, .portal-ui button { font: inherit; }
.portal-ui h1, .portal-ui h2, .portal-ui h3 { color: #1e293b; line-height: 1.25; font-weight: 700; }
.portal-ui h2 { font-size: 24px; margin: 0 0 8px; }
.portal-ui h3 { font-size: 18px; margin: 0 0 8px; }
.portal-ui a { color: var(--brand); }
.portal-ui label { display: block; color: #475569; font-weight: 600; font-size: 13px; margin-bottom: 6px; }
.portal-ui input[type=text], .portal-ui input[type=password], .portal-ui input[type=number],
.portal-ui select, .portal-ui textarea {
    max-width: 100%; padding: 8px 10px; border: 1px solid #cbd5e1;
    border-radius: 4px; background: #fff; color: #333;
}
.portal-ui textarea { resize: vertical; min-height: 110px; }
.portal-ui :is(input, select, textarea, button, a, summary):focus-visible {
    outline: 2px solid #2563eb; outline-offset: 3px;
}
.portal-ui button, .portal-ui .btn-submit {
    padding: 8px 16px; background: #2563eb; color: #fff; border: 0;
    border-radius: 4px; cursor: pointer; font-weight: 600;
}
.portal-ui button:hover, .portal-ui .btn-submit:hover { background: #1d4ed8; }
.portal-ui .form-card, .portal-ui .release-card, .portal-ui .portal-card {
    background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 6px;
    padding: 20px; box-shadow: none;
}
.portal-ui .form-card { max-width: 600px; margin: 24px auto; }
.portal-ui .form-group { margin-bottom: 18px; }
.portal-ui .form-group :is(input, select, textarea) { width: 100%; }
.portal-ui .subtitle, .portal-ui .content-subtitle { color: #64748b; margin: 0 0 20px; font-size: 14px; }
.portal-ui .btn-submit { width: 100%; }
.portal-ui .alert { padding: 10px 12px; border-radius: 4px; margin-bottom: 18px; font-size: 14px; }
.portal-ui .alert-success { background: #dcfce7; color: #15803d; }
.portal-ui .alert-error { background: #fee2e2; color: #b91c1c; }
.portal-ui.portal-login-page { min-height: 100vh; display: grid; place-items: center; }
.portal-ui .login-card { width: 100%; max-width: 420px; padding: 28px; margin: 0; }
.portal-ui .login-logo { width: 82px; height: 82px; object-fit: contain; display: block; margin-bottom: 20px; }

/* Release history */
.portal-ui .portal-page { max-width: 1100px; margin: 0 auto; }
.portal-ui .header { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.portal-ui .header h2 { margin: 0; }
.portal-ui #appFilterForm { display: flex; gap: 8px; align-items: center; }
.portal-ui #appFilterForm label { margin: 0; }
.portal-ui .release-card { margin-bottom: 20px; }
.portal-ui .release-header { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; border-bottom: 1px solid #e2e8f0; margin-bottom: 8px; padding-bottom: 12px; }
.portal-ui .version-title { font-size: 18px; font-weight: 700; color: #1e293b; }
.portal-ui .version-date { color: #64748b; font-size: 12px; }
.portal-ui .dev-badge { display: inline-block; font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 4px; background: #2563eb; color: #fff; margin-left: 8px; }
.portal-ui .badge { display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 4px; margin-right: 8px; }
.portal-ui .badge-Feature { background: #dcfce7; color: #15803d; }
.portal-ui .badge-Fix, .portal-ui .badge-Bug-Report { background: #fee2e2; color: #b91c1c; }
.portal-ui .badge-Improvement { background: #e0f2fe; color: #0369a1; }
.portal-ui .badge-Internal { background: #e2e8f0; color: #475569; }
.portal-ui .badge-Request { background: #fef3c7; color: #92400e; }
.portal-ui .status-pill { display: inline-block; font-size: 10px; font-weight: 700; padding: 2px 6px; border-radius: 4px; margin-right: 6px; }
.portal-ui .status-New { background: #e2e8f0; color: #475569; }
.portal-ui .status-Planned { background: #e0e7ff; color: #4338ca; }
.portal-ui .status-In-Progress { background: #fef3c7; color: #854d0e; }
.portal-ui .status-Completed { background: #dcfce7; color: #15803d; }
.portal-ui .status-Declined { background: #fee2e2; color: #b91c1c; }
.portal-ui .note-list { list-style: none; margin: 0; padding: 0; }
.portal-ui .note-item { padding: 12px 0; border-bottom: 1px solid #e2e8f0; font-size: 14px; overflow-wrap: anywhere; }
.portal-ui .note-item:last-child { border-bottom: 0; }
.portal-ui .note-summary { font-weight: 600; color: #1e293b; }
.portal-ui .note-details { margin-top: 4px; color: #475569; white-space: pre-wrap; font-size: 13px; }
.portal-ui .note-meta { margin-top: 6px; color: #64748b; font-size: 12px; }

/* Client portal shell */
body.portal-ui.portal-home { padding: 0; background: #fff; }
.portal-ui .portal-header { border-bottom: 1px solid #e2e8f0; background: #f8fafc; padding: 20px 24px; }
.portal-ui .header-inner { max-width: 1180px; margin: auto; display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.portal-ui .portal-eyebrow { color: #64748b; font-size: 12px; font-weight: 600; }
.portal-ui .portal-client h1 { margin: 2px 0 4px; font-size: 24px; }
.portal-ui .portal-client div { color: #64748b; font-size: 14px; }
.portal-ui .mobile-menu-button { display: none; }
.portal-ui .portal-shell { max-width: 1180px; margin: 24px auto; padding: 0 24px; display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 24px; }
.portal-ui .sidebar { background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 6px; padding: 12px; align-self: start; }
.portal-ui .sidebar-brand { display: block; padding: 8px 12px 20px; margin-bottom: 12px; border-bottom: 1px solid #e2e8f0; }
.portal-ui .sidebar-brand img { display: block; width: 84px; height: 84px; object-fit: contain; }
.portal-ui .sidebar > a:not(.sidebar-brand) { display: block; padding: 10px 12px; border-radius: 4px; margin: 0 0 4px; color: #475569; text-decoration: none; font-size: 14px; font-weight: 600; }
.portal-ui .sidebar > a:not(.sidebar-brand):hover, .portal-ui .sidebar > a.active { background: #dbeafe; color: #1d4ed8; }
.portal-ui .main-content { min-width: 0; padding: 8px 0; }
.portal-ui .content-title { margin: 0 0 6px; font-size: 26px; }
.portal-ui .card-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.portal-ui .portal-card p { margin: 0; color: #475569; font-size: 14px; }
@media (max-width: 760px) {
    .portal-ui .portal-header { padding: 16px; }
    .portal-ui .portal-shell { padding: 0 16px; margin: 16px auto; grid-template-columns: minmax(0, 1fr); gap: 16px; }
    .portal-ui .mobile-menu-button { display: inline-block; }
    .portal-ui .sidebar > a:not(.sidebar-brand) { display: none; }
    .portal-ui .sidebar.open > a:not(.sidebar-brand) { display: block; }
    .portal-ui .sidebar-brand { padding: 4px 8px; border: 0; margin: 0; }
    .portal-ui .sidebar-brand img { width: 60px; height: 60px; }
    .portal-ui .sidebar.open .sidebar-brand { margin-bottom: 12px; }
    .portal-ui .card-grid { grid-template-columns: minmax(0, 1fr); }
    .portal-ui .portal-client h1 { font-size: 21px; }
}
@media print {
    html:has(body.portal-ui), body.portal-ui { font-family: 'Figtree', 'Manrope', Arial, sans-serif !important; }
    .portal-ui .mobile-menu-button { display: none; }
}
