:root {
  color-scheme: dark;
  --bg: #09090b;
  --panel: #101012;
  --panel-2: #151518;
  --panel-3: #1b1b1f;
  --line: #27272d;
  --line-soft: #1e1e22;
  --text: #f4f4f5;
  --muted: #93939d;
  --faint: #666671;
  --red: #f04444;
  --red-soft: rgba(240, 68, 68, .13);
  --blue: #56a8ff;
  --violet: #a78bfa;
  --green: #4dd69c;
  --amber: #e9b949;
  --radius: 14px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); }
button, input, textarea, select { font: inherit; color: inherit; }
button, select { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .5; }
.hidden { display: none !important; }

.app-shell {
  display: grid;
  grid-template-columns: 64px 390px minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  height: 100dvh;
  overflow: hidden;
}

.rail {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 14px 8px max(14px, env(safe-area-inset-bottom));
  border-right: 1px solid var(--line-soft);
  background: #0c0c0e;
}
.brand { text-decoration: none; margin-bottom: 22px; }
.brand-frame {
  display: grid; place-items: center; width: 42px; height: 42px;
  border: 1px solid #303036; border-radius: 13px; overflow: hidden;
  background: #050506;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.06), 0 10px 28px rgba(232,18,38,.13);
}
.brand-mark {
  display: block; width: 38px; height: 38px; border-radius: 11px;
}
.welcome-orb span {
  display: grid; place-items: center; font-weight: 900;
  background: linear-gradient(145deg, #ff5c5c, #b71620);
  color: white; box-shadow: inset 0 1px 0 rgba(255,255,255,.25), 0 10px 25px rgba(193,24,38,.22);
}
.rail-button {
  display: grid; place-items: center; width: 42px; height: 42px; margin: 3px 0;
  border: 0; border-radius: 11px; color: var(--muted); background: transparent;
  text-decoration: none; font-size: 20px;
}
.rail-button:hover, .rail-button.active { color: white; background: var(--panel-3); }
.rail-button.enabled { color: var(--green); }
.rail-button.blocked { color: var(--red); }
#installButton { display: none; }
.rail-spacer { flex: 1; }

.inbox-pane {
  min-width: 0; display: flex; flex-direction: column;
  border-right: 1px solid var(--line); background: var(--panel);
}
.inbox-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 25px 22px 14px;
}
.eyebrow {
  margin: 0 0 5px; color: var(--red); font-size: 11px; font-weight: 800;
  letter-spacing: .13em; text-transform: uppercase;
}
h1, h2, h3, p { margin-top: 0; }
.inbox-header h1 { margin: 0; font-size: 27px; letter-spacing: -.04em; }
.icon-button {
  border: 1px solid var(--line); background: var(--panel-2); border-radius: 10px;
  width: 38px; height: 38px; display: grid; place-items: center; font-size: 20px;
}
.icon-button.primary, .button.primary, .send-button {
  border-color: #d32b36; background: linear-gradient(180deg, #f34c56, #d32732);
  color: white; box-shadow: 0 7px 18px rgba(210,39,50,.2);
}

.host-row {
  display: flex; align-items: center; gap: 8px; margin: 0 22px 14px;
  padding: 9px 11px; border: 1px solid var(--line); border-radius: 10px; background: #121215;
}
.presence { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 4px rgba(77,214,156,.1); }
.host-row select { flex: 1; min-width: 0; border: 0; background: transparent; font-size: 13px; font-weight: 650; outline: none; }
.host-status { color: var(--muted); font-size: 11px; }

