/* PF Parser — design tokens
   One radius scale, one spacing rhythm, one palette. Every surface in this
   app (topbar, cards, inputs, buttons, drop zones, badges, notices, the
   combobox, the modal) draws from these instead of picking its own numbers. */
:root {
  --bg: #f3f5f8;
  --paper: #ffffff;
  --paper-2: #f8f9fb;
  --line: #d9dfe6;
  --text: #1c2430;
  --muted: #5b6573;
  --navy: #1e3a5f;
  --navy-2: #16304f;
  --accent: #1a56a8;
  --accent-hover: #154a90;
  --ok: #157a3c;
  --ok-bg: #e8f6ee;
  --ok-line: #b7e2c6;
  --fail: #b42318;
  --fail-bg: #fdecec;
  --fail-line: #f2c2be;
  --warn: #9a6700;
  --warn-bg: #fff6dd;
  --warn-line: #ead48a;
  --mute-bg: #eef1f5;
  --info: #1a56a8;
  --info-bg: #eaf1fb;
  --info-line: #bcd4ee;

  --radius-sm: 6px;   /* inputs, buttons, drop zones, chips */
  --radius-md: 10px;  /* cards, modal */
  --radius-pill: 999px; /* badges */

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;

  --shadow-card: 0 1px 2px rgba(20, 30, 45, 0.05), 0 1px 1px rgba(20, 30, 45, 0.03);
  --shadow-float: 0 8px 24px rgba(20, 30, 45, 0.14);

  --font: "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;
  --bar: 48px;
}

* { box-sizing: border-box; }
html, body, #root {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 13px;
  line-height: 1.4;
}
html { overflow-y: auto; }
body, #root { overflow: visible; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent); }

/* Shell */
.shell { min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 var(--space-4);
  height: var(--bar);
  flex-shrink: 0;
  background: var(--navy);
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 20;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.12);
}
.brand { display: flex; align-items: baseline; gap: var(--space-2); font-weight: 700; font-size: 14px; }
.brand-sub { font-weight: 400; font-size: 12px; color: rgba(255, 255, 255, 0.72); }
.topbar-meta { margin-left: auto; color: rgba(255, 255, 255, 0.65); font-size: 11px; }

.main {
  flex: 1 0 auto;
  display: flex;
  flex-direction: column;
  padding: var(--space-4);
  width: 100%;
  max-width: 800px;
  margin: 0 auto;
}
.page { flex: 1 0 auto; display: flex; flex-direction: column; gap: var(--space-4); }
.row { display: flex; gap: var(--space-2); flex-wrap: wrap; align-items: center; }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-3); align-items: start; }

.page-head { display: flex; justify-content: space-between; align-items: center; gap: var(--space-3); flex-wrap: wrap; }
.page-title { margin: 0; font-size: 18px; font-weight: 700; color: var(--navy); }
.page-lead { margin: 4px 0 0; color: var(--muted); font-size: 12px; max-width: 52em; }

/* Card — the one container shape everything else nests inside */
.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  padding: var(--space-4);
}
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  margin: calc(var(--space-4) * -1) calc(var(--space-4) * -1) var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: var(--paper-2);
  border-bottom: 1px solid var(--line);
  border-radius: var(--radius-md) var(--radius-md) 0 0;
}
.card-title { margin: 0; font-size: 14px; font-weight: 600; color: var(--navy); }
.muted { color: var(--muted); font-size: 12px; }

.split .card { display: flex; flex-direction: column; }

