/* ==========================================================================
   Workspace — Operate surface.
   Light stone ground by default: this room runs all day under office light and
   prints vouchers. A dark instrument panel is one keystroke away for the long
   evenings before a departure.
   ========================================================================== */

.workspace { background: var(--ground); }

/* --- Boot ---------------------------------------------------------------- */
.boot {
  min-height: 100vh;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: var(--s4);
  color: var(--text-muted);
}
.boot__mark {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  background: var(--green-900);
  color: var(--amber-500);
  border-radius: var(--r-md);
  font-size: 1.35rem;
  padding-bottom: 3px;
}

/* --- Mark ---------------------------------------------------------------- */
.mark { display: inline-flex; align-items: center; gap: 10px; }
.mark__glyph {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  background: var(--amber-500);
  color: var(--green-950);
  border-radius: var(--r-sm);
  font-size: .95rem;
  font-weight: 700;
  line-height: 1;
  padding-bottom: 2px;
}
.mark__word { font-size: .9375rem; color: #fff; }
.mark__demo { color: var(--amber-500); }

/* --- Sign-in ------------------------------------------------------------- */
.signin {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}
.signin__side {
  display: flex;
  flex-direction: column;
  gap: var(--s8);
  padding: clamp(var(--s7), 5vw, var(--s11));
  background:
    radial-gradient(110% 80% at 82% 8%, rgba(242, 107, 29, .14), transparent 58%),
    linear-gradient(170deg, #16181D, #0B0D10);
  color: #fff;
}
.signin__plate {
  --plate: rgba(255, 255, 255, .05);
  --keyline: rgba(255, 255, 255, .2);
  margin-top: auto;
  padding: var(--s7);
  max-width: 440px;
}
.signin__plate .sign-label { color: rgba(233, 244, 238, .66); }
.signin__numeral {
  display: block;
  margin: var(--s3) 0 var(--s5);
  font-size: clamp(3.5rem, 7vw, 5.5rem);
  color: var(--amber-500);
}
.signin__plate p {
  font-size: .9375rem;
  line-height: 1.6;
  color: rgba(233, 244, 238, .74);
}
.signin__back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: auto;
  font-size: .8125rem;
  font-weight: 600;
  color: rgba(233, 244, 238, .66);
}
.signin__back:hover { color: #fff; }
.signin__main { display: grid; place-items: center; padding: var(--s7); background: var(--plate); }
.signin__form-wrap { width: min(100%, 380px); }
.signin__form-wrap h1 { font-size: 2rem; }
.signin__sub { margin-top: 6px; color: var(--text-muted); font-size: .9375rem; }
.signin__error {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: var(--s5);
  padding: 11px 13px;
  background: var(--signal-red-100);
  color: var(--signal-red);
  border-radius: var(--r-md);
  font-size: .875rem;
  font-weight: 600;
}
:root[data-theme='dark'] .signin__error { background: rgba(179, 38, 30, .22); color: #FFB4AC; }
.signin__form { display: grid; gap: var(--s4); margin-top: var(--s7); }
.signin__demo {
  margin-top: var(--s8);
  padding-top: var(--s6);
  border-top: 1px solid var(--keyline);
}
.signin__demo .sign-label { color: var(--text-muted); }
.signin__demo-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--s2);
  margin-top: var(--s3);
}
.signin__demo-note { margin-top: var(--s3); font-size: .75rem; line-height: 1.5; color: var(--text-faint); }

/* --- Shell --------------------------------------------------------------- */
.shell-grid {
  display: grid;
  grid-template-columns: 232px minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr);
  grid-template-areas: 'rail topbar' 'rail content';
  min-height: 100vh;
}

.rail {
  grid-area: rail;
  display: flex;
  flex-direction: column;
  gap: var(--s6);
  padding: var(--s5) var(--s4);
  background: var(--green-900);
  border-right: 1px solid var(--green-950);
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.mark--rail { padding: 4px 8px var(--s2); }
.nav-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 11px;
  border-radius: var(--r-md);
  color: rgba(233, 244, 238, .72);
  font-size: .875rem;
  font-weight: 550;
  transition: background-color .16s, color .16s;
}
.nav-item:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.nav-item.is-current {
  background: rgba(255, 255, 255, .1);
  color: #fff;
  font-weight: 650;
}
/* The directional marker from the signage system, not a coloured border. */
.nav-item.is-current::before {
  content: '';
  position: absolute;
  left: -4px;
  top: 50%;
  width: 8px;
  height: 14px;
  transform: translateY(-50%);
  background: var(--amber-500);
  clip-path: polygon(0 0, 100% 50%, 0 100%);
}
.rail__foot { margin-top: auto; padding: var(--s4) 11px 0; border-top: 1px solid rgba(255, 255, 255, .12); }
.rail__org { display: grid; gap: 3px; }
.rail__org .sign-label { color: #fff; }
.rail__org .data { font-size: .75rem; color: rgba(233, 244, 238, .5); }

/* --- Topbar -------------------------------------------------------------- */
.topbar {
  grid-area: topbar;
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: var(--s3);
  padding: var(--s3) var(--s6);
  min-height: 60px;
  background: color-mix(in srgb, var(--plate) 92%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--keyline);
}
.topbar__spacer { flex: 1; }
.topbar__menu { display: none; }
.icon-btn {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  background: transparent;
  color: var(--text-muted);
  border: 1px solid transparent;
  border-radius: var(--r-md);
  cursor: pointer;
  transition: background-color .16s, color .16s, border-color .16s;
}
.icon-btn:hover { background: var(--plate-sunken); color: var(--text); border-color: var(--keyline); }
.topbar__bell { position: relative; }
.topbar__count {
  position: absolute;
  top: 1px;
  right: 1px;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  display: grid;
  place-items: center;
  background: var(--signal-red);
  color: #fff;
  border-radius: 9px;
  font-size: .625rem;
  font-weight: 700;
}
.topbar__me {
  display: flex;
  align-items: center;
  gap: var(--s3);
  padding-left: var(--s4);
  margin-left: var(--s2);
  border-left: 1px solid var(--keyline);
}
.avatar {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  background: var(--green-800);
  color: #fff;
  border-radius: var(--r-md);
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .02em;
}
.topbar__who { display: grid; line-height: 1.25; }
.topbar__who strong { font-size: .8125rem; }
.topbar__who .data { font-size: .6875rem; color: var(--text-muted); }

/* --- Content ------------------------------------------------------------- */
.content {
  grid-area: content;
  display: grid;
  align-content: start;
  gap: var(--s5);
  padding: var(--s6) var(--s6) var(--s10);
  max-width: 1600px;
  width: 100%;
}
.content:focus { outline: none; }

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--s5);
  flex-wrap: wrap;
}
.page-head h1 { font-size: 1.75rem; letter-spacing: -0.03em; }
.page-head__sub { margin-top: 5px; font-size: .875rem; color: var(--text-muted); max-width: 74ch; }
.page-head__acts { display: flex; gap: var(--s2); flex-wrap: wrap; }

.backlink {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: .8125rem;
  font-weight: 650;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .05em;
}
.backlink:hover { color: var(--accent-text); }

/* Panels size to their own content — an empty panel beside a long table should
   not stretch to match it. */
.grid { display: grid; gap: var(--s5); align-items: start; }
.grid--1-1 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid--2-1 { grid-template-columns: minmax(0, 1.9fr) minmax(0, 1fr); }

/* --- Hero ---------------------------------------------------------------- */
.hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s8);
  padding: var(--s6) var(--s7);
  background: linear-gradient(112deg, #1D222B, #14171C);
  border-color: var(--green-900);
  color: #fff;
}
.hero.plate--keyline::after { border-color: rgba(255, 255, 255, .18); }
.hero__line {
  font-size: clamp(1.25rem, 2.2vw, 1.75rem);
  font-stretch: 108%;
  letter-spacing: -0.028em;
  max-width: 28ch;
}
.hero__sub { margin-top: 10px; font-size: .9375rem; color: rgba(233, 244, 238, .78); max-width: 62ch; }
.hero__sub strong { color: var(--amber-300); }
.hero__figure { display: grid; justify-items: end; gap: 6px; flex: none; }
.hero__figure-label { color: rgba(233, 244, 238, .62); }
.hero__figure-value { font-size: clamp(2.5rem, 5vw, 3.75rem); color: var(--amber-500); }

/* --- Metrics ------------------------------------------------------------- */
.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--s4);
}
.metric {
  display: grid;
  gap: 5px;
  padding: var(--s5);
  background: var(--plate);
}
.metric__label { color: var(--text-muted); }
.metric__value { font-size: 2.125rem; margin: 2px 0; }
.metric__note { font-size: .75rem; color: var(--text-faint); }
.metric--alert .metric__value { color: var(--signal-red); }
.metric--caution .metric__value { color: var(--amber-600); }
:root[data-theme='dark'] .metric--caution .metric__value { color: var(--amber-500); }
:root[data-theme='dark'] .metric--alert .metric__value { color: #FF8B80; }

/* --- Panels -------------------------------------------------------------- */
.panel { display: flex; flex-direction: column; min-width: 0; overflow: hidden; }
.panel__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--s4);
  padding: var(--s5) var(--s5) var(--s4);
  border-bottom: 1px solid var(--keyline);
}
.panel__title { font-size: 1rem; letter-spacing: -0.01em; }
.panel__sub { margin-top: 4px; font-size: .75rem; color: var(--text-muted); max-width: 70ch; }
.panel__acts { display: flex; gap: var(--s2); align-items: center; flex: none; }
.panel__body { padding: var(--s5); flex: 1; min-width: 0; }
.panel__body > .boardwrap:only-child,
.panel__body > .empty:only-child { margin: calc(var(--s5) * -1); }
.panel--flush .panel__body { padding: 0; }

/* --- Boards -------------------------------------------------------------- */
.boardwrap { overflow-x: auto; }
.board--data { font-size: .8125rem; }
.board--data thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 10px var(--s4);
  background: var(--plate-sunken);
  border-bottom: 1px solid var(--keyline);
  color: var(--text-muted);
  font-stretch: 100%;
  font-weight: 650;
  font-size: .6875rem;
  letter-spacing: .07em;
  text-transform: uppercase;
  text-align: left;
  white-space: nowrap;
}
.board--data thead th.right { text-align: right; }
.board--data tbody td {
  padding: 11px var(--s4);
  border-bottom: 1px solid var(--keyline);
  vertical-align: middle;
}
.board--data tbody tr:last-child td { border-bottom: none; }
.board--data tbody tr[data-go] { cursor: pointer; }
.board--data tbody tr[data-go]:hover { background: var(--stone-050); }
:root[data-theme='dark'] .board--data tbody tr[data-go]:hover { background: rgba(255, 255, 255, .04); }
.board--data tbody tr:focus-visible { outline: 2px solid var(--amber-500); outline-offset: -2px; }
.board--data .sub { display: block; font-size: .6875rem; color: var(--text-faint); margin-top: 2px; }
.cell--meter { min-width: 190px; }

/* The reference numeral: the same object as the gate plate, at list scale. */
.ref {
  display: inline-grid;
  place-items: center;
  min-width: 52px;
  padding: 4px 7px;
  background: var(--green-850);
  color: var(--amber-300);
  border-radius: var(--r-sm);
  font-size: .9375rem;
}
.ref--sm { min-width: 44px; font-size: .8125rem; padding: 2px 6px; }

