/* ===================================================================
   SlateSpace prototype — shared design system
   Every brand value below was measured off the live slatespace.in, not
   eyeballed: parchment #fbfbf4, ink #454646, gold #b6872d, neutral grey
   #969696, hairline #e1d8c7, sand #ebe2c5. Body is Poppins 16px/1.6 and
   the gold CTA is square (radius 0), 12px, uppercase, 0.6px tracking.
   Their headings declare "Agatho", but that face has no @font-face on
   their own site and never loads, so it is not chased here — Poppins is
   their real dominant face (583 uses vs 65).
   =================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&family=Cormorant+Garamond:ital,wght@500;600;700&display=swap');

:root {
  /* ---- Color: brand + surfaces (from slatespace.in) ---- */
  --color-primary: #b6872d;
  --color-primary-focus: #96701f;
  /* gold as TEXT on light ground: the brand gold measures 2.93:1, this
     darker step of the same hue reaches 4.49:1. Fills and borders keep
     the brand gold — only type moves. */
  --color-primary-text: #96701f;
  --color-primary-on-dark: #d9ae5c;
  --color-ink: #454646;
  --color-canvas: #ffffff;
  --color-parchment: #fbfbf4;
  --color-pearl: #f9f3e8;
  --color-dark-1: #454646;
  --color-dark-2: #565757;
  --color-dark-3: #383939;
  --color-hairline: #e1d8c7;
  --color-divider-soft: #f1ede0;
  --color-muted-80: #3a3b3b;
  /* Secondary text now carries the full ink colour. #969696 on the parchment
     ground measured 2.8:1 — under the 4.5:1 WCAG AA floor, and genuinely hard
     to read. Hierarchy is carried by size and weight instead: captions are
     13.5px against 16px body, labels are small and uppercase. The one place a
     light grey is still correct is on the dark band, which keeps
     --color-body-muted. */
  --color-muted-48: #454646;
  /* kept for the few spots that still need a step down on light ground:
     a struck-through unavailable slot, a closed calendar day */
  --color-muted-soft: #7b7b7b;
  /* two more surfaces measured off slatespace.in: the sand band it uses to
     separate sections, and the warm cream behind quiet panels */
  --color-sand: #ebe2c5;
  --color-cream: #f9f3e8;
  --color-body-muted: #ece7dd;
  --color-on-dark: #ffffff;
  --color-on-primary: #ffffff;

  /* ---- Color: functional status (added for this product — booking/
     lead/subscription states need to be distinguishable at a glance;
     warning shifted to terracotta so it never collides with the gold
     brand accent) ---- */
  --color-success: #1e8e5a;
  --color-success-bg: rgba(30, 142, 90, .1);
  --color-warning: #b5502b;
  --color-warning-bg: rgba(181, 80, 43, .1);
  --color-danger: #c62828;
  --color-danger-bg: rgba(198, 40, 40, .1);
  --color-info: var(--color-primary);
  --color-info-bg: rgba(182, 135, 45, .08);
  --color-neutral: var(--color-muted-48);
  --color-neutral-bg: rgba(138, 135, 118, .15);

  /* ---- Type ---- */
  --font-sans: "Poppins", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-serif: "Cormorant Garamond", Georgia, "Times New Roman", serif;

  /* ---- Radius (sharper, architectural — matches slatespace.in's
     square-cornered buttons and floor-plan logo mark) ---- */
  --radius-xs: 2px;
  --radius-sm: 3px;
  --radius-md: 3px;
  --radius-lg: 3px;
  --radius-pill: 9999px;
  --radius-btn: 0px;   /* slatespace.in's gold CTA is square-cornered */

  /* ---- Spacing (8px rhythm) ---- */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 17px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  --space-8: 80px;
  --space-9: 128px;   /* slatespace.in section rhythm */

  /* ---- Elevation (used only for overlays — DESIGN.md keeps chrome flat) ---- */
  --shadow-modal: 0 12px 40px rgba(0, 0, 0, .18);
  --shadow-hover: 0 2px 14px rgba(0, 0, 0, .07);
}

/* ---------------------------------------------------------------
   Reset & base
   --------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  color: var(--color-ink);
  background: var(--color-parchment);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4, p, figure { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
a { color: var(--color-primary-text); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
/* input text is ink now, so placeholders need their own lighter tone or they
   look like values someone already typed */
::placeholder { color: var(--color-muted-soft); opacity: 1; }
button { cursor: pointer; }
img { max-width: 100%; display: block; }
::selection { background: var(--color-primary); color: #fff; }

/* ---------------------------------------------------------------
   Typography
   --------------------------------------------------------------- */
.text-display { font-size: 38px; font-weight: 700; letter-spacing: -0.01em; line-height: 1.12; }
.text-title    { font-size: 24px; font-weight: 600; letter-spacing: -0.01em; line-height: 1.22; }
.text-subtitle { font-size: 18px; font-weight: 600; letter-spacing: -0.005em; line-height: 1.35; }
.text-body     { font-size: 16px; font-weight: 400; line-height: 1.6; }
.text-strong   { font-weight: 600; }
.text-caption  { font-size: 13.5px; font-weight: 400; line-height: 1.55; color: var(--color-muted-48); }
.text-caption-strong { font-size: 13px; font-weight: 600; color: var(--color-muted-80); }
.text-micro    { font-size: 11px; color: var(--color-muted-48); }
.text-muted    { color: var(--color-muted-48); }
.text-primary  { color: var(--color-primary-text); }
.text-success  { color: var(--color-success); }
.text-danger   { color: var(--color-danger); }
.text-center   { text-align: center; }
.text-right    { text-align: right; }
.mono          { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }

/* ---------------------------------------------------------------
   Layout utilities
   --------------------------------------------------------------- */
.container { max-width: 1245px; margin: 0 auto; padding: 0 var(--space-5); }
.flex { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.flex-wrap { flex-wrap: wrap; }
.flex-1 { flex: 1 1 auto; }
.gap-1 { gap: var(--space-1); } .gap-2 { gap: var(--space-2); } .gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); } .gap-5 { gap: var(--space-5); } .gap-6 { gap: var(--space-6); }
.grid { display: grid; gap: var(--space-5); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 900px) { .grid-3, .grid-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } }
.stack > * + * { margin-top: var(--space-4); }
.w-full { width: 100%; }
.hidden { display: none !important; }
.divider { height: 1px; background: var(--color-hairline); border: 0; margin: var(--space-5) 0; }

