/* Lakeside Café — Reservations. No frameworks, no CDNs. */

:root {
    --bg: #f5f3ee;
    --surface: #ffffff;
    --surface-2: #f0ede5;
    --text: #18211f;
    --muted: #5d6966;
    --border: #e2ddd1;
    --brand: #0f766e;
    --brand-strong: #0b5e57;
    --brand-tint: #e0f2ef;
    --on-brand: #ffffff;
    --accent: #b45309;

    --pending-bg: #fdf1dc;
    --pending-fg: #8a4b06;
    --confirmed-bg: #dcf3e6;
    --confirmed-fg: #0b6b3a;
    --cancelled-bg: #fbe3e1;
    --cancelled-fg: #a2271c;
    --neutral-bg: #ebe8e1;
    --neutral-fg: #4d5754;
    --danger: #b42318;
    --danger-strong: #912018;

    --radius: 14px;
    --radius-sm: 10px;
    --shadow: 0 1px 2px rgb(24 33 31 / 0.05), 0 6px 20px rgb(24 33 31 / 0.06);
    --focus: 0 0 0 3px rgb(15 118 110 / 0.35);
    --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
    --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;

    color-scheme: light;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #0e1413;
        --surface: #151d1c;
        --surface-2: #1b2524;
        --text: #e6ecea;
        --muted: #9aa9a5;
        --border: #293533;
        --brand: #2bb5a6;
        --brand-strong: #5fd4c6;
        --brand-tint: #16302d;
        --on-brand: #06201d;
        --accent: #f0a53a;

        --pending-bg: #3a2a10;
        --pending-fg: #f6c77a;
        --confirmed-bg: #123524;
        --confirmed-fg: #7fdca6;
        --cancelled-bg: #3d1a17;
        --cancelled-fg: #f4a29a;
        --neutral-bg: #242e2d;
        --neutral-fg: #b3bfbc;
        --danger: #e5574b;
        --danger-strong: #f07b70;

        --shadow: 0 1px 2px rgb(0 0 0 / 0.3), 0 8px 24px rgb(0 0 0 / 0.25);
        --focus: 0 0 0 3px rgb(43 181 166 / 0.45);

        color-scheme: dark;
    }
}

/* ---------- Base ---------- */

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    font-size: 16px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

img,
svg {
    display: block;
    max-width: 100%;
}

a {
    color: var(--brand);
    text-underline-offset: 3px;
}

a:hover {
    color: var(--brand-strong);
}

h1,
h2,
h3 {
    margin: 0 0 0.4em;
    line-height: 1.2;
    letter-spacing: -0.01em;
}

h1 {
    font-size: clamp(1.6rem, 1.2rem + 1.6vw, 2.25rem);
}

h2 {
    font-size: 1.15rem;
}

p {
    margin: 0 0 1em;
}

code,
pre {
    font-family: var(--mono);
    font-size: 0.9em;
}

code {
    background: var(--surface-2);
    border-radius: 6px;
    padding: 0.1em 0.35em;
    overflow-wrap: anywhere;
}

pre {
    margin: 0 0 1em;
    padding: 14px 16px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow-x: auto;
}

pre code {
    background: none;
    padding: 0;
    overflow-wrap: normal;
}

:focus-visible {
    outline: none;
    box-shadow: var(--focus);
    border-radius: 6px;
}

.container {
    width: min(1120px, 100% - 32px);
    margin-inline: auto;
}

.muted {
    color: var(--muted);
}

.small {
    font-size: 0.875rem;
}

.visually-hidden {
    position: absolute !important;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
}

.skip-link {
    position: absolute;
    left: 16px;
    top: -60px;
    z-index: 10;
    padding: 8px 14px;
    background: var(--brand);
    color: var(--on-brand);
    border-radius: var(--radius-sm);
}

.skip-link:focus {
    top: 12px;
}

/* ---------- Header & footer ---------- */

.site-header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}

.header-inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px 24px;
    padding-block: 14px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text);
    text-decoration: none;
}

.brand img {
    border-radius: 10px;
}

.brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.15;
}

.brand-name {
    font-weight: 700;
    font-size: 1.1rem;
}

