/* Gravity Desk — agent workspace.
 *
 * Values here mirror the approved design mockup (project/Main.dc.html) 1:1:
 * palette, type scale, spacing, radii and shadows are taken from its inline
 * styles rather than re-derived. Keep them in sync with that reference. */

:root{
  /* These names predate direction B. They now point at its tokens (desk.src.css
     :root), so the AI agent builder and rule builder share the product's type
     and palette. Change colors there, not here. */
  --font-sans:var(--ui);
  --font-mono:var(--code);

  --bg:var(--ground);
  --surface:var(--sheet);
  --raised:var(--sheet-2);
  --line:var(--rule);
  --line-soft:var(--rule-soft);
  --line-dashed:var(--rule);

  --ink-body:var(--ink-2);
  --ink-muted:var(--ink-3);
  --ink-faint:var(--ink-4);
  --ink-placeholder:var(--ink-4);

  --accent:var(--sign);
  --accent-soft:var(--sign-wash);
  --accent-nav:var(--sign-wash);
  --accent-border:color-mix(in srgb,var(--sign) 30%,var(--sheet));
  --accent-tint:var(--sign-wash);

  --critical:var(--a1);
  --critical-soft:color-mix(in srgb,var(--a1) 12%,var(--sheet));
  --critical-border:color-mix(in srgb,var(--a1) 40%,var(--sheet));
  --warning:var(--pend);
  --warning-soft:var(--pend-wash);
  --warning-tint:var(--pend-wash);
  --warning-deep:var(--pend);
  --warning-chip:var(--pend-wash);
  --warning-chip-border:color-mix(in srgb,var(--pend) 35%,var(--sheet));
  --success:var(--ok);

  --tooltip:var(--ink);

  --shadow-menu:var(--shadow);
}

*{ box-sizing:border-box; }
[hidden]{ display:none !important; }

body{
  margin:0;
  background:var(--bg);
  color:var(--ink);
  font-family:var(--font-sans);
  font-size:13.5px;
}
.mono{ font-family:var(--font-mono); font-feature-settings:"tnum"; }
button{ font-family:inherit; cursor:pointer; }
input, select{ font-family:inherit; }
::selection{ background:var(--sign); color:var(--sign-ink); }
:focus-visible{ outline:2px solid var(--accent); outline-offset:2px; }
@media (prefers-reduced-motion: reduce){ *{ animation-duration:.001ms !important; transition-duration:.001ms !important; } }

/* The app shell, Conversations and the customer page moved to desk.css
   (direction B, 2026-10-17). What remains here styles the screens not yet
   redesigned: the AI agent builder and the rule builder. */

.btn-primary{ background:var(--accent); color:var(--sign-ink); border:none; border-radius:6px; font-weight:600; }

/* ================= ERROR BANNER ================= */
#errorBanner{
  display:flex; align-items:center; gap:10px; padding:9px 28px; background:var(--critical-soft);
  color:var(--critical); font-size:12.5px; border-bottom:1px solid var(--critical-border); flex-shrink:0;
}
#errorBanner[hidden]{ display:none; }
#errorBannerDismiss{
  margin-left:auto; border:none; background:transparent; color:var(--critical);
  font-weight:700; font-size:14px; line-height:1;
}

::-webkit-scrollbar{ width:10px; height:10px; }
::-webkit-scrollbar-thumb{ background:var(--line); border-radius:5px; }
::-webkit-scrollbar-track{ background:transparent; }

