:root {
  color-scheme: light;
  /* Brand ramp. --brand is overwritten at runtime from the client's brand_color
     by applyTheme(); these are calm defaults so the page is never unstyled. */
  --brand: #2f8f6b;
  --brand-strong: #246b50;
  --brand-soft: rgba(47, 143, 107, 0.12);
  --brand-ink: #ffffff;

  /* Warm neutral skin. Surfaces stay neutral so PEACE survives a loud brand. */
  --ink: #1f1c17;
  --muted: #7c7163;
  --line: #e7ded0;
  --paper: #f7f3ec;
  --white: #ffffff;
  --surface: #ffffff;
  --surface-soft: #f2ebdf;
  --surface-warm: #fbf4e6;
  --grid-line: transparent;
  --frame-line: transparent;
  --readout-bg: rgba(255, 255, 255, 0.92);
  --signal-bg: #f7f3ec;
  --signal-line: rgba(31, 28, 23, 0.06);
  --signal-sweep: var(--brand-soft);

  /* Accents point at the brand so retheming is a single value. */
  --mint: var(--brand);
  --cyan: var(--brand);
  --blue: var(--brand);
  --amber: #9c6a12;
  --red: #b4453a;
  --graphite: #2a241b;
  --panel: #fffdf9;
  --rail: #211d16;
  --shadow: 0 18px 50px rgba(58, 42, 20, 0.10);

  --radius: 14px;
  --radius-sm: 10px;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --ink: #f1ece1;
  --muted: #b3a896;
  --line: #3a342a;
  --paper: #16130e;
  --white: #1d1913;
  --surface: #211c15;
  --surface-soft: #2a241b;
  --surface-warm: #2a2417;
  --grid-line: transparent;
  --frame-line: transparent;
  --readout-bg: rgba(33, 28, 21, 0.92);
  --signal-bg: #16130e;
  --signal-line: rgba(241, 236, 225, 0.06);
  --signal-sweep: var(--brand-soft);
  --mint: var(--brand);
  --cyan: var(--brand);
  --blue: var(--brand);
  --amber: #d69a2d;
  --red: #f0837a;
  --graphite: #f1ece1;
  --panel: #1d1913;
  --rail: #0f0c08;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.40);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background:
    radial-gradient(120% 80% at 85% -10%, var(--brand-soft), transparent 60%),
    var(--paper);
  background-attachment: fixed;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 1px solid var(--line);
  background: var(--white);
  color: var(--ink);
  min-height: 38px;
  padding: 0 14px;
  border-radius: 12px;
  cursor: pointer;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

button:hover:not(:disabled) {
  transform: translateY(-1px);
  border-color: #9ba695;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.primary {
  background: var(--brand);
  color: var(--brand-ink);
  border-color: var(--brand);
}

.primary:hover:not(:disabled) {
  background: var(--brand-strong);
  border-color: var(--brand-strong);
}

.ghost {
  background: transparent;
}

.danger {
  color: var(--red);
  border-color: rgba(180, 61, 50, 0.28);
}

select,
input,
textarea {
  border: 1px solid var(--line);
  background: var(--white);
  color: var(--ink);
  min-height: 38px;
  padding: 0 12px;
  border-radius: 12px;
  width: 100%;
}

textarea {
  min-height: 92px;
  padding-top: 10px;
  resize: vertical;
}

.app-shell {
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  min-height: 100vh;
}

.rail {
  position: sticky;
  top: 0;
  height: 100vh;
  background: var(--rail);
  color: #e8edef;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 18px 14px;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 4px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.brand-lockup strong,
.brand-lockup span {
  display: block;
}

.brand-lockup strong {
  color: #fffdf7;
}

.brand-lockup span {
  color: #aeb9ad;
  font-size: 12px;
}

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: var(--brand);
  color: var(--brand-ink);
  font-weight: 800;
  font-size: 13px;
  flex: 0 0 auto;
}

.main-nav {
  display: grid;
  gap: 4px;
  overflow: auto;
  padding-bottom: 20px;
}

.nav-room {
  display: grid;
  gap: 2px;
  margin-bottom: 10px;
}

.nav-room-label {
  margin: 6px 10px 4px;
  color: rgba(239, 233, 221, 0.42);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.nav-button {
  min-height: 40px;
  width: 100%;
  border-color: transparent;
  background: transparent;
  color: #efe9dd;
  display: grid;
  align-items: center;
  text-align: left;
  padding: 6px 12px;
  border-radius: 10px;
  line-height: 1.25;
}

.nav-button:hover:not(:disabled) {
  transform: none;
  border-color: transparent;
}

.nav-button:hover:not(.active) {
  background: rgba(255, 255, 255, 0.05);
}

.nav-button strong {
  font-weight: 600;
  font-size: 14px;
}

.nav-button span {
  font-size: 11px;
  color: rgba(239, 233, 221, 0.48);
}

.nav-button.active {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
  box-shadow: inset 3px 0 0 var(--brand);
}

.nav-button.active span {
  color: rgba(255, 255, 255, 0.62);
}

.workspace {
  padding: clamp(18px, 3vw, 34px);
  display: grid;
  gap: 22px;
}

.command-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #efe9dd;
  border-radius: 10px;
  padding: 9px 12px;
  font-size: 13px;
}

.command-trigger:hover:not(:disabled) {
  transform: none;
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.16);
}

.command-trigger span {
  color: rgba(239, 233, 221, 0.5);
  font-size: 11px;
}

.command-palette {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(31, 28, 23, 0.45);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 12vh 16px 16px;
}

