/* Direction: RESTROFLOW — food-tech SaaS. Light dashboard, deep navy sidebar, emerald accent. */
/* Completed by the platform from the short form: both modes, every
   palette token, each text-on-ground pair at its floor. To restyle, write the
   short form again (the decisions in one :root) and it is completed again. */

:root {
  --canvas: #f3f5f8;
  --surface: #ffffff;
  --surface-2: #e7eaec;
  --border: #e1e6ee;
  --border-strong: #aab1b1;
  --ink: #0f1b2d;
  --muted: #566579;
  --accent: #047857;
  --accent-hover: #03664a;
  --accent-ink: #ffffff;
  --accent-text: #047857;
  --accent-strong: #046e50;
  --accent-soft: #d2e4e1;
  --accent-border: #87bdb0;
  --success: #15803d;
  --success-ink: #ffffff;
  --success-soft: #d8e7e2;
  --success-strong: #116d34;
  --warning: #b45309;
  --warning-ink: #ffffff;
  --warning-soft: #ebe2db;
  --warning-strong: #994607;
  --danger: #b91c1c;
  --danger-ink: #ffffff;
  --danger-soft: #ecdbde;
  --danger-strong: #b91c1c;
  --chart-1: #047857;
  --chart-2: #138cb1;
  --chart-3: #4b4092;
  --chart-4: #af578a;
  --chart-5: #7f3200;
  --chart-6: #878013;

  --font-display: "Plus Jakarta Sans", ui-sans-serif, system-ui, sans-serif;
  --font-body: "Inter", ui-sans-serif, system-ui, sans-serif;
  --display-weight: 800;
  --display-tracking: -0.02em;
  --radius-card: 16px;
  --radius-btn: 10px;
  --radius-input: 10px;
  --shadow-card: 0 1px 2px rgba(15, 27, 45, 0.05);
  --x-side: #0e1a2b;
  --x-side-ink: #c5d0de;
  --x-side-mute: #7f90a6;
  --x-side-hover: #1a2a41;
  --x-side-line: #22324a;
  --x-on-photo: #ffffff;
  --x-kds: #0b1422;
  --font-mono: "JetBrains Mono Variable", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --font-sans: "Inter", ui-sans-serif, system-ui, sans-serif;
  --eyebrow-tracking: 0.08em;
}

html[data-theme="dark"] {
  --canvas: #010e0a;
  --surface: #1a2623;
  --surface-2: #0e1a16;
  --border: #25302c;
  --border-strong: #4d5654;
  --ink: #f3f5f8;
  --muted: #929999;
  --accent: #047857;
  --accent-hover: #2a8c70;
  --accent-ink: #ffffff;
  --accent-text: #4b9e86;
  --accent-strong: #3b967b;
  --accent-soft: #02251b;
  --accent-border: #023e2d;
  --success: #15803d;
  --success-ink: #ffffff;
  --success-soft: #052715;
  --success-strong: #499c68;
  --warning: #b45309;
  --warning-ink: #ffffff;
  --warning-soft: #281d0a;
  --warning-strong: #c57a40;
  --danger: #b91c1c;
  --danger-ink: #ffffff;
  --danger-soft: #29110e;
  --danger-strong: #d16969;
  --chart-1: #137e5d;
  --chart-2: #2093b8;
  --chart-3: #7a73ca;
  --chart-4: #b65d91;
  --chart-5: #be6436;
  --chart-6: #8e8600;
}

