/* Circes Tickets — tokens follow the circes-app redesign (ui/redesign-v2):
   cool slate neutrals, Geist, dark by default, no gold or cream. Colour means
   something: blue needs you, green good, red risk, cyan info. */
:root {
  --bg: #111318;
  --panel: #1b1f26;
  --panel-2: #232833;
  --sidebar: #15181e;
  --sidebar-active: #232833;
  --text: #f1f3f6;
  --text-2: #d4d8df;
  --muted: #aeb5c2;
  --faint: #6b7380;
  --line: #2a303b;
  --line-strong: #3a4250;
  --hover: #1f232b;
  --ring: #6ea8ff;
  --btn: #f1f3f6;
  --btn-text: #111318;
  --code-bg: #232833;

  --blue: #6ea8ff;   --blue-bg: rgba(110, 168, 255, .15);
  --green: #4fd18b;  --green-bg: rgba(79, 209, 139, .14);
  --red: #ff7a7a;    --red-bg: rgba(255, 122, 122, .14);
  --cyan: #5fd0e0;   --cyan-bg: rgba(95, 208, 224, .14);
  --amber: #e39a42;
  --logo-dot: #c8a96e; /* part of the Circes logo, nothing else */

  --s-open: var(--muted);  --s-open-bg: var(--panel-2);
  --s-await: var(--blue);  --s-await-bg: var(--blue-bg);
  --s-queued: var(--cyan); --s-queued-bg: var(--cyan-bg);
  --s-working: var(--cyan); --s-working-bg: var(--cyan-bg);
  --s-pr: var(--green);    --s-pr-bg: var(--green-bg);
  --s-human: var(--red);   --s-human-bg: var(--red-bg);
  --s-closed: var(--faint); --s-closed-bg: var(--panel-2);

  --sev-low: var(--muted); --sev-medium: var(--cyan); --sev-high: var(--amber); --sev-critical: var(--red);

  --shadow: 0 1px 2px rgb(0 0 0 / 30%), 0 12px 32px rgb(0 0 0 / 35%);
  --radius: 12px;
  --font: 'Geist', Inter, system-ui, -apple-system, sans-serif;
  --serif: var(--font);
  --mono: 'Geist Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  color-scheme: dark;
}

:root[data-theme='light'] {
  --bg: #f7f8fa; --panel: #ffffff; --panel-2: #eef1f5; --sidebar: #eef1f5; --sidebar-active: #ffffff;
  --text: #111318; --text-2: #2c323c; --muted: #4a5260; --faint: #8a93a1;
  --line: #e3e7ed; --line-strong: #cdd3dc; --hover: #e9edf2; --ring: #2f6fdb;
  --btn: #111318; --btn-text: #ffffff; --code-bg: #eef1f5;
  --blue: #2f6fdb;   --blue-bg: rgba(47, 111, 219, .10);
  --green: #1e8a55;  --green-bg: rgba(30, 138, 85, .10);
  --red: #c43d3d;    --red-bg: rgba(196, 61, 61, .09);
  --cyan: #13809a;   --cyan-bg: rgba(19, 128, 154, .10);
  --amber: #a8661b;
  --logo-dot: #806329;
  --shadow: 0 1px 2px rgb(17 19 24 / 6%), 0 12px 32px rgb(17 19 24 / 8%);
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
a { color: inherit; }
button, input, textarea, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; border-radius: 6px; }
.serif { font-family: var(--serif); font-weight: 600; letter-spacing: -0.02em; }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); font-size: 12.5px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
svg.i { width: 16px; height: 16px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- buttons & fields ---------- */
.btn { display: inline-flex; align-items: center; gap: 7px; height: 32px; padding: 0 12px; border-radius: 8px; border: 1px solid var(--line-strong);
  background: var(--panel); color: var(--text); cursor: pointer; white-space: nowrap; text-decoration: none; font-weight: 500; font-size: 13px; }
.btn:hover { background: var(--hover); }
.btn:disabled { opacity: .5; cursor: default; }
.btn-primary { background: var(--btn); color: var(--btn-text); border-color: var(--btn); }
.btn-primary:hover { background: var(--btn); opacity: .9; }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: var(--hover); }
.btn-block { width: 100%; justify-content: center; height: 38px; }
.btn-icon { width: 32px; padding: 0; justify-content: center; }
.btn-sm { height: 26px; padding: 0 10px; font-size: 12px; border-radius: 7px; }
.btn-danger { background: var(--red); border-color: var(--red); color: var(--bg); }
.btn-danger:hover { background: var(--s-human); opacity: .9; }

