: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); }
.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; }
.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; }
.filter-chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.filter-chip { border: 1px solid rgba(var(--primary-rgb), .35); background: var(--primary-soft); color: var(--primary-hover); border-radius: 999px;
    padding: 2px 10px; font-size: 13px; line-height: 1.5; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.filter-chip:hover { border-color: var(--primary); }
.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; }

/* 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; }
}
