:root{
/* Surfaces */
--bg-canvas:#F8F6F1; --bg-surface:#FFFFFF; --bg-subtle:#EFECE5;
--topbar-bg:rgba(255,255,255,0.88); --topbar-border:rgba(0,0,0,0.08);
/* Type & lines */
--ink:#192426; --muted:#6C787B; --line:#DDD7CB; --line-subtle:#EBE6DC;
/* Brand */
--teal:#1F6F5C; --teal-deep:#154F41; --teal-text:#154F41; --on-teal:#FFFFFF;
--teal-subtle:rgba(31,111,92,0.08); --teal-glow:rgba(31,111,92,0.16);
--amber:#B8862B; --danger:#A6402F;
/* Text-on-tint colours used by pills / badges */
--amber-text:#8A6416; --blue-text:#2456B8; --purple-text:#6A44C8;
/* Shadows */
--card-shadow:0 1px 3px rgba(25,36,38,0.04), 0 1px 2px rgba(25,36,38,0.02);
--shadow-pop:0 4px 14px rgba(0,0,0,0.18); --shadow-nav:0 -4px 20px rgba(0,0,0,0.08);
/* Backwards-compatible aliases (everything already written against these keeps working) */
--paper:var(--bg-canvas); --paper-raised:var(--bg-surface);
/* Radius scale: controls 6, cards/rows 8, containers 10 */
--r-sm:6px; --r-md:8px; --r-lg:10px;
color-scheme:light;
}
[data-theme="dark"]{
--bg-canvas:#0F1416; --bg-surface:#171F22; --bg-subtle:#212C30;
--topbar-bg:rgba(18,25,28,0.85); --topbar-border:rgba(255,255,255,0.08);
--ink:#EAF0F1; --muted:#91A0A3; --line:#29363A; --line-subtle:#1F2A2E;
--teal:#2EB395; --teal-deep:#228B73; --teal-text:#5FD0B6; --on-teal:#08201A;
--teal-subtle:rgba(46,179,149,0.14); --teal-glow:rgba(46,179,149,0.28);
--amber:#D8A546; --danger:#E05745;
--amber-text:#E6BC68; --blue-text:#8DB5FF; --purple-text:#B9A2FF;
--card-shadow:0 2px 8px rgba(0,0,0,0.35);
--shadow-pop:0 6px 18px rgba(0,0,0,0.5); --shadow-nav:0 -4px 20px rgba(0,0,0,0.45);
color-scheme:dark;
}
*{box-sizing:border-box;}
body{margin:0;background:var(--bg-canvas);color:var(--ink);font-family:'Work Sans',sans-serif;font-size:14px;line-height:1.5;overflow-x:hidden;transition:background-color .2s ease,color .2s ease;}
h1,h2,h3{font-family:'Fraunces',serif;font-weight:500;margin:0;}
.topbar{background:var(--topbar-bg);-webkit-backdrop-filter:blur(14px) saturate(1.4);backdrop-filter:blur(14px) saturate(1.4);color:var(--ink);padding:0 32px;min-height:52px;display:flex;align-items:center;gap:4px;position:sticky;top:0;z-index:800;overflow:visible;border-bottom:1px solid var(--topbar-border);transition:background .2s ease,border-color .2s ease;}
.brand{font-family:'Fraunces',serif;font-size:17px;padding:12px 16px 12px 0;margin-right:8px;flex-shrink:0;border-right:1px solid var(--line);color:var(--ink);}
#brand-home{cursor:pointer;padding:12px 16px 12px 0;margin-right:8px;flex-shrink:0;border-right:1px solid var(--line);border-radius:0;color:var(--ink);font-size:17px;font-weight:500;}
#brand-home:hover{color:var(--ink);background:none;}
#brand-home.active{color:var(--teal-text);background:none;}
#brand-home svg{color:var(--teal);flex-shrink:0;}
.tab{padding:7px 12px;cursor:pointer;color:var(--muted);font-size:13px;font-weight:500;white-space:nowrap;border-radius:6px;display:flex;align-items:center;gap:7px;transition:color .15s ease,background .15s ease;}
.tab:hover{color:var(--ink);background:var(--bg-subtle);}
.tab.active{color:var(--teal-text);background:var(--teal-subtle);font-weight:600;}
.tab .cnt{font-size:10.5px;font-weight:600;color:var(--muted);background:var(--bg-subtle);padding:1px 6px;border-radius:8px;}
.tab.active .cnt{color:var(--teal-text);background:var(--teal-glow);}
.top-actions{margin-left:auto;display:flex;gap:10px;align-items:center;}
.top-btn{background:var(--teal);color:var(--paper-raised);border:none;padding:6px 12px;font-family:'Work Sans',sans-serif;font-size:12px;line-height:1.4;cursor:pointer;border-radius:var(--r-sm);display:inline-flex;align-items:center;box-sizing:border-box;}
.top-btn:hover{background:var(--teal-deep);}
.top-btn-alt{background:var(--muted);color:var(--paper-raised);border:none;padding:6px 12px;font-family:'Work Sans',sans-serif;font-size:12px;line-height:1.4;cursor:pointer;border-radius:var(--r-sm);display:inline-flex;align-items:center;box-sizing:border-box;}
.top-btn-alt:hover{filter:brightness(0.88);}
.main{padding:32px 40px 60px;max-width:1280px;margin:0 auto;}
.table-scroll{overflow-x:auto;-webkit-overflow-scrolling:touch;}
.table-scroll table{min-width:100%;}
.panel-head{display:flex;justify-content:space-between;align-items:flex-end;margin-bottom:20px;border-bottom:1px solid var(--line);padding-bottom:16px;gap:20px;flex-wrap:wrap;}
.panel-head h2{font-size:23px;}
.panel-head p{margin:5px 0 0;color:var(--muted);font-size:13px;max-width:480px;}
.head-right{display:flex;align-items:center;gap:14px;}

/* --- Two-tier panel head: title + actions on top, view tabs underneath --- */
.panel-head.two-tier{flex-direction:column;align-items:stretch;gap:12px;padding-bottom:10px;}
.panel-top-row{display:flex;justify-content:space-between;align-items:center;gap:16px;flex-wrap:wrap;width:100%;}
.panel-top-row h2{margin:0;font-size:23px;}
.view-tabs-bar{display:flex;align-items:center;gap:6px;overflow-x:auto;width:100%;padding-bottom:2px;-webkit-overflow-scrolling:touch;scrollbar-width:none;}
.view-tabs-bar::-webkit-scrollbar{display:none;}
.view-tab-btn{background:none;border:1px solid transparent;color:var(--muted);height:30px;padding:0 10px;font-size:12.5px;font-weight:500;border-radius:6px;cursor:pointer;display:inline-flex;align-items:center;gap:6px;transition:all .15s ease;white-space:nowrap;font-family:'Work Sans',sans-serif;flex-shrink:0;}
.view-tab-btn:hover{color:var(--ink);background:var(--bg-subtle);}
.view-tab-btn.active{background:var(--bg-surface);color:var(--teal-text);border-color:var(--line);font-weight:600;box-shadow:0 1px 3px rgba(0,0,0,0.05);}
.view-tab-btn svg{width:14px;height:14px;stroke:currentColor;stroke-width:1.6;fill:none;}
.view-tab-btn .badge-count{background:var(--bg-subtle);}
.view-tab-btn.active .badge-count{background:var(--teal-subtle);color:var(--teal-text);}
.view-tab-edit-trigger{display:inline-flex;align-items:center;justify-content:center;width:18px;height:18px;border-radius:4px;margin-left:2px;opacity:.55;color:var(--muted);transition:opacity .15s,background .15s,color .15s;}
.view-tab-btn:hover .view-tab-edit-trigger{opacity:.85;}
.view-tab-edit-trigger:hover{opacity:1;color:var(--teal-text);background:var(--bg-subtle);}
.view-tab-edit-trigger svg{width:11px;height:11px;stroke:currentColor;stroke-width:1.6;fill:none;}
.view-tab-btn.add-view{border:1px dashed var(--line);padding:0 8px;}
.view-tab-btn.add-view:hover{border-color:var(--teal);color:var(--teal-text);}
/* --- Modern Compact Header Toolbar --- */
.head-right-toolbar {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    background: transparent;
}
.toolbar-group {
    display: inline-flex;
    align-items: center;
    background: var(--paper-raised);
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 2px;
    gap: 2px;
}
.toolbar-btn {
    background: none;
    border: none;
    color: var(--muted);
    height: 30px;
    padding: 0 9px;
    font-size: 12px;
    font-weight: 500;
    border-radius:var(--r-sm);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.15s ease;
    white-space: nowrap;
}
.toolbar-btn:hover {
    color: var(--ink);
    background: var(--bg-subtle);
}
.toolbar-btn.active {
    background: var(--ink);
    color: var(--paper);
    box-shadow: 0 1px 3px rgba(0,0,0,0.12);
}
.toolbar-btn svg {
    width: 14px;
    height: 14px;
    stroke: currentColor;
    stroke-width: 1.6;
    fill: none;
}
.toolbar-btn.icon-only {
    width: 30px;
    padding: 0;
    justify-content: center;
}
.badge-count {
    font-size: 10px;
    font-weight: 600;
    padding: 1px 5px;
    border-radius: 10px;
    background: rgba(110,101,88,0.18);
    color: var(--muted);
    line-height: 1.2;
}
.toolbar-btn.active .badge-count {
    background: color-mix(in srgb, var(--paper) 22%, transparent);
    color: var(--paper);
}
.toolbar-btn.archive-active {
    background: rgba(166,64,47,0.12);
    color: var(--danger);
    border: 1px solid rgba(166,64,47,0.3);
}
.modern-add-btn {
    background: var(--teal);
    color: var(--paper-raised);
    border: none;
    height: 32px;
    padding: 0 14px;
    font-family: 'Work Sans', sans-serif;
    font-size: 12.5px;
    font-weight: 600;
    border-radius: 6px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 1px 2px rgba(20,31,34,0.15);
    transition: background 0.15s, transform 0.1s;
}
.modern-add-btn:hover {
    background: var(--teal-deep);
    transform: translateY(-1px);
}
.modern-add-btn svg {
    width: 14px;
    height: 14px;
    stroke: currentColor;
    stroke-width: 2.2;
}
.view-switch{display:flex;border:1px solid var(--line);border-radius:var(--r-sm);overflow:hidden;background:var(--paper-raised);}
.view-switch button{background:none;border:none;padding:7px 9px;cursor:pointer;color:var(--muted);display:flex;align-items:center;border-right:1px solid var(--line);}
.view-switch button:last-child{border-right:none;}
.view-switch button.active{background:var(--ink);color:var(--paper);}
.view-switch svg{width:15px;height:15px;}
.add-btn{background:var(--teal);color:var(--paper-raised);border:none;padding:9px 16px;font-family:'Work Sans',sans-serif;font-size:13px;line-height:1.4;cursor:pointer;border-radius:var(--r-sm);flex-shrink:0;display:inline-flex;align-items:center;box-sizing:border-box;}
.add-btn:hover{background:var(--teal-deep);}
label{display:block;font-size:11.5px;color:var(--muted);margin-bottom:4px;}
textarea{resize:vertical;min-height:44px;}
.btn-save{background:var(--ink);color:var(--paper);border:none;padding:9px 18px;font-size:13px;line-height:1.4;cursor:pointer;border-radius:var(--r-sm);display:inline-flex;align-items:center;box-sizing:border-box;}
.btn-cancel{background:none;border:1px solid var(--line);padding:9px 18px;font-size:13px;line-height:1.4;cursor:pointer;border-radius:var(--r-sm);color:var(--muted);display:inline-flex;align-items:center;box-sizing:border-box;}
table{width:100%;border-collapse:collapse;}
th{white-space:nowrap;vertical-align:middle;text-align:left;font-size:11px;letter-spacing:0.02em;color:var(--muted);font-weight:500;padding:8px 10px;border-bottom:1px solid var(--ink);}
th.sortable{cursor:pointer;user-select:none;-webkit-user-select:none;white-space:nowrap;}
th.sortable:hover{color:var(--ink);}
th.sortable .sort-ind{display:inline-block;font-size:9px;margin-left:5px;opacity:0;transition:opacity .12s;}
th.sortable:hover .sort-ind{opacity:.45;}
th.sortable.sorted{color:var(--ink);}
th.sortable.sorted .sort-ind{opacity:1;color:var(--teal);}
th.sortable:focus-visible{outline:2px solid var(--teal);outline-offset:-2px;}
@media (hover:none){ th.sortable .sort-ind{opacity:.35;} th.sortable.sorted .sort-ind{opacity:1;} }
/* Uniform, single-line table cells: truncate with an ellipsis (full text on hover), strict row height */
td{padding:6px 10px;border-bottom:1px solid var(--line);font-size:13px;vertical-align:middle;height:38px;white-space:nowrap;max-width:260px;overflow:hidden;text-overflow:ellipsis;}
td .tag-list{flex-wrap:nowrap !important;overflow:hidden;max-width:100%;}
td .select-pill, td .tag{flex-shrink:0;line-height:1.2;}
td .cell-note{font-size:11.5px;color:var(--muted);margin-left:6px;font-weight:normal;}
tr.clickable:hover td{background:rgba(31,111,92,0.05);}
tr.clickable{cursor:pointer;}
tr.done td { text-decoration: line-through; color: var(--muted); }
tr.done td.no-strike { text-decoration: none; }
tr.done td a { color: var(--muted); }
.tag{display:inline-block;font-size:11px;padding:2px 8px;border-radius:10px;background:rgba(31,111,92,0.12);color: var(--teal-text);}
.tag.sales{background:rgba(184,134,43,0.15);color:var(--amber-text);}
.tag.ops{background:rgba(166,64,47,0.13);color:var(--danger);}
/* Color Badge System for Select / Dropdown Fields */
.select-pill {
    display: inline-flex;
    align-items: center;
    font-size: 11px;
    font-weight: 500;
    padding: 2px 7px;
    border-radius: 4px;
    line-height: 1.25;
    white-space: nowrap;
    border: 1px solid transparent;
}
.pill-teal   { background: rgba(31,111,92,0.12); color: var(--teal-text); border-color: rgba(31,111,92,0.25); }
.pill-amber  { background: rgba(184,134,43,0.15); color: var(--amber-text); border-color: rgba(184,134,43,0.3); }
.pill-red    { background: rgba(166,64,47,0.12); color: var(--danger); border-color: rgba(166,64,47,0.25); }
.pill-blue   { background: rgba(59,130,246,0.12); color: var(--blue-text); border-color: rgba(59,130,246,0.25); }
.pill-purple { background: rgba(139,92,246,0.12); color: var(--purple-text); border-color: rgba(139,92,246,0.25); }
.pill-gray   { background: rgba(110,101,88,0.14); color: var(--muted); border-color: rgba(110,101,88,0.25); }
.acc-link{color: var(--teal-text);font-weight:500;cursor:pointer;text-decoration:underline;text-decoration-color:rgba(31,111,92,0.35); position:relative; z-index:10;}
/* --- Modern Form Controls --- */
input, select, textarea {
    width: 100%;
    font-family: 'Work Sans', sans-serif;
    font-size: 13px;
    padding: 8px 11px;
    border: 1px solid var(--line);
    background: var(--bg-surface);
    color: var(--ink);
    border-radius: 6px;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--teal);
    box-shadow: 0 0 0 3px rgba(31,111,92,0.12);
}

/* --- Modern Custom Select Dropdown UI --- */
select {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='%236E6558' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 8l4 4 4-4'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 14px;
    padding-right: 32px !important;
    cursor: pointer;
}

select:hover {
    border-color: var(--muted);
    background-color: var(--paper-raised);
}

