@font-face { font-family: 'Space Mono'; font-style: normal; font-weight: 400; font-display: swap; src: url('/fonts/space-mono-400.woff2') format('woff2'); }
@font-face { font-family: 'Space Mono'; font-style: normal; font-weight: 700; font-display: swap; src: url('/fonts/space-mono-700.woff2') format('woff2'); }

/* Panel theme — layered ON TOP of Tabler (tabler.min.css). Tabler provides the
   reboot, typography (Inter), navbar + .page/.page-wrapper/.page-body shell and
   the colour tokens; this file restyles the app's existing component classes to
   match Tabler's palette so the server-rendered panels keep working unchanged.
   Loaded AFTER tabler.min.css, so these rules win where they overlap. */

:root {
  --navy: #1d273b;        /* headings */
  --accent: #066fd1;      /* Tabler primary */
  --accent-dark: #055cb0;
  --bg: #f6f8fb;
  --card: #ffffff;
  --line: #e6e7e9;        /* Tabler border */
  --text: #1d273b;
  --muted: #667382;
  --error: #d63939;
  --radius: 6px;
}

[hidden] { display: none !important; }

/* The Tabler page-body already pads; keep cards tidy inside it. */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.875rem 1rem;            /* compact, matches Tabler density */
  margin-top: 0.75rem;
  box-shadow: 0 1px 2px rgba(20, 34, 58, 0.04);
}
.card:first-child { margin-top: 0; }
/* Cards built with Tabler's real structure (card-header / card-table) provide
   their own internal spacing, so drop the wrapper padding to sit flush. */
.card:has(> .card-header),
.card:has(> .table-responsive),
.card:has(> .empty) { padding: 0; }
.card-header { padding: 0.625rem 1rem; }
.card-body { padding: 1rem; }
.card h2 { margin: 0 0 4px; color: var(--navy); font-size: 1.125rem; }
.card h3 { margin: 0 0 4px; color: var(--navy); font-size: 1rem; }
.card .card-title { color: var(--navy); }
.card.center { text-align: center; }
/* Denser table rows (Tabler default is roomier). */
.table.card-table th, .table.card-table td { padding-top: 0.45rem; padding-bottom: 0.45rem; }
.table thead th { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }

.muted { color: var(--muted); }
.lead { font-size: 17px; }
.error {
  background: #fdeceb; color: var(--error); border: 1px solid #f5c6c4;
  border-radius: var(--radius); padding: 10px 12px; margin: 12px 0;
}
.notice { background: #e9f7ef; color: #1f7a4d; border: 1px solid #b8e6cd; border-radius: var(--radius); padding: 8px 12px; }

/* Forms */
.quote-form { display: flex; flex-direction: column; gap: 14px; margin-top: 14px; }
.quote-form label { display: flex; flex-direction: column; gap: 5px; font-weight: 600; font-size: 14px; }
.quote-form .row { display: flex; gap: 14px; }
.quote-form .row label { flex: 1; }
/* Legacy hand-rolled two-up rows only — never clobber Bootstrap's grid
   (rows that contain col-* children, e.g. .row.row-cards / .row.g-2). */
.row:not(:has(> [class*="col-"])):not(:has(> .col)) { display: flex; gap: 14px; flex-wrap: wrap; }
.quote-form input, .quote-form select, .quote-form textarea {
  font: inherit; padding: 9px 12px; border: 1px solid var(--line);
  border-radius: var(--radius); background: #fff; font-weight: 400; color: var(--text);
}
.quote-form input:focus, .quote-form select:focus, .quote-form textarea:focus {
  outline: 0; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(6, 111, 209, 0.15);
}
fieldset.contact { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; display: flex; flex-direction: column; gap: 12px; }
fieldset.contact legend { font-weight: 700; font-size: 14px; padding: 0 6px; }
label.check { flex-direction: row; align-items: flex-start; gap: 8px; font-weight: 400; font-size: 14px; }
label.check input { margin-top: 3px; }
label .opt { color: var(--muted); font-weight: 400; }
.checks { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 16px; }
@media (max-width: 560px) { .checks { grid-template-columns: 1fr; } }

/* Buttons (our classes don't use Bootstrap's .btn base, so style them fully) */
.btn-primary {
  display: inline-block; background: var(--accent); color: #fff; border: none;
  border-radius: var(--radius); padding: 9px 16px; font: inherit; font-weight: 600;
  cursor: pointer; text-decoration: none; line-height: 1.4;
}
.btn-primary:hover { background: var(--accent-dark); color: #fff; }
.btn-secondary, .btn-ghost {
  display: inline-block; background: #fff; color: var(--accent); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 8px 14px; font: inherit; font-weight: 600;
  cursor: pointer; text-decoration: none; line-height: 1.4;
}
.btn-secondary:hover, .btn-ghost:hover { border-color: var(--accent); background: #f1f7ff; }

/* Data tables */
table.data { width: 100%; border-collapse: collapse; margin-top: 12px; font-size: 14px; }
table.data th, table.data td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.data th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: 0.03em; }
table.data td.muted { color: var(--muted); }
table.data td a.ext { word-break: break-all; }
table.data tbody tr:hover { background: #f6f8fb; }
/* Tabler card-table sits flush inside a .card. */
.card > .table-responsive { margin: 0; }
.card-table { margin-bottom: 0; }

/* Stat chips */
.stats { display: flex; gap: 10px; flex-wrap: wrap; margin: 4px 0 0; }
.stat { background: #eef3f9; border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 14px; }
.stat b { color: var(--navy); font-size: 18px; display: block; }
.stat span { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.03em; }

/* Badges (override Tabler's .badge so our variants render) */
.badge { display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; margin-right: 4px; }
.badge.caa { background: #e6f0ff; color: #1a5fd0; }
.badge.ins { background: #e9f7ef; color: #1f7a4d; }
.badge.rating { background: #fff4e0; color: #8a5a00; }
.chip { display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: #eef3f9; color: var(--navy); margin-right: 4px; }

/* Pagination */
.pager { display: flex; gap: 8px; align-items: center; margin-top: 16px; font-size: 14px; }
.pager a, .pager span.cur { padding: 7px 12px; border: 1px solid var(--line); border-radius: var(--radius); text-decoration: none; color: var(--accent); }
.pager span.cur { background: var(--navy); color: #fff; border-color: var(--navy); }
.pager .muted { border: none; padding: 7px 4px; }

/* Directory toolbar */
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 12px; }
.toolbar input[type="search"] { font: inherit; padding: 9px 12px; border: 1px solid var(--line); border-radius: var(--radius); min-width: 240px; }
.toolbar label.check { font-size: 14px; white-space: nowrap; }
.toolbar .clear { font-size: 14px; color: var(--muted); text-decoration: none; }

/* Credit packs */
.packs { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 12px; }
.pack { border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; text-align: center; min-width: 140px; display: flex; flex-direction: column; gap: 8px; }
.pack-credits { font-weight: 700; font-size: 18px; color: var(--navy); }
.pack-price { color: var(--muted); }

/* Pipeline board */
.board { display: flex; gap: 14px; margin-top: 20px; overflow-x: auto; padding-bottom: 12px; align-items: flex-start; }
.board-col { flex: 0 0 260px; background: #eef3f9; border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; display: flex; flex-direction: column; gap: 6px; }
.board-col.side { background: #f9eef0; border-color: #e6ccd0; }
.board-col-head { display: flex; align-items: center; justify-content: space-between; }
.board-col-head .col-title { font-weight: 700; color: var(--navy); font-size: 14px; }
.board-col-head .col-count { background: var(--navy); color: #fff; font-size: 12px; font-weight: 700; border-radius: 999px; min-width: 22px; text-align: center; padding: 1px 7px; }
.board-col.side .col-count { background: #9b3b4b; }
.col-hint { color: var(--muted); font-size: 11px; margin: 0 0 4px; line-height: 1.3; }
.board-col-body { display: flex; flex-direction: column; gap: 8px; min-height: 60px; border-radius: var(--radius); padding: 2px; }
.board-col-body.drag-over { outline: 2px dashed var(--accent); outline-offset: -2px; background: #e3ecfb; }
.col-empty { color: #a9b3c5; text-align: center; font-size: 13px; margin: 8px 0; }
.lead-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; text-decoration: none; color: var(--text); cursor: grab; box-shadow: 0 1px 2px rgba(20, 34, 58, 0.05); display: block; }
.lead-card:hover { border-color: var(--accent); }
.lead-card.dragging { opacity: 0.5; }
.lead-card-cat { font-weight: 700; font-size: 14px; color: var(--navy); }
.lead-card-area { color: var(--muted); font-size: 13px; margin-top: 2px; }
.lead-card-foot { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.lead-card-date { color: var(--muted); font-size: 11px; margin-left: auto; }
.lead-card-task { margin: 4px 0 0; font-size: 12px; font-weight: 700; color: #92400e; background: #fef3c7; border: 1px solid #fcd34d; border-radius: var(--radius); padding: 2px 7px; display: inline-block; }

/* Stage badge + move controls */
.stage-badge { display: inline-block; background: var(--navy); color: #fff; font-weight: 700; font-size: 13px; padding: 4px 12px; border-radius: 999px; }
.stage-move { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.stage-move form { display: inline; margin: 0; }
.stage-btn { font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; background: #fff; color: var(--accent); border: 1px solid var(--line); border-radius: var(--radius); padding: 6px 12px; text-decoration: none; }
.stage-btn:hover { border-color: var(--accent); background: #f1f7ff; }
.stage-btn.danger { color: #d63939; }
.stage-btn.danger:hover { border-color: #f0b9b9; background: #fdeeee; }

/* Timeline */
.timeline { list-style: none; margin: 8px 0 0; padding: 0; }
.timeline .tl-item { display: flex; gap: 12px; padding: 0 0 14px; position: relative; }
.timeline .tl-item:not(:last-child)::before { content: ""; position: absolute; left: 5px; top: 14px; bottom: 0; width: 2px; background: var(--line); }
.tl-dot { flex: 0 0 12px; width: 12px; height: 12px; border-radius: 999px; background: var(--accent); margin-top: 3px; position: relative; z-index: 1; }
.tl-body { flex: 1; }
.tl-head { display: flex; align-items: baseline; gap: 8px; justify-content: space-between; }
.tl-head strong { color: var(--navy); font-size: 14px; }
.tl-time { color: var(--muted); font-size: 12px; white-space: nowrap; }
.tl-text { font-size: 14px; margin-top: 1px; }
.tl-actor { color: var(--muted); font-size: 12px; margin-top: 1px; }
.note-form { margin-top: 16px; border-top: 1px solid var(--line); padding-top: 14px; }

/* In-page tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: 18px 0 16px; flex-wrap: wrap; }
.tab-btn { font: inherit; font-weight: 600; font-size: 14px; cursor: pointer; background: none; border: none; color: var(--muted); padding: 9px 14px; border-bottom: 3px solid transparent; margin-bottom: -1px; }
.tab-btn:hover { color: var(--text); }
.tab-btn.is-active { color: var(--navy); border-bottom-color: var(--accent); }
.tab-panel { display: none; }
.tab-panel.is-active { display: block; }

/* Email-template previews (Stack tab) */
.email-tpl { border: 1px solid var(--line); border-radius: var(--radius); margin: 8px 0; }
.email-tpl > summary { display: flex; align-items: center; gap: 10px; padding: 10px 14px; cursor: pointer; list-style: none; }
.email-tpl > summary::-webkit-details-marker { display: none; }
.email-tpl > summary::before { content: "▸"; color: var(--muted); }
.email-tpl[open] > summary::before { content: "▾"; }
.email-tpl-name { font-weight: 700; color: var(--navy); white-space: nowrap; }
.email-tpl-id { font-size: 12px; background: #eef3f9; color: var(--muted); border-radius: 6px; padding: 2px 7px; white-space: nowrap; }
.email-tpl-meta { flex: 1; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.email-copy { margin-left: auto; flex: 0 0 auto; }
.email-tpl-frame { width: 100%; height: 380px; border: 0; border-top: 1px solid var(--line); background: #fff; }

/* Responder cards + message threads + live chat */
.responder { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; margin: 10px 0; }
.responder-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.thread-wrap { margin: 6px 0; }
.thread { list-style: none; margin: 8px 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
/* Tabler-style chat bubbles. */
.thread li {
  background: #f1f5f9; border-radius: 14px; padding: 8px 12px; font-size: 14px;
  max-width: 80%; align-self: flex-start; line-height: 1.4;
}
.thread li .muted { display: block; font-size: 11px; font-weight: 600; margin-bottom: 1px; }
.thread li.me { background: var(--accent); color: #fff; align-self: flex-end; }
.thread li.me .muted { color: rgba(255, 255, 255, 0.85); }
#chat-messages { max-height: 50vh; overflow-y: auto; padding-right: 4px; }

/* Live self-test */
.pipeline-strip { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.pl-stage { padding: 6px 12px; border-radius: 999px; font-size: 13px; font-weight: 600; background: #f0f2f6; color: #6b7686; border: 1px solid var(--line); }
.pl-stage.done { background: #e6f7ee; color: #1c7a47; border-color: #b8e6cd; }
.pl-stage.current { background: var(--accent); color: #fff; border-color: var(--accent); }
.pl-stage.fail { background: #fdeaea; color: #b42318; border-color: #f4c7c2; }
.selftest-steps { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.selftest-step { display: flex; align-items: baseline; gap: 10px; padding: 9px 12px; border-radius: var(--radius); background: #f7f8fa; border: 1px solid var(--line); }
.selftest-step .st-icon { font-weight: 700; width: 16px; flex: 0 0 16px; text-align: center; }
.selftest-step .st-name { font-weight: 600; }
.selftest-step .st-detail { font-size: 13px; }
.selftest-step.pending { color: #98a1b0; }
.selftest-step.pending .st-icon { color: #c2c9d4; }
.selftest-step.ok { background: #f1faf5; border-color: #cdeedd; }
.selftest-step.ok .st-icon { color: #1c7a47; }
.selftest-step.fail { background: #fdeeed; border-color: #f4c7c2; }
.selftest-step.fail .st-icon { color: #b42318; }

/* Company-facing lead tiles */
.lead-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; margin-top: 12px; }
.lead-tile { display: block; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; text-decoration: none; color: var(--text); background: #fff; transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s; }
.lead-tile:hover { border-color: var(--accent); box-shadow: 0 4px 14px rgba(20, 34, 58, 0.1); transform: translateY(-1px); }
.lead-tile-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.lead-tile-cat { font-weight: 700; color: var(--navy); }
.lead-tile-area { color: var(--muted); font-size: 14px; margin-top: 2px; }
.lead-tile-sum { font-size: 14px; margin: 8px 0; color: var(--text); line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.lead-tile-foot { display: flex; justify-content: space-between; align-items: center; font-size: 13px; margin-top: 6px; }
.lead-tile-cta { color: var(--accent); font-weight: 700; }
.review-stars { color: #b8860b; letter-spacing: 1px; }

/* Orange Tasks button in the dark top strip (A9 #3) */
.btn-tasks { background: #f76707; border-color: #f76707; color: #fff; font-weight: 600; display: inline-flex; align-items: center; gap: 6px; }
.btn-tasks:hover, .btn-tasks:focus { background: #e8590c; border-color: #e8590c; color: #fff; }
.btn-tasks .icon { width: 18px; height: 18px; }

/* n8n-style pipeline flow (A8 #1) */
.flow { display: flex; align-items: stretch; gap: 0; flex-wrap: nowrap; margin-top: 4px; }
.flow-node { flex: 1 1 0; min-width: 140px; display: flex; flex-direction: column; gap: 4px; text-decoration: none; color: var(--text); background: #fff; border: 1px solid var(--line); border-top: 3px solid var(--accent); border-radius: 10px; padding: 12px 14px; transition: border-color .15s, box-shadow .15s, transform .15s; }
.flow-node:hover { box-shadow: 0 4px 14px rgba(20,34,58,.10); transform: translateY(-1px); border-color: var(--accent); }
.flow-node.selected { box-shadow: 0 0 0 2px var(--accent); border-color: var(--accent); }
.flow-node.side { border-top-color: #d63939; }
.flow-node-head { display: flex; align-items: center; justify-content: space-between; gap: 6px; min-height: 20px; }
.flow-node-title { font-weight: 700; color: var(--navy); font-size: 13px; }
.flow-node-count { font-size: 28px; font-weight: 700; line-height: 1.1; color: var(--navy); }
.flow-node-hint { font-size: 12px; color: var(--muted); line-height: 1.35; }
.flow-flag { font-size: 11px; font-weight: 700; color: #ad6800; background: #fff7e6; border: 1px solid #ffe1a8; border-radius: 999px; padding: 1px 7px; white-space: nowrap; align-self: flex-start; }
.flow-node-sub { font-size: 11px; color: var(--muted); margin-top: -2px; }
.flow-kind { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; padding: 1px 6px; border-radius: 999px; white-space: nowrap; }
.flow-kind-auto { color: #5b6573; background: #eef1f5; border: 1px solid var(--line); }
.flow-kind-manual { color: #ad6800; background: #fff7e6; border: 1px solid #ffe1a8; }
.flow-node.flow-manual { border-top-color: #f76707; }
.flow-conn { flex: 0 0 26px; align-self: center; height: 2px; background: linear-gradient(90deg, var(--line), #c5ccd6); position: relative; }
.flow-conn::after { content: ""; position: absolute; right: -1px; top: 50%; transform: translateY(-50%); border: 5px solid transparent; border-left-color: #c5ccd6; }
.flow-conn-side { background: #f0c4c4; }
.flow-conn-side::after { border-left-color: #e0a3a3; }
@media (max-width: 900px) {
  .flow { flex-direction: column; }
  .flow-node { min-width: 0; }
  .flow-conn { width: 2px; height: 20px; flex-basis: 20px; align-self: center; background: linear-gradient(180deg, var(--line), #c5ccd6); }
  .flow-conn::after { right: auto; left: 50%; top: auto; bottom: -1px; transform: translateX(-50%); border: 5px solid transparent; border-top-color: #c5ccd6; border-left-color: transparent; }
}

/* Copyable record-id chip (A8 #5) */
.id-chip { display: inline-flex; align-items: center; gap: 4px; }
.id-chip code { font-size: 12px; color: var(--muted); background: #f1f3f7; border: 1px solid var(--line); border-radius: 5px; padding: 1px 6px; }
.copy-btn { --tblr-btn-size: 1.5rem; width: 1.5rem; height: 1.5rem; padding: 0; color: var(--muted); position: relative; }
.copy-btn:hover { color: var(--accent); }
.copy-btn .copy-check { display: none; color: #2fb344; }
.copy-btn.is-copied .copy-icon { display: none; }
.copy-btn.is-copied .copy-check { display: inline-block; }
.copy-btn.is-copied { color: #2fb344; }

/* Kommo-style detail layout (A8 #6) */
.field-row { display: flex; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--line); }
.field-row:last-child { border-bottom: 0; }
.field-label { flex: 0 0 38%; color: var(--muted); font-size: 13px; padding-top: 1px; }
.field-value { flex: 1 1 0; font-size: 14px; min-width: 0; word-break: break-word; }
.detail-badges { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.copy-value { display: inline-flex; align-items: center; gap: 4px; max-width: 100%; }
.copy-value-text { word-break: break-all; }
.note-composer textarea { resize: vertical; }
/* Tabbed lead aside on a distinct background (A9 #2) */
.detail-aside { background: #f4f6fa; }
.detail-aside .detail-tabs { margin-bottom: 10px; }
.detail-aside .tab-panel .table.card-table { background: #fff; border-radius: var(--radius); }
.detail-aside .field-row { border-bottom-color: #e3e8ef; }

/* ===== Kommo-style detail (A10) ===== */
/* Status chevron bar */
.kommo-status { display: flex; gap: 3px; margin: 0 0 14px; flex-wrap: wrap; }
.kommo-status .seg {
  flex: 1 1 0; min-width: 92px; background: #eef1f5; color: #69727f;
  font-size: 12px; font-weight: 600; line-height: 1.2; padding: 8px 14px 8px 24px;
  clip-path: polygon(0 0, calc(100% - 13px) 0, 100% 50%, calc(100% - 13px) 100%, 0 100%, 13px 50%);
  text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.kommo-status .seg:first-child { padding-left: 14px; clip-path: polygon(0 0, calc(100% - 13px) 0, 100% 50%, calc(100% - 13px) 100%, 0 100%); }
.kommo-status .seg.done { background: #dbe7f8; color: #1c5fb0; }
.kommo-status .seg.current { background: #066fd1; color: #fff; }
.kommo-status .seg.current.rejected { background: #d63939; }
.kommo-status .seg.current.paused { background: #f59f00; }

/* Avatars */
.avatar-c { display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px; border-radius: 50%; background: #066fd1; color: #fff; font-weight: 700; font-size: 13px; flex: 0 0 38px; }
.avatar-c.av-contact { background: #4263eb; }

/* Kommo aside */
.kommo-aside { background: #f4f6fa; }
.kommo-head { display: flex; gap: 10px; align-items: center; padding-bottom: 10px; margin-bottom: 8px; border-bottom: 1px solid #e3e8ef; }
.kommo-head .kh-name { font-weight: 700; color: var(--navy); line-height: 1.2; }
.kommo-head .kh-sub { font-size: 12px; color: var(--muted); }
.kommo-contact-card { background: #1d273b; color: #fff; border-radius: 8px; padding: 12px; margin-top: 14px; display: flex; gap: 10px; align-items: flex-start; }
.kommo-contact-card .name { font-weight: 700; }
.kommo-contact-card .sub { font-size: 12px; color: #aab4c4; margin-bottom: 4px; }
.kommo-contact-card .cc-line { font-size: 13px; margin-top: 2px; }
.kommo-contact-card .copy-value-text { color: #dbe3ef; }
.kommo-contact-card .copy-btn { color: #aab4c4; }
.kommo-contact-card .copy-btn:hover { color: #fff; }

/* Kommo feed */
.kommo-feed { list-style: none; margin: 0; padding: 0; }
.kommo-feed .fd-date { text-align: center; margin: 14px 0 8px; }
.kommo-feed .fd-date span { font-size: 12px; color: var(--muted); background: #eef1f5; border: 1px solid var(--line); border-radius: 999px; padding: 2px 12px; }
.kommo-feed .fd-item { display: flex; gap: 12px; padding: 6px 0; }
.kommo-feed .fd-marker { flex: 0 0 32px; display: flex; justify-content: center; }
.kommo-feed .fd-icon { width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 14px; background: #eef1f5; color: #69727f; }
.kommo-feed .fd-icon.tone-created { background: #e6f0fb; color: #1c5fb0; }
.kommo-feed .fd-icon.tone-quality { background: #fff7e6; color: #ad6800; }
.kommo-feed .fd-icon.tone-matched { background: #e9edff; color: #3b5bdb; }
.kommo-feed .fd-icon.tone-approved { background: #e6f7ee; color: #1c7a47; }
.kommo-feed .fd-icon.tone-email { background: #fbe3e3; color: #b42318; }
.kommo-feed .fd-icon.tone-unlocked { background: #e6f7ee; color: #1c7a47; }
.kommo-feed .fd-icon.tone-note { background: #fff9db; color: #9c7a00; }
.kommo-feed .fd-icon.tone-stage { background: #eef1f5; color: #69727f; }
.kommo-feed .fd-body { flex: 1 1 0; min-width: 0; background: #f7f8fa; border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; }
.kommo-feed .fd-head { display: flex; justify-content: space-between; gap: 8px; }
.kommo-feed .fd-title { font-weight: 600; color: var(--navy); }
.kommo-feed .fd-time { font-size: 12px; color: var(--muted); white-space: nowrap; }
.kommo-feed .fd-text { font-size: 14px; margin-top: 2px; word-break: break-word; }
.kommo-feed .fd-actor { font-size: 12px; color: var(--muted); margin-top: 3px; }

/* Composer */
.kommo-composer { display: flex; gap: 10px; align-items: flex-start; background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 10px; margin-bottom: 14px; }
.kommo-composer .kc-body { flex: 1 1 0; }
.kommo-composer textarea { resize: vertical; }

/* Fixed top menu (A10.1) — both strips stick together */
.topbar-sticky { position: sticky; top: 0; z-index: 1030; background: #fff; box-shadow: 0 1px 0 var(--line); }

/* Incomplete-task banner — sticky/floating at the top of the feed (A10.5) */
.kommo-task { display: flex; gap: 10px; align-items: center; background: #fff7e6; border: 1px solid #ffe1a8; border-left: 3px solid #f76707; border-radius: 8px; padding: 10px 12px; margin-bottom: 12px; position: sticky; top: 112px; z-index: 5; box-shadow: 0 2px 6px rgba(20,34,58,.06); }
.kommo-task-flag { color: #f76707; font-size: 16px; line-height: 1; }
.kommo-task-body { flex: 1 1 0; min-width: 0; }
.kommo-task-title { font-weight: 700; color: var(--navy); }
.kommo-task-sub { font-size: 13px; color: #8a6d3b; margin-top: 1px; }
.kommo-task-action { display: flex; align-items: center; flex: 0 0 auto; }

/* Count badge on the orange Tasks button (A10.1) */
.tasks-count { display: inline-flex; align-items: center; justify-content: center; min-width: 18px; height: 18px; padding: 0 5px; margin-left: 6px; border-radius: 999px; background: #fff; color: #f76707; font-size: 11px; font-weight: 700; line-height: 1; }

/* Full-email viewer iframe (A12 #6) */
.email-body-frame { width: 100%; height: 380px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.email-meta th { width: 90px; font-weight: 600; }

/* Service-seekers column picker (A12 #2) */
.col-menu { min-width: 17rem; padding: 8px; max-height: 60vh; overflow-y: auto; }
.col-menu .col-row { display: flex; align-items: center; gap: 8px; padding: 4px 6px; border-radius: 6px; }
.col-menu .col-row:hover { background: #f1f3f7; }
.col-menu .col-row .grip { color: var(--muted); cursor: grab; font-size: 14px; }
.col-menu .col-row label { flex: 1; margin: 0; font-size: 14px; cursor: pointer; }
.col-menu .col-row .ord { display: inline-flex; gap: 2px; }
.col-menu .col-row .ord button { border: 0; background: transparent; color: var(--muted); cursor: pointer; padding: 0 3px; font-size: 13px; }
.col-menu .col-row .ord button:hover { color: var(--accent); }

/* Clickable email feed bubble (A10.4) */
.kommo-feed .fd-email { -webkit-appearance: none; appearance: none; width: 100%; text-align: left; cursor: pointer; font: inherit; }
.kommo-feed .fd-email:hover { border-color: var(--accent); background: #f1f6fc; }
.kommo-feed .fd-email .fd-actor { color: var(--accent); }

@media (max-width: 560px) { .quote-form .row { flex-direction: column; gap: 14px; } }

/* ---- B1: provider dashboard ---- */
/* Company initial avatar */
.company-avatar { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 999px; background: var(--navy, #14223a); color: #fff; font-weight: 700; font-size: 15px; flex: none; }
.company-avatar-lg { width: 48px; height: 48px; font-size: 20px; }

/* Profile completion checklist */
.completion-list li { display: flex; align-items: center; gap: 8px; padding: 3px 0; font-size: 14px; color: var(--muted, #6b7a90); }
.completion-list li.is-done { color: var(--text, #14223a); }
.completion-list .completion-dot { display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px; border-radius: 999px; font-size: 11px; font-weight: 700; background: #eef3f9; color: var(--muted, #6b7a90); flex: none; }
.completion-list li.is-done .completion-dot { background: #e6f6ec; color: #2fb344; }

/* Service chips row */
.chip-row { display: flex; flex-wrap: wrap; gap: 6px; }

/* Compact lead tiles (dashboard column) */
.lead-tiles-compact { grid-template-columns: 1fr; gap: 8px; }
.lead-tiles-compact .lead-tile { padding: 10px 12px; }
.lead-tiles-compact .lead-tile-sum { font-size: 13px; }

/* ---- C1: buyer requests → quote cards → embedded chat ---- */
/* Prominent profile avatar in the dark top strip (accent colour stands out on navy) */
.topbar-avatar { display: inline-flex; align-items: center; justify-content: center; width: 42px; height: 42px; border-radius: 999px; background: var(--accent, #2563c9); color: #fff; font-weight: 700; font-size: 18px; border: 2px solid rgba(255, 255, 255, 0.55); box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35); transition: transform 0.12s, box-shadow 0.12s; cursor: pointer; }
.topbar-avatar:hover { transform: scale(1.06); box-shadow: 0 2px 10px rgba(0, 0, 0, 0.45); }


.request-empty { text-align: center; }
.request-empty .card-body { padding: 32px 16px; }
.request-card .card-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.request-title { margin: 0; font-size: 1.05rem; color: var(--navy, #14223a); }
.request-meta { color: var(--muted, #6b7a90); font-size: 0.85rem; margin-top: 2px; }
.awaiting-quotes { margin: 4px 0; }

.quote-card { border: 1px solid var(--line, #e6ebf2); border-radius: var(--radius, 10px); padding: 12px 14px; margin-bottom: 12px; }
.quote-card:last-child { margin-bottom: 0; }
.quote-card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.quote-card-co { display: flex; align-items: center; gap: 8px; min-width: 0; }
.quote-card-co strong { color: var(--navy, #14223a); }
.quote-card-msg { margin: 8px 0; }
.quote-price { font-weight: 700; }
.quote-card-actions { margin-top: 8px; }

/* Embedded (expandable) chat inside a quote card */
.quote-chat { margin-top: 8px; border-top: 1px solid var(--line, #e6ebf2); padding-top: 8px; }
.quote-chat-summary { cursor: pointer; color: var(--accent, #2563c9); font-size: 0.9rem; list-style: none; font-weight: 600; user-select: none; }
.quote-chat-summary::-webkit-details-marker { display: none; }
.quote-chat-summary::after { content: "▾"; display: inline-block; margin-left: 6px; transition: transform 0.15s; }
.quote-chat[open] > .quote-chat-summary::after { transform: rotate(180deg); }
.quote-chat-body { margin-top: 8px; }
.quote-chat-bubbles { max-height: 40vh; overflow-y: auto; }
.quote-chat-open { display: inline-block; margin-top: 8px; }

/* Account settings rows */
.account-row { display: flex; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line, #e6ebf2); }
.account-label { color: var(--muted, #6b7a90); min-width: 80px; }
.account-value { font-weight: 500; }

/* Chat / conversation list */
.chat-list { display: flex; flex-direction: column; }
.chat-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; padding: 12px 4px; text-decoration: none; color: var(--text, #14223a); border-bottom: 1px solid var(--line, #e6ebf2); transition: background 0.12s; }
.chat-row:last-child { border-bottom: 0; }
.chat-row:hover { background: #f6f9fd; }
.chat-row-main { min-width: 0; flex: 1; }
.chat-row-head { display: flex; align-items: center; gap: 8px; }
.chat-row-cat { font-weight: 700; color: var(--navy, #14223a); }
.chat-row-preview { margin: 4px 0 0; font-size: 14px; color: var(--muted, #6b7a90); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-row-time { font-size: 12px; color: var(--muted, #6b7a90); flex: none; white-space: nowrap; }

/* ===========================================================================
   BRUTALIST / TERMINAL THEME — pros + buyer portals only (body.brutalist).
   Re-themes Tabler via its CSS variables + targeted overrides. The internal
   admin console does NOT set .brutalist, so it is unaffected.
   =========================================================================== */
body.brutalist {
  --tblr-font-sans-serif: 'Space Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --tblr-body-font-family: 'Space Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --tblr-border-radius: 0; --tblr-border-radius-sm: 0; --tblr-border-radius-md: 0;
  --tblr-border-radius-lg: 0; --tblr-border-radius-xl: 0; --tblr-border-radius-xxl: 0; --tblr-border-radius-pill: 0;
  --tblr-border-color: #0a0a0a;
  --tblr-box-shadow: none; --tblr-box-shadow-sm: none; --tblr-box-shadow-lg: none; --tblr-card-box-shadow: none;
  --tblr-body-bg: #ffffff;
  font-family: 'Space Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  background: #ffffff;
}

/* Flat + square across components. */
body.brutalist .card, body.brutalist .dropdown-menu, body.brutalist .modal-content,
body.brutalist .alert { box-shadow: none; }
body.brutalist .card, body.brutalist .card .card { border: 2px solid #0a0a0a; }
body.brutalist .table, body.brutalist .form-control, body.brutalist .form-select,
body.brutalist .dropdown-menu, body.brutalist .modal-content, body.brutalist .badge,
body.brutalist .chip, body.brutalist .lead-tile, body.brutalist .quote-card,
body.brutalist .kommo-aside, body.brutalist .kommo-contact-card, body.brutalist .company-avatar,
body.brutalist .topbar-avatar, body.brutalist .alert, body.brutalist .progress,
body.brutalist .btn, body.brutalist .completion-list .completion-dot { border-radius: 0; }

/* Headings + labels: uppercase. */
body.brutalist .card-title, body.brutalist .page-title, body.brutalist .page-pretitle,
body.brutalist h1, body.brutalist h2, body.brutalist h3, body.brutalist .nav-link-title,
body.brutalist .form-label, body.brutalist .request-title, body.brutalist .quote-card-co strong,
body.brutalist .kh-name { text-transform: uppercase; letter-spacing: 0.02em; }

/* Dark strip → navy #0f172a, hard rule beneath. */
body.brutalist .topbar-sticky { border-bottom: 2px solid #0a0a0a; }
body.brutalist .navbar[data-bs-theme="dark"] { background-color: #0f172a; }

/* Light nav: uppercase mono. */
body.brutalist .navbar .nav-link { text-transform: uppercase; font-weight: 700; letter-spacing: 0.04em; }

/* Buttons: uppercase mono, hard 2px border; primary inverts on hover. */
body.brutalist .btn { text-transform: uppercase; font-weight: 700; letter-spacing: 0.04em; border: 2px solid #0a0a0a; }
body.brutalist .btn-primary { background: #0f172a; border-color: #0f172a; color: #fff; }
body.brutalist .btn-primary:hover, body.brutalist .btn-primary:focus { background: #fff; color: #0f172a; }
body.brutalist .btn-outline-primary:hover, body.brutalist .btn-outline-danger:hover { background: #0a0a0a; color: #fff; border-color: #0a0a0a; }

/* Inputs. */
body.brutalist .form-control, body.brutalist .form-select { border: 2px solid #0a0a0a; }
body.brutalist .form-label { font-size: 12px; font-weight: 700; }

/* Pixel-mascot brand in the dark strip. */
.topbar-brand { display: inline-flex; align-items: center; text-decoration: none; }
.topbar-brand img { image-rendering: pixelated; display: block; }

/* Force-square + flat cards (Tabler keeps a 6px radius via its own card var). */
body.brutalist .card, body.brutalist .card-header, body.brutalist .card-footer,
body.brutalist .card-body { border-radius: 0 !important; }
body.brutalist .card { box-shadow: none !important; }
/* Safety: stacked cards in a row-deck column should stack, not sit side-by-side. */
body.brutalist .row-deck > [class*="col-"] { flex-direction: column; }
/* Let flex children shrink/wrap instead of forcing horizontal overflow in mono. */
body.brutalist .card-header { flex-wrap: wrap; gap: 6px; }
body.brutalist .chat-row-main, body.brutalist .quote-card-co { min-width: 0; }
/* Badges/chips keep their full label (uppercase mono is wider). */
body.brutalist .badge, body.brutalist .chip { flex: none; white-space: nowrap; }
