﻿/* File Name: static/css/portal.css */
/* PORTAL neumorphism v1. Complete stylesheet; existing DOM and theme controls retained. */
:root {
    color-scheme: light;
    --background: #efedf7;
    --surface: #efedf7;
    --text: #29263d;
    --muted: #625e75;
    --accent: #6839d9;
    --accent-soft: #e6def6;
    --accent-text: #ffffff;
    --border: #d9d4e7;
    --shadow-light: #ffffff;
    --shadow-dark: #d3cedf;
    --raised: 8px 8px 18px var(--shadow-dark), -8px -8px 18px var(--shadow-light);
    --raised-small: 4px 4px 9px var(--shadow-dark), -4px -4px 9px var(--shadow-light);
    --recessed: inset 4px 4px 9px var(--shadow-dark), inset -4px -4px 9px var(--shadow-light);
    --recessed-small: inset 2px 2px 5px var(--shadow-dark), inset -2px -2px 5px var(--shadow-light);
    --success: #23603d;
    --warning: #885015;
    /* Compatibility with existing project styles. All surfaces are opaque. */
    --glass: var(--surface);
    --glass-strong: var(--surface);
    --sidebar: var(--surface);
    --shadow: var(--raised);
}
html[data-theme="dark"] {
    color-scheme: dark;
    --background: #202126;
    --surface: #202126;
    --text: #eeedf2;
    --muted: #b6b1bf;
    --accent: #ef965b;
    --accent-soft: #392c26;
    --accent-text: #20160f;
    --border: #3d3b43;
    --shadow-light: #2c2d34;
    --shadow-dark: #141519;
    --success: #91d6a8;
    --warning: #f2b782;
}

/* Base and accessibility */
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; min-height: 100%; }
body {
    min-height: 100vh;
    color: var(--text);
    background: var(--background);
    font-family: "Segoe UI", Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    isolation: isolate;
}
button, input, select, textarea { font: inherit; }
button, a, summary, input { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }
a { color: var(--accent); }
button, summary { cursor: pointer; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 4px; }
h1, h2, h3, p { margin-top: 0; }
h2 { font-size: 16px; font-weight: 650; }
h3 { font-size: 15px; }
p:last-child { margin-bottom: 0; }
.sr-only {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0;
}
.skip-link {
    position: fixed; top: -100px; left: 16px; z-index: 2000;
    padding: 12px 18px; border-radius: 10px; background: var(--surface);
}
.skip-link:focus { top: 12px; }
.muted { color: var(--muted); }
/* Existing decorative elements stay in the templates but are not displayed. */
.ambient-background { display: none; }

/* Layout */
.portal-layout { min-height: 100vh; display: grid; grid-template-columns: 230px minmax(0, 1fr); }
.sidebar {
    position: sticky; top: 0; height: 100vh; padding: 32px 18px 22px;
    display: flex; flex-direction: column;
    background: var(--sidebar); border-right: 1px solid var(--border);
    box-shadow: 7px 0 18px var(--shadow-dark);
    z-index: 5;
}
.brand { display: block; padding: 0 12px 36px; text-decoration: none; color: var(--text); }
.brand-name { display: block; font-size: 21px; font-weight: 700; letter-spacing: -.6px; }
.brand-name span { color: var(--accent); }
.brand-tagline { display: block; margin-top: 5px; color: var(--muted); font-size: 11px; }
.nav-menu { display: flex; flex-direction: column; gap: 12px; }
.nav-item {
    min-height: 49px; padding: 11px 15px; display: flex; align-items: center; gap: 13px;
    border: 1px solid transparent; border-radius: 13px; color: var(--muted); text-decoration: none;
    transition: color .18s ease, background .18s ease, box-shadow .18s ease;
}
.nav-item:hover { color: var(--text); background: var(--surface); box-shadow: var(--raised-small); }
.nav-item.active { color: var(--accent); font-weight: 650; background: var(--accent-soft); border-color: var(--border); box-shadow: var(--recessed-small); }
.nav-icon { width: 22px; text-align: center; font-size: 20px; }
.sidebar-footer { margin-top: auto; padding: 30px 14px 0; color: var(--muted); font-size: 11px; }
.small-label { letter-spacing: 3px; font-size: 10px; }
.sidebar-footer p { margin: 6px 0 0; }
.portal-main { min-width: 0; min-height: 100vh; padding: 28px 36px 18px; display: flex; flex-direction: column; }

