/* Tokens: --primary, --accent, --radius, --font are set per company in Settings → Appearance */
:root {
  --bg: #f6f7f9; --panel: #ffffff; --text: #1c2130; --muted: #6b7280; --line: #dfe3ea;
  --primary-ink: #ffffff; --danger: #c0392b; --ok: #1f7a3a;
  --pad: 14px; --gap: 12px; --fs: 14px; --row: 40px;
}
[data-theme="dark"] {
  --bg: #12151c; --panel: #1b1f28; --text: #e6e8ee; --muted: #9aa3b2; --line: #2b3140;
}
[data-density="compact"] { --pad: 8px; --gap: 8px; --fs: 13px; --row: 30px; }
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: var(--fs)/1.45 var(--font); }
a { color: var(--primary); text-decoration: none; } a:hover { text-decoration: underline; }
h1, h2 { margin: 0 0 var(--gap); font-weight: 600; } h1 { font-size: 1.5em; } h2 { font-size: 1.05em; }
h1 small, h2 small { color: var(--muted); font-weight: 400; font-size: .7em; margin-inline-start: 6px; }
.muted, small { color: var(--muted); }
.empty { color: var(--muted); padding: var(--pad) 0; }

/* top bar */
.topbar { display: flex; align-items: center; gap: var(--gap); padding: 0 var(--pad); height: 52px; background: var(--primary); color: var(--primary-ink); position: sticky; top: 0; z-index: 10; }
.topbar a { color: inherit; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 1.05em; white-space: nowrap; }
.brand img { height: 30px; background: #fff; border-radius: 4px; padding: 2px; }
.modules { display: flex; gap: 2px; margin-inline-start: var(--gap); }
.modules a { padding: 6px 12px; border-radius: var(--radius); opacity: .85; }
.modules a.on, .modules a:hover { background: rgba(255,255,255,.18); opacity: 1; text-decoration: none; }
.search { flex: 1; display: flex; justify-content: center; }
.search input { width: min(420px, 100%); border: 0; border-radius: var(--radius); padding: 7px 12px; font: inherit; }
.userbox { display: flex; gap: 14px; white-space: nowrap; }
.userbox form { margin: 0; } .userbox button.link { padding: 0; border: 0; background: none; color: inherit; }
.userbox button.link:hover { text-decoration: underline; }

/* layout */
.page { max-width: 1400px; margin: 0 auto; padding: calc(var(--pad) * 1.5) var(--pad); }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: var(--gap); flex-wrap: wrap; margin-bottom: var(--gap); }
.page-title { margin: 0; } .crumb a { color: var(--muted); }
.actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.actions form { margin: 0; }
.cols { display: grid; gap: var(--gap); grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: var(--pad); }
.row { padding: 6px 0; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; }
.row:last-child { border-bottom: 0; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: var(--gap); margin-bottom: var(--gap); }
.stat { background: var(--panel); border: 1px solid var(--line); border-inline-start: 4px solid var(--accent); border-radius: var(--radius); padding: var(--pad); display: flex; flex-direction: column; color: inherit; }
.stat b { font-size: 1.8em; line-height: 1.1; } .stat span { color: var(--muted); }
.stat:hover { text-decoration: none; border-color: var(--primary); }

/* buttons & forms */
button, .btn { display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border: 1px solid var(--line); background: var(--panel); color: var(--text); border-radius: var(--radius); font: inherit; cursor: pointer; text-decoration: none; }
button:hover, .btn:hover { border-color: var(--primary); text-decoration: none; }
.primary, button.primary { background: var(--primary); color: var(--primary-ink); border-color: var(--primary); }
.danger { color: var(--danger); } .small { padding: 3px 8px; font-size: .9em; }
input, select, textarea { font: inherit; color: var(--text); background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 7px 10px; width: 100%; }
input[type="checkbox"] { width: auto; } input[type="color"] { height: 38px; padding: 2px; }
input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
label > span { display: block; color: var(--muted); font-size: .9em; margin-bottom: 3px; }
label.check { display: flex; align-items: center; gap: 8px; } label.inline { display: inline; }
.record-form { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: var(--pad); }
.record-form.narrow { max-width: 560px; } .record-form label { display: block; margin-bottom: var(--gap); }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: var(--gap) calc(var(--gap) * 2); }
.grid2 .wide { grid-column: 1 / -1; }
.flash { padding: 10px var(--pad); border-radius: var(--radius); margin-bottom: var(--gap); background: var(--panel); border: 1px solid var(--line); border-inline-start: 4px solid var(--ok); }
.flash.error { border-inline-start-color: var(--danger); }

