/* KAIROS design tokens and app shell (shared with Hermes, the INECTIO design baseline) */
[hidden] { display: none !important; }
:root {
    --navy-950: #1b1b1b;
    --navy-900: #2f2f2f;
    --navy-800: #3b3b3b;
    --navy-700: #535353;
    --accent: #cd2122;
    --accent-hover: #ac1c1d;
    --accent-soft: #fbe9e9;
    --gold: #e9a93a;
    --ink: #262626;
    --ink-2: #535353;
    --ink-3: #6c6c6c;
    --line: #e2e2e2;
    --line-2: #f0f0f0;
    --surface: #ffffff;
    --canvas: #f7f7f7;
    --green: #16794c;
    --green-bg: #e3f4ea;
    --red: #b42318;
    --red-bg: #fde8e6;
    --amber: #9a5b00;
    --amber-bg: #fff3d6;
    --blue: #1d4ed8;
    --blue-bg: #e6edff;
    --grey: #4b5565;
    --grey-bg: #eef0f4;
    --radius: 10px;
    --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .06);
    --shadow-lg: 0 10px 30px rgba(16, 24, 40, .12);
    --font: "Open Sans", "Segoe UI", Helvetica, Arial, sans-serif;
    --font-heading: "Montserrat", "Segoe UI", Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--canvas); color: var(--ink); font-family: var(--font); font-size: 14px; }
.dx-widget, .dx-widget input, .dx-widget textarea, .dx-datagrid, .dx-overlay-wrapper { font-family: var(--font) !important; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; color: var(--ink); letter-spacing: -.02em; font-family: var(--font-heading); }
.muted { color: var(--ink-3); }
.small { font-size: 12px; }
.nowrap { white-space: nowrap; }
.mono { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 12px; }

