/* DarkControl v2 application design system. Light tokens; dark tokens live in assets/theme-dark.css. */
:root,
html[data-theme="light"] {
    color-scheme: light;
    --bg-subtle: #f8faf9;
    --bg-sunken: #eef1f0;
    --sidebar-bg: #fbfcfc;
    --topbar-bg: rgba(255, 255, 255, .97);
    --mobile-nav-bg: rgba(255, 255, 255, .96);
    --popover-glass: rgba(255, 255, 255, .94);
    --border-hover: #aebbb6;
    --success-border: #c9e2d4;
    --danger-border: #edcaca;
    --warning-border: #e8d7b8;
    --info-border: #d8ddec;
    --text-on-solid: #ffffff;
    --accent-text: #0f5d4e;
    --nav-label: #5f6e69;
    --scrollbar: #c5cfcb;
    --avatar-border: #c8ddd6;
    --avatar-text: #125e4f;
    --avatar-bg: #edf7f4;
    --env-border: #d8c48f;
    --env-text: #725c20;
    --env-bg: #fff9df;
    --service-text: #4e587d;
    --service-bg: #f2f3f8;
    --offline-border: #e4c480;
    --offline-text: #62430f;
    --offline-strong: #51370d;
    --offline-bg: #fff7e6;
    --crumb-sep: #8d9a95;
    --chart-grid: #e6ebe9;
    --table-scroll-shadow: rgba(23, 32, 30, .75);
    --brand: #17201e;
    --brand-2: #33413d;
    --accent: #14715f;
    --accent-hover: #0f5d4e;
    --accent-press: #0a493d;
    --accent-subtle: #e9f5f1;
    --accent-ring: rgba(20, 113, 95, .18);
    --success: #187348;
    --success-subtle: #e8f5ee;
    --success-ring: rgba(24, 115, 72, .17);
    --danger: #b23a3a;
    --danger-subtle: #fbecec;
    --danger-ring: rgba(178, 58, 58, .16);
    --warning: #956417;
    --warning-subtle: #fbf3e3;
    --warning-ring: rgba(149, 100, 23, .16);
    --info: #365f94;
    --info-subtle: #edf2f8;
    --bg-app: #f4f6f5;
    --bg-surface: #ffffff;
    --bg-elevated: #f0f3f2;
    --bg-hover: #f4f7f6;
    --bg-overlay: rgba(18, 27, 25, .48);
    --text-primary: #17201e;
    --text-secondary: #485652;
    --text-muted: #5f6e69;
    --text-disabled: #9ba6a2;
    --text-inverse: #ffffff;
    --border: #dfe5e3;
    --border-strong: #cbd5d1;
    --divider: #ebefee;
    --badge-allow-text: #145a3a;
    --badge-deny-text: #8d2c2c;
    --badge-ask-text: #755013;
    /* Added 2026-11-11 (three themes). Interactive-control borders and placeholders meet WCAG non-text / text contrast. */
    --border-control: #7f8c88;
    --text-placeholder: #66746f;
    --focus-ring: var(--accent);
    --accent-border: rgba(20, 113, 95, .25);
    --success-hover: #135f3b;
    --danger-hover: #962f2f;
    --tooltip-bg: var(--text-primary);
    --tooltip-text: var(--bg-surface);
    --border-control-hover: #5f6e69;
    /* One colour per AI tool (audit C5; was injected by app.js). Neutral categorical hues: never a status colour or the
       accent. Light values >= 3.78:1 on white; Midnight / Lights off values live in theme-dark.css. */
    --tool-claudecode: #5b6ee1; --tool-codex: #0f8b8d; --tool-antigravity: #8b5cf6; --tool-opencode: #2f80c4;
    --tool-cursor: #c4458f; --tool-grokbuild: #5f6b7a; --tool-copilot: #8a6440; --tool-openclaw: #7a8494;
    /* Switch knob: white on every theme, on purpose (it sits on the accent or the control-border track). */
    --switch-knob: #ffffff;
    /* Theme previews in the theme menus: constant on purpose, they show what each theme looks like. */
    --swatch-light-bg: #f4f6f5; --swatch-light-fg: #14715f;
    --swatch-midnight-bg: #0c1222; --swatch-midnight-fg: #82a7d9;
    --swatch-lightsoff-bg: #000000; --swatch-lightsoff-fg: #82a7d9;
    --radius-xs: 3px;
    --radius-sm: 5px;
    --radius: 6px;
    --radius-lg: 8px;
    --radius-xl: 8px;
    --shadow-xs: 0 1px 2px rgba(23, 32, 30, .04);
    --shadow-sm: 0 2px 6px rgba(23, 32, 30, .07);
    --shadow-md: 0 12px 30px rgba(23, 32, 30, .10);
    --shadow-lg: 0 24px 64px rgba(23, 32, 30, .18);
    --transition: 150ms cubic-bezier(.2, 0, 0, 1);
    --font-sans: "Archivo", system-ui, -apple-system, "Segoe UI", sans-serif;
    --font-display: "Archivo", system-ui, -apple-system, "Segoe UI", sans-serif;
    --font-mono: "JetBrains Mono", "SFMono-Regular", Consolas, monospace;
    --sidebar-w: 236px;
    --sidebar-w-collapsed: 64px;
    --topbar-h: 58px;
    --content-max: 1540px;
    --content-pad: 28px;
}

html { background: var(--bg-app); }
body.v2-console { min-width: 320px; color: var(--text-primary); background: var(--bg-app); font-size: 14px; letter-spacing: 0; }
body.v2-console h1,
body.v2-console h2,
body.v2-console h3,
body.v2-console h4,
body.v2-console h5 { color: var(--text-primary); letter-spacing: 0; }
body.v2-console h1 { font-size: 1.55rem; font-weight: 680; }
body.v2-console h2 { font-size: 1rem; font-weight: 680; }
body.v2-console h3 { font-size: .9rem; font-weight: 680; }
body.v2-console a { color: var(--accent); }
body.v2-console a:hover { color: var(--accent-hover); }
body.v2-console :focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.dc-skip-link { position: fixed; z-index: 10000; top: 10px; left: 10px; padding: 9px 13px; border-radius: 5px; color: #fff !important; background: var(--accent); box-shadow: var(--shadow-md); transform: translateY(calc(-100% - 18px)); transition: transform var(--transition); }
.dc-skip-link:focus { transform: translateY(0); }
.dc-sr-only,
.sr-only { position: fixed !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0, 0, 0, 0) !important; white-space: nowrap !important; border: 0 !important; }
body.v2-console ::selection { color: var(--text-primary); background: var(--accent-ring); }
body.v2-console ::-webkit-scrollbar { width: 10px; height: 10px; }
body.v2-console ::-webkit-scrollbar-thumb { border: 2px solid transparent; border-radius: 8px; background: var(--scrollbar); background-clip: padding-box; }
body.v2-console ::-webkit-scrollbar-track { background: transparent; }

/* Application frame */
.v2-app { min-height: 100vh; background: var(--bg-app); }
.v2-app-body { min-width: 0; }
.v2-sidebar { position: sticky; top: 0; display: flex; flex: 0 0 var(--sidebar-w); flex-direction: column; width: var(--sidebar-w); height: 100vh; border-right: 1px solid var(--border); background: var(--bg-subtle); transition: width var(--transition), flex-basis var(--transition); z-index: 90; }
.v2-sidebar-head { display: flex; align-items: center; flex: 0 0 66px; justify-content: space-between; padding: 0 14px; border-bottom: 1px solid var(--divider); }
.v2-brand { display: flex; align-items: center; min-width: 0; gap: 10px; color: var(--text-primary) !important; }
.v2-brand img { flex: 0 0 auto; width: 30px; height: 30px; object-fit: contain; }
.v2-brand > span { display: flex; min-width: 0; flex-direction: column; line-height: 1.2; }
.v2-brand strong { overflow: hidden; color: var(--text-primary); font-size: .83rem; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.v2-brand small { margin-top: 2px; color: var(--text-muted); font-size: .62rem; }
.v2-sidebar-close { position: relative; display: none; width: 32px; height: 32px; border: 0; border-radius: 5px; background: transparent; color: var(--text-muted); cursor: pointer; }
.v2-sidebar-close::before,
.v2-sidebar-close::after { content: ""; position: absolute; top: 15px; left: 9px; width: 14px; height: 1.5px; background: currentColor; }
.v2-sidebar-close::before { transform: rotate(45deg); }
.v2-sidebar-close::after { transform: rotate(-45deg); }
.v2-nav { flex: 1 1 auto; min-height: 0; padding: 12px 9px 18px; overflow-y: auto; scrollbar-width: thin; }
.v2-nav-section + .v2-nav-section { margin-top: 16px; }
.v2-nav-label { height: 22px; padding: 0 9px; color: var(--nav-label); font-size: .61rem; font-weight: 700; letter-spacing: 0; line-height: 22px; text-transform: none; white-space: nowrap; }
.v2-nav-item { position: relative; display: flex; align-items: center; min-height: 36px; gap: 10px; padding: 7px 9px; border-radius: 5px; color: var(--text-secondary) !important; font-size: .78rem; font-weight: 540; transition: color var(--transition), background var(--transition); }
.v2-nav-item:hover { color: var(--text-primary) !important; background: var(--bg-sunken); }
.v2-nav-item.is-active { color: var(--accent-text) !important; background: var(--accent-subtle); font-weight: 670; }
.v2-nav-icon { display: inline-flex; flex: 0 0 18px; align-items: center; justify-content: center; }
.v2-nav-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.v2-sidebar-foot { position: relative; flex: 0 0 auto; padding: 9px; border-top: 1px solid var(--divider); background: var(--bg-surface); }
.v2-account { display: flex; align-items: center; width: 100%; min-width: 0; min-height: 48px; gap: 10px; padding: 7px; border: 0; border-radius: 6px; background: transparent; color: var(--text-secondary); cursor: pointer; text-align: left; }
.v2-account:hover { background: var(--bg-hover); color: var(--text-primary); }
.v2-account .user-avatar { display: inline-flex; flex: 0 0 31px; align-items: center; justify-content: center; width: 31px; height: 31px; border: 1px solid var(--avatar-border); border-radius: 50%; color: var(--avatar-text); background: var(--avatar-bg); font-size: .67rem; font-weight: 700; }
.v2-account-copy { display: flex; min-width: 0; flex: 1; flex-direction: column; line-height: 1.25; }
.v2-account-copy strong,
.v2-account-copy small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.v2-account-copy strong { color: var(--text-primary); font-size: .73rem; font-weight: 650; }
.v2-account-copy small { margin-top: 2px; color: var(--text-muted); font-size: .62rem; }
.v2-account-menu { right: 9px; bottom: calc(100% + 7px); left: 9px; top: auto; min-width: 0; border-color: var(--border); border-radius: 7px; box-shadow: var(--shadow-md); }
.v2-menu-state { margin-left: auto; color: var(--text-muted); font-size: .68rem; }
.user-menu-item.is-danger { color: var(--danger); }

/* Collapsed desktop rail */
html[data-sidebar="collapsed"] .v2-sidebar { flex-basis: var(--sidebar-w-collapsed); width: var(--sidebar-w-collapsed); }
html[data-sidebar="collapsed"] .v2-sidebar-head { justify-content: center; padding: 0; }
html[data-sidebar="collapsed"] .v2-brand > span,
html[data-sidebar="collapsed"] .v2-nav-label,
html[data-sidebar="collapsed"] .v2-nav-text,
html[data-sidebar="collapsed"] .v2-account-copy,
html[data-sidebar="collapsed"] .v2-account > svg { display: none; }
html[data-sidebar="collapsed"] .v2-nav { padding-right: 9px; padding-left: 9px; }
html[data-sidebar="collapsed"] .v2-nav-section + .v2-nav-section { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--divider); }
html[data-sidebar="collapsed"] .v2-nav-item { justify-content: center; padding: 8px; }
html[data-sidebar="collapsed"] .v2-nav-item.is-active::before { left: -9px; }
html[data-sidebar="collapsed"] .v2-account { justify-content: center; padding: 7px 0; }
html[data-sidebar="collapsed"] .v2-account-menu { left: 60px; bottom: 8px; width: 230px; }

/* Top bar */
.v2-topbar { position: sticky; top: 0; display: flex; align-items: center; height: var(--topbar-h); gap: 8px; padding: 0 18px; border-bottom: 1px solid var(--border); background: var(--topbar-bg); z-index: 70; }
.v2-icon-button { position: relative; display: inline-flex; flex: 0 0 34px; align-items: center; justify-content: center; width: 34px; height: 34px; padding: 0; border: 0; border-radius: 5px; color: var(--text-secondary); background: transparent; cursor: pointer; }
.v2-icon-button:hover { color: var(--text-primary); background: var(--bg-elevated); }
.v2-org-switcher { width: auto; max-width: 260px; min-width: 170px; height: 34px; padding: 5px 30px 5px 9px; border: 1px solid var(--border); border-radius: 5px; color: var(--text-secondary); background-color: var(--bg-surface); font-size: .72rem; }
.v2-search-trigger { display: flex; align-items: center; width: 210px; height: 34px; gap: 8px; padding: 0 9px; border: 1px solid var(--border); border-radius: 5px; color: var(--text-muted); background: var(--bg-subtle); font-size: .72rem; text-align: left; }
.v2-search-trigger:hover { border-color: var(--border-strong); color: var(--text-primary); background: var(--bg-surface); }
.v2-search-trigger > span { flex: 1; }
.v2-search-trigger kbd { padding: 1px 5px; border: 1px solid var(--border); border-radius: 3px; color: var(--text-muted); background: var(--bg-surface); font-family: var(--font-sans); font-size: .6rem; }
.v2-topbar .notif-badge { position: absolute; top: -3px; right: -6px; min-width: 15px; height: 15px; padding: 0 3px; border: 2px solid var(--bg-surface); border-radius: 8px; color: var(--text-on-solid); background: var(--danger); font-size: 9px; line-height: 11px; }
.dc-env-badge { display: inline-flex; align-items: center; height: 22px; padding: 0 7px; border: 1px solid var(--env-border); border-radius: 999px; color: var(--env-text); background: var(--env-bg); font-size: .61rem; font-weight: 750; letter-spacing: 0; text-transform: none; }
.dc-route-progress { position: fixed; z-index: 1000; top: 0; left: 0; width: 0; height: 2px; opacity: 0; background: var(--accent); pointer-events: none; }
body.dc-route-loading .dc-route-progress { width: 82%; opacity: 1; transition: width 2.5s cubic-bezier(.1,.7,.2,1), opacity .12s; }
.dc-mobile-nav { display: none; }
.dc-notification-loading { color: var(--text-muted); font-size: 13px; padding: 12px 2px; }
.dc-notification-feed { display: grid; gap: 0; }
.dc-notification-item { position: relative; display: grid; grid-template-columns: 10px minmax(0, 1fr); gap: 10px; padding: 15px 2px; border-bottom: 1px solid var(--divider); }
.dc-notification-item:last-child { border-bottom: 0; }
.dc-notification-dot { width: 7px; height: 7px; margin-top: 6px; border-radius: 50%; background: var(--border); }
.dc-notification-item.is-unseen .dc-notification-dot { background: var(--accent); box-shadow: none; }
.dc-notification-title { color: var(--text-primary); font-size: 13.5px; font-weight: 650; }
.dc-notification-item p { margin: 4px 0 7px; color: var(--text-secondary); font-size: 13px; line-height: 1.5; overflow-wrap: anywhere; }
.dc-notification-meta { color: var(--text-muted); font-size: 11.5px; }
.dc-notification-more { width: 100%; margin-top: 14px; }
.dc-notification-empty { display: grid; gap: 5px; place-items: center; padding: 42px 12px; text-align: center; }
.dc-notification-empty strong { color: var(--text-primary); font-size: 14px; }
.dc-notification-empty span { color: var(--text-muted); font-size: 13px; }

/* Main content */
.v2-main { width: 100%; max-width: var(--content-max); margin: 0 auto; padding: 22px var(--content-pad) 72px; }
.v2-breadcrumbs { display: flex; align-items: center; min-height: 24px; gap: 6px; margin: 0 0 12px; color: var(--text-muted); font-size: .68rem; }
.v2-breadcrumbs a { color: var(--text-muted); }
.v2-breadcrumbs a:hover { color: var(--text-primary); }
.v2-breadcrumbs .sep { color: var(--text-muted); opacity: 1; }
.v2-page-header,
body.v2-console .page-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 22px; padding: 0 0 20px; margin: 0 0 20px; border-bottom: 1px solid var(--border); }
.v2-page-title { min-width: 0; }
.v2-page-title h1,
body.v2-console .page-header h1 { margin: 0; font-size: 1.5rem; font-weight: 680; line-height: 1.2; }
.v2-page-title .page-header-sub,
body.v2-console .page-header-sub { display: block; max-width: 760px; margin: 6px 0 0; color: var(--text-muted); font-size: .79rem; line-height: 1.5; }
body.v2-console .page-header-actions { display: flex; align-items: center; justify-content: flex-end; gap: 7px; flex-wrap: wrap; }
body.v2-console .page-content { min-width: 0; }

