:root {
    /* Theme color. Change these six values to recolor the whole app (staff pages and the investor portal).
       --primary-rgb must match --primary. Ocean blue by default; navy and teal values are in docs/features/platform.md. */
    --primary: #0369a1;
    --primary-rgb: 3, 105, 161;
    --primary-hover: #075985;
    --primary-soft: #e0f0fa;
    --primary-light: #0ea5e9;
    --primary-lighter: #7dd3fc;

    --ink: #1f2a44;
    --muted: #7a869a;
    --line: #e8ecf3;
    --bg: #f4f6fb;
    --sidebar-w: 260px;
    --topbar-h: 64px;
    --radius: 14px;

    /* Point Bootstrap's own primary color (badges, progress bars, links, focus rings) at the theme. */
    --bs-primary: var(--primary);
    --bs-primary-rgb: var(--primary-rgb);
    --bs-primary-text-emphasis: var(--primary-hover);
    --bs-primary-bg-subtle: var(--primary-soft);
    --bs-primary-border-subtle: rgba(var(--primary-rgb), .3);
    --bs-link-color: var(--primary);
    --bs-link-color-rgb: var(--primary-rgb);
    --bs-link-hover-color: var(--primary-hover);
    --bs-focus-ring-color: rgba(var(--primary-rgb), .25);
}

body { font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif; background: var(--bg); color: var(--ink); font-size: 14px; }
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-hover); }
.material-symbols-outlined { font-size: 20px; vertical-align: middle; font-variation-settings: 'FILL' 0, 'wght' 400; }