/* ---------------------------------------------------------------
   Buttons
   --------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  border: 1px solid transparent; cursor: pointer; white-space: nowrap;
  font-family: var(--font-sans); font-size: 12px; font-weight: 400;
  text-transform: uppercase; letter-spacing: .05em;
  transition: transform .08s ease, opacity .15s ease, background-color .15s ease;
}
.btn:active { transform: scale(.96); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn-primary {
  background: var(--color-primary); color: var(--color-on-primary);
  border-radius: var(--radius-btn); padding: 12px 24px;
}
.btn-primary:hover { background: var(--color-primary-focus); }
.btn-secondary {
  background: transparent; color: var(--color-primary-text); border-color: var(--color-primary);
  border-radius: var(--radius-btn); padding: 11px 23px;
}
.btn-dark {
  background: var(--color-ink); color: #fff; border-radius: var(--radius-btn); padding: 9px 16px;
}
.btn-ghost {
  background: transparent; color: var(--color-ink); border-radius: var(--radius-btn); padding: 9px 14px;
}
.btn-ghost:hover { background: var(--color-divider-soft); }
.btn-danger {
  background: var(--color-danger-bg); color: var(--color-danger); border-radius: var(--radius-btn); padding: 10px 20px;
}
.btn-sm { padding: 7px 15px; font-size: 11.5px; }
.btn-block { width: 100%; }
.btn-icon {
  width: 36px; height: 36px; padding: 0; border-radius: var(--radius-pill);
  background: var(--color-divider-soft); color: var(--color-ink);
}

/* ---------------------------------------------------------------
   Forms
   --------------------------------------------------------------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field-label { font-size: 13px; font-weight: 600; color: var(--color-muted-80); }
.field-help { font-size: 12px; color: var(--color-muted-48); }
.field-error { font-size: 12px; color: var(--color-danger); }
.input, .select, textarea.input {
  width: 100%; border: 1px solid var(--color-hairline); border-radius: var(--radius-sm);
  padding: 11px 14px; font-size: 15px; background: var(--color-canvas); color: var(--color-ink);
  font-family: var(--font-sans);
}
.input:focus, .select:focus, textarea.input:focus {
  outline: 2px solid var(--color-primary-focus); outline-offset: 1px; border-color: transparent;
}
.input.has-error { border-color: var(--color-danger); }
.checkbox-row, .radio-row { display: flex; align-items: center; gap: var(--space-2); font-size: 14px; }
.segmented { display: inline-flex; background: var(--color-divider-soft); border-radius: var(--radius-btn); padding: 3px; gap: 2px; }
.segmented button {
  border: 0; background: transparent; padding: 8px 16px; border-radius: var(--radius-btn);
  font-size: 13px; font-weight: 600; color: var(--color-muted-80);
}
.segmented button.active { background: var(--color-canvas); color: var(--color-ink); box-shadow: var(--shadow-hover); }
fieldset { border: 0; padding: 0; margin: 0; }

/* OTP boxes */
.otp-row { display: flex; gap: var(--space-3); justify-content: center; }
.otp-box {
  width: 48px; height: 56px; text-align: center; font-size: 22px; font-weight: 600;
  border: 1px solid var(--color-hairline); border-radius: var(--radius-md);
}
.otp-box:focus { outline: 2px solid var(--color-primary-focus); border-color: transparent; }

/* ---------------------------------------------------------------
   Cards & panels
   --------------------------------------------------------------- */
.card {
  display: block; background: var(--color-canvas); border: 1px solid var(--color-hairline);
  border-radius: var(--radius-lg); padding: var(--space-5); color: inherit; text-decoration: none;
}
.card-pearl { background: var(--color-pearl); }
.card-hover { transition: box-shadow .2s cubic-bezier(.16,1,.3,1), transform .2s cubic-bezier(.16,1,.3,1); }
.card-hover:hover { box-shadow: var(--shadow-hover); transform: translateY(-2px); }
.card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--space-4); }

/* ---------------------------------------------------------------
   Badges / status pills
   --------------------------------------------------------------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600;
  padding: 4px 10px; border-radius: var(--radius-pill); white-space: nowrap;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-success { background: var(--color-success-bg); color: var(--color-success); }
.badge-warning { background: var(--color-warning-bg); color: var(--color-warning); }
.badge-danger  { background: var(--color-danger-bg); color: var(--color-danger); }
.badge-info    { background: var(--color-info-bg); color: var(--color-primary-text); }
.badge-neutral { background: var(--color-neutral-bg); color: var(--color-neutral); }

/* ---------------------------------------------------------------
   Tables
   --------------------------------------------------------------- */
.table-wrap { overflow-x: auto; background: var(--color-canvas); border: 1px solid var(--color-hairline); border-radius: var(--radius-lg); }

/* API payloads and other literal text: scrolls inside itself so a long line
   never pushes the page sideways. */