/* Compact status/stage dropdowns inside cards & tables */
.status-select {
    font-size: 11.5px;
    font-weight: 500;
    padding: 4px 24px 4px 8px !important;
    border-radius:var(--r-sm);
    background-size: 11px;
    background-position: right 7px center;
    border: 1px solid var(--line);
    background-color: var(--bg-surface);
}
.status-select:hover {
    border-color: var(--teal);
    color: var(--teal-text);
}
/* Inline custom select fields in table cells */
.table-cf-select {
    max-width: 160px;
    height: 26px !important;
    min-height: 26px !important;
    padding: 2px 22px 2px 7px !important;
    font-size: 11.5px !important;
    font-weight: 500;
    border-radius:var(--r-sm);
    background-size: 10px;
    cursor: pointer;
}
.table-cf-select:hover { border-color: var(--teal); }

/* Quick stage jump selector at the bottom of Kanban cards */
.card-stage-jump {
    width: 100%;
    margin-top: 8px;
    font-size: 11px;
    padding: 4px 22px 4px 7px !important;
    color: var(--muted);
    background-color: var(--paper-raised);
    border: 1px solid var(--line);
    border-radius:var(--r-sm);
}
.card-stage-jump:hover {
    border-color: var(--teal);
    color: var(--ink);
    background-color: var(--bg-surface);
}
.card-stage-jump{width:100%;margin-top:8px;font-size:11px;padding:3px 5px;color:var(--muted);background:var(--paper-raised);border:1px solid var(--line);}
.card-stage-jump:hover{border-color:var(--teal);color:var(--ink);}
.del{background:none;border:none;color:var(--muted);cursor:pointer;font-size:12px;text-decoration:underline;}
.del:hover{color:var(--danger);}
.edit{background:none;border:none;color:var(--teal);cursor:pointer;font-size:12px;text-decoration:underline;margin-right:10px;}
.edit:hover{color: var(--teal-text);}
.empty{color:var(--muted);padding:20px 0;font-size:13px;}
/* Kanban */
.board{display:flex;gap:14px;overflow-x:auto;padding-bottom:12px;align-items:flex-start;}
.board-col{background:var(--paper-raised);border:1px solid var(--line);border-radius:var(--r-lg);width:230px;flex-shrink:0;min-height:120px;max-height:calc(100vh - 260px);display:flex;flex-direction:column;}
.board-col-head{padding:10px 12px;border-bottom:1px solid var(--line);font-size:12px;font-weight:500;display:flex;justify-content:space-between;align-items:center;color:var(--ink);flex-shrink:0;}
.board-col-head .n{color:var(--muted);font-weight:400;}
.board-col.dragover{background:rgba(31,111,92,0.08);}
.board-cards{padding:8px;display:flex;flex-direction:column;gap:8px;min-height:60px;overflow-y:auto;flex:1;}
.board-cards::-webkit-scrollbar{width:7px;}
.board-cards::-webkit-scrollbar-track{background:transparent;}
.board-cards::-webkit-scrollbar-thumb{background:var(--line);border-radius:10px;}
.board-cards::-webkit-scrollbar-thumb:hover{background:var(--muted);}
.add-col-btn{display:flex;justify-content:center;align-items:center;height:40px;border:2px dashed var(--line);border-radius:var(--r-md);color:var(--muted);cursor:pointer;background:transparent;font-size:12.5px;width:100%;flex-shrink:0;}
.add-col-btn:hover{border-color:var(--teal);color:var(--teal);background:rgba(31,111,92,0.04);}
.card{background:var(--bg-surface);border:1px solid var(--line);border-radius:var(--r-md);box-shadow:var(--card-shadow);padding:10px 12px;cursor:pointer;font-size:12.5px;position:relative;}
.card-age-corner{position:absolute; top:8px; right:8px;}
.card:hover{border-color:var(--teal);}
.card:active{cursor:grabbing;}
.card.dragging{opacity:0.4;}
.card.card-won{border-left:3px solid var(--teal) !important;}
.card.card-lost{opacity:0.72;background:var(--paper-raised) !important;border-style:dashed;}
.card.card-lost:hover{opacity:1;}
.card .card-title{font-weight:500;font-size:13px;margin-bottom:3px;padding-right:36px;}
.card .card-acc{color: var(--teal-text);font-size:11.5px;margin-bottom:5px;cursor:pointer;text-decoration:underline;text-decoration-color:rgba(31,111,92,0.3); display:inline-block;}
.card .card-meta{color:var(--muted);font-size:11px;margin-top:4px;}
.card-action-bar{float:right; display:flex; gap:6px;}
.card .card-del{font-size:10.5px;color:var(--muted);background:none;border:none;cursor:pointer;padding:0;}
.card .card-del:hover{color:var(--danger);}
.card .card-edit{font-size:11px;color:var(--teal);background:none;border:none;cursor:pointer;padding:0;}
.card .card-edit:hover{color: var(--teal-text); text-decoration:underline;}
/* --- Modern Account Cards View --- */
.acc-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 16px;
}
.acc-card {
    background: var(--bg-surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 16px 18px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
    box-shadow: 0 1px 3px rgba(27,42,46,0.03);
}
.acc-card:hover {
    border-color: var(--teal);
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(27,42,46,0.07);
}
.acc-card-top {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 10px;
}
.acc-avatar {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: rgba(31,111,92,0.08);
    color: var(--teal-text);
    font-family: 'Fraunces', serif;
    font-weight: 600;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border: 1px solid rgba(31,111,92,0.18);
}
.acc-card-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--ink);
    margin: 0;
    line-height: 1.3;
}
.acc-card-meta-row {
    display: flex;
    align-items: center;
    gap: 5px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}
.acc-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 10px;
    border-top: 1px solid var(--line);
    margin-top: auto;
    font-size: 11.5px;
    color: var(--muted);
}
.acc-stats-pills {
    display: flex;
    align-items: center;
    gap: 6px;
}
.doc-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(230px,1fr));gap:14px;}
.doc-group{margin-bottom:28px;}
.doc-group-head{display:flex;align-items:baseline;gap:10px;margin-bottom:12px;padding-bottom:6px;border-bottom:1px solid var(--line);}
.doc-group-head h3{font-size:15px;text-transform:uppercase;letter-spacing:0.04em;color:var(--ink);}
.doc-group-head .n{font-size:12px;color:var(--muted);}
.doc-group-empty{color:var(--muted);font-style:italic;font-size:12.5px;padding:4px 0 0;}
.doc-card {
    background: var(--paper-raised);
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 16px;
    cursor: grab;
    display: flex;
    flex-direction: column;
    gap: 8px;
    transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}
.doc-card:active {
    cursor: grabbing;
}
.doc-card:hover {
    border-color: var(--teal);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(27,42,46,0.05);
}
.doc-card.dragging {
    opacity: 0.35;
    transform: scale(0.98);
}
.doc-card.drag-over {
    border-color: var(--teal) !important;
    box-shadow: 0 0 0 2px rgba(31,111,92,0.3) !important;
}
.seq-badge {
    font-family: monospace;
    font-size: 11px;
    font-weight: 600;
    color: var(--muted);
    background: var(--paper);
    padding: 1px 6px;
    border-radius: 4px;
    border: 1px solid var(--line);
    line-height: 1.3;
}
.doc-card.done{opacity:0.6;}
.doc-card.done h3{text-decoration:line-through;color:var(--muted);}
.doc-card-link{display:flex;align-items:center;gap:7px;background:rgba(31,111,92,0.09);color: var(--teal-text);border:1px solid rgba(31,111,92,0.25);border-radius:var(--r-md);padding:7px 10px;font-size:12.5px;font-weight:500;text-decoration:none;overflow:hidden;}
.doc-card-link:hover{background:var(--teal);color:var(--on-teal);border-color:var(--teal);}
.doc-card-link svg{flex-shrink:0;width:13px;height:13px;}
.doc-card-link span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}
.doc-card-nolink{font-size:12px;color:var(--muted);font-style:italic;padding:7px 0 0;}
.doc-card-top{display:flex;align-items:center;justify-content:space-between;gap:8px;}
.doc-card-top .tag-group{display:flex;align-items:center;gap:6px;flex-wrap:wrap;}
.doc-card h3{font-size:15px;margin:0;}
.doc-card-meta{display:flex;align-items:center;gap:10px;flex-wrap:wrap;font-size:11.5px;color:var(--muted);}
.doc-card-notes{font-size:12px;color:var(--muted);white-space:pre-line;overflow:hidden;text-overflow:ellipsis;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;}
.doc-grid-lean{display:grid;grid-template-columns:repeat(auto-fill,minmax(300px,1fr));gap:6px;}
.doc-card-lean{background:var(--paper-raised);border:1px solid var(--line);border-radius:var(--r-md);padding:7px 10px;cursor:pointer;display:flex;align-items:center;gap:8px;transition:border-color 0.15s ease,box-shadow 0.15s ease;}
.doc-card-lean:hover{border-color:var(--teal);box-shadow:0 2px 8px rgba(27,42,46,0.05);}
.doc-card-lean .seq-badge{flex-shrink:0;}
.doc-card-lean-icon{flex-shrink:0;font-size:13px;line-height:1;}
.doc-card-lean-title{flex:1;min-width:0;font-size:12.5px;font-weight:500;color:var(--ink);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}
.doc-card-lean-tag{flex-shrink:0;}
.doc-card-lean-link{flex-shrink:0;display:flex;align-items:center;justify-content:center;width:24px;height:24px;border-radius:var(--r-sm);color:var(--muted);}
.doc-card-lean-link:hover{background:rgba(31,111,92,0.12);color: var(--teal-text);}
.loading{color:var(--muted);padding:20px 0;font-size:13px;}
.stat-row{display:flex;gap:28px;margin-bottom:26px;flex-wrap:wrap;}
.stat{border-left:2px solid var(--teal);padding-left:12px;}
.stat .num{font-family:'Fraunces',serif;font-size:26px;line-height:1;}
.stat .lbl{font-size:11px;color:var(--muted);margin-top:4px;}
.toast{position:fixed;bottom:20px;right:20px;background:var(--ink);color:var(--paper);padding:10px 16px;border-radius:var(--r-md);font-size:12.5px;opacity:0;transition:opacity 0.3s;pointer-events:none;z-index:9999;}
.undo-toast{position:fixed;bottom:20px;right:20px;background:var(--ink);color:var(--paper);padding:12px 14px 12px 16px;border-radius:var(--r-md);font-size:12.5px;display:flex;align-items:center;gap:16px;opacity:0;transform:translateY(6px);transition:opacity 0.2s, transform 0.2s;pointer-events:none;z-index:9999;box-shadow:0 6px 18px rgba(0,0,0,0.25);}
.undo-toast.show{opacity:1;transform:translateY(0);pointer-events:auto;}
.undo-toast button{background:none;border:1px solid color-mix(in srgb, var(--paper) 35%, transparent);color:var(--paper);font-family:'Work Sans',sans-serif;font-size:12px;font-weight:600;padding:5px 12px;border-radius:2px;cursor:pointer;flex-shrink:0;white-space:nowrap;}
.undo-toast button:hover{background:color-mix(in srgb, var(--paper) 14%, transparent);border-color:color-mix(in srgb, var(--paper) 60%, transparent);}
.toast.show{opacity:1;}
.toast{transition:opacity 0.3s, transform 0.2s;}
.toast.raised{transform:translateY(-64px);}

    /* --- Win / Loss Debrief Reasons (settings drawer) --- */
.debrief-track-tabs{display:flex;background:var(--bg-subtle);border:1px solid var(--line);border-radius:7px;padding:2px;gap:2px;margin:8px 0 12px;width:100%;box-sizing:border-box;}
.debrief-track-btn{flex:1;background:none;border:none;color:var(--muted);font-family:'Work Sans',sans-serif;font-size:12px;font-weight:500;padding:6px 8px;border-radius:var(--r-sm);cursor:pointer;text-align:center;transition:all .15s ease;white-space:nowrap;}
.debrief-track-btn:hover{color:var(--ink);}
.debrief-track-btn.active{background:var(--bg-surface);color:var(--teal-text);font-weight:600;box-shadow:0 1px 3px rgba(0,0,0,0.08);}
.reason-list{display:flex;flex-direction:column;gap:5px;margin-bottom:12px;}
.reason-row{background:var(--paper-raised);border:1px solid var(--line);border-radius:6px;padding:7px 10px;display:flex;align-items:center;justify-content:space-between;gap:8px;font-size:12.5px;transition:border-color .15s,background .15s;}
.reason-row:hover{border-color:var(--teal);}
.reason-row.dragging{opacity:.35;}
.reason-row.drag-over{border-top:2px solid var(--teal);}
.reason-row.pinned{background:var(--paper);}
.reason-row.pinned .reason-pin{font-size:10px;color:var(--muted);padding:0 4px;}
/* --- Win / Loss Debrief Modal Chips --- */
.debrief-chip-grid { display:flex; flex-wrap:wrap; gap:7px; margin:12px 0 16px; }
.debrief-chip-btn {
    background:var(--bg-surface); border:1px solid var(--line); border-radius:20px; padding:6px 13px;
    font-size:12.5px; font-family:'Work Sans',sans-serif; color:var(--ink); cursor:pointer; transition:all 0.15s ease;
}
.debrief-chip-btn:hover { border-color:var(--teal); background:rgba(31,111,92,0.05); transform:translateY(-1px); }
.debrief-chip-btn.selected { background:var(--ink); color:var(--paper); border-color:var(--ink); box-shadow:0 2px 6px rgba(27,42,46,0.2); }
#debrief-save:disabled { opacity:0.45; cursor:not-allowed; }
/* --- Settings --- */
.settings-section{background:var(--paper-raised);border:1px solid var(--line);border-radius:var(--r-lg);padding:20px;margin-bottom:20px;}
.settings-section h3{margin-bottom:16px;font-size:16px;}
/* --- Modern Profile & Preferences Bento Layout --- */
.profile-grid-layout {
    display: grid;
    grid-template-columns: 360px 1fr; /* Fixed left identity, spacious fluid right side */
    gap: 18px;
    align-items: stretch; /* both cards share one height */
}
.profile-identity-card { display:flex; flex-direction:column; }
.ws-acronyms { margin-top:16px; margin-bottom:16px; padding-top:14px; border-top:1px solid var(--line-subtle); }
.profile-prefs-card { display:flex; flex-direction:column; }
/* whichever card is taller sets the height; the setting rows share any slack evenly so nothing is left empty */
.profile-prefs-card > .profile-setting-row { flex:1 1 auto; }
.ws-sync { margin-top:auto; padding-top:14px; border-top:1px solid var(--line); display:flex; align-items:center; justify-content:space-between; gap:10px; flex-wrap:wrap; }
.ws-acronyms + .ws-sync { margin-top:auto; }
.ws-sync-status { display:flex; align-items:center; gap:8px; font-size:12px; color:var(--muted); min-width:0; }
.ws-sync-actions { display:flex; gap:6px; flex-wrap:wrap; }
.ws-sync-actions .top-btn-alt { height:28px; padding:0 10px; font-size:11.5px; }

@media (max-width: 900px) {
    .profile-grid-layout {
        grid-template-columns: 1fr; /* Stacks cleanly on tablets and mobile screens */
    }
}

.profile-avatar-banner {
    display: flex;
    align-items: center;
    gap: 14px;
    padding-bottom: 14px;
    margin-bottom: 14px;
    border-bottom: 1px solid var(--line);
}

.profile-avatar-circle {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--teal);
    color: var(--paper-raised);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Fraunces', serif;
    font-size: 18px;
    font-weight: 600;
    flex-shrink: 0;
    box-shadow: 0 2px 6px rgba(31,111,92,0.2);
}

.profile-setting-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--line-subtle);
    gap: 16px;
    flex-wrap: wrap;
}