.command-palette[hidden] {
  display: none;
}

.command-panel {
  width: min(580px, 96vw);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.command-input {
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--line);
  padding: 16px 18px;
  font-size: 16px;
  background: transparent;
  color: var(--ink);
  border-radius: 0;
}

.command-input:focus {
  outline: none;
}

.command-results {
  list-style: none;
  margin: 0;
  padding: 6px;
  max-height: 52vh;
  overflow: auto;
}

.command-results li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  cursor: pointer;
}

.command-results li.selected,
.command-results li:hover {
  background: var(--brand-soft);
}

.command-results li strong {
  font-weight: 600;
}

.command-results li span {
  color: var(--muted);
  font-size: 12px;
}

.command-empty {
  color: var(--muted);
  justify-content: center !important;
  cursor: default !important;
}

.setup-wizard {
  max-width: 720px;
}

.setup-progress {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 4px;
}

.setup-wizard h2 {
  font-size: clamp(22px, 2.6vw, 28px);
  margin-bottom: 8px;
}

.setup-wizard .lede {
  margin-bottom: 22px;
}

.setup-options {
  display: grid;
  gap: 12px;
  margin-bottom: 24px;
}

.setup-option {
  display: grid;
  gap: 4px;
  text-align: left;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  min-height: 0;
}

.setup-option:hover:not(:disabled) {
  transform: none;
  border-color: var(--brand);
}

.setup-option.selected {
  border-color: var(--brand);
  box-shadow: inset 0 0 0 1px var(--brand), var(--shadow);
  background: var(--brand-soft);
}

.setup-option strong {
  font-size: 16px;
  font-weight: 600;
}

.setup-option span {
  color: var(--muted);
  font-size: 13px;
}

.platform-footer {
  color: var(--muted);
  font-size: 12px;
  padding: 8px 2px 2px;
  text-align: center;
}

.platform-footer a {
  color: var(--ink);
  font-weight: 900;
  text-decoration: none;
  border-bottom: 1px solid var(--mint);
}

.platform-footer a:hover {
  color: var(--mint);
}

.command {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 30vw);
  align-items: center;
  gap: 24px;
  padding: clamp(20px, 2.4vw, 30px) clamp(22px, 3vw, 34px);
  box-shadow: var(--shadow);
}

#signalCanvas {
  display: none;
}

.command-copy,
.readout-grid {
  position: relative;
  z-index: 1;
}

.eyebrow,
.kicker {
  margin: 0 0 8px;
  color: var(--blue);
  font-size: 12px;
  text-transform: uppercase;
  font-weight: 800;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  max-width: 820px;
  font-size: clamp(24px, 2.6vw, 31px);
  line-height: 1.1;
  margin-bottom: 8px;
  letter-spacing: -0.01em;
}

.lede {
  max-width: 760px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.5;
  margin: 0;
}

.readout-grid {
  display: grid;
  gap: 10px;
}

.readout {
  border: 1px solid var(--line);
  background: var(--readout-bg);
  padding: 16px;
  min-height: 78px;
}

.readout span {
  display: block;
  font-size: 30px;
  line-height: 1;
  font-weight: 900;
}

