/* ===================================================================
   ISO 27001 & NIS2 Zelfassessment — design system
   =================================================================== */

:root {
    --primary: #14294a;
    --primary-light: #2c5282;
    --primary-lighter: #3b6ea5;
    --accent: #0d9488;
    --accent-dark: #0b7a70;
    --accent-light: #ccfbf1;
    --bg: #f4f6f9;
    --card-bg: #ffffff;
    --border: #e2e6ec;
    --border-strong: #cbd3de;
    --text: #1a202c;
    --muted: #667085;
    --danger: #b91c1c;
    --danger-bg: #fef2f2;
    --ok: #15803d;
    --ok-bg: #ecfdf5;
    --warn: #92400e;
    --warn-bg: #fffbeb;
    --radius: 10px;
    --radius-sm: 6px;
    --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.06);
    --shadow-md: 0 4px 14px rgba(16, 24, 40, 0.08);
    --sidebar-width: 268px;
}

* { box-sizing: border-box; }

html { -webkit-font-smoothing: antialiased; }

body {
    margin: 0;
    font-family: "Inter", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.55;
    font-size: 15px;
}

/* ---------- Top header & navigation ---------- */

.topbar {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 1px 0 rgba(0,0,0,0.08);
}
.topbar-inner {
    max-width: 1280px;
    margin: 0 auto;
    padding: 13px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.brand { color: #fff; font-weight: 700; text-decoration: none; font-size: 1.08rem; display: flex; align-items: center; gap: 10px; letter-spacing: -0.01em; }
.brand-logo { height: 32px; width: auto; display: block; }
.topnav { display: flex; align-items: center; gap: 18px; }
.topnav > * { margin-left: 14px; }
.topnav > *:first-child { margin-left: 0; }
.topnav a { color: rgba(255,255,255,0.92); text-decoration: none; font-size: 0.88rem; }
.topnav a:hover { color: #fff; text-decoration: underline; }
.user-chip { opacity: 0.8; font-size: 0.85rem; }
.lang-switch a { opacity: 0.7; color: #fff; text-decoration: none; }
.lang-switch a.lang-active { opacity: 1; font-weight: 700; }

.mainnav { background: var(--primary-light); border-top: 1px solid rgba(255,255,255,0.08); }
.mainnav-inner { max-width: 1280px; margin: 0 auto; padding: 0 24px; display: flex; gap: 2px; }
.mainnav a {
    display: inline-block;
    padding: 11px 16px;
    color: rgba(255,255,255,0.78);
    text-decoration: none;
    font-size: 0.87rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    border-bottom: 3px solid transparent;
    transition: color 0.12s, background 0.12s;
}
.mainnav a:hover { color: #fff; background: rgba(255,255,255,0.06); }
.mainnav a.mainnav-active { color: #fff; border-bottom-color: var(--accent); }

.breadcrumb { font-size: 0.83rem; color: var(--muted); margin-bottom: 18px; }
.breadcrumb a { color: var(--primary-lighter); text-decoration: none; }
.breadcrumb a:hover { text-decoration: underline; }
.breadcrumb-sep { margin: 0 8px; color: var(--border-strong); }
.breadcrumb-current { color: var(--text); font-weight: 600; }

.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 28px 24px 70px;
}

/* ---------- Typography ---------- */

h1 { color: var(--primary); font-size: 1.7rem; font-weight: 700; letter-spacing: -0.01em; margin: 0 0 6px; }
h2 { color: var(--primary); font-size: 1.2rem; font-weight: 700; margin-top: 36px; letter-spacing: -0.005em; }
h3 { color: var(--primary); font-size: 1rem; font-weight: 700; margin: 18px 0 8px; }
p { margin: 0 0 12px; }

/* ---------- Cards & surfaces ---------- */

.card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px 22px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-sm);
}
.card summary { cursor: pointer; font-size: 1rem; padding: 2px 0; outline: none; }
.card summary::marker { color: var(--accent); }
.card summary:hover { color: var(--primary-lighter); }

/* ---------- Forms ---------- */

label {
    display: block;
    margin-bottom: 14px;
    font-size: 0.87rem;
    font-weight: 600;
    color: #344155;
}
input, select, textarea {
    display: block;
    width: 100%;
    margin-top: 5px;
    padding: 9px 11px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    font-size: 0.93rem;
    font-family: inherit;
    background: #fff;
    color: var(--text);
    transition: border-color 0.12s, box-shadow 0.12s;
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.14);
}
input:disabled, select:disabled, textarea:disabled { background: #f1f4f8; color: #8993a4; cursor: not-allowed; }

/* ---------- Buttons ---------- */

.btn {
    display: inline-block;
    padding: 9px 18px;
    border-radius: var(--radius-sm);
    border: none;
    cursor: pointer;
    font-weight: 600;
    text-decoration: none;
    font-size: 0.9rem;
    font-family: inherit;
    transition: background 0.12s, box-shadow 0.12s, border-color 0.12s, transform 0.05s;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); color: #fff; box-shadow: var(--shadow-sm); }
.btn-primary:hover { background: var(--accent-dark); }
.btn-secondary { background: #fff; color: var(--primary); border: 1px solid var(--border-strong); }
.btn-secondary:hover { border-color: var(--primary-lighter); color: var(--primary-lighter); }
.btn-danger { background: #fff; color: var(--danger); border: 1px solid #f3b4b4; }
.btn-danger:hover { background: var(--danger-bg); border-color: var(--danger); }
.btn-large { padding: 13px 26px; font-size: 1rem; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

.action-links { margin: 16px 0; display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------- Tables ---------- */

.table { width: 100%; border-collapse: collapse; margin-bottom: 20px; background: #fff; border-radius: var(--radius-sm); overflow: hidden; box-shadow: var(--shadow-sm); }
.table th, .table td { border-bottom: 1px solid var(--border); padding: 10px 12px; text-align: left; font-size: 0.89rem; }
.table th { background: #f8fafc; color: #334155; font-weight: 700; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.03em; }
.table tbody tr:hover { background: #fafbfd; }
.table tbody tr:last-child td { border-bottom: none; }
.row-muted { color: #98a2b3; }

/* ---------- Badges ---------- */

.badge { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 999px; font-size: 0.75rem; font-weight: 600; background: #eef1f5; color: #475467; }
.badge-completed { background: var(--ok-bg); color: var(--ok); }
.badge-draft { background: var(--danger-bg); color: var(--danger); }
.badge-in_progress { background: var(--warn-bg); color: var(--warn); }
.badge-archived { background: #eef1f5; color: #475467; }

/* ---------- Progress bars ---------- */

.progress-mini { height: 6px; background: #e6e9ef; border-radius: 4px; overflow: hidden; width: 100px; display: inline-block; vertical-align: middle; margin-right: 6px; }
.progress-mini-bar { height: 100%; background: var(--accent); border-radius: 4px; }

.progress-summary { display: flex; gap: 34px; margin: 16px 0; }
.progress-summary div { display: flex; flex-direction: column; }
.progress-summary strong { font-size: 1.7rem; color: var(--primary); font-weight: 700; letter-spacing: -0.02em; }
.progress-summary span { color: var(--muted); font-size: 0.83rem; }

/* ---------- Control rows ---------- */

.control-row { border-top: 1px solid var(--border); padding: 16px 0; }
.control-row.card { border-top: none; padding: 18px 22px; margin-bottom: 14px; }
.control-head { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; flex-wrap: wrap; }
.control-code { font-weight: 700; color: var(--primary); min-width: 55px; font-size: 0.92rem; }
.control-title { font-weight: 600; }
.control-explainer { color: var(--muted); font-size: 0.87rem; margin: 3px 0 8px; }
.nis2-tag { background: var(--accent); color: #fff; font-size: 0.66rem; padding: 2px 8px; border-radius: 999px; font-weight: 700; letter-spacing: 0.02em; }
.nis2-note { font-size: 0.84rem; background: var(--accent-light); border-left: 3px solid var(--accent); padding: 8px 12px; margin: 6px 0 10px; border-radius: 0 6px 6px 0; }
.control-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px 16px; }

.save-bar { position: sticky; bottom: 0; background: rgba(244,246,249,0.96); backdrop-filter: blur(4px); padding: 14px 0; text-align: right; border-top: 1px solid var(--border); }

/* ---------- Auth pages ---------- */

.auth-box { max-width: 380px; margin: 60px auto; background: #fff; padding: 34px; border-radius: var(--radius); border: 1px solid var(--border); box-shadow: var(--shadow-md); text-align: center; }
.auth-logo { display: block; width: 84px; height: 84px; margin: 0 auto 18px; }
.auth-box form, .auth-box p { text-align: left; }
.auth-box h1 { text-align: center; margin-bottom: 20px; }

/* ---------- Alerts ---------- */

.alert { padding: 11px 15px; border-radius: var(--radius-sm); margin-bottom: 18px; font-size: 0.89rem; }
.alert-ok { background: var(--ok-bg); color: var(--ok); }
.alert-error { background: var(--danger-bg); color: var(--danger); }

.chip { display: inline-block; background: #eef1f5; border: 1px solid var(--border); border-radius: 999px; padding: 2px 10px; margin: 2px; font-size: 0.78rem; text-decoration: none; color: var(--primary); }
.chip:hover { border-color: var(--accent); color: var(--accent-dark); }

.muted { color: var(--muted); }

.chart-tabs svg { max-width: 560px; width: 100%; height: auto; display: block; margin-bottom: 18px; }
.charts-donut-row { display: flex; gap: 40px; flex-wrap: wrap; align-items: center; }
.charts-donut-item svg { display: block; }

/* ---------- Chapter cards (overview grid) ---------- */

.chapter-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}
.chapter-card {
    display: block;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px 20px;
    text-decoration: none;
    color: var(--text);
    box-shadow: var(--shadow-sm);
    transition: box-shadow 0.15s, border-color 0.15s, transform 0.1s;
}
.chapter-card:hover { box-shadow: var(--shadow-md); border-color: var(--accent); transform: translateY(-1px); }
.chapter-card-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 10px; }
.chapter-card-head strong { color: var(--primary); }
.chapter-card-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 12px; }
.chapter-card-link { font-size: 0.83rem; color: var(--accent-dark); font-weight: 600; }
.chapter-card-info { background: var(--accent-light); border-color: #8fded3; }
.chapter-card-desc { font-size: 0.84rem; color: var(--muted); margin: 6px 0 0; }

/* ---------- Action list ---------- */

.action-list { list-style: none; padding: 0; margin: 6px 0 16px; }
.action-list li { padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 0.9rem; }
.action-list li:last-child { border-bottom: none; }
.action-list a { color: var(--primary); font-weight: 600; text-decoration: none; }
.action-list a:hover { color: var(--accent-dark); text-decoration: underline; }

/* ---------- Evidence lists ---------- */

.evidence-list { list-style: none; padding: 0; margin: 4px 0 12px; }
.evidence-list li { display: flex; align-items: center; gap: 10px; padding: 5px 0; font-size: 0.88rem; }
.inline-form { display: inline; margin: 0; }
.link-btn { background: none; border: none; color: var(--danger); cursor: pointer; padding: 0; font-size: 0.83rem; text-decoration: underline; font-family: inherit; }
.link-btn:hover { opacity: 0.75; }

/* ---------- Sharing ---------- */

.share-link-box { margin-top: 10px; }
.share-link-box input { font-family: "SFMono-Regular", Consolas, monospace; font-size: 0.82rem; background: #fff; }
.share-create-form { display: flex; gap: 16px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 20px; }
.share-create-form label { margin-bottom: 0; min-width: 190px; }
.share-banner { background: var(--warn-bg); border: 1px solid #fbd28b; color: var(--warn); border-radius: var(--radius-sm); padding: 11px 16px; margin-bottom: 20px; font-size: 0.88rem; }

/* ---------- Per-control save feedback ---------- */

.control-save-row { display: flex; align-items: center; gap: 14px; margin-top: 12px; }
.save-status { font-size: 0.86rem; font-weight: 600; min-height: 1.2em; }
.save-status-saving { color: var(--muted); font-weight: 400; font-style: italic; }
.save-status-ok { color: var(--ok); }
.save-status-error { color: var(--danger); }

/* ===================================================================
   Assessment layout: sticky left sidebar + content
   =================================================================== */

.assessment-layout {
    display: flex;
    align-items: flex-start;
    gap: 28px;
}
.assessment-sidebar {
    flex: 0 0 var(--sidebar-width);
    width: var(--sidebar-width);
    position: sticky;
    top: 20px;
}
.assessment-content {
    flex: 1 1 0%;
    min-width: 0;
}

.sidebar-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 18px;
    margin-bottom: 16px;
}
.sidebar-title { font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); margin: 0 0 10px; }
.sidebar-assessment-name { font-weight: 700; color: var(--primary); font-size: 0.98rem; line-height: 1.3; margin-bottom: 3px; }
.sidebar-org-name { font-size: 0.82rem; color: var(--muted); margin-bottom: 4px; }

.sidebar-nav { list-style: none; margin: 0; padding: 0; }
.sidebar-nav li { margin-bottom: 2px; }
.sidebar-nav a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 9px 12px;
    border-radius: var(--radius-sm);
    text-decoration: none;
    color: #344155;
    font-size: 0.88rem;
    font-weight: 500;
    border-left: 3px solid transparent;
    transition: background 0.12s, border-color 0.12s;
}
.sidebar-nav a:hover { background: #f1f5f9; }
.sidebar-nav a.sidebar-nav-active {
    background: var(--accent-light);
    color: var(--accent-dark);
    font-weight: 700;
    border-left-color: var(--accent);
}
.sidebar-nav-badge {
    font-size: 0.7rem;
    font-weight: 700;
    padding: 1px 7px;
    border-radius: 999px;
    background: var(--danger-bg);
    color: var(--danger);
    flex-shrink: 0;
}
.sidebar-nav-badge-done { background: var(--ok-bg); color: var(--ok); }
.sidebar-nav-divider { border: none; border-top: 1px solid var(--border); margin: 12px 0; }
.sidebar-nav-sep { padding: 4px 12px 2px; }

.sidebar-mini-progress { height: 4px; background: #e6e9ef; border-radius: 3px; overflow: hidden; margin-top: 8px; }
.sidebar-mini-progress-bar { height: 100%; background: var(--accent); border-radius: 3px; }

/* ---------- Footer ---------- */

.site-footer { text-align: center; padding: 24px; color: var(--muted); font-size: 0.8rem; }

/* ---------- Responsive ---------- */

@media (max-width: 900px) {
    .assessment-layout { flex-direction: column; }
    .assessment-sidebar { width: 100%; position: static; }
    .sidebar-nav { display: flex; flex-wrap: wrap; gap: 6px; }
    .sidebar-nav li { margin-bottom: 0; }
    .sidebar-nav a { border-left: none; border-bottom: 3px solid transparent; }
    .sidebar-nav a.sidebar-nav-active { border-bottom-color: var(--accent); border-left-color: transparent; }
    .sidebar-nav-divider, .sidebar-nav-sep { display: none; }
}

@media (max-width: 700px) {
    .control-fields { grid-template-columns: 1fr 1fr; }
    .container { padding: 20px 16px 60px; }
}