/* Header */
.portal-header {
    min-height: 76px; padding: 12px 18px; display: flex; align-items: center;
    justify-content: space-between; gap: 20px; background: var(--surface);
    border: 1px solid var(--border); border-radius: 18px; box-shadow: var(--raised);
}
.portal-heading { color: var(--accent); font-size: 29px; font-weight: 550; letter-spacing: 6px; text-decoration: none; }
.header-actions { display: flex; align-items: center; gap: 14px; min-width: 0; }
.search-box {
    width: 235px; height: 44px; padding: 0 13px; display: flex; align-items: center; gap: 9px;
    border: 1px solid var(--border); border-radius: 12px; background: var(--surface); box-shadow: var(--recessed);
}
.search-box:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.search-box input { width: 100%; min-width: 0; border: 0; outline: none; background: transparent; color: var(--text); font-size: 13px; }
.search-box input::placeholder { color: var(--muted); opacity: 1; }
.theme-toggle, .login-theme-toggle {
    height: 44px; padding: 0 11px; display: flex; align-items: center; gap: 7px;
    border: 1px solid var(--border); border-radius: 12px; background: var(--surface); color: var(--text);
    box-shadow: var(--raised-small);
}
.theme-toggle:active, .login-theme-toggle:active { box-shadow: var(--recessed-small); }
.toggle-track { width: 37px; height: 20px; padding: 2px; display: block; border-radius: 20px; background: var(--accent); box-shadow: inset 2px 2px 4px rgba(0,0,0,.2); }
.toggle-knob { width: 16px; height: 16px; display: block; border-radius: 50%; background: #fff; box-shadow: 1px 1px 3px rgba(0,0,0,.25); transition: transform .2s ease; }
html[data-theme="dark"] .toggle-knob { transform: translateX(17px); }

/* Account menu */
.user-card { position: relative; z-index: 20; }
.user-card > summary {
    min-height: 52px; padding: 7px 12px; display: flex; align-items: center; gap: 10px; list-style: none;
    border: 1px solid var(--border); border-radius: 13px; background: var(--surface); box-shadow: var(--raised-small);
}
.user-card[open] > summary { box-shadow: var(--recessed-small); }
summary::-webkit-details-marker { display: none; }
.avatar { width: 34px; height: 34px; flex: 0 0 34px; display: grid; place-items: center; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-weight: 700; box-shadow: var(--recessed-small); }
.user-information strong { display: block; max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.user-information small { display: block; margin-top: 2px; color: var(--muted); font-size: 10px; }
.user-chevron { color: var(--muted); }
.user-menu { position: absolute; right: 0; top: calc(100% + 14px); width: 235px; padding: 14px; border: 1px solid var(--border); border-radius: 13px; background: var(--surface); box-shadow: var(--raised); }
.user-menu p { padding: 0 4px; color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.user-menu a { display: block; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); text-decoration: none; box-shadow: var(--raised-small); }
.user-menu a:hover, .user-menu a:active { background: var(--accent-soft); box-shadow: var(--recessed-small); }

/* Page content and overview */
.page-content { flex: 1; width: 100%; max-width: 1440px; margin: 38px auto 0; }
.page-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 26px; }
.eyebrow { margin-bottom: 7px; color: var(--accent); font-size: 10px; font-weight: 700; letter-spacing: 1.7px; text-transform: uppercase; }
.page-heading h1 { margin-bottom: 8px; font-size: 30px; font-weight: 650; letter-spacing: -.8px; }
.page-description, .section-note { color: var(--muted); font-size: 13px; }
.section-note { margin-bottom: 20px; }
.badge { display: inline-flex; align-items: center; flex-shrink: 0; width: fit-content; padding: 6px 10px; border: 1px solid var(--border); border-radius: 20px; background: var(--surface); color: var(--muted); font-size: 10px; font-weight: 600; white-space: nowrap; box-shadow: var(--raised-small); }
.panel, .metric-card { min-width: 0; border: 1px solid var(--border); border-radius: 18px; background: var(--surface); box-shadow: var(--raised); }
.panel { padding: 23px; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 19px; }
.panel-heading h2 { margin: 0; }
.text-link { flex-shrink: 0; font-size: 12px; text-decoration: none; }
.text-link:hover { text-decoration: underline; }
.panel-note { margin-top: 19px; color: var(--muted); font-size: 12px; }
.metrics-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 22px; margin-bottom: 28px; }
.metric-card { padding: 21px; }
.metric-card h2 { margin-bottom: 14px; color: var(--muted); font-size: 12px; font-weight: 600; }
.metric-value { color: var(--accent); font-size: 32px; line-height: 1.2; }
.metric-card p { margin: 12px 0 0; color: var(--muted); font-size: 11px; }
.overview-grid { display: grid; grid-template-columns: 1.2fr 1fr; gap: 26px; }
.overview-wide { grid-column: 1 / -1; }
.workload-row { min-height: 51px; padding: 12px 0; display: flex; align-items: center; justify-content: space-between; gap: 14px; border-bottom: 1px solid var(--border); font-size: 12px; }
.workload-row:last-child { border-bottom: 0; }
.empty-state { padding: 32px 18px; border-radius: 13px; background: var(--surface); box-shadow: var(--recessed); text-align: center; }
.empty-symbol { width: 46px; height: 46px; margin: 0 auto 14px; display: grid; place-items: center; border-radius: 14px; color: var(--accent); background: var(--surface); box-shadow: var(--raised-small); font-size: 24px; }
.empty-state h3 { margin-bottom: 8px; }
.empty-state p { max-width: 480px; margin: 0 auto; color: var(--muted); font-size: 13px; }