.code-block {
  margin: 0;
  padding: var(--space-4);
  background: var(--color-pearl, #f4f2ea);
  border: 1px solid var(--color-hairline);
  border-radius: var(--radius-lg);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  line-height: 1.6;
  color: var(--color-ink);
  overflow-x: auto;
  max-height: 420px;
  overflow-y: auto;
  white-space: pre;
}
table.table { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 560px; background: var(--color-canvas); }
table.table th {
  text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .04em;
  color: var(--color-muted-48); font-weight: 600; padding: 12px 16px; background: var(--color-canvas);
  border-bottom: 1px solid var(--color-hairline); white-space: nowrap;
}
table.table td { padding: 13px 16px; border-bottom: 1px solid var(--color-divider-soft); vertical-align: middle; font-variant-numeric: tabular-nums; }
table.table tr:last-child td { border-bottom: 0; }
table.table tbody tr:hover { background: var(--color-divider-soft); }
.table-empty { padding: var(--space-7) var(--space-5); text-align: center; color: var(--color-muted-48); }

/* ---------------------------------------------------------------
   Tabs
   --------------------------------------------------------------- */
.tabs { display: flex; gap: var(--space-6); border-bottom: 1px solid var(--color-hairline); margin-bottom: var(--space-5); }
.tab {
  border: 0; background: transparent; padding: 12px 2px; font-size: 14px; font-weight: 600;
  color: var(--color-muted-48); border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tab.active { color: var(--color-ink); border-bottom-color: var(--color-primary); }

/* ---------------------------------------------------------------
   Modal / overlay / toast
   --------------------------------------------------------------- */
.overlay {
  position: fixed; inset: 0; background: rgba(0, 0, 0, .35);
  display: flex; align-items: center; justify-content: center; padding: var(--space-5); z-index: 100;
}
.modal {
  background: var(--color-canvas); border-radius: var(--radius-lg); padding: var(--space-6);
  width: 100%; max-width: 480px; box-shadow: var(--shadow-modal); max-height: 88vh; overflow-y: auto;
}
.modal-wide { max-width: 720px; }
.toast-stack {
  position: fixed; bottom: var(--space-6); left: 50%; transform: translateX(-50%);
  display: flex; flex-direction: column; gap: var(--space-2); z-index: 200; align-items: center;
}
.toast {
  background: var(--color-ink); color: #fff; padding: 12px 20px; border-radius: var(--radius-pill);
  font-size: 14px; font-weight: 600; box-shadow: var(--shadow-modal);
  animation: toast-in .18s ease-out;
}
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------------------------------------------------------------
   KPI / stat tiles
   --------------------------------------------------------------- */
.kpi-tile { background: var(--color-canvas); border: 1px solid var(--color-hairline); border-radius: var(--radius-lg); padding: var(--space-5); }
.kpi-value { font-size: 28px; font-weight: 600; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }
.kpi-label { font-size: 13px; color: var(--color-muted-48); margin-top: 4px; }
.kpi-delta { font-size: 12px; font-weight: 600; margin-top: var(--space-2); }

/* ---------------------------------------------------------------
   Hours balance: bar + ring
   --------------------------------------------------------------- */
.hours-bar-track { height: 10px; border-radius: var(--radius-pill); background: var(--color-divider-soft); overflow: hidden; }
.hours-bar-fill { height: 100%; background: var(--color-primary); border-radius: var(--radius-pill); }
.hours-ring {
  width: 132px; height: 132px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  background: conic-gradient(var(--color-primary) calc(var(--pct, 0) * 1%), var(--color-divider-soft) 0);
}
.hours-ring-inner {
  width: 104px; height: 104px; border-radius: 50%; background: var(--color-canvas);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}

/* ---------------------------------------------------------------
   Slot picker (date strip + time chips) & shutdown month grid
   --------------------------------------------------------------- */
.date-strip { display: flex; gap: var(--space-2); overflow-x: auto; padding-bottom: 4px; }
.date-chip {
  flex: 0 0 auto; width: 64px; padding: 10px 0; text-align: center; border-radius: var(--radius-md);
  border: 1px solid var(--color-hairline); background: var(--color-canvas); cursor: pointer;
  transition: border-color .15s ease, transform .15s ease;
}
.date-chip:hover:not(.active) { border-color: var(--color-primary); transform: translateY(-1px); }
.date-chip .dow { font-size: 11px; color: var(--color-muted-48); }
.date-chip .dom { font-size: 17px; font-weight: 600; font-variant-numeric: tabular-nums; }
.date-chip.active { background: var(--color-primary); border-color: var(--color-primary); color: #fff; }
.date-chip.active .dow { color: rgba(255, 255, 255, .8); }

.slot-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: var(--space-2); }
.slot-chip {
  padding: 10px 8px; text-align: center; border-radius: var(--radius-sm); font-size: 13px; font-weight: 600;
  border: 1px solid var(--color-hairline); background: var(--color-canvas); cursor: pointer;
}
.slot-chip:hover { border-color: var(--color-primary); }
.slot-chip.selected { background: var(--color-primary); border-color: var(--color-primary); color: #fff; }
.slot-chip.booked { background: var(--color-neutral-bg); color: var(--color-muted-soft); border-color: transparent; cursor: not-allowed; text-decoration: line-through; }
.slot-chip.shutdown { background: var(--color-danger-bg); color: var(--color-danger); border-color: transparent; cursor: not-allowed; }
.slot-chip.too-soon, .slot-chip.too-far { background: var(--color-warning-bg); color: var(--color-warning); border-color: transparent; cursor: not-allowed; }
.slot-chip.override-able { cursor: pointer; border: 1px dashed var(--color-warning); }

.month-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.month-grid .dow-label { font-size: 11px; color: var(--color-muted-48); text-align: center; padding-bottom: 4px; }
.month-cell {
  aspect-ratio: 1; border-radius: var(--radius-sm); border: 1px solid var(--color-divider-soft);
  display: flex; align-items: center; justify-content: center; font-size: 13px; position: relative;
}
.month-cell.blocked { background: var(--color-danger-bg); color: var(--color-danger); font-weight: 600; }
.month-cell.muted { color: var(--color-body-muted); border-color: transparent; }

/* ---------------------------------------------------------------
   Empty state / avatar
   --------------------------------------------------------------- */
.empty-state { text-align: center; padding: var(--space-8) var(--space-5); color: var(--color-muted-48); }
.empty-state .icon { font-size: 40px; margin-bottom: var(--space-3); }
.avatar {
  width: 36px; height: 36px; border-radius: 50%; background: var(--color-primary); color: #fff;
  display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 14px; flex: 0 0 auto;
}

/* ===================================================================
   Auth / login shells (shared across all 3 portals)
   =================================================================== */
.auth-screen { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: var(--space-5); }
.auth-card { width: 100%; max-width: 400px; }
.auth-brand { text-align: center; margin-bottom: var(--space-6); }
.quick-login-list { display: flex; flex-direction: column; gap: var(--space-3); margin-top: var(--space-5); }
.persona-card {
  display: flex; align-items: center; gap: var(--space-3); text-align: left; width: 100%;
  border: 1px solid var(--color-hairline); background: var(--color-canvas); border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4); cursor: pointer;
}
.persona-card:hover { border-color: var(--color-primary); }
.persona-card .meta { flex: 1 1 auto; min-width: 0; }
.persona-card .meta .name { font-weight: 600; font-size: 14px; }
.persona-card .meta .sub { font-size: 12px; color: var(--color-muted-48); }

/* ===================================================================
   Ops/Admin console shell — dark sidebar
   =================================================================== */
.ops-shell { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.ops-sidebar {
  background: var(--color-dark-1); color: var(--color-on-dark); padding: var(--space-5) var(--space-4);
  display: flex; flex-direction: column; gap: var(--space-2); position: sticky; top: 0; height: 100vh;
}
.ops-sidebar .brand { color: #fff; font-weight: 600; font-size: 17px; padding: 0 var(--space-2); margin-bottom: var(--space-5); }
.ops-nav-link {
  display: flex; align-items: center; gap: var(--space-3); padding: 10px var(--space-2); border-radius: var(--radius-sm);
  color: var(--color-body-muted); font-size: 14px; font-weight: 600; cursor: pointer; background: transparent; border: 0; width: 100%; text-align: left;
}
.ops-nav-link:hover { background: var(--color-dark-2); color: #fff; }
.ops-nav-link.active { background: var(--color-dark-2); color: var(--color-primary-on-dark); }
.ops-nav-spacer { flex: 1 1 auto; }
.ops-topbar { display: flex; align-items: center; justify-content: space-between; padding: var(--space-4) var(--space-6); border-bottom: 1px solid var(--color-hairline); background: var(--color-canvas); position: sticky; top: 0; z-index: 10; }
.ops-main { background: var(--color-canvas); min-height: 100vh; }
.ops-content { padding: var(--space-6); max-width: 1245px; }
/* Grid children default to min-width:auto, so a wide table would push the whole
   shell sideways instead of scrolling inside its own .table-wrap. Needed at
   every width, not just on mobile. */
.ops-shell > * { min-width: 0; }
.ops-main, .ops-content, .ops-topbar { min-width: 0; max-width: 100%; }
.role-pill { background: var(--color-dark-3); color: var(--color-primary-on-dark); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; padding: 3px 9px; border-radius: var(--radius-pill); }
@media (max-width: 860px) {
  .ops-shell { grid-template-columns: 1fr; }
  .ops-sidebar { display: none; }
}

/* ===================================================================
   Web app shell (Partner Portal + Customer App) — top nav, desktop web-app
   =================================================================== */
.topnav {
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-5);
  padding: var(--space-3) var(--space-6);
  background: var(--color-canvas); border-bottom: 1px solid var(--color-hairline); position: sticky; top: 0; z-index: 10;
}
.topnav > .flex:first-child { min-width: 0; flex: 1 1 auto; }
.topnav > .flex:last-child  { flex: 0 0 auto; }
.topnav .brand-lockup { flex: 0 0 auto; }
/* a long company name was wrapping to three lines in the corner */
.topnav .text-right .text-caption,
.topnav .text-right .text-micro { white-space: nowrap; }
.topnav .text-right { max-width: 200px; }
.topnav .text-right .text-caption { overflow: hidden; text-overflow: ellipsis; }
/* Seven items plus a brand and a user block needed ~1490px to fit on one
   line, so every 1440/1366/1280 laptop broke the nav onto two rows. It now
   refuses to wrap and scrolls instead, and sheds its icons before it has to. */
.topnav-links {
  display: flex; gap: var(--space-5); flex-wrap: nowrap;
  overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none;
  min-width: 0;
}
.topnav-links::-webkit-scrollbar { display: none; }
.topnav-links button { flex: 0 0 auto; white-space: nowrap; }
.topnav-links button { display: inline-flex; align-items: center; gap: 7px; background: none; border: 0; font-size: 15px; font-weight: 500; color: var(--color-muted-48); padding: 8px 0; border-bottom: 2px solid transparent; }
.topnav-links button.active { color: var(--color-ink); border-bottom-color: var(--color-primary); }
.topnav-links button .icon { width: 17px; height: 17px; }
@media (max-width: 1400px) {
  .topnav-links button .icon { display: none; }
  .topnav-links { gap: var(--space-4); }
}
.page-main { background: var(--color-parchment); min-height: 100vh; }
.page-content { max-width: 1245px; margin: 0 auto; padding: var(--space-7) var(--space-6); }
.page-content-narrow { max-width: 900px; }

/* ---------------------------------------------------------------
   Icons (stroke-based, currentColor — no icon carries its own color)
   --------------------------------------------------------------- */
.icon { flex-shrink: 0; display: inline-block; vertical-align: -0.15em; }
.icon-chip {
  width: 46px; height: 46px; border-radius: var(--radius-pill); flex-shrink: 0;
  background: var(--color-pearl); color: var(--color-ink);
  display: flex; align-items: center; justify-content: center;
}
.icon-chip-lg { width: 56px; height: 56px; }

/* Icon-forward quick-action tile */
.tile-action {
  display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center;
  padding: 22px 12px; border-radius: var(--radius-lg); border: 1px solid var(--color-hairline);
  background: var(--color-canvas); cursor: pointer;
  transition: border-color .2s cubic-bezier(.16,1,.3,1), transform .2s cubic-bezier(.16,1,.3,1), box-shadow .2s cubic-bezier(.16,1,.3,1);
}
.tile-action:hover { border-color: var(--color-primary); box-shadow: var(--shadow-hover); transform: translateY(-3px); }

/* Pricing card checklist rows */
.pricing-checklist { margin-top: var(--space-3); display: flex; flex-direction: column; gap: var(--space-2); }
.pricing-checklist .row { display: flex; align-items: center; gap: var(--space-2); font-size: 13.5px; color: var(--color-muted-80); }
.pricing-checklist .icon { color: var(--color-muted-48); }

/* Real brand lockup — icon mark + serif wordmark, from the actual
   slatespace.in logo asset (see /assets); mark comes in gold (light
   surfaces) and white (dark surfaces) variants. */
.brand-lockup { display: flex; align-items: center; gap: var(--space-3); }
.brand-logo-mark { width: 30px; height: 30px; object-fit: contain; flex-shrink: 0; margin: 0; }
.brand-wordmark { font-family: var(--font-serif); font-weight: 600; font-size: 19px; letter-spacing: .01em; line-height: 1.15; }
.brand-logo { height: 52px; width: auto; display: block; margin: 0 auto; }
.brand-logo-lg { height: 68px; }

/* ---------------------------------------------------------------
   Prototype-only chrome (landing badge, reset link)
   --------------------------------------------------------------- */
.proto-badge {
  display: inline-flex; align-items: center; gap: var(--space-2); background: var(--color-info-bg); color: var(--color-primary-text);
  font-size: 12px; font-weight: 700; padding: var(--space-2) var(--space-3); border-radius: var(--radius-pill);
}
.proto-badge::before { content: "●"; font-size: 8px; }

/* ---------------------------------------------------------------
   Accessibility: keyboard focus + reduced motion
   --------------------------------------------------------------- */
button:focus-visible, a:focus-visible, .date-chip:focus-visible, .slot-chip:focus-visible,
.persona-card:focus-visible, .tile-action:focus-visible, .card-hover:focus-visible,
.tab:focus-visible, .ops-nav-link:focus-visible, .topnav-links button:focus-visible,
.phone-tab:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--color-primary-focus); outline-offset: 2px;
}
.ops-nav-link:focus-visible { outline-color: var(--color-primary-on-dark); outline-offset: -2px; }

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

/* ===================================================================
   Public landing pages (Partner + Customer) — hero, dark band, stats, steps
   =================================================================== */
.text-hero { font-size: clamp(40px, 6vw, 72px); font-weight: 700; letter-spacing: -0.01em; line-height: 1.06; }


.hero-grid { display: grid; grid-template-columns: 1.1fr 1fr; gap: var(--space-7); align-items: center; }
@media (max-width: 860px) { .hero-grid { grid-template-columns: 1fr; } }

.hero-illustration { width: 100%; height: auto; max-width: 440px; display: block; margin: 0 auto; }

.section-pad { padding: var(--space-9) 0; }
@media (max-width: 900px) { .section-pad { padding: var(--space-8) 0; } }
@media (max-width: 640px) { .section-pad { padding: var(--space-7) 0; } }

/* Full-bleed dark band (breaks out of the centered page-content max-width) */
.section-dark {
  background: var(--color-dark-1); color: var(--color-on-dark);
  /* No 50vw breakout: this sits directly inside .page-main, which is already
     full width. 100vw counts the scrollbar while the layout viewport does not,
     so the old calc(50% - 50vw) pushed the page sideways by exactly one
     scrollbar width on every desktop browser. */
  padding: var(--space-8) var(--space-5);
}
.section-dark-inner { max-width: 1245px; margin: 0 auto; }
.section-dark .text-muted { color: var(--color-body-muted); }

.stat-row { display: flex; justify-content: center; gap: var(--space-7) var(--space-8); flex-wrap: wrap; text-align: center; }
.stat-value { font-size: 40px; font-weight: 600; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }
.stat-label { font-size: 13.5px; color: var(--color-body-muted); margin-top: var(--space-2); }

.step-card { text-align: left; }
.step-number {
  font-size: 12px; font-weight: 700; color: var(--color-primary); letter-spacing: .06em;
  text-transform: uppercase; margin-bottom: var(--space-3);
}

/* ---------------------------------------------------------------
   Pricing tags (classic centered pricing-card layout)
   --------------------------------------------------------------- */
.pricing-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-7) var(--space-5); }
@media (max-width: 1000px) { .pricing-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px)  { .pricing-grid { grid-template-columns: 1fr; } }

