:root {
    color-scheme: light;
    --navy: #172555;
    --blue: #0056a4;
    --sky: #54afdb;
    --ink: #17213a;
    --muted: #677189;
    --line: #dfe5ee;
    --soft: #f2f6fb;
    --white: #ffffff;
    --success: #168259;
    --warning: #ae6a12;
    --danger: #b83636;
    --shadow: 0 18px 55px rgba(23, 37, 85, 0.12);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    min-width: 320px;
    min-height: 100vh;
    color: var(--ink);
    background:
        radial-gradient(circle at 95% 5%, rgba(84, 175, 219, 0.2), transparent 28rem),
        linear-gradient(180deg, #f7f9fc 0%, #eef3f8 100%);
}

button, input { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }

.page-shell { min-height: 100vh; }

.site-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 76px;
    padding: 14px clamp(20px, 5vw, 72px);
    color: var(--white);
    background: var(--navy);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    color: inherit;
    text-decoration: none;
}

.brand-mark {
    display: grid;
    width: 42px;
    height: 42px;
    place-items: center;
    border: 2px solid rgba(255, 255, 255, 0.75);
    border-radius: 50%;
    font-size: 24px;
    font-weight: 800;
}

.brand strong, .brand small { display: block; }
.brand strong { font-size: 18px; letter-spacing: 0.02em; }
.brand small { margin-top: 2px; color: #c8d7ef; font-size: 12px; }

.text-button {
    padding: 8px 0;
    border: 0;
    color: #dce8fa;
    background: transparent;
}
.text-button:hover { color: var(--white); }

.centered-view {
    display: grid;
    min-height: calc(100vh - 76px);
    padding: 36px 20px;
    place-items: center;
}

.spinner {
    width: 42px;
    height: 42px;
    border: 4px solid rgba(0, 86, 164, 0.16);
    border-top-color: var(--blue);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.login-card {
    width: min(100%, 470px);
    padding: clamp(28px, 5vw, 50px);
    border: 1px solid rgba(223, 229, 238, 0.9);
    border-radius: 24px;
    background: rgba(255, 255, 255, 0.94);
    box-shadow: var(--shadow);
}

.eyebrow {
    margin: 0 0 8px;
    color: var(--blue);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.13em;
    text-transform: uppercase;
}

h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 14px; font-size: clamp(31px, 5vw, 48px); line-height: 1.03; letter-spacing: -0.035em; }
h2 { margin-bottom: 8px; font-size: clamp(24px, 3vw, 32px); letter-spacing: -0.025em; }
h3 { margin-bottom: 14px; }
.lead { color: var(--muted); font-size: 17px; line-height: 1.6; }

form { margin-top: 30px; }
label { display: block; margin-bottom: 8px; font-size: 14px; font-weight: 750; }

.password-field { position: relative; }
.password-field input {
    width: 100%;
    min-height: 52px;
    padding: 0 64px 0 14px;
    border: 1px solid #bcc7d8;
    border-radius: 10px;
    color: var(--ink);
    background: var(--white);
}
.password-field input:focus { outline: 3px solid rgba(84, 175, 219, 0.28); border-color: var(--blue); }
.password-field button {
    position: absolute;
    top: 50%;
    right: 12px;
    padding: 5px;
    border: 0;
    color: var(--blue);
    background: transparent;
    transform: translateY(-50%);
    font-size: 13px;
    font-weight: 750;
}

.primary-button, .secondary-button {
    display: inline-flex;
    min-height: 46px;
    align-items: center;
    justify-content: center;
    padding: 0 18px;
    border-radius: 9px;
    font-weight: 780;
    transition: transform 120ms ease, box-shadow 120ms ease, opacity 120ms ease;
}
.primary-button { border: 1px solid var(--blue); color: var(--white); background: var(--blue); }
.secondary-button { border: 1px solid #aab9cc; color: var(--navy); background: var(--white); }
.primary-button:hover, .secondary-button:hover { transform: translateY(-1px); box-shadow: 0 8px 18px rgba(23, 37, 85, 0.12); }
.primary-button:disabled, .secondary-button:disabled { cursor: wait; opacity: 0.55; transform: none; box-shadow: none; }
.full-width { width: 100%; margin-top: 18px; }
.form-error { margin: 10px 0 -6px; color: var(--danger); font-size: 14px; }
.privacy-note { margin: 24px 0 0; color: var(--muted); font-size: 12px; line-height: 1.5; }

.portal { width: min(1180px, calc(100% - 40px)); margin: 0 auto; padding: 48px 0 70px; }

.hero {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 40px;
    align-items: end;
    margin-bottom: 26px;
}
.hero h1 { max-width: 720px; margin-bottom: 10px; }
.hero .lead { max-width: 700px; margin-bottom: 0; }
.hero-total { min-width: 185px; padding: 20px 22px; border-left: 3px solid var(--sky); }
.hero-total span, .hero-total small { display: block; color: var(--muted); }
.hero-total strong { display: block; margin: 3px 0; color: var(--navy); font-size: 30px; }

.progress-card, .collection-panel {
    border: 1px solid var(--line);
    border-radius: 18px;
    background: var(--white);
    box-shadow: 0 8px 24px rgba(23, 37, 85, 0.06);
}
.progress-card { padding: 24px 26px; }
.progress-copy { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.progress-copy h2 { margin: 0; font-size: 22px; }
.progress-copy > strong { color: var(--blue); font-size: 26px; }
.progress-track { height: 10px; margin: 18px 0 10px; overflow: hidden; border-radius: 999px; background: #e8edf4; }
.progress-track span { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--blue), var(--sky)); transition: width 250ms ease; }
.progress-card > p { margin: 0; color: var(--muted); font-size: 13px; }

.notice { display: flex; gap: 14px; align-items: flex-start; margin: 18px 0 28px; padding: 17px 20px; border: 1px solid #c7deee; border-radius: 12px; background: #eaf6fc; }
.notice > span { display: grid; width: 28px; height: 28px; flex: 0 0 auto; place-items: center; border-radius: 50%; color: var(--white); background: var(--blue); font-weight: 800; }
.notice p { margin: 3px 0 0; color: #506078; font-size: 14px; line-height: 1.5; }

.tabs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-bottom: 14px; }
.tab { padding: 18px 22px; border: 1px solid var(--line); border-radius: 13px; text-align: left; color: var(--ink); background: rgba(255, 255, 255, 0.64); }
.tab span, .tab small { display: block; }
.tab span { font-weight: 800; }
.tab small { margin-top: 4px; color: var(--muted); }
.tab.active { border-color: var(--blue); color: var(--blue); background: var(--white); box-shadow: 0 7px 20px rgba(0, 86, 164, 0.1); }

.collection-panel { padding: clamp(22px, 4vw, 38px); }
.section-heading { display: flex; justify-content: space-between; gap: 26px; padding-bottom: 24px; border-bottom: 1px solid var(--line); }
.section-heading p:last-child { max-width: 720px; margin-bottom: 0; color: var(--muted); line-height: 1.55; }
.collection-stats { min-width: 150px; text-align: right; }
.collection-stats strong, .collection-stats span { display: block; }
.collection-stats strong { color: var(--navy); font-size: 24px; }
.collection-stats span { margin-top: 4px; color: var(--muted); font-size: 13px; }

.package-list { display: grid; gap: 12px; margin-top: 24px; }
.package-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 20px;
    align-items: center;
    padding: 20px;
    border: 1px solid var(--line);
    border-radius: 12px;
}
.package-card.confirmed { border-color: #a7dbc7; background: #f5fcf9; }
.package-name { margin: 0 0 7px; font-size: 17px; overflow-wrap: anywhere; }
.package-meta { display: flex; flex-wrap: wrap; gap: 7px 15px; color: var(--muted); font-size: 13px; }
.package-meta code { color: #47546c; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.package-actions { display: flex; align-items: center; gap: 10px; }
.status-pill { display: inline-flex; align-items: center; gap: 7px; margin-top: 12px; font-size: 13px; font-weight: 750; }
.status-pill::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #9aa5b5; }
.status-pill.started { color: var(--warning); }
.status-pill.started::before { background: var(--warning); }
.status-pill.confirmed { color: var(--success); }
.status-pill.confirmed::before { background: var(--success); }
.confirm-control { display: inline-flex; align-items: center; gap: 7px; color: #40506a; font-size: 13px; font-weight: 700; white-space: nowrap; }
.confirm-control input { width: 18px; height: 18px; accent-color: var(--success); }

.documents { margin-top: 34px; padding-top: 26px; border-top: 1px solid var(--line); }
.document-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 10px; }
.document-card { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 15px 16px; border: 1px solid var(--line); border-radius: 10px; background: var(--soft); }
.document-card strong, .document-card small { display: block; }
.document-card small { margin-top: 3px; color: var(--muted); }
.empty-state { padding: 40px 20px; border: 1px dashed #bdc8d7; border-radius: 12px; color: var(--muted); text-align: center; }

.portal-footer { padding: 28px 8px 0; color: var(--muted); text-align: center; font-size: 13px; }
.toast { position: fixed; right: 22px; bottom: 22px; z-index: 5; max-width: min(390px, calc(100% - 44px)); padding: 14px 18px; border-radius: 10px; color: var(--white); background: var(--navy); box-shadow: var(--shadow); }
.toast.error { background: var(--danger); }

@media (max-width: 760px) {
    .site-header { min-height: 68px; padding: 12px 20px; }
    .brand small { display: none; }
    .centered-view { min-height: calc(100vh - 68px); }
    .portal { width: min(100% - 28px, 1180px); padding-top: 30px; }
    .hero { grid-template-columns: 1fr; gap: 20px; }
    .hero-total { padding: 4px 0 4px 16px; }
    .tabs { grid-template-columns: 1fr; }
    .section-heading { display: block; }
    .collection-stats { margin-top: 18px; text-align: left; }
    .package-card { grid-template-columns: 1fr; }
    .package-actions { align-items: stretch; flex-direction: column; }
    .package-actions button { width: 100%; }
    .confirm-control { justify-content: center; min-height: 40px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