/* ---------- Topbar ---------- */
.topbar { position: fixed; inset: 0 0 auto 0; height: var(--topbar-h); background: #fff; border-bottom: 1px solid var(--line); z-index: 1030; display: flex; align-items: center; padding: 0 20px; gap: 12px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 18px; color: var(--ink); width: calc(var(--sidebar-w) - 20px); }
.brand .logo { width: 34px; height: 34px; border-radius: 10px; background: linear-gradient(135deg, var(--primary), var(--primary-light)); color: #fff; display: grid; place-items: center; }
.icon-btn { border: 0; background: transparent; width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; color: var(--muted); position: relative; }
.icon-btn:hover { background: var(--bg); color: var(--ink); }
.icon-btn .dot { position: absolute; top: 8px; right: 8px; width: 8px; height: 8px; border-radius: 50%; background: #ef476f; border: 2px solid #fff; }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--primary-soft); color: var(--primary); display: grid; place-items: center; font-weight: 600; }
.topbar .search { position: relative; max-width: 320px; flex: 1; }
.topbar .search input { padding-left: 38px; background: var(--bg); border: 0; border-radius: 10px; height: 40px; }
.topbar .search .material-symbols-outlined { position: absolute; left: 11px; top: 10px; color: var(--muted); }
#navToggle { display: none; }

/* ---------- Sidebar ---------- */
.sidebar { position: fixed; top: var(--topbar-h); bottom: 0; left: 0; width: var(--sidebar-w); background: #fff; border-right: 1px solid var(--line); overflow-y: auto; padding: 18px 14px; z-index: 1020; transition: transform .2s; }
.nav-group { font-size: 11px; font-weight: 600; letter-spacing: .08em; color: #a0a9b9; text-transform: uppercase; margin: 18px 10px 8px; }
.nav-group:first-child { margin-top: 4px; }
.sidebar a.nav-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; color: #55627a; font-weight: 500; margin-bottom: 2px; }
.sidebar a.nav-item:hover { background: var(--bg); color: var(--ink); }
.sidebar a.nav-item.active { background: var(--primary-soft); color: var(--primary); }
.sidebar .nav-foot { margin: 24px 10px 0; padding: 14px; border-radius: 12px; background: var(--primary-soft); color: var(--ink); font-size: 12.5px; }

/* ---------- Content ---------- */
.content { margin-left: var(--sidebar-w); padding: calc(var(--topbar-h) + 26px) 28px 30px; min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
/* The page fills the space above the footer, so the footer sits at the bottom of the window on short pages
   and below the content on long ones. min-width: 0 keeps wide tables scrolling inside the page instead of widening it. */
.content > .content-body { flex: 1 0 auto; min-width: 0; }
.content h3 { font-size: 22px; font-weight: 700; margin-bottom: 4px; }
.page-sub { color: var(--muted); margin-bottom: 22px; }
.app-footer { margin-top: 36px; color: var(--muted); font-size: 12.5px; display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; }

/* ---------- Cards / widgets ---------- */
.card { border: 0; border-radius: var(--radius); box-shadow: 0 1px 2px rgba(31, 42, 68, .04), 0 4px 16px rgba(31, 42, 68, .04); }
.card-head { display: flex; justify-content: space-between; align-items: center; padding: 18px 20px 0; }
.card-head h5 { margin: 0; font-size: 15px; font-weight: 600; }
.card-pad { padding: 18px 20px; }

.welcome { background: linear-gradient(120deg, var(--primary) 0%, var(--primary-light) 65%, var(--primary-lighter) 100%); color: #fff; border-radius: var(--radius); padding: 26px 28px; position: relative; overflow: hidden; margin-bottom: 22px; }
.welcome h4 { font-weight: 700; margin-bottom: 6px; }
.welcome p { opacity: .9; max-width: 460px; margin-bottom: 16px; }
.welcome .btn-light { color: var(--primary); font-weight: 600; border-radius: 10px; }
.welcome::after { content: ''; position: absolute; right: -40px; top: -60px; width: 260px; height: 260px; border-radius: 50%; background: rgba(255, 255, 255, .12); }
.welcome::before { content: ''; position: absolute; right: 120px; bottom: -90px; width: 200px; height: 200px; border-radius: 50%; background: rgba(255, 255, 255, .08); }

.stat { display: flex; align-items: center; gap: 14px; padding: 18px 20px; }
.min-w-0 { min-width: 0; }
.stat .ico { width: 48px; height: 48px; border-radius: 12px; display: grid; place-items: center; flex: none; }
.stat .ico .material-symbols-outlined { font-size: 24px; }
.stat .label { color: var(--muted); font-size: 12.5px; }
.stat .value { font-size: 22px; font-weight: 700; line-height: 1.2; }
.stat .sub { font-size: 12px; color: var(--muted); }
.ico.blue { background: var(--primary-soft); color: var(--primary); }
.ico.teal { background: #e0f5f1; color: #0f8a76; }
.ico.green { background: #e3f8ee; color: #1fa971; }
.ico.orange { background: #fff1e0; color: #f08c1a; }
.ico.pink { background: #fde8ef; color: #e5487a; }
.up { color: #1fa971; font-weight: 600; }
.down { color: #e5487a; font-weight: 600; }

/* mini bar chart */
.bars { display: flex; align-items: flex-end; gap: 8px; height: 170px; padding-top: 10px; }
.bars .col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; }
.bars .bar { width: 100%; max-width: 28px; border-radius: 6px 6px 0 0; background: linear-gradient(180deg, var(--primary-light), var(--primary)); min-height: 3px; }
.bars .bar.zero { background: var(--line); }
.bars .lbl { font-size: 10.5px; color: var(--muted); margin-top: 6px; }
.bars .val { font-size: 10.5px; color: var(--ink); margin-bottom: 3px; }

.meter { margin-bottom: 14px; }
.meter .top { display: flex; justify-content: space-between; margin-bottom: 6px; font-weight: 500; }
.meter .track { height: 8px; border-radius: 8px; background: var(--bg); overflow: hidden; }
.meter .fill { height: 100%; border-radius: 8px; }

/* ---------- Tables ---------- */
.table { --bs-table-bg: transparent; margin-bottom: 0; }
.table > thead th { font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; background: #f8f9fc; border-bottom: 1px solid var(--line); padding: 12px 16px; white-space: nowrap; }
.table > thead th .sort-link { color: inherit; text-decoration: none; display: inline-flex; align-items: center; gap: 2px; }
.table > thead th .sort-link .material-symbols-outlined { font-size: 14px; opacity: .35; }
.table > thead th .sort-link:hover, .table > thead th .sort-link.active { color: var(--ink); }
.table > thead th .sort-link.active .material-symbols-outlined { opacity: 1; }
.table > tbody td { padding: 13px 16px; border-color: var(--line); }
.table-hover > tbody > tr:hover > * { background: #fafbfe; }
.table-wrap { background: #fff; border-radius: var(--radius); box-shadow: 0 1px 2px rgba(31, 42, 68, .04), 0 4px 16px rgba(31, 42, 68, .04); overflow: hidden; }
.table-wrap .table-responsive { margin: 0; }
.table.bg-white { background: #fff !important; border-radius: var(--radius); overflow: hidden; }

/* ---------- Forms / buttons / badges ---------- */
.form-control, .form-select { border-radius: 10px; border-color: #dfe4ee; padding: .55rem .85rem; }
.form-control:focus, .form-select:focus { border-color: var(--primary); box-shadow: 0 0 0 .2rem rgba(var(--primary-rgb), .15); }

/* ---------- Choice picker (every select.form-select, see wwwroot/js/choice-picker.js) ---------- */
/* The button looks like a normal drop-down; the list opens in a window (a bottom sheet on phones).
   The real <select> stays in the form, invisible and out of the way. */
.choice-native { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important;
    overflow: hidden !important; clip: rect(0 0 0 0) !important; border: 0 !important; opacity: 0 !important; pointer-events: none !important; }
.choice-modal { z-index: 1065; }
.filter-row.is-off .choice-btn { opacity: .45; }
.choice-search { padding: 10px 16px 2px; }
.choice-empty { display: none; padding: 16px 22px; }
.choice-btn[hidden] { display: none !important; }
.choice-btn:disabled { background-color: #e9ecef; opacity: 1; }
.choice-btn.choice-placeholder { color: var(--bs-secondary-color, #6c757d); }
.choice-btn { text-align: left; background-color: #fff; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.choice-modal .modal-header { border-bottom: 1px solid var(--line); padding: 14px 18px; }
.choice-modal .modal-title { font-size: 16px; font-weight: 600; }
.choice-list { padding: 8px 10px 12px; }
.choice-group + .choice-group, .choice-opt + .choice-group { margin-top: 6px; }
.choice-group-label { font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: 12px 12px 4px; }
.choice-opt { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 48px; padding: 10px 12px; border: 0; border-radius: 10px;
    background: transparent; color: var(--ink); font-size: 15px; line-height: 1.35; text-align: left; }
.choice-opt .choice-text { flex: 1 1 auto; min-width: 0; }
.choice-opt .choice-tick { flex: 0 0 auto; color: var(--primary); visibility: hidden; }
/* Hover only where there is a real pointer: on phones a tap leaves :hover stuck on the row under the finger, which looked like a pre-picked choice. */
@media (hover: hover) { .choice-opt:hover { background: var(--bg); } }
.choice-opt:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }
.choice-opt.is-selected { background: var(--primary-soft); color: var(--primary-hover); font-weight: 600; }
.choice-opt.is-selected .choice-tick { visibility: visible; }
.choice-opt:disabled { opacity: .45; }
@media (max-width: 575.98px) {
    .choice-btn:not(.form-select-sm) { font-size: 16px; }
    .choice-search .form-control { font-size: 16px; } /* 16px stops iOS zooming in */
    .choice-modal .modal-dialog { margin: 0; min-height: 100%; align-items: flex-end; max-width: none; }
    .choice-modal .modal-dialog-scrollable { height: 100%; }
    .choice-modal .modal-content { border-radius: 18px 18px 0 0; max-height: 88vh; border: 0; }
    .choice-opt { font-size: 16px; }
}
.btn { border-radius: 10px; font-weight: 500; }
.btn-primary { background: var(--primary); border-color: var(--primary); }
.btn-primary:hover, .btn-primary:focus-visible, .btn-primary:active { background: var(--primary-hover) !important; border-color: var(--primary-hover) !important; }
.btn-primary:disabled, .btn-primary.disabled { background: var(--primary); border-color: var(--primary); }
.btn-outline-primary { color: var(--primary); border-color: var(--primary); }
.btn-outline-primary:hover, .btn-outline-primary:active, .btn-check:checked + .btn-outline-primary { background: var(--primary) !important; border-color: var(--primary) !important; color: #fff !important; }
/* Secondary buttons: a quiet outline in the theme, never Bootstrap's solid grey. Hover/active (which phones keep after a tap)
   is a light tint, so a tapped button doesn't turn into a big grey block. */
.btn-outline-secondary { --bs-btn-color: var(--ink); --bs-btn-border-color: #cfd6e3; --bs-btn-bg: #fff;
    --bs-btn-hover-color: var(--primary); --bs-btn-hover-bg: var(--primary-soft); --bs-btn-hover-border-color: rgba(var(--primary-rgb), .45);
    --bs-btn-active-color: var(--primary); --bs-btn-active-bg: var(--primary-soft); --bs-btn-active-border-color: var(--primary);
    --bs-btn-disabled-color: var(--muted); --bs-btn-disabled-bg: #fff; --bs-btn-disabled-border-color: var(--line);
    --bs-btn-focus-shadow-rgb: var(--primary-rgb); }
.btn-link { color: var(--primary); }
.form-check-input:checked { background-color: var(--primary); border-color: var(--primary); }
.form-check-input:focus { border-color: rgba(var(--primary-rgb), .5); box-shadow: 0 0 0 .2rem rgba(var(--primary-rgb), .15); }
.form-switch .form-check-input:focus:not(:checked) { --bs-form-switch-bg: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='rgba%280, 0, 0, 0.25%29'/%3e%3c/svg%3e"); }
.progress { --bs-progress-bar-bg: var(--primary); }
.nav-pills { --bs-nav-pills-link-active-bg: var(--primary); }
.nav-link { --bs-nav-link-color: var(--primary); --bs-nav-link-hover-color: var(--primary-hover); }
.nav-tabs .nav-link.active { color: var(--ink); }
.dropdown-menu { --bs-dropdown-link-active-bg: var(--primary); }
.list-group { --bs-list-group-active-bg: var(--primary); --bs-list-group-active-border-color: var(--primary); }
.badge { font-weight: 500; padding: .45em .7em; border-radius: 8px; vertical-align: middle; }
/* Center the letters themselves: trim the line box to cap height and baseline so equal padding sits evenly. */
@supports (text-box: trim-both cap alphabetic) { .badge { text-box: trim-both cap alphabetic; padding: .6em .7em; } }
.card.card-body { padding: 22px; }
.page-item.active .page-link { background: var(--primary); border-color: var(--primary); }
.page-link { color: var(--primary); }
.alert { border: 0; border-radius: 12px; }
/* Icon alerts are flex rows: keep the icon its own size and let long text, emails and code wrap on phones. */
.alert { overflow-wrap: anywhere; }
.alert.d-flex > .material-symbols-outlined { flex: none; }
.alert.d-flex > :not(.material-symbols-outlined) { min-width: 0; }
.alert code { white-space: normal; }

/* ---------- Auth ---------- */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; background: linear-gradient(135deg, var(--primary-soft), #f8fafc); padding: 20px; }
.auth-card { width: 100%; max-width: 400px; }

/* ---------- Responsive ---------- */
@media (max-width: 991.98px) {
    #navToggle { display: grid; }
    .brand { width: auto; }
    .topbar .search { display: none; }
    .sidebar { transform: translateX(-100%); box-shadow: 0 0 40px rgba(0, 0, 0, .15); }
    body.nav-open .sidebar { transform: none; }
    body.nav-open::after { content: ''; position: fixed; inset: var(--topbar-h) 0 0 0; background: rgba(15, 23, 42, .35); z-index: 1010; }
    .content { margin-left: 0; padding: calc(var(--topbar-h) + 18px) 14px 24px; }
    .welcome { padding: 20px; }
}

/* ---------- Workflow timeline ---------- */
.timeline { max-width: 760px; position: relative; }
.timeline::before { content: ''; position: absolute; left: 31px; top: 24px; bottom: 56px; width: 2px; background: var(--line); }
.tl-node { position: relative; display: flex; align-items: center; gap: 16px; background: #fff; border-radius: var(--radius); padding: 14px 16px; margin-bottom: 14px; box-shadow: 0 1px 2px rgba(31, 42, 68, .04), 0 4px 16px rgba(31, 42, 68, .04); }
.tl-ico { width: 40px; height: 40px; border-radius: 12px; background: var(--primary-soft); color: var(--primary); display: grid; place-items: center; flex: none; z-index: 1; }
.tl-trigger .tl-ico { background: #fff1e0; color: #f08c1a; }
.tl-body { flex: 1; min-width: 0; }
.tl-title { font-weight: 600; }
.tl-desc { color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }
.tl-actions { display: flex; gap: 2px; flex: none; }
.tl-actions .icon-btn { width: 34px; height: 34px; }
.tl-add { padding-left: 16px; }
.tl-add .btn { display: inline-flex; align-items: center; gap: 6px; }
@media (max-width: 575.98px) { .tl-node { flex-wrap: wrap; } .tl-actions { width: 100%; justify-content: flex-end; } .timeline::before { display: none; } }

/* ---------- Pipelines / kanban board ---------- */
.pipe-card { transition: transform .12s, box-shadow .12s; }
.pipe-card:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(31, 42, 68, .1); }
.stat-ico { width: 48px; height: 48px; border-radius: 12px; display: grid; place-items: center; flex: none; }

.board { display: flex; gap: 16px; align-items: flex-start; overflow-x: auto; padding-bottom: 18px; min-height: 62vh; -webkit-overflow-scrolling: touch; }
.lane { flex: 0 0 290px; background: #eaeef7; border-radius: var(--radius); padding: 10px; }
.lane-head { display: flex; align-items: center; gap: 6px; background: #fff; border-radius: 10px; border-top: 3px solid var(--primary); padding: 6px 8px 6px 6px; font-weight: 600; box-shadow: 0 1px 2px rgba(31, 42, 68, .05); }
.lane-handle { cursor: grab; color: #a0a9b9; user-select: none; touch-action: none; }
.lane-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lane-head .icon-btn { width: 30px; height: 30px; }
.lane-sum { font-size: 12px; color: var(--muted); padding: 6px 4px 0; min-height: 22px; }
.lane-body { min-height: 72px; padding: 6px 0 8px; display: flex; flex-direction: column; gap: 10px; }
.lane-add { width: 100%; border: 1px dashed #c3cce0; background: transparent; color: var(--muted); border-radius: 10px; padding: 8px; font-size: 13px; }
.lane-add:hover { background: #fff; color: var(--primary); border-color: var(--primary); }
.lane-new { background: transparent; border: 2px dashed #cfd6e6; }

.kcard { background: #fff; border-radius: 12px; padding: 12px; box-shadow: 0 1px 2px rgba(31, 42, 68, .06), 0 2px 8px rgba(31, 42, 68, .05); cursor: grab; border: 1px solid transparent; }
.kcard:hover { border-color: rgba(var(--primary-rgb), .3); }
.kcard-chosen { box-shadow: 0 10px 28px rgba(31, 42, 68, .2); }
.kcard-ghost { opacity: .45; background: var(--primary-soft); }
.kc-top { display: flex; gap: 10px; align-items: center; }
.kc-avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--primary-soft); color: var(--primary); display: grid; place-items: center; font-weight: 600; flex: none; }
.kc-main { min-width: 0; }
.kc-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kc-sub { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kc-value { display: inline-block; margin-top: 8px; font-weight: 600; font-size: 12.5px; color: #1fa971; background: #e3f8ee; border-radius: 8px; padding: 2px 8px; }
.kc-note { margin-top: 8px; font-size: 12.5px; color: #55627a; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.kc-meta { margin-top: 8px; font-size: 11.5px; color: #a0a9b9; }
.kc-eng { margin-top: 8px; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; font-size: 11.5px; color: #55627a; }
.kc-eng .material-symbols-outlined { font-size: 15px; vertical-align: -3px; color: #8a94a8; }
.kc-eng .badge { font-size: 10.5px; }
.add-results { max-height: 220px; overflow-y: auto; }
@media (max-width: 575.98px) { .lane { flex-basis: 82vw; } }

/* keep the page from scrolling sideways on phones */
.bars .col { min-width: 0; }
.bars .lbl { white-space: nowrap; }
html, body { overflow-x: hidden; max-width: 100%; }
@media (max-width: 575.98px) {
    .bars { gap: 3px; }
    .bars .lbl { font-size: 9px; }
    .bars .col:nth-child(even) .lbl { visibility: hidden; }
    .bars .val { font-size: 9px; }
}

/* ---------- Investor portal ---------- */
body.portal { background: var(--bg); min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
body.portal > .portal-wrap { width: 100%; }
body.portal > .portal-main { flex: 1 0 auto; }
.portal-wrap { max-width: 1100px; margin: 0 auto; padding-left: 16px; padding-right: 16px; }
.portal-top { background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 1020; }
.portal-top > .portal-wrap:first-child { min-height: 58px; }
.portal-brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 17px; color: var(--ink); min-width: 0; }
.portal-nav { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; padding-bottom: 8px; }
.portal-nav::-webkit-scrollbar { display: none; }
.portal-nav a { white-space: nowrap; padding: 7px 12px; border-radius: 9px; color: #55627a; font-weight: 500; }
.portal-nav a:hover { background: var(--bg); color: var(--ink); }
.portal-nav a.active { background: var(--primary-soft); color: var(--primary); }
.portal-nav a:focus-visible, .portal-brand:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.portal-main { padding-top: 24px; padding-bottom: 24px; }
.portal-main h3 { font-size: 22px; font-weight: 700; }
.portal-foot { color: var(--muted); font-size: 12px; padding-top: 12px; padding-bottom: 28px; border-top: 1px solid var(--line); }
.kpi .label { color: var(--muted); font-size: 12.5px; }
.kpi .value { font-size: 20px; font-weight: 700; }
.ledger td, .ledger th { white-space: nowrap; }
@media print {
    .portal-top, .portal-foot .no-print, .no-print { display: none !important; }
    body.portal { background: #fff; }
    .card { box-shadow: none; border: 1px solid #ddd; }
}

/* ---------- Company logo (branding) ---------- */
.brand-img { display: block; max-height: 40px; max-width: 100%; width: auto; object-fit: contain; }
.brand.has-logo { min-width: 0; }
.portal-brand .brand-img { max-height: 40px; max-width: min(240px, 55vw); }
.auth-logo { max-height: 64px; max-width: 260px; object-fit: contain; }
/* "Powered by TracVault" under a company logo: always shown with a logo, kept small and quiet. */
.brand-stack { display: inline-flex; flex-direction: column; align-items: flex-start; min-width: 0; line-height: 1; }
.brand-stack .brand-img { max-height: 34px; }
.powered-by { font-size: 10px; font-weight: 500; letter-spacing: .02em; color: var(--muted); white-space: nowrap; margin-top: 3px; }
.logo-drop { border: 2px dashed #c9d3e3; border-radius: var(--radius); padding: 24px 16px; text-align: center; color: var(--muted); cursor: pointer; transition: border-color .15s, background .15s; }
.logo-drop:hover, .logo-drop:focus-within, .logo-drop.dragover { border-color: var(--primary); background: var(--primary-soft); color: var(--ink); }
.logo-drop .material-symbols-outlined { font-size: 36px; display: block; margin: 0 auto 6px; color: var(--primary); }
.logo-tiles { display: flex; gap: 10px; flex-wrap: wrap; }
.logo-tile { flex: 1 1 200px; min-height: 84px; border: 1px solid var(--line); border-radius: 10px; display: grid; place-items: center; padding: 12px; }
.logo-tile img { max-height: 56px; max-width: 100%; object-fit: contain; }
.logo-tile.dark { background: #1f2a44; }
.logo-tile.checker { background: repeating-conic-gradient(#eef1f6 0% 25%, #fff 0% 50%) 50% / 16px 16px; }
.logo-crop { max-height: 360px; background: #f4f6fb; border-radius: 10px; overflow: hidden; }
.logo-crop img { display: block; max-width: 100%; }
.logo-preview-bar { display: flex; align-items: center; gap: 12px; height: 56px; padding: 0 14px; background: #fff; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.logo-preview-bar canvas { max-height: 36px; max-width: 220px; }

/* ---------- Contacts: search bar, Filter window and condition chips ---------- */
.contact-toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.contact-toolbar .contact-search { flex: 1 1 280px; max-width: 520px; width: auto; }
.contact-toolbar .contact-search .btn { padding-left: 10px; padding-right: 10px; }
.contact-toolbar .filter-clear-btn { display: inline-flex; align-items: center; justify-content: center; padding-left: 12px; padding-right: 12px; }
.filter-chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
/* Applied search + filter conditions (Views/Shared/_FilterChips): "Clear all" on the label line, an x on every chip. */
.filter-applied-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.filter-clear-all { display: inline-flex; align-items: center; gap: 2px; white-space: nowrap; border-radius: 999px; padding: 3px 12px 3px 8px; }
.filter-clear-all .material-symbols-outlined { font-size: 18px; }
.filter-chip { display: inline-flex; align-items: stretch; max-width: 100%; border: 1px solid rgba(var(--primary-rgb), .35);
    background: var(--primary-soft); color: var(--primary-hover); border-radius: 999px; font-size: 13px; line-height: 1.5; }
.filter-chip:hover { border-color: var(--primary); }
.filter-chip-text { border: 0; background: none; color: inherit; padding: 2px 4px 2px 10px; min-width: 0; overflow: hidden;
    text-overflow: ellipsis; white-space: nowrap; text-align: left; }
.filter-chip > span.filter-chip-text { cursor: default; }
.filter-chip-x { display: inline-flex; align-items: center; justify-content: center; flex: none; width: 28px; color: inherit;
    border-radius: 0 999px 999px 0; text-decoration: none; }
.filter-chip-x .material-symbols-outlined { font-size: 16px; }
.filter-chip-x:hover, .filter-chip-x:focus-visible { background: rgba(var(--primary-rgb), .15); color: var(--primary); }
@media (max-width: 575.98px) {
    /* Bigger tap targets on phones. */
    .filter-chip { font-size: 14px; }
    .filter-chip-text { padding: 5px 4px 5px 12px; }
    .filter-chip-x { width: 36px; }
    .filter-clear-all { padding: 6px 14px 6px 10px; }
}
.filter-modal .modal-header { border-bottom: 1px solid var(--line); }
.filter-rows { padding: 6px 0; }
.filter-row { display: grid; grid-template-columns: 52px minmax(140px, 1.1fr) minmax(130px, .9fr) minmax(150px, 1.3fr) 34px auto; gap: 10px;
    align-items: center; padding: 8px 16px; }
.filter-row .f-where, .filter-row .f-and { color: var(--muted); font-size: 13px; }
.filter-row .f-tools { display: flex; align-items: center; gap: 6px; justify-content: flex-end; }
.filter-row .f-tools .form-check-input { margin: 0; width: 1.1em; height: 1.1em; }
.filter-row .f-on-label { display: none; }
.filter-row .f-del { padding: 2px 4px; }
.filter-row .f-del:hover { color: #dc3545 !important; }
.filter-row .f-value.is-hidden { visibility: hidden; }
.filter-row.is-off .f-where, .filter-row.is-off select, .filter-row.is-off input:not(.f-on), .filter-row.is-off .f-and { opacity: .45; }
.filter-footer { border-top: 1px solid var(--line); gap: 8px; flex-wrap: wrap; justify-content: space-between; }
.filter-save { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; flex: 1 1 260px; max-width: 420px; margin: 0; }
.filter-save input[name=name] { flex: 1 1 160px; width: auto; }

/* "Match all/any", groups of conditions and the add/clear bar */
.filter-match { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 12px 16px 4px; font-size: 14px; }
.filter-match .f-match, .fg-head .f-match { width: auto; min-width: 72px; }
.filter-group { margin: 4px 16px 8px; border: 1px solid rgba(var(--primary-rgb), .3); border-left: 3px solid var(--primary); border-radius: 10px;
    background: var(--primary-soft); padding: 6px 0 4px; }
.filter-group .filter-row { padding-left: 12px; padding-right: 12px; }
.fg-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 2px 12px 4px; font-size: 13px; color: var(--muted); }
.fg-label { font-weight: 600; color: var(--primary-hover); }
.fg-add { margin-left: 12px; }
.fg-join { padding: 0 16px; color: var(--muted); font-size: 13px; }
.filter-bar { display: flex; flex-wrap: wrap; gap: 4px 18px; align-items: center; padding: 8px 16px; border-top: 1px solid var(--line); }
.filter-chip-group { display: inline-flex; flex-wrap: wrap; gap: 6px; align-items: center; max-width: 100%; min-width: 0; }
.filter-row .f-value .input-group-text { font-size: 13px; }

/* Sortable table headers (SortLinks) */
th.sortable .sort-link { color: inherit; text-decoration: none; display: inline-flex; align-items: center; gap: 2px; white-space: nowrap; }
th.sortable .sort-link:hover { color: var(--primary); }
th.sortable .sort-icon { font-size: 16px; opacity: .35; }
th.sortable .sort-link.is-sorted { color: var(--primary-hover); }
th.sortable .sort-link.is-sorted .sort-icon { opacity: 1; }
th.sortable .sort-link:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 4px; }

/* Phones and small tablets: the window fills the screen and each condition becomes a small card. */
@media (max-width: 767.98px) {
    .contact-toolbar .contact-search { flex-basis: 100%; max-width: none; }
    .filter-rows { padding: 10px 12px; display: flex; flex-direction: column; gap: 10px; }
    .filter-row { grid-template-columns: 1fr 1fr; gap: 8px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
    .filter-row .f-where { grid-column: 1 / -1; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
    .filter-row .f-field, .filter-row .f-op { grid-column: span 1; }
    .filter-row .f-value { grid-column: 1 / -1; }
    .filter-row .f-value.is-hidden { display: none; }
    .filter-row .f-and { display: none; }
    .filter-row .f-tools { grid-column: 1 / -1; justify-content: space-between; border-top: 1px solid var(--line); padding-top: 8px; }
    .filter-row .f-on-label { display: inline; margin-right: auto; }
    .filter-row .form-select-sm, .filter-row .form-control-sm { font-size: 16px; min-height: 40px; } /* 16px stops iOS zooming in */
    .filter-footer > * { flex-basis: 100%; max-width: none; }
    .filter-footer .ms-auto { justify-content: flex-end; }
    .filter-group { margin: 0 12px 10px; padding: 8px 0; }
    .filter-group .fg-rows { display: flex; flex-direction: column; gap: 8px; padding: 0 8px; }
    .filter-group .filter-row { padding: 10px; }
    .fg-join { padding: 0 12px 6px; }
    .filter-match { padding: 12px 12px 0; }
    .filter-bar { padding: 8px 12px; }
    .filter-group .fg-head .form-select-sm, .filter-match .form-select-sm { font-size: 16px; min-height: 40px; }
}

/* Platform console: badge next to the name, and the "You're in X" bar while inside another company. */
.console-badge { background: #1e293b; color: #fff; font-size: 11px; font-weight: 600; letter-spacing: .02em; }
.visit-bar { display: flex; align-items: center; gap: 10px; min-width: 0; margin: -10px 0 18px; padding: 8px 12px; border-radius: 10px;
    background: #fef3c7; border: 1px solid #f59e0b; color: #78350f; font-size: 14px; }
.visit-bar .material-symbols-outlined { color: #b45309; }
.visit-bar form { flex: 0 0 auto; }

/* Get help window (Views/Shared/_GetHelpModal.cshtml) */
.gh-types { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.gh-types .btn { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 6px; font-size: 13px; line-height: 1.2; white-space: normal; }
.gh-types .btn .material-symbols-outlined { font-size: 22px; }
@media (max-width: 380px) { .gh-types { grid-template-columns: 1fr; } .gh-types .btn { flex-direction: row; justify-content: flex-start; } }
.gh-sent { display: flex; gap: 8px; align-items: flex-start; background: var(--primary-soft); border-radius: 8px; padding: 8px 10px; }
.gh-sent .material-symbols-outlined { font-size: 18px; color: var(--primary); }

/* Support ticket conversation */
.ticket-msg { border: 1px solid #e5e7eb; border-radius: 10px; padding: 10px 12px; background: #fff; }
.ticket-msg.from-support { border-color: rgba(var(--primary-rgb), .35); background: var(--primary-soft); }
.ticket-msg.internal { border-color: #fcd34d; background: #fffbeb; }
.ticket-msg .meta { font-size: 12px; color: #64748b; margin-bottom: 4px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.ticket-msg .text { white-space: pre-wrap; word-break: break-word; }
.ticket-facts dt { font-weight: 500; color: #64748b; font-size: 12px; }
.ticket-facts dd { word-break: break-word; margin-bottom: 8px; }
.ticket-files { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.ticket-file { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; padding: 4px 10px; border: 1px solid #e5e7eb; border-radius: 8px; background: #fff; text-decoration: none; font-size: 13px; }
.ticket-file .material-symbols-outlined { font-size: 18px; }
.ticket-shot { display: flex; flex-direction: column; width: 160px; max-width: 100%; border: 1px solid #e5e7eb; border-radius: 8px; overflow: hidden; background: #fff; text-decoration: none; font-size: 12px; }
.ticket-shot img { width: 100%; height: 100px; object-fit: cover; object-position: top left; background: #f1f5f9; }
.ticket-shot span { padding: 3px 8px; color: #475569; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ticket-follow { font-size: 13px; }

/* Feature board: the vote box beside each idea */
.board-vote-form { margin: 0; flex: 0 0 auto; }
.board-vote { display: flex; flex-direction: column; align-items: center; justify-content: center; width: 64px; min-height: 64px; padding: 6px 4px; border: 1px solid #cbd5e1; border-radius: 10px; background: #fff; color: #334155; line-height: 1.1; flex: 0 0 auto; }
button.board-vote { cursor: pointer; }
button.board-vote:hover { border-color: var(--primary); color: var(--primary); }
button.board-vote:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.board-vote.voted { background: var(--primary); border-color: var(--primary); color: #fff; }
.board-vote.voted:hover { color: #fff; filter: brightness(1.08); }
.board-vote.readonly { background: #f8fafc; color: #64748b; }
.board-vote .material-symbols-outlined { font-size: 20px; }
.board-vote .n { font-weight: 600; font-size: 15px; }
.board-vote .l { font-size: 11px; }
.board-desc { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; word-break: break-word; }

/* Screenshot editor in the Get help window */
.gh-shot-wrap { position: relative; border: 1px solid #e5e7eb; border-radius: 8px; overflow: hidden; background: #f8fafc; touch-action: none; }
.gh-shot-wrap canvas { display: block; width: 100%; height: auto; cursor: crosshair; }
.gh-files-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.gh-files-list .badge { font-weight: 500; }

/* Count of things in the profile menu that need you (support requests waiting on your answer). */
.avatar-badge { top: -4px; right: -6px; font-size: .62rem; min-width: 1.2rem; line-height: 1; padding: .2rem .35rem; }

/* Full-screen windows on phones: size to the screen you can actually see (100dvh leaves out the browser's own bars),
   so the footer buttons (Send, Cancel) are never pushed under the browser or system bar. */
@supports (height: 100dvh) {
    .modal { height: 100dvh; }
    @media (max-width: 575.98px) {
        .modal-fullscreen-sm-down, .modal-fullscreen-sm-down .modal-content { height: 100dvh; max-height: 100dvh; }
    }
}
/* A window whose header, body and footer sit inside a <form> (Get help): keep the flex chain so the body scrolls
   and the footer (Send, Cancel) stays on screen, however long the form is. */
.modal-content > form { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; max-height: 100%; }
.modal-dialog-scrollable .modal-content > form { overflow: hidden; }

/* Support access ("You're in" bar countdown, Company access and Support access lists) */
.visit-bar .visit-text { flex: 1 1 auto; line-height: 1.3; }
.visit-bar .visit-level { background: #fff; color: #78350f; border: 1px solid #f59e0b; font-weight: 600; }
.visit-bar .ending { color: #b91c1c; font-weight: 600; }
.access-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.access-row > .min-w-0 { flex: 1 1 14rem; }

/* ---------- Screen viewing (support sees a hidden-values copy of this tab) ---------- */
body.sv-on { --sv-h: 48px; }
body.sv-on .topbar { top: var(--sv-h); }
body.sv-on .sidebar { top: calc(var(--topbar-h) + var(--sv-h)); }
body.sv-on .content { padding-top: calc(var(--topbar-h) + 26px + var(--sv-h)); }
.sv-bar { position: fixed; inset: 0 0 auto 0; height: 48px; z-index: 1040; background: var(--primary); color: #fff; display: flex; align-items: center; gap: 10px; padding: 0 16px; font-size: 14px; }
.sv-bar[hidden] { display: none; }
.sv-bar .sv-bar-text { flex: 1 1 auto; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sv-bar .btn { white-space: nowrap; flex: 0 0 auto; }
.sv-bar .sv-stop { color: #b91c1c; font-weight: 700; min-width: 64px; }
.sv-ring { position: fixed; z-index: 1039; pointer-events: none; border: 3px solid #f59e0b; border-radius: 8px; box-shadow: 0 0 0 4px rgba(245, 158, 11, .25); transition: all .15s; }
.sv-ring[hidden] { display: none; }
.sv-ring-label { position: absolute; left: -3px; top: calc(100% + 4px); background: #b45309; color: #fff; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 6px; white-space: nowrap; }
.sv-ask-list { padding-left: 1.1rem; margin-bottom: .5rem; }
.sv-ask-list li { margin-bottom: .35rem; }
.sv-toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 1060; background: var(--ink); color: #fff; padding: 12px 16px; border-radius: 10px; max-width: min(92vw, 520px); box-shadow: 0 10px 30px rgba(0, 0, 0, .2); }
.sv-toast[hidden] { display: none; }
@media (max-width: 575.98px) { .sv-bar { padding: 0 10px; gap: 6px; font-size: 13px; } }

/* Support's side: the copy of the staff member's tab */
.sv-stage { position: relative; overflow: hidden; border: 2px solid var(--primary); border-radius: 12px; background: var(--bg); }
.sv-stage iframe { border: 0; transform-origin: 0 0; display: block; background: #fff; }
.sv-meta { display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: center; }