.pricing-tag {
  position: relative; background: var(--color-canvas); border: 1px solid var(--color-hairline);
  border-radius: var(--radius-lg); padding: 32px 28px; text-align: center;
  transition: transform .2s cubic-bezier(.16,1,.3,1), box-shadow .2s cubic-bezier(.16,1,.3,1);
}
.pricing-tag:hover { transform: translateY(-3px); box-shadow: var(--shadow-hover); }
.pricing-tag.featured { border: 2px solid var(--color-primary-focus); background: var(--color-pearl); }
.pricing-ribbon {
  position: absolute; top: -13px; left: 50%; transform: translateX(-50%);
  background: var(--color-primary); color: #fff; font-size: 11px; font-weight: 700;
  letter-spacing: .04em; text-transform: uppercase; padding: 5px 16px; border-radius: var(--radius-pill);
  white-space: nowrap;
}
.pricing-tag-name { font-size: 18px; font-weight: 600; }
.pricing-tag-price { font-size: 38px; font-weight: 700; letter-spacing: -0.02em; margin-top: var(--space-3); font-variant-numeric: tabular-nums; }
.pricing-tag .pricing-checklist { text-align: left; }

/* ===================================================================
   REV 2 — components added for the revised (blue) requirements:
   lead remarks & history, sort/filter bars, add-on picker, mandatory
   booking uploads, invoice→Zoho selection, hours-utilisation bar.
   Uses the existing tokens only — no new colours introduced.
   =================================================================== */