.scorechip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px 3px 4px;
  border-radius: var(--r-sm);
  background: var(--stone-100);
  color: var(--stone-700);
  font-size: .6875rem;
  font-weight: 650;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.scorechip .numeral {
  display: inline-grid;
  place-items: center;
  min-width: 26px;
  padding: 2px 4px;
  border-radius: 2px;
  background: var(--stone-300);
  color: var(--stone-800);
  font-size: .8125rem;
}
.scorechip[data-band='hot']  { background: var(--signal-red-100); color: var(--signal-red); }
.scorechip[data-band='hot'] .numeral  { background: var(--signal-red); color: #fff; }
.scorechip[data-band='warm'] { background: var(--amber-100); color: var(--amber-700); }
.scorechip[data-band='warm'] .numeral { background: var(--amber-500); color: var(--green-950); }
.scorechip[data-band='cool'] { background: var(--signal-blue-100); color: var(--signal-blue); }
.scorechip[data-band='cool'] .numeral { background: var(--signal-blue); color: #fff; }
:root[data-theme='dark'] .scorechip { background: rgba(255, 255, 255, .08); color: var(--text-muted); }
:root[data-theme='dark'] .scorechip[data-band='hot']  { background: rgba(179, 38, 30, .22); color: #FF9E95; }
:root[data-theme='dark'] .scorechip[data-band='warm'] { background: rgba(223, 160, 42, .18); color: var(--amber-300); }
:root[data-theme='dark'] .scorechip[data-band='cool'] { background: rgba(27, 94, 140, .26); color: #8FC4E8; }

.dial { display: inline-flex; align-items: center; gap: 6px; color: var(--accent-text); font-weight: 650; }
.dial:hover { text-decoration: underline; }

/* --- Work list ----------------------------------------------------------- */
.worklist, .risklist, .factors, .feed, .notif, .thread, .stagebars, .season-strip {
  list-style: none; margin: 0; padding: 0;
}
.worklist { display: grid; }
.worklist__item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--s4);
  padding: var(--s4) var(--s5);
  margin: 0 calc(var(--s5) * -1);
  border-bottom: 1px solid var(--keyline);
  cursor: pointer;
  transition: background-color .16s;
}
.worklist__item:last-child { border-bottom: none; }
.worklist__item:hover { background: var(--stone-050); }
:root[data-theme='dark'] .worklist__item:hover { background: rgba(255, 255, 255, .04); }
.worklist__score {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: var(--r-md);
  background: var(--stone-200);
  color: var(--stone-700);
  font-size: 1.125rem;
}
.worklist__score[data-band='hot']  { background: var(--signal-red); color: #fff; }
.worklist__score[data-band='warm'] { background: var(--amber-500); color: var(--green-950); }
.worklist__score[data-band='cool'] { background: var(--signal-blue); color: #fff; }
.worklist__body { display: grid; gap: 3px; min-width: 0; }
.worklist__name {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-weight: 650;
  font-size: .9375rem;
}
.worklist__action { font-size: .8125rem; color: var(--text-muted); }
.worklist__meta { display: grid; justify-items: end; gap: 5px; flex: none; }
.worklist__meta .data { font-weight: 700; font-size: .875rem; }

.risklist li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: var(--s3);
  padding: 11px 0;
  border-bottom: 1px solid var(--keyline);
  cursor: pointer;
  font-size: .875rem;
}
.risklist li:last-child { border-bottom: none; }
.risklist li:hover .risklist__name { color: var(--accent-text); }
.risklist__name { font-weight: 600; }
.risklist__quiet { font-size: .75rem; color: var(--signal-red); font-weight: 650; }
:root[data-theme='dark'] .risklist__quiet { color: #FF9E95; }
.risklist__value { font-weight: 700; min-width: 60px; text-align: right; }

/* --- Score factors ------------------------------------------------------- */
.factors { display: grid; gap: 2px; }
.factor {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr);
  gap: var(--s3);
  padding: 9px 0;
  border-bottom: 1px solid var(--keyline);
}
.factor:last-child { border-bottom: none; }
.factor__points {
  font-weight: 800;
  font-size: .9375rem;
  text-align: right;
  font-stretch: 100%;
}
.factor__body { display: grid; gap: 2px; }
.factor__body strong { font-size: .8125rem; }
.factor__body span { font-size: .75rem; color: var(--text-muted); line-height: 1.45; }

/* --- Profile ------------------------------------------------------------- */
.profile {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: var(--s7);
  padding: var(--s6);
}
.profile__ref {
  display: grid;
  justify-items: center;
  align-content: start;
  gap: 6px;
  padding: var(--s5);
  min-width: 180px;
  background: var(--green-850);
  border-radius: var(--r-md);
  color: #fff;
  text-align: center;
}
.profile__ref .sign-label { color: rgba(233, 244, 238, .62); }
.profile__ref-num { font-size: 3rem; color: var(--amber-500); }
.profile__ref-note { font-size: .6875rem; line-height: 1.4; color: rgba(233, 244, 238, .55); max-width: 20ch; }
.profile__who h2 { font-size: 1.5rem; }
.profile__meta { margin-top: 5px; font-size: .8125rem; color: var(--text-muted); }
.profile__badges { display: flex; gap: 7px; flex-wrap: wrap; margin-top: var(--s4); }
.profile__facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: var(--s4);
  margin: var(--s5) 0 0;
  padding-top: var(--s5);
  border-top: 1px solid var(--keyline);
}
.profile__facts dt {
  font-stretch: 106%;
  font-weight: 650;
  font-size: .625rem;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--text-faint);
}
.profile__facts dd { margin: 3px 0 0; font-size: .875rem; font-weight: 600; }
.profile__acts {
  grid-column: 1 / -1;
  display: flex;
  gap: var(--s2);
  flex-wrap: wrap;
  padding-top: var(--s5);
  border-top: 1px solid var(--keyline);
}

/* --- Next action / policy plates ----------------------------------------- */
.nextact { padding: var(--s5) var(--s6); }
.nextact .sign-label { color: var(--green-900); opacity: .72; }
.nextact__line { margin-top: 6px; font-size: 1.0625rem; font-weight: 650; letter-spacing: -0.015em; }
.nextact__why { display: block; margin-top: 6px; font-size: .75rem; color: rgba(4, 29, 20, .68); font-weight: 600; }

.policy, .modelnote {
  display: flex;
  align-items: flex-start;
  gap: var(--s4);
  padding: var(--s4) var(--s5);
  color: var(--text-muted);
  font-size: .8125rem;
  line-height: 1.55;
}
.policy .ico, .modelnote .ico { flex: none; color: var(--accent); margin-top: 1px; }
.policy strong, .modelnote strong { display: block; color: var(--text); font-size: .875rem; }
.policy--alert { background: var(--signal-red-100); border-color: #EBC4C0; color: #7A2019; }
.policy--alert .ico { color: var(--signal-red); }
.policy--alert strong { color: var(--signal-red); }
.policy--alert.plate--keyline::after { border-color: #EBC4C0; }
:root[data-theme='dark'] .policy--alert { background: rgba(179, 38, 30, .18); border-color: rgba(179, 38, 30, .4); color: #F3C0BB; }
:root[data-theme='dark'] .policy--alert strong, :root[data-theme='dark'] .policy--alert .ico { color: #FF9E95; }

/* --- Charts -------------------------------------------------------------- */
.chart { margin: 0; display: grid; gap: var(--s3); }
.chart-cols {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 6px;
  align-items: end;
  border-bottom: 1px solid var(--keyline);
  padding-bottom: 6px;
}
.chart-col { display: grid; gap: 6px; justify-items: center; min-width: 0; }
.chart-col__bar { width: 100%; height: 150px; }
.chart-col__fill { fill: var(--signal-blue); opacity: .82; transition: fill .16s, opacity .16s; }
.chart-col:hover .chart-col__fill { opacity: 1; }
.chart-col__fill--forecast { fill: var(--amber-500); }
.chart-col:hover .chart-col__fill--forecast { fill: var(--amber-300); }
.chart-col__tick {
  font-size: .6875rem;
  color: var(--text-faint);
  white-space: nowrap;
  overflow: hidden;
}
.chart__key {
  display: flex;
  gap: var(--s5);
  font-size: .6875rem;
  color: var(--text-muted);
  padding-top: var(--s2);
}
.chart__key span { display: inline-flex; align-items: center; gap: 6px; }
.swatch { width: 11px; height: 11px; border-radius: 2px; display: inline-block; flex: none; }
.swatch--solid { background: var(--signal-blue); }
.swatch--hatch { background: var(--amber-500); }
.swatch--hot { background: var(--signal-red); }
.swatch--warm { background: var(--amber-500); }
.swatch--cool { background: var(--signal-blue); }
.swatch--cold { background: var(--stone-400); }

.stagebars { display: grid; gap: var(--s4); }
.stagebar { display: grid; gap: 5px; }
.stagebar__top { display: flex; justify-content: space-between; align-items: baseline; gap: var(--s3); }
.stagebar__name { font-weight: 650; font-size: .875rem; }
.stagebar__count { font-size: .6875rem; color: var(--text-muted); }
.stagebar__track { width: 100%; height: 8px; display: block; }
.stagebar__open { fill: var(--stone-200); }
:root[data-theme='dark'] .stagebar__open { fill: rgba(255, 255, 255, .12); }
.stagebar__weighted { fill: var(--signal-blue); }
.stagebar__foot { display: flex; justify-content: space-between; font-size: .6875rem; }
.stagebar__foot strong { color: var(--accent-text); }

.bandrail { display: grid; gap: var(--s3); }
.bandrail svg { width: 100%; height: 10px; border-radius: 2px; overflow: hidden; }
.rail__seg--hot  { fill: var(--signal-red); }
.rail__seg--warm { fill: var(--amber-500); }
.rail__seg--cool { fill: var(--signal-blue); }
.rail__seg--cold { fill: var(--stone-400); }
.bandrail__key { display: flex; gap: var(--s4); flex-wrap: wrap; font-size: .6875rem; color: var(--text-muted); }
.bandkey { display: inline-flex; align-items: center; gap: 6px; }
.bandkey strong { color: var(--text); }

.season-strip {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: var(--s3);
}
.season-cell { display: grid; justify-items: center; gap: 5px; text-align: center; }
.season-cell__idx { font-size: .6875rem; font-weight: 700; color: var(--text-muted); }
.season-cell__bar { width: 100%; height: 82px; }
.season-cell__fill { fill: var(--signal-blue); opacity: .75; }
.season-cell__fill--warn { fill: var(--amber-600); }
.season-cell__fill--peak { fill: var(--amber-500); }
.season-cell__mo { font-size: .75rem; font-weight: 650; }
.season-cell__season { font-size: .625rem; color: var(--text-faint); line-height: 1.3; }

.meter { display: grid; gap: 4px; min-width: 170px; }
.meter__svg { width: 100%; height: 8px; overflow: visible; }
.meter__track { fill: var(--stone-200); }
:root[data-theme='dark'] .meter__track { fill: rgba(255, 255, 255, .12); }
.meter__fill--ok   { fill: var(--signal-green); }
.meter__fill--warn { fill: var(--amber-500); }
.meter__fill--risk { fill: var(--signal-red); }
.meter__target { fill: var(--text-faint); }
.meter__label { font-size: .6875rem; color: var(--text-muted); }

/* --- Thread -------------------------------------------------------------- */
.thread { display: grid; gap: var(--s3); }
.thread--wide { max-height: none; }
.thread__msg {
  padding: var(--s4);
  background: var(--plate-sunken);
  border: 1px solid var(--keyline);
  border-radius: var(--r-md);
}
.thread__msg--inbound { background: var(--green-050); border-color: var(--green-100); }
:root[data-theme='dark'] .thread__msg--inbound { background: rgba(47, 162, 116, .1); border-color: rgba(47, 162, 116, .24); }
.thread__head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.thread__ref { display: inline-flex; align-items: center; gap: 7px; font-size: .75rem; font-weight: 650; }
.thread__ref:hover { color: var(--accent-text); }
.thread__by { margin-left: auto; font-size: .6875rem; color: var(--text-faint); }
.thread__body { font-size: .875rem; line-height: 1.55; }
.thread__media {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--keyline-strong);
  font-size: .75rem;
}

/* --- Feed and notifications ---------------------------------------------- */
.feed { display: grid; }
.feed li {
  display: grid;
  grid-template-columns: minmax(0, auto) minmax(0, 1fr) auto;
  gap: var(--s3);
  align-items: baseline;
  padding: 9px 0;
  border-bottom: 1px solid var(--keyline);
  font-size: .8125rem;
}
.feed li:last-child { border-bottom: none; }
.feed__who { font-weight: 650; }
.feed__what { color: var(--text-muted); }
.feed__when { font-size: .6875rem; color: var(--text-faint); white-space: nowrap; }

/* `display: flex` would otherwise beat the browser's [hidden] rule. */
.drawer[hidden] { display: none; }
.drawer {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 70;
  width: min(400px, 100vw);
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--plate);
  border-left: 1px solid var(--keyline);
  box-shadow: var(--lift-3);
  animation: drawer-in .28s var(--ease);
}
@keyframes drawer-in { from { transform: translateX(24px); opacity: 0 } to { transform: none; opacity: 1 } }
.drawer__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s3);
  padding: var(--s4) var(--s5);
  border-bottom: 1px solid var(--keyline);
}
.drawer__head h2 { font-size: 1rem; }
.drawer__body { flex: 1; overflow-y: auto; padding: var(--s3) var(--s5) var(--s6); }
.drawer__empty { padding: var(--s8) 0; text-align: center; color: var(--text-muted); font-size: .875rem; }
.notif { display: grid; }
.notif__item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: var(--s3);
  padding: var(--s4) 0;
  border-bottom: 1px solid var(--keyline);
}
.notif__item.is-unread .notif__body strong { color: var(--accent-text); }
.notif__dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 6px; background: var(--stone-300); }
.notif__dot--warning { background: var(--amber-500); }
.notif__dot--success { background: var(--green-500); }
.notif__dot--info { background: var(--signal-blue); }
.notif__body { display: grid; gap: 3px; }
.notif__body strong { font-size: .875rem; }
.notif__body span { font-size: .8125rem; color: var(--text-muted); }
.notif__when { font-size: .6875rem; color: var(--text-faint); }

/* --- Team / integrations ------------------------------------------------- */
.who { display: flex; align-items: center; gap: 10px; }
.who__dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--stone-300);
  flex: none;
}
.who__dot--on { background: var(--signal-green); box-shadow: 0 0 0 3px color-mix(in srgb, var(--signal-green) 24%, transparent); }

