:root {
    --ink: #17241f;
    --ink-soft: #3d4f48;
    --paper: #efece6;
    --card: #fffcf8;
    --line: #e3ddd3;
    --accent: #0e7c66;
    --accent-dark: #0b5e4d;
    --shadow: 0 24px 60px rgba(23, 36, 31, 0.12);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: "Outfit", sans-serif;
    color: var(--ink);
    background: var(--paper);
}

h1, h2, .login-story h1 {
    font-family: "Fraunces", serif;
    font-weight: 560;
    letter-spacing: -0.03em;
}

.brand-mark {
    width: 46px;
    height: 46px;
    border-radius: 14px;
    background: var(--ink);
    display: grid;
    place-items: center;
}

.brand-mark span,
.brand-mark span::before {
    display: block;
    background: #f4f1ea;
    border-radius: 99px;
}

.brand-mark span {
    width: 16px;
    height: 4px;
    position: relative;
}

.brand-mark span::before {
    content: "";
    width: 4px;
    height: 16px;
    position: absolute;
    left: 6px;
    top: -6px;
}

.brand-mark-sm { width: 36px; height: 36px; border-radius: 12px; }

.btn-ink {
    background: var(--ink);
    color: #f7f4ee;
    border: 0;
    border-radius: 12px;
    min-height: 46px;
    font-weight: 580;
}