/* tables */
.table-wrap { overflow-x: auto; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
table.records { width: 100%; border-collapse: collapse; }
table.records th, table.records td { text-align: start; padding: 0 12px; height: var(--row); border-bottom: 1px solid var(--line); white-space: nowrap; max-width: 320px; overflow: hidden; text-overflow: ellipsis; }
table.records th { color: var(--muted); font-weight: 500; position: sticky; top: 0; background: var(--panel); }
table.records tbody tr { cursor: pointer; } table.records tbody tr:hover { background: color-mix(in srgb, var(--primary) 6%, var(--panel)); }
table.records td.empty { white-space: normal; }
.pager { display: flex; gap: var(--gap); align-items: center; justify-content: center; padding: var(--pad); }

/* filters */
.filters { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: var(--pad); margin-bottom: var(--gap); }
.filters.hidden { display: none; }
.filter-top { display: flex; gap: var(--gap); align-items: end; margin-bottom: var(--gap); }
.filter-top input[type="search"] { max-width: 320px; } .filter-top label { display: flex; gap: 6px; align-items: center; white-space: nowrap; } .filter-top select { width: auto; }
.rule { display: grid; grid-template-columns: 1fr 1fr 1fr auto; gap: 8px; margin-bottom: 8px; }
.filter-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.filter-actions details { position: relative; } .filter-actions summary { list-style: none; }
.col-list, .save-box { position: absolute; z-index: 5; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: var(--pad); margin-top: 4px; min-width: 240px; box-shadow: 0 6px 20px rgba(0,0,0,.12); }
.col-list { columns: 2; } .col-list label { display: block; break-inside: avoid; }
.save-box input { margin-bottom: 8px; }
.views select { width: auto; } .views { display: flex; gap: 4px; align-items: center; }

/* record page: header, stage path, three columns (fields | activity | related cards) */
dt { color: var(--muted); font-size: .85em; } dd { margin: 0; overflow-wrap: anywhere; }
ul.plain { list-style: none; margin: 0; padding: 0; } ul.plain li { padding: 5px 0; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; }
svg.i { width: 1em; height: 1em; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.badge { display: inline-grid; place-items: center; width: 1.6em; height: 1.6em; border-radius: 5px; color: #fff; background: #8a94a6; flex: none; font-size: .9em; }
.badge svg.i { width: .95em; height: .95em; }
.b-accounts { background: #5867e8; } .b-contacts { background: #a094ed; } .b-potentials { background: #ff5d2d; }
.b-calls, .b-call { background: #06a59a; } .b-activities, .b-task { background: #3ba755; } .b-follow-up { background: #2e844a; } .b-note { background: #e2a300; }
.b-email { background: #939393; } .b-whatsapp { background: #25d366; } .b-system { background: #8a94a6; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

.record-head { display: flex; justify-content: space-between; align-items: center; gap: var(--gap); flex-wrap: wrap;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: var(--pad); margin-bottom: var(--gap); }
.record-title { display: flex; align-items: center; gap: 10px; min-width: 0; }
.record-title .badge { font-size: 1.35em; border-radius: 7px; }
.record-title small { display: block; font-size: .85em; } .record-title h1 { margin: 0; font-size: 1.45em; line-height: 1.2; overflow-wrap: anywhere; }
.btn-group { display: flex; flex-wrap: wrap; }
.btn-group > .btn, .btn-group > form > .btn { border-radius: 0; margin-inline-start: -1px; font-size: .9em; padding: 6px 12px; color: var(--primary); font-weight: 500; }
.btn-group > .btn.danger, .btn-group > form > .btn.danger { color: var(--danger); }
.btn-group > form { margin: 0; display: flex; }
.btn-group > :first-child, .btn-group > :first-child > .btn { border-start-start-radius: 99px; border-end-start-radius: 99px; }
.btn-group > :last-child, .btn-group > :last-child > .btn { border-start-end-radius: 99px; border-end-end-radius: 99px; }

.path { display: flex; gap: var(--gap); align-items: center; margin-bottom: var(--gap); padding: 10px var(--pad); }
.path-steps { display: flex; flex: 1; list-style: none; margin: 0; padding: 0; min-width: 0; }
.path-steps li { flex: 1; min-width: 0; margin-inline-end: -6px; }
.path-steps li:has(.done) { flex: .55; } .path-steps li:has(.current), .path-steps li:has(.selected) { flex: 2.2; }
.path-steps .step { position: relative; width: 100%; height: 32px; justify-content: center; border: 0; border-radius: 0; padding: 0 18px; font-size: .85em;
  background: var(--line); color: var(--text); clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 50%, calc(100% - 12px) 100%, 0 100%, 12px 50%); }
.path-steps li:first-child .step { clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 50%, calc(100% - 12px) 100%, 0 100%); border-radius: 99px 0 0 99px; }
.path-steps li:last-child .step { clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%, 12px 50%); border-radius: 0 99px 99px 0; }
.path-steps .step span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.path-steps .step.done { background: #aceadf; color: #0b5d52; }
.path-steps .step.current { background: #032d60; color: #fff; font-weight: 600; }
.path-steps .step.selected { background: var(--primary); color: #fff; }
.path-steps .step:hover:not(:disabled) { filter: brightness(.95); }
.path-steps .step:disabled { cursor: default; }
.path-action { display: flex; gap: 8px; align-items: center; } .path-action select { width: auto; }
.path-action .path-submit { border-radius: 99px; white-space: nowrap; font-size: .9em; }
.path-note { margin: calc(var(--gap) * -.5) 0 var(--gap); color: var(--muted); font-size: .9em; }

/* jump rail: small coloured buttons that scroll to each section */
.record-body.has-rail { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: var(--gap); align-items: start; }
.record-main { min-width: 0; }
.rail { position: sticky; top: calc(52px + var(--gap)); display: flex; flex-direction: column; gap: 6px; z-index: 4; }
.rail-btn { --c: #8a94a6; position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 7px 2px 5px;
  border-radius: var(--radius); background: color-mix(in srgb, var(--c) 14%, var(--panel)); color: color-mix(in srgb, var(--c) 75%, var(--text));
  border: 1px solid color-mix(in srgb, var(--c) 30%, transparent); font-size: .7em; font-weight: 600; line-height: 1.1; text-align: center; }
.rail-btn svg.i { width: 18px; height: 18px; }
.rail-btn:hover { text-decoration: none; background: color-mix(in srgb, var(--c) 24%, var(--panel)); }
.rail-btn.on { background: var(--c); color: #fff; border-color: var(--c); }
.rail-btn b { position: absolute; top: -6px; inset-inline-end: -6px; min-width: 18px; padding: 0 4px; border-radius: 9px; background: var(--c);
  color: #fff; font-size: .95em; line-height: 16px; border: 1px solid var(--panel); }
.rail-btn.on b { background: var(--panel); color: var(--c); border-color: var(--c); }
.r-accounts { --c: #5867e8; } .r-contacts { --c: #a094ed; } .r-potentials { --c: #ff5d2d; } .r-calls { --c: #06a59a; }
.r-task { --c: #3ba755; } .r-timeline { --c: #0b8ec4; } .r-top { --c: #8a94a6; margin-top: 6px; }
.b-timeline { background: #0b8ec4; }
#sec-details, #sec-activity, .record-body .panel.wide { scroll-margin-top: calc(52px + var(--gap)); }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }

.record-top { display: grid; gap: var(--gap); align-items: start; margin-bottom: var(--gap); grid-template-columns: minmax(0, 2fr) minmax(300px, 1fr); }
.record-top.no-side { grid-template-columns: minmax(0, 1fr); }
.record-top .panel, .side { min-width: 0; }
.side { display: flex; flex-direction: column; gap: var(--gap); }
.fields .sections { columns: 2 340px; column-gap: calc(var(--gap) * 2); }
.fields .section { break-inside: avoid; }

details > summary { list-style: none; cursor: pointer; } details > summary::-webkit-details-marker { display: none; }
details > summary > svg.i:first-child { transition: transform .12s; } details[open] > summary > svg.i:first-child { transform: rotate(90deg); }
[dir="rtl"] details:not([open]) > summary > svg.i:first-child { transform: rotate(180deg); }

.fields .section { margin-bottom: 10px; }
.fields .section > summary { display: flex; align-items: center; gap: 8px; background: color-mix(in srgb, var(--line) 55%, var(--panel));
  border-radius: var(--radius); padding: 5px 10px; font-size: 1.05em; font-weight: 500; }
.fields dl { margin: 4px 0 0; padding: 0 6px; display: block; }
.fields .field { position: relative; padding: 6px 28px 6px 4px; border-bottom: 1px solid var(--line); }
.fields dt { color: var(--text); font-weight: 600; font-size: .8em; }
.fields dd { font-size: .92em; }
.fields .pre { white-space: pre-wrap; }
.fields .pencil { position: absolute; inset-inline-end: 4px; bottom: 7px; color: var(--muted); opacity: .45; }
.fields .field:hover .pencil, .fields .pencil:focus-visible { opacity: 1; color: var(--primary); }
.fields .field.is-empty { display: none; } .fields.all .field.is-empty { display: block; }
.show-empty-toggle { justify-content: flex-end; font-size: .85em; color: var(--muted); margin-bottom: 8px; }
.avatar { display: inline-grid; place-items: center; width: 1.4em; height: 1.4em; border-radius: 50%; background: var(--primary); color: #fff; font-size: .75em; font-weight: 600; vertical-align: middle; }

.composer { border-bottom: 1px solid var(--line); padding-bottom: var(--gap); margin-bottom: 8px; }
.composer-tabs { display: flex; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 12px 3px 4px; border: 1px solid var(--line); border-radius: 99px; color: var(--text); font-size: .88em; }
.pill.on { border-color: var(--primary); box-shadow: inset 0 0 0 1px var(--primary); } .pill:hover { text-decoration: none; border-color: var(--primary); }
.pill .badge { font-size: .8em; border-radius: 50%; }
.note-form { display: flex; gap: 8px; align-items: flex-start; } .note-form textarea { flex: 1; }
.group > summary { display: flex; align-items: center; gap: 6px; background: color-mix(in srgb, var(--line) 55%, var(--panel)); border-radius: var(--radius); padding: 5px 10px; font-size: .88em; font-weight: 500; }
.group > summary small { margin-inline-start: auto; }
.upcoming { max-height: 360px; overflow-y: auto; }
.up-item { display: flex; align-items: flex-start; gap: 8px; padding: 8px 4px; border-bottom: 1px solid var(--line); }
.up-item .badge { border-radius: 50%; font-size: .8em; margin-top: 2px; }
.tl-main { flex: 1; min-width: 0; display: flex; flex-direction: column; } .tl-main b { font-weight: 500; overflow-wrap: anywhere; }
.tl-date { font-size: .8em; color: var(--muted); text-align: end; white-space: nowrap; } .tl-date.overdue { color: var(--danger); font-weight: 500; }
.empty.center { text-align: center; font-size: .9em; }

/* full-width record tables (related lists, timeline) */
.panel.wide { margin-bottom: var(--gap); }
.tbl-head { display: flex; justify-content: space-between; align-items: center; gap: var(--gap); flex-wrap: wrap; margin-bottom: 10px; }
.tbl-head h2 { display: flex; align-items: center; gap: 10px; margin: 0; font-weight: 500; }
.tbl-tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.tbl-tools select, .tbl-tools input { width: auto; padding: 4px 8px; font-size: .88em; }
.tbl-tools input[type="search"] { width: 190px; }
.tbl-tools .dates { display: flex; gap: 4px; align-items: center; font-size: .85em; color: var(--muted); }
.col-pick { position: relative; } .col-pick > summary { list-style: none; }
.col-pick .col-list { inset-inline-end: 0; max-height: 360px; overflow-y: auto; min-width: 300px; font-size: .9em; }
.tbl .table-wrap.flat { border: 0; border-radius: 0; margin: 0 calc(var(--pad) * -1); border-top: 1px solid var(--line); }
.tbl table.records th:first-child, .tbl table.records td:first-child { padding-inline-start: var(--pad); }
.tbl table.records th[data-sort] { cursor: pointer; user-select: none; }
.tbl table.records th[data-dir="asc"]::after { content: " ↑"; } .tbl table.records th[data-dir="desc"]::after { content: " ↓"; }
.tbl table.records th[hidden], .tbl table.records td[hidden] { display: none; }
.tbl table.records tbody.older tr { opacity: .8; }
.tbl table.records tbody.older tr:first-child td { border-top: 2px dashed var(--line); }
.tbl table.records tr.static { cursor: default; }
table.records td.num { text-align: end; font-variant-numeric: tabular-nums; }
.show-older { margin-top: 10px; } .show-older svg.i { transition: transform .12s; } .show-older.open svg.i { transform: rotate(90deg); }
.tbl-note { margin: 10px 0 0; color: var(--muted); font-size: .88em; }
.tl-table .kind { display: inline-flex; align-items: center; gap: 6px; } .tl-table .kind .badge { border-radius: 50%; font-size: .75em; }
.tl-table td.tl-body-cell { max-width: 420px; color: var(--muted); }
.tl-table tr { cursor: pointer; }
.tl-table tr.expanded td { white-space: pre-wrap; overflow: visible; height: auto; padding-block: 8px; vertical-align: top; }
.tl-table tr.expanded td.tl-body-cell { color: var(--text); }
.tag.overdue { background: color-mix(in srgb, var(--danger) 18%, var(--panel)); color: var(--danger); }

.cards { display: flex; flex-direction: column; gap: var(--gap); min-width: 0; }
.card { padding: 0; overflow: hidden; }
.card h2 { display: flex; align-items: center; gap: 10px; margin: 0; padding: 12px var(--pad); font-size: 1.05em; font-weight: 500; }
.card .empty { padding: 0 var(--pad) var(--pad); margin: 0; }
.tile { padding: 8px var(--pad) 10px; border-top: 1px solid var(--line); }
.tile > a, .tile > b { font-weight: 500; }
dl.kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 1px 12px; margin: 4px 0 0; font-size: .85em; }
dl.kv dt { font-size: 1em; } dl.kv dd { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tag { display: inline-block; font-size: .75em; padding: 1px 7px; border-radius: 10px; background: var(--line); color: var(--text); text-transform: capitalize; margin-inline-end: 6px; }
.tag.stage { background: color-mix(in srgb, var(--primary) 15%, var(--panel)); }
.tag.gf { background: color-mix(in srgb, var(--accent) 30%, var(--panel)); text-transform: none; }
.subnav { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: var(--gap); border-bottom: 1px solid var(--line); }
.subnav a { padding: 8px 12px; border-bottom: 2px solid transparent; margin-bottom: -1px; color: var(--muted); }
.subnav a.on { color: var(--text); border-bottom-color: var(--primary); }

/* relation picker */
.picker { position: relative; } .picker-list { list-style: none; margin: 0; padding: 0; position: absolute; inset-inline: 0; top: 100%; z-index: 6; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); display: none; max-height: 220px; overflow: auto; }
.picker-list li { padding: 7px 10px; cursor: pointer; } .picker-list li:hover { background: color-mix(in srgb, var(--primary) 8%, var(--panel)); }

/* login */
.login-body { display: grid; place-items: center; min-height: 100vh; }
.login { width: min(380px, 92vw); background: var(--panel); border: 1px solid var(--line); border-top: 4px solid var(--primary); border-radius: var(--radius); padding: calc(var(--pad) * 2); }
.login label { display: block; margin-bottom: var(--gap); } .login button { width: 100%; justify-content: center; }
.login-logo { height: 48px; margin-bottom: var(--gap); }

@media (max-width: 1000px) { .record-top { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 800px) {
  .topbar { flex-wrap: wrap; height: auto; padding: 8px var(--pad); row-gap: 6px; }
  .brand { flex: 1; } .userbox { gap: 10px; font-size: .95em; }
  .search { order: 2; width: 100%; } .search input { width: 100%; }
  .modules { order: 3; width: 100%; overflow-x: auto; margin: 0; white-space: nowrap; }
  .modules a { padding: 6px 10px; }
  body:has(.rail) .topbar { position: static; }
  .record-body.has-rail { grid-template-columns: minmax(0, 1fr); }
  .rail { flex-direction: row; overflow-x: auto; top: 0; margin: 0 calc(var(--pad) * -1); padding: 8px var(--pad); background: var(--bg); }
  .rail-btn { flex: 0 0 auto; flex-direction: row; gap: 5px; padding: 5px 10px; font-size: .78em; border-radius: 99px; }
  .rail-btn svg.i { width: 14px; height: 14px; } .rail-btn b { position: static; border: 0; }
  .r-top { margin-top: 0; }
  #sec-details, #sec-activity, .record-body .panel.wide { scroll-margin-top: 56px; }
  .tbl-tools { width: 100%; } .tbl-tools input[type="search"] { flex: 1; width: auto; min-width: 140px; }
  .col-pick .col-list { min-width: 240px; columns: 1; }
  .path { flex-direction: column; align-items: stretch; } .path-steps { overflow-x: auto; }
  .path-steps li { flex: 0 0 auto; min-width: 44px; } .path-steps .step.current { padding: 0 22px; }
  .path-steps .step.todo span { display: none; } .path-action { justify-content: flex-end; }
  .rule { grid-template-columns: 1fr 1fr; }
}
@media (prefers-reduced-motion: no-preference) { .btn, button { transition: border-color .12s; } }

/* notifications, reminders, assigned potentials */
.bell { position: relative; display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; }
.bell svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.bell:hover { background: rgba(255,255,255,.18); text-decoration: none; }
.bell b { position: absolute; top: -3px; inset-inline-end: -5px; min-width: 18px; padding: 0 4px; border-radius: 9px; background: #e5484d;
  color: #fff; font-size: 11px; line-height: 18px; text-align: center; border: 2px solid var(--primary); }
.userbox { align-items: center; }
.reminder { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 10px var(--pad); margin-bottom: var(--gap); border-radius: var(--radius);
  background: color-mix(in srgb, #f5a524 16%, var(--panel)); border: 1px solid color-mix(in srgb, #f5a524 45%, transparent); color: var(--text); }
.reminder span { margin-inline-start: auto; color: var(--primary); font-weight: 500; } .reminder:hover { text-decoration: none; border-color: #f5a524; }
.assigned-panel { margin-bottom: var(--gap); } .assigned-panel h2 { display: flex; align-items: baseline; gap: 6px; }
.more-link { margin-inline-start: auto; font-size: .8em; font-weight: 400; }
.row.assigned.is-new { background: color-mix(in srgb, var(--primary) 6%, var(--panel)); margin: 0 calc(var(--pad) * -1); padding-inline: var(--pad); }
tr.is-new td { background: color-mix(in srgb, var(--primary) 6%, var(--panel)); }
.tag.new { background: var(--primary); color: #fff; } .tag.today { background: color-mix(in srgb, #f5a524 25%, var(--panel)); }
.notif-list { padding: 0; }
.notif { display: flex; gap: 12px; align-items: flex-start; padding: 12px var(--pad); border-bottom: 1px solid var(--line); color: var(--text); }
.notif:last-child { border-bottom: 0; } .notif:hover { text-decoration: none; background: color-mix(in srgb, var(--primary) 5%, var(--panel)); }
.notif .dot { width: 9px; height: 9px; border-radius: 50%; margin-top: 6px; flex: none; background: transparent; }
.notif.unread .dot { background: var(--primary); } .notif.unread b { font-weight: 600; } .notif b { font-weight: 400; }
.notif-main { display: flex; flex-direction: column; min-width: 0; }
.notif-list .empty { padding: var(--pad); }
/* My report: filters, tiles, single-series charts */
.viz-grid, .report-tiles, .report-filters, .report-chart { --viz-series: #2a78d6; --viz-grid: #e1e0d9; --viz-base: #c3c2b7; --viz-axis: #898781; }
[data-theme="dark"] .viz-grid, [data-theme="dark"] .report-tiles, [data-theme="dark"] .report-chart { --viz-series: #3987e5; --viz-grid: #2c2c2a; --viz-base: #383835; }
.report-filters { display: flex; flex-wrap: wrap; gap: var(--gap); align-items: center; margin-bottom: var(--gap); }
.report-filters label { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: .9em; }
.report-filters select, .report-filters input { width: auto; padding: 5px 8px; }
.report-filters .custom-dates { display: flex; gap: 6px; align-items: center; } .report-filters .custom-dates[hidden] { display: none; }
.report-tiles { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.report-tiles .stat { gap: 2px; } .report-tiles .stat span { font-size: .88em; } .report-tiles .stat b { font-weight: 600; }
.report-tiles .stat small { font-size: .8em; }
.viz-grid { display: grid; gap: var(--gap); grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); margin-bottom: var(--gap); }
.viz-grid.lists { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.viz { min-width: 0; } .viz-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; margin-bottom: 10px; }
.viz-head h2 { margin: 0; } .viz-head small { font-size: .82em; }
.viz-plot svg { display: block; max-width: 100%; height: auto; }
.viz-plot .viz-mark { fill: var(--viz-series); } .viz-plot .viz-gridline { stroke: var(--viz-grid); stroke-width: 1; }
.viz-plot .viz-base { stroke: var(--viz-base); stroke-width: 1; } .viz-plot .viz-axis { fill: var(--viz-axis); font-size: 11px; font-variant-numeric: tabular-nums; }
.viz-plot .viz-hit { fill: transparent; } .viz-plot .viz-hit.on { fill: color-mix(in srgb, var(--viz-series) 8%, transparent); }
.hbar { display: grid; grid-template-columns: minmax(90px, 36%) 1fr; gap: 10px; align-items: center; padding: 3px 0; }
.hbar:hover { background: color-mix(in srgb, var(--viz-series) 6%, transparent); }
.hbar-label { color: var(--muted); font-size: .88em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar-track { display: flex; align-items: center; gap: 6px; min-width: 0; width: 100%; }
.hbar-fill { display: block; height: 16px; background: var(--viz-series); border-radius: 0 4px 4px 0; flex: none; }
.hbar-value { font-size: .85em; font-variant-numeric: tabular-nums; color: var(--text); white-space: nowrap; }
.viz-table td, .viz-table th { height: 32px; }
.viz-tip { position: fixed; z-index: 50; pointer-events: none; background: var(--panel); color: var(--text); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 6px 10px; box-shadow: 0 6px 20px rgba(0,0,0,.14); font-size: .85em; display: flex; flex-direction: column; gap: 2px; }
.viz-tip[hidden] { display: none; }
@media (max-width: 800px) { .viz-grid { grid-template-columns: minmax(0, 1fr); } }
/* report builder */
.builder { margin-bottom: var(--gap); display: flex; flex-direction: column; gap: 12px; }
.builder-row { display: grid; grid-template-columns: 90px minmax(0, 1fr); gap: 10px; align-items: center; }
.builder-row.top { align-items: start; } .builder-row.top .b-label { padding-top: 7px; }
.builder-row > select { width: auto; } .builder-row:first-child { display: flex; flex-wrap: wrap; }
.builder-row:first-child .b-label { width: 90px; }
.b-label { font-weight: 600; font-size: .9em; }
.b-body { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.b-inline { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.b-inline label { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: .9em; }
.b-inline select, .measure select { width: auto; max-width: 100%; }
.builder .rules .rule { margin-bottom: 0; } .rule .remove-rule { justify-self: start; } .builder .rules { display: flex; flex-direction: column; gap: 6px; }
.then { color: var(--muted); font-size: .9em; }
.measures { display: flex; flex-wrap: wrap; gap: 6px; } .measure { display: inline-flex; gap: 4px; align-items: center; }
.builder-actions { display: flex; gap: 8px; align-items: flex-start; flex-wrap: wrap; border-top: 1px solid var(--line); padding-top: 12px; }
.save-report { position: relative; } .save-report > summary { list-style: none; }
.save-report .save-box { min-width: 280px; display: flex; flex-direction: column; gap: 8px; }
.report-result { margin-bottom: var(--gap); } .report-chart { margin-bottom: var(--gap); max-width: 900px; }
.report-result .table-wrap.flat { border: 0; border-top: 1px solid var(--line); border-radius: 0; margin: 0 calc(var(--pad) * -1); }
.report-table th:first-child, .report-table td:first-child { padding-inline-start: var(--pad); }
.report-table th[data-sort] { cursor: pointer; user-select: none; }
.report-table th[data-dir="asc"]::after { content: " ↑"; } .report-table th[data-dir="desc"]::after { content: " ↓"; }
.report-table tfoot td { font-weight: 600; border-top: 2px solid var(--line); border-bottom: 0; }
.report-table td.num, .report-table th.num { text-align: end; font-variant-numeric: tabular-nums; }
@media (max-width: 800px) { .builder-row { grid-template-columns: minmax(0, 1fr); } }
/* embedded Metabase dashboards */
.report-frame { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.report-frame iframe { display: block; width: 100%; height: calc(100vh - 210px); min-height: 520px; border: 0; }
.report-note { font-size: .85em; margin-top: 8px; }
.howto { margin: 0 0 var(--gap); padding-inline-start: 20px; } .howto li { margin-bottom: 6px; }
.dash-table td { white-space: normal; height: auto; padding-block: 6px; } .dash-table input, .dash-table select { min-width: 120px; }
td.row-actions { display: flex; gap: 6px; align-items: center; } td.row-actions form { margin: 0; }
.record-form label[hidden] { display: none; }
.convert-report { border: 1px solid var(--line); border-inline-start: 4px solid var(--accent); border-radius: var(--radius); padding: var(--pad); margin-bottom: var(--gap); }
.convert-report h2 { margin-bottom: 6px; } .convert-report .bad { color: var(--danger); }
.convert-report .samples { margin: 0 0 var(--gap); max-height: 220px; overflow: auto; font-size: .9em; }
.on-fail { border: 0; padding: 0; margin: 0 0 var(--gap); } .on-fail legend { font-weight: 600; margin-bottom: 6px; }
.on-fail label { margin-bottom: 4px; }
table.kpi tbody tr { cursor: default; } table.kpi tr.avg td { color: var(--muted); font-style: italic; }

/* follow-ups & studies */
.task { display: flex; justify-content: space-between; gap: var(--gap); padding: 8px 0; border-bottom: 1px solid var(--line); }
.task:last-child { border-bottom: 0; }
.task-main { min-width: 0; } .task-main b { display: block; } .task-notes { margin: 4px 0 0; color: var(--muted); white-space: pre-wrap; font-size: .92em; }
.task.overdue .task-main small { color: var(--danger); } .task.done b { text-decoration: line-through; color: var(--muted); }
.task-actions { display: flex; gap: 6px; align-items: flex-start; } .task-actions form { margin: 0; }
.stat.alert { border-inline-start-color: var(--danger); } .stat.alert b { color: var(--danger); }
.study-card { display: block; margin-bottom: var(--gap); color: inherit; } .study-card:hover { text-decoration: none; border-color: var(--primary); }
.bar { height: 6px; background: var(--line); border-radius: 3px; margin-top: 8px; overflow: hidden; } .bar span { display: block; height: 100%; background: var(--accent); }
.targets { display: grid; gap: var(--gap); grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); }
.target.excluded { opacity: .5; } .target-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; } .target p { margin: 6px 0; }
.target-meta { display: flex; flex-direction: column; gap: 6px; margin: 8px 0; }
.tag.prog-new { background: var(--line); } .tag.prog-contacted { background: #dbe7ff; color: #1b3a8a; }
.tag.prog-interested { background: #fff1c2; color: #7a5a00; } .tag.prog-quoted { background: #ffe0c2; color: #8a4500; }
.tag.prog-won { background: #d4f5c4; color: #1f6a10; } .tag.prog-lost, .tag.prog-not_relevant { background: #f3d6d6; color: #8a1f1f; }
.sticky-actions { position: sticky; bottom: 0; background: var(--bg); padding: var(--pad) 0; }
.rule.step { grid-template-columns: 2fr 1fr 1fr; }
.add-task { margin: 8px 0 var(--gap); } .task-form { margin-top: 8px; }
select.small-select { width: auto; padding: 3px 8px; }
span.danger { color: var(--danger); }
.possible { color: #8a5a00; }
