/* =========================================================================
   Call Intelligence — light theme, Linear-flavoured.
   Hand-written, no framework, no build step.
   ========================================================================= */

:root {
  --bg: #ffffff;
  --bg-sub: #fafafa;
  --bg-hover: #f6f6f7;
  --bg-active: #eeeef1;
  --border: #ececee;
  --border-2: #e2e2e6;
  --text: #191920;
  --text-2: #66666f;
  --text-3: #9a9aa2;
  --accent: #5b63d3;
  --accent-hover: #4d55c6;
  --accent-soft: #eef0fb;
  --red: #cc4b45;
  --red-soft: #fdf1f0;
  --green: #2b8a5f;
  --green-soft: #eef8f2;
  --amber: #a8741f;
  --amber-soft: #fdf7e9;
  --radius: 6px;
  --radius-lg: 10px;
  --shadow-sm: 0 1px 2px rgba(20, 20, 30, .06);
  --shadow-md: 0 4px 16px rgba(20, 20, 30, .08), 0 1px 3px rgba(20, 20, 30, .06);
  --shadow-lg: 0 24px 48px rgba(20, 20, 30, .16);
  --sans: "Inter", "Inter var", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
}

*, *::before, *::after { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -.011em; }
h1 { font-size: 21px; }
h2 { font-size: 15px; }
p { margin: 0; }
a { color: inherit; text-decoration: none; }
svg.ic { flex: none; display: block; }
button { font: inherit; color: inherit; }
em { font-style: normal; }

.muted { color: var(--text-3); }
.text-red { color: var(--red); }

/* ---------- shell ---------- */
.app { display: flex; height: 100vh; overflow: hidden; }

.sidebar {
  width: 236px;
  flex: none;
  background: var(--bg-sub);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 10px 10px 10px;
}

.content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.main { flex: 1; overflow-y: auto; }