.readout label {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  font-weight: 800;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.panel,
.metric-card,
.portal-phone {
  background: var(--panel);
  border: 1px solid var(--line);
  min-width: 0;
  box-shadow: 0 8px 24px rgba(12, 18, 24, 0.06);
}

.panel-head {
  min-height: 72px;
  padding: 16px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.panel-head h2,
.panel-head h3 {
  margin: 0;
  font-size: 18px;
}

.panel-body {
  padding: 16px;
}

.command-band,
.ops-ribbon {
  display: grid;
  gap: 12px;
}

.ops-ribbon {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-column: 1 / -1;
}

.ops-node {
  border: 1px solid var(--line);
  background: var(--surface);
  padding: 14px;
  min-height: 102px;
}

.ops-node strong {
  display: block;
  font-size: 18px;
  margin-bottom: 6px;
}

.ops-node span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.dashboard-grid,
.module-grid,
.portal-grid,
.settings-grid {
  display: grid;
  gap: 16px;
}

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

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

.wide {
  grid-column: 1 / -1;
}

.metric-card {
  padding: 16px;
  min-height: 128px;
  position: relative;
  overflow: hidden;
}

.metric-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: var(--mint);
}

.metric-card strong {
  display: block;
  font-size: 32px;
  line-height: 1;
  margin-bottom: 10px;
}

.metric-card span {
  display: block;
  color: var(--muted);
  line-height: 1.45;
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.toolbar input {
  max-width: 320px;
}

.tab-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.tab-button {
  min-height: 34px;
  background: var(--surface);
}

.tab-button.active {
  background: var(--graphite);
  color: var(--white);
  border-color: var(--graphite);
}

.record-table-wrap {
  overflow: auto;
  max-height: 560px;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 10px;
  text-align: left;
  vertical-align: top;
  font-size: 13px;
}

th {
  position: sticky;
  top: 0;
  background: var(--surface-soft);
  z-index: 1;
}

.list-stack {
  display: grid;
  gap: 10px;
}

.list-item,
.work-card,
.portal-request {
  border: 1px solid var(--line);
  background: var(--surface);
  padding: 12px;
}

.list-item strong,
.work-card strong,
.portal-request strong {
  display: block;
  margin-bottom: 5px;
}

.meta-line {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.kanban {
  display: grid;
  grid-template-columns: repeat(5, minmax(200px, 1fr));
  gap: 12px;
  overflow-x: auto;
}

.dispatch-hint {
  color: var(--muted);
  font-size: 13px;
  margin: 0 0 10px;
}

.dispatch-calendar {
  display: grid;
  grid-template-columns: repeat(7, minmax(150px, 1fr));
  gap: 10px;
  overflow: auto;
  margin-bottom: 14px;
}

.calendar-day {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  min-height: 138px;
  padding: 10px;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.calendar-day.drop-target {
  border-color: var(--brand);
  background: var(--brand-soft);
  box-shadow: inset 0 0 0 1px var(--brand);
}

.calendar-day-head strong,
.calendar-day-head span,
.calendar-job small {
  display: block;
}

.calendar-day-head span {
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 8px;
}

.calendar-day-jobs {
  display: grid;
  gap: 7px;
  min-height: 40px;
}

.calendar-job {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  padding: 8px 9px;
  font-size: 12px;
  font-weight: 800;
  overflow-wrap: anywhere;
  cursor: grab;
  touch-action: none;
  user-select: none;
}

.calendar-job:active {
  cursor: grabbing;
}

.calendar-job.dragging {
  opacity: 0.4;
}

.calendar-job small {
  color: var(--muted);
  font-weight: 700;
  margin-top: 2px;
}

.calendar-ghost {
  position: fixed;
  z-index: 70;
  pointer-events: none;
  width: 150px;
  box-shadow: var(--shadow);
  background: var(--surface);
  opacity: 0.95;
}

.dispatch-dragging {
  cursor: grabbing;
}

.kanban-column {
  background: var(--surface-soft);
  border: 1px solid var(--line);
  min-height: 260px;
  padding: 10px;
}

.kanban-column h3 {
  font-size: 13px;
  text-transform: uppercase;
  margin-bottom: 10px;
  color: var(--muted);
}

.status {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 999px;
  font-weight: 900;
  font-size: 11px;
  text-transform: uppercase;
}

.status.ready,
.status.paid,
.status.active,
.status.completed {
  color: #0b513a;
  background: #dff8ed;
}

.status.needs_review,
.status.sent,
.status.scheduled,
.status.in_progress,
.status.service_due {
  color: #7a4407;
  background: #fff1d8;
}

.record-actions {
  display: flex;
  gap: 6px;
  align-items: center;
}

/* Inside a narrow kanban card the three quick actions must wrap, never spill past the card edge. */
.work-card .record-actions {
  flex-wrap: wrap;
  margin-top: 10px;
}

.work-card .record-actions button {
  flex: 1 1 auto;
  min-width: 0;
  padding: 7px 10px;
  font-size: 12px;
  white-space: nowrap;
}

.launch-manifest {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.launch-score {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  padding: 16px;
}

.checklist-grid,
.guardrail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 10px;
  padding: 16px;
}

.checklist-item,
.guardrail-item {
  border: 1px solid var(--line);
  background: var(--surface);
  padding: 12px;
  display: grid;
  gap: 8px;
  border-left: 4px solid var(--line);
}

.checklist-item.ready,
.guardrail-item.ready {
  border-left-color: var(--mint);
}

.checklist-item.warning,
.guardrail-item.warning {
  border-left-color: var(--amber);
}

.checklist-item.blocker,
.guardrail-item.blocker {
  border-left-color: var(--red);
}

.checklist-item strong,
.guardrail-item strong {
  display: block;
}

.checklist-item span,
.guardrail-item span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.guardrail-item > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.guardrail-item progress {
  width: 100%;
  height: 10px;
  accent-color: var(--mint);
}

.launch-item {
  border: 1px solid var(--line);
  background: var(--surface);
  padding: 12px;
}

.launch-item strong {
  display: block;
  margin-bottom: 5px;
}

.status.high,
.status.critical,
.status.new,
.status.open {
  color: #7c201b;
  background: #ffe6e2;
}

.control-band {
  display: grid;
  grid-template-columns: minmax(320px, 1.3fr) minmax(300px, 0.7fr);
  gap: 16px;
  margin-bottom: 16px;
}

.drop-zone,
.sheet-form {
  border: 1px dashed #9ba695;
  background: var(--readout-bg);
  min-height: 118px;
  padding: 20px;
  display: grid;
  align-content: center;
  gap: 8px;
  cursor: pointer;
}

.drop-zone.dragover {
  border-color: var(--cyan);
  background: var(--surface-soft);
}

.drop-zone input {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  opacity: 0;
  pointer-events: none;
}

.drop-title {
  font-weight: 900;
  font-size: 18px;
}

.drop-copy,
.sheet-form label {
  color: var(--muted);
  line-height: 1.45;
}

.inline-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.cockpit-grid {
  display: grid;
  grid-template-columns: minmax(260px, 0.8fr) minmax(360px, 1.2fr);
  grid-auto-rows: minmax(220px, auto);
  gap: 16px;
}

.source-panel {
  grid-row: span 2;
}

.preview-panel {
  grid-column: 2;
}

.full-panel {
  min-height: 460px;
}

.file-list,
.sheet-plans,
.preview-table,
.history-list,
.model-grid,
.warning-stack {
  padding: 16px;
}

.empty {
  color: var(--muted);
}

.file-item,
.history-item {
  border-bottom: 1px solid var(--line);
  padding: 12px 0;
}

.file-item:last-child,
.history-item:last-child {
  border-bottom: 0;
}

.file-item strong,
.history-item strong {
  display: block;
  margin-bottom: 4px;
}

.warning-stack {
  padding-top: 0;
}

.warning {
  border-left: 4px solid var(--amber);
  background: var(--surface-warm);
  padding: 10px 12px;
  margin-bottom: 8px;
  font-size: 13px;
}

.sheet-plan {
  display: grid;
  grid-template-columns: minmax(180px, 0.8fr) minmax(180px, 0.7fr);
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}

.sheet-plan:last-child {
  border-bottom: 0;
}

.sheet-meta strong,
.sheet-meta span {
  display: block;
}

.sheet-meta span {
  color: var(--muted);
  font-size: 13px;
  margin-top: 4px;
}

.field-map,
.record-fields {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 10px;
}

.field-map {
  grid-column: 1 / -1;
}

.map-row,
.form-row {
  display: grid;
  gap: 5px;
}

.map-row label,
.form-row label,
.form-row span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.action-row,
.dialog-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.summary-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
}

.summary-strip span {
  background: var(--surface-soft);
  border: 1px solid var(--line);
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}

.table-scroll {
  overflow: auto;
  max-height: 440px;
}

.error-list {
  margin: 4px 0 0;
  padding: 0;
  list-style: none;
  color: var(--red);
}

.model-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 12px;
}

.model-tile {
  border: 1px solid var(--line);
  padding: 14px;
  background: var(--surface);
}

.model-tile strong {
  display: block;
  margin-bottom: 8px;
}

.model-tile p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.portal-grid {
  grid-template-columns: minmax(320px, 0.85fr) minmax(360px, 1.15fr);
}

.portal-phone {
  max-width: 430px;
  min-height: 640px;
  padding: 18px;
  border-radius: 8px;
  background: var(--rail);
  color: var(--ink);
}

.portal-screen {
  min-height: 600px;
  background: var(--white);
  color: var(--ink);
  border-radius: 6px;
  padding: 18px;
  display: grid;
  align-content: start;
  gap: 14px;
}

.portal-screen h2 {
  margin-bottom: 4px;
}

.settings-card {
  background: var(--panel);
  border: 1px solid var(--line);
  padding: 16px;
}

.gate-mode .rail,
.portal-only .rail {
  display: none;
}

.gate-mode .app-shell,
.portal-only .app-shell {
  grid-template-columns: 1fr;
}

.gate-panel {
  min-height: 420px;
  display: grid;
  place-items: center;
}

.auth-card {
  width: min(620px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  padding: 22px;
  display: grid;
  gap: 14px;
}

.compact-card {
  width: min(420px, 100%);
}

.auth-card h2 {
  margin-bottom: 2px;
}

.system-alert {
  border-color: rgba(156, 106, 18, 0.44);
}

.module-controls {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 10px;
}

.module-toggle {
  border: 1px solid var(--line);
  background: var(--surface);
  padding: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.module-toggle input {
  width: auto;
  min-height: auto;
}

.upload-panel {
  margin-bottom: 16px;
}

.upload-grid {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(180px, 0.6fr) minmax(220px, 1fr) auto;
  gap: 12px;
  align-items: end;
}

.portal-public {
  display: grid;
  grid-template-columns: minmax(320px, 1fr) minmax(280px, 0.8fr);
  gap: 16px;
}

.service-stack {
  display: grid;
  gap: 14px;
}

.service-order {
  border: 1px solid var(--line);
  background: var(--surface);
}

.service-order-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 14px;
  border-bottom: 1px solid var(--line);
}

.service-order-head h3 {
  margin-bottom: 4px;
}

.service-order-grid {
  display: grid;
  grid-template-columns: minmax(300px, 1fr) minmax(240px, 0.72fr);
  gap: 12px;
  padding: 14px;
}

.portal-only .command {
  min-height: 220px;
}

.service-command {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.portal-public .panel {
  min-height: 100%;
}

.mini-form {
  padding: 0;
}

.mini-inline {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(120px, 0.4fr) minmax(180px, 1fr) auto minmax(120px, 0.5fr);
  gap: 8px;
  align-items: center;
}

.mini-inline input {
  min-width: 0;
}

.ai-inline .meta-line {
  grid-column: 1 / -1;
  color: var(--ink);
}

.company-day {
  border-color: rgba(15, 122, 149, 0.3);
}

.company-day-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.runway-step {
  border: 1px solid var(--line);
  background: var(--surface);
  min-height: 168px;
  padding: 12px;
  display: grid;
  align-content: start;
  gap: 10px;
}

.runway-step strong {
  text-transform: uppercase;
  font-size: 12px;
  color: var(--blue);
}

.mini-record {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  border-top: 1px solid var(--line);
  padding-top: 8px;
}

.mini-record span {
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 13px;
  font-weight: 800;
}

.knowledge-search {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.mini-task-stack {
  display: grid;
  gap: 8px;
}

.task-check {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 8px;
}

.task-check button {
  min-height: 30px;
  padding: 0 10px;
  font-size: 12px;
}

.task-check span {
  overflow-wrap: anywhere;
  font-size: 13px;
}

/* ============ Technician phone door — one job at a time ============ */
.tech-portal {
  width: min(560px, 100%);
  margin: 0 auto;
  display: grid;
  gap: 16px;
}

.tech-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.tech-bar h2 {
  font-size: 24px;
  margin: 2px 0 0;
}

.tech-signout {
  min-height: 44px;
  padding: 0 16px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  font-weight: 700;
}

.tech-empty {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 40px 24px;
  text-align: center;
  display: grid;
  gap: 8px;
}

.tech-empty strong {
  font-size: 22px;
}

.tech-empty p {
  color: var(--muted);
  max-width: 32ch;
  margin: 0 auto;
}

.tech-switch {
  position: sticky;
  top: 8px;
  z-index: 3;
  display: grid;
  grid-template-columns: 56px 1fr 56px;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px;
  box-shadow: var(--shadow);
}

.tech-arrow {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
  font-size: 30px;
  line-height: 1;
  display: grid;
  place-items: center;
}

.tech-arrow:disabled {
  opacity: 0.3;
}

.tech-switch-mid {
  display: grid;
  gap: 8px;
  justify-items: center;
}

.tech-count {
  font-weight: 800;
  font-size: 15px;
  letter-spacing: 0.01em;
}

.tech-dots {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  justify-content: center;
}

.tech-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--paper);
  padding: 0;
}

.tech-dot.done {
  background: var(--brand-soft);
  border-color: var(--brand);
}

.tech-dot.on {
  background: var(--brand);
  border-color: var(--brand);
  transform: scale(1.25);
}

.tech-job {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 22px 20px 20px;
  display: grid;
  gap: 16px;
}

.tech-job-top h1 {
  font-size: 28px;
  line-height: 1.1;
  margin: 4px 0 10px;
}

.tech-where {
  color: var(--ink);
  font-weight: 600;
  margin: 0;
}

.tech-when {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  margin: 6px 0 0;
}

.tech-prio {
  text-transform: capitalize;
  font-weight: 800;
  font-size: 12px;
  letter-spacing: 0.04em;
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand-strong);
  border: 1px solid var(--brand);
}

.tech-prio.high,
.tech-prio.critical {
  background: rgba(176, 32, 32, 0.12);
  color: #8a1c1c;
  border-color: rgba(176, 32, 32, 0.4);
}

.tech-stage {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.tech-stage-btn {
  display: grid;
  gap: 0;
}

.tech-stage-btn button {
  width: 100%;
  min-height: 58px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--muted);
  font-weight: 800;
  font-size: 15px;
}

.tech-stage-btn.on button {
  background: var(--brand);
  border-color: var(--brand);
  color: var(--brand-ink);
  box-shadow: var(--shadow);
}

.tech-stage-status {
  display: none;
}

.turnstile-row {
  margin: 4px 0;
  min-height: 65px;
}

.ops-toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translate(-50%, 16px);
  z-index: 60;
  max-width: min(440px, calc(100vw - 32px));
  padding: 14px 20px;
  border-radius: 12px;
  border: 1px solid var(--brand);
  background: var(--brand);
  color: var(--brand-ink);
  font-weight: 700;
  font-size: 14px;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.ops-toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.sched-summary {
  display: grid;
  gap: 3px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--paper);
  margin-bottom: 4px;
}

.sched-summary strong {
  font-size: 16px;
}

.sched-summary span {
  color: var(--muted);
  font-size: 13px;
}

.sched-third {
  display: grid;
  gap: 10px;
}

.sched-accept {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--brand-soft);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
}

