/* ==========================================================================
   Bid Desk
   A tender is a document with a deadline. The interface treats identifiers as
   the coded artefacts they are (mono, tracked) and gives time the loudest
   voice on the page. One accent, hairline rules, no decoration.
   ========================================================================== */

:root {
  --ink:        #071026;
  --ink-2:      #23324B;
  --ink-3:      #55617A;
  --muted:      #6E7A90;
  --faint:      #97A1B2;
  --paper:      #EDF1F6;
  --surface:    #FFFFFF;
  --sunken:     #F3F5F9;
  --rule:       #D9DFEA;
  --rule-soft:  #E9EDF4;

  --accent:     #0E7C86;
  --accent-ink: #0A5A63;
  --accent-wash:#DFF3F4;

  --overdue:    #C2410C;
  --critical:   #D32020;
  --warn:       #A85B08;
  --warn-wash:  #FDF0D5;
  --overdue-wash:#FBE9E0;
  --critical-wash:#FCE6E6;
  --good:       #12795C;
  --good-wash:  #D6F2E5;
  --lost-wash:  #FDE7E7;

  --radius:   6px;
  --radius-lg:10px;
  --shadow:   0 1px 2px rgba(19,26,43,.06), 0 1px 3px rgba(19,26,43,.04);
  --shadow-lg:0 4px 16px rgba(19,26,43,.10);

  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto,
          "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, "Cascadia Mono", Menlo,
          Consolas, "Liberation Mono", monospace;

  --nav-w: 232px;
  --density: 1;

  /* Semantic shell tokens. Branding can change the working accent without
     leaving a blue navigation state behind. */
  --nav-surface: var(--ink);
  --nav-surface-end: #12161C;
  --nav-text: #C8CFDC;
  --nav-text-muted: #8E99AC;
  --nav-active-bg: color-mix(in srgb, var(--accent) 25%, transparent);
  --nav-active-edge: var(--accent);
  --focus-ring: color-mix(in srgb, var(--accent) 34%, transparent);
  --scrim: rgba(7,16,38,.58);
  --touch-target: 44px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: -0.015em; }
