:root {
    --bg: #f6f3ee;
    --surface: #ffffff;
    --surface-soft: #fbfaf7;
    --ink: #171512;
    --muted: #746f66;
    --line: #e4ded3;
    --gold: #b8864b;
    --gold-dark: #7c542c;
    --bronze: #8f6842;
    --danger: #b84242;
    --success: #2f7a54;
    --warning: #9a6b24;
    --shadow: 0 18px 50px rgba(29, 24, 17, .08);
    --radius: 8px;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body { margin: 0; color: var(--ink); background: var(--bg); }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button, input, textarea, select { font: inherit; }

.auth-body {
    min-height: 100vh;
    background: #13110f;
    display: grid;
    place-items: center;
    padding: 24px;
}

.auth-shell { width: min(100%, 440px); }
.login-card {
    background: var(--surface);
    border: 1px solid rgba(255,255,255,.12);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 30px;
}

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

.login-brand h1 { margin: 0; font-size: 27px; letter-spacing: 0; }
.login-brand p, .muted { color: var(--muted); }
.small { font-size: 13px; }

.brand-mark {
    width: 42px;
    height: 42px;
    display: inline-grid;
    place-items: center;
    border-radius: 50%;
    background: #14110e;
    color: #f6d59a;
    font-weight: 800;
    border: 1px solid rgba(184, 134, 75, .45);
}

.dashboard-body {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 270px minmax(0, 1fr);
}

.sidebar {
    background: #15120f;
    color: #fff8ee;
    padding: 26px 18px;
    position: sticky;
    top: 0;
    height: 100vh;
}

.brand { margin-bottom: 28px; }
.brand strong { display: block; }
.brand small { color: #cdb99c; }

.nav-list { display: grid; gap: 6px; }
.nav-list a {
    padding: 12px 13px;
    border-radius: var(--radius);
    color: #e8decd;
}
.nav-list a.is-active, .nav-list a:hover {
    background: rgba(184, 134, 75, .18);
    color: #fff;
}

.workspace { min-width: 0; }
.topbar {
    height: 72px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 0 28px;
    background: rgba(246, 243, 238, .9);
    backdrop-filter: blur(14px);
    position: sticky;
    top: 0;
    z-index: 20;
    border-bottom: 1px solid var(--line);
}

.eyebrow {
    display: block;
    color: var(--bronze);
    text-transform: uppercase;
    letter-spacing: .08em;
    font-size: 12px;
    font-weight: 800;
}

.content {
    padding: 28px;
    display: grid;
    gap: 22px;
}

.page-head, .panel-head, .head-actions, .actions, .check-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.page-head h1 {
    margin: 4px 0 0;
    font-size: 30px;
    letter-spacing: 0;
}

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

.panel { padding: 20px; }
.panel h2 { margin: 0 0 14px; font-size: 19px; }
.panel-head { margin-bottom: 14px; }
.panel-head h2 { margin: 0; }

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

.stat-card { padding: 20px; }
.stat-card span, .stat-card small { color: var(--muted); display: block; }
.stat-card strong { display: block; font-size: 28px; margin-top: 6px; }

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

.form-grid { display: grid; gap: 18px; }
.form-section { display: grid; gap: 14px; }
.field-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

label { display: grid; gap: 7px; color: var(--ink); font-weight: 650; }
label span { color: var(--muted); font-size: 13px; font-weight: 700; }
input, textarea, select {
    width: 100%;
    border: 1px solid var(--line);
    background: var(--surface-soft);
    border-radius: var(--radius);
    padding: 11px 12px;
    color: var(--ink);
    outline: none;
}
textarea { min-height: 98px; resize: vertical; }
input:focus, textarea:focus, select:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(184, 134, 75, .15); }
.span-2 { grid-column: span 2; }
.check-label, .check-row label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
}
.check-label input, .check-row input { width: auto; }