/* Surfaces and hierarchy */
body.v2-console .card { border: 1px solid var(--border); border-radius: 7px; background: var(--bg-surface); box-shadow: var(--shadow-xs); }
body.v2-console .card-header { padding: 14px 16px; border-bottom: 1px solid var(--divider); background: var(--bg-surface); }
body.v2-console .card-body { padding: 16px; }
body.v2-console .panel-title { color: var(--text-secondary); font-size: .72rem; font-weight: 680; letter-spacing: 0; text-transform: none; }
body.v2-console .section-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 14px; margin: 24px 0 10px; }
body.v2-console .section-heading h2 { font-size: .92rem; }
body.v2-console .metric-card,
body.v2-console .kpi-card { min-height: 104px; border-radius: 7px; }
body.v2-console .metric-value,
body.v2-console .kpi-value { color: var(--text-primary); font-size: 1.45rem; font-weight: 680; letter-spacing: 0; }
body.v2-console .metric-label,
body.v2-console .kpi-label { color: var(--text-muted); font-size: .68rem; font-weight: 620; letter-spacing: 0; text-transform: none; }
body.v2-console .chart-card { border-radius: 7px; }

/* Buttons */
body.v2-console .btn { display: inline-flex; align-items: center; justify-content: center; min-height: 36px; gap: 7px; padding: 7px 12px; border: 1px solid transparent; border-radius: 5px; font-size: .74rem; font-weight: 650; letter-spacing: 0; line-height: 1.2; cursor: pointer; transition: background var(--transition), border-color var(--transition), color var(--transition), box-shadow var(--transition); }
body.v2-console .btn-sm { min-height: 32px; padding: 6px 10px; font-size: .7rem; }
body.v2-console .btn-primary { border-color: var(--accent); color: var(--text-on-solid); background: var(--accent); box-shadow: none; }
body.v2-console .btn-primary:hover { border-color: var(--accent-hover); color: var(--text-on-solid); background: var(--accent-hover); }
body.v2-console .btn-ghost,
body.v2-console .btn-secondary { border-color: var(--border-strong); color: var(--text-secondary); background: var(--bg-surface); }
body.v2-console .btn-ghost:hover,
body.v2-console .btn-secondary:hover { border-color: var(--border-hover); color: var(--text-primary); background: var(--bg-hover); }
body.v2-console .btn-danger { border-color: var(--danger); color: var(--text-on-solid); background: var(--danger); }
body.v2-console .btn-icon { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; padding: 0; border: 1px solid transparent; border-radius: 5px; color: var(--text-muted); background: transparent; cursor: pointer; }
body.v2-console .btn-icon:hover { border-color: var(--border); color: var(--text-primary); background: var(--bg-hover); }

/* Forms */
body.v2-console .form-group { margin-bottom: 16px; }
body.v2-console .form-group > label,
body.v2-console .selector-group > label,
body.v2-console .filter-group > label { display: block; margin-bottom: 5px; color: var(--text-secondary); font-size: .68rem; font-weight: 660; letter-spacing: 0; text-transform: none; }
body.v2-console .form-control { min-height: 38px; padding: 8px 10px; border: 1px solid var(--border-strong); border-radius: 5px; color: var(--text-primary); background: var(--bg-surface); font: inherit; font-size: .78rem; }
body.v2-console .form-control:hover { border-color: var(--border-hover); }
body.v2-console .form-control:focus { border-color: var(--accent); outline: 0; box-shadow: 0 0 0 3px var(--accent-ring); }
body.v2-console .form-control[aria-invalid="true"] { border-color: var(--danger); box-shadow: 0 0 0 3px var(--danger-ring); }
body.v2-console textarea.form-control { min-height: 88px; line-height: 1.5; resize: vertical; }
body.v2-console .form-hint { margin-top: 5px; color: var(--text-muted); font-size: .67rem; line-height: 1.45; }
body.v2-console input[type="checkbox"],
body.v2-console input[type="radio"] { accent-color: var(--accent); }
body.v2-console .selector-row { display: flex; align-items: flex-end; gap: 12px; }
body.v2-console .selector-card { border-radius: 7px; }
body.v2-console .inline-form { padding: 14px; border: 1px solid var(--border); border-radius: 7px; background: var(--bg-subtle); }
body.v2-console .toggle-switch { flex: 0 0 auto; }

/* Tables and toolbars */
body.v2-console .table-wrap { overflow: auto; border-radius: 7px; }
body.v2-console .table-wrap.dc-table-overflow { scrollbar-color: var(--border-strong) transparent; box-shadow: inset 12px 0 10px -14px var(--table-scroll-shadow), inset -12px 0 10px -14px var(--table-scroll-shadow); }
body.v2-console .table-wrap.dc-table-overflow.dc-scroll-start { box-shadow: inset -12px 0 10px -14px var(--table-scroll-shadow); }
body.v2-console .table-wrap.dc-table-overflow.dc-scroll-end { box-shadow: inset 12px 0 10px -14px var(--table-scroll-shadow); }
body.v2-console .table-wrap.dc-table-overflow:focus-visible { outline-offset: 3px; }
body.v2-console table { width: 100%; border-collapse: collapse; color: var(--text-secondary); font-size: .76rem; }
body.v2-console thead th { height: 41px; padding: 9px 12px; border-bottom: 1px solid var(--border); color: var(--text-muted); background: var(--bg-subtle); font-size: .64rem; font-weight: 700; letter-spacing: 0; text-align: left; text-transform: none; white-space: nowrap; }
body.v2-console tbody td { padding: 11px 12px; border-bottom: 1px solid var(--divider); vertical-align: middle; }
body.v2-console tbody tr:last-child td { border-bottom: 0; }
body.v2-console tbody tr:hover td { background: var(--bg-subtle); }
body.v2-console tbody td strong { color: var(--text-primary); font-weight: 650; }
body.v2-console th.num,
body.v2-console td.num { text-align: right; font-variant-numeric: tabular-nums; }
body.v2-console .toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
body.v2-console .dc-bulkbar { min-height: 42px; margin-bottom: 10px; padding: 7px 10px; border: 1px solid var(--border); border-radius: 6px; background: var(--bg-subtle); }
body.v2-console .empty-state { padding: 40px 20px; color: var(--text-muted); text-align: center; }
body.v2-console .empty-icon { border: 1px solid var(--border); background: var(--bg-subtle); box-shadow: none; }

body.v2-console .toast-icon svg,
body.v2-console .toast-dismiss svg,
body.v2-console .act-ico svg,
body.v2-console .btn-icon svg,
body.v2-console .chip-x svg,
body.v2-console .dc-top-btn svg,
body.v2-console .dc-watch-star svg,
body.v2-console .ob-check svg { width: 1em; height: 1em; display: block; }
body.v2-console .btn-icon { display: inline-grid; place-items: center; }
body.v2-console .btn-icon svg { width: 17px; height: 17px; }
body.v2-console .toast-dismiss { display: grid; place-items: center; }
body.v2-console .chip-x { border: 0; background: transparent; color: inherit; padding: 2px; cursor: pointer; }
body.v2-console .dc-watch-star { width: 28px; height: 28px; display: inline-grid; place-items: center; color: var(--text-muted); }
body.v2-console .dc-watch-star svg { width: var(--star); height: var(--star); }
body.v2-console .ob-check { width: 18px; height: 18px; display: inline-grid; place-items: center; }
body.v2-console .ob-check svg { width: 18px; height: 18px; }
body.v2-console .ob-pending { width: 14px; height: 14px; border: 1.5px solid currentColor; border-radius: 50%; display: block; }
body.v2-console .dc-mpick-check svg { width: 16px; height: 16px; display: block; }
body.v2-console .skeleton,
body.v2-console .chart-skeleton { background: linear-gradient(90deg, var(--bg-sunken) 30%, var(--border) 50%, var(--bg-sunken) 70%); background-size: 220% 100%; animation: dc-shimmer 1.6s ease-in-out infinite; }

/* Badges and status */
body.v2-console .badge { display: inline-flex; align-items: center; min-height: 21px; padding: 2px 7px; border: 1px solid var(--border); border-radius: 4px; color: var(--text-secondary); background: var(--bg-sunken); font-size: .63rem; font-weight: 650; letter-spacing: 0; text-transform: none; }
body.v2-console .badge-allow { border-color: var(--success-border); color: var(--badge-allow-text); background: var(--success-subtle); }
body.v2-console .badge-deny { border-color: var(--danger-border); color: var(--badge-deny-text); background: var(--danger-subtle); }
body.v2-console .badge-ask { border-color: var(--warning-border); color: var(--badge-ask-text); background: var(--warning-subtle); }
body.v2-console .badge-service { border-color: var(--info-border); color: var(--service-text); background: var(--service-bg); }
body.v2-console .chip { border-radius: 4px; }
body.v2-console .dot { width: 7px; height: 7px; }
body.v2-console .role-badge { border-radius: 4px; }

/* Tabs and segmented controls */
body.v2-console .tabs,
body.v2-console .pol-tabs { display: flex; align-items: center; gap: 20px; border-bottom: 1px solid var(--border); }
body.v2-console .tab,
body.v2-console .pol-tab { position: relative; min-height: 41px; padding: 0 1px; border: 0; color: var(--text-muted); background: transparent; font-size: .74rem; font-weight: 640; }
body.v2-console .tab.active,
body.v2-console .pol-tab.active { color: var(--text-primary); }
body.v2-console .tab.active::after,
body.v2-console .pol-tab.active::after { content: ""; position: absolute; right: 0; bottom: -1px; left: 0; height: 2px; background: var(--accent); }
body.v2-console .seg,
body.v2-console .seg-control { display: inline-flex; padding: 3px; border: 1px solid var(--border); border-radius: 6px; background: var(--bg-sunken); }
body.v2-console .seg-btn,
body.v2-console .seg-control button { min-height: 30px; padding: 5px 10px; border: 0; border-radius: 4px; color: var(--text-muted); background: transparent; font-size: .69rem; font-weight: 640; }
body.v2-console .seg-btn.active,
body.v2-console .seg-btn.is-active,
body.v2-console .seg-control button.active { color: var(--text-primary); background: var(--bg-surface); box-shadow: var(--shadow-xs); }

/* Modals and drawers */
body.dc-modal-open { overflow: hidden; }
body.v2-console .modal-backdrop { visibility: hidden; align-items: center; justify-content: center; padding: 24px; background: var(--bg-overlay); }
body.v2-console .modal-backdrop.active { visibility: visible; }
body.v2-console .modal { display: flex; flex-direction: column; width: min(520px, calc(100vw - 32px)); max-width: none; max-height: calc(100vh - 48px); min-height: 0; overflow: hidden; border: 1px solid var(--border); border-radius: 8px; background: var(--bg-surface); box-shadow: var(--shadow-lg); }
body.v2-console .modal.lg { width: min(760px, calc(100vw - 32px)); }
body.v2-console .modal.xl { width: min(1040px, calc(100vw - 32px)); }
body.v2-console .modal-header { display: flex; flex: 0 0 auto; align-items: center; justify-content: space-between; min-height: 64px; gap: 14px; padding: 15px 18px; border-bottom: 1px solid var(--border); background: var(--bg-surface); }
body.v2-console .modal-header h3 { font-size: .94rem; }
body.v2-console .modal-body { flex: 1 1 auto; min-height: 0; padding: 18px; overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; touch-action: pan-y; -webkit-overflow-scrolling: touch; }
body.v2-console .modal-footer { display: flex; flex: 0 0 auto; align-items: center; justify-content: flex-end; min-height: 58px; gap: 8px; padding: 11px 18px; border-top: 1px solid var(--border); background: var(--bg-subtle); }
body.v2-console .drawer-backdrop { background: var(--bg-overlay); transition: opacity var(--dc-motion-base) var(--dc-ease-out); }
body.v2-console .drawer { width: min(680px, 100vw); border: 0; background: var(--bg-surface); box-shadow: var(--shadow-lg); transition: transform var(--dc-motion-slow) var(--dc-ease-out); }
body.v2-console .drawer-header { min-height: 64px; padding: 15px 18px; border-bottom: 1px solid var(--border); }
body.v2-console .drawer-body { min-height: 0; padding: 18px; overflow-y: auto; overscroll-behavior: contain; touch-action: pan-y; -webkit-overflow-scrolling: touch; }
body.v2-console .modal-backdrop.dc-confirm-backdrop {
    position: fixed;
    inset: 0;
    width: 100%;
    max-width: none;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}
body.v2-console .confirm-dialog { width: min(440px, calc(100vw - 32px)); border-radius: 8px; }
body.v2-console .confirm-dialog .modal-header { min-height: 58px; }
body.v2-console .confirm-dialog .modal-body { padding-block: 20px; }
body.v2-console .confirm-message { margin: 0; color: var(--text-primary); font-size: .84rem; line-height: 1.6; }
body.v2-console .confirm-detail { margin-top: 14px; padding: 10px 12px; overflow-wrap: anywhere; border: 1px solid var(--border); border-radius: 5px; background: var(--bg-subtle); color: var(--text-secondary); font-family: var(--font-mono); font-size: .72rem; }
@media (max-width: 600px) {
    body.v2-console .modal-backdrop.dc-confirm-backdrop { align-items: flex-end; padding: 12px; }
    body.v2-console .confirm-dialog { width: 100%; max-height: calc(100vh - 24px); }
    body.v2-console .confirm-dialog .modal-footer { display: grid; grid-template-columns: 1fr 1fr; }
    body.v2-console .confirm-dialog .modal-footer .btn { width: 100%; }
}

/* Menus, comboboxes, command search */
body.v2-console .user-menu,
body.v2-console .quicknew-menu,
body.v2-console .dc-views-panel,
body.v2-console .dc-kebab-menu,
body.v2-console .dgcb-panel,
body.v2-console .dc-mpick-panel { border: 1px solid var(--border); border-radius: 7px; background: var(--bg-surface); box-shadow: var(--shadow-md); }
body.v2-console .user-menu-item,
body.v2-console .dc-kebab-item { min-height: 34px; border-radius: 4px; color: var(--text-secondary); font-size: .73rem; }
body.v2-console .user-menu-item:hover,
body.v2-console .dc-kebab-item:hover { color: var(--text-primary); background: var(--bg-hover); }
body.v2-console .dc-kebab-item.danger { color: var(--danger); }
body.v2-console .dc-kebab-item.danger:hover,
body.v2-console .dc-kebab-item.danger:focus-visible { color: var(--danger); background: var(--danger-subtle); }
body.v2-console .dc-kebab-item[disabled] { color: var(--text-muted); cursor: not-allowed; }
body.v2-console .cmdk { border: 1px solid var(--border); border-radius: 8px; background: var(--bg-surface); box-shadow: var(--shadow-lg); }
body.v2-console .cmdk-input { border-bottom-color: var(--border); }
body.v2-console .cmdk-item.active { background: var(--accent-subtle); }

/* Toasts and notices */
body.v2-console .toast { border: 1px solid var(--border); border-radius: 6px; background: var(--bg-surface); box-shadow: var(--shadow-md); }
body.v2-console .form-notice,
body.v2-console .notice,
body.v2-console .dash-since { border: 1px solid var(--border); border-radius: 6px; background: var(--bg-subtle); }
body.v2-console .form-notice.error { border-color: var(--danger-border); background: var(--danger-subtle); }
body.v2-console .form-notice.success { border-color: var(--success-border); background: var(--success-subtle); }

/* Charts */
body.v2-console .chart-legend { color: var(--text-muted); font-size: .65rem; }
body.v2-console .chart-grid { stroke: var(--chart-grid); }
body.v2-console .donut { filter: none; }
body.v2-console .donut-tooltip,
body.v2-console .chart-tooltip { border: 1px solid var(--border); border-radius: 5px; color: var(--text-primary); background: var(--bg-surface); box-shadow: var(--shadow-sm); }

/* Remove light-mode-incompatible decoration from copied pages */
body.v2-console .page-header::after,
body.v2-console .card::before { display: none; }
body.v2-console .theme-toggle { display: none !important; }