.brand-tag {
    color: var(--muted);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.main-nav {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
}

.nav-link {
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    color: var(--muted);
    font-weight: 600;
    text-decoration: none;
}

.nav-link:hover {
    color: var(--text);
    background: var(--surface-2);
}

.nav-link[aria-current="page"] {
    color: var(--brand-strong);
    background: var(--brand-tint);
}

.nav-cta {
    margin-left: 8px;
}

.main {
    flex: 1;
    padding-block: 32px 48px;
}

.site-footer {
    border-top: 1px solid var(--border);
    background: var(--surface);
    font-size: 0.875rem;
}

.footer-inner {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 4px 24px;
    padding-block: 18px;
}

.footer-inner p {
    margin: 0;
}

/* ---------- Buttons ---------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
    padding: 10px 18px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    font: inherit;
    font-weight: 600;
    line-height: 1.2;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.btn-sm {
    min-height: 36px;
    padding: 6px 14px;
    font-size: 0.9rem;
}

.btn-lg {
    min-height: 52px;
    padding: 12px 24px;
    font-size: 1.05rem;
}

.btn-primary {
    background: var(--brand);
    color: var(--on-brand);
}

.btn-primary:hover {
    background: var(--brand-strong);
    color: var(--on-brand);
}

.btn-secondary {
    background: var(--surface);
    border-color: var(--border);
    color: var(--text);
}

.btn-secondary:hover {
    background: var(--surface-2);
    color: var(--text);
}

.btn-ghost {
    background: transparent;
    color: var(--muted);
}

.btn-ghost:hover {
    color: var(--text);
    background: var(--surface-2);
}

.btn-danger {
    background: var(--surface);
    border-color: var(--danger);
    color: var(--danger);
}

.btn-danger:hover {
    background: var(--danger);
    color: #fff;
}

form[aria-busy="true"] .btn {
    opacity: 0.7;
    cursor: progress;
}

/* ---------- Page structure ---------- */

.page-head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 24px;
}

.page-head > div {
    min-width: 0;
}

.page-head h1 {
    overflow-wrap: anywhere;
}

.eyebrow {
    margin: 0 0 6px;
    color: var(--accent);
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.eyebrow a {
    color: inherit;
}

.lead {
    color: var(--muted);
    font-size: 1.05rem;
    margin: 0;
}

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px;
    margin-bottom: 24px;
    min-width: 0;
}

.card-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.card-head h2 {
    margin: 0;
}

.grid-2 {
    display: grid;
    gap: 0 24px;
}

@media (min-width: 880px) {
    .grid-2 {
        grid-template-columns: 1fr 1fr;
    }

    .grid-detail {
        grid-template-columns: 3fr 2fr;
    }
}

.empty {
    padding: 28px 16px;
    text-align: center;
    color: var(--muted);
    border: 1px dashed var(--border);
    border-radius: var(--radius-sm);
}

.empty p {
    margin-bottom: 12px;
}

.empty p:last-child {
    margin-bottom: 0;
}

.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.actions form {
    margin: 0;
}

.actions-center {
    justify-content: center;
}

.back-link {
    margin: 20px 0 0;
    font-size: 0.9rem;
}

/* ---------- Dashboard ---------- */

.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 18px 20px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.stat-accent {
    background: var(--brand);
    border-color: var(--brand);
    color: var(--on-brand);
}

.stat-label {
    font-size: 0.85rem;
    font-weight: 600;
    opacity: 0.85;
}

.stat-value {
    font-size: 2.25rem;
    font-weight: 750;
    line-height: 1.1;
    font-variant-numeric: tabular-nums;
}

.stat-note {
    font-size: 0.85rem;
    opacity: 0.8;
}

.booking-list,
.dish-list,
.menu-items,
.steps {
    list-style: none;
    margin: 0;
    padding: 0;
}

.booking-list li + li,
.dish-list li + li {
    border-top: 1px solid var(--border);
}

.booking {
    display: grid;
    grid-template-columns: 7.5rem 1fr auto;
    align-items: center;
    gap: 12px;
    padding: 12px 4px;
    color: inherit;
    text-decoration: none;
    border-radius: var(--radius-sm);
}

.booking:hover {
    background: var(--surface-2);
    color: inherit;
}

.booking-when,
.booking-who {
    display: flex;
    flex-direction: column;
    line-height: 1.3;
    min-width: 0;
}

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