.search {
  display: flex; align-items: center; gap: 8px; margin: 0 22px 14px; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 10px; color: var(--faint); background: #0d0d0f;
}
.search input { width: 100%; border: 0; outline: 0; background: transparent; font-size: 13px; }
.filters {
  display: flex; gap: 4px; overflow-x: auto; padding: 0 18px 12px; scrollbar-width: none;
  border-bottom: 1px solid var(--line-soft);
}
.filter {
  white-space: nowrap; border: 0; border-radius: 8px; padding: 7px 9px;
  background: transparent; color: var(--muted); font-size: 12px; font-weight: 650;
}
.filter span { margin-left: 4px; color: var(--faint); }
.filter.active { color: white; background: var(--panel-3); }
.assignment-list { min-height: 0; overflow-y: auto; padding: 10px; }
.assignment-card {
  position: relative; width: 100%; border: 1px solid transparent; border-radius: 12px;
  margin-bottom: 5px; background: transparent; color: inherit;
}
.assignment-card:hover { background: #17171a; }
.assignment-card.selected { background: var(--panel-3); border-color: #303038; }
.assignment-open {
  width: 100%; border: 0; padding: 13px 14px; background: transparent;
  color: inherit; text-align: left;
}
.card-topline { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.card-topline time { color: var(--faint); font-size: 10px; }
.card-meta { display: inline-flex; flex: 0 0 auto; align-items: center; gap: 7px; color: var(--faint); }
.unread-dot {
  display: inline-block; width: 7px; height: 7px; border-radius: 50%;
  background: #4d9cff; box-shadow: 0 0 0 3px rgba(77,156,255,.08);
}
.assignment-open > strong {
  display: -webkit-box; overflow: hidden; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  margin: 9px 0 5px; font-size: 14px; line-height: 1.35;
}
.card-location {
  display: flex; align-items: center; gap: 9px; min-width: 0;
  color: var(--faint); font-size: 10px;
}
.assignment-card.actionable .card-location { padding-right: 27px; }
.assignment-open .project {
  min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  color: var(--muted); font: 11px ui-monospace, monospace;
}
.card-host { flex: 0 0 auto; white-space: nowrap; }
.inbox-assignment-action {
  position: absolute; right: 9px; bottom: 9px; display: grid; place-items: center;
  width: 22px; height: 22px; padding: 0; border: 1px solid #34343b; border-radius: 6px;
  background: #1c1c20; color: var(--muted); font-size: 12px; line-height: 1;
  opacity: 0; pointer-events: none;
  transition: opacity .12s ease, color .12s ease, border-color .12s ease;
}
.assignment-card:hover .inbox-assignment-action,
.assignment-card:focus-within .inbox-assignment-action {
  opacity: 1; pointer-events: auto;
}
.inbox-assignment-action:hover, .inbox-assignment-action:focus-visible {
  border-color: #5a5a66; color: white; outline: 0;
}
.wait-assignment { color: var(--amber); }
.inbox-group, .settled-group {
  margin-top: 17px; padding-top: 11px; border-top: 1px solid var(--line-soft);
}
.inbox-group-heading, .settled-heading {
  display: flex; justify-content: space-between; padding: 0 8px 7px;
  color: var(--faint); font-size: 9px; font-weight: 750; letter-spacing: .08em;
  text-transform: uppercase;
}
.settled-row { position: relative; border-radius: 9px; }
.settled-row:hover, .settled-row.selected { background: #17171a; }
.settled-row.selected { box-shadow: inset 0 0 0 1px #303038; }
.settled-row .assignment-open {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center;
  gap: 10px; padding: 9px 10px;
}
.settled-row .card-meta { transition: opacity .12s ease; }
.pin-assignment {
  position: absolute; top: 50%; right: 9px; display: grid; place-items: center;
  width: 22px; height: 22px; padding: 0; transform: translateY(-50%);
  border: 1px solid #34343b; border-radius: 6px; background: #1c1c20;
  color: var(--muted); font-size: 14px; font-weight: 800; line-height: 1;
  opacity: 0; pointer-events: none;
  transition: opacity .12s ease, color .12s ease, border-color .12s ease;
}
.settled-row:hover .pin-assignment,
.settled-row:focus-within .pin-assignment {
  opacity: 1; pointer-events: auto;
}
.settled-row:hover .card-meta,
.settled-row:focus-within .card-meta { opacity: 0; }
.pin-assignment:hover, .pin-assignment:focus-visible, .pin-assignment.pinned {
  border-color: #6b4650; color: var(--red); outline: 0;
}
.settled-action-sheet {
  position: fixed; inset: 0; z-index: 40; display: grid; align-items: end;
}
.settled-action-backdrop {
  position: absolute; inset: 0; width: 100%; height: 100%; padding: 0;
  border: 0; background: rgba(0,0,0,.62);
}
.settled-action-panel {
  position: relative; display: grid; gap: 8px; width: min(420px, calc(100% - 20px));
  margin: 0 auto max(10px, env(safe-area-inset-bottom)); padding: 10px;
  border: 1px solid #34343b; border-radius: 16px; background: #19191d;
  box-shadow: 0 18px 60px rgba(0,0,0,.55);
}
.settled-action-handle {
  width: 34px; height: 4px; margin: 0 auto 2px; border-radius: 999px; background: #4a4a52;
}
.settled-action-panel > strong {
  overflow: hidden; padding: 4px 8px 7px; color: var(--muted);
  font-size: 11px; font-weight: 650; text-overflow: ellipsis; white-space: nowrap;
}
.settled-action-panel button:not(.settled-action-backdrop) {
  min-height: 44px; border: 0; border-radius: 10px; background: #24242a;
  font-size: 13px; font-weight: 700;
}
.settled-action-panel .settled-action-pin { color: #f17882; }
.settled-action-panel .settled-action-cancel { color: var(--muted); background: transparent; }
.settled-copy { min-width: 0; display: grid; gap: 3px; }
.settled-copy strong, .settled-copy > span {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.settled-copy strong { color: #bdbdc4; font-size: 11px; }
.settled-copy > span { color: var(--faint); font: 9px ui-monospace, monospace; }
.pinned-marker {
  margin-right: 5px; color: #e36a75; font-weight: 850;
  letter-spacing: .04em; text-transform: uppercase;
}
.settled-row time { font-size: 9px; }
.phase { display: inline-flex; align-items: center; gap: 6px; font-size: 10px; font-weight: 750; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.phase i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.phase.working { color: var(--blue); }
.phase.waiting { color: var(--faint); }
.phase.harnessing { color: var(--violet); }
.phase.debounce { color: var(--amber); }
.phase.failed, .phase.needs { color: var(--red); }
.phase.settled { color: var(--faint); }
.list-empty { color: var(--muted); font-size: 13px; padding: 40px 20px; text-align: center; }

.detail-pane {
  position: relative; min-width: 0; min-height: 0; height: 100%;
  overflow: hidden; background: var(--bg);
}
.welcome {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-height: 100%; max-width: 570px; margin: auto; padding: 60px 32px; text-align: center;
}
.welcome-orb {
  display: grid; place-items: center; width: 86px; height: 86px; margin-bottom: 28px;
  border: 1px solid #3b2528; border-radius: 28px; background: radial-gradient(circle at 50% 35%, #251518, #0e0e10 72%);
}
.welcome-orb span { width: 47px; height: 47px; border-radius: 14px; font-size: 22px; }
.welcome-orb.small { width: 70px; height: 70px; margin: 0 0 22px; border-radius: 23px; }
.welcome-orb.small span { width: 42px; height: 42px; }
.welcome h2 { margin-bottom: 12px; font-size: clamp(27px, 4vw, 42px); letter-spacing: -.05em; }
.welcome > p:not(.eyebrow) { max-width: 520px; color: var(--muted); line-height: 1.65; }
.assignment-loading {
  min-height: 100%; display: flex; align-items: center; justify-content: center; gap: 10px;
  color: var(--muted); font-size: 13px;
}
.button {
  display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--line);
  border-radius: 10px; padding: 10px 15px; background: var(--panel-2); text-decoration: none;
  font-weight: 700; font-size: 13px;
}
.button.small { padding: 7px 10px; font-size: 11px; }
.button.wide { width: 100%; }

.notification-dialog form { width: min(440px, calc(100vw - 32px)); }
.notification-dialog .welcome-orb { margin-left: auto; margin-right: auto; }
.notification-dialog h2, .notification-dialog .eyebrow, .notification-dialog .dialog-copy {
  text-align: center;
}
.notification-dialog .dialog-copy {
  color: var(--muted); font-size: 13px; line-height: 1.6;
}
.notification-status {
  display: flex; align-items: center; gap: 12px; margin: 20px 0 12px;
  padding: 13px 14px; border: 1px solid var(--line); border-radius: 11px;
  background: var(--panel-2);
}
.notification-status > span {
  width: 9px; height: 9px; flex: 0 0 auto; border-radius: 50%;
  background: var(--faint);
}
.notification-status > span.enabled {
  background: var(--green); box-shadow: 0 0 0 4px rgba(77,214,156,.1);
}
.notification-status > span.blocked {
  background: var(--red); box-shadow: 0 0 0 4px var(--red-soft);
}
.notification-status div { display: grid; gap: 3px; }
.notification-status strong { font-size: 13px; }
.notification-status small, .notification-privacy {
  color: var(--muted); font-size: 11px; line-height: 1.45;
}
.notification-privacy { margin-bottom: 18px; }

.install-dialog form { width: min(440px, calc(100vw - 32px)); }
.install-dialog .welcome-orb { margin-left: auto; margin-right: auto; }
.install-dialog h2, .install-dialog .eyebrow, .install-dialog .dialog-copy {
  text-align: center;
}
.install-dialog .dialog-copy, .install-note {
  color: var(--muted); font-size: 12px; line-height: 1.55;
}
.install-steps {
  display: grid; gap: 11px; margin: 20px 0; padding: 16px 18px 16px 38px;
  border: 1px solid var(--line); border-radius: 11px; background: var(--panel-2);
  color: var(--muted); font-size: 12px; line-height: 1.45;
}
.install-steps strong { color: var(--text); }
.install-note { margin-bottom: 18px; }

@media (display-mode: browser) {
  #installButton { display: grid; }
}

.assignment-detail {
  min-width: 0; min-height: 0; height: 100%; display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr) auto auto auto;
}
.detail-header {
  display: flex; align-items: center; gap: 14px; padding: 19px 24px;
  border-bottom: 1px solid var(--line); background: rgba(11,11,13,.92); backdrop-filter: blur(16px);
}
.detail-heading { flex: 1; min-width: 0; }
.detail-heading h2 { margin: 6px 0 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 18px; letter-spacing: -.025em; }
.detail-meta { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 11px; }
.detail-meta > span:not(.status-pill) + span:not(.status-pill)::before { content: "·"; margin-right: 8px; color: var(--faint); }
.status-pill { border-radius: 20px; padding: 4px 8px; color: var(--muted); background: var(--panel-3); font-weight: 750; }
.status-pill.working { color: var(--blue); background: rgba(86,168,255,.1); }
.status-pill.harnessing { color: var(--violet); background: rgba(167,139,250,.1); }
.status-pill.debounce { color: var(--amber); background: rgba(233,185,73,.1); }
.status-pill.failed, .status-pill.needs { color: #ff7179; background: var(--red-soft); }
.status-pill.settled { color: var(--green); background: rgba(77,214,156,.08); }
.back-button { display: none; border: 0; background: transparent; font-size: 28px; }

.conversation { min-width: 0; min-height: 0; overflow-y: auto; padding: 30px clamp(22px, 6vw, 78px); }
.message { width: 100%; min-width: 0; max-width: 790px; margin: 0 auto 26px; }
.message-label { display: flex; gap: 8px; align-items: baseline; margin-bottom: 8px; font-size: 12px; font-weight: 800; }
.message-label span { color: var(--faint); font-size: 10px; font-weight: 600; }
.message-body { border: 1px solid var(--line); border-radius: 13px; padding: 15px 17px; background: var(--panel-2); color: #e8e8eb; font-size: 14px; line-height: 1.65; overflow-wrap: anywhere; }
.message-actions { display: flex; min-height: 30px; padding: 5px 3px 0; }
.copy-message-markdown {
  display: grid; width: 30px; height: 30px; padding: 6px; border: 0; border-radius: 8px;
  place-items: center; color: var(--faint); background: transparent;
}
.copy-message-markdown:hover, .copy-message-markdown:focus-visible { color: var(--text); background: var(--panel-3); }
.copy-message-markdown svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.5; }
.copy-message-markdown.copied { color: var(--green); }
.copy-message-markdown.copied svg { display: none; }
.copy-message-markdown.copied::after { content: "\2713"; font-size: 17px; line-height: 1; }
.message.ceo .message-label { color: #ff737b; }
.message.ceo .message-body { border-color: #3b292c; background: #171214; }
.message.muted .message-body { color: var(--muted); background: #101012; }
.message.error .message-body { border-color: #622c32; background: var(--red-soft); color: #ffadb1; }
.working-card {
  display: flex; gap: 13px; max-width: 790px; margin: 0 auto 25px; padding: 14px 16px;
  border: 1px solid #273747; border-radius: 13px; background: rgba(55,120,184,.08);
}
.working-card strong { font-size: 13px; }
.working-card p { margin: 4px 0 0; color: var(--muted); font-size: 11px; }
.working-spinner {
  width: 16px; height: 16px; border: 2px solid rgba(86,168,255,.25); border-top-color: var(--blue);
  border-radius: 50%; animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.proof-drawer, .closeout-panel, .queue-panel, .composer-wrap { width: min(100% - 44px, 900px); margin: 0 auto; }
.proof-drawer { border: 1px solid var(--line); border-bottom: 0; border-radius: 12px 12px 0 0; background: #101012; }
.proof-summary {
  display: grid; grid-template-columns: auto 1fr auto; width: 100%; gap: 12px; padding: 10px 14px;
  border: 0; background: transparent; color: var(--muted); text-align: left; font-size: 11px;
}
.proof-summary span:first-child { color: var(--text); font-weight: 750; }
.proof-summary span:nth-child(2) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.proof-content { padding: 4px 14px 14px; border-top: 1px solid var(--line-soft); }
.proof-content dl { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px 18px; }
.proof-content dl div { min-width: 0; }
.proof-content dt { margin-bottom: 3px; color: var(--faint); font-size: 9px; text-transform: uppercase; letter-spacing: .08em; }
.proof-content dd { margin: 0; overflow: hidden; text-overflow: ellipsis; color: var(--muted); font: 10px ui-monospace, monospace; }
.task-identity { display: flex; align-items: center; gap: 6px; }
.task-identity > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task-deep-link {
  display: grid; flex: 0 0 auto; place-items: center; width: 18px; height: 18px;
  border: 1px solid var(--line); border-radius: 5px; color: var(--blue); font: 700 11px/1 ui-monospace, monospace;
}
.task-deep-link[hidden] { display: none; }
.task-deep-link:hover { border-color: var(--blue); background: var(--blue-soft); color: white; }
.proof-actions { display: flex; gap: 8px; }

.closeout-panel {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 10px 14px; border: 1px solid #453b25; border-bottom: 0;
  background: rgba(75,57,20,.13);
}
.closeout-copy { display: flex; align-items: center; gap: 10px; min-width: 0; }
.closeout-copy > div { display: grid; gap: 2px; min-width: 0; }
.closeout-copy strong { color: #f0d48a; font-size: 11px; }
.closeout-copy span:not(.closeout-icon) { overflow: hidden; text-overflow: ellipsis; color: var(--muted); font-size: 10px; white-space: nowrap; }
.closeout-icon { color: var(--amber); font-size: 17px; }
.closeout-actions { display: flex; gap: 5px; flex: 0 0 auto; }
.closeout-actions:empty { display: none; }
.closeout-actions button {
  border: 1px solid #4b4435; border-radius: 8px; padding: 6px 8px;
  background: #17150f; color: #d8cda9; font-size: 9px; font-weight: 700;
}
.closeout-actions button:hover { border-color: #746a50; color: white; }
.closeout-actions button.selected {
  border-color: #8b7645; background: #2a2415; color: #fff1bd;
}

.queue-panel { max-height: 210px; overflow-y: auto; padding: 12px 14px; border: 1px solid var(--line); border-bottom: 0; background: #111113; }
.queue-heading { display: flex; justify-content: space-between; align-items: center; margin-bottom: 9px; }
.queue-heading h3 { margin: 0; font-size: 12px; }
.queue-heading span { color: var(--muted); font-size: 10px; }
.queue-item { display: grid; grid-template-columns: 24px 1fr auto; gap: 8px; align-items: start; margin-top: 7px; }
.queue-index { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 7px; background: var(--panel-3); color: var(--muted); font-size: 10px; }
.queue-item textarea { width: 100%; resize: vertical; border: 1px solid var(--line); border-radius: 8px; padding: 7px 9px; background: #0d0d0f; font-size: 11px; line-height: 1.45; }
.queue-body { min-width: 0; }
.queue-attachments { display: block; margin-top: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--faint); font-size: 9px; }
.queue-actions { display: flex; flex-direction: column; gap: 3px; }
.queue-actions button { border: 0; background: transparent; color: var(--muted); font-size: 9px; }
.queue-actions button:hover { color: white; }

.composer-wrap { padding: 10px 0 max(14px, env(safe-area-inset-bottom)); background: var(--bg); }
.delivery-mode { display: flex; align-items: center; gap: 4px; margin-bottom: 7px; }
.mode {
  display: flex; align-items: baseline; gap: 7px; border: 0; border-radius: 8px; padding: 6px 9px;
  color: var(--muted); background: transparent; font-size: 10px;
}
.mode strong { font-size: 11px; }
.mode span { color: var(--faint); }
.mode.active { color: white; background: var(--panel-3); }
.harness-default { display: flex; align-items: center; gap: 3px; margin-left: auto; }
.harness-default > span { margin-right: 3px; color: var(--faint); font-size: 9px; }
.harness-default button {
  border: 1px solid transparent; border-radius: 7px; padding: 5px 7px;
  background: transparent; color: var(--faint); font-size: 9px; font-weight: 700;
}
.harness-default button:hover { color: white; }
.harness-default button.selected {
  border-color: #4b4435; background: #2a2415; color: #fff1bd;
}
.composer { display: grid; gap: 6px; padding: 7px; border: 1px solid #35353d; border-radius: 14px; background: var(--panel-2); box-shadow: 0 15px 40px rgba(0,0,0,.25); }
.composer-row { display: flex; align-items: flex-end; gap: 8px; }
.composer textarea { flex: 1; min-height: 38px; max-height: 180px; resize: none; border: 0; outline: 0; padding: 9px 10px; background: transparent; font-size: 13px; line-height: 1.45; }
.send-button { flex: 0 0 auto; width: 38px; height: 38px; border: 1px solid #d32b36; border-radius: 10px; font-weight: 900; }
.dictation-button {
  position: relative; display: grid; flex: 0 0 auto; place-items: center; width: 38px; height: 38px;
  border: 0; border-radius: 50%; background: #2b2b30; color: #ededf0; touch-action: none;
}
.dictation-button:hover { background: #36363c; color: white; }
.dictation-button:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.dictation-button .mic-icon { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.dictation-button .stop-icon { display: none; width: 12px; height: 12px; border-radius: 2px; background: currentColor; }
.dictation-button.recording { background: #ededf0; color: #17171a; }
.dictation-button.recording .mic-icon { display: none; }
.dictation-button.recording .stop-icon { display: block; }
.dictation-button.transcribing { color: var(--muted); cursor: progress; }
.dictation-button.transcribing .mic-icon { animation: dictation-pulse 1s ease-in-out infinite; }
.dictation-readout { min-width: 0; flex: 1; align-items: center; gap: 9px; color: var(--muted); }
.dictation-readout:not(.hidden) { display: flex; }
.dictation-line { min-width: 24px; flex: 1; border-top: 2px dotted #4a4a51; }
.dictation-wave { display: flex; align-items: center; gap: 2px; height: 24px; }
.dictation-wave i { width: 2px; height: 5px; border-radius: 2px; background: #f3f3f4; animation: dictation-wave 850ms ease-in-out infinite alternate; }
.dictation-wave i:nth-child(2n) { animation-delay: -180ms; }
.dictation-wave i:nth-child(3n) { animation-delay: -360ms; }
.dictation-wave i:nth-child(4n) { animation-delay: -540ms; }
.dictation-readout time { flex: 0 0 auto; color: #d1d1d5; font-size: 12px; font-variant-numeric: tabular-nums; }
.dictation-copy { display: none; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; }
.dictation-readout.transcribing .dictation-line,
.dictation-readout.transcribing .dictation-wave,
.dictation-readout.transcribing time { display: none; }
.dictation-readout.transcribing .dictation-copy { display: block; }
.composer-row.dictation-active .attachment-menu-wrap,
.composer-row.dictation-active > textarea { display: none; }
.dialog-composer { position: relative; }
.dialog-composer textarea { width: 100%; padding-right: 50px; }
.dialog-composer > .dictation-button { position: absolute; right: 8px; bottom: 8px; }
.dialog-composer > .dictation-readout { position: absolute; inset: auto 52px 8px 10px; height: 38px; }
.dialog-composer.dictation-active textarea { visibility: hidden; }
@keyframes dictation-wave { from { height: 4px; opacity: .45; } to { height: 20px; opacity: 1; } }
@keyframes dictation-pulse { 50% { opacity: .35; } }
.attach-button {
  display: grid; place-items: center; width: 38px; height: 38px; border: 0;
  border-radius: 10px; background: #1d1d22; color: var(--muted); font-size: 21px;
}
.attach-button:hover { color: white; background: #26262c; }
.attachment-menu-wrap { position: relative; flex: 0 0 auto; }
.attachment-menu {
  position: absolute; z-index: 12; left: 0; bottom: calc(100% + 8px); width: 170px;
  padding: 6px; border: 1px solid #35353d; border-radius: 12px;
  background: #19191e; box-shadow: 0 18px 55px rgba(0,0,0,.55);
}
.dialog-attachments .attachment-menu { top: calc(100% + 8px); bottom: auto; }
.initial-closeout-field { display: grid; gap: 7px; margin: 0; padding: 0; border: 0; }
.initial-closeout-field > legend { margin-bottom: 2px; font-size: 11px; font-weight: 700; }
.initial-closeout-field > small { color: var(--faint); font-size: 9px; }
.initial-closeout-options { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.initial-closeout-options label { position: relative; }
.initial-closeout-options input { position: absolute; opacity: 0; pointer-events: none; }
.initial-closeout-options span {
  display: grid; gap: 2px; padding: 8px; border: 1px solid var(--line);
  border-radius: 9px; background: #141417; cursor: pointer;
}
.initial-closeout-options strong { font-size: 10px; }
.initial-closeout-options small { color: var(--faint); font-size: 8px; }
.initial-closeout-options input:checked + span {
  border-color: #8b7645; background: #2a2415; color: #fff1bd;
}
.initial-closeout-options input:focus-visible + span { outline: 2px solid var(--blue); }
.attachment-menu button {
  display: flex; align-items: center; gap: 10px; width: 100%; border: 0;
  border-radius: 8px; padding: 9px 10px; background: transparent; color: var(--muted);
  text-align: left; font-size: 11px;
}
.attachment-menu button:hover { color: white; background: #24242a; }
.attachment-menu button > span { color: inherit; }
.attachment-tray { display: flex; flex-wrap: wrap; gap: 7px; padding: 2px; }
.attachment-draft {
  position: relative; display: flex; align-items: center; gap: 7px; max-width: 230px;
  min-height: 42px; padding: 5px 30px 5px 6px; border: 1px solid var(--line);
  border-radius: 10px; background: #101012;
}
.attachment-draft img { width: 38px; height: 38px; border-radius: 7px; object-fit: cover; }
.attachment-draft .file-glyph { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 7px; background: #202027; color: var(--muted); }
.attachment-draft > span:not(.file-glyph) { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: 10px; }
.attachment-draft button {
  position: absolute; top: 5px; right: 5px; width: 20px; height: 20px;
  border: 0; border-radius: 6px; background: #24242a; color: var(--muted); font-size: 11px;
}
.drop-zone.dragging { border-color: var(--red); background: rgba(240,68,68,.06); }
.message-attachments { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 9px; }
.message-attachment {
  display: inline-flex; align-items: center; gap: 7px; min-width: 0; max-width: 260px;
  border: 1px solid var(--line); border-radius: 10px; padding: 6px 9px;
  background: #0d0d0f; color: var(--muted); text-decoration: none; font-size: 10px;
}
.message-attachment.image { display: block; max-width: min(100%, 340px); padding: 5px; }
.message-attachment.image img { display: block; max-width: 100%; max-height: 240px; border-radius: 7px; object-fit: contain; }
.dialog-attachments {
  margin: 13px 0; padding: 10px; border: 1px dashed #34343b; border-radius: 11px;
}
.attachment-picker-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.attachment-picker-row > span { color: var(--faint); font-size: 9px; }
.dialog-attachments .attachment-tray { margin-top: 9px; }
.composer-note { margin: 6px 4px 0; color: var(--faint); font-size: 9px; }

dialog {
  width: min(620px, calc(100% - 28px)); padding: 0; border: 1px solid #383840;
  border-radius: 17px; color: var(--text); background: #121215; box-shadow: 0 30px 90px rgba(0,0,0,.65);
}
dialog::backdrop { background: rgba(0,0,0,.72); backdrop-filter: blur(6px); }
dialog form { padding: 22px; }
.dialog-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 22px; }
.dialog-header h2 { margin: 0; font-size: 24px; }
dialog label, .login-card label { display: grid; gap: 7px; margin: 15px 0; color: var(--muted); font-size: 11px; font-weight: 700; }
dialog select, dialog textarea, .login-card input {
  width: 100%; border: 1px solid var(--line); border-radius: 10px; outline: 0;
  padding: 11px 12px; background: #0c0c0e; font-size: 13px;
}
dialog textarea:focus, dialog select:focus, .login-card input:focus { border-color: #565661; }
.request-label textarea { line-height: 1.55; resize: vertical; }
.check-row { grid-template-columns: auto 1fr; align-items: start; }
.check-row input { margin-top: 3px; accent-color: var(--red); }
.check-row strong, .check-row small { display: block; }
.check-row small { margin-top: 3px; color: var(--faint); font-weight: 500; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 22px; }
.form-error { margin: 10px 0; color: #ff858c; font-size: 12px; }
.toast {
  position: fixed; z-index: 20; left: 50%; bottom: 28px; transform: translateX(-50%);
  border: 1px solid #38443e; border-radius: 10px; padding: 10px 14px; background: #152019;
  color: #bdf8d9; box-shadow: 0 15px 45px rgba(0,0,0,.4); font-size: 12px;
}
.toast.error { border-color: #633237; background: #241417; color: #ffb2b6; }

.login-page { display: grid; min-height: 100dvh; place-items: center; padding: 24px; background: radial-gradient(circle at 50% 10%, #1c1114, var(--bg) 45%); }
.login-card { width: min(100%, 410px); padding: 32px; border: 1px solid var(--line); border-radius: 19px; background: rgba(16,16,18,.95); box-shadow: 0 30px 90px rgba(0,0,0,.45); }
.login-card h1 { margin: 0 0 9px; letter-spacing: -.04em; font-size: 30px; }
.login-intro { color: var(--muted); font-size: 13px; line-height: 1.55; }
.security-note { margin: 19px 0 0; color: var(--faint); font-size: 10px; line-height: 1.5; text-align: center; }

@media (max-width: 860px) {
  .app-shell { grid-template-columns: 1fr; padding-bottom: calc(58px + env(safe-area-inset-bottom)); }
  .rail {
    position: fixed; z-index: 10; inset: auto 0 0; height: calc(58px + env(safe-area-inset-bottom));
    flex-direction: row; justify-content: space-around; padding: 7px 16px env(safe-area-inset-bottom);
    border: 0; border-top: 1px solid var(--line); background: rgba(12,12,14,.97); backdrop-filter: blur(18px);
  }
  .brand { margin: 0; }
  .brand-frame { width: 40px; height: 40px; }
  .brand-mark { width: 36px; height: 36px; }
  .rail-button { margin: 0; }
  .rail-spacer { display: none; }
  .inbox-pane { border: 0; min-height: 0; }
  .detail-pane {
    display: none; position: fixed; z-index: 8;
    inset: 0 0 calc(58px + env(safe-area-inset-bottom)); height: auto; background: var(--bg);
  }
  body.detail-open .inbox-pane { display: none; }
  body.detail-open .detail-pane { display: block; }
  .assignment-detail { height: 100%; }
  .back-button { display: block; }
  .detail-header { padding: 12px 14px; }
  .detail-heading h2 { font-size: 15px; }
  .conversation { padding: 20px 14px; }
  .proof-drawer, .closeout-panel, .queue-panel, .composer-wrap { width: calc(100% - 20px); }
  .closeout-panel { align-items: flex-start; flex-direction: column; gap: 8px; }
  .closeout-actions { width: 100%; }
  .closeout-actions button { flex: 1; }
  .delivery-mode { overflow-x: auto; }
  .mode span { display: none; }
  .harness-default { flex: 0 0 auto; }
  .harness-default > span { display: none; }
  .composer-note { display: none; }
  .proof-content dl { grid-template-columns: 1fr; }
  .welcome { min-height: 100%; padding: 30px 20px; }
}

@media (max-width: 480px) {
  .inbox-header { padding: 18px 16px 12px; }
  .host-row, .search { margin-left: 16px; margin-right: 16px; }
  .assignment-list { padding: 8px; }
  dialog form { padding: 18px; }
  .login-card { padding: 25px 20px; }
}

@media (hover: none) {
  .inbox-assignment-action { opacity: 1; pointer-events: auto; }
  .settled-row .assignment-open { -webkit-touch-callout: none; user-select: none; }
  .settled-row.hold-pending { background: #17171a; }
}
