:root {
    --bg: #f5f3ee;
    --surface: #fffefa;
    --surface-2: #eef2f0;
    --ink: #17211d;
    --muted: #6f7772;
    --line: #dedbd2;
    --accent: #b83f2a;
    --accent-2: #1f6f5b;
    --gold: #bf8b2e;
    --danger: #b42318;
    --shadow: 0 18px 48px rgba(36, 31, 24, .1);
    --radius: 8px;
}
/* #1a1a2e */

* { box-sizing: border-box; }
body { margin: 0; font-family: Inter, ui-sans-serif, system-ui, -apple-system, Segoe UI, Arial, sans-serif; color: var(--ink); background: var(--bg); }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 280px 1fr; }
.sidebar { position: sticky; top: 0; height: 100vh; padding: 24px; background: #1a1a2e; color: #f9f4ea; display: flex; flex-direction: column; gap: 22px; overflow-y: auto; overflow-x: hidden; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 8px; background: var(--accent); color: white; font-weight: 900; letter-spacing: 0; }
.brand strong { display: block; font-size: 18px; }
.brand small { color: #bfc7c2; }
.brand.large .brand-mark { width: 56px; height: 56px; }
.sidebar nav { display: grid; gap: 8px; }
.sidebar nav a { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 8px; color: #dce3de; min-height: 48px; }
.sidebar nav a:hover, .sidebar nav a.active { background: rgba(255,255,255,.1); color: white; }
.nav-icon { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; background: rgba(255,255,255,.09); font-size: 12px; font-weight: 800; }
.nav-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.logout { margin-top: auto; color: #ffd1c8; padding: 12px; border-radius: 8px; display: flex; align-items: center; gap: 12px; min-height: 48px; }
.logout:hover { background: rgba(255,255,255,.1); color: white; }

.main { padding: 26px; min-width: 0; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 22px; }
.topbar h1 { margin: 4px 0 0; font-size: clamp(28px, 4vw, 42px); line-height: 1.04; letter-spacing: 0; }
.eyeline { margin: 0; color: var(--muted); font-weight: 700; text-transform: uppercase; font-size: 12px; }
.topbar-actions { display: flex; align-items: center; gap: 12px; }
.icon-btn { width: 42px; height: 42px; border: 1px solid var(--line); background: var(--surface); border-radius: 8px; position: relative; cursor: pointer; }
.icon-btn[data-count]:after { content: attr(data-count); position: absolute; top: -8px; right: -7px; min-width: 20px; height: 20px; border-radius: 999px; background: var(--accent); color: white; font-size: 11px; display: grid; place-items: center; }
.user-pill { display: flex; align-items: center; gap: 10px; border: 1px solid var(--line); background: var(--surface); border-radius: 8px; padding: 8px 12px; }
.user-pill > span { width: 34px; height: 34px; display: grid; place-items: center; background: var(--accent-2); color: white; border-radius: 8px; font-weight: 800; }
.user-pill strong, .user-pill small { display: block; }
.user-pill small { color: var(--muted); }

.panel, .metric-card, .auth-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.panel { padding: 20px; min-width: 0; }
.section-gap { margin-top: 16px; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 14px; margin-bottom: 16px; }
.panel-head h2, .panel-subhead h3 { margin: 0; font-size: 18px; }
.panel-head a { color: var(--accent); font-weight: 800; }
.panel-subhead { margin: 22px 0 12px; }
.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; }
.metric-card { padding: 20px; }
.metric-card span { color: var(--muted); font-weight: 700; }
.metric-card strong { display: block; margin: 12px 0 4px; font-size: 32px; letter-spacing: 0; }
.metric-card small { color: var(--muted); }
.metric-card.warning strong { color: var(--danger); }
.dashboard-grid, .split-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; align-items: start; }
.wide { grid-column: span 2; }

.btn { border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 8px; padding: 10px 14px; font-weight: 800; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; }
.btn.primary { background: var(--accent); color: white; border-color: var(--accent); }
.btn.danger { background: #fff1ef; color: var(--danger); border-color: #ffc9c2; }
.btn.small { min-height: 32px; padding: 6px 10px; font-size: 13px; }
.btn.full, .full { width: 100%; }
.quick-actions { display: grid; gap: 10px; }

label { display: grid; gap: 7px; font-weight: 800; font-size: 13px; color: #35413b; }
input, select, textarea { width: 100%; border: 1px solid var(--line); background: white; border-radius: 8px; padding: 10px 12px; color: var(--ink); outline-color: var(--accent-2); }
.stack-form { display: grid; gap: 13px; }
.inline-form { display: flex; gap: 8px; align-items: center; margin-top: 12px; }
.inline-form input { min-width: 0; }
.inline-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.compact-form { gap: 8px; min-width: 210px; }
.compact-form input, .compact-form select { padding: 7px 9px; font-size: 13px; }
.form-hint { color: var(--muted); font-weight: 700; margin-top: -7px; }
.search-input { max-width: 280px; }

.table-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table-wrap .data-table, .dataTables_wrapper .data-table { min-width: 720px; }
.dataTables_wrapper { width: 100%; overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th, .data-table td { text-align: left; padding: 12px; border-bottom: 1px solid var(--line); }
.data-table th { font-size: 12px; text-transform: uppercase; color: var(--muted); }
.compact th, .compact td { padding: 10px; }
.status { padding: 5px 9px; border-radius: 999px; font-size: 12px; font-weight: 900; background: var(--surface-2); color: var(--ink); }
.status.sent, .status.preparing { background: #fff5d8; color: #835b00; }
.status.ready, .status.completed, .status.closed { background: #dcfce7; color: #166534; }
.status.cancelled { background: #fee2e2; color: #991b1b; }
.text-danger { color: var(--danger); font-weight: 900; }

.floor-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.table-card { border: 1px solid var(--line); border-radius: 8px; padding: 16px; background: white; display: grid; gap: 8px; }
.table-card strong { font-size: 28px; }
.table-card small { text-transform: uppercase; color: var(--muted); font-weight: 900; }
.table-card.occupied { border-color: #f0b4a9; background: #fff6f4; }
.table-card.available { border-color: #a7e1c0; }
.card-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }

.pos-layout { display: grid; grid-template-columns: 260px 1fr 340px; gap: 16px; align-items: start; }
.pos-sidebar, .order-ticket { position: sticky; top: 20px; }
.category-tabs { display: grid; gap: 8px; margin-top: 16px; }
.category-tabs button { border: 1px solid var(--line); background: white; border-radius: 8px; padding: 10px; text-align: left; cursor: pointer; font-weight: 800; }
.category-tabs button.active { background: #17211d; color: white; }
.menu-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px; }
.menu-tile { text-align: left; border: 1px solid var(--line); background: white; border-radius: 8px; padding: 10px; cursor: pointer; display: grid; gap: 6px; }
.menu-tile[hidden] { display: none !important; }
.menu-tile img, .menu-admin-card img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 6px; background: var(--surface-2); }
.menu-tile span, .menu-admin-card span { color: var(--muted); font-size: 13px; }
.menu-tile small { font-weight: 900; color: var(--accent); }
.empty-state { border: 1px dashed var(--line); border-radius: 8px; padding: 22px; color: var(--muted); text-align: center; font-weight: 800; margin-top: 14px; }
.ticket-items { min-height: 190px; display: grid; gap: 8px; align-content: start; margin-bottom: 12px; }
.ticket-items.empty { color: var(--muted); place-items: center; border: 1px dashed var(--line); border-radius: 8px; }
.ticket-row { display: grid; grid-template-columns: 1fr auto auto; gap: 8px; align-items: center; padding: 9px; border-bottom: 1px solid var(--line); }
.qty-control { display: inline-flex; gap: 5px; align-items: center; }
.qty-control button { width: 28px; height: 28px; border: 1px solid var(--line); background: white; border-radius: 6px; cursor: pointer; }
.ticket-total { display: flex; justify-content: space-between; align-items: center; font-size: 20px; margin: 16px 0; }
.ticket-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

.kitchen-board { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.kitchen-column { background: rgba(255,255,255,.45); border: 1px solid var(--line); border-radius: 8px; padding: 14px; min-height: 70vh; }
.kitchen-column h2 { margin: 0 0 12px; }
.kitchen-list { display: grid; gap: 12px; }
.kitchen-card { background: white; border: 1px solid var(--line); border-radius: 8px; padding: 14px; display: grid; gap: 10px; }
.kitchen-card header { display: flex; justify-content: space-between; gap: 10px; }
.kitchen-card ul { margin: 0; padding-left: 18px; }

.menu-admin-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; }
.menu-admin-card { border: 1px solid var(--line); border-radius: 8px; padding: 10px; background: white; display: grid; gap: 8px; }
.menu-admin-actions { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.recipe-builder { border: 1px solid var(--line); padding: 12px; border-radius: 8px; max-height: 270px; overflow: auto; }
.recipe-builder h3 { margin: 0 0 10px; }
.recipe-row { grid-template-columns: 1fr 88px; align-items: center; margin-bottom: 8px; }

.rank-list { display: grid; gap: 10px; }
.rank-list div { border-bottom: 1px solid var(--line); padding-bottom: 10px; display: grid; gap: 3px; }
.rank-list strong { color: var(--accent-2); }
.rank-list small { color: var(--muted); }
.notification-panel { position: fixed; top: 76px; right: 24px; width: min(380px, calc(100vw - 32px)); background: white; border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); padding: 12px; z-index: 10; }
.notification-panel article { border-bottom: 1px solid var(--line); padding: 10px; }
.notification-panel article:last-child { border-bottom: 0; }

.modal { border: 0; border-radius: 8px; box-shadow: var(--shadow); width: min(440px, calc(100vw - 32px)); }
.modal::backdrop { background: rgba(23, 33, 29, .45); }
.modal form { display: grid; gap: 12px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; }
.alert { padding: 10px; border-radius: 8px; font-weight: 800; }
.alert.danger { background: #fee2e2; color: #991b1b; }

.auth-body { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(circle at top left, #fff 0, var(--bg) 34%, #e8ede8 100%); }
.auth-layout { width: min(1100px, 100%); display: grid; grid-template-columns: 1.2fr 420px; gap: 24px; align-items: stretch; }
.auth-story { padding: 44px; background: #1a1a2e; color: white; border-radius: 8px; min-height: 560px; display: flex; flex-direction: column; justify-content: space-between; box-shadow: var(--shadow); }
.auth-story h1 { font-size: clamp(38px, 7vw, 76px); line-height: .94; letter-spacing: 0; margin: 60px 0 20px; max-width: 760px; }
.auth-story p { color: #dbe2dd; font-size: 18px; max-width: 580px; line-height: 1.6; }
.auth-stats { display: flex; gap: 14px; flex-wrap: wrap; }
.auth-stats span { border: 1px solid rgba(255,255,255,.16); border-radius: 8px; padding: 12px 14px; color: #dbe2dd; }
.auth-stats strong { color: white; display: block; }
.auth-card { padding: 28px; align-self: center; display: grid; gap: 14px; }
.auth-card h2, .auth-card h1 { margin: 0; }
.auth-card p { color: var(--muted); margin: 0; }

@media print {
    .sidebar, .topbar, .notification-panel, .ticket-actions, .pos-sidebar, .menu-panel { display: none !important; }
    .app-shell, .pos-layout { display: block; }
    .panel { box-shadow: none; border: 0; }
}

@media (max-width: 1120px) {
    .app-shell { grid-template-columns: 230px 1fr; }
    .sidebar { padding: 18px 14px; }
    .brand span:last-child { min-width: 0; }
    .pos-layout, .kitchen-board, .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .order-ticket { grid-column: span 2; }
}

@media (max-width: 760px) {
    .app-shell { display: block; }
    .sidebar { position: static; height: auto; flex-direction: row; overflow-x: auto; justify-content: flex-start; }
    .sidebar nav { display: flex; }
    .sidebar nav a, .logout { flex: 0 0 auto; }
    .main { padding: 16px; }
    .topbar { align-items: flex-start; flex-direction: column; }
    .metric-grid, .dashboard-grid, .split-grid, .pos-layout, .kitchen-board, .auth-layout { grid-template-columns: 1fr; }
    .wide, .order-ticket { grid-column: auto; }
    .pos-sidebar, .order-ticket { position: static; }
    .auth-story { min-height: auto; padding: 28px; }
    .auth-story h1 { margin-top: 34px; }
    .ticket-actions { grid-template-columns: 1fr; }
}