/* ---- filter / sort bar (leads, invoices) ---- */
.filter-bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
  padding: 14px 16px; background: var(--color-pearl);
  border: 1px solid var(--color-hairline); border-radius: var(--radius-md);
}
.filter-count {
  font-size: 12px; color: var(--color-muted-48);
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
.select-inline { width: auto; padding: 6px 10px; font-size: 13px; }
.tabular { font-variant-numeric: tabular-nums; }

/* ---- clickable name cell — opens History ---- */
.link-cell {
  background: none; border: 0; padding: 0; font: inherit; font-weight: 600;
  color: var(--color-ink); cursor: pointer; text-align: left;
  border-bottom: 1px solid transparent;
}
.link-cell:hover { color: var(--color-primary); border-bottom-color: var(--color-primary); }
.link-cell:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 2px; }

/* ---- lead remarks ---- */
.remark-cell { max-width: 320px; }
.remark-latest {
  font-size: 13px; line-height: 1.45; color: var(--color-muted-80);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}

/* ---- history timeline (lead + customer) ---- */
.timeline { max-height: 46vh; overflow-y: auto; padding-right: 4px; }
.timeline-item {
  display: flex; gap: 14px; padding: 12px 0;
  border-bottom: 1px solid var(--color-divider-soft);
}
.timeline-item:last-child { border-bottom: 0; }
.timeline-dot {
  flex: 0 0 9px; width: 9px; height: 9px; margin-top: 6px;
  border-radius: 50%; background: var(--color-primary);
}

/* ---- invoice selection ---- */
.row-selected { background: var(--color-info-bg); }

/* ---- add-on picker at booking ---- */
.addon-list {
  display: flex; flex-direction: column;
  border: 1px solid var(--color-hairline); border-radius: var(--radius-md); overflow: hidden;
}
.addon-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 14px; border-bottom: 1px solid var(--color-divider-soft);
}
.addon-row:last-child { border-bottom: 0; }

