/* =====================================================================
   Catendal Hotel and Suites — staff system theme
   Modelled on the Kempinski Mall of the Emirates site: a sand band on
   top, a white masthead with the hotel's name centred in tracked
   capitals, cream canvas, white panels, navy ink, light serif headings,
   square outlined buttons and a taupe rule marking where you are.
   ===================================================================== */

:root {
  /* colour */
  --sand: #DCD0C3;          /* top band */
  --sand-deep: #C9B9A6;
  --ink: #14213D;           /* navy: text, primary buttons */
  --ink-hover: #22335A;
  --ink-2: #4B5468;         /* secondary text */
  --ink-3: #656B7E;         /* captions, hints */
  --paper: #FFFFFF;         /* masthead, panels */
  --cream: #F7F4EF;         /* canvas */
  --cream-2: #EFEAE2;       /* hover wash */
  --line: #E3DDD4;          /* hairlines */
  --line-strong: #CDC3B5;
  --taupe: #A88B67;         /* the "you are here" rule, focus ring */
  --taupe-ink: #8A7152;
  --scrim: rgba(20, 33, 61, .38);

  --good: #2F7A55;  --good-bg: #E6F2EB;
  --warn: #9A5B0B;  --warn-bg: #FAF0DE;
  --bad: #B23A2E;   --bad-bg: #F8E6E3;
  --info: #33568F;  --info-bg: #E7EDF6;
  --idle: #6B7184;  --idle-bg: #EEEDEA;

  /* chart series (validated for colour-blind separation on white) */
  --s-rooms: #33568F;
  --s-bar: #B5793C;
  --s-restaurant: #8C5A9E;

  /* type */
  --font-display: "Cormorant Garamond", "Cormorant", Garamond, "Times New Roman", serif;
  --font-ui: "Jost", "Futura", "Century Gothic", "Avenir Next", system-ui, sans-serif;
  --t-xs: 0.75rem;   /* 12 */
  --t-sm: 0.875rem;  /* 14 */
  --t-md: 1rem;      /* 16 */
  --t-lg: 1.25rem;   /* 20 */
  --t-xl: 1.75rem;   /* 28 */
  --t-2xl: 2.5rem;   /* 40 */
  --t-3xl: 3.5rem;   /* 56 */
  --track: 0.14em;   /* tracked capitals */

  /* space */
  --gutter: max(16px, env(safe-area-inset-left, 0px));
  --gutter-r: max(16px, env(safe-area-inset-right, 0px));
  --maxw: 1280px;

  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--cream);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: var(--t-md);
  line-height: 1.55;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
}
body::before { /* paints the phone's status-bar area in the band colour */
  content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px);
  z-index: 60; background: var(--sand);
}
img { max-width: 100%; }
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--taupe); outline-offset: 2px; }
::selection { background: var(--sand); }

.serif { font-family: var(--font-display); }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--ink-3); }
.soft { color: var(--ink-2); }
.nowrap { white-space: nowrap; }
.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; }

/* ---------- headings ---------- */
h1, h2, h3 {
  font-variant-numeric: lining-nums;
  font-family: var(--font-display);
  font-weight: 500;
  color: var(--ink);
  margin: 0;
  line-height: 1.1;
  text-wrap: balance;
  letter-spacing: -0.005em;
}
h1 { font-size: var(--t-2xl); }
h2 { font-size: var(--t-xl); }
h3 { font-size: var(--t-lg); line-height: 1.25; }
p { margin: 0; }

/* =====================================================================
   SHELL: band, masthead, tabs, drawer
   ===================================================================== */
.band {
  background: var(--sand);
  color: var(--ink);
  text-align: center;
  font-size: var(--t-xs);
  letter-spacing: var(--track);
  text-transform: uppercase;
  font-weight: 500;
  padding-block: 11px;
  padding-left: var(--gutter);
  padding-right: var(--gutter-r);
}
.band-inner { display: flex; justify-content: center; align-items: center; gap: 14px; flex-wrap: wrap; }
.band-flag {
  border: 1px solid var(--ink); padding: 1px 8px; letter-spacing: 0.1em; font-size: 0.6875rem;
}