/* Buttons */
.btn {
  border: 1px solid var(--line);
  background: var(--paper);
  border-radius: var(--radius-sm);
  padding: 7px 14px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 500;
  white-space: nowrap;
  text-decoration: none;
  transition: background 0.12s ease, border-color 0.12s ease;
}
.btn:hover { background: var(--paper-2); border-color: #c3ccd6; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-ghost { background: var(--paper); }
.btn-danger { background: var(--fail-bg); color: var(--fail); border-color: var(--fail-line); }
.btn-icon { padding: 5px; width: 26px; height: 26px; justify-content: center; }
.client-add-actions { gap: 8px; align-items: center; min-height: 32px; }

/* Fields */
.field { display: flex; flex-direction: column; gap: var(--space-1); min-width: 0; flex: 1; }
.label { font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.02em; }
.input, .select, .textarea {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 7px 10px;
  outline: none;
  width: 100%;
}
.input:focus, .select:focus, .textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(26, 86, 168, 0.12); }
.textarea { min-height: 88px; resize: vertical; line-height: 1.45; }
.select { appearance: auto; }
.input:disabled { background: var(--mute-bg); color: var(--muted); }

/* Drop zone */
.drop {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  border: 2px dashed #c3ccd6;
  border-radius: var(--radius-sm);
  padding: var(--space-3) var(--space-4);
  background: var(--paper-2);
  color: var(--muted);
  cursor: pointer;
  min-height: 84px;
  transition: border-color 0.12s ease, background 0.12s ease;
}
.drop:hover { border-color: var(--accent); }
.drop.is-over { border-color: var(--accent); border-style: solid; background: #eef4fb; }
.drop.is-filled { border-style: solid; color: var(--text); background: #fff; border-color: #9db7d8; }
.drop.is-busy { cursor: progress; opacity: 0.7; }
.drop.is-busy:hover { border-color: #c3ccd6; }
.drop:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.drop input { display: none; }
.drop-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; gap: 2px; }
.drop-text strong { font-size: 13px; font-weight: 600; color: var(--text); }
.drop-text span { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; }

/* Badges — small pills, one size, one weight */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.badge-ok { background: var(--ok-bg); color: var(--ok); }
.badge-fail { background: var(--fail-bg); color: var(--fail); }
.badge-warn { background: var(--warn-bg); color: var(--warn); }
.badge-mute { background: var(--mute-bg); color: var(--muted); }
.badge-info { background: var(--info-bg); color: var(--info); }
.req { color: var(--warn); font-weight: 700; }

/* Notices */
.notice { border-radius: var(--radius-sm); padding: var(--space-3); flex-shrink: 0; }
.notice-error { color: var(--fail); background: var(--fail-bg); border: 1px solid var(--fail-line); }
.notice-warn { color: var(--warn); background: var(--warn-bg); border: 1px solid var(--warn-line); }
.notice-ok { color: var(--ok); background: var(--ok-bg); border: 1px solid var(--ok-line); }
.notice-title { display: block; font-size: 13px; margin-bottom: 4px; }
.notice-body, .notice-hint { margin: 0; color: inherit; }
.notice-list { margin: 0 0 var(--space-2); padding-left: 1.2em; }
.notice-list li { margin: 2px 0; font-weight: 600; }
.notice .btn { margin-top: var(--space-1); }
.error {
  color: var(--fail);
  background: var(--fail-bg);
  border: 1px solid var(--fail-line);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
}
.empty {
  text-align: center;
  padding: var(--space-4);
  color: var(--muted);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}

/* Table (used inside the mapping modal) */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-sm); background: #fff; }
table { width: 100%; border-collapse: collapse; font-size: 12px; }
th, td { text-align: left; padding: 7px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: var(--navy); font-size: 11px; font-weight: 600; background: var(--paper-2); }
tr:last-child td { border-bottom: 0; }
.tr-gap td { background: var(--warn-bg) !important; }
.tr-suggested td { background: var(--info-bg) !important; }
.tr-automatch td { background: var(--mute-bg) !important; }
.field-label { font-weight: 500; }
.section-label { display: block; margin: var(--space-4) 0 var(--space-2); font-size: 12px; font-weight: 600; color: var(--navy); }

/* Combobox */
.combobox { position: relative; flex: 1; min-width: 0; }
.combobox-list {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 30;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-float);
  max-height: 240px;
  overflow-y: auto;
  margin: 0;
  padding: var(--space-1) 0;
  list-style: none;
}
.combobox-option { padding: 7px 10px; cursor: pointer; font-size: 13px; }
.combobox-option.is-active { background: var(--paper-2); }
.combobox-option.is-selected { font-weight: 600; color: var(--accent); }
.combobox-empty { padding: 7px 10px; color: var(--muted); font-size: 12px; }

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(20, 26, 35, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  z-index: 50;
}
.modal-card {
  background: var(--paper);
  border: 1px solid var(--line);
  padding: var(--space-5);
  max-width: 720px;
  width: 100%;
  height: 100vh;
  max-height: 100vh;
  overflow: auto;
  box-shadow: var(--shadow-float);
}