/* RESTROFLOW app shell, tables, charts, POS, kitchen and print styles. Tokens only. */
[hidden] { display: none !important; }
body { --side-w: 16rem; }
#side { position: fixed; inset: 0 auto 0 0; width: var(--side-w); background: var(--x-side); color: var(--x-side-ink); z-index: 40; display: flex; flex-direction: column; transform: translateX(-100%); transition: transform .2s ease, width .2s ease; }
body.side-open #side { transform: none; }
#scrim { display: none; position: fixed; inset: 0; z-index: 35; background: color-mix(in srgb, black 50%, transparent); }
body.side-open #scrim { display: block; }
#main { min-height: 100vh; transition: padding .2s ease; }
@media (min-width: 1024px) {
  #side { transform: none; }
  #main { padding-left: var(--side-w); }
  body.side-collapsed { --side-w: 4.75rem; }
  body.side-collapsed .side-label, body.side-collapsed .side-group { display: none; }
  body.side-collapsed .side-link { justify-content: center; }
  #scrim, body.side-open #scrim { display: none; }
}
.side-nav { overflow-y: auto; flex: 1; padding: .5rem .75rem 1rem; scrollbar-width: thin; }
.side-group { margin: 1rem .5rem .35rem; font-size: .68rem; letter-spacing: .09em; text-transform: uppercase; color: var(--x-side-mute); font-weight: 600; }
.side-link { display: flex; align-items: center; gap: .75rem; padding: .55rem .7rem; border-radius: .6rem; color: var(--x-side-ink); font-size: .875rem; font-weight: 500; transition: background .15s, color .15s; }
.side-link:hover { background: var(--x-side-hover); color: var(--x-on-photo); }
.side-link.on { background: var(--accent); color: var(--x-on-photo); }
.side-link .icon { width: 1.15rem; height: 1.15rem; flex: none; }
.topbar { position: sticky; top: 0; z-index: 30; background: var(--surface); border-bottom: 1px solid var(--border); }
.dd { position: relative; }
.dd > summary { list-style: none; cursor: pointer; }
.dd > summary::-webkit-details-marker { display: none; }
.dd-panel { position: absolute; right: 0; top: calc(100% + .5rem); min-width: 16rem; max-width: 92vw; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: 0 12px 32px color-mix(in srgb, black 14%, transparent); z-index: 50; overflow: hidden; }
.dd-panel a.item { display: block; padding: .6rem .9rem; font-size: .875rem; }
.dd-panel a.item:hover { background: var(--surface-2); }

/* data tables */
.dt-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-card); }
.dt { width: 100%; border-collapse: collapse; font-size: .875rem; }
.dt th { text-align: left; font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; padding: .7rem .9rem; background: var(--surface-2); white-space: nowrap; }
.dt th[data-sort] { cursor: pointer; user-select: none; }
.dt th[data-sort]:hover { color: var(--ink); }
.dt th[data-dir="asc"]::after { content: " \2191"; }
.dt th[data-dir="desc"]::after { content: " \2193"; }
.dt td { padding: .65rem .9rem; border-top: 1px solid var(--border); vertical-align: middle; }
.dt tbody tr:hover { background: color-mix(in srgb, var(--accent) 4%, transparent); }
.dt td.num, .dt th.num { text-align: right; font-variant-numeric: tabular-nums; }
.dt tr[hidden] { display: none; }

