:root {
    --theme-color: #0d9488;
    --theme-dark: #0f766e;
    --bg: #f1f5f9;
    --surface: #ffffff;
    --text: #0f172a;
    --muted: #64748b;
    --border: #e2e8f0;
    --danger: #dc2626;
    --radius: 16px;
    --shadow: 0 20px 50px rgba(15, 23, 42, 0.08);
    --font: "DM Sans", ui-sans-serif, system-ui, sans-serif;
    --font-display: "Instrument Serif", Georgia, serif;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
}

a { color: var(--theme-color); }

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

.eyebrow {
    display: inline-block;
    color: var(--theme-color);
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    font-size: 0.75rem;
}

h1, h2, h3 { line-height: 1.2; margin: 0 0 0.5rem; }
h1 { font-family: var(--font-display); font-size: clamp(2rem, 4vw, 3rem); font-weight: 400; }

/* Buttons */
.button,
button.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
    padding: 0 20px;
    border: none;
    border-radius: 999px;
    background: var(--theme-color);
    color: #fff;
    font: inherit;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
    transition: transform 0.15s, opacity 0.15s;
}

.button:hover { opacity: 0.92; transform: translateY(-1px); }
.button--sm { min-height: 36px; padding: 0 14px; font-size: 0.875rem; }
.button--outline { background: transparent; color: var(--theme-color); border: 2px solid var(--theme-color); }
.secondary-button { background: #e2e8f0; color: var(--text); }
.danger-button { background: var(--danger); color: #fff; }

/* Forms */
label { display: grid; gap: 6px; font-weight: 600; font-size: 0.9rem; }
input, textarea, select {
    width: 100%;
    min-height: 44px;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 12px;
    font: inherit;
    background: #fff;
}
textarea { min-height: 96px; resize: vertical; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.check input { width: auto; min-height: auto; }
.form-grid { display: grid; gap: 14px; }
.form-grid--2 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.form-message { margin: 0; color: var(--muted); font-size: 0.9rem; }
.inline-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

/* Cards */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
}

/* Badges */
.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;
    background: #e2e8f0;
}
.badge--pending { background: #fef3c7; color: #92400e; }
.badge--completed, .badge--active, .badge--approved { background: #d1fae5; color: #065f46; }
.badge--cancelled, .badge--passive { background: #fee2e2; color: #991b1b; }
.badge--preparing { background: #dbeafe; color: #1e40af; }

/* Brand */
.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-weight: 800;
    text-decoration: none;
    color: inherit;
}
.logo-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: var(--theme-color);
    color: #fff;
    font-size: 0.8rem;
}

/* Marketing */
.page-marketing { background: linear-gradient(180deg, #ecfeff 0%, var(--bg) 40%); }
.site-header {
    position: sticky;
    top: 0;
    z-index: 10;
    background: rgba(255,255,255,0.9);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--border);
}
.site-header__inner, main { width: min(1120px, calc(100% - 32px)); margin: 0 auto; }
.site-header__inner { display: flex; align-items: center; justify-content: space-between; padding: 16px 0; }
.site-nav { display: flex; gap: 20px; align-items: center; }
.site-nav a { color: var(--text); text-decoration: none; font-weight: 600; }
.hero {
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    gap: 40px;
    align-items: center;
    padding: 64px 0 48px;
}
.hero__title em { font-style: italic; color: var(--theme-color); }
.hero__lead { font-size: 1.125rem; color: var(--muted); max-width: 52ch; }
.hero-visual { display: flex; justify-content: center; }
.hero-phone {
    width: min(320px, 100%);
    padding: 16px;
    border-radius: 32px;
    background: #0f172a;
    box-shadow: var(--shadow);
}
.hero-phone__screen { background: #fff; border-radius: 24px; padding: 20px; }
.hero-phone__item { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.hero-phone__thumb { width: 48px; height: 48px; border-radius: 12px; background: #e2e8f0; }
.features { padding: 48px 0; }
.features__grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 20px; }
.feature-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; }
.restaurant-showcase { padding-bottom: 64px; }

/* Auth */
.page-auth {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1fr 1fr;
}
.auth-brand {
    background: linear-gradient(145deg, var(--theme-color), var(--theme-dark));
    color: #fff;
    padding: 48px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}
.auth-brand h1 { color: #fff; }
.auth-panel { display: flex; align-items: center; justify-content: center; padding: 32px; }
.auth-card { width: min(440px, 100%); }
.auth-card__footer { margin-top: 20px; color: var(--muted); }

/* Dashboard layout */
.page-dashboard {
    display: grid;
    grid-template-columns: 260px 1fr;
    min-height: 100vh;
}
.sidebar {
    background: #0f172a;
    color: #e2e8f0;
    padding: 24px 18px;
    display: flex;
    flex-direction: column;
    gap: 24px;
    position: sticky;
    top: 0;
    height: 100vh;
}
.sidebar .brand { color: #fff; margin-bottom: 8px; }
.sidebar-nav { display: grid; gap: 6px; }
.sidebar-nav a {
    color: #cbd5e1;
    text-decoration: none;
    padding: 10px 12px;
    border-radius: 10px;
    font-weight: 600;
}
.sidebar-nav a:hover { background: rgba(255,255,255,0.08); color: #fff; }
.sidebar-footer { margin-top: auto; }
.sidebar-footer .button { width: 100%; }

.panel-mobile-bar {
    display: none;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 16px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 20;
}
.panel-mobile-bar__brand { display: flex; align-items: center; gap: 10px; }
.panel-mobile-bar__brand span { display: block; font-size: 0.8rem; color: var(--muted); }

.dash-main { padding: 28px 32px 48px; }
.dash-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 24px;
}
.dash-header__actions { display: flex; gap: 10px; flex-wrap: wrap; }

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 16px;
    margin-bottom: 28px;
}
.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
}
.stat-card__value { font-size: 2rem; font-weight: 800; color: var(--theme-color); }
.stat-card__label { color: var(--muted); font-size: 0.9rem; }

.panel-section { margin-bottom: 32px; }
.panel-section h2 { margin-bottom: 16px; font-size: 1.35rem; }
.panel-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 20px; }
.panel-grid--2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }

.data-list { display: grid; gap: 10px; }
.data-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 16px 18px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
}

.tenant-identity-form {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 12px;
    align-items: flex-end;
    width: 100%;
    padding-top: 12px;
    margin-top: 4px;
    border-top: 1px solid var(--border);
}

.tenant-identity-form label {
    display: grid;
    gap: 4px;
    font-size: 0.85rem;
    min-width: 140px;
    flex: 1;
}

.tenant-identity-form .form-message {
    width: 100%;
    margin: 0;
    font-size: 0.875rem;
}

.field-readonly {
    display: grid;
    gap: 6px;
}

.field-readonly__label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--muted);
}

