/* ═══════════════════════════════════════════════════════════════════════════
   Sidhi — base layer
   Loaded by every layout. Tokens, reset, typography, controls.
   Panel-specific and storefront-specific rules live in their own files so that
   neither can quietly restyle the other.

   THEMING: every colour in this project is a token declared here. A rebrand is
   a change to this :root block, not a search across stylesheets — which is the
   difference between an afternoon and a fortnight.
   ═══════════════════════════════════════════════════════════════════════════ */

:root {
  /* ── Brand ─────────────────────────────────────────────────────────────
     Ember on warm ivory. Red-orange is the appetite hue the whole category
     runs on, and it is deliberately NOT the navy-and-gold of Attention Point
     or the royal maroon of Maharaja: three sites from one workshop should not
     read as one site.

     #C1341C is 5.6:1 on white, so it carries text as well as fills. */
  --brand:        #D5000F;   /* the red in the Magadh logo; 5.5:1 on white */
  --brand-deep:   #A50009;   /* its outline; hover and pressed */
  --brand-soft:   #FCE8E9;
  --brand-line:   #F5C2C4;
  --brand-ink:    #FFFFFF;   /* text ON a brand-filled surface */

  /* Gold from the logo's tagline pill. A FILL, never a text colour: 2.6:1 on
     white. Anything sitting on it takes --ink. Offers, bestseller marks, the
     cooking column. (The token keeps its old name so nothing else moves.) */
  --saffron:      #E5B03A;
  --saffron-soft: #FBF1DA;
  --saffron-line: #E8D0A0;

  /* ── Semantic ──────────────────────────────────────────────────────────
     Deliberately separate from the brand hue. "This order is late" must not
     be the same colour as "this is our button", or neither reads as itself.
     --stop sits darker than --brand so the two separate by lightness and not
     by hue alone. */
  --ok:        #17794A;  --ok-soft:   #E4F2EA;  --ok-line:   #BEDDCC;
  --warn:      #8A5A0B;  --warn-soft: #FBF0DA;  --warn-line: #E8D0A0;
  --stop:      #A32318;  --stop-soft: #FAE7E4;  --stop-line: #EDC3BD;
  --info:      #21566E;  --info-soft: #E3EFF4;  --info-line: #BBD5E1;

  /* The FSSAI marks. Green for vegetarian, maroon-brown for not — a legal
     convention, not a design choice, so they never change with the brand. */
  --veg:       #17794A;
  --nonveg:    #8C2F20;

  /* ── Neutrals ──────────────────────────────────────────────────────────
     Warm paper rather than grey. A restaurant page on #F4F2F4 looks like a
     dashboard; the few degrees of warmth here are most of the difference. */
  --ink:       #1A1410;
  --ink-2:     #4A3F38;
  --muted:     #7C6F66;
  --faint:     #A99C92;
  --line:      #E8DFD5;
  --line-2:    #D6C8BA;
  --surface:   #FFFFFF;
  --surface-2: #FBF6EF;
  --ground:    #F4ECE2;
  --sunk:      #EBE0D3;

  /* ── Type ──────────────────────────────────────────────────────────────
     Fraunces carries headings and dish names; a serif is most of what
     separates a restaurant from a form, and both sibling sites already use
     one. Manrope carries everything read quickly — prices, addresses, the
     kitchen board — because its numerals are even-width, so a column of
     totals lines up.

     Both stacks fall back to system faces, and the page is READABLE in those
     before either webfont arrives. That matters more on a phone in Sidhi than
     it does anywhere this was designed. */
  --display: Fraunces, Georgia, "Times New Roman", serif;
  --font: Manrope, -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", "SF Mono", Menlo, Consolas, monospace;

  /* ── Scale ─────────────────────────────────────────────────────────────
     A fixed set. Sizes outside it are how a layout stops looking composed. */
  --r-sm: 8px;  --r: 12px;  --r-lg: 16px;  --r-pill: 999px;

  /* A 1px warm border does the work a shadow usually does. Shadow is spent on
     things that genuinely float: the sticky bar, a button over a photograph. */
  --sh-xs: 0 1px 2px rgba(26,20,16,.06);
  --sh:    0 2px 8px rgba(26,20,16,.08), 0 1px 3px rgba(26,20,16,.05);
  --sh-lg: 0 12px 30px rgba(26,20,16,.14), 0 3px 8px rgba(26,20,16,.06);

  --dur: .18s;
  --ease: cubic-bezier(.2,.8,.2,1);
}

