/* =========================================================================
   RMC — AI Operations Forge
   Design system for the catering harness operator console.
   ========================================================================= */

/* ---------- Tokens ---------- */
:root {
  /* Warm AI-workflow palette inspired by Appraisal Forge, tuned for RMC ops. */
  --paper:           #f4efe6;
  --paper-deep:      #eee6da;
  --paper-card:      rgba(255, 250, 244, 0.88);
  --paper-elevated:  #ffffff;
  --paper-inset:     #f8f2ea;

  --ink:             #08111c;
  --ink-soft:        #13273b;
  --ink-muted:       #4b6074;
  --ink-faint:       #7f8d9a;
  --ink-ghost:       #b9c4cf;

  --rule:            rgba(19, 39, 59, 0.14);
  --rule-soft:       rgba(19, 39, 59, 0.08);
  --rule-strong:     rgba(19, 39, 59, 0.24);

  --accent:          #0d9bb3;
  --accent-soft:     #d9f4f7;
  --accent-ink:      #075568;
  --blue:            #3a6df0;
  --blue-soft:       #dbe7ff;
  --blue-ink:        #1c3f9f;

  --saffron:         #c58a1b;
  --saffron-soft:    #f4dfb7;
  --saffron-ink:     #704b0c;

  --sage:            #2b8a64;
  --sage-soft:       #d7efe5;
  --sage-ink:        #15513a;

  --rust:            #d96d57;
  --rust-soft:       #f8d6ce;
  --rust-ink:        #7d2e20;

  --olive:           #8a6f1f;
  --olive-soft:      #efe3b0;
  --olive-ink:       #4d3d0e;

  /* Type */
  --font-display: "Syne", "Manrope", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-body:    "Manrope", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono:    "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  /* Scale */
  --t-3xs: 10px;
  --t-2xs: 11px;
  --t-xs:  12px;
  --t-sm:  13px;
  --t-md:  14px;
  --t-lg:  16px;
  --t-xl:  19px;
  --t-2xl: 24px;
  --t-3xl: 32px;
  --t-4xl: 44px;
  --t-5xl: 64px;

  /* Space */
  --s-1: 4px;
  --s-2: 8px;
  --s-3: 12px;
  --s-4: 16px;
  --s-5: 20px;
  --s-6: 24px;
  --s-7: 32px;
  --s-8: 44px;
  --s-9: 60px;
  --s-10: 80px;

  /* Layout */
  --shell-max: 1340px;
  --gutter:    32px;
  --rail-w:    240px;
  --expert-rail-w: 360px;

  /* Effects */
  --shadow-1: 0 1px 0 rgba(8, 17, 28, 0.04), 0 16px 36px -28px rgba(8, 17, 28, 0.28);
  --shadow-2: 0 1px 0 rgba(8, 17, 28, 0.06), 0 26px 70px -44px rgba(8, 17, 28, 0.36);
  --shadow-pressed: inset 0 1px 0 rgba(8, 17, 28, 0.08);

  --radius-1: 4px;
  --radius-2: 6px;
  --radius-3: 10px;
  --radius-4: 14px;
}

/* ---------- Reset & base ---------- */
*, *::before, *::after { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--t-md);
  line-height: 1.55;
  font-feature-settings: "ss01", "cv11", "tnum" 0;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background-image:
    linear-gradient(180deg, #fbf7f1 0%, #f4efe6 46%, #f8f2ea 100%),
    repeating-linear-gradient(90deg, rgba(19, 39, 59, 0.025) 0 1px, transparent 1px 5px);
}

a {
  color: var(--accent-ink);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 120ms ease, color 120ms ease;
}
a:hover { border-bottom-color: var(--accent); color: var(--accent); }

p { margin: 0 0 var(--s-3); }
ul, ol { margin: 0; padding-left: 1.25em; }
li + li { margin-top: var(--s-1); }

button { font: inherit; }

::selection { background: var(--saffron-soft); color: var(--saffron-ink); }

/* ---------- Typography ---------- */
h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: 0;
  margin: 0;
  color: var(--ink);
}
h1 {
  font-size: var(--t-4xl);
  line-height: 1.02;
}
h2 { font-size: var(--t-2xl); line-height: 1.15; }
h3 { font-size: var(--t-xl); line-height: 1.2; }
h4 { font-size: var(--t-lg); line-height: 1.3; }

.display {
  font-family: var(--font-display);
  font-size: var(--t-5xl);
  line-height: 0.95;
  letter-spacing: 0;
  font-weight: 800;
}
.display em {
  font-style: normal;
  color: var(--blue);
}

.eyebrow {
  font-family: var(--font-body);
  font-size: var(--t-2xs);
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-muted);
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
}
.eyebrow::before {
  content: "";
  display: inline-block;
  width: 18px;
  height: 1px;
  background: var(--rule-strong);
}
.eyebrow.no-rule::before { display: none; }

.serif { font-family: var(--font-display); }
.italic { font-style: italic; }
.mono { font-family: var(--font-mono); }
.tabular { font-variant-numeric: tabular-nums; }

.muted { color: var(--ink-muted); }
.faint { color: var(--ink-faint); }
.ink   { color: var(--ink); }
.accent { color: var(--accent); }

.text-xs { font-size: var(--t-xs); }
.text-sm { font-size: var(--t-sm); }
.text-md { font-size: var(--t-md); }
.text-lg { font-size: var(--t-lg); }

/* ---------- Shell & nav ---------- */
.shell {
  display: grid;
  grid-template-columns: var(--rail-w) minmax(0, 1fr);
  min-height: 100vh;
}

.rail {
  border-right: 1px solid var(--rule);
  background: rgba(248, 242, 232, 0.78);
  backdrop-filter: blur(18px) saturate(1.2);
  padding: var(--s-6) var(--s-5) var(--s-6) var(--s-6);
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: var(--s-6);
}