/* ---- mandatory layout upload ---- */
.req {
  font-size: 10px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
  color: var(--color-warning); background: var(--color-warning-bg);
  padding: 2px 6px; border-radius: var(--radius-xs); margin-left: 6px;
}
.field-hint { font-size: 12px; color: var(--color-muted-48); margin-top: 6px; }
.file-chip {
  display: flex; justify-content: space-between; gap: 12px; align-items: center;
  margin-top: 8px; padding: 8px 12px; font-size: 13px;
  background: var(--color-pearl); border: 1px solid var(--color-hairline);
  border-radius: var(--radius-sm);
}
.file-chip span { font-size: 12px; color: var(--color-muted-48); white-space: nowrap; }
.file-chip-error { border-color: var(--color-danger); color: var(--color-danger); }
.file-chip-error span { color: var(--color-danger); }

/* ---- hours utilisation: available vs shutdown vs booked ---- */
.util-bar {
  display: flex; height: 14px; width: 100%; overflow: hidden;
  border-radius: var(--radius-pill); background: var(--color-divider-soft);
}
.util-seg { height: 100%; }
.util-seg.util-booked { background: var(--color-primary); }
.util-seg.util-shutdown { background: var(--color-warning); }
.util-seg.util-free { background: var(--color-hairline); }
.util-key {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; color: var(--color-muted-48); font-variant-numeric: tabular-nums;
}
.util-dot { width: 9px; height: 9px; border-radius: 2px; display: inline-block; }
.util-dot.util-booked { background: var(--color-primary); }
.util-dot.util-shutdown { background: var(--color-warning); }
.util-dot.util-free { background: var(--color-hairline); }

/* ---- customer dashboard: offers + news & events ---- */
.promo-strip { display: flex; flex-direction: column; gap: 12px; }
.promo-card {
  padding: 16px 18px; border-left: 3px solid var(--color-primary);
  background: var(--color-info-bg); border-radius: var(--radius-sm);
}
.promo-card .promo-title { font-weight: 600; font-size: 15px; }
.promo-card .promo-body { font-size: 13px; color: var(--color-muted-80); margin-top: 4px; line-height: 1.5; }
.promo-code-pill {
  display: inline-block; margin-top: var(--space-3); padding: var(--space-1) var(--space-3);
  font-family: ui-monospace, Consolas, monospace; font-size: 12px; letter-spacing: .06em;
  background: var(--color-canvas); border: 1px dashed var(--color-primary);
  color: var(--color-primary); border-radius: var(--radius-xs);
}
.news-item {
  display: flex; gap: var(--space-3); padding: var(--space-3) 0;
  border-bottom: 1px solid var(--color-divider-soft);
}
.news-item:last-child { border-bottom: 0; }
.news-date {
  flex: 0 0 52px; text-align: center; padding: 6px 0;
  background: var(--color-pearl); border: 1px solid var(--color-hairline); border-radius: var(--radius-sm);
}
.news-date .d { font-size: 18px; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; }
.news-date .m { font-size: 10px; text-transform: uppercase; letter-spacing: .08em; color: var(--color-muted-48); margin-top: 2px; }

/* ---- mobile: Safari / Chrome Mobile is a stated requirement ---- */
@media (max-width: 720px) {
  .filter-bar { padding: 12px; }
  .filter-bar .input,
  .filter-bar .select { width: 100%; max-width: none; }
  .filter-bar .flex { width: 100%; }
  .remark-cell { max-width: none; }
  .addon-row { flex-direction: column; align-items: stretch; gap: 8px; }
  .addon-row .select-inline { width: 100%; }
  .util-key { font-size: 11px; }
  .timeline { max-height: none; }
}

/* ===================================================================
   REV 2 — mobile navigation.
   Requirement: the whole portal must be operable on Safari and Chrome
   Mobile. Two things blocked that:
     · .topnav-links wrapped and collided with the brand/user block
     · .ops-sidebar was display:none under 860px, leaving the Ops
       Console with no navigation at all on a phone
   Both now collapse to a horizontally scrollable strip.
   =================================================================== */
@media (max-width: 1000px) {
  /* --- Partner Portal + Customer App --- */
  .topnav {
    flex-direction: column; align-items: stretch; gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
  }
  .topnav > .flex { width: 100%; justify-content: space-between; }
  .topnav > .flex:first-child { flex-direction: column; align-items: stretch; gap: var(--space-3); }
  .topnav-links {
    flex-wrap: nowrap; overflow-x: auto; gap: var(--space-5);
    -webkit-overflow-scrolling: touch; scrollbar-width: none;
    padding-bottom: 2px; margin: 0 calc(var(--space-4) * -1); padding-inline: var(--space-4);
  }
  .topnav-links::-webkit-scrollbar { display: none; }
  .topnav-links button { white-space: nowrap; flex: 0 0 auto; }
  .page-content { padding: var(--space-5) var(--space-4); }

  /* --- Ops Console: sidebar becomes a scrolling top strip ---
     min-width:0 is load-bearing: grid items default to min-width:auto, so
     without it neither the nav strip nor the tables can shrink below their
     content and overflow-x:auto never engages — the whole page scrolls
     sideways instead. */
  .ops-shell { grid-template-columns: 1fr; }
  .ops-shell > * { min-width: 0; }
  .ops-main, .ops-content, .ops-topbar { min-width: 0; max-width: 100%; }
  .ops-sidebar {
    display: flex; flex-direction: row; align-items: center;
    overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none;
    gap: var(--space-2); padding: var(--space-3) var(--space-4);
    min-height: 0; height: auto; min-width: 0; position: sticky; top: 0; z-index: 11;
  }
  .ops-sidebar::-webkit-scrollbar { display: none; }
  .ops-sidebar .brand { flex: 0 0 auto; margin: 0 var(--space-3) 0 0; padding: 0; border-bottom: 0; }
  .ops-sidebar .brand .text-caption { display: none; }
  .ops-nav-link {
    flex: 0 0 auto; white-space: nowrap; width: auto;
    padding: 8px 12px; border-radius: var(--radius-sm); margin: 0;
  }
  .ops-nav-spacer { display: none; }
  .ops-topbar { padding: var(--space-3) var(--space-4); }
  .ops-topbar .text-caption { display: none; }
  .ops-content { padding: var(--space-4); }

  /* tables are the main horizontal-overflow risk on a phone */
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .table { min-width: 640px; }
  .modal { max-height: 88vh; overflow-y: auto; }
}