/* ── Reset ───────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }

/* The browser's own [hidden] rule is `display: none` at the lowest possible
   specificity, so ANY class that sets display beats it. A .btn with hidden on
   it stayed on screen, which is how the basket ended up showing "Checkout" and
   "add more to order" at the same time. */
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--ground);
  -webkit-font-smoothing: antialiased;
}

img, svg { display: block; max-width: 100%; height: auto; }
button, input, select, textarea { font: inherit; color: inherit; }

/* Focus is never removed, only restyled. An outlet panel gets used with a
   keyboard when the touchscreen is greasy, and an admin form gets tabbed
   through by anyone entering a dozen outlets in a row. */
:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ── Typography ──────────────────────────────────────────────────────────── */
/* Headings take the display face; h4 does not, because at 15px a serif stops
   being characterful and starts being harder to read. */
h1, h2, h3 {
  font-family: var(--display);
  font-weight: 600;
  line-height: 1.12;
  text-wrap: balance;
  letter-spacing: -.02em;
}
h1 { font-size: clamp(28px, 5vw, 44px); }
h2 { font-size: clamp(21px, 3vw, 30px); }
h3 { font-size: 19px; }
h4 { font-size: 15px; font-weight: 700; line-height: 1.25; letter-spacing: -.01em; }

a { color: var(--brand); text-underline-offset: 2px; }
a:hover { color: var(--brand-deep); }

.muted { color: var(--muted); }
.small { font-size: 14px; }
.mono  { font-family: var(--mono); font-size: .92em; }
.num   { font-variant-numeric: tabular-nums; }

.eyebrow {
  font-size: 11px; font-weight: 700; letter-spacing: .12em;
  text-transform: uppercase; color: var(--muted);
}

/* Screen-reader-only, for labels a sighted user gets from context. */
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0;
  margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* Skip link. Here rather than in one shell's stylesheet: it was defined only
   in storefront.css, so the admin panel rendered it as a visible red link in
   the top-left corner of every page. */
.skip {
  position: absolute; left: 12px; top: -60px; z-index: 60;
  padding: 11px 18px; border-radius: var(--r);
  background: var(--brand); color: var(--brand-ink);
  font-weight: 700; text-decoration: none;
  transition: top var(--dur) var(--ease);
}
.skip:focus { top: 12px; color: var(--brand-ink); }

/* ── Layout ──────────────────────────────────────────────────────────────── */
.wrap {
  width: 100%;
  max-width: 1160px;
  margin-inline: auto;
  padding-inline: 20px;   /* never a shorthand: it would zero the sides */
}
.wrap-narrow { max-width: 720px; }