/* kpi + charts */
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-card); padding: 1rem 1.1rem; box-shadow: var(--shadow-card); }
.kpi .v { font-family: var(--font-display); font-weight: 800; font-size: 1.55rem; letter-spacing: -.02em; line-height: 1.15; }
.vbars { display: flex; align-items: flex-end; gap: 3px; height: 170px; padding-top: 1.2rem; }
.vbars .col { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; height: 100%; min-width: 0; }
.vbars .bar { background: var(--accent); border-radius: 4px 4px 0 0; min-height: 2px; transition: opacity .15s; transform-origin: bottom; animation: grow .6s ease both; }
.vbars .col:hover .bar { opacity: .75; }
.vlabels { display: flex; gap: 3px; margin-top: .35rem; font-size: .65rem; color: var(--muted); }
.vlabels span { flex: 1; text-align: center; overflow: hidden; white-space: nowrap; min-width: 0; }
.hbar { height: .5rem; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.hbar > i { display: block; height: 100%; background: var(--accent); border-radius: 999px; }
@keyframes grow { from { transform: scaleY(.1); } to { transform: scaleY(1); } }
html.reduced-motion .vbars .bar { animation: none; }

/* wizard */
.wz-dots { display: flex; gap: .4rem; }
.wz-dots i { flex: 1; height: .3rem; border-radius: 99px; background: var(--border); }
.wz-dots i.on { background: var(--accent); }

/* floor */
.floor { display: grid; gap: .9rem; grid-template-columns: repeat(auto-fill, minmax(10.5rem, 1fr)); }
.tbl { border: 2px solid var(--border); border-radius: 18px; padding: .9rem; background: var(--surface); }
.tbl.s-available { border-color: var(--success); }
.tbl.s-occupied { border-color: var(--danger); background: var(--danger-soft); }
.tbl.s-reserved { border-color: var(--warning); background: var(--warning-soft); }
.tbl.s-cleaning { border-color: var(--border-strong); background: var(--surface-2); }

/* kitchen display */
.kds { background: var(--x-kds); color: var(--x-on-photo); min-height: 100vh; }
.kds-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr)); align-items: start; }
.kds-col h2 { font-size: 1.1rem; letter-spacing: .06em; text-transform: uppercase; margin-bottom: .75rem; color: var(--x-side-ink); }
.kds-card { background: var(--x-side); border: 2px solid var(--x-side-line); border-radius: 16px; padding: 1rem; margin-bottom: .8rem; font-size: 1.1rem; }
.kds-card.late { border-color: var(--danger); }
.kds-card li { font-size: 1.2rem; font-weight: 600; padding: .15rem 0; }
.kds-card .btn { width: 100%; font-size: 1.05rem; padding: .8rem; margin-top: .6rem; }

/* POS */
.pos-grid { display: grid; gap: 1rem; grid-template-columns: 1fr; }
@media (min-width: 1024px) { .pos-grid { grid-template-columns: minmax(0, 1fr) 24rem; } }
.pos-prod { text-align: left; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: .75rem; transition: border-color .15s, transform .1s; }
.pos-prod:hover { border-color: var(--accent); }
.pos-prod:active { transform: scale(.98); }
.pos-prod[hidden] { display: none; }
.diet { display: inline-block; width: .8rem; height: .8rem; border: 1.5px solid; border-radius: 3px; position: relative; flex: none; }
.diet::after { content: ""; position: absolute; inset: 2px; border-radius: 50%; background: currentColor; }
.diet.veg { color: var(--success); } .diet.nonveg { color: var(--danger); } .diet.egg { color: var(--warning); }

/* public menu */
.cartbar { position: fixed; left: 1rem; right: 1rem; bottom: 1rem; z-index: 30; }
.cartbar[hidden] { display: none; }

/* receipts and print */
.receipt { max-width: 26rem; margin: 0 auto; background: var(--surface); padding: 1.5rem; border: 1px dashed var(--border-strong); font-family: var(--font-mono); font-size: .8rem; }
.receipt hr { border: 0; border-top: 1px dashed var(--border-strong); margin: .6rem 0; }
.invoice { max-width: 52rem; margin: 0 auto; background: var(--surface); padding: 2rem; border: 1px solid var(--border); border-radius: 12px; }
@media print {
  .no-print, #side, .topbar, #scrim, .cartbar { display: none !important; }
  #main { padding: 0 !important; }
  body { background: var(--surface) !important; }
  .receipt, .invoice { border: 0; }
  .qr-print { break-inside: avoid; }
}
#loadbar { position: fixed; top: 0; left: 0; height: 3px; width: 0; background: var(--accent); z-index: 100; transition: width .3s ease, opacity .3s ease; opacity: 0; }
body.htmx-busy #loadbar { width: 80%; opacity: 1; }
.fade-in { animation: fadeUp .35s ease both; }
@keyframes fadeUp { from { transform: translateY(8px); } to { transform: none; } }
html.reduced-motion .fade-in { animation: none; }