.brand {
  display: flex;
  align-items: baseline;
  gap: var(--s-2);
  text-decoration: none;
  color: var(--ink);
  border: none;
}
.brand:hover { color: var(--ink); border: none; }
.brand .mark {
  font-family: var(--font-display);
  font-size: 30px;
  line-height: 0.9;
  font-weight: 800;
  letter-spacing: 0;
}
.brand .mark em {
  font-style: normal;
  color: var(--blue);
}
.brand .meta {
  font-family: var(--font-body);
  font-size: var(--t-2xs);
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

.nav-group {
  display: flex;
  flex-direction: column;
  gap: var(--s-1);
}
.nav-group .label {
  font-size: var(--t-2xs);
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: var(--s-2);
  padding-left: var(--s-2);
}
.nav-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px var(--s-3);
  border: 1px solid transparent;
  border-radius: 999px;
  color: var(--ink-soft);
  font-size: var(--t-sm);
  font-weight: 500;
  letter-spacing: 0;
  transition: background 120ms ease, color 120ms ease, border-color 120ms ease;
}
.nav-link:hover {
  background: rgba(255, 255, 255, 0.62);
  color: var(--ink);
  border-bottom-color: transparent;
}
.nav-link.is-active {
  background: var(--paper-elevated);
  color: var(--ink);
  border-color: rgba(13, 155, 179, 0.28);
  font-weight: 600;
  box-shadow: var(--shadow-1);
}
.nav-link.is-locked {
  color: var(--ink-faint);
}
.nav-link.is-locked .dot {
  background: transparent;
  border: 1px solid var(--ink-ghost);
}
.nav-link.is-locked .count {
  color: var(--ink-faint);
  border: 1px solid var(--rule);
  border-radius: 999px;
  padding: 1px 6px;
  background: rgba(255, 255, 255, 0.5);
}
.nav-link .dot {
  width: 6px; height: 6px; border-radius: 999px;
  background: var(--ink-ghost);
}
.nav-link.is-active .dot { background: var(--blue); }
.nav-link .count {
  font-family: var(--font-mono);
  font-size: var(--t-2xs);
  color: var(--ink-faint);
  font-variant-numeric: tabular-nums;
}
.nav-current-job {
  display: grid;
  gap: 2px;
  padding: 7px 12px;
  border: 1px solid var(--rule);
  border-radius: var(--radius-2);
  background: rgba(255, 255, 255, 0.58);
}
.nav-current-label {
  font-size: var(--t-3xs);
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
.nav-current-title {
  font-size: var(--t-xs);
  font-weight: 800;
  color: var(--ink);
  line-height: 1.2;
}

.rail-foot {
  margin-top: auto;
  padding-top: var(--s-4);
  border-top: 1px dashed var(--rule);
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
  font-size: var(--t-2xs);
  color: var(--ink-faint);
  letter-spacing: 0.04em;
}
.rail-foot .release {
  font-family: var(--font-mono);
  color: var(--ink-muted);
  font-size: var(--t-xs);
}

/* ---------- Main content ---------- */
.canvas {
  position: relative;
  padding: var(--s-7) var(--s-7) var(--s-9);
  max-width: var(--shell-max);
  width: 100%;
}
.canvas.tight { padding: var(--s-6) var(--s-6) var(--s-7); }
.top-account {
  position: absolute;
  top: var(--s-3);
  right: var(--s-7);
  z-index: 40;
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  min-height: 34px;
  padding: 4px 5px 4px 12px;
  border: 1px solid rgba(17, 24, 39, 0.12);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: var(--shadow-1);
  backdrop-filter: blur(14px);
}
.top-account-user {
  font-size: var(--t-xs);
  color: var(--ink-muted);
  white-space: nowrap;
}
.top-account-user strong {
  color: var(--ink);
  font-weight: 800;
}
.expert-static-page .canvas {
  max-width: none;
  min-height: 100vh;
  padding-right: calc(var(--expert-rail-w) + var(--s-7));
}
.expert-static-page .top-account {
  right: calc(var(--expert-rail-w) + var(--s-7));
}
.expert-static-page .workspace-shell {
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
}
.has-agent-rail .canvas {
  max-width: none;
  padding-right: calc(var(--expert-rail-w) + var(--s-7));
}
.has-agent-rail .top-account {
  right: calc(var(--expert-rail-w) + var(--s-7));
}
.has-agent-rail.expert-static-page .workspace-shell {
  grid-template-columns: minmax(0, 1fr) minmax(260px, 320px);
}

.page-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: var(--s-6);
  align-items: end;
  padding-bottom: var(--s-5);
  margin-bottom: var(--s-6);
  border-bottom: 1px solid var(--rule);
  position: relative;
}
.page-head::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -4px;
  height: 1px;
  background: var(--rule);
  opacity: 0.55;
}
.page-head .lede {
  font-family: var(--font-body);
  font-style: normal;
  font-size: var(--t-lg);
  color: var(--ink-soft);
  margin-top: var(--s-3);
  max-width: 62ch;
  line-height: 1.4;
}
.page-head .actions {
  display: flex;
  align-items: center;
  gap: var(--s-2);
}
.job-action-form {
  display: inline-flex;
  margin: 0;
}
.job-save-state {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 9px;
  border: 1px solid var(--rule);
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: var(--t-2xs);
  color: var(--ink-muted);
  background: rgba(255, 255, 255, 0.58);
  white-space: nowrap;
}
.workspace-page-head {
  gap: var(--s-4);
  padding-bottom: var(--s-3);
  margin-bottom: var(--s-4);
}
.workspace-page-head .display {
  font-size: 34px;
  line-height: 1;
}
.workspace-page-head .lede {
  font-size: var(--t-sm);
  margin-top: var(--s-2);
  max-width: 68ch;
  line-height: 1.35;
}
.workspace-page-head .eyebrow {
  font-size: var(--t-3xs);
}
.workspace-page-head .actions .btn {
  padding: 7px 12px;
  min-height: 34px;
}

/* ---------- Cards & surfaces ---------- */
.card {
  background: var(--paper-card);
  border: 1px solid var(--rule);
  border-radius: var(--radius-3);
  padding: var(--s-5);
  position: relative;
  box-shadow: var(--shadow-1);
}
.card.elevated {
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow-2);
}
.card.flat {
  box-shadow: none;
  background: transparent;
  border-color: var(--rule-soft);
}
.card.inset {
  background: var(--paper-inset);
  border-style: dashed;
  border-color: var(--rule);
  box-shadow: none;
}
.card .card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--s-3);
  margin-bottom: var(--s-3);
}
.card .card-head h2,
.card .card-head h3 { line-height: 1.1; }
.card-tools {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--s-2);
  flex-shrink: 0;
}

.card .card-foot {
  margin-top: var(--s-4);
  padding-top: var(--s-3);
  border-top: 1px dashed var(--rule);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
  font-size: var(--t-xs);
  color: var(--ink-muted);
}

/* Decorative corner ornament — small but signature */
.card.ornate::before {
  content: "✦";
  position: absolute;
  top: 10px; right: 14px;
  font-family: var(--font-display);
  color: var(--saffron);
  font-size: 14px;
  line-height: 1;
  opacity: 0.85;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  padding: 10px 16px;
  font-family: var(--font-body);
  font-size: var(--t-sm);
  font-weight: 600;
  letter-spacing: 0;
  border-radius: 999px;
  border: 1px solid var(--ink);
  background: var(--ink);
  color: var(--paper);
  cursor: pointer;
  transition: transform 80ms ease, background 120ms ease, box-shadow 120ms ease;
  text-decoration: none;
}
.btn:hover { background: var(--ink-soft); border-color: var(--ink-soft); color: var(--paper); border-bottom-color: var(--ink-soft); transform: translateY(-1px); }
.btn:active { transform: translateY(1px); box-shadow: var(--shadow-pressed); }

.btn.accent {
  background: linear-gradient(135deg, var(--accent) 0%, var(--blue) 100%);
  border-color: transparent;
  color: var(--paper-elevated);
  box-shadow: 0 14px 28px rgba(58, 109, 240, 0.18);
}
.btn.accent:hover { box-shadow: 0 18px 34px rgba(58, 109, 240, 0.22); }

.btn.ghost {
  background: transparent;
  color: var(--ink);
  border-color: var(--rule-strong);
}
.btn.ghost:hover { background: rgba(255, 255, 255, 0.62); color: var(--ink); }

.btn.subtle {
  background: var(--paper-elevated);
  color: var(--ink-soft);
  border-color: var(--rule);
}
.btn.subtle:hover { background: var(--paper-card); color: var(--ink); }

.btn.sm { padding: 5px 10px; font-size: var(--t-xs); }
.btn.lg { padding: 12px 20px; font-size: var(--t-md); }

.btn .kbd {
  font-family: var(--font-mono);
  font-size: var(--t-2xs);
  padding: 1px 5px;
  border-radius: var(--radius-1);
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: rgba(255, 255, 255, 0.85);
}
.btn.ghost .kbd, .btn.subtle .kbd {
  background: var(--paper-inset);
  border-color: var(--rule);
  color: var(--ink-muted);
}

/* ---------- Form controls ---------- */
.field {
  display: flex;
  flex-direction: column;
  gap: var(--s-1);
  position: relative;
}
.field.span-2 { grid-column: span 2; }
.field.span-full { grid-column: 1 / -1; }

.field-label {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--s-3);
  font-size: var(--t-2xs);
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-muted);
}
.field-label .hint {
  font-family: var(--font-body);
  font-style: normal;
  font-size: var(--t-xs);
  letter-spacing: 0;
  text-transform: none;
  color: var(--ink-faint);
  font-weight: 400;
}

.input,
.textarea,
.select {
  width: 100%;
  padding: 9px 12px;
  font: inherit;
  font-size: var(--t-md);
  color: var(--ink);
  background: var(--paper-elevated);
  border: 1px solid var(--rule);
  border-radius: var(--radius-2);
  transition: border-color 120ms ease, box-shadow 120ms ease, background 120ms ease;
}
.input:hover, .textarea:hover, .select:hover { border-color: var(--rule-strong); }
.input:focus, .textarea:focus, .select:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--paper-elevated);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.textarea { min-height: 96px; resize: vertical; line-height: 1.5; }
.textarea.tall { min-height: 380px; }
.textarea.notes {
  font-family: var(--font-body);
  font-size: var(--t-md);
  line-height: 1.65;
  color: var(--ink);
  background: var(--paper-card);
}
.source-upload-form {
  display: grid;
  gap: var(--s-2);
}
.source-upload-form .btn {
  margin-top: var(--s-1);
  justify-self: start;
}
.gcal-current-job {
  display: grid;
  gap: 4px;
  padding: 10px;
  border: 1px solid var(--rule);
  border-radius: var(--radius-2);
  background: rgba(255, 255, 255, 0.72);
  font-size: var(--t-xs);
  color: var(--ink-muted);
}
.gcal-current-title {
  color: var(--ink);
  font-weight: 800;
  line-height: 1.25;
  text-decoration: none;
}
.gcal-current-job form { margin: 3px 0 0; }
.gcal-current-job button {
  width: 100%;
  border: 1px solid var(--rule);
  border-radius: 999px;
  background: var(--paper-elevated);
  color: var(--ink-soft);
  padding: 5px 8px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

/* Field with extracted value: shows source-attribution underline */
.field.has-extracted .input,
.field.has-extracted .textarea {
  background: linear-gradient(180deg, var(--saffron-soft) 0%, var(--paper-elevated) 100%);
  border-color: var(--saffron);
}
.field.is-empty .input,
.field.is-empty .textarea {
  background: var(--paper-inset);
}

/* ---------- Pills & badges ---------- */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 8px;
  font-family: var(--font-body);
  font-size: var(--t-2xs);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border-radius: var(--radius-1);
  background: var(--paper-inset);
  color: var(--ink-soft);
  border: 1px solid var(--rule);
  white-space: nowrap;
}
.pill .dot { width: 6px; height: 6px; border-radius: 999px; background: currentColor; }

