/* SecureStories – Telekom-inspired palette, not an official CI implementation.
   Magenta is the no-JavaScript default; green is an explicit user preference.
   Success/risk colours communicate status independently of the brand theme. */

:root {
    color-scheme: light;
    --font-sans: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --color-bg: #f4f4f4;
    --color-surface: #ffffff;
    --color-surface-subtle: #fafafa;
    --color-surface-hover: #ededed;
    --color-primary: #e20074;
    --color-primary-hover: #b0005a;
    --color-primary-text: #ad0059;
    --color-primary-soft: #fce4f1;
    --color-primary-border: #d48aaf;
    --color-secondary: #383838;
    --color-secondary-hover: #202020;
    --color-danger: #b42332;
    --color-warning: #8a5207;
    --color-warning-hover: #6e4005;
    --color-success: #176b35;
    --color-text: #262626;
    --color-text-muted: #606060;
    --color-border: #dedede;
    --color-border-strong: #858585;
    --radius: 6px;
    --shadow: 0 8px 24px rgba(0, 0, 0, 0.06);
    --focus-ring: #202020;
    --primary-shadow: rgba(226, 0, 116, 0.16);
    --ticker-bg: #262626;
    --ticker-border: #606060;
    --ticker-border-bottom: #606060;
    --ticker-accent: #ffb3d9;
    --ticker-pulse: #ff80bf;
    --ticker-pulse-glow: rgba(255, 128, 191, 0.14);
    --ticker-link: #ffffff;
    --ticker-link-hover: #ffb3d9;
    --ticker-separator: #a3a3a3;
    --ticker-toggle-hover: #383838;
    --hero-bg-color: var(--color-primary);
    --hero-brandmark: #ffffff;
    --hero-muted: #ffffff;
    --hero-eyebrow: #ffffff;
    --hero-footnote: #ffffff;
}

:root[data-theme="green"] {
    --color-primary: #087c5b;
    --color-primary-hover: #056348;
    --color-primary-text: #056348;
    --color-primary-soft: #e1f2ec;
    --color-primary-border: #70a894;
    --primary-shadow: rgba(8, 124, 91, 0.16);
    --ticker-accent: #9be4c9;
    --ticker-pulse: #36d69d;
    --ticker-pulse-glow: rgba(54, 214, 157, 0.12);
    --ticker-link-hover: #9be4c9;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }

body {
    font-family: var(--font-sans);
    background: var(--color-bg);
    color: var(--color-text);
    line-height: 1.6;
}

a { color: var(--color-primary-text); text-underline-offset: 0.18em; }
a:hover { text-decoration-thickness: 2px; }
a[target="_blank"]::after { content: " ↗ (extern)"; font-size: 0.85em; white-space: nowrap; }
.skip-link { position: fixed; top: 0.75rem; left: 1rem; z-index: 1100; padding: 0.75rem 1rem; transform: translateY(-200%); border-radius: var(--radius); background: var(--color-surface); color: var(--color-primary-text); font-weight: 700; }
.skip-link:focus { transform: translateY(0); }
#main-content { width: 100%; flex: 1; scroll-margin-top: 90px; }
.product-footer { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 0.5rem 1.5rem; padding: 1.25rem max(1rem, 3vw); border-top: 1px solid var(--color-border); background: var(--color-surface); color: var(--color-text-muted); font-size: 0.8rem; }
.product-footer strong { color: var(--color-primary-text); }

/* Navbar */
.navbar {
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    padding: 0.75rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 2rem;
    box-shadow: var(--shadow);
}
.nav-brand { font-weight: 700; font-size: 1.1rem; }
.nav-links { display: flex; gap: 1rem; }
.nav-links a { color: var(--color-text); text-decoration: none; }
.nav-links a:hover { color: var(--color-primary-text); }
.nav-user { margin-left: auto; display: flex; align-items: center; gap: 0.75rem; font-size: 0.9rem; }

/* Container */
.container { max-width: 1000px; margin: 2rem auto; padding: 0 1.5rem; }

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.5rem 1rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    background: var(--color-surface);
    color: var(--color-text);
    text-decoration: none;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.15s;
}
.btn:hover { background: var(--color-bg); }
.btn-primary { background: var(--color-primary); color: white; border-color: var(--color-primary); }
.btn-primary:hover { background: var(--color-primary-hover); }
.btn-secondary { background: var(--color-secondary); color: white; border-color: var(--color-secondary); }
.btn-warning { background: var(--color-warning); color: white; border-color: var(--color-warning); }
.btn-sm { padding: 0.25rem 0.5rem; font-size: 0.8rem; }
.btn-block { width: 100%; text-align: center; }

/* Forms */
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; margin-bottom: 0.25rem; font-weight: 500; font-size: 0.9rem; }
.form-group input, .form-group textarea, .form-group select {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    font-size: 0.95rem;
    font-family: inherit;
}
.form-group textarea { resize: vertical; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }

/* Login */
.login-container {
    max-width: 400px;
    margin: 4rem auto;
    padding: 2rem;
    background: var(--color-surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    text-align: center;
}
.login-container h1 { margin-bottom: 0.25rem; }
.login-container .subtitle { color: var(--color-text-muted); margin-bottom: 1.5rem; }
.form-login { text-align: left; }

/* Alerts */
.alert { padding: 0.75rem 1rem; border-radius: var(--radius); margin-bottom: 1rem; }
.alert-error { background: #fef2f2; border: 1px solid #fecaca; color: var(--color-danger); }
.alert-warning { background: #fffbeb; border: 1px solid #fde68a; color: #92400e; }
.alert-success { background: #f0fdf4; border: 1px solid #bbf7d0; color: var(--color-success); }

/* Badges */
.badge {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    border-radius: 3px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}
.badge-low { background: #dbeafe; color: #1e40af; }
.badge-medium { background: #fef3c7; color: #92400e; }
.badge-high { background: #fee2e2; color: #991b1b; }
.badge-critical { background: #991b1b; color: white; }
.badge-info { background: #e0e7ff; color: #3730a3; }
.badge-status-open { background: #e5e7eb; color: #374151; }
.badge-status-in_progress { background: #dbeafe; color: #1e40af; }
.badge-status-implemented { background: #d1fae5; color: #065f46; }
.badge-status-verified { background: var(--color-success); color: white; }
.badge-status-waived { background: #fef3c7; color: #92400e; }
.badge-status-not_applicable { background: #f3f4f6; color: #6b7280; }

/* Tables */
.table { width: 100%; border-collapse: collapse; margin-top: 1rem; }
.table th, .table td { padding: 0.6rem 0.75rem; text-align: left; border-bottom: 1px solid var(--color-border); }
.table th { background: var(--color-bg); font-weight: 600; font-size: 0.85rem; }

/* Cards */
.card { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius); margin-bottom: 1rem; }
.card-header { padding: 0.75rem 1rem; border-bottom: 1px solid var(--color-border); display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.card-body { padding: 1rem; }
.card-body p { margin-bottom: 0.5rem; }

/* Analysis Result */
.result-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 2rem; gap: 1rem; }
.risk-badge-large {
    text-align: center;
    padding: 1rem 1.5rem;
    border-radius: var(--radius);
    min-width: 120px;
}
.risk-badge-large.badge-low { background: #dbeafe; }
.risk-badge-large.badge-medium { background: #fef3c7; }
.risk-badge-large.badge-high { background: #fee2e2; }
.risk-badge-large.badge-critical { background: #991b1b; color: white; }
.risk-label { display: block; font-size: 0.75rem; text-transform: uppercase; }
.risk-value { display: block; font-size: 1.5rem; font-weight: 700; }
.risk-score { display: block; font-size: 0.8rem; opacity: 0.8; }

.result-section { margin-bottom: 2rem; }
.result-section h3 { margin-bottom: 0.75rem; padding-bottom: 0.5rem; border-bottom: 1px solid var(--color-border); }
.meta { font-size: 0.8rem; color: var(--color-text-muted); }
.category { font-size: 0.8rem; color: var(--color-text-muted); }
.references { font-size: 0.85rem; color: var(--color-text-muted); }

.question-list { list-style: none; }
.question-list li { padding: 0.75rem; border: 1px solid var(--color-border); border-radius: var(--radius); margin-bottom: 0.5rem; }
.question-list .rationale { font-size: 0.85rem; color: var(--color-text-muted); margin-top: 0.25rem; }

.export-buttons { display: flex; gap: 0.5rem; flex-wrap: wrap; }

/* Data source administration */
.source-page-header { max-width: 780px; }
.source-section { margin-bottom: 2.5rem; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 2rem; margin-bottom: 1rem; }
.section-heading > p { max-width: 520px; color: var(--color-text-muted); font-size: 0.88rem; }
.section-heading h2 { font-size: 1.25rem; }
.source-list { border-top: 1px solid var(--color-border-strong); }
.source-row { display: flex; align-items: center; justify-content: space-between; gap: 1.5rem; min-height: 118px; padding: 1.15rem 0; border-bottom: 1px solid var(--color-border); }
.source-main { min-width: 0; }
.source-title-line { display: flex; align-items: center; gap: 0.65rem; flex-wrap: wrap; }
.source-title-line h3 { font-size: 1rem; }
.source-meta { display: flex; gap: 0.85rem; flex-wrap: wrap; margin-top: 0.35rem; color: var(--color-text-muted); font-size: 0.78rem; }
.source-url { display: block; max-width: 680px; margin-top: 0.35rem; color: var(--color-primary-text); font-size: 0.78rem; overflow-wrap: anywhere; }
.source-state { padding: 0.15rem 0.4rem; border: 1px solid var(--color-border-strong); border-radius: 3px; color: var(--color-text-muted); font-size: 0.68rem; font-weight: 700; text-transform: uppercase; }
.source-state-ready, .source-state-live { border-color: var(--color-primary-border); background: var(--color-primary-soft); color: var(--color-primary-text); }
.source-state-missing, .source-state-error { border-color: #e1a8a3; background: #fbe7e5; color: var(--color-danger); }
.source-actions { display: flex; align-items: center; justify-content: end; gap: 0.55rem; flex: none; }
.source-switch { min-width: 90px; border: 0; background: transparent; color: var(--color-text-muted); cursor: pointer; font: inherit; font-size: 0.78rem; font-weight: 700; }
.source-switch span { display: inline-block; position: relative; width: 34px; height: 20px; margin-right: 0.4rem; border-radius: 10px; background: var(--color-border-strong); vertical-align: middle; }
.source-switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 14px; height: 14px; border-radius: 50%; background: white; transition: transform 0.15s; }
.source-switch.is-on { color: var(--color-primary-text); }
.source-switch.is-on span { background: var(--color-primary); }
.source-switch.is-on span::after { transform: translateX(14px); }

/* Dashboard */
.actions { margin-bottom: 2rem; display: flex; gap: 0.75rem; }
.empty-state { color: var(--color-text-muted); font-style: italic; padding: 2rem; text-align: center; }

/* Responsive */
@media (max-width: 768px) {
    .form-row { grid-template-columns: 1fr; }
    .result-header { flex-direction: column; }
    .navbar { flex-wrap: wrap; gap: 0.5rem; }
    .section-heading, .source-row { align-items: stretch; flex-direction: column; }
    .source-row { gap: 0.85rem; }
    .source-actions { justify-content: space-between; }
}

/* Product workspace */
html { scroll-behavior: smooth; }

body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    font-size: 15px;
    letter-spacing: 0;
}

button, input, select, textarea { font-family: inherit; letter-spacing: 0; }
h1, h2, h3, .nav-brand, .metric-card strong { font-family: var(--font-sans); font-weight: 700; letter-spacing: 0; }
h1 { font-size: clamp(2rem, 4vw, 3.2rem); line-height: 1.06; }
h2 { font-size: 1.35rem; line-height: 1.25; }
h3 { font-size: 1.2rem; line-height: 1.3; }

.navbar {
    position: sticky;
    top: 0;
    z-index: 30;
    min-height: 68px;
    padding: 0 3vw;
    gap: 1.5rem;
    border-top: 4px solid var(--color-primary);
    box-shadow: none;
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(12px);
}
.nav-brand { display: flex; align-items: center; gap: 0.65rem; color: var(--color-text); text-decoration: none; }
.brand-mark { display: grid; place-items: center; flex: none; width: 36px; height: 36px; color: white; background: var(--color-primary); border-radius: 4px; font-size: 1rem; }
.nav-links { align-self: stretch; gap: 0.25rem; }
.nav-links a { display: flex; align-items: center; position: relative; padding: 0 0.85rem; color: var(--color-text-muted); font-weight: 600; font-size: 0.88rem; white-space: nowrap; }
.nav-links a::after { content: ""; position: absolute; right: 0.85rem; bottom: -1px; left: 0.85rem; height: 3px; background: transparent; }
.nav-links a:hover, .nav-links a[aria-current="page"] { color: var(--color-primary-text); }
.nav-links a[aria-current="page"]::after { background: var(--color-primary); }
.nav-user { gap: 0.65rem; }
.user-avatar { display: grid; place-items: center; flex: none; width: 34px; height: 34px; border-radius: 50%; background: var(--color-surface-hover); color: var(--color-text); font-weight: 700; }
.user-meta { display: grid; max-width: 10rem; min-width: 0; line-height: 1.2; }
.user-meta strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.84rem; }
.user-meta small { color: var(--color-text-muted); text-transform: capitalize; }
.nav-user form { display: inline; }
.theme-toggle { display: inline-flex; align-items: center; gap: 0.4rem; min-height: 40px; padding: 0.35rem 0.6rem; border: 1px solid var(--color-border-strong); border-radius: var(--radius); background: var(--color-surface); color: var(--color-text-muted); cursor: pointer; font: 650 0.75rem var(--font-sans); }
.theme-toggle:hover { border-color: var(--color-primary); color: var(--color-primary-text); }
.theme-toggle .theme-swatch { width: 12px; height: 12px; border-radius: 50%; background: var(--color-primary); box-shadow: 0 0 0 1px rgba(0,0,0,0.06); }
.help-button { width: 40px; height: 40px; flex: none; border: 1px solid var(--color-border-strong); border-radius: 50%; background: var(--color-surface); color: var(--color-primary-text); cursor: pointer; font: 800 0.85rem var(--font-sans); }
.help-button:hover { border-color: var(--color-primary); background: var(--color-primary-soft); }
.help-button:focus-visible { outline: 3px solid var(--focus-ring); outline-offset: 2px; }

/* Product tour */
.product-tour { position: fixed; z-index: 1000; inset: 0; pointer-events: none; }
.tour-backdrop { position: fixed; z-index: 1000; inset: 0; background: transparent; pointer-events: auto; }
.tour-highlight { position: fixed; z-index: 1001; border: 3px solid #ffffff; border-radius: 8px; background: transparent; box-shadow: 0 0 0 3px var(--color-primary), 0 0 0 9999px rgba(0, 0, 0, 0.68), 0 12px 36px rgba(0,0,0,0.32); pointer-events: none; transition: top 0.18s ease, left 0.18s ease, width 0.18s ease, height 0.18s ease; }
.tour-target-active { border-radius: var(--radius); pointer-events: none; }
.tour-popover { position: fixed; z-index: 1003; width: min(420px, calc(100vw - 24px)); padding: 1.25rem; border: 1px solid var(--color-border-strong); border-top: 4px solid var(--color-primary); border-radius: 6px; background: white; color: var(--color-text); box-shadow: 0 18px 50px rgba(0,0,0,0.26); pointer-events: auto; }
.tour-progress { margin-bottom: 0.75rem; display: flex; justify-content: space-between; gap: 1rem; color: var(--color-text-muted); font-size: 0.7rem; font-weight: 750; text-transform: uppercase; }
.tour-progress span:last-child { color: var(--color-primary-text); }
.tour-popover h2 { font-size: 1.25rem; }
.tour-popover > p { margin-top: 0.55rem; color: var(--color-text-muted); line-height: 1.55; }
.tour-actions { margin-top: 1.15rem; padding-top: 0.9rem; display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; border-top: 1px solid var(--color-border); }
.tour-actions > div { display: flex; gap: 0.5rem; }
.tour-actions button:disabled { opacity: 0.4; cursor: not-allowed; }

.security-ticker { height: 38px; display: grid; grid-template-columns: auto minmax(0, 1fr) 42px; align-items: stretch; overflow: hidden; border-bottom: 1px solid var(--ticker-border-bottom); color: white; background: var(--ticker-bg); }
.ticker-label { z-index: 2; padding: 0 1.1rem; display: flex; align-items: center; gap: 0.5rem; border-right: 1px solid var(--ticker-border); color: var(--ticker-accent); background: var(--ticker-bg); font-size: 0.7rem; font-weight: 800; text-transform: uppercase; white-space: nowrap; }
.ticker-pulse { width: 7px; height: 7px; border-radius: 50%; background: var(--ticker-pulse); box-shadow: 0 0 0 4px var(--ticker-pulse-glow); }
.ticker-viewport { position: relative; min-width: 0; overflow: hidden; }
.ticker-viewport::before, .ticker-viewport::after { content: ""; position: absolute; z-index: 1; top: 0; bottom: 0; width: 28px; pointer-events: none; }
.ticker-viewport::before { left: 0; background: linear-gradient(90deg, var(--ticker-bg), transparent); }
.ticker-viewport::after { right: 0; background: linear-gradient(270deg, var(--ticker-bg), transparent); }
.ticker-track { width: max-content; min-width: 100%; height: 100%; padding-left: 100%; display: flex; align-items: center; animation: ticker-scroll var(--ticker-duration, 35s) linear infinite; will-change: transform; }
.ticker-track a { color: var(--ticker-link); text-decoration: none; font-size: 0.78rem; font-weight: 600; white-space: nowrap; }
.ticker-track a:hover { color: var(--ticker-link-hover); text-decoration: underline; }
.ticker-separator { margin: 0 1.5rem; color: var(--ticker-separator); font-size: 0.48rem; }
.ticker-toggle { border: 0; border-left: 1px solid var(--ticker-border); color: var(--ticker-accent); background: var(--ticker-bg); cursor: pointer; font: 700 0.65rem var(--font-sans); }
.ticker-toggle:hover { background: var(--ticker-toggle-hover); }
.security-ticker.is-paused .ticker-track, .security-ticker:hover .ticker-track, .security-ticker:focus-within .ticker-track { animation-play-state: paused; }
@keyframes ticker-scroll { to { transform: translateX(var(--ticker-distance)); } }

.container { max-width: 1240px; margin: 0 auto; padding: 3.5rem 2rem 5rem; }
.page-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 2rem; margin-bottom: 2.25rem; }
.page-header.compact { max-width: 760px; margin-bottom: 2rem; }
.page-lead { max-width: 680px; margin-top: 0.75rem; color: var(--color-text-muted); font-size: 1.05rem; line-height: 1.55; }
.eyebrow, .section-kicker { margin-bottom: 0.55rem; color: var(--color-primary-text); font-size: 0.72rem; font-weight: 800; letter-spacing: 0; text-transform: uppercase; }
.page-actions, .form-actions { display: flex; gap: 0.65rem; align-items: center; }

.btn { min-height: 40px; padding: 0.58rem 0.95rem; display: inline-flex; align-items: center; justify-content: center; border-color: var(--color-border-strong); font-weight: 650; line-height: 1; }
.btn:hover { background: var(--color-surface-hover); border-color: var(--color-border-strong); }
.btn-primary { background: var(--color-primary); border-color: var(--color-primary); box-shadow: 0 5px 12px var(--primary-shadow); }
.btn-primary:hover { background: var(--color-primary-hover); border-color: var(--color-primary-hover); }
.btn-secondary { background: var(--color-secondary); border-color: var(--color-secondary); }
.btn-secondary:hover { background: var(--color-secondary-hover); border-color: var(--color-secondary-hover); }
.btn-warning:hover { background: var(--color-warning-hover); border-color: var(--color-warning-hover); }
.btn-quiet { background: transparent; }
.btn-sm { min-height: 32px; padding: 0.35rem 0.65rem; }
:focus-visible { outline: 3px solid var(--focus-ring); outline-offset: 2px; box-shadow: 0 0 0 2px white; }
/* Keep focus rings visible inside clipped navigation/ticker surfaces. */
.section-nav a:focus-visible, .ticker-track a:focus-visible, .ticker-toggle:focus-visible { outline-offset: -3px; outline-color: currentColor; }

.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px; margin-bottom: 2.75rem; overflow: hidden; border: 1px solid var(--color-border); border-radius: var(--radius); background: var(--color-border); box-shadow: var(--shadow); }
.metric-card { min-height: 138px; padding: 1.15rem 1.35rem; display: flex; flex-direction: column; align-items: flex-start; background: var(--color-surface); }
.metric-card::before { content: ""; width: 28px; height: 3px; margin-bottom: 1rem; background: var(--color-primary); }
.metric-card.metric-critical::before { background: var(--color-danger); }
.metric-card strong { margin: auto 0 0.1rem; font-size: 2rem; line-height: 1; }
.metric-label { color: var(--color-text); font-size: 0.8rem; font-weight: 750; text-transform: uppercase; }
.metric-detail { color: var(--color-text-muted); font-size: 0.78rem; }

.content-section { overflow: hidden; border: 1px solid var(--color-border); border-radius: var(--radius); background: var(--color-surface); box-shadow: var(--shadow); }
.section-heading { padding: 1.25rem 1.4rem; display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.section-heading p:not(.section-kicker) { margin-top: 0.2rem; color: var(--color-text-muted); font-size: 0.88rem; }
.result-count { flex: none; padding: 0.3rem 0.55rem; border: 1px solid var(--color-border); border-radius: 4px; color: var(--color-text-muted); background: var(--color-surface-subtle); font-size: 0.75rem; font-weight: 700; }
.filter-bar { padding: 0.9rem 1.4rem; display: grid; grid-template-columns: minmax(240px, 1fr) 190px 160px; gap: 0.75rem; border-block: 1px solid var(--color-border); background: var(--color-surface-subtle); }
.filter-bar label { display: grid; gap: 0.28rem; color: var(--color-text-muted); font-size: 0.72rem; font-weight: 700; }
.filter-bar input, .filter-bar select { min-height: 40px; width: 100%; padding: 0.5rem 0.7rem; border: 1px solid var(--color-border-strong); border-radius: 4px; background: white; color: var(--color-text); font: inherit; }

.table-wrap { width: 100%; overflow-x: auto; }
.table { margin: 0; }
.table th { padding: 0.7rem 1rem; background: white; color: var(--color-text-muted); font-size: 0.7rem; text-transform: uppercase; }
.table td { padding: 0.9rem 1rem; vertical-align: middle; }
.table tbody tr { transition: background-color 0.12s ease; }
.table tbody tr:hover { background: var(--color-surface-subtle); }
.table tbody tr[hidden] { display: none; }
.analysis-table { min-width: 760px; }
.analysis-table th:first-child { width: 52%; }
.analysis-title { display: block; max-width: 610px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.92rem; }
.table-meta { display: block; margin-top: 0.18rem; color: var(--color-text-muted); font-size: 0.75rem; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.empty-state { padding: 2.5rem; display: grid; justify-items: center; gap: 0.35rem; color: var(--color-text-muted); font-style: normal; }
.empty-state strong { color: var(--color-text); font-size: 1.05rem; }
.empty-state-large { min-height: 260px; place-content: center; border: 1px dashed var(--color-border-strong); background: var(--color-surface); }
.empty-state-large .btn { margin-top: 0.8rem; }

.analysis-form { overflow: hidden; border: 1px solid var(--color-border); border-radius: var(--radius); background: var(--color-surface); box-shadow: var(--shadow); }
.form-section { padding: 1.75rem; border-bottom: 1px solid var(--color-border); }
.form-section-heading { margin-bottom: 1.5rem; display: flex; align-items: flex-start; gap: 0.85rem; }
.form-section-heading > span { display: grid; place-items: center; width: 32px; height: 32px; flex: none; border-radius: 50%; background: var(--color-primary-soft); color: var(--color-primary-text); font-size: 0.72rem; font-weight: 800; }
.form-section-heading h2 { font-size: 1.1rem; }
.form-section-heading p { margin-top: 0.1rem; color: var(--color-text-muted); font-size: 0.85rem; }
.form-group { margin-bottom: 1.15rem; }
.form-group:last-child { margin-bottom: 0; }
.form-group label { margin-bottom: 0.4rem; color: var(--color-text); font-weight: 700; }
.required { margin-left: 0.35rem; color: var(--color-danger); font-size: 0.7rem; font-weight: 650; text-transform: uppercase; }
.form-group input, .form-group textarea, .form-group select { padding: 0.7rem 0.8rem; border-color: var(--color-border-strong); background: var(--color-surface); color: var(--color-text); line-height: 1.4; }
.form-group input:hover, .form-group textarea:hover, .form-group select:hover { border-color: var(--color-text-muted); }
.form-group input:focus, .form-group textarea:focus, .form-group select:focus { border-color: var(--color-primary); background: white; }
.field-hint { margin-top: 0.35rem; display: flex; justify-content: space-between; gap: 1rem; color: var(--color-text-muted); font-size: 0.75rem; }
.form-actions { padding: 1rem 1.75rem; justify-content: flex-end; background: var(--color-surface-subtle); }
.button-loader { display: none; width: 15px; height: 15px; margin-left: 0.55rem; border: 2px solid rgba(255,255,255,0.4); border-top-color: white; border-radius: 50%; animation: spin 0.7s linear infinite; }
.is-loading .button-loader { display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

.result-header { padding-bottom: 2rem; align-items: flex-end; border-bottom: 1px solid var(--color-border); }
.story-info { min-width: 0; }
.story-info h2 { max-width: 880px; margin-top: 0.25rem; font-size: clamp(1.6rem, 3vw, 2.55rem); }
.back-link { display: inline-block; margin-bottom: 1.5rem; color: var(--color-text-muted); font-size: 0.82rem; font-weight: 650; text-decoration: none; }
.back-link:hover { color: var(--color-primary-text); }
.story-meta { margin-top: 0.85rem; display: flex; gap: 0.5rem; flex-wrap: wrap; }
.story-meta span { padding: 0.25rem 0.5rem; border: 1px solid var(--color-border); border-radius: 4px; color: var(--color-text-muted); background: white; font-size: 0.76rem; }
.risk-badge-large { padding: 0.85rem 1.2rem; flex: none; border-radius: 4px; border-left: 4px solid currentColor; text-align: left; }
.risk-label { font-size: 0.66rem; font-weight: 750; }
.risk-value { font-family: var(--font-sans); font-size: 1.3rem; }
.section-nav { position: sticky; top: 68px; z-index: 20; margin-bottom: 1.5rem; display: flex; overflow-x: auto; border: 1px solid var(--color-border); border-radius: var(--radius); background: rgba(255,255,255,0.96); box-shadow: 0 4px 14px rgba(0,0,0,0.05); }
.section-nav { scrollbar-width: none; }
.section-nav::-webkit-scrollbar { display: none; }
.section-nav a { padding: 0.75rem 1rem; flex: none; color: var(--color-text-muted); text-decoration: none; font-size: 0.8rem; font-weight: 700; }
.section-nav a:hover { color: var(--color-primary-text); background: var(--color-primary-soft); }
.section-nav span { margin-left: 0.2rem; color: var(--color-primary-text); }
.result-section { margin-bottom: 1.5rem; scroll-margin-top: 135px; }
.result-section > h3 { border: 0; }
.requirement-panel { overflow: hidden; border: 1px solid var(--color-border); border-radius: var(--radius); background: white; box-shadow: var(--shadow); }
.requirement-panel .section-heading { border-bottom: 1px solid var(--color-border); background: var(--color-surface-subtle); }
.requirement-content { padding: 1.4rem; display: grid; gap: 1.25rem; }
.requirement-context { padding-top: 1.25rem; border-top: 1px solid var(--color-border); }
.content-label { display: block; margin-bottom: 0.45rem; color: var(--color-text-muted); font-size: 0.72rem; font-weight: 800; text-transform: uppercase; }
.original-text { max-width: 980px; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.65; }
.summary-panel { padding: 1.5rem; border-left: 4px solid var(--color-primary); background: white; box-shadow: var(--shadow); }
.summary-panel h3 { margin-bottom: 0.65rem; }
.summary-panel > p:not(.section-kicker):not(.meta) { max-width: 900px; font-size: 1.02rem; line-height: 1.65; }
.summary-panel .meta { margin-top: 1rem; }
.expected-result-panel { padding: 1.5rem; border: 1px solid var(--color-border); border-left: 4px solid var(--color-warning); background: #fffdf7; box-shadow: var(--shadow); }
.expected-result-panel .section-heading { margin-bottom: 1rem; }
.expected-result-note { margin-top: 1rem; color: var(--color-text-muted); font-size: 0.82rem; }
.card { border-color: var(--color-border); box-shadow: 0 3px 12px rgba(0,0,0,0.035); }
.card-header { padding: 0.9rem 1rem; background: var(--color-surface-subtle); }
.card-header strong { font-size: 0.96rem; }
.card-header .category { margin-left: auto; }
.card-body { padding: 1.1rem; }
.finding-detail { margin-top: 1rem; padding-top: 0.9rem; border-top: 1px solid var(--color-border); }
.finding-detail strong, .recommendation strong { display: block; margin-bottom: 0.25rem; font-size: 0.78rem; text-transform: uppercase; }
.recommendation { position: relative; margin-top: 0.9rem; padding: 0.85rem 5.5rem 0.85rem 1rem; border-left: 3px solid var(--color-primary); background: var(--color-primary-soft); }
.copy-button { position: absolute; top: 0.65rem; right: 0.65rem; padding: 0.3rem 0.45rem; border: 1px solid var(--color-primary-border); border-radius: 3px; background: white; color: var(--color-primary-text); cursor: pointer; font: inherit; font-size: 0.7rem; font-weight: 700; }
.references { margin-top: 0.9rem; display: flex; gap: 0.4rem; flex-wrap: wrap; }
.references span { padding: 0.2rem 0.45rem; border: 1px solid var(--color-border); border-radius: 3px; background: var(--color-surface-subtle); }
.question-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.75rem; }
.question-list li { margin: 0; padding: 1rem; display: flex; align-items: flex-start; gap: 0.75rem; background: white; }
.question-number { display: grid; place-items: center; width: 26px; height: 26px; flex: none; border-radius: 50%; background: var(--color-surface-hover); color: var(--color-text-muted); font-size: 0.72rem; font-weight: 800; }
.question-list .category { display: block; margin-top: 0.25rem; }
.criteria-table { min-width: 900px; background: white; }
.criteria-table th:first-child { width: 35%; }
.status-select { min-width: 130px; padding: 0.4rem; border: 1px solid var(--color-border-strong); border-radius: 4px; background: white; font: inherit; font-size: 0.8rem; }
.export-section { padding: 1.3rem; display: flex; align-items: center; justify-content: space-between; gap: 1.5rem; border: 1px solid var(--color-border); background: white; }
.export-section p:not(.section-kicker) { margin-top: 0.25rem; color: var(--color-text-muted); }

.badge { border-radius: 3px; font-size: 0.68rem; letter-spacing: 0; }
.badge-low { background: #e0edf8; color: #22577a; }
.badge-medium { background: #fff0c7; color: #8a5207; }
.badge-high { background: #fbe1de; color: #9f2d26; }
.badge-critical { background: #962b32; color: white; }
.badge-info { background: #e5e9f7; color: #334b89; }

.auth-layout { min-height: calc(100vh - 7rem); display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(360px, 0.9fr); overflow: hidden; border: 1px solid var(--color-border); border-radius: var(--radius); background: white; box-shadow: var(--shadow); }
.auth-intro { min-height: 620px; padding: 2.5rem; display: flex; flex-direction: column; justify-content: space-between; gap: 2rem; color: white; background-color: var(--hero-bg-color); }
.auth-brand { display: flex; align-items: center; gap: 0.75rem; font-family: var(--font-sans); font-size: 1.1rem; font-weight: 700; }
.auth-brand .brand-mark { background: var(--hero-brandmark); color: var(--color-primary-text); }
.auth-intro h1 { max-width: 600px; font-size: clamp(2.5rem, 5vw, 4.4rem); }
.auth-intro > div > p:not(.eyebrow) { max-width: 600px; margin-top: 1.25rem; color: var(--hero-muted); font-size: 1.08rem; }
.auth-intro .eyebrow { color: var(--hero-eyebrow); }
.auth-footnote { color: var(--hero-footnote); font-size: 0.78rem; }
.auth-form-panel { align-self: center; width: min(100%, 460px); margin: 0 auto; padding: 3rem; }
.auth-form-heading { margin-bottom: 2rem; }
.auth-form-heading h2 { font-size: 2rem; }
.auth-form-heading > p:last-child { margin-top: 0.35rem; color: var(--color-text-muted); }
.auth-security-note { margin-top: 1.5rem; padding-top: 1.25rem; display: flex; align-items: center; gap: 0.65rem; border-top: 1px solid var(--color-border); color: var(--color-text-muted); font-size: 0.76rem; }
.auth-security-note span { padding: 0.25rem 0.35rem; border: 1px solid var(--color-border-strong); border-radius: 3px; color: var(--color-primary-text); font-size: 0.62rem; font-weight: 800; }

/* Keep every navigation action available without a JavaScript menu. */
@media (max-width: 1280px) {
    .navbar { position: relative; padding: 0.75rem 1rem 0; flex-wrap: wrap; gap: 0.75rem; }
    .nav-brand { order: 1; }
    .nav-user { order: 2; }
    .nav-links { order: 3; width: 100%; flex-wrap: wrap; border-top: 1px solid var(--color-border); }
    .nav-links a { min-height: 46px; flex: 1 1 auto; justify-content: center; }
    .section-nav { top: 0; }
    #main-content { scroll-margin-top: 1rem; }
}

@media (max-width: 900px) {
    .navbar { padding: 0.75rem 1rem 0; gap: 1rem; }
    .user-meta { display: none; }
    .container { padding: 2.5rem 1.25rem 4rem; }
    .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .filter-bar { grid-template-columns: 1fr 1fr; }
    .search-field { grid-column: 1 / -1; }
    .question-list { grid-template-columns: 1fr; }
    .auth-layout { grid-template-columns: 1fr; }
    .auth-intro { min-height: 280px; }
    .auth-intro h1 { font-size: 2.6rem; }
    .auth-form-panel { padding: 2.5rem; }
}

@media (max-width: 680px) {
    .navbar { position: relative; min-height: auto; padding: 0.75rem 1rem 0; flex-wrap: wrap; }
    .nav-brand { order: 1; }
    .nav-user { order: 2; width: 100%; margin-left: 0; flex-wrap: wrap; }
    .nav-user form { margin-left: auto; }
    .nav-user .btn { min-height: 40px; }
    .theme-toggle { min-height: 40px; }
    .nav-links { order: 3; width: calc(100% + 2rem); margin: 0 -1rem; padding: 0 0.5rem; justify-content: space-around; border-top: 1px solid var(--color-border); }
    .nav-links a { min-height: 46px; padding: 0 0.5rem; font-size: 0.78rem; }
    .nav-links a::after { right: 0.5rem; left: 0.5rem; }
    .security-ticker { grid-template-columns: minmax(0, 1fr) 42px; }
    .ticker-label { display: none; }
    .container { padding: 2rem 1rem 3rem; }
    .page-header, .result-header, .export-section { align-items: stretch; flex-direction: column; }
    .page-actions { width: 100%; }
    .page-actions .btn { flex: 1; }
    h1 { font-size: 2rem; }
    .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .metric-card { min-height: 118px; padding: 1rem; }
    .metric-card strong { font-size: 1.65rem; }
    .filter-bar { grid-template-columns: 1fr; }
    .search-field { grid-column: auto; }
    .analysis-table { min-width: 0; }
    .analysis-table thead { display: none; }
    .analysis-table, .analysis-table tbody { display: block; width: 100%; }
    .analysis-table tbody tr { padding: 0.9rem 1rem; display: grid; grid-template-columns: 1fr auto auto; gap: 0.55rem 0.75rem; }
    .analysis-table td { padding: 0; display: block; border: 0; }
    .analysis-table td:first-child { grid-column: 1 / -1; }
    .analysis-table td:nth-child(2) { grid-column: 1; grid-row: 2; color: var(--color-text-muted); font-size: 0.78rem; }
    .analysis-table td:nth-child(3) { grid-column: 2; grid-row: 2; }
    .analysis-table td:nth-child(4) { grid-column: 3; grid-row: 2; }
    .analysis-table td:last-child { grid-column: 1 / -1; grid-row: 3; }
    .analysis-table td:last-child .btn { width: 100%; }
    .analysis-title { white-space: normal; }
    .form-section { padding: 1.25rem; }
    .form-actions { padding: 1rem 1.25rem; }
    .form-actions .btn { flex: 1; }
    .field-hint { align-items: flex-end; flex-direction: column; }
    .risk-badge-large { width: 100%; }
    .section-nav { top: 0; flex-wrap: wrap; overflow-x: visible; }
    .section-nav a { padding: 0.65rem 0.7rem; flex: 1 1 auto; text-align: center; }
    .card-header .category { width: 100%; margin-left: 0; }
    .recommendation { padding-right: 1rem; padding-top: 2.8rem; }
    .export-buttons { width: 100%; }
    .export-buttons .btn { flex: 1; }
    .auth-layout { min-height: auto; }
    .auth-intro { min-height: 240px; padding: 1.5rem; }
    .auth-intro h1 { font-size: 2rem; }
    .auth-intro > div > p:not(.eyebrow) { font-size: 0.92rem; }
    .auth-footnote { display: none; }
    .auth-form-panel { padding: 2rem 1.5rem; }
    .tour-popover { padding: 1rem; }
    .tour-actions { align-items: stretch; flex-direction: column-reverse; }
    .tour-actions > div { width: 100%; }
    .tour-actions > div .btn { flex: 1; }
    .tour-actions > .btn { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
    .ticker-track { padding-left: 1rem; transform: none; animation: none !important; }
}