.booking-name {
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.booking-who .muted {
    font-size: 0.9rem;
}

.dish {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 12px 4px;
}

.dish > span:first-child {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.dish-name {
    font-weight: 600;
}

.dish-category {
    color: var(--muted);
    font-size: 0.85rem;
}

.dish-price {
    font-weight: 700;
    color: var(--brand-strong);
    white-space: nowrap;
}

/* ---------- Badges & alerts ---------- */

.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 999px;
    background: var(--neutral-bg);
    color: var(--neutral-fg);
    font-size: 0.8rem;
    font-weight: 700;
    white-space: nowrap;
    vertical-align: middle;
}

.badge-lg {
    padding: 6px 14px;
    font-size: 0.95rem;
}

.badge-pending {
    background: var(--pending-bg);
    color: var(--pending-fg);
}

.badge-confirmed {
    background: var(--confirmed-bg);
    color: var(--confirmed-fg);
}

.badge-cancelled {
    background: var(--cancelled-bg);
    color: var(--cancelled-fg);
}

.badge-soldout {
    margin-left: 6px;
}

.alert {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 16px;
    margin-bottom: 20px;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    background: var(--brand-tint);
    color: var(--text);
}

.alert p {
    margin: 0;
}

.alert p + p {
    margin-top: 6px;
}

.alert-success {
    background: var(--confirmed-bg);
    border-color: color-mix(in srgb, var(--confirmed-fg) 25%, transparent);
    color: var(--confirmed-fg);
}

.alert-error {
    background: var(--cancelled-bg);
    border-color: color-mix(in srgb, var(--cancelled-fg) 25%, transparent);
    color: var(--cancelled-fg);
}

.alert-info {
    background: var(--brand-tint);
    border-color: color-mix(in srgb, var(--brand) 25%, transparent);
}

.alert-close {
    flex: none;
    width: 28px;
    height: 28px;
    margin: -2px -6px -2px 0;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: inherit;
    font-size: 1.3rem;
    line-height: 1;
    cursor: pointer;
}

.alert-close:hover {
    background: rgb(0 0 0 / 0.08);
}

/* ---------- Tabs ---------- */

.tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 20px;
}

.tab {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 14px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
    color: var(--text);
    font-weight: 600;
    font-size: 0.9rem;
    text-decoration: none;
}

.tab:hover {
    border-color: var(--brand);
    color: var(--text);
}

.tab[aria-current="page"] {
    background: var(--brand);
    border-color: var(--brand);
    color: var(--on-brand);
}

.tab-count {
    min-width: 1.6em;
    padding: 0 6px;
    border-radius: 999px;
    background: var(--surface-2);
    color: var(--muted);
    font-size: 0.8rem;
    text-align: center;
}

.tab[aria-current="page"] .tab-count {
    background: rgb(255 255 255 / 0.22);
    color: inherit;
}

/* ---------- Tables (cards on small screens) ---------- */

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
}

.table th,
.table td {
    padding: 12px 10px;
    text-align: left;
    vertical-align: top;
    border-bottom: 1px solid var(--border);
}

.table th {
    color: var(--muted);
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.table tbody tr:last-child td {
    border-bottom: 0;
}

.table tbody tr:hover td {
    background: var(--surface-2);
}

.cell-strong {
    display: block;
    font-weight: 600;
}

.cell-sub {
    display: block;
    color: var(--muted);
    font-size: 0.85rem;
    overflow-wrap: anywhere;
}

.cell-action {
    text-align: right;
    white-space: nowrap;
}

.row-problem td {
    background: color-mix(in srgb, var(--cancelled-bg) 45%, transparent);
}

@media (max-width: 720px) {
    .table thead {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0 0 0 0);
        clip-path: inset(50%);
    }

    .table,
    .table tbody,
    .table tr,
    .table td {
        display: block;
        width: 100%;
    }

    .table tr {
        padding: 10px 0;
        border-bottom: 1px solid var(--border);
    }

    .table tbody tr:last-child {
        border-bottom: 0;
    }

    /* The label sits in the cell's left padding, so a cell's own content
       (a name above an email, "Today 7:30 PM") keeps flowing normally. */
    .table td {
        position: relative;
        min-height: 2em;
        padding: 5px 0 5px 7rem;
        border: 0;
    }

    .table td::before {
        content: attr(data-label);
        position: absolute;
        left: 0;
        top: 7px;
        width: 6.25rem;
        color: var(--muted);
        font-size: 0.8rem;
        font-weight: 700;
        letter-spacing: 0.04em;
        text-transform: uppercase;
    }

    .table td.cell-action {
        text-align: left;
        padding: 8px 0 0;
    }

    .table td.cell-action::before {
        content: none;
    }

    .table tbody tr:hover td {
        background: none;
    }
}

/* ---------- Details ---------- */

