/* =====================================================================
   VyomDigital design system (docs/10). Tokens first; components use tokens only.
   ===================================================================== */
:root {
    --dm-primary: #4f46e5;
    --dm-primary-dark: #4338ca;
    --dm-primary-soft: #eef2ff;
    --dm-bg: #f6f7fb;
    --dm-surface: #ffffff;
    --dm-border: #e7e9f0;
    --dm-border-strong: #d0d5dd;
    --dm-text: #101828;
    --dm-text-2: #475467;
    --dm-text-3: #667085;
    --dm-sidebar: #17153b;
    --dm-sidebar-2: #211e52;
    --dm-sidebar-muted: #a5b4fc;
    --dm-success: #079455;
    --dm-warning: #dc6803;
    --dm-danger: #d92d20;
    --dm-info: #0e7ad1;
    --dm-radius: 12px;
    --dm-radius-sm: 8px;
    --dm-shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .04);
    --dm-shadow-md: 0 8px 24px -6px rgba(16, 24, 40, .12), 0 2px 6px rgba(16, 24, 40, .05);
    --bs-body-font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --bs-body-color: var(--dm-text);
    --bs-secondary-color: var(--dm-text-3);
    --bs-border-color: var(--dm-border);
    --bs-primary: #4f46e5;
    --bs-primary-rgb: 79, 70, 229;
    --bs-link-color: var(--dm-primary);
    --bs-link-color-rgb: 79, 70, 229;
    --bs-link-hover-color: var(--dm-primary-dark);
}

