:root {
    color-scheme: light;
    --navy: #172033;
    --blue: #2458a6;
    --blue-dark: #19447f;
    --ink: #172033;
    --muted: #6a7280;
    --line: #dfe4ea;
    --surface: #ffffff;
    --background: #f2f4f7;
    --danger: #a12626;
    --success: #18734a;
}

* { box-sizing: border-box; }

html, body { min-height: 100%; }

body {
    margin: 0;
    background: var(--background);
    color: var(--ink);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    -webkit-font-smoothing: antialiased;
}

button, input { font: inherit; }
.d-none { display: none !important; }

.app-header {
    min-height: 106px;
    padding: calc(16px + env(safe-area-inset-top)) 20px 18px;
    background: var(--navy);
    color: #fff;
    display: flex;
    align-items: end;
    justify-content: space-between;
}

.app-header h1 { margin: 1px 0 0; font-size: 28px; line-height: 1; }
.eyebrow { color: #aebbd0; font-size: 12px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
.logout-form { margin: 0; }
.text-button { border: 0; background: transparent; color: #fff; padding: 10px 0 2px 14px; }

.app-main {
    width: min(100%, 620px);
    margin: 0 auto;
    padding: 22px 16px calc(28px + env(safe-area-inset-bottom));
}

h2 { margin: 0 0 6px; font-size: 24px; }
h3 { margin: 0 0 12px; font-size: 17px; }
.muted { color: var(--muted); }
.capture-intro { margin: 0 4px 18px; }
.capture-intro p { margin: 0; line-height: 1.4; }

.panel {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 20px;
    box-shadow: 0 8px 28px rgba(23, 32, 51, .07);
}

.login-panel { margin: 9vh auto 0; max-width: 430px; }
.login-panel h2, .login-panel > p { text-align: center; }
.panel-icon { width: 52px; height: 52px; margin: 0 auto 14px; border-radius: 16px; display: grid; place-items: center; background: #e9eef8; font-size: 24px; }

label { display: block; margin: 17px 0 7px; font-weight: 700; font-size: 14px; }
.optional { color: var(--muted); font-weight: 400; }

input[type="text"], input[type="password"], input[type="date"] {
    width: 100%;
    min-height: 50px;
    padding: 11px 13px;
    border: 1px solid #bfc7d1;
    border-radius: 11px;
    background: #fff;
    color: var(--ink);
    font-size: 16px;
}

input:focus, button:focus-visible, a:focus-visible { outline: 3px solid rgba(36, 88, 166, .3); outline-offset: 2px; }

.primary-button, .secondary-button {
    width: 100%;
    min-height: 52px;
    border-radius: 12px;
    padding: 13px 16px;
    font-weight: 750;
    text-align: center;
}

.primary-button { margin-top: 20px; border: 1px solid var(--blue); background: var(--blue); color: #fff; }
.primary-button:active, .account-button:active { background: var(--blue-dark); transform: translateY(1px); }
.secondary-button { border: 1px solid #bfc7d1; background: #fff; color: var(--ink); }
.link-button { display: flex; align-items: center; justify-content: center; text-decoration: none; }

.quick-dates { display: flex; gap: 8px; margin-top: 8px; }
.quick-dates button { border: 1px solid #cbd2db; border-radius: 999px; background: #fff; color: var(--blue); padding: 7px 13px; font-weight: 650; }

.photo-button { position: relative; width: min(100%, 290px); aspect-ratio: 1; overflow: hidden; border: 2px dashed #aab4c2; border-radius: 18px; display: flex; gap: 10px; align-items: center; justify-content: center; color: var(--blue); background: #f8faff; margin: 7px auto 0; cursor: pointer; }
.camera { font-size: 24px; }
.photo-placeholder { display: flex; flex-direction: column; align-items: center; gap: 9px; font-weight: 750; }
.photo-preview { display: none; width: 100%; height: 100%; object-fit: contain; background: #111; }
.photo-preview.is-visible { display: block; }
.photo-change { position: absolute; right: 10px; bottom: 10px; border-radius: 999px; padding: 7px 11px; color: #fff; background: rgba(0, 0, 0, .68); font-size: 12px; font-weight: 750; }
.photo-status { text-align: center; font-size: 13px; margin-top: 8px; }
.visually-hidden { position: absolute !important; width: 1px !important; height: 1px !important; overflow: hidden !important; clip: rect(0 0 0 0) !important; white-space: nowrap !important; }

.add-page-button { margin-top: 16px; color: var(--blue); border-color: var(--blue); background: #f8faff; }
.or-divider { display: flex; align-items: center; gap: 10px; margin: 20px 0 2px; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .05em; }
.or-divider::before, .or-divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }

.account-section { margin-top: 22px; }
.account-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 11px; }
.account-button { min-height: 68px; border: 0; border-radius: 14px; padding: 10px; background: var(--blue); color: #fff; font-size: 16px; font-weight: 750; box-shadow: 0 5px 12px rgba(36, 88, 166, .18); }

.error-message { margin: 0 0 14px; border: 1px solid #e4b6b6; border-radius: 12px; padding: 12px 13px; color: var(--danger); background: #fff4f4; line-height: 1.4; }
.success-message { display: flex; align-items: flex-start; gap: 11px; margin: 0 0 14px; border: 1px solid #a9d8bf; border-radius: 14px; padding: 12px 13px; color: #105d3a; background: #ecf8f1; line-height: 1.35; }
.success-message__mark { flex: 0 0 auto; width: 25px; height: 25px; display: grid; place-items: center; border-radius: 50%; color: #fff; background: var(--success); font-weight: 800; }
.success-message div div { margin-top: 2px; font-size: 13px; }

button:disabled { opacity: .55; cursor: wait; transform: none !important; }
.is-uploading .photo-button, .is-uploading .quick-dates { pointer-events: none; opacity: .55; }
.upload-overlay { position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center; padding: 24px; background: rgba(23, 32, 51, .62); backdrop-filter: blur(3px); }
.upload-overlay[hidden] { display: none; }
.upload-overlay__card { width: min(100%, 310px); display: flex; flex-direction: column; align-items: center; gap: 10px; border-radius: 18px; padding: 24px; color: var(--ink); background: #fff; box-shadow: 0 18px 50px rgba(0, 0, 0, .25); text-align: center; }
.upload-overlay__card span:last-child { color: var(--muted); font-size: 13px; }
.upload-spinner { width: 34px; height: 34px; border: 4px solid #dce5f2; border-top-color: var(--blue); border-radius: 50%; animation: upload-spin .75s linear infinite; }
@keyframes upload-spin { to { transform: rotate(360deg); } }

.success-panel { margin-top: 8vh; text-align: center; }
.success-mark { width: 64px; height: 64px; margin: 0 auto 14px; display: grid; place-items: center; border-radius: 50%; background: #e1f5ea; color: var(--success); font-size: 34px; font-weight: 800; }
.success-actions { margin-top: 22px; display: grid; gap: 11px; }
.success-actions .primary-button { margin-top: 0; }

@media (max-width: 370px) {
    .account-grid { grid-template-columns: 1fr; }
}
