:root {
  --bg: #f4f6f8;
  --card: #ffffff;
  --ink: #13212c;
  --body: #3a4855;
  --muted: #6c7986;
  --line: #e2e7ec;
  --line-strong: #cfd7df;
  --brand: #0b6e79;
  --brand-ink: #07505a;
  --brand-soft: #e5f2f3;
  --green: #1d7f55;
  --green-soft: #e4f4ec;
  --amber: #9a6410;
  --amber-soft: #fcf2df;
  --red: #b83a33;
  --red-soft: #fbe9e8;
  --blue: #2c63c9;
  --blue-soft: #e8effc;
  --violet: #6b4fc8;
  --shadow: 0 1px 2px rgba(19, 33, 44, 0.06), 0 2px 8px rgba(19, 33, 44, 0.04);
  --radius: 10px;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  color-scheme: light;
}

* { box-sizing: border-box; }

html, body { margin: 0; height: 100%; }

body {
  background: var(--bg);
  color: var(--body);
  font: 14px/1.5 Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { color: var(--ink); margin: 0; }
a { color: inherit; text-decoration: none; }
code { font-family: var(--mono); font-size: 12px; background: var(--bg); padding: 1px 5px; border-radius: 4px; }
small { font-size: 11px; letter-spacing: 0.02em; color: var(--muted); }
.muted { color: var(--muted); }
.pad { padding: 16px; }
.link { color: var(--brand); font-weight: 500; }
.link:hover { text-decoration: underline; }
form.inline { display: inline; }

.topbar {
  height: 56px;
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 0 20px;
  background: var(--card);
  border-bottom: 1px solid var(--line);
}

.brand { display: flex; align-items: center; gap: 10px; color: var(--brand); font-weight: 700; font-size: 15px; }
.brand svg { width: 28px; height: 28px; }
.brand span { color: var(--ink); }
.brand em { font-style: normal; font-weight: 500; color: var(--muted); margin-left: 2px; }

.topnav { display: flex; gap: 4px; }
.topnav a { padding: 6px 12px; border-radius: 6px; color: var(--muted); font-weight: 500; }
.topnav a.active { background: var(--brand-soft); color: var(--brand-ink); }

.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 16px; }

.delay-toggle label { display: flex; align-items: center; gap: 8px; cursor: pointer; font-size: 12px; color: var(--muted); font-weight: 500; }
.delay-toggle input { position: absolute; opacity: 0; pointer-events: none; }
.switch { width: 30px; height: 18px; border-radius: 9px; background: var(--line-strong); position: relative; transition: background 0.15s; }
.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.2); transition: transform 0.15s; }
.delay-toggle input:checked + .switch { background: var(--brand); }
.delay-toggle input:checked + .switch::after { transform: translateX(12px); }