html { font-size: 14px; }
body {
    background: var(--dm-bg);
    color: var(--dm-text);
    font-family: var(--bs-body-font-family);
    font-feature-settings: "cv11", "ss01";
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
}
h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6 { color: var(--dm-text); letter-spacing: -.01em; }
.h6, h6 { font-weight: 600; }
.text-muted { color: var(--dm-text-3) !important; }
a { color: var(--dm-primary); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--dm-primary-dark); }
small, .small { font-size: .857rem; }
::selection { background: #c7d2fe; }

/* ---- Buttons ---- */
.btn { border-radius: var(--dm-radius-sm); font-weight: 500; --bs-btn-padding-y: .45rem; --bs-btn-padding-x: .9rem; --bs-btn-font-size: .93rem; display: inline-flex; align-items: center; justify-content: center; gap: .4rem; }
.btn-sm { --bs-btn-padding-y: .3rem; --bs-btn-padding-x: .65rem; --bs-btn-font-size: .857rem; }
.btn-lg { --bs-btn-padding-y: .6rem; --bs-btn-padding-x: 1.2rem; }
.btn-link { display: inline; }
.btn-primary { --bs-btn-bg: var(--dm-primary); --bs-btn-border-color: var(--dm-primary); --bs-btn-hover-bg: var(--dm-primary-dark); --bs-btn-hover-border-color: var(--dm-primary-dark); --bs-btn-active-bg: #3730a3; --bs-btn-disabled-bg: #a5b4fc; --bs-btn-disabled-border-color: #a5b4fc; box-shadow: 0 1px 2px rgba(79,70,229,.25); }
.btn-outline-primary { --bs-btn-color: var(--dm-primary); --bs-btn-border-color: #c7d2fe; --bs-btn-hover-bg: var(--dm-primary-soft); --bs-btn-hover-color: var(--dm-primary-dark); --bs-btn-hover-border-color: #a5b4fc; --bs-btn-active-bg: #e0e7ff; --bs-btn-active-color: var(--dm-primary-dark); }
.btn-outline-secondary { --bs-btn-color: #344054; --bs-btn-border-color: var(--dm-border-strong); --bs-btn-hover-bg: #f9fafb; --bs-btn-hover-color: var(--dm-text); --bs-btn-hover-border-color: var(--dm-border-strong); --bs-btn-active-bg: #f2f4f7; --bs-btn-active-color: var(--dm-text); background: #fff; box-shadow: 0 1px 2px rgba(16,24,40,.04); }
.btn-light { --bs-btn-bg: #f2f4f7; --bs-btn-border-color: #f2f4f7; --bs-btn-hover-bg: #eaecf0; --bs-btn-hover-border-color: #eaecf0; }
.btn-outline-danger { --bs-btn-border-color: #fda29b; --bs-btn-hover-bg: #fef3f2; --bs-btn-hover-color: var(--dm-danger); --bs-btn-hover-border-color: #fda29b; background: #fff; }

/* ---- Forms ---- */
.form-label { font-weight: 500; font-size: .893rem; color: #344054; margin-bottom: .35rem; display: inline-flex; align-items: center; gap: .15rem; }
.form-control, .form-select { border-radius: var(--dm-radius-sm); border-color: var(--dm-border-strong); padding: .5rem .75rem; font-size: .93rem; box-shadow: 0 1px 2px rgba(16,24,40,.04); }
.form-control-sm, .form-select-sm { padding: .3rem .6rem; font-size: .857rem; }
.form-control::placeholder { color: #98a2b3; }
.form-text { color: var(--dm-text-3); font-size: .82rem; margin-top: .3rem; }
.form-check-input:checked { background-color: var(--dm-primary); border-color: var(--dm-primary); }
.input-group-text { background: #f9fafb; border-color: var(--dm-border-strong); color: var(--dm-text-3); }
.field-validation-error, .invalid-feedback, .text-danger.small { font-size: .82rem; }
.btn:focus-visible, .form-control:focus, .form-select:focus, .form-check-input:focus { box-shadow: 0 0 0 4px rgba(79,70,229,.15); border-color: #a5b4fc; outline: 0; }
a:focus-visible { outline: 2px solid var(--dm-primary); outline-offset: 2px; border-radius: 4px; }

/* Form layout: titled groups of fields */
.form-section { padding: 1.25rem 0; border-top: 1px solid var(--dm-border); }
.form-section:first-child { border-top: 0; padding-top: 0; }
.form-section-title { font-size: .95rem; font-weight: 600; margin-bottom: .2rem; }
.form-section-hint { color: var(--dm-text-3); font-size: .857rem; margin-bottom: 1rem; }
.form-actions { display: flex; gap: .5rem; justify-content: flex-end; padding-top: 1rem; border-top: 1px solid var(--dm-border); margin-top: .5rem; }

/* ---- Cards ---- */
.card { border: 1px solid var(--dm-border); border-radius: var(--dm-radius); box-shadow: var(--dm-shadow); --bs-card-cap-bg: #fff; }
.card.border-0 { border: 1px solid var(--dm-border) !important; }
.card .card { box-shadow: none; }
.shadow-sm { box-shadow: var(--dm-shadow) !important; }
.card-header { background: #fff; border-bottom-color: var(--dm-border); font-weight: 600; padding: .85rem 1.1rem; }
.card > .card-header:first-child { border-radius: var(--dm-radius) var(--dm-radius) 0 0; }
.card-body { padding: 1.1rem; }
.card-footer { background: #fcfcfd; border-top-color: var(--dm-border); }
.list-group-item { border-color: var(--dm-border); padding: .75rem 1.1rem; }

/* section-card tag helper */
.section-card { margin-bottom: 1rem; }
.section-header { display: flex; align-items: flex-start; gap: .75rem; padding: 1rem 1.1rem .85rem; border-bottom: 1px solid var(--dm-border); }
.section-icon { width: 34px; height: 34px; border-radius: 9px; background: var(--dm-primary-soft); color: var(--dm-primary); display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; font-size: 1rem; }
.section-titles { min-width: 0; flex: 1; }
.section-title { font-size: 1rem; font-weight: 600; margin: 0; display: flex; align-items: center; gap: .2rem; line-height: 1.6; }
.section-description { font-size: .857rem; color: var(--dm-text-3); }
.section-actions { display: flex; gap: .4rem; flex-wrap: wrap; margin-left: auto; align-items: center; }
.section-body { padding: 1.1rem; }
.section-body-flush { padding: 0; }
.section-body-flush > .table, .section-body-flush > .table-responsive > .table { margin-bottom: 0; }
.section-body-flush > .list-group { border-radius: 0 0 var(--dm-radius) var(--dm-radius); }

/* ---- Info tips ---- */
.info-tip { border: 0; background: transparent; padding: 0 .2rem; color: #98a2b3; font-size: .85em; line-height: 1; cursor: help; display: inline-flex; align-items: center; vertical-align: middle; }
.info-tip:hover, .info-tip:focus-visible { color: var(--dm-primary); outline: 0; }
.popover { --bs-popover-border-color: var(--dm-border); --bs-popover-body-color: var(--dm-text-2); --bs-popover-font-size: .857rem; --bs-popover-max-width: 300px; box-shadow: var(--dm-shadow-md); border-radius: 10px; }
.tooltip { --bs-tooltip-bg: #101828; --bs-tooltip-font-size: .8rem; }

/* ---- KPI cards ---- */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(175px, 1fr)); gap: 1rem; margin-bottom: 1rem; }
.kpi-card { display: flex; gap: .9rem; align-items: flex-start; background: var(--dm-surface); border: 1px solid var(--dm-border); border-radius: var(--dm-radius); box-shadow: var(--dm-shadow); padding: 1rem 1.1rem; color: inherit; text-decoration: none; transition: border-color .15s, box-shadow .15s, transform .15s; min-width: 0; }
a.kpi-card:hover { border-color: #c7d2fe; box-shadow: var(--dm-shadow-md); transform: translateY(-1px); color: inherit; }
.kpi-icon { width: 42px; height: 42px; border-radius: 11px; display: inline-flex; align-items: center; justify-content: center; font-size: 1.2rem; flex-shrink: 0; }
.kpi-body { display: flex; flex-direction: column; min-width: 0; }
.kpi-label { font-size: .82rem; color: var(--dm-text-3); font-weight: 500; display: inline-flex; align-items: center; }
.kpi-value { font-size: 1.55rem; font-weight: 700; line-height: 1.2; color: var(--dm-text); letter-spacing: -.02em; display: flex; align-items: baseline; gap: .5rem; flex-wrap: wrap; }
.kpi-delta { font-size: .8rem; font-weight: 600; display: inline-flex; align-items: center; gap: .1rem; }
.kpi-note { font-size: .78rem; color: var(--dm-text-3); line-height: 1.35; margin-top: .1rem; }
.kpi-primary .kpi-icon { background: #eef2ff; color: #4338ca; }
.kpi-success .kpi-icon { background: #ecfdf3; color: #067647; }
.kpi-warning .kpi-icon { background: #fffaeb; color: #b54708; }
.kpi-danger .kpi-icon { background: #fef3f2; color: #b42318; }
.kpi-info .kpi-icon { background: #eff8ff; color: #175cd3; }
.kpi-secondary .kpi-icon { background: #f2f4f7; color: #344054; }

/* ---- Charts ---- */
.vd-chart { width: 100%; height: 280px; }
.vd-chart.sm { height: 200px; }
.vd-chart.lg { height: 360px; }
.vd-chart-empty { height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .4rem; color: #98a2b3; font-size: .875rem; }
.vd-chart-empty i { font-size: 1.6rem; }

/* Report builder (EPIC 40.1): live preview while it reloads, numbers in report tables, the line of facts under a report */
.is-loading[aria-busy] { opacity: .55; transition: opacity .15s; pointer-events: none; }
.report-table td.num, .report-table th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.report-meta { display: flex; flex-wrap: wrap; gap: .25rem 1rem; font-size: .8125rem; color: #667085; }
.report-builder .form-label { font-size: .8125rem; font-weight: 600; margin-bottom: .25rem; }
@media (min-width: 1200px) { .report-preview-sticky { position: sticky; top: 1rem; } }

/* ---- Tables ---- */
.table { --bs-table-color: var(--dm-text); --bs-table-border-color: var(--dm-border); margin-bottom: 0; }
.table > thead { --bs-table-bg: #f9fafb; }
.table thead th { font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: var(--dm-text-3); font-weight: 600; padding: .65rem 1rem; white-space: nowrap; border-bottom-width: 1px; }
.table td { padding: .75rem 1rem; vertical-align: middle; }
.table-sm td, .table-sm th { padding: .45rem .75rem; }
.table-hover > tbody > tr:hover > * { --bs-table-bg-state: #f8f8ff; }
.card > .table-responsive:last-child .table tr:last-child td, .card > .table:last-child tr:last-child td { border-bottom: 0; }
.row-actions { display: flex; gap: .25rem; justify-content: flex-end; }

/* ---- Badges, status, avatars ---- */
.badge { font-weight: 500; padding: .35em .6em; border-radius: 6px; letter-spacing: .01em; }
.text-bg-light.border { color: var(--dm-text-2) !important; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: linear-gradient(135deg, #6366f1, #4338ca); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-weight: 600; font-size: .85rem; flex-shrink: 0; }
.avatar-sm { width: 26px; height: 26px; font-size: .72rem; }

/* ---- Tabs / nav pills used as sub-navigation ---- */
.nav-tabs { border-bottom-color: var(--dm-border); gap: .25rem; }
.nav-tabs .nav-link { border: 0; border-bottom: 2px solid transparent; color: var(--dm-text-3); font-weight: 500; padding: .6rem .9rem; margin-bottom: -1px; }
.nav-tabs .nav-link:hover { color: var(--dm-text); border-bottom-color: var(--dm-border-strong); }
.nav-tabs .nav-link.active { color: var(--dm-primary); border-bottom-color: var(--dm-primary); background: transparent; }
.nav-pills .nav-link { color: var(--dm-text-2); font-weight: 500; border-radius: var(--dm-radius-sm); }
.nav-pills .nav-link.active { background: var(--dm-primary-soft); color: var(--dm-primary-dark); }

/* ---- Alerts, toasts, modals, dropdowns ---- */
.alert { border-radius: 10px; border: 1px solid transparent; font-size: .93rem; }
.alert-success { background: #ecfdf3; border-color: #abefc6; color: #067647; }
.alert-danger { background: #fef3f2; border-color: #fecdca; color: #b42318; }
.alert-warning { background: #fffaeb; border-color: #fedf89; color: #93370d; }
.alert-info { background: #eff8ff; border-color: #b2ddff; color: #175cd3; }
.vd-toast { background: #fff; border: 1px solid var(--dm-border); border-radius: 12px; box-shadow: var(--dm-shadow-md); font-size: .93rem; overflow: hidden; }
.vd-toast > div > .bi { font-size: 1.1rem; margin-top: .05rem; }
.vd-toast-success > div > .bi { color: var(--dm-success); }
.vd-toast-danger > div > .bi { color: var(--dm-danger); }
.vd-toast-warning > div > .bi { color: var(--dm-warning); }
.vd-toast-info > div > .bi { color: var(--dm-info); }
.toast-container { z-index: 1090; }
.modal-content { border: 0; border-radius: 14px; box-shadow: 0 24px 48px -12px rgba(16,24,40,.25); }
.vd-confirm-icon { width: 44px; height: 44px; border-radius: 50%; background: #fef3f2; color: var(--dm-danger); display: inline-flex; align-items: center; justify-content: center; font-size: 1.25rem; flex-shrink: 0; }
.dropdown-menu { border: 1px solid var(--dm-border); border-radius: 10px; box-shadow: var(--dm-shadow-md); padding: .35rem; font-size: .93rem; }
.dropdown-item { border-radius: 6px; padding: .45rem .7rem; display: flex; align-items: center; gap: .5rem; }
.dropdown-item:active { background: var(--dm-primary-soft); color: var(--dm-primary-dark); }

/* ---- Empty states ---- */
.empty-state { text-align: center; padding: 2.5rem 1rem; color: var(--dm-text-3); }
.empty-state-icon { width: 56px; height: 56px; border-radius: 50%; background: var(--dm-primary-soft); color: var(--dm-primary); display: inline-flex; align-items: center; justify-content: center; font-size: 1.5rem; margin-bottom: .75rem; box-shadow: 0 0 0 8px #f5f6ff; }
.empty-state-title { color: var(--dm-text); font-weight: 600; font-size: 1rem; margin-bottom: .25rem; }
.empty-state-text { max-width: 26rem; margin: 0 auto; font-size: .9rem; }

/* ===== App shell ===== */
.app-shell { display: flex; min-height: 100vh; }
.app-sidebar {
    width: 252px;
    background: linear-gradient(180deg, var(--dm-sidebar-2) 0%, var(--dm-sidebar) 100%);
    color: #e0e7ff;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,.18) transparent;
}
.app-sidebar::-webkit-scrollbar { width: 6px; }
.app-sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.18); border-radius: 3px; }
.app-sidebar .brand {
    display: block;
    font-weight: 700;
    font-size: 1.15rem;
    color: #fff;
    padding: 1.05rem 1.25rem .9rem;
    letter-spacing: .2px;
}
.app-sidebar .brand .dot { color: #818cf8; }

/* "Jump to" box */
.nav-find { position: relative; margin: 0 .85rem .6rem; }
.nav-find > i { position: absolute; left: .7rem; top: 50%; transform: translateY(-50%); font-size: .8rem; color: var(--dm-sidebar-muted); pointer-events: none; }
.nav-find input {
    width: 100%; background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.1); border-radius: 8px;
    color: #fff; font-size: .85rem; padding: .42rem 2rem .42rem 2rem; outline: none; transition: background .15s, border-color .15s;
}
.nav-find input::placeholder { color: #a5b4fc; opacity: .75; }
.nav-find input:focus { background: rgba(255,255,255,.12); border-color: #818cf8; }
.nav-find input::-webkit-search-cancel-button { filter: invert(1); opacity: .6; }
.nav-find kbd { position: absolute; right: .55rem; top: 50%; transform: translateY(-50%); font-size: .68rem; padding: .05rem .35rem;
    background: rgba(255,255,255,.1); color: #c7d2fe; border-radius: 4px; box-shadow: none; }
.nav-find input:focus + kbd, .nav-find input:not(:placeholder-shown) + kbd { display: none; }

.app-sidebar .nav-link {
    color: #c7d2fe;
    padding: .44rem .85rem;
    margin: 1px .6rem;
    display: flex;
    align-items: center;
    gap: .7rem;
    font-size: .89rem;
    border-radius: 8px;
    transition: background .12s, color .12s;
}
.app-sidebar .nav-link:hover { background: rgba(255,255,255,.07); color: #fff; }
.app-sidebar .nav-link.active { background: rgba(129,140,248,.22); color: #fff; font-weight: 500; box-shadow: inset 3px 0 0 #818cf8; }
.app-sidebar .nav-link:focus-visible, .nav-group-toggle:focus-visible { outline: 2px solid #818cf8; outline-offset: -2px; }

/* Collapsible groups */
/* Group headings read as section labels, not links: dimmer, smaller, wider spacing, faint icons. A hairline
   separates the top-level links from the groups; an open group sits on a faint panel with an indent guide. */
.nav-group { margin: .1rem .6rem 0; border-radius: 10px; transition: background .15s; }
.app-sidebar .nav-link + .nav-group { margin-top: .75rem; position: relative; }
.app-sidebar .nav-link + .nav-group::before { content: ""; position: absolute; left: .25rem; right: .25rem; top: -.4rem; border-top: 1px solid rgba(255,255,255,.08); }
.nav-group.open { background: rgba(255,255,255,.035); }
.nav-group-toggle {
    all: unset; box-sizing: border-box; cursor: pointer;
    width: 100%; padding: .55rem .85rem;
    display: flex; align-items: center; gap: .7rem; border-radius: 10px;
    font-size: .68rem; font-weight: 600; text-transform: uppercase; letter-spacing: .12em; color: #8f96cc;
}
.nav-group-toggle > i:first-child { opacity: .65; font-size: .8rem; }
.nav-group-toggle > span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-group-toggle:hover { color: #c7d2fe; }
.nav-group-toggle .chev { margin-left: auto; font-size: .65rem; opacity: .7; transition: transform .18s ease; }
.nav-group.open .nav-group-toggle .chev { transform: rotate(180deg); }
.nav-group.open > .nav-group-toggle, .nav-group.has-active > .nav-group-toggle { color: #c7d2fe; }
.nav-group-items { display: none; padding: 0 0 .4rem; margin-left: 1.35rem; border-left: 1px solid rgba(255,255,255,.08); }
.nav-group.open .nav-group-items, .app-sidebar.filtering .nav-group-items { display: block; }
.nav-group-items .nav-link { margin: 1px .35rem 1px .4rem; padding-left: .7rem; }
.app-sidebar .nav-link i, .nav-group-toggle > i:first-child { width: 1.1rem; text-align: center; flex-shrink: 0; }
.nav-empty { padding: .6rem 1.45rem; font-size: .85rem; color: var(--dm-sidebar-muted); }

/* Top bar breadcrumb */
.topbar-crumb { align-items: center; gap: .45rem; font-size: .88rem; min-width: 0; }
.topbar-crumb .bi { font-size: .7rem; color: #98a2b3; }
.topbar-crumb span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.app-sidebar .brand-tag { font-size: .62rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; background: #f59e0b; color: #1c1917; border-radius: 4px; padding: .1rem .35rem; margin-left: .5rem; vertical-align: middle; }
/* Platform console (no workspace): a different accent so operators never mistake it for a client workspace (docs/10). */
.platform-shell .app-sidebar { background: linear-gradient(180deg, #1c2434 0%, #0f1521 100%); }
.platform-shell .app-sidebar .brand .dot { color: #fbbf24; }
.platform-shell .app-sidebar .nav-link.active { background: rgba(251,191,36,.16); box-shadow: inset 3px 0 0 #fbbf24; }
.platform-shell .nav-find input:focus { border-color: #fbbf24; }
.platform-shell .app-topbar { border-top: 3px solid #f59e0b; }
.app-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.app-topbar { background: rgba(255,255,255,.92); backdrop-filter: saturate(180%) blur(8px); border-bottom: 1px solid var(--dm-border); padding: .55rem 1.75rem; display: flex; align-items: center; gap: 1rem; position: sticky; top: 0; z-index: 20; min-height: 58px; }
.app-content { padding: 1.5rem 1.75rem 3rem; flex: 1; width: 100%; max-width: 1640px; }

/* Page header (PageHeaderTagHelper) */
.page-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.5rem; }
.page-header-main { display: flex; gap: .9rem; align-items: flex-start; min-width: 0; }
.page-icon { width: 44px; height: 44px; border-radius: 12px; background: linear-gradient(135deg, #eef2ff, #e0e7ff); color: var(--dm-primary); display: inline-flex; align-items: center; justify-content: center; font-size: 1.3rem; flex-shrink: 0; border: 1px solid #e0e7ff; }
.page-header-titles { min-width: 0; }
.page-back { display: table; margin-bottom: .2rem; font-size: .85rem; color: var(--dm-text-3); text-decoration: none; }
.page-back:hover { color: var(--dm-primary); }
.page-title { font-size: 1.6rem; font-weight: 700; margin: 0; display: inline-flex; align-items: center; gap: .25rem; letter-spacing: -.02em; line-height: 1.3; }
.page-subtitle { color: var(--dm-text-3); font-size: .93rem; margin-top: .15rem; max-width: 60rem; }
.page-header-actions { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }

/* Toolbars and filters */
.toolbar-form { margin-bottom: 1.25rem; }
.filter-bar { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; background: #fff; border: 1px solid var(--dm-border); border-radius: var(--dm-radius); padding: .6rem; margin-bottom: 1rem; box-shadow: var(--dm-shadow); }
.filter-control { max-width: 360px; }
.filter-control-sm { max-width: 260px; }

/* Auth / centered pages */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 2rem 1rem; background: radial-gradient(900px 500px at 85% -10%, #e0e7ff 0%, rgba(224,231,255,0) 60%), radial-gradient(700px 420px at -10% 110%, #ede9fe 0%, rgba(237,233,254,0) 60%), var(--dm-bg); }
.auth-brand { font-weight: 800; color: var(--dm-sidebar); font-size: 1.6rem; letter-spacing: -.02em; }

/* Dashboard */
.dash-hero { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.5rem; }
.dash-hero h1 { font-weight: 700; letter-spacing: -.02em; font-size: 1.6rem; }
.dash-actions { display: flex; gap: .5rem; flex-wrap: wrap; }

/* Mobile */
@media (max-width: 991.98px) {
    .app-sidebar { position: fixed; left: -270px; z-index: 1050; transition: left .2s ease; box-shadow: var(--dm-shadow-md); }
    .app-sidebar.open { left: 0; }
    .sidebar-backdrop { position: fixed; inset: 0; background: rgba(16,24,40,.45); z-index: 1040; }
    .app-topbar { padding: .55rem 1rem; }
    .app-content { padding: 1.1rem 1rem 2.5rem; }
    .page-title { font-size: 1.35rem; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* Place picker city search */
.place-city { position: relative; }
.place-city-list { width: 100%; max-height: 300px; overflow-y: auto; margin-top: 2px; }
.place-city-list .dropdown-item { display: flex; gap: .75rem; }

/* Masters */
.masters-nav { padding: .4rem; }
.masters-nav-item { display: flex; gap: .75rem; align-items: flex-start; padding: .7rem .75rem; border-radius: 10px; color: inherit; text-decoration: none; }
.masters-nav-item:hover { background: #f9fafb; color: inherit; }
.masters-nav-item.active { background: var(--dm-primary-soft); }
.masters-nav-item.active .fw-semibold { color: var(--dm-primary-dark); }
.masters-add { padding: 1rem 1.1rem; background: #fcfcfd; border-bottom: 1px solid var(--dm-border); }
tr.dragging { opacity: .5; background: var(--dm-primary-soft); }
.drag-handle { cursor: grab; }
.tabular { font-variant-numeric: tabular-nums; }
.min-w-0 { min-width: 0; }

/* Help panel beside forms */
.help-panel { position: sticky; top: 80px; background: linear-gradient(180deg, #f8f9ff, #fff); border: 1px solid #e0e7ff; border-radius: var(--dm-radius); padding: 1.1rem 1.2rem; font-size: .893rem; color: var(--dm-text-2); }
.help-panel-title { font-weight: 600; color: var(--dm-primary-dark); margin-bottom: .6rem; display: flex; align-items: center; gap: .4rem; }
.help-panel ul { padding-left: 1.1rem; margin: 0; display: grid; gap: .55rem; }
.help-panel strong { color: var(--dm-text); font-weight: 600; }
.card-link { color: inherit; text-decoration: none; transition: border-color .15s, box-shadow .15s; }
.card-link:hover { border-color: #c7d2fe; box-shadow: var(--dm-shadow-md); color: inherit; }
.vd-chart.is-empty { height: 160px; }
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: .4rem 1rem; }

/* Settings quick links */
.settings-links { padding-bottom: .4rem; position: sticky; top: 80px; }
.settings-links a { display: flex; gap: .75rem; align-items: flex-start; padding: .6rem 1rem; color: inherit; text-decoration: none; border-top: 1px solid var(--dm-border); }
.settings-links a:hover { background: #f9fafb; }
.settings-links a > i { color: var(--dm-primary); font-size: 1.05rem; margin-top: .1rem; }
.settings-links strong { display: block; font-weight: 600; font-size: .9rem; }
.settings-links small { color: var(--dm-text-3); }
.form-select-sm { padding-right: 2rem; background-position: right .55rem center; }

/* Shared additions from the screen pass */
@media (max-width: 575.98px) { .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .6rem; } .kpi-card { padding: .8rem; gap: .6rem; } .kpi-icon { width: 34px; height: 34px; font-size: 1rem; } .kpi-value { font-size: 1.25rem; } }
tr[data-href] { cursor: pointer; }
.filter-select { width: auto; min-width: 10rem; max-width: 14rem; }
.form-check-input { border-color: #98a2b3; }
.text-pre-line { white-space: pre-line; }
.validation-summary-errors ul { margin-bottom: 0; padding-left: 1.1rem; }
.alert ul:last-child { margin-bottom: 0; }
.timer-pill { display: inline-flex; align-items: center; gap: .1rem; border: 1px solid #fecdca; background: #fef3f2; border-radius: 999px; padding: .2rem .65rem; font-size: .85rem; font-weight: 600; color: #b42318; }
.timer-pill a { color: inherit; }

/* =====================================================================
   Everyday workspace (EPIC 37): top-bar search and quick add, the search
   dialog, tags, the "no next step" flag, My Day rows, composer preview.
   ===================================================================== */
.topbar-search { display: inline-flex; align-items: center; gap: .5rem; border: 1px solid var(--dm-border-strong); background: #fff; color: var(--dm-text-3); border-radius: var(--dm-radius-sm); padding: .3rem .6rem; font-size: .857rem; min-width: 2.2rem; box-shadow: 0 1px 2px rgba(16,24,40,.04); }
.topbar-search:hover { border-color: #a5b4fc; color: var(--dm-text); }
.topbar-search kbd, .vd-search-box kbd, .vd-search-foot kbd { font-size: .68rem; padding: .05rem .35rem; background: #f2f4f7; color: var(--dm-text-2); border: 1px solid var(--dm-border); border-radius: 4px; box-shadow: none; }
@media (min-width: 992px) { .topbar-search { min-width: 15rem; } .topbar-search kbd { margin-left: auto; } }
.topbar-add { padding-left: .55rem; padding-right: .7rem; }

.vd-search-dialog { margin-top: 8vh; }
.vd-search-box { display: flex; align-items: center; gap: .65rem; padding: .85rem 1.1rem; border-bottom: 1px solid var(--dm-border); }
.vd-search-box > .bi { color: var(--dm-text-3); font-size: 1.05rem; }
.vd-search-box input { flex: 1; border: 0; outline: 0; font-size: 1.05rem; min-width: 0; background: transparent; }
.vd-search-box input::-webkit-search-cancel-button { display: none; }
.vd-search-results { max-height: min(60vh, 520px); overflow-y: auto; padding: .35rem; }
.vd-search-empty { padding: 2rem 1rem; text-align: center; color: var(--dm-text-2); }
.vd-search-foot { display: flex; flex-wrap: wrap; gap: .9rem; padding: .55rem 1.1rem; border-top: 1px solid var(--dm-border); font-size: .78rem; color: var(--dm-text-3); background: #fcfcfd; border-radius: 0 0 14px 14px; }
.vd-hit-heading { font-size: .7rem; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--dm-text-3); padding: .6rem .75rem .25rem; }
.vd-hit { display: flex; align-items: center; gap: .7rem; width: 100%; padding: .5rem .75rem; border-radius: 8px; color: var(--dm-text); text-decoration: none; border: 0; background: transparent; text-align: left; }
.vd-hit:hover, .vd-hit.active { background: var(--dm-primary-soft); color: var(--dm-text); }
.vd-hit-icon { width: 30px; height: 30px; border-radius: 8px; background: #f2f4f7; color: var(--dm-primary); display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.vd-hit.active .vd-hit-icon { background: #fff; }
.vd-hit-text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.vd-hit-title { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vd-hit-sub { font-size: .8rem; color: var(--dm-text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vd-hit-sub:empty { display: none; }
.vd-hit-kind { font-size: .72rem; color: var(--dm-text-3); flex-shrink: 0; }
@media (max-width: 575.98px) { .vd-search-dialog { margin: 0; } .vd-search-dialog .modal-content { border-radius: 0; min-height: 100vh; } .vd-search-results { max-height: none; } .vd-search-foot { display: none; } }

.vd-record-pick { position: relative; }
.vd-record-pick .dropdown-menu { max-height: 280px; overflow-y: auto; }
.vd-record-chosen { display: flex; align-items: center; gap: .5rem; padding: .45rem .7rem; border: 1px solid var(--dm-border-strong); border-radius: var(--dm-radius-sm); background: #f9fafb; }
.vd-record-chosen.d-none { display: none !important; }
.vd-choice { display: flex; flex-wrap: wrap; gap: .35rem; }

/* Tags */
.vd-tags { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem; }
.vd-tag-list { display: contents; }
.vd-tag { display: inline-flex; align-items: center; gap: .25rem; padding: .15rem .55rem; border-radius: 999px; background: var(--dm-primary-soft); color: var(--dm-primary-dark); font-size: .8rem; font-weight: 500; line-height: 1.5; }
.vd-tag::before { content: "#"; opacity: .55; }
.vd-tag-sm { font-size: .7rem; padding: .02rem .45rem; }
.vd-tag-x { border: 0; background: transparent; color: inherit; padding: 0 0 0 .1rem; line-height: 1; font-size: 1rem; opacity: .6; }
.vd-tag-x:hover, .vd-tag-x:focus-visible { opacity: 1; }
.vd-tag-input { border: 1px dashed var(--dm-border-strong); border-radius: 999px; padding: .12rem .65rem; font-size: .8rem; width: 8.5rem; outline: 0; background: transparent; }
.vd-tag-input:focus { border-style: solid; border-color: #a5b4fc; box-shadow: 0 0 0 3px rgba(79,70,229,.12); width: 11rem; }
.vd-tag-chips { display: inline-flex; flex-wrap: wrap; gap: .2rem; margin-left: .35rem; vertical-align: middle; font-weight: 400; }

/* Deal with no next step (37.7) */
.vd-nostep { display: inline-flex; align-items: center; gap: .25rem; font-size: .72rem; font-weight: 500; color: #93370d; background: #fffaeb; border: 1px solid #fedf89; border-radius: 6px; padding: .05rem .4rem; margin-left: .35rem; white-space: nowrap; vertical-align: middle; position: relative; z-index: 2; }
.card .vd-nostep { margin-left: 0; }

/* My Day */
.myday-filters { display: flex; flex-wrap: wrap; gap: .35rem; margin-bottom: 1rem; }
.myday-filters .btn { gap: .35rem; border: 1px solid var(--dm-border); background: #fff; }
.myday-filters .btn.active { background: var(--dm-primary-soft); border-color: #c7d2fe; color: var(--dm-primary-dark); }
.myday-filters .badge { font-weight: 600; }
.myday-row { display: flex; align-items: center; gap: .85rem; transition: opacity .25s, transform .25s; }
.myday-row.myday-gone { opacity: 0; transform: translateX(12px); }
.myday-icon { width: 36px; height: 36px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; font-size: 1rem; background: #eef2ff; color: #4338ca; }
.myday-followup { background: #ecfdf3; color: #067647; }
.myday-meeting { background: #eff8ff; color: #175cd3; }
.myday-inbox { background: #fffaeb; color: #b54708; }
.myday-stuckdeal { background: #fef3f2; color: #b42318; }
.myday-main { min-width: 0; flex: 1; }
.myday-title { font-weight: 600; color: var(--dm-text); text-decoration: none; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.myday-title:hover { color: var(--dm-primary); }
.myday-meta { display: flex; flex-wrap: wrap; align-items: center; gap: .2rem .5rem; font-size: .82rem; color: var(--dm-text-3); min-width: 0; }
.myday-meta .text-truncate { max-width: 22rem; }
.myday-when { font-size: .82rem; white-space: nowrap; }
.myday-actions { display: flex; gap: .3rem; align-items: center; flex-shrink: 0; }
.myday-danger .section-icon { background: #fef3f2; color: var(--dm-danger); }
@media (max-width: 575.98px) {
    .myday-row { flex-wrap: wrap; gap: .5rem .75rem; }
    .myday-main { flex-basis: calc(100% - 50px); }
    .myday-when { margin-left: 48px; }
    .myday-actions { margin-left: auto; }
}

/* Composer merge preview */
.vd-template-menu { min-width: 16rem; max-height: 320px; overflow-y: auto; }
.vd-merge-preview { border: 1px solid #e0e7ff; background: #f8f9ff; border-radius: var(--dm-radius-sm); padding: .65rem .8rem; }

/* Website → Settings: theme choice cards (EPIC 26) */
.theme-option { display: block; height: 100%; cursor: pointer; border: 1px solid var(--dm-border-strong); border-radius: var(--dm-radius-sm); padding: .75rem .9rem; background: #fff; transition: border-color .15s, box-shadow .15s; }
.theme-option:hover { border-color: #a5b4fc; }
.btn-check:checked + .theme-option { border-color: var(--dm-primary); box-shadow: 0 0 0 3px var(--dm-primary-soft); }
.btn-check:focus-visible + .theme-option { outline: 2px solid var(--dm-primary); outline-offset: 2px; }
.theme-swatches { display: flex; margin-bottom: .5rem; }
.theme-swatches span { width: 22px; height: 22px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px rgba(15, 23, 42, .12); margin-right: -6px; }

/* ---- Content labels (EPIC 42.4): a colour per label, set inline as --chip ---- */
.vd-label-badge { background: color-mix(in srgb, var(--chip) 16%, transparent); color: color-mix(in srgb, var(--chip) 70%, #0f172a); border: 1px solid color-mix(in srgb, var(--chip) 35%, transparent); font-weight: 500; }
.vd-label-chip { border: 1px solid color-mix(in srgb, var(--chip) 45%, transparent); color: color-mix(in srgb, var(--chip) 75%, #0f172a); background: transparent; }
.vd-label-chip::before { content: ""; display: inline-block; width: .55rem; height: .55rem; border-radius: 50%; background: var(--chip); margin-right: .35rem; }
.btn-check:checked + .vd-label-chip { background: color-mix(in srgb, var(--chip) 18%, transparent); border-color: var(--chip); font-weight: 600; }
.btn-check:focus-visible + .vd-label-chip { outline: 2px solid var(--chip); outline-offset: 2px; }
[data-bs-theme="dark"] .vd-label-badge, [data-bs-theme="dark"] .vd-label-chip { color: color-mix(in srgb, var(--chip) 55%, #fff); }

/* ---- Posting queue grid (EPIC 42.3) ---- */
.vd-queue-grid td, .vd-queue-grid th { padding: .3rem .4rem; }
.vd-queue-grid tbody tr:hover { background: var(--bs-tertiary-bg); }

/* ---- Link-in-bio preview (EPIC 42.7) ---- */
.vd-bio-preview { max-width: 18rem; padding: 1.25rem 1rem; border-radius: 1.25rem; background: color-mix(in srgb, var(--bio) 8%, var(--bs-body-bg)); border: 1px solid var(--bs-border-color); }
.vd-bio-avatar { display: block; width: 64px; height: 64px; border-radius: 50%; object-fit: cover; margin: 0 auto .5rem; }
.vd-bio-button { margin-top: .5rem; padding: .55rem .75rem; border-radius: .7rem; background: var(--bio); color: #fff; text-align: center; font-size: .875rem; font-weight: 600; }

/* ---- Sequence flow (EPIC 44.1): trigger, waits, branch conditions ---- */
.vd-flow-node { display: inline-flex; align-items: center; gap: .4rem; padding: .3rem .75rem; border-radius: 999px; font-size: .8rem; font-weight: 600; background: var(--bs-tertiary-bg); border: 1px solid var(--bs-border-color); }
.vd-flow-start { background: var(--bs-primary-bg-subtle); border-color: var(--bs-primary-border-subtle); color: var(--bs-primary-text-emphasis); }
.vd-flow-link { margin-left: 1rem; padding: .35rem 0 .35rem .9rem; border-left: 2px dashed var(--bs-border-color); font-size: .8rem; color: var(--bs-secondary-color); min-height: .75rem; }
.vd-flow-branch { margin-left: 1rem; padding: 0 0 .4rem .9rem; border-left: 2px dashed var(--bs-border-color); display: flex; flex-wrap: wrap; align-items: center; gap: .25rem .75rem; font-size: .8rem; }
.vd-flow-cond { padding: .15rem .55rem; border-radius: .4rem; background: var(--bs-warning-bg-subtle); border: 1px solid var(--bs-warning-border-subtle); color: var(--bs-warning-text-emphasis); font-weight: 600; }

/* ---- Local map grid (EPIC 45.3) ---- */
.vd-grid { display: grid; grid-template-columns: repeat(var(--n), minmax(2.25rem, 3.25rem)); gap: .35rem; justify-content: center; }
.vd-grid-cell { aspect-ratio: 1; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: .85rem; color: #fff; }
.vd-grid-cell[data-centre] { outline: 3px solid var(--bs-primary); outline-offset: 2px; }
.vd-grid-top { background: #12b76a; }
.vd-grid-mid { background: #f79009; }
.vd-grid-low { background: #f04438; }
.vd-grid-none { background: var(--bs-secondary-bg); color: var(--bs-secondary-color); font-weight: 500; font-size: .7rem; }
.vd-grid-key { display: inline-block; width: .8rem; height: .8rem; border-radius: 50%; margin-right: .3rem; vertical-align: -1px; }
