/* ---------- theme ----------
   Light by default, dark when the device prefers it, and either one when the
   agent picks it with the sidebar button (data-theme on <html>). */
:root {
  --bg: #f4f5f7;
  --panel: #ffffff;
  --sunken: #eef0f3;
  --line: #e4e7ec;
  --line-strong: #cdd2da;
  --text: #161a22;
  --muted: #596273;
  --faint: #6b7483;
  --accent: #2f5fe0;
  --accent-text: #2552cc;
  --accent-ink: #ffffff;
  --accent-soft: #e9effd;
  --note: #fff7da;
  --note-line: #ecd58a;
  --note-ink: #6b5410;
  --good: #177a45;
  --good-soft: #e3f4ea;
  --warn: #9a5b00;
  --warn-soft: #fdf0d9;
  --bad: #b42323;
  --bad-soft: #fde7e7;
  --ai-soft: #efe9fd; --ai-ink: #6b3fd4; --ai-line: #d9cdf8;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 8px 24px rgba(16, 24, 40, .06);
  --font: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1014; --panel: #16191f; --sunken: #1d2128; --line: #262b33; --line-strong: #363c47;
    --text: #e9ecf1; --muted: #a1a9b6; --faint: #8f98a6;
    --accent: #4d7cf5; --accent-text: #8eadfb; --accent-soft: #1b2747;
    --note: #2c2612; --note-line: #54471c; --note-ink: #ecd58a;
    --good: #5fd394; --good-soft: #16301f; --warn: #f0b65a; --warn-soft: #33270f; --bad: #ff8a8a; --bad-soft: #3d1c1c;
    --ai-soft: #2c2147; --ai-ink: #b9a2f5; --ai-line: #4a3a75;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .3);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0e1014; --panel: #16191f; --sunken: #1d2128; --line: #262b33; --line-strong: #363c47;
  --text: #e9ecf1; --muted: #a1a9b6; --faint: #8f98a6;
  --accent: #4d7cf5; --accent-text: #8eadfb; --accent-soft: #1b2747;
  --note: #2c2612; --note-line: #54471c; --note-ink: #ecd58a;
  --good: #5fd394; --good-soft: #16301f; --warn: #f0b65a; --warn-soft: #33270f; --bad: #ff8a8a; --bad-soft: #3d1c1c;
    --ai-soft: #2c2147; --ai-ink: #b9a2f5; --ai-line: #4a3a75;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .3);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { font: 14px/1.45 var(--font); color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; }
button, input, textarea, select { font: inherit; color: inherit; }
a { color: var(--accent-text); }
/* No double-tap zoom delay on controls; focus rings and :hover give the feedback instead of the grey tap flash. */
a, button, input, select, textarea, label, summary, [role="button"] { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
h1, h2, h3 { text-wrap: balance; }
/* iOS zooms into any field under 16px when it gets focus. */
@media (pointer: coarse) { input, select, textarea { font-size: 16px; } }
.skip-link { position: fixed; top: 8px; left: 8px; z-index: 100; padding: 8px 14px; border: 0; border-radius: 10px; background: var(--accent); color: var(--accent-ink); font-weight: 600; cursor: pointer; transform: translateY(-200%); }
.skip-link:focus-visible { transform: none; outline: 2px solid var(--text); outline-offset: 2px; }
.boot { display: grid; place-items: center; height: 100vh; color: var(--muted); }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 12px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
svg.i { width: 18px; height: 18px; flex: none; }

/* ---------- buttons & inputs ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 36px; padding: 0 14px;
  border: 1px solid var(--line-strong); border-radius: 10px; background: var(--panel); cursor: pointer;
  font-weight: 550; white-space: nowrap; text-decoration: none; color: var(--text);
}
.btn:hover { background: var(--sunken); }
.btn:focus-visible, .input:focus-visible, textarea:focus-visible, select:focus-visible, a:focus-visible, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.07); }
.btn.dark { background: var(--text); border-color: var(--text); color: var(--panel); }
.btn.dark:hover { opacity: .9; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--sunken); }
.btn.danger { color: var(--bad); }
.btn:disabled { opacity: .55; cursor: default; }
.input, select.input, textarea.input {
  width: 100%; height: 40px; padding: 0 12px; border: 1px solid var(--line-strong); border-radius: 10px;
  background: var(--panel);
}
textarea.input { height: auto; padding: 10px 12px; resize: vertical; }
label.field { display: grid; gap: 4px; margin-bottom: 14px; font-weight: 550; }
label.field .hint { font-weight: 400; color: var(--muted); font-size: 12px; }
.error { color: var(--bad); min-height: 20px; }

/* ---------- login ---------- */
.login { display: grid; place-items: center; min-height: 100vh; padding: 16px; }
.login form { width: 100%; max-width: 380px; background: var(--panel); padding: 32px; border-radius: 18px; box-shadow: var(--shadow); border: 1px solid var(--line); }
.login .logo { width: 40px; height: 40px; border-radius: 12px; background: var(--accent); display: grid; place-items: center; margin-bottom: 16px; }
.login .logo svg { width: 22px; height: 22px; }
.login h1 { font-size: 22px; margin: 0 0 4px; letter-spacing: -.02em; }
.login p { margin: 0 0 22px; color: var(--muted); }
.login .btn { width: 100%; height: 44px; }

/* ---------- layout ---------- */
.shell { display: grid; grid-template-columns: 248px 360px 1fr; height: 100vh; height: 100dvh; }
.shell.with-details { grid-template-columns: 248px 360px 1fr 300px; }
.shell.page-mode { grid-template-columns: 248px 1fr; }

.sidebar { background: var(--panel); border-right: 1px solid var(--line); display: flex; flex-direction: column; padding: 20px 14px 14px; gap: 2px; min-width: 0; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; padding: 0 6px 18px; }
.brand .logo { width: 32px; height: 32px; border-radius: 9px; background: var(--accent); display: grid; place-items: center; flex: none; }
.brand .logo svg { width: 18px; height: 18px; }
.brand .bn { font-weight: 700; font-size: 15px; letter-spacing: -.01em; line-height: 1.2; }
.brand .bs { font-size: 12px; color: var(--muted); }
.nav-item { display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 0 12px; border-radius: 10px; color: var(--text); text-decoration: none; font-weight: 500; }
.nav-item:hover { background: var(--sunken); }
.nav-item.active { background: var(--accent-soft); color: var(--accent-text); font-weight: 650; }
.nav-item .count { margin-left: auto; min-width: 22px; padding: 1px 7px; border-radius: 999px; font-size: 12px; font-weight: 600; text-align: center; background: var(--sunken); color: var(--muted); font-variant-numeric: tabular-nums; }
.nav-item.active .count { background: var(--panel); }
.nav-item .count.hot { background: var(--accent); color: var(--accent-ink); }
.nav-sep { height: 1px; background: var(--line); margin: 10px 6px; }
.sidebar .spacer { flex: 1; min-height: 16px; }
.away-toggle { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; border-radius: 12px; background: var(--sunken); }
.away-toggle button { display: flex; align-items: center; justify-content: center; gap: 6px; height: 36px; border: 0; border-radius: 9px; background: transparent; color: var(--muted); font-size: 13px; font-weight: 600; cursor: pointer; }
.away-toggle button .d { width: 8px; height: 8px; border-radius: 50%; background: var(--good); }
.away-toggle button .d.away { background: none; border: 2px solid var(--warn); }
.away-toggle button.on { background: var(--panel); color: var(--text); box-shadow: var(--shadow); }
.status-hint { margin: 8px 6px 4px; font-size: 12px; color: var(--muted); }
.me { display: flex; align-items: center; gap: 8px; padding: 12px 4px 0; margin-top: 10px; border-top: 1px solid var(--line); }
.me .who { min-width: 0; flex: 1; }
.me .who div { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me .who div:first-child { font-weight: 600; font-size: 13px; }
.icon-btn { width: 36px; height: 36px; padding: 0; flex: none; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); color: var(--muted); display: grid; place-items: center; cursor: pointer; }
.icon-btn:hover { background: var(--sunken); color: var(--text); }
.conn { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); flex: none; display: inline-block; margin-right: 4px; }
.conn.live { background: var(--good); }
.conn.away { background: var(--warn); }

.avatar { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; flex: none; font-size: 13px; font-weight: 650; color: #fff; position: relative; }
.avatar.sm { width: 30px; height: 30px; font-size: 11px; }
.avatar.lg { width: 48px; height: 48px; font-size: 16px; }
.avatar .dot { position: absolute; right: -1px; bottom: -1px; width: 11px; height: 11px; border-radius: 50%; background: var(--good); border: 2px solid var(--panel); }

/* ---------- list ---------- */
.list { border-right: 1px solid var(--line); background: var(--panel); display: flex; flex-direction: column; min-width: 0; }
.list-head { padding: 18px 16px 12px; display: grid; gap: 12px; }
.list-head .row { display: flex; align-items: center; gap: 8px; }
.list-head h2 { font-size: 20px; margin: 0; flex: 1; letter-spacing: -.02em; }
.list-head .n { font-size: 12px; color: var(--muted); }
.search { display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 12px; border-radius: 10px; background: var(--sunken); color: var(--muted); border: 1px solid transparent; }
.search:focus-within { border-color: var(--accent); background: var(--panel); outline: 2px solid var(--accent); outline-offset: 2px; }
.search input { flex: 1; min-width: 0; border: 0; background: transparent; color: var(--text); outline: none; }
.list-body { overflow-y: auto; flex: 1; padding: 0 10px 16px; display: flex; flex-direction: column; gap: 2px; }
.conv { display: grid; grid-template-columns: 36px 1fr; gap: 12px; padding: 12px; border-radius: 12px; cursor: pointer; text-decoration: none; color: inherit; }
.conv:hover { background: var(--sunken); }
.conv.active { background: var(--sunken); box-shadow: inset 0 0 0 1px var(--line-strong); }
.conv .top { display: flex; gap: 8px; align-items: baseline; }
.conv .name { font-weight: 550; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv .time { font-size: 12px; color: var(--muted); flex: none; }
.conv .preview { color: var(--muted); font-size: 13px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin-top: 2px; }
.conv.unread .name { font-weight: 700; }
.conv.unread .preview { color: var(--text); }
.conv .meta { display: flex; gap: 6px; margin-top: 6px; align-items: center; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.conv .unread-dot { margin-left: auto; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.empty { padding: 48px 24px; text-align: center; color: var(--muted); }
.empty strong { display: block; color: var(--text); margin-bottom: 4px; font-size: 15px; }

.pill { display: inline-flex; align-items: center; gap: 4px; height: 20px; padding: 0 8px; border-radius: 999px; font-size: 11px; font-weight: 650; text-transform: capitalize; background: var(--sunken); color: var(--muted); }
.pill.open { background: var(--accent-soft); color: var(--accent-text); }
.pill.pending { background: var(--warn-soft); color: var(--warn); }
.pill.closed { background: var(--sunken); color: var(--muted); }
.case-chip { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 6px; font-size: 12px; font-weight: 650; background: var(--sunken); color: var(--muted); font-variant-numeric: tabular-nums; }
.rel-chip { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border-radius: 999px; border: 1px solid var(--line-strong); color: var(--accent-text); font-size: 12px; font-weight: 600; text-decoration: none; }
.rel-chip:hover { background: var(--sunken); }
.rel-chip svg { width: 14px; height: 14px; }

/* ---------- conversation ---------- */
.thread { display: flex; flex-direction: column; min-width: 0; background: var(--bg); }
.thread-head { padding: 12px 24px 10px; border-bottom: 1px solid var(--line); background: var(--panel); }
.th-top { display: flex; align-items: center; gap: 10px; min-height: 44px; }
.th-top .title { flex: 1; min-width: 0; display: grid; gap: 2px; }
.th-top .title .line { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.th-top .title .nm { font-weight: 650; font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.th-top .status-select { width: auto; flex: none; height: 34px; font-size: 13px; padding: 0 8px; }
.th-meta { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 8px; }
.th-meta label { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.th-meta select { width: auto; max-width: 200px; height: 30px; font-size: 13px; padding: 0 6px; }
.back { display: none; }
.messages { flex: 1; overflow-y: auto; padding: 24px; display: flex; flex-direction: column; gap: 14px; }
.messages > * { width: 100%; max-width: 760px; margin-left: auto; margin-right: auto; }
.msg { display: flex; flex-direction: column; gap: 4px; }
.msg .bubble { max-width: min(560px, 80%); padding: 10px 14px; border-radius: 16px; white-space: pre-wrap; word-wrap: break-word; overflow-wrap: anywhere; }
.msg .by { font-size: 12px; color: var(--muted); padding: 0 4px; }
.msg.contact { align-items: flex-start; }
.msg.contact .bubble { background: var(--panel); border-bottom-left-radius: 4px; box-shadow: var(--shadow); }
.msg.agent { align-items: flex-end; }
.msg.agent .bubble { background: var(--accent); color: var(--accent-ink); border-bottom-right-radius: 4px; }
.msg.note { align-items: flex-end; }
.msg.note .bubble { background: var(--note); border: 1px dashed var(--note-line); color: var(--note-ink); border-radius: 12px; }
.msg.system { align-items: center; }
.msg.system .bubble { background: none; padding: 2px 8px; color: var(--muted); font-size: 12px; text-align: center; }
.day { text-align: center; font-size: 12px; color: var(--muted); }
.day span { padding: 4px 10px; border-radius: 999px; background: var(--sunken); }

.composer-wrap { padding: 0 24px 24px; }
.composer { max-width: 760px; margin: 0 auto; border: 1px solid var(--line-strong); border-radius: 14px; background: var(--panel); box-shadow: var(--shadow); }
.composer.note-mode { background: var(--note); border-style: dashed; border-color: var(--note-line); }
/* The textarea has no outline of its own, so the whole composer shows the focus ring. */
.composer:has(textarea:focus) { outline: 2px solid var(--accent); outline-offset: 2px; }
.composer.note-mode:has(textarea:focus) { outline-color: var(--note-ink); }
.composer .tabs { display: flex; gap: 4px; padding: 8px 8px 0; }
.composer .tab { height: 32px; border: 0; background: none; padding: 0 12px; border-radius: 8px; cursor: pointer; color: var(--muted); font-size: 13px; font-weight: 600; }
.composer .tab.on { background: var(--panel); color: var(--text); box-shadow: 0 0 0 1px var(--line); }
.composer textarea { display: block; width: 100%; min-height: 64px; max-height: 240px; border: 0; padding: 10px 14px; resize: none; background: transparent; outline: none; }
.composer .row { display: flex; align-items: center; gap: 10px; padding: 6px 10px 10px 14px; }
.composer .row .hint { flex: 1; font-size: 12px; color: var(--muted); }
.composer.note-mode .btn.primary { background: var(--note-ink); border-color: var(--note-ink); color: var(--note); }

/* ---------- details ---------- */
.details { border-left: 1px solid var(--line); background: var(--panel); overflow-y: auto; padding: 24px 20px; min-width: 0; }
.details h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 24px 0 8px; }
.details .who { display: grid; justify-items: center; gap: 6px; text-align: center; margin-bottom: 18px; }
.details .who .nm { font-weight: 650; font-size: 15px; }
.kv { display: grid; grid-template-columns: 84px 1fr; gap: 8px 10px; font-size: 13px; margin: 0; }
.details > h3:first-child { margin-top: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.history { display: grid; gap: 6px; }
.history a { display: grid; gap: 2px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); text-decoration: none; color: var(--text); font-size: 13px; }
.history a:hover { background: var(--sunken); }
.history a.current { border-color: var(--accent); background: var(--accent-soft); }
.history .r { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.history .r b { color: var(--accent-text); font-variant-numeric: tabular-nums; }
.history .r .t { margin-left: auto; }
.history .s { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.placeholder { display: grid; place-items: center; height: 100%; color: var(--muted); text-align: center; padding: 24px; }

/* ---------- settings ---------- */
.settings { overflow-y: auto; padding: 28px 32px 64px; }
.settings h1 { font-size: 24px; margin: 0 0 4px; letter-spacing: -.02em; }
.settings > p { margin: 0 0 24px; color: var(--muted); }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 22px; margin-bottom: 20px; max-width: 760px; }
.card h2 { font-size: 16px; margin: 0 0 4px; }
.card > p { margin: 0 0 16px; color: var(--muted); }
table.team { width: 100%; border-collapse: collapse; }
table.team td, table.team th { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.team th { font-size: 12px; color: var(--muted); font-weight: 600; }
table.team td.actions { text-align: right; white-space: nowrap; }
table.team tr.disabled td { opacity: .55; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
pre.snippet { background: var(--sunken); border: 1px solid var(--line); border-radius: 10px; padding: 12px; font: 12.5px/1.5 var(--mono); overflow-x: auto; white-space: pre-wrap; word-break: break-all; margin: 0 0 10px; }
.swatch { display: flex; gap: 8px; align-items: center; }
.swatch input[type=color] { width: 44px; height: 40px; padding: 2px; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--panel); }
.seg { display: inline-grid; grid-auto-flow: column; gap: 4px; padding: 4px; border-radius: 12px; background: var(--sunken); }
.seg button { height: 34px; padding: 0 14px; border: 0; border-radius: 9px; background: transparent; color: var(--muted); font-weight: 600; cursor: pointer; }
.seg button.on { background: var(--panel); color: var(--text); box-shadow: var(--shadow); }

/* ---------- all cases ---------- */
.pill.cat { background: var(--accent-soft); color: var(--accent); font-weight: 600; max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: inline-block; line-height: 20px; }
.cases { overflow-y: auto; padding: 28px 32px 64px; min-width: 0; }
.cases-top h1 { font-size: 22px; margin: 0 0 4px; }
.cases-top p { margin: 0 0 18px; color: var(--muted); }
.scope { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; background: var(--accent-soft); border-radius: 10px; padding: 6px 6px 6px 14px; margin-bottom: 14px; }
.scope .btn { margin-left: auto; height: 28px; }
.case-stats { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; margin-bottom: 18px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; }
.stat-v { font-size: 22px; font-weight: 650; font-variant-numeric: tabular-nums; line-height: 1.2; }
.stat-l { font-size: 12px; color: var(--muted); }
.stat.open .stat-v { color: var(--good); }
.stat.pending .stat-v { color: var(--warn); }
.cases-toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 18px; }
.cases-search { flex: 1 1 280px; }
.cases-filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.cases-filters select { width: auto; max-width: 190px; height: 34px; }
.groupby { display: flex; align-items: center; gap: 6px; margin-left: 6px; }
.seg { display: inline-flex; background: var(--sunken); border: 1px solid var(--line); border-radius: 9px; padding: 2px; }
.seg-btn { border: 0; background: none; height: 28px; padding: 0 11px; border-radius: 7px; cursor: pointer; color: var(--muted); font-weight: 600; font-size: 13px; }
.seg-btn:hover { color: var(--text); }
.seg-btn.on { background: var(--panel); color: var(--text); box-shadow: 0 1px 2px rgba(16, 24, 40, .1); }
.seg-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

.case-row {
  display: grid; align-items: center; gap: 12px;
  grid-template-columns: 72px minmax(180px, 1fr) 170px 128px 124px 110px 72px 150px;
  padding: 10px 14px; text-decoration: none; color: var(--text); font-size: 13px;
}
.case-head { font-size: 11.5px; font-weight: 600; color: var(--faint); text-transform: uppercase; letter-spacing: .04em; padding-top: 0; padding-bottom: 6px; }
.case-group { margin-bottom: 18px; }
.group-h { display: flex; align-items: baseline; gap: 8px; font-size: 14px; margin: 0 0 8px; padding: 0 2px; }
.group-sub { font-weight: 400; font-size: 12.5px; }
.group-n { margin-left: auto; font-size: 12px; color: var(--muted); font-weight: 500; }
.case-table { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.case-table .case-row + .case-row { border-top: 1px solid var(--line); }
.case-table .case-row:hover { background: var(--sunken); }
.case-table .case-row:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.c-id { color: var(--muted); font-variant-numeric: tabular-nums; }
.c-subject { display: flex; flex-direction: column; min-width: 0; }
.c-title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.c-preview { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 12.5px; }
.c-preview:empty { display: none; }
.c-customer { display: flex; align-items: center; gap: 8px; min-width: 0; }
.c-name, .c-agent { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.c-opened, .c-age { color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.c-age .age-open { color: var(--text); }
.more { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 4px 2px; }

@media (max-width: 1280px) {
  .case-row { grid-template-columns: 72px minmax(160px, 1fr) 150px 120px 124px 132px; }
  .case-row .c-agent, .case-row .c-opened, .case-head span:nth-child(6), .case-head span:nth-child(7) { display: none; }
}
@media (max-width: 860px) {
  .cases { padding: 20px 16px 48px; }
  .case-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .case-stats .stat:nth-child(n+4) { display: none; }
  .case-head { display: none !important; }
  .case-row { grid-template-columns: auto 1fr auto; grid-template-areas: "id title status" "sub sub sub" "cust cust age"; row-gap: 4px; }
  .case-row .c-id { grid-area: id; }
  .case-row .c-subject { display: contents; }
  .case-row .c-title { grid-area: title; }
  .case-row .c-preview { grid-area: sub; }
  .case-row .c-status { grid-area: status; justify-self: end; }
  .case-row .c-customer { grid-area: cust; }
  .case-row .c-age { grid-area: age; justify-self: end; }
  .case-row .c-cat { display: none; }
  .cases-filters select { max-width: none; flex: 1 1 140px; }
  .groupby { margin-left: 0; flex: 1 1 100%; }
  .groupby select { flex: 1; }
}

/* ---------- AI ---------- */
.btn.sm { height: 28px; padding: 0 10px; font-size: 13px; }
.pill.ai { background: var(--ai-soft); color: var(--ai-ink); }
.ai-state { display: inline-flex; align-items: center; gap: 6px; }
.msg.bot { align-self: flex-end; }
.msg.bot .by { text-align: right; }
.msg.bot .bubble { background: var(--ai-soft); color: var(--text); border: 1px solid var(--ai-line); border-bottom-right-radius: 4px; }
.composer .tabs { align-items: center; }
.copilot-bar { margin-left: auto; display: flex; gap: 4px; }
.copilot-btn:first-child { color: var(--ai-ink); font-weight: 600; }
.copilot-sources { font-size: 12px; margin-top: 6px; min-height: 0; }
.copilot-sources a { text-decoration: none; }
.copilot-sources a:hover { text-decoration: underline; }
.copilot-out { white-space: pre-wrap; font-size: 13px; margin-top: 10px; background: var(--sunken); border-radius: 8px; padding: 0 10px; }
.copilot-out:not(:empty) { padding: 10px; }
.callout { background: var(--sunken); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; font-size: 13px; color: var(--muted); }
.callout code, .card code { font: 12px var(--mono); background: var(--panel); border: 1px solid var(--line); border-radius: 4px; padding: 1px 5px; }
.kb-row { display: grid; grid-template-columns: minmax(0, 1fr) auto 210px; gap: 14px; align-items: center; padding: 12px 14px; text-decoration: none; color: var(--text); }
.case-table .kb-row + .kb-row { border-top: 1px solid var(--line); }
.kb-row:hover { background: var(--sunken); }
.kb-main { display: flex; flex-direction: column; min-width: 0; }
.kb-editor { max-width: 860px; }
.kb-body { font: 14px/1.55 var(--font); min-height: 320px; }
label.check { display: flex; align-items: center; gap: 8px; margin: 4px 0 8px; }
label.check input { width: 16px; height: 16px; }
@media (max-width: 860px) {
  .kb-row { grid-template-columns: 1fr auto; }
  .kb-row .c-opened { display: none; }
  .copilot-bar { margin-left: 0; width: 100%; }
  .composer .tabs { flex-wrap: wrap; }
}

/* ---------- activities ---------- */
.k-ico, .t-kind, .t-card-ico, .kind-btn, .t-flag, .t-handle, .t-check, .t-high { line-height: 0; }
.k-ico svg, .t-kind svg, .t-card-ico svg, .kind-btn svg, .t-flag svg, .t-high svg {
  width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round;
}
.followup-btn { gap: 5px; margin-left: auto; color: var(--muted); }
.followup-btn .k-ico svg { width: 15px; height: 15px; }
.nav-item .count.late { color: var(--bad); }
.seg-n { margin-left: 6px; font-size: 11.5px; color: var(--faint); font-variant-numeric: tabular-nums; }
.seg-btn.on .seg-n { color: var(--accent); }
.acts-who { margin-left: auto; }
.acts-who select { width: auto; height: 34px; }
.acts-body { max-width: 760px; }

.t-card { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); padding: 14px 16px 16px; margin-bottom: 18px; }
.t-card-h { display: flex; align-items: center; gap: 10px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.t-card-h h2 { font-size: 15px; margin: 0; flex: 1; }
.t-card-ico { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; background: var(--good-soft); color: var(--good); flex: none; }
.t-card.late .t-card-ico { background: var(--bad-soft); color: var(--bad); }
.t-card-n { font-size: 11.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--faint); }
.t-progress { height: 3px; border-radius: 3px; background: var(--sunken); margin: 10px 0 2px; overflow: hidden; }
.t-progress span { display: block; height: 100%; background: var(--good); border-radius: 3px; transform-origin: left center; transition: transform .3s ease; }
.t-list { display: flex; flex-direction: column; min-height: 4px; }
.t-list.drop-after { box-shadow: inset 0 -2px 0 var(--accent); }
.t-empty { color: var(--muted); font-size: 13px; padding: 14px 4px 4px; }

.t-row { display: flex; align-items: center; gap: 10px; padding: 10px 4px; border-radius: 10px; position: relative; }
.t-row + .t-row { border-top: 1px solid transparent; }
.t-row:hover { background: var(--sunken); }
.t-row.dragging { opacity: .4; }
.t-list.is-dragging { user-select: none; -webkit-user-select: none; }
.t-row.drop-before::before, .t-row.drop-after::after { content: ""; position: absolute; left: 4px; right: 4px; height: 2px; background: var(--accent); border-radius: 2px; }
.t-row.drop-before::before { top: -1px; }
.t-row.drop-after::after { bottom: -1px; }
.t-handle { width: 16px; height: 28px; margin-right: -6px; border: 0; background: none; color: var(--faint); cursor: grab; opacity: 0; display: grid; place-items: center; border-radius: 4px; flex: none; }
.t-handle svg { width: 14px; height: 14px; fill: currentColor; }
.t-row:hover .t-handle, .t-handle:focus-visible { opacity: 1; }
.t-handle:focus-visible { outline: 2px solid var(--accent); }
.t-check { width: 22px; height: 22px; border-radius: 7px; border: 1.5px solid var(--line-strong); background: var(--panel); display: grid; place-items: center; cursor: pointer; flex: none; padding: 0; color: transparent; transition: background .15s, border-color .15s; }
.t-check svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.t-check:hover { border-color: var(--good); }
.t-check:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.t-row.done .t-check { background: var(--good); border-color: var(--good); color: #fff; }
.t-check.ghost { border-style: dashed; cursor: default; background: transparent; }
.t-kind { width: 32px; height: 32px; border-radius: 9px; background: var(--sunken); border: 1px solid var(--line); display: grid; place-items: center; color: var(--muted); flex: none; }
.t-row:hover .t-kind { background: var(--panel); }
.t-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.t-title { all: unset; cursor: pointer; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border-radius: 4px; }
.t-title:hover { text-decoration: underline; text-decoration-color: var(--line-strong); }
.t-title:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.t-sub { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.t-case { color: var(--accent); text-decoration: none; }
.t-case:hover { text-decoration: underline; }
.t-row.done .t-title { color: var(--faint); text-decoration: line-through; text-decoration-color: var(--faint); }
.t-row.done .t-sub, .t-row.done .t-kind { opacity: .7; }
.t-flag { color: var(--bad); flex: none; }
.t-due { flex: none; font-variant-numeric: tabular-nums; }
.t-due.late { background: var(--bad-soft); color: var(--bad); }
.t-unowned { color: var(--faint); width: 22px; text-align: center; flex: none; }
.t-quick { display: none; gap: 2px; flex: none; }
.t-row:hover .t-quick, .t-row:focus-within .t-quick { display: flex; }
.t-quick .btn { height: 26px; padding: 0 8px; font-size: 12.5px; color: var(--muted); }

.t-add { margin-top: 10px; border: 1.5px dashed var(--line-strong); border-radius: 12px; padding: 8px 10px; }
.t-add:focus-within, .t-add.open { border-style: solid; border-color: var(--accent); background: var(--panel); }
.t-add-line { display: flex; align-items: center; gap: 10px; }
.t-add-input { flex: 1; min-width: 0; border: 0; background: none; height: 28px; outline: none; }
.t-add-input::placeholder { color: var(--faint); }
.t-add-btn { display: none; }
.t-add-opts { display: none; flex-wrap: wrap; gap: 8px 12px; align-items: center; padding: 10px 0 2px 32px; }
.t-add:focus-within .t-add-opts, .t-add.open .t-add-opts, .t-add:focus-within .t-add-btn, .t-add.open .t-add-btn { display: flex; }
.t-opt { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.t-opt .input { height: 30px; width: auto; font-size: 13px; padding: 0 8px; }
.t-high { color: var(--muted); gap: 4px; }
.t-high svg { width: 14px; height: 14px; }
.t-high.on { color: var(--bad); background: var(--bad-soft); }
.kind-pick { display: inline-flex; gap: 2px; background: var(--sunken); border: 1px solid var(--line); border-radius: 9px; padding: 2px; }
.kind-btn { width: 30px; height: 28px; border: 0; background: none; border-radius: 7px; display: grid; place-items: center; cursor: pointer; color: var(--muted); }
.kind-btn:hover { color: var(--text); }
.kind-btn.on { background: var(--panel); color: var(--text); box-shadow: 0 1px 2px rgba(16, 24, 40, .12); }
.kind-btn:focus-visible { outline: 2px solid var(--accent); }

.t-dialog { border: 1px solid var(--line); border-radius: 16px; padding: 0; width: min(520px, calc(100vw - 32px)); background: var(--panel); color: var(--text); box-shadow: 0 20px 60px rgba(16, 24, 40, .25); overscroll-behavior: contain; }
.t-dialog::backdrop { background: rgba(16, 24, 40, .35); }
.t-dialog form { padding: 18px 20px 16px; }
.t-dialog-h { display: flex; align-items: center; margin-bottom: 12px; }
.t-dialog-h h2 { font-size: 17px; margin: 0; flex: 1; }
.t-dialog div.field { display: grid; gap: 4px; margin-bottom: 12px; }
.t-dialog div.field > span:first-child { font-weight: 500; }
.t-dialog .kind-pick { justify-self: start; }
.t-when { display: flex; gap: 8px; }
.t-when input[type=time] { max-width: 140px; }
.t-chips { display: flex; flex-wrap: wrap; gap: 2px; margin: 2px 0 0 -6px; }
.t-chips .btn { color: var(--accent); }
.t-dialog-f { display: flex; gap: 8px; align-items: center; margin-top: 8px; }

.case-tasks .t-row.compact { padding: 6px 2px; gap: 8px; }
.case-tasks .t-row.compact .t-title { font-size: 13px; }
.case-tasks .t-row.compact .t-sub { font-size: 12px; }
.case-tasks .t-row.compact .t-check { width: 18px; height: 18px; border-radius: 5px; }
.case-tasks .t-row.compact .t-check svg { width: 11px; height: 11px; }
.case-tasks .t-due { font-size: 11px; height: 18px; }
.case-tasks > .btn { margin-top: 6px; }

@media (max-width: 860px) {
  .acts-who { margin-left: 0; flex: 1 1 100%; }
  .acts-who select { width: 100%; }
  .t-card { padding: 12px 12px 14px; border-radius: 14px; }
  .t-kind { display: none; }
  .t-handle { display: none; }
  .t-quick { display: none !important; }
  .t-add-opts { padding-left: 0; }
  .followup-btn { margin-left: 0; }
  .t-dialog-f { flex-wrap: wrap; }
}

.toast { position: fixed; bottom: calc(20px + env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); background: var(--text); color: var(--panel); padding: 10px 16px; border-radius: 10px; box-shadow: var(--shadow); z-index: 10; font-weight: 550; }

/* ---------- feedback board ---------- */
.idea-tabs { overflow-x: auto; margin-bottom: 14px; scrollbar-width: thin; }
.idea-tabs .seg { white-space: nowrap; }
.seg-btn.attn .seg-n { color: var(--bad); font-weight: 700; }
.idea-row { display: grid; grid-template-columns: 56px minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 12px 14px; text-decoration: none; color: var(--text); }
.case-table .idea-row + .idea-row { border-top: 1px solid var(--line); }
.idea-row:hover { background: var(--sunken); }
.idea-votes { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; height: 52px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); font-variant-numeric: tabular-nums; }
.idea-votes .up { font-size: 10px; color: var(--accent-text); line-height: 1; }
.idea-votes b { font-size: 15px; }
.idea-votes.big { width: 72px; height: 76px; flex: none; }
.idea-votes.big b { font-size: 22px; }
.idea-tags { display: flex; gap: 6px; align-items: center; }
.idea-head { display: flex; gap: 16px; align-items: flex-start; margin-top: 10px; flex-wrap: wrap; }
.idea-actions { display: flex; gap: 8px; align-items: center; }
.idea-approve { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.idea-approve span { flex: 1 1 240px; }
.idea-grid { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 16px; align-items: start; }
.idea-comments { display: grid; gap: 10px; margin-bottom: 12px; }
.idea-c { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.idea-c > div:first-child { display: flex; align-items: center; gap: 4px; }
.idea-c.agent { background: var(--accent-soft); border-color: transparent; }
.idea-cb { white-space: pre-wrap; overflow-wrap: anywhere; margin-top: 4px; }
.idea-sys { font-size: 12px; color: var(--muted); text-align: center; padding: 2px 0; }
.idea-voter { display: flex; gap: 10px; align-items: center; padding: 8px 4px; border-radius: 8px; text-decoration: none; color: var(--text); }
.idea-voter:hover { background: var(--sunken); }
.pill.idea-open { background: var(--sunken); color: var(--muted); }
.pill.idea-under_review { background: var(--warn-soft); color: var(--warn); }
.pill.idea-planned { background: var(--accent-soft); color: var(--accent-text); }
.pill.idea-in_progress { background: var(--ai-soft); color: var(--ai-ink); }
.pill.idea-complete { background: var(--good-soft); color: var(--good); }
.pill.idea-closed { background: var(--sunken); color: var(--faint); }
@media (max-width: 1000px) {
  .idea-grid { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .idea-row { grid-template-columns: 48px minmax(0, 1fr); }
  .idea-tags { grid-column: 2; }
}

.idea-status-row { display: flex; gap: 8px; margin-bottom: 8px; }
.idea-status-row select { flex: 1; }
.idea-votes.sm { width: 38px; height: 38px; flex: none; }
.idea-votes.sm b { font-size: 13px; }
.idea-picker { display: grid; gap: 10px; }
.idea-pick-list { display: grid; gap: 4px; max-height: 50vh; overflow-y: auto; }
.idea-pick { display: flex; align-items: center; gap: 10px; padding: 6px 4px; border-radius: 8px; }
.idea-pick:hover { background: var(--sunken); }
.idea-pick-new { display: flex; align-items: center; gap: 10px; justify-content: space-between; border-top: 1px solid var(--line); margin-top: 12px; padding-top: 12px; }
.case-ideas { display: grid; gap: 4px; margin-bottom: 8px; }
.case-idea { display: flex; gap: 8px; align-items: center; padding: 4px; border-radius: 8px; text-decoration: none; color: var(--text); }
.case-idea:hover { background: var(--sunken); }
.cl-ideas { display: grid; gap: 6px; }
.cl-chip { display: flex; align-items: center; gap: 4px; font-size: 13px; border: 1px solid var(--line); border-radius: 10px; padding: 4px 4px 4px 8px; }
.cl-chip .btn { margin-left: auto; }
a.seg-btn { display: inline-flex; align-items: center; text-decoration: none; }

/* ---------- responsive ---------- */
@media (max-width: 1240px) {
  .shell.with-details { grid-template-columns: 232px 320px 1fr; }
  .shell.with-details .details { display: none; }
}
/* Phones: the sidebar becomes a drawer that slides in over the page. */
.menu-btn { display: none; }
.scrim, .drawer-close { display: none; }
.brand-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 860px) {
  .shell, .shell.with-details, .shell.page-mode { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; z-index: 40; top: 0; bottom: 0; left: 0; width: min(300px, 84vw);
    overflow-y: auto; overscroll-behavior: contain; border-right: 0;
    padding: calc(12px + env(safe-area-inset-top)) 12px calc(12px + env(safe-area-inset-bottom)) calc(12px + env(safe-area-inset-left));
    transform: translateX(-104%); visibility: hidden;
    transition: transform .26s cubic-bezier(.32, .72, 0, 1), visibility 0s linear .26s;
  }
  .shell.show-sidebar .sidebar { transform: none; visibility: visible; transition: transform .26s cubic-bezier(.32, .72, 0, 1); box-shadow: 8px 0 40px rgba(16, 24, 40, .28); }
  .scrim { display: block; position: fixed; inset: 0; z-index: 39; background: rgba(16, 24, 40, .42); opacity: 0; pointer-events: none; transition: opacity .26s; touch-action: none; }
  .shell.show-sidebar .scrim { opacity: 1; pointer-events: auto; }
  .brand { padding: 4px 4px 14px 8px; }
  .drawer-close { display: inline-flex; width: 36px; height: 36px; padding: 0; justify-content: center; color: var(--muted); }
  .sidebar .nav-item { padding: 11px 12px; font-size: 15px; }
  .sidebar .nav-sep { margin: 8px; }
  .menu-btn { display: inline-flex; width: 40px; height: 40px; padding: 0; justify-content: center; position: relative; flex: none; margin-left: -8px; }
  .menu-btn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
  .menu-btn.dot::after { content: ""; position: absolute; top: 8px; right: 7px; width: 8px; height: 8px; border-radius: 50%; background: var(--bad); box-shadow: 0 0 0 2px var(--bg); }
  .shell.has-conv .list { display: none; }
  .shell:not(.has-conv) .thread { display: none; }
  .back { display: inline-flex; }
  .thread-head { padding: 12px 16px; }
  .messages { padding: 16px; }
  .composer-wrap { padding: 0 12px 12px; }
  .settings { padding: 20px 16px 48px; }
  .grid2 { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; transition-delay: 0s !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; }
}

/* ---------- temporary password dialog ---------- */
.pw-value { font: 600 16px/1 var(--mono); letter-spacing: .04em; }
.pw-status { min-height: 18px; margin: 0; color: var(--good); }

/* ---------- ITIL: priority, SLA, incident record, problems, time ---------- */
.pill.prio { text-transform: none; font-variant-numeric: tabular-nums; }
.pill.prio.p1 { background: var(--bad); color: #fff; }
.pill.prio.p2 { background: var(--bad-soft); color: var(--bad); }
.pill.prio.p3 { background: var(--warn-soft); color: var(--warn); }
.pill.prio.p4 { background: var(--sunken); color: var(--muted); }
.pill.major { background: var(--bad); color: #fff; text-transform: none; }
.pill.resolved { background: var(--good-soft); color: var(--good); }
.pill.sla { text-transform: none; background: var(--sunken); color: var(--muted); }
.pill.sla.warn { background: var(--warn-soft); color: var(--warn); }
.pill.sla.bad { background: var(--bad-soft); color: var(--bad); }
.pill.prb-new { background: var(--sunken); color: var(--muted); }
.pill.prb-investigating { background: var(--ai-soft); color: var(--ai-ink); }
.pill.prb-known_error { background: var(--warn-soft); color: var(--warn); text-transform: none; }
.pill.prb-resolved { background: var(--good-soft); color: var(--good); }
.pill.prb-closed { background: var(--sunken); color: var(--faint); }
.nav-item.nav-sub { font-size: 12.5px; color: var(--muted); padding-left: 24px; }

.itil { display: grid; gap: 8px; }
.itil h3 { margin-bottom: 0 !important; }
.itil-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.itil-field { display: grid; gap: 3px; font-size: 12px; color: var(--muted); min-width: 0; }
.itil-field select, .itil-field input { height: 32px; font-size: 13px; padding: 0 6px; color: var(--text); }
.itil-prio { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px; }
.itil-sla { grid-template-columns: 84px 1fr; }
.itil-sla .sla-bad { color: var(--bad); font-weight: 600; }
.itil-sla .sla-warn { color: var(--warn); font-weight: 600; }
.itil-sla .sla-ok { color: var(--good); }
.itil-problem { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.itil-problem input { width: 110px; flex: 1 1 90px; height: 30px; font-size: 13px; }
.itil-problem a { font-weight: 650; }
.itil-resolution { background: var(--good-soft); border-radius: 10px; padding: 8px 10px; display: grid; gap: 2px; white-space: pre-wrap; }

.composer-time { padding: 0 10px; }
.time-fields { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; min-height: 30px; }
.time-fields .time-ico { color: var(--muted); }
.time-fields .time-input { width: 88px; height: 30px; font-size: 13px; padding: 0 8px; }
.time-fields select { width: auto; max-width: 160px; height: 30px; font-size: 13px; padding: 0 6px; }
.time-bill { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; color: var(--muted); }
.timer-btn { font-variant-numeric: tabular-nums; }
.timer-btn.running { color: var(--bad); background: var(--bad-soft); }
.time-chip { color: var(--accent-text); font-weight: 600; }
.composer.note-mode .time-fields .btn.ghost { color: var(--note-ink); }

.time-summary { display: grid; gap: 8px; }
.time-totals { display: flex; gap: 14px; flex-wrap: wrap; font-variant-numeric: tabular-nums; }
.time-list { display: grid; gap: 2px; }
.time-row { display: flex; gap: 8px; align-items: flex-start; padding: 8px 2px; border-top: 1px solid var(--line); }
.time-row:first-child { border-top: 0; }
.time-main { flex: 1; min-width: 0; display: grid; gap: 2px; }
.time-top { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-variant-numeric: tabular-nums; }
.time-desc { color: var(--muted); white-space: pre-wrap; overflow-wrap: anywhere; }
.time-summary > .btn { justify-self: start; }
.time-table .time-row { padding: 10px 14px; }
.time-table .time-row:hover { background: var(--sunken); }
.sla-table input { height: 32px; max-width: 140px; }
.t-dialog.wide { width: min(680px, calc(100vw - 32px)); }

.prb-row { display: grid; grid-template-columns: 82px minmax(200px, 1fr) 120px 84px 90px 120px 70px; gap: 12px; align-items: center; padding: 10px 14px; text-decoration: none; color: var(--text); font-size: 13px; }
.case-table .prb-row + .prb-row { border-top: 1px solid var(--line); }
.case-table a.prb-row:hover { background: var(--sunken); }
.prb-row .c-id { font-weight: 650; color: var(--accent-text); font-variant-numeric: tabular-nums; }

.idea-row .idea-link { text-decoration: none; color: inherit; border-radius: 8px; }
.idea-row .idea-link:hover .c-title { text-decoration: underline; }
.idea-quick { width: auto; height: 30px; font-size: 12.5px; padding: 0 6px; font-weight: 600; }

@media (max-width: 1100px) {
  .prb-row { grid-template-columns: 82px minmax(160px, 1fr) 110px 70px; }
  .prb-row > :nth-child(5), .prb-row > :nth-child(6), .prb-row > :nth-child(7) { display: none; }
}
@media (max-width: 640px) {
  .itil-grid { grid-template-columns: 1fr; }
  .prb-row { grid-template-columns: auto 1fr auto; }
  .prb-row > :nth-child(4) { display: none; }
  .idea-row { grid-template-columns: 44px minmax(0, 1fr); }
  .idea-row .idea-tags { grid-column: 2; justify-self: start; }
}
.cases-filters input[type=date] { width: auto; height: 34px; }
/* Below 1240px the details column is hidden: "Case details" opens it as a slide-over. */
.details-btn, .details-close { display: none; }
@media (max-width: 1240px) {
  .details-btn { display: inline-flex; }
  .shell.with-details.show-details .details {
    display: block; position: fixed; z-index: 45; top: 0; right: 0; bottom: 0; width: min(380px, 94vw);
    box-shadow: -12px 0 40px rgba(16, 24, 40, .25); padding-top: 12px;
  }
  .shell.show-details .details-close { display: inline-flex; margin-bottom: 8px; }
}
.suggest-row { display: flex; gap: 8px; align-items: center; }
.suggest-row > a { flex: 1; min-width: 0; }

/* ===================== Suite: status page, help center, portal ===================== */
.kb-pills { display: inline-flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.pill.pub { background: var(--good-soft); color: var(--good); }
.t-dialog.s-wide { width: min(640px, calc(100vw - 32px)); }
.comp-checks { display: flex; flex-wrap: wrap; gap: 4px 16px; }
.comp-checks .check { margin: 0; }
.portal-mod { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 8px 0; border-top: 1px solid var(--line); }
.portal-mod:first-of-type { border-top: 0; }
.portal-mod .check { margin: 0; flex: 1 1 380px; }

/* status admin */
.status-page { --s-ok: #1f9d55; --s-maint: #3b82f6; --s-degraded: #d99a06; --s-partial: #f97316; --s-major: #dc2626; --s-none: var(--line-strong); }
.ov-strip { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: 12px; margin-bottom: 18px; color: #fff; background: var(--s-ok); max-width: 1000px; }
.ov-strip.ov-maint { background: var(--s-maint); }
.ov-strip.ov-degraded { background: var(--s-degraded); }
.ov-strip.ov-partial { background: var(--s-partial); }
.ov-strip.ov-major { background: var(--s-major); }
.ov-dot { width: 10px; height: 10px; border-radius: 50%; background: #fff; box-shadow: 0 0 0 4px rgba(255, 255, 255, .3); }
.sec-h { font-size: 15px; margin: 22px 0 10px; }
.sec-row { display: flex; align-items: center; justify-content: space-between; max-width: 1000px; }
.sec-row .sec-h { margin-bottom: 10px; }
.inc-card { max-width: 1000px; padding: 14px 16px; margin-bottom: 10px; border-left: 4px solid var(--s-degraded); }
.inc-card.imp-major { border-left-color: var(--s-partial); }
.inc-card.imp-critical { border-left-color: var(--s-major); }
.inc-card.maint { border-left-color: var(--s-maint); }
.inc-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.inc-update { margin-top: 8px; padding: 8px 10px; background: var(--sunken); border-radius: 8px; white-space: pre-wrap; font-size: 13.5px; }
.pill.ist-investigating { background: var(--bad-soft); color: var(--bad); }
.pill.ist-identified, .pill.ist-monitoring { background: var(--warn-soft); color: var(--warn); }
.pill.ist-resolved, .pill.ist-completed { background: var(--good-soft); color: var(--good); }
.pill.ist-scheduled, .pill.ist-in_progress { background: var(--accent-soft); color: var(--accent-text); }
.comp-list { max-width: 1000px; padding: 4px 16px; }
.comp-row { display: grid; grid-template-columns: minmax(0, 1fr) 210px 190px auto; gap: 14px; align-items: center; padding: 12px 0; border-top: 1px solid var(--line); }
.comp-row:first-child { border-top: 0; }
.comp-main { min-width: 0; }
.comp-main .small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.comp-main .bad { color: var(--bad); font-weight: 600; }
.sbars { display: flex; gap: 2px; height: 24px; }
.sb { flex: 1; border-radius: 2px; background: var(--s-ok); }
.sb.maint { background: var(--s-maint); }
.sb.degraded { background: var(--s-degraded); }
.sb.partial { background: var(--s-partial); }
.sb.major { background: var(--s-major); }
.sb.none { background: var(--s-none); }
.cs-sel { height: 32px; font-weight: 600; }
.cs-sel.cs-ok { color: var(--good); }
.cs-sel.cs-degraded, .cs-sel.cs-partial { color: var(--warn); }
.cs-sel.cs-major { color: var(--bad); }
.cs-sel.cs-maint { color: var(--accent-text); }
.comp-tools { display: flex; gap: 2px; align-items: center; }
.past-row { display: grid; grid-template-columns: minmax(0, 1fr) auto 170px auto; gap: 14px; align-items: center; padding: 10px 14px; border-top: 1px solid var(--line); }
.past-row:first-child { border-top: 0; }
.past-tools { display: flex; gap: 6px; align-items: center; }

@media (max-width: 860px) {
  .comp-row { grid-template-columns: minmax(0, 1fr) auto; }
  .comp-row .sbars { grid-column: 1 / -1; grid-row: 2; }
  .comp-row .comp-tools { grid-column: 2; grid-row: 1; }
  .comp-row .cs-sel { grid-column: 1 / -1; }
  .past-row { grid-template-columns: minmax(0, 1fr) auto; }
  .past-row .c-opened { display: none; }
}
.icon-btn.sm { width: 28px; height: 28px; border-radius: 8px; font-size: 13px; }

.status-page .case-table { max-width: 1000px; }