/* Spinner (FileDrop busy state) */
.spin { animation: pf-spin 0.9s linear infinite; }
@keyframes pf-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@media (max-width: 900px) {
  .split { grid-template-columns: 1fr; }
}

/* View tabs — underline style, distinct from .btn action buttons so the two
   never compete for the same visual weight (WorkingsView's Run/History). */
.view-tabs { display: flex; gap: var(--space-5); border-bottom: 1px solid var(--line); }
.view-tab {
  background: none;
  border: none;
  padding: var(--space-2) 1px 10px;
  margin-bottom: -1px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  border-bottom: 2px solid transparent;
}
.view-tab:hover { color: var(--text); }
.view-tab.is-active { color: var(--navy); border-bottom-color: var(--accent); }

/* Status toolbar — one compact strip for state + figures + actions, instead
   of a full-width colored notice block. */
.status-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  flex-wrap: wrap;
}
.status-line { display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; min-width: 0; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.status-dot-ok { background: var(--ok); }
.status-dot-warn { background: var(--warn); }
.status-dot-fail { background: var(--fail); }
.status-title { font-weight: 700; font-size: 13px; }
.status-title.tone-ok { color: var(--ok); }
.status-title.tone-warn { color: var(--warn); }
.status-title.tone-fail { color: var(--fail); }
.status-figures { color: var(--muted); font-size: 12px; }

/* Checks grid — compact two-up rows; only failing checks show their detail
   line, so a mostly-passing gate list doesn't dominate the page. */
.check-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1px var(--space-4); }
@media (max-width: 640px) { .check-grid { grid-template-columns: 1fr; } }
.check-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  padding: 6px var(--space-2);
  border-radius: var(--radius-sm);
  min-width: 0;
}
.check-row.is-fail { background: var(--fail-bg); }
.check-name { font-size: 12px; min-width: 0; }
.check-name strong { font-weight: 500; }
.check-name span { display: block; color: var(--fail); font-size: 11px; margin-top: 1px; }

/* Review list — blockers/exceptions as one continuous accent-bordered
   block, not separate floating boxes: rows sit flush against each other
   with a hairline divider, rounding only at the list's own ends. */
.review-list {
  display: flex;
  flex-direction: column;
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.review-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: var(--space-3);
  border-left: 3px solid var(--line);
  background: var(--paper-2);
}
.review-item + .review-item { border-top: 1px solid rgba(20, 30, 45, 0.08); }
.review-item.tone-fail { border-left-color: var(--fail); background: var(--fail-bg); }
.review-item.tone-warn { border-left-color: var(--warn); background: var(--warn-bg); }
.review-item-title { font-weight: 600; font-size: 12px; }
.review-item-cols {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: var(--space-4);
  align-items: start;
}
.review-item-detail { color: var(--muted); font-size: 12px; line-height: 1.45; }
.review-item-codes { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 4px; max-width: 220px; }
.review-item-codes-count { color: var(--muted); font-size: 12px; font-weight: 600; white-space: nowrap; }
.chip {
  display: inline-flex;
  align-items: center;
  padding: 1px 8px;
  border-radius: var(--radius-pill);
  background: var(--mute-bg);
  color: var(--muted);
  font-size: 11px;
  border: none;
  font-family: inherit;
}

/* Collapsible "what we checked" — closed by default when everything passes,
   so the routine case doesn't force-scroll past thirteen green rows. */