.pill.sage   { background: var(--sage-soft); color: var(--sage-ink); border-color: var(--sage); }
.pill.olive  { background: var(--olive-soft); color: var(--olive-ink); border-color: var(--olive); }
.pill.rust   { background: var(--rust-soft); color: var(--rust-ink); border-color: var(--rust); }
.pill.accent { background: var(--accent-soft); color: var(--accent-ink); border-color: var(--accent); }
.pill.saffron{ background: var(--saffron-soft); color: var(--saffron-ink); border-color: var(--saffron); }
.pill.ink    { background: var(--ink); color: var(--paper); border-color: var(--ink); }

/* Confidence pills: stamp-like, with a small glyph */
.confidence {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 1px 6px 1px 4px;
  font-family: var(--font-mono);
  font-size: var(--t-2xs);
  font-weight: 500;
  letter-spacing: 0.04em;
  border: 1px solid currentColor;
  border-radius: var(--radius-1);
  background: var(--paper-elevated);
  cursor: default;
}
.confidence::before {
  content: "";
  width: 4px;
  height: 4px;
  border-radius: 999px;
  background: currentColor;
}
.confidence.high  { color: var(--sage-ink);   background: var(--sage-soft); }
.confidence.med   { color: var(--olive-ink);  background: var(--olive-soft); }
.confidence.low   { color: var(--rust-ink);   background: var(--rust-soft); }
.confidence.none  { color: var(--ink-faint);  background: var(--paper-inset); border-style: dashed; }

/* Stamp: a richer "extracted" marker */
.stamp {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: var(--t-2xs);
  font-weight: 500;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--accent-ink);
  padding: 2px 6px;
  border-radius: var(--radius-1);
  background: var(--accent-soft);
  border: 1px solid var(--accent);
}

/* ---------- Provenance ---------- */
mark.provenance {
  background: linear-gradient(180deg, transparent 60%, var(--saffron-soft) 60%);
  color: inherit;
  padding: 0 2px;
  border-radius: 2px;
  cursor: pointer;
  transition: background 120ms ease;
}
mark.provenance:hover,
mark.provenance.is-active {
  background: var(--saffron-soft);
  box-shadow: inset 0 -2px 0 var(--saffron);
}

.provenance-link {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-family: var(--font-mono);
  font-size: var(--t-2xs);
  color: var(--saffron-ink);
  text-decoration: none;
  border: none;
  cursor: pointer;
  background: none;
  padding: 0;
}
.provenance-link::before { content: "✦"; color: var(--saffron); }
.provenance-link:hover { color: var(--accent-ink); }

/* ---------- Tables ---------- */
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--t-sm);
  font-variant-numeric: tabular-nums;
}
.table thead th {
  text-align: left;
  padding: var(--s-3) var(--s-4);
  font-family: var(--font-body);
  font-size: var(--t-2xs);
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-muted);
  background: var(--paper-deep);
  border-bottom: 1px solid var(--rule-strong);
  border-top: 1px solid var(--rule);
}
.table thead th:first-child { border-top-left-radius: var(--radius-2); border-left: 1px solid var(--rule); }
.table thead th:last-child  { border-top-right-radius: var(--radius-2); border-right: 1px solid var(--rule); }

.table tbody td {
  padding: var(--s-3) var(--s-4);
  border-bottom: 1px solid var(--rule-soft);
  background: var(--paper-elevated);
  vertical-align: top;
}
.table tbody tr:last-child td { border-bottom: 1px solid var(--rule); }
.table tbody tr:last-child td:first-child { border-bottom-left-radius: var(--radius-2); }
.table tbody tr:last-child td:last-child  { border-bottom-right-radius: var(--radius-2); }
.table tbody td:first-child { border-left: 1px solid var(--rule); }
.table tbody td:last-child  { border-right: 1px solid var(--rule); }
.table tbody tr:hover td { background: var(--paper-card); }