.sched-accept input {
  width: 20px;
  height: 20px;
  accent-color: var(--brand);
}

.tech-accept {
  display: grid;
  gap: 10px;
  padding: 16px;
  border: 1px solid var(--brand);
  border-radius: var(--radius-sm);
  background: var(--brand-soft);
}

.tech-accept-h {
  margin: 0;
  font-weight: 800;
  font-size: 15px;
  color: var(--brand-strong);
}

.tech-accept-row {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 10px;
}

.tech-accept-yes button {
  width: 100%;
  min-height: 56px;
  border-radius: 10px;
  border: 1px solid var(--brand);
  background: var(--brand);
  color: var(--brand-ink);
  font-weight: 800;
  font-size: 16px;
}

.tech-accept-no button {
  width: 100%;
  min-height: 56px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  font-weight: 700;
  font-size: 15px;
}

.tech-onway {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--brand);
  border-radius: var(--radius-sm);
  background: var(--brand-soft);
}

.tech-onway-window {
  display: grid;
  gap: 3px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--brand-strong);
}

.tech-onway-window select {
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
  color: var(--ink);
  padding: 0 10px;
  font-size: 15px;
  font-family: inherit;
}

.tech-onway-btn {
  min-height: 54px;
  border-radius: 10px;
  border: 1px solid var(--brand);
  background: var(--brand);
  color: var(--brand-ink);
  font-weight: 800;
  font-size: 16px;
}