.model-chip { font-size: 11px; font-weight: 600; color: var(--violet); background: #f0ecfb; border-radius: 999px; padding: 3px 10px; }

.me { display: flex; align-items: center; gap: 8px; }
.me-text { display: flex; flex-direction: column; line-height: 1.2; }
.me-text strong { color: var(--ink); font-size: 13px; }

.avatar {
  flex: none;
  width: 32px; height: 32px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: #e9edf1; color: var(--body);
  font-size: 12px; font-weight: 600;
}
.avatar-rep { background: var(--brand); color: #fff; }

.desk-grid {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr) 400px;
  height: calc(100vh - 56px);
}

.inbox-col, .thread-col, .side-col { overflow-y: auto; min-height: 0; }
.inbox-col { background: var(--card); border-right: 1px solid var(--line); }
.side-col { border-left: 1px solid var(--line); padding: 12px; display: flex; flex-direction: column; gap: 12px; background: var(--bg); }

.col-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 16px 8px; }
.col-head h2 { font-size: 13px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.count { font-size: 11px; font-weight: 600; background: var(--bg); padding: 1px 8px; border-radius: 999px; }

.inbox-row {
  display: grid;
  grid-template-columns: 32px 1fr auto;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  align-items: start;
}
.inbox-row:hover { background: #f8fafb; }
.inbox-row.active { background: var(--brand-soft); box-shadow: inset 3px 0 0 var(--brand); }
.inbox-main { display: flex; flex-direction: column; min-width: 0; }
.inbox-top { display: flex; justify-content: space-between; gap: 8px; }
.inbox-top strong { color: var(--ink); font-size: 13px; }
.inbox-top time { font-size: 11px; color: var(--muted); }
.inbox-subject { font-size: 12px; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.inbox-snippet { font-size: 12px; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

.pill { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 999px; white-space: nowrap; background: var(--bg); color: var(--muted); }
.pill-live { background: var(--blue-soft); color: var(--blue); }
.pill-live::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; animation: pulse 1.2s infinite; }
.pill-won { background: var(--green-soft); color: var(--green); }
.pill-warn { background: var(--amber-soft); color: var(--amber); }
.pill-bad { background: var(--red-soft); color: var(--red); }
.pill-new { background: var(--brand-soft); color: var(--brand-ink); }

.btn { white-space: nowrap; font: inherit; font-size: 12px; font-weight: 600; border: 1px solid var(--line-strong); background: var(--card); color: var(--ink); border-radius: 6px; padding: 6px 12px; cursor: pointer; }
.btn:hover { border-color: var(--brand); color: var(--brand); }
.btn-small { padding: 2px 8px; font-size: 11px; }

.thread { padding: 20px 24px 40px; max-width: 860px; margin: 0 auto; }
.thread-head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; margin-bottom: 18px; }
.thread-head h1 { font-size: 19px; line-height: 1.3; margin: 2px 0 4px; }
.thread-head p { margin: 0; font-size: 12px; }
.eyebrow-sub { color: var(--muted); font-weight: 500; letter-spacing: 0.02em; text-transform: none; }
.eyebrow-sub::before { content: "· "; }
.eyebrow { font-size: 11px !important; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; color: var(--brand) !important; }

.thread-items { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }

.mail { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.mail-out { border-left: 3px solid var(--brand); }
.mail-head { display: flex; align-items: center; gap: 10px; padding: 12px 16px 0; }
.mail-who { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.mail-who strong { color: var(--ink); font-size: 13px; }
.mail-who small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mail-head time { margin-left: auto; font-size: 11px; color: var(--muted); white-space: nowrap; }
.mail-body { padding: 10px 16px 14px 58px; white-space: pre-wrap; color: var(--ink); font-size: 13.5px; line-height: 1.6; }
.mail-foot { display: flex; align-items: center; gap: 10px; padding: 8px 16px 10px 58px; border-top: 1px solid var(--line); background: #fafbfc; font-size: 12px; }
.mail-foot .link { margin-left: auto; }

.note { border: 1px dashed #e3c78f; background: var(--amber-soft); border-radius: var(--radius); padding: 10px 14px; margin-left: 58px; }
.note-denied { border-color: #eab5b1; background: var(--red-soft); }
.note-approved { border-color: #a9d8c0; background: var(--green-soft); }
.note-head { display: flex; align-items: center; gap: 8px; font-size: 12px; flex-wrap: wrap; }
.note-head strong { color: var(--ink); }
.note-head time { margin-left: auto; color: var(--muted); font-size: 11px; }
.note-tag { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--amber); }
.note-ask { margin: 6px 0 2px; font-size: 12px; color: var(--muted); }
.note-body { margin: 0; color: var(--ink); font-size: 13px; }

.typing { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; padding-left: 4px; }
.dots { display: inline-flex; gap: 3px; }
.dots i { width: 5px; height: 5px; border-radius: 50%; background: var(--brand); animation: bounce 1s infinite; }
.dots i:nth-child(2) { animation-delay: 0.15s; }
.dots i:nth-child(3) { animation-delay: 0.3s; }

.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.panel-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.panel-head h3 { font-size: 13px; display: flex; align-items: center; gap: 8px; }
.private { font-size: 10px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--amber); background: var(--amber-soft); padding: 1px 6px; border-radius: 4px; }

.desk { display: flex; flex-direction: column; flex: 0 0 auto; height: 60vh; min-height: 360px; }
.desk-scroll { overflow-y: auto; padding: 4px 14px 14px; }
.desk-context { font-size: 12px; color: var(--muted); margin: 8px 0 4px; }

.steps { list-style: none; margin: 0; padding: 0; }
.step { position: relative; display: grid; grid-template-columns: 14px 1fr; gap: 10px; padding: 8px 0 8px; }
.step::before { content: ""; position: absolute; left: 6px; top: 22px; bottom: -8px; width: 2px; background: var(--line); }
.steps:last-child .step:last-child::before { display: none; }
.step-dot { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--line-strong); background: var(--card); margin-top: 2px; position: relative; z-index: 1; }
.step.done .step-dot { border-color: var(--brand); background: var(--brand); box-shadow: inset 0 0 0 2px #fff; }
.step.active .step-dot { border-color: var(--blue); animation: pulse 1.2s infinite; }
.step h4 { font-size: 12px; font-weight: 600; letter-spacing: 0.01em; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.step-body { white-space: pre-wrap; font-size: 12.5px; line-height: 1.55; color: var(--body); margin-top: 2px; }
.event-ok .step-dot { border-color: var(--green); background: var(--green); box-shadow: inset 0 0 0 2px #fff; }
.event-ok h4 { color: var(--green); }
.event-bad .step-dot { border-color: var(--red); background: var(--red); box-shadow: inset 0 0 0 2px #fff; }
.event-bad h4 { color: var(--red); }
.event-wait .step-dot { border-color: var(--amber); background: var(--amber-soft); }
.event-wait h4 { color: var(--amber); }

.move-chip { font-size: 11px; font-weight: 600; background: #f0ecfb; color: var(--violet); padding: 1px 8px; border-radius: 999px; }
.offer-mini { display: flex; flex-direction: column; gap: 2px; font-size: 12px; font-family: var(--mono); color: var(--ink); margin-top: 4px; background: var(--bg); border-radius: 6px; padding: 6px 8px; }
.offer-mini strong { color: var(--brand-ink); }

.draft { white-space: pre-wrap; font-size: 13px; line-height: 1.55; color: var(--ink); background: #fbfcfd; border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; margin-top: 4px; }

.revision { margin: 8px 0 4px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--red); border-top: 1px dashed #eab5b1; padding-top: 8px; }

.caret { display: inline-block; width: 7px; height: 14px; background: var(--blue); vertical-align: text-bottom; margin-left: 2px; animation: blink 0.9s steps(1) infinite; }

.deal-body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 14px; }
.kpis, .quarter { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.kpis > div, .quarter > div { background: var(--bg); border-radius: 8px; padding: 8px 10px; display: flex; flex-direction: column; min-width: 0; }
.kpis strong, .quarter strong { color: var(--ink); font-size: 15px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.quarter strong.small { font-size: 12px; white-space: normal; }
.kpis em, .quarter em { font-style: normal; font-size: 11px; color: var(--muted); }
.ask-summary { margin: -6px 0 0; font-size: 12px; color: var(--muted); font-style: italic; }

.ladder-head { display: flex; justify-content: space-between; margin-bottom: 6px; }
.ladder-bar { position: relative; height: 14px; display: flex; border-radius: 7px; overflow: visible; }
.zone { height: 100%; display: block; }
.zone:first-child { border-radius: 7px 0 0 7px; }
.zone-rep { background: #cfe8e3; }
.zone-manager { background: #a6d3d9; }
.zone-desk { background: #f1d29a; }
.zone-walk { flex: 1; background: repeating-linear-gradient(-45deg, #f3c9c5, #f3c9c5 4px, #fbe9e8 4px, #fbe9e8 8px); border-radius: 0 7px 7px 0; }
.marker { position: absolute; top: 50%; width: 14px; height: 14px; border-radius: 50%; transform: translate(-50%, -50%); border: 2px solid #fff; box-shadow: 0 1px 3px rgba(0,0,0,.3); }
.marker-current { background: var(--muted); width: 4px; height: 22px; border-radius: 2px; border: none; }
.marker-offer { background: var(--brand-ink); }
.marker-ask { background: #fff; border: 3px solid var(--red); }
.ladder-legend { display: flex; gap: 12px; margin-top: 6px; font-size: 11px; color: var(--muted); }
.ladder-legend span { display: inline-flex; align-items: center; gap: 4px; }
.sw { width: 10px; height: 10px; border-radius: 2px; display: inline-block; flex: none !important; }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.dot.marker-current { border-radius: 1px; width: 3px; height: 11px; }
.dot.marker-ask { border-width: 2px; }

.offer-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.offer-table td { padding: 5px 0; border-bottom: 1px solid var(--line); color: var(--ink); }
.offer-table td:nth-child(2) { text-align: right; color: var(--muted); padding-right: 12px; }
.offer-table td:nth-child(3) { text-align: right; font-family: var(--mono); }
.offer-table tr.sub td { color: var(--muted); font-family: inherit; text-align: left; border-bottom: none; padding: 2px 0; }

.approvals ul { list-style: none; padding: 0; margin: 6px 0 0; display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--ink); }
.approvals p { margin: 4px 0 0; font-size: 12px; }

.empty-desk { display: grid; place-items: center; height: calc(100vh - 56px); }
.empty-card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 32px 36px; max-width: 520px; box-shadow: var(--shadow); }
.empty-card h1 { font-size: 20px; margin-bottom: 8px; }

@keyframes pulse { 50% { opacity: 0.35; } }
@keyframes blink { 50% { opacity: 0; } }
@keyframes bounce { 50% { transform: translateY(-3px); opacity: 0.5; } }

@media (max-width: 1280px) {
  .desk-grid { grid-template-columns: minmax(0, 1fr) 380px; }
  .inbox-col { display: none; }
  .thread { padding: 16px 18px 32px; }
  .me-text small { display: none; }
}

@media (max-width: 1000px) {
  .desk-grid { grid-template-columns: minmax(0, 1fr) 340px; }
  .topbar { gap: 12px; padding: 0 14px; }
  .topnav, .me-text { display: none; }
  .thread { padding: 12px 12px 28px; }
  .thread-head h1 { font-size: 16px; }
  .eyebrow-sub { display: block; margin-top: 2px; }
  .eyebrow-sub::before { content: none; }
  .mail-head { padding: 10px 12px 0; gap: 8px; }
  .mail-head .avatar { width: 26px; height: 26px; font-size: 10px; }
  .mail-who small { font-size: 10.5px; }
  .mail-body { padding: 8px 12px 12px; font-size: 13px; line-height: 1.55; }
  .mail-foot { padding: 6px 12px 8px; }
  .note { margin-left: 0; }
  .side-col { padding: 8px; gap: 8px; }
  .desk { height: 62vh; }
  .panel-head { padding: 10px 12px; }
  .desk-scroll { padding: 2px 12px 12px; }
  .deal-body { padding: 10px 12px 12px; gap: 12px; }
  .kpis strong, .quarter strong { font-size: 13px; }
  .kpis > div, .quarter > div { padding: 6px 8px; }
  .ladder-legend { gap: 8px; flex-wrap: wrap; }
}

@media (max-width: 760px) {
  .desk-grid { grid-template-columns: 1fr; height: auto; }
  .side-col { border-left: none; }
  .desk { height: auto; max-height: 80vh; }
}

.arena { max-width: 1120px; margin: 0 auto; padding: 32px 20px 64px; display: grid; gap: 28px; }
.arena h1 { font-size: 28px; margin: 0 0 8px; }
.arena h2 { font-size: 16px; text-transform: uppercase; letter-spacing: .06em; color: #6b7280; margin: 0 0 10px; }
.arena-head p { color: #4b5563; max-width: 70ch; margin: 0; }
.arena-table { width: 100%; border-collapse: collapse; background: #fff; border: 1px solid #e5e7eb; border-radius: 10px; overflow: hidden; font-size: 14px; }
.arena-table th, .arena-table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid #f0f1f3; }
.arena-table th { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: #6b7280; }
.arena-table .num { font-variant-numeric: tabular-nums; }
.arena-table .bad { color: #b42318; font-weight: 600; }
.arena.narrow { max-width: 520px; }
.arena .card { background: #fff; border: 1px solid #e5e7eb; border-radius: 12px; padding: 20px; }
.arena .stack { display: grid; gap: 8px; max-width: 460px; }
.arena .stack input, .arena .stack select { padding: 9px 11px; border: 1px solid #d1d5db; border-radius: 8px; font: inherit; }
.arena .btn { margin-top: 8px; padding: 10px 16px; border-radius: 8px; border: 0; background: #0b7a75; color: #fff; font-weight: 600; cursor: pointer; justify-self: start; }
.arena .btn-quiet { background: #f3f4f6; color: #374151; }
.arena .steps { display: grid; gap: 6px; padding-left: 20px; }
.arena .big-score { font-size: 40px; font-weight: 700; margin: 4px 0; }
.arena .muted { color: #6b7280; }
.arena .bad { color: #b42318; }
.arena h3 { font-size: 14px; margin: 14px 0 4px; }