.stack   { display: grid; gap: 16px; }
.stack-s { display: grid; gap: 8px; }
.row     { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row-end { margin-left: auto; }
.grid    { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }

/* ── Cards ───────────────────────────────────────────────────────────────── */
/* Border, fill, radius and shadow each say "separate object". Spent by role,
   not stamped on every block — a page where everything is a card has no
   hierarchy left to express. */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 18px 20px;
}
.card-flush { padding: 0; overflow: hidden; }
.card-head {
  padding: 14px 20px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.card-head h2, .card-head h3 { font-size: 16px; }

/* ── Buttons ─────────────────────────────────────────────────────────────── */
/* 44px minimum on every target. A thumb in a kitchen doorway is not a mouse,
   and this is the one rule that holds whatever the design looks like. */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  min-height: 44px;
  font-family: var(--font);
  font-size: 15px; font-weight: 700; line-height: 1.2;
  padding: 11px 20px;
  border: 1.5px solid transparent;
  border-radius: var(--r);
  background: var(--brand);
  color: var(--brand-ink);
  cursor: pointer;
  text-decoration: none;
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.btn:hover { background: var(--brand-deep); color: var(--brand-ink); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }

.btn-ghost  { background: var(--surface); color: var(--ink); border-color: var(--line-2); }
.btn-ghost:hover { background: var(--sunk); color: var(--ink); }
.btn-danger { background: var(--surface); color: var(--stop); border-color: var(--stop-line); }
.btn-danger:hover { background: var(--stop-soft); color: var(--stop); }

/* The ADD button on a dish: outlined, so a grid of forty of them does not
   become forty solid red rectangles shouting at once. */
.btn-add {
  background: var(--surface); color: var(--brand); border-color: var(--brand);
  font-size: 13px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase;
  min-height: 38px; padding: 8px 16px; border-radius: var(--r-sm);
}
.btn-add:hover { background: var(--brand-soft); color: var(--brand-deep); }

.btn-block  { width: 100%; }
.btn-sm     { min-height: 38px; padding: 8px 14px; font-size: 13.5px; }
.btn-lg     { min-height: 52px; padding: 15px 26px; font-size: 16px; }

/* A logout control is a POST (a GET logout can be triggered by an <img> on
   another site), so it is a button that has to look like a link. */
.btn-link {
  background: none; border: none; padding: 0;
  color: var(--muted); font-size: 14px; cursor: pointer; text-decoration: underline;
}
.btn-link:hover { color: var(--ink); }

/* ── Forms ───────────────────────────────────────────────────────────────── */
.field { display: grid; gap: 6px; }
.field > label { font-size: 14px; font-weight: 600; color: var(--ink-2); }

.input, .select, .textarea {
  width: 100%;
  padding: 11px 13px;
  background: var(--surface);
  border: 1px solid var(--line-2);
  border-radius: var(--r-sm);
  font-size: 16px;   /* 16px or iOS zooms the page on focus */
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
}
.textarea { min-height: 96px; resize: vertical; }

.field-error .input, .field-error .select, .field-error .textarea { border-color: var(--stop); }
.error-text { font-size: 13.5px; color: var(--stop); }
.hint { font-size: 13.5px; color: var(--muted); }

/* ── Alerts ──────────────────────────────────────────────────────────────── */
.alert {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 12px 15px;
  border: 1px solid var(--line);
  border-left-width: 3px;
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
  font-size: 14.5px;
  background: var(--surface-2);
}
.alert-success { border-left-color: var(--ok);   background: var(--ok-soft);   border-color: var(--ok-line);   color: var(--ok); }
.alert-error   { border-left-color: var(--stop); background: var(--stop-soft); border-color: var(--stop-line); color: var(--stop); }
.alert-warning { border-left-color: var(--warn); background: var(--warn-soft); border-color: var(--warn-line); color: var(--warn); }
.alert-info    { border-left-color: var(--info); background: var(--info-soft); border-color: var(--info-line); color: var(--info); }

/* ── Badges ──────────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11.5px; font-weight: 700; letter-spacing: .04em;
  padding: 3px 9px;
  border-radius: var(--r-pill);
  border: 1px solid var(--line-2);
  background: var(--sunk);
  color: var(--muted);
  white-space: nowrap;
}
.badge-ok   { color: var(--ok);   background: var(--ok-soft);   border-color: var(--ok-line); }
.badge-warn { color: var(--warn); background: var(--warn-soft); border-color: var(--warn-line); }
.badge-stop { color: var(--stop); background: var(--stop-soft); border-color: var(--stop-line); }
.badge-brand{ color: var(--brand);background: var(--brand-soft);border-color: var(--brand-line); }

.dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: none; }

/* ── Tables ──────────────────────────────────────────────────────────────── */
/* Always inside .table-scroll: a table is the one thing allowed to be wider
   than the screen, and only inside its own scroller so the page body never
   scrolls sideways. */
/* position: relative so a visually-hidden label inside a wide table is
   clipped by this box. Without it the label is placed against the page, and
   the page itself scrolls sideways on a phone. */
.table-scroll { overflow-x: auto; position: relative; }
table { border-collapse: collapse; width: 100%; font-size: 14.5px; }
th {
  text-align: left; font-size: 11.5px; font-weight: 700;
  letter-spacing: .06em; text-transform: uppercase; color: var(--muted);
  padding: 11px 16px; white-space: nowrap;
  border-bottom: 1px solid var(--line-2);
  background: var(--surface-2);
}
td { padding: 12px 16px; border-bottom: 1px solid var(--line); color: var(--ink-2); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
td strong { color: var(--ink); font-weight: 600; }

/* ── Empty states ────────────────────────────────────────────────────────── */
/* An empty list says what would be here and how to make it happen. A blank
   panel reads as a bug, and is reported as one. */
.empty { padding: 40px 24px; text-align: center; color: var(--muted); }
.empty h3 { color: var(--ink-2); margin-bottom: 6px; }
.empty p { font-size: 14.5px; max-width: 46ch; margin-inline: auto; }

/* ── The FSSAI diet mark ─────────────────────────────────────────────────── */
/* A legal convention, drawn at its proper proportions: a square outline with a
   filled circle inside, green for vegetarian and maroon for not. It appears on
   every dish, every basket line and every ticket in the kitchen — the one piece
   of this interface somebody may have a religious reason to rely on.

   Colour is never the only carrier: the filter buttons say the word, and the
   two hues differ in lightness as well as hue. */
.diet {
  display: inline-flex; align-items: center; justify-content: center;
  width: 16px; height: 16px; flex: none;
  border: 1.8px solid var(--nonveg);
  border-radius: 3px;
  background: var(--surface);
}
.diet::after { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--nonveg); }
.diet.is-veg { border-color: var(--veg); }
.diet.is-veg::after { background: var(--veg); }
.diet-lg { width: 19px; height: 19px; border-width: 2px; }
.diet-lg::after { width: 8px; height: 8px; }

/* ── The plate ───────────────────────────────────────────────────────────── */
/* A dish's photograph, or the drawn stand-in when there is none. See
   dish_plate() in app/Helpers/functions.php for why it is drawn rather than
   left as a grey box or filled with stock photography of somebody else's food. */
.plate {
  position: relative;
  overflow: hidden;
  border-radius: var(--r);
  background: var(--sunk);
  aspect-ratio: 1;
}
.plate img { width: 100%; height: 100%; object-fit: cover; }

.plate.is-drawn { background: var(--plate-bg, #EFE0CE); }
.plate.is-drawn span { position: absolute; display: block; border-radius: 50%; }
.plate-dish    { left: 50%; top: 48%; transform: translate(-50%,-50%); width: 80%; height: 80%; background: #F8F2E8; }
.plate-food    { left: 50%; top: 48%; transform: translate(-50%,-50%); width: 56%; height: 56%; background: var(--plate-food); }
.plate-garnish { left: 56%; top: 36%; width: 15%; height: 15%; background: var(--plate-garnish); }
.plate-accent  { left: 35%; top: 58%; width: 11%; height: 11%; background: var(--plate-accent); }

/* ── The outlet chip ─────────────────────────────────────────────────────── */
/* Which kitchen is cooking, and how far away it is. Sidhi assigns the outlet
   on the server, so the site has to say WHICH one on every page — a site that
   decides silently feels arbitrary the first time the answer surprises anyone. */
.chip {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 7px 13px 7px 10px;
  border-radius: var(--r-pill);
  border: 1px solid var(--ok-line);
  background: var(--ok-soft);
  font-size: 12.5px; font-weight: 700; color: var(--ok);
  white-space: nowrap; text-decoration: none;
}
.chip .dot { background: var(--ok); }
.chip .chip-meta { font-weight: 500; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.chip.is-asking { border-color: var(--warn-line); background: var(--warn-soft); color: var(--warn); }
.chip.is-asking .dot { background: var(--warn); }
.chip.is-stop { border-color: var(--stop-line); background: var(--stop-soft); color: var(--stop); }
.chip.is-stop .dot { background: var(--stop); }

/* ── Quantity stepper ────────────────────────────────────────────────────── */
.stepper {
  display: inline-flex; align-items: center;
  border: 1.5px solid var(--brand);
  border-radius: var(--r-sm);
  overflow: hidden;
  background: var(--surface);
}
.stepper button {
  width: 38px; height: 38px; flex: none;
  border: 0; background: var(--surface); color: var(--brand);
  font-size: 19px; font-weight: 700; line-height: 1; cursor: pointer;
}
.stepper button:last-child { background: var(--brand); color: var(--brand-ink); }
.stepper button:disabled { opacity: .4; cursor: not-allowed; }
.stepper .n {
  min-width: 34px; text-align: center;
  font-size: 15px; font-weight: 800; font-variant-numeric: tabular-nums;
}
.stepper-sm button { width: 30px; height: 32px; font-size: 16px; }
.stepper-sm .n { min-width: 26px; font-size: 13.5px; }

/* ── Pills ───────────────────────────────────────────────────────────────── */
/* Filters and category rails. Selected is a fill, not a tint: at arm's length
   on a phone a tint reads as "slightly different", not as "chosen". */
.pill {
  display: inline-flex; align-items: center; gap: 7px;
  min-height: 36px; padding: 8px 14px;
  border: 1.5px solid var(--line-2);
  border-radius: var(--r-pill);
  background: var(--surface);
  font-family: var(--font); font-size: 13px; font-weight: 700; color: var(--ink-2);
  white-space: nowrap; cursor: pointer; text-decoration: none;
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.pill:hover { border-color: var(--ink-2); color: var(--ink); }
.pill.is-on { background: var(--ink); border-color: var(--ink); color: var(--surface); }
.pill.is-on:hover { color: var(--surface); }

/* ── The offer / bestseller mark ─────────────────────────────────────────── */
.tag {
  display: inline-flex; align-items: center;
  padding: 3px 8px; border-radius: 5px;
  background: var(--saffron-soft);
  font-size: 10px; font-weight: 800; letter-spacing: .07em; text-transform: uppercase;
  color: var(--warn);
}
.tag-solid { background: var(--saffron); color: var(--ink); }

/* ── The bill ────────────────────────────────────────────────────────────── */
/* views/partials/order_items.php. These classes were in the markup from Phase 4
   and in NO stylesheet — not this one, not the storefront's, not the panels' —
   so every bill, on the customer's confirmation page and on both staff panels,
   ran together as "Subtotal₹480 Delivery Free Total₹480". Defined here because
   all three shells draw it. */
.receipt { display: grid; gap: 10px; }
.receipt-line {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 14px;
  font-size: 15px; color: var(--ink);
}
.receipt-line > div { min-width: 0; }
.receipt-line > .num { flex: none; font-weight: 700; }
.receipt-line .diet { margin-right: 4px; vertical-align: -2px; }
.cart-note { color: var(--muted); font-style: italic; }
.receipt-totals {
  display: grid; gap: 6px;
  margin-top: 4px; padding-top: 10px;
  border-top: 1px solid var(--line);
  font-size: 14px; color: var(--ink-2);
}
.total-row { display: flex; align-items: baseline; justify-content: space-between; gap: 14px; }
.total-row.is-grand {
  margin-top: 4px; padding-top: 9px;
  border-top: 1px solid var(--line);
  font-size: 16.5px; font-weight: 800; color: var(--ink);
}