/* --- Phase 2C: rule builder --------------------------------------------- */
:root{
  --source-ticket:var(--sign);
  --source-customer:#2E7A72;
  --source-organization:#A67C3E;
}
.rb{ display:flex; flex-direction:column; gap:10px; font-size:12.5px; color:var(--ink-body); }
.rb-group{ border:1px solid var(--line); border-radius:8px; padding:10px; display:flex; flex-direction:column; gap:8px; background:var(--surface); }
.rb-group.rb-depth-2{ background:var(--bg); }
.rb-group.rb-depth-3{ background:var(--raised); }
.rb-group.rb-depth-1{ border:none; padding:0; background:transparent; }
.rb-group-head{ display:flex; align-items:center; gap:8px; }
.rb-hint{ color:var(--ink-muted); }
.rb-op, .rb-field, .rb-cmp, .rb-value{
  font:inherit; color:var(--ink-body); background:var(--surface);
  border:1px solid var(--line); border-radius:6px; padding:5px 7px;
}
.rb-op{ font-weight:600; }
.rb-leaf{ display:flex; flex-wrap:wrap; align-items:center; gap:6px; }
.rb-source{
  font-size:11px; font-weight:700; border-radius:999px; padding:2px 8px; white-space:nowrap;
}
.rb-source-ticket{ background:color-mix(in srgb, var(--source-ticket) 13%, transparent); color:var(--source-ticket); }
.rb-source-customer{ background:color-mix(in srgb, var(--source-customer) 13%, transparent); color:var(--source-customer); }
.rb-source-organization{ background:color-mix(in srgb, var(--source-organization) 15%, transparent); color:var(--source-organization); }
.rb-source-unknown{ background:var(--critical-soft); color:var(--critical); }
.rb-value-wrap{ display:inline-flex; align-items:center; gap:6px; }
.rb-days{ width:72px; }
.rb-suffix{ color:var(--ink-muted); }
.rb-multi{ display:inline-flex; flex-wrap:wrap; gap:4px 12px; }
.rb-check{ display:inline-flex; align-items:center; gap:4px; }
.rb-remove, .rb-remove-group{
  background:transparent; border:1px solid transparent; border-radius:6px; color:var(--ink-faint);
  cursor:pointer; padding:3px 8px; font-size:13px;
}
.rb-remove:hover, .rb-remove-group:hover{ color:var(--critical); border-color:var(--critical-border); }
.rb-remove-group{ margin-left:auto; font-size:12px; }
.rb-remove:disabled{ opacity:.4; cursor:default; }
.rb-actions{ display:flex; gap:6px; }
.rb-add{
  background:transparent; color:var(--accent); border:1px dashed var(--accent-border); border-radius:6px;
  padding:4px 10px; font-size:12px; font-weight:600; cursor:pointer;
}
.rb-add:disabled{ color:var(--ink-faint); border-color:var(--line); cursor:default; }
.rb-empty{ margin:0; color:var(--ink-faint); }
.rb-readback{ border-top:1px solid var(--line-soft); padding-top:8px; }
.rb-readback p{ margin:0 0 4px; }
.rb-text{ color:var(--ink); font-weight:500; }
.rb-count{ color:var(--ink-muted); }
.rb-muted{ color:var(--ink-faint); }
.rb-invalid{ color:var(--critical); }

@media (max-width:720px){
  .rb-leaf{ align-items:stretch; }
  .rb-field, .rb-cmp, .rb-value{ flex:1 1 140px; min-width:0; }
}

/* ---------------------------------------------------------------------------
   Agents workspace (Phase 2C Plan 2)
   --------------------------------------------------------------------------- */