.table.dense thead th, .table.dense tbody td { padding: 7px var(--s-3); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- Layout primitives ---------- */
.stack { display: flex; flex-direction: column; gap: var(--s-4); }
.stack.tight { gap: var(--s-2); }
.stack.loose { gap: var(--s-6); }

.row { display: flex; flex-wrap: wrap; gap: var(--s-3); align-items: center; }
.row.between { justify-content: space-between; }
.row.tight { gap: var(--s-2); }
.row.loose { gap: var(--s-5); }

.grid { display: grid; gap: var(--s-4); }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.auto   { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.grid.sidebar { grid-template-columns: minmax(0, 1fr) 360px; align-items: start; }
.grid.split    { grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr); align-items: start; }

.workspace-right-rail {
  position: sticky;
  top: var(--s-4);
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
  max-height: calc(100vh - var(--s-8));
}
.expert-static-page .workspace-right-rail {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 80;
  width: var(--expert-rail-w);
  max-height: none;
  gap: 0;
  border-left: 1px solid var(--rule);
  background: #ffffff;
  box-shadow: -16px 0 36px -34px rgba(8, 17, 28, 0.5);
}
.event-expert-panel {
  min-height: min(640px, calc(100vh - 260px));
  border: 1px solid var(--rule);
  border-radius: var(--radius-2);
  background: var(--paper-elevated);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-1);
}
.expert-static-page .event-expert-panel {
  flex: 1;
  height: 100vh;
  min-height: 0;
  border: none;
  border-radius: 0;
  box-shadow: none;
}
.expert-head {
  background: #111827;
  color: #f8fafc;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-2);
  padding: 0 var(--s-3);
  min-height: 48px;
}
.expert-tabs { display: flex; align-self: stretch; align-items: flex-end; }
.expert-tab {
  display: inline-flex;
  align-items: center;
  min-height: 48px;
  padding: 0 var(--s-3);
  border-bottom: 2px solid transparent;
  font-weight: 700;
  font-size: var(--t-sm);
}
.expert-tab.is-active { border-bottom-color: var(--accent); }
.forge-ready {
  padding: 5px 9px;
  border-radius: var(--radius-1);
  background: var(--sage-soft);
  color: var(--sage-ink);
  border: 1px solid var(--sage);
  font-size: var(--t-2xs);
  font-weight: 700;
}
.expert-messages {
  flex: 1;
  min-height: 320px;
  max-height: 520px;
  overflow-y: auto;
  padding: var(--s-3);
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
  background: #fff;
}
.expert-static-page .expert-messages {
  min-height: 0;
  max-height: none;
}
.expert-message {
  border: 1px solid var(--rule);
  border-radius: var(--radius-2);
  padding: 8px 10px;
  font-size: var(--t-sm);
  line-height: 1.45;
}
.expert-message.assistant { background: var(--paper-card); color: var(--ink); }
.expert-message.user {
  background: var(--accent-soft);
  color: var(--accent-ink);
  align-self: flex-end;
}
.expert-input-area {
  border-top: 1px solid var(--rule);
  padding: var(--s-2);
  background: var(--paper-card);
  display: grid;
  gap: var(--s-2);
}
.expert-input {
  width: 100%;
  min-height: 74px;
  resize: vertical;
  border: 1px solid var(--rule);
  border-radius: var(--radius-1);
  padding: 8px 10px;
  font: inherit;
  font-size: var(--t-sm);
}
.expert-actions { display: flex; gap: var(--s-2); justify-content: flex-end; flex-wrap: wrap; }
.expert-static-page .source-upload-card {
  display: none;
}
.global-agent-rail {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 90;
  width: var(--expert-rail-w);
  border-left: 1px solid var(--rule);
  background: #ffffff;
  box-shadow: -16px 0 36px -34px rgba(8, 17, 28, 0.5);
}
.global-agent-panel {
  height: 100vh;
  min-height: 0;
  border: none;
  border-radius: 0;
  box-shadow: none;
}
.global-agent-panel.is-chef-advisor .expert-head {
  background: linear-gradient(135deg, #111827 0%, var(--accent-ink) 100%);
}
.global-agent-panel.is-chef-advisor .expert-tab.is-active {
  border-bottom-color: var(--saffron);
}
.global-agent-panel .expert-messages {
  min-height: 0;
  max-height: none;
}
.global-agent-subtitle {
  padding: 8px var(--s-3);
  border-bottom: 1px solid var(--rule);
  color: var(--ink-muted);
  font-family: var(--font-mono);
  font-size: var(--t-xs);
  background: var(--paper-card);
}
.has-agent-rail.expert-static-page .workspace-right-rail {
  position: sticky;
  top: var(--s-4);
  right: auto;
  bottom: auto;
  width: auto;
  max-height: calc(100vh - var(--s-8));
  gap: var(--s-3);
  border-left: none;
  background: transparent;
  box-shadow: none;
}
.has-agent-rail.expert-static-page .source-upload-card {
  display: block;
}

.ai-settings-page { max-width: 960px; margin: 0 auto; }
.forge-panel {
  background: #171717;
  border: 1px solid #333;
  color: #f8fafc;
  border-radius: var(--radius-2);
  overflow: hidden;
}
.forge-account-panel {
  margin-top: var(--s-4);
  padding: var(--s-4);
  background: #171717;
  border: 1px solid #333;
  color: #f8fafc;
  border-radius: var(--radius-2);
}
.forge-account-panel h2 {
  margin: 0 0 var(--s-3);
  padding-bottom: var(--s-3);
  border-bottom: 1px solid #333;
  font-size: var(--t-lg);
}
.forge-account-panel form { margin: var(--s-3) 0 0; }
.forge-tabs {
  display: flex;
  border-bottom: 1px solid #333;
}
.forge-tabs span,
.forge-tabs strong {
  padding: 12px 20px;
  border-right: 1px solid #333;
  font-size: var(--t-sm);
}
.forge-tabs strong {
  color: #00d4ff;
  border-bottom: 2px solid #00d4ff;
}
.forge-form {
  display: grid;
  gap: var(--s-3);
  padding: var(--s-4);
}
.forge-form .input,
.forge-form .select {
  background: #252525;
  border-color: #444;
  color: #f8fafc;
}
.compact-input { max-width: 150px; }
.success-text { color: #10b981; margin: 0; font-size: var(--t-sm); }
.error-text { color: #ef4444; margin: 0; font-size: var(--t-sm); }
.login-shell { min-height: 70vh; display: grid; place-items: center; }
.login-panel {
  width: min(520px, 100%);
  background: var(--paper-elevated);
  border: 1px solid var(--rule);
  border-radius: var(--radius-3);
  padding: var(--s-6);
  box-shadow: var(--shadow-2);
}
.login-panel input {
  width: 100%;
  padding: 9px 12px;
  font: inherit;
  border: 1px solid var(--rule);
  border-radius: var(--radius-2);
}
.inline-logout { margin: 0; }
.inline-logout button {
  padding: 6px 10px;
  border: 1px solid var(--rule);
  border-radius: 999px;
  background: var(--paper-elevated);
  color: var(--ink);
  font: inherit;
  font-size: var(--t-xs);
  font-weight: 800;
  cursor: pointer;
}
.inline-logout button:hover { border-color: var(--accent); }

.divider {
  border: none;
  height: 1px;
  background: var(--rule);
  margin: var(--s-4) 0;
}
.divider.dashed { background: none; border-top: 1px dashed var(--rule-strong); }
.divider.thick { height: 2px; background: var(--ink-ghost); }

.hr-double {
  border: none;
  border-top: 1px solid var(--rule-strong);
  border-bottom: 1px solid var(--rule);
  height: 4px;
  margin: var(--s-5) 0;
}

/* ---------- Metric tiles ---------- */
.metric {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
  padding: var(--s-5);
  background: rgba(255, 250, 244, 0.86);
  border: 1px solid var(--rule);
  border-radius: var(--radius-3);
  position: relative;
  overflow: hidden;
}
.metric .metric-label {
  font-size: var(--t-2xs);
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-muted);
}
.metric .metric-value {
  font-family: var(--font-display);
  font-size: var(--t-3xl);
  line-height: 1;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0;
}
.metric .metric-foot {
  margin-top: auto;
  font-size: var(--t-xs);
  color: var(--ink-muted);
}
.metric.accent { background: var(--accent-soft); border-color: var(--accent); }
.metric.accent .metric-value { color: var(--accent-ink); }
.metric.sage { background: var(--sage-soft); border-color: var(--sage); }
.metric.sage .metric-value { color: var(--sage-ink); }
.workspace-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--s-3);
  margin-bottom: var(--s-4);
}
.workspace-metrics .metric {
  gap: var(--s-1);
  min-height: 86px;
  padding: var(--s-3);
  border-radius: var(--radius-2);
}
.workspace-metrics .metric .metric-value {
  font-size: var(--t-2xl);
}
.workspace-metrics .metric .metric-foot {
  font-size: var(--t-2xs);
}
.approval-levels {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--s-3);
  margin: 0 0 var(--s-4);
}
.approval-level-card {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-3);
  background: var(--paper-elevated);
  border: 1px solid var(--rule);
  border-radius: var(--radius-2);
}
.approval-level-number,
.approval-level-pill,
.approval-status {
  font-family: var(--font-mono);
  font-size: var(--t-3xs);
  font-weight: 800;
  text-transform: uppercase;
}
.approval-level-number,
.approval-level-pill {
  color: var(--accent-ink);
}
.approval-layout {
  align-items: start;
}
.approval-matrix-card {
  overflow: hidden;
}
.approval-table-wrap {
  overflow-x: auto;
}
.approval-table {
  min-width: 1040px;
}
.approval-domain,
.approval-status,
.approval-group-row span,
.approval-group-row p {
  display: block;
  color: var(--ink-muted);
}
.approval-domain {
  font-size: var(--t-xs);
}
.approval-group {
  font-weight: 800;
}
.approval-row.is-assigned .approval-status {
  color: var(--sage-ink);
}
.approval-row.is-fallback .approval-status {
  color: var(--saffron-ink);
}
.approval-row.is-unassigned .approval-status {
  color: var(--rust-ink);
}
.approval-group-list {
  display: grid;
  gap: var(--s-2);
}
.approval-assign-form {
  display: grid;
  gap: var(--s-3);
}
.approval-assign-form .btn {
  justify-self: start;
}
.approval-group-row {
  padding: var(--s-3);
  background: var(--paper-elevated);
  border: 1px solid var(--rule-soft);
  border-radius: var(--radius-2);
}
.approval-group-row p {
  margin: var(--s-1) 0 0;
  font-size: var(--t-xs);
}
.approval-group-row.is-missing {
  border-color: var(--rust);
  background: var(--rust-soft);
}
.job-progress-line {
  margin: 0 0 var(--s-3);
  padding: 10px 12px;
  border: 1px solid var(--rule);
  border-radius: var(--radius-2);
  background: rgba(255, 255, 255, 0.7);
  display: grid;
  grid-template-columns: minmax(140px, 190px) minmax(0, 1fr);
  gap: var(--s-3);
  align-items: center;
}
.job-progress-summary {
  display: grid;
  gap: 1px;
}
.job-progress-summary span,
.job-progress-summary em {
  font-family: var(--font-mono);
  font-size: var(--t-3xs);
  color: var(--ink-faint);
  font-style: normal;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.job-progress-summary strong {
  font-size: var(--t-md);
  line-height: 1.15;
}
.job-progress-steps {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 0;
  list-style: none;
  margin: 0;
  padding: 0;
}
.job-progress-step {
  min-width: 0;
  position: relative;
  display: grid;
  gap: 3px;
  justify-items: center;
  color: var(--ink-faint);
  font-size: var(--t-2xs);
  font-weight: 700;
  text-align: center;
}
.job-progress-step small {
  max-width: 100%;
  color: var(--ink-muted);
  font-size: var(--t-3xs);
  font-weight: 500;
  line-height: 1.15;
}
.job-progress-step::before {
  content: "";
  position: absolute;
  top: 7px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--rule);
  z-index: 0;
}
.job-progress-step:first-child::before { left: 50%; }
.job-progress-step:last-child::before { right: 50%; }
.job-progress-dot {
  width: 16px;
  height: 16px;
  border: 2px solid var(--rule-strong);
  border-radius: 999px;
  background: var(--paper-elevated);
  z-index: 1;
}
.job-progress-step.is-complete {
  color: var(--sage-ink);
}
.job-progress-step.is-complete .job-progress-dot {
  background: var(--sage);
  border-color: var(--sage);
}
.job-progress-step.is-active {
  color: var(--accent-ink);
}
.job-progress-step.is-active .job-progress-dot {
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}
.job-progress-step.is-blocked {
  color: var(--rust-ink);
}
.job-progress-step.is-blocked .job-progress-dot {
  background: var(--rust);
  border-color: var(--rust);
}