.tech-onway-status {
  grid-column: 1 / -1;
  color: var(--brand-strong);
  font-weight: 600;
}

.tech-onway.sent .tech-onway-btn {
  opacity: 0.65;
}

.tech-block-h {
  font-weight: 800;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin: 0 0 10px;
}

.tech-tasks {
  display: grid;
  gap: 8px;
}

.tech-task {
  display: grid;
  grid-template-columns: 44px 1fr;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--paper);
}

.tech-task span {
  font-weight: 600;
  overflow-wrap: anywhere;
}

.tech-task.done span {
  color: var(--muted);
  text-decoration: line-through;
}

.tech-check {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: 2px solid var(--line);
  background: var(--surface);
  color: var(--brand-ink);
  font-size: 24px;
  font-weight: 900;
  line-height: 1;
  display: grid;
  place-items: center;
}

.tech-task.done .tech-check {
  background: var(--brand);
  border-color: var(--brand);
}

.tech-tool {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--paper);
  overflow: hidden;
}

.tech-tool > summary {
  list-style: none;
  cursor: pointer;
  min-height: 54px;
  display: flex;
  align-items: center;
  padding: 0 16px;
  font-weight: 700;
  font-size: 15px;
}

.tech-tool > summary::-webkit-details-marker {
  display: none;
}