.btn-ink:hover { background: #0d1814; color: white; }

.btn-quiet {
    background: transparent;
    border: 0;
    color: var(--ink-soft);
    border-radius: 10px;
    min-height: 40px;
}

.btn-quiet:hover { background: rgba(23, 36, 31, 0.06); color: var(--ink); }

.page-login {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 28px 16px;
}

.login-stage {
    width: min(980px, 100%);
}

.login-card {
    width: min(980px, 100%);
    min-height: min(640px, calc(100vh - 56px));
    display: grid;
    grid-template-columns: 1.05fr 0.95fr;
    background: var(--card);
    border-radius: 28px;
    overflow: hidden;
    box-shadow: var(--shadow);
}

.login-story {
    background:
        radial-gradient(circle at 20% 20%, rgba(14, 124, 102, 0.35), transparent 42%),
        linear-gradient(160deg, #1c2c27 0%, #101815 70%);
    color: #f6f3ed;
    padding: 48px 42px;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
}

.brand-kicker {
    letter-spacing: 0.14em;
    text-transform: uppercase;
    font-size: 12px;
    opacity: 0.72;
    margin-bottom: auto;
}

.login-story h1 {
    font-size: clamp(34px, 4vw, 48px);
    line-height: 1.05;
    margin: 0 0 18px;
}

.login-story blockquote {
    margin: 0;
    font-size: 17px;
    line-height: 1.45;
    color: rgba(246, 243, 237, 0.82);
}

.story-sign {
    margin: 22px 0 0;
    font-size: 13px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    opacity: 0.62;
}

.login-form {
    padding: 48px 42px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.login-form h2 { font-size: 34px; margin: 18px 0 6px; }

.password-field { position: relative; }

.password-field .form-control { padding-right: 46px; }

.password-toggle {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    border: 0;
    background: transparent;
    color: var(--ink-soft);
    width: 36px;
    height: 36px;
}

.form-control, .form-select {
    min-height: 46px;
    border-radius: 12px;
    border-color: var(--line);
    background: #fff;
}

.form-control:focus, .form-select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 4px rgba(14, 124, 102, 0.12);
}

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

.app-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 16px 28px;
    position: sticky;
    top: 0;
    background: rgba(239, 236, 230, 0.92);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(23, 36, 31, 0.06);
    z-index: 5;
}

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

.app-brand img { width: 36px; height: 36px; border-radius: 12px; object-fit: cover; }

.app-brand strong, .app-brand small { display: block; }

.app-brand small { color: var(--ink-soft); font-size: 12px; }

.app-brand strong { font-size: 15px; line-height: 1.2; }

.user-chip {
    display: inline-flex;
    align-items: center;
    max-width: 180px;
    padding: 8px 12px;
    border-radius: 999px;
    background: #fff;
    border: 1px solid var(--line);
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.icon-btn, .btn-line {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: #fff;
    color: var(--ink);
    display: inline-grid;
    place-items: center;
}

.btn-line {
    width: auto;
    padding: 0 14px;
    font-weight: 580;
}

.icon-btn:hover, .btn-line:hover { background: #f7f4ee; color: var(--ink); }

.app-main { width: min(1080px, calc(100% - 32px)); margin: 10px auto 48px; }

.eyebrow {
    color: var(--accent-dark);
    margin-bottom: 6px;
    font-size: 14px;
}

.hero-copy h1 { font-size: clamp(34px, 4vw, 48px); margin: 0 0 8px; }

.hero-copy p { max-width: 62ch; color: var(--ink-soft); }

.stat-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
    margin: 28px 0;
}

.stat-card, .day-card, .status-banner {
    background: var(--card);
    border-radius: 22px;
    border: 1px solid rgba(23, 36, 31, 0.05);
}

.stat-card { padding: 18px 18px 16px; }

.stat-icon {
    width: 40px;
    height: 40px;
    border-radius: 13px;
    display: inline-grid;
    place-items: center;
    background: #e7f3ef;
    color: var(--accent-dark);
    font-size: 18px;
}

.stat-icon-lg { width: 52px; height: 52px; border-radius: 16px; font-size: 22px; }

.stat-card strong {
    display: block;
    font-family: "Fraunces", serif;
    font-size: 34px;
    line-height: 1;
    margin-top: 16px;
}

.stat-card > span:last-child { color: var(--ink-soft); font-size: 14px; }

.status-banner {
    padding: 12px 16px;
    margin-bottom: 18px;
    color: var(--accent-dark);
    background: #e7f3ef;
}

.day-card { padding: 8px 8px 8px; margin-top: 6px; }

.day-card header {
    display: flex;
    justify-content: space-between;
    align-items: end;
    padding: 16px 16px 8px;
}

.day-card h2 { font-size: 28px; margin: 0; }

.day-card header p { margin: 4px 0 0; color: var(--ink-soft); }

.day-empty {
    margin: 8px;
    min-height: 220px;
    border-radius: 16px;
    border: 1px dashed #d9d2c7;
    background: #f7f4ee;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 8px;
    padding: 28px 20px;
}

.day-empty strong { font-size: 18px; }

.day-empty p { max-width: 42ch; margin: 0; color: var(--ink-soft); }

.reveal.pending {
    opacity: 0;
    transform: translateY(14px);
}

.reveal.pending.is-visible {
    opacity: 1;
    transform: none;
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.drawer-root[hidden] { display: none; }

.drawer-root.is-open,
.drawer-root.is-closing {
    position: fixed;
    inset: 0;
    z-index: 40;
    display: block;
}

html.drawer-open,
body.drawer-open { overflow: hidden; }

.drawer-backdrop {
    position: absolute;
    inset: 0;
    border: 0;
    background: rgba(23, 36, 31, 0.42);
    backdrop-filter: blur(4px);
    animation: backdrop-in 0.28s ease forwards;
}

.drawer-root.is-closing .drawer-backdrop { animation: backdrop-out 0.22s ease forwards; }

.drawer {
    position: absolute;
    top: 0;
    right: 0;
    height: 100%;
    height: 100dvh;
    width: min(520px, 100%);
    background: #fff;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: -16px 0 40px rgba(23, 36, 31, 0.12);
    animation: drawer-in 0.32s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

.drawer-root.is-closing .drawer { animation: drawer-out 0.22s ease forwards; }

@keyframes drawer-in {
    from { transform: translateX(100%); }
    to { transform: translateX(0); }
}

@keyframes drawer-out {
    from { transform: translateX(0); }
    to { transform: translateX(100%); }
}

@keyframes backdrop-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes backdrop-out { from { opacity: 1; } to { opacity: 0; } }

.drawer-head, .drawer-foot {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 18px 22px;
    flex-shrink: 0;
    background: #fff;
}

.drawer-head { border-bottom: 1px solid var(--line); }

.drawer-head h2 { font-size: 26px; margin: 0; }

.drawer-head p { margin: 4px 0 0; color: var(--ink-soft); font-size: 14px; }

.drawer-form { display: flex; flex-direction: column; min-height: 0; flex: 1; }

.drawer-body {
    overflow: auto;
    overscroll-behavior: contain;
    padding: 20px 22px 28px;
    min-height: 0;
}

.drawer-foot {
    border-top: 1px solid var(--line);
    padding-bottom: max(16px, env(safe-area-inset-bottom));
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px 14px;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.field-span { grid-column: 1 / -1; }

.field > span { font-size: 13px; color: var(--ink-soft); }

.field .form-control,
.field .form-select { width: 100%; max-width: 100%; }

.file-picker-row {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    min-height: 46px;
    padding: 6px 10px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fff;
}

.file-picker-row input {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

.file-picker-btn {
    flex-shrink: 0;
    border-radius: 8px;
    background: var(--ink);
    color: #f7f4ee;
    font-size: 13px;
    padding: 6px 10px;
}

.file-picker-name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--ink-soft);
    font-size: 14px;
}

.drawer-head > div { min-width: 0; flex: 1; }

.drawer-head p {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.drawer-section { margin: 26px 0 14px; }

.drawer-section h3 { font-size: 20px; margin: 0 0 4px; }

.drawer-section p { margin: 0; color: var(--ink-soft); font-size: 14px; }

.driver-popover {
    border-radius: 16px;
    box-shadow: var(--shadow);
}

.driver-popover-title {
    font-family: "Fraunces", serif;
    font-size: 20px;
    color: var(--ink);
}

.driver-popover-description { color: var(--ink-soft); }

.driver-popover-footer button {
    border-radius: 10px;
    text-shadow: none;
}

@media (max-width: 860px) {
    .login-card { grid-template-columns: 1fr; min-height: 0; }
    .login-story { min-height: 0; padding: 28px 24px 24px; }
    .login-story h1 { font-size: 30px; }
    .login-form { padding: 28px 22px 32px; }
    .stat-grid { grid-template-columns: 1fr 1fr; }
    .app-top { padding: 12px 14px; }
    .user-chip { display: none; }
    .form-grid { grid-template-columns: 1fr; }
    .field-span { grid-column: auto; }
    .drawer { width: 100%; }
}

@media (max-width: 560px) {
    .stat-grid { grid-template-columns: 1fr; }
    .hero-copy h1 { font-size: 32px; }
    .page-login { padding: 12px; }
}

@media (prefers-reduced-motion: reduce) {
    .drawer,
    .drawer-backdrop,
    .reveal.pending,
    .reveal.pending.is-visible {
        animation: none;
        transition: none;
    }
}