/* ---------- Stage rail (vertical pipeline) ---------- */
.stage-rail {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: var(--s-2) 0;
}
.stage-step {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: var(--s-3);
  padding: var(--s-2) 0;
  position: relative;
}
.stage-step .marker {
  position: relative;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 4px;
}
.stage-step .marker::before {
  content: "";
  position: absolute;
  top: 18px; bottom: -8px;
  left: 50%;
  width: 1px;
  background: var(--rule-strong);
}
.stage-step:last-child .marker::before { display: none; }
.stage-step .dot {
  width: 14px; height: 14px;
  border-radius: 999px;
  background: var(--paper-elevated);
  border: 1.5px solid var(--rule-strong);
  position: relative;
  z-index: 1;
}
.stage-step.is-passed .dot { background: var(--sage); border-color: var(--sage); }
.stage-step.is-blocked .dot { background: var(--rust); border-color: var(--rust); }
.stage-step.is-pending .dot { background: var(--paper-elevated); border-color: var(--olive); border-style: dashed; }
.stage-step.is-active .dot {
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}
.stage-step .body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-bottom: var(--s-2);
}
.stage-step .body .name {
  font-family: var(--font-display);
  font-size: var(--t-md);
  font-weight: 700;
  color: var(--ink);
  line-height: 1.2;
}
.stage-step .body .meta {
  font-family: var(--font-mono);
  font-size: var(--t-2xs);
  color: var(--ink-faint);
  letter-spacing: 0.04em;
}
.stage-step.is-active .body .name { color: var(--accent-ink); font-weight: 600; }

/* Horizontal stage rail for headers */
.stage-flow {
  display: flex;
  align-items: center;
  gap: var(--s-1);
  padding: var(--s-3) 0;
  flex-wrap: wrap;
}
.stage-flow .stage-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  font-size: var(--t-2xs);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: var(--paper-elevated);
  border: 1px solid var(--rule);
  border-radius: var(--radius-1);
  color: var(--ink-muted);
}
.stage-flow .stage-chip.is-passed { background: var(--sage-soft); color: var(--sage-ink); border-color: var(--sage); }
.stage-flow .stage-chip.is-active { background: var(--accent); color: var(--paper-elevated); border-color: var(--accent); }
.stage-flow .stage-chip.is-blocked { background: var(--rust-soft); color: var(--rust-ink); border-color: var(--rust); }
.stage-flow .arrow {
  font-family: var(--font-display);
  color: var(--ink-faint);
  font-size: var(--t-md);
  font-style: italic;
}

/* ---------- Tabs ---------- */
.tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--rule-strong);
  margin-bottom: var(--s-4);
  position: relative;
}
.tab {
  appearance: none;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  padding: var(--s-2) var(--s-4);
  font-family: var(--font-body);
  font-size: var(--t-md);
  color: var(--ink-muted);
  cursor: pointer;
  margin-bottom: -1px;
  transition: color 120ms ease, border-color 120ms ease;
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
}
.tab:hover { color: var(--ink); }
.tab.is-active {
  color: var(--accent-ink);
  border-bottom-color: var(--accent);
}
.tab .count {
  font-family: var(--font-mono);
  font-size: var(--t-2xs);
  color: var(--ink-faint);
  background: var(--paper-inset);
  padding: 1px 6px;
  border-radius: var(--radius-1);
}
.tab.is-active .count { background: var(--accent-soft); color: var(--accent-ink); }

.tab-panel { display: none; }
.tab-panel.is-active { display: block; }

/* ---------- Workspace module map ---------- */
.module-strip {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2);
  padding-bottom: var(--s-4);
  border-bottom: 1px solid var(--rule);
}
.module-chip {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 6px 10px;
  border: 1px solid var(--rule);
  border-radius: var(--radius-2);
  background: var(--paper-card);
  color: var(--ink-soft);
  font-size: var(--t-sm);
  font-weight: 600;
}
.module-chip:hover {
  background: var(--paper-elevated);
  color: var(--accent-ink);
  border-bottom-color: var(--rule);
}
.module-chip.is-active {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--paper);
}
.compact-list {
  margin-top: var(--s-2);
  padding-left: 1.1rem;
  color: var(--ink-soft);
  font-size: var(--t-sm);
}

.calendar-board {
  margin-top: var(--s-5);
  background: var(--paper-elevated);
  border: 1px solid var(--rule);
  border-radius: var(--radius-2);
  box-shadow: var(--shadow-1);
  overflow: hidden;
}