/* ===================================================================
   REV 3 — master add/edit/delete + the role permission matrix.
   =================================================================== */

/* ---- day-of-week picker (Room master operating days) ---- */
.day-picker { display: flex; flex-wrap: wrap; gap: 6px; }
.day-chip { position: relative; cursor: pointer; }
.day-chip input { position: absolute; opacity: 0; width: 0; height: 0; }
.day-chip span {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 46px; padding: 8px 10px; font-size: 13px; font-weight: 600;
  color: var(--color-muted-48); background: var(--color-canvas);
  border: 1px solid var(--color-hairline); border-radius: var(--radius-sm);
}
.day-chip input:checked + span {
  color: var(--color-on-primary); background: var(--color-primary); border-color: var(--color-primary);
}
.day-chip input:focus-visible + span { outline: 2px solid var(--color-primary); outline-offset: 2px; }

/* ---- permission matrix ---- */
.perm-table th, .perm-table td { padding: 8px 12px; }
.perm-table td.text-center, .perm-table th.text-center { text-align: center; }
.perm-table input[type="checkbox"] { width: 17px; height: 17px; cursor: pointer; accent-color: var(--color-primary); }
.perm-table input[type="checkbox"]:disabled { cursor: not-allowed; opacity: .45; }
.perm-table tbody tr:hover { background: var(--color-pearl); }

/* a Delete that referential integrity will refuse */
.btn.is-blocked { color: var(--color-muted-48); text-decoration: line-through; }

@media (max-width: 720px) {
  .perm-table { min-width: 420px; }
  .day-chip span { min-width: 40px; padding: 8px; }
}

/* ===================================================================
   REV 4 — mobile reachability.
   At 375px three rows were wider than the screen and simply clipped, so
   their controls could not be reached at all: the 9-tab Masters strip and
   the action-button rows on Subscriptions and Invoices. Tabs now scroll
   horizontally; action rows wrap.
   =================================================================== */
@media (max-width: 720px) {
  /* tab strips scroll instead of overflowing */
  .tabs {
    flex-wrap: nowrap; overflow-x: auto; gap: var(--space-4);
    -webkit-overflow-scrolling: touch; scrollbar-width: none;
    margin-inline: calc(var(--space-4) * -1); padding-inline: var(--space-4);
  }
  .tabs::-webkit-scrollbar { display: none; }
  .tab { flex: 0 0 auto; white-space: nowrap; }

  /* header rows: title on one line, actions wrapping under it */
  .ops-content > .flex.justify-between { flex-wrap: wrap; gap: var(--space-3); }
  .ops-content > .flex.justify-between > .flex { flex-wrap: wrap; width: 100%; }
  .card-header { flex-wrap: wrap; gap: var(--space-2); }

  /* the segmented control is a row of buttons too */
  .segmented { flex-wrap: wrap; }

  /* stop long action rows clipping their buttons */
  .filter-bar .flex { flex-wrap: wrap; width: 100%; }
  .filter-bar .flex .btn { flex: 1 1 auto; }
}

/* ===================================================================
   REV 5 — month calendar.
   Replaces the 7-day strip, which forced week-by-week paging and showed
   nothing about where the free days actually were. Each cell carries the
   day's real availability so a whole month reads at a glance.
   =================================================================== */
.cal { border: 1px solid var(--color-hairline); background: var(--color-canvas); }

.cal-head {
  display: flex; align-items: center; gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--color-hairline);
}
.cal-pickers { display: flex; gap: 6px; flex: 1 1 auto; }
.cal-pickers .select { flex: 0 1 auto; }

.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); }

.cal-dow {
  padding: 8px 0; text-align: center;
  font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase;
  color: var(--color-muted-48); border-bottom: 1px solid var(--color-hairline);
}

.cal-cell {
  min-height: 62px; padding: 6px 4px 5px;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 2px;
  border-right: 1px solid var(--color-divider-soft);
  border-bottom: 1px solid var(--color-divider-soft);
  background: var(--color-canvas);
}
.cal-cell:nth-child(7n) { border-right: 0; }
.cal-cell.is-blank { background: var(--color-parchment); }

.cal-num  { font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; line-height: 1.2; }
.cal-note { font-size: 10.5px; line-height: 1.2; color: var(--color-muted-48); }

/* days you can pick */
.cal-cell.is-open, .cal-cell.is-full { cursor: pointer; }
.cal-cell.is-open .cal-note { color: var(--color-success); }
.cal-cell.is-open:hover  { background: var(--color-info-bg); }
.cal-cell.is-full:hover  { background: var(--color-divider-soft); }
.cal-cell.is-full .cal-num, .cal-cell.is-full .cal-note { color: var(--color-muted-48); }

/* days you cannot */
.cal-cell.is-past   { background: var(--color-parchment); }
.cal-cell.is-past .cal-num { color: var(--color-muted-soft); }
.cal-cell.is-closed { background: var(--color-parchment); }
.cal-cell.is-closed .cal-num { color: var(--color-muted-soft); }
.cal-cell.is-shutdown { background: var(--color-warning-bg); }
.cal-cell.is-shutdown .cal-num,
.cal-cell.is-shutdown .cal-note { color: var(--color-warning); }

.cal-cell.is-today .cal-num {
  position: relative;
}
.cal-cell.is-today .cal-num::after {
  content: ''; position: absolute; left: 50%; transform: translateX(-50%);
  bottom: -3px; width: 14px; height: 2px; background: var(--color-primary);
}
.cal-cell.is-selected {
  background: var(--color-primary); box-shadow: inset 0 0 0 1px var(--color-primary);
}
.cal-cell.is-selected .cal-num,
.cal-cell.is-selected .cal-note { color: var(--color-on-primary); }
.cal-cell.is-selected.is-today .cal-num::after { background: var(--color-on-primary); }
.cal-cell:focus-visible { outline: 2px solid var(--color-primary); outline-offset: -2px; }

.cal-legend {
  display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-4);
  padding: 10px var(--space-4);
  border-top: 1px solid var(--color-hairline);
  font-size: 11.5px; color: var(--color-muted-48);
}
.cal-legend span { display: inline-flex; align-items: center; gap: 6px; }
.cal-key { width: 10px; height: 10px; border: 1px solid var(--color-hairline); display: inline-block; }
.cal-key.is-open     { background: var(--color-canvas); border-color: var(--color-success); }
.cal-key.is-full     { background: var(--color-divider-soft); }
.cal-key.is-shutdown { background: var(--color-warning-bg); border-color: var(--color-warning); }
.cal-key.is-closed   { background: var(--color-parchment); }

