:root {
    --bg: #f4f2ee;
    --paper: rgba(255, 255, 255, 0.94);
    --ink: #1f2023;
    --muted: #74777d;
    --line: #b7bcc3;
    --accent: #f2eee6;
    --stroke: 0.65px;
    --stroke-soft: 0.35px;
    --shadow: 0 8px 18px rgba(31, 32, 35, 0.025);
}

* {
    box-sizing: border-box;
}

html {
    font-size: 75%;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
    color: var(--ink);
    background: linear-gradient(180deg, #f8f7f4 0%, #f4f2ee 100%);
}

a {
    color: inherit;
    text-decoration: none;
}

button,
input,
select,
textarea {
    font: inherit;
}

.app-shell {
    max-width: 500px;
    margin: 0 auto;
    min-height: 100vh;
    padding: 14px 12px 18px;
}

.topbar,
.panel {
    background: var(--paper);
    border: var(--stroke) solid var(--line);
    box-shadow: var(--shadow);
}

.topbar {
    display: grid;
    gap: 5px;
    text-align: center;
    padding: 12px 10px 10px;
    margin-bottom: 8px;
}

.section-kicker {
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 0.16em;
    font-size: 0.7rem;
    color: var(--muted);
}

.eyebrow {
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-size: 2.8rem;
    line-height: 1;
    font-weight: 200;
    color: var(--ink);
}

h2,
h3 {
    margin: 0;
    font-family: inherit;
    font-weight: 500;
    line-height: 1.08;
}

h2 {
    font-size: 1.65rem;
}

h3 {
    font-size: 1.05rem;
}

.inline-links {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
    font-size: 1rem;
}

.inline-links a {
    padding: 0 1px;
}

.inline-links a + a::before {
    content: "|";
    margin-right: 4px;
    color: var(--muted);
}

.inline-links .active {
    font-weight: 600;
}

.nav-links {
    font-weight: 500;
}

.utility-links {
    font-size: 0.95rem;
}

.driver-switcher select {
    min-width: 180px;
    border: var(--stroke) solid var(--line);
    background: #fff;
    color: var(--ink);
    padding: 5px 8px;
}

.user-meta,
.muted,
.holiday-item p,
.history-item p {
    margin: 0;
    color: var(--muted);
    line-height: 1.45;
}

.user-meta {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
    font-size: 0.92rem;
}

.ghost-link {
    text-decoration: underline;
}

.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 3px 6px;
    border: var(--stroke-soft) solid var(--line);
    background: #fff;
    font-size: 0.82rem;
}

.badge.soft {
    background: var(--accent);
}

.panel {
    padding: 8px;
    margin-bottom: 8px;
}

.content {
    display: grid;
    gap: 0;
}

.subtle-panel {
    background: rgba(255, 255, 255, 0.72);
}

.messages {
    display: grid;
    gap: 5px;
    margin-bottom: 7px;
}

.message {
    padding: 6px 8px;
    border: var(--stroke-soft) solid var(--line);
    background: #fff;
}

.stack-form,
.holiday-list,
.history-list,
.timeline,
.read-only-list {
    display: grid;
    gap: 6px;
}

.field {
    display: grid;
    gap: 4px;
}

.field span {
    font-size: 0.9rem;
    color: var(--muted);
}

.field input,
.field select,
.field textarea {
    width: 100%;
    border: var(--stroke) solid var(--line);
    background: #fff;
    color: var(--ink);
    padding: 6px 8px;
    outline: none;
}

.field textarea {
    resize: vertical;
}

.primary-button,
.secondary-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: var(--stroke) solid var(--line);
    background: #fff;
    color: var(--ink);
    padding: 6px 10px;
    font-weight: 500;
    cursor: pointer;
}

.secondary-button:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.small {
    padding: 5px 8px;
    font-size: 0.92rem;
}

.button-row,
.inline-form,
.section-header,
.today-heading {
    display: flex;
    align-items: center;
    gap: 5px;
    flex-wrap: wrap;
}

.card-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
    margin-top: 7px;
}

.summary-card {
    padding: 7px;
    border: var(--stroke-soft) solid var(--line);
    background: #fff;
    display: grid;
    gap: 3px;
}

.summary-card span {
    color: var(--muted);
    font-size: 0.9rem;
}

.summary-card strong {
    font-size: 1.08rem;
    font-weight: 500;
}

.summary-card.accent {
    background: var(--accent);
}

.today-card {
    display: grid;
    gap: 7px;
    margin-top: 7px;
}

.gps-status {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    padding: 6px 8px;
    border: var(--stroke-soft) solid var(--line);
    background: #fff;
}

.gps-status[data-state="ready"] {
    background: #f8faf7;
}

.gps-status[data-state="error"] {
    background: #fff8f6;
}

.timeline div,
.read-only-list div,
.history-item,
.holiday-item,
.month-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
}

.timeline div,
.read-only-list div,
.history-item,
.holiday-item,
.month-banner {
    padding: 6px 8px;
    border: var(--stroke-soft) solid var(--line);
    background: #fff;
}

.wireframe-form {
    margin-top: 7px;
}

.rule-sheet {
    display: grid;
    gap: 5px;
}

.rule-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 6px;
}

.rule-label,
.rule-value {
    min-height: 29px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 5px 8px;
    border: var(--stroke) solid var(--line);
    background: #fff;
    text-align: center;
}

.rule-label {
    font-weight: 500;
}

.rule-value input,
.rule-value select {
    border: 0;
    padding: 0;
    text-align: center;
}

.inline-link {
    min-width: 96px;
}

.top-spacer {
    margin-top: 7px;
}

.four-up form {
    flex: 1 1 calc(50% - 8px);
}

.four-up button {
    width: 100%;
}

.auth-panel {
    margin-top: 8vh;
}

.form-errors {
    padding: 6px 8px;
    border: var(--stroke-soft) solid var(--line);
    background: #fff;
    color: var(--ink);
}

@media (max-width: 420px) {
    .eyebrow {
        font-size: 2.4rem;
    }

    .card-grid {
        grid-template-columns: 1fr;
    }

    .history-item,
    .holiday-item,
    .month-banner,
    .timeline div,
    .read-only-list div,
    .rule-row {
        align-items: flex-start;
        flex-direction: column;
    }

    .four-up form {
        flex-basis: 100%;
    }
}