/* Project rows: preserve compact names at rest and expansion on hover/focus. */
.project-list { display: flex; flex-direction: column; gap: 20px; }
.project-row { border: 1px solid var(--border); border-radius: 17px; background: var(--surface); box-shadow: var(--raised); }
.project-row > summary { min-height: 64px; padding: 19px 23px; display: flex; align-items: center; gap: 0; list-style: none; border-radius: 17px; transition: padding .2s ease, gap .2s ease; }
.project-copy { flex: 1; min-width: 0; }
.project-name { display: block; font-size: 16px; font-weight: 600; }
.project-headline { display: none; margin-top: 5px; color: var(--muted); font-size: 12px; }
.project-icon, .integration-icon { width: 46px; height: 46px; flex: 0 0 46px; place-items: center; border: 1px solid var(--border); border-radius: 13px; color: var(--accent); background: var(--surface); box-shadow: var(--raised-small); font-size: 17px; font-weight: 700; }
.project-icon, .project-chevron { display: none; }
.project-row[open] > summary, .project-row:focus-within > summary { padding-top: 24px; padding-bottom: 24px; gap: 17px; }
.project-row[open] .project-icon, .project-row:focus-within .project-icon { display: grid; }
.project-row[open] .project-headline, .project-row[open] .project-chevron,
.project-row:focus-within .project-headline, .project-row:focus-within .project-chevron { display: block; }
@media (hover: hover) {
    .project-row:hover > summary { padding-top: 24px; padding-bottom: 24px; gap: 17px; }
    .project-row:hover .project-icon { display: grid; }
    .project-row:hover .project-headline, .project-row:hover .project-chevron { display: block; }
}
.project-row[open] { border-color: var(--accent); }
.project-row[open] > summary { color: var(--accent); }
.project-row[open] .project-chevron { transform: rotate(180deg); }
.project-body { padding: 23px; border-top: 1px solid var(--border); }
.project-body > p { font-size: 13px; }
.queue-placeholder { margin-top: 18px; padding: 24px 16px; border: 1px solid var(--border); border-radius: 11px; background: var(--surface); box-shadow: var(--recessed); text-align: center; color: var(--muted); font-size: 13px; }
.section-spacer { margin-top: 28px; }
.empty-search { padding: 28px; text-align: center; color: var(--muted); }