.integrations { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: var(--s4); }
.integration { display: flex; flex-direction: column; gap: var(--s3); padding: var(--s5); }
.integration__head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--s3); }
.integration__head h3 { font-size: 1rem; }
.integration__blurb { margin-top: 5px; font-size: .8125rem; color: var(--text-muted); line-height: 1.5; }
.integration__needs {
  display: flex;
  gap: 8px;
  padding: var(--s3);
  background: var(--plate-sunken);
  border-radius: var(--r-sm);
  font-size: .75rem;
  line-height: 1.5;
  color: var(--text-muted);
  flex: 1;
}
.integration__needs .ico { flex: none; margin-top: 2px; }
.integration__foot { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); font-size: .6875rem; }

.splittable__rest td { border-top: 2px solid var(--keyline-strong); }
.notes-body { font-size: .9375rem; line-height: 1.65; max-width: var(--measure); }

/* --- Filters ------------------------------------------------------------- */
.filterbar {
  display: flex;
  gap: var(--s2);
  flex-wrap: wrap;
  align-items: center;
  padding: var(--s3);
  background: var(--plate);
  border: 1px solid var(--keyline);
  border-radius: var(--r-plate);
}
.filterbar__search {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1 1 260px;
  min-width: 200px;
  padding: 0 11px;
  background: var(--plate-sunken);
  border: 1px solid var(--keyline-strong);
  border-radius: var(--r-md);
  color: var(--text-muted);
}
.filterbar__search input {
  flex: 1;
  min-width: 0;
  padding: 9px 0;
  background: none;
  border: none;
  outline: none;
}
.filterbar:focus-within .filterbar__search { border-color: var(--accent); }
.filterbar select {
  padding: 9px 11px;
  min-height: 40px;
  background: var(--plate);
  border: 1px solid var(--keyline-strong);
  border-radius: var(--r-md);
  font-size: .8125rem;
}
.filterbar__toggle {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 12px;
  min-height: 40px;
  background: var(--plate);
  border: 1px solid var(--keyline-strong);
  border-radius: var(--r-md);
  font-size: .8125rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.filterbar__toggle input { accent-color: var(--green-800); width: 16px; height: 16px; }
.filterbar__toggle:has(input:checked) { border-color: var(--accent); color: var(--accent-text); }

/* --- Modal --------------------------------------------------------------- */
body.has-modal { overflow: hidden; }
.modal-scrim {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  padding: var(--s5);
  background: color-mix(in srgb, var(--green-950) 62%, transparent);
  backdrop-filter: blur(3px);
  animation: scrim-in .18s var(--ease-quick);
}
@keyframes scrim-in { from { opacity: 0 } to { opacity: 1 } }
.modal {
  width: min(100%, 540px);
  max-height: min(88vh, 780px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--lift-3);
  animation: modal-in .26s var(--ease);
}
.modal--wide { width: min(100%, 760px); }
@keyframes modal-in { from { transform: translateY(10px) scale(.99); opacity: 0 } to { transform: none; opacity: 1 } }
.modal__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s4);
  padding: var(--s5);
  border-bottom: 1px solid var(--keyline);
}
.modal__head h2 { font-size: 1.0625rem; }
.modal__form { display: flex; flex-direction: column; min-height: 0; }
.modal__body { padding: var(--s5); overflow-y: auto; }
.modal__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s4);
  padding: var(--s4) var(--s5);
  border-top: 1px solid var(--keyline);
  background: var(--plate-sunken);
}
.modal__error { font-size: .8125rem; font-weight: 600; color: var(--signal-red); margin: 0; }
:root[data-theme='dark'] .modal__error { color: #FF9E95; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s4); }

/* --- Toast --------------------------------------------------------------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: var(--s7);
  z-index: 120;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  background: var(--green-900);
  color: #fff;
  border-radius: var(--r-md);
  box-shadow: var(--lift-3);
  font-size: .875rem;
  font-weight: 600;
  transform: translateX(-50%);
  animation: toast-in .3s var(--ease);
}
@keyframes toast-in { from { transform: translate(-50%, 14px); opacity: 0 } to { transform: translateX(-50%); opacity: 1 } }
.toast--error { background: var(--signal-red); }
.toast .ico { color: var(--amber-500); }
.toast--error .ico { color: #fff; }

/* --- Empty, skeleton, failure -------------------------------------------- */
.empty {
  display: grid;
  justify-items: center;
  gap: var(--s2);
  padding: var(--s9) var(--s5);
  text-align: center;
  color: var(--text-muted);
}
.empty .ico { color: var(--keyline-strong); }
.empty__msg { font-size: .9375rem; font-weight: 600; color: var(--text); }
.empty__hint { font-size: .8125rem; max-width: 44ch; }

.skeleton { display: grid; gap: var(--s3); }
.skeleton__row {
  height: 58px;
  border-radius: var(--r-md);
  background: linear-gradient(90deg, var(--plate) 25%, var(--plate-sunken) 50%, var(--plate) 75%);
  background-size: 300% 100%;
  animation: shimmer 1.5s linear infinite;
}
@keyframes shimmer { from { background-position: 150% 0 } to { background-position: -150% 0 } }

.failure {
  display: grid;
  justify-items: center;
  gap: var(--s3);
  padding: var(--s10) var(--s5);
  text-align: center;
}
.failure .ico { color: var(--signal-red); }
.failure p { color: var(--text-muted); max-width: 52ch; }

/* --- Responsive ---------------------------------------------------------- */
@media (max-width: 1240px) {
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid--2-1, .grid--1-1 { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 1024px) {
  .shell-grid { grid-template-columns: minmax(0, 1fr); grid-template-areas: 'topbar' 'content'; }
  .rail {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 80;
    width: 250px;
    transform: translateX(-100%);
    transition: transform .28s var(--ease);
  }
  .rail.is-open { transform: none; box-shadow: var(--lift-3); }
  .topbar__menu { display: grid; }
  .signin { grid-template-columns: minmax(0, 1fr); }
  .signin__side { display: none; }
}

@media (max-width: 720px) {
  .content { padding: var(--s4) var(--s4) var(--s9); gap: var(--s4); }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s3); }
  .hero { flex-direction: column; align-items: flex-start; gap: var(--s5); padding: var(--s5); }
  .hero__figure { justify-items: start; }
  .profile { grid-template-columns: minmax(0, 1fr); gap: var(--s5); padding: var(--s5); }
  .profile__ref { min-width: 0; }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .topbar__who { display: none; }
  .page-head h1 { font-size: 1.4rem; }
  .season-strip { grid-auto-flow: row; grid-auto-columns: auto; }
  .season-cell { grid-template-columns: 46px 1fr auto; align-items: center; text-align: left; }
  .season-cell__bar { height: 20px; }
  .worklist__item { grid-template-columns: auto minmax(0, 1fr); }
  .worklist__meta { grid-column: 2; justify-items: start; grid-auto-flow: column; align-items: center; gap: var(--s3); }
}

/* --- Currency ------------------------------------------------------------ */
/* The code sits beside the amount so a PKR row is never mistaken for a USD one. */
.ccy {
  display: inline-block;
  padding: 2px 6px;
  background: var(--plate-sunken);
  border: 1px solid var(--keyline);
  border-radius: var(--r-sm);
  font-size: .6875rem;
  font-weight: 700;
  letter-spacing: .04em;
  color: var(--text-muted);
}

/* --- Multi-tenant branding ------------------------------------------------ */
/* Each client company sees its own name and logo across the workspace. */
.topbar__tenant {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.topbar__logo, .rail__logo {
  width: 28px;
  height: 28px;
  object-fit: contain;
  border-radius: var(--r-sm);
  background: #fff;
  border: 1px solid var(--keyline);
  flex: none;
}
.rail__logo { margin-bottom: 6px; border-color: rgba(255, 255, 255, .25); }
.topbar__tenant-name {
  font-size: .875rem;
  color: var(--text-muted);
}
.topbar__tenant-name strong { color: var(--text); font-weight: 700; }

.corow { display: flex; align-items: center; gap: 12px; }
.cologo {
  width: 36px;
  height: 36px;
  object-fit: contain;
  border-radius: var(--r-sm);
  background: #fff;
  border: 1px solid var(--keyline);
  flex: none;
}
.cologo--empty {
  display: grid;
  place-items: center;
  color: var(--text-faint);
  background: var(--plate-sunken);
}

.logopick { display: flex; align-items: center; gap: var(--s4); }
.logopick__preview {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  flex: none;
  background: var(--plate-sunken);
  border: 1px dashed var(--keyline-strong);
  border-radius: var(--r-md);
  overflow: hidden;
  font-size: .6875rem;
}
.logopick__preview img { width: 100%; height: 100%; object-fit: contain; background: #fff; }
.logopick input[type=file] { font-size: .8125rem; min-width: 0; }

@media (max-width: 720px) {
  .topbar__tenant-name { display: none; }
}

/* --- Demo countdown ------------------------------------------------------- */
/* A full-width strip above the topbar controls for client companies whose
   demo period has an end date. */
.demoband {
  flex-basis: 100%;
  order: -1;
  display: flex;
  align-items: center;
  gap: 8px;
  margin: calc(var(--s3) * -1) calc(var(--s6) * -1) var(--s3);
  padding: 7px var(--s6);
  background: var(--green-850);
  color: #fff;
  font-size: .75rem;
  font-weight: 600;
}
.demoband .ico { color: var(--amber-300); flex: none; }
.demoband--warn { background: var(--amber-600); color: #fff; }
.demoband--warn .ico { color: #fff; }
.demoband--alert { background: var(--signal-red); }
.demoband--alert .ico { color: #fff; }
.topbar { flex-wrap: wrap; }

.demo-presets { margin-top: 6px; }


/* --- Platform management pieces ------------------------------------------ */
.rail__credit {
  margin-top: 4px;
  font-size: .625rem;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--amber-300);
}
.signin__showcase {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: var(--s2) 0 var(--s3);
  font-size: 1.375rem;
  letter-spacing: -0.02em;
}
.signin__foot {
  margin-top: var(--s7);
  text-align: center;
  font-size: .6875rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.modulegrid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--s2);
}
.modulepick {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 9px 11px;
  border: 1px solid var(--keyline-strong);
  border-radius: var(--r-md);
  cursor: pointer;
  transition: border-color .14s, background-color .14s;
}
.modulepick:has(input:checked) { border-color: var(--accent); background: var(--plate-sunken); }
.modulepick input { margin-top: 2px; accent-color: var(--green-800); }
.modulepick span { display: grid; gap: 1px; min-width: 0; }
.modulepick strong { font-size: .75rem; text-transform: capitalize; }
.modulepick small { font-size: .6875rem; color: var(--text-muted); line-height: 1.35; }

.dangerzone {
  display: grid;
  gap: 6px;
  justify-items: start;
  padding-top: var(--s4);
  border-top: 1px dashed var(--keyline-strong);
}
.dangertext { font-size: .875rem; line-height: 1.6; margin-bottom: var(--s4); }

.reqfacts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--s3) var(--s5);
  margin: 0 0 var(--s5);
}
.reqfacts dt {
  font-size: .625rem;
  font-weight: 650;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text-faint);
}
.reqfacts dd { margin: 2px 0 0; font-size: .875rem; font-weight: 600; }
.reqblock { margin-bottom: var(--s4); }
.reqblock p {
  margin-top: 6px;
  padding: var(--s3);
  background: var(--plate-sunken);
  border-radius: var(--r-sm);
  font-size: .875rem;
  line-height: 1.55;
}
.reqcell { font-size: .8125rem; color: var(--text-muted); }

/* --- Customer satisfaction (Reports) -------------------------------------- */
.satrow {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--s4);
  margin-bottom: var(--s5);
}
.satstat {
  display: grid;
  gap: 5px;
  padding: var(--s4);
  background: var(--plate-sunken);
  border-radius: var(--r-md);
}
.satstat .numeral { font-size: 1.75rem; }
.satstat > span:last-child { font-size: .75rem; color: var(--text-muted); }
.satlist { list-style: none; margin: 0; padding: 0; display: grid; }
.satlist li {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: start;
  gap: var(--s3);
  padding: 10px 0;
  border-bottom: 1px solid var(--keyline);
  font-size: .8125rem;
}
.satlist li:last-child { border-bottom: none; }
.satlist__body { display: grid; gap: 2px; min-width: 0; }
.satlist__body span { color: var(--text-muted); }
.satlist__when { color: var(--text-faint); white-space: nowrap; }

/* --- Platform overview ----------------------------------------------------- */
.expirelist { list-style: none; margin: 0; padding: 0; display: grid; }
.expirelist li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s3);
  padding: 11px 0;
  border-bottom: 1px solid var(--keyline);
}
.expirelist li:last-child { border-bottom: none; }
.expirelist__name { display: grid; gap: 2px; min-width: 0; }