.field-readonly__value {
    margin: 0;
    font-weight: 600;
}

.field-readonly__value code {
    font-size: 0.9rem;
    font-weight: 500;
}
.data-row__main { display: grid; gap: 4px; }
.data-row__meta { color: var(--muted); font-size: 0.875rem; }
.data-row__actions { display: flex; gap: 8px; flex-wrap: wrap; }
.empty-state { text-align: center; color: var(--muted); }
.hours-row {
    display: grid;
    grid-template-columns: 120px 1fr 1fr 1fr;
    gap: 12px;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}

/* Customer menu */
.page-menu { background: var(--bg); }
.menu-page {
    width: min(720px, calc(100% - 24px));
    margin: 0 auto;
    padding: 20px 0 120px;
}
.menu-page__header { text-align: center; margin-bottom: 24px; }
.menu-page__logo { max-height: 64px; margin-bottom: 12px; }
.menu-page__table-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    align-items: end;
    margin-top: 16px;
}
.menu-page__table-bar label { text-align: left; max-width: 140px; }
.menu-page__table-msg { width: 100%; color: var(--danger); font-size: 0.9rem; margin: 0; }

.menu-nav {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin: -8px 0 20px;
    padding: 4px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 999px;
    width: fit-content;
    margin-left: auto;
    margin-right: auto;
}
.menu-nav__link {
    padding: 8px 18px;
    border-radius: 999px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--muted);
    text-decoration: none;
}
.menu-nav__link:hover { color: var(--text); }
.menu-nav__link.is-active {
    background: var(--primary);
    color: #fff;
}