.profile-setting-row:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.profile-setting-info {
    flex: 1;
    min-width: 170px; /* Prevents "Stale Deal Alert" from ever breaking vertically */
}

.profile-setting-info b {
    display: block;
    font-size: 13px;
    color: var(--ink);
    margin-bottom: 2px;
    font-weight: 600;
}

.profile-setting-info span {
    display: block;
    font-size: 11.5px;
    color: var(--muted);
    line-height: 1.4;
}

.profile-setting-control {
    flex-shrink: 0;
}

.profile-setting-control select {
    min-width: 140px;
    font-size: 12.5px;
    padding: 6px 8px;
}

/* --- Tactile Segmented Controls (Theme, Density, Stale Threshold) --- */
.segmented-control {
    display: inline-flex;
    background: var(--bg-subtle);
    border: 1px solid var(--line);
    border-radius: 7px;
    padding: 2px;
    gap: 2px;
    flex-shrink: 0;
}

.segmented-btn {
    background: none;
    border: none;
    color: var(--muted);
    font-family: 'Work Sans', sans-serif;
    font-size: 12px;
    font-weight: 500;
    padding: 5px 12px;
    min-height: 0;
    border-radius:var(--r-sm);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.segmented-btn:hover {
    color: var(--ink);
}

.segmented-btn.active {
    background: var(--bg-surface);
    color: var(--ink);
    font-weight: 600;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

[data-theme="dark"] .segmented-btn.active {
    color: var(--teal-text);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
}

.segmented-btn svg {
    width: 13px;
    height: 13px;
    stroke: currentColor;
    fill: none;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* --- Custom Acronym Tag Chips --- */
.caps-chip-list {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 8px;
}

.caps-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: var(--bg-subtle);
    border: 1px solid var(--line);
    padding: 2px 4px 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    color: var(--ink);
}

.caps-chip button {
    background: none;
    border: none;
    padding: 0 3px;
    min-height: 0;
    cursor: pointer;
    color: var(--muted);
    font-size: 14px;
    line-height: 1;
}

.caps-chip button:hover {
    color: var(--danger);
}

/* Compact Density Modifiers */
/* Compact Density (desktop + mobile). Class sits on <html> (set before first paint) and <body>. */
.density-compact td { padding: 3px 8px !important; font-size: 12px !important; height: 30px !important; }
.density-compact th { padding: 5px 8px !important; font-size: 11px !important; }
.density-compact td.td-bulk-select, .density-compact th.th-bulk-select { padding: 2px 4px !important; }
.density-compact td .status-select { min-height: 22px !important; height: 22px !important; padding: 2px 20px 2px 6px !important; font-size: 11px !important; line-height: 1 !important; }
.density-compact td .top-btn, .density-compact td .top-btn-alt, .density-compact td button { min-height: 24px !important; height: 24px !important; padding: 2px 8px !important; font-size: 11px !important; }
.density-compact .card { padding: 6px 8px; font-size: 12px; }

.settings-tabs {
    display: flex;
    gap: 4px;
    border-bottom: 1px solid var(--line);
    margin-bottom: 20px;
    flex-wrap: wrap;
}
.settings-tab{padding:9px 14px;font-size:12.5px;color:var(--muted);cursor:pointer;border-bottom:2px solid transparent;margin-bottom:-1px;display:flex;align-items:center;gap:7px;}
.settings-tab svg{width:14px;height:14px;stroke:currentColor;fill:none;stroke-width:1.6;flex-shrink:0;}
.settings-tab:hover{color:var(--ink);}
.settings-tab.active{color: var(--teal-text);border-bottom-color:var(--teal);font-weight:500;}
.sync-status{font-size:11.5px;color:var(--muted);margin-top:12px;line-height:1.6;}
.sync-status code{background:var(--paper);padding:1px 5px;border-radius:3px;}
.csv-field-note{max-width:640px;}
.gh-label{font-size:10.5px;color:var(--muted);text-transform:uppercase;letter-spacing:0.04em;margin-bottom:5px;display:block;font-weight:500;}
.sync-status-line{font-size:12.5px;font-weight:500;padding:8px 12px;border-radius:var(--r-md);background:var(--paper);border:1px solid var(--line);margin-bottom:10px;max-width:100%;}
.sync-status-line.ok{color: var(--teal-text);border-color:rgba(31,111,92,0.3);background:rgba(31,111,92,0.06);}
.sync-status-line.err{color:var(--danger);border-color:rgba(166,64,47,0.3);background:rgba(166,64,47,0.06);}
.sync-log{max-width:100%;max-height:150px;overflow-y:auto;background:#12191B;border-radius:var(--r-md);padding:10px 12px;}
.sync-log-line{font-family:'SFMono-Regular',Consolas,'Liberation Mono',Menlo,monospace;font-size:11px;line-height:1.7;color:#B7C4C0;white-space:pre-wrap;word-break:break-word;}
.sync-log-line.err{color:#E5998C;}
.sync-log-line.ok{color:#8FE0C9;}
.toggle-row{display:flex;align-items:flex-start;gap:10px;background:var(--paper);border:1px solid var(--line);border-radius:var(--r-md);padding:12px 14px;}
.toggle-row input[type=checkbox]{width:auto;margin-top:3px;flex-shrink:0;}
.toggle-row .toggle-copy{font-size:12.5px;}
.toggle-row .toggle-copy b{display:block;margin-bottom:2px;color:var(--ink);font-weight:600;}
.toggle-row .toggle-copy span{color:var(--muted);font-size:11.5px;}
.stage-list{display:flex;flex-direction:column;gap:5px;margin-bottom:12px;}
.stage-item{background:var(--paper-raised);border:1px solid transparent;border-top:2px solid transparent;border-radius:var(--r-md);font-size:12.5px;transition:border-color 0.15s, background 0.15s;}
.stage-item:hover{border-color:var(--line);}
.stage-item.dragging{opacity:0.4;}
.stage-item.drag-over{border-top-color:var(--teal);}
.stage-main{display:flex;justify-content:space-between;align-items:center;gap:8px;padding:7px 10px;cursor:pointer;}
/* --- Modals --- */
.modal-backdrop { position:fixed; top:0; left:0; width:100%; height:100%; background:rgba(20,31,34,0.5); backdrop-filter:blur(3px); -webkit-backdrop-filter:blur(3px); z-index:9999; display:none; justify-content:center; align-items:center; padding:20px; opacity:0; transition:opacity 0.15s ease; }
.modal-backdrop.show { display:flex; opacity:1; }
.modal-box {
    background:var(--paper-raised);
    padding:26px 26px 24px;
    border-radius:12px;
    width:100%;
    max-width:400px;
    max-height:calc(100vh - 40px);   /* never taller than the screen... */
    max-height:calc(100dvh - 40px);
    overflow-y:auto;                 /* ...long content scrolls inside the box instead of pushing Save off-screen */
    border-top:3px solid var(--teal);
    box-shadow:0 20px 45px -14px rgba(20,31,34,0.4), 0 3px 10px rgba(20,31,34,0.1);
    transform:translateY(8px) scale(0.98);
    opacity:0;
    transition:transform 0.18s cubic-bezier(0.16,1,0.3,1), opacity 0.18s ease;
}
/* Long option lists (tags / dropdown choices) get their own scroll area inside the field dialog */
#cf-options-list { max-height:220px; overflow-y:auto; padding-right:4px; }
.modal-backdrop.show .modal-box { transform:translateY(0) scale(1); opacity:1; }
.modal-box.danger-modal { border-top-color:var(--danger); }
.modal-box h3 { letter-spacing:0.01em; }
.modal-box label { font-weight:600; color:var(--ink); text-transform:none; letter-spacing:0; font-size:12.5px; }
.modal-box input, .modal-box select, .modal-box textarea { border-radius:6px; border-color:var(--line); transition:border-color 0.15s, box-shadow 0.15s; }
.modal-box input:focus, .modal-box select:focus, .modal-box textarea:focus { outline:none; border-color:var(--teal); box-shadow:0 0 0 3px rgba(31,111,92,0.14); }
.ui-dialog-msg { margin:0 0 16px; color:var(--muted); font-size:13.5px; line-height:1.5; white-space:pre-line; }
.ui-dialog-actions { display:flex; gap:10px; margin-top:18px; justify-content:flex-end; }
.btn-save, .btn-cancel, .btn-danger { border-radius:6px; transition:transform 0.12s ease, box-shadow 0.12s ease, background 0.15s ease, border-color 0.15s ease; }
.btn-save:hover { box-shadow:0 6px 16px rgba(20,31,34,0.28); transform:translateY(-1px); }
.btn-cancel:hover { border-color:var(--muted); background:rgba(110,101,88,0.07); }
.btn-danger { background:var(--danger); color:var(--paper); border:none; padding:9px 18px; font-size:13px; line-height:1.4; cursor:pointer; display:inline-flex; align-items:center; box-sizing:border-box; }
.btn-danger:hover { background:#832F21; box-shadow:0 6px 16px rgba(166,64,47,0.3); transform:translateY(-1px); }
.modal-close { background:none; border:none; font-size:19px; color:var(--muted); cursor:pointer; line-height:1; padding:3px 7px; border-radius:6px; }
.modal-close:hover { color:var(--danger); background:var(--bg-subtle); }
/* --- Right Sidebar Context Panel --- */
.sidebar {
position: fixed; top: 0; right: 0; bottom: 0; width: 420px; max-width:100vw;
background: var(--paper-raised); border-left: 1px solid var(--line);
box-shadow: -4px 0 15px rgba(0,0,0,0.05); z-index: 900;
transform: translateX(100%); transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
display: flex; flex-direction: column;
}
.sidebar.open { transform: translateX(0); }
.settings-drawer { width: 560px; z-index: 950; }
.sb-form.open { display: flex; flex-direction: column; gap: 10px; }
.sb-form input, .sb-form select, .sb-form textarea { padding: 7px 9px; font-size: 13px; }
.sb-data-grid { display: grid; grid-template-columns: 1fr; gap: 14px; font-size: 13px; }
.sb-data-grid .lbl { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.02em; margin-bottom: 2px; }
.sb-data-grid > div { min-width: 0; }
.sb-data-grid .sb-val { overflow-wrap: anywhere; word-break: break-word; }
.sb-actions { display:flex; gap:8px; align-items:flex-start; flex-shrink:0; }
.sb-icon-btn.danger { background: rgba(166,64,47,0.1); color: var(--danger); }
.sb-icon-btn.danger:hover { background: var(--danger); color: var(--on-teal); }
.sb-edit-field label { display:block; font-size:11px; color:var(--muted); margin-bottom:4px; text-transform:uppercase; letter-spacing:0.02em; }
.sb-edit-field { margin-bottom:12px; }
.sb-icon-btn.icon-only { padding:5px 7px; }
.sb-delete-btn { width:100%; background:rgba(166,64,47,0.04); border:1px dashed rgba(166,64,47,0.45); color:var(--danger); padding:12px; font-size:13px; font-family:'Work Sans',sans-serif; cursor:pointer; border-radius:4px; margin-top:4px; }
.sb-delete-btn:hover { background:rgba(166,64,47,0.1); border-color:var(--danger); }
.sb-archive-btn { width:100%; background:var(--paper-raised); border:1px solid var(--line); color:var(--ink); padding:12px; font-size:13px; font-family:'Work Sans',sans-serif; cursor:pointer; border-radius:4px; margin-top:4px; }
.sb-archive-btn:hover { background:var(--paper); border-color:var(--muted); }
.sb-archive-btn.is-archived { background:rgba(31,111,92,0.06); border-color:rgba(31,111,92,0.35); color: var(--teal-text); }
.sb-archive-btn.is-archived:hover { background:rgba(31,111,92,0.12); }
.top-btn-alt.icon-only { display:inline-flex; align-items:center; justify-content:center; padding:7px 9px; }
.top-btn-alt.icon-only svg { width:15px; height:15px; }
.set-card-row { padding:14px 16px; }
.set-card-row .set-card-head h4 { font-size:14px; }
.pipeline-card { display:flex; flex-direction:column; gap:12px; }
.pipeline-card-top { display:flex; justify-content:space-between; align-items:baseline; gap:10px; }
.pipeline-card-top h4 { font-size:15px; margin:0; }
.pipeline-card-badge { font-size:9.5px; color:var(--muted); text-transform:uppercase; font-weight:600; letter-spacing:0.03em; }
.pipeline-card-actions { display:flex; justify-content:space-between; align-items:center; padding-top:12px; border-top:1px solid var(--line); flex-wrap:wrap; gap:10px; }
.pipeline-card-actions-right { display:flex; align-items:center; gap:12px; }
.pipeline-enabled-toggle { display:flex; align-items:center; gap:5px; font-size:11.5px; color:var(--muted); cursor:pointer; white-space:nowrap; }
.pipeline-delete-btn { background:none; border:none; color:var(--danger); cursor:pointer; font-size:14px; padding:2px; }
.age-badge { display:inline-block; font-size:10.5px; font-weight:600; padding:2px 7px; border-radius:9px; white-space:nowrap; letter-spacing:0.02em; }
.age-badge.age-fresh { background:rgba(31,111,92,0.12); color: var(--teal-text); }
.age-badge.age-normal { background:rgba(110,101,88,0.14); color:var(--muted); }
.age-badge.age-warn { background:rgba(184,134,43,0.18); color:var(--amber-text); }
.age-badge.age-stale { background:rgba(166,64,47,0.15); color:var(--danger); }
.card-meta-row { display:flex; align-items:center; gap:8px; margin-top:6px; flex-wrap:wrap; }
.activity-feed { display:flex; flex-direction:column; gap:2px; }
.activity-item { display:flex; gap:12px; padding:12px 4px; border-bottom:1px solid var(--line); font-size:13px; align-items:flex-start; }
.activity-item:last-child { border-bottom:none; }
.activity-dot { width:8px; height:8px; border-radius:50%; margin-top:5px; flex-shrink:0; background:var(--muted); }
.activity-dot.act-created { background:var(--teal); }
.activity-dot.act-updated { background:var(--amber); }
.activity-dot.act-stage { background:#6E90C7; }
.activity-dot.act-deleted { background:var(--danger); }
.activity-dot.act-archived { background:var(--danger); }
.activity-dot.act-restored { background:var(--teal); }
.activity-body { flex:1; min-width:0; }
.activity-msg { color:var(--ink); }
.activity-msg a { color: var(--teal-text); text-decoration:underline; text-decoration-color:rgba(31,111,92,0.35); cursor:pointer; }
.activity-meta { color:var(--muted); font-size:11.5px; margin-top:2px; }
.sb-activity-item { padding:8px 0; border-bottom:1px solid var(--line); font-size:12.5px; }
.sb-activity-item:last-child { border-bottom:none; padding-bottom:0; }
.sb-activity-msg { color:var(--ink); }
.sb-activity-time { color:var(--muted); font-size:11px; margin-top:2px; }
.archived-banner { background:rgba(166,64,47,0.08); border:1px solid rgba(166,64,47,0.25); color:var(--danger); padding:10px 14px; border-radius:var(--r-md); font-size:12.5px; margin-bottom:16px; }
.system-field-row { display:flex; justify-content:space-between; align-items:center; padding:7px 10px; font-size:11.5px; color:var(--muted); border-radius:var(--r-md); }
.system-field-row:nth-child(even) { background:var(--paper-raised); }
.system-fields-list { border:1px solid var(--line); border-radius:6px; padding:4px; margin-bottom:10px; }
/* --- Shared modern settings cards (Pipelines / Data Management) --- */
.set-desc { font-size:12px; color:var(--muted); margin:2px 0 16px; max-width:640px; line-height:1.55; }
.set-grid { display:grid; grid-template-columns:repeat(auto-fit, minmax(280px,1fr)); gap:18px; align-items:start; }
.set-card { background:var(--bg-surface); border:1px solid var(--line); border-radius:8px; padding:18px 18px 16px; box-shadow:0 1px 2px rgba(27,42,46,0.04); min-width:0; }
.set-card-head { display:flex; align-items:center; justify-content:space-between; gap:10px; margin-bottom:4px; }
.set-card-head h4 { font-family:'Fraunces',serif; font-weight:500; font-size:15px; color:var(--ink); margin:0; }
.set-card.set-card-new { border:1px dashed rgba(31,111,92,0.35); background:rgba(31,111,92,0.03); box-shadow:none; }
/* --- Data Management Layout --- */
.dm-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
    gap: 16px;
    align-items: stretch; /* both columns end on the same line */
}
.dm-col { display:flex; flex-direction:column; gap:16px; }
/* only the last card in a column absorbs spare height, so the two columns end on the same line */
.dm-col > .dm-card:last-child { flex:1 1 auto; display:flex; flex-direction:column; }
.dm-col > .dm-card:last-child > .dm-pill-list { flex:1 1 125px; max-height:none; min-height:0; align-content:flex-start; }
.dm-col > .dm-card.dm-danger-card { justify-content:center; }
.dm-card { flex:1 1 auto; display:flex; flex-direction:column; }
.dm-col > .dm-card > .dm-btn-group { margin-top:auto; }
.dm-col > .dm-card.dm-danger-card { justify-content:center; }
.dm-card {
    background: var(--bg-surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 18px 20px;
    box-shadow: 0 1px 2px rgba(27,42,46,0.04);
}
.dm-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 4px;
}
.dm-card-head h4 {
    font-family: 'Fraunces', serif;
    font-size: 15px;
    font-weight: 500;
    margin: 0;
    color: var(--ink);
}
.dm-desc {
    font-size: 12px;
    color: var(--muted);
    margin: 0 0 14px;
    line-height: 1.5;
}
.dm-btn-group {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.dm-btn-group .top-btn,
.dm-btn-group .top-btn-alt,
.dm-btn-group label {
    height: 32px;
    padding: 0 14px;
    font-size: 12px;
    border-radius:var(--r-sm);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin: 0;                /* Resets the 4px label bottom-margin */
    line-height: 1;
    vertical-align: middle;
    box-sizing: border-box;
}
.dm-pill-list {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    max-height: 125px;
    overflow-y: auto;
    padding: 8px 10px;
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius:var(--r-md);
}
.dm-pill {
    font-size: 11px;
    font-family: monospace;
    background: var(--paper-raised);
    border: 1px solid var(--line);
    padding: 2px 7px;
    border-radius: 3px;
    color: var(--ink);
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.dm-pill small {
    color: var(--muted);
    font-family: 'Work Sans', sans-serif;
    font-size: 9.5px;
}
.dm-danger-card {
    border-color: rgba(166,64,47,0.3);
    background: rgba(166,64,47,0.03);
    padding: 16px 20px;
}
/* --- Custom Fields (in the settings drawer) --- */
.cf-count { font-size:10px; color:var(--muted); background:var(--paper); padding:2px 8px; border-radius:9px; white-space:nowrap; flex-shrink:0; text-transform:none; letter-spacing:0; font-weight:600; }
.cf-list { display:flex; flex-direction:column; gap:5px; }
.cf-row { border-radius:var(--r-md); background:var(--paper-raised); border:1px solid transparent; border-top:2px solid transparent; transition:border-color 0.15s, background 0.15s; }
.cf-row:hover { border-color:var(--line); }
.cf-row.dragging { opacity:0.4; }
.cf-row.drag-over { border-top-color:var(--teal); }
.cf-row-main { display:flex; align-items:center; justify-content:space-between; gap:8px; padding:7px 9px; }
.cf-row-main.clickable { cursor:pointer; }
.cf-drag-handle { cursor:grab; color:var(--muted); font-size:13px; letter-spacing:-1px; padding:2px 3px; flex-shrink:0; touch-action:none; }
.cf-drag-handle:active { cursor:grabbing; }
.cf-row .cf-name { display:flex; align-items:center; gap:7px; font-size:12.5px; color:var(--ink); min-width:0; flex:1; }
.cf-row .cf-name .lbl-text { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.cf-chevron { color:var(--muted); font-size:11px; flex-shrink:0; transition:transform 0.15s; }
.cf-pill { font-size:9px; text-transform:uppercase; letter-spacing:0.03em; padding:2px 6px; border-radius:8px; flex-shrink:0; font-weight:600; }
.cf-pill.core { background:rgba(31,111,92,0.1); color: var(--teal-text); }
.cf-pill.fixed { background:rgba(110,101,88,0.12); color:var(--muted); }
.cf-pill.type-relation { background:rgba(184,134,43,0.15); color:var(--amber-text); }
.cf-pill.type-url { background:rgba(31,111,92,0.1); color: var(--teal-text); }
.cf-pill.type-currency { background:rgba(31,111,92,0.1); color: var(--teal-text); }
.cf-pill.type-text, .cf-pill.type-number, .cf-pill.type-date, .cf-pill.type-select { background:rgba(110,101,88,0.12); color:var(--muted); }
.cf-expand { padding:2px 9px 10px 30px; display:flex; flex-direction:column; gap:8px; cursor:default; }
.cf-expand-row { display:flex; gap:6px; align-items:center; }
.cf-expand-row input[type="text"], .cf-expand-row input:not([type]) { flex:1; font-size:12px; padding:5px 8px; border:1px solid var(--line); border-radius:var(--r-sm); font-family:'Work Sans',sans-serif; background:var(--bg-surface); }
.cf-btn-sm { font-size:11px; padding:5px 10px; border-radius:var(--r-sm); cursor:pointer; border:none; background:var(--teal); color:var(--on-teal); font-family:'Work Sans',sans-serif; font-weight:600; white-space:nowrap; }
.cf-btn-sm:hover { background:var(--teal-deep); }
.cf-check-row { display:flex; align-items:center; gap:7px; font-size:12px; color:var(--ink); cursor:pointer; }
.cf-check-row input { width:auto; }
.cf-del-full { align-self:flex-start; font-size:11px; padding:5px 10px; border-radius:var(--r-sm); cursor:pointer; border:1px solid var(--danger); background:none; color:var(--danger); font-family:'Work Sans',sans-serif; }
.cf-del-full:hover { background:rgba(166,64,47,0.08); }
.inline-ask { display:flex; align-items:center; flex-wrap:wrap; gap:9px; font-size:11.5px; color:var(--danger); padding:2px 0; }
.inline-ask .cf-btn-sm.danger { background:var(--danger); }
.inline-ask .cf-btn-sm.danger:hover { background:#8a3722; }
.inline-add-row { display:flex; gap:7px; align-items:center; margin-top:2px; }
.inline-add-row input { flex:1; padding:6px 9px; font-size:12.5px; border:1px solid var(--line); border-radius:var(--r-sm); font-family:'Work Sans',sans-serif; }
.cf-empty { font-size:12px; color:var(--muted); padding:6px 2px; }
.cf-orphan-box { background:rgba(184,134,43,0.08); border:1px solid rgba(184,134,43,0.28); border-radius:6px; padding:10px 11px; display:flex; flex-direction:column; gap:6px; }
.cf-orphan-head { font-size:9.5px; color:var(--amber-text); font-weight:700; text-transform:uppercase; letter-spacing:0.03em; }
.cf-orphan-row { display:flex; justify-content:space-between; align-items:center; gap:8px; font-size:12px; }
.cf-orphan-row .actions { display:flex; gap:6px; flex-shrink:0; }
.cf-orphan-row .actions button { font-size:10.5px; padding:3px 9px; border-radius:var(--r-sm); cursor:pointer; border:none; font-family:'Work Sans',sans-serif; }
.cf-orphan-row .btn-manage { background:var(--teal); color:var(--on-teal); }
.cf-orphan-row .btn-manage:hover { background:var(--teal-deep); }
.cf-orphan-row .btn-discard { background:none; color:var(--danger); border:1px solid var(--danger); }
.cf-orphan-row .btn-discard:hover { background:rgba(166,64,47,0.08); }
.cf-add-btn { border:1px dashed rgba(31,111,92,0.4); background:rgba(31,111,92,0.04); color: var(--teal-text); font-family:'Work Sans',sans-serif; font-weight:600; font-size:12px; padding:9px; border-radius:6px; cursor:pointer; text-align:center; margin-top:2px; display:block; width:100%; }
.cf-add-btn:hover { background:rgba(31,111,92,0.09); border-color:var(--teal); }
.sb-field-icon { color:var(--muted); background:none; border:none; cursor:pointer; font-size:11px; padding:2px 5px; border-radius:3px; line-height:1.4; }
.sb-field-icon:hover { color: var(--teal-text); background:rgba(31,111,92,0.08); }
.sb-field-icon.sb-field-del:hover { color:var(--danger); background:rgba(166,64,47,0.08); }
/* Analytics */
.stat-grid { display:grid; grid-template-columns:repeat(auto-fit, minmax(170px,1fr)); gap:14px; margin-bottom:20px; }
.stat-card { background:var(--paper-raised); border:1px solid var(--line); border-radius:var(--r-lg); padding:16px; transition: border-color 0.15s, transform 0.1s, box-shadow 0.15s; }
.stat-card.clickable { cursor:pointer; }
.stat-card.clickable:hover { border-color:var(--teal); transform:translateY(-2px); box-shadow:0 4px 12px rgba(0,0,0,0.06); }
.stat-value { font-family:'Fraunces', serif; font-size:26px; color:var(--ink); line-height:1.1; }
.stat-label { color:var(--muted); font-size:11.5px; text-transform:uppercase; letter-spacing:0.03em; margin-top:6px; }
.stat-sub { color:var(--muted); font-size:11px; margin-top:4px; }
.analytics-cols { display:grid; grid-template-columns:repeat(auto-fit, minmax(260px,1fr)); gap:14px; }
.analytics-panel { background:var(--paper-raised); border:1px solid var(--line); border-radius:var(--r-lg); padding:16px; }
.analytics-panel h3 { font-size:14px; margin:0 0 4px; }
.analytics-panel .hint { color:var(--muted); font-size:11.5px; margin:0 0 12px; }
.bar-row { display:flex; align-items:center; gap:10px; margin-bottom:9px; font-size:12px; }
.bar-row:last-child { margin-bottom:0; }
.bar-label { width:100px; flex-shrink:0; color:var(--muted); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.bar-track { flex:1; background:var(--line); height:9px; border-radius:5px; overflow:hidden; }
.bar-fill { height:100%; background:var(--teal); border-radius:5px; }
.bar-count { width:22px; text-align:right; color:var(--ink); font-weight:500; flex-shrink:0; }
.spark-row { display:flex; align-items:flex-end; gap:6px; height:80px; padding-top:10px; }
.spark-bar-wrap { flex:1; display:flex; flex-direction:column; align-items:center; justify-content:flex-end; height:100%; }
.spark-bar { width:100%; max-width:22px; background:var(--teal); border-radius:2px 2px 0 0; }
.spark-label { font-size:10px; color:var(--muted); margin-top:5px; }
.stale-list { display:flex; flex-direction:column; gap:2px; }
.attn-tabs { display:flex; gap:6px; margin:-2px 0 10px; }
.attn-tab { font:inherit; font-size:11.5px; padding:4px 10px; border:1px solid var(--line); background:transparent; color:var(--muted); border-radius:999px; cursor:pointer; }
.attn-tab:hover { color:var(--ink); border-color:var(--muted); }
.attn-tab.active { background:rgba(31,111,92,0.1); border-color:rgba(31,111,92,0.35); color: var(--teal-text); font-weight:600; }
.stale-item { display:flex; justify-content:space-between; align-items:center; padding:9px 4px; border-bottom:1px solid var(--line); cursor:pointer; }
.stale-item:last-child { border-bottom:none; }
.stale-item:hover .stale-name { color: var(--teal-text); text-decoration:underline; }
.stale-name { font-size:13px; }
.stale-acc { font-size:11px; color:var(--muted); margin-top:1px; }
/* Analytics Dashboard */
.analytics-header-controls { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; }
.analytics-kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-bottom: 22px; }
.analytics-kpi-card { background: var(--bg-surface); border: 1px solid var(--line); border-radius: 8px; padding: 16px 18px; box-shadow: var(--card-shadow); }
.analytics-kpi-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.analytics-kpi-val { font-family: 'Fraunces', serif; font-size: 28px; line-height: 1.1; color: var(--ink); }
.analytics-kpi-lbl { font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); font-weight: 600; margin-top: 6px; }
.analytics-kpi-sub { font-size: 11.5px; color: var(--muted); margin-top: 3px; }

.analytics-dashboard-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }
@media (max-width: 960px) { .analytics-dashboard-grid { grid-template-columns: 1fr; } }

.analytics-card { background: var(--bg-surface); border: 1px solid var(--line); border-radius: 8px; padding: 20px; box-shadow: var(--card-shadow); }
.analytics-card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; padding-bottom: 10px; border-bottom: 1px solid var(--line-subtle); gap: 10px; flex-wrap: wrap; }
.analytics-card-head h3 { font-size: 15px; margin: 0; color: var(--ink); }

/* Funnel bars */
.funnel-step { margin-bottom: 10px; }
.funnel-step:last-child { margin-bottom: 0; }
.funnel-labels { display: flex; justify-content: space-between; font-size: 12px; margin-bottom: 4px; }
.funnel-track { height: 20px; background: var(--bg-subtle); border-radius: 5px; overflow: hidden; position: relative; }
.funnel-fill { height: 100%; background: linear-gradient(90deg, var(--teal-deep), var(--teal)); border-radius: 5px; display: flex; align-items: center; justify-content: flex-end; padding-right: 8px; font-size: 10.5px; font-weight: 600; color: #fff; min-width: 28px; transition: width 0.3s ease; }
.funnel-dropoff { font-size: 11px; color: var(--danger); font-weight: 500; margin-top: 2px; }

/* Multi-segment outreach bar */
.outreach-bar-track { display: flex; height: 12px; border-radius: 6px; overflow: hidden; background: var(--bg-subtle); margin: 12px 0 16px; }
.outreach-bar-seg { height: 100%; transition: width 0.3s ease; }
.outreach-legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 12px; }
.outreach-legend-item { display: inline-flex; align-items: center; gap: 6px; }
.outreach-dot { width: 8px; height: 8px; border-radius: 50%; }

/* Revenue Loss Rows */
.loss-money-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line-subtle); font-size: 12.5px; }
.loss-money-row:last-child { border-bottom: none; }

/* --- Modern Homepage Styles --- */
.home-hero {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 22px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--line);
    flex-wrap: wrap;
    gap: 16px;
}
.home-stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 14px;
    margin-bottom: 22px;
}
.home-stat-card {
    background: var(--bg-surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 16px 18px;
    cursor: pointer;
    transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    box-shadow: 0 1px 2px rgba(27,42,46,0.03);
}
.home-stat-card:hover {
    transform: translateY(-2px);
    border-color: var(--teal);
    box-shadow: 0 5px 15px rgba(27,42,46,0.07);
}
.home-stat-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}
.home-stat-icon-wrap {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    background: rgba(31,111,92,0.08);
    color: var(--teal-text);
    display: flex;
    align-items: center;
    justify-content: center;
}
.home-stat-num {
    font-family: 'Fraunces', serif;
    font-size: 30px;
    color: var(--ink);
    line-height: 1;
    margin-bottom: 4px;
}
.home-stat-lbl {
    font-size: 12px;
    color: var(--muted);
    font-weight: 500;
}
.home-quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 24px;
}
.home-action-chip {
    background: var(--bg-surface);
    border: 1px solid var(--line);
    color: var(--ink);
    padding: 7px 13px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    transition: all 0.15s ease;
    box-shadow: 0 1px 2px rgba(27,42,46,0.02);
}
.home-action-chip:hover {
    border-color: var(--teal);
    color: var(--teal-text);
    background: rgba(31,111,92,0.04);
    transform: translateY(-1px);
}
.home-widget {
    background: var(--bg-surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 18px 20px;
    box-shadow: 0 1px 3px rgba(27,42,46,0.03);
}
.home-widget-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--line);
}
.home-widget-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13.5px;
    font-weight: 600;
    color: var(--ink);
    margin: 0;
}
.home-see-all {
    font-size: 11.5px;
    color: var(--teal-text);
    cursor: pointer;
    text-decoration: underline;
    text-decoration-color: rgba(31,111,92,0.35);
}
.home-see-all:hover {
    color: var(--teal);
}
/* --- Modern Contact Cards View --- */
.contact-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 16px;
}
.contact-card {
    background: var(--bg-surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 16px 18px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
    box-shadow: 0 1px 3px rgba(27,42,46,0.03);
    position: relative;
}
.contact-card:hover {
    border-color: var(--teal);
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(27,42,46,0.07);
}
.contact-card-top {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 10px;
}
.contact-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(31,111,92,0.09);
    color: var(--teal-text);
    font-family: 'Fraunces', serif;
    font-weight: 600;
    font-size: 13.5px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border: 1px solid rgba(31,111,92,0.2);
}
.contact-card-name {
    font-size: 14.5px;
    font-weight: 600;
    color: var(--ink);
    margin: 0;
    line-height: 1.3;
}
.contact-card-title {
    font-size: 11.5px;
    color: var(--muted);
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.contact-card-company {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    color: var(--teal-text);
    background: rgba(31,111,92,0.06);
    border: 1px solid rgba(31,111,92,0.18);
    padding: 2px 7px;
    border-radius:var(--r-md);
    text-decoration: none;
    max-width: fit-content;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: background 0.15s, border-color 0.15s;
}
.contact-card-company:hover {
    background: rgba(31,111,92,0.14);
    border-color: var(--teal);
}
.contact-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 10px;
    border-top: 1px solid var(--line);
    margin-top: 12px;
    font-size: 11.5px;
}
/* Calendar */
.cal-header { display:flex; align-items:center; gap:10px; margin-bottom:14px; }
.cal-header h3 { font-size:16px; flex:1; text-align:center; }
.cal-nav { background:var(--paper-raised); border:1px solid var(--line); color:var(--ink); width:28px; height:28px; border-radius:var(--r-sm); cursor:pointer; font-size:15px; line-height:1; }
.cal-nav:hover { border-color:var(--teal); color: var(--teal-text); }
.cal-today-btn { width:auto; padding:0 10px; font-size:11.5px; }
.cal-grid { display:grid; grid-template-columns:repeat(7, minmax(0, 1fr)); gap:1px; background:var(--line); border:1px solid var(--line); }
.cal-weekday { background:var(--paper-raised); text-align:center; font-size:10.5px; color:var(--muted); text-transform:uppercase; letter-spacing:0.03em; padding:6px 0; }
.cal-cell { background:var(--bg-surface); min-height:88px; padding:5px; font-size:11px; min-width:0; overflow:hidden; }
.cal-cell.cal-empty { background:var(--paper); }
.cal-cell.cal-today { background:rgba(31,111,92,0.05); }
.cal-daynum { font-size:11px; color:var(--muted); margin-bottom:4px; }
.cal-today .cal-daynum { color: var(--teal-text); font-weight:600; }
.cal-event { font-size:10.5px; padding:2px 5px; border-radius:2px; margin-bottom:2px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; cursor:pointer; background:rgba(31,111,92,0.12); color: var(--teal-text); }
.cal-event:hover { filter:brightness(0.94); }
.cal-more { font-size:10px; color:var(--muted); margin-top:1px; }
/* Topbar global search */
.topbar-search-wrap { position:relative; display:flex; align-items:center; padding:0 20px 0 6px; }
#global-search { background:var(--bg-subtle); border:1px solid var(--line); color:var(--ink); padding:6px 11px; border-radius:6px; font-size:12.5px; width:190px; transition:width .18s ease, border-color .15s ease, background .15s ease, box-shadow .15s ease; }
#global-search::placeholder { color:var(--muted); }
#global-search:focus { background:var(--bg-surface); width:250px; outline:none; border-color:var(--teal); box-shadow:0 0 0 3px var(--teal-glow); }
/* Topbar right cluster: search + icon nav, pinned to the far right */
.topbar-right{margin-left:auto;display:flex;align-items:center;gap:2px;flex-shrink:0;}
.icon-nav{display:flex;align-items:center;gap:2px;padding-left:6px;}
.icon-tab{position:relative;width:32px;height:32px;padding:0;display:flex;align-items:center;justify-content:center;border:none;border-bottom:none;background:none;color:var(--muted);cursor:pointer;border-radius:6px;flex-shrink:0;}
.icon-tab.active{border-bottom:none;}
.icon-tab svg{width:17px;height:17px;stroke:currentColor;fill:none;stroke-width:1.6;}
.icon-tab:hover{color:var(--ink);background:var(--bg-subtle);}
.icon-tab.active{color:var(--teal-text);background:var(--teal-subtle);}
.icon-tab .icon-dot{position:absolute;top:5px;right:5px;width:6px;height:6px;border-radius:50%;background:var(--teal);border:1px solid var(--bg-surface);}