.masthead {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 40;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}
.masthead-inner {
  max-width: var(--maxw); margin: 0 auto;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 16px;
  min-height: 84px;
  padding-left: var(--gutter); padding-right: var(--gutter-r);
}
.mast-left { display: flex; align-items: center; gap: 18px; min-width: 0; }
.mast-right { display: flex; justify-content: flex-end; align-items: center; gap: 10px; }
.burger {
  width: 44px; height: 44px; display: inline-grid; place-items: center;
  background: none; border: 0; padding: 0; cursor: pointer;
}
.burger span, .burger span::before, .burger span::after {
  display: block; width: 30px; height: 2px; background: var(--ink); position: relative; content: "";
}
.burger span::before { position: absolute; top: -7px; }
.burger span::after { position: absolute; top: 7px; }
.who { min-width: 0; line-height: 1.25; }
.who-name { font-size: var(--t-sm); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.who-role { font-size: var(--t-xs); color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.1em; }

.wordmark {
  text-align: center; text-decoration: none; color: var(--ink);
  text-transform: uppercase; letter-spacing: var(--track); font-weight: 500;
  font-size: 1.125rem; line-height: 1.15;
}
.wordmark small { display: block; font-size: 0.8125rem; letter-spacing: 0.22em; margin-top: 2px; }

.tabs {
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}
.tabs-inner {
  max-width: var(--maxw); margin: 0 auto;
  display: flex; gap: 34px; overflow-x: auto; scrollbar-width: none;
  padding-left: var(--gutter); padding-right: var(--gutter-r);
}
.tabs-inner::-webkit-scrollbar { display: none; }
.tab {
  position: relative; display: inline-flex; align-items: center; gap: 8px;
  padding: 15px 0 14px; white-space: nowrap;
  font-size: var(--t-xs); letter-spacing: var(--track); text-transform: uppercase; font-weight: 500;
  color: var(--ink-2); text-decoration: none; background: none; border: 0; cursor: pointer;
}
.tab:hover { color: var(--ink); }
.tab[aria-current="page"] { color: var(--ink); }
.tab[aria-current="page"]::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: var(--taupe);
}
.count {
  min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px;
  display: inline-grid; place-items: center;
  background: var(--ink); color: var(--paper); font-size: 0.6875rem; letter-spacing: 0;
}

.drawer-scrim { position: fixed; inset: 0; background: var(--scrim); z-index: 70; }
.drawer {
  position: fixed; inset: 0 auto 0 0; width: min(360px, 88vw); z-index: 71;
  background: var(--paper); display: flex; flex-direction: column;
  padding: calc(env(safe-area-inset-top, 0px) + 18px) 28px calc(env(safe-area-inset-bottom, 0px) + 24px) max(28px, env(safe-area-inset-left, 0px));
  transform: translateX(-102%); transition: transform .28s ease;
  overflow-y: auto;
}
.drawer.open { transform: none; }
.drawer-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 26px; }
.drawer nav { display: flex; flex-direction: column; }
.drawer .tab {
  font-size: var(--t-sm); padding: 14px 0; border-bottom: 1px solid var(--line); justify-content: space-between;
}
.drawer .tab[aria-current="page"]::after { left: 0; right: auto; width: 34px; }
.drawer-foot { margin-top: auto; padding-top: 24px; display: grid; gap: 10px; }
.x-btn {
  width: 40px; height: 40px; border: 0; background: none; cursor: pointer; font-size: 26px; line-height: 1; color: var(--ink);
}

/* =====================================================================
   PAGE
   ===================================================================== */
.canvas {
  max-width: var(--maxw); margin: 0 auto;
  padding-left: var(--gutter); padding-right: var(--gutter-r);
  padding-block: 44px 80px;
}
.page-head {
  display: flex; justify-content: space-between; align-items: flex-end; gap: 20px 32px; flex-wrap: wrap;
  margin-bottom: 32px;
}
.page-head .lede { margin-top: 10px; color: var(--ink-2); max-width: 62ch; }
.head-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.section { margin-top: 44px; }
.section-head {
  display: flex; justify-content: space-between; align-items: baseline; gap: 12px 24px; flex-wrap: wrap;
  margin-bottom: 16px;
}
.section-head p { color: var(--ink-3); font-size: var(--t-sm); }

.panel {
  background: var(--paper);
  border: 1px solid var(--line);
  padding: 24px;
  min-width: 0;
}
.panel-flush { padding: 0; }
.panel-title { font-family: var(--font-display); font-size: var(--t-lg); font-weight: 500; margin-bottom: 4px; }
.panel-sub { color: var(--ink-3); font-size: var(--t-sm); margin-bottom: 16px; }