/* --- Company portal (own-domain sign-in) ----------------------------------- */
.portal__brand { display: grid; gap: var(--s4); margin: auto 0; max-width: 420px; }
.portal__logo {
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  background: var(--amber-500);
  color: #fff;
  border-radius: var(--r-lg);
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.6rem;
  font-weight: 700;
  overflow: hidden;
}
.portal__logo img { width: 100%; height: 100%; object-fit: contain; background: #fff; }
.portal__name { font-size: clamp(1.8rem, 3.4vw, 2.6rem); letter-spacing: -0.02em; color: #fff; }
.portal__sub { color: rgba(240, 242, 245, .66); font-size: 1rem; }
.portal__credit { margin-top: auto; text-align: left; }
.signin__error[hidden] { display: none; }

/* --- Documents settings ----------------------------------------------------- */
.themegrid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--s4);
  margin-bottom: var(--s5);
}
.themecard {
  position: relative;
  display: grid;
  gap: 8px;
  padding: var(--s4);
  border: 1.5px solid var(--keyline-strong);
  border-radius: var(--r-lg);
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s;
}
.themecard:hover { border-color: var(--text-muted); }
.themecard.is-active { border-color: var(--amber-500); box-shadow: 0 0 0 3px color-mix(in srgb, var(--amber-500) 18%, transparent); }
.themecard input { position: absolute; opacity: 0; pointer-events: none; }
.themecard strong { font-size: .875rem; }
.themecard__blurb { font-size: .75rem; color: var(--text-muted); line-height: 1.45; }
.themecard__swatch {
  display: grid;
  gap: 4px;
  padding: 10px;
  height: 66px;
  background: var(--plate-sunken);
  border-radius: var(--r-md);
  align-content: start;
}
.themecard__swatch i { display: block; border-radius: 2px; }
.themecard__swatch--modern i:nth-child(1) { height: 5px; background: var(--amber-500); }
.themecard__swatch--modern i:nth-child(2) { height: 10px; width: 55%; background: var(--green-800); }
.themecard__swatch--modern i:nth-child(3) { height: 16px; background: var(--stone-200); }
.themecard__swatch--classic { justify-items: center; }
.themecard__swatch--classic i:nth-child(1) { height: 8px; width: 40%; background: var(--green-800); }
.themecard__swatch--classic i:nth-child(2) { height: 3px; width: 80%; background: var(--green-800); }
.themecard__swatch--classic i:nth-child(3) { height: 16px; width: 80%; background: var(--stone-200); }
.themecard__swatch--minimal i:nth-child(1) { height: 2px; background: var(--green-900); }
.themecard__swatch--minimal i:nth-child(2) { height: 10px; width: 45%; background: var(--stone-300); }
.themecard__swatch--minimal i:nth-child(3) { height: 1.5px; background: var(--stone-300); }

.accentpick { display: flex; align-items: center; gap: 10px; }
.accentpick input[type=color] {
  width: 52px;
  height: 40px;
  padding: 3px;
  border: 1px solid var(--keyline-strong);
  border-radius: var(--r-md);
  background: var(--plate);
  cursor: pointer;
}
.accentpick input[type=text] { width: 110px; }
.togglerow { gap: var(--s6); }
.docactions { margin-top: var(--s2); }

/* --- AI Company Builder ---------------------------------------------------- */
.aiws__pick { min-width: 300px; }
.aiws__pick select { min-width: 280px; }
.aiws__prompt { display: grid; gap: var(--s4); }
.aiws__engine { align-items: end; justify-content: space-between; }

.kb { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.kb__item {
  display: flex;
  align-items: center;
  gap: var(--s3);
  padding: 10px 12px;
  border: 1px solid var(--keyline);
  border-radius: var(--r-md);
  background: var(--stone-050);
}
.kb__kind { flex: none; text-transform: uppercase; }
.kb__body { flex: 1; min-width: 0; display: grid; }
.kb__body strong { font-size: .875rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kb__when { flex: none; color: var(--text-muted); font-size: .75rem; }

.plangrid { display: grid; gap: var(--s4); }
.plancard { padding: var(--s5); display: grid; gap: 10px; }
.plancard__head { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); }
.plancard__prompt { font-size: .9375rem; color: var(--text-muted); font-style: italic; }
.plancard__analysis { font-size: .875rem; color: var(--text-muted); }
.plancard__summary { font-size: .9375rem; }
.plancard__chips { display: flex; flex-wrap: wrap; gap: 6px; }
.plancard__note {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: .8125rem;
  color: var(--text-muted);
  padding: 8px 10px;
  background: var(--stone-050);
  border-radius: var(--r-md);
}
.plancard__note .ico { flex: none; margin-top: 1px; color: var(--amber-600); }
.plancard__acts { display: flex; gap: var(--s2); flex-wrap: wrap; margin-top: 2px; }

.chip {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border: 1px solid var(--keyline-strong);
  border-radius: 100px;
  font-size: .75rem;
  font-weight: 650;
  font-family: 'Archivo', 'Inter', sans-serif;
}
.chip--add { border-color: var(--signal-green); color: var(--signal-green-600); background: var(--signal-green-100); }
.chip--cut { border-color: var(--signal-red); color: var(--signal-red); background: var(--signal-red-100); }

.verlist { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.verlist__item {
  display: flex;
  align-items: center;
  gap: var(--s4);
  padding: 10px 12px;
  border: 1px solid var(--keyline);
  border-radius: var(--r-md);
}
.verlist__no { flex: none; font-size: 1.125rem; color: var(--amber-600); min-width: 44px; }
.verlist__body { flex: 1; min-width: 0; display: grid; gap: 2px; }
.verlist__body strong { font-size: .875rem; }

/* --- Template Library ------------------------------------------------------- */
.tplgrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: var(--s4);
}
.tpl { padding: var(--s5); display: grid; gap: 10px; align-content: start; }
.tpl--off { opacity: .6; }
.tpl__head { display: flex; align-items: center; gap: 10px; }
.tpl__head h3 { font-size: 1.0625rem; flex: 1; }
.tpl__swatch {
  flex: none;
  width: 14px;
  height: 14px;
  border-radius: 4px;
  background: var(--tpl-accent, var(--amber-500));
}
.tpl__desc { font-size: .875rem; line-height: 1.55; color: var(--text-muted); }
.tpl__meta { font-size: .75rem; color: var(--text-muted); }
.tpl__tags { display: flex; flex-wrap: wrap; gap: 5px; }
.tpl__tag {
  padding: 2px 9px;
  border: 1px solid var(--keyline);
  border-radius: 100px;
  font-size: .6875rem;
  font-weight: 600;
  color: var(--text-muted);
}
.tpl__acts { display: flex; gap: var(--s2); flex-wrap: wrap; margin-top: 4px; }

.recommend { display: grid; gap: 8px; margin: var(--s3) 0 0; padding: 0; list-style: none; }
.recommend li { display: grid; grid-template-columns: minmax(0, 1fr) 140px 48px; gap: 10px; align-items: center; font-size: .875rem; }
.recommend__bar { height: 8px; border-radius: 4px; background: var(--stone-100); overflow: hidden; }
.recommend__fill { display: block; height: 100%; width: var(--w, 0%); border-radius: 4px; background: var(--amber-500); transition: width .5s var(--ease); }
.recommend__msg { margin-top: var(--s3); }

/* --- Domain Management ------------------------------------------------------ */
.domrow { display: grid; gap: 3px; justify-items: start; }
.domrow strong { font-size: .9375rem; }

/* --- Demo request reference material ---------------------------------------- */
.refassets { display: grid; gap: 6px; margin: var(--s2) 0 0; padding: 0; list-style: none; }
.refassets__item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border: 1px solid var(--keyline);
  border-radius: var(--r-md);
  font-size: .8125rem;
}
.refassets__item .ico { flex: none; color: var(--amber-600); }
.refassets__link {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.refassets__file {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 0;
  background: none;
  border: none;
  color: var(--text);
  font: inherit;
  font-weight: 600;
  text-align: left;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
.refassets__preview { margin-top: var(--s3); }
.refassets__preview[hidden] { display: none; }
.refassets__preview img {
  max-width: 100%;
  border: 1px solid var(--keyline);
  border-radius: var(--r-md);
}

/* --- AI Studio (company side) ------------------------------------------------ */
.studio__credits {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
}
.studio__credits .numeral { font-size: 1.5rem; color: var(--amber-600); }
.studio__estimate {
  margin-top: var(--s3);
  padding: var(--s4);
  border: 1px dashed var(--keyline-strong);
  border-radius: var(--r-md);
  display: grid;
  gap: 8px;
}
.studio__estimate[hidden] { display: none; }
.estrow {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s5);
  align-items: center;
  font-size: .875rem;
}
.plancard__note--pause { color: var(--signal-red); background: var(--signal-red-100); }
.plancard__note--pause .ico { color: var(--signal-red); }
.studio__support { align-items: center; }
.studio__support .btn { margin-left: auto; flex: none; }
.studio__suggest .ico { color: var(--amber-600); }

/* --- AI Studio settings modal (platform side) -------------------------------- */
.studioset { display: grid; gap: var(--s5); }
.studioset__wallet {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--s5);
  padding: var(--s5);
}
.studioset__balance { display: grid; gap: 2px; }
.studioset__no { font-size: 2rem; color: var(--amber-600); line-height: 1; }
.studioset__grant { display: flex; align-items: end; gap: var(--s2); }
.studioset__grant .field input { width: 130px; }
.studioset__master { padding: var(--s3) 0; }