/* ---------- workspace switcher ---------- */
.ws {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: var(--radius);
  cursor: default;
}
.ws:hover { background: var(--bg-hover); }
.ws-logo {
  width: 22px; height: 22px;
  border-radius: 5px;
  background: linear-gradient(145deg, #6a72dd, #4a52c0);
  color: #fff;
  display: grid; place-items: center;
  font-size: 11px; font-weight: 600;
}
.ws-name {
  flex: 1; min-width: 0;
  font-size: 13px; font-weight: 500;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ws-caret { color: var(--text-3); }

/* ---------- nav ---------- */
.nav { display: flex; flex-direction: column; gap: 1px; margin-top: 8px; }
.nav-section {
  margin: 16px 8px 4px;
  font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase;
  color: var(--text-3);
}
.nav-item {
  display: flex; align-items: center; gap: 9px;
  height: 30px; padding: 0 8px;
  border-radius: var(--radius);
  font-size: 13px; color: var(--text-2);
}
.nav-item:hover { background: var(--bg-hover); color: var(--text); }
.nav-item.active { background: var(--bg-active); color: var(--text); font-weight: 500; }
.nav-item .ic { color: var(--text-3); }
.nav-item.active .ic, .nav-item:hover .ic { color: var(--text-2); }

.sidebar-foot { margin-top: auto; padding-top: 10px; }
.me {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 6px 6px 8px;
  border-top: 1px solid var(--border);
  padding-top: 12px;
}
.me-text { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.me-name {
  font-size: 12.5px; font-weight: 500;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.me-role { font-size: 11px; color: var(--text-3); }

/* ---------- avatar ---------- */
.avatar {
  border-radius: 50%;
  background: var(--av, #6e79d6);
  color: #fff;
  display: inline-grid; place-items: center;
  font-weight: 600; font-size: 10px;
  flex: none; letter-spacing: .01em;
}

/* ---------- topbar ---------- */
.topbar {
  height: 46px; flex: none;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 20px;
  border-bottom: 1px solid var(--border);
  background: rgba(255,255,255,.85);
  backdrop-filter: saturate(180%) blur(6px);
}
.crumbs { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.crumb-root { color: var(--text-2); }
.crumb-sep { color: var(--text-3); }
.crumb-here { color: var(--text); font-weight: 500; }
.crumb-link { color: var(--text-2); }
.crumb-link:hover { color: var(--text); }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.chip-role {
  font-size: 11px; color: var(--text-2);
  background: var(--bg-sub); border: 1px solid var(--border);
  padding: 2px 8px; border-radius: 99px;
}

/* ---------- flash ---------- */
.flash {
  margin: 12px 20px 0;
  padding: 9px 12px;
  border-radius: var(--radius);
  font-size: 13px;
  border: 1px solid transparent;
}
.flash-ok { background: var(--green-soft); border-color: #cfe9db; color: #1f6b49; }
.flash-err { background: var(--red-soft); border-color: #f2d5d3; color: #a53b36; }

/* ---------- page ---------- */
.page { padding: 22px 20px 80px; max-width: 1180px; margin: 0 auto; }
.page-narrow { max-width: 720px; }
.page-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 16px; margin-bottom: 18px;
}
.page-sub { color: var(--text-2); font-size: 13px; margin-top: 3px; }
.back-link {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 12.5px; color: var(--text-2); margin-bottom: 12px;
}
.back-link:hover { color: var(--text); }
.section-title { margin: 30px 0 10px; font-size: 13px; color: var(--text-2); font-weight: 500; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  height: 30px; padding: 0 11px;
  border: 1px solid var(--border-2);
  background: #fff; border-radius: var(--radius);
  font-size: 13px; font-weight: 500;
  cursor: pointer; white-space: nowrap;
  transition: background .12s ease, border-color .12s ease;
}
.btn:hover { background: var(--bg-hover); }
.btn:active { background: var(--bg-active); }
.btn-primary {
  background: var(--accent); border-color: var(--accent); color: #fff;
  box-shadow: var(--shadow-sm);
}
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--bg-hover); color: var(--text); }
.btn-block { width: 100%; justify-content: center; height: 34px; }

.icon-btn {
  display: inline-grid; place-items: center;
  width: 26px; height: 26px;
  border: none; background: transparent; border-radius: 5px;
  color: var(--text-3); cursor: pointer;
}
.icon-btn:hover { background: var(--bg-active); color: var(--text); }
.icon-btn-danger:hover { background: var(--red-soft); color: var(--red); }
.inline-form { display: inline; }

/* ---------- fields ---------- */
.field { display: flex; flex-direction: column; gap: 5px; }
.field > span {
  font-size: 12px; font-weight: 500; color: var(--text-2);
  display: flex; gap: 6px; align-items: baseline;
}
.field > span em { font-size: 11px; color: var(--text-3); font-weight: 400; }
input[type="text"], input[type="email"], input[type="password"],
input[type="search"], input[type="date"], input[type="time"],
select, textarea {
  font: inherit; font-size: 13px;
  color: var(--text);
  background: #fff;
  border: 1px solid var(--border-2);
  border-radius: var(--radius);
  padding: 6px 9px;
  width: 100%;
  transition: border-color .12s ease, box-shadow .12s ease;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
input:disabled { background: var(--bg-sub); color: var(--text-3); }
textarea { resize: vertical; }
select {
  appearance: none;
  padding-right: 28px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 16 16' fill='none' stroke='%239a9aa2' stroke-width='1.5' stroke-linecap='round'%3E%3Cpath d='m4 6.2 4 3.8 4-3.8'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  background-size: 12px;
}
.stack { display: flex; flex-direction: column; gap: 12px; }

.edit-grid {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px;
}
.field-wide { grid-column: 1 / -1; }
.field-sm input, .field-sm select { padding: 5px 8px; font-size: 12.5px; }

/* ---------- toolbar ---------- */
.toolbar { display: flex; align-items: center; gap: 10px; margin: 16px 0 10px; }
.toolbar-spacer { flex: 1; }
.toolbar-form { display: flex; align-items: center; gap: 8px; }
.seg {
  display: inline-flex; padding: 2px; gap: 2px;
  background: var(--bg-active); border-radius: 7px;
}
.seg-item {
  padding: 3px 10px; border-radius: 5px;
  font-size: 12.5px; color: var(--text-2); cursor: pointer;
}
.seg-item:hover { color: var(--text); }
.seg-item.active { background: #fff; color: var(--text); box-shadow: var(--shadow-sm); font-weight: 500; }

.search { position: relative; display: flex; align-items: center; }
.search .ic { position: absolute; left: 9px; color: var(--text-3); pointer-events: none; }
.search input { padding-left: 28px; width: 210px; }
.select-compact { width: auto; font-size: 12.5px; padding: 5px 26px 5px 9px; }

/* ---------- KPIs ---------- */
.kpis {
  display: grid; grid-template-columns: repeat(4, 1fr);
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  overflow: hidden; background: var(--bg-sub);
}
.kpi { padding: 12px 16px; border-left: 1px solid var(--border); background: #fff; }
.kpi:first-child { border-left: none; }
.kpi-label {
  display: block; font-size: 11px; font-weight: 500; letter-spacing: .03em;
  text-transform: uppercase; color: var(--text-3); margin-bottom: 3px;
}
.kpi-value { font-size: 20px; font-weight: 600; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }

/* ---------- list ---------- */
.list {
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  overflow: hidden; background: #fff;
}
.list-head {
  display: grid; align-items: center; gap: 10px;
  padding: 0 12px; height: 32px;
  background: var(--bg-sub);
  border-bottom: 1px solid var(--border);
  font-size: 11px; font-weight: 500; letter-spacing: .03em;
  text-transform: uppercase; color: var(--text-3);
}
.list-head span { white-space: nowrap; }

.task > .row, .list-head:not(.call-grid):not(.user-grid) {
  grid-template-columns: 24px minmax(0, 1fr) 150px 126px 96px 104px;
}
.call-grid { grid-template-columns: 16px minmax(0, 1fr) 140px 86px 78px 72px 96px; }
.call-grid span { white-space: nowrap; }
.user-grid { grid-template-columns: 24px minmax(0, 1fr) 120px 116px 150px 116px; }

.task { border-top: 1px solid var(--border); }
.task:first-of-type { border-top: none; }

.row {
  display: grid; align-items: center; gap: 10px;
  padding: 0 12px; min-height: 52px;
  cursor: pointer; user-select: none;
}
.row:hover { background: var(--bg-hover); }
.task.is-open > .row { background: var(--bg-hover); }
.row:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
a.row { cursor: default; }
a.row:hover { background: var(--bg-hover); }

.row-main { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.row-title {
  font-size: 13.5px; font-weight: 450;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.row-title.done { color: var(--text-3); text-decoration: line-through; }
.row-sub {
  font-size: 12px; color: var(--text-3);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.row-assignee, .row-prio {
  display: flex; align-items: center; gap: 6px;
  font-size: 12.5px; color: var(--text-2); min-width: 0;
}
.row-assignee span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-due, .row-when, .row-status, .row-score {
  font-size: 12.5px; color: var(--text-2); font-variant-numeric: tabular-nums;
}
.row-due.overdue { color: var(--red); font-weight: 500; }
.row-actions { display: flex; align-items: center; gap: 2px; justify-content: flex-end; }

.row-check { display: flex; align-items: center; justify-content: center; }
.check-btn {
  width: 17px; height: 17px; border-radius: 50%;
  border: 1.5px solid var(--border-2); background: #fff;
  display: grid; place-items: center; cursor: pointer;
  color: transparent; padding: 0;
  transition: border-color .12s ease, background .12s ease, color .12s ease;
}
.check-btn:hover { border-color: var(--green); color: var(--green); background: var(--green-soft); }

.call-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--border-2); margin: 0 auto; }
.call-positive { background: var(--green); }
.call-negative { background: var(--red); }
.call-neutral { background: var(--amber); }

.score-pill {
  display: inline-grid; place-items: center;
  min-width: 30px; height: 20px; padding: 0 6px;
  border-radius: 99px; font-size: 12px; font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.score-hi { background: var(--green-soft); color: #1f6b49; }
.score-mid { background: var(--amber-soft); color: #8a5f14; }
.score-lo { background: var(--red-soft); color: #a53b36; }

/* ---------- pills, tags ---------- */
.pill {
  display: inline-flex; align-items: center; gap: 5px;
  height: 20px; padding: 0 8px;
  border-radius: 99px; font-size: 11.5px; font-weight: 500;
  background: var(--bg-active); color: var(--text-2);
}
.pill i { width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.pill-open { background: var(--accent-soft); color: #4850b8; }
.pill-in-progress { background: var(--amber-soft); color: #8a5f14; }
.pill-completed { background: var(--green-soft); color: #1f6b49; }
.pill-cancelled { background: var(--bg-active); color: var(--text-3); }
.pill-received { background: var(--accent-soft); color: #4850b8; }
.pill-processing { background: var(--amber-soft); color: #8a5f14; }
.pill-failed { background: var(--red-soft); color: #a53b36; }

.role-tag {
  font-size: 11.5px; padding: 2px 7px; border-radius: 5px;
  background: var(--bg-active); color: var(--text-2); text-transform: capitalize;
}
.role-owner, .role-admin { background: var(--accent-soft); color: #4850b8; }
.role-manager { background: var(--amber-soft); color: #8a5f14; }

.prio { display: inline-flex; color: var(--text-3); }
.prio rect { fill: currentColor; }
.prio-low { color: #b9b9c0; }
.prio-medium { color: #8f9bd6; }
.prio-high { color: #6a76d8; }
.prio-urgent { color: var(--red); }

/* ---------- flash / empty ---------- */
.empty {
  border: 1px dashed var(--border-2); border-radius: var(--radius-lg);
  padding: 46px 20px; text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  color: var(--text-2);
}
.empty strong { font-size: 14px; color: var(--text); }
.empty p { font-size: 13px; max-width: 380px; }
.empty-icon {
  width: 38px; height: 38px; border-radius: 10px;
  background: var(--bg-active); color: var(--text-3);
  display: grid; place-items: center; margin-bottom: 8px;
}

/* ---------- expanded panel ---------- */
.row-panel { border-top: 1px solid var(--border); background: #fff; }
.panel { display: grid; grid-template-columns: minmax(0, 1.02fr) minmax(0, .98fr); }
.panel-main { padding: 20px 22px; border-right: 1px solid var(--border); min-width: 0; }
.panel-side { padding: 20px 22px; min-width: 0; display: flex; flex-direction: column; gap: 16px; }

.panel-top { display: flex; gap: 18px; align-items: center; margin-bottom: 16px; }
.score-ring {
  --score: 0; --ring: var(--green);
  width: 78px; height: 78px; border-radius: 50%;
  background: conic-gradient(var(--ring) calc(var(--score) * 1%), var(--bg-active) 0);
  display: grid; place-items: center; flex: none;
}
.score-inner {
  width: 62px; height: 62px; border-radius: 50%; background: #fff;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  line-height: 1.1;
}
.score-inner strong { font-size: 19px; font-weight: 600; letter-spacing: -.02em; }
.score-inner span { font-size: 9px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-3); }

.facts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 18px; min-width: 0; }
.fact { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.fact > span {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-3);
}
.fact strong { font-size: 13.5px; font-weight: 500; }
.fact-wide { grid-column: 1 / -1; }
.sent-positive { color: var(--green); }
.sent-negative { color: var(--red); }
.sent-neutral { color: var(--amber); }

.attention {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--red-soft); color: #a53b36;
  font-size: 12px; padding: 4px 9px; border-radius: 5px; margin-bottom: 12px;
}

.summary { font-size: 13.5px; line-height: 1.6; color: var(--text); margin-bottom: 14px; }

.next-action {
  background: var(--bg-sub); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 10px 12px; margin-bottom: 14px;
}
.next-action .label, .chip-group .label, .related .label {
  display: block; font-size: 10.5px; text-transform: uppercase;
  letter-spacing: .04em; color: var(--text-3); margin-bottom: 3px;
}
.next-action p { font-size: 13px; }

.chip-group { margin-bottom: 12px; }
.chips { display: flex; flex-wrap: wrap; gap: 5px; }
.chip {
  font-size: 12px; padding: 3px 8px; border-radius: 5px;
  background: var(--bg-active); color: var(--text-2);
}
.chip-warn { background: var(--amber-soft); color: #8a5f14; }

.panel-meta { font-size: 11.5px; color: var(--text-3); margin-bottom: 16px; }

.empty-analysis {
  display: flex; gap: 12px; align-items: flex-start;
  background: var(--bg-sub); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px; margin-bottom: 16px;
}
.empty-analysis strong { display: block; font-size: 13.5px; }
.empty-analysis p { font-size: 12.5px; color: var(--text-2); }

.task-edit {
  border-top: 1px solid var(--border); padding-top: 14px;
  display: flex; flex-direction: column; gap: 12px;
}
.edit-actions { display: flex; align-items: center; gap: 8px; }
.edit-spacer { flex: 1; }

/* ---------- player ---------- */
.player-card { border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 14px; background: var(--bg-sub); }
.player-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.player-head strong { display: block; font-size: 13.5px; font-weight: 500; }
.player-sub { font-size: 12px; color: var(--text-3); }
.link-quiet { font-size: 12px; color: var(--text-2); display: inline-flex; align-items: center; gap: 3px; }
.link-quiet:hover { color: var(--accent); }

.player { display: flex; align-items: center; gap: 10px; }
.play-btn {
  width: 30px; height: 30px; border-radius: 50%; flex: none;
  background: var(--accent); border: none; color: #fff;
  display: grid; place-items: center; cursor: pointer;
  box-shadow: var(--shadow-sm);
}
.play-btn:hover { background: var(--accent-hover); }
.seek { flex: 1; height: 20px; display: flex; align-items: center; cursor: pointer; }
.seek-track { width: 100%; height: 4px; border-radius: 99px; background: var(--bg-active); overflow: hidden; }
.seek-fill { height: 100%; width: 0; background: var(--accent); border-radius: 99px; }
.player-time { font-size: 11.5px; color: var(--text-3); font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ---------- transcript ---------- */
.transcript { display: flex; flex-direction: column; min-height: 0; }
.transcript-head {
  display: flex; align-items: baseline; justify-content: space-between;
  font-size: 12px; font-weight: 500; color: var(--text-2);
  padding-bottom: 8px; border-bottom: 1px solid var(--border); margin-bottom: 10px;
}
.transcript-meta { font-size: 11.5px; color: var(--text-3); font-weight: 400; }
.transcript-body {
  overflow-y: auto; max-height: 420px; padding-right: 6px;
  font-size: 13px; line-height: 1.65; color: var(--text-2);
}
.transcript-body p { margin-bottom: 10px; }
.transcript-body p:last-child { margin-bottom: 0; }
.transcript-tall { max-height: 560px; }
.transcript-warn {
  background: var(--amber-soft); color: #8a5f14;
  border-radius: var(--radius); padding: 8px 10px; font-size: 12.5px;
}
.transcript-empty { color: var(--text-3); font-size: 13px; }

.side-empty {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 40px 20px; color: var(--text-3); font-size: 13px;
}
.side-empty .ic { color: var(--text-3); }

/* ---------- cards ---------- */
.card {
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 18px 20px; margin-bottom: 16px; background: #fff;
}
.card-title { margin-bottom: 12px; }
.call-layout { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr); gap: 16px; }
.transcript-card { margin-top: 16px; }
.related { border-top: 1px solid var(--border); padding-top: 12px; }
.related-task {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; padding: 5px 0; color: var(--text-2);
}
.related-task:hover { color: var(--accent); }
.dot { width: 6px; height: 6px; border-radius: 50%; background: var(--text-3); flex: none; }
.dot-completed { background: var(--green); }
.dot-in-progress { background: var(--amber); }
.dot-cancelled { background: var(--border-2); }

.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.stat { display: flex; flex-direction: column; gap: 2px; }
.stat span { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-3); }
.stat strong { font-size: 15px; font-weight: 600; }

/* ---------- audit trail ---------- */
.trail { border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; }
.trail-row {
  display: grid; grid-template-columns: 200px 1fr 160px;
  gap: 12px; padding: 8px 14px; font-size: 12.5px;
  border-top: 1px solid var(--border); color: var(--text-2);
}
.trail-row:first-child { border-top: none; }
.trail-action { font-family: var(--mono); font-size: 11.5px; color: var(--text); }
.trail-when { color: var(--text-3); text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- dialog ---------- */
.dialog {
  border: none; border-radius: 12px; padding: 0;
  width: min(440px, calc(100vw - 32px));
  box-shadow: var(--shadow-lg);
  color: var(--text);
}
.dialog::backdrop { background: rgba(20, 20, 30, .32); backdrop-filter: blur(1px); }
.dialog-form { padding: 18px 20px 16px; display: flex; flex-direction: column; gap: 12px; }
.dialog-head { display: flex; align-items: center; justify-content: space-between; }
.dialog-head h2 { font-size: 15px; }
.dialog-note { font-size: 12px; color: var(--text-3); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }

/* ---------- login ---------- */
.login-body { display: grid; place-items: center; background: var(--bg-sub); }
.login-wrap { width: 100%; display: grid; place-items: center; padding: 24px; }
.login-card {
  width: min(384px, 100%);
  background: #fff; border: 1px solid var(--border);
  border-radius: 14px; box-shadow: var(--shadow-md);
  padding: 26px 26px 22px;
}
.login-brand {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; font-weight: 600; margin-bottom: 22px;
}
.brand-mark {
  width: 26px; height: 26px; border-radius: 7px;
  background: linear-gradient(145deg, #6a72dd, #4a52c0);
  color: #fff; display: grid; place-items: center;
}
.login-card h1 { font-size: 19px; margin-bottom: 4px; }
.login-sub { font-size: 13px; color: var(--text-2); margin-bottom: 18px; }
.login-foot { margin-top: 18px; font-size: 12px; color: var(--text-3); text-align: center; }
.login-card .flash { margin: 0 0 16px; }

/* ---------- loading ---------- */
.panel-loading { padding: 26px 22px; color: var(--text-3); font-size: 13px; }

/* ---------- responsive ---------- */
@media (max-width: 1080px) {
  .panel, .call-layout { grid-template-columns: minmax(0, 1fr); }
  .panel-main { border-right: none; border-bottom: 1px solid var(--border); }
}

/* Below 860px the sidebar becomes a compact top bar: hiding it outright would
   leave no way to reach Calls, Users or Settings on a phone. */
@media (max-width: 860px) {
  html, body { height: auto; }
  .app { flex-direction: column; height: auto; min-height: 100vh; overflow: visible; }
  .sidebar {
    width: 100%; flex-direction: row; align-items: center; gap: 4px;
    padding: 8px 12px; border-right: none;
    border-bottom: 1px solid var(--border);
    position: sticky; top: 0; z-index: 30;
    background: rgba(250, 250, 250, .96);
    backdrop-filter: saturate(180%) blur(8px);
  }
  .ws { padding: 4px 4px; }
  .ws-name, .ws-caret { display: none; }
  .nav { flex-direction: row; margin: 0; gap: 2px; }
  .nav-item { height: 30px; padding: 0 10px; }
  .nav-item span { display: none; }
  .sidebar-foot { margin: 0 0 0 auto; padding: 0; }
  .me { border-top: none; padding: 0; }
  .me-text { display: none; }
  .content { overflow: visible; }
  .main { overflow: visible; }

  .page { padding: 16px 14px 60px; }
  .page-head { align-items: flex-start; flex-wrap: wrap; gap: 10px; }
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .kpi:nth-child(3) { border-left: none; }

  .toolbar { flex-wrap: wrap; }
  .toolbar-form { flex: 1 1 100%; }
  .search { flex: 1; }
  .search input { width: 100%; }
  .seg { max-width: 100%; overflow-x: auto; }

  .list-head { display: none; }

  /* One task: check, title, status on the first line; due date beneath the title. */
  .task > .row {
    grid-template-columns: 22px minmax(0, 1fr) auto;
    grid-template-areas:
      "check main status"
      "check due  status";
    row-gap: 2px;
    padding: 9px 12px;
    min-height: 56px;
  }
  .task > .row .row-check { grid-area: check; align-self: start; margin-top: 2px; }
  .task > .row .row-main { grid-area: main; }
  .task > .row .row-due { grid-area: due; font-size: 12px; }
  .task > .row .row-status { grid-area: status; align-self: center; }
  .task > .row .row-assignee,
  .task > .row .row-prio { display: none; }

  /* One call: dot, customer, score. */
  a.call-grid { grid-template-columns: 10px minmax(0, 1fr) auto; padding: 10px 12px; }
  a.call-grid .row-assignee,
  a.call-grid .row-when { display: none; }

  /* One person: avatar, name, status, actions. */
  .user-grid { grid-template-columns: 22px minmax(0, 1fr) auto auto; }
  .user-grid > .row-when:nth-child(3),
  .user-grid > .row-when:nth-child(5) { display: none; }

  .panel-main, .panel-side { padding: 16px 14px; }
  .card { padding: 14px; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .trail-row { grid-template-columns: 1fr auto; }
  .trail-target { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