.btn {
    min-height: 38px;
    border: 1px solid transparent;
    border-radius: var(--radius);
    padding: 9px 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    font-weight: 800;
    white-space: nowrap;
}
.btn-primary { background: #16120f; color: #f7dfb6; border-color: #16120f; }
.btn-light { background: var(--surface-soft); color: var(--ink); border-color: var(--line); }
.btn-danger { background: #fff4f2; color: var(--danger); border-color: #f0c8c4; }
.btn-full { width: 100%; }
.form-actions { display: flex; justify-content: flex-end; }

.alert {
    padding: 13px 15px;
    border-radius: var(--radius);
    border: 1px solid var(--line);
    background: #fff;
    color: var(--ink);
}
.alert-success { border-color: #b7dfc9; background: #f0fbf5; color: var(--success); }
.alert-error { border-color: #efc1bf; background: #fff3f2; color: var(--danger); }
.alert-warning { border-color: #efd19a; background: #fff8e9; color: var(--warning); }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 680px; }
th, td {
    text-align: left;
    padding: 13px 12px;
    border-bottom: 1px solid var(--line);
    vertical-align: middle;
}
th { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; }
td small { color: var(--muted); display: block; margin-top: 3px; }

.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: #f0e6d9;
    color: #694827;
    padding: 5px 9px;
    font-size: 12px;
    font-weight: 800;
}
.badge.success { background: #e7f5ed; color: var(--success); }
.badge.danger { background: #fae8e5; color: var(--danger); }

.inline-edit {
    display: grid;
    grid-template-columns: repeat(4, minmax(90px, 1fr)) auto auto;
    gap: 9px;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--line);
}
.inline-edit textarea { min-height: 46px; }

.translation-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}
.translation-grid.compact textarea { min-height: 64px; }

.category-edit {
    border-bottom: 1px solid var(--line);
    padding: 14px 0;
}

.allergen-picker {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}
.allergen-picker label {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface-soft);
}
.allergen-picker input { width: auto; }

.tag-row { display: flex; flex-wrap: wrap; gap: 7px; }
.tag {
    --tag: var(--gold);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    min-height: 24px;
    border-radius: 999px;
    padding: 3px 8px;
    background: #fff;
    color: var(--tag);
    border: 1px solid var(--tag);
    font-size: 11px;
    font-weight: 900;
}

.qr-preview, .qr-download { text-align: center; }
.qr-preview img, .qr-download img { width: min(100%, 260px); margin: 0 auto 12px; border: 1px solid var(--line); }

.empty-state {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 30px;
    text-align: center;
}

.menu-body {
    --tenant-color: #b8864b;
    background: #f8f5ee;
}

.menu-hero {
    min-height: 285px;
    position: relative;
    background: #15120f;
    color: #fff;
    overflow: hidden;
}
.menu-cover {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: .42;
}
.menu-hero::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(20,17,14,.16), rgba(20,17,14,.86));
}
.menu-hero-content {
    position: relative;
    z-index: 1;
    min-height: 285px;
    display: flex;
    align-items: flex-end;
    gap: clamp(10px, 2.5vw, 16px);
    width: min(100%, 980px);
    margin: 0 auto;
    padding: 28px 18px;
}
.menu-logo {
    width: clamp(58px, 18vw, 82px);
    height: clamp(58px, 18vw, 82px);
    flex: 0 0 auto;
    border-radius: 16px;
    object-fit: contain;
    background: #fff;
    border: 2px solid rgba(255,255,255,.72);
    padding: 6px;
}
.text-logo {
    display: grid;
    place-items: center;
    color: var(--tenant-color);
    font-size: clamp(26px, 7vw, 34px);
    font-weight: 900;
    padding: 0;
}
.menu-hero h1 { margin: 0; font-size: clamp(25px, 7vw, 32px); letter-spacing: 0; overflow-wrap: anywhere; }
.menu-hero p { margin: 6px 0 0; color: #f4eadb; max-width: 620px; }

.menu-app {
    width: min(100%, 980px);
    margin: 0 auto;
    padding: 16px 14px 36px;
}
.menu-tools {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    align-items: end;
    margin-top: -32px;
    position: relative;
    z-index: 80;
}
.search-box {
    background: #fff;
    border-radius: var(--radius);
    border: 1px solid var(--line);
    padding: 10px;
    box-shadow: var(--shadow);
}
.search-box input { border: 0; background: transparent; padding: 4px 0 0; }
.language-switch {
    display: flex;
    gap: 6px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 7px;
    box-shadow: var(--shadow);
    overflow-x: auto;
}
.language-switch a {
    padding: 8px 10px;
    border-radius: 6px;
    color: var(--muted);
    white-space: nowrap;
    font-weight: 800;
}
.language-switch a.is-active {
    background: var(--tenant-color);
    color: #fff;
}

.language-picker {
    position: relative;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    min-width: 190px;
    z-index: 90;
}
.language-picker summary {
    list-style: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 11px 13px;
    font-weight: 900;
}
.language-picker summary::-webkit-details-marker { display: none; }
.language-picker-label {
    display: grid;
    gap: 2px;
}
.language-picker-label small {
    color: var(--muted);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .06em;
}
.language-choice {
    display: flex;
    align-items: center;
    gap: 9px;
}
.language-flag {
    font-size: 20px;
    line-height: 1;
    filter: saturate(1.05);
}
.language-name { font-weight: 900; }
.language-picker summary:after {
    content: "";
    width: 9px;
    height: 9px;
    border-right: 2px solid var(--tenant-color);
    border-bottom: 2px solid var(--tenant-color);
    transform: rotate(45deg);
    margin-top: -4px;
}
.language-picker[open] summary:after {
    transform: rotate(225deg);
    margin-top: 4px;
}
.language-panel {
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    z-index: 999;
    width: min(270px, 80vw);
    display: grid;
    gap: 6px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 8px;
    box-shadow: 0 18px 50px rgba(29,24,17,.16);
}
.language-panel a {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 10px 11px;
    border-radius: 7px;
    color: var(--muted);
    font-weight: 900;
}
.language-panel a.is-active,
.language-panel a:hover {
    background: var(--tenant-color);
    color: #fff;
}

.category-strip {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 14px 0;
    background: rgba(248,245,238,.94);
    backdrop-filter: blur(10px);
}
.category-strip a {
    flex: 0 0 auto;
    border: 1px solid var(--line);
    background: #fff;
    border-radius: 999px;
    padding: 10px 13px;
    font-weight: 800;
}

.menu-category { scroll-margin-top: 78px; padding: 10px 0 18px; }
.menu-category-head h2 { margin: 0; font-size: 24px; }
.menu-category-head p { color: var(--muted); margin: 4px 0 0; }
.product-list { display: grid; gap: 12px; margin-top: 12px; }
.menu-product {
    display: grid;
    grid-template-columns: 108px minmax(0, 1fr);
    gap: 13px;
    padding: 12px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: 0 10px 28px rgba(29, 24, 17, .06);
}
.menu-product > img, .product-image-fallback {
    width: 108px;
    height: 108px;
    border-radius: var(--radius);
    object-fit: cover;
}
.product-image-fallback {
    display: grid;
    place-items: center;
    background: #15120f;
    color: #f3d69f;
    font-weight: 900;
    font-size: 34px;
}
.product-info { display: grid; gap: 7px; min-width: 0; }
.product-title {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: start;
}
.product-title h3 { margin: 0; font-size: 18px; overflow-wrap: anywhere; }
.product-info p { margin: 0; color: var(--muted); line-height: 1.45; }
.price { display: grid; justify-items: end; white-space: nowrap; }
.price del { color: var(--muted); font-size: 12px; }
.price strong { color: var(--tenant-color); font-size: 18px; }
.product-detail summary { cursor: pointer; color: var(--gold-dark); font-weight: 800; }
.product-detail ul { margin: 8px 0 0; padding-left: 20px; color: var(--muted); }
.nutrition-table {
    min-width: 0;
    width: 100%;
    margin-top: 8px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
    background: #fffaf3;
}
.nutrition-table th,
.nutrition-table td {
    padding: 9px 10px;
    border-bottom: 1px solid var(--line);
    font-size: 13px;
}
.nutrition-table th {
    text-transform: none;
    letter-spacing: 0;
    color: var(--muted);
    width: 52%;
    background: #fff6ea;
}
.nutrition-table tr:last-child th,
.nutrition-table tr:last-child td { border-bottom: 0; }
.nutrition-fields input { background: #fff; }
.btn-menu-order {
    justify-self: start;
    background: #1c6f4c;
    color: #fff;
    border-color: #1c6f4c;
    min-height: 34px;
    padding: 7px 11px;
}
.menu-footer {
    text-align: center;
    color: var(--muted);
    padding: 20px 0 0;
    font-size: 13px;
    font-weight: 800;
}
.menu-unavailable {
    min-height: 100vh;
    display: grid;
    place-items: center;
    background: #15120f;
    color: #fff;
    text-align: center;
    padding: 24px;
}
.menu-unavailable section { max-width: 420px; }
.menu-unavailable h1 { margin-bottom: 8px; }
.menu-unavailable p { color: #d7c9b7; }

@media (max-width: 1000px) {
    .dashboard-body { grid-template-columns: 1fr; }
    .sidebar {
        position: static;
        height: auto;
        padding: 16px;
    }
    .nav-list {
        display: flex;
        overflow-x: auto;
        padding-bottom: 3px;
    }
    .nav-list a { flex: 0 0 auto; }
    .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .grid-two { grid-template-columns: 1fr; }
    .topbar { top: 0; padding: 0 16px; }
    .content { padding: 18px; }
}

@media (max-width: 720px) {
    .field-grid, .translation-grid, .allergen-picker, .menu-tools { grid-template-columns: 1fr; }
    .language-picker { width: 100%; }
    .language-panel { left: 0; right: auto; width: 100%; }
    .span-2 { grid-column: auto; }
    .stats-grid { grid-template-columns: 1fr; }
    .page-head h1 { font-size: 25px; }
    .inline-edit { grid-template-columns: 1fr; }
    table { min-width: 620px; }
    .menu-hero, .menu-hero-content { min-height: 245px; }
    .menu-hero h1 { font-size: 27px; }
    .menu-tools { margin-top: -24px; }
    .menu-product {
        grid-template-columns: 86px minmax(0, 1fr);
        gap: 10px;
        padding: 10px;
    }
    .menu-product > img, .product-image-fallback { width: 86px; height: 86px; }
    .product-title { display: grid; }
    .price { justify-items: start; }
}
