/* XQ-CRM — design system per the design handoff (dark default, light theme). */

/* ---------- tokens ---------- */
body {
  --page-bg: radial-gradient(1100px 500px at 65% -8%, rgba(62,195,174,.05), transparent 62%), #161412;
  --sidebar-bg: linear-gradient(180deg,#1d1a16 0%,#181512 100%);
  --panel-bg: linear-gradient(180deg,#211e1a 0%,#1c1916 100%);
  --panel-border: #2f2b26;
  --panel-shadow: inset 0 1px 0 rgba(255,255,255,.045), 0 12px 32px -16px rgba(0,0,0,.6);
  --row-shadow: inset 0 1px 0 rgba(255,255,255,.045), 0 8px 24px -14px rgba(0,0,0,.55);
  --modal-shadow: 0 24px 70px rgba(0,0,0,.55), inset 0 1px 0 rgba(255,255,255,.05);
  --border: #2a2622;
  --border-strong: #3a352f;
  --surface2: #262220;
  --input-bg: #161412;
  --text1: #f4f1ec;
  --text2: #a89f94;
  --text3: #746c62;
  --text-soft: #d9d4cc;
  --overlay: rgba(12,10,8,.6);
  --font-display: "Instrument Sans",-apple-system,"Segoe UI",Helvetica,Arial,sans-serif;
  --display-weight: 650;
  --accent: #3ec3ae;
  --accent-soft: rgba(62,195,174,.13);
  --accent-soft-border: rgba(62,195,174,.4);
  --ok: #6bc98f;   --ok-soft: rgba(107,201,143,.13);
  --info: #6fa8dc; --info-soft: rgba(111,168,220,.13);
  --warn: #dcaf62; --warn-soft: rgba(220,175,98,.13);
  --bad: #dd7d74;  --bad-soft: rgba(221,125,116,.13);
}
body[data-theme="light"] {
  --page-bg: radial-gradient(900px 420px at 68% -12%, rgba(255,145,60,.13), transparent 60%), radial-gradient(1300px 640px at 32% -10%, rgba(96,130,255,.10), transparent 65%), #fbfaf8;
  --sidebar-bg: rgba(255,255,255,.72);
  --panel-bg: #ffffff;
  --panel-border: #e9e5df;
  --panel-shadow: 0 1px 2px rgba(35,30,20,.04), 0 14px 36px -22px rgba(35,30,20,.16);
  --row-shadow: 0 1px 2px rgba(35,30,20,.05);
  --modal-shadow: 0 24px 70px rgba(35,30,20,.22);
  --border: #eae6e0;
  --border-strong: #d8d3cb;
  --surface2: #f3f1ec;
  --input-bg: #ffffff;
  --text1: #211f1c;
  --text2: #6d675e;
  --text3: #9a948a;
  --text-soft: #3c3934;
  --overlay: rgba(45,40,30,.35);
  --font-display: "Newsreader",Georgia,serif;
  --display-weight: 500;
  --accent: #0f9d87;
  --ok: #1e8f4d;
  --info: #2467b8;
  --warn: #96660e;
  --bad: #bd3a30;
}
body[data-theme-anim], body[data-theme-anim] * {
  transition-property: background-color, border-color, color;
  transition-duration: .25s; transition-timing-function: ease;
}

/* ---------- base ---------- */
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--page-bg); color: var(--text1);
  font-family: "Instrument Sans",-apple-system,"Segoe UI",Helvetica,Arial,sans-serif;
  font-size: 14px; line-height: 1.5; -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { color: #5cd6c2; text-decoration: underline; }
input::placeholder { color: var(--text3); }
* { scrollbar-color: var(--border-strong) transparent; scrollbar-width: thin; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 8px; }
::-webkit-scrollbar-track { background: transparent; }
button {
  font-family: inherit;
  transition: background .15s ease, border-color .15s ease, color .15s ease,
              box-shadow .15s ease, transform .1s ease;
}
button:active { transform: scale(.98); }
input, select { transition: border-color .15s ease, box-shadow .15s ease, background .15s ease; }
.mono { font-family: ui-monospace, Menlo, Consolas, monospace; }

/* ---------- motion (transform-only frames; JS clears data-anim on end) ---------- */
[data-anim="view"]    { animation: fadeUp .28s ease both; }
[data-anim="overlay"] { animation: fadeIn .2s ease both; }
[data-anim="drawer"]  { animation: slideInRight .26s cubic-bezier(.2,.8,.25,1) both; }
[data-anim="pop"]     { animation: popIn .24s cubic-bezier(.2,.8,.25,1) both; }
[data-anim="done"]    { animation: none; }
@keyframes fadeUp { from { transform: translateY(8px); } to { transform: translateY(0); } }
@keyframes fadeIn { from { opacity: .35; } to { opacity: 1; } }
@keyframes slideInRight { from { transform: translateX(32px); } to { transform: translateX(0); } }
@keyframes popIn { from { transform: scale(.97) translateY(6px); } to { transform: scale(1) translateY(0); } }
@keyframes spin { to { transform: rotate(360deg); } }
.spin { animation: spin 1s linear infinite; }

/* ---------- app shell ---------- */
.app { display: flex; min-height: 100vh; background: var(--page-bg); }
.sidebar {
  width: 240px; flex-shrink: 0; background: var(--sidebar-bg);
  border-right: 1px solid var(--border); backdrop-filter: blur(10px);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 22px 20px; }
.logo {
  width: 36px; height: 36px; border-radius: 11px;
  background: linear-gradient(135deg,#46cfb8,#2ba190);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; color: #0e2521; font-size: 18px;
  box-shadow: 0 4px 14px rgba(62,195,174,.28), inset 0 1px 0 rgba(255,255,255,.35);
}
.brand-text { font-weight: 650; font-size: 15px; letter-spacing: -0.01em; }
.brand-sub { font-size: 11px; color: var(--text3); margin-top: 1px; }
.nav { padding: 10px 12px; flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 3px; }
.nav-item {
  display: flex; align-items: center; gap: 11px; width: 100%; padding: 10px 12px;
  border: none; border-radius: 9px; font-size: 13.5px; text-align: left; cursor: pointer;
  background: transparent; color: var(--text2); font-weight: 500;
}
.nav-item:hover { color: var(--text1); background: var(--surface2); }
.nav-item.active { background: var(--accent-soft); color: var(--accent); font-weight: 650; }
.nav-item .ico { width: 17px; height: 17px; flex-shrink: 0; }
.nav-item .grow { flex: 1; }
.nav-badge {
  font-size: 10.5px; font-weight: 700; background: rgba(62,195,174,.16);
  color: var(--accent); padding: 1px 8px; border-radius: 10px;
}
.sidebar-user {
  margin: 12px; padding: 12px; border-radius: 12px; background: var(--surface2);
  display: flex; align-items: center; gap: 10px;
}
.su-avatar {
  width: 34px; height: 34px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg,#46cfb8,#2ba190); color: #0e2521;
  font-size: 12.5px; font-weight: 700; box-shadow: inset 0 1px 0 rgba(255,255,255,.3);
}
.su-info { flex: 1; min-width: 0; }
.su-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.su-role { font-size: 10.5px; color: var(--text3); }
.icon-btn {
  background: none; border: none; color: var(--text3); cursor: pointer;
  padding: 7px; border-radius: 8px; flex-shrink: 0; display: flex; align-items: center;
}
.icon-btn:hover { color: var(--text1); background: var(--surface2); }
.icon-btn.danger:hover { color: var(--bad); background: var(--bad-soft); }

/* ---------- content ---------- */
.main { flex: 1; min-width: 0; }
.view { display: none; }
.view.active { display: block; }
/* Centered: the 1180px cap keeps line lengths readable; margin:auto splits the
   spare width into both gutters instead of one lopsided right void on wide
   screens (the prototype was authored at 1440px where it isn't noticeable). */
.content { padding: 32px 40px 80px; max-width: 1180px; margin: 0 auto; }
h1.page-title {
  margin: 0; font-size: 26px; font-weight: var(--display-weight);
  letter-spacing: -0.01em; font-family: var(--font-display);
}
h1.page-title.greet { font-size: 28px; }
.page-sub { font-size: 13.5px; color: var(--text2); margin-top: 5px; }
.page-sub strong { color: var(--text1); font-weight: 600; }
.page-head { margin-bottom: 24px; }
.micro-label {
  font-size: 11px; font-weight: 600; letter-spacing: .07em;
  text-transform: uppercase; color: var(--text3);
}
.title-count { font-size: 13px; font-weight: 600; color: var(--text3); letter-spacing: 0; vertical-align: 3px; margin-left: 4px; font-family: "Instrument Sans",-apple-system,sans-serif; }

/* ---------- panels ---------- */
.panel {
  background: var(--panel-bg); border: 1px solid var(--panel-border);
  box-shadow: var(--panel-shadow); border-radius: 16px; overflow: hidden;
}

/* date scope bar (Calls view) */
.date-bar { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 16px; }
.date-seg button { padding: 0 13px; }
.date-inputs { display: flex; align-items: center; gap: 8px; }
.date-input {
  height: 32px; padding: 0 10px; border-radius: 9px; border: 1px solid var(--border);
  background: var(--input-bg); color: var(--text1); font-family: inherit; font-size: 12.5px;
  color-scheme: light dark;
}
.date-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(62,195,174,.14); }
.date-label { font-size: 12px; color: var(--text3); font-variant-numeric: tabular-nums; }

/* stat strip */
.stat-strip { display: flex; align-items: stretch; margin-bottom: 24px; }
.stat-cell { flex: 1; padding: 16px 24px; border-right: 1px solid var(--border); }
.stat-cell:last-child { border-right: none; }
.stat-cell.clickable { cursor: pointer; transition: background .15s ease, box-shadow .15s ease; }
.stat-cell.clickable:hover { background: var(--surface2); }
.stat-cell.active { background: var(--accent-soft); box-shadow: inset 0 -2px 0 var(--accent); }
.stat-label { display: flex; align-items: center; gap: 8px; }
.stat-dot { width: 7px; height: 7px; border-radius: 50%; }
.stat-num-row { display: flex; align-items: baseline; gap: 9px; margin-top: 8px; }
.stat-num {
  font-size: 30px; font-weight: 600; letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums; font-family: var(--font-display);
}
.stat-hint { font-size: 11.5px; color: var(--text3); }

/* chips + search */
.filter-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; margin-bottom: 16px; flex-wrap: wrap;
}
.chip-row { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  height: 32px; padding: 0 14px; border-radius: 16px; font-size: 12.5px;
  font-weight: 600; cursor: pointer; border: 1px solid var(--border);
  background: transparent; color: var(--text2);
}
.chip:hover { color: var(--text1); background: var(--surface2); }
.chip.active { background: var(--accent-soft); color: var(--accent); border-color: var(--accent-soft-border); }
.search-pill {
  display: flex; align-items: center; gap: 9px; height: 36px; padding: 0 14px;
  border-radius: 18px; border: 1px solid var(--border); background: var(--input-bg);
  width: 240px;
}
.search-pill svg { flex-shrink: 0; }
.search-pill input {
  flex: 1; min-width: 0; background: none; border: none; outline: none;
  color: var(--text1); font-family: inherit; font-size: 13px;
}

/* segmented control */
.seg {
  display: inline-flex; background: var(--surface2); border: 1px solid var(--border);
  border-radius: 18px; padding: 3px; gap: 2px;
}
.seg button {
  height: 30px; padding: 0 16px; border-radius: 15px; border: none; font-size: 12.5px;
  font-weight: 600; cursor: pointer; background: transparent; color: var(--text2);
}
.seg button.active { background: var(--panel-bg); color: var(--text1); box-shadow: 0 1px 4px rgba(0,0,0,.18); }

/* ---------- call cards ---------- */
.call-list { display: flex; flex-direction: column; gap: 10px; }
.call-card {
  display: flex; align-items: center; gap: 16px; padding: 16px 20px;
  background: var(--panel-bg); border: 1px solid var(--border);
  box-shadow: var(--row-shadow); border-radius: 14px; cursor: pointer;
  transition: border-color .15s ease, background .15s ease, box-shadow .15s ease, transform .15s ease;
}
.call-card:hover { background: var(--surface2); border-color: var(--border-strong); transform: translateY(-1px); }
.avatar {
  border-radius: 50%; flex-shrink: 0; display: flex; align-items: center;
  justify-content: center; font-weight: 700; color: #fff;
}
.avatar.unmapped { background: var(--surface2); color: var(--text3); }
.call-card .avatar { width: 40px; height: 40px; font-size: 13px; }
.cc-rep { width: 170px; flex-shrink: 0; }
.cc-rep-name { font-size: 13.5px; font-weight: 600; }
.cc-rep-name.unmapped { color: var(--text3); }
.cc-phone { font-size: 12px; color: var(--text2); font-variant-numeric: tabular-nums; margin-top: 1px; }
.dir-word { color: var(--text3); font-weight: 650; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; margin-right: 2px; }
.cc-state { width: 160px; flex-shrink: 0; }
.state-tag { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 600; }
.state-tag .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; opacity: .85; }
.st-ok { color: var(--ok); } .st-info { color: var(--info); }
.st-warn { color: var(--warn); } .st-bad { color: var(--bad); }
.cc-snippet {
  flex: 1; min-width: 0; font-size: 12.5px; color: var(--text2); line-height: 1.5;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cc-snippet.status { font-style: italic; }
.cc-dur { width: 64px; flex-shrink: 0; text-align: right; font-size: 12.5px; color: var(--text2); font-variant-numeric: tabular-nums; }
.cc-time { width: 82px; flex-shrink: 0; text-align: right; font-size: 12px; color: var(--text3); }
.empty-msg { padding: 48px 0; text-align: center; color: var(--text2); font-size: 13.5px; }

/* pill badges */
.pill {
  display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 12px;
  border-radius: 13px; font-size: 11.5px; font-weight: 600;
}
.pill .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill-ok { background: var(--ok-soft); color: var(--ok); }
.pill-info { background: var(--info-soft); color: var(--info); }
.pill-warn { background: var(--warn-soft); color: var(--warn); }
.pill-bad { background: var(--bad-soft); color: var(--bad); }
.pill-accent { background: var(--accent-soft); color: var(--accent); }
.pill-neutral { background: var(--surface2); color: var(--text2); }
.pill-muted { background: var(--surface2); color: var(--text3); }

/* buttons */
.btn-secondary {
  height: 36px; padding: 0 16px; border-radius: 18px; border: 1px solid var(--border);
  background: transparent; color: var(--text2); font-size: 12.5px; font-weight: 600; cursor: pointer;
  display: inline-flex; align-items: center; gap: 7px;
}
.btn-secondary:hover { color: var(--text1); background: var(--surface2); }
.btn-secondary.sm { height: 32px; padding: 0 16px; font-size: 12px; }
.btn-secondary.danger { color: var(--bad); }
.btn-secondary.danger:hover { background: var(--bad-soft); border-color: var(--bad); color: var(--bad); }
.btn-primary {
  border: none; background: linear-gradient(180deg,#4ed0bb,#33b39f); color: #0c211d;
  box-shadow: 0 3px 12px -3px rgba(62,195,174,.45), inset 0 1px 0 rgba(255,255,255,.3);
  font-weight: 650; cursor: pointer; display: inline-flex; align-items: center; gap: 8px;
  height: 38px; padding: 0 18px; border-radius: 19px; font-size: 13px;
}
.btn-primary:hover { background: #5cd6c2; }
.btn-primary.sm { height: 36px; padding: 0 18px; border-radius: 18px; font-size: 12.5px; }
.btn-accent-outline {
  height: 36px; padding: 0 18px; border-radius: 18px; border: 1px solid var(--accent);
  background: var(--accent-soft); color: var(--accent); font-size: 12.5px; font-weight: 650; cursor: pointer;
}
.btn-accent-outline:hover { background: rgba(62,195,174,.22); }
.trash-btn {
  width: 32px; height: 32px; border-radius: 16px; border: 1px solid var(--border);
  background: transparent; color: var(--bad); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
}
.trash-btn:hover { background: var(--bad-soft); border-color: var(--bad); }

/* ---------- drawer ---------- */
.overlay {
  position: fixed; inset: 0; z-index: 100; background: var(--overlay);
  backdrop-filter: blur(3px); display: none;
}
.overlay.open { display: block; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 101; width: 560px; max-width: 92vw;
  background: var(--panel-bg); border-left: 1px solid var(--panel-border);
  display: none; flex-direction: column; box-shadow: -24px 0 70px rgba(0,0,0,.45);
}
.drawer.open { display: flex; }
.drawer-head { padding: 24px 26px 20px; border-bottom: 1px solid var(--border); }
.drawer-id-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.drawer-id { display: flex; align-items: center; gap: 13px; }
.drawer-id .avatar { width: 42px; height: 42px; font-size: 13.5px; }
.drawer-name { font-size: 16px; font-weight: 650; letter-spacing: -0.01em; }
.drawer-meta { font-size: 12.5px; color: var(--text2); font-variant-numeric: tabular-nums; margin-top: 1px; }
.drawer-close {
  background: none; border: none; color: var(--text3); cursor: pointer;
  font-size: 22px; line-height: 1; padding: 2px 8px; border-radius: 8px;
}
.drawer-close:hover { color: var(--text1); background: var(--surface2); }
.drawer-pills { display: flex; gap: 8px; margin-top: 16px; flex-wrap: wrap; }
.drawer-audio {
  display: flex; align-items: center; gap: 12px; background: var(--input-bg);
  border: 1px solid var(--border); border-radius: 24px; padding: 6px 16px 6px 6px; margin-top: 16px;
}
.audio-play {
  width: 34px; height: 34px; border-radius: 50%; flex-shrink: 0; border: none;
  background: linear-gradient(180deg,#4ed0bb,#33b39f); color: #0c211d;
  box-shadow: 0 3px 12px -3px rgba(62,195,174,.45), inset 0 1px 0 rgba(255,255,255,.3);
  cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.audio-play:hover { background: #5cd6c2; }
.audio-mid { flex: 1; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
/* The visible bar stays 4px, but the grabbable area is padded out to ~16px via
   the ::before overlay — a 4px pointer target is unusable, especially on touch.
   touch-action:none is required or the browser steals the drag for scrolling. */
.audio-track {
  position: relative; height: 4px; border-radius: 2px; background: var(--border);
  cursor: pointer; touch-action: none; outline: none;
}
.audio-track::before {
  content: ""; position: absolute; left: 0; right: 0; top: -8px; bottom: -8px;
}
.audio-fill { position: absolute; top: 0; bottom: 0; left: 0; border-radius: 2px; background: var(--accent); width: 0%; }
.audio-thumb {
  position: absolute; top: 50%; left: 0; width: 12px; height: 12px; border-radius: 50%;
  background: var(--accent); border: 2px solid var(--input-bg);
  transform: translate(-50%, -50%); pointer-events: none;
  box-shadow: 0 1px 4px rgba(0,0,0,.35);
  opacity: 0; transition: opacity .12s ease, width .12s ease, height .12s ease;
}
/* Reveal the handle on hover/focus/drag; a permanently visible dot is noisy on
   a row this small, but it must be discoverable and keyboard-reachable. */
.drawer-audio:hover .audio-thumb,
.audio-track:focus-visible .audio-thumb { opacity: 1; }
.audio-track:focus-visible { box-shadow: 0 0 0 2px var(--accent); border-radius: 2px; }
.drawer-audio:active .audio-thumb { opacity: 1; width: 14px; height: 14px; }
.audio-times { display: flex; justify-content: space-between; font-size: 10px; color: var(--text3); font-variant-numeric: tabular-nums; }
/* Rep -> Slack identity validation */
.validate-row { display: flex; gap: 8px; align-items: stretch; }
.validate-row .tin { flex: 1; min-width: 0; }
.validate-row .btn-secondary { flex-shrink: 0; height: auto; padding: 0 16px; font-size: 13px; border-radius: 10px; }
.slack-match {
  display: flex; align-items: center; gap: 10px; margin-top: 8px;
  padding: 10px 12px; border-radius: 10px; font-size: 13px;
  border: 1px solid var(--border); background: var(--input-bg);
}
.slack-match img { width: 32px; height: 32px; border-radius: 8px; flex-shrink: 0; }
.slack-match.ok { border-color: var(--accent); }
.slack-match.err { border-color: #d9534f; color: #e08b88; }
.sm-name { font-weight: 600; }
.sm-sub { font-size: 11px; color: var(--text3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sm-tick { font-size: 11px; color: var(--accent); font-weight: 600; flex-shrink: 0; }
.sm-hint { margin-top: 6px; font-size: 11px; color: var(--text3); }

.drawer-tabs { display: flex; gap: 2px; padding: 0 26px; border-bottom: 1px solid var(--border); }
.drawer-tab {
  background: none; border: none; font-size: 13px; font-weight: 600; padding: 12px 13px;
  margin-bottom: -1px; border-bottom: 2px solid transparent; color: var(--text2); cursor: pointer;
}
.drawer-tab.active { border-bottom-color: var(--accent); color: var(--text1); }
.drawer-body { flex: 1; overflow-y: auto; padding: 22px 26px; }
.drawer-foot {
  padding: 16px 26px; border-top: 1px solid var(--border);
  display: flex; justify-content: flex-end; gap: 10px;
}

/* drawer: summary tab — long real summaries need reading comfort: full-contrast
   text, larger sizes, and generous rhythm (the 12.5px muted prototype spec only
   worked for 3-line mock chapters). */
.sum-stack { display: flex; flex-direction: column; gap: 28px; }
.sum-recap { font-size: 14.5px; line-height: 1.7; color: var(--text1); margin-top: 10px; }
.sum-chapters { display: flex; flex-direction: column; gap: 18px; margin-top: 12px; }
.sum-chapter { border-left: 2px solid var(--accent-soft-border); padding-left: 15px; }
.sum-chapter-title { font-size: 14px; font-weight: 650; margin-bottom: 5px; }
.sum-chapter-body { font-size: 13.5px; line-height: 1.7; color: var(--text-soft); }
.sum-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.sum-action { display: flex; align-items: flex-start; gap: 11px; padding: 11px 13px; background: var(--surface2); border-radius: 11px; }
.act-ico {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; border-radius: 8px; flex-shrink: 0;
  background: var(--accent-soft); color: var(--accent);
}
.sum-action-text { font-size: 13px; font-weight: 600; line-height: 1.5; }
.sum-action-due { font-size: 11.5px; color: var(--text3); margin-top: 2px; }

/* sync chip */
.sync-chip {
  display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 11px;
  border-radius: 14px; border: 1px solid var(--border); background: transparent;
  color: var(--text2); font-size: 11.5px; font-weight: 600; cursor: pointer; flex-shrink: 0;
}
.sync-chip:hover { color: var(--accent); border-color: var(--accent); }
.sync-chip.synced { color: var(--accent); border-color: var(--accent-soft-border); background: var(--accent-soft); cursor: default; }

/* drawer: conversation tab */
.convo { display: flex; flex-direction: column; gap: 14px; }
.utt { display: flex; flex-direction: column; max-width: 85%; }
.utt.rep { align-self: flex-end; align-items: flex-end; }
.utt.cust { align-self: flex-start; align-items: flex-start; }
.utt-who { display: flex; align-items: center; gap: 7px; font-size: 11px; font-weight: 700; margin-bottom: 4px; }
.utt.rep .utt-who { color: var(--accent); }
.utt.cust .utt-who { color: var(--info); }
.utt-who .t { color: var(--text3); font-weight: 500; font-variant-numeric: tabular-nums; }
.utt-bubble { padding: 10px 14px; border-radius: 14px; font-size: 13px; line-height: 1.55; }
.utt.rep .utt-bubble { background: var(--accent-soft); border-top-right-radius: 4px; }
.utt.cust .utt-bubble { background: var(--surface2); border-top-left-radius: 4px; }
.drawer-empty { padding: 40px 20px; text-align: center; color: var(--text2); font-size: 13.5px; }
.drawer-empty .actions { margin-top: 14px; }

/* drawer: transcript tab */
.plain-transcript { line-height: 1.75; font-size: 13px; white-space: pre-wrap; color: var(--text-soft); }

/* ---------- action items view ---------- */
.act-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.act-controls { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; }
.unsynced-banner {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  padding: 12px 16px; margin-bottom: 20px; border-radius: 12px;
  border: 1px solid rgba(220,175,98,.35); background: rgba(220,175,98,.09); cursor: pointer;
}
.unsynced-banner:hover { background: rgba(220,175,98,.15); }
.unsynced-banner .msg { flex: 1; font-size: 12.5px; color: var(--text-soft); }
.unsynced-banner .msg strong { color: var(--warn); font-weight: 650; }
.unsynced-banner .cta { font-size: 12px; font-weight: 650; color: var(--warn); flex-shrink: 0; }
.act-groups { display: flex; flex-direction: column; gap: 24px; }
.act-group-label { margin-bottom: 10px; }
.act-row {
  display: flex; align-items: center; gap: 14px; padding: 14px 20px;
  border-bottom: 1px solid var(--border);
}
.act-row:last-child { border-bottom: none; }
.act-row.done { opacity: .55; }
.act-row.done .act-text { text-decoration: line-through; }
.act-check {
  width: 22px; height: 22px; border-radius: 50%; flex-shrink: 0;
  border: 1.5px solid var(--border-strong); background: transparent; color: #fff;
  cursor: pointer; display: inline-flex; align-items: center; justify-content: center; padding: 0;
}
.act-check:hover { border-color: var(--accent); }
.act-check.checked { border-color: var(--accent); background: var(--accent); }
.act-ico-lg {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; border-radius: 9px; flex-shrink: 0;
  background: var(--accent-soft); color: var(--accent);
}
.act-main { flex: 1; min-width: 0; }
.act-text { font-size: 13px; font-weight: 600; line-height: 1.45; }
.act-sub { font-size: 11.5px; color: var(--text3); margin-top: 2px; }
.act-due { flex-shrink: 0; font-size: 12px; font-weight: 600; color: var(--text3); }
.act-due.today { color: var(--warn); }
.act-btns { display: flex; gap: 8px; flex-shrink: 0; }

/* calendar */
.cal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 24px; }
.cal-title { display: flex; align-items: baseline; gap: 10px; }
.cal-month { font-size: 20px; font-weight: var(--display-weight); letter-spacing: -0.01em; font-family: var(--font-display); }
.cal-year { font-size: 13px; color: var(--text3); font-variant-numeric: tabular-nums; }
.cal-nav { display: flex; gap: 6px; }
.cal-nav button {
  width: 30px; height: 30px; border-radius: 15px; border: 1px solid var(--border);
  background: transparent; color: var(--text2); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
}
.cal-nav button:hover { color: var(--text1); background: var(--surface2); }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0,1fr)); border-top: 1px solid var(--border); }
.cal-dow {
  text-align: right; font-size: 10.5px; font-weight: 600; letter-spacing: .08em;
  text-transform: uppercase; color: var(--text3); padding: 10px 12px 8px;
  border-bottom: 1px solid var(--border);
}
.cal-cell {
  min-width: 0; min-height: 96px; border: none; border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border); border-radius: 0; background: transparent;
  cursor: default; padding: 9px 10px; display: flex; flex-direction: column;
  align-items: stretch; gap: 6px; position: relative; text-align: left;
}
.cal-cell.has-items { cursor: pointer; }
.cal-cell.has-items:hover { background: var(--surface2); }
.cal-cell.selected { background: var(--accent-soft); box-shadow: inset 0 0 0 1.5px var(--accent); }
.cal-cell.selected:hover { background: var(--accent-soft); }
.cal-num {
  align-self: flex-end; font-size: 12px; font-weight: 500; font-variant-numeric: tabular-nums;
  color: var(--text3); min-width: 22px; height: 22px; padding: 0 3px; border-radius: 11px;
  display: inline-flex; align-items: center; justify-content: center;
}
.cal-cell.has-items .cal-num { color: var(--text1); font-weight: 650; }
.cal-num.today { background: var(--accent); color: #fff; font-weight: 650; }
.cal-event {
  display: block; min-width: 0; font-size: 10.5px; font-weight: 600; color: var(--text-soft);
  background: var(--surface2); border-left: 2px solid var(--accent); padding: 3px 7px;
  border-radius: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cal-more { font-size: 10px; font-weight: 600; color: var(--text3); padding-left: 2px; }
.cal-day-label { margin: 24px 0 10px; }

/* ---------- team / users rows ---------- */
.person-row {
  display: flex; align-items: center; gap: 12px 16px; padding: 16px 24px;
  border-bottom: 1px solid var(--border); flex-wrap: wrap;
}
.person-row:last-child { border-bottom: none; }
.person-row .avatar { width: 38px; height: 38px; font-size: 12.5px; }
.pr-name-col { width: 180px; flex-shrink: 0; }
.pr-name { font-size: 13.5px; font-weight: 600; }
.pr-caption { font-size: 11.5px; color: var(--text3); margin-top: 1px; }
.pr-cid {
  width: 230px; flex-shrink: 0; font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 11.5px; color: var(--text2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.pr-spacer { flex: 1; }
.user-row .avatar { width: 36px; height: 36px; font-size: 12px; }
.ur-name-col { width: 200px; flex-shrink: 0; }
.ur-you { color: var(--text3); font-weight: 450; }

/* inline create bar (users) */
.create-bar {
  display: flex; align-items: flex-end; gap: 12px; padding: 20px 22px;
  margin-bottom: 24px; flex-wrap: wrap;
}
.field-col { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field-col label { font-size: 12px; font-weight: 600; color: var(--text2); }
.field-col.grow { flex: 1; min-width: 180px; }
.tin {
  height: 40px; padding: 0 13px; background: var(--input-bg); border: 1px solid var(--border);
  border-radius: 10px; color: var(--text1); font-family: inherit; font-size: 13px; width: 100%;
}
.tin:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(62,195,174,.14); }
.tin.mono { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12px; color: var(--text2); }
select.tin { cursor: pointer; }
.create-caption { width: 100%; font-size: 11.5px; color: var(--text3); }

/* ---------- centered modal ---------- */
.modal-wrap {
  position: fixed; inset: 0; z-index: 110; display: none; align-items: center;
  justify-content: center; background: var(--overlay); backdrop-filter: blur(4px); padding: 24px;
}
.modal-wrap.open { display: flex; }
.modal-card {
  width: 100%; max-width: 480px; background: var(--panel-bg);
  border: 1px solid var(--panel-border); border-radius: 18px;
  box-shadow: var(--modal-shadow); overflow: hidden;
}
.modal-title-row { display: flex; align-items: center; justify-content: space-between; padding: 22px 26px 0; }
.modal-title-row h3 { margin: 0; font-size: 16px; font-weight: 650; letter-spacing: -0.01em; }
.modal-helper { padding: 6px 26px 0; color: var(--text2); font-size: 12.5px; }
.modal-fields { display: flex; flex-direction: column; gap: 14px; padding: 20px 26px; }
.modal-foot-row {
  display: flex; justify-content: flex-end; gap: 10px;
  padding: 16px 26px 22px; border-top: 1px solid var(--border);
}
.cred-box { background: var(--surface2); border-radius: 11px; padding: 14px 16px; display: flex; flex-direction: column; gap: 8px; }
.cred-row { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; }
.cred-row .k { color: var(--text2); }
.cred-row .v { font-family: ui-monospace, Menlo, Consolas, monospace; font-weight: 600; }
.cred-note { font-size: 11.5px; color: var(--text3); margin-top: 10px; }

/* ---------- login ---------- */
.login-wrap { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 24px; background: var(--page-bg); }
.login-col { width: 100%; max-width: 400px; }
.login-brand { display: flex; flex-direction: column; align-items: center; gap: 14px; margin-bottom: 28px; }
.login-logo {
  width: 52px; height: 52px; border-radius: 15px; background: linear-gradient(135deg,#46cfb8,#2ba190);
  display: flex; align-items: center; justify-content: center; font-weight: 700; color: #0e2521;
  font-size: 26px; box-shadow: 0 8px 24px rgba(62,195,174,.3), inset 0 1px 0 rgba(255,255,255,.35);
}
.login-title { font-weight: var(--display-weight); font-size: 22px; letter-spacing: -0.01em; font-family: var(--font-display); text-align: center; }
.login-sub { font-size: 13px; color: var(--text2); margin-top: 3px; text-align: center; }
.login-card {
  background: var(--panel-bg); border: 1px solid var(--panel-border); border-radius: 18px;
  padding: 28px; box-shadow: var(--panel-shadow);
}
.login-field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.login-field label { font-size: 12px; font-weight: 600; color: var(--text2); }
.login-field input {
  height: 42px; padding: 0 14px; background: var(--input-bg); border: 1px solid var(--border);
  border-radius: 11px; color: var(--text1); font-family: inherit; font-size: 13.5px; width: 100%;
}
.login-field input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(62,195,174,.14); }
.login-btn { width: 100%; height: 44px; border-radius: 22px; font-size: 14px; justify-content: center; }
.login-note { text-align: center; margin-top: 20px; font-size: 12px; color: var(--text3); }
.login-error { color: var(--bad); font-size: 12.5px; margin-bottom: 12px; display: none; }

/* ============================================================
   Mobile (≤820px): sidebar becomes a bottom tab bar; layouts
   trade columns for stacked, thumb-reachable arrangements.
   ============================================================ */
.mobile-top { display: none; }
.bottom-nav { display: none; }

/* agenda (mobile calendar) */
.agenda { border-top: 1px solid var(--border); }
.agenda-day { display: flex; gap: 14px; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.agenda-day:last-child { border-bottom: none; }
.agenda-date { width: 44px; flex-shrink: 0; text-align: center; }
.agenda-num {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; border-radius: 15px; font-size: 14px; font-weight: 650;
  font-variant-numeric: tabular-nums;
}
.agenda-day.today .agenda-num { background: var(--accent); color: #fff; }
.agenda-dow { display: block; font-size: 10px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--text3); margin-top: 2px; }
.agenda-items { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.agenda-item {
  display: flex; align-items: center; gap: 9px; width: 100%; text-align: left;
  background: var(--surface2); border: none; border-radius: 9px; padding: 9px 11px;
  font-size: 12.5px; font-weight: 600; color: var(--text-soft); cursor: pointer;
}
.agenda-item:hover { color: var(--text1); }
.agenda-rep { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.agenda-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

@media (max-width: 820px) {
  .sidebar { display: none; }

  .mobile-top {
    display: flex; align-items: center; justify-content: space-between;
    position: sticky; top: 0; z-index: 90; padding: 10px 16px;
    background: var(--sidebar-bg); backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
  }

  .bottom-nav {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 95;
    background: var(--sidebar-bg); backdrop-filter: blur(10px);
    border-top: 1px solid var(--border);
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
  }
  .bn-tab {
    position: relative; flex: 1; min-height: 48px; border: none; background: none;
    border-radius: 12px; display: flex; flex-direction: column; align-items: center;
    justify-content: center; gap: 3px; cursor: pointer; color: var(--text3);
  }
  .bn-tab svg { width: 20px; height: 20px; }
  .bn-tab span:not(.bn-badge) { font-size: 10px; font-weight: 600; letter-spacing: .02em; }
  .bn-tab.active { color: var(--accent); }
  .bn-badge {
    position: absolute; top: 3px; right: calc(50% - 22px);
    font-size: 9.5px; font-weight: 700; background: var(--accent); color: #fff;
    min-width: 15px; height: 15px; padding: 0 4px; border-radius: 8px;
    display: inline-flex; align-items: center; justify-content: center;
  }

  .content { padding: 18px 14px calc(84px + env(safe-area-inset-bottom)); }
  h1.page-title { font-size: 21px; }
  h1.page-title.greet { font-size: 22px; }
  .page-head { margin-bottom: 18px; }

  /* stat strip -> one slim row of five (short labels, no hints; JS renders
     compact variants). Five numbers shouldn't cost a third of the screen. */
  .stat-strip { flex-wrap: nowrap; }
  .stat-cell {
    flex: 1 1 0; min-width: 0; padding: 9px 4px 10px;
    border-bottom: none; text-align: center;
  }
  .stat-cell:last-child { border-right: none; }
  .stat-label { justify-content: center; gap: 5px; font-size: 9.5px; letter-spacing: .04em; white-space: nowrap; }
  .stat-dot { width: 6px; height: 6px; }
  .stat-num-row { justify-content: center; margin-top: 3px; }
  .stat-num { font-size: 19px; }

  /* date presets: the joined pill clips mid-button when it overflows a phone
     width — become discrete wrapping chips instead */
  .date-bar { gap: 8px; margin-bottom: 14px; }
  .date-seg {
    background: none; border: none; padding: 0; gap: 6px;
    flex-wrap: wrap; display: flex;
  }
  .date-seg button {
    height: 30px; padding: 0 12px; border-radius: 15px;
    border: 1px solid var(--border); background: transparent; color: var(--text2);
  }
  .date-seg button.active {
    background: var(--accent-soft); color: var(--accent);
    border-color: var(--accent-soft-border); box-shadow: none;
  }
  .date-label { flex-basis: 100%; font-size: 11.5px; }
  .date-inputs { flex-basis: 100%; }
  .date-input { flex: 1; }

  /* tighter vertical rhythm before the first call card */
  .content { padding-top: 14px; }
  h1.page-title.greet { font-size: 20px; }
  .page-head { margin-bottom: 14px; }
  .stat-cell { padding: 11px 14px; }
  .stat-num { font-size: 22px; }
  .stat-strip { margin-bottom: 16px; }
  .filter-row { gap: 8px; margin-bottom: 12px; }
  .search-pill { height: 34px; }
  .state-tag { font-size: 11px; }

  /* chips scroll horizontally, app-style; search takes its own row */
  .filter-row { gap: 10px; }
  .chip-row {
    flex-wrap: nowrap; overflow-x: auto; width: 100%; padding-bottom: 2px;
    -webkit-overflow-scrolling: touch; scrollbar-width: none;
  }
  .chip-row::-webkit-scrollbar { display: none; }
  .chip { flex-shrink: 0; }
  .search-pill { width: 100%; }

  /* call cards -> two-line layout */
  .call-card { flex-wrap: wrap; gap: 10px 12px; padding: 13px 14px; }
  .call-card .avatar { width: 36px; height: 36px; font-size: 12px; }
  .cc-rep { flex: 1; width: auto; min-width: 0; }
  .cc-state { width: auto; margin-left: auto; }
  .cc-snippet { flex: 1 1 100%; order: 5; white-space: normal;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
  .cc-dur, .cc-time { width: auto; order: 6; }
  .cc-time { margin-left: auto; }
  .call-card > svg { display: none; }

  /* action rows wrap; chips drop to their own line */
  .act-row { flex-wrap: wrap; gap: 10px 12px; padding: 13px 14px; }
  .act-main { flex: 1 1 55%; }
  .act-due { order: 5; }
  .act-btns { order: 6; flex: 1 1 100%; justify-content: flex-end; }

  /* team / user rows: caller id gets its own full line */
  .person-row { padding: 14px 16px; }
  .pr-cid { width: 100%; order: 5; }
  .pr-name-col { flex: 1; width: auto; }

  /* drawer -> full screen sheet */
  .drawer { width: 100vw; max-width: 100vw; border-left: none; }
  .drawer-head { padding: 18px 16px 16px; }
  .drawer-tabs { padding: 0 16px; }
  .drawer-body { padding: 18px 16px; }
  .drawer-foot { padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); }

  /* modals breathe on small screens */
  .modal-wrap { padding: 14px; align-items: flex-end; }
  .modal-card { max-width: 100%; }
  .create-bar { padding: 16px; }

  /* login */
  .login-card { padding: 22px 18px; }
}