/* Responsive */
@media (max-width: 1180px) {
    /* Same selector as the token block above: a bare :root loses to html[data-theme="light"] there. */
    :root, html[data-theme="light"] { --content-pad: 22px; }
    .v2-search-trigger { width: 170px; }
}
@media (max-width: 1024px) {
    html[data-sidebar="collapsed"] .v2-sidebar,
    .v2-sidebar { position: fixed; top: 0; bottom: 0; left: 0; width: min(280px, calc(100vw - 48px)); height: 100vh; height: 100dvh; flex-basis: auto; visibility: hidden; transform: translateX(-102%); box-shadow: var(--shadow-lg); transition: transform var(--transition), visibility 0s linear .2s; }
    html[data-sidebar="collapsed"] .v2-sidebar.is-open,
    .v2-sidebar.is-open { visibility: visible; transform: translateX(0); transition: transform var(--transition), visibility 0s; }
    .v2-sidebar-close { display: block; }
    html[data-sidebar="collapsed"] .v2-brand > span,
    html[data-sidebar="collapsed"] .v2-nav-label,
    html[data-sidebar="collapsed"] .v2-nav-text,
    html[data-sidebar="collapsed"] .v2-account-copy,
    html[data-sidebar="collapsed"] .v2-account > svg { display: flex; }
    html[data-sidebar="collapsed"] .v2-nav-item { justify-content: flex-start; padding: 7px 9px; }
    html[data-sidebar="collapsed"] .v2-nav-section + .v2-nav-section { margin-top: 16px; padding-top: 0; border-top: 0; }
    html[data-sidebar="collapsed"] .v2-account { justify-content: flex-start; padding: 7px; }
    html[data-sidebar="collapsed"] .v2-account-menu { right: 9px; bottom: calc(100% + 7px); left: 9px; width: auto; }
    .dc-side-backdrop { position: fixed; inset: 0; border: 0; background: rgba(18, 27, 25, .42); z-index: 80; }
    body.dc-nav-open { overflow: hidden; }
}
@media (max-width: 760px) {
    :root, html[data-theme="light"] { --content-pad: 16px; }
    .v2-topbar { padding: 0 12px; }
    .v2-org-switcher { max-width: 180px; min-width: 0; }
    .v2-search-trigger { width: 34px; padding: 0; justify-content: center; border-color: transparent; background: transparent; }
    .v2-search-trigger > span,
    .v2-search-trigger kbd { display: none; }
    .v2-page-header,
    body.v2-console .page-header { align-items: stretch; flex-direction: column; gap: 12px; }
    body.v2-console .page-header-actions { justify-content: flex-start; }
    body.v2-console .selector-row,
    body.v2-console .toolbar { align-items: stretch; flex-direction: column; }
    body.v2-console .selector-group,
    body.v2-console .selector-group .form-control { width: 100%; }
    body.v2-console .modal-backdrop { align-items: flex-end; padding: 0; }
    body.v2-console .modal,
    body.v2-console .modal.lg,
    body.v2-console .modal.xl { width: 100%; max-height: calc(100vh - 20px); border-right: 0; border-bottom: 0; border-left: 0; border-radius: 8px 8px 0 0; }
    body.v2-console .drawer { width: 100%; }
    .dc-env-badge { display: none; }
    .dc-mobile-nav { position: fixed; z-index: 65; right: 10px; bottom: max(10px, env(safe-area-inset-bottom)); left: 10px; display: grid; grid-template-columns: repeat(5, 1fr); min-height: 58px; padding: 5px; border: 1px solid var(--border); border-radius: 12px; background: var(--bg-surface); box-shadow: 0 10px 32px rgba(22,34,31,.18); backdrop-filter: none; }
    .dc-mobile-nav a, .dc-mobile-nav button { display: flex; min-width: 0; min-height: 46px; flex-direction: column; align-items: center; justify-content: center; gap: 3px; padding: 4px 2px; border: 0; border-radius: 8px; color: var(--text-muted); background: transparent; font: inherit; font-size: .58rem; font-weight: 650; text-decoration: none; }
    .dc-mobile-nav svg { width: 17px; height: 17px; }
    .dc-mobile-nav .is-active { color: var(--accent); background: var(--accent-subtle); }
    .v2-main { padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
}

/* Endpoints */
/* Status strip: a .gk-stats strip (gov-kit.css), pressed cell = tint + accent label, no bar (2026-11-15 UI audit R4) */
.v2-endpoints .ep-stats { margin-bottom: 14px; }
.v2-endpoints .ep-filter-card { border-radius: 7px; }
.v2-endpoints .ep-filters { gap: 9px; }
.v2-endpoints .ep-filters .filter-group label { letter-spacing: 0; text-transform: none; }
.v2-endpoints .ep-os-avatar { border-radius: 6px; }
.v2-endpoints .ep-status-pill,
.v2-endpoints .ep-gchip { border-radius: 4px; }
.v2-endpoints .ep-bulkbar { position: sticky; top: 64px; z-index: 25; flex-wrap: wrap; border-radius: 6px; background: var(--bg-subtle); }
.v2-endpoints #ep-table tbody tr:hover { background: var(--bg-subtle); }
.v2-endpoints #ep-table .col-actions { text-align: right; }
@media (max-width: 900px) {
    .v2-endpoints .ep-stats { grid-template-columns: repeat(3, 1fr); }
    .v2-endpoints .ep-filters .grow { flex-basis: 100%; }
}

/* Endpoint detail */
.v2-endpoint-detail .ep-back { margin-bottom: 12px; color: var(--accent); font-size: .74rem; font-weight: 650; }
.v2-endpoint-detail .ep-back::before { content: "<"; margin-right: 5px; }
.v2-endpoint-detail .ep-hero { grid-template-columns: 58px minmax(0, 1fr) auto; gap: 16px; }
.v2-endpoint-detail .ep-hero-avatar { width: 58px; height: 58px; border-radius: 7px; }
.v2-endpoint-detail .ep-hero-avatar svg { width: 29px; height: 29px; }
.v2-endpoint-detail .ep-hero-avatar img { width: 38px; height: 38px; }
.v2-endpoint-detail .ep-hero-avatar .pulse { right: -3px; bottom: -3px; width: 15px; height: 15px; border-width: 2px; }
.v2-endpoint-detail .ep-hero-host { font-size: 1.2rem; letter-spacing: 0; }
.v2-endpoint-detail .ep-hero-sub { gap: 5px 14px; font-size: .74rem; }
.v2-endpoint-detail .ep-hero-actions .row { flex-wrap: wrap; justify-content: flex-end; }
.v2-endpoint-detail .ep-status-pill,
.v2-endpoint-detail .ep-hero-gchip { border-radius: 4px; }
.v2-endpoint-detail .metric-grid { gap: 10px; margin-bottom: 14px; }
.v2-endpoint-detail .ep-grid { gap: 12px; margin-bottom: 14px; }
.v2-endpoint-detail .panel-title { margin-bottom: 12px; letter-spacing: 0; text-transform: none; }
@media (max-width: 900px) {
    .v2-endpoint-detail .ep-hero { grid-template-columns: 48px minmax(0, 1fr); }
    .v2-endpoint-detail .ep-hero-avatar { width: 48px; height: 48px; }
    .v2-endpoint-detail .ep-hero-actions { grid-column: 1 / -1; align-items: flex-start; }
    .v2-endpoint-detail .ep-hero-actions .row { justify-content: flex-start; }
}

/* Policies */
.v2-policies .pol-scope { margin-bottom: 16px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 7px; background: var(--bg-surface); }
.v2-policies .pol-scope .selector-group { width: min(100%, 340px); }
.v2-policies .pol-tabs { margin-bottom: 16px; }
.v2-policies .pol-tab { min-height: 38px; padding: 8px 12px; letter-spacing: 0; }
.v2-policies .pol-tab .cnt { border-radius: 4px; }
.v2-policies .pol-insights { margin-bottom: 14px; border-bottom: 1px solid var(--border); }
.v2-policies .pol-insights > summary { width: max-content; margin-bottom: 12px; color: var(--accent); cursor: pointer; font-size: .72rem; font-weight: 650; }
.v2-policies .pol-insights .viz-grid { padding-bottom: 14px; }
.v2-policies .toolbar { align-items: flex-end; padding: 0; border: 0; background: transparent; }
.v2-policies .pol-toolbar-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px; }
.pol-actions-menu { position: relative; }
.pol-actions-menu > summary { list-style: none; cursor: pointer; }
.pol-actions-menu > summary::-webkit-details-marker { display: none; }
.pol-actions-popover { position: absolute; z-index: 45; top: calc(100% + 6px); right: 0; display: grid; width: 210px; padding: 6px; border: 1px solid var(--border); border-radius: 6px; background: var(--bg-surface); box-shadow: var(--shadow-md); }
.pol-actions-popover .btn { justify-content: flex-start; width: 100%; }
.v2-policies .chip { border-radius: 4px; }
/* Height follows the content (no empty half dialog), with a floor so filtering the rules does not make it jump. */
#modal-policy .modal { height: auto; min-height: min(520px, calc(100vh - 48px)); max-height: min(860px, calc(100vh - 48px)); }
#modal-policy .modal-body { min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
#modal-policy .section-label { margin-top: 24px; letter-spacing: 0; text-transform: none; color: var(--text-primary); font-size: .8rem; }
#modal-policy .inline-form { border-radius: 6px; background: var(--bg-subtle); }
#modal-policy .inline-form label { letter-spacing: 0; text-transform: none; }
#modal-policy .manage-rules-card { margin-bottom: 6px; }
#modal-policy .manage-rules-card .table-wrap { max-height: none; overflow-x: auto; }

/* Groups */
.v2-groups .grp-scope { margin-bottom: 16px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 7px; background: var(--bg-surface); }
.v2-groups .grp-scope .selector-group { width: min(100%, 340px); }
.v2-groups .grp-insights { margin-bottom: 14px; border-bottom: 1px solid var(--border); }
.v2-groups .grp-insights > summary { width: max-content; margin-bottom: 12px; color: var(--accent); cursor: pointer; font-size: .72rem; font-weight: 650; }
.v2-groups .grp-insights .viz-grid { padding-bottom: 14px; }
.v2-groups .toolbar { padding: 0; border: 0; background: transparent; }
.grp-actions-menu { position: relative; }
.grp-actions-menu > summary { list-style: none; cursor: pointer; }
.grp-actions-menu > summary::-webkit-details-marker { display: none; }
.grp-actions-popover { position: absolute; z-index: 45; top: calc(100% + 6px); right: 0; display: grid; width: 170px; padding: 6px; border: 1px solid var(--border); border-radius: 6px; background: var(--bg-surface); box-shadow: var(--shadow-md); }
.grp-actions-popover .btn { justify-content: flex-start; }
#modal-group .modal { height: min(740px, calc(100vh - 48px)); }
#modal-group .modal-body { min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
#modal-group .section-label { letter-spacing: 0; text-transform: none; color: var(--text-primary); font-size: .8rem; }
#modal-group .inline-form { border-radius: 6px; background: var(--bg-subtle); }
@media (max-width: 760px) {
    .v2-policies .pol-toolbar-actions { width: 100%; justify-content: flex-start; }
    .v2-policies #pol-search { width: 100% !important; }
    #modal-policy .modal { height: calc(100vh - 20px); }
}
@media (max-width: 480px) {
    body.v2-console { font-size: 13px; }
    .v2-main { padding-top: 16px; }
    .v2-org-switcher { max-width: 145px; }
    body.v2-console .card-body { padding: 14px; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .001ms !important; animation-duration: .001ms !important; animation-iteration-count: 1 !important; }
}

/* R11-05: coarse pointers get WCAG-sized interactive targets without making
   the denser desktop console feel oversized. */
@media (pointer: coarse) {
    body.v2-console .btn,
    body.v2-console .btn-sm,
    body.v2-console .btn-icon,
    body.v2-console .v2-icon-button,
    body.v2-console .tab,
    body.v2-console .pol-tab,
    body.v2-console .seg-btn,
    body.v2-console .seg-control button,
    body.v2-console summary { min-width: 44px; min-height: 44px; }
    body.v2-console input[type="checkbox"],
    body.v2-console input[type="radio"] { width: 20px; height: 20px; }
}

/* R11-06: the persistent connection state stays above drawers and remains
   readable on narrow screens. */
.dc-offline-bar { position: fixed; z-index: 10020; right: 16px; bottom: 16px; left: 16px; max-width: 680px; margin-inline: auto; padding: 11px 15px; border: 1px solid var(--offline-border); border-radius: 6px; color: var(--offline-text); background: var(--offline-bg); box-shadow: var(--shadow-md); font-size: .76rem; line-height: 1.45; text-align: center; }
.dc-offline-bar strong { margin-right: 4px; color: var(--offline-strong); }

/* Authentication */
body.v2-auth button, body.v2-auth input, body.v2-auth select { font-family: inherit; }   /* sign-in pages do not load ds.css §21 */
body.v2-auth { min-height: 100vh; margin: 0; display: grid; grid-template-rows: 72px 1fr 56px; color: var(--text-primary); background: var(--bg-subtle); font-family: var(--font-sans); }
.v2-auth-header { display: flex; align-items: center; justify-content: space-between; padding: 0 clamp(20px, 4vw, 56px); border-bottom: 1px solid var(--border); background: var(--bg-surface); }
.v2-auth-brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text-primary); font-size: .94rem; font-weight: 700; text-decoration: none; }
.v2-auth-brand img { width: 27px; height: 27px; object-fit: contain; }
.v2-auth-product { color: var(--text-muted); font-size: .74rem; font-weight: 600; }
.v2-auth-main { display: grid; place-items: center; width: 100%; padding: 40px 20px; }
.v2-auth-panel { width: min(100%, 420px); padding: 34px 36px 30px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg-surface); box-shadow: 0 12px 35px rgba(20, 37, 32, .07); }
.v2-auth-panel .auth-brand { margin: 0 0 9px; padding: 0; text-align: left; }
.v2-auth-eyebrow { margin: 0; color: var(--accent); font-size: .7rem; font-weight: 700; text-transform: none; }
.v2-auth-panel .auth-title { margin: 0; color: var(--text-primary); font-size: 1.58rem; line-height: 1.25; letter-spacing: 0; }
.v2-auth-panel .auth-subtitle { margin: 8px 0 26px; color: var(--text-secondary); font-size: .84rem; line-height: 1.55; }
.v2-auth-panel .form-group { margin-bottom: 17px; }
.v2-auth-panel .form-group label { color: var(--text-primary); font-size: .74rem; font-weight: 600; }
.v2-auth-panel .form-control { min-height: 42px; border-color: var(--border-hover); border-radius: 5px; background: var(--bg-surface); }
.v2-auth-panel .form-control:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-subtle); }
.v2-auth-panel .pw-toggle { right: 8px; color: var(--accent); font-size: .7rem; font-weight: 700; text-transform: none; }
.v2-caps-warning { margin-top: 6px; color: var(--warning); }
.v2-auth-panel .auth-alert { margin-bottom: 18px; border-radius: 5px; font-size: .78rem; line-height: 1.45; }
.v2-auth-panel .btn-lg { min-height: 42px; border-radius: 5px; font-size: .8rem; }
.v2-auth-panel .btn-ms { display: inline-flex; align-items: center; justify-content: center; gap: 10px; color: var(--text-primary); border: 1px solid var(--border); background: var(--bg-surface); font-weight: 600; }
.v2-auth-panel .btn-ms:hover { border-color: var(--border-hover); background: var(--bg-hover); }
.v2-auth-panel .auth-divider { display: flex; align-items: center; gap: 12px; margin: 20px 0; color: var(--text-muted); font-size: .68rem; }
.v2-auth-panel .auth-divider::before,
.v2-auth-panel .auth-divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.v2-auth-footer { margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--border); color: var(--text-muted); font-size: .76rem; text-align: center; }
.v2-auth-footer a { color: var(--accent); font-weight: 650; }
.v2-auth-legal { display: grid; place-items: center; color: var(--text-muted); font-size: .67rem; }
.v2-auth-panel.wlc-card { width: min(100%, 520px); }
.wlc-panel { padding: 16px; border: 1px solid var(--border); border-radius: 6px; background: var(--bg-subtle); }
.wlc-panel h2 { margin: 3px 0 5px; color: var(--text-primary); font-size: .9rem; letter-spacing: 0; }
.wlc-panel p { margin: 0 0 12px; color: var(--text-secondary); font-size: .78rem; line-height: 1.5; }
.wlc-step { color: var(--text-muted); font-size: .64rem; font-weight: 700; text-transform: none; }
.wlc-id { display: flex; align-items: stretch; gap: 8px; }
.wlc-id code { min-width: 0; flex: 1; padding: 9px 10px; overflow-wrap: anywhere; border: 1px solid var(--border); border-radius: 5px; background: var(--bg-surface); font-family: var(--font-mono); font-size: .76rem; }
.wlc-meta { margin-top: 9px; color: var(--text-muted); font-size: .69rem; line-height: 1.45; }
.wlc-or { display: flex; align-items: center; gap: 12px; margin: 18px 0; color: var(--text-muted); font-size: .65rem; font-weight: 650; text-transform: none; }
.wlc-or::before, .wlc-or::after { content: ""; flex: 1; height: 1px; background: var(--border); }