.st-editor{ display:flex; flex-direction:column; gap:14px; }
.st-field{ display:flex; flex-direction:column; gap:6px; }
.st-label{ font-size:12px; font-weight:600; color:var(--ink-body); }
.st-hint{ font-size:12px; color:var(--ink-muted); line-height:1.4; }
.st-note{ margin:0; font-size:12.5px; color:var(--ink-muted); }
.st-input{ border:1px solid var(--line); border-radius:6px; padding:7px 9px; background:var(--surface); color:var(--ink); font:inherit; font-size:13px; }
textarea.st-input{ resize:vertical; line-height:1.45; }
.st-number{ max-width:120px; }
.st-color{ width:44px; height:32px; padding:2px; border:1px solid var(--line); border-radius:6px; background:var(--surface); }
.st-inline{ display:flex; gap:16px; align-items:flex-end; flex-wrap:wrap; }
.st-presets, .st-checks{ display:flex; flex-wrap:wrap; gap:6px 16px; }
.st-radio, .st-check{ display:inline-flex; align-items:center; gap:6px; font-size:13px; color:var(--ink-body); }
.st-rule{ border:1px dashed var(--line-dashed); border-radius:8px; padding:10px; }
.st-chips{ display:flex; flex-wrap:wrap; gap:6px; }
.st-chip{ border:1px solid var(--line); background:var(--surface); color:var(--ink-body); border-radius:999px; padding:3px 10px; font-size:12px; }
.st-chip.on{ background:var(--accent-soft); border-color:var(--accent-border); color:var(--accent); }
.st-count{ margin:0; font-size:12.5px; color:var(--ink); display:flex; flex-direction:column; gap:2px; }
.st-voice{ display:flex; flex-direction:column; gap:10px; padding:12px; background:var(--bg); border:1px solid var(--line-soft); border-radius:8px; }
.st-sliders{ display:grid; grid-template-columns:repeat(auto-fill, minmax(230px, 1fr)); gap:12px 18px; }
.st-slider{ display:flex; flex-direction:column; gap:4px; }
.st-slider input[type=range]{ accent-color:var(--accent); }
.ti{ display:flex; flex-direction:column; gap:10px; }
.ti-modes{ display:inline-flex; border:1px solid var(--line); border-radius:7px; overflow:hidden; align-self:flex-start; }
.ti-mode{ background:var(--surface); border:none; padding:5px 12px; font-size:12.5px; color:var(--ink-muted); }
.ti-mode.on{ background:var(--accent-soft); color:var(--accent); font-weight:600; }
.ti-replay{ display:flex; gap:8px; }
.ti-replay select{ flex:1; min-width:0; }
.ti-log{ display:flex; flex-direction:column; gap:8px; max-height:420px; overflow:auto; }
.ti-turn{ border-radius:8px; padding:8px 10px; display:flex; flex-direction:column; gap:4px; font-size:13px; }
.ti-turn p{ margin:0; white-space:pre-wrap; line-height:1.45; }
.ti-user{ background:var(--raised); }
.ti-agent{ background:var(--accent-tint); border:1px solid var(--accent-border); }
.ti-failed{ background:var(--critical-soft); border-color:var(--critical-border); }
.ti-who{ font-size:11px; font-weight:600; color:var(--ink-faint); text-transform:uppercase; letter-spacing:.04em; }
.ti-meta{ display:flex; flex-wrap:wrap; gap:6px; }
.ti-chip{ font-size:11.5px; padding:1px 8px; border-radius:999px; background:var(--surface); border:1px solid var(--line); color:var(--ink-body); }
.ti-escalated{ background:var(--warning-chip); border-color:var(--warning-chip-border); color:var(--warning-deep); }
.ti-resolved{ color:var(--success); }
.ti-flag{ background:var(--critical-soft); border-color:var(--critical-border); color:var(--critical); }
.ti-reason{ color:var(--ink-muted); font-size:12px; }
.ti-compose{ display:flex; flex-direction:column; gap:6px; align-items:flex-end; }
.ti-compose textarea{ width:100%; }
.ti-inspect, .ti-compare{ border:1px solid var(--line-soft); border-radius:8px; padding:8px 10px; font-size:12.5px; }
.ti-inspect summary, .ti-compare summary{ cursor:pointer; font-weight:600; color:var(--ink-body); }
.ti-inspect h4{ margin:10px 0 4px; font-size:12px; color:var(--ink-muted); }
.ti-inspect pre{ margin:0; padding:8px; background:var(--bg); border-radius:6px; font-family:var(--font-mono); font-size:11.5px; white-space:pre-wrap; max-height:220px; overflow:auto; }