.details {
    display: grid;
    gap: 0;
    margin: 0;
}

.details > div {
    display: grid;
    grid-template-columns: 8rem 1fr;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}

.details > div:last-child {
    border-bottom: 0;
}

.details dt {
    color: var(--muted);
    font-weight: 600;
}

.details dd {
    margin: 0;
    min-width: 0;
    overflow-wrap: anywhere;
}

@media (max-width: 520px) {
    .details > div {
        grid-template-columns: 1fr;
        gap: 2px;
    }
}

/* ---------- Forms ---------- */

.form {
    max-width: 820px;
}

.form-grid {
    display: grid;
    gap: 18px 20px;
}

@media (min-width: 640px) {
    .form-grid {
        grid-template-columns: 1fr 1fr;
    }

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

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

.field label {
    font-weight: 600;
}

.optional {
    color: var(--muted);
    font-weight: 400;
    font-size: 0.85rem;
}

input,
select,
textarea {
    width: 100%;
    min-height: 44px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text);
    font: inherit;
}

textarea {
    min-height: 96px;
    resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: var(--focus);
}

.has-error input,
.has-error select,
.has-error textarea {
    border-color: var(--danger);
}

.field-error {
    margin: 0;
    color: var(--danger);
    font-size: 0.875rem;
    font-weight: 600;
}

.form-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 24px;
}

/* ---------- Menu ---------- */

.menu-grid {
    display: grid;
    gap: 0 24px;
}

@media (min-width: 880px) {
    .menu-grid {
        grid-template-columns: 1fr 1fr;
    }
}

.menu-section {
    scroll-margin-top: 16px;
}

.menu-section h2 {
    padding-bottom: 10px;
    margin-bottom: 4px;
    border-bottom: 2px solid var(--brand-tint);
}

.menu-item {
    display: flex;
    align-items: baseline;
    gap: 10px;
    padding: 10px 0;
}

.menu-item-name {
    font-weight: 600;
    min-width: 0;
}

.menu-item-leader {
    flex: 1;
    min-width: 16px;
    border-bottom: 2px dotted var(--border);
    transform: translateY(-4px);
}

.menu-item-price {
    font-weight: 700;
    color: var(--brand-strong);
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.menu-item.is-unavailable .menu-item-name,
.menu-item.is-unavailable .menu-item-price {
    color: var(--muted);
}

.menu-item.is-unavailable .menu-item-price {
    text-decoration: line-through;
}

/* ---------- Setup, configuration and error pages ---------- */

.setup-card {
    max-width: 780px;
    margin-inline: auto;
    padding: 28px;
}

.setup-card .lead {
    margin-bottom: 20px;
}

.steps {
    counter-reset: step;
    margin: 20px 0 24px;
}

.steps li {
    counter-increment: step;
    position: relative;
    padding: 0 0 12px 40px;
}

.steps li::before {
    content: counter(step);
    position: absolute;
    left: 0;
    top: 0;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--brand-tint);
    color: var(--brand-strong);
    font-size: 0.85rem;
    font-weight: 700;
    line-height: 26px;
    text-align: center;
}

.manual {
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.manual summary {
    cursor: pointer;
    font-weight: 600;
    color: var(--brand);
}

.manual p {
    margin-top: 12px;
}

.key-table {
    margin: 20px 0 24px;
}

.error-page {
    max-width: 640px;
    margin: 24px auto;
    text-align: center;
}

.error-code {
    margin: 0 0 8px;
    font-size: clamp(4rem, 3rem + 6vw, 7rem);
    font-weight: 800;
    line-height: 1;
    letter-spacing: -0.04em;
    color: var(--brand);
    opacity: 0.9;
}

.error-page .lead {
    margin-bottom: 16px;
}

.error-page .actions {
    margin-top: 24px;
}

@media (max-width: 560px) {
    .main {
        padding-block: 24px 40px;
    }

    .card,
    .setup-card {
        padding: 16px;
    }

    .stats {
        gap: 12px;
    }

    .stat {
        padding: 14px 16px;
    }

    .stat-value {
        font-size: 1.9rem;
    }

    /* The dashboard and the reservation list carry their own "New reservation"
       button; on a phone the header keeps to one row of links. */
    .nav-cta {
        display: none;
    }

    .booking {
        grid-template-columns: 1fr auto;
    }

    .booking-when {
        grid-column: 1 / -1;
        flex-direction: row;
        gap: 8px;
    }
}

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