/* Dashboard */
.v2-dashboard .dashboard-scope { margin-bottom: 14px; }
.v2-dashboard .selector-card { align-items: center; padding: 0; border: 0; background: transparent; box-shadow: none; }
.v2-dashboard .selector-card .selector-group { display: flex; flex: 0 1 340px; flex-direction: row; align-items: center; gap: 10px; min-width: 220px; margin: 0; }
.v2-dashboard .selector-card .selector-group label { flex: none; margin: 0; }
.v2-dashboard .selector-card .selector-group .dgcb,
.v2-dashboard .selector-card .selector-group select { flex: 1; min-width: 0; }
.v2-dashboard .selector-meta-note { color: var(--text-muted); font-size: .72rem; white-space: nowrap; }
.v2-dashboard .selector-card .selector-meta { margin-left: auto; font-size: .74rem; }
.v2-dashboard .selector-card .selector-meta b { font-family: var(--font-sans); }
.v2-dashboard .live-pulse { font-size: .74rem; }
.v2-dashboard .log-chips { margin: 0; padding: 0; border: 0; }
.v2-dashboard .log-chips-lbl { font-size: .69rem; letter-spacing: 0; text-transform: none; }
.v2-dashboard .log-chip { min-height: 28px; padding: 5px 9px; border: 1px solid var(--border); border-radius: 5px; color: var(--text-secondary); background: var(--bg-surface); font-size: .7rem; font-weight: 600; }
.v2-dashboard .log-chip:hover { border-color: var(--accent); color: var(--accent-text); background: var(--accent-subtle); }
/* Getting started */
.v2-dashboard .onboard-head { align-items: center; margin-bottom: 10px; color: var(--text-primary); font-size: .88rem; }
.v2-dashboard .onboard-meta { display: inline-flex; align-items: center; gap: 12px; font-size: .72rem; font-weight: 400; }
.v2-dashboard .ob-progress { height: 5px; margin-bottom: 14px; overflow: hidden; border-radius: 99px; background: var(--bg-elevated); }
.v2-dashboard .ob-progress span { display: block; height: 100%; border-radius: 99px; background: var(--accent); transition: width var(--transition); }
.v2-dashboard .onboard-steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 10px; }
.v2-dashboard .onboard-step { display: flex; align-items: flex-start; gap: 10px; padding: 12px; border: 1px solid var(--border); border-radius: 7px; color: var(--text-secondary); background: var(--bg-surface); text-decoration: none; }
.v2-dashboard .onboard-step.next { border-color: var(--accent); background: var(--accent-subtle); }
.v2-dashboard .onboard-step:hover { border-color: var(--accent); }
.v2-dashboard .onboard-step .ob-check { flex: none; margin-top: 1px; color: var(--text-muted); }
.v2-dashboard .onboard-step.next .ob-check { color: var(--accent-text); }
.v2-dashboard .onboard-step.done .ob-check { color: var(--success); }
.v2-dashboard .ob-text { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.v2-dashboard .ob-title { color: var(--text-primary); font-size: .78rem; font-weight: 650; }
.v2-dashboard .onboard-step.done .ob-title { color: var(--text-secondary); font-weight: 600; }
.v2-dashboard .ob-hint { color: var(--text-muted); font-size: .7rem; line-height: 1.4; }
.v2-dashboard .onboard-step.next .ob-hint { color: var(--text-secondary); }
/* Key metrics */
.v2-dashboard .kpi-windowbar { flex-wrap: wrap; justify-content: flex-start; margin: 18px 0 10px; }
.v2-dashboard .kpi-heading { margin: 0 6px 0 0; color: var(--text-primary); font-size: 1rem; font-weight: 680; }
.v2-dashboard .kpi-wlabel { margin-left: auto; font-size: .7rem; letter-spacing: 0; text-transform: none; }
.v2-dashboard .dc-sparkstat { padding: 2px 10px; border-radius: 5px; }
.v2-dashboard .dc-sparkstat .ss-label { font-size: .69rem; letter-spacing: 0; text-transform: none; }
.v2-dashboard .dc-sparkstat .ss-val { font-size: .78rem; }
.v2-dashboard .dc-sparkstat .ss-spark { width: 80px; height: 22px; }
.v2-dashboard .metric-grid { gap: 10px; margin-bottom: 12px; }
.v2-dashboard .metric-card { gap: 5px; min-width: 0; min-height: 132px; padding: 14px 14px 12px; border-radius: 8px; }
.v2-dashboard .metric-label { color: var(--text-secondary); font-size: .72rem; }
body.v2-console .v2-dashboard .metric-value { font-size: 1.85rem; font-weight: 660; letter-spacing: -.02em; line-height: 1.12; }
body.v2-console .v2-dashboard .metric-value.danger { color: var(--danger); }
body.v2-console .v2-dashboard .metric-value.warning { color: var(--warning); }
body.v2-console .v2-dashboard .metric-value.success { color: var(--success); }
.v2-dashboard .metric-sub { font-size: .7rem; }
.v2-dashboard .metric-viz { display: block; height: 28px; margin-top: auto; padding-top: 4px; box-sizing: content-box; }
.v2-dashboard .metric-spark { display: block; height: 28px; }
.v2-dashboard .metric-spark .sparkline { display: block; width: 100%; height: 28px; }
.v2-dashboard .sparkline path { vector-effect: non-scaling-stroke; }
.v2-dashboard .sparkline .area { fill: var(--accent-subtle); stroke: none; }
.v2-dashboard .sparkline.success .line { stroke: var(--success); }
.v2-dashboard .sparkline.success .area { fill: var(--success-subtle); }
.v2-dashboard .sparkline.danger .line { stroke: var(--danger); }
.v2-dashboard .sparkline.danger .area { fill: var(--danger-subtle); }
.v2-dashboard .metric-meter-wrap { display: flex; align-items: flex-end; height: 28px; padding-bottom: 5px; box-sizing: border-box; }
.v2-dashboard .metric-meter { display: flex; width: 100%; height: 6px; overflow: hidden; border-radius: 99px; background: var(--bg-elevated); }
.v2-dashboard .metric-meter span { display: block; height: 100%; }
.v2-dashboard .metric-skel .skeleton { height: 12px; border-radius: 4px; }
.v2-dashboard .metric-skel .skeleton:nth-child(1) { width: 55%; }
.v2-dashboard .metric-skel .skeleton:nth-child(2) { width: 40%; height: 28px; margin: 4px 0; }
.v2-dashboard .metric-skel .skeleton:nth-child(3) { width: 75%; }
/* Hierarchy and empty states */
.v2-dashboard .section-heading { align-items: flex-end; margin-top: 32px; padding-bottom: 10px; border-bottom: 1px solid var(--border); }
body.v2-console .v2-dashboard .section-heading h2,
.v2-dashboard .section-title { padding-left: 0; color: var(--text-primary); font-size: 1rem; font-weight: 680; letter-spacing: 0; text-transform: none; }
.v2-dashboard .section-title::before { display: none; }
.v2-dashboard .section-sub { margin-top: 3px; color: var(--text-muted); font-size: .74rem; }
body.v2-console .v2-dashboard .panel-title { margin-bottom: 12px; color: var(--text-primary); font-size: .8rem; }
.v2-dashboard .card-header h3,
.v2-dashboard .chart-card h3 { color: var(--text-primary); font-size: .84rem; font-weight: 660; }
.v2-dashboard .dash-empty { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; padding: 6px 0; }
.v2-dashboard .dash-empty-title { color: var(--text-primary); font-size: .8rem; font-weight: 640; }
.v2-dashboard .dash-empty-msg { color: var(--text-muted); font-size: .74rem; line-height: 1.5; }
.v2-dashboard .dash-empty .btn { margin-top: 8px; }
.v2-dashboard .hbar-row { grid-template-columns: minmax(0, 40%) 1fr 40px; }
.v2-dashboard .daily-bar.is-zero .daily-stack { height: 2px !important; border-radius: 1px; background: var(--border-strong); }
.v2-dashboard .daily-bar.is-today .daily-day { color: var(--text-primary); font-weight: 680; }
.v2-dashboard .hbar-link { margin: -4px -6px; padding: 4px 6px; border-radius: 5px; color: inherit; text-decoration: none; transition: background var(--transition); }
.v2-dashboard .hbar-link:hover { background: var(--bg-hover); }
.v2-dashboard .hbar-link:hover .hbar-label { color: var(--accent-text); }
.v2-dashboard .svc-top-row code { border: 0; background: transparent; }
.v2-dashboard .donut-empty { color: var(--text-muted); font-size: .74rem; }
.v2-dashboard .hbar-empty { display: grid; place-items: center; min-height: 120px; color: var(--text-muted); font-size: .76rem; }
/* The off-screen skip link must not cast its shadow onto the top of the page */
.skip-link:not(:focus),
.dc-skip-link:not(:focus) { box-shadow: none; }
.v2-dashboard .dash-grid { gap: 12px; margin-bottom: 12px; }
.v2-dashboard .card,
.v2-dashboard .chart-card { border-radius: 7px; }
.v2-dashboard .chart-icon { display: none; }
.v2-dashboard .chart-hint { color: var(--accent); font-size: .69rem; font-weight: 600; }
@media (max-width: 760px) {
    .v2-dashboard .selector-card .selector-group { flex: 1 1 100%; }
    .v2-dashboard .selector-meta-note { display: none; }
    .v2-dashboard .selector-card .selector-meta { flex-wrap: wrap; margin-left: 0; }
    .v2-dashboard .kpi-wlabel { margin-left: 0; }
    .v2-dashboard .hbar-row { grid-template-columns: 110px 1fr 40px; }
    .v2-dashboard .log-chips { flex-wrap: wrap; }
    .v2-dashboard .log-chip { flex: 0 0 auto; }
}
@media (max-width: 520px) {
    body.v2-auth { grid-template-rows: 64px 1fr 44px; background: var(--bg-surface); }
    .v2-auth-header { padding: 0 18px; }
    .v2-auth-main { align-items: start; padding: 34px 18px 20px; }
    .v2-auth-panel { padding: 0; border: 0; box-shadow: none; }
}

/* Event log */
.v2-events .filters-bar { gap: 9px; }
.v2-events .filter-group label,
.v2-events .log-chips-lbl { letter-spacing: 0; text-transform: none; }
.obs-actions-menu { position: relative; align-self: flex-end; }
.obs-actions-menu > summary { list-style: none; cursor: pointer; }
.obs-actions-menu > summary::-webkit-details-marker { display: none; }
.obs-actions-popover { position: absolute; z-index: 45; top: calc(100% + 6px); right: 0; display: grid; width: 200px; padding: 6px; border: 1px solid var(--border); border-radius: 6px; background: var(--bg-surface); box-shadow: var(--shadow-md); }
.obs-actions-popover .btn { justify-content: flex-start; width: 100%; }
.obs-insights { margin: 12px 0 18px; padding-top: 10px; border-top: 1px solid var(--border); }
.obs-insights > summary { width: max-content; margin-bottom: 12px; color: var(--accent); cursor: pointer; font-size: .72rem; font-weight: 650; }
.v2-events .log-stats { margin-bottom: 8px; }
@media (max-width: 760px) { .v2-events .filter-group, .v2-events .filter-group .form-control { width: 100%; } }

/* Activity */
.v2-activity .act-controls { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 7px; background: var(--bg-surface); }
.v2-activity .act-chips { gap: 0; padding: 3px; border: 1px solid var(--border); border-radius: 6px; background: var(--bg-sunken); }
.v2-activity .act-chip { min-height: 30px; padding: 5px 10px; border: 0; border-radius: 4px; color: var(--text-muted); background: transparent; font-size: .69rem; }
.v2-activity .act-chip.active { color: var(--text-primary); background: var(--bg-surface); box-shadow: var(--shadow-xs); }
.v2-activity .act-feed { padding: 0 4px; }
.v2-activity .act-item { grid-template-columns: 26px minmax(0, 1fr) auto; padding: 13px 2px; }
.v2-activity .act-ico { width: 24px; height: 24px; border-radius: 5px; font-size: .65rem; font-weight: 750; }
.v2-activity .act-kind { letter-spacing: 0; }
@media (max-width: 760px) {
    .v2-activity .act-controls { align-items: stretch; flex-direction: column; }
    .v2-activity .act-controls > div:last-child { align-items: stretch !important; flex-direction: column; }
    .v2-activity #act-search, .v2-activity #act-range { width: 100% !important; }
    .v2-activity .act-item { grid-template-columns: 24px minmax(0, 1fr); }
    .v2-activity .act-meta { grid-column: 2; align-items: flex-start; flex-direction: row; }
}

/* Audit trail */
.v2-audit .filters-bar { gap: 9px; }
.v2-audit .filter-group label { letter-spacing: 0; text-transform: none; }
.v2-audit .log-stats { flex-wrap: wrap; align-items: baseline; gap: 4px 18px; margin-bottom: 8px; }
.v2-audit .log-stat strong.tone-text-warning { color: var(--badge-ask-text); }
.v2-audit .log-stat strong.tone-text-danger { color: var(--badge-deny-text); }
.v2-audit .audit-coverage { color: var(--text-muted); }
.v2-audit .audit-coverage.is-capped { color: var(--badge-ask-text); }
.v2-audit .audit-stale { color: var(--badge-deny-text); }
.v2-audit #audit-table td.audit-rule { width: 40%; max-width: 0; }
.v2-audit #audit-table td.audit-rule code { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.v2-audit .audit-when { display: block; color: var(--text-secondary); font-variant-numeric: tabular-nums; white-space: nowrap; }
.v2-audit .audit-when + .rel-time { display: block; margin-top: 1px; color: var(--text-muted); font-size: .68rem; }
.v2-audit .audit-kind { text-transform: capitalize; }
.v2-audit .pagination { flex-wrap: wrap; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--border); }
.audit-drawer-nav { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 14px; padding-bottom: 12px; border-bottom: 1px solid var(--border); font-size: .74rem; color: var(--text-muted); }
.audit-drawer-nav span:last-child { display: inline-flex; gap: 6px; }
.audit-utc { color: var(--text-muted); font-size: .72rem; }
@media (max-width: 760px) { .v2-audit .filter-group, .v2-audit .filter-group .form-control { width: 100%; } }