.tech-tool > summary::after {
  content: '+';
  margin-left: auto;
  font-size: 22px;
  color: var(--muted);
  font-weight: 400;
}

.tech-tool[open] > summary::after {
  content: '\2212';
}

.tech-tool[open] > summary {
  border-bottom: 1px solid var(--line);
}

.tech-form {
  display: grid;
  gap: 10px;
  padding: 14px 16px 16px;
}

.tech-form label {
  display: grid;
  gap: 6px;
  font-weight: 700;
  font-size: 13px;
  color: var(--muted);
}

.tech-form input,
.tech-form textarea,
.tech-form select {
  width: 100%;
  min-height: 50px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  padding: 12px 14px;
  font-size: 16px;
  font-family: inherit;
}

.tech-form textarea {
  min-height: 64px;
  resize: vertical;
}

.tech-form-row {
  grid-template-columns: 1fr 1fr auto;
  align-items: center;
}

.tech-form-row .tech-ai-out,
.tech-form-row .meta-line {
  grid-column: 1 / -1;
}

.tech-save {
  min-height: 50px;
  padding: 0 22px;
  border-radius: 10px;
  border: 1px solid var(--brand);
  background: var(--brand);
  color: var(--brand-ink);
  font-weight: 800;
  font-size: 15px;
}

.tech-listed {
  padding: 0 16px 14px;
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.tech-ai-out {
  color: var(--ink);
}

.tech-invoice button {
  width: 100%;
  min-height: 56px;
  border-radius: var(--radius-sm);
  border: 1px dashed var(--brand);
  background: var(--brand-soft);
  color: var(--brand-strong);
  font-weight: 800;
  font-size: 16px;
}

.tech-invoice.sent button {
  border-style: solid;
  opacity: 0.7;
}

/* ============ Customer door — lead with one clear ask ============ */
.client-portal {
  width: min(720px, 100%);
  margin: 0 auto;
  display: grid;
  gap: 18px;
}

.client-request {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    radial-gradient(120% 90% at 90% -20%, var(--brand-soft), transparent 60%),
    var(--surface);
  box-shadow: var(--shadow);
  padding: 26px 24px 24px;
  display: grid;
  gap: 18px;
}

.client-request-copy h2 {
  font-size: 28px;
  margin: 4px 0 6px;
}

.client-request-copy p {
  color: var(--muted);
  margin: 0;
  max-width: 46ch;
}

.client-request .record-fields {
  padding: 0;
}

.client-request .primary {
  min-height: 54px;
  font-size: 16px;
}

.client-stat-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.client-stat {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  padding: 16px 18px;
  display: grid;
  gap: 4px;
}

.client-stat strong {
  font-size: 26px;
  line-height: 1;
}

.client-stat span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.client-panels {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.client-extra {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.client-extra > summary {
  list-style: none;
  cursor: pointer;
  min-height: 54px;
  display: flex;
  align-items: center;
  padding: 0 18px;
  font-weight: 700;
}

.client-extra > summary::-webkit-details-marker {
  display: none;
}

.client-extra .panel {
  border: 0;
  box-shadow: none;
}

@media (max-width: 620px) {
  .client-panels {
    grid-template-columns: 1fr;
  }

  .client-stat strong {
    font-size: 22px;
  }

  .tech-form-row {
    grid-template-columns: 1fr;
  }
}

.hidden {
  display: none !important;
}

.record-dialog {
  width: min(760px, calc(100vw - 28px));
  border: 1px solid var(--line);
  padding: 0;
  background: var(--white);
  color: var(--ink);
  box-shadow: var(--shadow);
}

.record-dialog::backdrop {
  background: rgba(15, 18, 15, 0.42);
}

.dialog-head {
  padding: 16px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.dialog-head h2 {
  margin: 0;
}

.record-fields {
  padding: 16px;
}

.dialog-actions {
  padding: 16px;
  border-top: 1px solid var(--line);
}

.integration-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
  padding: 0 16px 16px;
}

.integration-card {
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  background: var(--surface);
  padding: 14px;
  border-radius: 6px;
}

.integration-card.connected {
  border-color: rgba(24, 183, 122, 0.48);
  box-shadow: inset 4px 0 0 var(--mint);
}

.integration-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 10px;
}

.integration-head h3 {
  margin: 0;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border: 1px solid var(--line);
  background: var(--surface-soft);
  padding: 0 8px;
  border-radius: 999px;
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}

.compact-fields {
  padding: 0;
  display: grid;
  gap: 10px;
}

.template-list {
  display: grid;
  gap: 8px;
  padding: 16px;
}

.template-list article {
  border: 1px solid var(--line);
  background: var(--surface);
  padding: 10px;
  border-radius: 6px;
}

.email-composer {
  border-top: 1px solid var(--line);
}

.detail-drawer {
  position: fixed;
  inset: 0 0 0 auto;
  width: min(680px, 100vw);
  transform: translateX(104%);
  transition: transform 220ms ease;
  z-index: 40;
  background: rgba(17, 20, 23, 0.26);
  display: grid;
  justify-items: end;
  pointer-events: none;
}

.detail-drawer.open {
  transform: translateX(0);
  pointer-events: auto;
}

.detail-panel {
  width: min(680px, 100vw);
  height: 100vh;
  overflow: auto;
  background: var(--white);
  border-left: 1px solid var(--line);
  box-shadow: var(--shadow);
  padding: 18px;
  display: grid;
  align-content: start;
  gap: 16px;
}

.detail-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 14px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 14px;
}

.detail-head h2 {
  margin: 0;
}

.detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.detail-section {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 6px;
  padding: 14px;
}

.detail-section h3 {
  margin: 0;
}

.detail-fields {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 8px;
}

.detail-fields div,
.detail-list article {
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 5px;
  padding: 10px;
  min-width: 0;
}

.detail-fields span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 4px;
}