.about-page__cover {
    margin: 0 -12px 20px;
    border-radius: var(--radius);
    overflow: hidden;
    max-height: 220px;
}
.about-page__cover img {
    width: 100%;
    height: 220px;
    object-fit: cover;
    display: block;
}
.about-page__head { text-align: center; margin-bottom: 20px; }
.about-page__title { font-size: 1.5rem; margin: 0 0 8px; }
.about-page__summary {
    color: var(--muted);
    margin: 0;
    line-height: 1.5;
}
.about-page__description {
    margin-bottom: 20px;
    line-height: 1.6;
}
.about-page__contact h3,
.about-page__gallery h3 {
    font-size: 1.1rem;
    margin: 0 0 12px;
}
.about-contact-list {
    list-style: none;
    padding: 0;
    margin: 0 0 24px;
    display: grid;
    gap: 10px;
}
.about-contact-list li {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}
.about-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
}
.about-gallery__item {
    margin: 0;
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--surface);
    border: 1px solid var(--border);
}
.about-gallery__item img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    display: block;
}
.about-gallery__item figcaption {
    padding: 8px;
    font-size: 0.85rem;
    color: var(--muted);
}

.about-panel-cover-preview img {
    max-width: 200px;
    max-height: 120px;
    object-fit: cover;
    border-radius: var(--radius);
    border: 1px solid var(--border);
}
.about-panel-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 14px;
}
.about-panel-gallery__item {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 10px;
    background: var(--surface);
}
.about-panel-gallery__item img {
    width: 100%;
    aspect-ratio: 4/3;
    object-fit: cover;
    border-radius: 8px;
    display: block;
    margin-bottom: 8px;
}

.menu-view-lead { text-align: center; color: var(--muted); margin: 0 0 16px; }
.menu-view-title { font-size: 1.35rem; margin: 12px 0 16px; }
.menu-section--categories { margin-bottom: 32px; }
.menu-section--products { margin-top: 8px; }
.menu-category { margin-bottom: 28px; scroll-margin-top: 16px; }
.menu-category h2 {
    font-size: 1.2rem;
    margin: 0 0 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}
.menu-back { margin-bottom: 8px; }

.category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 14px;
}

.category-tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    cursor: pointer;
    font: inherit;
    color: inherit;
    text-align: center;
    transition: transform 0.15s, box-shadow 0.15s;
}

.category-tile:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.category-tile__img {
    width: 100%;
    height: 100px;
    object-fit: cover;
    border-radius: 12px;
}

.category-tile__placeholder {
    width: 100%;
    height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #e2e8f0;
    border-radius: 12px;
    font-size: 2rem;
    font-weight: 800;
    color: var(--theme-color);
}

.category-grid--text .category-tile {
    min-height: 72px;
    justify-content: center;
}

.category-grid--text .category-tile__label {
    font-size: 1.05rem;
    font-weight: 700;
}

.category-grid--visual .category-tile {
    padding: 10px;
    gap: 0;
}

.category-grid--visual .category-tile__img,
.category-grid--visual .category-tile__placeholder {
    height: 120px;
}

.category-grid--visual .category-tile__label {
    display: none;
}

.category-tile__label {
    font-weight: 700;
    line-height: 1.3;
}

.menu-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 14px;
}
.product-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    display: grid;
    gap: 10px;
    transition: transform 0.15s, box-shadow 0.15s;
}

.product-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.product-card__link {
    display: grid;
    gap: 8px;
    text-decoration: none;
    color: inherit;
}

.product-card__link img { width: 100%; height: 120px; object-fit: cover; border-radius: 12px; }
.product-card__link b { color: var(--theme-color); font-size: 1.1rem; }

.product-card__add {
    width: 100%;
}

.menu-breadcrumb {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    font-size: 0.9rem;
    margin-bottom: 16px;
    color: var(--muted);
}

.menu-breadcrumb a {
    color: var(--theme-color);
    font-weight: 600;
    text-decoration: none;
}

.product-detail {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}

.product-detail__image {
    width: 100%;
    max-height: 320px;
    object-fit: cover;
    display: block;
}

.product-detail__placeholder {
    height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #e2e8f0;
    font-size: 4rem;
    font-weight: 800;
    color: var(--theme-color);
}

.product-detail__body {
    padding: 24px;
    display: grid;
    gap: 12px;
}

.product-detail__title {
    margin: 0;
    font-size: 1.75rem;
}

.product-detail__desc {
    margin: 0;
    color: var(--muted);
    line-height: 1.7;
}

.product-detail__price {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--theme-color);
}

.product-detail__add {
    width: fit-content;
}

