/* The Rishiora: web admin styles. Tokens follow spec 11.2–11.5. */
:root {
  --ink: #111111;
  --gold: #C9A86A;
  --gold-dark: #A88545;
  --gold-light: #F5EEDF;
  --bg: #FFFFFF;
  --page: #F7F7F7;
  --muted: #F2F2F2;
  --border: #E3E3E3;
  --text: #1A1A1A;
  --text-2: #6B6B6B;
  --text-3: #A6A6A6;
  --success: #2E7D32;
  --warning: #ED9C28;
  --danger: #C62828;
  --info: #1E5FA8;
  --t-free: #FFFFFF;
  --t-occupied: #C9A86A;
  --t-kot: #1E5FA8;
  --t-bill: #ED9C28;
  --t-paid: #2E7D32;
  --t-reserved: #9E9E9E;
  --radius-card: 16px;
  --radius-input: 12px;
  --sidebar: 248px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ink: #F2F2F2; --bg: #1E1E1E; --page: #121212; --muted: #2A2A2A; --border: #333333;
    --text: #F2F2F2; --text-2: #B0B0B0; --text-3: #7A7A7A; --gold-light: #3A3122; --gold-dark: #D9BC85;
    --t-free: #1E1E1E; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --ink: #F2F2F2; --bg: #1E1E1E; --page: #121212; --muted: #2A2A2A; --border: #333333;
  --text: #F2F2F2; --text-2: #B0B0B0; --text-3: #7A7A7A; --gold-light: #3A3122; --gold-dark: #D9BC85;
  --t-free: #1E1E1E; color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 15px; line-height: 1.5; color: var(--text); background: var(--page);
  font-feature-settings: "tnum" 1;
}
a { color: var(--gold-dark); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 28px; font-weight: 700; margin: 0 0 4px; line-height: 1.2; }
h2 { font-size: 20px; font-weight: 700; margin: 0 0 12px; }
h3 { font-size: 16px; font-weight: 600; margin: 0 0 8px; }
.sub { color: var(--text-2); margin: 0; }
.small { font-size: 13px; color: var(--text-2); }
.section-title { position: relative; padding-bottom: 10px; margin-bottom: 16px; }
.section-title::after { content: ""; position: absolute; left: 0; bottom: 0; width: 40px; height: 4px; background: var(--gold); border-radius: 2px; }

/* ---- Shell ---- */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar); flex-shrink: 0; background: var(--bg); border-right: 1px solid var(--border);
  padding: 20px 12px; position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px 20px; font-weight: 700; font-size: 16px; color: var(--text); }
.brand-mark { width: 32px; height: 32px; border-radius: 10px; background: var(--ink); color: var(--gold); display: grid; place-items: center; font-weight: 700; }
.nav a {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px;
  color: var(--text-2); font-weight: 500; min-height: 44px;
}
.nav a:hover { background: var(--muted); text-decoration: none; color: var(--text); }
.nav a.active { background: var(--gold-light); color: var(--text); box-shadow: inset 3px 0 0 var(--gold); }
.nav svg { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 1.75; flex-shrink: 0; }
.nav .nav-label { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); padding: 16px 12px 6px; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 64px; background: var(--bg); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 12px; padding: 0 24px; position: sticky; top: 0; z-index: 10;
}
.topbar .spacer { flex: 1; }
.menu-btn { display: inline-flex; }
/* Collapsed sidebar on wider screens: an icon-only rail; names show as tooltips. */
@media (min-width: 768px) {
  body.nav-collapsed .sidebar { width: 72px; padding: 20px 10px; overflow-x: hidden; }
  body.nav-collapsed .brand { font-size: 0; gap: 0; justify-content: center; padding: 0 0 20px; }
  body.nav-collapsed .brand .brand-mark { font-size: 16px; }
  body.nav-collapsed .nav a { font-size: 0; gap: 0; justify-content: center; padding: 10px 0; }
  body.nav-collapsed .nav a svg { width: 22px; height: 22px; }
  body.nav-collapsed .nav .nav-label { font-size: 10px; text-align: center; padding: 14px 0 6px; overflow: hidden; text-overflow: clip; white-space: nowrap; letter-spacing: 0; }
}
.content { padding: 24px; max-width: 1280px; width: 100%; margin: 0 auto; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }

/* ---- Components ---- */
.card { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-card); padding: 20px; }
.card + .card { margin-top: 16px; }
.grid > .card + .card, .grid > .card { margin-top: 0; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.kpi .label { font-size: 13px; font-weight: 500; color: var(--text-2); }
.kpi .value { font-size: 28px; font-weight: 700; margin-top: 4px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 20px;
  border-radius: 999px; border: 1.5px solid var(--ink); background: var(--ink); color: var(--bg);
  font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; white-space: nowrap;
}
.btn:hover { text-decoration: none; opacity: .9; }
.btn-outline { background: transparent; color: var(--ink); }
.btn-sm { min-height: 36px; padding: 0 14px; font-size: 14px; }
.btn-block { width: 100%; }
.btn:focus-visible, input:focus-visible, select:focus-visible, a:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

label { display: block; font-size: 13px; font-weight: 500; color: var(--text-2); margin-bottom: 6px; }
input[type=text], input[type=email], input[type=password], input[type=tel], input[type=number], input[type=date], input[type=search], select {
  width: 100%; min-height: 44px; padding: 0 14px; border: 1px solid var(--border); border-radius: var(--radius-input);
  background: var(--bg); color: var(--text); font: inherit;
}
input:focus, select:focus { border-color: var(--ink); outline: none; }
.field { margin-bottom: 16px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.error { color: var(--danger); font-size: 13px; margin-top: 4px; }
.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 8px; }
.check { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 12px; color: var(--text); font-size: 14px; margin: 0; cursor: pointer; min-height: 44px; }
.check input { width: 18px; height: 18px; accent-color: var(--gold-dark); }
.check:has(input:checked) { background: var(--gold-light); border-color: var(--gold); }

.alert { padding: 12px 16px; border-radius: 12px; margin-bottom: 16px; font-size: 14px; display: flex; gap: 10px; align-items: flex-start; }
.alert-success { background: #E8F5E9; color: #1B5E20; }
.alert-error { background: #FDECEA; color: #8E1B1B; }
.alert-info { background: var(--muted); color: var(--text); }

.pill { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; line-height: 20px; white-space: nowrap; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill-active { background: #E8F5E9; color: var(--success); }
.pill-grace { background: #FFF4E5; color: #9A5B00; }
.pill-expired, .pill-none, .pill-disabled { background: #FDECEA; color: var(--danger); }
.pill-scheduled { background: #E8F0FA; color: var(--info); }
.chip { display: inline-block; padding: 4px 12px; border-radius: 999px; background: var(--gold-light); color: var(--text); font-size: 13px; font-weight: 500; margin: 0 6px 6px 0; }
.chip-off { background: var(--muted); color: var(--text-3); }

table.data { width: 100%; border-collapse: collapse; font-size: 14px; }
table.data th { text-align: left; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--text-2); padding: 10px 12px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--bg); }
table.data td { padding: 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
table.data tr:last-child td { border-bottom: 0; }
.table-wrap { overflow-x: auto; }

/* Location switcher */
.switcher { position: relative; }
.switcher select { min-width: 240px; font-weight: 600; border-radius: 999px; }

/* Floor plan tiles (spec 11.7) */
.floor { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 12px; }
.tile {
  min-height: 84px; border-radius: 14px; border: 1.5px solid var(--border); background: var(--t-free);
  padding: 10px; display: flex; flex-direction: column; justify-content: space-between; color: var(--text);
}
.tile .num { font-weight: 700; font-size: 18px; }
.tile .meta { font-size: 12px; opacity: .85; }
.tile.occupied { background: var(--t-occupied); border-color: var(--t-occupied); color: #111; }
.tile.kot_sent { background: var(--t-kot); border-color: var(--t-kot); color: #fff; }
.tile.bill_printed { background: var(--t-bill); border-color: var(--t-bill); color: #111; }
.tile.paid { background: var(--t-paid); border-color: var(--t-paid); color: #fff; }
.tile.reserved { background: var(--t-reserved); border-color: var(--t-reserved); color: #fff; }
.legend { display: flex; flex-wrap: wrap; gap: 12px; font-size: 13px; color: var(--text-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 14px; height: 14px; border-radius: 4px; border: 1px solid var(--border); display: inline-block; }

/* Auth page */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 16px; background: var(--page); }
.auth .card { width: 100%; max-width: 420px; padding: 32px; }

.empty { text-align: center; color: var(--text-2); padding: 32px 16px; }
details.inline summary { cursor: pointer; color: var(--gold-dark); font-weight: 600; list-style: none; }
details.inline summary::-webkit-details-marker { display: none; }
details.inline[open] summary { margin-bottom: 12px; }

/* ---- Responsive (spec 11.8) ---- */
@media (max-width: 1023px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 767px) {
  .sidebar { position: fixed; left: 0; top: 0; z-index: 30; transform: translateX(-100%); transition: transform .2s; box-shadow: 0 0 40px rgba(0,0,0,.2); }
  body.nav-open .sidebar { transform: none; }
  .menu-btn { display: inline-flex; }
  .topbar { padding: 0 16px; }
  .content { padding: 16px; }
  .grid-2, .grid-3, .field-row { grid-template-columns: 1fr; }
  .switcher select { min-width: 0; max-width: 52vw; }
  .topbar .user-name { display: none; }
  h1 { font-size: 24px; }
}
@media (max-width: 480px) { .grid-4 { grid-template-columns: 1fr 1fr; } }

/* ---- Menu (spec 4.1) ---- */
/* Food-type symbol: square outline + dot (Veg green, Egg yellow) or triangle (Non-veg). Always paired with a label for screen readers. */
.food { display: inline-block; width: 14px; height: 14px; border: 1.5px solid currentColor; border-radius: 2px; position: relative; vertical-align: -2px; flex-shrink: 0; }
.food::after { content: ""; position: absolute; inset: 2.5px; border-radius: 50%; background: currentColor; }
.food.veg { color: var(--success); }
.food.egg { color: #D9A100; }
.food.non_veg { color: #8B2F1E; }
.food.non_veg::after { inset: auto; left: 50%; top: 50%; width: 0; height: 0; border-radius: 0; background: none;
  border-left: 4px solid transparent; border-right: 4px solid transparent; border-bottom: 7px solid currentColor; transform: translate(-50%, -60%); }
.badge-veg { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 999px; background: #E8F5E9; color: var(--success); font-size: 12px; font-weight: 600; }

.menu-layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 16px; align-items: start; }
.cat-nav { position: sticky; top: 80px; display: flex; flex-direction: column; max-height: calc(100vh - 96px); }
.cat-nav .cat-find { position: relative; flex: none; padding: 0 0 8px; }
.cat-nav .cat-find svg { position: absolute; left: 10px; top: 12px; color: var(--text-2); pointer-events: none; }
.cat-nav .cat-find input { width: 100%; min-height: 40px; padding-left: 32px; border-radius: 10px; }
.cat-nav .cat-links { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
.cat-nav a.active { background: var(--muted); font-weight: 600; }
.cat-nav a { display: flex; justify-content: space-between; padding: 8px 12px; border-radius: 10px; color: var(--text); font-weight: 500; min-height: 40px; align-items: center; }
.cat-nav a:hover { background: var(--muted); text-decoration: none; }
.cat-nav .count { color: var(--text-3); font-size: 13px; }
.item-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--border); }
.item-row:last-child { border-bottom: 0; }
.item-name { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.item-meta { font-size: 13px; color: var(--text-2); margin-top: 2px; }
.item-price { font-weight: 700; text-align: right; white-space: nowrap; }
.item-outlets { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.stock-btn { border: 1px solid var(--border); background: var(--bg); color: var(--text); border-radius: 999px; padding: 4px 10px; font: inherit; font-size: 12px; cursor: pointer; min-height: 32px; display: inline-flex; align-items: center; gap: 6px; }
.stock-btn.out { background: #FDECEA; border-color: #F5C2C0; color: var(--danger); }
.stock-btn .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--success); }
.stock-btn.out .dot { background: var(--danger); }
.muted-row { opacity: .55; }

.radio-cards { display: flex; gap: 8px; flex-wrap: wrap; }
.radio-card { display: inline-flex; align-items: center; gap: 8px; padding: 10px 14px; border: 1px solid var(--border); border-radius: 12px; cursor: pointer; min-height: 44px; color: var(--text); font-size: 14px; margin: 0; }
.radio-card input { accent-color: var(--gold-dark); }
.radio-card:has(input:checked) { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.repeat-row { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1.2fr) 44px; gap: 8px; margin-bottom: 8px; align-items: center; }
.icon-btn { width: 44px; height: 44px; border-radius: 12px; border: 1px solid var(--border); background: var(--bg); color: var(--text-2); cursor: pointer; font-size: 18px; }
.outlet-block { border: 1px solid var(--border); border-radius: 12px; padding: 12px; margin-bottom: 12px; }
.price-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; margin-top: 10px; }
.price-grid label { font-size: 12px; margin-bottom: 4px; }
.sticky-actions { position: sticky; bottom: 0; background: var(--page); padding: 12px 0; display: flex; gap: 12px; border-top: 1px solid var(--border); margin-top: 16px; }
textarea { width: 100%; min-height: 80px; padding: 10px 14px; border: 1px solid var(--border); border-radius: var(--radius-input); background: var(--bg); color: var(--text); font: inherit; resize: vertical; }
input[type=time] { width: 100%; min-height: 44px; padding: 0 14px; border: 1px solid var(--border); border-radius: var(--radius-input); background: var(--bg); color: var(--text); font: inherit; }

@media (max-width: 1023px) { .menu-layout { grid-template-columns: 1fr; } .cat-nav { position: static; max-height: none; } .cat-nav .cat-links { display: flex; gap: 6px; overflow-x: auto; overflow-y: hidden; } .cat-nav a { white-space: nowrap; border: 1px solid var(--border); } .price-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 767px) { .repeat-row { grid-template-columns: 1fr 1fr; } .repeat-row .icon-btn { justify-self: end; } .price-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ---- Add buttons (top right) + modal forms ---- */
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.section-head > :first-child { margin: 0; }
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-left: auto; }
dialog.modal {
  border: 0; border-radius: var(--radius-card); padding: 0; width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 48px);
  background: var(--bg); color: var(--text); box-shadow: 0 24px 64px rgba(0,0,0,.28);
}
dialog.modal::backdrop { background: rgba(0,0,0,.45); }
dialog.modal.modal-wide { width: min(820px, calc(100vw - 32px)); }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--bg); z-index: 1; }
.modal-head h2 { margin: 0; font-size: 18px; }
.modal-close { border: 0; background: transparent; color: var(--text-2); font-size: 26px; line-height: 1; width: 40px; height: 40px; border-radius: 50%; cursor: pointer; }
.modal-close:hover { background: var(--muted); }
.modal-body { padding: 20px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }
@media (max-width: 640px) { .modal .field-row { grid-template-columns: 1fr; } }
.btn-outline.danger, .btn.danger { color: var(--danger); border-color: var(--danger); background: transparent; }
.modal .grid-4, .modal .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }

/* ---- Icon actions (edit / delete) with tooltips ---- */
.icon-action {
  display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; padding: 0;
  border: 1px solid var(--border); border-radius: 10px; background: var(--bg); color: var(--text-2); cursor: pointer; vertical-align: middle;
}
.icon-action svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.icon-action:hover { background: var(--muted); color: var(--text); text-decoration: none; }
.icon-action.danger { color: var(--danger); }
.icon-action.danger:hover { background: #FDECEA; border-color: #F5C2C0; }
.icon-action[aria-disabled="true"] { opacity: .4; cursor: not-allowed; }
.icon-action:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.inline-form { display: inline; margin: 0; }
.row-actions { display: inline-flex; gap: 6px; align-items: center; white-space: nowrap; }
.tooltip {
  position: fixed; z-index: 1000; pointer-events: none; background: var(--ink); color: var(--bg); font-size: 12px; font-weight: 500;
  line-height: 1.3; padding: 5px 9px; border-radius: 6px; max-width: 260px; box-shadow: 0 4px 14px rgba(0,0,0,.2);
}
.icon-action.add { background: var(--ink); border-color: var(--ink); color: var(--bg); border-radius: 50%; }
.icon-action.add:hover { background: var(--ink); color: var(--bg); opacity: .88; }
.icon-action.add svg { stroke-width: 2.4; }
.icon-action.add-lg { width: 44px; height: 44px; }
.icon-action.add-lg svg { width: 22px; height: 22px; }
.icon-action.toggle[aria-expanded="true"] { background: var(--gold-light); border-color: var(--gold); color: var(--text); }
.icon-action.toggle-chevron svg { transition: transform .15s ease; }
.icon-action.toggle-chevron[aria-expanded="true"] svg { transform: rotate(180deg); }
.toggle-panel { margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--border); }