.grid { display: grid; gap: 16px; }
.section.grid, .grid-top { align-items: start; }
.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)); }
.split { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.stack { display: grid; gap: 16px; }

/* stat tiles */
.stat { background: var(--paper); border: 1px solid var(--line); padding: 20px 22px 18px; min-width: 0; }
.stat-label { font-size: var(--t-sm); color: var(--ink-2); }
.stat-value {
  font-size: 2.125rem; font-weight: 300; line-height: 1.15; margin-top: 6px; letter-spacing: -0.01em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.stat-foot { font-size: var(--t-xs); color: var(--ink-3); margin-top: 6px; }
.stat-foot b { font-weight: 500; color: var(--ink-2); }
.stat-link { cursor: pointer; text-align: left; font: inherit; color: inherit; width: 100%; }
.stat-link:hover { border-color: var(--line-strong); }

/* =====================================================================
   CONTROLS
   ===================================================================== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 0 22px;
  border: 1px solid var(--ink); background: transparent; color: var(--ink);
  font-size: var(--t-xs); letter-spacing: var(--track); text-transform: uppercase; font-weight: 500;
  cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background-color .15s ease, color .15s ease, border-color .15s ease;
}
.btn:hover { background: var(--ink); color: var(--paper); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .45; cursor: not-allowed; }
.btn:disabled:hover { background: transparent; color: var(--ink); }
.btn-solid { background: var(--ink); color: var(--paper); }
.btn-solid:hover { background: var(--ink-hover); border-color: var(--ink-hover); }
.btn-solid:disabled:hover { background: var(--ink); color: var(--paper); }
.btn-danger { border-color: var(--bad); color: var(--bad); }
.btn-danger:hover { background: var(--bad); color: var(--paper); }
.btn-sm { min-height: 36px; padding: 0 14px; font-size: 0.6875rem; }
.btn-wide { width: 100%; }
.btn-ghost { border-color: transparent; }
.btn-ghost:hover { background: var(--cream-2); color: var(--ink); }

/* Kempinski's italic "View offer" link — used for row actions */
.link {
  font-family: var(--font-display); font-style: italic; font-weight: 500; font-size: 1.0625rem;
  color: var(--ink); text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px;
  font-variant-numeric: lining-nums;
  background: none; border: 0; padding: 2px 0; cursor: pointer; white-space: nowrap;
}
.link:hover { color: var(--taupe-ink); }
.link-danger { color: var(--bad); }
.links { display: inline-flex; gap: 16px; flex-wrap: wrap; justify-content: flex-end; }

.field { display: grid; gap: 7px; min-width: 0; }
.field > span, .label {
  font-size: 0.6875rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-2); font-weight: 500;
}
.field .hint { font-size: var(--t-xs); color: var(--ink-3); letter-spacing: 0; text-transform: none; font-weight: 400; }
.input, .select, .textarea {
  width: 100%; min-height: 46px; padding: 10px 14px;
  background: var(--paper); border: 1px solid var(--line-strong); border-radius: 0;
  font-size: var(--t-md); color: var(--ink);
}
.textarea { min-height: 92px; resize: vertical; }
.select { appearance: none; padding-right: 40px; background-image: linear-gradient(45deg, transparent 50%, var(--ink) 50%), linear-gradient(135deg, var(--ink) 50%, transparent 50%); background-position: calc(100% - 20px) 50%, calc(100% - 15px) 50%; background-size: 5px 5px; background-repeat: no-repeat; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px rgba(168, 139, 103, .35); }
.input[readonly] { background: var(--cream); color: var(--ink-2); }
.form { display: grid; gap: 18px; }
.form-row { display: grid; gap: 16px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-row-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; margin-top: 6px; }
.form-error {
  color: var(--bad); background: var(--bad-bg); padding: 10px 14px; font-size: var(--t-sm); border-left: 2px solid var(--bad);
}
.form-note { color: var(--ink-2); background: var(--cream); padding: 10px 14px; font-size: var(--t-sm); }

.check { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-size: var(--t-sm); }
.check input { width: 18px; height: 18px; accent-color: var(--ink); }

/* segmented choice (payment method, settle type) */
.choice { display: flex; flex-wrap: wrap; border: 1px solid var(--line-strong); background: var(--paper); }
.choice label { flex: 1 1 0; min-width: 0; position: relative; }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice span {
  display: grid; place-items: center; min-height: 44px; padding: 0 10px; cursor: pointer; text-align: center;
  font-size: 0.6875rem; letter-spacing: 0.12em; text-transform: uppercase; font-weight: 500; color: var(--ink-2);
  border-left: 1px solid var(--line);
}
.choice label:first-child span { border-left: 0; }
.choice input:checked + span { background: var(--ink); color: var(--paper); }
.choice input:focus-visible + span { outline: 2px solid var(--taupe); outline-offset: -2px; }

.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; margin-bottom: 16px; }
.toolbar .field { min-width: 150px; }
.toolbar .grow { flex: 1 1 220px; }
.search { position: relative; }
.search .input { padding-left: 40px; }
.search::before {
  content: ""; position: absolute; left: 14px; top: 50%; width: 13px; height: 13px; margin-top: -8px;
  border: 1.5px solid var(--ink-3); border-radius: 50%;
}
.search::after {
  content: ""; position: absolute; left: 26px; top: 50%; width: 6px; height: 1.5px; margin-top: 4px;
  background: var(--ink-3); transform: rotate(45deg);
}