h1 { font-size: 25px; letter-spacing: -0.026em; line-height: 1.2; }
h2 { font-size: 16px; }
h3 { font-size: 14px; }
p  { margin: 0 0 10px; }
a  { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Identifiers, dates and money are coded data. They get the mono face and
   tabular figures so columns align and numbers can be compared by eye. */
.mono, .ref, .num, td.num, .money {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-size: 12.5px;
  letter-spacing: -0.02em;
}
.num, td.num, .money { text-align: right; }

.eyebrow {
  font-size: 10px; font-weight: 600; text-transform: uppercase;
  letter-spacing: .09em; color: var(--faint);
}

/* ------------------------------------------------------------------ shell */
.shell { display: flex; min-height: 100vh; }

.nav {
  width: var(--nav-w); flex: 0 0 var(--nav-w);
  background: var(--ink); color: #C8CFDC;
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.nav-brand {
  padding: 18px 18px 16px; border-bottom: 1px solid rgba(255,255,255,.08);
}
.nav-brand .mark {
  font-family: var(--mono); font-size: 15px; font-weight: 600;
  color: #fff; letter-spacing: -0.03em; display: block;
}
.nav-brand .org {
  font-size: 10px; text-transform: uppercase; letter-spacing: .1em;
  color: #6F7C93; margin-top: 3px; display: block;
}
.nav-group { padding: 14px 0 4px; }
.nav-group-label {
  padding: 0 18px 6px; font-size: 10px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .09em; color: #5B6880;
}
.nav a.nav-item {
  display: flex; align-items: center; gap: 9px;
  padding: 7px 18px; color: #C8CFDC; font-size: 13px; text-decoration: none;
  border-left: 2px solid transparent;
}
.nav a.nav-item:hover { background: rgba(255,255,255,.05); color: #fff; }
.nav a.nav-item.active {
  background: linear-gradient(90deg, var(--nav-active-bg), transparent);
  color: #fff; border-left-color: var(--accent); font-weight: 550;
}
.nav-item .count {
  margin-left: auto; font-family: var(--mono); font-size: 11px;
  color: #7B8AA3; font-variant-numeric: tabular-nums;
}
.nav-item .count.hot {
  color: #FFB394; background: rgba(194,65,12,.22);
  padding: 1px 6px; border-radius: 9px; font-weight: 600;
}
.nav-foot {
  margin-top: auto; padding: 14px 18px;
  border-top: 1px solid rgba(255,255,255,.08); font-size: 12px;
}
.nav-foot .who { color: #fff; font-weight: 500; }
.nav-foot .role { color: #6F7C93; font-size: 11px; text-transform: capitalize; }
.nav-foot a { color: #8A97AD; font-size: 11.5px; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  background: var(--surface); border-bottom: 1px solid var(--rule);
  padding: 14px 26px; display: flex; align-items: center; gap: 16px;
  position: sticky; top: 0; z-index: 20;
}
.topbar .title-wrap { min-width: 0; }
.topbar .sub { color: var(--muted); font-size: 12.5px; margin-top: 1px; }
.topbar .spacer { flex: 1; }

.content { padding: 22px 26px 60px; max-width: 1500px; width: 100%; }

/* ----------------------------------------------------------------- cards */
.card {
  background: var(--surface); border: 1px solid var(--rule);
  border-radius: var(--radius-lg); box-shadow: var(--shadow);
}
.card + .card { margin-top: 16px; }
.card-head {
  padding: 13px 16px; border-bottom: 1px solid var(--rule-soft);
  display: flex; align-items: center; gap: 10px;
}
.card-head h2 {
  font-size: 10px; font-weight: 680; text-transform: uppercase;
  letter-spacing: .1em; color: var(--ink-3);
}
.card-head .spacer { flex: 1; }
.card-body { padding: 16px; }
.card-body.tight { padding: 0; }

.grid { display: grid; gap: 16px; }
.grid.c2 { grid-template-columns: repeat(2, minmax(0,1fr)); }
.grid.c3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
.grid.c4 { grid-template-columns: repeat(4, minmax(0,1fr)); }
.grid.main-side { grid-template-columns: minmax(0,1fr) 340px; align-items: start; }

/* ----------------------------------------------------------------- stats */
.stat { padding: 15px 17px 16px; position: relative; overflow: hidden; }
.stat::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: var(--rule);
}
.stat.is-alert::before  { background: var(--overdue); }
.stat.is-good::before   { background: var(--good); }
.stat.is-accent::before { background: var(--accent); }
.stat .label {
  font-size: 10px; font-weight: 600; text-transform: uppercase;
  letter-spacing: .08em; color: var(--faint);
}
.stat .value {
  font-family: var(--mono); font-size: 33px; font-weight: 600;
  letter-spacing: -0.05em; color: var(--ink); margin-top: 6px;
  font-variant-numeric: tabular-nums; line-height: 1.05;
}
.stat .value.sm { font-size: 24px; letter-spacing: -0.04em; }
.stat .foot { font-size: 11.5px; color: var(--muted); margin-top: 3px; }
.stat .value.alert { color: var(--overdue); }
.stat .value.good  { color: var(--good); }

/* --------------------------------------------------- the deadline runway
   The signature element. Every live deadline placed on one horizontal axis,
   with everything left of the today-line already late. */
.runway { padding: 18px 16px 10px; }
.runway-track {
  position: relative; height: 132px;
  border-bottom: 1px solid var(--rule);
  background:
    linear-gradient(90deg, rgba(194,65,12,.05) 0 var(--today-pos), transparent var(--today-pos));
}
.runway-today {
  position: absolute; top: -4px; bottom: 0; width: 0;
  border-left: 1.5px dashed var(--overdue); left: var(--today-pos);
}
.runway-today::after {
  content: "today"; position: absolute; top: -16px; left: 4px;
  font-size: 9.5px; text-transform: uppercase; letter-spacing: .09em;
  color: var(--overdue); font-weight: 600;
}
.runway-pin {
  position: absolute; width: 11px; height: 11px; border-radius: 50%;
  border: 2px solid var(--surface); transform: translate(-50%, -50%);
  cursor: pointer; transition: transform .12s ease;
}
.runway-pin:hover, .runway-pin:focus-visible { transform: translate(-50%,-50%) scale(1.55); z-index: 5; }
.runway-pin.overdue  { background: var(--overdue); }
.runway-pin.critical { background: var(--critical); }
.runway-pin.soon     { background: var(--warn); }
.runway-pin.clear    { background: var(--accent); }
.runway-axis {
  display: flex; justify-content: space-between; padding-top: 7px;
  font-family: var(--mono); font-size: 10.5px; color: var(--faint);
}
.runway-legend {
  display: flex; gap: 14px; flex-wrap: wrap; padding-top: 10px;
  font-size: 11.5px; color: var(--muted); align-items: center;
}
.runway-legend .dot {
  width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-right: 5px;
}

/* ---------------------------------------------------------------- tables */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data th {
  text-align: left; padding: 9px 12px; font-size: 10px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .07em; color: var(--faint);
  border-bottom: 1px solid var(--rule); white-space: nowrap;
  background: var(--surface); position: sticky; top: 0;
}
table.data th a { color: inherit; }
table.data th.num { text-align: right; }
table.data td {
  padding: 9px 12px; border-bottom: 1px solid var(--rule-soft);
  vertical-align: middle;
}
table.data tbody tr:hover { background: var(--sunken); }
table.data tbody tr:last-child td { border-bottom: none; }
.row-link { color: var(--ink); font-weight: 500; display: block; }
.row-link:hover { color: var(--accent); text-decoration: none; }
.row-sub { color: var(--muted); font-size: 11.5px; margin-top: 1px; }
.cell-title { max-width: 380px; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ----------------------------------------------------------------- chips */
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 8px; border-radius: 20px; font-size: 11.5px; font-weight: 500;
  border: 1px solid transparent; white-space: nowrap;
}
.chip .dot { width: 6px; height: 6px; border-radius: 50%; }
.chip-stage { background: var(--sunken); color: var(--ink-2); border-color: var(--rule); }
.chip-due {
  font-family: var(--mono); font-size: 11.5px; font-variant-numeric: tabular-nums;
}
.chip-due.overdue  { background: var(--overdue-wash); color: var(--overdue); }
.chip-due.critical { background: var(--critical-wash); color: var(--critical); }
.chip-due.soon     { background: var(--warn-wash); color: var(--warn); }
.chip-due.clear    { background: var(--sunken); color: var(--muted); }
.chip-due.undated  { background: transparent; color: var(--faint); border-color: var(--rule); }
.chip-due.settled  { background: transparent; color: var(--faint); }
.chip-flag { background: var(--warn-wash); color: var(--warn); }
.chip-good { background: var(--good-wash); color: var(--good); }
.chip-bad  { background: var(--critical-wash); color: var(--critical); }

.avatar {
  width: 22px; height: 22px; border-radius: 50%; background: var(--accent-wash);
  color: var(--accent-ink); font-size: 9.5px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
  letter-spacing: .02em; flex: 0 0 22px;
}
.who-cell { display: flex; align-items: center; gap: 7px; }

/* --------------------------------------------------------------- buttons */
.btn {
  display: inline-flex; align-items: center; gap: 6px; justify-content: center;
  padding: 7px 13px; border-radius: var(--radius); font-size: 13px;
  font-weight: 500; font-family: inherit; cursor: pointer;
  border: 1px solid var(--rule); background: var(--surface); color: var(--ink);
  text-decoration: none; line-height: 1.3;
}
.btn:hover { background: var(--sunken); text-decoration: none; }
.btn-primary {
  background: var(--accent); border-color: var(--accent); color: #fff;
}
.btn-primary:hover { background: var(--accent-ink); border-color: var(--accent-ink); }
.btn-danger { color: var(--critical); border-color: #F3C6C6; }
.btn-danger:hover { background: var(--lost-wash); }
.btn-sm { padding: 4px 9px; font-size: 12px; }
.btn:disabled, .btn.is-blocked { opacity: .5; cursor: not-allowed; }
.btn-group { display: flex; flex-wrap: wrap; gap: 7px; }

/* ----------------------------------------------------------------- forms */
.field { margin-bottom: 14px; }
.field > label {
  display: block; font-size: 12px; font-weight: 600; color: var(--ink-2);
  margin-bottom: 4px;
}
.field .hint { font-size: 11.5px; color: var(--muted); margin-top: 3px; }
.field .err { font-size: 11.5px; color: var(--critical); margin-top: 3px; }
input[type=text], input[type=number], input[type=date], input[type=email],
input[type=url], input[type=password], select, textarea {
  width: 100%; padding: 7px 10px; font-size: 13.5px; font-family: inherit;
  color: var(--ink); background: var(--surface);
  border: 1px solid var(--rule); border-radius: var(--radius);
}
input[type=date], input[type=number] { font-family: var(--mono); font-size: 13px; }
textarea { min-height: 76px; resize: vertical; }
input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--accent); outline-offset: -1px; border-color: var(--accent);
}
.field-row { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 14px; }
.field-row.c3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
.required::after { content: " *"; color: var(--critical); }
fieldset { border: none; padding: 0; margin: 0 0 22px; }
fieldset > legend {
  font-size: 10px; font-weight: 600; text-transform: uppercase;
  letter-spacing: .08em; color: var(--faint); padding: 0 0 9px;
  border-bottom: 1px solid var(--rule-soft); width: 100%; margin-bottom: 14px;
}
.form-actions {
  display: flex; gap: 9px; padding-top: 16px; border-top: 1px solid var(--rule-soft);
}
.checkline { display: flex; align-items: center; gap: 8px; }
.checkline input { width: auto; }

/* filter bar */
.filters {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: end;
  padding: 13px 17px; border-bottom: 1px solid var(--rule-soft);
  background: var(--sunken);
}
.filters .f { min-width: 136px; }
.filters .f label {
  display: block; font-size: 9.5px; font-weight: 600; text-transform: uppercase;
  letter-spacing: .07em; color: var(--faint); margin-bottom: 3px;
}
.filters select, .filters input { padding: 5px 8px; font-size: 12.5px; }
.filters .f.grow { flex: 1; min-width: 180px; }

/* -------------------------------------------------------- the stage rail
   A real sequence, so a numbered progressive rail is honest here. */
.rail { display: flex; gap: 2px; padding: 2px 0 14px; overflow-x: auto; }
.rail-step {
  flex: 1; min-width: 62px; padding: 7px 8px 8px; border-radius: 4px;
  background: var(--sunken); border-top: 3px solid var(--rule);
}
.rail-step .n {
  font-family: var(--mono); font-size: 9.5px; color: var(--faint);
}
.rail-step .nm {
  font-size: 11px; font-weight: 500; color: var(--muted); margin-top: 1px;
  line-height: 1.25;
}
.rail-step.done { background: var(--accent-wash); border-top-color: var(--accent); }
.rail-step.done .nm, .rail-step.done .n { color: var(--accent-ink); }
.rail-step.now {
  background: var(--accent); border-top-color: var(--accent-ink);
}
.rail-step.now .nm, .rail-step.now .n { color: #fff; font-weight: 600; }
.rail-step.terminal { background: var(--ink); border-top-color: var(--ink); }
.rail-step.terminal .nm, .rail-step.terminal .n { color: #fff; }

/* gate feedback */
.gate-block {
  border: 1px solid #F0D9BE; background: #FEF8EF;
  border-radius: var(--radius); padding: 11px 13px; margin-bottom: 12px;
}
.gate-block .gate-head {
  font-size: 12px; font-weight: 600; color: var(--warn); margin-bottom: 5px;
}
.gate-block ul { margin: 0; padding-left: 17px; font-size: 12.5px; color: var(--ink-2); }
.gate-block li { margin-bottom: 2px; }

/* definition list */
.dl { display: grid; grid-template-columns: 128px minmax(0,1fr); gap: 7px 14px; font-size: 13px; }
.dl dt { color: var(--muted); font-size: 12px; }
.dl dd { margin: 0; color: var(--ink); }

/* timeline */
.timeline { position: relative; padding-left: 19px; }
.timeline::before {
  content: ""; position: absolute; left: 4px; top: 5px; bottom: 5px;
  width: 1px; background: var(--rule);
}
.tl-item { position: relative; padding-bottom: 14px; font-size: 12.5px; }
.tl-item::before {
  content: ""; position: absolute; left: -19px; top: 4px;
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--surface); border: 2px solid var(--accent);
}
.tl-item .when { font-family: var(--mono); font-size: 11px; color: var(--faint); }
.tl-item .what { color: var(--ink); margin-top: 1px; }
.tl-item .note { color: var(--muted); margin-top: 2px; font-size: 12px; }

/* messages */
.msg {
  padding: 10px 14px; border-radius: var(--radius); margin-bottom: 14px;
  font-size: 13px; border: 1px solid; border-left-width: 3px;
}
.msg-success { background: var(--good-wash); border-color: #A7DDD6; color: #0B5C55; }
.msg-error   { background: var(--critical-wash); border-color: #EFBEBE; color: #941919; }
.msg-warning { background: var(--warn-wash); border-color: #F0DCA0; color: #92400E; }
.msg-info    { background: var(--accent-wash); border-color: #C3D2FB; color: var(--accent-ink); }

/* empty state */
.empty { padding: 44px 22px; text-align: center; }
.empty h3 { color: var(--ink-2); margin-bottom: 5px; }
.empty p { color: var(--muted); font-size: 13px; max-width: 420px; margin: 0 auto 14px; }

/* bars used in reporting */
.bar-row { display: grid; grid-template-columns: 158px 1fr 88px; gap: 11px; align-items: center;
           padding: 5px 0; font-size: 12.5px; }
.bar-row .lbl { color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { background: var(--sunken); border-radius: 3px; height: 17px; overflow: hidden; display: flex; }
.bar-fill { height: 100%; }
.bar-fill.won  { background: var(--good); }
.bar-fill.lost { background: #E4A0A0; }
.bar-fill.open { background: var(--accent); }
.bar-row .val { font-family: var(--mono); font-size: 11.5px; text-align: right; color: var(--muted); }

.pagination { display: flex; gap: 7px; align-items: center; padding: 12px 16px;
              border-top: 1px solid var(--rule-soft); font-size: 12.5px; color: var(--muted); }
.pagination .spacer { flex: 1; }

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--rule); padding: 0 16px; }
.tabs a {
  padding: 9px 12px; font-size: 13px; color: var(--muted);
  border-bottom: 2px solid transparent; text-decoration: none;
}
.tabs a:hover { color: var(--ink); text-decoration: none; }
.tabs a.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 500; }

.note-item { padding: 10px 0; border-bottom: 1px solid var(--rule-soft); font-size: 13px; }
.note-item:last-child { border-bottom: none; }
.note-meta { font-size: 11px; color: var(--faint); margin-top: 3px; }

/* login */
.auth-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(1000px 600px at 50% -10%, #1B2740, var(--ink));
  padding: 20px;
}
.auth-card { width: 100%; max-width: 348px; background: var(--surface);
             border-radius: var(--radius-lg); padding: 28px; box-shadow: var(--shadow-lg); }
.auth-card .mark { font-family: var(--mono); font-size: 17px; font-weight: 600;
                   letter-spacing: -0.03em; }
.auth-card .org { font-size: 10px; text-transform: uppercase; letter-spacing: .1em;
                  color: var(--faint); margin: 3px 0 22px; }

/* ------------------------------------------------------------ responsive */
@media (max-width: 1100px) {
  .grid.main-side { grid-template-columns: minmax(0,1fr); }
  .grid.c4 { grid-template-columns: repeat(2, minmax(0,1fr)); }
}
@media (max-width: 780px) {
  .shell { flex-direction: column; }
  .nav { width: 100%; flex: none; height: auto; position: static; flex-direction: row;
         flex-wrap: wrap; align-items: center; padding: 8px; gap: 4px; }
  .nav-brand { border: none; padding: 6px 10px; }
  .nav-group { display: flex; padding: 0; gap: 2px; overflow-x: auto; }
  .nav-group-label { display: none; }
  .nav a.nav-item { border-left: none; border-radius: 4px; padding: 6px 10px;
                    white-space: nowrap; }
  .nav a.nav-item.active { border-left: none; }
  .nav-foot { margin: 0; border: none; padding: 6px 10px; }
  .content { padding: 16px 14px 48px; }
  .topbar { padding: 12px 14px; }
  .grid.c2, .grid.c3, .grid.c4 { grid-template-columns: minmax(0,1fr); }
  .field-row, .field-row.c3 { grid-template-columns: minmax(0,1fr); }
  .dl { grid-template-columns: minmax(0,1fr); gap: 2px; }
  .dl dt { margin-top: 8px; }
  .bar-row { grid-template-columns: 108px 1fr 62px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 3px; }

@media print {
  .nav, .topbar .btn, .filters, .form-actions { display: none !important; }
  body { background: #fff; }
  .card { box-shadow: none; border-color: #ccc; }
}


/* grouped stage moves */
.move-set { padding-top: 12px; border-top: 1px solid var(--rule-soft); margin-top: 12px; }
.move-set .eyebrow { margin-bottom: 7px; display: block; }

/* The pipeline table is wide by nature. On a phone it scrolls inside its card
   rather than pushing the whole page sideways. */
@media (max-width: 780px) {
  .card { max-width: 100%; overflow: hidden; }
  .table-wrap { -webkit-overflow-scrolling: touch; }
  table.data { min-width: 620px; }
  .cell-title { max-width: 210px; }
  .tabs { overflow-x: auto; }
  .filters .f, .filters .f.grow { min-width: 100%; }
  .filters { flex-direction: column; align-items: stretch; }
}


/* role explanations on the people screens */
.role-line {
  display: flex; gap: 11px; align-items: baseline; padding: 6px 0;
  font-size: 12.5px; color: var(--muted); border-bottom: 1px solid var(--rule-soft);
}
.role-line:last-child { border-bottom: none; }
.role-line strong { color: var(--ink-2); font-weight: 600; }
.role-help { background: var(--sunken); border-radius: var(--radius); padding: 4px 13px; margin-top: -4px; }

/* an auto-issued number, shown where a text field used to be */
.issued {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  background: var(--sunken); border: 1px dashed var(--rule);
  border-radius: var(--radius); padding: 10px 13px;
}
.issued .val { font-family: var(--mono); font-size: 14px; font-weight: 600; color: var(--ink); }
.issued .note { font-size: 11.5px; color: var(--muted); }

/* nav footer with profile link */
.nav-foot .who-row { display: flex; align-items: center; gap: 9px; }
.nav-foot .who-row .avatar { background: rgba(255,255,255,.11); color: #DCE3EF; }
.nav-foot .links { display: flex; gap: 13px; margin-top: 10px; }
.nav-foot .links a, .nav-foot .links button {
  color: #7B89A3; font-size: 11.5px; background: none; border: none;
  padding: 0; cursor: pointer; font-family: inherit;
}
.nav-foot .links a:hover, .nav-foot .links button:hover { color: #fff; text-decoration: none; }

.btn-good { color: var(--good); border-color: #A5DBD3; }
.btn-good:hover { background: var(--good-wash); border-color: #86CDC3; }

/* avatars: photo when there is one, coloured initials otherwise */
img.avatar { object-fit: cover; display: inline-block; }
.avatar-upload { display: flex; align-items: center; gap: 14px; margin-bottom: 6px; }
.avatar-upload .preview { width: 56px; height: 56px; font-size: 17px; flex: 0 0 56px; }

/* spreadsheet upload */
.dropzone {
  border: 2px dashed var(--rule); border-radius: var(--radius-lg);
  background: var(--sunken); padding: 34px 20px; text-align: center;
}
.dropzone input[type=file] { width: auto; margin: 0 auto 10px; display: block; }
.dropzone label { display: block; cursor: pointer; }
.dropzone label strong { display: block; font-size: 14px; color: var(--ink); }
.dropzone label span { font-size: 12.5px; color: var(--muted); }
ol.steps { margin: 0; padding-left: 18px; font-size: 12.5px; color: var(--muted); }
ol.steps li { padding: 3px 0; }
ol.steps strong { color: var(--ink-2); }

/* ------------------------------------------------------------ the board */
.board { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 10px; align-items: flex-start; }
.board-col {
  flex: 0 0 268px; background: var(--sunken); border: 1px solid var(--rule);
  border-radius: var(--radius-lg); display: flex; flex-direction: column; max-height: 74vh;
}
.board-col.over { border-color: var(--accent); background: var(--accent-wash); }
.board-head {
  padding: 10px 12px 9px; border-top: 3px solid var(--rule);
  border-radius: 9px 9px 0 0; background: var(--surface);
  border-bottom: 1px solid var(--rule-soft);
}
.board-head .nm { font-size: 12px; font-weight: 650; color: var(--ink); }
.board-head .ct { float: right; font-size: 11.5px; color: var(--muted); }
.board-head .val { font-size: 11px; color: var(--faint); margin-top: 2px; }
.board-drop { padding: 9px; overflow-y: auto; flex: 1; min-height: 70px; }
.board-card {
  background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius);
  padding: 10px 11px; margin-bottom: 8px; cursor: grab; box-shadow: var(--shadow);
}
.board-card.dragging { opacity: .4; }
.board-card .ttl { display: block; font-size: 12.5px; font-weight: 550; color: var(--ink); line-height: 1.35; }
.board-card .ttl:hover { color: var(--accent); text-decoration: none; }
.board-card .cust { font-size: 11px; color: var(--muted); margin-top: 3px; }
.board-card .meta { display: flex; align-items: center; gap: 7px; margin-top: 9px; }
.board-card .meta .amt { margin-left: auto; font-size: 11px; color: var(--ink-2); }
.board-empty { font-size: 11.5px; color: var(--faint); text-align: center; padding: 14px 0; }
@media (max-width: 780px) { .board-col { flex: 0 0 232px; } }

/* ==========================================================================
   Polish pass — icons, depth, and a sidebar that reads as a product
   ========================================================================== */

.ic { width: 17px; height: 17px; flex: 0 0 17px; stroke-width: 1.7; }
.ic-sm { width: 14px; height: 14px; flex: 0 0 14px; }
.ic-lg { width: 22px; height: 22px; flex: 0 0 22px; }
.ic-xl { width: 30px; height: 30px; flex: 0 0 30px; stroke-width: 1.5; }

/* --- sidebar --------------------------------------------------------- */
.nav {
  background: linear-gradient(180deg, #121A2A 0%, #0C1220 100%);
  border-right: 1px solid rgba(255,255,255,.06);
}
.nav-brand { display: flex; align-items: center; gap: 11px; padding: 18px 17px 17px; }
.nav-brand .logo {
  width: 34px; height: 34px; flex: 0 0 34px; border-radius: 9px;
  background: linear-gradient(145deg, var(--accent), #5B7BF0);
  color: #fff; font-family: var(--mono); font-size: 13px; font-weight: 700;
  letter-spacing: -0.05em; display: flex; align-items: center; justify-content: center;
  box-shadow: 0 3px 10px rgba(37,84,232,.42);
}
.nav-brand .brand-text { display: flex; flex-direction: column; min-width: 0; }
.nav-brand .mark { font-family: var(--sans); font-size: 14.5px; font-weight: 650; letter-spacing: -0.02em; }
.nav a.nav-item { border-radius: 0 8px 8px 0; margin-right: 9px; padding: 8px 14px; }
.nav a.nav-item .ic { opacity: .62; }
.nav a.nav-item:hover .ic { opacity: 1; }
.nav a.nav-item.active .ic { opacity: 1; }
.nav a.nav-item.active {
  background: linear-gradient(90deg, var(--nav-active-bg), transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 20%, transparent);
}
.nav-foot .links a, .nav-foot .links button { display: inline-flex; align-items: center; gap: 5px; }
.nav-foot .links .ic { width: 13px; height: 13px; flex: 0 0 13px; }

/* --- surfaces get depth ---------------------------------------------- */
.card {
  box-shadow: 0 1px 2px rgba(14,20,32,.04), 0 3px 10px rgba(14,20,32,.05);
  border-color: #E1E6EF;
}
.card-head {
  background: linear-gradient(180deg, #FBFCFE, #F7F9FC);
  border-radius: 11px 11px 0 0;
}
.card-head h2 { display: flex; align-items: center; gap: 7px; }
.card-head h2 .ic { width: 14px; height: 14px; flex: 0 0 14px; color: var(--faint); }

.topbar {
  background: rgba(255,255,255,.88); backdrop-filter: saturate(180%) blur(8px);
  box-shadow: 0 1px 0 rgba(14,20,32,.05);
}

/* --- stat cards ------------------------------------------------------- */
.stat { padding-left: 18px; }
.stat::before { width: 4px; border-radius: 12px 0 0 12px; }
.stat .label { display: flex; align-items: center; gap: 6px; }
.stat .label .ic { width: 13px; height: 13px; flex: 0 0 13px; }
.stat.is-alert  { background: linear-gradient(100deg, #FEF6F2 0%, var(--surface) 46%); }
.stat.is-good   { background: linear-gradient(100deg, #F0FBF9 0%, var(--surface) 46%); }
.stat.is-accent { background: linear-gradient(100deg, #F3F6FE 0%, var(--surface) 46%); }

/* --- buttons ---------------------------------------------------------- */
.btn { box-shadow: 0 1px 1.5px rgba(14,20,32,.05); }
.btn .ic { width: 15px; height: 15px; flex: 0 0 15px; }
.btn-primary {
  background: linear-gradient(180deg, #3563EC, var(--accent));
  box-shadow: 0 1px 2px rgba(26,60,171,.28), 0 2px 8px rgba(37,84,232,.22);
}
.btn-primary:hover { background: linear-gradient(180deg, var(--accent), var(--accent-ink)); }

/* --- empty states carry the app when there is no data yet ------------- */
.empty { padding: 52px 24px; }
.empty .empty-icon {
  width: 58px; height: 58px; border-radius: 16px; margin: 0 auto 16px;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(150deg, var(--accent-wash), #F4F7FF);
  color: var(--accent); border: 1px solid #D5DFFB;
}
.empty .empty-icon .ic { width: 26px; height: 26px; flex: 0 0 26px; stroke-width: 1.5; }
.empty h3 { font-size: 15px; }

/* --- the welcome screen ---------------------------------------------- */
.welcome {
  background: linear-gradient(135deg, #101828 0%, #1C2A47 55%, #223763 100%);
  border-radius: var(--radius-lg); padding: 34px 32px; color: #fff;
  margin-bottom: 18px; position: relative; overflow: hidden;
}
.welcome::after {
  content: ""; position: absolute; right: -80px; top: -110px;
  width: 340px; height: 340px; border-radius: 50%;
  background: radial-gradient(circle, rgba(37,84,232,.42), transparent 66%);
}
.welcome h2 { font-size: 22px; letter-spacing: -0.026em; margin-bottom: 8px; color: #fff; }
.welcome p { color: #A9B6CD; font-size: 13.5px; max-width: 560px; margin-bottom: 20px; }
.welcome .btn-group { position: relative; z-index: 1; }
.welcome .btn { background: rgba(255,255,255,.1); border-color: rgba(255,255,255,.18); color: #fff; }
.welcome .btn:hover { background: rgba(255,255,255,.18); }
.welcome .btn-primary { background: #fff; border-color: #fff; color: var(--ink); }
.welcome .btn-primary:hover { background: #EDF1FA; color: var(--ink); }

.setup-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 14px; }
.setup-step {
  background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius-lg);
  padding: 18px; display: block; color: inherit; text-decoration: none;
  box-shadow: var(--shadow);
}
.setup-step:hover { border-color: var(--accent); text-decoration: none; box-shadow: var(--shadow-lg); }
.setup-step .n {
  width: 25px; height: 25px; border-radius: 8px; background: var(--accent-wash);
  color: var(--accent-ink); font-family: var(--mono); font-size: 11.5px; font-weight: 700;
  display: flex; align-items: center; justify-content: center; margin-bottom: 11px;
}
.setup-step.done .n { background: var(--good-wash); color: var(--good); }
.setup-step h3 { font-size: 13.5px; margin-bottom: 5px; }
.setup-step p { font-size: 12.5px; color: var(--muted); margin: 0; }
.setup-step .go {
  display: inline-flex; align-items: center; gap: 5px; margin-top: 11px;
  font-size: 12px; font-weight: 600; color: var(--accent);
}
@media (max-width: 900px) { .setup-grid { grid-template-columns: minmax(0,1fr); } }

/* --- misc ------------------------------------------------------------- */
.tabs a { display: inline-flex; align-items: center; gap: 6px; }
table.data tbody tr { transition: none; }
.chip .ic { width: 12px; height: 12px; flex: 0 0 12px; }
.dropzone { background: linear-gradient(160deg, #F7F9FD, var(--sunken)); }
.dropzone .empty-icon { margin-bottom: 12px; }

.grid.c1 { grid-template-columns: minmax(0,1fr); }

/* the upload box is one big target; the native input is hidden behind it */
.dropzone { display: block; cursor: pointer; position: relative; }
.dropzone input[type=file] {
  position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; cursor: pointer;
}
.dropzone strong { display: block; font-size: 14.5px; color: var(--ink); margin-bottom: 3px; }
.dropzone > span:not(.empty-icon) { display: block; font-size: 12.5px; color: var(--muted); }
.dropzone:hover, .dropzone.over { border-color: var(--accent); background: var(--accent-wash); }
.dropzone.has-file { border-style: solid; border-color: var(--good); background: var(--good-wash); }
.dropzone.has-file .empty-icon { background: #fff; color: var(--good); border-color: #A5DBD3; }


/* ==========================================================================
   REACH brand layer
   Deep midnight as the ground, teal as the working accent, gold reserved for
   value and for wins. The palette leans on the UAE enterprise-technology
   register rather than generic SaaS blue.
   ========================================================================== */
:root {
  --brand-deep:  #1A1F26;
  --brand-mid:   #0D2038;
  --teal:        #CF3339;
  --teal-bright: #E04A50;
  --gold:        #58606A;
  --gold-bright: #79828E;
  --gold-wash:   #FBF2DC;
  --violet:      #5B4B9E;
}

/* sidebar: deeper, with a teal-to-gold hairline down the edge */
.nav {
  background: linear-gradient(180deg, #0A1830 0%, var(--brand-deep) 62%, #050B1A 100%);
  position: relative;
}
.nav::after {
  content: ""; position: absolute; top: 0; right: 0; bottom: 0; width: 2px;
  background: linear-gradient(180deg, var(--teal-bright), var(--teal) 42%, var(--gold) 100%);
  opacity: .5;
}
.nav-brand .logo {
  background: linear-gradient(140deg, var(--teal-bright), var(--teal) 62%, #0A5A63);
  box-shadow: 0 4px 14px rgba(23,162,174,.4);
}
.nav a.nav-item.active {
  background: linear-gradient(90deg, rgba(23,162,174,.30), rgba(23,162,174,.05));
  box-shadow: inset 0 0 0 1px rgba(23,162,174,.24);
}
.nav a.nav-item.active .ic { color: var(--teal-bright); }
.nav-item .count.hot { color: #FFC98A; background: rgba(185,138,46,.28); }

/* the persona strip tells you whose view you are looking at */
.persona-bar {
  display: flex; align-items: center; gap: 13px; padding: 15px 18px;
  border-radius: var(--radius-lg); margin-bottom: 17px; color: #fff;
  background: linear-gradient(120deg, var(--brand-deep), var(--brand-mid) 58%, #14324F);
  position: relative; overflow: hidden;
}
.persona-bar::after {
  content: ""; position: absolute; right: -60px; top: -90px;
  width: 300px; height: 300px; border-radius: 50%;
  background: radial-gradient(circle, rgba(23,162,174,.34), transparent 68%);
}
.persona-bar .who { position: relative; z-index: 1; }
.persona-bar .who .h { font-size: 17px; font-weight: 650; letter-spacing: -0.02em; }
.persona-bar .who .s { font-size: 12.5px; color: #9FB2C9; margin-top: 2px; }
.persona-bar .avatar {
  width: 42px; height: 42px; flex: 0 0 42px; font-size: 14px;
  border: 2px solid rgba(255,255,255,.16); position: relative; z-index: 1;
}
.persona-bar .role-tag {
  margin-left: auto; position: relative; z-index: 1;
  background: rgba(23,162,174,.22); border: 1px solid rgba(23,162,174,.4);
  color: #7FE3EC; font-size: 11px; font-weight: 650; text-transform: uppercase;
  letter-spacing: .09em; padding: 5px 12px; border-radius: 20px;
}

/* stat cards in brand tones */
.stat.is-accent::before { background: linear-gradient(180deg, var(--teal-bright), var(--teal)); }
.stat.is-accent { background: linear-gradient(100deg, #E9F7F8 0%, var(--surface) 48%); }
.stat.is-good::before   { background: linear-gradient(180deg, #1CA378, var(--good)); }
.stat.is-alert::before  { background: linear-gradient(180deg, #E2683A, var(--overdue)); }
.stat .value.money-v { color: var(--gold); }
.stat.is-gold::before { background: linear-gradient(180deg, var(--gold-bright), var(--gold)); }
.stat.is-gold { background: linear-gradient(100deg, var(--gold-wash) 0%, var(--surface) 48%); }

.btn-primary {
  background: linear-gradient(180deg, var(--teal-bright), var(--teal));
  box-shadow: 0 1px 2px rgba(10,90,99,.3), 0 2px 9px rgba(14,124,134,.26);
}
.btn-primary:hover { background: linear-gradient(180deg, var(--teal), var(--accent-ink)); }

.welcome { background: linear-gradient(135deg, var(--brand-deep) 0%, #103049 52%, #0B4650 100%); }
.welcome::after { background: radial-gradient(circle, rgba(23,162,174,.4), transparent 66%); }
.auth-wrap { background: radial-gradient(1100px 620px at 50% -12%, #123A४6, var(--brand-deep)); }
.auth-wrap { background: radial-gradient(1100px 620px at 50% -12%, #113A46, var(--brand-deep)); }

/* queue panels on the persona dashboards */
.queue-list { padding: 0; }
.queue-row {
  display: flex; align-items: center; gap: 11px; padding: 11px 16px;
  border-bottom: 1px solid var(--rule-soft); text-decoration: none; color: inherit;
}
.queue-row:last-child { border-bottom: none; }
.queue-row:hover { background: var(--sunken); text-decoration: none; }
.queue-row .body { min-width: 0; flex: 1; }
.queue-row .t { font-size: 13px; font-weight: 550; color: var(--ink); display: block;
                overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.queue-row .c { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.queue-row .right { text-align: right; flex: 0 0 auto; }

/* task list */
.task-row { display: flex; align-items: flex-start; gap: 10px; padding: 10px 0;
            border-bottom: 1px solid var(--rule-soft); font-size: 12.5px; }
.task-row:last-child { border-bottom: none; }
.task-row .dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 5px;
                 flex: 0 0 8px; background: var(--teal); }
.task-row.late .dot { background: var(--overdue); }

/* activity feed */
.feed { position: relative; padding-left: 22px; }
.feed::before { content: ""; position: absolute; left: 6px; top: 4px; bottom: 4px;
                width: 2px; background: linear-gradient(180deg, var(--teal), var(--rule)); opacity:.3; }
.feed-item { position: relative; padding: 0 0 15px; font-size: 12.5px; }
.feed-item::before {
  content: ""; position: absolute; left: -22px; top: 3px; width: 11px; height: 11px;
  border-radius: 50%; background: var(--surface); border: 2px solid var(--teal);
}
.feed-item .w { font-family: var(--mono); font-size: 10.5px; color: var(--faint); }
.feed-item .s { color: var(--ink); font-weight: 500; margin-top: 1px; }
.feed-item .m { color: var(--muted); margin-top: 2px; }
.feed-kind {
  display: inline-block; font-size: 10px; font-weight: 650; text-transform: uppercase;
  letter-spacing: .07em; padding: 1px 7px; border-radius: 10px; margin-right: 6px;
  background: var(--accent-wash); color: var(--accent-ink);
}
.feed-kind.SALES { background: var(--gold-wash); color: #8A6418; }
.feed-kind.PRESALES { background: var(--accent-wash); color: var(--accent-ink); }
.feed-kind.BID_MANAGER { background: #EDE9FA; color: var(--violet); }
.feed-kind.EXECUTIVE { background: #E6EEF7; color: #24507C; }

/* ==========================================================================
   Workflow designer
   ========================================================================== */
.flow-head { font-size: 11px; font-weight: 680; text-transform: uppercase;
             letter-spacing: .1em; color: var(--faint); margin: 20px 0 11px; }
.flow-legend { display: flex; gap: 17px; flex-wrap: wrap; font-size: 12px;
               color: var(--muted); margin-bottom: 4px; }
.flow-legend .sw { width: 10px; height: 10px; border-radius: 3px; display: inline-block;
                   margin-right: 6px; vertical-align: -1px; }

.flow { display: flex; gap: 12px; overflow-x: auto; padding: 4px 2px 14px; align-items: stretch; }
.flow-stage {
  flex: 0 0 208px; background: var(--surface); border: 1px solid var(--rule);
  border-radius: var(--radius-lg); box-shadow: var(--shadow); position: relative;
  cursor: grab; display: flex; flex-direction: column; overflow: hidden;
}
.flow-stage.end { cursor: default; flex: 0 0 190px; }
.flow-stage.dragging { opacity: .35; }
.flow-stage.off { opacity: .45; }
.flow-stage .grip {
  position: absolute; top: 8px; right: 9px; color: var(--faint);
  font-size: 12px; letter-spacing: -2px; z-index: 2;
}
.flow-top { height: 4px; }
.flow-body { padding: 13px 14px 12px; display: flex; flex-direction: column; flex: 1; }
.flow-n { font-family: var(--mono); font-size: 10px; color: var(--faint); letter-spacing: .06em; }
.flow-name { font-size: 13.5px; font-weight: 650; color: var(--ink); margin: 3px 0 8px; line-height: 1.25; }
.flow-meta { display: flex; gap: 5px; flex-wrap: wrap; margin-bottom: 10px; }
.flow-gates { border-top: 1px solid var(--rule-soft); padding-top: 9px; flex: 1; }
.flow-gates.none { font-size: 11.5px; color: var(--faint); }
.gate-pill {
  display: inline-block; font-size: 10.5px; background: var(--accent-wash);
  color: var(--accent-ink); border-radius: 5px; padding: 2px 7px; margin: 0 3px 3px 0;
}
.flow-actions { display: flex; gap: 5px; padding-top: 10px; }

/* the editor panel */
.panel-wrap {
  position: fixed; inset: 0; background: rgba(7,16,38,.55); z-index: 60;
  display: none; align-items: flex-start; justify-content: center; padding: 40px 20px;
  overflow-y: auto; backdrop-filter: blur(3px);
}
.panel-wrap.open { display: flex; }
.panel {
  width: 100%; max-width: 620px; background: var(--surface);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
}
.panel-head {
  display: flex; align-items: center; padding: 15px 18px;
  border-bottom: 1px solid var(--rule-soft);
}
.panel-head h2 { flex: 1; font-size: 15px; }
.panel-body { padding: 18px; }
.gate-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 7px 14px; }
.gate-check { font-size: 12.5px; color: var(--ink-2); }
@media (max-width: 700px) { .gate-grid { grid-template-columns: minmax(0,1fr); } }

/* move matrix */
table.matrix th.rot { height: 116px; white-space: nowrap; vertical-align: bottom; padding: 0 0 8px; }
table.matrix th.rot span {
  display: inline-block; transform: rotate(-60deg); transform-origin: left bottom;
  width: 20px; font-size: 10px; letter-spacing: .04em;
}
table.matrix th.rowh { text-align: left; white-space: nowrap; font-size: 11.5px;
                       text-transform: none; letter-spacing: 0; color: var(--ink-2); }
table.matrix th.rowh .dot { width: 7px; height: 7px; border-radius: 50%;
                            display: inline-block; margin-right: 6px; }
td.mcell { text-align: center; cursor: pointer; font-weight: 700; width: 34px;
           border-left: 1px solid var(--rule-soft); }
td.mcell.yes { background: var(--good-wash); color: var(--good); }
td.mcell.no  { background: var(--surface); color: transparent; }
td.mcell.no:hover { background: var(--accent-wash); }
td.mcell.same { background: var(--sunken); color: var(--faint); cursor: default; }

/* workflow presets */
.preset-row { margin: 4px 0 16px; }
.preset-row .eyebrow { display: block; margin-bottom: 8px; }
.preset-cards { display: flex; gap: 11px; flex-wrap: wrap; }
.preset { margin: 0; }
.preset button {
  text-align: left; background: var(--surface); border: 1px solid var(--rule);
  border-radius: var(--radius-lg); padding: 13px 15px; cursor: pointer;
  max-width: 320px; font-family: inherit; box-shadow: var(--shadow);
}
.preset button:hover { border-color: var(--accent); box-shadow: var(--shadow-lg); }
.preset button strong { display: block; font-size: 13.5px; color: var(--ink); margin-bottom: 3px; }
.preset button span { font-size: 12px; color: var(--muted); line-height: 1.45; }

/* ---------------------------------------------------------- branding ---- */
.brand-logo { max-height: 34px; max-width: 168px; object-fit: contain; }
.brand-logo.on-plate { background: #fff; padding: 5px 8px; border-radius: 7px; }
.auth-logo { max-height: 46px; max-width: 220px; object-fit: contain; margin-bottom: 22px; }

.brand-upload { display: flex; gap: 15px; align-items: center; }
.brand-preview {
  width: 96px; height: 60px; flex: 0 0 96px; border-radius: var(--radius);
  border: 1px solid var(--rule); display: flex; align-items: center;
  justify-content: center; overflow: hidden; background: var(--sunken);
}
.brand-preview.dark { background: var(--brand-deep); }
.brand-preview img { max-width: 84px; max-height: 48px; object-fit: contain; }
.brand-preview span { font-family: var(--mono); font-weight: 700; color: var(--faint); }

.swatch-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 11px; }
.swatch { display: flex; align-items: center; gap: 11px; padding: 9px 11px;
          border: 1px solid var(--rule); border-radius: var(--radius); cursor: pointer; }
.swatch:hover { border-color: var(--accent); }
.swatch input[type=color] {
  width: 40px; height: 34px; flex: 0 0 40px; padding: 2px; cursor: pointer;
  border-radius: 6px; border: 1px solid var(--rule);
}
.sw-label { font-size: 12.5px; font-weight: 550; color: var(--ink-2); }
.sw-hint { display: block; font-size: 11px; color: var(--muted); font-weight: 400; margin-top: 1px; }
@media (max-width: 900px) { .swatch-grid { grid-template-columns: minmax(0,1fr); } }

/* live preview */
.brand-demo {
  --p-deep:#071026; --p-primary:#0E7C86; --p-bright:#17A2AE; --p-accent:#B98A2E;
  --p-good:#12795C; --p-warn:#A85B08; --p-danger:#C2410C; --p-page:#EDF1F6;
  --p-radius:12px;
  display: flex; border-radius: var(--p-radius); overflow: hidden;
  border: 1px solid var(--rule); font-size: 10px; min-height: 210px;
}
.d-nav { width: 84px; flex: 0 0 84px; background: var(--p-deep); padding: 9px 7px; }
.d-logo { height: 20px; border-radius: 5px; margin-bottom: 10px;
          background: linear-gradient(140deg, var(--p-bright), var(--p-primary)); }
.d-item { color: #93A1B8; padding: 4px 6px; border-radius: 4px; margin-bottom: 2px; }
.d-item.active { background: color-mix(in srgb, var(--p-primary) 34%, transparent); color: #fff; }
.d-main { flex: 1; background: var(--p-page); padding: 9px; }
.d-stats { display: flex; gap: 6px; margin-bottom: 7px; }
.d-stat { flex: 1; background: #fff; border-radius: calc(var(--p-radius) - 4px);
          padding: 6px 7px; border-left: 3px solid var(--rule); }
.d-stat.alert { border-left-color: var(--p-danger); }
.d-stat.accent { border-left-color: var(--p-primary); }
.d-stat i { display: block; font-style: normal; color: #8B95A8; font-size: 8px;
            text-transform: uppercase; letter-spacing: .08em; }
.d-stat b { font-size: 15px; letter-spacing: -0.04em; }
.d-stat.alert b { color: var(--p-danger); }
.d-stat.accent b { color: var(--p-accent); }
.d-card { background: #fff; border-radius: calc(var(--p-radius) - 4px); padding: 4px 8px; margin-bottom: 7px; }
.d-row { display: flex; justify-content: space-between; padding: 5px 0;
         border-bottom: 1px solid #EEF1F6; }
.d-row:last-child { border-bottom: none; }
.d-row em { font-style: normal; padding: 1px 6px; border-radius: 9px; font-size: 9px; }
.d-row em.late { background: color-mix(in srgb, var(--p-danger) 14%, #fff); color: var(--p-danger); }
.d-row em.soon { background: color-mix(in srgb, var(--p-warn) 15%, #fff); color: var(--p-warn); }
.d-row em.ok   { background: #F1F4F9; color: #7A8699; }
.d-btns { display: flex; gap: 5px; }
.d-btn { background: #fff; border: 1px solid #DDE3EC; border-radius: 5px; padding: 4px 8px; }
.d-btn.primary { background: linear-gradient(180deg, var(--p-bright), var(--p-primary));
                 border-color: var(--p-primary); color: #fff; }

/* ------------------------------------------------------ command palette */
.searchbar {
  display: flex; align-items: center; gap: 8px; cursor: pointer;
  background: var(--sunken); border: 1px solid var(--rule);
  border-radius: 20px; padding: 6px 12px; font-family: inherit;
  font-size: 12.5px; color: var(--muted); min-width: 210px;
}
.searchbar:hover { border-color: var(--accent); color: var(--ink-2); }
.searchbar span { flex: 1; text-align: left; }
.searchbar kbd, .empty kbd {
  font-family: var(--mono); font-size: 10px; background: var(--surface);
  border: 1px solid var(--rule); border-radius: 4px; padding: 1px 5px; color: var(--faint);
}
.palette-wrap {
  position: fixed; inset: 0; background: rgba(7,16,38,.5); z-index: 90;
  display: none; align-items: flex-start; justify-content: center;
  padding: 90px 20px 20px; backdrop-filter: blur(4px);
}
.palette-wrap.open { display: flex; }
.palette {
  width: 100%; max-width: 620px; background: var(--surface);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); overflow: hidden;
}
.palette-input { display: flex; align-items: center; gap: 11px; padding: 15px 18px;
                 border-bottom: 1px solid var(--rule-soft); }
.palette-input .ic { color: var(--faint); }
.palette-input input { border: none; padding: 0; font-size: 15px; background: transparent; }
.palette-input input:focus { outline: none; }
.palette-results { max-height: 60vh; overflow-y: auto; }
.palette-hint { padding: 26px 18px; text-align: center; color: var(--faint); font-size: 12.5px; }
.palette-row {
  display: flex; align-items: center; gap: 12px; padding: 10px 18px;
  border-bottom: 1px solid var(--rule-soft); text-decoration: none; color: inherit;
}
.palette-row:hover, .palette-row.on { background: var(--accent-wash); text-decoration: none; }
.palette-row .pk { font-size: 9.5px; font-weight: 680; text-transform: uppercase;
                   letter-spacing: .08em; color: var(--accent-ink);
                   background: var(--accent-wash); border-radius: 10px;
                   padding: 2px 8px; flex: 0 0 auto; min-width: 78px; text-align: center; }
.palette-row .pb { flex: 1; min-width: 0; }
.palette-row .pb b { display: block; font-size: 13px; font-weight: 550; color: var(--ink);
                     overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.palette-row .pb i { font-style: normal; font-size: 11.5px; color: var(--muted); }
.palette-row .pm { font-size: 11px; color: var(--faint); flex: 0 0 auto; }
.palette-all { display: block; padding: 11px 18px; text-align: center; font-size: 12.5px;
               color: var(--accent); font-weight: 550; }
@media (max-width: 780px) { .searchbar { min-width: 0; } .searchbar span, .searchbar kbd { display: none; } }

/* a logo that fails to load should not leave a broken icon in the sidebar */
.brand-logo { min-height: 22px; }
.nav-brand { min-height: 44px; }


/* ==========================================================================
   REACH palette, sampled from the 2026 company profile
     #CF3339  logo red        #58606A  wordmark slate
     #1A1F26  dark slide bg   #F2F3F5  page grey
   The diagonal geometry on the slides is echoed once, on the sidebar edge,
   rather than everywhere — a deck can carry it, an application worked in all
   day cannot.
   ========================================================================== */
:root {
  --reach-red:   #CF3339;
  --reach-slate: #58606A;
  --reach-ink:   #1A1F26;
}
.nav { background: linear-gradient(180deg, #232A33 0%, var(--reach-ink) 58%, #12161C 100%); }
.nav::after {
  background: linear-gradient(180deg, var(--reach-red), #9E2228 55%, var(--reach-slate));
  opacity: .75; width: 3px;
}
.nav-brand .logo { background: linear-gradient(140deg, #E04A50, var(--reach-red) 62%, #A8262C); }
.nav a.nav-item.active .ic { color: #F1868A; }

/* ---------------------------------------------------------- roles ------- */
.role-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 15px; }
.role-card {
  display: flex; background: var(--surface); border: 1px solid var(--rule);
  border-radius: var(--radius-lg); overflow: hidden; text-decoration: none;
  color: inherit; box-shadow: var(--shadow);
}
.role-card:hover { border-color: var(--accent); box-shadow: var(--shadow-lg); text-decoration: none; }
.role-card.off { opacity: .55; }
.role-card .bar { width: 5px; flex: 0 0 5px; }
.rc-body { padding: 15px 17px; flex: 1; min-width: 0; }
.rc-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.rc-head h3 { font-size: 14.5px; }
.rc-desc { font-size: 12.5px; color: var(--muted); margin-bottom: 10px; line-height: 1.45; }
.rc-meta { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 11px; }
.rc-perms { border-top: 1px solid var(--rule-soft); padding-top: 10px; }
.rc-group { font-size: 11.5px; color: var(--muted); padding: 2px 0; }
.rc-group b { color: var(--ink-2); font-weight: 600; }

.scope-option {
  display: flex; gap: 11px; align-items: flex-start; padding: 12px 14px;
  border: 1px solid var(--rule); border-radius: var(--radius);
  margin-bottom: 9px; cursor: pointer;
}
.scope-option.on { border-color: var(--accent); background: var(--accent-wash); }
.scope-option input { width: auto; margin-top: 3px; }
.scope-option b { display: block; font-size: 13px; color: var(--ink); }
.scope-option i { font-style: normal; font-size: 12px; color: var(--muted); line-height: 1.45; }

.perm-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 9px 16px; }
.perm { display: flex; gap: 9px; align-items: flex-start; cursor: pointer; }
.perm input { width: auto; margin-top: 3px; flex: 0 0 auto; }
.perm b { display: block; font-size: 12.5px; font-weight: 500; color: var(--ink-2); }
.perm i { font-style: normal; font-size: 11px; color: var(--faint); line-height: 1.4; }
@media (max-width: 820px) { .perm-grid { grid-template-columns: minmax(0,1fr); } }

.board-more { display: block; text-align: center; font-size: 11.5px; padding: 9px 0;
              color: var(--accent); font-weight: 550; }

/* two-factor */
.tfa-qr { display: flex; justify-content: center; padding: 14px;
          background: #fff; border: 1px solid var(--rule); border-radius: var(--radius-lg); }
.tfa-qr svg { width: 200px; height: 200px; }
.code-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 9px; margin-top: 13px; }
.code-grid span { background: var(--sunken); border: 1px solid var(--rule);
                  border-radius: var(--radius); padding: 9px; text-align: center;
                  font-size: 13px; letter-spacing: .04em; }
@media (max-width: 700px) { .code-grid { grid-template-columns: repeat(2, minmax(0,1fr)); } }


/* ==========================================================================
   Application shell — navigation, accessibility, and responsive behaviour
   ========================================================================== */

.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.skip-link {
  position: fixed;
  top: 10px;
  left: 12px;
  z-index: 200;
  transform: translateY(-160%);
  padding: 10px 14px;
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  border: 2px solid var(--accent);
  box-shadow: var(--shadow-lg);
  font-weight: 650;
}
.skip-link:focus { transform: translateY(0); text-decoration: none; }

body.nav-open,
body.palette-open { overflow: hidden; }

button { font: inherit; }

:where(a, button, input, select, textarea, [tabindex]):focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
  box-shadow: 0 0 0 3px var(--focus-ring);
}

#main-content:focus-visible {
  outline-offset: -3px;
  border-radius: var(--radius-lg);
}

/* The default Reach colours still come from Branding. These semantic rules
   ensure a new organisation colour updates every active shell state. */
.nav {
  background: linear-gradient(
    180deg,
    color-mix(in srgb, var(--brand-deep) 88%, white) 0%,
    var(--brand-deep) 58%,
    color-mix(in srgb, var(--brand-deep) 82%, black) 100%
  );
  color: var(--nav-text);
  z-index: 80;
}
.nav::after {
  background: linear-gradient(180deg, var(--accent), var(--accent-ink) 55%, var(--gold));
  opacity: .78;
}
.nav-brand {
  color: inherit;
  text-decoration: none;
}
.nav-brand:hover { text-decoration: none; background: rgba(255,255,255,.025); }
.nav-brand:focus-visible { outline-color: #fff; outline-offset: -4px; }
.nav-brand .logo {
  background: linear-gradient(140deg, var(--teal-bright), var(--accent) 62%, var(--accent-ink));
  box-shadow: 0 4px 14px color-mix(in srgb, var(--accent) 36%, transparent);
}
.nav a.nav-item {
  min-height: 38px;
  transition: background-color .14s ease, color .14s ease, box-shadow .14s ease;
}
.nav a.nav-item.active {
  background: linear-gradient(90deg, var(--nav-active-bg), transparent);
  border-left-color: var(--nav-active-edge);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 22%, transparent);
}
.nav a.nav-item.active .ic { color: var(--teal-bright); }
.nav a.nav-item:focus-visible {
  outline-color: #fff;
  outline-offset: -3px;
  box-shadow: inset 0 0 0 2px color-mix(in srgb, #fff 70%, transparent);
}
.nav-foot .role { display: block; }
.nav-foot .links a,
.nav-foot .links button { border-radius: 4px; }
.nav-foot .links a:focus-visible,
.nav-foot .links button:focus-visible { outline-color: #fff; }

.mobile-nav-toggle,
.nav-overlay { display: none; }
.mobile-nav-toggle {
  width: var(--touch-target);
  height: var(--touch-target);
  flex: 0 0 var(--touch-target);
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
}
.menu-bars,
.menu-bars::before,
.menu-bars::after {
  display: block;
  width: 19px;
  height: 2px;
  border-radius: 2px;
  background: currentColor;
}
.menu-bars { position: relative; }
.menu-bars::before,
.menu-bars::after { content: ""; position: absolute; left: 0; }
.menu-bars::before { top: -6px; }
.menu-bars::after { top: 6px; }

.topbar {
  min-height: 66px;
  border-bottom-color: color-mix(in srgb, var(--rule) 82%, transparent);
}
.topbar .title-wrap { overflow: hidden; }
.topbar .title-wrap h1 { overflow-wrap: anywhere; }
.topbar-tools,
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.topbar-actions:empty { display: none; }
.topbar-actions .btn { white-space: nowrap; }

.searchbar {
  min-height: 38px;
  transition: border-color .14s ease, background-color .14s ease, color .14s ease;
}
.searchbar:hover { background: var(--surface); }

.content { margin: 0 auto; }
.card-body,
.card-head { min-width: 0; }
.card-head { flex-wrap: wrap; }
.table-wrap {
  max-width: 100%;
  overscroll-behavior-x: contain;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
  scrollbar-color: var(--rule) transparent;
}
.table-wrap::-webkit-scrollbar { height: 9px; }
.table-wrap::-webkit-scrollbar-thumb { background: var(--rule); border-radius: 10px; }
.table-wrap::-webkit-scrollbar-track { background: transparent; }

/* Search dialog */
.palette-wrap { background: var(--scrim); }
.palette {
  border: 1px solid color-mix(in srgb, var(--rule) 74%, transparent);
  box-shadow: 0 22px 64px rgba(7,16,38,.24), var(--shadow-lg);
}
.palette-input input[type=search] {
  min-width: 0;
  appearance: none;
  -webkit-appearance: none;
}
.palette-input input[type=search]::-webkit-search-cancel-button { display: none; }
.palette-close {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}
.palette-close:hover { color: var(--ink); background: var(--sunken); }
.palette-row,
.palette-all { min-height: 44px; }
.palette-hint.is-loading::before {
  content: "";
  display: inline-block;
  width: 9px;
  height: 9px;
  margin-right: 8px;
  border: 2px solid var(--rule);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: shell-spin .7s linear infinite;
}
@keyframes shell-spin { to { transform: rotate(360deg); } }

/* Authentication */
.auth-wrap {
  position: relative;
  isolation: isolate;
  background:
    radial-gradient(750px 470px at 14% 5%, color-mix(in srgb, var(--accent) 30%, transparent), transparent 64%),
    radial-gradient(700px 500px at 92% 105%, color-mix(in srgb, var(--gold) 19%, transparent), transparent 68%),
    linear-gradient(145deg, color-mix(in srgb, var(--brand-deep) 86%, white), var(--brand-deep));
}
.auth-wrap::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  opacity: .22;
  background-image:
    linear-gradient(rgba(255,255,255,.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.055) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: linear-gradient(to bottom, #000, transparent 76%);
}
.auth-card {
  position: relative;
  max-width: 410px;
  padding: 34px;
  border: 1px solid rgba(255,255,255,.54);
  box-shadow: 0 24px 70px rgba(0,0,0,.27), 0 2px 8px rgba(0,0,0,.1);
  overflow: hidden;
}
.auth-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--accent), var(--teal-bright), var(--gold));
}
.auth-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 46px;
  margin-bottom: 28px;
}
.auth-brand .mark { display: block; font-family: var(--sans); color: var(--ink); }
.auth-brand .org { display: block; margin: 2px 0 0; }
.auth-mark {
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  border-radius: 11px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-family: var(--mono);
  font-weight: 750;
  background: linear-gradient(145deg, var(--teal-bright), var(--accent-ink));
  box-shadow: 0 7px 18px color-mix(in srgb, var(--accent) 27%, transparent);
}
.auth-logo { margin: 0; }
.auth-heading { margin-bottom: 22px; }
.auth-heading h1 { font-size: 24px; margin-bottom: 6px; }
.auth-heading p { color: var(--muted); font-size: 13.5px; margin: 0; }
.auth-form .field { margin-bottom: 16px; }
.auth-form input { min-height: 44px; font-size: 15px; }
.auth-submit { width: 100%; min-height: 44px; margin-top: 3px; }
.auth-help {
  margin: 18px 0 0;
  padding-top: 16px;
  border-top: 1px solid var(--rule-soft);
  color: var(--muted);
  font-size: 11.5px;
  text-align: center;
}

@media (max-width: 880px) {
  .js-ready .shell { flex-direction: row; }
  .js-ready .mobile-nav-toggle { display: inline-flex; }
  .js-ready .nav {
    display: flex;
    width: min(86vw, 320px);
    max-width: 320px;
    height: 100vh;
    height: 100dvh;
    position: fixed;
    inset: 0 auto 0 0;
    flex: 0 0 auto;
    flex-direction: column;
    flex-wrap: nowrap;
    align-items: stretch;
    gap: 0;
    padding: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    transform: translateX(-102%);
    visibility: hidden;
    box-shadow: 18px 0 50px rgba(7,16,38,.3);
    transition: transform .22s ease, visibility 0s linear .22s;
  }
  .js-ready.nav-open .nav {
    transform: translateX(0);
    visibility: visible;
    transition-delay: 0s;
  }
  .js-ready .nav-brand {
    padding: 18px 17px 17px;
    border-bottom: 1px solid rgba(255,255,255,.08);
  }
  .js-ready .nav .nav-group { display: block; padding: 14px 0 4px; overflow: visible; }
  .js-ready .nav .nav-group-label { display: block; }
  .js-ready .nav a.nav-item {
    min-height: var(--touch-target);
    margin-right: 9px;
    padding: 10px 16px;
    border-left: 2px solid transparent;
    border-radius: 0 8px 8px 0;
  }
  .js-ready .nav a.nav-item.active { border-left-color: var(--nav-active-edge); }
  .js-ready .nav-foot {
    margin-top: auto;
    padding: 14px 18px;
    border-top: 1px solid rgba(255,255,255,.08);
  }
  .js-ready .nav-foot .links { gap: 8px; }
  .js-ready .nav-foot .links a,
  .js-ready .nav-foot .links button { min-height: var(--touch-target); padding: 8px 6px; }
  .js-ready .nav-overlay {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 70;
    width: 100%;
    height: 100%;
    padding: 0;
    border: 0;
    background: var(--scrim);
    backdrop-filter: blur(2px);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    cursor: default;
    transition: opacity .2s ease, visibility 0s linear .2s;
  }
  .js-ready.nav-open .nav-overlay {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transition-delay: 0s;
  }

  .main { width: 100%; }
  .topbar { min-height: 64px; padding: 10px 12px; gap: 10px; }
  .topbar .title-wrap { flex: 1 1 auto; }
  .topbar .title-wrap h1 { font-size: clamp(18px, 4.2vw, 23px); }
  .topbar .spacer { display: none; }
  .topbar-tools { flex: 0 1 auto; }
  .topbar-actions { max-width: 48vw; overflow-x: auto; scrollbar-width: none; }
  .topbar-actions::-webkit-scrollbar { display: none; }
  .searchbar {
    width: var(--touch-target);
    min-width: var(--touch-target);
    min-height: var(--touch-target);
    padding: 0;
    justify-content: center;
    border-radius: var(--radius);
  }
  .searchbar span,
  .searchbar kbd { display: none; }
  .content { padding: 18px 14px 48px; }

  .grid.c2,
  .grid.c3,
  .grid.c4 { grid-template-columns: minmax(0,1fr); }
  .field-row,
  .field-row.c3 { grid-template-columns: minmax(0,1fr); }
  .card { max-width: 100%; }
  .card-head { padding: 14px; }
  .card-body { padding: 14px; }
  table.data { min-width: 640px; }
  .tabs { overflow-x: auto; scrollbar-width: none; }
  .tabs::-webkit-scrollbar { display: none; }
  .tabs a,
  .pagination a,
  .pagination .btn,
  .btn,
  button:not(.nav-overlay),
  input:not([type=checkbox]):not([type=radio]):not([type=file]),
  select { min-height: var(--touch-target); }
  .pagination { flex-wrap: wrap; }
  .checkline { min-height: var(--touch-target); }
  .checkline input,
  input[type=checkbox],
  input[type=radio] { width: 20px; height: 20px; }
}

@media (max-width: 560px) {
  .topbar { gap: 8px; }
  .topbar .sub { display: none; }
  .topbar-actions { max-width: 42vw; }
  .content { padding: 14px 10px 42px; }
  .card-head,
  .card-body { padding-left: 12px; padding-right: 12px; }
  .palette-wrap { align-items: flex-start; padding: 12px; }
  .palette { max-height: calc(100vh - 24px); max-height: calc(100dvh - 24px); }
  .palette-input { padding: 11px 12px; }
  .palette-results { max-height: calc(100vh - 90px); max-height: calc(100dvh - 90px); }
  .palette-row { padding: 11px 12px; gap: 8px; }
  .palette-row .pk { min-width: 62px; padding-inline: 6px; }
  .palette-row .pm { display: none; }
  .auth-wrap { padding: 14px; align-items: center; }
  .auth-card { padding: 28px 22px 24px; }
  .auth-brand { margin-bottom: 23px; }
  .auth-heading h1 { font-size: 22px; }
}

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

@media print {
  .mobile-nav-toggle,
  .nav-overlay,
  .skip-link,
  .searchbar,
  .palette-wrap { display: none !important; }
}

/* Density is an installation-level preference. Keep the scale in one custom
   property and apply it to the recurring vertical rhythm; mobile controls retain
   their 44px minimum target even in compact mode. */
:root {
  --density-1: calc(4px * var(--density));
  --density-2: calc(7px * var(--density));
  --density-3: calc(10px * var(--density));
  --density-4: calc(14px * var(--density));
  --density-5: calc(18px * var(--density));
  --density-6: calc(22px * var(--density));
}

.topbar { padding-block: var(--density-4); }
.content {
  padding-block-start: var(--density-6);
  padding-block-end: calc(60px * var(--density));
}
.nav-group { padding-block-start: var(--density-4); }
.nav a.nav-item { padding-block: var(--density-2); }
.nav-foot { padding-block: var(--density-4); }
.card-head { padding-block: var(--density-3); }
.card-body { padding-block: var(--density-4); }
.stat { padding-block: calc(15px * var(--density)); }
table.data th,
table.data td { padding-block: calc(9px * var(--density)); }
.btn { padding-block: var(--density-2); }
.btn-sm { padding-block: var(--density-1); }
input[type=text], input[type=number], input[type=date], input[type=email],
input[type=url], input[type=password], input[type=search], select, textarea {
  padding-block: var(--density-2);
}
.field { margin-bottom: var(--density-4); }
.filters { padding-block: calc(13px * var(--density)); }
.tabs a { padding-block: calc(9px * var(--density)); }
.msg { padding-block: var(--density-3); }
.queue-row { padding-block: calc(11px * var(--density)); }
.task-row,
.note-item { padding-block: var(--density-3); }
.pagination { padding-block: calc(12px * var(--density)); }
.form-actions { padding-top: calc(16px * var(--density)); }
.palette-row { padding-block: var(--density-3); }

/* Mobile workspaces: retain the full desktop view and make the same records
   comfortable to read and act on with a phone, touch, or a keyboard. */
.mobile-dock, .nav-drawer-close, .filter-toggle { display: none; }
.app-version { margin-top: 8px; color: var(--nav-text-muted); font-size: 10.5px; }
[hidden] { display: none !important; }
.grid > *, .field, fieldset { min-width: 0; }
.grid > .card + .card { margin-top: 0; }
.workspace-tabs { flex-wrap: wrap; }
.scroll-hint {
  padding: 8px 12px; margin: 0; font-size: 12px;
  color: var(--muted); background: var(--sunken);
}
.form-error-summary ul { margin: 8px 0 0; padding-left: 20px; }
.form-error-summary a { color: inherit; text-decoration: underline; }
.page-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.page-actions .btn { white-space: normal; overflow-wrap: anywhere; min-width: 0; }
.attachment-form-grid { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1.4fr) auto; gap: 10px; align-items: end; }
.board-tools { display: flex; align-items: center; gap: 12px; margin: 0 0 14px; }
.board-tools label { font-weight: 600; color: var(--ink-2); white-space: nowrap; }
.board-tools select { width: auto; min-width: 180px; max-width: 100%; }
.board-tools .hint { color: var(--muted); font-size: 12px; }
.board-card .board-move { margin-top: 10px; width: 100%; }
.board-col { scroll-margin-inline: 4px; }
.board-dialog {
  width: min(440px, calc(100vw - 28px)); max-height: calc(100dvh - 32px);
  overflow-y: auto; padding: 24px; margin: auto; border: 1px solid var(--rule);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
  color: var(--ink); background: var(--surface);
}
.board-dialog::backdrop { background: var(--scrim); }
.board-dialog h2 { font-size: 20px; margin: 0 0 8px; }
.board-dialog p { overflow-wrap: anywhere; color: var(--muted); }
.board-dialog .field { margin-top: 20px; }
.board-dialog .form-actions { flex-wrap: wrap; }
.board-dialog .msg { margin-top: 12px; }

@media (max-width: 880px) {
  html { scroll-padding-block: 145px 90px; }
  .topbar {
    display: grid; grid-template-columns: 44px minmax(0, 1fr) 44px;
    align-items: center; gap: 8px 10px;
    padding: max(10px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) 10px max(12px, env(safe-area-inset-left));
  }
  .topbar .title-wrap { grid-column: 2; }
  .topbar .title-wrap h1 { line-height: 1.2; }
  .topbar .sub { display: block; font-size: 11.5px; overflow-wrap: anywhere; }
  .topbar-tools { display: contents; }
  .topbar .searchbar { grid-column: 3; grid-row: 1; }
  .topbar-actions {
    grid-column: 1 / -1; max-width: none; width: 100%; flex-wrap: wrap;
    overflow: visible; gap: 7px; padding-top: 3px;
  }
  .topbar-actions .btn { flex: 1 1 auto; min-width: 0; }
  .topbar-actions .btn-primary { order: -1; }
  .content {
    padding: 16px max(12px, env(safe-area-inset-right)) calc(92px + env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
  }
  .mobile-dock {
    display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
    position: fixed; inset: auto 0 0; z-index: 35;
    border-top: 1px solid var(--rule); background: var(--surface);
    box-shadow: 0 -3px 18px rgba(7,16,38,.06);
    padding: 5px max(6px, env(safe-area-inset-right)) max(5px, env(safe-area-inset-bottom)) max(6px, env(safe-area-inset-left));
  }
  .mobile-dock a {
    display: flex; flex-direction: column; justify-content: center; align-items: center;
    gap: 4px; min-height: 54px; padding: 6px 2px; border-radius: 8px;
    color: var(--ink-3); font-size: 11.5px; font-weight: 600; text-decoration: none;
  }
  .mobile-dock a[aria-current="page"] { color: var(--accent-ink); background: var(--accent-wash); }
  .mobile-dock .ic { width: 21px; height: 21px; flex-basis: 21px; }
  .dock-count { display: inline-block; margin-left: 3px; padding: 0 5px; border-radius: 12px; background: var(--critical); color: #fff; font-size: 10px; }
  .nav-open .mobile-dock, .palette-open .mobile-dock { visibility: hidden; }
  .js-ready .nav-drawer-close {
    display: flex; align-items: center; justify-content: center;
    position: absolute; top: max(9px, env(safe-area-inset-top)); right: 8px; z-index: 2;
    width: 44px; height: 44px; padding: 0; background: rgba(255,255,255,.08);
    color: #fff; border: 1px solid rgba(255,255,255,.2); border-radius: 7px;
    font-size: 26px; cursor: pointer;
  }
  .js-ready .nav-brand { padding-right: 62px; padding-top: max(18px, env(safe-area-inset-top)); }
  .js-ready .nav-foot { padding-bottom: max(14px, env(safe-area-inset-bottom)); }
  .grid.c4 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .grid > .card + .card { margin-top: 0; }
  .stat { padding: 14px 12px; }
  .stat .value { font-size: 28px; overflow-wrap: anywhere; }
  .stat .value.sm { font-size: clamp(16px, 3.8vw, 23px); }
  .stat .label, .stat .foot { overflow-wrap: anywhere; }
  input:not([type=checkbox]):not([type=radio]), select, textarea,
  .filters input, .filters select, .auth-form input {
    font-size: 16px; max-width: 100%; min-width: 0;
  }
  textarea { min-height: 112px; }
  input[type=datetime-local], input[type=time], input[type=date] { min-height: 44px; width: 100%; }
  input[type=file] { width: 100%; font-size: 14px; }
  input[type=file]::file-selector-button { min-height: 44px; margin-right: 8px; }
  .field > label { font-size: 13px; }
  .attachment-form-grid { grid-template-columns: minmax(0,1fr); }
  .field .hint, .field .err { font-size: 12.5px; overflow-wrap: anywhere; }
  .form-actions { flex-wrap: wrap; gap: 8px; }
  .form-actions > .btn { flex: 1 1 auto; }
  .tabs a { flex-shrink: 0; align-items: center; }
  .workspace-tabs { flex-wrap: nowrap; }
  .rail { gap: 6px; scroll-snap-type: x proximity; }
  .rail-step { flex: 0 0 120px; min-width: 120px; scroll-snap-align: start; }
  .rail-step .nm { overflow-wrap: anywhere; }
  .filters { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; padding: 12px; }
  .filters .f, .filters .f.grow { min-width: 0; grid-column: 1 / -1; }
  .filters > .btn { min-width: 0; }
  .js-ready .filter-toggle { display: inline-flex; grid-column: 1 / -1; justify-content: space-between; }
  .js-ready .filters:not(.is-expanded) [data-filter-secondary] { display: none; }
  .filters .f label { font-size: 11px; }
  .filters .f label.checkline { display: flex; text-transform: none; letter-spacing: normal; margin-bottom: 0; font-size: 13px; }
  .board { scroll-snap-type: x mandatory; overscroll-behavior-x: contain; padding: 2px 2px 14px; }
  .board-col { flex-basis: min(82vw, 330px); scroll-snap-align: start; max-height: 65vh; max-height: 65dvh; }
  .board-card { padding: 13px; cursor: auto; }
  .board-card .ttl { font-size: 14px; line-height: 1.45; min-height: 44px; }
  .board-card .cust { font-size: 12px; overflow-wrap: anywhere; }
  .board-tools { flex-wrap: wrap; gap: 7px; }
  .board-tools select { flex: 1; min-width: 0; }
  .board-tools .hint { flex-basis: 100%; }
  .board-dialog { padding: 20px; }
  .bar-row { grid-template-columns: minmax(0, 1fr) auto; gap: 5px 10px; margin-bottom: 14px; }
  .bar-row .lbl { white-space: normal; }
  .bar-row .val { grid-column: 2; grid-row: 1; }
  .bar-row .bar-track { grid-column: 1 / -1; grid-row: 2; }
  .persona-bar { flex-wrap: wrap; padding: 14px; gap: 10px; }
  .persona-bar .who { min-width: 0; flex: 1; overflow-wrap: anywhere; }
  .persona-bar .role-tag { margin-left: 0; max-width: 100%; }
  .queue-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 7px 9px; padding: 14px 12px; }
  .queue-row > .chip-stage { grid-column: 1 / -1; justify-self: start; }
  .queue-row .body { grid-column: 1; }
  .queue-row .t { white-space: normal; overflow-wrap: anywhere; }
  .queue-row .right { grid-column: 2; }
  .chip { max-width: 100%; }
  .chip-stage { white-space: normal; }
  .runway-axis { flex-wrap: wrap; gap: 6px; font-size: 10px; }
  table.data.compact-record-list { min-width: 0; }
  .compact-record-list .cell-title { max-width: none; }
  .compact-record-list .truncate { white-space: normal; overflow-wrap: anywhere; }
}

@media (max-width: 640px) {
  table.data.responsive-records, .responsive-records tbody { display: block; min-width: 0; width: 100%; }
  .responsive-records thead {
    position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
    overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap;
  }
  table.data.responsive-records tbody tr {
    display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
    padding: 14px 12px; gap: 11px 16px; border-bottom: 1px solid var(--rule);
  }
  table.data.responsive-records tbody tr:last-child { border-bottom: none; }
  table.data.responsive-records td {
    display: flex; flex-direction: column; align-items: flex-start; gap: 3px;
    padding: 0; border: 0; min-width: 0; max-width: none; text-align: left;
    overflow-wrap: anywhere;
  }
  .responsive-records td[data-label]::before {
    content: attr(data-label); font: 600 10px var(--sans); color: var(--ink-3);
    text-transform: uppercase; letter-spacing: .06em;
  }
  .responsive-records .record-primary, .responsive-records td[colspan] { grid-column: 1 / -1; }
  .responsive-records .record-primary { padding-bottom: 8px; border-bottom: 1px solid var(--rule-soft); }
  .responsive-records .row-link { font-size: 15px; line-height: 1.45; }
  .responsive-records td a { display: inline-flex; align-items: center; min-height: 44px; }
  .responsive-records .truncate { white-space: normal; overflow: visible; }
  .responsive-records .row-sub { font-size: 12px; }
  .pagination > span:first-child { flex-basis: 100%; }
  .pagination .spacer { display: none; }
  .pagination { justify-content: space-between; gap: 10px; }
}

@media (max-width: 359px) {
  .grid.c4 { grid-template-columns: minmax(0, 1fr); }
  .topbar-actions .btn { white-space: normal; }
}

@media print {
  .mobile-dock, .nav-drawer-close, .filter-toggle, .scroll-hint,
  .connectivity-status, .board-move, .board-tools { display: none !important; }
  .topbar { position: static; }
  .content { padding-bottom: 0; }
}