/* Alerts */
.v2-alerts .alert-scope .selector-row { justify-content: space-between; }
.v2-alerts .stat-row { gap: 10px; }
.v2-alerts .stat-card { display: flex; flex-direction: column; gap: 2px; padding: 14px 18px; border-radius: 6px; box-shadow: none; text-align: left; }
.v2-alerts .stat-card .stat-label { order: -1; margin: 0; color: var(--text-secondary); font-size: .76rem; font-weight: 500; letter-spacing: 0; text-transform: none; }
.v2-alerts .stat-card .stat-value { font-size: 1.5rem; font-weight: 650; line-height: 1.2; }
.v2-alerts .stat-card .stat-cap { color: var(--text-muted); font-size: .72rem; }
.v2-alerts .stat-card[role="button"]:hover { border-color: var(--border-strong); background: var(--bg-subtle); }
.v2-alerts .stat-card[role="button"]:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.v2-alerts .stat-card[aria-pressed="true"] { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.v2-alerts #fires-tbody tr[data-id]:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.v2-alerts .fire-sub { display: block; margin-top: 1px; color: var(--text-muted); font-size: .72rem; white-space: nowrap; }
.v2-alerts .fire-dest { font-family: var(--font-mono); font-size: .74rem; overflow-wrap: anywhere; }
.v2-alerts .fire-status { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.v2-alerts .fire-ack { min-height: 26px; padding: 3px 9px; border-radius: 5px; color: var(--text-secondary); font: inherit; font-size: .7rem; font-weight: 600; letter-spacing: 0; cursor: pointer; }
.v2-alerts .fire-ack:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.v2-alerts #alerts-filter-card { margin-bottom: 14px; }
.v2-alerts #alerts-filter-card .card-body { padding: 12px 14px; }
.v2-alerts .filters-bar .filter-clear { grid-column: span 1; align-self: end; }
.v2-alerts .filter-group .form-control { min-height: 34px; }
.v2-alerts .form-group label { letter-spacing: 0; text-transform: none; }
.v2-alerts #al-triage-card { border-color: var(--danger); }
@media (max-width: 760px) { .v2-alerts .alert-scope-actions { width: 100%; justify-content: flex-start; } }

/* Alert rules */
.v2-alert-rules .alert-rules-scope .selector-row { justify-content: space-between; }
.v2-alert-rules #rules-content > .card { border-radius: 7px; }
.v2-alert-rules .col-actions { text-align: right; white-space: nowrap; }
.v2-alert-rules .rule-dest-name { display: block; margin-top: 4px; overflow-wrap: anywhere; font-size: .78rem; }
.v2-alert-rules .rule-cond { color: var(--text-primary); font-weight: 600; }
.v2-alert-rules .rule-cond-sub { display: block; margin-top: 1px; color: var(--text-muted); font-size: .72rem; }
#modal-rule .rule-readback { margin: 4px 0 2px; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text-secondary); background: var(--bg-elevated); font-size: .8rem; line-height: 1.5; }
#modal-rule .rule-readback b { color: var(--text-primary); font-weight: 650; }
#modal-rule .rule-action-choices { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
#modal-rule .rule-action-choice { font-size: .8rem; }
#modal-rule .rule-action-choice:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
#modal-rule .modal { height: min(820px, calc(100vh - 48px)); }
#modal-rule .modal-body { min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
#modal-rule .section-title { display: flex; align-items: center; gap: 8px; margin: 24px 0 14px; padding-bottom: 8px; border-bottom: 1px solid var(--border); color: var(--text-primary); font-size: .82rem; letter-spacing: 0; text-transform: none; }
#modal-rule .section-title span { display: grid; place-items: center; width: 20px; height: 20px; border-radius: 4px; color: var(--accent); background: var(--accent-subtle); font-size: .68rem; }
@media (max-width: 760px) { .v2-alert-rules .alert-rules-actions { width: 100%; flex-wrap: wrap; } #modal-rule .modal { height: calc(100vh - 20px); } }

/* Compliance */
.v2-compliance .compliance-actions { display: flex; align-items: center; gap: 8px; }
.v2-compliance #open-checklist-btn { gap: 8px; }
.v2-compliance .section-heading { margin-top: 28px; }
body.v2-console .v2-compliance .section-heading h2 { font-size: 1rem; font-weight: 660; letter-spacing: 0; text-transform: none; }
.v2-compliance .score-panel { padding: 4px 0; }
#modal-checklist .modal { height: min(780px, calc(100vh - 48px)); }
#modal-checklist .modal-body { min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
@media (max-width: 760px) {
    .v2-compliance .compliance-actions { width: 100%; justify-content: flex-start; flex-wrap: wrap; }
    .v2-compliance .section-heading > div:last-child { width: 100%; flex-wrap: wrap; }
    .v2-compliance #analytics-dept { width: 100% !important; }
    .v2-compliance .seg-control { max-width: 100%; overflow-x: auto; }
    #modal-checklist .modal { height: calc(100vh - 20px); }
}

/* Risk */
.v2-risk #risk-ep-table a { font-weight: 650; }
.v2-risk .panel-title { letter-spacing: 0; text-transform: none; }
.v2-risk .risk-score { display: flex; align-items: center; gap: 8px; }
.v2-risk .risk-meter { flex: 1 1 auto; min-width: 44px; height: 5px; border-radius: 3px; background: var(--bg-elevated); overflow: hidden; }
.v2-risk .risk-meter > span { display: block; height: 100%; border-radius: 3px; }
.v2-risk .risk-sum { margin-top: 3px; color: var(--text-muted); font-size: .68rem; white-space: nowrap; font-variant-numeric: tabular-nums; }
.v2-risk .risk-why { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.v2-risk .risk-why .posture-accept { flex: none; }
.v2-risk .risk-bands { padding: 2px; }
.v2-risk .risk-caption { margin: -2px 0 10px; color: var(--text-muted); font-size: .72rem; }
@media (max-width: 760px) { .v2-risk .risk-why { flex-wrap: wrap; } .v2-risk .risk-sum { white-space: normal; } }

/* Reports */
.v2-reports .rep-summary-head { margin: 0 0 12px; color: var(--text-primary); font-size: 1.02rem; font-weight: 650; line-height: 1.4; }
.v2-reports .rep-facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 28px; margin: 0; padding: 0 0 0 16px; color: var(--text-secondary); font-size: .8rem; line-height: 1.5; }
.v2-reports .rep-control { display: grid; grid-template-columns: 72px minmax(0, 1fr); gap: 10px; align-items: baseline; padding: 9px 0; border-top: 1px solid var(--border); }
.v2-reports .rep-control:first-child { border-top: 0; padding-top: 2px; }
.v2-reports .rep-control-label { color: var(--text-primary); font-size: .8rem; font-weight: 620; }
.v2-reports .rep-control-detail { margin-top: 1px; color: var(--text-muted); font-size: .73rem; line-height: 1.45; }
.v2-reports .rep-more { margin-top: 8px; color: var(--text-muted); font-size: .73rem; }
.v2-reports .rep-score-of { margin-left: 3px; color: var(--text-muted); font-family: var(--font-sans, inherit); font-size: .9rem; font-weight: 500; }
.v2-reports .rep-tier { margin-top: 6px; font-size: .78rem; font-weight: 640; }
.v2-reports .rep-kpi { text-align: left; }
.v2-reports .rep-kpi .v { font-family: inherit; font-size: 1.4rem; font-weight: 680; font-variant-numeric: tabular-nums; }
.tone-text-success { color: var(--success); } .tone-text-warning { color: var(--badge-ask-text); } .tone-text-danger { color: var(--badge-deny-text); }
.tone-fill-success { background: var(--success) !important; } .tone-fill-warning { background: var(--warning) !important; } .tone-fill-danger { background: var(--danger) !important; }
@media (max-width: 760px) { .v2-reports .rep-facts { grid-template-columns: minmax(0, 1fr); } }
.v2-reports .rep-grid { gap: 12px; }
.v2-reports .rep-kpis { gap: 10px; }
.v2-reports .rep-kpi { border-radius: 6px; background: var(--bg-surface); }
.v2-reports .rep-kpi .l { letter-spacing: 0; text-transform: none; }
.v2-reports .panel-title { letter-spacing: 0; text-transform: none; }
.v2-reports #rep-window { margin-bottom: 14px; }
/* Paper: theme.js switches to the light tokens before printing. Browsers drop
   backgrounds by default, which would blank every score bar and chart fill. */
@media print {
    @page { margin: 14mm; }
    .obs-actions-menu, .obs-scope, .v2-compliance .seg-control { display: none !important; }
    html, body, .v2-app, .v2-app-body, .v2-main, .page-content { display: block !important; width: auto !important; max-width: none !important; height: auto !important; min-height: 0 !important; margin: 0 !important; overflow: visible !important; }
    .page-content { padding: 0 !important; }
    .page-content * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    .table-wrap { max-height: none !important; overflow: visible !important; }
    .table-wrap thead th { position: static !important; }
    thead { display: table-header-group; }
    tr { break-inside: avoid; }
    .v2-reports .rep-grid { grid-template-columns: 1fr 1fr !important; }
    .v2-reports .panel-title, .v2-reports .rep-summary-head { break-after: avoid; }
    .v2-ai .ai-layout { display: block !important; }
    .v2-ai .ai-runs, .v2-ai .ai-tools, .v2-ai .ai-runs-org, .v2-ai .btn { display: none !important; }
    .v2-ai .ai-panel, .v2-ai .ai-f { break-inside: avoid; }
    .v2-ai .ai-filters { display: none !important; }
}

/* Organisation */
.v2-org .org-scope .selector-row { justify-content: space-between; }
.v2-org .card-header .icon { display: none; }
.v2-org .card-header h2 { letter-spacing: 0; }
.v2-org .section-title { letter-spacing: 0; text-transform: none; color: var(--text-primary); }
.v2-org .setting-row { gap: 20px; }
.v2-org .key-display { flex-wrap: wrap; }
.v2-org .org-danger-zone { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-top: 28px; padding: 18px; border: 1px solid var(--danger-border); border-radius: 7px; background: var(--danger-subtle); }
.v2-org .org-danger-zone h2 { margin: 0 0 4px; color: var(--danger); font-size: .9rem; letter-spacing: 0; }
.v2-org .org-danger-zone p { margin: 0; color: var(--text-secondary); font-size: .74rem; }
@media (max-width: 760px) {
    .v2-org .org-danger-zone { align-items: stretch; flex-direction: column; }
    .v2-org .setting-row { align-items: stretch; flex-direction: column; gap: 10px; }
    .v2-org .setting-value { align-items: stretch; flex-wrap: wrap; }
    .v2-org .setting-value .form-control { width: 100% !important; }
    .deploy-agent-actions { display: grid !important; grid-template-columns: 1fr 1fr; }
    .deploy-agent-actions .btn { width: 100%; min-height: 38px; }
}
@media (max-width: 440px) {
    .deploy-agent-actions { grid-template-columns: 1fr; }
}

/* Console-wide responsive hardening: charts stay fluid, dense control rows
   wrap, and data tables scroll within the viewport instead of the page. */
body.v2-console svg { max-width: 100%; }
body.v2-console .card,
body.v2-console .card-body,
body.v2-console .viz-grid > *,
body.v2-console .dash-grid > * { min-width: 0; }
body.v2-console .table-wrap { max-width: 100%; overscroll-behavior-x: contain; -webkit-overflow-scrolling: touch; }
@media (max-width: 760px) {
    body.v2-console .section-heading { align-items: stretch; flex-direction: column; gap: 10px; }
    body.v2-console .section-heading > div:last-child { justify-content: flex-start; }
    body.v2-console .modal-footer { flex-wrap: wrap; }
    body.v2-console .modal-footer .btn { min-height: 40px; }
    body.v2-console .form-control { max-width: 100%; }
    .v2-reports .rep-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 440px) {
    .v2-reports .rep-kpis { grid-template-columns: 1fr; }
}

/* Users */

.v2-users .users-primary-actions { display: flex; align-items: center; gap: 8px; }
.v2-users .users-toolbar .form-control { width: 100%; font-size: .76rem; }
.v2-users #member-stats { padding-top: 10px !important; }
.v2-users .col-actions { text-align: right; }
.obs-actions-popover > button { display: flex; align-items: center; width: 100%; min-height: 34px; padding: 7px 9px; border: 0; border-radius: 4px; color: var(--text-primary); background: transparent; cursor: pointer; font: inherit; font-size: .74rem; text-align: left; }
.obs-actions-popover > button:hover,
.obs-actions-popover > button:focus-visible { background: var(--accent-subtle); outline: none; }
.obs-actions-popover,
.pol-actions-popover,
.grp-actions-popover,
.policy-actions-popover,
.dc-colchooser-menu { max-width: calc(100vw - 32px); max-height: min(420px, calc(100vh - 96px)); overflow-y: auto; overscroll-behavior: contain; }
.modal-compact { width: min(100%, 520px); }
.field-help { margin: 6px 0 0; color: var(--text-muted); font-size: .7rem; line-height: 1.45; }
@media (max-width: 760px) {
    .v2-users .users-primary-actions { justify-content: space-between; width: 100%; }
    .v2-users .table-wrap { overflow-x: auto; }
}

/* Single sign-on */
.v2-sso { display: flex; flex-direction: column; gap: 16px; max-width: 920px; }
.v2-sso .card { border-radius: 7px; }
.v2-sso .card-header h2 { margin-bottom: 3px; letter-spacing: 0; }
.v2-sso .card-header p { margin: 0; }
.sso-scope { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin-bottom: 0; }
.sso-scope form { width: min(100%, 340px); }
.sso-status { display: inline-flex; align-items: center; gap: 7px; margin: 0; color: var(--text-secondary); font-size: .74rem; font-weight: 650; }
.sso-dot { flex: 0 0 auto; width: 7px; height: 7px; border-radius: 50%; }
.sso-on { background: var(--success); }
.sso-off { background: var(--text-muted); }
.sso-form { display: grid; gap: 16px; }
.sso-form .form-group { margin: 0; }
.sso-row { display: grid; grid-template-columns: minmax(0, 1fr) 220px; gap: 14px; }
.sso-tenant { display: grid; gap: 5px; padding: 11px 12px; border: 1px solid var(--border); border-radius: 6px; background: var(--bg-subtle); }
.sso-tenant span { color: var(--text-muted); font-size: .67rem; font-weight: 650; }
.sso-tenant code { overflow-wrap: anywhere; color: var(--text-primary); font-family: var(--font-mono); font-size: .73rem; }
.sso-switches { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.sso-check { display: flex; align-items: flex-start; gap: 10px; padding: 12px; border: 1px solid var(--border); border-radius: 6px; cursor: pointer; }
.sso-check input { margin-top: 2px; }
.sso-check span { display: grid; gap: 3px; }
.sso-check strong { color: var(--text-primary); font-size: .75rem; }
.sso-check small { color: var(--text-muted); font-size: .68rem; line-height: 1.4; }
.sso-kv { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.sso-danger-zone { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 15px 18px; border-top: 1px solid var(--danger-border); background: var(--danger-subtle); }
.sso-danger-zone strong { color: var(--danger); font-size: .75rem; }
.sso-danger-zone p { margin: 3px 0 0; color: var(--text-secondary); font-size: .68rem; }
.sso-empty { padding-block: 28px; }
.sso-empty h3 { margin: 0 0 6px; font-size: .88rem; }
.sso-empty > p { max-width: 620px; margin: 0 0 16px; color: var(--text-secondary); font-size: .75rem; line-height: 1.55; }
.sso-connect-form { margin: 0; }
.sso-reference { border: 1px solid var(--border); border-radius: 7px; background: var(--bg-surface); }
.sso-reference > summary { padding: 14px 16px; color: var(--text-primary); cursor: pointer; font-size: .76rem; font-weight: 650; }
.sso-reference-body { padding: 0 18px 18px; border-top: 1px solid var(--border); }
.sso-reference-body > p { color: var(--text-secondary); font-size: .74rem; }
.sso-steps { margin: 0; padding-left: 20px; color: var(--text-secondary); font-size: .73rem; line-height: 1.75; }
.sso-steps code { padding: 1px 4px; border-radius: 3px; background: var(--bg-sunken); font-family: var(--font-mono); font-size: .7rem; }
.sso-uri { margin: 7px 0; padding: 8px 10px; border: 1px solid var(--border); border-radius: 5px; background: var(--bg-subtle); font-family: var(--font-mono); font-size: .7rem; overflow-wrap: anywhere; }
@media (max-width: 760px) {
    .sso-scope { align-items: stretch; flex-direction: column; }
    .sso-scope form { width: 100%; }
    .sso-row, .sso-switches { grid-template-columns: 1fr; }
    .sso-danger-zone { align-items: stretch; flex-direction: column; }
}

/* Settings */
.v2-settings { display: grid; gap: 16px; max-width: 960px; }
.v2-settings .settings-section { margin: 0; border-radius: 7px; }
.v2-settings .card-header { padding: 15px 18px; }
.v2-settings .card-header h2 { margin: 0 0 3px; font-size: .86rem; letter-spacing: 0; }
.v2-settings .card-header p { margin: 0; color: var(--text-muted); font-size: .7rem; }
.v2-settings .settings-grid { padding: 0 18px; }
.v2-settings .set-row { min-height: 66px; padding: 13px 0; border-color: var(--border); }
.v2-settings .set-row-top { align-items: flex-start; }
.v2-settings .set-label { color: var(--text-primary); font-size: .76rem; }
.v2-settings .set-hint { margin-top: 3px; color: var(--text-muted); font-size: .69rem; line-height: 1.45; }
.v2-settings .set-control { width: min(100%, 250px); }
.v2-settings .set-control > .form-control { width: 100%; }
.v2-settings .set-control:has(.toggle-switch) { width: auto; }
.settings-fixed-value { display: inline-flex; align-items: center; min-height: 32px; padding: 5px 10px; border: 1px solid var(--border); border-radius: 5px; color: var(--text-secondary); background: var(--bg-subtle); font-size: .72rem; font-weight: 650; }
.settings-button-group { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.v2-settings .pin-list { gap: 5px; max-height: 190px; }
.v2-settings .pin-row { min-height: 34px; padding: 7px 9px; border-radius: 5px; color: var(--text-secondary); background: var(--bg-surface); }
.v2-settings .pin-row input { margin: 0; accent-color: var(--accent); }
.v2-settings .pin-row.pinned { border-color: var(--border-hover); color: var(--text-primary); background: var(--accent-subtle); }
@media (max-width: 720px) {
    .v2-settings .set-row { align-items: stretch; flex-direction: column; gap: 10px; }
    .v2-settings .set-control { width: 100%; }
    .v2-settings .set-control:has(.toggle-switch) { width: auto; }
    .settings-button-group { justify-content: flex-start; }
}

/* ── 2026-07-20 audit: no coloured edge pills on cards/divs ──────────────
   Tone/severity is carried by a uniform 1px border colour (and existing
   icons/badges) instead of a thicker coloured left edge. */
body.v2-console .section-heading .section-title { padding-left: 0; }
body.v2-console .section-heading .section-title::before { display: none; }
/* Toasts and endpoint peer rows: neutral 1px border all round; tone on the icon (2026-11-15 UI audit R1, R3) */

/* Side menu: grouped, collapsible, compact (2026-11-05 overhaul) */
.v2-sidebar-head { flex-basis: 58px; }
.v2-nav { padding: 10px 9px 12px; }
.v2-nav-section + .v2-nav-section { margin-top: 10px; }
.v2-nav-section--home { padding-bottom: 2px; }
.v2-nav-item { min-height: 32px; padding: 5px 9px; }
.v2-nav-item.is-active::before { top: 6px; bottom: 6px; }
.v2-nav-group-toggle { display: flex; align-items: center; justify-content: space-between; width: 100%; height: 26px; border: 0; border-radius: 5px; background: transparent; line-height: 26px; cursor: pointer; transition: color var(--transition), background var(--transition); }
.v2-nav-group-toggle:hover { color: var(--text-primary); background: var(--bg-hover); }
.v2-nav-group-toggle svg { flex: none; transform: rotate(-90deg); transition: transform var(--transition); }
.v2-nav-group.is-open .v2-nav-group-toggle svg { transform: none; }
.v2-nav-group-items { display: none; padding-top: 2px; }
.v2-nav-group.is-open .v2-nav-group-items { display: block; }
.v2-nav-group:not(.is-open).has-active .v2-nav-group-toggle { color: var(--accent-text); }
.v2-sidebar-resources { flex: 0 0 auto; padding: 6px 9px; border-top: 1px solid var(--divider); }
.v2-sidebar-resources .v2-nav-item.is-active::before { left: -9px; }
html[data-sidebar="collapsed"] .v2-nav-group-toggle { display: none; }
html[data-sidebar="collapsed"] .v2-nav-group-items { display: block; }
html[data-sidebar="collapsed"] .v2-nav-section + .v2-nav-section { margin-top: 6px; padding-top: 6px; }
@media (max-width: 1024px) {
    html[data-sidebar="collapsed"] .v2-nav-group-toggle { display: flex; }
    html[data-sidebar="collapsed"] .v2-nav-group:not(.is-open) .v2-nav-group-items { display: none; }
}

/* Data tables at scale: compact scope row, filter disclosure, table toolbar, pager */
/* Page header actions stay beside the title on desktop rather than dropping under it. */
@media (min-width: 1100px) {
    body.v2-console .page-header { flex-wrap: nowrap; }
    body.v2-console .page-header > div:first-child { min-width: 0; }
    body.v2-console .page-header-actions { flex-shrink: 0; max-width: 62%; }
}

/* Shared row actions and Actions menus */
body.v2-console td.col-actions > .btn,
body.v2-console td.col-actions > .btn-icon { vertical-align: middle; }
body.v2-console .obs-actions-popover > .btn { justify-content: flex-start; min-height: 32px; border-color: transparent; background: transparent; color: var(--text-primary); font-weight: 500; text-align: left; }
body.v2-console .obs-actions-popover > .btn:hover,
body.v2-console .obs-actions-popover > .btn:focus-visible { border-color: transparent; background: var(--accent-subtle); }

/* Quick filter chips inherit the console font instead of the browser's button font. */
body.v2-console .log-chip,
body.v2-console .dc-date-preset { min-height: 28px; padding: 4px 10px; border: 1px solid var(--border); border-radius: 5px; color: var(--text-secondary); background: var(--bg-surface); font: inherit; font-size: .7rem; font-weight: 600; letter-spacing: 0; cursor: pointer; }
body.v2-console .log-chip:hover,
body.v2-console .dc-date-preset:hover { border-color: var(--accent); color: var(--accent-text); background: var(--accent-subtle); }
body.v2-console .log-chip.active,
body.v2-console .dc-date-preset.active { border-color: var(--accent); color: var(--accent-text); background: var(--accent-subtle); }
body.v2-console .log-chips-lbl { font-size: .69rem; letter-spacing: 0; text-transform: none; }
body.v2-console .filters-actions .log-chips,
body.v2-console .dcs-filter-actions .log-chips { margin: 0; }
.dc-filters-more { margin-top: 9px; }
.dc-filters-more[hidden] { display: none; }
.dc-filters-extra { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin-top: 9px; }
.dc-filters-extra label { display: inline-flex; align-items: center; gap: 5px; color: var(--text-muted); font-size: .7rem; }
.dc-filter-error { margin-top: 2px; color: var(--danger); font-size: .67rem; line-height: 1.35; }
.dc-filter-error[hidden] { display: none; }
.dc-inline-select { width: auto; min-height: 28px !important; padding: 3px 6px !important; font-size: .7rem !important; }

.dc-table-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; min-height: 44px; padding: 7px 14px; border-bottom: 1px solid var(--border); color: var(--text-secondary); font-size: .74rem; }
.dc-table-bar-end { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-left: auto; }
.dc-table-bar .log-stats { display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 0; font-size: .74rem; }
.dc-table-bar .log-col-toggle { display: inline-flex; align-items: center; gap: 5px; color: var(--text-secondary); font-size: .72rem; cursor: pointer; }
.dc-table-bar .log-cols { margin: 0; }
.dc-table-bar .dc-tags { margin: 0 !important; }
.dc-stale-note { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 8px; color: var(--warning); }
.dc-stale-note button { padding: 0; border: 0; color: var(--accent-text); background: none; font: inherit; font-weight: 650; text-decoration: underline; cursor: pointer; }
.dc-updated { color: var(--text-muted); white-space: nowrap; }

.dc-density { display: inline-flex; padding: 2px; border: 1px solid var(--border); border-radius: 6px; background: var(--bg-sunken); }
.dc-density button { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 24px; padding: 0; border: 0; border-radius: 4px; color: var(--text-muted); background: transparent; cursor: pointer; }
.dc-density button:hover { color: var(--text-primary); }
.dc-density button.active { color: var(--text-primary); background: var(--bg-surface); box-shadow: var(--shadow-xs); }

/* Long tables scroll inside the card so the header row stays in view. */
body.v2-console .dc-table-scroll { max-height: max(420px, calc(100vh - 190px)); }
body.v2-console .dc-table-scroll.is-refreshing { opacity: .65; transition: opacity var(--transition); }
.density-compact body.v2-console .dcs-table tbody td,
.density-compact body.v2-console #ep-table tbody td,
.density-compact body.v2-console #logs-table tbody td { padding-top: 4px; padding-bottom: 4px; }
.density-compact .ep-groups, .density-compact .ep-row .dc-tags { display: inline-flex; margin-top: 0 !important; }
.density-compact .ep-os-avatar { transform: scale(.82); }
.density-compact .v2-activity .act-item { padding: 7px 2px; }
.density-compact .v2-activity .act-detail { margin-top: 0; }

body.v2-console .dc-pager { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; padding: 9px 14px; border-top: 1px solid var(--border); color: var(--text-secondary); font-size: .74rem; }
.dc-pager-size { display: inline-flex; align-items: center; gap: 6px; color: var(--text-muted); font-size: .72rem; white-space: nowrap; }
.dc-pager-end { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-left: auto; }
.dc-pager-btns { display: flex; gap: 4px; }
body.v2-console .dc-pager .dc-pager-btns .btn { min-width: 0; }

/* Removable active-filter chips */
body.v2-console .dc-active-filter { height: 24px; border: 1px solid transparent; font: inherit; font-size: .69rem; font-weight: 600; cursor: pointer; }
body.v2-console .dc-active-filter:hover { border-color: var(--accent); }

/* Event log */
body.v2-console .v2-events .log-command { max-width: 520px; }
body.v2-console #logs-table td:nth-child(3) code { white-space: nowrap; word-break: normal; }
body.v2-console #logs-table td:nth-child(2) { white-space: nowrap; }
.dc-facet-count { margin-left: 2px; color: var(--text-muted); }
.log-hist-title { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }

/* Endpoints */
.v2-endpoints .deploy-agent-card { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; padding: 9px 14px; }
.v2-endpoints .deploy-agent-card .card-header { flex: none; padding: 0; border: 0; background: none; }
.v2-endpoints .deploy-agent-card .card-header h2 { margin: 0; font-size: .82rem; }
.v2-endpoints .deploy-agent-card .card-body { display: flex; flex: 1 1 320px; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; padding: 0; }
.v2-endpoints .deploy-agent-card .card-body > p { flex: 1 1 260px; margin: 0 !important; font-size: .72rem; line-height: 1.4; }
.v2-endpoints .ep-bulkbar .count { white-space: nowrap; }
.v2-endpoints .ep-bulk-matching { padding: 0; border: 0; color: var(--accent-text); background: none; font: inherit; font-size: .74rem; font-weight: 650; text-decoration: underline; cursor: pointer; }
.v2-endpoints .ep-bulk-matching[hidden] { display: none; }
.v2-endpoints .ep-bulk-note { color: var(--text-secondary); font-size: .74rem; }
.v2-endpoints .ep-bulk-sep { width: 1px; height: 18px; background: var(--border-strong); }
body.v2-console .v2-endpoints .ep-bulkbar .ep-bulk-danger { border-color: var(--danger); color: var(--danger); }
body.v2-console .v2-endpoints .ep-bulkbar .ep-bulk-danger:hover { color: var(--danger); background: var(--danger-subtle); }
.v2-endpoints #ep-table .ep-id-text { min-width: 0; }
.v2-endpoints #ep-table .ep-id-mid { display: block; max-width: 230px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.v2-endpoints #ep-table .ep-id-host { display: block; max-width: 190px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (min-width: 721px) {
    /* Row actions stay reachable however wide the table gets. */
    .v2-endpoints #ep-table .col-actions { position: sticky; right: 0; z-index: 1; width: 132px; white-space: nowrap; background: var(--bg-surface); box-shadow: -1px 0 0 var(--divider); }
    .v2-endpoints #ep-table thead .col-actions { z-index: 3; background: var(--bg-elevated); }
    .v2-endpoints #ep-table tbody tr:hover .col-actions { background: var(--bg-subtle); }
    .v2-endpoints #ep-table tbody tr:nth-child(even):not(:hover):not(.is-selected) .col-actions { background: color-mix(in srgb, var(--bg-elevated) 45%, var(--bg-surface)); }
    .v2-endpoints #ep-table tbody tr.is-selected .col-actions { background: color-mix(in srgb, var(--accent) 12%, var(--bg-surface)); }
}
@media (min-width: 721px) and (max-width: 1560px) {
    .v2-endpoints #ep-table thead th, .v2-endpoints #ep-table tbody td { padding-right: 7px; padding-left: 7px; }
}
@media (min-width: 721px) and (max-width: 1400px) {
    /* Narrower screens: give the width to Version and Risk rather than scrolling them away. */
    .v2-endpoints #ep-table .ep-id-mid, .v2-endpoints #ep-table .ep-id-host { max-width: 150px; }
    .v2-endpoints #ep-table .ep-mini-bar { display: none; }
    .v2-endpoints #ep-table thead th[data-col="activity"] { width: auto !important; }
    .v2-endpoints #ep-table .col-actions { width: 118px; }
}
.v2-endpoints #ep-table tbody tr.is-selected { background: var(--accent-subtle); }
.v2-endpoints #ep-table tbody tr.is-selected:hover { background: var(--accent-subtle); }
.v2-endpoints .ep-actions .btn-icon { display: inline-flex; align-items: center; justify-content: center; }
.v2-endpoints .ep-actions .btn-icon svg { display: block; }
.v2-endpoints .dc-note-indicator { display: inline-flex !important; align-items: center; gap: 4px; }

/* Sessions: tighter cells, full KPI labels, row identity stays on screen while scrolling sideways. */
body.v2-console .dcs-table thead th { padding-right: 7px; padding-left: 7px; letter-spacing: 0; }
body.v2-console .dcs-table tbody td { padding-right: 7px; padding-left: 7px; }
body.v2-console .dcs-kpi-lbl { overflow: visible; white-space: normal; letter-spacing: 0; text-overflow: clip; }
body.v2-console .dcs-table tbody td:first-child { position: sticky; left: 0; z-index: 1; background: var(--bg-surface); box-shadow: 1px 0 0 var(--divider); }
body.v2-console .dcs-table thead th:first-child { left: 0; z-index: 3; box-shadow: 1px 0 0 var(--divider); }
body.v2-console .dcs-table tbody tr:nth-child(even) td:first-child { background: color-mix(in srgb, var(--bg-elevated) 45%, var(--bg-surface)); }
body.v2-console .dcs-table tbody tr:hover td:first-child { background: var(--bg-elevated); }
body.v2-console .dcs-table tbody td[colspan] { position: static; box-shadow: none; white-space: normal; }

/* Activity */
.v2-activity .act-chip-count { margin-left: 5px; color: var(--text-muted); font-weight: 500; }
.v2-activity .act-chip.active .act-chip-count { color: var(--text-secondary); }
.v2-activity .act-item { border-radius: 4px; cursor: pointer; }
.v2-activity .act-item:hover { background: var(--bg-elevated); }
.v2-activity .act-item:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.v2-activity .act-ico svg { display: block; }
.v2-activity .act-clock { color: var(--text-secondary); font-variant-numeric: tabular-nums; }
.v2-activity .act-sep { margin: 0 5px; color: var(--text-muted); }
.v2-activity .act-day-count { color: var(--text-muted); font-weight: 500; }
.v2-activity .act-day-heading { top: var(--topbar-h); }
.v2-activity #act-wrap > .card { overflow: visible; }
.v2-activity .act-more { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 12px; padding: 14px 4px 4px; border-top: 1px solid var(--divider); color: var(--text-muted); font-size: .74rem; }
.v2-activity .act-live-state.stale { color: var(--warning); }
.v2-activity .act-live-state.stale::before { background: var(--warning); }
.v2-activity .act-skel-row { display: grid; grid-template-columns: 26px minmax(0, 1fr) 90px; gap: 12px; align-items: center; padding: 13px 2px; border-top: 1px solid var(--divider); }
.v2-activity .act-skel-row:first-child { border-top: 0; }

@media (max-width: 900px) {
    body.v2-console .dc-table-scroll { max-height: none; }
    body.v2-console .dcs-table tbody td:first-child, body.v2-console .dcs-table thead th:first-child { position: static; box-shadow: none; }
    .dc-table-bar-end, .dc-pager-end { margin-left: 0; }
}

/* Theme button: shows the current choice (sun = Light, moon = Midnight, filled disc = Lights off, screen = System). */
.dc-theme-toggle svg { display: none; }
html:not([data-theme-pref]) .dc-theme-toggle .dc-theme-icon-sun,
html[data-theme-pref="light"] .dc-theme-toggle .dc-theme-icon-sun,
html[data-theme-pref="midnight"] .dc-theme-toggle .dc-theme-icon-moon,
html[data-theme-pref="lightsoff"] .dc-theme-toggle .dc-theme-icon-off,
html[data-theme-pref="system"] .dc-theme-toggle .dc-theme-icon-system { display: block; }
.dc-auth-theme { position: fixed; z-index: 20; top: 14px; right: 14px; display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border: 1px solid var(--border); border-radius: 6px; background: var(--bg-surface); color: var(--text-secondary); cursor: pointer; }
.dc-auth-theme:hover { color: var(--text-primary); background: var(--bg-hover); }

/* Investigation charts: ranked token bars, clipped outliers, chart drill-downs */
body.v2-console .v2-org-switcher { background-repeat: no-repeat; background-position: right 9px center; background-size: 12px; }
.dc-tokbars { display: flex; flex-direction: column; gap: 4px; }
.dc-tokbar { display: grid; grid-template-columns: 110px minmax(0, 1fr) 54px 46px; align-items: center; gap: 10px; padding: 5px 6px; border-radius: 5px; color: var(--text-secondary); font-size: .76rem; text-decoration: none; }
a.dc-tokbar:hover { background: var(--bg-hover); color: var(--text-primary); }
.dc-tokbar-name { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.dc-tokbar-track { display: flex; gap: 1px; height: 14px; border-radius: 3px; background: var(--bg-elevated); overflow: hidden; }
.dc-tokbar-track > span { display: block; min-width: 2px; height: 100%; }
.dc-tokbar-in { background: var(--info); }
.dc-tokbar-out { background: var(--series-8); }
.dc-tokbar-val { color: var(--text-primary); font-weight: 650; text-align: right; font-variant-numeric: tabular-nums; }
.dc-tokbar-pct { color: var(--text-muted); font-size: .7rem; text-align: right; font-variant-numeric: tabular-nums; }
.dc-chart .bar-break { fill: none; stroke: var(--bg-surface); stroke-width: 3; }
.dc-chart .bar-over { fill: var(--text-primary); font-size: 10px; font-weight: 650; font-family: var(--font-sans); }
.dc-stack a.row { color: inherit; text-decoration: none; border-radius: 4px; }
.dc-stack a.row:hover .name { color: var(--accent); }
.dc-chart-note { margin: 8px 0 0; color: var(--text-muted); font-size: .72rem; line-height: 1.5; }
.dc-panel-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 14px; margin-bottom: 12px; }
.dc-panel-head .panel-title { margin-bottom: 0; }
@media (max-width: 620px) { .dc-tokbar { grid-template-columns: 82px minmax(0, 1fr) 46px 40px; gap: 6px; } }

/* Forms and destructive actions: shared across administration pages */
.dc-field-error { margin: 5px 0 0; color: var(--danger); font-size: .72rem; font-weight: 550; line-height: 1.4; }
.form-control[aria-invalid="true"] { border-color: var(--danger); }
body.v2-console .btn.btn-danger-quiet { border-color: var(--danger-border); color: var(--danger); background: transparent; }
body.v2-console .btn.btn-danger-quiet:hover { border-color: var(--danger); color: var(--danger); background: var(--danger-subtle); }
.btn[aria-busy="true"] { cursor: progress; opacity: .7; }
body.v2-console .confirm-impact { margin: 14px 0 0; padding: 10px 12px 10px 28px; border: 1px solid var(--warning-border); border-radius: 5px; background: var(--warning-subtle); color: var(--text-primary); font-size: .76rem; line-height: 1.55; }
body.v2-console .confirm-impact li + li { margin-top: 3px; }
.dc-impact { margin: 0 0 14px; padding: 10px 12px 10px 28px; border: 1px solid var(--warning-border); border-radius: 5px; background: var(--warning-subtle); color: var(--text-primary); font-size: .78rem; line-height: 1.55; }
.dc-impact li + li { margin-top: 3px; }
.dc-impact:empty { display: none; }
.dc-modal-lead { margin: 0 0 14px; color: var(--text-primary); font-size: .84rem; line-height: 1.6; }

/* Section jump bar: sticks below the topbar on long admin pages */
body.v2-console .dc-jump { position: sticky; top: var(--topbar-h, 58px); z-index: 8; display: flex; gap: 4px; overflow-x: auto; margin: 0 0 16px; padding: 6px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-app); backdrop-filter: none; }
body.v2-console .dc-jump a { flex: 0 0 auto; padding: 6px 11px; border-radius: 999px; border: 1px solid transparent; color: var(--text-secondary); font-size: .74rem; font-weight: 600; text-decoration: none; }
body.v2-console .dc-jump a:hover, body.v2-console .dc-jump a:focus-visible { color: var(--text-primary); border-color: var(--border); background: var(--bg-elevated); outline: none; }
body.v2-console .dc-jump a.is-active { color: var(--accent); border-color: var(--accent); background: var(--accent-subtle); }

/* Organisation */
.v2-org .org-anchor { scroll-margin-top: calc(var(--topbar-h, 58px) + 64px); }
.v2-org .deploy-choice { border: 1px solid var(--border); color: var(--text-primary); background: var(--bg-subtle); transition: border-color var(--transition), background var(--transition); }
.v2-org .deploy-choice:hover { border-color: var(--accent); color: var(--text-primary); background: var(--accent-subtle); }
.v2-org .deploy-choice small { color: var(--text-secondary); opacity: 1; }
.v2-org .deploy-choice--remove strong { color: var(--danger); }
.v2-org .deploy-choice--remove:hover { border-color: var(--danger); background: var(--danger-subtle); }
.v2-org .card-body .section-title { margin: 26px 0 8px; padding-top: 20px; border-top: 1px solid var(--divider); font-size: .94rem; font-weight: 650; }
.v2-org .card-body > .section-title:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
.v2-org .key-display + .form-hint { margin-top: 8px; }
.v2-org select.form-select { appearance: none; -webkit-appearance: none; padding-right: 30px; background-image: linear-gradient(45deg, transparent 50%, var(--text-muted) 50%), linear-gradient(135deg, var(--text-muted) 50%, transparent 50%); background-position: calc(100% - 16px) 50%, calc(100% - 11px) 50%; background-size: 5px 5px; background-repeat: no-repeat; }
.v2-org .org-danger-zone { scroll-margin-top: calc(var(--topbar-h, 58px) + 64px); }

/* Users and Groups */
body.v2-console .member-avatar { border: 1px solid var(--border); color: var(--accent); background: var(--accent-subtle); text-transform: uppercase; }
.member-you { display: inline-block; margin-left: 6px; padding: 1px 6px; border: 1px solid var(--border); border-radius: 999px; color: var(--text-secondary); background: var(--bg-elevated); font-size: .64rem; font-weight: 650; vertical-align: 1px; }
body.v2-console .member-role-select { width: 110px; padding: 4px 26px 4px 8px; font-size: .75rem; appearance: none; -webkit-appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--text-muted) 50%), linear-gradient(135deg, var(--text-muted) 50%, transparent 50%); background-position: calc(100% - 14px) 50%, calc(100% - 9px) 50%; background-size: 5px 5px; background-repeat: no-repeat; }
.v2-users .obs-scope .selector-group { max-width: 420px; }
.v2-groups .grp-num { padding: 2px 8px; border: 0; border-radius: 4px; color: var(--text-primary); background: none; font: inherit; font-weight: 650; font-variant-numeric: tabular-nums; }
button.grp-num { cursor: pointer; }
button.grp-num:hover { color: var(--accent); background: var(--accent-subtle); }
.v2-groups .grp-row-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.grp-swatch[aria-pressed="true"] { outline: 2px solid var(--text-primary); outline-offset: 1px; }

/* Settings */
.v2-settings select.form-control, .v2-sso select.form-control { appearance: none; -webkit-appearance: none; padding-right: 30px; background-image: linear-gradient(45deg, transparent 50%, var(--text-muted) 50%), linear-gradient(135deg, var(--text-muted) 50%, transparent 50%); background-position: calc(100% - 16px) 50%, calc(100% - 11px) 50%; background-size: 5px 5px; background-repeat: no-repeat; }
.v2-settings .settings-section { scroll-margin-top: calc(var(--topbar-h, 58px) + 64px); }
.set-field-note { margin-top: 3px; color: var(--danger); font-size: .69rem; font-weight: 550; }

/* Single sign-on */
.v2-sso .sso-form > .btn { justify-self: start; align-self: flex-start; width: auto; }
.sso-warn { margin: 0; padding: 10px 12px; border: 1px solid var(--warning-border); border-radius: 5px; background: var(--warning-subtle); color: var(--text-primary); font-size: .74rem; line-height: 1.5; }
.sso-warn[hidden] { display: none; }
.sso-copy-row { display: flex; align-items: flex-start; gap: 8px; margin-top: 6px; }
.sso-copy-row .sso-uri { flex: 1; min-width: 0; margin: 0; }

/* Plan and usage */
.lic-meter-link { display: inline-block; margin-top: 8px; color: var(--accent); font-size: .72rem; font-weight: 600; text-decoration: none; }
.lic-meter-link:hover { text-decoration: underline; }

/* Sign-in and sign-up: product panel beside the form on wide screens */
.v2-auth-hero { display: none; }
@media (min-width: 1080px) {
    .v2-auth-main.has-hero { grid-template-columns: minmax(0, 500px) minmax(0, 420px); justify-content: center; align-items: center; gap: clamp(48px, 7vw, 110px); background: none; }
    .v2-auth-hero { display: block; }
}
.v2-auth-hero h2 { margin: 0; color: var(--text-primary); font-size: clamp(1.9rem, 2.7vw, 2.5rem); font-weight: 700; letter-spacing: -.02em; line-height: 1.14; }
.v2-auth-hero > p { margin: 16px 0 0; color: var(--text-secondary); font-size: .95rem; line-height: 1.6; }
.v2-auth-hero ul { display: grid; gap: 18px; margin: 32px 0 0; padding: 0; list-style: none; }
.v2-auth-hero li { display: block; }
.v2-auth-hero strong { display: block; color: var(--text-primary); font-size: .86rem; font-weight: 650; }
.v2-auth-hero li span:last-child span { display: block; margin-top: 2px; color: var(--text-secondary); font-size: .78rem; line-height: 1.5; }
.v2-auth-panel .btn[aria-busy="true"] { opacity: .75; }
@media (max-width: 640px) {
    .v2-auth-product { display: none; }
    .v2-auth-panel { background: transparent; }
}
.pw-match { min-height: 1em; margin-top: 5px; font-size: .72rem; font-weight: 550; }
.pw-match.is-ok { color: var(--success); }
.pw-match.is-bad { color: var(--danger); }

/* ── Global experience: motion, palette, toasts, tooltips, dialogs ── */
:root {
    --dc-motion-fast: 120ms;
    --dc-motion-base: 160ms;
    --dc-motion-slow: 200ms;
    --dc-ease-out: cubic-bezier(.2, .8, .2, 1);
}
@keyframes dc-fade-in { from { opacity: 0; } }
@keyframes dc-pop-in { from { opacity: 0; transform: translateY(8px) scale(.985); } }
@keyframes dc-menu-in { from { opacity: 0; translate: 0 -4px; } }
@keyframes dc-busy-slide { from { background-position: -45% 0; } to { background-position: 145% 0; } }
@keyframes dc-toast-rise { from { opacity: 0; translate: 0 10px; } }
@keyframes dc-toast-bar { to { transform: scaleX(0); } }

/* Page changes: content cross-fades, while the menu and top bar hold still. */
@view-transition { navigation: auto; }
::view-transition-old(root) { animation: dc-vt-out var(--dc-motion-fast) ease both; }
::view-transition-new(root) { animation: dc-vt-in var(--dc-motion-base) var(--dc-ease-out) both; }
@keyframes dc-vt-out { to { opacity: 0; } }
@keyframes dc-vt-in { from { opacity: 0; transform: translateY(3px); } }
@media (min-width: 1025px) {
    body.v2-console .dc-sidebar { view-transition-name: dc-sidebar; }
    body.v2-console .v2-topbar { view-transition-name: dc-topbar; }
    ::view-transition-old(dc-sidebar), ::view-transition-old(dc-topbar) { display: none; }
    ::view-transition-new(dc-sidebar), ::view-transition-new(dc-topbar) { animation: none; }
}
@media (prefers-reduced-motion: reduce) {
    ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; }
}
html[data-reduce-motion="1"]::view-transition-group(*),
html[data-reduce-motion="1"]::view-transition-old(*),
html[data-reduce-motion="1"]::view-transition-new(*) { animation: none !important; }