.menu-cart {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: min(720px, 100%);
    background: var(--surface);
    border-top: 1px solid var(--border);
    padding: 16px;
    box-shadow: 0 -10px 40px rgba(0,0,0,0.1);
    z-index: 30;
}
.menu-cart__head, .menu-cart__footer { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
#cart-items { list-style: none; padding: 0; margin: 8px 0; max-height: 120px; overflow: auto; }
.menu-actions {
    position: fixed;
    bottom: 88px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 10px;
    z-index: 25;
}
.toast {
    position: fixed;
    top: 16px;
    left: 50%;
    transform: translateX(-50%);
    background: #0f172a;
    color: #fff;
    padding: 12px 20px;
    border-radius: 999px;
    z-index: 50;
}
.toast--error { background: var(--danger); }

/* Modals */
body.modal-open { overflow: hidden; }

.modal {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal[hidden] { display: none; }

.modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
}

.modal__dialog {
    position: relative;
    width: min(480px, 100%);
    max-height: calc(100vh - 40px);
    overflow: auto;
    z-index: 1;
}

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

.modal__head h3 { margin: 0; }

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

.panel-section__head h2 { margin: 0; }

.history-collapse {
    padding: 0;
    overflow: hidden;
}

.history-collapse__trigger {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 12px;
    padding: 16px 18px;
    cursor: pointer;
    list-style: none;
    user-select: none;
}

.history-collapse__trigger::-webkit-details-marker {
    display: none;
}

.history-collapse__title {
    font-size: 1.2rem;
    font-weight: 700;
}

.history-collapse__hint {
    flex: 1;
    font-size: 0.875rem;
    min-width: 160px;
}

.history-collapse__chevron {
    width: 10px;
    height: 10px;
    border-right: 2px solid var(--muted);
    border-bottom: 2px solid var(--muted);
    transform: rotate(45deg);
    transition: transform 0.2s ease;
    margin-left: auto;
}

.history-collapse[open] .history-collapse__chevron {
    transform: rotate(-135deg);
    margin-top: 4px;
}

.history-collapse__body {
    padding: 0 18px 18px;
    border-top: 1px solid var(--border);
}

.history-collapse__body .data-list {
    margin-top: 14px;
}

.history-collapse__body .empty-state {
    margin-top: 14px;
}

.settings-block {
    padding: 16px 18px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: #f8fafc;
    display: grid;
    gap: 12px;
}

.settings-block__title {
    margin: 0;
    font-size: 1.1rem;
}

.settings-block__desc {
    margin: 0;
    font-size: 0.9rem;
    line-height: 1.45;
}

.settings-block__fields {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px 16px;
}

.settings-block__fields label {
    display: grid;
    gap: 6px;
    font-size: 0.875rem;
    font-weight: 600;
}

.live-badge {
    font-size: 0.75rem;
    font-weight: 700;
    color: #059669;
    background: #d1fae5;
    padding: 4px 10px;
    border-radius: 999px;
}

.nav-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    margin-left: 6px;
    border-radius: 999px;
    background: var(--danger);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 800;
}

.data-row--alert {
    border-color: #fca5a5;
    background: #fff7ed;
    animation: request-pulse 1.5s ease-in-out 2;
}

@keyframes request-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0); }
    50% { box-shadow: 0 0 0 6px rgba(220, 38, 38, 0.15); }
}

.panel-toast {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 200;
    max-width: min(360px, calc(100% - 40px));
    padding: 16px 20px;
    background: #0f172a;
    color: #fff;
    border-radius: 14px;
    box-shadow: 0 20px 50px rgba(15, 23, 42, 0.35);
    font-weight: 700;
    transform: translateX(120%);
    transition: transform 0.35s ease;
}

.panel-toast--show {
    transform: translateX(0);
}

.modal__close {
    border: none;
    background: #e2e8f0;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    font-size: 1.4rem;
    line-height: 1;
    cursor: pointer;
    color: var(--text);
}

@media (max-width: 1024px) {
    .page-dashboard { grid-template-columns: 1fr; }
    .sidebar { display: none; }
    .panel-mobile-bar { display: flex; }
    .page-auth { grid-template-columns: 1fr; }
    .auth-brand { min-height: auto; padding: 32px; }
    .hero { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
    .dash-main { padding: 16px; }
    .data-row { flex-direction: column; align-items: stretch; }
    .hours-row { grid-template-columns: 1fr; }
}