@media (max-width: 720px) {
  .cal-head { flex-wrap: wrap; }
  .cal-pickers { order: -1; width: 100%; }
  .cal-pickers .select { flex: 1 1 auto; }
  .cal-cell { min-height: 50px; padding: 5px 2px; }
  .cal-num  { font-size: 13px; }
  .cal-note { font-size: 9.5px; }
}

/* ===================================================================
   REV 6 — template editing.
   Staff write these templates, not developers, so the available merge
   fields are shown as clickable chips and every box carries a live
   preview filled with sample data.
   =================================================================== */
.tagbox {
  margin-top: 10px; padding: 12px 14px;
  background: var(--color-pearl); border: 1px solid var(--color-hairline);
}
.tagbox-head {
  font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase;
  color: var(--color-muted-48); margin-bottom: 10px;
}
.tagbox-group { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; margin-bottom: 7px; }
.tagbox-group:last-child { margin-bottom: 0; }
.tagbox-label {
  flex: 0 0 62px; font-size: 10.5px; font-weight: 600; letter-spacing: .06em;
  text-transform: uppercase; color: var(--color-muted-48);
}
.tag-chip {
  font-family: ui-monospace, Consolas, monospace; font-size: 11.5px;
  padding: 3px 8px; cursor: pointer;
  background: var(--color-canvas); color: var(--color-primary-text);
  border: 1px dashed var(--color-primary); border-radius: var(--radius-xs);
}
.tag-chip:hover { background: var(--color-primary); color: var(--color-on-primary); border-style: solid; }
.tag-chip:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 2px; }

/* live preview panes */
.tpl-preview {
  background: var(--color-canvas); border: 1px solid var(--color-hairline);
  padding: var(--space-5); min-height: 300px; overflow-x: auto;
}
.tpl-preview-sms {
  min-height: 0; margin-top: 10px; padding: 11px 14px;
  background: var(--color-divider-soft); border: 0; border-left: 3px solid var(--color-primary);
  font-size: 13.5px; line-height: 1.55; color: var(--color-muted-80); white-space: pre-wrap;
}

/* the invoice markup, rendered inside the preview pane */
.tpl-preview .inv { font-size: 13px; line-height: 1.55; }
.tpl-preview .inv-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px;
  padding-bottom: 18px; border-bottom: 2px solid var(--color-primary); }
.tpl-preview .inv-brand { font-size: 19px; font-weight: 700; letter-spacing: -0.01em; }
.tpl-preview .inv-sub { font-size: 11.5px; color: var(--color-muted-48); }
.tpl-preview .inv-meta { text-align: right; }
.tpl-preview .inv-word { font-size: 10px; font-weight: 600; letter-spacing: .18em; text-transform: uppercase; color: var(--color-primary); }
.tpl-preview .inv-no { font-size: 16px; font-weight: 600; font-variant-numeric: tabular-nums; }
.tpl-preview .inv-status { display: inline-block; margin-top: 6px; font-size: 10px; font-weight: 600;
  letter-spacing: .1em; text-transform: uppercase; border: 1px solid var(--color-primary);
  color: var(--color-primary); padding: 2px 8px; }
.tpl-preview .inv-parties { display: flex; gap: 36px; padding: 18px 0; border-bottom: 1px solid var(--color-hairline); }
.tpl-preview .inv-cap { font-size: 10px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase;
  color: var(--color-muted-48); margin-bottom: 4px; }
.tpl-preview .inv-name { font-weight: 600; font-size: 14px; }
.tpl-preview .inv-table { width: 100%; border-collapse: collapse; margin-top: 6px; }
.tpl-preview .inv-table th { font-size: 10px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase;
  color: var(--color-muted-48); text-align: left; padding: 12px 0 8px; border-bottom: 1px solid var(--color-hairline); }
.tpl-preview .inv-table td { padding: 13px 0; border-bottom: 1px solid var(--color-divider-soft); vertical-align: top; }
.tpl-preview .inv-table .r { text-align: right; font-variant-numeric: tabular-nums; }
.tpl-preview .inv-totals { margin-left: auto; width: 230px; margin-top: 14px; }
.tpl-preview .inv-totals > div { display: flex; justify-content: space-between; padding: 5px 0; font-variant-numeric: tabular-nums; }
.tpl-preview .inv-totals > div span:first-child { color: var(--color-muted-48); }
.tpl-preview .inv-grand { border-top: 1px solid var(--color-ink); margin-top: 6px; padding-top: 10px !important;
  font-weight: 700; font-size: 15px; }
.tpl-preview .inv-grand span:first-child { color: var(--color-ink) !important; }
.tpl-preview .inv-foot { margin-top: 26px; padding-top: 14px; border-top: 1px solid var(--color-hairline);
  font-size: 11px; color: var(--color-muted-48); }

@media (max-width: 720px) {
  .tagbox-label { flex-basis: 100%; margin-bottom: 2px; }
  .tpl-preview { min-height: 0; padding: var(--space-4); }
  .tpl-preview .inv-parties { flex-direction: column; gap: 16px; }
  .tpl-preview .inv-totals { width: 100%; }
}

/* ===================================================================
   REV 7 — code entry rows.
   The input takes the room; the Apply button keeps its own width and
   never shrinks into an unreadable stub.
   =================================================================== */
.code-field { margin-top: var(--space-3); }
.code-field + .code-field { margin-top: var(--space-4); }
.code-row { display: flex; gap: var(--space-2); align-items: stretch; }
.code-row .input { flex: 1 1 auto; min-width: 0; }
.code-row .btn { flex: 0 0 auto; }
.code-field .field-help { margin-top: 6px; font-size: 12.5px; }
.code-field .field-help:empty { display: none; }

/* the buy modal uses the same shape */
.field > .flex.gap-2 > .input { flex: 1 1 auto; min-width: 0; }
.field > .flex.gap-2 > .btn   { flex: 0 0 auto; }

@media (max-width: 420px) {
  .code-row { flex-wrap: wrap; }
  .code-row .btn { width: 100%; }
}