/* =====================================================================
   TABLES, PILLS, LISTS
   ===================================================================== */
.table-wrap { overflow-x: auto; background: var(--paper); border: 1px solid var(--line); }
.table { width: 100%; border-collapse: collapse; font-size: var(--t-sm); }
.table th {
  text-align: left; font-weight: 500; color: var(--ink-2); white-space: nowrap;
  font-size: 0.6875rem; letter-spacing: 0.12em; text-transform: uppercase;
  padding: 14px 16px; border-bottom: 1px solid var(--line); background: var(--paper);
}
.table td { padding: 14px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: #FBFAF7; }
.table .r { text-align: right; }
.table td.r { font-variant-numeric: tabular-nums; white-space: nowrap; }
.table .strong { font-weight: 500; }
.table .sub { display: block; color: var(--ink-3); font-size: var(--t-xs); margin-top: 2px; }
.table tfoot td { font-weight: 500; border-top: 1px solid var(--line-strong); border-bottom: 0; }
.row-void td { color: var(--ink-3); }
.row-void .strike { text-decoration: line-through; }

.pill {
  display: inline-flex; align-items: center; gap: 7px; white-space: nowrap;
  padding: 3px 10px 3px 9px; font-size: 0.75rem; font-weight: 500; line-height: 1.5;
  background: var(--idle-bg); color: var(--idle);
}
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: none; }
.pill-good { background: var(--good-bg); color: var(--good); }
.pill-warn { background: var(--warn-bg); color: var(--warn); }
.pill-bad { background: var(--bad-bg); color: var(--bad); }
.pill-info { background: var(--info-bg); color: var(--info); }
.pill-ink { background: var(--ink); color: var(--paper); }

.empty {
  padding: 40px 24px; text-align: center; color: var(--ink-3); background: var(--paper); border: 1px solid var(--line);
}
.empty h3 { color: var(--ink); margin-bottom: 6px; }
.empty .btn { margin-top: 16px; }

.kv { display: grid; grid-template-columns: auto 1fr; row-gap: 8px; column-gap: 0; font-size: var(--t-sm); }
.kv dt { color: var(--ink-3); }
.kv dd { margin: 0; padding-left: 20px; text-align: right; font-variant-numeric: tabular-nums; }
.kv .total { font-weight: 500; font-size: var(--t-md); padding-top: 10px; border-top: 1px solid var(--line); }

.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 13px 0; border-bottom: 1px solid var(--line); }
.list li:last-child { border-bottom: 0; }
.list .meta { font-size: var(--t-xs); color: var(--ink-3); }

/* =====================================================================
   ROOM BOARD
   ===================================================================== */