/* Shared integration cards */
.integration-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; }
.integration-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 23px; }
.integration-icon { display: grid; }
.integration-card { display: flex; flex-direction: column; }
.integration-card h2 { margin-bottom: 9px; }
.integration-card > p { font-size: 13px; }
.integration-note { margin-top: auto; padding-top: 18px; color: var(--muted); font-size: 11px !important; }
.onboarding-icon, .sharepoint-icon, .jira-icon, .graph-icon,
.auth0-icon, .mailjet-icon, .tableau-icon { background: var(--surface); color: var(--accent); }

/* Tables, analytics and settings */
.table-scroll { overflow-x: auto; border: 1px solid var(--border); border-radius: 11px; background: var(--surface); box-shadow: var(--recessed-small); }
table { width: 100%; border-collapse: collapse; text-align: left; font-size: 12px; }
th, td { padding: 14px 12px; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-weight: 600; white-space: nowrap; }
.table-empty { padding: 44px 18px; text-align: center; color: var(--muted); }
.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.setting-row h2 { margin-bottom: 7px; }
.setting-row p { max-width: 560px; font-size: 13px; }
.theme-options { display: flex; flex-shrink: 0; gap: 12px; }
.theme-option { min-height: 43px; padding: 9px 17px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); box-shadow: var(--raised-small); }
.theme-option[aria-pressed="true"] { color: var(--accent); background: var(--accent-soft); border-color: var(--accent); box-shadow: var(--recessed-small); }
.portal-footer { padding-top: 35px; color: var(--muted); font-size: 10px; }
.notice { padding: 16px; border: 1px solid var(--border); border-left: 3px solid var(--accent); border-radius: 12px; background: var(--surface); box-shadow: var(--recessed-small); overflow-wrap: anywhere; }