/* Floating tooltip: appended to body so the topbar's overflow-x:auto (which
   also clips the y-axis) can't cut it off. Positioned via JS on hover. */
/* Top bar: tabs that don't fit collapse into a "More" menu (no sideways scrollbar) */
#topbar-tabs-wrap{display:flex;align-items:center;gap:2px;flex:1;min-width:0;}
#topbar-tabs{display:flex;align-items:center;gap:2px;overflow:hidden;min-width:0;flex:0 1 auto;}
#topbar-tabs .tab{flex-shrink:0;}
#topbar-more{position:relative;flex-shrink:0;display:none;}
#topbar-more.show{display:block;}
.more-btn{display:flex;align-items:center;gap:6px;height:32px;padding:0 10px;border:1px solid transparent;background:none;color:var(--muted);font:inherit;font-size:13px;font-weight:500;border-radius:6px;cursor:pointer;white-space:nowrap;transition:color .15s ease,background .15s ease;}
.more-btn:hover,.more-btn[aria-expanded="true"]{color:var(--ink);background:var(--bg-subtle);}
.more-btn svg{width:15px;height:15px;stroke:currentColor;fill:none;}
.more-btn .more-caret{width:12px;height:12px;transition:transform .15s ease;}
.more-btn[aria-expanded="true"] .more-caret{transform:rotate(180deg);}
.more-count{font-size:10.5px;font-weight:600;color:var(--muted);background:var(--bg-subtle);padding:1px 6px;border-radius:8px;}
.more-menu{display:none;position:absolute;top:calc(100% + 8px);left:0;min-width:250px;max-width:340px;max-height:min(440px,70vh);overflow-y:auto;background:var(--bg-surface);border:1px solid var(--line);border-radius:10px;box-shadow:0 14px 36px rgba(0,0,0,0.18);padding:6px;z-index:900;}
.more-menu.open{display:block;}
.more-search{width:100%;margin:2px 0 6px;font-size:12.5px;padding:6px 9px;}
.more-menu .tab{width:100%;height:auto;min-width:0;padding:8px 10px;gap:10px;justify-content:flex-start;}
.more-menu .tab span:not(.cnt){display:inline !important;}
.more-menu .tab .cnt{display:inline-block !important;margin-left:auto;}
.more-menu .tab:focus-visible{outline:2px solid var(--teal);outline-offset:-2px;}
.more-empty{padding:10px;font-size:12px;color:var(--muted);text-align:center;}
/* Calendar field picker + undated notice */
.cal-field-picker{display:flex;align-items:center;gap:8px;margin:2px 0 10px;font-size:12px;color:var(--muted);}
.cal-field-picker label{margin:0;font-size:11.5px;color:var(--muted);}
.cal-field-picker select{width:auto;font-size:12px;padding:3px 26px 3px 8px;}
.cal-field-label strong{color:var(--ink);font-weight:600;}
.cal-undated{margin-top:10px;font-size:11.5px;color:var(--muted);text-align:right;}
.cal-undated-link{background:none;border:none;color:var(--teal-text);cursor:pointer;font-size:11.5px;font-weight:600;padding:0 0 0 6px;text-decoration:underline;}
#icon-tab-tooltip{position:fixed;background:var(--ink);color:var(--paper);font-size:11px;padding:4px 8px;border-radius:3px;white-space:nowrap;opacity:0;pointer-events:none;transition:opacity .12s ease;box-shadow:0 4px 12px rgba(0,0,0,0.25);z-index:9998;}
#icon-tab-tooltip.show{opacity:1;}
.search-dropdown { position:absolute; top:calc(100% + 6px); right:20px; width:380px; max-height:480px; overflow-y:auto; background:var(--bg-surface); border:1px solid var(--line); border-radius:8px; box-shadow:0 14px 34px rgba(0,0,0,0.2); z-index:1000; display:none; }
.search-dropdown.open { display:block; }
.search-result-group { padding:8px 12px 6px; font-size:10.5px; text-transform:uppercase; letter-spacing:.05em; color:var(--muted); background:var(--bg-subtle); position:sticky; top:0; z-index:2; display:flex; align-items:center; justify-content:space-between; border-bottom:1px solid var(--line-subtle); font-weight:600; }
.search-result-item { padding:9px 12px; cursor:pointer; border-bottom:1px solid var(--line-subtle); font-size:13px; color:var(--ink); transition:background .12s ease; }
.search-result-item:last-child { border-bottom:none; }
.search-result-item:hover { background:var(--bg-subtle); }
.search-result-item.is-archived .search-item-title { color:var(--muted); }
.search-item-top { display:flex; align-items:center; justify-content:space-between; gap:8px; }
.search-item-title { font-weight:500; color:var(--ink); overflow:hidden; text-overflow:ellipsis; white-space:nowrap; min-width:0; }
.search-item-meta { font-size:11px; color:var(--muted); margin-top:3px; display:flex; align-items:center; gap:6px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.search-item-meta > span { overflow:hidden; text-overflow:ellipsis; min-width:0; }
.search-match-why { color:var(--teal-text); font-weight:500; flex-shrink:1; }
.search-dropdown-footer { padding:7px 12px; font-size:11px; color:var(--muted); background:var(--bg-subtle); border-top:1px solid var(--line); display:flex; align-items:center; justify-content:space-between; position:sticky; bottom:0; z-index:2; }
.search-empty { padding:20px; font-size:12.5px; color:var(--muted); text-align:center; }
/* Above-table filter bar */
.filter-bar { display:flex; flex-wrap:wrap; align-items:center; gap:8px; margin:0 0 16px; }
.filter-bar input[type="text"], .filter-bar select { font-size:12.5px; padding:6px 9px; border:1px solid var(--line); border-radius:var(--r-sm); background:var(--bg-surface); color:var(--ink); }
.filter-bar input[type="text"] { width:200px; }
.filter-bar select { width:auto; max-width:170px; }
.filter-bar .filter-clear { font-size:12px; padding:6px 10px; border:1px solid var(--line); border-radius:var(--r-sm); background:var(--paper-raised); color:var(--muted); cursor:pointer; }
.filter-bar .filter-clear:hover { color:var(--danger); border-color:var(--danger); }
.filter-bar .filter-count { font-size:11.5px; color:var(--muted); margin-left:2px; }
.filter-bar .filter-add-btn { font-size:12.5px; padding:6px 11px; border:1px dashed var(--muted); border-radius:var(--r-sm); background:none; color:var(--ink); cursor:pointer; }
.filter-bar .filter-add-btn:hover { border-style:solid; border-color:var(--teal); color:var(--teal); }
.filter-chips { flex-basis:100%; display:flex; flex-wrap:wrap; align-items:center; gap:6px; }
.filter-chip { display:inline-flex; align-items:stretch; border:1px solid var(--line); border-radius:999px; background:var(--paper-raised); font-size:12px; color:var(--ink); max-width:100%; overflow:hidden; }
.filter-chip button { background:none; border:none; cursor:pointer; font:inherit; color:inherit; }
.filter-chip-body { padding:4px 4px 4px 11px; text-align:left; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.filter-chip-body em { font-style:normal; color:var(--muted); }
.filter-chip-x { padding:4px 9px 4px 5px; font-size:15px; line-height:1; color:var(--muted); }
.filter-chip-x:hover { color:var(--danger); }
.filter-chip:hover { border-color:var(--muted); }
.filter-chips .filter-save-view { font-size:12px; padding:4px 10px; border:none; background:none; color:var(--teal); cursor:pointer; text-decoration:underline; }

/* --- Unified Topbar Profile & Workspace Menu --- */
.user-menu-wrap { 
    position: relative; 
    display: flex; 
    align-items: center; 
    margin-left: 6px; 
    flex-shrink: 0; 
}
.user-pill-btn {
    position: relative;
    width: 32px !important; height: 32px !important;
    min-height: 32px !important; max-height: 32px !important;
    border-radius: 6px !important;
    border: 1px solid var(--line);
    background: none;
    color: var(--muted);
    display: inline-flex !important; align-items: center; justify-content: center;
    cursor: pointer; padding: 0 !important; margin: 0 !important; flex-shrink: 0 !important;
    transition: color .15s, border-color .15s, background .15s;
}
.user-pill-btn:hover { color: var(--ink); border-color: var(--muted); background: none; }
.user-pill-btn.active { color: var(--teal-text); border-color: var(--teal); background: var(--teal-subtle); }
.user-pill-btn .user-icon { width: 15px; height: 15px; }
.user-dot {
    position: absolute; top: -3px; right: -3px; width: 8px; height: 8px; border-radius: 50%;
    background: #F59E0B; border: 1.5px solid var(--bg-surface); display: none;
}
body.has-pending-sync .user-dot { display: block; }

/* Unified Dropdown Box */
.user-dropdown {
    position: absolute; top: calc(100% + 8px); right: 0; width: 240px;
    background: var(--bg-surface); border: 1px solid var(--line); color: var(--ink);
    border-radius: 10px; box-shadow: 0 16px 36px rgba(0,0,0,0.16);
    z-index: 1000; display: none; flex-direction: column; 
    overflow-y: auto;          /* <-- Add this */
    max-height: 85vh;          /* <-- Add this */
}
.user-dropdown.open { display:flex; }
.user-dropdown-header {
    padding:12px 14px 10px; background:var(--bg-subtle);
    border-bottom:1px solid var(--line);
}
.user-email-text {
    font-weight:600; font-size:12.5px; color:var(--ink);
    overflow:hidden; text-overflow:ellipsis; white-space:nowrap;
}
/* --- Live sync & network resilience indicator --- */
.cloud-status-pill {
    display:inline-flex; align-items:center; gap:6px; font-size:11px;
    color:var(--muted); margin-top:4px; cursor:pointer;
    padding:2px 6px; margin-left:-6px; border-radius:4px; transition:background 0.15s ease;
}
.cloud-status-pill:hover { background:var(--bg-surface, var(--bg-subtle)); }
.cloud-dot-static {
    width:7px; height:7px; border-radius:50%; background:#34D399;
    box-shadow:0 0 0 2px rgba(52,211,153,0.25); flex-shrink:0;
}
.cloud-dot-static.offline { background:#F59E0B; box-shadow:0 0 0 2px rgba(245,158,11,0.25); }
.cloud-dot-static.syncing { background:#3B82F6; box-shadow:0 0 0 2px rgba(59,130,246,0.3); animation:syncPulse 1.2s infinite ease-in-out; }
@keyframes syncPulse { 0%,100%{opacity:1;transform:scale(1);} 50%{opacity:0.4;transform:scale(0.85);} }
.topbar-sync-badge {
    display:none; align-items:center; gap:5px; font-size:11px; font-weight:500;
    color:#D97706; background:rgba(245,158,11,0.12); border:1px solid rgba(245,158,11,0.28);
    padding:3px 8px; border-radius:12px; cursor:pointer; margin-right:6px; white-space:nowrap;
}
.topbar-sync-badge.show { display:inline-flex; }
.user-dropdown-section { padding:4px; display:flex; flex-direction:column; gap:1px; }
.user-dropdown-divider { height:1px; background:var(--line); margin:2px 0; }
.user-dropdown-item {
    background:none; border:none; padding:8px 10px; font-size:12.5px;
    color:var(--ink); text-align:left; cursor:pointer; display:flex;
    align-items:center; gap:9px; width:100%; border-radius:6px;
    transition:background 0.12s, color 0.12s; font-family:'Work Sans',sans-serif;
}
.user-dropdown-item svg { width:15px; height:15px; stroke:currentColor; fill:none; stroke-width:1.6; flex-shrink:0; }
.user-dropdown-item:hover { background:var(--bg-subtle); color:var(--ink); }
.user-dropdown-item .menu-badge {
    margin-left:auto; font-size:10px; font-weight:600; padding:1px 6px;
    border-radius:8px; background:var(--teal-subtle); color:var(--teal-text);
}
.user-dropdown-item.logout { color:var(--danger); }
.user-dropdown-item.logout:hover { background:rgba(166,64,47,0.1); color:var(--danger); }

/* --- Bulk select (table checkboxes + floating command bar) --- */
th.th-bulk-select, td.td-bulk-select{width:36px;min-width:36px;max-width:36px;text-align:center;padding:8px 4px !important;vertical-align:middle;}
th.th-bulk-select input, td.td-bulk-select input{cursor:pointer;width:15px;height:15px;margin:0 auto;display:block;accent-color:var(--teal);}
tr.row-selected td{background:rgba(31,111,92,0.08) !important;}
.bulk-floating-bar{position:fixed;bottom:24px;left:50%;transform:translateX(-50%) translateY(24px);background:var(--ink);color:var(--paper);padding:7px 12px;border-radius:30px;box-shadow:0 10px 30px rgba(0,0,0,0.32),0 2px 8px rgba(0,0,0,0.18);display:flex;align-items:center;gap:8px;z-index:920;opacity:0;pointer-events:none;transition:transform .2s cubic-bezier(0.16,1,0.3,1),opacity .18s ease;white-space:nowrap;}
.bulk-floating-bar.show{transform:translateX(-50%) translateY(0);opacity:1;pointer-events:auto;}
@media (max-width:760px){.bulk-floating-bar{bottom:calc(16px + env(safe-area-inset-bottom,0px));width:calc(100% - 20px);max-width:480px;padding:7px 9px;overflow-x:auto;border-radius:12px;justify-content:flex-start;scrollbar-width:none;}.bulk-floating-bar::-webkit-scrollbar{display:none;}}
.bulk-count-pill{background:color-mix(in srgb,var(--paper) 16%,transparent);color:var(--paper);font-size:11.5px;font-weight:600;padding:4px 10px;border-radius:14px;display:inline-flex;align-items:center;gap:5px;flex-shrink:0;}
.bulk-btn{background:transparent;border:1px solid color-mix(in srgb,var(--paper) 24%,transparent);color:var(--paper);padding:5px 10px;font-size:12px;font-weight:500;font-family:inherit;border-radius:6px;cursor:pointer;display:inline-flex;align-items:center;gap:5px;transition:background .15s,border-color .15s;flex-shrink:0;}
.bulk-btn:hover{background:color-mix(in srgb,var(--paper) 14%,transparent);border-color:color-mix(in srgb,var(--paper) 50%,transparent);}
.bulk-btn.danger{color:#ff9d8f;border-color:rgba(255,120,100,0.35);}
.bulk-btn.danger:hover{background:rgba(224,87,69,0.25);border-color:var(--danger);color:#fff;}
.bulk-action-select{background:var(--bg-surface);color:var(--ink);border:1px solid var(--line);font-size:11.5px;font-weight:500;padding:5px 24px 5px 8px !important;border-radius:6px;cursor:pointer;flex-shrink:0;height:29px;width:auto;}

/* --- Expanded split-pane sidebar & interaction hub --- */
.sidebar.expanded { width: min(1000px, 100vw); }
.sb-split-layout { display:flex; flex:1; min-height:0; overflow:hidden; }
.sb-split-layout > .sb-pane-context.sb-body { width:340px; flex:none; flex-grow:0; border-right:1px solid var(--line); padding:18px; gap:14px; }
.sb-pane-timeline { flex:1; min-width:0; overflow-y:auto; padding:18px; display:flex; flex-direction:column; gap:14px; background:var(--bg-canvas); }
.sb-mobile-tabs { display:none; background:var(--bg-subtle); border-bottom:1px solid var(--line); padding:4px; gap:4px; }
.sb-mobile-tab-btn { flex:1; border:none; background:transparent; padding:8px; font-size:12px; font-weight:500; color:var(--muted); border-radius:6px; cursor:pointer; font-family:'Work Sans',sans-serif; }
.sb-mobile-tab-btn.active { background:var(--bg-surface); color:var(--teal-text); font-weight:600; box-shadow:0 1px 3px rgba(0,0,0,0.08); }
@media (max-width:760px){
    .sb-mobile-tabs { display:flex; }
    .sb-split-layout { flex-direction:column; }
    .sb-split-layout > .sb-pane-context.sb-body, .sb-pane-timeline { width:100%; border-right:none; padding:16px; flex:1 1 auto; min-height:0; }
    .sb-pane-context.hidden-mobile, .sb-pane-timeline.hidden-mobile { display:none !important; }
}
.interaction-bar { display:flex; gap:4px; flex-wrap:wrap; background:var(--bg-subtle); padding:4px; border-radius:8px; border:1px solid var(--line); }
.interaction-btn { flex:1; min-width:64px; border:none; background:transparent; color:var(--ink); font-size:11.5px; font-weight:500; font-family:inherit; padding:7px 8px; border-radius:6px; cursor:pointer; display:inline-flex; align-items:center; justify-content:center; gap:5px; transition:background .15s, color .15s; white-space:nowrap; }
.interaction-btn:hover { background:var(--bg-surface); color:var(--teal-text); }
.interaction-btn.active { background:var(--bg-surface); color:var(--teal-text); font-weight:600; box-shadow:0 1px 3px rgba(0,0,0,0.08); }
.interaction-composer { background:var(--bg-surface); border:1px solid rgba(31,111,92,0.3); border-radius:8px; padding:14px; display:flex; flex-direction:column; gap:10px; }
.interaction-composer .ic-title { font-weight:600; font-size:12.5px; color:var(--ink); display:flex; align-items:center; justify-content:space-between; gap:8px; }
.interaction-composer .ic-title small { font-weight:400; font-size:10.5px; color:var(--muted); }
.interaction-composer input, .interaction-composer select, .interaction-composer textarea { font-size:12.5px; padding:7px 9px; }
.interaction-composer textarea { min-height:64px; resize:vertical; }
.ic-row { display:flex; gap:8px; align-items:center; }
.ic-actions { display:flex; justify-content:flex-end; gap:6px; flex-wrap:wrap; }
.ic-followup { display:flex; align-items:center; gap:8px; font-size:12px; color:var(--muted); flex-wrap:wrap; }
.ic-followup input[type=checkbox] { width:auto; margin:0; }
.ic-followup input[type=text] { flex:1; min-width:140px; }
.ic-followup input[type=date] { width:auto; }
.ic-hint { font-size:11.5px; color:var(--muted); }
.composer-chips { display:flex; gap:5px; flex-wrap:wrap; }
.composer-chip { background:var(--bg-surface); border:1px solid var(--line); border-radius:14px; padding:3px 10px; font-size:11px; color:var(--ink); cursor:pointer; font-family:inherit; transition:background .12s, border-color .12s; }
.composer-chip:hover { border-color:var(--teal); }
.composer-chip.selected { background:var(--teal); color:var(--on-teal); border-color:var(--teal); }
.timeline-head { font-size:11px; text-transform:uppercase; letter-spacing:0.04em; color:var(--muted); font-weight:600; }
.timeline-stream { display:flex; flex-direction:column; gap:8px; }
.timeline-item { background:var(--bg-surface); border:1px solid var(--line); border-radius:8px; padding:10px 12px; display:flex; flex-direction:column; gap:6px; transition:border-color .15s; }
.timeline-item:hover { border-color:var(--teal); }
.timeline-item-top { display:flex; justify-content:space-between; align-items:flex-start; gap:8px; }
.timeline-badge { display:inline-flex; align-items:center; gap:5px; font-size:11px; font-weight:600; padding:2px 8px; border-radius:5px; min-width:0; }
.timeline-badge span { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.timeline-time { font-size:11px; color:var(--muted); white-space:nowrap; display:flex; align-items:center; gap:6px; }
.timeline-del { background:none; border:none; color:var(--muted); cursor:pointer; padding:1px 3px; border-radius:4px; opacity:0; transition:opacity .12s; line-height:0; }
.timeline-item:hover .timeline-del, .timeline-del:focus-visible { opacity:1; }
.timeline-del:hover { color:var(--danger); background:var(--bg-subtle); }
@media (hover:none){ .timeline-del { opacity:.7; } }
.timeline-body { font-size:12.5px; color:var(--ink); line-height:1.5; white-space:pre-wrap; word-break:break-word; }
.timeline-meta { font-size:11px; color:var(--muted); display:flex; gap:10px; flex-wrap:wrap; align-items:center; }
.timeline-meta a { color:var(--teal-text); }
.badge-call { background:rgba(59,130,246,0.12); color:var(--blue-text); }
.badge-whatsapp { background:rgba(46,179,149,0.14); color:var(--teal-text); }
.badge-email { background:rgba(139,92,246,0.12); color:var(--purple-text); }
.badge-meeting { background:rgba(184,134,43,0.15); color:var(--amber-text); }
.badge-note { background:rgba(110,101,88,0.12); color:var(--muted); }

/* =========================================================
   MOBILE / RESPONSIVE LAYER
   Everything above this point is the original desktop layout,
   untouched. Rules below adapt it for narrow / touch screens
   without changing any markup or JS.
========================================================= */

/* Tablet / small-laptop: trim outer spacing a bit */
@media (max-width: 1000px){
    .main{padding:24px 20px 48px;}
}

/* Mid-width desktops: give the object tabs the room (the quick icons live in the avatar menu too) */
@media (min-width: 761px) and (max-width: 1100px){
    #icon-nav{display:none;}
    #brand-home-label{display:none;}
    #brand-home{padding-right:10px;margin-right:4px;}
    .topbar{padding-left:16px;padding-right:16px;}
    #global-search{width:150px;}
    #global-search:focus{width:200px;}
    .topbar-search-wrap{padding-right:8px;}
}

@media (max-width: 760px){
    html{ -webkit-text-size-adjust:100%; }
    body{ font-size:13.5px; }

    /* --- Balanced Mobile Bottom Navigation Bar --- */
    .topbar {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        top: auto;
        min-height: 54px;
        padding: 3px 10px;
        padding-bottom: max(8px, env(safe-area-inset-bottom, 0px));
        gap: 3px;
        border-top: 1px solid var(--topbar-border);
        border-bottom: none;
        box-shadow: var(--shadow-nav);
        z-index: 850;
        background: var(--topbar-bg);
    }

    /* Brand / Home button */
    #brand-home {
        min-width: 40px;
        height: 42px;
        padding: 0;
        margin-right: 0;
        border: none;
        border-right: none; /* removes the desktop separator line */
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: 7px;
    }
    #brand-home svg {
        width: 20px !important;
        height: 20px !important;
    }
    #brand-home.active,
    .tab.active {
        border: none;
        background: var(--teal-subtle);
        color: var(--teal);
        border-radius: 10px;
    }
    #brand-home-label { display: none; }

    /* "More" on the bottom bar: icon-only button, menu opens upward as a sheet */
    .more-btn{height:42px;min-width:42px;padding:0 10px;justify-content:center;border-radius:10px;}
    .more-btn .more-label,.more-btn .more-caret{display:none;}
    .more-btn svg{width:19px;height:19px;}
    .more-menu{position:fixed;left:8px;right:8px;top:auto;bottom:calc(64px + env(safe-area-inset-bottom,0px));min-width:0;max-width:none;max-height:60vh;}
    .more-menu .tab{padding:12px 12px;}

    /* Navigation tabs */
    #topbar-tabs {
        gap: 2px;
        padding: 0 2px;
    }
    .tab {
        min-width: 42px;
        height: 42px;
        padding: 0 10px;
        font-size: 13px;
        gap: 0;
        display: flex;
        align-items: center;
        justify-content: center;
        border-bottom: none;
        border-radius: 7px;
    }
    .tab svg {
        width: 19px !important;
        height: 19px !important;
    }
    .tab .cnt { display: none; }
    .tab span:not(.cnt) { display: none; }

    /* Search trigger */
    .topbar-search-wrap {
        padding: 0 3px;
        position: relative;
        display: flex;
        align-items: center;
    }
    #global-search {
        width: 35px;
        height: 35px;
        padding: 0;
        color: transparent;
        cursor: pointer;
        background-color: transparent;
        border: none;
        border-radius: 7px;
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238FA39D' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m21 21-4.3-4.3'/%3E%3C/svg%3E");
        background-repeat: no-repeat;
        background-position: center;
        background-size: 18px;
        transition: width 0.2s ease, background-color 0.15s ease, border-color 0.15s ease;
    }
    #global-search:hover {
        background-color: var(--bg-subtle);
    }
    #global-search::placeholder { color: transparent; }
    
    #global-search:focus {
        position: relative;
        width: 155px;
        height: 35px;
        max-width: 44vw;
        z-index: 10;
        color: var(--ink);
        padding: 5px 10px 5px 30px;
        font-size: 13px;
        background-color: var(--bg-surface);
        border: 1px solid var(--teal);
        border-radius: 7px;
        cursor: text;
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238FA39D' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m21 21-4.3-4.3'/%3E%3C/svg%3E");
        background-repeat: no-repeat;
        background-position: 8px center;
        background-size: 14px;
        box-shadow: var(--shadow-pop);
    }
    #global-search:focus::placeholder { color: var(--muted); }

    /* User Profile Avatar Pill */
    .user-pill-btn {
        width: 34px !important;
        height: 34px !important;
        min-height: 34px !important;
        max-height: 34px !important;
    }

    /* Upward-opening menus */
    .search-dropdown {
        position: absolute;
        bottom: calc(100% + 9px);
        top: auto;
        right: 0;
        left: auto;
        width: 295px;
        max-width: 90vw;
        max-height: 60vh;
        box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.35);
    }
    .user-dropdown {
        position: absolute;
        bottom: calc(100% + 9px);
        top: auto;
        right: 0;
        width: 225px;
        box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.4);
    }

    #icon-nav { display: none !important; }

    /* --- Page content & bottom spacing --- */
    .main {
        padding: max(16px, env(safe-area-inset-top, 0px)) 12px calc(78px + env(safe-area-inset-bottom, 0px));
    }
    .panel-head { margin-bottom: 16px; padding-bottom: 12px; gap: 12px; }
    .panel-head h2 { font-size: 19px; }
    .panel-head p { max-width: 100%; font-size: 12.5px; }
    .head-right { width: 100%; flex-wrap: wrap; gap: 8px; }
    .head-right-toolbar { width: 100%; }
    .toolbar-group { flex-wrap: wrap; }
    .modern-add-btn, .add-btn, .top-btn, .top-btn-alt { min-height: 40px; padding-left: 14px; padding-right: 14px; }

    .filter-bar { width: 100%; }
    .filter-bar input[type="text"], .filter-bar select { flex: 1 1 140px; width: auto; min-height: 38px; }

    /* --- Tables --- */
    td, th { padding: 9px 8px; font-size: 13px; }
    .table-scroll { margin: 0 -12px; padding: 0 12px; }
    .table-scroll table { min-width: 640px; }

    /* --- Kanban board --- */
    .board { scroll-snap-type: x mandatory; margin: 0 -12px; padding: 0 12px 12px; gap: 10px; }
    .board-col { width: 82vw; scroll-snap-align: start; max-height: calc(100vh - 220px); }

    /* --- Record panel & settings drawer --- */
    .sidebar { width: 100vw; }
    .settings-drawer { width: 100vw; }
    .sb-head { padding: 16px 16px 14px; }
    .sb-head h3 { font-size: 18px; }
    .sb-body { padding: 16px; gap: 14px; }
    .sb-close { font-size: 28px; padding: 4px 8px; }

    /* --- Modals become bottom sheets --- */
    .modal-backdrop { align-items: flex-end; padding: 0; }
    .modal-box { max-width: 100%; width: 100%; border-radius: 16px 16px 0 0; max-height: 88vh; overflow-y: auto; padding: 20px 18px 22px; }
    .modal-backdrop.show .modal-box { transform: translateY(0); }

    /* --- General tap targets --- */
    button, .toolbar-btn, .view-switch button, input, select, textarea { min-height: 38px; }
    /* Checkboxes and in-table controls must not stretch rows (this is what defeated Compact on phones) */
    input[type="checkbox"], input[type="radio"] { min-height: auto; }
    td select, td input, td button { min-height: 0; }
    .toolbar-btn.icon-only { width: 38px; }
    .view-switch button { padding: 8px 10px; }

    /* --- Toasts float above the bar --- */
    .toast, .undo-toast {
        left: 12px;
        right: 12px;
        bottom: calc(70px + env(safe-area-inset-bottom, 0px));
    }

    .dm-grid { grid-template-columns: 1fr; }

    /* Settings sub-tabs */
    .settings-tabs { flex-wrap: nowrap; gap: 0; }
    .settings-tab { flex: 1; justify-content: center; padding: 11px 4px; min-height: 40px; }
    .settings-tab span { display: none; }
    .settings-tab svg { width: 18px; height: 18px; }
}
/* --- Activities Dashboard (Sidebar Right Pane) --- */
.activities-highlights { 
    display: flex; 
    gap: 12px; 
    margin-bottom: 20px; 
    flex-wrap: wrap; 
}
.ah-card { 
    flex: 1; 
    min-width: 110px; 
    background: var(--bg-surface); 
    border: 1px solid var(--line); 
    border-radius: 8px; 
    padding: 14px; 
    display: flex; 
    flex-direction: column; 
    gap: 6px; 
    box-shadow: var(--card-shadow); 
    transition: border-color 0.15s ease; 
}
.ah-card:hover { border-color: var(--teal); }
.ah-lbl { 
    font-size: 11px; 
    text-transform: uppercase; 
    letter-spacing: 0.04em; 
    color: var(--muted); 
    font-weight: 600; 
}
.ah-val { 
    font-size: 14px; 
    font-weight: 600; 
    color: var(--ink); 
    white-space: nowrap; 
    overflow: hidden; 
    text-overflow: ellipsis; 
}
.ah-val.highlight { color: var(--teal-text); }