.rooms-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); }
.room {
  position: relative; background: var(--paper); border: 1px solid var(--line); border-top: 3px solid var(--idle);
  padding: 14px 16px 16px; min-height: 148px; display: flex; flex-direction: column; gap: 4px;
  text-align: left; cursor: pointer; font: inherit; color: inherit; width: 100%;
}
.room:hover { border-color: var(--line-strong); }
.room[data-status="available"] { border-top-color: var(--good); }
.room[data-status="occupied"] { border-top-color: var(--info); }
.room[data-status="cleaning"] { border-top-color: var(--warn); }
.room[data-status="maintenance"] { border-top-color: var(--bad); }
.room-no { font-family: var(--font-display); font-size: 2.25rem; font-weight: 500; line-height: 1; font-variant-numeric: lining-nums; }
.room-type { font-size: var(--t-xs); color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.1em; }
.room-guest { font-size: var(--t-sm); margin-top: auto; padding-top: 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.room-guest .muted { display: block; font-size: var(--t-xs); }
.legend { display: flex; gap: 18px; flex-wrap: wrap; font-size: var(--t-xs); color: var(--ink-2); }
.legend i { display: inline-block; width: 12px; height: 3px; margin-right: 7px; vertical-align: middle; }
.legend .sw { width: 10px; height: 10px; border-radius: 2px; }

/* =====================================================================
   POINT OF SALE
   ===================================================================== */
.pos { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 20px; align-items: start; }
.pos-cats { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.cat-chip {
  flex: none; min-height: 38px; padding: 0 16px; border: 1px solid var(--line-strong); background: var(--paper);
  font-size: 0.6875rem; letter-spacing: 0.12em; text-transform: uppercase; font-weight: 500; color: var(--ink-2); cursor: pointer;
}
.cat-chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.items-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
.item {
  min-height: 92px; padding: 12px 14px; text-align: left; cursor: pointer;
  background: var(--paper); border: 1px solid var(--line); display: flex; flex-direction: column; justify-content: space-between; gap: 8px;
  font: inherit; color: inherit;
}
.item:hover { border-color: var(--ink); }
.item:active { background: var(--cream-2); }
.item-name { font-size: var(--t-sm); font-weight: 500; line-height: 1.3; }
.item-price { font-size: var(--t-sm); color: var(--ink-2); font-variant-numeric: tabular-nums; }
.item[disabled] { cursor: not-allowed; background: var(--cream); color: var(--ink-3); }
.item[disabled] .item-price::after { content: " · Out of stock"; color: var(--bad); }
.item .in-ticket { font-size: var(--t-xs); color: var(--taupe-ink); font-weight: 500; }
.cat-heading { font-family: var(--font-display); font-size: var(--t-lg); margin: 22px 0 10px; }
.cat-heading:first-child { margin-top: 0; }

.ticket { position: sticky; top: 110px; background: var(--paper); border: 1px solid var(--line); display: flex; flex-direction: column; max-height: calc(100vh - 130px); }
.ticket-head { padding: 18px 20px 14px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: baseline; }
.ticket-lines { overflow-y: auto; padding: 4px 20px; flex: 1 1 auto; min-height: 80px; }
.tline { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 10px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); }
.tline:last-child { border-bottom: 0; }
.tline-name { font-size: var(--t-sm); line-height: 1.3; }
.tline-name small { display: block; color: var(--ink-3); font-size: var(--t-xs); }
.tline-total { font-size: var(--t-sm); font-variant-numeric: tabular-nums; min-width: 72px; text-align: right; }
.stepper { display: inline-flex; align-items: center; border: 1px solid var(--line-strong); }
.stepper button { width: 32px; height: 32px; border: 0; background: var(--paper); cursor: pointer; font-size: 18px; line-height: 1; color: var(--ink); }
.stepper button:hover { background: var(--cream-2); }
.stepper output { min-width: 28px; text-align: center; font-size: var(--t-sm); font-variant-numeric: tabular-nums; }
.ticket-foot { border-top: 1px solid var(--line); padding: 16px 20px 20px; display: grid; gap: 14px; }
.ticket-total { display: flex; justify-content: space-between; align-items: baseline; }
.ticket-total strong { font-size: 1.75rem; font-weight: 400; font-variant-numeric: tabular-nums; }
.ticket-empty { color: var(--ink-3); font-size: var(--t-sm); padding: 26px 0; text-align: center; }
.pos-bar { display: none; }
.ticket-close { display: none !important; }

/* =====================================================================
   CHARTS
   ===================================================================== */
.chart { position: relative; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .grid-line { stroke: var(--line); stroke-width: 1; }
.chart .axis-text { fill: var(--ink-3); font-size: 12px; font-family: var(--font-ui); font-variant-numeric: tabular-nums; }
.chart .value-text { fill: var(--ink); font-size: 12px; font-weight: 500; font-family: var(--font-ui); }
.chart .hit { fill: transparent; cursor: pointer; }
.chart .hit:hover + .marks .bar, .chart .col:hover .bar { filter: brightness(1.12); }
.chart .col:focus { outline: none; }
.chart .col:focus-visible .hit { stroke: var(--taupe); stroke-width: 2; }
.chart-legend { display: flex; gap: 18px; flex-wrap: wrap; margin: 2px 0 12px; font-size: var(--t-sm); color: var(--ink-2); }
.chart-legend span { display: inline-flex; align-items: center; gap: 8px; }
.chart-legend i { width: 12px; height: 12px; border-radius: 2px; display: inline-block; }
.tooltip {
  position: absolute; pointer-events: none; z-index: 5; min-width: 168px;
  background: var(--paper); border: 1px solid var(--line-strong); box-shadow: 0 6px 22px rgba(20, 33, 61, .10);
  padding: 10px 12px; font-size: var(--t-xs); color: var(--ink-2);
}
.tooltip .tt-title { color: var(--ink); font-weight: 500; margin-bottom: 6px; font-size: var(--t-sm); }
.tooltip .tt-row { display: grid; grid-template-columns: 14px 1fr auto; align-items: center; gap: 8px; padding: 2px 0; }
.tooltip .tt-row i { height: 2px; width: 12px; display: block; }
.tooltip .tt-row b { color: var(--ink); font-weight: 500; font-variant-numeric: tabular-nums; font-size: var(--t-sm); }
.tooltip .tt-total { border-top: 1px solid var(--line); margin-top: 6px; padding-top: 6px; display: flex; justify-content: space-between; }
.tooltip .tt-total b { color: var(--ink); font-weight: 500; }
details.table-view { margin-top: 12px; font-size: var(--t-sm); }
details.table-view summary { cursor: pointer; color: var(--ink-2); font-size: var(--t-xs); letter-spacing: 0.1em; text-transform: uppercase; }
details.table-view .table-wrap { margin-top: 10px; }

/* horizontal paid/owed bars */
.hbars { display: grid; gap: 16px; }
.hbar-row { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 14px; align-items: center; }
.hbar-name { font-size: var(--t-sm); color: var(--ink-2); }
.hbar-track { display: flex; gap: 2px; height: 22px; align-items: stretch; }
.hbar-seg { min-width: 0; }
.hbar-seg:first-child { border-radius: 0; }
.hbar-seg:last-child { border-radius: 0 4px 4px 0; }
.hbar-figs { grid-column: 2; display: flex; gap: 16px; font-size: var(--t-xs); color: var(--ink-3); margin-top: -8px; flex-wrap: wrap; }
.hbar-figs b { color: var(--ink); font-weight: 500; font-variant-numeric: tabular-nums; }

/* =====================================================================
   MODAL, TOAST, CONFIRM
   ===================================================================== */
.modal-scrim {
  position: fixed; inset: 0; z-index: 80; background: var(--scrim);
  display: grid; place-items: center;
  padding: max(16px, env(safe-area-inset-top, 0px)) var(--gutter-r) max(16px, env(safe-area-inset-bottom, 0px)) var(--gutter);
  overflow-y: auto;
}
.modal {
  width: min(640px, 100%); background: var(--paper); border: 1px solid var(--line);
  box-shadow: 0 20px 60px rgba(20, 33, 61, .18); display: flex; flex-direction: column; max-height: calc(100vh - 32px);
}
.modal-wide { width: min(900px, 100%); }
.modal-narrow { width: min(460px, 100%); }
.modal-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; padding: 24px 26px 14px; }
.modal-head h2 { font-size: 1.875rem; }
.modal-head p { color: var(--ink-3); font-size: var(--t-sm); margin-top: 6px; }
.modal-body { padding: 6px 26px 24px; overflow-y: auto; }
.modal-foot { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; padding: 16px 26px 22px; border-top: 1px solid var(--line); }

.toasts { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(env(safe-area-inset-bottom, 0px) + 22px); z-index: 90; display: grid; gap: 8px; width: min(520px, calc(100vw - 32px)); }
.toast { background: var(--ink); color: var(--paper); padding: 13px 18px; font-size: var(--t-sm); box-shadow: 0 10px 30px rgba(20, 33, 61, .25); display: flex; justify-content: space-between; gap: 16px; align-items: center; }
.toast-bad { background: var(--bad); }

.loading { padding: 60px 0; text-align: center; color: var(--ink-3); font-size: var(--t-sm); letter-spacing: 0.1em; text-transform: uppercase; }
.dim { opacity: .55; transition: opacity .2s; }

/* =====================================================================
   SIGN IN
   ===================================================================== */
.login { min-height: 100vh; display: flex; flex-direction: column; background: var(--paper); }
.login-main { flex: 1; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.login-brand {
  background: var(--cream); display: flex; flex-direction: column; justify-content: center; align-items: center;
  text-align: center; padding: 56px max(24px, 6vw); border-right: 1px solid var(--line);
}
.lockup { color: var(--ink); }
.lockup-mark { width: 64px; height: 64px; margin: 0 auto 22px; display: block; }
.lockup-name { font-family: var(--font-display); font-size: clamp(2.5rem, 5vw, 3.75rem); font-weight: 500; line-height: 1.02; text-wrap: balance; font-variant-numeric: lining-nums; }
.lockup-rule { width: 150px; height: 1px; background: var(--ink); margin: 20px auto 12px; }
.lockup-city { font-size: var(--t-xs); letter-spacing: 0.32em; text-transform: uppercase; font-weight: 500; }
.login-brand .tagline { margin-top: 34px; color: var(--ink-2); max-width: 36ch; font-size: var(--t-md); }
.login-form-wrap { display: flex; align-items: center; justify-content: center; padding: 56px max(24px, 5vw); }
.login-form { width: min(400px, 100%); display: grid; gap: 20px; }
.login-form h1 { font-size: var(--t-2xl); }
.login-form .lede { color: var(--ink-2); margin-top: -8px; }
.demo-accounts { display: grid; gap: 8px; margin-top: 8px; }
.demo-accounts .btn { justify-content: space-between; }
.demo-accounts .btn small { font-size: 0.6875rem; letter-spacing: 0.06em; text-transform: none; opacity: .75; font-weight: 400; }
.foot { text-align: center; font-size: var(--t-xs); color: var(--ink-3); padding: 18px 16px calc(env(safe-area-inset-bottom, 0px) + 18px); letter-spacing: 0.06em; }

/* =====================================================================
   PRINT (invoices & receipts)
   ===================================================================== */
#print-root { display: none; }
.doc { background: var(--paper); color: #111; font-family: var(--font-ui); }
.doc-a4 { max-width: 760px; margin: 0 auto; padding: 36px 40px; }
.doc-receipt { max-width: 80mm; margin: 0 auto; padding: 8px 4px; font-size: 12px; }
.doc .doc-lockup { text-align: center; margin-bottom: 22px; }
.doc .doc-name { font-family: var(--font-display); font-size: 30px; font-weight: 500; line-height: 1.05; color: var(--ink); text-wrap: balance; }
.doc-receipt .doc-name { font-size: 22px; }
.doc .doc-rule { width: 110px; height: 1px; background: var(--ink); margin: 10px auto 7px; }
.doc .doc-city { font-size: 10px; letter-spacing: 0.3em; text-transform: uppercase; color: var(--ink); }
.doc .doc-contact { font-size: 11px; color: #555; margin-top: 8px; }
.doc-title { display: flex; justify-content: space-between; align-items: flex-end; border-top: 1px solid #ccc; border-bottom: 1px solid #ccc; padding: 10px 0; margin-bottom: 16px; }
.doc-title h2 { font-size: 22px; }
.doc-receipt .doc-title { display: block; text-align: center; }
.doc-receipt .doc-title h2 { font-size: 16px; }
.doc-meta { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 24px; font-size: 12px; margin-bottom: 16px; }
.doc-receipt .doc-meta { grid-template-columns: 1fr; font-size: 11px; }
.doc-meta div { display: flex; justify-content: space-between; gap: 10px; }
.doc-meta span { color: #666; }
.doc table { width: 100%; border-collapse: collapse; font-size: 12px; }
.doc th { text-align: left; font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; color: #555; font-weight: 500; border-bottom: 1px solid #bbb; padding: 6px 4px; }
.doc td { padding: 6px 4px; border-bottom: 1px solid #e5e5e5; vertical-align: top; }
.doc .r { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.doc-totals { margin-top: 12px; margin-left: auto; width: min(320px, 100%); font-size: 12.5px; }
.doc-receipt .doc-totals { width: 100%; }
.doc-totals div { display: flex; justify-content: space-between; padding: 3px 0; }
.doc-totals .grand { border-top: 1px solid #111; margin-top: 4px; padding-top: 7px; font-weight: 600; font-size: 14px; }
.doc-foot { margin-top: 26px; text-align: center; font-size: 11px; color: #555; }
.doc-foot .sig { display: flex; justify-content: space-between; gap: 24px; margin-top: 34px; text-align: left; }
.doc-foot .sig div { flex: 1; border-top: 1px solid #999; padding-top: 6px; }
.doc-stamp { display: inline-block; border: 1.5px solid currentColor; padding: 2px 10px; font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase; font-weight: 600; }
.doc-stamp.paid { color: var(--good); }
.doc-stamp.owing { color: var(--bad); }
.doc-stamp.void { color: var(--bad); }
.doc-preview { border: 1px solid var(--line); background: var(--paper); max-height: 62vh; overflow-y: auto; }

@media print {
  @page { margin: 12mm; }
  body { background: #fff; }
  body > *:not(#print-root) { display: none !important; }
  body::before { display: none; }
  #print-root { display: block !important; }
  #print-root.receipt-mode { width: 76mm; }
  .doc-a4 { padding: 0; max-width: none; }
}

/* =====================================================================
   RESPONSIVE
   ===================================================================== */
@media (max-width: 1100px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .split { grid-template-columns: minmax(0, 1fr); }
  .pos { grid-template-columns: minmax(0, 1fr) 330px; }
}
@media (max-width: 900px) {
  .tabs { display: none; }
  .masthead-inner { min-height: 68px; grid-template-columns: auto 1fr auto; }
  .wordmark { font-size: 0.875rem; letter-spacing: 0.12em; }
  .wordmark small { font-size: 0.6875rem; }
  .who { display: none; }
  .grid-3 { grid-template-columns: minmax(0, 1fr); }
  .login-main { grid-template-columns: minmax(0, 1fr); }
  .login-brand { border-right: 0; border-bottom: 1px solid var(--line); padding-block: 44px 36px; }
  .login-brand .tagline { display: none; }
  .pos { grid-template-columns: minmax(0, 1fr); }
  .ticket { position: fixed; inset: auto 0 0 0; top: auto; max-height: 86vh; z-index: 75; transform: translateY(105%); transition: transform .25s ease; border: 0; border-top: 1px solid var(--line-strong); box-shadow: 0 -10px 40px rgba(20, 33, 61, .18); padding-bottom: env(safe-area-inset-bottom, 0px); }
  .ticket.open { transform: none; }
  .ticket .ticket-close { display: inline-grid !important; place-items: center; }
  .pos-bar {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 74;
    padding: 12px var(--gutter-r) calc(env(safe-area-inset-bottom, 0px) + 12px) var(--gutter);
    background: var(--ink); color: var(--paper); justify-content: space-between; align-items: center; gap: 12px;
  }
  .pos-bar .btn { border-color: var(--paper); color: var(--paper); }
  .pos-bar .btn:hover { background: var(--paper); color: var(--ink); }
  .canvas-pos { padding-bottom: 120px; }
  .pos-cats { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
}
@media (max-width: 640px) {
  h1 { font-size: 2rem; }
  .canvas { padding-block: 28px 64px; }
  .grid-2, .grid-4, .form-row, .form-row-3 { grid-template-columns: minmax(0, 1fr); }
  .grid-4.keep-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat { padding: 16px; }
  .stat-value { font-size: 1.625rem; }
  .panel { padding: 18px; }
  .page-head { margin-bottom: 24px; }
  .mast-right .btn { padding: 0 12px; min-height: 40px; letter-spacing: 0.08em; }
  .modal-scrim { place-items: end center; padding: 0; }
  .modal { width: 100%; max-height: 92vh; border-left: 0; border-right: 0; border-bottom: 0; }
  .modal-head, .modal-body, .modal-foot { padding-left: 18px; padding-right: 18px; }
  .hbar-row { grid-template-columns: minmax(0, 1fr); gap: 6px; }
  .hbar-figs { grid-column: 1; margin-top: 0; }
  .items-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rooms-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .table th, .table td { padding: 12px; }
  .lockup-name { font-size: 2.5rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