.gcal-page {
  background: #f8fafd;
}
.gcal-page .shell {
  display: grid;
  grid-template-columns: var(--rail-w) minmax(0, 1fr);
  min-height: 100vh;
}
.gcal-page .rail {
  display: flex;
}
.gcal-page .canvas.gcal-canvas {
  width: 100%;
  max-width: none;
  height: 100vh;
  padding: 0;
}
.has-agent-rail.gcal-page .canvas.gcal-canvas {
  padding-right: var(--expert-rail-w);
}
.calendar-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--s-4);
  padding: var(--s-4) var(--s-5);
  border-bottom: 1px solid var(--rule);
  background: var(--paper-card);
}
.calendar-toolbar h2 {
  font-size: var(--t-2xl);
  line-height: 1.1;
}
.calendar-controls {
  display: flex;
  align-items: center;
  gap: var(--s-2);
}
.icon-btn {
  width: 34px;
  height: 34px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--rule);
  border-radius: var(--radius-1);
  background: var(--paper-elevated);
  color: var(--ink-soft);
  font-size: var(--t-xl);
  line-height: 1;
}
.icon-btn:hover {
  border-color: var(--accent);
  background: var(--paper-card);
}
.inline-add {
  position: relative;
}
.inline-add summary {
  list-style: none;
}
.inline-add summary::-webkit-details-marker {
  display: none;
}
.add-field-btn {
  width: auto;
  min-width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0 8px;
  cursor: pointer;
  font-weight: 700;
  color: var(--accent-ink);
  font-size: var(--t-sm);
}
.add-field-btn .add-label {
  font-size: var(--t-2xs);
  font-weight: 800;
}
.inline-add[open] .add-field-btn {
  background: var(--accent-soft);
  border-color: var(--accent);
}
.inline-add-panel {
  position: absolute;
  z-index: 20;
  top: calc(100% + var(--s-2));
  right: 0;
  width: min(420px, calc(100vw - 48px));
  padding: var(--s-3);
  border: 1px solid var(--rule);
  border-radius: var(--radius-2);
  background: var(--paper-elevated);
  box-shadow: var(--shadow-2);
}
.inline-add-form {
  display: grid;
  gap: var(--s-2);
}
.inline-add-form label {
  display: grid;
  gap: var(--s-1);
  font-size: var(--t-xs);
  font-weight: 700;
  color: var(--ink-muted);
}
.inline-add-form .btn {
  justify-self: start;
  margin-top: var(--s-1);
}
.calendar-jump {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-2);
  padding: var(--s-3) var(--s-5);
  border-bottom: 1px solid var(--rule-soft);
  background: #f8fafc;
}
.calendar-jump-label {
  font-family: var(--font-mono);
  font-size: var(--t-2xs);
  color: var(--ink-muted);
  text-transform: uppercase;
}
.calendar-jump a {
  padding: 3px 8px;
  border: 1px solid #cbd5e1;
  border-radius: var(--radius-1);
  background: #ffffff;
  color: #1e3a8a;
  font-size: var(--t-xs);
  font-weight: 700;
}
.calendar-scroll {
  overflow-x: auto;
}
.calendar-grid {
  min-width: 980px;
  display: grid;
  grid-template-columns: repeat(7, minmax(132px, 1fr));
  background: var(--rule);
  gap: 1px;
}
.calendar-weekday {
  min-height: 36px;
  display: flex;
  align-items: center;
  padding: 0 var(--s-3);
  background: var(--paper-card);
  color: var(--ink-muted);
  font-size: var(--t-xs);
  font-weight: 800;
}
.calendar-day {
  min-height: 138px;
  padding: var(--s-2);
  background: #ffffff;
}
.calendar-day.is-muted {
  background: #f8fafc;
}
.calendar-day.is-today {
  box-shadow: inset 0 0 0 2px #2563eb;
}
.calendar-day-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 22px;
  margin-bottom: var(--s-1);
}
.calendar-day-number {
  width: 24px;
  height: 24px;
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  font-size: var(--t-xs);
  font-weight: 800;
  color: var(--ink-soft);
}
.calendar-day.is-today .calendar-day-number {
  background: #2563eb;
  color: #ffffff;
}
.calendar-day-count {
  font-family: var(--font-mono);
  font-size: var(--t-2xs);
  color: var(--ink-muted);
}
.calendar-events {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.calendar-event {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 5px 6px;
  border: 1px solid transparent;
  border-radius: var(--radius-1);
  background: #dbeafe;
  color: #172554;
  overflow: hidden;
}
.calendar-event:hover {
  border-color: #2563eb;
  color: #172554;
}
.calendar-event.is-dry-run {
  background: #fef3c7;
  color: #713f12;
}
.calendar-event.is-golden {
  background: #ede9fe;
  color: #3b0764;
}
.calendar-event.is-complete {
  background: #dcfce7;
  color: #14532d;
}
.calendar-event.is-blocked {
  background: #fee2e2;
  color: #7f1d1d;
}
.calendar-event.is-appointment {
  background: #dbeafe;
  color: #172554;
}
.calendar-event.is-hold,
.calendar-event.is-approval {
  background: #ffedd5;
  color: #7c2d12;
}
.calendar-event-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-1);
}
.calendar-event-time,
.calendar-event-badge,
.calendar-event-meta {
  font-family: var(--font-mono);
  font-size: var(--t-3xs);
  line-height: 1.25;
}
.calendar-event-badge {
  font-weight: 800;
  text-transform: uppercase;
}
.calendar-event-title {
  font-size: var(--t-xs);
  font-weight: 800;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.calendar-event-meta {
  opacity: 0.76;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.calendar-overflow {
  font-family: var(--font-mono);
  font-size: var(--t-2xs);
  color: var(--ink-muted);
  padding: 2px 6px;
}

.gcal-board {
  margin-top: 0;
  width: 100%;
  height: 100vh;
  background: #ffffff;
  border: none;
  border-radius: 0;
  box-shadow: none;
  font-family: "Roboto", Arial, sans-serif;
}
.gcal-topbar {
  min-height: 64px;
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--s-4);
  padding: 10px 16px;
  border-bottom: 1px solid #edf0f3;
  background: #f8fafd;
}
.gcal-brand,
.gcal-nav,
.gcal-view-switch {
  display: flex;
  align-items: center;
  gap: var(--s-3);
}
.gcal-brand {
  font-size: 22px;
  font-weight: 400;
  color: #202124;
}
.gcal-menu {
  width: 28px;
  height: 28px;
  display: inline-grid;
  place-items: center;
  color: #5f6368;
}
.gcal-logo {
  width: 30px;
  height: 30px;
  display: inline-grid;
  place-items: center;
  border-radius: 6px;
  background: linear-gradient(135deg, #4285f4 0 45%, #34a853 45% 70%, #fbbc04 70%);
  color: #ffffff;
  font-family: var(--font-mono);
  font-size: var(--t-xs);
  font-weight: 800;
}
.gcal-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}
.gcal-icon {
  width: 38px;
  height: 38px;
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  border-bottom: none;
  color: #5f6368;
  font-size: 20px;
}
.gcal-icon:hover {
  background: #edf0f3;
  color: #202124;
  border-bottom: none;
}
.gcal-account {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 3px 4px 3px 11px;
  border: 1px solid #dadce0;
  border-radius: 999px;
  background: #ffffff;
}
.gcal-account-user {
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #3c4043;
  font-size: var(--t-xs);
  font-weight: 700;
}
.gcal-account button {
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid #dadce0;
  border-radius: 999px;
  background: #f8fafd;
  color: #202124;
  font: inherit;
  font-size: var(--t-xs);
  font-weight: 800;
  cursor: pointer;
}
.gcal-account button:hover {
  background: #edf0f3;
}
.gcal-nav h2 {
  font-family: var(--font-body);
  font-size: 22px;
  font-weight: 500;
  color: #202124;
}
.gcal-pill {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  padding: 0 18px;
  border: 1px solid #dadce0;
  border-radius: 999px;
  background: #ffffff;
  color: #202124;
  font-weight: 600;
}
.gcal-view-switch {
  border: 1px solid #dadce0;
  border-radius: 999px;
  background: #ffffff;
  padding: 3px;
}
.gcal-view-switch a {
  padding: 6px 12px;
  border-radius: 999px;
  color: #3c4043;
  font-size: var(--t-sm);
  font-weight: 700;
}
.gcal-view-switch a.is-active {
  background: #d2e3fc;
  color: #174ea6;
}
.gcal-shell {
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr) 48px;
  height: calc(100vh - 64px);
  min-height: 620px;
}
.gcal-sidebar {
  padding: 16px;
  background: #f8fafd;
  border-right: 1px solid #edf0f3;
}
.gcal-search-people {
  min-height: 40px;
  margin-top: var(--s-5);
  padding: 0 14px;
  display: flex;
  align-items: center;
  gap: var(--s-3);
  border: none;
  border-radius: 0;
  background: #eef2f8;
  color: #3c4043;
  font-size: var(--t-sm);
  font-weight: 500;
}
.gcal-search-people:hover {
  color: #202124;
  border-bottom: none;
}
.gcal-create {
  display: inline-flex;
  align-items: center;
  gap: var(--s-3);
  min-height: 56px;
  padding: 0 20px;
  border: 1px solid #dadce0;
  border-radius: 16px;
  background: #ffffff;
  color: #202124;
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(60, 64, 67, 0.18);
}
.gcal-create span {
  font-size: 26px;
  line-height: 1;
  color: #1a73e8;
}
.gcal-mini,
.gcal-cal-list {
  margin-top: var(--s-5);
}
.gcal-mini-head {
  display: flex;
  justify-content: space-between;
  margin-bottom: var(--s-3);
  color: #202124;
  font-size: var(--t-sm);
}
.gcal-mini-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}
.gcal-mini-weekday,
.gcal-mini-day {
  min-height: 26px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #3c4043;
  font-size: var(--t-2xs);
  border-bottom: none;
}
.gcal-mini-weekday {
  color: #70757a;
  font-weight: 800;
}
.gcal-mini-day.is-muted {
  color: #9aa0a6;
}
.gcal-mini-day.is-selected-week {
  background: #e8f0fe;
}
.gcal-mini-day.is-today {
  background: #1a73e8;
  color: #ffffff;
  font-weight: 800;
}
.gcal-mini-day.has-events::after {
  content: "";
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #1a73e8;
  position: absolute;
  margin-top: 18px;
}
.gcal-cal-list {
  display: flex;
  flex-direction: column;
  gap: 9px;
  color: #3c4043;
  font-size: var(--t-sm);
}
.gcal-list-head {
  color: #202124;
  font-weight: 800;
}
.gcal-cal-list span,
.gcal-cal-list a {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: #3c4043;
}
.gcal-cal-list i {
  width: 13px;
  height: 13px;
  border-radius: 3px;
  background: #1a73e8;
}
.gcal-cal-list i.is-dry-run { background: #f9ab00; }
.gcal-cal-list i.is-golden { background: #7e57c2; }
.gcal-cal-list i.is-capacity { background: #34a853; }
.gcal-cal-list i.is-appointment { background: #1a73e8; }
.gcal-cal-list i.is-hold { background: #fbbc04; }
.gcal-main {
  overflow: auto;
  background: #ffffff;
}
.gcal-week-head,
.gcal-all-day,
.gcal-time-grid {
  min-width: 1040px;
  display: grid;
  grid-template-columns: 68px repeat(7, minmax(132px, 1fr));
}
.gcal-week-head {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #ffffff;
  border-bottom: 1px solid #edf0f3;
}
.gcal-timezone {
  padding: 8px 8px 0;
  color: #5f6368;
  font-size: var(--t-2xs);
  text-align: right;
}
.gcal-day-head {
  min-height: 76px;
  display: grid;
  place-items: center;
  align-content: center;
  border-left: 1px solid #edf0f3;
  color: #3c4043;
}
.gcal-day-head span {
  font-size: var(--t-2xs);
  font-weight: 800;
  color: #5f6368;
}
.gcal-day-head strong {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  font-size: 28px;
  font-weight: 500;
}
.gcal-day-head.is-today strong {
  background: #1a73e8;
  color: #ffffff;
}
.gcal-all-day {
  border-bottom: 1px solid #edf0f3;
}
.gcal-all-day-cell {
  min-height: 36px;
  padding: 4px;
  border-left: 1px solid #edf0f3;
}
.gcal-time-label {
  min-height: 54px;
  padding: 0 8px;
  border-top: 1px solid #edf0f3;
  color: #5f6368;
  font-size: var(--t-xs);
  text-align: right;
  transform: translateY(-8px);
}
.gcal-time-cell {
  min-height: 54px;
  padding: 3px 5px;
  border-top: 1px solid #edf0f3;
  border-left: 1px solid #edf0f3;
}
.gcal-event {
  min-height: 36px;
  border-radius: 6px;
  background: #7986cb;
  color: #ffffff;
}
.gcal-event:hover {
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.8);
}
.gcal-event.is-dry-run {
  background: #f9ab00;
  color: #3c2500;
}
.gcal-event.is-golden {
  background: #7e57c2;
  color: #ffffff;
}
.gcal-event.is-complete {
  background: #33b679;
  color: #ffffff;
}
.gcal-event.is-blocked {
  background: #d93025;
  color: #ffffff;
}
.gcal-event.is-appointment {
  background: #1a73e8;
  color: #ffffff;
}
.gcal-event.is-hold,
.gcal-event.is-approval {
  background: #fbbc04;
  color: #3c2500;
}
.gcal-month-grid {
  min-width: 1040px;
  display: grid;
  grid-template-columns: repeat(7, minmax(132px, 1fr));
  background: #edf0f3;
  gap: 1px;
}
.gcal-month-weekday {
  min-height: 36px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 0 12px;
  background: #ffffff;
  color: #5f6368;
  font-size: var(--t-2xs);
  font-weight: 800;
}
.gcal-month-day {
  min-height: 128px;
  padding: 6px;
  background: #ffffff;
}
.gcal-month-day.is-muted {
  background: #fafafa;
  color: #9aa0a6;
}
.gcal-month-day-head {
  min-height: 26px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.gcal-month-day.is-today .gcal-month-day-head span {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #1a73e8;
  color: #ffffff;
}
.gcal-utility-rail {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 28px;
  padding-top: 14px;
  border-left: 1px solid #edf0f3;
  background: #ffffff;
  color: #5f6368;
  font-size: 18px;
}
.gcal-utility-rail span {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
}
.gcal-utility-rail .is-keep { color: #fbbc04; }
.gcal-utility-rail .is-tasks { color: #1a73e8; }
.gcal-utility-rail .is-contacts { color: #1a73e8; }
.gcal-utility-rail .is-maps { color: #34a853; }
.gcal-plus {
  margin-top: 12px;
  border-top: 1px solid #edf0f3;
}

/* ---------- KBD ---------- */
kbd, .kbd-inline {
  font-family: var(--font-mono);
  font-size: var(--t-2xs);
  padding: 1px 5px;
  background: var(--paper-inset);
  border: 1px solid var(--rule);
  border-radius: var(--radius-1);
  color: var(--ink-muted);
  letter-spacing: 0.04em;
}

/* ---------- Code blocks ---------- */
.code, pre.code {
  font-family: var(--font-mono);
  font-size: var(--t-xs);
  line-height: 1.55;
  background: var(--paper-inset);
  border: 1px solid var(--rule);
  border-radius: var(--radius-2);
  padding: var(--s-3) var(--s-4);
  color: var(--ink-soft);
  overflow-x: auto;
  margin: 0;
}
.code .key { color: var(--accent-ink); }
.code .str { color: var(--sage-ink); }
.code .num { color: var(--saffron-ink); }

/* ---------- Toolbar ---------- */
.toolbar {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  padding: var(--s-2) var(--s-3);
  background: var(--paper-card);
  border: 1px solid var(--rule);
  border-radius: var(--radius-2);
}
.toolbar .toolbar-divider {
  width: 1px;
  align-self: stretch;
  background: var(--rule);
  margin: 0 var(--s-1);
}

/* ---------- List items ---------- */
.list-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: var(--s-3);
  padding: var(--s-3) 0;
  border-bottom: 1px dashed var(--rule);
  align-items: start;
}
.list-row:last-child { border-bottom: none; }
.list-row .title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--t-md);
  line-height: 1.25;
  color: var(--ink);
}
.list-row .meta {
  font-family: var(--font-mono);
  font-size: var(--t-2xs);
  color: var(--ink-faint);
  letter-spacing: 0.04em;
}
.list-row .body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.list-row .right { display: flex; align-items: center; gap: var(--s-2); }
.row-actions {
  display: inline-flex;
  flex-wrap: wrap;
  gap: var(--s-1);
  justify-content: flex-end;
}
.row-details {
  margin-top: var(--s-2);
  color: var(--ink-soft);
}
.row-details summary {
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: var(--t-2xs);
  color: var(--accent);
  text-transform: uppercase;
}
.row-details .compact-list {
  margin-top: var(--s-2);
}
.packet-link-list {
  display: grid;
  gap: var(--s-1);
}
.packet-link {
  display: flex;
  justify-content: space-between;
  gap: var(--s-2);
  padding: 7px 0;
  border-bottom: 1px dashed var(--rule);
  color: var(--ink-soft);
  font-weight: 600;
}
.packet-link:last-child {
  border-bottom: none;
}
.packet-link .count {
  font-family: var(--font-mono);
  font-size: var(--t-2xs);
  color: var(--ink-faint);
}

/* ---------- Detail rows ---------- */
.kv {
  display: grid;
  grid-template-columns: 140px minmax(0, 1fr);
  gap: var(--s-3);
  padding: var(--s-2) 0;
  border-bottom: 1px solid var(--rule-soft);
  font-size: var(--t-sm);
}
.kv:last-child { border-bottom: none; }
.kv dt {
  font-size: var(--t-2xs);
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-muted);
  padding-top: 2px;
}
.kv dd { margin: 0; color: var(--ink); }

/* ---------- Empty state ---------- */
.empty {
  text-align: center;
  padding: var(--s-7) var(--s-4);
  color: var(--ink-muted);
}
.empty .empty-mark {
  font-family: var(--font-display);
  font-style: normal;
  font-size: var(--t-3xl);
  color: var(--saffron);
  margin-bottom: var(--s-3);
}
.empty .empty-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--t-xl);
  color: var(--ink);
  margin-bottom: var(--s-2);
}
.empty .empty-body {
  max-width: 38ch;
  margin: 0 auto;
  font-size: var(--t-sm);
  color: var(--ink-muted);
  line-height: 1.5;
}

/* ---------- Result banner ---------- */
.banner {
  padding: var(--s-3) var(--s-4);
  border-radius: var(--radius-2);
  border: 1px solid var(--rule);
  background: var(--paper-elevated);
  display: flex;
  align-items: flex-start;
  gap: var(--s-3);
  font-size: var(--t-sm);
}
.banner .banner-icon {
  font-family: var(--font-display);
  font-size: var(--t-lg);
  color: var(--saffron);
  line-height: 1;
}
.banner.success { background: var(--sage-soft); border-color: var(--sage); color: var(--sage-ink); }
.banner.success .banner-icon { color: var(--sage-ink); }
.banner.error   { background: var(--rust-soft); border-color: var(--rust); color: var(--rust-ink); }
.banner.error .banner-icon { color: var(--rust-ink); }

/* ---------- Notes pane / split workspace ---------- */
.workspace {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr);
  gap: 0;
  border: 1px solid var(--rule);
  border-radius: var(--radius-3);
  overflow: hidden;
  background: var(--paper-elevated);
  box-shadow: var(--shadow-2);
  min-height: 640px;
}
.workspace > .pane { padding: var(--s-5) var(--s-6); }
.workspace > .pane.notes-pane {
  background: var(--paper-card);
  border-right: 1px double var(--rule-strong);
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
}
.workspace > .pane.form-pane {
  background: var(--paper-elevated);
  display: flex;
  flex-direction: column;
  gap: var(--s-4);
  max-height: 80vh;
  overflow-y: auto;
}
.notes-pane .notes-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding-bottom: var(--s-3);
  border-bottom: 1px dashed var(--rule);
}
.notes-pane .notes-area {
  flex: 1;
  font-family: var(--font-body);
  font-size: var(--t-md);
  line-height: 1.7;
  background: var(--paper-card);
  border: none;
  resize: none;
  color: var(--ink);
  padding: 0;
  width: 100%;
  min-height: 480px;
}
.notes-pane .notes-area:focus { outline: none; }
.notes-pane .notes-display {
  flex: 1;
  font-family: var(--font-body);
  font-size: var(--t-md);
  line-height: 1.7;
  color: var(--ink);
  white-space: pre-wrap;
  word-break: break-word;
  display: none;
}
.workspace.is-extracted .notes-area { display: none; }
.workspace.is-extracted .notes-display { display: block; }
.workspace.is-menu-consulting > .pane {
  pointer-events: none;
  user-select: none;
  opacity: 0.12;
}

/* ---------- Intake Menu Builder ---------- */
.menu-builder-shell {
  position: absolute;
  inset: 0;
  z-index: 30;
  display: flex;
  padding: var(--s-4);
  background: rgba(247, 243, 236, 0.96);
  backdrop-filter: blur(3px);
  overflow: auto;
}
.menu-builder-shell[hidden] { display: none; }
.menu-builder-panel {
  width: 100%;
  min-height: 100%;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: var(--paper-elevated);
  border: 1px solid var(--rule);
  border-radius: var(--radius-2);
  box-shadow: var(--shadow-2);
}
.menu-builder-head,
.menu-builder-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-4);
  padding: var(--s-5);
  border-bottom: 1px solid var(--rule);
}
.menu-builder-head h2 {
  margin: 0;
  font-size: var(--t-3xl);
  line-height: 1.02;
}
.menu-builder-summary {
  max-width: 760px;
  margin: var(--s-2) 0 0;
  color: var(--ink-muted);
  font-size: var(--t-sm);
  line-height: 1.45;
}
.menu-builder-foot {
  border-top: 1px solid var(--rule);
  border-bottom: 0;
  margin-top: auto;
}
.menu-builder-grid {
  display: grid;
  grid-template-columns: minmax(260px, 0.9fr) minmax(280px, 0.9fr) minmax(280px, 0.72fr);
  gap: var(--s-5);
  padding: var(--s-5);
  min-height: 0;
  flex: 1;
}
.menu-builder-column {
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
  min-width: 0;
}
.chef-advisor-card {
  padding: var(--s-4);
  border: 1px solid var(--rule);
  border-radius: var(--radius-2);
  background: var(--paper-card);
  box-shadow: var(--shadow-1);
}
.chef-advisor-card h3 {
  margin: 2px 0 0;
  font-size: var(--t-2xl);
}
.chef-prompt-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--s-2);
}
.menu-builder-controls,
.menu-builder-add-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: var(--s-2);
}
.menu-catalog-results,
.menu-selected-list {
  border: 1px solid var(--rule);
  border-radius: var(--radius-2);
  background: var(--paper-inset);
  min-height: 260px;
  max-height: 52vh;
  overflow: auto;
}
.menu-catalog-row,
.menu-selected-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: var(--s-3);
  padding: var(--s-3);
  border-bottom: 1px dashed var(--rule);
}
.menu-catalog-row:last-child,
.menu-selected-row:last-child { border-bottom: 0; }
.menu-row-title {
  display: block;
  font-weight: 700;
  overflow-wrap: anywhere;
}
.menu-row-meta {
  display: block;
  color: var(--ink-muted);
  font-size: var(--t-xs);
}
.menu-selected-fields {
  display: grid;
  grid-template-columns: minmax(120px, 0.8fr) minmax(80px, 0.5fr) minmax(90px, 0.7fr);
  gap: var(--s-2);
  margin-top: var(--s-2);
}

