/* CaiReport's own components, styled to match the blue service portal theme.
   Typography remains in typography.css and report layouts remain in report.css. */
:root {
    --navy: #0b315f;
    --brand: #174f8a;
    --blue: #2563eb;
    --brand-soft: #eaf3ff;
    --page: #f5f7fb;
    --surface-soft: #f8fbff;
    --line: #d5e5f5;
    --shadow: 0 12px 28px rgba(50, 92, 151, .12);
    --radius: 20px;
}

html { background: var(--page); }
body.app-body,
body.login-body {
    background:
        radial-gradient(circle at 8% -10%, rgba(37, 99, 235, .06), transparent 34rem),
        radial-gradient(circle at 92% 2%, rgba(14, 165, 233, .05), transparent 28rem),
        linear-gradient(180deg, #fbfcff 0%, #f5f7fb 45%, #edf2f8 100%);
}
body.app-body::before,
body.login-body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    opacity: .3;
    background-image: linear-gradient(rgba(15, 23, 42, .025) 1px, transparent 1px),
                      linear-gradient(90deg, rgba(15, 23, 42, .025) 1px, transparent 1px);
    background-size: 42px 42px;
    mask-image: linear-gradient(to bottom, #000, transparent 70%);
}
::selection { color: #fff; background: var(--brand); }
:focus-visible { outline-color: #1b679d; outline-offset: 3px; }

/* The boxed service menu and softly raised surfaces are the main visual cues. */
.app-shell { --sidebar: 276px; }
.sidebar {
    inset: 12px auto 12px 12px;
    width: calc(var(--sidebar) - 24px);
    padding-inline: 12px;
    border: 1px solid rgba(255, 255, 255, .9);
    border-radius: 23px;
    background: linear-gradient(148deg, #f1f7ff, #e5effd);
    box-shadow: 10px 10px 24px rgba(80, 124, 187, .13),
                -8px -8px 22px rgba(255, 255, 255, .85),
                inset 1px 1px 0 #fff;
}
.sidebar .brand { padding: 4px 7px 12px; }

.nav-list { padding-top: 8px; }
.nav-list a {
    gap: 10px;
    min-height: 43px;
    padding: 4px 8px;
    border: 1px solid transparent;
    border-radius: 13px;
    color: #315887;
    font-weight: 700;
    transition: color .18s ease, background .18s ease, box-shadow .18s ease;
}
.nav-list a svg {
    flex: none;
    width: 18px;
    height: 18px;
    padding: 6px;
    box-sizing: content-box;
    border-radius: 9px;
    color: #3475cf;
    background: rgba(255, 255, 255, .66);
    box-shadow: 2px 3px 6px rgba(86, 127, 190, .12), -2px -2px 5px #fff;
}
.nav-list a:hover { color: #174d94; background: rgba(255, 255, 255, .7); }
.nav-list a.active,
.nav-list a.active:hover {
    border-color: #78acfa;
    color: #104baf;
    background: linear-gradient(125deg, #d8e8ff, #bdd8ff);
    box-shadow: inset 1px 1px 0 #fff, 4px 5px 10px rgba(65, 124, 206, .13);
}
.sidebar-user { padding-inline: 8px; }
.topbar {
    background: rgba(255, 255, 255, .78);
    border-bottom-color: rgba(148, 163, 184, .22);
    box-shadow: 0 8px 30px rgba(15, 23, 42, .045);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}
.topbar-context strong { background: #eaf3ff; color: #174f8a; }

.panel,
.stat-card,
.report-hub-card {
    border: 1px solid #d5e5fa;
    border-radius: 22px;
    background: linear-gradient(145deg, #fff, #f8fbff);
    box-shadow: 7px 9px 22px rgba(80, 124, 187, .11),
                -5px -5px 17px rgba(255, 255, 255, .82),
                inset 0 1px 0 #fff;
}
.stat-card { border-color: #d5e5fa; }
.stat-card::after { opacity: .07; }
.welcome-panel,
.credentials-card {
    border-color: #d0e2fa;
    background: linear-gradient(145deg, #f4f9ff, #e4f0ff);
}
.report-hub-card { position: relative; overflow: hidden; }
.report-hub-card::before {
    content: "";
    position: absolute;
    inset: -65% 38% 55% -24%;
    pointer-events: none;
    background: radial-gradient(circle, rgba(59, 130, 246, .2), transparent 70%);
}
.report-hub-card:hover {
    border-color: #95bff3;
    box-shadow: 0 18px 36px rgba(50, 92, 151, .17);
}
.page-heading h1 { color: #113b75; }
.page-heading p:not(.eyebrow),
.report-section-head p { color: #536d93; }
.date-pill { border-color: #d0e2fa; box-shadow: 0 2px 8px rgba(15, 23, 42, .04); }

.button { transition: background .18s ease, border-color .18s ease, box-shadow .18s ease, transform .18s ease; }
.button-primary {
    border-color: #3183f3;
    background: linear-gradient(135deg, #56a2ff, #2874ef);
    box-shadow: 4px 6px 12px rgba(37, 108, 220, .22), inset 0 1px 0 rgba(255, 255, 255, .45);
}
.button-primary:hover { filter: none; background: linear-gradient(135deg, #4a96f8, #2169e0); transform: translateY(-1px); }
.button-secondary {
    border-color: #aacbf2;
    background: linear-gradient(135deg, #f4f9ff, #dcecff);
    color: #24558d;
    box-shadow: 3px 4px 9px rgba(60, 111, 180, .12), inset 0 1px 0 #fff;
}
.button-secondary:hover { border-color: #80b2ec; background: linear-gradient(135deg, #eaf4ff, #cfe3fc); }
.button-ghost { background: rgba(255, 255, 255, .6); border-color: #d2e0f0; }
.logout-button { background: #fff5dc; border-color: #f2d49a; color: #8a4b0b; }
.logout-button:hover { background: #ffebbd; border-color: #e5bd6f; color: #713b08; }

.field input,
.field select,
.search-form input,
.table-page-size select,
.report-form .field textarea,
.report-metrics td input,
.reason-detail,
.report-monthly-input {
    border-color: #bfd4ed;
    box-shadow: inset 0 1px 3px rgba(37, 79, 130, .035);
}

/* Native select controls gain a themed picker where the browser supports it. */
@supports (appearance: base-select) {
    :is(.field select, .table-page-size select, .month-picker select):not([multiple]) {
        appearance: base-select;
        cursor: pointer;
    }
    ::picker(select) {
        appearance: base-select;
        max-height: min(320px, 50vh);
        overflow-y: auto;
        margin-top: 4px;
        padding: 6px;
        border: 1px solid #bfd4ed;
        border-radius: 12px;
        background: #fff;
        box-shadow: 0 16px 34px rgba(15, 49, 95, .18);
    }
    :is(.field select, .table-page-size select, .month-picker select) option {
        padding: 9px 12px;
        border-radius: 8px;
        color: #173657;
        background: #fff;
        cursor: pointer;
    }
    :is(.field select, .table-page-size select, .month-picker select) option:hover,
    :is(.field select, .table-page-size select, .month-picker select) option:focus {
        color: #174f8a;
        background: #edf5ff;
    }
    :is(.field select, .table-page-size select, .month-picker select) option:checked {
        color: #174f8a;
        background: #dcecff;
        font-weight: 600;
    }
    :is(.field select, .table-page-size select, .month-picker select):disabled {
        cursor: not-allowed;
    }
    :is(.field select, .table-page-size select, .month-picker select)::picker-icon {
        color: #24558d;
        transition: transform .18s ease;
    }
    :is(.field select, .table-page-size select, .month-picker select):open::picker-icon {
        transform: rotate(180deg);
    }
}
@media (prefers-reduced-motion: reduce) {
    :is(.field select, .table-page-size select, .month-picker select)::picker-icon {
        transition: none;
    }
}
.field input:focus,
.field select:focus,
.search-form input:focus,
.report-form .field textarea:focus,
.report-monthly-input:focus-within { border-color: #4c94ed; outline-color: rgba(68, 139, 234, .2); }
.report-radio-option:has(input:checked),
.report-point-option:has(input:checked) { background: linear-gradient(125deg, #e5f0ff, #d5e7ff); }
.report-section-head > span { background: linear-gradient(145deg, #eaf3ff, #d8e8ff); }
.report-reason,
.report-period,
.report-point-choices,
.report-radio-choices { border-color: #d0e2f6; }
.reason-options { background: #f3f8ff; }

.table-pagination-controls,
th { background: #f3f8ff; }
th { color: #506987; }
td { border-top-color: #e5edf7; }
tbody tr:hover { background: #f4f9ff; }
.badge-user,
code { background: #eaf3ff; }

.login-intro { background: linear-gradient(145deg, #f4f9ff, #e1edfd); }
.login-announcements { position: relative; z-index: 2; align-self: stretch; width: auto; max-width: none; max-height: calc(100vh - 180px); margin: clamp(16px, 4vh, 52px) calc(28px - clamp(40px, 6vw, 92px)) 0; overflow-y: auto; }
.login-announcement { padding: 18px 22px; margin-bottom: 18px; border: 1px solid #cbdcf7; border-radius: 18px; background: rgba(255,255,255,.86); box-shadow: 0 12px 28px rgba(37,79,130,.09); overflow-wrap: anywhere; color: #12345c; font-size: var(--font-size-body, 15px); line-height: 1.65; }
.login-announcement p { margin: 0 0 12px; }
.login-announcement p:last-child { margin-bottom: 0; }
.login-announcement hr { border: 0; border-top: 1px solid #cbdcf7; margin: 16px 0; }
.announcement-form-panel { max-width: 980px; }
.announcement-form-panel textarea { min-height: 220px; resize: vertical; font-family: inherit; }
.announcement-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; margin-bottom: 8px; }
.announcement-toolbar button, .announcement-toolbar label { display: inline-flex; align-items: center; gap: 5px; min-height: 36px; padding: 5px 10px; border: 1px solid #cbdcf7; border-radius: 8px; background: #f5f9ff; color: var(--ink); font: inherit; cursor: pointer; }
.announcement-toolbar select { border: 0; background: transparent; font: inherit; }
.announcement-toolbar input[type=color] { width: 30px; height: 26px; padding: 0; border: 0; background: transparent; cursor: pointer; }
.announcement-schedule { padding: 14px 18px; border: 1px solid var(--line); border-radius: 14px; }
.announcement-schedule legend { padding: 0 7px; font-weight: 700; }
.announcement-schedule-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.announcement-schedule-grid > div { display: grid; gap: 12px; }
@media (max-width: 700px) { .announcement-schedule-grid { grid-template-columns: 1fr; } }
@media (max-width: 840px) {
    .login-intro.has-announcements { display: block; order: 2; min-height: 0; padding: 20px 24px; }
    .login-intro.has-announcements .brand, .login-intro.has-announcements .abstract-panel { display: none; }
    .login-intro.has-announcements .login-announcements { max-height: none; margin: 0; }
}
.login-panel { background: transparent; }
.login-card {
    padding: 24px 28px;
    border: 1px solid #d5e5fa;
    border-radius: 22px;
    background: linear-gradient(145deg, #fff, #f8fbff);
    box-shadow: var(--shadow);
}
.login-help { background: #edf5ff; border: 1px solid #d5e6fb; }

/* The public sign-in card follows the compact, centered reference layout. */
.login-form-panel { padding: 24px; }
.login-form-card {
    position: relative;
    isolation: isolate;
    overflow: hidden;
    width: min(450px, 100%);
    padding: 32px;
    border: 1px solid #e2eaf4;
    border-radius: 20px;
    background: #fff;
    box-shadow: 0 20px 48px rgba(37, 79, 130, .15);
}
.login-form-card::before {
    content: "";
    position: absolute;
    z-index: -1;
    top: -95px;
    left: 10%;
    right: 10%;
    height: 190px;
    border-radius: 50%;
    background: radial-gradient(ellipse, rgba(147, 197, 253, .38), transparent 70%);
    pointer-events: none;
}
.login-card-header { display: flex; flex-direction: column; align-items: center; margin-bottom: 26px; text-align: center; }
.login-card-logo { width: 82px; height: 82px; display: grid; place-items: center; margin-bottom: 16px; border: 1px solid #e8eff9; border-radius: 18px; background: #fff; box-shadow: 0 10px 24px rgba(37, 79, 130, .13); }
.login-card-logo img { width: 58px; height: 58px; object-fit: contain; }
.login-form-card h2 { margin: 0; font-size: 28px; line-height: 1.25; font-weight: 700; }
.login-form-card .form-lead { margin: 6px 0 0; font-size: 15px; }
.login-entry-form { gap: 20px; }
.login-entry-form .field { gap: 7px; }
.login-entry-form .field label { color: var(--text); font-weight: 600; }
.login-entry-form .field input { min-height: 50px; background: var(--surface-soft); }
.login-entry-form .field input::placeholder { color: #64748b; opacity: 1; }
.login-entry-form .password-wrap input { padding-right: 76px; }
.login-entry-form .password-toggle { top: 3px; right: 4px; min-height: 44px; }
.login-password-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.login-password-heading button, .login-signup a { color: var(--blue); font-weight: 600; text-decoration: none; }
.login-password-heading button { padding: 0; border: 0; background: none; cursor: pointer; }
.login-password-heading button:hover, .login-signup a:hover { text-decoration: underline; }
.login-entry-form .remember-choice { min-height: 32px; }
.login-entry-form .remember-choice input { flex: none; }
.login-entry-form .button-primary { min-height: 50px; border-radius: 10px; }
.login-signup { margin: 22px 0 0; text-align: center; color: var(--muted); }
.login-form-card .login-help { margin: 16px 0 0; padding: 9px 12px; line-height: 1.5; scroll-margin-top: 20px; }
.login-form-card .login-help[hidden] { display: none; }
.registration-window-panel { margin-bottom: 16px; padding: 20px 24px; }
.registration-window-header { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.registration-window-header h2 { margin: 0; color: var(--ink); }
.registration-window-status { color: var(--success); font-weight: 700; }
.registration-window-status.is-closed { color: var(--danger); }
.registration-window-fields { max-width: 750px; }
.registration-window-panel .form-actions { margin-top: 14px; }

@media (min-width: 841px) {
    .app-shell.sidebar-collapsed { --sidebar: 96px; }
    .sidebar-collapsed .sidebar { padding-inline: 10px; }
    .sidebar-collapsed .nav-list a { padding-inline: 0; }
    .sidebar-collapse-button { top: 25px; }
}
@media (max-width: 1050px) and (min-width: 841px) {
    .app-shell { --sidebar: 250px; }
}
@media (max-width: 840px) {
    .sidebar { inset: 0 auto 0 0; width: min(300px, 84vw); border-radius: 0 22px 22px 0; }
    .topbar { backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
}
@media (max-width: 620px) {
    .login-panel { background: transparent; }
    .login-card { padding: 18px 20px; }
    .login-form-panel { padding: 16px; align-items: center; }
    .login-form-card { padding: 28px 20px; }
}