.field { display: flex; flex-direction: column; gap: 5px; }
.field > span { font-size: 12px; font-weight: 500; color: var(--text-2); }
.field small { color: var(--faint); font-size: 12px; }
input[type='text'], input[type='search'], input[type='password'], input:not([type]), textarea, select {
  width: 100%; border: 1px solid var(--line-strong); background: var(--panel); border-radius: 8px; padding: 8px 10px; outline: none; }
input:focus, textarea:focus, select:focus { border-color: var(--ring); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ring) 18%, transparent); }
textarea { resize: vertical; min-height: 90px; line-height: 1.5; }
.stack { display: flex; flex-direction: column; gap: 14px; }

/* ---------- login ---------- */
.login-body { display: grid; place-items: center; min-height: 100%; padding: 24px 16px; }
.login-card { width: 100%; max-width: 380px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 32px 28px; box-shadow: var(--shadow); }
.login-card h1 { font-size: 30px; margin: 22px 0 4px; }
.login-card p { margin: 0 0 22px; }
.form-error { background: var(--s-human-bg); color: var(--s-human); padding: 9px 12px; border-radius: 8px; font-size: 13px; }

.wordmark { display: inline-flex; align-items: center; gap: 9px; font-weight: 600; font-size: 21px; letter-spacing: -0.8px; line-height: 1; }
/* The Circes logo exactly as circes-app's CircesBrand draws it: mark cropped 1.5x in a rounded square. */
.brand-mark { width: 30px; height: 30px; border-radius: 9px; overflow: hidden; flex: none; display: inline-block; }
.brand-mark img { width: 100%; height: 100%; object-fit: cover; transform: scale(1.5); display: block; }
.wordmark .dot { color: var(--logo-dot); }
.wordmark-sub { font-weight: 400; color: var(--muted); letter-spacing: -0.2px; font-size: 15px; margin-left: 2px; }

/* ---------- app layout ---------- */
.app { display: grid; grid-template-columns: 236px minmax(320px, 400px) 1fr; height: 100vh; overflow: hidden; }
.sidebar { background: var(--sidebar); border-right: 1px solid var(--line); display: flex; flex-direction: column; padding: 18px 12px 12px; gap: 18px; overflow-y: auto; }
.sidebar-top { display: flex; align-items: center; justify-content: space-between; padding: 0 6px; }
.nav { display: flex; flex-direction: column; gap: 1px; }
.nav-label { font-size: 10.5px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--faint); padding: 0 10px 6px; }
.nav a { display: flex; align-items: center; gap: 9px; padding: 6px 10px; border-radius: 7px; text-decoration: none; color: var(--text-2); font-size: 13.5px; }
.nav a:hover { background: var(--hover); }
.nav a[aria-current='page'] { background: var(--sidebar-active); color: var(--text); box-shadow: inset 2px 0 var(--text); font-weight: 500; }
.nav .count { margin-left: auto; font-size: 12px; color: var(--faint); font-variant-numeric: tabular-nums; }
.nav a[aria-current='page'] .count { color: var(--muted); }
.nav .count.attention { color: var(--bg); background: var(--blue); border-radius: 99px; padding: 0 7px; font-weight: 600; font-size: 11.5px; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; }
.agent-card .row { display: flex; align-items: center; gap: 8px; font-weight: 500; font-size: 13px; }
.agent-card .sub { font-size: 12px; color: var(--muted); margin-top: 6px; line-height: 1.45; word-break: break-word; }
.agent-card .sub.mono { font-size: 11.5px; }
.agent-card a { text-decoration: none; }
.agent-card a:hover { text-decoration: underline; }
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.stat-grid .card { padding: 10px 12px; }
.stat-grid b { display: block; font-size: 17px; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -0.3px; }
.stat-grid span { font-size: 11.5px; color: var(--muted); }
.sidebar-foot { margin-top: auto; display: flex; align-items: center; gap: 6px; padding: 8px 6px 0; border-top: 1px solid var(--line); }
.avatar { width: 26px; height: 26px; border-radius: 50%; background: var(--sidebar-active); color: var(--text); display: grid; place-items: center; font-weight: 600; font-size: 12px; flex: none; }
.sidebar-foot .who { font-size: 13px; font-weight: 500; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); flex: none; }
.pulse.on { background: var(--s-working); animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .35; } }
@media (prefers-reduced-motion: reduce) { .pulse.on { animation: none; } }