.checks-disclosure > summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 6px;
}
.checks-disclosure > summary::-webkit-details-marker { display: none; }
.checks-disclosure > summary::before {
  content: "▸";
  font-size: 10px;
  color: var(--muted);
  transition: transform 0.15s ease;
}
.checks-disclosure[open] > summary::before { transform: rotate(90deg); }
.checks-disclosure .card-title { display: inline; }
.checks-disclosure[open] .check-grid { margin-top: var(--space-3); }

/* Full-screen workings review: enough room for employee evidence without
   making the assistant feel like a small generic support widget. */
.assistant-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 70;
  background: var(--paper-2);
}
.assistant-modal {
  width: 100vw;
  height: 100vh;
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  background: var(--paper-2);
}
.assistant-modal-head {
  min-height: 40px;
  display: flex;
  align-items: stretch;
  padding: 0;
  color: var(--text);
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}
.assistant-modal-head-inner {
  width: 100%;
  max-width: 640px;
  min-width: 0;
  margin: 0 auto;
  padding: 3px 12px;
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
}
.assistant-modal-title { min-width: 0; }
.assistant-modal-head h2 {
  margin: 0;
  overflow: hidden;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.assistant-modal-head p {
  margin: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.assistant-modal-close.btn {
  width: 24px;
  height: 24px;
  padding: 0;
  color: var(--muted);
  background: transparent;
  border-color: transparent;
}
.assistant-modal-close.btn:hover { color: var(--text); background: var(--mute-bg); }
.assistant-scope-status {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--muted);
  font-size: 10px;
  white-space: nowrap;
}
.assistant-modal-body { min-height: 0; background: var(--paper-2); }

/* Calculation assistant — a quiet audit transcript. */
.assistant-panel {
  position: relative;
  min-height: 560px;
  display: flex;
  flex-direction: column;
  margin-top: var(--space-1);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}
.assistant-modal-body .assistant-panel {
  width: 100%;
  max-width: 640px;
  height: 100%;
  min-height: 0;
  margin: 0 auto;
  border-top: 0;
  border-bottom: 0;
  border-radius: 0;
  box-shadow: none;
}
.assistant-context-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: var(--paper-2);
  border-bottom: 1px solid var(--line);
}
.assistant-context-bar > div { display: flex; flex-direction: column; gap: 2px; }
.assistant-context-bar > div span { color: var(--muted); font-size: 11px; }
.assistant-context-bar .select { width: auto; min-width: 190px; }
.assistant-panel > .error { margin: var(--space-3) var(--space-4) 0; }
.assistant-transcript {
  flex: 1;
  min-height: 0;
  max-height: 58vh;
  overflow-y: auto;
  padding: var(--space-4) var(--space-4) 118px;
  background: var(--paper);
  scroll-behavior: smooth;
}
.assistant-modal-body .assistant-transcript { max-height: none; }
.assistant-message {
  width: 100%;
  margin-bottom: 10px;
  animation: assistant-message-in 160ms ease-out both;
}
.assistant-message-user { width: fit-content; max-width: 85%; margin-left: auto; }
.assistant-message-assistant { margin-right: auto; }
.assistant-message-meta {
  display: flex;
  justify-content: flex-end;
  height: 18px;
  color: var(--muted);
  font-size: 11px;
}
.assistant-message-content {
  padding: 4px 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  font-size: 13px;
  line-height: 1.62;
}
.assistant-message-user .assistant-message-content {
  padding: 8px 14px;
  color: var(--text);
  background: var(--mute-bg);
  border-radius: 16px 16px 5px 16px;
}
.assistant-message-content p { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.assistant-message-content p + p { margin-top: 8px; }
.assistant-message-content h2,
.assistant-message-content h3 {
  margin: 16px 0 6px;
  color: var(--text);
  font-weight: 600;
  line-height: 1.35;
}
.assistant-message-content h2 { padding-bottom: 4px; border-bottom: 1px solid var(--line); font-size: 15px; }
.assistant-message-content h3 { font-size: 13px; }
.assistant-message-content code {
  padding: 1px 4px;
  border-radius: 3px;
  background: var(--mute-bg);
  color: var(--navy);
  font: 11px/1.4 "Cascadia Mono", Consolas, monospace;
}
.assistant-message-user .assistant-message-content code {
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
}
.assistant-message-bullet { display: grid; grid-template-columns: 12px 1fr; }
.assistant-message-bullet > span { color: var(--accent); }
.assistant-copy {
  padding: 1px 5px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 10px;
  opacity: 0;
}
.assistant-message-assistant:hover .assistant-copy,
.assistant-copy:focus-visible { opacity: 1; }
.assistant-copy:hover { color: var(--accent); }
.assistant-approval-args {
  max-height: 160px;
  overflow: auto;
  margin: 6px 0 0;
  padding: var(--space-2);
  background: rgba(20, 30, 45, 0.05);
  border-radius: var(--radius-sm);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font: 11px/1.45 "Cascadia Mono", Consolas, monospace;
}
.assistant-empty {
  min-height: 260px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  color: var(--muted);
}
.assistant-empty-icon {
  width: 42px;
  height: 42px;
  margin-bottom: var(--space-3);
  display: grid;
  place-items: center;
  color: var(--muted);
  background: var(--mute-bg);
  border-radius: 50%;
}
.assistant-empty strong { color: var(--navy); font-size: 14px; }
.assistant-empty p { max-width: 480px; margin: 6px 0 var(--space-3); }
.assistant-starters { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--space-2); }
.assistant-starters button {
  border: 1px solid var(--info-line);
  border-radius: var(--radius-pill);
  background: var(--info-bg);
  color: var(--info);
  padding: 6px 10px;
  font-size: 11px;
}
.assistant-starters button:hover { border-color: var(--accent); }
.assistant-activity {
  position: relative;
  display: inline-flex;
  overflow: hidden;
  width: max-content;
  max-width: 100%;
  margin: var(--space-2) 0 var(--space-3);
  padding: 2px 0;
  border-radius: var(--radius-pill);
  color: var(--muted);
  background: var(--paper);
  font-size: 12px;
  animation: assistant-activity-in 200ms ease-out both;
}
.assistant-activity-star {
  position: absolute;
  z-index: 0;
  width: 300%;
  height: 50%;
  border-radius: 50%;
  background: radial-gradient(circle, #4f8fe8, transparent 12%);
}
.assistant-activity-star-bottom {
  right: -250%;
  bottom: -12px;
  animation: assistant-star-bottom 3.6s linear infinite alternate;
}
.assistant-activity-star-top {
  top: -12px;
  left: -250%;
  animation: assistant-star-top 3.6s linear infinite alternate;
}
.assistant-activity-inner {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px 6px 10px;
  color: var(--muted);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
}
.assistant-thinking-dots {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.assistant-thinking-dots span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 7px rgba(26, 86, 168, 0.45);
  animation: assistant-think 1.05s ease-in-out infinite;
}
.assistant-thinking-dots span:nth-child(2) { animation-delay: 0.16s; }
.assistant-thinking-dots span:nth-child(3) { animation-delay: 0.32s; }
.assistant-shiny-text {
  display: inline-block;
  color: var(--muted);
  background-image: linear-gradient(
    120deg,
    var(--muted) 0%,
    var(--muted) 35%,
    #fff 50%,
    var(--muted) 65%,
    var(--muted) 100%
  );
  background-size: 200% auto;
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: assistant-shine 2s linear infinite;
}
.assistant-approval {
  max-width: 650px;
  margin: var(--space-3) 0;
  padding: var(--space-3);
  border: 1px solid var(--warn-line);
  border-left: 3px solid var(--warn);
  border-radius: var(--radius-sm);
  background: var(--warn-bg);
}
.assistant-approval-head { display: flex; align-items: center; gap: var(--space-2); color: var(--warn); }
.assistant-approval p { margin: var(--space-2) 0; }
.assistant-approval .assistant-approval-note { color: var(--muted); font-size: 11px; }
.assistant-approval-args { background: rgba(255, 255, 255, 0.65); }
.assistant-approval-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-2);
  margin-top: var(--space-3);
}
.assistant-composer {
  position: absolute;
  inset: auto 0 0;
  z-index: 5;
  padding: 24px 12px max(10px, env(safe-area-inset-bottom));
  background: linear-gradient(to bottom, transparent, rgba(255, 255, 255, 0.96) 34%, var(--paper) 60%);
}
.assistant-composer-box {
  overflow: hidden;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 6px 20px rgba(20, 30, 45, 0.08);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.assistant-composer-box:focus-within {
  border-color: #aab5c2;
  box-shadow: 0 8px 24px rgba(20, 30, 45, 0.11);
}
.assistant-composer-input {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  padding: 8px 10px 2px;
}
.assistant-composer-input textarea {
  min-height: 22px;
  max-height: 120px;
  flex: 1;
  resize: none;
  overflow-y: auto;
  padding: 2px 0;
  color: var(--text);
  background: transparent;
  border: 0;
  outline: 0;
  font: 13px/1.45 var(--font);
}
.assistant-composer-input textarea::placeholder { color: #7c8794; }
.assistant-send {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  color: #fff;
  background: var(--text);
  border: 0;
  border-radius: 50%;
}
.assistant-send:hover { background: var(--navy); }
.assistant-send:disabled { opacity: 0.32; cursor: not-allowed; }
.assistant-composer-foot {
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
  padding: 0 10px 8px;
}
.assistant-chip {
  height: 24px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
  padding: 0 8px;
  color: var(--muted);
  background: var(--mute-bg);
  border-radius: var(--radius-pill);
  font-size: 10px;
}
.assistant-run-picker { max-width: 190px; padding-right: 4px; }
.assistant-run-picker .select {
  min-width: 0;
  height: 22px;
  padding: 0 20px 0 0;
  overflow: hidden;
  color: var(--muted);
  background: transparent;
  border: 0;
  box-shadow: none;
  font-size: 10px;
  text-overflow: ellipsis;
}
.assistant-composer-hint {
  margin-left: auto;
  overflow: hidden;
  color: var(--muted);
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@keyframes assistant-message-in {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes assistant-activity-in {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes assistant-think {
  0%, 80%, 100% { transform: translateY(0) scale(0.72); opacity: 0.4; }
  40% { transform: translateY(-3px) scale(1); opacity: 1; }
}
@keyframes assistant-star-bottom {
  0% { transform: translate(0, 0); opacity: 1; }
  100% { transform: translate(-100%, 0); opacity: 0; }
}
@keyframes assistant-star-top {
  0% { transform: translate(0, 0); opacity: 1; }
  100% { transform: translate(100%, 0); opacity: 0; }
}
@keyframes assistant-shine {
  from { background-position: 150% center; }
  to { background-position: -50% center; }
}

@media (max-width: 640px) {
  .assistant-modal-head { min-height: 40px; padding: 0; }
  .assistant-modal-head-inner { padding: 3px 10px; }
  .assistant-scope-status { font-size: 0; }
  .assistant-context-bar { align-items: stretch; flex-direction: column; }
  .assistant-context-bar .select { width: 100%; }
  .assistant-message { width: 100%; }
  .assistant-message-user { width: fit-content; max-width: 92%; }
  .assistant-transcript { max-height: 54vh; padding: var(--space-3); }
  .assistant-modal-body .assistant-transcript { max-height: none; padding-bottom: 110px; }
  .assistant-composer { padding: 20px 10px max(8px, env(safe-area-inset-bottom)); }
  .assistant-composer-hint { display: none; }
  .assistant-chip { padding: 0 8px; }
  .assistant-run-picker { max-width: 180px; }
}

@media (prefers-reduced-motion: reduce) {
  .assistant-message,
  .assistant-activity,
  .assistant-activity-star,
  .assistant-thinking-dots span,
  .assistant-shiny-text {
    animation: none;
  }
  .assistant-shiny-text {
    background: none;
    -webkit-text-fill-color: currentColor;
  }
  .assistant-transcript { scroll-behavior: auto; }
}