/* Form sections */
.form-section {
  padding: var(--s-4) 0;
  border-top: 1px solid var(--rule);
}
.form-section:first-child { border-top: none; padding-top: 0; }
.form-section .section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: var(--s-3);
}
.form-section .section-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--t-xl);
  color: var(--ink);
  display: flex;
  align-items: baseline;
  gap: var(--s-2);
}
.form-section .section-title .num {
  font-family: var(--font-mono);
  font-size: var(--t-xs);
  color: var(--ink-faint);
  font-style: normal;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--s-3) var(--s-4);
}

/* ---------- Downstream agent preview ---------- */
.agent-deck {
  display: grid;
  gap: var(--s-3);
}
.agent-row {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  gap: var(--s-3);
  padding: var(--s-3);
  border: 1px solid var(--rule);
  border-radius: var(--radius-2);
  background: var(--paper-elevated);
  align-items: center;
  position: relative;
  transition: border-color 120ms ease, background 120ms ease;
}
.agent-row:hover { border-color: var(--rule-strong); background: var(--paper-card); }
.agent-row .glyph {
  font-family: var(--font-display);
  font-size: 22px;
  color: var(--accent);
  font-style: normal;
  line-height: 1;
  text-align: center;
}
.agent-row .agent-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.agent-row .agent-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--t-md);
  line-height: 1.2;
}
.agent-row .agent-scope {
  font-size: var(--t-xs);
  color: var(--ink-muted);
  line-height: 1.4;
}