/* Dialogs fade out as well as in. */
body.v2-console .modal-backdrop { transition: opacity var(--dc-motion-base) ease, visibility 0s linear var(--dc-motion-base); }
body.v2-console .modal-backdrop.active { transition: opacity var(--dc-motion-base) ease, visibility 0s; }
body.v2-console .modal { transition: transform var(--dc-motion-slow) var(--dc-ease-out); }
body.v2-console .dc-confirm-backdrop.active { animation: dc-fade-in var(--dc-motion-base) ease; }
body.v2-console .dc-confirm-backdrop.active .confirm-dialog { animation: dc-pop-in var(--dc-motion-slow) var(--dc-ease-out); transform: none; }
body.v2-console .confirm-title { display: flex; align-items: center; gap: 11px; min-width: 0; }
body.v2-console .confirm-ico { display: grid; flex: 0 0 auto; place-items: center; width: auto; height: auto; color: var(--accent-text); background: none; }
body.v2-console .confirm-dialog.is-danger .confirm-ico { color: var(--danger); background: none; }
body.v2-console .confirm-ico svg { display: block; width: 17px; height: 17px; }
body.v2-console .confirm-input.is-match { border-color: var(--success); }
body.v2-console .dc-prompt-note { margin: 6px 0 0; }
body.v2-console .dc-prompt-note:empty { display: none; }

