:root {
    --bg: #f4f6f8;
    --surface: #ffffff;
    --surface-soft: #eef7f5;
    --ink: #17211f;
    --muted: #65736f;
    --line: #d9e2df;
    --primary: #0f766e;
    --primary-dark: #115e59;
    --accent: #d97706;
    --danger: #c2410c;
    --success: #15803d;
    --shadow: 0 18px 40px rgba(23, 33, 31, 0.08);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--ink);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    letter-spacing: 0;
}

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

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

input,
select,
textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 10px 12px;
    background: #fff;
    color: var(--ink);
}

label {
    display: grid;
    gap: 7px;
    color: var(--muted);
    font-size: 0.88rem;
    font-weight: 650;
}

label input,
label select,
label textarea {
    color: var(--ink);
    font-weight: 500;
}

.app-shell {
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
    min-height: 100vh;
}

.sidebar {
    display: flex;
    flex-direction: column;
    gap: 24px;
    padding: 24px;
    background: #142421;
    color: #f8faf9;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-mark {
    display: grid;
    width: 38px;
    height: 38px;
    place-items: center;
    border-radius: 8px;
    background: var(--primary);
    color: #fff;
    font-weight: 800;
}

.brand small,
.nav a,
.muted,
small {
    color: var(--muted);
}

.sidebar .brand small,
.sidebar .nav a {
    color: #b8c9c4;
}

.brand span:last-child {
    display: grid;
    gap: 2px;
}

.nav {
    display: grid;
    gap: 6px;
}

.nav a {
    border-radius: 8px;
    padding: 11px 12px;
    font-weight: 650;
}

.nav a.active,
.nav a:hover {
    background: rgba(255, 255, 255, 0.09);
    color: #fff;
}

.main {
    min-width: 0;
    padding: 28px;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 18px;
    margin-bottom: 22px;
}

.topbar h1,
.login-copy h1,
.booking-hero h1 {
    margin: 0;
    line-height: 1.05;
}

.topbar h1 {
    font-size: clamp(1.5rem, 2.8vw, 2.3rem);
}

.eyebrow {
    margin: 0 0 7px;
    color: var(--primary);
    font-size: 0.74rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-chip,
.alarm-pill,
.status {
    display: inline-flex;
    align-items: center;
    min-height: 30px;
    border-radius: 999px;
    padding: 5px 10px;
    font-size: 0.8rem;
    font-weight: 800;
}

.user-chip {
    background: #fff;
    border: 1px solid var(--line);
}

.alarm-pill {
    background: #fff7ed;
    color: #9a3412;
}

.public-shell {
    width: min(1120px, calc(100% - 32px));
    margin: 0 auto;
    padding: 36px 0;
}

.login-panel {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 420px;
    min-height: calc(100vh - 72px);
    align-items: center;
    gap: 32px;
}

.login-copy {
    padding: 42px;
}

.login-copy h1 {
    max-width: 720px;
    font-size: clamp(2.4rem, 6vw, 5.2rem);
}

.login-copy p:last-child {
    max-width: 620px;
    color: var(--muted);
    font-size: 1.1rem;
    line-height: 1.7;
}

.form-card,
.panel {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.form-card {
    display: grid;
    gap: 16px;
    padding: 26px;
}

.form-card h2,
.panel h2 {
    margin: 0;
    font-size: 1.05rem;
}

.metrics-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}

.metric {
    display: grid;
    gap: 8px;
    min-height: 110px;
    padding: 18px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
}

.metric span {
    color: var(--muted);
    font-size: 0.84rem;
    font-weight: 750;
}

.metric strong {
    font-size: 2.3rem;
}

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

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.split-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(320px, 430px);
    gap: 18px;
    align-items: start;
}

.form-grid {
    display: grid;
    gap: 14px;
}

.primary-button,
.ghost-button,
.danger-button,
.icon-button,
.primary-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    border-radius: 8px;
    border: 1px solid transparent;
    padding: 10px 14px;
    cursor: pointer;
    font-weight: 800;
    white-space: nowrap;
}

.primary-button {
    background: var(--primary);
    color: #fff;
}

.primary-button:hover {
    background: var(--primary-dark);
}

.primary-button:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

.ghost-button,
.icon-button {
    background: #fff;
    border-color: var(--line);
    color: var(--ink);
}

.danger-button {
    background: #fff7ed;
    border-color: #fed7aa;
    color: var(--danger);
}

.primary-link {
    min-height: auto;
    color: var(--primary);
    padding: 0;
}

.compact {
    min-height: 34px;
    padding: 7px 10px;
    font-size: 0.84rem;
}

.full {
    width: 100%;
}

.table-wrap {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 760px;
}

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

th {
    color: var(--muted);
    font-size: 0.78rem;
    text-transform: uppercase;
}

td small {
    display: block;
    margin-top: 3px;
}

.row-actions {
    display: flex;
    gap: 8px;
}

.status {
    background: #e5e7eb;
    color: #374151;
}

.status.pending {
    background: #fff7ed;
    color: #9a3412;
}

