/* =====================================================================
   HRCloud - shared styles
   Deep navy base, glowing panels, one gradient colour per metric.
   ===================================================================== */
/* fonts are served from /fonts (SIL Open Font License) - no external requests */
@font-face { font-family: "Outfit"; font-style: normal; font-weight: 500; font-display: swap; src: url("../fonts/outfit-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Outfit"; font-style: normal; font-weight: 600; font-display: swap; src: url("../fonts/outfit-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Outfit"; font-style: normal; font-weight: 700; font-display: swap; src: url("../fonts/outfit-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "Outfit"; font-style: normal; font-weight: 800; font-display: swap; src: url("../fonts/outfit-latin-800-normal.woff2") format("woff2"); }
@font-face { font-family: "DM Sans"; font-style: normal; font-weight: 400; font-display: swap; src: url("../fonts/dm-sans-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "DM Sans"; font-style: normal; font-weight: 500; font-display: swap; src: url("../fonts/dm-sans-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "DM Sans"; font-style: normal; font-weight: 600; font-display: swap; src: url("../fonts/dm-sans-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "DM Sans"; font-style: normal; font-weight: 700; font-display: swap; src: url("../fonts/dm-sans-latin-700-normal.woff2") format("woff2"); }

:root {
  --bg: #060b1d;
  --bg-2: #0a1230;
  --panel: #0d1734;
  --panel-2: #111e42;
  --line: rgba(129, 156, 255, .13);
  --line-2: rgba(129, 156, 255, .22);
  --text: #eef2ff;
  --text-2: #a9b4d6;
  --text-3: #6f7ba3;

  --cyan: #22d3ee;
  --blue: #3b82f6;
  --indigo: #6366f1;
  --violet: #8b5cf6;
  --fuchsia: #d946ef;
  --pink: #ec4899;
  --rose: #f43f5e;
  --amber: #f59e0b;
  --orange: #fb923c;
  --emerald: #10b981;
  --teal: #14b8a6;
  --lime: #a3e635;

  --g-sales: linear-gradient(135deg, #22d3ee 0%, #3b82f6 55%, #6366f1 100%);
  --g-mesas: linear-gradient(135deg, #a78bfa 0%, #8b5cf6 45%, #d946ef 100%);
  --g-llevar: linear-gradient(135deg, #fbbf24 0%, #f59e0b 45%, #fb7185 100%);
  --g-exp: linear-gradient(135deg, #fb7185 0%, #f43f5e 50%, #ec4899 100%);
  --g-profit: linear-gradient(135deg, #34d399 0%, #10b981 50%, #14b8a6 100%);
  --g-orders: linear-gradient(135deg, #60a5fa 0%, #6366f1 60%, #8b5cf6 100%);
  --g-ticket: linear-gradient(135deg, #2dd4bf 0%, #22d3ee 50%, #a3e635 100%);

  --radius-lg: 22px;
  --radius: 16px;
  --radius-sm: 11px;
  --shadow: 0 24px 60px -28px rgba(2, 6, 23, .9), 0 0 0 1px var(--line) inset;
  --font-display: "Outfit", "Segoe UI", system-ui, sans-serif;
  --font-body: "DM Sans", "Segoe UI", system-ui, sans-serif;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --sidebar: 248px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(1100px 600px at 85% -10%, rgba(59, 130, 246, .20), transparent 60%),
    radial-gradient(900px 520px at -10% 30%, rgba(139, 92, 246, .16), transparent 60%),
    radial-gradient(900px 600px at 60% 110%, rgba(16, 185, 129, .10), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font: 15px/1.5 var(--font-body);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--cyan); text-decoration: none; }
button, input, select { font: inherit; color: inherit; }
.num, .kpi-value, .money { font-family: var(--font-display); font-variant-numeric: tabular-nums; }
:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; border-radius: 8px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }

/* ---------------------------------------------------------------------
   App shell: sidebar (desktop) / top bar + bottom bar (phone)
   --------------------------------------------------------------------- */
.shell { display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100vh; }

.sidebar {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; gap: 6px;
  padding: 22px 16px;
  background: linear-gradient(180deg, rgba(13, 23, 52, .92), rgba(8, 14, 36, .92));
  border-right: 1px solid var(--line);
  backdrop-filter: blur(14px);
}
.brand { display: flex; align-items: center; gap: 12px; padding: 4px 10px 22px; }
.brand-mark {
  width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center;
  background: var(--g-sales); box-shadow: 0 10px 30px -8px rgba(34, 211, 238, .7);
  font: 800 19px/1 var(--font-display); color: #04122b;
}
.brand-name { font: 700 19px/1.1 var(--font-display); letter-spacing: -.01em; }
.brand-name small { display: block; font: 500 12px/1.3 var(--font-body); color: var(--text-3); letter-spacing: 0; }

.nav-link {
  position: relative; display: flex; align-items: center; gap: 12px;
  padding: 11px 14px; border-radius: 12px; color: var(--text-2);
  font-weight: 500; transition: background .2s var(--ease), color .2s var(--ease);
  border: 0; background: none; width: 100%; text-align: left; cursor: pointer;
}
.nav-link svg { width: 20px; height: 20px; flex: none; }
.nav-link:hover { background: rgba(129, 156, 255, .08); color: var(--text); }
.nav-link.active {
  color: #fff;
  background: linear-gradient(90deg, rgba(59, 130, 246, .38), rgba(99, 102, 241, .14));
  box-shadow: 0 0 0 1px rgba(96, 165, 250, .35) inset, 0 10px 30px -14px rgba(59, 130, 246, .9);
}
.nav-link.active::before {
  content: ""; position: absolute; left: -16px; top: 9px; bottom: 9px; width: 4px;
  border-radius: 0 4px 4px 0; background: var(--g-sales);
}
.sidebar-spacer { flex: 1; }
.user-chip {
  display: flex; align-items: center; gap: 11px; padding: 12px; border-radius: 14px;
  background: rgba(129, 156, 255, .06); border: 1px solid var(--line);
}
.avatar {
  width: 38px; height: 38px; border-radius: 50%; flex: none; display: grid; place-items: center;
  background: var(--g-mesas); font: 700 15px/1 var(--font-display); color: #fff;
}
.user-chip .who { min-width: 0; }
.user-chip .who b { display: block; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-chip .who span { color: var(--text-3); font-size: 12.5px; }

.main { min-width: 0; padding: 26px 30px 60px; }
.topbar { display: none; }
.bottombar { display: none; }

/* ---------------------------------------------------------------------
   Page header
   --------------------------------------------------------------------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head h1 { margin: 0; font: 700 clamp(24px, 3vw, 32px)/1.15 var(--font-display); letter-spacing: -.02em; }
.page-head p { margin: 4px 0 0; color: var(--text-2); }
.head-tools { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* sync status pill */
.sync-pill {
  display: inline-flex; align-items: center; gap: 8px; padding: 8px 13px; border-radius: 999px;
  background: rgba(16, 185, 129, .10); border: 1px solid rgba(16, 185, 129, .3); color: #a7f3d0;
  font-size: 13px; font-weight: 500; white-space: nowrap;
}
.sync-pill .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--emerald); box-shadow: 0 0 0 0 rgba(16, 185, 129, .7); animation: pulse 2.4s infinite; }
.sync-pill.late { background: rgba(245, 158, 11, .10); border-color: rgba(245, 158, 11, .35); color: #fde68a; }
.sync-pill.late .dot { background: var(--amber); animation: none; }
.sync-pill.off { background: rgba(244, 63, 94, .10); border-color: rgba(244, 63, 94, .35); color: #fecdd3; }
.sync-pill.off .dot { background: var(--rose); animation: none; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, .6); } 70% { box-shadow: 0 0 0 9px rgba(16, 185, 129, 0); } 100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); } }

/* ---------------------------------------------------------------------
   Controls
   --------------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 18px; border-radius: 12px; border: 1px solid var(--line-2);
  background: rgba(129, 156, 255, .07); color: var(--text); font-weight: 600; cursor: pointer;
  transition: transform .15s var(--ease), background .2s var(--ease), box-shadow .2s var(--ease), opacity .2s;
  white-space: nowrap; text-decoration: none;
}
.btn svg { width: 18px; height: 18px; }
.btn:hover { background: rgba(129, 156, 255, .13); }
.btn:active { transform: scale(.97); }
.btn[disabled] { opacity: .55; pointer-events: none; }
.btn-primary {
  border: 0; color: #fff;
  background: linear-gradient(135deg, #3b82f6, #6366f1 60%, #8b5cf6);
  box-shadow: 0 12px 30px -12px rgba(99, 102, 241, .95);
}
.btn-primary:hover { background: linear-gradient(135deg, #4f8ff7, #7376f3 60%, #9a6ff7); }
.btn-green { border: 0; color: #032018; background: var(--g-profit); box-shadow: 0 12px 30px -12px rgba(16, 185, 129, .9); }
.btn-danger { border-color: rgba(244, 63, 94, .4); color: #fecdd3; background: rgba(244, 63, 94, .1); }
.btn-sm { padding: 7px 12px; border-radius: 10px; font-size: 13.5px; }
.btn-icon { padding: 9px; border-radius: 11px; }
.btn.loading { position: relative; color: transparent !important; }
.btn.loading::after {
  content: ""; position: absolute; width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, .35); border-top-color: #fff; animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.field { display: grid; gap: 7px; margin-bottom: 15px; }
.field label { font-size: 13.5px; font-weight: 600; color: var(--text-2); }
.input, select.input {
  width: 100%; padding: 12px 14px; border-radius: 12px;
  background: rgba(6, 11, 29, .7); border: 1px solid var(--line-2); color: var(--text);
  transition: border-color .2s, box-shadow .2s; outline: none;
}
.input:focus { border-color: rgba(34, 211, 238, .7); box-shadow: 0 0 0 4px rgba(34, 211, 238, .14); }
.input::placeholder { color: var(--text-3); }
select.input { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--text-2) 50%), linear-gradient(135deg, var(--text-2) 50%, transparent 50%); background-position: calc(100% - 20px) 52%, calc(100% - 15px) 52%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 36px; }
select.input option { background: #0d1734; }
.hint { font-size: 12.5px; color: var(--text-3); }
.check { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); cursor: pointer; transition: background .2s, border-color .2s; }
.check:hover { background: rgba(129, 156, 255, .06); }
.check input { width: 18px; height: 18px; accent-color: var(--blue); }
.check:has(input:checked) { border-color: rgba(59, 130, 246, .55); background: rgba(59, 130, 246, .1); }

/* restaurant switcher */
.rest-switch { position: relative; }
.rest-btn {
  display: inline-flex; align-items: center; gap: 10px; padding: 9px 14px 9px 10px;
  border-radius: 14px; border: 1px solid var(--line-2); background: rgba(13, 23, 52, .8); cursor: pointer;
  max-width: 320px; transition: background .2s;
}
.rest-btn:hover { background: rgba(17, 30, 66, .95); }
.rest-btn .rest-ico { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; background: var(--g-llevar); color: #2a1300; flex: none; }
.rest-btn .rest-ico svg { width: 18px; height: 18px; }
.rest-btn b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.rest-btn .chev { width: 16px; height: 16px; color: var(--text-3); transition: transform .25s var(--ease); flex: none; }
.rest-switch.open .chev { transform: rotate(180deg); }
.rest-menu {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 40; width: min(340px, 92vw);
  padding: 8px; border-radius: 18px; background: rgba(13, 23, 52, .98); border: 1px solid var(--line-2);
  box-shadow: 0 30px 70px -20px rgba(0, 0, 0, .8); backdrop-filter: blur(16px);
  transform-origin: top right; transform: translateY(-6px) scale(.97); opacity: 0; pointer-events: none;
  transition: transform .22s var(--ease), opacity .18s;
}
.rest-switch.open .rest-menu { transform: none; opacity: 1; pointer-events: auto; }
.rest-item { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 12px; border-radius: 12px; border: 0; background: none; text-align: left; cursor: pointer; }
.rest-item:hover, .rest-item.sel { background: rgba(59, 130, 246, .13); }
.rest-item .grow { flex: 1; min-width: 0; }
.rest-item b { display: block; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rest-item span { font-size: 12.5px; color: var(--text-3); }
.rest-item .today { font: 600 14px/1 var(--font-display); color: #a5f3fc; white-space: nowrap; }
.rest-search { margin: 2px 2px 8px; }

/* period segmented control with a sliding highlight */
.periods {
  position: relative; display: inline-flex; padding: 5px; gap: 2px; border-radius: 16px;
  background: rgba(13, 23, 52, .85); border: 1px solid var(--line); margin-bottom: 22px;
  max-width: 100%; overflow-x: auto; scrollbar-width: none;
}
.periods::-webkit-scrollbar { display: none; }
.periods .glider {
  position: absolute; top: 5px; bottom: 5px; left: 0; width: 0; border-radius: 12px;
  background: var(--g-sales); box-shadow: 0 10px 26px -10px rgba(34, 211, 238, .9);
  transition: transform .38s var(--ease), width .38s var(--ease);
}
.periods button {
  position: relative; z-index: 1; padding: 9px 18px; border: 0; border-radius: 12px; background: none;
  color: var(--text-2); font-weight: 600; cursor: pointer; white-space: nowrap; transition: color .25s;
}
.periods button.active { color: #03122b; }
/* ‹ previous / next period › */
.period-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 22px; }
.period-row .periods { margin-bottom: 0; }
.period-nav {
  display: inline-flex; align-items: center; gap: 4px; padding: 5px; border-radius: 16px;
  background: rgba(13, 23, 52, .85); border: 1px solid var(--line);
}
.pn-btn {
  width: 38px; height: 38px; display: grid; place-items: center; border: 0; border-radius: 12px; cursor: pointer;
  background: rgba(129, 156, 255, .08); color: var(--text); transition: background .2s, transform .15s var(--ease), opacity .2s;
}
.pn-btn svg { width: 20px; height: 20px; }
.pn-btn:hover:not([disabled]) { background: rgba(59, 130, 246, .28); }
.pn-btn:active:not([disabled]) { transform: scale(.92); }
.pn-btn[disabled] { opacity: .3; cursor: default; }
.pn-label { min-width: 168px; overflow: hidden; text-align: center; padding: 0 6px; }
.pn-label > span { display: inline-block; font: 600 15px/1.2 var(--font-display); white-space: nowrap; }
.pn-label > span.from-l { animation: pnFromL .32s var(--ease); }
.pn-label > span.from-r { animation: pnFromR .32s var(--ease); }
@keyframes pnFromL { from { opacity: 0; transform: translateX(-18px); } }
@keyframes pnFromR { from { opacity: 0; transform: translateX(18px); } }
.custom-range { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: -10px 0 22px; }
.custom-range { align-items: flex-end; }
.custom-range .dt { display: grid; gap: 4px; font-size: 12.5px; color: var(--text-3); }
.custom-range .input { width: auto; padding: 9px 12px; color-scheme: dark; }

/* ---------------------------------------------------------------------
   Panels / cards
   --------------------------------------------------------------------- */
.panel {
  position: relative; min-width: 0;
  padding: 20px 22px; border-radius: var(--radius-lg);
  background: linear-gradient(180deg, rgba(17, 30, 66, .78), rgba(11, 19, 44, .78));
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}
.panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px 14px; margin-bottom: 14px; flex-wrap: wrap; }
.panel-head h2 { margin: 0; font: 600 17px/1.3 var(--font-display); letter-spacing: -.005em; }
.panel-head p { margin: 2px 0 0; color: var(--text-3); font-size: 13px; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 13px; color: var(--text-2); }
.legend i { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; vertical-align: 1px; }

.grid { display: grid; gap: 18px; }
.kpis { grid-template-columns: 1.4fr repeat(4, 1fr); margin-bottom: 18px; }
.row-2 { grid-template-columns: 2fr 1fr; margin-bottom: 18px; }
.row-3 { grid-template-columns: repeat(3, 1fr); margin-bottom: 18px; }
.row-tables { grid-template-columns: 1.35fr 1fr; }

/* KPI */
.kpi { padding: 18px 20px 18px; overflow: hidden; }
.kpi::after {
  content: ""; position: absolute; right: -40px; top: -40px; width: 140px; height: 140px; border-radius: 50%;
  background: var(--kg, var(--g-sales)); opacity: .16; filter: blur(28px); pointer-events: none;
}
.kpi-top { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.kpi-ico { width: 40px; height: 40px; border-radius: 13px; display: grid; place-items: center; background: var(--kg, var(--g-sales)); color: #fff; flex: none; box-shadow: 0 10px 24px -10px var(--kc, rgba(34, 211, 238, .9)); }
.kpi-ico svg { width: 21px; height: 21px; }
.kpi-label { color: var(--text-2); font-size: 14px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.kpi-value { font-size: clamp(22px, 2.2vw, 28px); font-weight: 700; letter-spacing: -.02em; line-height: 1.1; white-space: nowrap; }
.kpi-value small { font-size: .55em; font-weight: 600; color: var(--text-3); margin-right: 4px; letter-spacing: 0; }
.kpi-foot { display: flex; align-items: center; gap: 8px; margin-top: 9px; font-size: 12.5px; color: var(--text-3); flex-wrap: wrap; }
.trend { display: inline-flex; align-items: center; gap: 3px; padding: 3px 8px; border-radius: 999px; font-weight: 700; font-size: 12.5px; }
.trend svg { width: 13px; height: 13px; }
.trend.up { color: #6ee7b7; background: rgba(16, 185, 129, .14); }
.trend.down { color: #fda4af; background: rgba(244, 63, 94, .14); }
.trend.flat { color: var(--text-2); background: rgba(129, 156, 255, .1); }
.trend.good-down { color: #6ee7b7; background: rgba(16, 185, 129, .14); }
.trend.bad-up { color: #fda4af; background: rgba(244, 63, 94, .14); }

.kpi.hero { padding: 22px 24px; background: linear-gradient(140deg, rgba(34, 211, 238, .20), rgba(59, 130, 246, .18) 45%, rgba(99, 102, 241, .22)), linear-gradient(180deg, rgba(17, 30, 66, .9), rgba(11, 19, 44, .9)); box-shadow: 0 0 0 1px rgba(96, 165, 250, .35) inset, 0 30px 60px -30px rgba(59, 130, 246, .8); }
.kpi.hero .kpi-value { font-size: clamp(30px, 3.4vw, 42px); }
.split { display: flex; gap: 6px; margin-top: 14px; height: 8px; border-radius: 999px; overflow: hidden; background: rgba(255, 255, 255, .06); }
.split span { display: block; height: 100%; border-radius: 999px; width: 0; transition: width 1s var(--ease); }
.split .m { background: var(--g-mesas); }
.split .l { background: var(--g-llevar); }
.split-legend { display: flex; justify-content: space-between; gap: 10px; margin-top: 9px; font-size: 12.5px; color: var(--text-2); }
.split-legend > span { display: grid; gap: 1px; }
.split-legend > span:last-child { text-align: right; justify-items: end; }
.split-legend b { font-family: var(--font-display); color: var(--text); font-weight: 600; font-size: 14px; white-space: nowrap; }
.split-legend .sw { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; }
.split-legend .sw.m { background: var(--g-mesas); }
.split-legend .sw.l { background: var(--g-llevar); }

/* chart */
.chart-box { position: relative; height: 290px; }
.chart-box.sm { height: 210px; }
.donut-wrap { display: grid; grid-template-columns: 1fr; gap: 18px; justify-items: center; }
.donut-wrap .dlist { width: 100%; }
.donut-box { position: relative; width: 180px; height: 180px; }
.donut-center { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; pointer-events: none; }
.donut-center b { display: block; font: 700 18px/1.1 var(--font-display); }
.donut-center span { font-size: 12px; color: var(--text-3); }
.dlist { list-style: none; margin: 0; padding: 0; display: grid; gap: 9px; }
.dlist li { display: grid; grid-template-columns: 12px 1fr auto; gap: 9px; align-items: center; font-size: 13.5px; }
.dlist i { width: 10px; height: 10px; border-radius: 50%; }
.dlist .nm { color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dlist .vl { font-family: var(--font-display); font-weight: 600; white-space: nowrap; }
.dlist .pc { color: var(--text-3); font-weight: 500; margin-left: 6px; font-size: 12px; }

/* top products */
.bars { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.bars li { display: grid; gap: 6px; }
.bars .bt { display: flex; justify-content: space-between; gap: 10px; font-size: 13.5px; }
.bars .bt span:first-child { color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bars .bt span:last-child { color: var(--text-2); white-space: nowrap; font-family: var(--font-display); }
.bars .track { height: 9px; border-radius: 999px; background: rgba(255, 255, 255, .06); overflow: hidden; }
.bars .fill { height: 100%; width: 0; border-radius: 999px; transition: width 1.1s var(--ease); }

/* tables */
.table-wrap { overflow-x: auto; margin: 0 -6px; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: left; font-weight: 600; color: var(--text-3); font-size: 12.5px; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 11px 10px; border-bottom: 1px solid rgba(129, 156, 255, .07); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl .r { text-align: right; white-space: nowrap; }
.tbl tbody tr { transition: background .15s; }
.tbl tbody tr:hover { background: rgba(129, 156, 255, .05); }
.tag { display: inline-block; padding: 3px 9px; border-radius: 8px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.tag.cash { color: #fde68a; background: rgba(245, 158, 11, .14); }
.tag.transfer { color: #bae6fd; background: rgba(59, 130, 246, .16); }
.tag.other { color: var(--text-2); background: rgba(129, 156, 255, .1); }
.tag.ok { color: #a7f3d0; background: rgba(16, 185, 129, .14); }
.tag.warn { color: #fde68a; background: rgba(245, 158, 11, .14); }
.tag.bad { color: #fecdd3; background: rgba(244, 63, 94, .14); }
.tag.violet { color: #ddd6fe; background: rgba(139, 92, 246, .16); }

/* activity */
.activity { list-style: none; margin: 0; padding: 0; display: grid; }
.activity li { display: grid; grid-template-columns: 40px 1fr auto; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid rgba(129, 156, 255, .07); }
.activity li:last-child { border-bottom: 0; }
.act-ico { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; }
.act-ico svg { width: 19px; height: 19px; }
.act-ico.m { background: rgba(139, 92, 246, .18); color: #c4b5fd; }
.act-ico.l { background: rgba(245, 158, 11, .16); color: #fcd34d; }
.act-ico.g { background: rgba(244, 63, 94, .16); color: #fda4af; }
.activity b { display: block; font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.activity span { color: var(--text-3); font-size: 12.5px; }
.activity .amt { font: 600 14.5px/1 var(--font-display); white-space: nowrap; }
.amt.plus { color: #6ee7b7; }
.amt.minus { color: #fda4af; }

.empty { display: grid; place-items: center; gap: 6px; text-align: center; padding: 30px 10px; color: var(--text-3); font-size: 14px; }
.empty svg { width: 34px; height: 34px; color: var(--text-3); opacity: .6; }

.open-now { display: inline-flex; align-items: center; gap: 8px; padding: 8px 13px; border-radius: 999px; font-size: 13px; background: rgba(139, 92, 246, .14); border: 1px solid rgba(139, 92, 246, .35); color: #ddd6fe; white-space: nowrap; }
.open-now svg { width: 16px; height: 16px; }
.open-now b { font-family: var(--font-display); }

/* deleted / edited lines */
.mini-tabs { display: inline-flex; gap: 2px; padding: 4px; border-radius: 12px; background: rgba(6, 11, 29, .6); border: 1px solid var(--line); }
.mini-tabs button { border: 0; background: none; color: var(--text-2); font-weight: 600; font-size: 13px; padding: 6px 12px; border-radius: 9px; cursor: pointer; transition: background .2s, color .2s; }
.mini-tabs button.active { background: rgba(129, 156, 255, .16); color: var(--text); }
.del-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 14px; }
.del-stat { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 14px; border: 1px solid var(--line); }
.del-stat.d { background: linear-gradient(135deg, rgba(244, 63, 94, .14), rgba(244, 63, 94, .04)); border-color: rgba(244, 63, 94, .25); }
.del-stat.e { background: linear-gradient(135deg, rgba(245, 158, 11, .14), rgba(245, 158, 11, .04)); border-color: rgba(245, 158, 11, .25); }
.del-ico { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; flex: none; }
.del-ico svg { width: 18px; height: 18px; }
.del-stat.d .del-ico { background: rgba(244, 63, 94, .2); color: #fda4af; }
.del-stat.e .del-ico { background: rgba(245, 158, 11, .2); color: #fcd34d; }
.del-stat > div { flex: 1; min-width: 0; }
.del-stat b { display: block; font: 700 20px/1.1 var(--font-display); }
.del-stat span { font-size: 12.5px; color: var(--text-2); }
.del-stat strong { font-size: 15px; font-weight: 600; white-space: nowrap; }
.tag.del { color: #fecdd3; background: rgba(244, 63, 94, .15); }
.tag.edi { color: #fde68a; background: rgba(245, 158, 11, .15); }
.del-tbl .muted { color: var(--text-2); }

/* ---------------------------------------------------------------------
   Loading skeleton + orchestrated entrance
   --------------------------------------------------------------------- */
.skel { position: relative; overflow: hidden; border-radius: 10px; background: rgba(129, 156, 255, .08); color: transparent !important; }
.skel::after { content: ""; position: absolute; inset: 0; transform: translateX(-100%); background: linear-gradient(90deg, transparent, rgba(160, 185, 255, .14), transparent); animation: shimmer 1.3s infinite; }
@keyframes shimmer { to { transform: translateX(100%); } }

.reveal { opacity: 0; transform: translateY(14px) scale(.985); }
.revealed .reveal { animation: rise .7s var(--ease) forwards; animation-delay: calc(var(--i, 0) * 70ms); }
@keyframes rise { to { opacity: 1; transform: none; } }

.swap { transition: opacity .25s var(--ease), transform .25s var(--ease); }
.refreshing .swap { opacity: .45; transform: translateY(2px); }

/* ---------------------------------------------------------------------
   Toast + modal
   --------------------------------------------------------------------- */
.toasts { position: fixed; z-index: 100; left: 50%; bottom: 26px; transform: translateX(-50%); display: grid; gap: 10px; width: min(420px, 92vw); pointer-events: none; }
.toast {
  display: flex; align-items: center; gap: 11px; padding: 13px 16px; border-radius: 14px;
  background: rgba(13, 23, 52, .97); border: 1px solid var(--line-2); box-shadow: 0 20px 50px -18px rgba(0, 0, 0, .9);
  animation: toastIn .35s var(--ease); pointer-events: auto; font-weight: 500;
}
.toast svg { width: 20px; height: 20px; flex: none; }
.toast.ok svg { color: var(--emerald); }
.toast.err svg { color: var(--rose); }
.toast.out { animation: toastOut .3s var(--ease) forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateY(14px) scale(.96); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(10px) scale(.96); } }

.modal-back {
  position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 18px;
  background: rgba(2, 6, 23, .66); backdrop-filter: blur(6px);
  opacity: 0; transition: opacity .22s;
}
.modal-back.show { opacity: 1; }
.modal {
  width: min(520px, 100%); max-height: calc(100vh - 36px); overflow: auto;
  padding: 24px; border-radius: 22px; background: linear-gradient(180deg, #111e42, #0c1634);
  border: 1px solid var(--line-2); box-shadow: 0 40px 90px -30px rgba(0, 0, 0, .9);
  transform: translateY(18px) scale(.97); transition: transform .28s var(--ease);
}
.modal-back.show .modal { transform: none; }
.modal h3 { margin: 0 0 4px; font: 700 20px/1.25 var(--font-display); }
.modal > p { margin: 0 0 18px; color: var(--text-2); font-size: 14px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; flex-wrap: wrap; }

.code-box {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 16px 18px; border-radius: 16px;
  background: rgba(6, 11, 29, .8); border: 1px dashed rgba(34, 211, 238, .5); margin: 6px 0 12px;
}
.code-box code { font: 700 24px/1.2 var(--font-display); letter-spacing: .08em; color: #a5f3fc; word-break: break-all; }
.code-box code.long { font-size: 14px; letter-spacing: 0; }

/* ---------------------------------------------------------------------
   Responsive
   --------------------------------------------------------------------- */
@media (max-width: 1280px) {
  .kpis { grid-template-columns: repeat(3, 1fr); }
  .kpi.hero { grid-column: span 3; }
  .row-3 { grid-template-columns: 1fr 1fr; }
  .row-3 > :last-child { grid-column: span 2; }
}
@media (max-width: 1020px) {
  :root { --sidebar: 0px; }
  .shell { display: block; }
  .sidebar { display: none; }
  .main { padding: 82px 16px calc(92px + env(safe-area-inset-bottom, 0px)); }
  .topbar {
    display: flex; position: fixed; z-index: 50; left: 0; right: 0; top: 0; height: 64px;
    align-items: center; gap: 12px; padding: 0 14px;
    background: rgba(6, 11, 29, .82); border-bottom: 1px solid var(--line); backdrop-filter: blur(16px);
  }
  .topbar .brand { padding: 0; flex: 1; min-width: 0; }
  .topbar .brand-mark { width: 34px; height: 34px; font-size: 17px; }
  .bottombar {
    display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; position: fixed; z-index: 50; left: 0; right: 0; bottom: 0;
    padding: 6px 8px; border-radius: 18px 18px 0 0; background: rgba(13, 23, 52, .96);
    border: 1px solid var(--line-2); border-bottom: 0;
    backdrop-filter: blur(16px); box-shadow: 0 -12px 40px -16px rgba(0, 0, 0, .9);
    padding-bottom: calc(6px + env(safe-area-inset-bottom, 0px));
  }
  .toasts { bottom: calc(84px + env(safe-area-inset-bottom, 0px)); }
  .bottombar .nav-link { flex-direction: column; gap: 3px; padding: 8px 4px; font-size: 11.5px; text-align: center; align-items: center; }
  .bottombar .nav-link.active::before { display: none; }
  .row-2, .row-tables { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  body { font-size: 14.5px; }
  .kpis { grid-template-columns: 1fr 1fr; gap: 12px; }
  .kpi.hero { grid-column: span 2; }
  .kpi { padding: 15px 15px 14px; }
  .kpi-ico { width: 34px; height: 34px; border-radius: 11px; }
  .kpi-ico svg { width: 18px; height: 18px; }
  .kpi-top { gap: 9px; margin-bottom: 9px; }
  .kpi-label { font-size: 13px; }
  .kpi-value { font-size: 19px; }
  .kpi.hero .kpi-value { font-size: 32px; }
  .row-3 { grid-template-columns: 1fr; }
  .row-3 > :last-child { grid-column: auto; }
  .grid { gap: 12px; }
  .row-2, .row-3, .kpis { margin-bottom: 12px; }
  .panel { padding: 16px; border-radius: 18px; }
  .chart-box { height: 240px; }
  .donut-box { width: 160px; height: 160px; }
  .page-head { margin-bottom: 14px; }
  .head-tools { width: 100%; gap: 8px; }
  .rest-switch { order: -1; flex: 1 0 100%; min-width: 0; }
  .rest-btn { width: 100%; max-width: none; }
  .rest-btn b { flex: 1; text-align: left; }
  .sync-pill, .open-now { font-size: 12.5px; padding: 7px 11px; }
  /* expense table becomes a list */
  .tbl.cards thead { display: none; }
  .tbl.cards tr { display: grid; grid-template-columns: 1fr auto; grid-template-areas: "desc amt" "date tipo"; gap: 4px 12px; padding: 11px 2px; border-bottom: 1px solid rgba(129, 156, 255, .07); }
  .tbl.cards tr:last-child { border-bottom: 0; }
  .tbl.cards td { padding: 0; border: 0; }
  .tbl.cards .c-desc { grid-area: desc; font-weight: 600; }
  .tbl.cards .c-amt { grid-area: amt; }
  .tbl.cards .c-date { grid-area: date; font-size: 12.5px; }
  .tbl.cards .c-tipo { grid-area: tipo; justify-self: end; }
  .tbl.cards .c-user { display: none; }
  .tbl.cards td[colspan] { grid-column: 1 / -1; }
  .del-tbl.cards tr { grid-template-areas: "desc amt" "date tipo" "meta meta"; }
  .del-tbl.cards .c-qty, .del-tbl.cards .c-waiter { display: none; }
  .del-tbl.cards .c-meta { grid-area: meta; font-size: 12.5px; color: var(--text-3); }
  .del-stats { grid-template-columns: 1fr; gap: 8px; }
  .mini-tabs { width: 100%; }
  .mini-tabs button { flex: 1; }
  .periods { display: flex; width: 100%; margin-bottom: 16px; }
  .period-row { gap: 8px; margin-bottom: 16px; }
  .period-row .periods { margin-bottom: 0; }
  .period-nav { display: flex; width: 100%; }
  .pn-label { flex: 1; min-width: 0; }
  .periods button { flex: 1 0 auto; padding: 9px 13px; }
  .custom-range { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; }
  .custom-range .dt { min-width: 0; }
  .custom-range .input { width: 100%; min-width: 0; max-width: 100%; padding: 9px 6px; font-size: 16px; }
  .custom-range input[type="datetime-local"] { -webkit-appearance: none; appearance: none; text-align: left; }
  .custom-range input[type="datetime-local"]::-webkit-date-and-time-value { text-align: left; }
  .custom-range .btn { grid-column: 1 / -1; }
  /* iPhone zooms into any field with text smaller than 16px */
  .input, select.input, textarea { font-size: 16px; }
  .tbl .hide-sm { display: none; }
  .modal { padding: 20px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .reveal { opacity: 1; transform: none; }
}

/* details that only appear on the phone layout of the deleted-lines list */
.hide-wide { display: none; }
@media (max-width: 720px) { .hide-wide { display: inline; } }