/* --- WhatsApp Business inbox ------------------------------------------------- */
.wa {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  min-height: 540px;
  overflow: hidden;
  padding: 0;
}
.wa__list { border-right: 1px solid var(--keyline); display: flex; flex-direction: column; min-height: 0; }
.wa__list-head { padding: var(--s4) var(--s4) var(--s3); border-bottom: 1px solid var(--keyline); }
.wa__threads { margin: 0; padding: 0; list-style: none; overflow-y: auto; }
.convo {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s3);
  padding: 12px var(--s4);
  border-bottom: 1px solid var(--keyline);
  cursor: pointer;
  transition: background .15s;
}
.convo:hover { background: var(--stone-050); }
.convo.is-open { background: var(--stone-100); box-shadow: inset 3px 0 0 var(--amber-500); }
:root[data-theme='dark'] .convo:hover { background: rgba(255, 255, 255, .04); }
:root[data-theme='dark'] .convo.is-open { background: rgba(255, 255, 255, .07); }
.convo__who { display: grid; gap: 2px; min-width: 0; }
.convo__who strong { font-size: .875rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.convo__meta { display: grid; justify-items: end; gap: 4px; flex: none; }

/* Tab bar for the unified Communications hub. */
.tabbar {
  display: flex;
  gap: var(--s2);
  padding: 4px;
  background: var(--plate-sunken);
  border: 1px solid var(--keyline);
  border-radius: var(--r-md);
  width: fit-content;
}
.tabbar__tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: none;
  border: none;
  border-radius: calc(var(--r-md) - 3px);
  color: var(--text-muted);
  font-weight: 600;
  font-size: .8125rem;
  cursor: pointer;
  transition: background .16s, color .16s, box-shadow .16s;
}
.tabbar__tab:hover { color: var(--text); }
.tabbar__tab.is-active {
  background: var(--plate);
  color: var(--text);
  box-shadow: 0 1px 3px rgba(11, 13, 16, .12);
}
.tabbar__tab.is-active .ico { color: var(--amber-600); }
.wa__none { padding: var(--s5); }
.wa__pane { display: flex; flex-direction: column; min-height: 0; }
.wa__empty {
  margin: auto;
  display: grid;
  justify-items: center;
  gap: var(--s3);
  color: var(--text-muted);
  padding: var(--s8);
  text-align: center;
}
.wa__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s4);
  padding: var(--s4) var(--s5);
  border-bottom: 1px solid var(--keyline);
}
.wa__name { cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.wa__scroll {
  flex: 1;
  overflow-y: auto;
  padding: var(--s5);
  display: grid;
  gap: 10px;
  align-content: start;
  background: var(--stone-050);
}
.bubble {
  max-width: 72%;
  padding: 10px 13px;
  border-radius: 12px;
  display: grid;
  gap: 4px;
  font-size: .9rem;
  line-height: 1.5;
}
.bubble--in { justify-self: start; background: var(--stone-000); border: 1px solid var(--keyline); border-bottom-left-radius: 4px; }
.bubble--out { justify-self: end; background: #E9F6EE; border: 1px solid #CBE8D6; border-bottom-right-radius: 4px; }
:root[data-theme='dark'] .bubble--out { background: #1E3128; border-color: #2C4A3A; }
.bubble__kind { justify-self: start; }
.bubble__meta { font-size: .6875rem; color: var(--text-muted); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.bubble__error { font-size: .75rem; color: var(--signal-red); }
.wa__composer { display: grid; gap: var(--s2); padding: var(--s4) var(--s5); border-top: 1px solid var(--keyline); }
.wa__composer textarea { resize: vertical; }
.wa__composer-acts { display: flex; gap: var(--s2); justify-content: flex-end; flex-wrap: wrap; }
.wa__optout {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: var(--s4) var(--s5);
  border-top: 1px solid var(--keyline);
  color: var(--signal-red);
  font-weight: 600;
  font-size: .875rem;
}
.wa__foot { font-size: .8125rem; }
.wa__qr { width: 180px; height: 180px; border: 1px solid var(--keyline); border-radius: var(--r-md); margin-top: 6px; }

/* --- The hub: three panes — list · thread · context rail ----------------- */
.wa--hub { grid-template-columns: 320px minmax(0, 1fr) 320px; }

.wa__filters { padding: var(--s3) var(--s3) var(--s2); border-bottom: 1px solid var(--keyline);
  display: grid; gap: var(--s2); }
.wa__search { display: flex; align-items: center; gap: 7px; padding: 7px 10px;
  background: var(--plate-sunken); border: 1px solid var(--keyline); border-radius: var(--r-md); }
.wa__search input { border: none; background: none; width: 100%; outline: none; font: inherit; color: inherit; }
.wa__chips { display: flex; flex-wrap: wrap; gap: 6px; }
.wa__chips select { font-size: .75rem; padding: 4px 6px; border-radius: var(--r-sm);
  border: 1px solid var(--keyline); background: var(--plate); color: inherit; max-width: 130px; }
.fchip { font-size: .75rem; font-weight: 650; padding: 5px 10px; border-radius: 999px;
  border: 1px solid var(--keyline); background: var(--plate); cursor: pointer; }
.fchip.is-on { background: var(--amber-500); border-color: var(--amber-500); color: var(--green-950); }

/* The richer conversation row the hub uses. */
.convo { flex-direction: column; align-items: stretch; gap: 3px; }
.convo__top { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.convo__top strong { font-size: .875rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.convo__preview { font-size: .8125rem; color: var(--text-muted); overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; }
.convo__row2 { display: flex; align-items: center; gap: 6px; }
.convo__chips { display: flex; gap: 4px; flex-wrap: wrap; flex: 1 1 auto; min-width: 0; overflow: hidden; }
.lbl { font-size: .625rem; font-weight: 700; padding: 2px 6px; border-radius: 999px;
  background: var(--stone-100); color: var(--text-muted); white-space: nowrap; }
:root[data-theme='dark'] .lbl { background: rgba(255,255,255,.08); }
.convo__unread { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px;
  background: var(--signal-red); color: #fff; font-size: .6875rem; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center; }

/* The context rail. */
.wa__rail { border-left: 1px solid var(--keyline); overflow-y: auto; padding: var(--s4);
  display: grid; gap: var(--s4); align-content: start; min-height: 0; }
.rail__id { display: grid; gap: 2px; }
.rail__controls { display: grid; gap: var(--s3); }
.rail__ctl { display: grid; gap: 4px; font-size: .75rem; font-weight: 650; color: var(--text-muted); }
.rail__ctl select { font: inherit; font-weight: 500; color: var(--text); padding: 6px 8px;
  border: 1px solid var(--keyline); border-radius: var(--r-sm); background: var(--plate); }
.rail__section { display: grid; gap: 6px; }
.rail__acts { display: flex; flex-wrap: wrap; gap: 6px; }
.lbl-picks { display: flex; flex-wrap: wrap; gap: 6px; }
.lbl-pick { font-size: .6875rem; font-weight: 650; padding: 4px 9px; border-radius: 999px;
  border: 1px dashed var(--keyline); background: none; cursor: pointer; color: var(--text-muted); }
.lbl-pick.is-on { background: var(--amber-500); border-style: solid; border-color: var(--amber-500);
  color: var(--green-950); }
.rail__records, .rail__links, .rail__notes, .tl { list-style: none; margin: 0; padding: 0;
  display: grid; gap: 6px; }
.rail__records li, .rail__links li { font-size: .8125rem; }
.note p { margin: 0 0 2px; font-size: .8125rem; }
.tl__item { display: grid; gap: 1px; padding-left: 10px; border-left: 2px solid var(--keyline); }
.tl__kind { font-size: .625rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em;
  color: var(--amber-600); }
.tl__detail { font-size: .8125rem; }

@media (max-width: 1100px) {
  /* Fold the rail away; it returns on wider screens. The thread stays usable. */
  .wa--hub { grid-template-columns: 300px minmax(0, 1fr); }
  .wa__rail { display: none; }
}
@media (max-width: 900px) {
  .wa { grid-template-columns: minmax(0, 1fr); }
  .wa__list { max-height: 320px; border-right: none; border-bottom: 1px solid var(--keyline); }
  /* On a phone the hub is list → thread: opening a conversation hides the list
     and shows the thread full width, with the rail reachable by scrolling. */
  .wa--hub { grid-template-columns: minmax(0, 1fr); }
  .wa-skin--open .wa__list { display: none; }
  .wa-skin--open .wa__rail { display: grid; border-left: none; border-top: 1px solid var(--keyline); }
}

/* --- Insights ------------------------------------------------------------------ */
.wa-insights { display: grid; gap: var(--s5); }
.wa-insights__head { display: flex; align-items: center; gap: var(--s3); }
.wa-kpis {
  display: grid; gap: var(--s3);
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}
.wa-kpi {
  display: grid; gap: 2px; padding: var(--s4);
  background: var(--plate); border: 1px solid var(--keyline); border-radius: var(--r-md);
}
.wa-kpi__value { font-size: 1.6rem; font-weight: 700; line-height: 1.1; }
.wa-kpi__label { font-size: .8125rem; color: var(--text-muted); }
.wa-kpi__sub { font-size: .75rem; }
.wa-insights__grid {
  display: grid; gap: var(--s4);
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}
.wa-card {
  padding: var(--s4); background: var(--plate);
  border: 1px solid var(--keyline); border-radius: var(--r-md);
}
.wa-card h4 { margin: 0 0 var(--s3); }
.wa-vol { display: flex; gap: var(--s4); flex-wrap: wrap; margin-bottom: var(--s3); }
.wa-vol__stat { font-size: .8125rem; color: var(--text-muted); }
.wa-vol__stat strong { font-size: 1.15rem; color: var(--text); margin-right: 3px; }
.wa-spark {
  display: flex; align-items: flex-end; gap: 3px; height: 72px;
  padding-top: var(--s2); border-top: 1px solid var(--keyline);
}
.wa-spark__day { display: flex; align-items: flex-end; gap: 1px; flex: 1 1 0; height: 100%; }
.wa-spark__bar { flex: 1 1 0; border-radius: 2px 2px 0 0; min-height: 1px; height: var(--h, 0%); }
.wa-spark__bar--in { background: var(--wa-teal); }
.wa-spark__bar--out { background: var(--amber-500); }
.wa-bars { display: grid; gap: 7px; list-style: none; margin: 0; padding: 0; }
.wa-bar { display: grid; grid-template-columns: minmax(70px, 34%) 1fr auto; align-items: center; gap: var(--s3); }
.wa-bar__label { font-size: .8125rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wa-bar__track { height: 8px; background: var(--plate-sunken); border-radius: 999px; overflow: hidden; }
.wa-bar__fill { display: block; height: 100%; width: var(--w, 0%); background: var(--amber-500); border-radius: 999px; }
.wa-bar__n { font-size: .8125rem; font-variant-numeric: tabular-nums; color: var(--text-muted); }

/* --- Connect wizard ------------------------------------------------------------ */
.wizard__lead { margin: 0 0 var(--s4); color: var(--text-muted); }
.wizard__methods { display: grid; gap: var(--s3); }
.wmethod {
  display: flex; gap: var(--s3); align-items: flex-start; padding: var(--s4);
  border: 1px solid var(--keyline); border-radius: var(--r-md); cursor: pointer;
  transition: border-color var(--ease-quick), background var(--ease-quick);
}
.wmethod:hover { border-color: var(--keyline-strong); }
.wmethod input { margin-top: 3px; accent-color: var(--amber-500); }
.wmethod:has(input:checked) { border-color: var(--amber-500); background: var(--amber-100); }
.wmethod__body { display: grid; gap: 3px; }
.wmethod__body strong { display: flex; align-items: center; gap: var(--s2); flex-wrap: wrap; }
.wmethod__desc { font-size: .8125rem; color: var(--text-muted); }
.wmethod--warn:has(input:checked) { border-color: var(--signal-red); background: var(--signal-red-100); }
.wizard__done { display: grid; gap: var(--s3); justify-items: center; text-align: center; padding: var(--s3) 0; }
.wizard__done .ico--lg { color: var(--signal-green); }

/* --- Screen protection --------------------------------------------------------- */
.watermark {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  flex-wrap: wrap;
  gap: 90px 70px;
  align-content: space-between;
  padding: 40px;
  overflow: hidden;
  pointer-events: none;
  user-select: none;
}
.watermark span {
  font-size: .8125rem;
  font-weight: 650;
  color: color-mix(in srgb, var(--text) 7%, transparent);
  transform: rotate(-24deg);
  white-space: nowrap;
}

/* --- Security controls ---------------------------------------------------------- */
.secform { display: grid; gap: var(--s4); justify-items: start; }
.secform .field--check { align-items: flex-start; }

/* ==========================================================================
   Premium pass — the polish layer.
   Loaded last on purpose: it refines the primitives above (depth, motion,
   accent discipline) without touching a single view template.
   ========================================================================== */

/* --- Ground & content ------------------------------------------------------ */
.workspace .content {
  background:
    radial-gradient(90% 340px at 50% -80px,
      color-mix(in srgb, var(--amber-500) 5%, transparent), transparent 70%);
}

/* Views arrive, they don't pop: each top-level block fades up with a small
   cascade. Cheap, GPU-friendly, and killed entirely under reduced motion. */
.content > * { animation: view-in .45s var(--ease) both; }
.content > :nth-child(2) { animation-delay: .05s; }
.content > :nth-child(3) { animation-delay: .1s; }
.content > :nth-child(4) { animation-delay: .15s; }
.content > :nth-child(5) { animation-delay: .2s; }
.content > :nth-child(n+6) { animation-delay: .24s; }
@keyframes view-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

/* --- Rail ------------------------------------------------------------------ */
.rail {
  background:
    radial-gradient(120% 200px at 20% -60px, rgba(242, 107, 29, .12), transparent 65%),
    linear-gradient(178deg, #14171D 0%, var(--green-900) 42%, #0B0D11 100%);
  border-right: 1px solid rgba(255, 255, 255, .06);
}
.nav-item { padding: 10px 12px; }
.nav-item .ico { opacity: .75; transition: opacity .16s, color .16s; }
.nav-item:hover .ico { opacity: 1; }
.nav-item.is-current {
  background: linear-gradient(90deg, rgba(242, 107, 29, .16), rgba(255, 255, 255, .06));
}
.nav-item.is-current .ico { opacity: 1; color: var(--amber-500); }
.rail__foot { border-top-color: rgba(255, 255, 255, .08); }
.rail__org {
  padding: 10px 12px;
  margin: 0 -4px;
  background: rgba(255, 255, 255, .04);
  border: 1px solid rgba(255, 255, 255, .07);
  border-radius: var(--r-md);
}

/* --- Topbar ------------------------------------------------------------------ */
.topbar { box-shadow: 0 1px 0 var(--keyline), 0 8px 24px rgba(11, 13, 16, .04); }
:root[data-theme='dark'] .topbar { box-shadow: 0 1px 0 var(--keyline), 0 8px 24px rgba(0, 0, 0, .3); }
.avatar {
  background: linear-gradient(135deg, var(--amber-500), var(--amber-600));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .25);
}
.topbar__tenant-name strong { letter-spacing: -0.01em; }

/* --- Page heads ----------------------------------------------------------------- */
.page-head { padding-top: var(--s2); }
.page-head h1 {
  font-size: 1.9rem;
  display: flex;
  align-items: center;
  gap: 12px;
}
.page-head h1::before {
  content: '';
  width: 6px;
  height: 26px;
  flex: none;
  border-radius: 3px;
  background: linear-gradient(180deg, var(--amber-500), var(--amber-600));
}

/* --- Metrics ---------------------------------------------------------------------- */
.metric {
  overflow: hidden;
  padding: var(--s5) var(--s5) var(--s4);
  transition: transform .22s var(--ease), box-shadow .22s var(--ease);
}
.metric::before {
  content: '';
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: linear-gradient(180deg, var(--amber-500), transparent 85%);
  opacity: .85;
}
.metric:hover { transform: translateY(-2px); box-shadow: var(--lift-2); }
.metric__value { font-size: 2.375rem; }   /* tracking comes from .numeral */
.metric--alert::before { background: linear-gradient(180deg, var(--signal-red), transparent 85%); }

/* --- Panels ------------------------------------------------------------------------- */
.panel__head {
  background: linear-gradient(180deg,
    color-mix(in srgb, var(--plate-sunken) 55%, var(--plate)), var(--plate));
}
.panel__title {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 1.03rem;
}
.panel__title::before {
  content: '';
  width: 4px;
  height: 15px;
  flex: none;
  border-radius: 2px;
  background: var(--amber-500);
  opacity: .9;
}

/* --- Boards ---------------------------------------------------------------------------- */
.board--data thead th {
  background: color-mix(in srgb, var(--plate-sunken) 80%, var(--plate));
  backdrop-filter: blur(4px);
}
.board--data tbody tr { transition: background-color .14s var(--ease-quick); }
.board--data tbody tr:hover { background: color-mix(in srgb, var(--plate-sunken) 60%, var(--plate)); }
.board--data tbody tr[data-go]:hover {
  background: color-mix(in srgb, var(--amber-500) 6%, var(--plate));
  box-shadow: inset 3px 0 0 var(--amber-500);
}

/* --- Hero -------------------------------------------------------------------------------- */
.hero {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(90% 160% at 88% -20%, rgba(242, 107, 29, .22), transparent 58%),
    linear-gradient(112deg, #1D222B, #12151A);
}
.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, .035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .035) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(80% 90% at 75% 20%, #000 25%, transparent 80%);
  pointer-events: none;
}
.hero > * { position: relative; }

/* --- Skeleton shimmer ----------------------------------------------------------------------- */
.skeleton { display: grid; gap: var(--s3); }
.skeleton__row {
  height: 52px;
  border-radius: var(--r-md);
  background: linear-gradient(100deg,
    var(--plate-sunken) 38%,
    color-mix(in srgb, var(--plate) 70%, #fff) 50%,
    var(--plate-sunken) 62%);
  background-size: 220% 100%;
  animation: shimmer 1.3s linear infinite;
}
:root[data-theme='dark'] .skeleton__row {
  background: linear-gradient(100deg,
    var(--plate-sunken) 38%, #1B1F27 50%, var(--plate-sunken) 62%);
  background-size: 220% 100%;
}
@keyframes shimmer {
  from { background-position: 120% 0; }
  to { background-position: -100% 0; }
}

/* --- Overlays -------------------------------------------------------------------------------- */
.modal-scrim {
  background: rgba(8, 10, 13, .5);
  backdrop-filter: blur(4px);
  animation: scrim-in .18s var(--ease-quick) both;
}
.modal { animation: modal-in .26s var(--ease) both; box-shadow: var(--lift-3); }
@keyframes scrim-in { from { opacity: 0; } }
@keyframes modal-in {
  from { opacity: 0; transform: translateY(14px) scale(.985); }
  to { opacity: 1; transform: none; }
}
.toast { animation: toast-in .3s var(--ease) both; box-shadow: var(--lift-3); }
@keyframes toast-in {
  from { opacity: 0; transform: translateY(14px) scale(.97); }
  to { opacity: 1; transform: none; }
}
.drawer { box-shadow: var(--lift-3); animation: drawer-in .28s var(--ease) both; }
@keyframes drawer-in {
  from { opacity: 0; transform: translateX(18px); }
  to { opacity: 1; transform: none; }
}

/* --- Sign-in ------------------------------------------------------------------------------------ */
.signin__side {
  background:
    radial-gradient(110% 80% at 82% 8%, rgba(242, 107, 29, .2), transparent 58%),
    radial-gradient(70% 60% at 0% 100%, rgba(242, 107, 29, .08), transparent 60%),
    linear-gradient(170deg, #16181D, #0B0D10);
  position: relative;
  overflow: hidden;
}
.signin__side::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, .035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .035) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(90% 70% at 30% 20%, #000 20%, transparent 75%);
  pointer-events: none;
}
.signin__side > * { position: relative; }
.signin__form-wrap { animation: view-in .5s var(--ease) both; }
.signin__form-wrap h1 { font-size: 2.25rem; letter-spacing: -0.03em; }

/* --- Scrollbars (WebKit + Firefox) ----------------------------------------------------------------- */
* { scrollbar-width: thin; scrollbar-color: var(--keyline-strong) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb {
  background: var(--keyline-strong);
  border-radius: 6px;
  border: 3px solid transparent;
  background-clip: padding-box;
}
*::-webkit-scrollbar-thumb:hover { background-color: var(--stone-400); border: 3px solid transparent; background-clip: padding-box; }
*::-webkit-scrollbar-track { background: transparent; }

/* --- Motion discipline ------------------------------------------------------------------------------ */
@media (prefers-reduced-motion: reduce) {
  .content > *, .signin__form-wrap, .modal, .modal-scrim, .toast, .drawer { animation: none; }
  .skeleton__row { animation: none; }
  .metric, .metric:hover { transform: none; }
}

/* --- Command palette ---------------------------------------------------------- */
/* Used a hundred times a day: opens instantly, animates almost nothing. */
.palette {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 12vh var(--s4) var(--s4);
  background: rgba(8, 10, 13, .45);
  backdrop-filter: blur(3px);
}
.palette[hidden] { display: none; }
.palette__box {
  width: min(100%, 620px);
  max-height: 60vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--lift-3);
  animation: palette-in .12s var(--ease-quick) both;
}
@keyframes palette-in { from { opacity: 0; transform: translateY(-6px); } }
.palette__field {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: var(--s4) var(--s5);
  border-bottom: 1px solid var(--keyline);
}
.palette__field .ico { color: var(--text-muted); flex: none; }
.palette__field input {
  flex: 1;
  border: none;
  background: none;
  font-size: 1rem;
  color: var(--text);
  outline: none;
}
.palette__list {
  margin: 0;
  padding: var(--s2);
  list-style: none;
  overflow-y: auto;
}
.palette__group {
  padding: 10px var(--s3) 4px;
  color: var(--text-faint);
}
.palette__item {
  display: flex;
  align-items: center;
  gap: var(--s3);
  padding: 9px var(--s3);
  border-radius: var(--r-md);
  cursor: pointer;
}
.palette__item:hover { background: var(--plate-sunken); }
.palette__item.is-active {
  background: color-mix(in srgb, var(--amber-500) 9%, var(--plate));
  box-shadow: inset 3px 0 0 var(--amber-500);
}
.palette__ref {
  flex: none;
  display: inline-grid;
  place-items: center;
  min-width: 56px;
  padding: 3px 8px;
  background: var(--green-850);
  color: var(--amber-300);
  border-radius: var(--r-sm);
  font-size: .8125rem;
}
.palette__body { flex: 1; min-width: 0; display: grid; }
.palette__body strong {
  font-size: .875rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.palette__none { padding: var(--s5); color: var(--text-muted); text-align: center; }
.palette__foot {
  display: flex;
  gap: var(--s5);
  padding: 9px var(--s5);
  border-top: 1px solid var(--keyline);
  color: var(--text-faint);
  font-size: .6875rem;
}
.palette__kbd, .palette kbd, .searchbtn__kbd {
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  padding: 2px 6px;
  background: var(--plate-sunken);
  border: 1px solid var(--keyline-strong);
  border-bottom-width: 2px;
  border-radius: 5px;
  font-family: 'Archivo', 'Inter', sans-serif;
  font-size: .6875rem;
  font-weight: 650;
  color: var(--text-muted);
}
.palette__kbd { margin-left: auto; }

/* The topbar door to the palette. */
.searchbtn {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 36px;
  padding: 6px 10px 6px 12px;
  background: var(--plate-sunken);
  border: 1px solid var(--keyline);
  border-radius: var(--r-md);
  color: var(--text-muted);
  font-size: .8125rem;
  font-weight: 550;
  cursor: pointer;
  transition: border-color .16s, color .16s, box-shadow .16s;
}
.searchbtn:hover { border-color: var(--keyline-strong); color: var(--text); box-shadow: var(--lift-1); }
.searchbtn__hint { min-width: 90px; text-align: left; }
@media (max-width: 900px) {
  .searchbtn__hint, .searchbtn__kbd { display: none; }
}

/* --- Press feedback (tactile confirmation, never below .95) -------------------- */
.btn:active { transform: scale(.975); }
.icon-btn:active, .palette__item:active, .convo:active, .tabbar__tab:active { transform: scale(.97); }
@media (prefers-reduced-motion: reduce) {
  .palette__box { animation: none; }
  .btn:active, .icon-btn:active, .palette__item:active, .convo:active, .tabbar__tab:active { transform: none; }
}

/* --- Bulk selection & import/export ------------------------------------------- */
.pick { display: inline-grid; place-items: center; cursor: pointer; padding: 4px; }
.pick input { width: 16px; height: 16px; accent-color: var(--amber-600); cursor: pointer; }

.bulkbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s4);
  padding: 10px var(--s5);
  background: color-mix(in srgb, var(--amber-500) 8%, var(--plate));
  border: 1px solid color-mix(in srgb, var(--amber-500) 35%, var(--keyline));
  border-radius: var(--r-md);
  animation: view-in .18s var(--ease) both;
}
.bulkbar.is-empty { display: none; }
.bulkbar__count { font-size: .875rem; }
.bulkbar__count strong { color: var(--amber-600); }
.bulkbar__acts { display: flex; gap: var(--s2); }

/* --- Transactions / reconciliation -------------------------------------- */
/* The cash book stacks a filter bar, a bulk-action bar and the register in one
   panel body, so give the leading controls breathing room above the table. */
.panel__body > .filterbar { margin-bottom: var(--s3); }
.panel__body > .bulkbar { margin-bottom: var(--s3); }

.acctgrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: var(--s3);
}
.acctcard { display: grid; gap: 4px; padding: var(--s4); }
.acctcard__name { font-size: .688rem; }
.acctcard__net { font-size: 1.5rem; line-height: 1.1; }
.acctcard__note { font-size: .75rem; color: var(--text-muted); }
.acctcard__note .warn, .warn { color: var(--amber-600); font-weight: 600; }

.recon {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: .75rem;
  font-weight: 600;
  white-space: nowrap;
}
.recon--on { color: var(--signal-green); }
:root[data-theme='dark'] .recon--on { color: #4FC98B; }
.recon--off { color: var(--text-muted); font-weight: 500; }

/* A denser metric row for the dashboard's cash-position widget. */
.metrics--tight { margin: 0; }

/* Read-only payment-link box in the pay-by-link result modal. */
.linkbox { margin: var(--s2) 0; }
.linkbox__url {
  width: 100%;
  padding: 10px 12px;
  font-family: var(--font-mono, monospace);
  font-size: .8125rem;
  background: var(--plate-sunken);
  border: 1px solid var(--keyline-strong);
  border-radius: var(--r-md);
  color: var(--text);
}

/* --- Guidebook ----------------------------------------------------------- */
.panel--flush .panel__head { display: none; }
.panel--flush .panel__body { padding: 0; }

.gbtabs { display: flex; gap: 4px; margin-bottom: var(--s4); flex-wrap: wrap; }
.gbtab {
  padding: 9px 16px;
  border: 1px solid var(--keyline);
  background: var(--plate);
  border-radius: var(--r-md);
  font-weight: 600;
  font-size: .8125rem;
  cursor: pointer;
  color: var(--text-muted);
}
.gbtab.is-active { border-color: var(--accent); color: var(--accent-text); background: color-mix(in srgb, var(--accent) 8%, var(--plate)); }

.gb { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: var(--s5); align-items: start; }
.gb__toc { position: sticky; top: var(--s4); display: grid; gap: var(--s3); }
.gb__search {
  display: flex; align-items: center; gap: 8px; padding: 0 11px;
  background: var(--plate-sunken); border: 1px solid var(--keyline-strong); border-radius: var(--r-md);
  color: var(--text-muted);
}
.gb__search input { flex: 1; min-width: 0; padding: 9px 0; background: none; border: none; outline: none; }
.gbtoc { display: grid; gap: 2px; max-height: 70vh; overflow-y: auto; }
.gbtoc__item {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 11px; border: 0; background: none; border-radius: var(--r-md);
  text-align: left; cursor: pointer; color: var(--text); font-size: .8125rem; width: 100%;
}
.gbtoc__item .ico { color: var(--text-muted); flex: none; }
.gbtoc__item:hover { background: var(--plate-sunken); }
.gbtoc__item.is-active { background: color-mix(in srgb, var(--accent) 12%, var(--plate)); color: var(--accent-text); font-weight: 600; }
.gbtoc__item.is-active .ico { color: var(--accent); }

.gb__main { min-width: 0; }
.gb__crumb { font-size: .8125rem; color: var(--text-muted); margin-bottom: var(--s3); }
.gbdoc__title { display: flex; align-items: center; gap: 10px; margin: 0 0 var(--s2); }
.gbdoc__title .ico { color: var(--accent); }
.gbdoc__intro { color: var(--text-muted); margin: 0 0 var(--s4); font-size: .95rem; }
.gbsec { border: 1px solid var(--keyline); border-radius: var(--r-md); margin-bottom: var(--s2); overflow: hidden; }
.gbsec > summary {
  padding: 11px var(--s4); cursor: pointer; font-weight: 600; font-size: .875rem;
  list-style: none; display: flex; align-items: center; justify-content: space-between;
}
.gbsec > summary::after { content: '+'; color: var(--text-muted); font-size: 1.1rem; }
.gbsec[open] > summary::after { content: '−'; }
.gbsec > summary::-webkit-details-marker { display: none; }
.gbsec__body { padding: 0 var(--s4) var(--s3); }
.gbsec__body p { margin: 0 0 var(--s2); line-height: 1.6; }
.gbsec__body ul, .gbsec__body ol { margin: 0 0 var(--s2); padding-left: 1.3em; display: grid; gap: 5px; }
.gbsec__body li { line-height: 1.55; }
.gb__pager { display: flex; justify-content: space-between; margin-top: var(--s4); }

.gbcards { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: var(--s4); }
.gbcard { display: grid; gap: var(--s2); padding: var(--s5); }
.gbcard__ico { color: var(--accent); }
.gbcard p { color: var(--text-muted); font-size: .875rem; margin: 0; }
.gbcard .btn { justify-self: start; margin-top: var(--s2); }
.gb__meta { margin-top: var(--s4); color: var(--text-muted); font-size: .8125rem; }

.gbver { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s2); }
.gbver__row { display: flex; align-items: center; justify-content: space-between; gap: var(--s3);
  padding: var(--s3) var(--s4); border: 1px solid var(--keyline); border-radius: var(--r-md); flex-wrap: wrap; }
.gbver__acts { display: flex; gap: var(--s2); }
.gbdiff { margin-top: var(--s4); }
.gbdiff.plate, .gbdiff .plate { padding: var(--s4); }
.gbdiff h4 { margin: 0 0 var(--s2); }
.gbdiff p { margin: 4px 0; }

.gbask { display: grid; gap: var(--s3); }
.gbask__row { display: flex; gap: var(--s2); }
.gbask__row .gbask__q { flex: 1; }
.gbask__q { width: 100%; padding: 11px 13px; border: 1px solid var(--keyline-strong);
  border-radius: var(--r-md); background: var(--plate-sunken); color: var(--text); font-size: .95rem; }
.gbask__answer { padding: var(--s4); background: var(--plate-sunken); border-radius: var(--r-md); line-height: 1.6; }
.gbask__answer p { margin: 0 0 var(--s2); }
.gbask__links { display: flex; flex-wrap: wrap; gap: var(--s2); margin-top: var(--s2); }
.gbask__by { font-size: .75rem; }

@media (max-width: 860px) {
  .gb { grid-template-columns: 1fr; }
  .gb__toc { position: static; }
  .gbtoc { max-height: none; }
}

.topbar__install { white-space: nowrap; }
@media (max-width: 640px) { .topbar__install { display: none; } }

.importer { display: grid; gap: var(--s4); }
.importer__steps { margin: 0; padding-left: 1.2em; display: grid; gap: 6px; font-size: .875rem; color: var(--text-muted); }
.importer__steps strong { color: var(--text); }
.importer__pick { position: relative; overflow: hidden; }
.importer__result { display: grid; gap: var(--s3); padding-top: var(--s3); border-top: 1px solid var(--keyline); }
.importer__found strong, .importer__done { color: var(--text); }
.importer__done { display: flex; align-items: center; gap: 8px; font-weight: 600; color: var(--signal-green-600); }
.importer__done .ico { color: var(--signal-green-600); }
.importer__errs { margin: 0; padding-left: 1.1em; font-size: .8125rem; color: var(--signal-red); display: grid; gap: 3px; }

/* ==========================================================================
   Mobile app shell — bottom tab bar, compact top bar, slim demo strip.
   Everything here is scoped to phones so the desktop layout is untouched.
   ========================================================================== */

/* Bottom navigation: hidden on desktop, an app-style tab bar on phones. */
.botnav { display: none; }

@media (max-width: 720px) {
  .botnav {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 60;
    display: flex;
    justify-content: space-around;
    gap: 2px;
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
    background: color-mix(in srgb, var(--plate) 96%, transparent);
    backdrop-filter: blur(12px);
    border-top: 1px solid var(--keyline);
    box-shadow: 0 -6px 20px rgba(11, 13, 16, .08);
  }
  :root[data-theme='dark'] .botnav { box-shadow: 0 -6px 20px rgba(0, 0, 0, .4); }
  .botnav__tab {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 7px 2px 5px;
    background: none;
    border: 0;
    border-radius: var(--r-md);
    color: var(--text-muted);
    font-size: .625rem;
    font-weight: 600;
    letter-spacing: .01em;
    cursor: pointer;
    text-decoration: none;
    min-width: 0;
    transition: color .16s;
  }
  .botnav__tab .ico { width: 22px; height: 22px; }
  .botnav__tab span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .botnav__tab.is-active { color: var(--amber-600); }
  :root[data-theme='dark'] .botnav__tab.is-active { color: var(--amber-300); }
  .botnav__tab.is-active .ico { color: var(--amber-600); }
  :root[data-theme='dark'] .botnav__tab.is-active .ico { color: var(--amber-300); }
  .botnav__tab.is-active::before {
    content: '';
    position: absolute;
    top: 0;
    width: 26px; height: 3px;
    border-radius: 0 0 3px 3px;
    background: var(--amber-500);
  }
  .botnav__tab { position: relative; }

  /* Leave room so content never hides behind the tab bar. */
  .content { padding-bottom: calc(72px + env(safe-area-inset-bottom)) !important; }

  /* --- Compact top bar --------------------------------------------------- */
  .topbar { gap: var(--s2); padding: 8px var(--s4); min-height: 54px; flex-wrap: wrap; }
  .topbar__menu { order: -2; }
  .topbar__tenant { order: -1; gap: 8px; min-width: 0; }
  .topbar__logo { width: 30px; height: 30px; }
  /* One tidy row of actions; the palette collapses to an icon, the profile
     name is already hidden on phones. */
  .searchbtn { padding: 8px; min-width: 40px; justify-content: center; }
  .topbar__me { padding-left: var(--s2); margin-left: 0; gap: 6px; }
  .topbar__me .avatar { width: 32px; height: 32px; }

  /* --- Slim demo strip: a single clipped line under the controls -------- */
  .demoband {
    order: 3;
    margin: 8px calc(var(--s4) * -1) -8px;
    padding: 6px var(--s4);
    font-size: .6875rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
  }
  .demoband .ico { display: none; }

  /* --- Denser metric plates --------------------------------------------- */
  .metric { padding: var(--s3) var(--s4); }
  .metric__value { font-size: 1.5rem; }
  .metric__label { font-size: .625rem; }
  .metric__note { font-size: .625rem; }

  /* A tick box is 16px of ink. A fingertip is not, so the label around it
     grows to a real target while the box itself stays the same size. */
  .pick { padding: 13px; }
  .filterbar__toggle, .switch { min-height: 44px; }

  /* --- The page heading, on a screen that has none to spare -------------- */
  /* At 390px the heading block was 216px tall and the first row of real
     content started 307px down — most of the screen spent on a title and a
     sentence. Everything below buys that space back. */
  .page-head { gap: var(--s3); margin-bottom: var(--s3); }
  .page-head h1 { font-size: 1.375rem; }
  /* The subtitle explains the screen; it does not need three lines to do it.
     The full sentence stays in the DOM for anyone reading with assistive
     technology. */
  .page-head__sub {
    margin-top: 3px;
    font-size: .8125rem;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
  }
  /* The thing you came to do goes first and spans the width — a full-width
     target beats a small button orphaned on its own row, which is what
     wrapping produced. */
  .page-head__acts { flex-wrap: wrap; width: 100%; gap: var(--s2); }
  .page-head__acts .btn--primary {
    order: -1;
    flex: 1 0 100%;
    justify-content: center;
  }
  /* Secondaries share a row. A lone one keeps its own size — stretching
     "Refresh" across the screen would give the least important action on the
     page the most weight. */
  .page-head__acts .btn:not(.btn--primary):not(:only-child) {
    flex: 1 1 auto;
    justify-content: center;
  }
}

/* Very small phones: metrics fall back to a single column. */
@media (max-width: 380px) {
  .metrics { grid-template-columns: minmax(0, 1fr); }
  .botnav__tab span { font-size: .5625rem; }
}

/* --- Sign-in: mobile branding ------------------------------------------- */
/* On desktop the left showcase panel carries the brand; it is hidden on
   phones, so show a compact brand header above the form there instead. */
.signin__brand { display: none; }
@media (max-width: 1024px) {
  .signin__brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    margin-bottom: var(--s6);
    text-decoration: none;
    color: var(--text);
  }
  .signin__brand-glyph {
    display: grid;
    place-items: center;
    width: 46px; height: 46px;
    border-radius: var(--r-md);
    background: linear-gradient(135deg, var(--amber-500), var(--amber-600));
    box-shadow: 0 6px 18px -6px rgba(242, 107, 29, .6);
  }
  .signin__brand-glyph .ico { color: #fff; }
  .signin__brand-text { display: grid; line-height: 1.15; }
  .signin__brand-text strong { font-size: 1.05rem; letter-spacing: .01em; }
  .signin__brand-text span { font-size: .75rem; color: var(--text-muted); }
  .signin__main { padding: var(--s6) var(--s5); align-content: center; }
  .signin__form-wrap h1 { font-size: 1.7rem; }
  .signin__form { margin-top: var(--s5); }
}

/* ==========================================================================
   Enterprise group architecture — company switcher, licence meter, group
   dashboard. All data-driven widths are set through the CSSOM (CSP-safe).
   ========================================================================== */

/* --- Company switcher ----------------------------------------------------- */
.coswitch { position: relative; }
.coswitch__btn {
  display: flex; align-items: center; gap: 9px;
  padding: 6px 10px 6px 6px;
  background: none; border: 1px solid transparent; border-radius: var(--r-md);
  color: inherit; font: inherit; cursor: pointer; max-width: 340px;
}
.coswitch__btn:hover { border-color: var(--keyline-strong); background: var(--plate-sunken); }
.coswitch__caret { width: 15px; height: 15px; flex: none; opacity: .6; }
.coswitch__flag {
  flex: none; padding: 2px 7px; border-radius: 100px;
  background: var(--amber-500); color: #fff;
  font-size: .625rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
}
.coswitch__menu {
  position: absolute; top: calc(100% + 6px); left: 0; z-index: 70;
  min-width: 268px; max-height: 60vh; overflow-y: auto;
  display: grid; gap: 2px; padding: 6px;
  background: var(--plate); border: 1px solid var(--keyline);
  border-radius: var(--r-plate); box-shadow: var(--lift-3);
}
.coswitch__menu[hidden] { display: none; }
.coswitch__item {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center;
  gap: 4px 10px; width: 100%; padding: 9px 11px;
  background: none; border: none; border-radius: var(--r-md);
  text-align: left; color: var(--text); font: inherit; cursor: pointer;
}
.coswitch__item:hover { background: var(--plate-sunken); }
.coswitch__item.is-active { background: var(--plate-sunken); }
.coswitch__name { font-size: .875rem; font-weight: 600; }
.coswitch__kind { grid-column: 1; font-size: .6875rem; color: var(--text-muted); }
.coswitch__tick { grid-row: 1 / span 2; width: 16px; height: 16px; color: var(--signal-green); }
.coswitch__item--link {
  border-top: 1px solid var(--keyline); border-radius: 0 0 var(--r-md) var(--r-md);
  margin-top: 4px; padding-top: 11px; font-size: .8125rem; font-weight: 600;
  color: var(--accent-text); display: block;
}
.coswitch__loading { padding: 12px; font-size: .8125rem; color: var(--text-muted); }

/* --- Licence meter -------------------------------------------------------- */
.lic { display: grid; gap: var(--s5); }
.lic__row { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: var(--s5); }
.lic__meter { display: grid; gap: 6px; }
.lic__label { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.lic__label span { font-size: .75rem; font-weight: 650; letter-spacing: .04em; text-transform: uppercase; color: var(--text-muted); }
.lic__label b { font-size: 1.0625rem; font-variant-numeric: tabular-nums; }
.lic__bar { height: 8px; border-radius: 100px; background: var(--plate-sunken); overflow: hidden; }
.lic__bar i {
  display: block; height: 100%; width: 0;
  border-radius: 100px;
  background: linear-gradient(90deg, var(--signal-green), var(--amber-500));
  transition: width .5s var(--ease);
}
.lic__note { font-size: .75rem; color: var(--text-muted); }
.lic__facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: var(--s4); margin: 0; }
.lic__facts dt { font-size: .6875rem; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--text-muted); }
.lic__facts dd { margin: 3px 0 0; font-size: .9375rem; font-weight: 600; }
.lic__warn {
  margin: 0; padding: 11px 13px; border-radius: var(--r-md);
  background: var(--signal-red-100); color: var(--signal-red);
  font-size: .875rem; font-weight: 600;
}

/* --- Group dashboard ------------------------------------------------------ */
.gfilter {
  display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--s3);
  margin-bottom: var(--s5);
}
.gfilter .field { margin: 0; min-width: 150px; }
.gtiles {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: var(--s3); margin-bottom: var(--s5);
}
.gtile {
  display: grid; gap: 5px; padding: var(--s4) var(--s4);
  background: var(--plate); border: 1px solid var(--keyline); border-radius: var(--r-plate);
}
.gtile__label { font-size: .6875rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--text-muted); }
.gtile__value { font-size: 1.5rem; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.gtile--good .gtile__value { color: var(--signal-green-600); }
.gtile--bad .gtile__value { color: var(--signal-red); }
.gtile--warn .gtile__value { color: var(--amber-600); }
.gleaders { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: var(--s4); }
.gleader { display: grid; gap: 3px; padding: var(--s4); background: var(--plate-sunken); border-radius: var(--r-md); }
.gleader__label { font-size: .6875rem; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--text-muted); }
.gleader strong { font-size: 1.0625rem; }
.gleader__value { font-size: .8125rem; color: var(--text-muted); }
.gact { display: grid; gap: 2px; margin: 0; padding: 0; list-style: none; }
.gact li {
  display: grid; grid-template-columns: minmax(110px, auto) minmax(0, 1fr) auto;
  gap: 12px; align-items: baseline; padding: 9px 0;
  border-bottom: 1px solid var(--keyline); font-size: .875rem;
}
.gact li:last-child { border-bottom: none; }
.gact__co { font-weight: 650; font-size: .8125rem; }
.pos { color: var(--signal-green-600); }
.neg { color: var(--signal-red); }
.tag {
  padding: 1px 7px; border-radius: 100px; background: var(--green-800); color: #fff;
  font-size: .625rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
}
/* Vertical column headers keep the sharing matrix readable at width. */
.vert { height: 118px; white-space: nowrap; vertical-align: bottom; padding: 0 !important; }
.vert > span { display: block; transform-origin: bottom left; transform: rotate(-60deg) translateX(4px); width: 20px; font-size: .75rem; }

@media (max-width: 720px) {
  .coswitch__btn { max-width: 190px; }
  .gact li { grid-template-columns: minmax(0, 1fr); gap: 2px; }
}

/* --- Sidebar sections ------------------------------------------------------ */
/* Labels turn a long list into four short ones. They are signage, not links:
   no hover, no target, and they never take focus. */
.nav-head {
  margin: var(--s4) 0 2px;
  padding: 0 12px;
  font-size: .625rem;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: rgba(233, 244, 238, .38);
  pointer-events: none;
}
.nav-list > .nav-head:first-child { margin-top: 0; }

/* --- Dashboard: quick actions & alerts ------------------------------------- */
.quickact {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s2);
  margin-bottom: var(--s5);
}
.quickact__btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 14px;
  background: var(--plate);
  border: 1px solid var(--keyline);
  border-radius: 100px;
  color: var(--text);
  font-size: .8125rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color .16s, background-color .16s, transform .16s var(--ease-quick);
}
.quickact__btn:hover {
  border-color: var(--amber-500);
  background: var(--plate-sunken);
  transform: translateY(-1px);
}
.quickact__btn .ico { color: var(--amber-600); }

.alertlist { list-style: none; margin: 0; padding: 0; display: grid; }
.alertlist__item {
  display: grid;
  grid-template-columns: 8px minmax(0, 1fr) auto;
  gap: var(--s3);
  align-items: baseline;
  padding: 11px 0;
  border-bottom: 1px solid var(--keyline);
}
.alertlist__item:last-child { border-bottom: none; }
.alertlist__dot { width: 8px; height: 8px; border-radius: 50%; background: var(--stone-300); }
.alertlist__dot--alert { background: var(--signal-red); }
.alertlist__dot--caution { background: var(--amber-500); }
.alertlist__dot--cool { background: var(--signal-blue); }
.alertlist__body { display: grid; gap: 2px; font-size: .875rem; }
.alertlist__body span { color: var(--text-muted); font-size: .8125rem; }
.alertlist__when { white-space: nowrap; font-size: .75rem; }

.depart__in {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 100px;
  background: var(--plate-sunken);
  border: 1px solid var(--keyline);
  font-size: .75rem;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}
.depart__in.is-soon { background: var(--amber-100); border-color: var(--amber-300); color: var(--amber-700); }

/* --- Reservations ---------------------------------------------------------- */
.rfilter {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: var(--s3);
  align-items: end;
}
.rfilter__acts { display: flex; gap: var(--s2); }

/* The facts strip: what the desk needs before it reads anything else. */
.rfacts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1px;
  margin: 0 0 var(--s5);
  padding: 0;
  background: var(--keyline);
  border: 1px solid var(--keyline);
  border-radius: var(--r-plate);
  overflow: hidden;
}
.rfact { display: grid; gap: 3px; padding: var(--s3) var(--s4); background: var(--plate); }
.rfact dt {
  font-size: .625rem; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; color: var(--text-muted);
}
.rfact dd { margin: 0; font-size: .9375rem; font-weight: 600; }

.rgrid { display: grid; gap: var(--s5); }

.rwarn {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: .75rem; font-weight: 600; color: var(--amber-700);
}
.rwarn .ico { color: var(--amber-600); }

.ramend { list-style: none; margin: 0; padding: 0; display: grid; }
.ramend li {
  display: grid;
  grid-template-columns: minmax(96px, auto) minmax(0, 1fr) auto;
  gap: var(--s3);
  align-items: start;
  padding: var(--s3) 0;
  border-bottom: 1px solid var(--keyline);
}
.ramend li:last-child { border-bottom: none; }
.ramend__kind {
  padding: 2px 9px; border-radius: 100px; background: var(--plate-sunken);
  border: 1px solid var(--keyline); font-size: .6875rem; font-weight: 700;
  letter-spacing: .05em; text-transform: uppercase; text-align: center;
}
.ramend__kind.is-cancel { background: var(--signal-red-100); border-color: var(--signal-red); color: var(--signal-red); }
.ramend .data { font-size: .75rem; }


@media (max-width: 720px) {
  .rfacts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ramend li { grid-template-columns: minmax(0, 1fr); gap: 5px; }
  /* The row scrolls, so it has to look like it scrolls: the last chip fades
     out at the edge instead of being sliced off mid-word. */
  .quickact {
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 4px;
    scroll-snap-type: x proximity;
    -webkit-overflow-scrolling: touch;
    mask-image: linear-gradient(90deg, #000 calc(100% - 28px), transparent);
  }
  .quickact::-webkit-scrollbar { display: none; }
  .quickact__btn { white-space: nowrap; scroll-snap-align: start; }
}

/* --- Data boards on a phone ------------------------------------------------ */
/* A nine-column register cannot be read by dragging it sideways on a 360px
   screen. Below the breakpoint each row becomes a fact card: the first column
   is the card's title, the rest pair up two to a line under their own labels,
   and the actions sit along the bottom. The cell itself stays in normal flow —
   making it a grid would turn every <strong> and <span> inside it into a
   separate row. */
@media (max-width: 720px) {
  .boardwrap { overflow-x: visible; }
  /* Cards need their own gutter back — the full-bleed rule is for tables. */
  .panel__body > .boardwrap:only-child { margin: 0; }
  .board--data { display: block; width: 100%; font-size: .8125rem; }
  .board--data thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .board--data tbody { display: grid; gap: var(--s2); }
  .board--data tbody tr {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px var(--s3);
    padding: 11px var(--s3) 10px;
    background: var(--plate-sunken);
    border: 1px solid var(--keyline);
    border-radius: var(--r-md);
  }
  .board--data tbody td {
    display: block;
    min-width: 0;
    padding: 0;
    border-bottom: none;
    text-align: left;
    line-height: 1.35;
    overflow-wrap: anywhere;
  }
  .board--data tbody td.right { text-align: left; }
  .board--data tbody td::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 1px;
    font-size: .5625rem;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--text-muted);
  }
  /* The first cell is the card's title and the action cell its footer; both
     run the full width of the card. */
  .board--data tbody td:first-child,
  .board--data tbody td[data-label=''] { grid-column: 1 / -1; }
  .board--data tbody td:first-child { font-size: .9375rem; font-weight: 650; }
  .board--data tbody td:first-child::before,
  .board--data tbody td[data-label='']::before { content: none; }
  .board--data tbody td[data-label=''] {
    display: flex;
    flex-wrap: wrap;
    gap: var(--s2);
    padding-top: 9px;
    border-top: 1px solid var(--keyline);
  }
  .board--data tbody td[data-label=''] .btn { flex: 1 1 auto; justify-content: center; }
  .board--data tbody td[data-label='']:empty { display: none; }
  /* Secondary text keeps its own weight rather than inheriting the title's. */
  .board--data tbody td .data,
  .board--data tbody td .sub {
    display: block;
    margin-top: 0;
    font-size: .6875rem;
    font-weight: 500;
    color: var(--text-faint);
  }

  /* Filters collapse behind their own summary so the records are the first
     thing on screen, not the sixth field of a form. */
  .filterbox { margin-bottom: var(--s4); }
}

.filterbox {
  background: var(--plate);
  border: 1px solid var(--keyline);
  border-radius: var(--r-plate);
  overflow: hidden;
}
.filterbox__sum {
  display: flex;
  align-items: center;
  gap: var(--s2);
  padding: var(--s3) var(--s4);
  font-size: .8125rem;
  font-weight: 650;
  cursor: pointer;
  list-style: none;
  user-select: none;
}
.filterbox__sum::-webkit-details-marker { display: none; }
.filterbox__sum .ico { color: var(--text-muted); }
.filterbox__count {
  margin-left: auto;
  padding: 1px 8px;
  border-radius: 100px;
  background: var(--amber-100);
  color: var(--amber-700);
  font-size: .6875rem;
  font-weight: 700;
}
.filterbox[open] .filterbox__sum { border-bottom: 1px solid var(--keyline); }
.filterbox__body { padding: var(--s4); }

/* Targets a thumb can actually hit. Keyed off width as well as pointer type:
   a small screen is a phone whatever the pointer reports. */
@media (max-width: 720px), (pointer: coarse) {
  .btn, .btn--sm { min-height: 42px; }
  .qsec__btn, .icon-btn, .botnav__tab { min-width: 42px; min-height: 42px; }
  .board--data tbody td[data-label=''] .btn { min-height: 40px; }
}

/* A policy strip that is warning rather than reassuring — used where the
   interface has to say plainly that something carries risk. */
.policy--warn {
  border-color: var(--amber-500);
  background: linear-gradient(0deg, var(--amber-100), var(--amber-100)), var(--plate);
}
:root[data-theme='dark'] .policy--warn {
  background: color-mix(in srgb, var(--amber-700) 22%, var(--plate));
}
.policy--warn .ico { color: var(--amber-600); }

/* --- WhatsApp colour grading ----------------------------------------------- */
/* The Communications area borrows WhatsApp's own palette so the surface reads
   as the channel it is. Scoped to this one area on purpose: the CRM's amber
   identity stays everywhere else, and a green that means "WhatsApp" here
   would only mean "success" if it leaked out. */
.wa-skin {
  --wa-green: #25D366;      /* the brand green, used sparingly */
  --wa-teal: #128C7E;       /* headers and accents */
  --wa-deep: #075E54;       /* the darkest, for bands */
  --wa-out: #D9FDD3;        /* the sent-message bubble */
  --wa-out-line: #B7E9AE;
  --wa-paper: #EFE7DE;      /* the chat paper */
}
:root[data-theme='dark'] .wa-skin {
  --wa-out: #144D37;
  --wa-out-line: #1F6B4C;
  --wa-paper: #0E1611;
}

/* The thread list marks the open conversation in the channel's own colour. */
.wa-skin .convo.is-open { box-shadow: inset 3px 0 0 var(--wa-teal); }

/* The conversation header carries a quiet band of it. */
.wa-skin .wa__head {
  background: linear-gradient(180deg,
    color-mix(in srgb, var(--wa-teal) 9%, var(--plate)), var(--plate));
  border-bottom: 1px solid color-mix(in srgb, var(--wa-teal) 22%, var(--keyline));
}
.wa-skin .wa__name { text-decoration-color: var(--wa-teal); }

/* Chat paper, and the doodled tint WhatsApp uses behind messages. */
.wa-skin .wa__scroll {
  background:
    radial-gradient(circle at 18% 12%, color-mix(in srgb, var(--wa-teal) 5%, transparent) 0 12px, transparent 13px),
    radial-gradient(circle at 74% 44%, color-mix(in srgb, var(--wa-teal) 4%, transparent) 0 16px, transparent 17px),
    radial-gradient(circle at 38% 78%, color-mix(in srgb, var(--wa-teal) 5%, transparent) 0 10px, transparent 11px),
    var(--wa-paper);
  background-size: 190px 190px, 250px 250px, 160px 160px, auto;
}
.wa-skin .bubble--out {
  background: var(--wa-out);
  border-color: var(--wa-out-line);
}
.wa-skin .bubble--in { background: var(--plate); }

/* A connected channel says so in green; the unofficial link keeps amber,
   because that one is a warning and must not read as reassurance. */
.wa-skin .policy:not(.policy--warn) {
  border-color: color-mix(in srgb, var(--wa-green) 45%, var(--keyline));
  background: linear-gradient(90deg,
    color-mix(in srgb, var(--wa-green) 10%, var(--plate)) 0 4px,
    var(--plate) 4px);
}
.wa-skin .policy:not(.policy--warn) > .ico { color: var(--wa-teal); }

/* Send is the channel's action, so it wears the channel's colour. */
.wa-skin .wa__composer-acts .btn--primary {
  background: var(--wa-teal);
  border-color: var(--wa-teal);
  color: #fff;
}
.wa-skin .wa__composer-acts .btn--primary:hover { background: var(--wa-deep); border-color: var(--wa-deep); }
.wa-skin .wa__composer textarea:focus-visible { outline-color: var(--wa-green); }

/* The tab that selects the WhatsApp inbox. */
.wa-skin .gbtab.is-on, .wa [data-gtab].is-on { box-shadow: inset 0 -2px 0 var(--wa-teal); }

/* Withdrawing a licence sits at the far end of the footer, away from Save:
   it is the one destructive action in the dialog. */
.licence__drop { margin-right: auto; white-space: nowrap; }
