:root {
  color-scheme: light;
  --bg:#dbe5ef; --panel:#fff; --ink:#102b47; --ink2:#304d68; --muted:#4d657d;
  --line:#aabed3; --line2:#d3deea; --brand:#105bb8; --brand-soft:#e4eefc;
  --grey-soft:#edf3f9; --cc-layer:#edf3f9; --cc-inset:#f2f7fd;
  --cc-header:#102940; --cc-header-control:#173550; --cc-header-ink:#f4f8ff;
  --cc-accent:#00b6d2; --cc-on-brand:#fff;
  --cc-preview:#ffe8d5; --cc-preview-ink:#862d08; --cc-preview-line:#e76126;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg:#090f17; --panel:#131f2f; --ink:#e6eef9; --ink2:#c7d6e7; --muted:#a7bdd3;
  --line:#426387; --line2:#2c445e; --brand:#85baff; --brand-soft:#1d3857;
  --client:#7ee3d7; --client-soft:#123a3a; --grey-soft:#1a2a3e;
  --red:#ffabb9; --red-soft:#492636; --amber:#ffd18c; --amber-soft:#443418;
  --green:#79e1ca; --green-soft:#16433d; --blue:#9bcaff; --blue-soft:#213a59;
  --cc-layer:#192a3e; --cc-inset:#101b29; --cc-header:#0d1726;
  --cc-header-control:#173550; --cc-on-brand:#0d2137;
  --cc-preview:#48290f; --cc-preview-ink:#ffca9b; --cc-preview-line:#d78850;
}
.btn.primary { color:var(--cc-on-brand) }
.drawer .note { background:var(--cc-inset) }
.drawer .msg.answer { border-color:var(--line) }
.cc-top {
  min-height:52px; padding:8px 16px; background:var(--cc-header); color:var(--cc-header-ink);
  border-bottom:2px solid var(--cc-accent);
}
.cc-top .client-pill,.cc-theme {
  padding:5px 9px; border:1px solid #42617d; border-radius:4px;
  background:var(--cc-header-control); color:var(--cc-header-ink);
}
:root[data-theme="dark"] .cc-theme { border-color:var(--cc-accent) }
.cc-top-label { font-weight:650; padding:4px 8px }
.cc-top .menu { color:var(--ink) }
.cc-preview {
  position:static; display:flex; align-items:center; gap:8px 12px; flex-wrap:wrap;
  padding:7px 16px; text-align:left; background:var(--cc-preview); color:var(--cc-preview-ink);
  border-bottom:1px solid var(--cc-preview-line); font-weight:400;
}
.cc-preview a { margin-left:auto; text-decoration:none; color:var(--ink) }
.cc-wrap { padding:12px 16px 32px; max-width:1680px; margin:auto }
.cc-heading { display:flex; align-items:center; justify-content:space-between; gap:10px; margin-bottom:10px }
.cc-heading > div { display:flex; flex-wrap:wrap; align-items:baseline; gap:4px 12px }
.cc-heading h1 { font-size:23px; letter-spacing:-.025em; margin:0 }
.cc-sub,.cc-shown { color:var(--muted); font-size:12px }
#cc-status:not(:empty) { margin:0 0 8px; color:var(--ink2) }
.cc-board { border:1px solid var(--line); border-radius:6px; background:var(--panel); box-shadow:var(--shadow) }
.cc-tabs,.cc-stages,.cc-groups,.cc-quick,.cc-tools { display:flex; align-items:center; gap:6px }
.cc-tabs,.cc-stages { border-bottom:1px solid var(--line); padding:0 6px }
.cc-stages { flex-wrap:wrap; background:var(--cc-layer) }
.cc-tabs button,.cc-stages button,.cc-quick button,.cc-groups button {
  white-space:nowrap; border:1px solid transparent; border-radius:4px 4px 0 0;
  color:var(--ink2); background:transparent; padding:7px 9px; font-size:13px;
}
.cc-tabs button[aria-pressed="true"],.cc-stages button[aria-pressed="true"] {
  color:var(--ink); background:var(--brand-soft); box-shadow:inset 0 -2px var(--cc-accent); font-weight:700;
}
.cc-count {
  display:inline-block; margin-left:5px; padding:0 5px; border-radius:3px;
  font:600 11px/1.4 ui-monospace,monospace; color:var(--ink); background:var(--brand-soft);
}
.cc-tabs button[aria-pressed="true"] .cc-count,.cc-groups button[aria-pressed="true"] .cc-count,
.cc-quick button[aria-pressed="true"] .cc-count,.cc-stages button[aria-pressed="true"] .cc-count {
  background:var(--brand); color:var(--cc-on-brand);
}
.cc-quick,.cc-tools { flex-wrap:wrap; padding:8px 12px; background:var(--cc-layer); border-bottom:1px solid var(--line2) }
.cc-quick button,.cc-groups button {
  padding:4px 8px; border-color:var(--line); background:var(--panel); color:var(--ink);
}
.cc-groups { gap:0; flex-wrap:wrap }
.cc-groups button { border-radius:4px; margin-right:2px }
.cc-quick button { border-radius:20px }
.cc-quick button[aria-pressed="true"],.cc-groups button[aria-pressed="true"] {
  background:var(--brand-soft); border-color:var(--brand); font-weight:650;
}
.cc-tools input[type="search"],.cc-filter summary,.cc-phone-sort select {
  min-height:30px; padding:4px 8px; border:1px solid var(--line);
  border-radius:4px; font-size:13px; background:var(--panel);
}
.cc-tools input[type="search"] { width:220px; max-width:100% }
.cc-filter { position:relative; min-width:0 }
.cc-filter summary { cursor:pointer; list-style:none; white-space:nowrap }
.cc-filter summary::-webkit-details-marker { display:none }
.cc-filter summary::after { content:" ▾"; color:var(--muted) }
.cc-filter[open] summary::after { content:" ▴" }
.cc-filter-menu {
  position:absolute; z-index:10; top:calc(100% + 4px); left:0;
  width:max-content; min-width:180px; max-width:calc(100vw - 38px); max-height:240px;
  overflow:auto; overscroll-behavior:contain; padding:8px; border:1px solid var(--line);
  background:var(--panel); border-radius:5px; box-shadow:0 6px 16px #0003;
}
.cc-filter-menu label,.cc-filter-tools { display:flex; align-items:center; gap:8px; padding:4px }
.cc-filter-menu input { accent-color:var(--brand); flex:none }
.cc-filter-tools { justify-content:space-between; border-bottom:1px solid var(--line2); margin-bottom:4px }
.cc-phone-sort,.cc-mobile-label { display:none }
.cc-table { table-layout:fixed; font-size:13px }
.cc-table th { position:static; white-space:normal; background:var(--panel); border-bottom-color:var(--line) }
.cc-table th button,.cc-mobile-label {
  font:650 10px/1.3 ui-monospace,monospace; text-transform:uppercase; letter-spacing:.06em;
}
.cc-table th[aria-sort="ascending"] button,.cc-table th[aria-sort="descending"] button {
  color:var(--ink); box-shadow:inset 0 -2px var(--cc-accent);
}
.cc-table td { padding:8px 10px; min-width:0; overflow-wrap:anywhere }
.cc-table tbody tr { cursor:default }
.cc-table .cc-row:hover,.cc-table .cc-selected { background:var(--brand-soft) }
.cc-table .cc-selected { box-shadow:inset 3px 0 var(--cc-accent) }
.cc-todos th:first-child { width:31% }
.cc-todos th:nth-child(3) { width:16% }
.cc-todos th:nth-child(5) { width:10% }
.cc-todos th:nth-child(6) { width:13% }
.cc-todos th:last-child { width:15% }
.cc-offers th:first-child { width:19% }
.cc-offers th:nth-child(2) { width:17% }
.cc-offers th:nth-child(8),.cc-offers th:last-child { width:12% }
.cc-cell-list_price,.cc-cell-our_offer,.cc-cell-their_counter,.cc-cell-gap {
  font-variant-numeric:tabular-nums; text-align:right;
}
.cc-cell-actions { text-align:right }
.cc-cell-actions .btn { margin:0 0 3px 4px }
.cc-tag {
  display:inline-block; padding:1px 5px; border:1px solid var(--line); border-radius:3px;
  background:var(--cc-layer); font:600 11px/1.4 ui-monospace,monospace;
}
.cc-date { white-space:nowrap }
.cc-tag[data-tone="counter"],.cc-tag[data-tone="highest_best"] { color:var(--red); background:var(--red-soft); border-color:transparent }
.cc-tag[data-tone="signature"],.cc-tag[data-tone="ended"] { color:var(--amber); background:var(--amber-soft); border-color:transparent }
.cc-tag[data-tone="contract"],.cc-tag[data-tone="approved"] { color:var(--green); background:var(--green-soft); border-color:transparent }
.cc-what { color:var(--brand) }
.cc-sent { color:var(--green); font-weight:650 }
.cc-receipt { display:inline-flex; align-items:center; gap:6px }
.cc-cell-actions .cc-receipt .btn { flex:none; margin:0 }
.cc-table .cc-detail-row td { padding:0 }
.cc-detail { border-block:1px solid var(--cc-accent); background:var(--cc-inset) }
.cc-detail-main { display:grid; grid-template-columns:1fr 1fr; gap:12px; padding:12px }
.cc-detail-main > * { min-width:0 }
.cc-thread .sec { border:0; padding:0 }
.cc-thread .msgs { max-height:360px; overflow:auto }
.cc-detail-footer {
  display:flex; justify-content:space-between; gap:8px; padding:8px 12px;
  border-top:1px solid var(--line2); background:var(--cc-layer);
}
.cc-answer { padding:12px; border:1px solid var(--cc-accent); border-radius:5px; background:var(--panel) }
.cc-answer h3,.cc-answer p { margin:0 0 8px }
.cc-answer fieldset { border:0; margin:0; padding:0; min-inline-size:0 }
.cc-answer input { background:transparent }

