:root {
    --bg: #f4f6f8;
    --card-bg: #ffffff;
    --border: #dde2e7;
    --text: #1f2933;
    --muted: #6b7785;
    --accent: #1b4965;
    --critical: #c00000;
    --high: #e36c09;
    --medium: #bf8f00;
    --low: #38761d;
    --info: #31599d;
}

* { box-sizing: border-box; }

html, body { min-height: 100%; }

body {
    margin: 0;
    font-family: "Segoe UI", Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
}

body.page-landing,
body.page-assessment {
    background:
        radial-gradient(circle at 8% 8%, rgba(27, 73, 101, 0.07) 0%, transparent 38%),
        radial-gradient(circle at 95% 18%, rgba(49, 89, 157, 0.06) 0%, transparent 42%),
        linear-gradient(180deg, #eef2f6 0%, #f4f6f8 220px, #f4f6f8 100%);
    background-attachment: fixed;
}

body.page-login {
    background:
        radial-gradient(circle at 15% 20%, rgba(255, 255, 255, 0.06) 0%, transparent 40%),
        radial-gradient(circle at 85% 80%, rgba(255, 255, 255, 0.05) 0%, transparent 45%),
        linear-gradient(135deg, #15324a 0%, #1b4965 45%, #2a6f97 100%);
    background-attachment: fixed;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.topbar {
    background: var(--accent);
    color: white;
    padding: 14px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}

.brand {
    color: white;
    text-decoration: none;
    font-size: 1.1rem;
    font-weight: 600;
}

.topbar-clock {
    color: white;
    opacity: 0.9;
    font-size: 0.88rem;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.topnav {
    display: flex;
    align-items: center;
    gap: 18px;
}

.topnav a {
    color: white;
    text-decoration: none;
    font-size: 0.92rem;
    opacity: 0.9;
}

.topnav a:hover { opacity: 1; text-decoration: underline; }

.topnav-user {
    font-size: 0.88rem;
    opacity: 0.85;
    padding-left: 6px;
    border-left: 1px solid rgba(255, 255, 255, 0.35);
}

.topnav .link-button {
    background: rgba(255, 255, 255, 0.15);
    color: white;
    border-color: rgba(255, 255, 255, 0.3);
}

.login-wrap {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 16px;
}

.login-brand {
    text-align: center;
    margin-bottom: 28px;
}

.login-brand-name {
    display: block;
    color: #ffffff;
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: 0.01em;
}

.login-brand-dash { color: #9fc2da; }

.login-brand-tagline {
    display: block;
    margin-top: 6px;
    color: #cfe1ec;
    font-size: 0.95rem;
    font-weight: 400;
}

.login-card {
    width: 100%;
    max-width: 400px;
    margin: 0;
    padding: 32px 36px 36px;
    border: none;
    border-radius: 14px;
    box-shadow: 0 24px 60px -16px rgba(10, 30, 50, 0.45), 0 2px 8px rgba(10, 30, 50, 0.12);
}

.login-card h2 {
    margin: 0 0 6px;
    font-size: 1.4rem;
    color: var(--text);
}

.login-subtitle {
    margin: 0 0 24px;
    font-size: 0.9rem;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.login-form label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 0.85rem;
    color: var(--muted);
    font-weight: 600;
}

.login-form input {
    padding: 11px 12px;
    font-size: 0.98rem;
    border-radius: 7px;
    border: 1px solid var(--border);
}

.login-form input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(27, 73, 101, 0.15);
}

.login-form button {
    margin-top: 6px;
    padding: 12px;
    font-size: 1rem;
    border-radius: 7px;
}

body.page-login .container {
    flex: 1;
    display: flex;
    flex-direction: column;
    max-width: 100%;
    margin: 0;
    padding: 0;
}

body.page-login .flash {
    max-width: 400px;
    margin: 24px auto 0;
}

.user-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.app-shell {
    display: flex;
    align-items: flex-start;
}

.sidebar {
    width: 230px;
    flex-shrink: 0;
    background: var(--card-bg);
    border-right: 1px solid var(--border);
    padding: 20px 0;
    position: sticky;
    top: 0;
    align-self: flex-start;
    max-height: 100vh;
    overflow-y: auto;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.sidebar-link {
    display: block;
    padding: 12px 20px;
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--text);
    text-decoration: none;
    border-left: 3px solid transparent;
}

.sidebar-link:hover { background: #eef2f5; }

.sidebar-link.active {
    color: var(--accent);
    border-left-color: var(--accent);
    background: #eef2f5;
}

.sidebar-link.disabled {
    color: var(--muted);
    font-weight: 500;
    cursor: default;
}

.sidebar-link.disabled:hover { background: none; }

.badge-soon {
    display: block;
    margin-top: 3px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--muted);
}

.container {
    flex: 1;
    max-width: 1000px;
    margin: 24px auto;
    padding: 0 16px 80px;
}

.sidebar-right {
    width: 300px;
    flex-shrink: 0;
    padding: 20px 16px;
    position: sticky;
    top: 0;
    align-self: flex-start;
    max-height: 100vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

@media (max-width: 1300px) {
    .sidebar-right { display: none; }
}

.key-actions-card { padding: 16px; }
.key-actions-card .dashboard-title { font-size: 0.95rem; margin-bottom: 10px; padding-bottom: 8px; }

.key-actions-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 320px;
    overflow-y: auto;
}

.key-action-item {
    border-left: 3px solid var(--border);
    padding: 4px 0 4px 10px;
    font-size: 0.8rem;
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.key-action-item a { font-weight: 600; word-break: break-word; }

.key-action-module {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--muted);
}

.key-action-due { font-size: 0.74rem; color: var(--muted); }

.key-action-item.key-action-overdue { border-left-color: var(--critical, #b00020); }
.key-action-item.key-action-overdue .key-action-due { color: var(--critical, #b00020); font-weight: 600; }
.key-action-item.key-action-soon { border-left-color: var(--medium); }
.key-action-item.key-action-upcoming { border-left-color: var(--low); }

.card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 20px 24px;
    margin-bottom: 20px;
}

h2 { margin-top: 0; }

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.form-grid label, .finding-form label {
    display: flex;
    flex-direction: column;
    font-size: 0.85rem;
    color: var(--muted);
    gap: 4px;
}

.form-grid .full, .finding-form .full { grid-column: 1 / -1; }

input, select, textarea, button {
    font-family: inherit;
    font-size: 0.95rem;
    padding: 8px;
    border: 1px solid var(--border);
    border-radius: 4px;
}

input, select, textarea {
    width: 100%;
    max-width: 100%;
}

.hidden {
    display: none !important;
}

button {
    background: var(--accent);
    color: white;
    border: none;
    cursor: pointer;
    padding: 9px 16px;
    font-weight: 600;
}

button:hover { opacity: 0.9; }

.link-button {
    display: inline-block;
    background: #eef2f5;
    color: var(--text);
    border: 1px solid var(--border);
    padding: 9px 14px;
    border-radius: 4px;
    text-decoration: none;
    font-size: 0.9rem;
    cursor: pointer;
}

.link-button.danger { background: #fbeaea; color: var(--critical); border-color: #f0c8c8; }

.list-table {
    width: 100%;
    border-collapse: collapse;
}

.list-table th, .list-table td {
    text-align: left;
    padding: 10px 8px;
    border-bottom: 1px solid var(--border);
    font-size: 0.92rem;
}

.muted { color: var(--muted); font-size: 0.9rem; }

.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.78rem;
    background: #eef2f5;
    margin-right: 6px;
}

.status-compliant { background: #e3f1da; color: var(--low); }
.status-partial { background: #fdf2cf; color: var(--medium); }
.status-non-compliant { background: #fbdede; color: var(--critical); }
.status-not-applicable, .status-not-reviewed { background: #ececec; color: var(--muted); }
.status-completed { background: #dbe9ff; color: var(--info); }
.status-in-progress { background: #fdf2cf; color: var(--medium); }
.status-draft { background: #ececec; color: var(--muted); }
.status-under-review { background: #fdf2cf; color: var(--medium); }
.status-approved { background: #e3f1da; color: var(--low); }

.renewal-overdue { background: #fbdede; color: var(--critical); font-weight: 600; }
.renewal-due-soon { background: #fde3cf; color: #b5570a; font-weight: 600; }
.renewal-on-track { background: #e3f1da; color: var(--low); }
.status-published { background: #dbe9ff; color: var(--info); }

.severity-critical { background: #fbdede; color: var(--critical); }
.severity-high { background: #fde6d2; color: var(--high); }
.severity-medium { background: #fdf2cf; color: var(--medium); }
.severity-low { background: #e3f1da; color: var(--low); }
.severity-informational { background: #dbe9ff; color: var(--info); }

.risk-low { background: #e3f1da; color: var(--low); font-weight: 600; }
.risk-medium { background: #fdf2cf; color: var(--medium); font-weight: 600; }
.risk-high { background: #fbdede; color: var(--critical); font-weight: 600; }

.status-open { background: #ececec; color: var(--muted); }
.status-mitigation-planned { background: #fdf2cf; color: var(--medium); }
.status-accepted { background: #dbe9ff; color: var(--info); }
.status-closed { background: #e3f1da; color: var(--low); }

.header-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 12px;
}

.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.status-summary { margin-top: 14px; }

.finding {
    border-top: 1px solid var(--border);
    padding: 16px 0;
}

.finding:first-of-type { border-top: none; padding-top: 4px; }

.finding-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; flex-wrap: wrap; }

.refs { font-size: 0.85rem; color: var(--muted); }

.finding-form {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 10px;
}

.finding-form button { grid-column: 1 / -1; justify-self: start; }

.contacts-form {
    grid-template-columns: 1fr 1fr 1fr 1fr;
}

.contacts-form h4.full {
    grid-column: 1 / -1;
    margin: 10px 0 0;
    color: var(--accent);
}

.contacts-form h4.full:first-of-type { margin-top: 0; }

details summary {
    cursor: pointer;
    font-size: 1rem;
    color: var(--accent);
    list-style: none;
}

details[open] summary { margin-bottom: 6px; }

.add-control-form { grid-template-columns: 1fr 1fr; }

.dashboard-chart {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 8px auto 16px;
    border-radius: 8px;
}

.dashboard-header .header-row { align-items: flex-start; }

.eyebrow {
    margin: 0 0 2px;
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--muted);
}

.dashboard-header h2 { margin: 0 0 4px; font-size: 1.6rem; }

.stat-row {
    display: flex;
    gap: 16px;
    margin-top: 18px;
    flex-wrap: wrap;
}

.stat-card {
    flex: 1;
    min-width: 160px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 18px 20px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.stat-value {
    font-size: 2.2rem;
    font-weight: 700;
    color: var(--accent);
    line-height: 1;
}

.stat-label {
    font-size: 0.85rem;
    color: var(--muted);
    font-weight: 500;
}

.stat-card.stat-completed .stat-value { color: var(--low); }
.stat-card.stat-pending .stat-value { color: var(--medium); }
.stat-card.stat-overdue .stat-value { color: var(--critical, #b00020); }

.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.dashboard-grid .card { margin-bottom: 0; }

.dashboard-title {
    margin: 0 0 14px;
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--accent);
    padding-bottom: 10px;
    border-bottom: 2px solid var(--border);
}

@media (max-width: 800px) {
    .dashboard-grid { grid-template-columns: 1fr; }
}

.ioc-widget-card {
    padding: 16px;
    max-height: 360px;
    display: flex;
    flex-direction: column;
}

.ioc-widget-card .dashboard-title { font-size: 0.95rem; margin-bottom: 4px; padding-bottom: 8px; }

.ioc-widget-list {
    list-style: none;
    margin: 0;
    padding: 0;
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ioc-widget-list li {
    border-bottom: 1px solid var(--border);
    padding-bottom: 8px;
    font-size: 0.78rem;
}

.ioc-widget-list li:last-child { border-bottom: none; padding-bottom: 0; }

.ioc-widget-list a {
    word-break: break-all;
    font-weight: 600;
}

.ioc-widget-meta {
    display: block;
    color: var(--muted);
    margin-top: 2px;
}

.evidence-section {
    margin-top: 12px;
    padding: 10px 12px;
    background: #f8f9fb;
    border: 1px solid var(--border);
    border-radius: 6px;
}

.evidence-label { font-size: 0.85rem; color: var(--muted); display: block; margin-bottom: 6px; }

.evidence-list {
    list-style: none;
    margin: 0 0 8px;
    padding: 0;
}

.evidence-list li {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 0;
    font-size: 0.9rem;
}

.inline-form { display: inline; }

.link-button.small { padding: 3px 8px; font-size: 0.78rem; }

.evidence-upload-form {
    display: flex;
    gap: 8px;
    align-items: center;
}

.evidence-paste {
    margin-top: 8px;
    padding: 10px 12px;
    border: 1px dashed #9aa7b5;
    border-radius: 6px;
    font-size: 0.85rem;
    color: var(--muted);
    text-align: center;
    cursor: text;
    background: #fff;
}

.evidence-paste:focus {
    outline: none;
    border-color: var(--accent);
    color: var(--text);
}

.flash {
    background: #fdf2cf;
    border: 1px solid #e6cf6e;
    color: #6b5000;
    padding: 10px 16px;
    border-radius: 6px;
    margin-bottom: 16px;
}

.news-ticker {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: var(--accent);
    color: white;
    display: flex;
    align-items: center;
    gap: 0;
    z-index: 20;
    box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.15);
}

.news-ticker-label {
    flex-shrink: 0;
    background: #143247;
    padding: 9px 16px;
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    white-space: nowrap;
}

.news-ticker-track-wrap {
    flex: 1;
    overflow: hidden;
    white-space: nowrap;
}

.news-ticker-track {
    display: inline-block;
    white-space: nowrap;
    padding-left: 100%;
    animation: news-ticker-scroll 70s linear infinite;
}

.news-ticker-track:hover { animation-play-state: paused; }

@keyframes news-ticker-scroll {
    0% { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}

.news-ticker-item {
    display: inline-block;
    color: white;
    text-decoration: none;
    font-size: 0.85rem;
    padding: 9px 0;
}

.news-ticker-item:hover { text-decoration: underline; }

.news-ticker-source {
    background: rgba(255, 255, 255, 0.18);
    border-radius: 3px;
    padding: 2px 6px;
    margin-right: 8px;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
}

.news-ticker-sep {
    display: inline-block;
    margin: 0 18px;
    opacity: 0.5;
}