.detail-fields strong {
  display: block;
  overflow-wrap: anywhere;
}

.detail-list {
  display: grid;
  gap: 8px;
}

@media (max-width: 1100px) {
  .dashboard-grid,
  .module-grid,
  .ops-ribbon,
  .service-command,
  .portal-grid,
  .portal-public,
  .cockpit-grid,
  .control-band {
    grid-template-columns: 1fr;
  }

  .upload-grid {
    grid-template-columns: 1fr;
  }

  .company-day-grid,
  .knowledge-search,
  .launch-score {
    grid-template-columns: 1fr;
  }

  .service-order-grid,
  .mini-inline,
  .integration-grid {
    grid-template-columns: 1fr;
  }

  .service-order {
    border-radius: 8px;
    overflow: hidden;
  }

  .service-order-head {
    position: sticky;
    top: 0;
    background: var(--surface);
    z-index: 2;
  }

  .preview-panel {
    grid-column: auto;
  }

  .kanban {
    grid-template-columns: repeat(2, minmax(220px, 1fr));
  }
}

@media (max-width: 780px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .rail {
    position: fixed;
    z-index: 20;
    bottom: 0;
    top: auto;
    height: 76px;
    width: 100%;
    padding: 8px;
  }

  .brand-lockup {
    display: none;
  }

  .main-nav {
    grid-auto-flow: column;
    grid-auto-columns: minmax(74px, 1fr);
    overflow-x: auto;
    padding-bottom: 0;
  }

  .nav-button {
    grid-template-columns: 1fr;
    justify-items: center;
    gap: 2px;
    min-height: 58px;
    font-size: 12px;
  }

  .nav-button span {
    display: none;
  }

  .workspace {
    padding-bottom: 98px;
  }

  .portal-only .workspace {
    padding: 12px;
  }

  .command {
    grid-template-columns: 1fr;
    min-height: 320px;
  }

  .portal-only .command {
    min-height: auto;
    padding: 18px;
  }

  h1 {
    font-size: 42px;
  }

  .kanban {
    grid-template-columns: minmax(240px, 1fr);
  }

  .toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .toolbar input {
    max-width: none;
  }

  .launch-manifest,
  .ops-ribbon,
  .service-command {
    grid-template-columns: 1fr;
  }

  .record-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .detail-panel {
    padding-bottom: 98px;
  }
}

/* Below 780px, record tables collapse into calm stacked cards. */
@media (max-width: 780px) {
  .record-table-wrap {
    overflow: visible;
    max-height: none;
  }
  table {
    min-width: 0;
  }
  .record-table-wrap thead {
    display: none;
  }
  .record-table-wrap tr {
    display: block;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 10px 14px;
    margin-bottom: 12px;
    background: var(--surface);
  }
  .record-table-wrap td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    border: 0;
    padding: 7px 0;
    text-align: right;
  }
  .record-table-wrap td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 12px;
    font-weight: 600;
    text-align: left;
  }
  .record-table-wrap td[data-label="Actions"] {
    display: block;
    text-align: left;
    padding-top: 10px;
  }
  .record-table-wrap td[data-label="Actions"]::before {
    display: block;
    margin-bottom: 6px;
  }
  .record-table-wrap td[data-label="Actions"] .record-actions {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 8px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition: none !important;
    animation: none !important;
  }
}

/* ============ Living-line home (gray28) ============ */
/* The big page-header hero belongs only on the sign-in screen and the public portals.
   Inside the authenticated admin every view has its own header, so the hero is pure
   waste on every page, not just Today. Hide it across the whole admin. */