.status.confirmed,
.status.active,
.status.completed {
    background: #dcfce7;
    color: #166534;
}

.status.cancelled {
    background: #fee2e2;
    color: #991b1b;
}

.status.rejected {
    background: #f3e8ff;
    color: #6b21a8;
}

.status.seated {
    background: #dbeafe;
    color: #1d4ed8;
}

.restaurant-list {
    display: grid;
    gap: 10px;
}

.restaurant-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 12px;
    background: #fbfdfc;
    border: 1px solid var(--line);
    border-radius: 8px;
}

.restaurant-row div {
    display: grid;
    gap: 3px;
}

.filter-bar,
.inline-form,
.copy-box {
    display: flex;
    align-items: end;
    gap: 10px;
    margin-bottom: 16px;
}

.inline-form {
    align-items: end;
    margin-top: 14px;
}

.table-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
    gap: 10px;
}

.table-cards article {
    display: grid;
    gap: 4px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fbfdfc;
}

.signup-page,
.signup-form {
    display: grid;
    gap: 18px;
}

.plan-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.plan-option input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.plan-option span,
.subscription-summary article {
    display: grid;
    gap: 7px;
    min-height: 120px;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    color: var(--ink);
}

.plan-option input:checked + span {
    border-color: var(--primary);
    background: var(--surface-soft);
}

.plan-option em {
    color: var(--primary-dark);
    font-style: normal;
    font-size: 1.4rem;
    font-weight: 900;
}

.subscription-summary {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 12px;
}

.subscription-summary span {
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 800;
    text-transform: uppercase;
}

.hours-grid {
    display: grid;
    gap: 10px;
}

.hours-row {
    display: grid;
    grid-template-columns: 120px 1fr 1fr 120px;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
}

.check-label {
    display: flex;
    align-items: center;
    gap: 8px;
}

.check-label input {
    width: auto;
}

.booking-page {
    display: grid;
    gap: 18px;
}

.booking-hero {
    padding: 34px 0 12px;
}

.booking-hero h1 {
    font-size: clamp(2.4rem, 7vw, 5rem);
}

.booking-hero p:last-child {
    color: var(--muted);
    font-weight: 650;
}

.booking-form {
    display: grid;
    grid-template-columns: 180px 220px auto;
    align-items: end;
    gap: 12px;
    padding: 18px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
}

.booking-form.wide {
    grid-template-columns: 1fr;
    align-items: stretch;
}

.slot-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
    gap: 10px;
}

.slot-option input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.slot-option span {
    display: grid;
    min-height: 42px;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    color: var(--ink);
    font-weight: 850;
}

.slot-option input:checked + span {
    border-color: var(--primary);
    background: var(--surface-soft);
    color: var(--primary-dark);
}

.booking-fields {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.booking-fields label:last-child {
    grid-column: 1 / -1;
}

.edit-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.span-2,
.form-actions {
    grid-column: 1 / -1;
}

.form-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.delete-form {
    display: flex;
    justify-content: flex-end;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--line);
}

.staff-preview-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px;
    border: 1px solid #bde3df;
    border-radius: 8px;
    background: #eef7f5;
    color: var(--primary-dark);
    font-weight: 800;
}

.reservation-status-card {
    display: grid;
    gap: 18px;
    padding: 20px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.status-line {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}

.detail-grid article {
    display: grid;
    gap: 6px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fbfdfc;
}

.detail-grid span {
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 800;
    text-transform: uppercase;
}

.detail-grid strong {
    font-size: 1.1rem;
}

.flash {
    margin-bottom: 16px;
    border-radius: 8px;
    padding: 12px 14px;
    font-weight: 750;
}

.flash.success {
    background: #dcfce7;
    color: #166534;
}

.flash.error {
    background: #fee2e2;
    color: #991b1b;
}

.empty {
    padding: 18px;
    color: var(--muted);
    text-align: center;
}

.alarm-dock {
    position: fixed;
    right: 22px;
    bottom: 22px;
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 16px;
    width: min(420px, calc(100% - 32px));
    padding: 16px;
    border: 1px solid #fed7aa;
    border-radius: 8px;
    background: #fff7ed;
    color: #7c2d12;
    box-shadow: var(--shadow);
}

.alarm-dock p {
    margin: 4px 0 0;
    color: #9a3412;
}

@media (max-width: 920px) {
    .app-shell {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: static;
        padding: 16px;
    }

    .nav {
        grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    }

    .main {
        padding: 18px;
    }

    .metrics-grid,
    .split-layout,
    .login-panel,
    .booking-fields,
    .edit-grid,
    .detail-grid,
    .plan-grid,
    .subscription-summary {
        grid-template-columns: 1fr;
    }

    .login-copy {
        padding: 12px 0;
    }

    .booking-form,
    .hours-row {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .topbar,
    .restaurant-row,
    .header-actions,
    .filter-bar,
    .inline-form,
    .copy-box,
    .staff-preview-bar {
        align-items: stretch;
        flex-direction: column;
    }

    .topbar-actions {
        justify-content: space-between;
    }

    .row-actions {
        flex-wrap: wrap;
    }
}