/* Header & Add Button */
.activities-header { 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    margin-bottom: 14px; 
    padding-bottom: 10px; 
    border-bottom: 1px solid var(--line-subtle); 
}
.activities-title { font-size: 15px; font-weight: 600; color: var(--ink); margin: 0; }

.activities-add-wrap { position: relative; }
.activities-add-btn { 
    background: var(--teal); 
    color: var(--paper-raised); 
    border: none; 
    padding: 6px 14px; 
    font-size: 12.5px; 
    font-weight: 600; 
    border-radius: 6px; 
    cursor: pointer; 
    display: flex; 
    align-items: center; 
    gap: 6px; 
    transition: background 0.15s, transform 0.1s; 
    box-shadow: 0 1px 2px rgba(20,31,34,0.15); 
    font-family: 'Work Sans', sans-serif; 
}
.activities-add-btn:hover { background: var(--teal-deep); transform: translateY(-1px); }
.activities-add-btn svg { width: 14px; height: 14px; stroke-width: 2.2; stroke: currentColor; fill: none; }

/* The Popover Menu */
.activities-add-menu { 
    display: none; 
    position: absolute; 
    right: 0; 
    top: calc(100% + 6px); 
    background: var(--bg-surface); 
    border: 1px solid var(--line); 
    border-radius: 8px; 
    box-shadow: 0 6px 24px rgba(0,0,0,0.15); 
    z-index: 100; 
    min-width: 170px; 
    padding: 6px; 
    flex-direction: column; 
    gap: 2px; 
}
.activities-add-menu.show { display: flex; }
.activities-menu-btn { 
    background: none; 
    border: none; 
    padding: 8px 12px; 
    text-align: left; 
    font-size: 12.5px; 
    color: var(--ink); 
    border-radius:var(--r-sm); 
    cursor: pointer; 
    display: flex; 
    align-items: center; 
    gap: 10px; 
    font-family: 'Work Sans', sans-serif; 
    transition: background 0.12s, color 0.12s;
}
.activities-menu-btn:hover { background: var(--bg-subtle); color: var(--teal-text); }
.activities-menu-btn svg { width: 15px; height: 15px; color: var(--muted); stroke: currentColor; fill: none; }
.activities-menu-btn:hover svg { color: var(--teal-text); }