body:not(.gate-mode):not(.portal-only) .command { display: none; }
.home { display: grid; gap: 18px; }
.home-top { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; }
.home-eyebrow { color: var(--brand); font-size: 11px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; margin: 0 0 4px; }
.home-h1 { font-size: clamp(20px, 2.4vw, 26px); margin: 0; }
.home-command { display: flex; align-items: center; gap: 14px; width: 100%; text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 18px 20px; min-height: 64px; }
.home-command:hover:not(:disabled) { transform: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.home-command .hc-ai { font-size: 11px; font-weight: 600; color: var(--brand-ink); background: var(--brand); border-radius: 7px; padding: 5px 10px; }
.home-command .hc-ph { color: var(--muted); font-size: 15px; }
.home-command .hc-k { margin-left: auto; color: var(--muted); font-size: 11px; border: 1px solid var(--line); border-radius: 6px; padding: 3px 8px; }
.home-lbl { color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; margin: 6px 2px -4px; }
.ops-line-wrap { overflow-x: auto; padding: 6px 0 2px; }
.ops-line { position: relative; display: grid; grid-template-columns: repeat(5, minmax(108px, 1fr)); gap: 8px; min-width: 560px; }
.ops-line::before { content: ''; position: absolute; top: 20px; left: 5%; right: 5%; height: 2px; background: var(--line); }
.ops-stage { position: relative; display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; }
.ops-dot { width: 14px; height: 14px; border-radius: 50%; background: var(--line); border: 3px solid var(--paper); margin-top: 13px; flex: 0 0 auto; }
.ops-dot.on { background: var(--brand); }
.ops-sname { font-size: 11px; color: var(--muted); letter-spacing: 0.04em; text-transform: uppercase; }
.ops-count { font-size: 22px; font-weight: 500; line-height: 1; }
.ops-count.on { color: var(--brand); }
.ops-beads { display: flex; flex-direction: column; gap: 6px; width: 100%; margin-top: 2px; }
.ops-bead { font-size: 11px; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 9px; padding: 7px 9px; line-height: 1.25; text-align: left; width: 100%; }
.ops-bead.on { color: var(--brand-strong); background: var(--brand-soft); border-color: transparent; }
.ops-bead:hover:not(:disabled) { transform: none; border-color: var(--brand); }
.ops-more { font-size: 11px; color: var(--muted); padding-left: 2px; }
.ops-empty { font-size: 11px; color: var(--muted); opacity: 0.55; }
.ops-signals { display: flex; gap: 10px; flex-wrap: wrap; }
.ops-chip { display: inline-flex; align-items: center; gap: 9px; background: var(--surface); border: 1px solid var(--line); border-radius: 11px; padding: 10px 14px; font-size: 13px; color: var(--ink); }
.ops-chip:hover:not(:disabled) { transform: none; border-color: var(--brand); }
.ops-chip-clear { color: var(--muted); }
.ops-cd { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 auto; }
.home-board { margin-top: 4px; }
.install-toast {
  position: fixed; right: 24px; bottom: 24px;
  transform: translateY(12px);
  z-index: 60; display: flex; align-items: center; gap: 12px;
  max-width: min(420px, calc(100vw - 24px));
  padding: 12px 14px; background: var(--surface);
  border: 1px solid var(--line); border-radius: 16px;
  box-shadow: 0 18px 50px rgba(20, 30, 24, 0.28);
  opacity: 0; transition: opacity 0.25s ease, transform 0.25s ease;
}
.install-toast.show { opacity: 1; transform: translateY(0); }
.install-toast .it-mark {
  flex: 0 0 auto; display: grid; place-items: center;
  width: 40px; height: 40px; border-radius: 12px;
  background: var(--brand); color: var(--brand-ink);
  font-weight: 700; font-size: 14px; letter-spacing: 0.04em;
}
.install-toast .it-copy { display: flex; flex-direction: column; line-height: 1.25; }
.install-toast .it-copy strong { font-size: 14px; }
.install-toast .it-sub { color: var(--muted); font-size: 12px; }
.install-toast .it-go {
  flex: 0 0 auto; margin-left: auto;
  background: var(--brand); color: var(--brand-ink); border-color: var(--brand);
  font-weight: 600; border-radius: 10px; padding: 8px 14px;
}
.install-toast .it-x {
  flex: 0 0 auto; background: transparent; border: none; color: var(--muted);
  font-size: 20px; line-height: 1; padding: 4px 6px; cursor: pointer;
}
@media (max-width: 780px) {
  .install-toast {
    left: 12px; right: 12px; max-width: none;
    transform: translateY(12px);
    bottom: calc(76px + env(safe-area-inset-bottom, 0px) + 12px);
  }
  .install-toast.show { transform: translateY(0); }
}

/* AI command bar: the AI offer row, thinking state, and confirm card */
.cmd-ai { display: flex; align-items: center; gap: 10px; }
.cmd-ai-badge { font-size: 10px; font-weight: 700; letter-spacing: 0.04em; color: var(--brand-ink); background: var(--brand); border-radius: 6px; padding: 3px 7px; flex: 0 0 auto; }
.cmd-ai strong { flex: 1 1 auto; }
.cmd-thinking { display: flex; align-items: center; gap: 10px; color: var(--muted); }
.cmd-proposal { display: flex; gap: 12px; align-items: flex-start; }
.cmd-prop-body { display: flex; flex-direction: column; gap: 10px; flex: 1 1 auto; }
.cmd-prop-body strong { font-size: 15px; line-height: 1.4; }
.cmd-note { color: var(--amber, #c98a12); font-size: 12px; margin: 0; }
.cmd-prop-actions { display: flex; gap: 8px; margin-top: 2px; }
.cmd-note-row { color: var(--muted); font-size: 12px; font-style: italic; }

/* Import cockpit: AI mapping status + per-column review flags */
.sheet-ai-status { display: inline-flex; align-items: center; font-size: 11px; color: var(--muted); }
.sheet-ai-status.ok { color: var(--brand-strong); }
.sheet-ai-status.pending::before { content: ''; display: inline-block; width: 8px; height: 8px; margin-right: 6px; border-radius: 50%; background: var(--brand); animation: aiPulse 1s ease-in-out infinite; }
@keyframes aiPulse { 0%, 100% { opacity: 0.3; } 50% { opacity: 1; } }
.map-row.map-review > label { color: var(--amber, #c98a12); }
.map-flag { margin-left: 6px; font-size: 10px; font-weight: 700; color: var(--brand-ink); background: var(--amber, #c98a12); border-radius: 5px; padding: 1px 6px; vertical-align: middle; }

@media (max-width: 780px) {
  .ops-line { grid-template-columns: 1fr; min-width: 0; gap: 2px; }
  .ops-line::before { left: 19px; right: auto; top: 10px; bottom: 10px; width: 2px; height: auto; }
  .ops-stage { flex-direction: row; align-items: center; gap: 12px; text-align: left; padding: 9px 0; }
  .ops-dot { margin-top: 0; margin-left: 13px; }
  .ops-sname { width: 84px; flex: 0 0 auto; }
  .ops-count { font-size: 18px; min-width: 22px; text-align: right; }
  .ops-beads { margin-top: 0; }
  .home-command { min-height: 58px; padding: 15px 16px; }
  .home-command .hc-ph { font-size: 14px; }
}