/* ---------- list ---------- */
.list { border-right: 1px solid var(--line); display: flex; flex-direction: column; min-width: 0; background: var(--bg); }
.list-head { padding: 16px 16px 12px; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 12px; }
.list-title { display: flex; align-items: baseline; gap: 8px; }
.list-title h2 { margin: 0; font-size: 22px; }
.list-title .muted { font-size: 13px; }
.search { position: relative; }
.search svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--faint); }
.search input { padding-left: 32px; height: 34px; }
.search kbd { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); }
kbd { font: 11px var(--mono); color: var(--faint); border: 1px solid var(--line-strong); border-radius: 4px; padding: 0 5px; background: var(--panel); }
.items { overflow-y: auto; flex: 1; }
.item { display: block; padding: 12px 16px; border-bottom: 1px solid var(--line); text-decoration: none; cursor: pointer; }
.item:hover { background: var(--hover); }
.item[aria-selected='true'] { background: var(--panel); box-shadow: inset 2px 0 var(--blue); }
.item-top { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.item-top .num { font-family: var(--mono); font-size: 11.5px; }
.item-top time { margin-left: auto; color: var(--faint); }
.item-title { margin: 4px 0 6px; font-weight: 500; color: var(--text); line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.item-meta { display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.empty { padding: 48px 24px; text-align: center; color: var(--muted); }
.empty h3 { font-family: var(--serif); font-weight: 600; font-size: 20px; color: var(--text); margin: 0 0 6px; }

/* ---------- pills ---------- */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px 2px 8px; border-radius: 99px; font-size: 12px; font-weight: 500; white-space: nowrap; background: var(--s-open-bg); color: var(--s-open); }
.pill::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.queued { background: var(--s-queued-bg); color: var(--s-queued); }
.pill.awaiting { background: var(--s-await-bg); color: var(--s-await); }
.pill.working { background: var(--s-working-bg); color: var(--s-working); }
.pill.working::before { animation: pulse 1.6s ease-in-out infinite; }
.pill.pr-open { background: var(--s-pr-bg); color: var(--s-pr); }
.pill.needs-human { background: var(--s-human-bg); color: var(--s-human); }
.pill.closed { background: var(--s-closed-bg); color: var(--s-closed); }
.sev { display: inline-flex; align-items: center; gap: 5px; text-transform: capitalize; }
.sev::before { content: ''; width: 7px; height: 7px; border-radius: 2px; background: var(--sev, var(--faint)); }
.sev.low { --sev: var(--sev-low); } .sev.medium { --sev: var(--sev-medium); } .sev.high { --sev: var(--sev-high); } .sev.critical { --sev: var(--sev-critical); }

/* ---------- detail ---------- */
.detail { overflow-y: auto; min-width: 0; background: var(--panel); }
.detail-inner { max-width: 820px; margin: 0 auto; padding: 24px 32px 64px; }
.detail-bar { display: flex; align-items: center; gap: 8px; margin-bottom: 18px; flex-wrap: wrap; }
.detail-bar .back { display: none; }
.detail-bar .spacer { flex: 1; }
.detail-eyebrow { font-size: 12.5px; color: var(--muted); display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.detail h1 { font-family: var(--serif); font-weight: 600; font-size: 28px; line-height: 1.2; letter-spacing: -0.02em; margin: 6px 0 16px; word-break: break-word; }
.facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; margin: 0 0 28px; }
.facts > div { padding: 10px 12px; min-width: 0; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.facts > div:nth-child(3n) { border-right: 0; }
.facts > div:nth-last-child(-n + 3) { border-bottom: 0; }
.facts dt { font-size: 11.5px; color: var(--muted); margin-bottom: 2px; }
.facts dd { margin: 0; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.facts dd a { color: var(--blue); text-decoration: none; }

.section { margin-bottom: 32px; }
.section-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.section-head h2 { font-size: 11px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--faint); margin: 0; }
.section-head .line { flex: 1; height: 1px; background: var(--line); }

.prose { color: var(--text-2); line-height: 1.65; word-break: break-word; }
.prose > :first-child { margin-top: 0; }
.prose p { margin: 0 0 12px; }
.prose h3 { font-size: 13px; font-weight: 600; color: var(--text); margin: 18px 0 6px; }
.prose ul, .prose ol { margin: 0 0 12px; padding-left: 20px; }
.prose code { font-family: var(--mono); font-size: 12.5px; background: var(--code-bg); padding: 1px 5px; border-radius: 4px; }
.prose pre { background: var(--code-bg); padding: 12px 14px; border-radius: 8px; overflow-x: auto; font-size: 12.5px; line-height: 1.55; }
.prose pre code { background: none; padding: 0; }
.prose a { color: var(--blue); }
.prose blockquote { margin: 0 0 12px; padding-left: 12px; border-left: 2px solid var(--line-strong); color: var(--muted); }

/* agent panel */
.agent-panel { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.agent-head { display: flex; align-items: center; gap: 12px; padding: 12px 14px; background: var(--bg); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.agent-head .metrics { display: flex; gap: 16px; margin-left: auto; font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; flex-wrap: wrap; }
.agent-head .metrics b { color: var(--text); font-weight: 500; }
.agent-body { padding: 14px; }
.feed { list-style: none; margin: 0; padding: 10px 0; max-height: 340px; overflow-y: auto; background: var(--code-bg); border-radius: 8px; font-family: var(--mono); font-size: 12px; line-height: 1.55; }
.feed li { display: grid; grid-template-columns: 62px 14px 1fr; gap: 8px; padding: 2px 12px; color: var(--text-2); }
.feed time { color: var(--faint); }
.feed .k { color: var(--faint); }
.feed li.step { color: var(--blue); }
.feed li.note { color: var(--muted); font-family: var(--font); font-size: 12.5px; }
.feed li.error { color: var(--s-human); }
.feed li span:last-child { word-break: break-word; }
.files { margin: 12px 0 0; padding: 0; list-style: none; display: flex; flex-wrap: wrap; gap: 6px; }
.files li { font-family: var(--mono); font-size: 11.5px; background: var(--code-bg); border-radius: 5px; padding: 2px 7px; }
.report { margin: 14px 0 0; display: grid; grid-template-columns: 92px 1fr; gap: 8px 14px; font-size: 13.5px; line-height: 1.6; }
.report:first-child { margin-top: 0; }
.report dt { font-size: 11px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); padding-top: 3px; }
.report dd { margin: 0; color: var(--text-2); white-space: pre-wrap; word-break: break-word; }
.agent-empty { padding: 22px 14px; text-align: center; color: var(--muted); }
details.history summary { cursor: pointer; font-size: 12.5px; color: var(--muted); padding: 10px 14px; border-top: 1px solid var(--line); list-style: none; }
details.history summary::-webkit-details-marker { display: none; }
details.history .past { padding: 0 14px 12px; display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; }
details.history .past div { display: flex; gap: 10px; align-items: center; color: var(--muted); }

/* triage */
.triage { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 12px; }
.triage-by { font-size: 11px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin-right: 4px; }
.tchip { display: inline-flex; gap: 6px; align-items: baseline; font-size: 12px; padding: 3px 9px; border-radius: 7px; background: var(--code-bg); color: var(--muted); }
.tchip b { font-weight: 500; color: var(--text); font-variant-numeric: tabular-nums; }
.tchip.warn b { color: var(--s-human); }

/* conversation */
.thread { display: flex; flex-direction: column; gap: 14px; }
.comment { display: grid; grid-template-columns: 28px 1fr; gap: 10px; }
.comment img, .comment .avatar { width: 28px; height: 28px; border-radius: 50%; }
.comment .bubble { border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px; min-width: 0; }
.comment.agent .bubble { background: var(--bg); }
.comment .who { font-size: 12.5px; color: var(--muted); margin-bottom: 4px; display: flex; gap: 6px; }
.comment .who b { color: var(--text); font-weight: 500; }
.compose { margin-top: 16px; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--panel); }
.compose:focus-within { border-color: var(--ring); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ring) 18%, transparent); }
.compose textarea { border: 0; box-shadow: none !important; min-height: 80px; background: transparent; }
.compose-foot { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.compose-foot label { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text-2); margin-right: auto; cursor: pointer; }

.placeholder { height: 100%; display: grid; place-items: center; text-align: center; color: var(--muted); padding: 24px; }
.placeholder h3 { font-family: var(--serif); font-weight: 600; font-size: 24px; color: var(--text); margin: 14px 0 6px; }
.placeholder .keys { margin-top: 18px; display: flex; gap: 14px; justify-content: center; font-size: 12px; flex-wrap: wrap; }

/* ---------- dialog ---------- */
dialog { border: 1px solid var(--line); border-radius: 14px; padding: 0; width: min(640px, calc(100vw - 32px)); background: var(--panel); color: var(--text); box-shadow: var(--shadow); }
dialog::backdrop { background: rgb(10 12 16 / 55%); }
.dialog-head { padding: 20px 24px 0; display: flex; align-items: flex-start; justify-content: space-between; }
.dialog-head h2 { font-family: var(--serif); font-weight: 600; font-size: 22px; letter-spacing: -0.02em; margin: 0; }
.dialog-head p { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.dialog-body { padding: 18px 24px; max-height: calc(100vh - 220px); overflow-y: auto; }
.dialog-foot { padding: 14px 24px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 8px; align-items: center; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.sev-picker { display: flex; gap: 6px; flex-wrap: wrap; }
.sev-picker label { cursor: pointer; }
.sev-picker input { position: absolute; opacity: 0; pointer-events: none; }
.sev-picker span { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border: 1px solid var(--line-strong); border-radius: 99px; font-size: 13px; text-transform: capitalize; }
.sev-picker input:checked + span { border-color: var(--text); background: var(--hover); font-weight: 500; }
.sev-picker input:focus-visible + span { outline: 2px solid var(--ring); outline-offset: 2px; }

/* ---------- toast & loading ---------- */
.toasts { position: fixed; bottom: 16px; right: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 50; }
.toast { background: var(--btn); color: var(--btn-text); padding: 10px 14px; border-radius: 9px; box-shadow: var(--shadow); font-size: 13px; max-width: 360px; }
.toast.error { background: var(--red); color: var(--bg); }
.skeleton { background: var(--hover); animation: pulse 1.4s ease-in-out infinite; border-radius: 6px; }

/* ---------- responsive ---------- */
@media (max-width: 1180px) {
  .app { grid-template-columns: 216px 1fr; }
  .detail { position: fixed; inset: 0 0 0 216px; z-index: 10; display: none; box-shadow: var(--shadow); }
  .app.has-detail .detail { display: block; }
  .detail-bar .back { display: inline-flex; }
}
@media (max-width: 760px) {
  .app { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); height: 100dvh; }
  .sidebar, .list { min-width: 0; }
  .sidebar { flex-direction: row; flex-wrap: wrap; align-items: center; padding: 10px 16px; gap: 10px; border-right: 0; border-bottom: 1px solid var(--line); overflow: visible; }
  .sidebar-top { flex: 1; padding: 0; }
  .sidebar .nav { order: 3; flex-direction: row; overflow-x: auto; width: 100%; gap: 4px; padding-bottom: 2px; }
  .sidebar .nav-label, .stat-grid, .sidebar-foot .who { display: none; }
  .nav a { flex: none; padding: 5px 10px; }
  .agent-card { order: 4; width: 100%; padding: 8px 10px; }
  .agent-card .sub { display: none; }
  .sidebar-foot { margin: 0; border: 0; padding: 0; order: 2; }
  .detail { inset: 0; }
  .detail-inner { padding: 16px 16px 48px; }
  .detail h1 { font-size: 26px; }
  .grid-2 { grid-template-columns: 1fr; }
  .facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .facts > div:nth-child(3n) { border-right: 1px solid var(--line); }
  .facts > div:nth-child(2n) { border-right: 0; }
  .facts > div:nth-last-child(-n + 3) { border-bottom: 1px solid var(--line); }
  .facts > div:nth-last-child(-n + 2) { border-bottom: 0; }
  .report { grid-template-columns: 1fr; gap: 2px; }
  .report dd { margin-bottom: 8px; }
  .list-head { padding: 14px 16px 10px; }
  .search kbd { display: none; }
}

/* ---------- recommendation chips ---------- */
.rec { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 500; padding: 1px 8px; border-radius: 6px; white-space: nowrap; }
.rec.ok { background: var(--s-pr-bg); color: var(--s-pr); }
.rec.hold { background: var(--s-human-bg); color: var(--s-human); }
.rec.pending { background: var(--code-bg); color: var(--muted); }

/* ---------- approval panel ---------- */
.approval { border: 1px solid var(--s-await); background: var(--s-await-bg); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 22px; }
.approval.hold { border-color: var(--s-human); background: var(--s-human-bg); }
.approval-head { display: flex; gap: 12px; align-items: flex-start; }
.approval-icon { color: var(--s-await); padding-top: 2px; }
.approval.hold .approval-icon { color: var(--s-human); }
.approval-title { font-weight: 600; font-size: 14px; }
.approval-sub { font-size: 13px; color: var(--text-2); margin-top: 2px; line-height: 1.5; }
.approval .triage { margin: 12px 0 0; }
.approval .tchip { background: var(--panel); }
.approval-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.reject-form { margin-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.reject-form .row { display: flex; gap: 8px; justify-content: flex-end; }
.reject-form[hidden] { display: none; }

/* ---------- history ---------- */
.history-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.ev { display: grid; grid-template-columns: 22px 1fr auto; gap: 10px; align-items: start; padding: 7px 0; font-size: 13px; }
.history-list .ev + .ev { border-top: 1px dashed var(--line); }
.ev-icon { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: var(--code-bg); color: var(--muted); }
.ev-icon svg.i { width: 12px; height: 12px; }
.ev.approved .ev-icon, .ev.pr .ev-icon, .ev.closed .ev-icon { background: var(--s-pr-bg); color: var(--s-pr); }
.ev.triaged .ev-icon, .ev.created .ev-icon { background: var(--s-await-bg); color: var(--s-await); }
.ev.started .ev-icon { background: var(--s-working-bg); color: var(--s-working); }
.ev.rejected .ev-icon, .ev.failed .ev-icon, .ev.finished .ev-icon { background: var(--s-human-bg); color: var(--s-human); }
.ev time { font-size: 12px; color: var(--faint); white-space: nowrap; }
.ev-text { color: var(--text-2); word-break: break-word; }

/* ---------- overview board ---------- */
.board, .scrim { display: none; }
.app.overview { grid-template-columns: 236px 1fr; }
.app.overview .list { display: none; }
.app.overview .board { display: flex; flex-direction: column; min-width: 0; overflow: hidden; background: var(--bg); }
.app.overview .detail { position: fixed; top: 0; right: 0; bottom: 0; width: min(820px, calc(100vw - 236px)); z-index: 20; display: none; border-left: 1px solid var(--line); box-shadow: var(--shadow); }
.app.overview.has-detail .detail { display: block; }
.app.overview.has-detail .scrim { display: block; position: fixed; inset: 0; z-index: 15; background: rgb(10 12 16 / 35%); }
.app.overview .detail-bar .back { display: inline-flex; }

.board-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; padding: 22px 28px 14px; }
.board-head h2 { margin: 0; font-size: 30px; }
.board-head p { margin: 2px 0 0; }
.kpis { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; padding: 0 28px 18px; }
.kpi { text-align: left; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; cursor: pointer; font: inherit; color: inherit; }
.kpi:hover { border-color: var(--line-strong); }
.kpi b { display: flex; align-items: center; gap: 8px; font-size: 22px; font-weight: 600; letter-spacing: -0.4px; font-variant-numeric: tabular-nums; }
.kpi span { font-size: 12px; color: var(--muted); }
.kpi.attention { box-shadow: inset 0 2px 0 var(--blue); }
.kpi.attention b { color: var(--blue); }
.kpi.warn b { color: var(--s-human); }
.kpi.agent { cursor: default; }
.kpi.agent b { font-size: 17px; height: 33px; }

.board-body { flex: 1; min-height: 0; display: grid; grid-template-columns: 1fr 300px; gap: 0; border-top: 1px solid var(--line); }
.columns { display: grid; grid-template-columns: repeat(5, minmax(220px, 1fr)); gap: 12px; padding: 16px 16px 16px 28px; overflow: auto; min-width: 0; }
.col { display: flex; flex-direction: column; min-height: 0; background: var(--sidebar); border: 1px solid var(--line); border-radius: 12px; }
.col > header, .activity > header { display: flex; align-items: baseline; gap: 8px; padding: 10px 12px 8px; white-space: nowrap; }
.col-hint { overflow: hidden; text-overflow: ellipsis; }
.col-title { font-size: 11px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--faint); }
.col-count { font-size: 12px; font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; }
.col-hint { margin-left: auto; font-size: 11.5px; color: var(--faint); }
.col-awaiting { border-color: var(--s-await); }
.col-items { display: flex; flex-direction: column; gap: 8px; padding: 0 8px 10px; overflow-y: auto; }
.col-empty { font-size: 12px; color: var(--faint); text-align: center; padding: 18px 0; }
.card-t { display: block; background: var(--panel); border: 1px solid var(--line); border-radius: 9px; padding: 10px 11px; text-decoration: none; cursor: pointer; }
.card-t:hover { border-color: var(--line-strong); }
.card-t.selected { box-shadow: inset 2px 0 var(--blue); }
.card-top { display: flex; align-items: center; gap: 8px; font-size: 11.5px; color: var(--muted); }
.card-top .num { font-family: var(--mono); }
.card-top time { margin-left: auto; color: var(--faint); }
.card-title { font-size: 13px; font-weight: 500; line-height: 1.4; margin: 5px 0 6px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.card-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; font-size: 11.5px; color: var(--muted); }
.card-actions { display: flex; gap: 6px; margin-top: 9px; }

.activity { border-left: 1px solid var(--line); background: var(--panel); display: flex; flex-direction: column; min-height: 0; }
.activity ol { list-style: none; margin: 0; padding: 0 14px 14px; overflow-y: auto; }
.activity .ev { grid-template-columns: 22px 1fr; padding: 8px 0; border-bottom: 1px dashed var(--line); }
.activity .ev a { font-weight: 500; text-decoration: none; display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
.activity .ev a:hover { text-decoration: underline; }
.activity .ev-text { font-size: 12.5px; }
.activity time { font-size: 11.5px; }

@media (max-width: 1640px) {
  .board { overflow-y: auto !important; }
  .board-body { display: block; }
  .columns { min-height: 520px; padding-right: 28px; }
  .activity { border-left: 0; border-top: 1px solid var(--line); }
  .activity ol { columns: 2 340px; column-gap: 24px; }
  .activity .ev { break-inside: avoid; }
}
@media (max-width: 1100px) {
  .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 1180px) {
  .app.overview { grid-template-columns: 216px 1fr; }
  .app.overview .detail { inset: 0 0 0 216px; width: auto; }
}
@media (max-width: 760px) {
  .app.overview { grid-template-columns: minmax(0, 1fr); }
  .app.overview .detail { inset: 0; }
  .board-head { padding: 16px; }
  .kpis { padding: 0 16px 14px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .columns { padding: 12px 16px; grid-template-columns: repeat(5, 82vw); }
  .board { overflow-y: auto !important; }
  .board-body { display: block; }
}

/* ---------- priority & grouping ---------- */
.prio { display: inline-grid; place-items: center; min-width: 24px; height: 18px; padding: 0 5px; border-radius: 5px; font: 600 10.5px/1 var(--font); letter-spacing: .02em; flex: none; }
.prio.p0 { background: var(--sev-critical); color: var(--bg); }
.prio.p1 { background: transparent; color: var(--sev-high); box-shadow: inset 0 0 0 1px var(--sev-high); }
.prio.p2 { background: var(--s-queued-bg); color: var(--sev-medium); }
.prio.p3 { background: var(--code-bg); color: var(--muted); }
.nav a .prio { min-width: 22px; }
.fact-prio { display: inline-flex; gap: 7px; align-items: center; }
.area { color: var(--text-2); }
.board-tools { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.seg { display: inline-flex; align-items: center; gap: 2px; padding: 3px; border: 1px solid var(--line-strong); border-radius: 9px; background: var(--panel); }
.seg-label { font-size: 12px; color: var(--muted); padding: 0 8px 0 6px; }
.seg button { border: 0; background: transparent; font: inherit; font-size: 12.5px; padding: 4px 11px; border-radius: 6px; cursor: pointer; color: var(--text-2); }
.seg button.on { background: var(--btn); color: var(--btn-text); font-weight: 500; }
.col-p0 { border-color: var(--sev-critical); }
.col-p1 { border-color: var(--sev-high); }

/* ---------- screenshots ---------- */
.shots { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.shots a { display: block; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; max-width: 320px; }
.shots img { display: block; max-width: 100%; max-height: 220px; object-fit: contain; background: var(--code-bg); }

/* ---------- CI, PR, metrics ---------- */
.ci { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 500; padding: 1px 8px; border-radius: 6px; white-space: nowrap; background: var(--code-bg); color: var(--muted); }
.ci::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.ci.success { background: var(--s-pr-bg); color: var(--s-pr); }
.ci.failure { background: var(--s-human-bg); color: var(--s-human); }
.ci.pending { background: var(--s-working-bg); color: var(--s-working); }
.pr-panel { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.pr-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ci-failed { margin: 10px 0 0; padding-left: 18px; font-size: 12.5px; }
.ci-failed a { color: var(--s-human); }
.metrics { padding: 0 28px 28px; overflow-y: auto; }
.metrics .kpis { padding: 0 0 18px; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
.panel-table { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.panel-table > header { padding: 12px 14px 4px; }
.panel-table table { width: 100%; border-collapse: collapse; font-size: 13px; }
.panel-table th, .panel-table td { text-align: left; padding: 8px 14px; border-top: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.panel-table th { font-size: 12px; color: var(--muted); font-weight: 500; border-top: 0; }
@media (max-width: 760px) { .metrics { padding: 0 16px 20px; } }

/* Sales: trial account dialog */
dialog.wide { width: min(780px, calc(100vw - 32px)); }
dialog.wide .dialog-body > * { flex-shrink: 0; }
.facts > div { display: flex; flex-direction: column; gap: 2px; font-size: 13px; }
.facts b { font-weight: 500; }
.history { list-style: none; margin: 0; padding: 0; font-size: 13px; display: grid; gap: 6px; }
.history time { color: var(--muted); font-size: 12px; }
.draft-editor textarea { font: inherit; line-height: 1.5; }

/* Module switch: Tickets and Sales are separate modules under one login. */
.module-switch { display: grid; grid-template-columns: 1fr 1fr; gap: 2px; padding: 3px; margin: 2px 4px 0; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); }
.module-switch a { display: flex; align-items: center; justify-content: center; gap: 7px; padding: 6px 8px; border-radius: 7px; text-decoration: none; color: var(--muted); font-size: 13px; font-weight: 500; }
.module-switch a:hover { color: var(--text); }
.module-switch a[aria-selected='true'] { background: var(--sidebar-active); color: var(--text); box-shadow: 0 1px 2px rgb(0 0 0 / 18%); }
.module-switch .i { width: 15px; height: 15px; }

/* Sales → Growth */
.kpi.good b { color: var(--green); }
.kpi .kpi-sub { font-size: 11.5px; color: var(--faint); }
.growth { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 460px), 1fr)); gap: 16px; padding: 0 28px 28px; }
.growth-panel { margin: 0; }
.growth-panel .pad { padding: 14px 16px; margin: 0; }
.funnel { display: grid; gap: 10px; padding: 14px 16px; }
.funnel-row { display: grid; grid-template-columns: 170px 1fr 44px 44px; gap: 10px; align-items: center; font-size: 13px; }
.funnel-track { height: 10px; background: var(--panel-2); border-radius: 4px; overflow: hidden; }
.funnel-bar { display: block; height: 100%; background: var(--blue); border-radius: 0 4px 4px 0; }
.funnel-num { text-align: right; font-variant-numeric: tabular-nums; font-weight: 500; }
.funnel-pct { text-align: right; font-variant-numeric: tabular-nums; font-size: 12px; }
.rate { display: inline-flex; align-items: center; gap: 8px; font-variant-numeric: tabular-nums; }
.rate-bar { display: inline-block; height: 6px; max-width: 80px; min-width: 2px; background: var(--blue); border-radius: 0 3px 3px 0; }
.mini-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 12px; padding: 14px 16px; }
.mini-kpis > div { display: flex; flex-direction: column; gap: 2px; }
.mini-kpis b { font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums; }
.mini-kpis span { font-size: 12px; color: var(--muted); }
@media (max-width: 760px) { .growth { padding: 0 16px 16px; } .funnel-row { grid-template-columns: 1fr 44px 44px; } .funnel-track { grid-column: 1 / -1; grid-row: 2; } }
.funnel-track { display: block; }
.growth-panel > header { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.kpi .kpi-sub { display: block; margin-top: 2px; }