/* ---------- Responsive ---------- */
@media (max-width: 1080px) {
  .shell { grid-template-columns: 1fr; }
  .rail {
    position: static;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--rule);
    flex-direction: row;
    align-items: center;
    flex-wrap: wrap;
    padding: var(--s-3) var(--s-5);
    gap: var(--s-4);
  }
  .rail-foot { margin-top: 0; padding-top: 0; border-top: none; }
  .nav-group { flex-direction: row; flex-wrap: wrap; gap: var(--s-1); }
  .nav-group .label { display: none; }
  .nav-link { padding: 5px 10px; border-radius: var(--radius-1); border-left: none; }
  .nav-link.is-active { border-left: none; border-bottom: 2px solid var(--accent); }
  .canvas { padding: var(--s-5) var(--s-5) var(--s-7); }
  .has-agent-rail .canvas,
  .has-agent-rail.gcal-page .canvas.gcal-canvas {
    padding-right: var(--s-5);
  }
  .expert-static-page .canvas { padding: var(--s-5) var(--s-5) var(--s-7); }
  .top-account {
    position: static;
    margin: 0 0 var(--s-4) auto;
    width: max-content;
    max-width: 100%;
  }
  .global-agent-rail {
    position: static;
    width: auto;
    height: 520px;
    border-left: none;
    border-top: 1px solid var(--rule);
    box-shadow: none;
  }
  .global-agent-panel {
    height: 520px;
    border-radius: 0;
  }
  .has-agent-rail.expert-static-page .workspace-shell {
    grid-template-columns: 1fr;
  }
  .job-progress-line {
    grid-template-columns: 1fr;
  }
  .job-progress-steps {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    row-gap: var(--s-3);
  }
  .workspace-right-rail {
    position: static;
    max-height: none;
  }
  .expert-static-page .workspace-right-rail {
    position: static;
    width: auto;
    border-left: none;
    box-shadow: none;
  }
  .expert-static-page .event-expert-panel {
    height: auto;
    min-height: 520px;
    border: 1px solid var(--rule);
    border-radius: var(--radius-2);
    box-shadow: var(--shadow-1);
  }
  .expert-static-page .source-upload-card { display: block; }
  .workspace { grid-template-columns: 1fr; min-height: 0; }
  .workspace > .pane.notes-pane { border-right: none; border-bottom: 1px double var(--rule-strong); }
  .menu-builder-grid,
  .menu-builder-controls,
  .menu-builder-add-row,
  .chef-prompt-grid { grid-template-columns: 1fr; }
  .menu-builder-shell { position: fixed; z-index: 120; }
  .menu-builder-panel { min-height: auto; }
}
@media (max-width: 720px) {
  .grid.cols-2, .grid.cols-3, .grid.cols-4, .grid.sidebar, .grid.split { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .field.span-2 { grid-column: auto; }
  .page-head { grid-template-columns: 1fr; }
  h1 { font-size: var(--t-3xl); }
  .display { font-size: var(--t-4xl); }
}
