/* CRM styles (the header, Menu and bars are the shared command chrome: shared/chrome.css). */
:root {
  --chart-surface: #fcfcfb;
  --chart-ink-2: #52514e;
  --chart-muted: #898781;
}
#app { background: var(--page); }
#main { background: var(--page); }

/* ---------- header extras: record search and the user button (row 1 of the chrome) ---------- */
.avatar { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; border-radius: 50%; color: #fff; font-size: 10px; font-weight: 600; flex: none; letter-spacing: .02em; }
.avatar.lg { width: 32px; height: 32px; font-size: 13px; }
/* the company name in row 1 is read-only (kit.css styles #doc-title as an editable title) */
.cmd-header .cmd-context#doc-title:hover { border-color: transparent; }
/* the Table / Kanban switch on the top bar */
.crm-mode { display: inline-flex; align-items: center; gap: 1px; flex: none; }

/* ---------- object tabs (quiet text tabs, accent underline) & banner ---------- */
#crm-main { flex: 1; min-height: 0; overflow: auto; padding: 20px 24px 32px; outline: none; }

/* ---------- common ---------- */
.page { max-width: 1480px; margin: 0 auto; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; margin-bottom: 16px; min-width: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 16px 8px; }
.card-head h2 { margin: 0; font-size: 16px; font-weight: 500; display: flex; align-items: center; gap: 6px; }
.card-foot { padding: 8px 16px 12px; border-top: 1px solid var(--line-soft); }
.pad { padding: 12px 16px; }
.pad-card { padding: 16px 20px; }
.pad-card h2 { margin: 0 0 8px; font-size: 16px; font-weight: 500; display: flex; align-items: center; gap: 6px; }
.row-gap { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.obj-ico { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 6px; color: #fff; flex: none; }
.obj-ico .material-symbols-outlined { font-size: 18px; }
.obj-ico.sm { width: 20px; height: 20px; border-radius: 4px; }
.obj-ico.sm .material-symbols-outlined { font-size: 14px; }
.obj-ico.lg { width: 40px; height: 40px; border-radius: 8px; }
.obj-ico.lg .material-symbols-outlined { font-size: 24px; }
.obj-ico.xl { width: 64px; height: 64px; border-radius: 14px; }
.obj-ico.xl .material-symbols-outlined { font-size: 36px; }
.badge { display: inline-flex; align-items: center; gap: 2px; font-size: 11px; font-weight: 500; padding: 1px 8px; border-radius: 10px; background: var(--line); color: var(--text-2); white-space: nowrap; }
.badge .material-symbols-outlined { font-size: 14px; }
.badge.warn { background: #fce8e6; color: #a50e0e; }
.chip { display: inline-flex; align-items: center; gap: 2px; background: #e8f0fe; color: #174ea6; border-radius: 16px; padding: 0 2px 0 12px; font-size: 13px; }
.chip .icon-btn { width: 26px; height: 26px; color: var(--info); }
.chip .icon-btn .material-symbols-outlined { font-size: 16px; }
.rec-link, .ref-link, .ext-link { color: var(--accent); text-decoration: none; }
.rec-link:hover, .ref-link:hover, .ext-link:hover { text-decoration: underline; }
.rec-link { font-weight: 500; }
.user-cell { display: inline-flex; align-items: center; gap: 6px; min-width: 0; }
.multiline { white-space: pre-wrap; overflow-wrap: anywhere; }
.oneline { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; max-width: 320px; }
.chk-ic { font-size: 18px; color: var(--faint); }
.chk-ic.on { color: var(--accent); }
.icon-btn.on { background: var(--accent-soft); color: #041e49; }
.btn.on { background: var(--accent-soft); border-color: var(--accent-soft); }
.btn:disabled { opacity: .5; cursor: default; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 18px; overflow: hidden; background: var(--surface); flex: none; }
.seg .icon-btn { border-radius: 0; width: 38px; height: 34px; }
.seg-text button { border: 0; background: var(--surface); padding: 7px 14px; font-size: 13px; cursor: pointer; white-space: nowrap; }
.seg-text button + button, .seg .icon-btn + .icon-btn { border-left: 1px solid var(--line); }
.seg-text button:hover { background: var(--hover); }
.seg-text button.on { background: var(--accent-soft); color: var(--accent-strong); font-weight: 500; }
.tabs-line { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; scrollbar-width: none; }
.tabs-line .tab { display: inline-flex; align-items: center; gap: 6px; padding: 10px 14px; border: 0; background: none; color: var(--muted); text-decoration: none; font-size: 14px; border-bottom: 3px solid transparent; cursor: pointer; white-space: nowrap; }
.tabs-line .tab:hover { color: var(--text); background: var(--sunk); }
.tabs-line .tab.on { color: var(--accent); border-bottom-color: var(--accent); font-weight: 500; }
.tab-n { font-size: 11px; background: var(--line); color: var(--text-2); border-radius: 10px; padding: 0 7px; font-weight: 500; }
.tab.on .tab-n { background: var(--accent-soft); color: #041e49; }
.muted.pad { display: block; }
code { font: 12px Consolas, monospace; background: var(--hover); padding: 1px 5px; border-radius: 3px; }

/* ---------- tables ---------- */
.crm-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
.crm-table th { position: sticky; top: 0; z-index: 1; background: var(--panel); color: var(--text-2); font-weight: 500; text-align: left; padding: 0 10px; height: 36px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.crm-table td { padding: 0 10px; height: 38px; border-bottom: 1px solid var(--line-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 320px; }
.crm-table tbody tr:hover td { background: var(--hover); }
.crm-table tr.sel td { background: var(--sel-soft); }
.crm-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.crm-table .c-sel { width: 36px; padding-right: 0; }
.crm-table .c-num { width: 40px; color: var(--muted); font-variant-numeric: tabular-nums; text-align: right; padding-left: 0; }
.crm-table .c-act { width: 40px; text-align: right; padding: 0 4px; }
.crm-table .nowrap { white-space: nowrap; width: auto; }
.crm-table tr.spacer td, .crm-table tr.spacer:hover td { padding: 0; border: 0; height: auto; background: none; }
.crm-table td.editable:hover { box-shadow: inset 0 0 0 1px #c4c7c5; cursor: text; }
.crm-table td.editing { padding: 2px 4px; overflow: visible; }
.crm-table td.editing .inp { padding: 4px 6px; }
.crm-table.crm-mini td { height: 32px; }
.th-btn { border: 0; background: none; font: inherit; color: inherit; font-weight: 500; cursor: pointer; display: inline-flex; align-items: center; gap: 2px; padding: 0; }
.th-btn:disabled { cursor: default; }
.num .th-btn { flex-direction: row-reverse; }
.sort-ic { font-size: 15px; color: var(--accent); }
.tbl-card { overflow: hidden; }
.tbl-card .crm-table th { position: static; }
.tbl-scroll { overflow-x: auto; }
.rel-table td { height: 34px; }

/* ---------- list view ---------- */
.list-page { display: flex; flex-direction: column; height: 100%; min-height: 460px; }
.list-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.lh-title { display: flex; align-items: center; gap: 12px; min-width: 0; }
.lh-obj { font-size: 22px; font-weight: 500; }
.list-page .lh-obj { font-size: 12px; font-weight: 400; color: var(--muted); }
.lh-view { border: 0; background: none; font: inherit; font-size: 20px; font-weight: 500; padding: 2px 4px 2px 0; margin-left: -1px; cursor: pointer; display: inline-flex; align-items: center; border-radius: 6px; color: var(--text); }
.lh-view:hover { background: var(--hover); }
.lh-crumb { font-size: 12px; color: var(--accent); text-decoration: none; }
.lh-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.list-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.lb-info { flex: 1; min-width: 200px; font-size: 12px; color: var(--muted); }
.lb-mod { display: inline-flex; align-items: center; gap: 2px; font-size: 12px; color: #7a4f01; background: #fef7e0; border-radius: 14px; padding: 0 4px 0 12px; }
.lb-right { display: flex; align-items: center; gap: 8px; }
.lb-search { width: 240px; border-radius: 18px; padding: 6px 12px; }
.bulk-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; background: #e8f0fe; border-radius: 10px; padding: 6px 10px; margin-bottom: 10px; }
.bulk-bar .btn { padding: 4px 12px; font-size: 13px; }
.bulk-n { font-weight: 500; margin-right: 6px; color: var(--info); }
.list-body { flex: 1; min-height: 0; display: flex; gap: 12px; }
.list-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.tbl-wrap { flex: 1; min-height: 240px; overflow: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
.filter-panel { width: 340px; flex: none; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; overflow: auto; display: flex; flex-direction: column; gap: 12px; }
.fp-title { margin: 0; font-size: 15px; font-weight: 500; }
.fp-foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: auto; padding-top: 8px; }
.flt-editor { display: flex; flex-direction: column; gap: 8px; }
.flt-list { display: flex; flex-direction: column; gap: 8px; }
.flt-row { display: flex; flex-direction: column; gap: 6px; padding: 10px; background: var(--bg); border: 1px solid var(--line-soft); border-radius: 8px; }
.flt-top { display: flex; gap: 4px; align-items: center; }
.flt-top select { flex: 1; min-width: 0; }
.flt-row .inp { padding: 5px 8px; font-size: 13px; }
.flt-checks { display: flex; flex-direction: column; gap: 2px; max-height: 150px; overflow: auto; padding: 2px; }
.flt-checks label.inline { margin: 0; }
.flt-add { align-self: flex-start; display: inline-flex; align-items: center; gap: 2px; }
.flt-empty { padding: 4px 0; }
.cols-dlg { display: flex; flex-direction: column; gap: 10px; }
.cols-list { display: flex; flex-direction: column; border: 1px solid var(--line-soft); border-radius: 8px; max-height: 320px; overflow: auto; }
.cols-row { display: flex; align-items: center; gap: 2px; padding: 2px 6px 2px 12px; border-bottom: 1px solid var(--line-soft); }
.cols-row:last-child { border-bottom: 0; }
.cols-name { flex: 1; font-size: 14px; }

/* ---------- kanban ---------- */
.kanban { flex: 1; min-height: 300px; display: flex; gap: 12px; overflow-x: auto; padding-bottom: 8px; align-items: flex-start; }
.kb-col { flex: 0 0 272px; background: var(--line-soft); border-radius: 12px; display: flex; flex-direction: column; max-height: 100%; border: 2px solid transparent; }
.kb-col.drop { border-color: var(--accent); background: #dfe9fb; }
.kb-head { padding: 10px 12px 6px; }
.kb-name { font-weight: 500; font-size: 14px; }
.kb-sub { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.kb-lane { display: flex; flex-direction: column; gap: 8px; padding: 4px 8px 10px; overflow-y: auto; min-height: 60px; }
.kb-card { background: var(--surface); border-radius: 8px; padding: 10px 12px; box-shadow: 0 1px 2px rgba(60, 64, 67, .2); cursor: grab; display: flex; flex-direction: column; gap: 3px; }
.kb-card:hover { box-shadow: 0 2px 6px rgba(60, 64, 67, .25); }
.kb-card.dragging { opacity: .5; }
.kb-title { font-weight: 500; color: var(--accent); text-decoration: none; font-size: 14px; }
.kb-title:hover { text-decoration: underline; }
.kb-line { font-size: 12px; color: var(--text-2); }
.kb-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 4px; }
.kb-warn { display: inline-flex; align-items: center; gap: 2px; font-size: 11px; color: var(--danger); }
.kb-warn .material-symbols-outlined { font-size: 14px; }

/* ---------- record page ---------- */
.rec-head { padding: 14px 16px; }
.rh-top { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.rh-titles { flex: 1; min-width: 200px; }
.rh-obj { font-size: 12px; color: var(--muted); }
.rh-name { margin: 0; font-size: 22px; font-weight: 500; overflow-wrap: anywhere; }
.rh-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.rh-actions .btn { padding: 5px 12px; font-size: 13px; }
.rh-compact { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px 20px; margin: 14px 0 0; padding-top: 12px; border-top: 1px solid var(--line-soft); }
.rh-item { min-width: 0; }
.rh-item dt { font-size: 12px; color: var(--muted); }
.rh-item dd { margin: 2px 0 0; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-height: 20px; }
.rh-note { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 10px; background: #e6f4ea; color: #0d652d; padding: 8px 12px; border-radius: 8px; font-size: 13px; }
.path-card { padding: 12px 16px; }
.path-row { display: flex; align-items: center; gap: 12px; }
.path { display: flex; list-style: none; margin: 0; padding: 0; flex: 1; min-width: 0; gap: 3px; }
.path-step { flex: 1 1 0; min-width: 34px; }
.path-btn { width: 100%; height: 34px; border: 0; background: var(--line-soft); color: var(--text-2); display: flex; align-items: center; justify-content: center; gap: 2px; padding: 0 12px 0 20px; font: inherit; font-size: 13px; cursor: pointer;
  clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 50%, calc(100% - 12px) 100%, 0 100%, 12px 50%); }
.path-step:first-child .path-btn { clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 50%, calc(100% - 12px) 100%, 0 100%); border-radius: 17px 0 0 17px; padding-left: 12px; }
.path-step:last-child .path-btn { clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%, 12px 50%); border-radius: 0 17px 17px 0; }
.path-btn .material-symbols-outlined { font-size: 16px; flex: none; }
.path-lbl { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.path-btn:hover { background: var(--line); }
.path-step.done .path-btn { background: #cde8d6; color: #0d652d; }
.path-step.done .path-lbl { display: none; }
.path-step.done:hover .path-lbl { display: inline; }
.path-step.current .path-btn { background: var(--accent); color: #fff; font-weight: 500; }
.path-step.current.won .path-btn { background: #188038; }
.path-step.current.lost .path-btn { background: #b3261e; }
.path-step.selected .path-btn { background: #d3e3fd; color: #041e49; box-shadow: inset 0 -3px 0 var(--accent); }
.path-row > .btn { flex: none; }
.path-guide { display: flex; align-items: center; gap: 6px; margin-top: 10px; font-size: 13px; color: var(--text-2); }
.path-guide .material-symbols-outlined { font-size: 18px; color: var(--muted); }
.rec-body { display: grid; grid-template-columns: minmax(0, 1fr) minmax(320px, 400px); gap: 16px; align-items: start; }
.rec-main, .rec-side { min-width: 0; }
.det-body { padding: 0 16px 12px; }
.det-sec { font-size: 13px; font-weight: 500; margin: 12px 0 4px; padding: 6px 10px; background: var(--sunk); border-radius: 6px; color: var(--text-2); }
.det-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 24px; margin: 0; }
.det-cell { padding: 6px 2px; border-bottom: 1px solid var(--line-soft); min-width: 0; }
.det-cell.wide { grid-column: 1 / -1; }
.det-cell dt { font-size: 12px; color: var(--muted); }
.det-cell dd { margin: 2px 0 0; display: flex; align-items: flex-start; justify-content: space-between; gap: 6px; min-height: 22px; font-size: 14px; }
.det-cell dd > :first-child { min-width: 0; overflow-wrap: anywhere; }
.det-pen { width: 26px; height: 26px; opacity: 0; margin: -3px -4px 0 0; }
.det-pen .material-symbols-outlined { font-size: 16px; }
.det-cell:hover .det-pen, .det-pen:focus-visible { opacity: 1; }
.det-save { position: sticky; bottom: 0; display: flex; justify-content: center; gap: 8px; padding: 12px; margin: 12px -16px -12px; background: var(--bg); border-top: 1px solid var(--line); border-radius: 0 0 12px 12px; }
.addr { display: flex; flex-direction: column; }
.map-link { display: inline-flex; align-items: center; gap: 2px; font-size: 12px; margin-top: 2px; }
.map-link .material-symbols-outlined { font-size: 15px; }
.parent-list { display: flex; flex-direction: column; padding: 0 8px 10px; }
.parent-row { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 8px; text-decoration: none; color: var(--text); }
.parent-row:hover { background: var(--sunk); }
.pr-name { color: var(--accent); font-weight: 500; }

/* activity */
.act-tabs { display: flex; gap: 4px; padding: 0 12px; flex-wrap: wrap; }
.act-tab { display: inline-flex; align-items: center; gap: 4px; border: 1px solid var(--line); background: var(--surface); border-radius: 16px; padding: 4px 10px; font-size: 12px; cursor: pointer; color: var(--text-2); }
.act-tab .material-symbols-outlined { font-size: 16px; }
.act-tab:hover { background: var(--hover); }
.act-tab.on { background: var(--accent-soft); border-color: var(--accent-soft); color: #041e49; font-weight: 500; }
.act-panel { padding: 10px 12px 4px; }
.act-form { display: flex; flex-direction: column; gap: 8px; }
.act-form textarea { resize: vertical; font: inherit; }
.act-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.act-row .field:last-child:nth-child(3) { grid-column: 1 / -1; }
.act-form .inp { padding: 6px 8px; font-size: 13px; }
.act-save { align-self: flex-end; padding: 5px 16px; }
.timeline { padding: 4px 12px 14px; }
.tl-head { font-size: 12px; font-weight: 500; color: var(--text-2); margin: 14px 0 6px; padding-bottom: 4px; border-bottom: 1px solid var(--line-soft); text-transform: none; }
.tl-empty { margin: 4px 0; }
.tl-item { display: flex; gap: 10px; padding: 6px 0; position: relative; }
.tl-ico { width: 28px; height: 28px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; color: #fff; flex: none; }
.tl-ico .material-symbols-outlined { font-size: 16px; }
.tl-call .tl-ico { background: #48c3cc; }
.tl-email .tl-ico { background: #95aec5; }
.tl-task .tl-ico { background: #4bc076; }
.tl-event .tl-ico { background: #eb7092; }
.tl-note .tl-ico { background: #d4b93c; }
.tl-body { flex: 1; min-width: 0; }
.tl-top { display: flex; align-items: center; gap: 6px; }
.tl-top input { margin: 0; }
.tl-title { flex: 1; min-width: 0; color: var(--accent); text-decoration: none; font-weight: 500; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tl-title:hover { text-decoration: underline; }
.tl-date { font-size: 12px; color: var(--muted); white-space: nowrap; }
.tl-date.overdue, .ml-date.overdue { color: var(--danger); font-weight: 500; }
.tl-meta { font-size: 12px; color: var(--muted); }
.tl-desc { font-size: 13px; color: var(--text-2); margin-top: 4px; white-space: pre-wrap; background: var(--bg); border-radius: 6px; padding: 6px 8px; }
.tl-desc.clamp { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; cursor: pointer; }

/* ---------- forms ---------- */
.rec-form { display: flex; flex-direction: column; }
.rf-sec { font-size: 13px; font-weight: 500; margin: 14px 0 8px; padding: 6px 10px; background: var(--sunk); border-radius: 6px; color: var(--text-2); }
.rf-sec:first-of-type { margin-top: 4px; }
.rf-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 20px; }
.rf-grid .wide { grid-column: 1 / -1; }
.rf-cell { min-width: 0; }
.rf-name { display: grid; grid-template-columns: 110px 1fr 1fr; gap: 10px; }
.rf-name > .rf-cell:first-child:nth-last-child(2) { grid-column: span 1; }
.rf-addr { border: 1px solid var(--line-soft); border-radius: 8px; padding: 6px 12px 12px; margin: 0; }
.rf-addr legend { padding: 0 4px; }
.rf-err { color: var(--danger); font-size: 12px; min-height: 0; }
.rf-err:empty { display: none; }
.inp.invalid, .invalid .inp { border-color: var(--danger); }
abbr.req { color: var(--danger); text-decoration: none; margin-right: 2px; }
textarea.inp { resize: vertical; font: inherit; }
.chk { padding: 6px 0; }
.dup-box { background: #fef7e0; border: 1px solid #f9e0a3; border-radius: 8px; padding: 10px 12px; margin-bottom: 8px; display: flex; flex-direction: column; gap: 4px; }
.dup-title { display: flex; align-items: center; gap: 6px; font-size: 13px; color: #7a4f01; }
.dup-item { display: flex; align-items: center; gap: 6px; text-decoration: none; color: var(--accent); font-size: 13px; }
.lk { display: flex; gap: 6px; min-width: 0; }
.lk.disabled { opacity: .5; pointer-events: none; }
.lk-obj { width: 130px; flex: none; }
.lk-box { flex: 1; min-width: 0; position: relative; }
.lk-pill { display: flex; align-items: center; gap: 6px; border: 1px solid var(--line-strong); border-radius: 4px; padding: 3px 4px 3px 8px; background: var(--sunk); min-height: 36px; }
.lk-pill .lk-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lk-x { width: 26px; height: 26px; }
.lk-x .material-symbols-outlined { font-size: 16px; }
.lk-drop { position: fixed; z-index: 1300; background: var(--surface); border-radius: 8px; box-shadow: 0 4px 16px rgba(0, 0, 0, .2); padding: 4px 0; max-height: 320px; overflow: auto; }
.lk-opt { display: flex; align-items: center; gap: 10px; padding: 6px 12px; cursor: pointer; }
.lk-opt.hi, .lk-opt:hover { background: var(--sunk); }
.lk-txt { min-width: 0; }
.lk-txt .lk-name { font-size: 14px; }
.lk-sub { font-size: 12px; color: var(--muted); }
.lk-empty { padding: 8px 12px; color: var(--muted); font-size: 13px; }
.lk-new { color: var(--accent); border-top: 1px solid var(--line-soft); font-size: 13px; }
.convert { display: flex; flex-direction: column; gap: 12px; }
.cv-box { border: 1px solid var(--line-soft); border-radius: 10px; padding: 8px 12px 12px; display: flex; flex-direction: column; gap: 6px; }
.cv-head { margin: 0; font-size: 14px; font-weight: 500; display: flex; align-items: center; gap: 6px; }
.cv-radio { margin-top: 2px; }
.cv-misc { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.conv-list { list-style: none; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.conv-list li { display: flex; align-items: center; gap: 6px; }

/* ---------- home ---------- */
.home-head h1 { margin: 0; font-size: 24px; font-weight: 400; }
.home-head p { margin: 4px 0 14px; font-size: 13px; }
.filter-row { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.fr-field { display: inline-flex; align-items: center; gap: 8px; }
.fr-select { width: auto; padding: 6px 10px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin-bottom: 16px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; text-decoration: none; color: var(--text); display: flex; flex-direction: column; gap: 4px; min-width: 0; }
a.tile:hover { border-color: #aecbfa; }
.tile.hero { grid-column: span 2; background: var(--surface); }
.tile-label { font-size: 13px; color: var(--muted); }
.tile-value { font-size: 28px; font-weight: 500; line-height: 1.15; letter-spacing: -.01em; }
.tile.hero .tile-value { font-size: 48px; }
.tile-sub { font-size: 12px; color: var(--muted); }
.tile-delta { display: inline-flex; align-items: center; gap: 2px; font-size: 12px; font-weight: 500; }
.tile-delta .material-symbols-outlined { font-size: 15px; }
.tile-delta.good { color: var(--ok); }
.tile-delta.bad { color: var(--danger); }
.home-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.home-grid > .card { margin: 0; }
.chart-card .card-head { align-items: flex-start; }
.chart-body { padding: 4px 16px 14px; }
.chart-host { min-height: 120px; }
.list-card { display: flex; flex-direction: column; }
.mini-list { list-style: none; margin: 0; padding: 0 8px 6px; flex: 1; }
.ml-item { display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: 8px; }
.ml-item:hover { background: var(--bg); }
.ml-item input { margin: 0; }
.ml-text { flex: 1; min-width: 0; }
.ml-text .muted { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ml-title { color: var(--text); text-decoration: none; font-size: 14px; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ml-title:hover { color: var(--accent); text-decoration: underline; }
.ml-title.done { text-decoration: line-through; color: var(--muted); }
.ml-date { font-size: 12px; color: var(--muted); white-space: nowrap; }
.ml-amt { font-size: 13px; font-weight: 500; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ml-cal { display: flex; flex-direction: column; align-items: center; width: 40px; flex: none; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.ml-cal-m { font-size: 10px; text-transform: uppercase; background: #eb7092; color: #fff; width: 100%; text-align: center; font-weight: 600; }
.ml-cal-d { font-size: 16px; font-weight: 500; padding: 1px 0; }


/* ---------- reports ---------- */
.report-page .lh-title { flex: 1; }
.report-page .lh-title > div { flex: 1; min-width: 0; }
.rp-name { font: inherit; font-size: 20px; font-weight: 500; border: 1px solid transparent; border-radius: 6px; padding: 1px 6px; margin-left: -7px; background: transparent; width: 100%; max-width: 680px; color: var(--text); }
.rp-name:hover { border-color: var(--line); }
.rp-name:focus { outline: none; border-color: var(--accent); background: var(--surface); }
.rp-body { display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: 16px; align-items: start; }
.rp-builder { padding: 12px 14px; display: flex; flex-direction: column; gap: 14px; position: sticky; top: 0; max-height: calc(100vh - 250px); overflow: auto; margin: 0; }
.rp-builder[hidden] { display: none !important; }
.rp-body:has(.rp-builder[hidden]) { grid-template-columns: minmax(0, 1fr); }
.rp-sec { display: flex; flex-direction: column; gap: 6px; }
.rp-sec-label { font-size: 12px; font-weight: 500; color: var(--text-2); }
.rp-sec .inp, .rp-sec select { font-size: 13px; padding: 6px 8px; }
.rp-results { min-width: 0; }
.rp-summary { display: flex; align-items: flex-end; gap: 24px; flex-wrap: wrap; margin-bottom: 14px; }
.rp-stat-v { font-size: 26px; font-weight: 500; }
.rp-filters { flex: 1; min-width: 200px; }
.rp-results .chart-card { padding: 14px 16px; }
.rp-table tr.clickable { cursor: pointer; }
.rp-table tr.subtotal td { background: var(--bg); font-weight: 500; }
.rp-table tr.total td { background: #eef3fd; font-weight: 600; border-bottom: 0; }
.rp-table tr.grp-first td:first-child { font-weight: 500; }
.rp-details .card-head { justify-content: flex-start; }

/* ---------- activities & calendar ---------- */
.act-grid { display: grid; grid-template-columns: minmax(300px, 400px) minmax(0, 1fr); gap: 16px; align-items: start; }
.task-card .tabs-line { margin: 0; padding: 0 8px; }
.task-list { max-height: calc(100vh - 320px); overflow: auto; padding-top: 6px; }
.cal-card { padding: 12px 14px 14px; }
.cal-head { display: flex; align-items: center; gap: 6px; margin-bottom: 10px; }
.cal-head h2 { margin: 0 8px 0 4px; font-size: 18px; font-weight: 500; flex: 1; }
.cal-head .btn { padding: 4px 14px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-top: 1px solid var(--line-soft); border-left: 1px solid var(--line-soft); }
.cal-dow { font-size: 11px; font-weight: 500; text-transform: uppercase; color: var(--muted); padding: 6px 8px; border-right: 1px solid var(--line-soft); border-bottom: 1px solid var(--line-soft); background: var(--bg); }
.cal-day { min-height: 104px; border-right: 1px solid var(--line-soft); border-bottom: 1px solid var(--line-soft); padding: 4px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.cal-day.out { background: var(--bg); }
.cal-day.out .cal-num { color: var(--faint); }
.cal-num { font-size: 12px; font-weight: 500; width: 24px; height: 24px; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; }
.cal-day.today .cal-num { background: var(--accent); color: #fff; }
.cal-chip { display: flex; align-items: center; gap: 4px; font-size: 12px; text-decoration: none; color: var(--text-2); border-radius: 4px; padding: 1px 4px; min-width: 0; }
.cal-chip.event { background: #fde7ef; color: #6d1333; }
.cal-chip.task { background: #e6f4ea; color: #0d652d; }
.cal-chip.task.done { opacity: .6; text-decoration: line-through; }
.cal-chip:hover { filter: brightness(.95); }
.cc-time { font-weight: 600; flex: none; font-variant-numeric: tabular-nums; }
.cc-ic { font-size: 13px; flex: none; }
.cc-sub { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-more { border: 0; background: none; color: var(--accent); font-size: 12px; text-align: left; cursor: pointer; padding: 0 4px; }
.cal-pop { display: flex; flex-direction: column; gap: 3px; min-width: 220px; }
.cal-pop-h { font-weight: 500; margin-bottom: 4px; }

/* ---------- setup, bin, search ---------- */
.setup-bar { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.setup-bar .field { min-width: 200px; }
.form.narrow { max-width: 460px; }
.pl-table td { overflow: visible; }
.pl-table .inp { padding: 4px 8px; font-size: 13px; }
.num-inp { width: 80px; }
.pl-foot { display: flex; gap: 8px; margin: 12px 0 4px; }
.search-h { font-size: 20px; font-weight: 500; margin: 0 0 16px; }

/* ---------- import ---------- */
.imp-help summary { cursor: pointer; font-weight: 500; }
.imp-ways { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; margin-top: 12px; }
.imp-way { display: flex; gap: 10px; }
.imp-way > .material-symbols-outlined { color: var(--accent); font-size: 24px; }
.imp-way h3 { margin: 0 0 4px; font-size: 14px; font-weight: 500; }
.imp-way p { margin: 0; font-size: 13px; color: var(--text-2); line-height: 1.5; }
.dropzone { border: 2px dashed #aecbfa; border-radius: 16px; background: var(--surface); padding: 28px 16px; display: flex; flex-direction: column; align-items: center; gap: 10px; margin-bottom: 16px; text-align: center; }
.dropzone > .material-symbols-outlined { font-size: 40px; color: var(--accent); }
.dropzone.over { background: var(--accent-soft); border-color: var(--accent); }
.dz-t { font-size: 15px; }
.imp-status { color: var(--accent); font-weight: 500; }
.imp-table td { overflow: visible; white-space: normal; height: auto; padding: 8px 10px; vertical-align: top; }
.imp-table tr.dim td { color: var(--muted); }
.imp-table select { max-width: 220px; }
.imp-table td.c-act { width: auto; white-space: nowrap; }
.imp-file { font-weight: 500; overflow-wrap: anywhere; }
.imp-opts { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 24px; padding: 14px 16px; border-top: 1px solid var(--line-soft); }
.imp-opt { font-weight: 500; font-size: 14px; }
.imp-foot { display: flex; align-items: center; justify-content: flex-end; gap: 16px; padding: 12px 16px 16px; flex-wrap: wrap; }
.imp-result h2 .material-symbols-outlined { color: var(--ok); }
.imp-list { list-style: none; padding: 0; margin: 8px 0 12px; display: flex; flex-direction: column; gap: 6px; }
.imp-list li { display: flex; align-items: center; gap: 4px; }
.map-scroll { max-height: 56vh; }
.map-table td { white-space: normal; height: auto; padding: 6px 10px; vertical-align: top; overflow: visible; }
.map-table tr.dim td:not(:last-child) { color: var(--muted); }
.map-table select { width: 100%; }
.map-ex { font-size: 12px; color: var(--text-2); max-width: 260px; overflow-wrap: anywhere; }

/* ---------- confetti (toasts with Undo are the chrome's) ---------- */
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 4000; overflow: hidden; }
.confetti i { position: absolute; top: -16px; width: 8px; height: 14px; border-radius: 2px; animation: crm-fall 2.2s cubic-bezier(.25, .6, .5, 1) forwards; }
@keyframes crm-fall { to { top: 105%; transform: rotate(900deg) translateX(40px); } }

/* ---------- responsive ---------- */
@media (max-width: 1150px) {
  .rec-body { grid-template-columns: minmax(0, 1fr); }
  .rp-body { grid-template-columns: minmax(0, 1fr); }
  .rp-builder { position: static; max-height: none; }
}
@media (max-width: 960px) {
  .home-grid, .act-grid { grid-template-columns: minmax(0, 1fr); }
  .tile.hero { grid-column: 1 / -1; }
  .filter-panel { position: fixed; right: 12px; top: 140px; bottom: 12px; z-index: 800; box-shadow: var(--pop-shadow); width: min(340px, calc(100vw - 24px)); }
}
@media (max-width: 700px) {
  #crm-main { padding: 14px 16px 24px; }
  /* the search box is an icon until it is used; then it spans row 1 */
  .rf-grid, .det-grid, .cv-misc, .imp-opts, .act-row { grid-template-columns: 1fr; }
  .rf-name { grid-template-columns: 1fr; }
  .lb-search { width: 100%; }
  .lb-right { flex: 1; }
  .path-step:not(.current) .path-lbl { display: none; }
  .path-row { flex-wrap: wrap; }
  .cal-day { min-height: 64px; }
  .cc-sub { display: none; }
  .tile.hero .tile-value { font-size: 40px; }
}