/* Login and Access Denied */
.login-page { display: grid; place-items: center; }
.login-shell { width: 100%; min-height: 100vh; padding: 30px 18px; display: grid; place-items: center; }
.login-card { width: min(470px, 100%); min-height: 390px; padding: 54px 36px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; border: 1px solid var(--border); border-radius: 28px; background: var(--surface); box-shadow: 14px 14px 30px var(--shadow-dark), -14px -14px 30px var(--shadow-light); }
.login-wordmark { color: var(--accent); font-size: 46px; font-weight: 350; letter-spacing: 12px; text-indent: 12px; }
.login-divider { width: 40px; height: 2px; margin: 27px 0; background: var(--accent); }
.login-description { max-width: 320px; margin: 0 0 30px; color: var(--muted); font-size: 14px; line-height: 1.6; }
.microsoft-login-button { width: 100%; max-width: 300px; min-height: 55px; padding: 12px 18px; display: flex; align-items: center; justify-content: center; gap: 14px; border: 1px solid var(--border); border-radius: 13px; background: var(--surface); box-shadow: var(--raised); color: var(--text); text-decoration: none; font-size: 14px; font-weight: 600; transition: border-color .2s ease, box-shadow .2s ease; }
.microsoft-login-button:hover { border-color: var(--accent); }
.microsoft-login-button:active { box-shadow: var(--recessed); }
.microsoft-logo { width: 20px; height: 20px; flex: 0 0 20px; display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; gap: 2px; }
.microsoft-logo span:nth-child(1) { background: #f35325; }
.microsoft-logo span:nth-child(2) { background: #81bc06; }
.microsoft-logo span:nth-child(3) { background: #05a6f0; }
.microsoft-logo span:nth-child(4) { background: #ffba08; }
.login-note { margin-top: 22px; color: var(--muted); font-size: 10px; }
.login-theme-toggle { position: fixed; top: 25px; right: 28px; z-index: 10; }
.denied-title { margin: 0 0 14px; font-size: 24px; }
.secondary-login-button { padding: 12px 20px; border: 1px solid var(--border); border-radius: 11px; color: var(--text); background: var(--surface); box-shadow: var(--raised-small); text-decoration: none; }
.secondary-login-button:hover { color: var(--accent); }
.secondary-login-button:active { box-shadow: var(--recessed-small); }

/* Existing post-login entrance still dismisses without JavaScript. */
.entrance-screen { position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center; background: var(--background); pointer-events: none; animation: entranceFade .5s ease .7s forwards; }
.entrance-word { color: var(--accent); font-size: clamp(34px, 7vw, 58px); font-weight: 350; letter-spacing: 14px; text-indent: 14px; }
@keyframes entranceFade { to { opacity: 0; visibility: hidden; } }

/* Responsive layouts */
@media (max-width: 1250px) {
    .portal-layout { grid-template-columns: 205px minmax(0, 1fr); }
    .portal-main { padding: 24px; }
    .search-box { width: 180px; }
    .integration-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .metrics-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .overview-grid { grid-template-columns: 1fr; }
    .portal-header { gap: 14px; padding: 12px; }
    .header-actions { gap: 10px; }
}
@media (max-width: 980px) {
    .portal-layout { display: block; }
    .sidebar { position: static; height: auto; padding: 17px 22px; border-right: 0; border-bottom: 1px solid var(--border); box-shadow: 0 5px 14px var(--shadow-dark); }
    .brand { padding: 0 0 15px; }
    .brand-tagline, .sidebar-footer { display: none; }
    .nav-menu { flex-direction: row; flex-wrap: wrap; gap: 8px; }
    .nav-item { min-height: 42px; padding: 9px 12px; gap: 7px; font-size: 12px; }
    .nav-icon { width: 18px; font-size: 17px; }
    .portal-main { min-height: calc(100vh - 140px); }
}
@media (max-width: 640px) {
    .sidebar { padding: 16px; }
    .nav-menu { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .nav-item { justify-content: center; padding: 9px 5px; }
    .portal-main { padding: 20px 16px; }
    .portal-header { flex-wrap: wrap; gap: 15px; }
    .portal-heading { font-size: 25px; letter-spacing: 4px; }
    .header-actions { flex: 1; justify-content: flex-end; flex-wrap: wrap; gap: 10px; }
    .search-box { order: 3; width: 100%; }
    .user-information, .user-chevron { display: none; }
    .user-card > summary { min-height: 44px; padding: 4px 7px; }
    .theme-toggle { padding: 0 8px; }
    .page-content { margin-top: 28px; }
    .page-heading { flex-direction: column; gap: 12px; }
    .page-heading h1 { font-size: 27px; }
    .metrics-grid { gap: 16px; }
    .metric-card { padding: 16px; }
    .integration-grid { grid-template-columns: 1fr; }
    .panel { padding: 19px; }
    .panel-heading, .workload-row { flex-wrap: wrap; }
    .project-row > summary, .project-row[open] > summary, .project-row:focus-within > summary { padding: 18px 16px; }
    .project-name { font-size: 14px; }
    .project-body { padding: 18px 16px; }
    .setting-row { align-items: flex-start; flex-direction: column; gap: 16px; }
    .login-card { padding: 44px 24px; }
    .login-wordmark { font-size: 38px; letter-spacing: 9px; text-indent: 9px; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; }
    .entrance-screen { display: none; }
}
@media (forced-colors: active) {
    .panel, .metric-card, .project-row, .portal-header, .login-card,
    .nav-item, .badge, .theme-toggle, .theme-option, .search-box,
    .microsoft-login-button, .secondary-login-button { border: 1px solid ButtonText; box-shadow: none; }
    .nav-item.active, .theme-option[aria-pressed="true"] { outline: 2px solid Highlight; }
}

/* Neumorphism v2: consistent outline icons, typography and explicit status colors. */
:root {
    --status-good: #23643c;
    --status-good-bg: #e2eee3;
    --status-idle: #925018;
    --status-idle-bg: #f6e9db;
    --status-bad: #ab303a;
    --status-bad-bg: #f6e2e5;
}
html[data-theme="dark"] {
    --status-good: #92d5a4;
    --status-good-bg: #26392d;
    --status-idle: #f3b57a;
    --status-idle-bg: #3b2d23;
    --status-bad: #f4a1ac;
    --status-bad-bg: #3e2930;
}
body {
    font-family: "Segoe UI Variable Text", "Segoe UI", Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}
h1, h2, h3, .brand-name, .project-name {
    font-family: "Segoe UI Variable Display", "Segoe UI", Arial, sans-serif;
}
.portal-heading { font-size: 27px; font-weight: 650; letter-spacing: 5px; }
.brand-name { font-weight: 700; letter-spacing: -.65px; }
.page-heading h1 { font-size: 32px; font-weight: 700; letter-spacing: -.9px; }
.page-description, .section-note { font-size: 14px; line-height: 1.6; }
.metric-card h2 { font-size: 13px; font-weight: 600; }
.metric-value { font-size: 34px; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -.8px; }
.metric-card p { font-size: 12px; }
.panel-heading h2 { font-size: 17px; font-weight: 650; }
.workload-row { font-size: 13px; min-height: 54px; }
.panel-note { font-size: 12px; line-height: 1.6; }
.badge { font-size: 11px; font-weight: 600; line-height: 1.5; }
.project-headline { font-size: 13px; }
.user-information strong { font-size: 13px; }
.user-information small { font-size: 11px; }
.portal-icon {
    display: inline-block; width: 21px; height: 21px; flex: 0 0 21px;
    fill: none; stroke: currentColor; stroke-width: 1.7;
    stroke-linecap: round; stroke-linejoin: round; vertical-align: middle;
    pointer-events: none;
}
.nav-icon { display: inline-flex; align-items: center; justify-content: center; }
.nav-icon .portal-icon { width: 22px; height: 22px; flex-basis: 22px; }
.has-heading-icon { display: flex; align-items: center; gap: 10px; }
.has-heading-icon > .portal-icon { color: var(--accent); }
.metric-card h2.has-heading-icon { align-items: flex-start; }
.metric-card h2 .portal-icon { width: 23px; height: 23px; flex-basis: 23px; }
.workload-name { display: inline-flex; align-items: center; gap: 11px; min-width: 0; }
.workload-name > .portal-icon { width: 18px; height: 18px; flex-basis: 18px; color: var(--accent); }
.project-icon .portal-icon, .integration-icon .portal-icon { width: 25px; height: 25px; flex-basis: 25px; }
.empty-symbol .portal-icon { width: 25px; height: 25px; }
.badge.status-connected, .badge.status-idle, .badge.status-error { gap: 7px; box-shadow: none; }
.badge.status-connected { color: var(--status-good); background: var(--status-good-bg); border-color: var(--status-good); }
.badge.status-idle { color: var(--status-idle); background: var(--status-idle-bg); border-color: var(--status-idle); }
.badge.status-error { color: var(--status-bad); background: var(--status-bad-bg); border-color: var(--status-bad); }
.badge.status-connected::before, .badge.status-idle::before, .badge.status-error::before {
    content: ""; display: inline-block; width: 7px; height: 7px;
    flex: 0 0 7px; border-radius: 50%; background: currentColor;
}
@media (max-width: 640px) {
    .portal-heading { font-size: 24px; letter-spacing: 4px; }
    .page-heading h1 { font-size: 28px; }
    .panel-heading h2 { font-size: 16px; }
    .metric-value { font-size: 30px; }
    .metric-card h2.has-heading-icon { gap: 7px; }
    .metric-card h2 .portal-icon { width: 18px; height: 18px; flex-basis: 18px; }
    .metric-card h2 { font-size: 12px; }
    .nav-icon .portal-icon { width: 19px; height: 19px; flex-basis: 19px; }
}
@media (forced-colors: active) {
    .badge.status-connected, .badge.status-idle, .badge.status-error { color: CanvasText; background: Canvas; border-color: CanvasText; }
}

/* Projects v3: application-sized cards with always-visible icons and actions. */
.project-list.project-card-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    align-items: stretch;
    gap: 24px;
}
.project-card {
    min-width: 0;
    min-height: 240px;
    padding: 23px;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border);
    border-radius: 18px;
    background: var(--surface);
    box-shadow: var(--raised);
    transition: border-color .18s ease;
}
.project-card:hover, .project-card:focus-within { border-color: var(--accent); }
.project-card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 20px; }
.project-card .project-icon { display: grid; }
.project-card-top .badge { flex-shrink: 1; white-space: normal; text-align: right; }
.project-card h2 { margin: 0 0 9px; font-size: 17px; font-weight: 650; line-height: 1.4; }
.project-card-description { margin: 0 0 22px; color: var(--muted); font-size: 13px; line-height: 1.6; }
.project-card-action {
    display: inline-flex; align-items: center; justify-content: center; gap: 10px;
    align-self: flex-start; margin-top: auto; min-height: 43px;
    padding: 10px 14px; border: 1px solid var(--border); border-radius: 10px;
    color: var(--accent); background: var(--surface); box-shadow: var(--raised-small);
    text-decoration: none; font-size: 13px; font-weight: 600;
}
.project-card-action:hover { border-color: var(--accent); }
.project-card-action:active { box-shadow: var(--recessed-small); }
.project-card-action .portal-icon { width: 17px; height: 17px; flex-basis: 17px; }
.project-board-back { display: inline-flex; margin-bottom: 22px; gap: 8px; align-items: center; font-size: 13px; text-decoration: none; }
.project-board-back:hover { text-decoration: underline; }
.project-board .project-body { border: 0; padding: 0; }
.project-board .project-body .table-scroll { margin-top: 18px; }
@media (max-width: 1250px) {
    .project-list.project-card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
    .project-list.project-card-grid { grid-template-columns: 1fr; }
    .project-card { min-height: 225px; padding: 19px; }
    .project-card h2 { font-size: 16px; }
}
@media (forced-colors: active) {
    .project-card, .project-card-action { border: 1px solid ButtonText; box-shadow: none; }
}

/* Compact Settings. All overrides are scoped to Settings only. */
#page-settings .page-heading { margin-bottom: 16px; }
#page-settings .panel { padding: 16px 18px; border-radius: 14px; }
#page-settings .section-spacer { margin-top: 16px; }
#page-settings h2 { font-size: 15px; margin-bottom: 8px; }
#page-settings .panel-heading { margin-bottom: 10px; gap: 12px; }
#page-settings .panel-heading h2 { margin-bottom: 0; }
#page-settings .muted, #page-settings .panel-note { font-size: 12px; line-height: 1.45; }
#page-settings .panel > .muted { margin-bottom: 12px; }
#page-settings .setting-row { gap: 14px; }
#page-settings .setting-row p { margin-bottom: 0; }
#page-settings #themeStatus { margin-top: 6px; margin-bottom: 0; font-size: 11px; }
#page-settings .theme-options { gap: 8px; }
#page-settings .theme-option { min-height: 34px; padding: 6px 12px; font-size: 12px; }
#page-settings #settingsMessage { padding: 8px 12px; margin-bottom: 12px; font-size: 12px; border-radius: 8px; }
#page-settings #settingsMessage[data-error="true"] { border-color: var(--status-bad); color: var(--status-bad); }
#page-settings .settings-form { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr) 130px auto; align-items: end; gap: 10px; }
#page-settings .settings-form label, #page-settings .route-search { display: flex; flex-direction: column; gap: 4px; min-width: 0; font-size: 11px; color: var(--muted); }
#page-settings .settings-form input:not([type="checkbox"]),
#page-settings .settings-form select, #page-settings .routing-table-scroll select,
#page-settings .route-search input {
    width: 100%; min-width: 0; min-height: 34px; padding: 6px 9px;
    border: 1px solid var(--border); border-radius: 7px;
    color: var(--text); background: var(--surface); box-shadow: var(--recessed-small); font: inherit; font-size: 12px;
}
#page-settings .settings-button {
    min-height: 34px; padding: 6px 12px; border: 1px solid var(--border); border-radius: 8px;
    color: var(--accent); background: var(--surface); box-shadow: var(--raised-small);
    cursor: pointer; font: inherit; font-size: 12px; white-space: nowrap;
}
#page-settings .settings-button:hover { border-color: var(--accent); }
#page-settings .settings-button:disabled { cursor: default; opacity: .6; }
#page-settings #managedProjects { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
#page-settings .managed-project { min-width: 0; margin: 0; padding: 12px; border: 1px solid var(--border); border-radius: 10px; }
#page-settings .managed-project h3 { font-size: 13px; margin-bottom: 10px; overflow-wrap: anywhere; }
#page-settings .managed-project .settings-form { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; gap: 8px; }
#page-settings .managed-project .settings-form > label:nth-child(1) { grid-column: 1 / 2; }
#page-settings .managed-project .settings-form > label:nth-child(2) { grid-column: 2 / 4; }
#page-settings .settings-form label.settings-check { flex-direction: row; align-items: center; gap: 7px; min-height: 34px; color: var(--text); }
#page-settings .settings-check input, #page-settings .routing-table-scroll input[type="checkbox"] { accent-color: var(--accent); width: 17px; height: 17px; margin: 0; box-shadow: none; cursor: pointer; }
#page-settings .route-search { max-width: 340px; }
#page-settings .routing-table-scroll { max-height: 340px; margin-top: 10px; }
#page-settings .routing-table-scroll table { font-size: 12px; }
#page-settings .routing-table-scroll th, #page-settings .routing-table-scroll td { padding: 7px 10px; vertical-align: middle; }
#page-settings .routing-table-scroll th { position: sticky; top: 0; background: var(--surface); z-index: 1; }
#page-settings .routing-table-scroll th:first-child, #page-settings .routing-table-scroll td:first-child { width: 70px; text-align: center; }
#page-settings .routing-table-scroll select { width: 220px; min-height: 30px; padding: 4px 8px; }
#page-settings #routeCount { margin: 10px 0; font-size: 11px; }
@media (max-width: 1200px) {
    #page-settings #managedProjects { grid-template-columns: 1fr; }
    #page-settings #createProject { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
    #page-settings #createProject > button { justify-self: end; }
}
@media (max-width: 640px) {
    #page-settings .panel { padding: 14px; }
    #page-settings .setting-row { gap: 10px; }
    #page-settings #createProject { grid-template-columns: 1fr; }
    #page-settings #createProject > button { justify-self: start; }
    #page-settings .managed-project .settings-form { grid-template-columns: minmax(0, 1fr) auto; }
    #page-settings .managed-project .settings-form > label:nth-child(1),
    #page-settings .managed-project .settings-form > label:nth-child(2) { grid-column: 1 / -1; }
    #page-settings .managed-project .settings-form > button { grid-column: 1 / -1; justify-self: start; }
    #page-settings .settings-button, #page-settings .theme-option { min-height: 40px; }
}