/* Shell */
.app { display: grid; grid-template-columns: 252px 1fr; min-height: 100vh; }
.sidebar { background: linear-gradient(180deg, var(--navy-950), var(--navy-900)); color: #d4d4d4; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; border-right: 1px solid #333; }
.brand { display: flex; gap: 11px; align-items: center; padding: 18px 18px 14px; color: #fff; text-decoration: none !important; }
.brand strong { display: block; font-size: 18px; letter-spacing: .01em; font-family: var(--font-heading); }
.brand small { display: block; font-size: 11px; color: #b1b1b1; margin-top: 1px; }
.nav { display: flex; flex-direction: column; padding: 6px 10px 16px; gap: 1px; }
.nav-group { font-size: 10.5px; text-transform: uppercase; letter-spacing: .09em; color: #a2a2a2; margin: 16px 10px 6px; font-weight: 600; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; color: #d4d4d4; font-weight: 500; text-decoration: none !important; }
.nav a .dx-icon { font-size: 17px; color: #aaa; width: 18px; }
.nav a:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.nav a.active { background: rgba(205, 33, 34, .2); color: #fff; box-shadow: inset 3px 0 0 var(--accent); }
.nav a.active .dx-icon { color: #f17475; }
.sidebar-foot { margin-top: auto; padding: 14px 18px; font-size: 11px; color: #999; }

.main { display: flex; flex-direction: column; min-width: 0; }
.topbar { position: sticky; top: 0; z-index: 900; display: flex; align-items: center; gap: 14px; padding: 10px 28px; background: rgba(255, 255, 255, .92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.menu-toggle { display: none; }
.search { position: relative; flex: 1; max-width: 620px; }
.search > .dx-icon { position: absolute; left: 11px; top: 9px; color: var(--ink-3); font-size: 16px; }
.search input { width: 100%; height: 36px; border: 1px solid var(--line); border-radius: 9px; padding: 0 12px 0 34px; font: inherit; background: var(--canvas); color: var(--ink); outline: none; }
.search input:focus { border-color: var(--accent); background: #fff; box-shadow: 0 0 0 3px var(--accent-soft); }
.search-results { position: absolute; top: 42px; left: 0; right: 0; background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow-lg); max-height: 70vh; overflow: auto; padding: 6px; }
.search-results .grp { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); padding: 8px 10px 4px; }
.search-results a { display: flex; justify-content: space-between; gap: 10px; padding: 7px 10px; border-radius: 7px; color: var(--ink); text-decoration: none; }
.search-results a:hover, .search-results a.sel { background: var(--accent-soft); }
.search-results a small { color: var(--ink-3); display: block; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.icon-btn { position: relative; border: 0; background: transparent; width: 36px; height: 36px; border-radius: 9px; cursor: pointer; color: var(--ink-2); }
.icon-btn:hover { background: var(--line-2); }
.icon-btn .dx-icon { font-size: 19px; }
.icon-btn .dot { position: absolute; top: 6px; right: 6px; min-width: 16px; height: 16px; border-radius: 8px; background: var(--red); color: #fff; font-size: 10px; line-height: 16px; padding: 0 4px; font-weight: 700; }
.user-chip { display: flex; align-items: center; gap: 8px; padding: 4px 10px 4px 4px; border-radius: 20px; cursor: pointer; }
.user-chip:hover { background: var(--line-2); }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: linear-gradient(135deg, var(--navy-700), var(--accent)); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; flex: none; }
.user-name { font-weight: 500; color: var(--ink-2); }
.page { padding: 24px 28px 48px; max-width: 1640px; width: 100%; }

/* Page header */
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head h1 { font-size: 24px; font-weight: 700; }
.page-head .sub { color: var(--ink-2); margin-top: 4px; max-width: 900px; }
.crumbs { font-size: 12px; color: var(--ink-3); margin-bottom: 6px; }
.crumbs a { color: var(--ink-3); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* Cards, grids */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line-2); }
.card-head h2, .card-head h3 { font-size: 15px; font-weight: 600; }
.card-head .hint { font-size: 12px; color: var(--ink-3); }
.card-body { padding: 16px 18px; }
.card-body.flush { padding: 0; }
.stack { display: flex; flex-direction: column; gap: 18px; }
.grid { display: grid; gap: 18px; }
.grid > *, .stack > *, .editor-shell > * { min-width: 0; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-main { grid-template-columns: minmax(0, 2fr) minmax(300px, 1fr); }
.span2 { grid-column: span 2; }

/* KPI tiles */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 18px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); text-decoration: none !important; color: inherit; display: block; }
a.kpi:hover { border-color: #e4a1a2; }
.kpi .label { font-size: 12px; color: var(--ink-2); font-weight: 500; }
.kpi .value { font-size: 26px; font-weight: 700; margin-top: 4px; color: var(--ink); font-variant-numeric: tabular-nums; }
.kpi .foot { font-size: 11.5px; color: var(--ink-3); margin-top: 2px; }
.kpi.warn .value { color: var(--amber); }
.kpi.bad .value { color: var(--red); }
.kpi.good .value { color: var(--green); }

/* Badges & chips */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 600; white-space: nowrap; line-height: 18px; }
.badge-green { background: var(--green-bg); color: var(--green); }
.badge-red { background: var(--red-bg); color: var(--red); }
.badge-amber { background: var(--amber-bg); color: var(--amber); }
.badge-blue { background: var(--blue-bg); color: var(--blue); }
.badge-grey { background: var(--grey-bg); color: var(--grey); }
.basis { font-size: 11px; color: var(--ink-3); border: 1px solid var(--line); border-radius: 4px; padding: 0 4px; margin-left: 2px; white-space: nowrap; }
.basis-unknown { color: var(--amber); border-color: #f2d9a6; }
.chip { display: inline-block; background: var(--line-2); border-radius: 6px; padding: 1px 7px; font-size: 12px; color: var(--ink-2); margin: 1px 2px 1px 0; }
.score { display: inline-flex; align-items: center; justify-content: center; min-width: 38px; height: 22px; border-radius: 6px; font-weight: 700; font-size: 12px; font-variant-numeric: tabular-nums; }
.score-hi { background: var(--green-bg); color: var(--green); }
.score-mid { background: var(--amber-bg); color: var(--amber); }
.score-lo { background: var(--red-bg); color: var(--red); }
.score-none { background: var(--grey-bg); color: var(--ink-3); }

/* Definition lists */
.facts { display: grid; grid-template-columns: 170px 1fr; gap: 9px 16px; margin: 0; }
.facts dt { color: var(--ink-3); font-size: 12.5px; padding-top: 1px; }
.facts dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }

/* Lists */
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; gap: 12px; align-items: flex-start; padding: 11px 18px; border-bottom: 1px solid var(--line-2); }
.list li:last-child { border-bottom: 0; }
.list .grow { flex: 1; min-width: 0; }
.list .title { font-weight: 600; color: var(--ink); display: block; overflow: hidden; text-overflow: ellipsis; }
.list .meta { font-size: 12px; color: var(--ink-3); margin-top: 2px; }
.empty { padding: 26px 18px; text-align: center; color: var(--ink-3); }
.when { font-size: 12px; font-weight: 600; white-space: nowrap; }
.when.urgent { color: var(--red); }
.when.soon { color: var(--amber); }

/* Tabs */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; }
.tabs a { padding: 10px 14px; color: var(--ink-2); font-weight: 500; border-bottom: 2px solid transparent; white-space: nowrap; text-decoration: none !important; }
.tabs a:hover { color: var(--ink); }
.tabs a.active { color: var(--accent); border-bottom-color: var(--accent); }
.tabs a .count { font-size: 11px; background: var(--line-2); border-radius: 8px; padding: 0 6px; margin-left: 4px; color: var(--ink-3); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* Alerts */
.alert { border-radius: 9px; padding: 11px 14px; display: flex; gap: 10px; align-items: flex-start; margin-bottom: 14px; font-size: 13.5px; }
.alert .dx-icon { font-size: 17px; margin-top: 1px; }
.alert-warn { background: var(--amber-bg); color: #6b4000; border: 1px solid #f3dca5; }
.alert-bad { background: var(--red-bg); color: #7a1a12; border: 1px solid #f6c7c2; }
.alert-good { background: var(--green-bg); color: #0f5134; border: 1px solid #bfe5cf; }
.alert-info { background: var(--blue-bg); color: #1e3a8a; border: 1px solid #cad8ff; }
.alert ul { margin: 4px 0 0 18px; padding: 0; }

/* Timeline */
.timeline { list-style: none; margin: 0; padding: 4px 18px 10px; }
.timeline li { position: relative; padding: 8px 0 8px 22px; border-left: 2px solid var(--line); margin-left: 6px; }
.timeline li::before { content: ""; position: absolute; left: -6px; top: 13px; width: 10px; height: 10px; border-radius: 50%; background: #fff; border: 2px solid var(--accent); }
.timeline li.ev-decision::before { border-color: var(--green); background: var(--green); }
.timeline li.ev-amend::before { border-color: var(--amber); background: var(--amber); }
.timeline .t-meta { font-size: 11.5px; color: var(--ink-3); }

/* Kanban board */
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(250px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 8px; }
.lane { background: #eaeef5; border-radius: 10px; padding: 8px; min-height: 200px; display: flex; flex-direction: column; }
.lane-head { display: flex; justify-content: space-between; align-items: center; padding: 4px 6px 8px; font-weight: 600; font-size: 13px; }
.lane-head .n { background: #fff; border-radius: 10px; padding: 0 8px; font-size: 12px; color: var(--ink-2); }
.lane-body { flex: 1; display: flex; flex-direction: column; gap: 8px; min-height: 60px; }
.tcard { background: #fff; border-radius: 8px; padding: 10px 11px; box-shadow: var(--shadow); border: 1px solid var(--line); cursor: grab; }
.tcard:hover { border-color: #c4cfe8; }
.tcard .ref { font-size: 11px; color: var(--ink-3); font-weight: 600; }
.tcard .ttl { font-weight: 600; margin: 3px 0 6px; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.tcard .row { display: flex; justify-content: space-between; align-items: center; gap: 6px; font-size: 12px; color: var(--ink-2); }

/* Scorecard */
.criterion { display: grid; grid-template-columns: minmax(220px, 1.1fr) 240px minmax(200px, 1.5fr); gap: 14px; align-items: start; padding: 12px 0; border-bottom: 1px solid var(--line-2); }
.criterion:last-child { border-bottom: 0; }
.criterion .name { font-weight: 600; }
.criterion .guide { font-size: 12px; color: var(--ink-3); margin-top: 2px; }
.rating { display: flex; gap: 4px; }
.rating button { width: 34px; height: 32px; border-radius: 7px; border: 1px solid var(--line); background: #fff; cursor: pointer; font-weight: 600; color: var(--ink-2); }
.rating button.on { background: var(--accent); color: #fff; border-color: var(--accent); }
.rating button:hover { border-color: var(--accent); }
.scorebar { height: 10px; border-radius: 5px; background: var(--line-2); overflow: hidden; position: relative; }
.scorebar > span { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), #e57576); border-radius: 5px; }
.scorebar .mark { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--ink-3); }

/* Forms */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 18px; }
.form-grid .full { grid-column: 1 / -1; }
label.lbl { display: block; font-size: 12.5px; font-weight: 600; color: var(--ink-2); margin-bottom: 5px; }
.help { font-size: 12px; color: var(--ink-3); margin-top: 4px; }
input.inp, select.inp, textarea.inp { width: 100%; border: 1px solid #d5dbe6; border-radius: 8px; padding: 8px 10px; font: inherit; color: var(--ink); background: #fff; }
input.inp:focus, select.inp:focus, textarea.inp:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.btn { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 14px; border-radius: 8px; border: 1px solid #d0d7e4; background: #fff; color: var(--ink); font: inherit; font-weight: 600; cursor: pointer; text-decoration: none !important; white-space: nowrap; }
.btn:hover { background: var(--line-2); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-danger { color: var(--red); border-color: #efc2bd; }
.btn-sm { height: 28px; padding: 0 10px; font-size: 12.5px; }
.btn .dx-icon { font-size: 15px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

/* Progress */
.progress { height: 8px; background: var(--line-2); border-radius: 4px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--green); }
.progress.amber > span { background: var(--gold); }

/* Editor */
.editor-shell { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 18px; }
.section-list a { display: flex; justify-content: space-between; gap: 8px; padding: 9px 14px; border-bottom: 1px solid var(--line-2); color: var(--ink); text-decoration: none !important; }
.section-list a.active { background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); }
.section-list a small { color: var(--ink-3); }
.ai-panel { background: linear-gradient(180deg, #fff7f7, #fff); border: 1px dashed #e3b4b4; border-radius: 10px; padding: 14px; }
.ai-tag { display: inline-flex; gap: 4px; align-items: center; font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: #9f2021; background: var(--accent-soft); border-radius: 5px; padding: 2px 6px; }

/* DevExtreme fine-tuning */
.dx-datagrid-headers { color: var(--ink-2); font-weight: 600; font-size: 12.5px; }
.dx-datagrid .dx-row > td { padding-top: 9px; padding-bottom: 9px; }
.card .dx-datagrid { border-radius: 0 0 var(--radius) var(--radius); }
.dx-datagrid-rowsview .dx-row.dx-data-row:hover { background: #f7f9fd; }
.dx-button-mode-contained.dx-button-default { background-color: var(--accent); }
.dx-popup-title.dx-toolbar { padding: 10px 18px; }
.dx-toast-content { border-radius: 9px; }
.dx-texteditor.dx-editor-outlined { border-radius: 8px; }
.dx-htmleditor { border-radius: 8px; }
.dx-htmleditor-content { min-height: 380px; font-size: 14.5px; line-height: 1.6; }
.notif-list { max-height: 460px; overflow: auto; width: 380px; }
.notif-list a { display: block; padding: 10px 12px; border-bottom: 1px solid var(--line-2); color: var(--ink); text-decoration: none; }
.notif-list a.unread { background: #f5f8ff; }
.notif-list a:hover { background: var(--accent-soft); }
.notif-list .n-title { font-weight: 600; font-size: 13px; }
.notif-list .n-body { font-size: 12px; color: var(--ink-2); margin-top: 2px; }
.notif-list .n-time { font-size: 11px; color: var(--ink-3); margin-top: 3px; }
.sev-Critical .n-title { color: var(--red); }
.sev-Warning .n-title { color: var(--amber); }

/* Auth pages */
.auth-page { background: #111113; color: #f2f0ef; }
.auth {
    position: relative;
    isolation: isolate;
    display: grid;
    place-items: center;
    min-height: 100vh;
    min-height: 100svh;
    padding: 40px 24px;
    overflow: hidden;
    background: radial-gradient(ellipse at 50% 110%, rgba(164, 39, 42, .16), transparent 55%),
        radial-gradient(ellipse at 50% 0, rgba(255, 255, 255, .035), transparent 60%);
}
.auth::before {
    content: "";
    position: absolute;
    inset: 24px;
    z-index: -1;
    border: 1px solid rgba(255, 255, 255, .045);
    border-radius: 16px;
    pointer-events: none;
}
.auth-orbit {
    position: absolute;
    z-index: -1;
    width: 820px;
    height: 820px;
    border: 1px solid rgba(255, 255, 255, .035);
    border-radius: 50%;
    pointer-events: none;
}
.auth-orbit::before, .auth-orbit::after {
    content: "";
    position: absolute;
    inset: 100px;
    border: 1px solid rgba(255, 255, 255, .025);
    border-radius: 50%;
}
.auth-orbit::after { inset: -100px; }
.auth-box {
    position: relative;
    width: 100%;
    max-width: 400px;
    padding: 52px 40px 40px;
    border: 1px solid rgba(255, 255, 255, .09);
    border-radius: 24px;
    background: linear-gradient(155deg, rgba(255, 255, 255, .045), transparent 55%), #19191c;
    box-shadow: 0 32px 100px rgba(0, 0, 0, .35), inset 0 1px rgba(255, 255, 255, .025);
}
.auth-box::before {
    content: "";
    position: absolute;
    top: -1px;
    left: 25%;
    right: 25%;
    height: 1px;
    background: linear-gradient(90deg, transparent, #d65859, transparent);
}
.auth-identity { display: grid; justify-items: center; gap: 26px; margin-bottom: 44px; }
.auth-logo { display: block; border-radius: 19px; box-shadow: 0 8px 32px rgba(0, 0, 0, .2), 0 0 50px rgba(205, 33, 34, .09); }
.auth-label {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #aaa5a5;
    font-family: var(--font);
    font-size: 10px;
    font-weight: 500;
    line-height: 1.6;
    letter-spacing: .2em;
    text-transform: uppercase;
}
.auth-label svg { flex: none; color: #cc7778; }
.auth-box h2 { color: #f2f0ef; font-size: 24px; line-height: 1.3; }
.auth-eyebrow { display: block; color: #cc7778; font-size: 10px; letter-spacing: .15em; margin-bottom: 16px; }
.auth-intro { color: #bcb7b7; line-height: 1.75; margin: 14px 0 24px; }
.auth-content a:not(.btn) { color: #edaaaa; }
.btn-google {
    width: 100%;
    min-height: 52px;
    justify-content: center;
    gap: 12px;
    padding: 14px 18px;
    border: 1px solid #eeebea;
    border-radius: 10px;
    background: #f5f3f2;
    color: #262326;
    font-family: var(--font);
    font-size: 13px;
    font-weight: 600;
    box-shadow: 0 2px 6px rgba(0, 0, 0, .12);
    transition: background .2s, box-shadow .2s, transform .2s;
}
.btn-google svg { flex: none; }
.btn-google:hover:not(:disabled) { background: #fff; border-color: #fff; box-shadow: 0 4px 20px rgba(0, 0, 0, .2); transform: translateY(-1px); }
.btn-google:active:not(:disabled) { transform: translateY(0); }
.btn-google:focus-visible { outline: 2px solid #edaaaa; outline-offset: 5px; }
.btn-google:disabled { opacity: .5; cursor: not-allowed; }
.auth-note { margin: 20px 0 0; color: #bcb7b7; font-size: 12px; line-height: 1.7; text-align: center; }
.auth-error { margin: 0 0 20px; padding: 12px; border: 1px solid rgba(237, 170, 170, .2); border-radius: 8px; background: rgba(205, 33, 34, .08); color: #edaaaa; }

@media (max-width: 480px) {
    .auth { padding: 32px 24px; }
    .auth::before { inset: 12px; }
    .auth-box { padding: 44px 28px 32px; border-radius: 20px; }
}
@media (prefers-reduced-motion: reduce) {
    .btn-google { transition: none; }
    .btn-google:hover:not(:disabled) { transform: none; }
}

@media (max-width: 1200px) {
    .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .g-main { grid-template-columns: minmax(0, 1fr); }
    .criterion { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
    .app { grid-template-columns: 1fr; }
    .sidebar { position: fixed; z-index: 1000; width: 260px; transform: translateX(-100%); transition: transform .2s; }
    .app.nav-open .sidebar { transform: none; box-shadow: var(--shadow-lg); }
    .menu-toggle { display: inline-block; }
    .page { padding: 18px 16px 40px; }
    .topbar { padding: 10px 16px; }
    .g2, .g3, .g4 { grid-template-columns: minmax(0, 1fr); }
    .span2 { grid-column: auto; }
    .form-grid { grid-template-columns: 1fr; }
    .facts { grid-template-columns: 1fr; gap: 2px 0; }
    .facts dd { margin-bottom: 8px; }
    .editor-shell { grid-template-columns: minmax(0, 1fr); }
    .user-name { display: none; }
}

/* Win over the DevExtreme typography rules (".dx-theme-*-typography a", headings) */
.dx-viewport h1, .dx-viewport h2, .dx-viewport h3, .dx-viewport h4 { margin: 0; color: var(--ink); line-height: 1.25; }
.dx-viewport a { color: var(--accent); }
.dx-viewport .btn { color: var(--ink); }
.dx-viewport .btn-primary { color: #fff; }
.dx-viewport .brand, .dx-viewport .brand strong { color: #fff; }
.dx-viewport .nav a { color: #d4d4d4; }
.dx-viewport .nav a:hover, .dx-viewport .nav a.active { color: #fff; }
.dx-viewport .tabs a { color: var(--ink-2); }
.dx-viewport .tabs a.active { color: var(--accent); }
.dx-viewport a.kpi, .dx-viewport .search-results a, .dx-viewport .notif-list a, .dx-viewport .section-list a, .dx-viewport a.card { color: var(--ink); }
.dx-viewport .list a.title { color: var(--ink); }
.dx-viewport .list a.title:hover { color: var(--accent); }
.dx-viewport, .dx-viewport .dx-widget { font-family: var(--font); }

/* INECTIO accent for the bundled Fluent controls. Keep semantic success/warning colours. */
.dx-color-accent, .dx-theme-accent-as-text-color, .dx-link { color: var(--accent); }
.dx-theme-accent-as-background-color { background-color: var(--accent); }
.dx-button-mode-contained.dx-button-default.dx-state-hover, .dx-button-mode-contained.dx-button-default.dx-state-focused { background-color: var(--accent-hover); }
.dx-texteditor.dx-editor-outlined.dx-state-focused { border-color: var(--accent); }
.dx-checkbox-checked .dx-checkbox-icon, .dx-checkbox-indeterminate .dx-checkbox-icon { background-color: var(--accent); border-color: var(--accent); color: #fff; }
.dx-radiobutton-checked .dx-radiobutton-icon-dot { background-color: var(--accent); }
.dx-datagrid-rowsview .dx-selection.dx-row:not(.dx-row-focused) > td, .dx-list-item-selected { background-color: var(--accent-soft); color: var(--ink); }
.dx-pager .dx-pages .dx-selection, .dx-pager .dx-page-sizes .dx-selection { background-color: var(--accent-soft); color: var(--accent); }
.dx-tab-selected .dx-tab-text, .dx-tabs .dx-tab-selected .dx-icon { color: var(--accent); }

/* ---------- KAIROS additions ---------- */
.key { font-family: Consolas, "SFMono-Regular", Menlo, monospace; font-size: 12.5px; font-weight: 600; color: var(--ink-2); white-space: nowrap; }
a.key { color: var(--ink-2); }
a.key:hover { color: var(--accent); }

/* Workflow lozenges: category colour plus text, never colour alone. */
.status { display: inline-block; border-radius: 4px; padding: 1px 7px; font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .02em; white-space: nowrap; border: 1px solid transparent; }
.st-todo { background: var(--grey-bg); color: var(--grey); border-color: #dde1e8; }
.st-progress { background: var(--blue-bg); color: var(--blue); border-color: #cdd9ff; }
.st-qa { background: #f1e8ff; color: #6b2fbf; border-color: #e1d0fb; }
.st-done { background: var(--green-bg); color: var(--green); border-color: #c9ead7; }

.wi-type { display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px; border-radius: 4px; font-size: 10.5px; font-weight: 800; color: #fff; flex: none; vertical-align: -3px; }
.wi-Epic { background: #7a3fd1; }
.wi-Story { background: #2e9e5b; }
.wi-Task { background: #2f6fd6; }
.wi-Defect { background: #cd2122; }
.wi-Subtask { background: #5aa0e6; }
.wi-Spike { background: #6c6c6c; }
.wi-Change { background: #d98a00; }

.prio { display: inline-block; width: 14px; text-align: center; font-weight: 800; }
.prio-Highest, .prio-High { color: var(--red); }
.prio-Medium { color: var(--amber); }
.prio-Low, .prio-Lowest { color: var(--blue); }

.blocked-flag { color: var(--red); font-weight: 700; font-size: 12px; }
.sync-flag { font-size: 11.5px; border-radius: 6px; padding: 1px 6px; background: var(--amber-bg); color: var(--amber); white-space: nowrap; }

/* Project header */
.project-head { display: flex; align-items: center; gap: 14px; margin-bottom: 6px; flex-wrap: wrap; }
.project-avatar { width: 40px; height: 40px; border-radius: 9px; background: var(--navy-900); color: #fff; display: flex; align-items: center; justify-content: center; font-family: var(--font-heading); font-weight: 700; font-size: 14px; flex: none; }
.project-head h1 { font-size: 22px; }
.project-head .meta { color: var(--ink-3); font-size: 12.5px; }

/* Backlog */
.sprint-box { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 14px; box-shadow: var(--shadow); }
.sprint-box.active { border-color: #b9c9f5; }
.sprint-head { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--line-2); flex-wrap: wrap; }
.sprint-head h3 { font-size: 14px; font-weight: 700; }
.sprint-head .dates { color: var(--ink-3); font-size: 12px; }
.sprint-head .grow { flex: 1; }
.bl-list { min-height: 38px; padding: 4px 0; }
.bl-row { display: grid; grid-template-columns: 22px 88px minmax(0, 1fr) auto 120px 46px 22px; align-items: center; gap: 10px; padding: 7px 14px; border-bottom: 1px solid var(--line-2); background: #fff; cursor: grab; }
.bl-row:last-child { border-bottom: 0; }
.bl-row:hover { background: #fafbfd; }
.bl-row:focus { outline: 2px solid var(--accent); outline-offset: -2px; }
.bl-row .sum { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bl-row .epic { font-size: 11px; color: #7a3fd1; background: #f1e8ff; border-radius: 4px; padding: 0 6px; white-space: nowrap; max-width: 180px; overflow: hidden; text-overflow: ellipsis; }
.bl-row .pts { text-align: center; background: var(--line-2); border-radius: 10px; font-size: 12px; padding: 0 6px; }
.bl-empty { padding: 14px; color: var(--ink-3); font-size: 12.5px; text-align: center; border: 1px dashed var(--line); margin: 8px 14px; border-radius: 8px; }

/* Board */
.board.kanban { grid-auto-columns: minmax(220px, 1fr); }
.tcard .key-row { display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--ink-3); font-weight: 600; }
.tcard.blocked { border-left: 3px solid var(--red); }
.tcard:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

/* Readiness gates */
.gates { list-style: none; margin: 0; padding: 0; }
.gates li { display: flex; gap: 12px; padding: 11px 18px; border-bottom: 1px solid var(--line-2); align-items: flex-start; }
.gates li:last-child { border-bottom: 0; }
.gate-icon { width: 22px; height: 22px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 13px; flex: none; margin-top: 1px; }
.gate-pass .gate-icon { background: var(--green-bg); color: var(--green); }
.gate-fail .gate-icon { background: var(--red-bg); color: var(--red); }
.gate-exc .gate-icon { background: var(--amber-bg); color: var(--amber); }
.gates .gname { font-weight: 600; }
.gates .gdetail { color: var(--ink-2); font-size: 12.5px; }
.gates .gowner { margin-left: auto; font-size: 11.5px; color: var(--ink-3); white-space: nowrap; }
.readiness { display: inline-flex; align-items: center; gap: 8px; font-family: var(--font-heading); font-weight: 700; font-size: 15px; border-radius: 8px; padding: 6px 12px; }
.readiness.r-Ready { background: var(--green-bg); color: var(--green); }
.readiness.r-ReadyWithExceptions { background: var(--amber-bg); color: var(--amber); }
.readiness.r-Blocked { background: var(--red-bg); color: var(--red); }

/* Metric tiles */
.metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.metric { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; background: #fff; }
.metric .label { font-size: 12px; color: var(--ink-2); }
.metric .value { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.metric .def { font-size: 11px; color: var(--ink-3); margin-top: 2px; }
.bar { display: flex; height: 8px; border-radius: 6px; overflow: hidden; background: var(--line-2); margin-top: 10px; }
.bar > span { display: block; height: 100%; }
.bar .b-pass { background: #2e9e5b; }
.bar .b-fail { background: var(--red); }
.bar .b-block { background: #d98a00; }
.bar .b-prog { background: var(--blue); }

/* Test steps and player */
.steps { width: 100%; border-collapse: collapse; }
.steps th { text-align: left; font-size: 12px; color: var(--ink-3); font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.steps td { padding: 9px 10px; border-bottom: 1px solid var(--line-2); vertical-align: top; }
.steps td.n { width: 34px; color: var(--ink-3); font-weight: 700; }
.steps textarea.inp { min-height: 54px; }
.step-actions { display: flex; gap: 4px; flex-wrap: wrap; }
.step-actions button { border: 1px solid var(--line); background: #fff; border-radius: 6px; padding: 4px 9px; font-size: 12px; font-weight: 600; cursor: pointer; color: var(--ink-2); }
.step-actions button:hover { border-color: #b8c2d4; }
.step-actions button.on.s-Passed { background: var(--green-bg); color: var(--green); border-color: #a9dcbf; }
.step-actions button.on.s-Failed { background: var(--red-bg); color: var(--red); border-color: #f2b8b1; }
.step-actions button.on.s-Blocked { background: var(--amber-bg); color: var(--amber); border-color: #f3d48f; }
.step-actions button.on.s-Skipped { background: var(--grey-bg); color: var(--grey); border-color: #cfd5df; }
.version-pill { display: inline-block; border-radius: 10px; padding: 0 8px; font-size: 12px; font-weight: 700; background: var(--line-2); color: var(--ink-2); }

.inline-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.inline-form .inp { width: auto; flex: 1; min-width: 160px; }
.rich { line-height: 1.55; overflow-wrap: anywhere; }
.rich ul, .rich ol { padding-left: 20px; margin: 6px 0; }
.rich p { margin: 0 0 8px; }
.toolbar-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.select-inline { border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; background: #fff; font: inherit; }
.conflict-vals { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 8px 0; }
.conflict-vals div { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; background: #fff; overflow-wrap: anywhere; }
.conflict-vals .lbl2 { font-size: 11px; color: var(--ink-3); font-weight: 700; text-transform: uppercase; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.auth-content .btn:not(.btn-google):not(.btn-primary) { background: transparent; color: #e8e8e8; border-color: rgba(255, 255, 255, .25); }
.btn-block { width: 100%; justify-content: center; }
.auth-content .field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; text-align: left; }
.auth-content .field > label { font-size: 12.5px; font-weight: 600; color: #cfcfcf; }
.auth-content .inp { background: #222226; border-color: #3a3a40; color: #f2f0ef; min-height: 40px; }
.auth-content .inp:focus { border-color: #d65859; box-shadow: 0 0 0 3px rgba(205, 33, 34, .25); }
.auth-content .inp:disabled { opacity: .7; }
.auth-content .btn-primary { height: 42px; margin-top: 4px; }
.auth-content h2 { color: #f2f0ef; font-size: 18px; margin-bottom: 8px; }
.auth-sep { display: flex; align-items: center; gap: 12px; color: #8a8a8a; font-size: 11.5px; text-transform: uppercase; letter-spacing: .1em; margin: 22px 0 16px; }
.auth-sep::before, .auth-sep::after { content: ""; flex: 1; height: 1px; background: rgba(255, 255, 255, .1); }
.auth-ok { background: rgba(22, 121, 76, .18); border: 1px solid rgba(110, 231, 183, .25); color: #b5f0cf; border-radius: 10px; padding: 10px 12px; font-size: 13px; margin-bottom: 14px; }

/* Client portal */
.portal-banner { background: var(--amber-bg); color: var(--amber); border-radius: 8px; padding: 8px 12px; font-size: 13px; margin-bottom: 16px; }
.release-card .card-head h2 { display: flex; gap: 10px; align-items: center; }
.client-badge { display: inline-block; background: var(--blue-bg); color: var(--blue); border-radius: 6px; padding: 0 6px; font-size: 11px; font-weight: 700; }
@media (max-width: 760px) {
    .bl-row { grid-template-columns: 22px 80px minmax(0, 1fr) 46px; }
    .bl-row .epic, .bl-row .who, .bl-row .st, .bl-row .pr { display: none; }
    .conflict-vals { grid-template-columns: 1fr; }
}