@media (max-width:760px) {
  .cc-wrap { padding:10px }
  .cc-top { gap:6px; flex-wrap:wrap; padding:8px 10px }
  .cc-top-label { order:1; flex-basis:100%; border-top:1px solid #42617d; padding:6px 0 1px }
  .cc-preview a { margin-left:0 }
  .cc-heading h1 { font-size:21px }
  .cc-heading { align-items:flex-start }
  .cc-tools input[type="search"] { width:100% }
  .cc-groups { width:100%; display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:3px }
  .cc-groups button { white-space:normal; margin:0 }
  .cc-filter-menu { width:168px; min-width:0 }
  .cc-filter[data-axis="move"] .cc-filter-menu { left:auto; right:0 }
  .cc-phone-sort { display:inline-flex; align-items:center; gap:4px; font-size:12px }
  .cc-phone-sort select { max-width:172px }
  .cc-table,.cc-table tbody,.cc-table .cc-detail-row,.cc-table .cc-detail-row td { display:block }
  .cc-table thead { position:absolute; width:1px; height:1px; overflow:hidden; clip-path:inset(50%) }
  .cc-table thead button { visibility:hidden }
  .cc-table .cc-row { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:6px 8px; padding:10px 12px; border-bottom:1px solid var(--line2) }
  .cc-table .cc-row td { padding:0; border:0 }
  .cc-mobile-label { display:block; margin-bottom:2px; color:var(--muted); font-size:9px }
  .cc-cell-what .cc-mobile-label,.cc-cell-actions .cc-mobile-label,.cc-offers .cc-cell-home .cc-mobile-label { display:none }
  .cc-offers .cc-cell-home,.cc-offers .cc-cell-stage,.cc-cell-actions,.cc-todos .cc-cell-what { grid-column:1 / -1 }
  .cc-table .cc-cell-actions { text-align:left }
  .cc-cell-actions .btn { margin:0 4px 0 0 }
  .cc-offers .cc-cell-move,.cc-offers .cc-cell-reply_by,
  .cc-todos .cc-cell-home,.cc-todos .cc-cell-since,.cc-todos .cc-cell-due { grid-column:span 2 }
  .cc-offers .cc-cell-home .linkbtn { font-size:14px }
  .cc-detail-main { grid-template-columns:minmax(0,1fr) }
}