/* Popup menus open with a short settle. */
body.v2-console .dc-kebab-menu,
body.v2-console .dc-views-panel,
body.v2-console .quicknew-menu,
body.v2-console .user-menu,
body.v2-console .dgcb-panel,
body.v2-console .dc-mpick-panel,
body.v2-console details.obs-actions-menu[open] > :not(summary),
body.v2-console details.pol-actions-menu[open] > :not(summary),
body.v2-console details.grp-actions-menu[open] > :not(summary),
body.v2-console details.policy-actions-menu[open] > :not(summary),
body.v2-console details.dc-colchooser[open] > :not(summary) { animation: dc-menu-in var(--dc-motion-fast) var(--dc-ease-out); }
body.v2-console .btn:active:not(:disabled),
body.v2-console .v2-icon-button:active { scale: .98; }
body.v2-console tr[tabindex="0"]:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

/* Command palette */
body.v2-console .cmdk-backdrop { padding-top: 11vh; animation: dc-fade-in var(--dc-motion-fast) ease; }
body.v2-console .cmdk { display: flex; flex-direction: column; width: min(640px, calc(100vw - 24px)); max-height: min(560px, 78vh); border-color: var(--border-strong, var(--border)); border-radius: 10px; animation: dc-pop-in var(--dc-motion-base) var(--dc-ease-out); }
body.v2-console .cmdk-search { display: flex; flex: 0 0 auto; align-items: center; gap: 11px; padding: 0 16px; border-bottom: 1px solid var(--border); color: var(--text-muted); }
body.v2-console .cmdk-search svg { flex: 0 0 auto; width: 16px; height: 16px; }
body.v2-console .cmdk .cmdk-input,
body.v2-console .cmdk .cmdk-input:focus,
body.v2-console .cmdk .cmdk-input:focus-visible { flex: 1 1 auto; width: auto; min-width: 0; height: 50px; padding: 0; border: 0; outline: 0; box-shadow: none; background: transparent; color: var(--text-primary); font-size: .94rem; }
body.v2-console .cmdk .cmdk-input::placeholder { overflow: hidden; text-overflow: ellipsis; }
body.v2-console .cmdk .cmdk-input:placeholder-shown { text-overflow: ellipsis; }
body.v2-console .cmdk-list { flex: 1 1 auto; min-height: 0; max-height: none; padding: 6px 8px 8px; overscroll-behavior: contain; scroll-padding: 28px 0 6px; }
body.v2-console .cmdk-list .cmdk-group { padding: 11px 8px 5px; color: var(--text-muted); font-size: .65rem; font-weight: 650; letter-spacing: 0; text-transform: none; }
body.v2-console .cmdk-item { justify-content: flex-start; gap: 11px; min-height: 36px; padding: 6px 8px; border-radius: 6px; color: var(--text-secondary); font-size: .8rem; }
body.v2-console .cmdk-item.active { color: var(--text-primary); background: var(--accent-subtle); }
body.v2-console .cmdk-ico { display: grid; flex: 0 0 18px; place-items: center; width: 18px; height: 18px; color: var(--text-muted); }
body.v2-console .cmdk-item.active .cmdk-ico { color: var(--accent); }
body.v2-console .cmdk-ico svg { display: block; width: 16px; height: 16px; }
body.v2-console .cmdk-label { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
body.v2-console .cmdk-label mark { border-radius: 2px; color: var(--accent); background: transparent; font-weight: 700; }
body.v2-console .cmdk-sub { flex: 0 1 auto; min-width: 0; overflow: hidden; color: var(--text-muted); font-size: .7rem; text-overflow: ellipsis; white-space: nowrap; }
body.v2-console .cmdk-hint { display: inline-flex; flex: 0 0 auto; gap: 3px; margin-left: auto; }
body.v2-console .cmdk-item kbd,
body.v2-console .cmdk-foot kbd { display: inline-block; min-width: 18px; padding: 0 4px; border: 1px solid var(--border); border-radius: 4px; color: var(--text-muted); background: var(--bg-subtle); font-family: var(--font-sans); font-size: .64rem; line-height: 16px; text-align: center; }
body.v2-console .cmdk-empty { display: grid; gap: 4px; padding: 34px 12px; font-size: .8rem; }
body.v2-console .cmdk-empty strong { overflow-wrap: anywhere; color: var(--text-primary); font-weight: 600; }
body.v2-console .cmdk-foot { display: flex; flex: 0 0 auto; align-items: center; justify-content: space-between; gap: 14px; min-height: 36px; padding: 6px 14px; border-top: 1px solid var(--border); color: var(--text-muted); background: var(--bg-subtle); font-size: .68rem; }
body.v2-console .cmdk-keys { display: inline-flex; flex: 0 0 auto; align-items: center; gap: 4px; white-space: nowrap; }
body.v2-console .cmdk-keys kbd + kbd { margin-left: -1px; }
body.v2-console .cmdk-status { min-width: 0; overflow: hidden; text-align: right; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 640px) {
    body.v2-console .cmdk-backdrop { padding-top: 12px; }
    body.v2-console .cmdk-keys, body.v2-console .cmdk-sub { display: none; }
}

/* Toasts */
body.v2-console .toast { position: relative; overflow: hidden; animation: dc-toast-rise var(--dc-motion-slow) var(--dc-ease-out); }
body.v2-console .toast.out { animation: toast-out 200ms forwards; }
body.v2-console .toast-bar { position: absolute; right: 0; bottom: 0; left: 0; height: 2px; background: var(--border-strong); opacity: .7; transform-origin: left; animation-name: dc-toast-bar; animation-timing-function: linear; animation-fill-mode: forwards; pointer-events: none; }
body.v2-console .toast-count { flex: 0 0 auto; align-self: center; padding: 0 6px; border: 1px solid var(--border); border-radius: 9px; color: var(--text-secondary); background: var(--bg-subtle); font-size: .68rem; font-weight: 600; line-height: 16px; }
body.v2-console .toast-count[hidden] { display: none; }
body.v2-console .toast .toast-dismiss { flex: 0 0 auto; width: 22px; height: 22px; }
body.v2-console .toast .toast-dismiss svg { width: 14px; height: 14px; }
@media (max-width: 480px) { body.v2-console .toast-container { right: 10px; bottom: 10px; left: 10px; } body.v2-console .toast { min-width: 0; max-width: none; } }

/* Tooltips: the inverse of the page, so they read as apart from it in both themes. */
.dc-tooltip { position: fixed; top: 0; left: 0; z-index: 1300; max-width: 320px; padding: 6px 9px; overflow-wrap: anywhere; border-radius: 5px; color: var(--bg-surface); background: var(--text-primary); box-shadow: var(--shadow-md); font-family: var(--font-sans); font-size: .72rem; font-weight: 500; line-height: 1.42; white-space: pre-line; pointer-events: none; opacity: 0; translate: 0 3px; }
.dc-tooltip.is-below { translate: 0 -3px; }
.dc-tooltip.is-right { translate: -3px 0; }
.dc-tooltip.is-on { opacity: 1; translate: 0 0; transition: opacity var(--dc-motion-fast) ease, translate var(--dc-motion-fast) var(--dc-ease-out); }
.dc-tooltip[hidden] { display: none; }

/* Slow request bar */
.dc-busy-bar { position: fixed; top: 0; right: 0; left: 0; z-index: 1250; height: 2px; background: linear-gradient(90deg, transparent, var(--accent), transparent) no-repeat; background-size: 45% 100%; opacity: 0; pointer-events: none; transition: opacity var(--dc-motion-base) ease; }
.dc-busy-bar.is-on { opacity: 1; animation: dc-busy-slide 1.1s ease-in-out infinite; }

/* Two-key shortcut indicator */
.dc-go-hud { position: fixed; bottom: 22px; left: 50%; z-index: 1100; display: flex; align-items: center; gap: 8px; padding: 7px 12px; border: 1px solid var(--border); border-radius: 8px; color: var(--text-secondary); background: var(--bg-surface); box-shadow: var(--shadow-md); font-size: .74rem; pointer-events: none; opacity: 0; translate: -50% 6px; transition: opacity var(--dc-motion-fast) ease, translate var(--dc-motion-fast) var(--dc-ease-out); }
.dc-go-hud.is-on { opacity: 1; translate: -50% 0; }
.dc-go-hud kbd { padding: 0 5px; border: 1px solid var(--border); border-radius: 4px; color: var(--text-primary); background: var(--bg-subtle); font-size: .68rem; line-height: 16px; }

/* Keyboard shortcuts panel */
.kbd-groups { display: grid; gap: 20px; }
.kbd-group h4 { margin: 0 0 4px; color: var(--text-muted); font-size: .65rem; font-weight: 650; letter-spacing: 0; text-transform: none; }
body.v2-console .kbd-table td { padding: 6px 4px; font-size: .76rem; }
body.v2-console .kbd-table td:first-child { width: 112px; white-space: nowrap; }
body.v2-console .kbd-table kbd { display: inline-block; min-width: 20px; margin-right: 3px; padding: 0 5px; border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 4px; color: var(--text-primary); background: var(--bg-subtle); font-family: var(--font-sans); font-size: .68rem; line-height: 17px; text-align: center; }
.kbd-then { margin: 0 5px 0 2px; color: var(--text-muted); font-size: .65rem; }
.kbd-foot { margin: 18px 0 0; color: var(--text-muted); font-size: .72rem; }

/* Notifications */
.dc-notification-summary { margin-bottom: 4px; color: var(--text-muted); font-size: .72rem; }
.dc-notification-summary strong { color: var(--accent); font-weight: 650; }
.dc-notification-day { margin: 16px 0 2px; color: var(--text-muted); font-size: .65rem; font-weight: 650; letter-spacing: 0; text-transform: none; }
.dc-notification-feed > .dc-notification-day:first-child { margin-top: 8px; }
.dc-notification-empty-ico { display: none; }
.dc-notification-empty-ico svg { display: block; width: 20px; height: 20px; }
.dc-notification-skel { display: grid; gap: 8px; padding: 15px 0 15px 20px; border-bottom: 1px solid var(--divider); }
.dc-notification-skel .skeleton { display: block; height: 11px; border-radius: 4px; }
.dc-notification-skel .skeleton:nth-child(1) { width: 42%; height: 13px; }
.dc-notification-skel .skeleton:nth-child(2) { width: 88%; }
.dc-notification-skel .skeleton:nth-child(3) { width: 24%; }
.dc-notification-retry { margin-top: 10px; }

/* Skeleton rows look like the content they stand in for. */
body.v2-console .skeleton-row td:nth-child(3n+1) .skeleton { width: 76%; }
body.v2-console .skeleton-row td:nth-child(3n+2) .skeleton { width: 54%; }
body.v2-console .skeleton-row td:nth-child(3n) .skeleton { width: 64%; }
body.v2-console .skeleton-row:nth-child(even) .skeleton { opacity: .72; }
@media print { .dc-busy-bar, .dc-go-hud, .dc-tooltip { display: none !important; } }

/* Keyboard focus is always a solid ring, on every control that used a faint one or a background change alone. */
body.v2-console .btn:focus-visible,
body.v2-console .toggle-switch input:focus-visible + .toggle-slider,
body.v2-console .copy-btn:focus-visible,
body.v2-console .dc-mpick-x:focus-visible,
body.v2-console .dc-org-switcher:focus-visible,
body.v2-console .dc-watch-star:focus-visible,
body.v2-console .row-actions a:focus-visible,
body.v2-console .row-actions button:focus-visible,
body.v2-console td a:focus-visible,
body.v2-console .btn-icon:focus-visible,
body.v2-console .dc-jump a:focus-visible,
body.v2-console .wf-switch input:focus-visible + .track,
body.v2-console .wf-check input:focus-visible + span,
body.v2-console .wf-addnext:focus-visible,
body.v2-console .wf-fchip:focus-visible,
body.v2-console .wf-hdr-icon:focus-visible,
body.v2-console .wf-start-card:focus-visible,
body.v2-console .wf-next-go:focus-visible,
body.v2-console .wf-badge[data-tip]:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
body.v2-console .dc-kebab-item:focus-visible,
body.v2-console .obs-actions-popover > button:focus-visible,
body.v2-console .obs-actions-popover > .btn:focus-visible,
body.v2-console .user-menu-item:focus-visible,
body.v2-console .wf-pal-item:focus-visible,
body.v2-console .wf-menu-item:focus-visible,
body.v2-console .wf-sim-ep:focus-visible,
body.v2-console .wf-pick-item:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
body.v2-console .form-control:focus { box-shadow: 0 0 0 1px var(--accent), 0 0 0 4px var(--accent-ring); }

/* A focused control never lands under the sticky topbar or the phone menu. */
html { scroll-padding-top: 72px; }
@media (max-width: 760px) {
    html { scroll-padding-bottom: 88px; }
    /* Toasts and Back to top sit above the phone menu instead of covering it. */
    body.v2-console .toast-container { bottom: calc(78px + env(safe-area-inset-bottom)); }
    body.v2-console .dc-top-btn { bottom: calc(82px + env(safe-area-inset-bottom)); }
    .dc-mobile-nav a, .dc-mobile-nav button { font-size: .64rem; }
    body.v2-console .modal, body.v2-console .modal.lg, body.v2-console .modal.xl { max-height: calc(100dvh - 20px); }
}

/* 761 to 768 wide: style.css stacks these while v2.css still right-aligned them, which pushed titles to the right of the page. */
@media (min-width: 761px) and (max-width: 768px) {
    .v2-page-header, body.v2-console .page-header { align-items: stretch; }
    body.v2-console .page-header-actions { justify-content: flex-start; }
    body.v2-console .selector-row, body.v2-console .selector-card { align-items: stretch; }
}

/* Filter bars widen their inputs on small screens; a checkbox must stay a checkbox. */
@media (max-width: 768px) {
    body.v2-console .filters-bar input[type="checkbox"],
    body.v2-console .filter-group input[type="checkbox"] { flex: none; width: 16px !important; min-width: 0 !important; height: 16px; margin: 0; padding: 0; }
    body.v2-console .log-regex-lbl { flex: none; white-space: nowrap; margin-top: 0; }
    body.v2-console .ep-search-wrap { flex: 1 1 100%; width: 100%; }
}

/* Short stat cards stay side by side on phones rather than running to several screens. */
@media (max-width: 900px) {
    body.v2-console .ep-stats { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; }
}
@media (max-width: 420px) {
    body.v2-console .metric-grid, body.v2-console .metric-grid.cols-6, body.v2-console .metric-grid.cols-5, body.v2-console .metric-grid.cols-4, body.v2-console .metric-grid.cols-3,
    body.v2-console #risk-kpis, body.v2-console .rep-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
    body.v2-console .v2-endpoints .ep-stat { min-height: 0; padding: 8px 10px; }
}
@media (max-width: 760px) {
    body.v2-console .deploy-agent-actions { display: grid !important; grid-template-columns: repeat(2, minmax(0, 1fr)); }
    body.v2-console .deploy-agent-actions .btn { width: 100%; }
}
@media (max-width: 640px) {
    body.v2-console .ep-fleet-disclosure > summary { flex-wrap: wrap; gap: 2px 10px; }
    body.v2-console .ep-fleet-disclosure > summary > span { order: 3; flex: 1 1 100%; }
}
/* Organisation platform tiles wrap their description rather than running off the button. */
body.v2-console .deploy-choice { height: auto; min-width: 0; white-space: normal; }
body.v2-console .deploy-choice small { display: block; text-align: center; white-space: normal; overflow-wrap: anywhere; }

@media (max-width: 760px) {
    /* Alerts: the three actions wrap inside the card, and the role badge keeps its own width. */
    .v2-alerts .alert-scope-actions { flex-wrap: wrap; }
    body.v2-console .page-header .role-badge { align-self: flex-start; }
    /* Empty messages stay in view inside a table wider than the screen. */
    body.v2-console .table-wrap td > .jit-empty,
    body.v2-console .table-wrap td > .empty-panel { position: sticky; left: 12px; box-sizing: border-box; width: calc(100vw - 88px); max-width: 100%; }
    body.v2-console .table-wrap td.empty-state { text-align: left; }
}
@media (max-width: 640px) {
    /* Alerts filters in two columns, like the other observability pages. */
    body.v2-console .v2-alerts .filters-bar { display: flex; flex-wrap: wrap; align-items: flex-end; }
    body.v2-console .v2-alerts .filters-bar .filter-group { flex: 1 1 calc(50% - 6px); width: auto; min-width: 0 !important; max-width: none; }
    /* Token usage: captions wrap, and the scope selects line up. */
    body.v2-console .metric-foot, body.v2-console .metric-sub { overflow: visible; text-overflow: clip; white-space: normal; }
    body.v2-console .v2-tokens .selector-group > label { flex: 0 0 84px; }
}

/* Phone-only Filters button on Event log and Sessions. */
body.v2-console .dc-phone-filters-btn { display: none; }
@media (max-width: 640px) {
    body.v2-console .dc-phone-filters-btn { display: inline-flex; }
    body.v2-console .dc-phone-filters-closed .filter-group:has(select) { display: none; }
    body.v2-console .dc-phone-merged { display: none !important; }
    body.v2-console .dc-filters-more.dc-phone-more-open { display: block !important; }
    body.v2-console .dc-filters-more.dc-phone-more-closed { display: none !important; }
}
/* Tablet widths: the four filter dropdowns share a row rather than stranding one. */
@media (min-width: 641px) and (max-width: 1180px) {
    body.v2-console .dcs-filters:has(#f-status) .filter-group { grid-column: span 3; }
    body.v2-console .dcs-filters:has(#f-status) .filter-group.filter-search { grid-column: 1 / -1; }
    body.v2-console .v2-events .filters-bar:has(#filter-search) .filter-group { grid-column: span 3; }
    body.v2-console .v2-events .filters-bar:has(#filter-search) .filter-group.filter-search { grid-column: 1 / -1; }
}

/* Rings on tabs and header cells sit inside, because their scrolling containers clip anything outside. */
body.v2-console th.sortable-col:focus-visible,
body.v2-console th[tabindex="0"]:focus-visible,
body.v2-console .pol-tab:focus-visible,
body.v2-console .jit-tab:focus-visible,
body.v2-console .wf-tab:focus-visible { outline-offset: -2px; }
/* Back to top stays beneath drawers and dialogs. */
body.v2-console .dc-top-btn { z-index: 60; }

/* Event log on phones: every row shows host, decision and command without sideways scrolling. */
@media (max-width: 640px) {
    #logs-scroll #logs-table, #logs-scroll #logs-table tbody, #logs-scroll #logs-table thead { display: block; width: 100%; min-width: 0; }
    #logs-scroll #logs-table thead { position: sticky; top: 0; z-index: 2; background: var(--bg-surface); border-bottom: 1px solid var(--border); }
    .log-cols { display: none; }   /* Machine ID is not shown at this width, so its toggle would do nothing. */
    #logs-scroll #logs-table thead tr { display: flex !important; flex-flow: row wrap; gap: 0 4px; height: auto; min-height: 0; padding: 4px 8px; }
    #logs-scroll #logs-table thead th { position: static; display: block; flex: 0 0 auto; width: auto !important; min-width: 0; padding: 6px; border: 0; background: transparent; white-space: nowrap; }
    #logs-scroll #logs-table thead th:not([data-sort-key]) { display: none; }
    #logs-scroll #logs-table tr.log-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "host action" "cmd cmd" "time service"; gap: 5px 10px; padding: 10px 14px; border-bottom: 1px solid var(--divider); }
    #logs-scroll #logs-table tr.log-row > td { display: block; min-width: 0; max-width: none; height: auto; padding: 0; border: 0; background: transparent; }
    #logs-scroll #logs-table tr.log-row > td:nth-child(1) { grid-area: time; align-self: center; }
    #logs-scroll #logs-table tr.log-row > td:nth-child(2) { grid-area: host; align-self: center; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    #logs-scroll #logs-table tr.log-row > td:nth-child(3) { display: none; }
    #logs-scroll #logs-table tr.log-row > td:nth-child(4) { grid-area: service; justify-self: end; }
    #logs-scroll #logs-table tr.log-row > td:nth-child(5) { grid-area: cmd; white-space: normal; overflow: visible; }
    #logs-scroll #logs-table tr.log-row > td:nth-child(5) code { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden; white-space: normal; overflow-wrap: anywhere; }
    #logs-scroll #logs-table tr.log-row > td:nth-child(6) { grid-area: action; justify-self: end; }
    #logs-scroll #logs-table tr:not(.log-row) { display: block; }
    #logs-scroll #logs-table tr:not(.log-row) > td { display: block; }
}

/* Windows High Contrast and other forced colour modes drop backgrounds and box shadows, so state needs system colours. */
@media (forced-colors: active) {
    body.v2-console :focus-visible { outline: 2px solid Highlight !important; outline-offset: 2px; }
    body.v2-console .form-control:focus { outline: 2px solid Highlight; }
    body.v2-console .v2-nav-item.is-active,
    body.v2-console .seg-btn.active,
    body.v2-console .log-chip.active,
    body.v2-console .pol-tab.active,
    body.v2-console .dc-mobile-nav .is-active { forced-color-adjust: none; background: Highlight; color: HighlightText; }
    body.v2-console .toggle-slider { forced-color-adjust: none; border: 1px solid CanvasText; background: Canvas; }
    body.v2-console .toggle-switch input:checked + .toggle-slider { background: Highlight; }
    body.v2-console .modal,
    body.v2-console .drawer,
    body.v2-console .toast,
    body.v2-console .cmdk,
    body.v2-console .user-menu,
    body.v2-console .dc-kebab-menu,
    body.v2-console .dgcb-panel,
    body.v2-console .dc-mobile-nav { border: 1px solid CanvasText; }
}

/* ── Theme menus (2026-11-11): topbar popup and the segmented row in the account menu ── */
.dc-theme-wrap { position: relative; display: inline-flex; }
.dc-theme-menu { position: absolute; z-index: 120; top: calc(100% + 8px); right: 0; width: 248px; padding: 6px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg-surface); box-shadow: var(--shadow-md); animation: dc-menu-in var(--dc-motion-fast) var(--dc-ease-out); }
.dc-theme-menu[hidden] { display: none; }
.dc-theme-menu-head { padding: 6px 8px 6px; color: var(--text-muted); font-size: .68rem; font-weight: 650; }
.dc-theme-opt { display: grid; grid-template-columns: 22px minmax(0, 1fr) 16px; align-items: center; gap: 10px; width: 100%; min-height: 44px; padding: 6px 8px; border: 0; border-radius: 6px; color: var(--text-secondary); background: transparent; font: inherit; text-align: left; cursor: pointer; }
.dc-theme-opt:hover { color: var(--text-primary); background: var(--bg-hover); }
.dc-theme-opt:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: -2px; }
.dc-theme-opt strong { display: block; color: var(--text-primary); font-size: .78rem; font-weight: 600; line-height: 1.3; }
.dc-theme-opt small { display: block; color: var(--text-muted); font-size: .68rem; line-height: 1.35; }
.dc-theme-opt .dc-theme-check { width: 14px; height: 14px; color: var(--accent); visibility: hidden; }
.dc-theme-opt[aria-checked="true"] .dc-theme-check { visibility: visible; }
.dc-theme-opt[aria-checked="true"] strong { color: var(--text-primary); }
.dc-theme-swatch { position: relative; display: block; width: 22px; height: 22px; overflow: hidden; border: 1px solid var(--border-control); border-radius: 50%; background: var(--sw-bg); }
.dc-theme-swatch::after { content: ""; position: absolute; right: 4px; bottom: 4px; width: 7px; height: 7px; border-radius: 50%; background: var(--sw-fg); }
.dc-theme-swatch.is-light { --sw-bg: var(--swatch-light-bg); --sw-fg: var(--swatch-light-fg); }
.dc-theme-swatch.is-midnight { --sw-bg: var(--swatch-midnight-bg); --sw-fg: var(--swatch-midnight-fg); }
.dc-theme-swatch.is-lightsoff { --sw-bg: var(--swatch-lightsoff-bg); --sw-fg: var(--swatch-lightsoff-fg); }
.dc-theme-swatch.is-system { background: linear-gradient(135deg, var(--swatch-light-bg) 50%, var(--swatch-midnight-bg) 50%); }
.dc-theme-swatch.is-system::after { display: none; }
/* Account menu: Light / Midnight / Lights off / System as one segmented row. */
.dc-theme-group { padding: 4px 2px 8px; }
.dc-theme-group-label { display: flex; align-items: center; justify-content: space-between; padding: 4px 4px 6px; color: var(--text-secondary); font-size: .73rem; }
.dc-theme-seg { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px; padding: 2px; border: 1px solid var(--border); border-radius: 7px; background: var(--bg-sunken); }
.dc-theme-seg button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-width: 0; min-height: 44px; padding: 5px 0 4px; border: 0; border-radius: 5px; color: var(--text-muted); background: transparent; font: inherit; font-size: .6rem; font-weight: 600; line-height: 1.15; text-align: center; cursor: pointer; }
.dc-theme-seg button svg { width: 15px; height: 15px; flex: none; }
.dc-theme-seg button span { max-width: 100%; letter-spacing: -.01em; white-space: normal; overflow-wrap: normal; }
.dc-theme-seg button:hover { color: var(--text-primary); }
.dc-theme-seg button[aria-checked="true"] { color: var(--text-primary); background: var(--bg-surface); box-shadow: var(--shadow-xs), inset 0 0 0 1px var(--border); }
.dc-theme-seg button:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: -2px; }
@media (forced-colors: active) {
    .dc-theme-seg button[aria-checked="true"], .dc-theme-opt[aria-checked="true"] { outline: 2px solid Highlight; outline-offset: -2px; }
}

/* ── Interactive-control borders and placeholders (audit 35b A1/A2): >= 3:1 boundary, AA placeholder text ── */
body.v2-console .form-control,
body.v2-console .btn-secondary,
body.v2-console .btn-ghost,
body.v2-console .dgcb-trigger,
body.v2-console .v2-org-switcher { border-color: var(--border-control); }
body.v2-console .form-control:hover:not(:focus),
body.v2-console .btn-secondary:hover,
body.v2-console .btn-ghost:hover,
body.v2-console .dgcb-trigger:hover,
body.v2-console .v2-org-switcher:hover { border-color: var(--border-control-hover); }
body.v2-console .form-control[aria-invalid="true"] { border-color: var(--danger); }
body.v2-console .form-control:focus { border-color: var(--accent); }
.form-control::placeholder, input::placeholder, textarea::placeholder { color: var(--text-placeholder); opacity: 1; }
:root[data-contrast="1"]:not([data-theme="dark"]) { --border-control: #56635f; --border-control-hover: var(--text-primary); --text-placeholder: #4f5d58; }