/* --- Seamless Table Header Column Switcher --- */
.table-scroll-wrap {
    position: relative;
}

.table-col-header-btn {
    position: absolute;
    top: 0;
    right: 0;
    height: var(--th-h);
    width: 32px;
    box-sizing: border-box;
    background: var(--bg-canvas);
    border: none;
    color: var(--ink);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    padding: 0;
    transition: background 0.15s ease;
}

.table-col-header-btn:hover {
    background: var(--bg-subtle);
    color: var(--teal-text);
}

.table-col-header-btn svg {
    width: 14px;
    height: 14px;
}

/* Header row height and the button share one variable so their bottom borders always line up */
.table-scroll-wrap { --th-h: 34px; }
.density-compact .table-scroll-wrap { --th-h: 28px; }
.table-scroll table th { height: var(--th-h); box-sizing: border-box; }

/* Gives the last header text breathing room so it doesn't tuck under the button when scrolled all the way right */
.table-scroll table th:last-child {
    padding-right: 38px !important;
}

/* ===== Activity section: pulse, actions, upcoming, timeline ===== */
.act-pulse { display:grid; grid-template-columns:repeat(3,1fr); border:1px solid var(--line); border-radius:10px; background:var(--bg-surface); margin-bottom:12px; overflow:hidden; }
.act-cell { display:flex; flex-direction:column; gap:3px; padding:11px 14px; min-width:0; }
.act-cell + .act-cell { border-left:1px solid var(--line); }
.act-lbl { font-size:10.5px; text-transform:uppercase; letter-spacing:.05em; color:var(--muted); font-weight:600; }
.act-val { font-size:14px; font-weight:600; color:var(--ink); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.act-val.ok { color:var(--teal-text); } .act-val.warn { color:var(--amber-text, #B8862B); } .act-val.bad, .act-sub.bad { color:var(--danger, #C0392B); }
.act-sub { font-size:11.5px; color:var(--muted); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.act-nudge { display:flex; align-items:center; justify-content:space-between; gap:10px; font-size:12px; color:var(--muted); background:var(--bg-subtle); border-radius:8px; padding:8px 12px; margin-bottom:12px; }
.act-nudge-btn { background:none; border:1px solid var(--teal); color:var(--teal-text); border-radius:6px; font-size:11.5px; font-weight:600; padding:3px 10px; cursor:pointer; flex-shrink:0; }
.act-nudge-btn:hover { background:var(--teal-subtle); }
.act-bar { display:flex; align-items:center; justify-content:space-between; gap:8px; flex-wrap:wrap; margin-bottom:14px; }
.act-bar-log { display:flex; gap:4px; flex-wrap:wrap; }
.act-chip, .act-schedule { display:inline-flex; align-items:center; gap:6px; height:30px; padding:0 10px; border:1px solid var(--line); background:var(--bg-surface); color:var(--muted); border-radius:7px; font-size:12px; font-weight:500; cursor:pointer; transition:color .15s,border-color .15s,background .15s; }
.act-chip:hover, .act-schedule:hover { color:var(--ink); border-color:var(--muted); }
.act-chip.active { color:var(--teal-text); border-color:var(--teal); background:var(--teal-subtle); }
.act-schedule { color:var(--teal-text); border-color:var(--teal); font-weight:600; }
.act-schedule.active { background:var(--teal); color:var(--on-teal, #fff); }
.act-section { margin-bottom:18px; }
.act-section-head { display:flex; align-items:center; gap:8px; font-size:11px; text-transform:uppercase; letter-spacing:.05em; color:var(--muted); font-weight:600; margin-bottom:8px; }
.act-count { background:var(--bg-subtle); border-radius:10px; padding:0 7px; font-size:10.5px; line-height:17px; }
.act-hint { margin-left:auto; text-transform:none; letter-spacing:0; font-weight:400; font-size:11px; }
.up-list { display:flex; flex-direction:column; border:1px solid var(--line); border-radius:10px; background:var(--bg-surface); }
.up-row { display:flex; align-items:flex-start; gap:10px; padding:10px 12px; }
.up-row + .up-row { border-top:1px solid var(--line); }
.up-row.overdue { box-shadow:inset 3px 0 0 var(--danger, #C0392B); }
.up-ico, .tl-ico { width:24px; height:24px; border-radius:50%; display:inline-flex; align-items:center; justify-content:center; flex-shrink:0; }
.up-check { width:16px; height:16px; margin:4px 4px 0 4px; border:1.5px solid var(--muted); border-radius:50%; background:none; cursor:pointer; flex-shrink:0; padding:0; }
.up-check:hover { border-color:var(--teal); background:var(--teal-subtle); }
.up-main { flex:1; min-width:0; }
.up-title { font-size:13px; font-weight:600; color:var(--ink); overflow:hidden; text-overflow:ellipsis; }
.up-sub { display:flex; gap:8px; align-items:center; flex-wrap:wrap; font-size:11.5px; color:var(--muted); margin-top:1px; }
.up-row.overdue .up-when { color:var(--danger, #C0392B); }
.up-sub a { color:var(--teal-text); }
.up-tag, .up-via { font-size:10px; text-transform:uppercase; letter-spacing:.04em; background:var(--bg-subtle); color:var(--muted); border-radius:4px; padding:0 5px; font-weight:600; }
.up-note { font-size:12px; color:var(--muted); margin-top:4px; }
.up-resch { display:flex; align-items:center; gap:6px; flex-wrap:wrap; margin-top:8px; }
.up-resch input { font-size:12px; padding:4px 6px; width:auto; }
.up-actions { display:flex; gap:2px; opacity:.55; transition:opacity .12s; }
.up-row:hover .up-actions, .up-row:focus-within .up-actions { opacity:1; }
.up-act { width:26px; height:26px; border:none; background:none; color:var(--muted); border-radius:6px; cursor:pointer; display:inline-flex; align-items:center; justify-content:center; }
.up-act:hover { background:var(--bg-subtle); color:var(--ink); } .up-act.done:hover { color:var(--teal-text); background:var(--teal-subtle); } .up-act.del:hover { color:var(--danger, #C0392B); }
@media (hover:none){ .up-actions { opacity:1; } }
.tl-filters, .files-kinds { display:flex; gap:5px; flex-wrap:wrap; margin-bottom:10px; }
.tl-filter { background:none; border:1px solid var(--line); border-radius:14px; padding:2px 10px; font-size:11.5px; color:var(--muted); cursor:pointer; }
.tl-filter b { font-weight:600; margin-left:2px; opacity:.7; }
.tl-filter:hover { border-color:var(--muted); color:var(--ink); }
.tl-filter.active { background:var(--ink); color:var(--paper); border-color:var(--ink); }
.tl-stream { display:flex; flex-direction:column; gap:14px; }
.tl-group-label { font-size:11px; color:var(--muted); font-weight:600; margin-bottom:6px; }
.tl-item { display:flex; gap:10px; padding:8px 0; position:relative; }
.tl-item + .tl-item { border-top:1px solid var(--line); }
.tl-main { flex:1; min-width:0; }
.tl-top { display:flex; justify-content:space-between; align-items:flex-start; gap:8px; }
.tl-title { font-size:12.5px; font-weight:600; color:var(--ink); }
.tl-time { font-size:11px; color:var(--muted); white-space:nowrap; display:flex; align-items:center; gap:6px; }
.tl-item:hover .timeline-del, .tl-item .timeline-del:focus-visible { opacity:1; }
.tl-body { font-size:12.5px; color:var(--ink); line-height:1.5; margin-top:2px; white-space:pre-wrap; word-break:break-word; display:-webkit-box; -webkit-line-clamp:4; -webkit-box-orient:vertical; overflow:hidden; }
.tl-body:hover { -webkit-line-clamp:unset; }
.tl-meta { display:flex; gap:10px; flex-wrap:wrap; font-size:11px; color:var(--muted); margin-top:3px; }
.tl-meta a { color:var(--teal-text); }
@media (max-width:520px){ .act-pulse { grid-template-columns:1fr; } .act-cell + .act-cell { border-left:none; border-top:1px solid var(--line); } .act-chip span { display:none; } }

/* ===== Files ===== */
.files-count { display:inline-flex; align-items:center; gap:3px; color:var(--teal-text); font-size:12px; font-weight:600; }
.lib-mode { display:inline-flex; border:1px solid var(--line); border-radius:8px; overflow:hidden; }
.lib-mode button { background:none; border:none; padding:5px 12px; font-size:12px; color:var(--muted); cursor:pointer; display:inline-flex; align-items:center; gap:5px; height:30px; }
.lib-mode button.active { background:var(--ink); color:var(--paper); }
.lib-mode-n { font-size:10.5px; opacity:.75; }
.files-summary { font-size:12.5px; color:var(--muted); margin:2px 0 12px; display:flex; gap:8px; align-items:baseline; flex-wrap:wrap; }
.files-summary b { color:var(--ink); } .files-summary .dot { opacity:.5; }
.files-q { flex:1; min-width:180px; }
.files-table td, .files-table th { vertical-align:middle; }
.files-table th.num, .files-table td.num { text-align:right; white-space:nowrap; }
.file-name { display:flex; align-items:center; gap:8px; cursor:pointer; min-width:0; }
.file-name:hover .file-name-t { color:var(--teal-text); text-decoration:underline; }
.file-name-t { font-weight:600; overflow:hidden; text-overflow:ellipsis; max-width:320px; white-space:nowrap; }
.file-ico { width:26px; height:26px; border-radius:6px; display:inline-flex; align-items:center; justify-content:center; background:var(--bg-subtle); color:var(--muted); flex-shrink:0; }
.file-ico.k-pdf { background:rgba(192,57,43,.12); color:#C0392B; } .file-ico.k-sheet { background:rgba(46,179,149,.14); color:var(--teal-text); }
.file-ico.k-doc { background:rgba(59,130,246,.12); color:var(--blue-text); } .file-ico.k-image { background:rgba(139,92,246,.12); color:var(--purple-text); }
.file-kind { font-size:11.5px; color:var(--muted); }
.file-link { display:flex; align-items:center; gap:6px; flex-wrap:wrap; }
.file-ent { font-size:10px; text-transform:uppercase; letter-spacing:.04em; background:var(--bg-subtle); color:var(--muted); border-radius:4px; padding:0 5px; font-weight:600; }
.file-co { font-size:11.5px; color:var(--muted); }
.file-actions { white-space:nowrap; text-align:right; }
.files-empty { text-align:center; padding:60px 20px; color:var(--muted); }
.files-empty .fe-title { font-weight:600; color:var(--ink); margin:10px 0 4px; } .files-empty .fe-sub { font-size:12.5px; max-width:420px; margin:0 auto; }

.file-actions { display:flex; gap:4px; justify-content:flex-end; align-items:center; }
.files-table td.file-actions { display:table-cell; }
.files-table td.file-actions > * { display:inline-flex; vertical-align:middle; margin-left:4px; }

/* Columns control: header-corner on desktop, in-flow button on mobile */
.cols-bar-mobile { display:none; }
@media (max-width: 760px){
    .table-col-header-btn { display:none !important; }
    .table-scroll table th:last-child { padding-right: 10px !important; }
    .cols-bar-mobile { display:flex; justify-content:flex-end; padding:0 0 8px; }
    .cols-bar-btn { display:inline-flex; align-items:center; gap:6px; height:32px; padding:0 12px; border:1px solid var(--line); background:var(--bg-surface); color:var(--muted); border-radius:7px; font-size:12px; font-weight:500; cursor:pointer; }
    .cols-bar-btn svg { width:14px; height:14px; }
    .cols-bar-btn:active { background:var(--bg-subtle); color:var(--ink); }
}

/* Activity page: day headings + "show more" paging */
.activity-day { font-size:11px; text-transform:uppercase; letter-spacing:.05em; color:var(--muted); font-weight:600; padding:14px 0 4px; }
.activity-feed .activity-day:first-child { padding-top:8px; }
.activity-more { display:flex; align-items:center; justify-content:space-between; gap:10px; margin:12px 2px 24px; font-size:12px; color:var(--muted); }


/* =========================================================
   DESIGN LANGUAGE v2: record sidebar + shared primitives
   Radius scale --r-sm/md/lg, hairline dividers, tinted (not solid)
   hover states, neutral icon buttons, divided rows not boxed cards.
========================================================= */
.sb-head { padding:20px 22px 16px; border-bottom:1px solid var(--line); display:flex; justify-content:space-between; align-items:flex-start; gap:12px; background:var(--bg-surface); }
.sb-head h3 { font-size:22px; margin:0; line-height:1.2; overflow-wrap:anywhere; }
.sb-head .meta { font-size:12px; color:var(--muted); margin-top:6px; }
.sb-eyebrow { display:flex; align-items:center; gap:6px; flex-wrap:wrap; margin:0 0 6px; font-size:10.5px; font-weight:600; letter-spacing:.08em; text-transform:uppercase; color:var(--teal-text); }
.sb-eyebrow.is-edit { color:var(--amber-text); }
.sb-close { flex-shrink:0; width:30px; height:30px; margin:-4px -6px 0 0; display:inline-flex; align-items:center; justify-content:center; background:none; border:none; color:var(--muted); cursor:pointer; border-radius:var(--r-md); transition:background .15s, color .15s; padding:0; }
.sb-close:hover { color:var(--ink); background:var(--bg-subtle); }
.sb-close:focus-visible { outline:2px solid var(--teal); outline-offset:1px; }

.sb-body { padding:18px; overflow-y:auto; flex:1; display:flex; flex-direction:column; gap:12px; background:var(--bg-canvas); }
.sb-section { background:var(--bg-surface); border:1px solid var(--line); border-radius:var(--r-lg); padding:14px 16px; box-shadow:var(--card-shadow); }
.sb-sec-head { display:flex; justify-content:space-between; align-items:center; gap:8px; min-height:24px; margin-bottom:10px; font-size:10.5px; font-weight:600; text-transform:uppercase; letter-spacing:.06em; color:var(--muted); }
.sb-sec-head > span:first-child:not(.sb-count):not(.cf-count) { display:inline-flex; align-items:center; gap:7px; }
.sb-count { background:var(--bg-subtle); color:var(--muted); border-radius:10px; padding:0 7px; font-size:10.5px; line-height:17px; font-weight:600; letter-spacing:0; margin-left:6px; }
.sb-sec-hint { margin-left:auto; text-transform:none; letter-spacing:0; font-weight:400; font-size:11px; color:var(--muted); }

/* Header actions: tinted ghost buttons, never solid-flip on hover */
.sb-add-btn { display:inline-flex; align-items:center; gap:5px; height:24px; padding:0 9px; background:var(--teal-subtle); border:none; color:var(--teal-text); cursor:pointer; font-family:inherit; font-size:11.5px; font-weight:600; letter-spacing:0; text-transform:none; border-radius:var(--r-sm); transition:background .15s; }
.sb-add-btn:hover { background:var(--teal-glow); }
.sb-icon-btn { background:var(--teal-subtle); border:none; color:var(--teal-text); cursor:pointer; font-size:11.5px; font-weight:600; padding:6px 10px; border-radius:var(--r-sm); display:flex; align-items:center; gap:4px; transition:background .15s, color .15s; }
.sb-icon-btn:hover { background:var(--teal-glow); }
.sb-icon-btn.icon-only { padding:0; width:24px; height:24px; justify-content:center; background:none; color:var(--muted); }
.sb-icon-btn.icon-only:hover { background:var(--bg-subtle); color:var(--ink); }
.sb-icon-btn.danger { background:rgba(166,64,47,.1); color:var(--danger); }
.sb-icon-btn.danger:hover { background:rgba(166,64,47,.18); color:var(--danger); }

/* Related lists: one container, divided rows (matches .up-list / .tl-item) */
.sb-list { display:flex; flex-direction:column; margin:0 -8px; }
.sb-card { display:flex; align-items:center; gap:10px; padding:9px 8px; margin:0; background:none; border:none; border-radius:var(--r-md); cursor:pointer; font-size:13px; transition:background .12s; position:relative; }
.sb-card + .sb-card::before { content:''; position:absolute; top:0; left:46px; right:8px; height:1px; background:var(--line-subtle); }
.sb-card:hover { background:var(--bg-subtle); }
.sb-card:hover + .sb-card::before, .sb-card:hover::before { opacity:0; }
.sb-card-ico { width:28px; height:28px; border-radius:var(--r-md); display:inline-flex; align-items:center; justify-content:center; flex-shrink:0; background:var(--teal-subtle); color:var(--teal-text); }
.sb-card-main { flex:1; min-width:0; }
.sb-card-title { font-weight:600; font-size:13px; color:var(--ink); line-height:1.3; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.sb-card-meta { display:flex; align-items:center; gap:6px; flex-wrap:wrap; margin-top:2px; color:var(--muted); font-size:11.5px; }
.sb-card-go { color:var(--muted); opacity:.45; display:inline-flex; flex-shrink:0; transition:opacity .12s, transform .12s; }
.sb-card:hover .sb-card-go { opacity:1; color:var(--teal-text); transform:translateX(1px); }
.sb-card .sb-icon-btn.icon-only { flex-shrink:0; }
.sb-empty { color:var(--muted); font-size:12.5px; padding:2px 0 4px; }

/* Lean linked-account row */
.sb-section.sb-linked { padding:10px 12px; }
.sb-section.sb-linked .sb-sec-head { margin-bottom:6px; }
.sb-section.sb-linked .sb-list { margin:0 -4px; }
.sb-section.sb-linked .sb-card { padding:6px 4px; }
.sb-section.sb-linked .sb-card-title { font-size:13.5px; }

/* Pipeline stage control */
.sb-stage-select { width:100%; font-weight:600; font-size:13px; color:var(--teal-text); background-color:var(--teal-subtle); border:1px solid transparent; }
.sb-stage-select:hover { border-color:var(--teal); }

.sb-form { display:none; background:var(--teal-subtle); padding:12px; margin-bottom:10px; border-radius:var(--r-md); border:1px dashed rgba(31,111,92,.4); }
.sb-form.open { display:flex; flex-direction:column; gap:10px; }
.sb-archive-btn, .sb-delete-btn { border-radius:var(--r-md); }
.sb-split-layout > .sb-pane-context.sb-body { padding:16px; gap:12px; background:var(--bg-canvas); }
.sb-field-icon { border-radius:var(--r-sm); }
.interaction-bar, .interaction-composer, .timeline-item { border-radius:var(--r-lg); }
.interaction-btn { border-radius:var(--r-md); }
@media (max-width:760px){
    .sb-head { padding:16px 16px 14px; }
    .sb-body, .sb-split-layout > .sb-pane-context.sb-body { padding:14px; }
    .sb-close { width:36px; height:36px; }
}

/* ---- Cards and panels get the shared card shadow ---- */
.settings-section, .stat-card, .analytics-panel, .board-col, .toggle-row, .dm-card, .set-card { box-shadow:var(--card-shadow); }
.board-col { background:var(--bg-subtle); border-color:var(--line-subtle); }
.stat-card:hover { border-color:var(--teal); }
.sb-delete-btn { border-style:solid; border-color:rgba(166,64,47,.3); background:transparent; }
.sb-delete-btn:hover { background:rgba(166,64,47,.08); border-color:var(--danger); }

/* ---- Tables: one rounded card, quiet header (same eyebrow style as the sidebar) ---- */
.table-scroll-wrap { background:var(--bg-surface); border:1px solid var(--line); border-radius:var(--r-lg); box-shadow:var(--card-shadow); overflow:hidden; }
th { font-size:10.5px; font-weight:600; letter-spacing:.06em; text-transform:uppercase; color:var(--muted); border-bottom:1px solid var(--line); background:var(--bg-surface); }
th.sortable:hover, th.sortable.sorted { color:var(--ink); }
tbody tr:last-child td { border-bottom:none; }
td { border-bottom-color:var(--line-subtle); }
.table-col-header-btn { background:var(--bg-surface); border-bottom:none; color:var(--muted); }
.table-col-header-btn:hover { background:var(--bg-subtle); color:var(--teal-text); }

/* ---- Columns dropdown (anchored popover, replaces the old modal) ---- */
.colmenu { position:absolute; z-index:1000; width:248px; display:flex; flex-direction:column; background:var(--bg-surface); border:1px solid var(--line); border-radius:var(--r-lg); box-shadow:0 8px 28px rgba(0,0,0,.16); overflow:hidden; animation:colmenu-in .12s ease-out; }
@keyframes colmenu-in { from { opacity:0; transform:translateY(-4px); } to { opacity:1; transform:none; } }
.colmenu-head { padding:10px 14px 6px; font-size:10.5px; font-weight:600; letter-spacing:.06em; text-transform:uppercase; color:var(--muted); }
.colmenu-list { overflow-y:auto; min-height:0; max-height:324px; /* ~10 rows, then scroll */ padding:2px 6px 6px; display:flex; flex-direction:column; scrollbar-width:thin; scrollbar-color:var(--line) transparent; }
.colmenu-list::-webkit-scrollbar { width:8px; }
.colmenu-list::-webkit-scrollbar-thumb { background:var(--line); border-radius:4px; border:2px solid var(--bg-surface); }
.colmenu-list::-webkit-scrollbar-thumb:hover { background:var(--muted); }
.colmenu-row { flex-shrink:0; }
.colmenu-row { display:flex; align-items:center; gap:10px; margin:0; padding:6px 8px; border-radius:var(--r-sm); cursor:pointer; font-size:13px; color:var(--ink); }
.colmenu-row:hover { background:var(--bg-subtle); }
.colmenu-row input { position:absolute; opacity:0; width:0 !important; height:0 !important; min-height:0 !important; padding:0; margin:0; pointer-events:none; }
.colmenu-box { width:16px; height:16px; flex-shrink:0; display:inline-flex; align-items:center; justify-content:center; border:1.5px solid var(--line); border-radius:4px; background:var(--bg-surface); color:transparent; transition:background .12s, border-color .12s; }
.colmenu-row input:checked + .colmenu-box { background:var(--teal); border-color:var(--teal); color:var(--on-teal); }
.colmenu-row input:focus-visible + .colmenu-box { box-shadow:0 0 0 3px var(--teal-glow); }
.colmenu-lbl { flex:1; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.colmenu-tag { font-size:10px; color:var(--muted); text-transform:uppercase; letter-spacing:.04em; }
.colmenu-empty { padding:10px 8px; font-size:12.5px; color:var(--muted); }

/* ---- Table header: clearly distinct from body rows ---- */
th { background:var(--bg-subtle); color:color-mix(in srgb, var(--ink) 62%, var(--muted)); font-weight:700; border-bottom:1px solid var(--muted); }
th.sortable:hover { background:color-mix(in srgb, var(--bg-subtle) 78%, var(--line)); color:var(--ink); }
th.sortable.sorted { color:var(--ink); }
.table-col-header-btn { background:var(--bg-subtle); border-bottom:none; border-left:none; color:color-mix(in srgb, var(--ink) 62%, var(--muted)); }
.table-col-header-btn:hover { background:color-mix(in srgb, var(--bg-subtle) 78%, var(--line)); color:var(--teal-text); }

/* ---- Mobile: the Columns button lives OUTSIDE the table card, above it ---- */
@media (max-width:760px){
    .table-scroll-wrap { background:none; border:none; box-shadow:none; border-radius:0; overflow:visible; }
    .table-scroll-wrap > .table-scroll { margin:0; padding:0; background:var(--bg-surface); border:1px solid var(--line); border-radius:var(--r-lg); box-shadow:var(--card-shadow); }
    .cols-bar-mobile { padding:0 0 8px; }
    .cols-bar-btn { min-height:34px; height:34px; padding:0 12px; border-radius:var(--r-sm); background:var(--bg-surface); border:1px solid var(--line); color:var(--muted); font-size:12.5px; font-weight:500; }
    .cols-bar-btn svg { width:14px; height:14px; }
}

/* ---- Unified Documents section (files + links) ---- */
.sb-sec-actions { display:inline-flex; align-items:center; gap:6px; }
.sb-sec-actions .sb-add-btn { margin:0; }
label.sb-add-btn { cursor:pointer; }
.sb-card-ico.is-file { background:var(--bg-subtle); color:var(--muted); }
.sb-docs.is-drop { border-color:var(--teal); background:var(--teal-subtle); }
.sb-row-del { opacity:0; transition:opacity .12s; }
.sb-card:hover .sb-row-del, .sb-row-del:focus-visible { opacity:1; }
@media (hover:none){ .sb-row-del { opacity:.7; } }

/* ---- Record header icon tile + individual record cards ---- */
.sb-head-main { display:flex; align-items:center; gap:12px; min-width:0; flex:1; }
.sb-head-main > div { min-width:0; }
.sb-head-ico { width:38px; height:38px; flex-shrink:0; display:inline-flex; align-items:center; justify-content:center; border-radius:var(--r-lg); background:var(--teal-subtle); color:var(--teal-text); border:1px solid var(--teal-glow); }
.sb-eyebrow { margin-bottom:3px; }

/* Related-list rows are individual cards: soft resting shade, stronger on hover */
.sb-list { margin:0; gap:6px; }
.sb-card { padding:9px 10px; background:color-mix(in srgb, var(--bg-subtle) 55%, var(--bg-surface)); border:1px solid var(--line-subtle); }
.sb-card + .sb-card::before { display:none; }
.sb-card:hover { background:var(--bg-subtle); border-color:var(--line); }
.sb-section.sb-linked .sb-list { margin:0; }
.sb-section.sb-linked .sb-card { padding:8px 10px; }
.sb-card-ico { background:var(--bg-surface); box-shadow:inset 0 0 0 1px var(--line-subtle); }
.sb-card-ico.is-file { background:var(--bg-surface); }
