:root {
    --bg: #f5f7fa;
    --surface: #ffffff;
    --border: #e3e8ef;
    --text: #1f2937;
    --muted: #6b7280;
    --primary: #1e4fd6;
    --primary-hover: #173fae;
    --primary-soft: #eaf0fd;
    --danger: #dc2626;
    --success: #059669;
    --warning: #d97706;
    --sidebar: #0b1530;
    --sidebar-text: #cbd5e1;
    --radius: 8px;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    font-size: 14px;
    color: var(--text);
    background: var(--bg);
    line-height: 1.45;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 22px; margin: 0 0 16px; }
h2 { font-size: 16px; margin: 0 0 12px; }
h3 { font-size: 14px; margin: 0 0 8px; }

/* ---------- layout ---------- */
.shell { display: flex; min-height: 100vh; }
.sidebar {
    width: 220px; flex-shrink: 0; background: var(--sidebar); color: var(--sidebar-text);
    display: flex; flex-direction: column; padding: 18px 12px; position: sticky; top: 0; height: 100vh;
    /* A long menu scrolls inside the dark sidebar instead of spilling past it. */
    overflow-y: auto; overscroll-behavior: contain;
    scrollbar-width: thin; scrollbar-color: #1e4fd6 transparent;
}
.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-thumb { background: #1e4fd6; border-radius: 3px; }
.nav, .sidebar-footer { flex-shrink: 0; }
.brand { font-weight: 700; font-size: 18px; color: #fff; padding: 0 10px; display: flex; align-items: center; gap: 8px; }
.brand-dot { width: 10px; height: 10px; border-radius: 50%; background: #0845fb; display: inline-block; }
.workspace-name { font-size: 12px; color: #94a3b8; padding: 2px 10px 18px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav a {
    display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 6px;
    color: var(--sidebar-text); font-weight: 500;
}
.nav a:hover { background: #16244a; text-decoration: none; color: #fff; }
.nav a.active { background: #1e4fd6; color: #fff; }
.nav .section { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: #64748b; padding: 16px 10px 6px; }
.sidebar-footer { margin-top: auto; padding: 10px; font-size: 13px; border-top: 1px solid #16244a; }
.sidebar-footer a { color: var(--sidebar-text); }
.sidebar-footer button { background: none; border: 0; color: #94a3b8; padding: 0; cursor: pointer; font: inherit; }
.running-pill { display: block; margin: 0 0 12px; padding: 8px 10px; border-radius: 6px; background: #064e3b; color: #a7f3d0; font-size: 12px; }
.main { flex: 1; min-width: 0; padding: 24px 32px 48px; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.page-head h1 { margin: 0; }

@media (max-width: 860px) {
    .shell { flex-direction: column; }
    .sidebar { width: 100%; height: auto; position: static; padding: 12px; }
    .nav { display: flex; flex-wrap: wrap; gap: 4px; }
    .nav .section { display: none; }
    .workspace-name { padding-bottom: 8px; }
    .sidebar-footer { margin-top: 8px; }
    .main { padding: 16px; }
}

/* ---------- components ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; margin-bottom: 16px; }
.card.flush { padding: 0; overflow: hidden; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 860px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    padding: 8px 14px; border-radius: 6px; border: 1px solid var(--border); background: var(--surface);
    color: var(--text); font: inherit; font-weight: 500; cursor: pointer; white-space: nowrap;
}
.btn:hover { background: #f3f4f6; text-decoration: none; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-danger { color: var(--danger); }
.btn-danger:hover { background: #fef2f2; }
.btn-stop { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-stop:hover { background: #b91c1c; }
.btn-sm { padding: 4px 9px; font-size: 13px; }
.btn-icon { padding: 4px 8px; border: 0; background: transparent; color: var(--muted); }
.btn-icon:hover { background: #f3f4f6; color: var(--text); }

label { display: block; font-size: 13px; font-weight: 500; margin-bottom: 4px; color: #374151; }
.field { margin-bottom: 12px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=time], select, textarea {
    width: 100%; padding: 8px 10px; border: 1px solid var(--border); border-radius: 6px;
    font: inherit; background: #fff; color: var(--text);
}
input:focus, select:focus, textarea:focus { outline: 2px solid #c4d4f7; border-color: var(--primary); }
input[type=color] { width: 44px; height: 36px; padding: 2px; border: 1px solid var(--border); border-radius: 6px; background: #fff; }
textarea { min-height: 70px; resize: vertical; }
.check { display: inline-flex; align-items: center; gap: 6px; font-weight: 400; font-size: 14px; cursor: pointer; }
.hint { font-size: 12px; color: var(--muted); margin-top: 4px; }
.row { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.row > .grow { flex: 1; min-width: 160px; }

.alert { padding: 10px 14px; border-radius: 6px; margin-bottom: 16px; }
.alert-success { background: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0; }
.alert-error { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.alert-error ul { margin: 0; padding-left: 18px; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; background: #fafbfc; }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table-wrap { overflow-x: auto; }

.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 500; background: #f3f4f6; color: #374151; }
.badge-blue { background: var(--primary-soft); color: var(--primary); }
.badge-green { background: #ecfdf5; color: var(--success); }
.badge-amber { background: #fffbeb; color: var(--warning); }
.badge-red { background: #fef2f2; color: var(--danger); }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }
.project-tag { display: inline-flex; align-items: center; font-weight: 500; }
.muted { color: var(--muted); }
.mono { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }
.right { text-align: right; }
.empty { text-align: center; color: var(--muted); padding: 32px 16px; }

details > summary { cursor: pointer; list-style: none; }
details > summary::-webkit-details-marker { display: none; }

/* ---------- auth ---------- */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px 16px; }
.auth-card { width: 100%; max-width: 420px; background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: 28px; }
.auth-card.wide { max-width: 520px; }
.auth-card .brand { color: var(--text); padding: 0; margin-bottom: 18px; }
.auth-card .btn-primary { width: 100%; padding: 10px; margin-top: 6px; }
.auth-foot { text-align: center; margin-top: 16px; font-size: 13px; color: var(--muted); }

.btn-google { width: 100%; padding: 10px; background: #fff; border-color: #dadce0; color: #3c4043; margin-bottom: 4px; }
.btn-google:hover { background: #f8f9fa; }
.divider { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; margin: 14px 0; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }

/* ---------- mobile: compact top bar + hamburger (also used inside the Android app) ---------- */
.brand-row { display: flex; align-items: center; justify-content: space-between; }
.nav-toggle { display: none; background: none; border: 0; padding: 6px; cursor: pointer; color: #fff; }
.nav-toggle span { display: block; width: 22px; height: 2px; background: currentColor; margin: 5px 0; border-radius: 2px; transition: transform .2s, opacity .2s; }
.sidebar.open .nav-toggle span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.sidebar.open .nav-toggle span:nth-child(2) { opacity: 0; }
.sidebar.open .nav-toggle span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
@media (max-width: 860px) {
    .sidebar { position: sticky; top: 0; z-index: 50; padding: 10px 14px; padding-top: max(10px, env(safe-area-inset-top)); height: auto; max-height: 100vh; }
    .nav-toggle { display: block; }
    .workspace-name { display: none; }
    .sidebar .nav, .sidebar .sidebar-footer { display: none; }
    .sidebar.open .nav { display: flex; flex-direction: column; flex-wrap: nowrap; gap: 0; margin-top: 10px; max-height: calc(100vh - 140px); overflow-y: auto; }
    .sidebar.open .nav .section { display: block; padding-top: 10px; }
    .sidebar.open .sidebar-footer { display: block; }
    .running-pill { margin: 8px 0 0; }
    .main { padding: 14px; }
    .page-head h1 { font-size: 20px; }
    .timer-bar .clock { flex: 1; text-align: left; }
    .timer-bar .btn { flex: 1; padding: 10px; }
    input, select, textarea { font-size: 16px; } /* no zoom-on-focus on iOS/Android */
}
.get-android { display: block; font-size: 12px; margin-bottom: 10px; color: #93c5fd !important; }
@media (display-mode: standalone), (display-mode: fullscreen) { .get-android { display: none; } }

.btn-google + .btn-google { margin-top: 6px; }
.busy-note { margin-top: 12px; padding: 10px 12px; border-radius: 8px; background: var(--primary-soft); color: #173fae; font-size: 14px; display: flex; align-items: center; gap: 8px; }
.spinner { width: 16px; height: 16px; border: 2px solid #c4d4f7; border-top-color: var(--primary); border-radius: 50%; display: inline-block; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.seat-meter { font-size: 13px; color: var(--muted); background: #fff; border: 1px solid var(--border); border-radius: 999px; padding: 6px 14px; }
.seat-meter b { color: var(--text); }
.seat-meter a { margin-left: 8px; font-weight: 600; }
.seat-meter.full { border-color: #fcd34d; background: #fffbeb; }

.auth-card .btn-block { width: 100%; padding: 10px; }

/* standard switcher */
.topbar { display: flex; align-items: center; justify-content: flex-start; gap: 12px; margin: -8px 0 18px; padding-bottom: 14px; border-bottom: 1px solid var(--border); }
.std-switch { display: flex; align-items: center; gap: 10px; margin: 0; }
.std-switch label { margin: 0; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; }
.std-switch select { width: auto; min-width: 280px; max-width: 100%; font-weight: 600; border-color: var(--primary); }
@media (max-width: 860px) { .std-switch { flex-wrap: wrap; width: 100%; } .std-switch select { flex: 1; min-width: 0; } }

/* page banner, stat cards, filters (Users & permissions) */
.page-banner { position: relative; display: flex; align-items: center; gap: 16px; flex-wrap: wrap; padding: 22px 24px; border-radius: 12px; margin-bottom: 16px; color: #fff; background: linear-gradient(120deg, #173fae 0%, #1d3fa8 55%, #0845fb 130%); overflow: hidden; }
.page-banner::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 3px; background: linear-gradient(90deg, #0845fb, #a78bfa, #f59e0b); }
.page-banner h1 { margin: 0 0 4px; font-size: 22px; }
.page-banner p { margin: 0; font-size: 13px; color: #d6e0f8; }
.banner-icon { width: 44px; height: 44px; border-radius: 10px; display: grid; place-items: center; background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.25); flex-shrink: 0; }
.banner-eyebrow { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: #b9c9f2; }
.banner-meter { margin-left: auto; background: rgba(255,255,255,.12); border-color: rgba(255,255,255,.25); color: #d6e0f8; }
.banner-meter b { color: #fff; }
.banner-meter a { color: #fff; text-decoration: underline; }
.banner-meter.full { background: rgba(251,191,36,.22); border-color: #fbbf24; }
.stat-cards { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 16px; }
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; }
.stat-card span { display: block; font-size: 12px; color: var(--muted); }
.stat-card b { font-size: 28px; color: #0b1530; line-height: 1.3; }
@media (max-width: 860px) { .stat-cards { grid-template-columns: 1fr 1fr; } .banner-meter { margin-left: 0; } }
.filters-title { display: flex; align-items: center; gap: 8px; font-size: 14px; margin-bottom: 14px; }
.filter-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0 16px; }
.filter-grid .span-2 { grid-column: span 2; }
@media (max-width: 860px) { .filter-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 520px) { .filter-grid { grid-template-columns: 1fr; } .filter-grid .span-2 { grid-column: auto; } }
.list-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; padding: 18px 16px 10px; }
.per-page { margin: 0; }
.per-page label { font-weight: 400; margin: 0; }
.info-note { margin: 0 16px 14px; padding: 10px 14px; background: var(--primary-soft); border-radius: 6px; font-size: 12.5px; color: #173fae; }
th a.sort { color: inherit; text-decoration: none; display: inline-flex; gap: 6px; }
th a.sort span { color: #a8b8dc; font-size: 10px; }
.pagination { display: flex; align-items: center; justify-content: center; gap: 12px; margin: 14px 0; }
.btn.disabled { opacity: .4; pointer-events: none; }

/* organization */
.org-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 16px; align-items: start; }
.org-layout.chart-mode { grid-template-columns: 1fr; }
@media (max-width: 1000px) { .org-layout { grid-template-columns: 1fr; } }
.org-node { display: block; border: 1px solid var(--border); border-radius: 8px; padding: 8px 12px; background: #fff; color: var(--text); text-decoration: none; }
a.org-node:hover { border-color: var(--primary); text-decoration: none; }
.org-node.active { border-color: var(--primary); background: var(--primary-soft); box-shadow: 0 0 0 2px #c4d4f7; }
.org-node.root { background: #0b1530; color: #fff; border-color: #0b1530; display: inline-block; }
.org-node.root .org-type { color: #b9c9f2; }
.org-type { display: block; font-size: 10px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); }
.org-node b { display: block; font-size: 14px; }
.org-meta { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; }
.orgtree, .orgtree ul { list-style: none; margin: 0; padding: 0; }
.orgtree ul { margin-left: 18px; padding-left: 16px; border-left: 2px solid #d5e0f7; }
.orgtree li { margin: 8px 0; position: relative; }
.orgtree ul > li::before { content: ""; position: absolute; left: -16px; top: 22px; width: 14px; border-top: 2px solid #d5e0f7; }
.orgchart { overflow-x: auto; padding: 8px 0 16px; }
.orgchart ul { padding-top: 20px; position: relative; display: flex; justify-content: center; margin: 0; padding-left: 0; list-style: none; }
.orgchart > ul { padding-top: 0; }
.orgchart li { text-align: center; position: relative; padding: 20px 8px 0; min-width: 150px; }
.orgchart > ul > li { padding-top: 0; }
.orgchart li::before, .orgchart li::after { content: ""; position: absolute; top: 0; right: 50%; border-top: 2px solid #c0cff2; width: 50%; height: 20px; }
.orgchart li::after { right: auto; left: 50%; border-left: 2px solid #c0cff2; }
.orgchart > ul > li::before, .orgchart > ul > li::after { display: none; }
.orgchart li:only-child::before, .orgchart li:only-child::after { display: none; }
.orgchart li:only-child { padding-top: 20px; }
.orgchart > ul > li:only-child { padding-top: 0; }
.orgchart li:first-child::before, .orgchart li:last-child::after { border: 0 none; }
.orgchart li:last-child::before { border-right: 2px solid #c0cff2; border-radius: 0 6px 0 0; }
.orgchart li:first-child::after { border-radius: 6px 0 0 0; }
.orgchart ul ul::before { content: ""; position: absolute; top: 0; left: 50%; border-left: 2px solid #c0cff2; height: 20px; }
.orgchart .org-node { display: inline-block; text-align: center; min-width: 130px; max-width: 200px; }
.org-panel .card { margin-bottom: 14px; }
.org-crumb { font-size: 12px; color: var(--muted); }
.member-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: 10px 0; border-bottom: 1px solid var(--border); }
.member-add { margin-top: 14px; }
.add-top { position: relative; }
.add-top > summary { list-style: none; }
.add-top-form { position: absolute; right: 0; top: 44px; z-index: 5; width: 300px; box-shadow: 0 8px 24px rgba(11,21,48,.18); }
.segmented { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; background: #fff; }
.segmented a { padding: 8px 14px; font-weight: 600; font-size: 13px; color: var(--muted); text-decoration: none; }
.segmented a + a { border-left: 1px solid var(--border); }
.segmented a.active { background: var(--primary); color: #fff; }

/* personnel module */
.subtabs { display: flex; gap: 2px; flex-wrap: wrap; border-bottom: 1px solid var(--border); margin: -4px 0 16px; background: var(--surface); border-radius: 8px 8px 0 0; padding: 0 8px; }
.subtabs a { padding: 12px 14px; font-weight: 600; font-size: 13px; color: var(--muted); text-decoration: none; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.subtabs a:hover { color: var(--text); }
.subtabs a.active { color: var(--primary); border-bottom-color: var(--primary); }
.subtabs.inner { background: transparent; padding: 0; margin: 0 0 14px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }
.form-grid .span-all { grid-column: 1 / -1; }
@media (max-width: 700px) { .form-grid { grid-template-columns: 1fr; } }
.req { color: var(--danger); }
.checkbox-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 6px 14px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 6px; background: #fff; }
.due { font-variant-numeric: tabular-nums; }
.due-late { color: var(--danger); font-weight: 600; }
.due-soon { color: var(--warning); font-weight: 600; }
.ov-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; margin-bottom: 14px; }
.ov-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; }
.ov-card h3 { margin: 0 0 6px; font-size: 15px; color: #0b1530; }
.ov-card b { display: block; font-size: 30px; line-height: 1.2; color: #0b1530; }
.ov-card span { display: block; font-size: 12px; color: var(--muted); margin-bottom: 10px; }
.ov-bar { border-radius: 4px; padding: 3px 8px; font-size: 11px; font-weight: 700; text-align: center; color: #fff; background: #6b7280; }
.ov-bar.ok { background: #15803d; } .ov-bar.warn { background: #d97706; }
.ov-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-bottom: 14px; }
.ov-row .card { margin-bottom: 0; }
@media (max-width: 1000px) { .ov-row { grid-template-columns: 1fr; } }
.ov-line { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.ov-line:last-child { border-bottom: 0; }
.count { min-width: 26px; text-align: center; padding: 1px 8px; border-radius: 999px; color: #fff; font-size: 12px; font-weight: 700; background: #6b7280; }
.count.blue { background: #0845fb; } .count.green { background: #15803d; } .count.amber { background: #d97706; } .count.red { background: #dc2626; }
.ov-item { padding: 7px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.ov-item:last-child { border-bottom: 0; }
.ov-item .muted { margin-left: 6px; }
.people-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 14px; }
.person { display: flex; gap: 12px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; }
.avatar { width: 42px; height: 42px; border-radius: 50%; background: var(--primary-soft); color: var(--primary); font-weight: 700; display: grid; place-items: center; flex-shrink: 0; }
.person-body { min-width: 0; font-size: 13px; }
.person-body b { font-size: 14px; }
.person-units { margin: 4px 0; }
.facts dt { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-top: 12px; }
.facts dd { margin: 2px 0 0; }

/* personnel notifications — colour = urgency (never emailed, shown on the panel only) */
.sev-expired { --sev: #dc2626; --sev-bg: #fef2f2; }
.sev-urgent { --sev: #ea580c; --sev-bg: #fff7ed; }
.sev-soon { --sev: #ca8a04; --sev-bg: #fefce8; }
.sev-notice { --sev: #2563eb; --sev-bg: #eff6ff; }
.notifs-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.legend-row { display: flex; gap: 6px; flex-wrap: wrap; }
.sev-pill { font-size: 11px; font-weight: 700; padding: 2px 9px; border-radius: 999px; color: var(--sev); background: var(--sev-bg); border: 1px solid var(--sev); }
.notif-group { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin: 14px 0 6px; }
.notif { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 8px 12px; margin-bottom: 5px; border-radius: 6px; border-left: 4px solid var(--sev); background: var(--sev-bg); color: var(--text); text-decoration: none; font-size: 13px; }
.notif:hover { text-decoration: none; filter: brightness(.97); }
.notif-what { color: #4b5563; margin-left: 4px; }
.notif-when { color: var(--sev); font-weight: 700; white-space: nowrap; }
.notif-more { display: block; font-size: 12px; margin: 6px 0 0 4px; }
.bell { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 999px; color: var(--sev); background: var(--sev-bg); border: 1px solid var(--sev); font-size: 13px; text-decoration: none; }
.bell:hover { text-decoration: none; filter: brightness(.96); }
.nav-badge { margin-left: auto; min-width: 20px; text-align: center; padding: 0 6px; border-radius: 999px; font-size: 11px; font-weight: 700; color: #fff; background: var(--sev); }
.nav a { position: relative; }

/* language switcher */
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.lang-switch { margin: 0; }
.lang-switch select { width: auto; padding: 5px 8px; font-size: 13px; font-weight: 600; }
.guest-lang { position: absolute; top: 14px; right: 16px; z-index: 5; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Quality system */
.kv { display: grid; grid-template-columns: 220px 1fr; gap: 8px 16px; margin: 0 0 12px; }
.kv dt { color: var(--muted); font-size: 13px; }
.kv dd { margin: 0; }
@media (max-width: 700px) { .kv { grid-template-columns: 1fr; } .kv dt { margin-top: 6px; } }
.qms-section { max-width: 900px; }
.qms-section h2 { margin-top: 0; }
.inline-grid input, .inline-grid select { min-width: 110px; }
.heat { border-collapse: separate; border-spacing: 3px; }
.heat th { font-size: 11px; color: var(--muted); font-weight: 600; padding: 2px 6px; background: transparent; border: 0; }
.heat td { width: 46px; height: 38px; text-align: center; font-weight: 700; border-radius: 6px; border: 0; padding: 0; color: #0b1530; }
.heat .lv-low { background: #dcfce7; } .heat .lv-medium { background: #fef9c3; } .heat .lv-high { background: #fed7aa; } .heat .lv-critical { background: #fecaca; }
.heat td a { display: block; line-height: 38px; color: inherit; text-decoration: none; }
.heat td.zero { opacity: .55; font-weight: 400; }
.rating { display: inline-block; min-width: 2.2em; text-align: center; border-radius: 4px; padding: 1px 6px; font-weight: 700; }
.rating.lv-low { background: #dcfce7; color: #166534; } .rating.lv-medium { background: #fef9c3; color: #854d0e; }
.rating.lv-high { background: #fed7aa; color: #9a3412; } .rating.lv-critical { background: #fecaca; color: #991b1b; }

/* Quality system guide */
.banner-help { margin-left: auto; width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: 20px; color: #fff; text-decoration: none; background: rgba(255,255,255,.16); border: 1px solid rgba(255,255,255,.4); flex-shrink: 0; }
.banner-help:hover { background: rgba(255,255,255,.3); }
.guide { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 16px; align-items: start; }
.guide-toc { position: sticky; top: 12px; display: flex; flex-direction: column; gap: 2px; }
.guide-toc h2 { margin: 0 0 8px; font-size: 15px; }
.guide-toc a { padding: 6px 8px; border-radius: 6px; font-size: 13px; text-decoration: none; color: var(--text); }
.guide-toc a:hover { background: var(--bg, #f3f4f6); color: var(--primary); }
.guide-toc .guide-back { margin-top: 8px; border-top: 1px solid var(--border); border-radius: 0; padding-top: 10px; color: var(--muted); }
.guide-body section { scroll-margin-top: 12px; }
.guide-body h2 { margin-top: 0; }
.guide-body li { margin-bottom: 6px; line-height: 1.5; }
.faq-item { border-top: 1px solid var(--border); padding: 10px 0; }
.faq-item:first-of-type { border-top: 0; }
.faq-item p { margin: 8px 0 0; color: var(--muted); }
@media (max-width: 900px) { .guide { grid-template-columns: 1fr; } .guide-toc { position: static; } }

/* Suppliers */
.sub-item { border-top: 1px solid var(--border); padding: 10px 0; }
.sub-item:first-of-type { border-top: 0; }
.sub-item > summary { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.qual-step { border-top: 1px solid var(--border); padding: 10px 0; }
.qual-step:first-of-type { border-top: 0; }
.qual-head { display: flex; gap: 10px; align-items: flex-start; }
.qual-dot { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 700; background: var(--border); color: var(--muted); flex-shrink: 0; }
.qual-dot.done { background: #15803d; color: #fff; }
.qual-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; align-items: end; margin: 8px 0 0 34px; }
.qual-fields .span-all { grid-column: 1 / -1; }
@media print {
  .sidebar, .topbar, .no-print, .subtabs { display: none !important; }
  .main { margin: 0 !important; padding: 0 !important; }
  .card { box-shadow: none !important; border: 0 !important; }
  body { background: #fff !important; }
}

/* Documentation */
.checks { display: flex; flex-wrap: wrap; gap: 6px 16px; padding: 6px 0; }
.check { display: inline-flex; align-items: center; gap: 6px; font-weight: 400; }
.tree, .tree ul { list-style: none; margin: 0; padding-left: 20px; }
.tree { padding-left: 0; }
.tree li { margin: 3px 0; }
.tree details > summary { cursor: pointer; font-weight: 600; padding: 3px 0; }
.tree .doc-line { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 2px 0; }
.tree .doc-line .num { font-family: monospace; font-size: 12px; color: var(--muted); }
.view-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.view-tabs a { padding: 6px 12px; border-radius: 999px; border: 1px solid var(--border); text-decoration: none; font-size: 13px; color: var(--text); }
.view-tabs a.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.scope-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.scope-tabs a { padding: 5px 11px; border-radius: 6px; background: var(--surface); border: 1px solid var(--border); font-size: 13px; text-decoration: none; color: var(--text); }
.scope-tabs a.active { border-color: var(--primary); color: var(--primary); font-weight: 700; }

/* Small note after a module's name: the standards it is needed for. */
.std-note { font-size: 10px; font-weight: 400; letter-spacing: 0; text-transform: none; opacity: .6; margin-left: 2px; }

/* System overview (cockpit) */
.cockpit-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; margin: 16px 0; }
.cockpit-card { display: block; background: var(--card, #fff); border: 1px solid var(--line, #e5e1ee); border-left: 5px solid #16a34a; border-radius: 12px; padding: 14px 16px; color: inherit; text-decoration: none; }
.cockpit-card:hover { box-shadow: 0 4px 14px rgba(11, 21, 48, .10); }
.cockpit-card.status-warn { border-left-color: #d97706; } .cockpit-card.status-bad { border-left-color: #dc2626; }
.cockpit-head { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; } .cockpit-icon { font-size: 16px; }
.cockpit-status { font-size: 13px; margin: 6px 0 10px; } .dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: #16a34a; margin-right: 4px; }
.dot-warn { background: #d97706; } .dot-bad { background: #dc2626; }
.cockpit-metrics { display: flex; gap: 14px; flex-wrap: wrap; } .cm { display: flex; flex-direction: column; min-width: 70px; } .cm b { font-size: 20px; line-height: 1.1; } .cm span { font-size: 12px; color: var(--muted, #6b6480); }
.cm.warn b { color: #b45309; } .cm.bad b { color: #dc2626; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 14px; }
.chip { font-size: 12px; padding: 3px 10px; border-radius: 999px; border: 1px solid var(--line, #e5e1ee); color: inherit; text-decoration: none; background: #dcfce7; }
.chip-warn { background: #fef3c7; } .chip-bad { background: #fee2e2; }

/* ---------- Deadlines and tasks: colourful tiles, friendly rows ---------- */
.task-tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 16px; }
.task-tile { --c: #1e4fd6; --soft: #eaf0fd; display: block; position: relative; background: var(--surface); border: 1px solid var(--border); border-top: 4px solid var(--c); border-radius: 12px; padding: 14px 16px 12px; color: inherit; text-decoration: none; transition: transform .15s ease, box-shadow .15s ease; }
.task-tile:hover { transform: translateY(-2px); box-shadow: 0 10px 22px rgba(11, 21, 48, .12); text-decoration: none; }
.task-tile.active { box-shadow: 0 0 0 2px var(--c), 0 10px 22px rgba(11, 21, 48, .12); }
.task-tile .tt-ico { position: absolute; right: 14px; top: 12px; width: 38px; height: 38px; display: grid; place-items: center; border-radius: 50%; background: var(--soft); font-size: 19px; }
.task-tile .tt-label { display: block; font-weight: 700; font-size: 13px; color: #0b1530; padding-right: 44px; }
.task-tile b { display: block; font-size: 36px; line-height: 1.1; color: var(--c); margin-top: 8px; }
.task-tile small { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
.task-tile.is-zero b { opacity: .45; }
.tile-red { --c: #dc2626; --soft: #fef2f2; } .tile-orange { --c: #ea580c; --soft: #fff7ed; } .tile-amber { --c: #d97706; --soft: #fffbeb; }
.tile-cyan { --c: #0891b2; --soft: #ecfeff; } .tile-green { --c: #059669; --soft: #ecfdf5; } .tile-blue { --c: #0845fb; --soft: #eef2ff; }
.tile-slate { --c: #64748b; --soft: #f1f5f9; } .tile-pink { --c: #db2777; --soft: #fdf2f8; }
.task-tile.tile-red:not(.is-zero) b { animation: tile-beat 2s ease-in-out infinite; }
@keyframes tile-beat { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.06); } }
@media (prefers-reduced-motion: reduce) { .task-tile.tile-red:not(.is-zero) b { animation: none; } .task-tile { transition: none; } }
.task-bar { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin: 0 0 16px; }
.task-progress { flex: 1; min-width: 220px; }
.task-progress .tp-text { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.task-progress .tp-bar { height: 10px; border-radius: 6px; background: #e3e9f6; overflow: hidden; }
.task-progress .tp-bar i { display: block; height: 100%; border-radius: 6px; background: linear-gradient(90deg, #0845fb, #a78bfa, #22c55e); transition: width .4s ease; }
.task-table td { vertical-align: middle; }
.task-table tr.row-expired td:first-child { box-shadow: inset 4px 0 0 #dc2626; }
.task-table tr.row-urgent td:first-child { box-shadow: inset 4px 0 0 #ea580c; }
.task-table tr.row-soon td:first-child { box-shadow: inset 4px 0 0 #f59e0b; }
.task-table tr.row-notice td:first-child { box-shadow: inset 4px 0 0 #60a5fa; }
.task-table tr.row-approval td:first-child { box-shadow: inset 4px 0 0 #a78bfa; }
.task-table tr.row-done td:first-child { box-shadow: inset 4px 0 0 #22c55e; }
.task-table tr.row-done .t-title { text-decoration: line-through; opacity: .6; }
.task-table tbody tr:hover { background: #f6f8ff; }
.t-item { display: flex; align-items: center; gap: 10px; }
.t-ico { flex: none; display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 10px; background: var(--primary-soft); color: var(--primary); font-size: 15px; }
.t-ico.k-approval { background: #f5f3ff; color: #7c3aed; } .t-ico.k-task { background: #ecfdf5; color: #059669; }
.check-btn { width: 30px; height: 30px; border-radius: 50%; border: 2px solid #cbd5e1; background: #fff; color: #cbd5e1; font-weight: 700; font-size: 14px; line-height: 1; cursor: pointer; transition: all .15s ease; }
.check-btn:hover, .check-btn:focus-visible { border-color: #059669; background: #059669; color: #fff; transform: scale(1.1); }
.check-btn.done { border-color: #059669; background: #059669; color: #fff; }
.task-empty { text-align: center; padding: 38px 16px; color: var(--muted); }
.task-empty .big { display: block; font-size: 46px; line-height: 1.2; }
.task-empty b { display: block; color: #0b1530; font-size: 16px; margin: 4px 0; }
@media (max-width: 860px) { .task-tiles { grid-template-columns: 1fr 1fr; } }

/* ---------- compact filters: more fields per row, smaller controls, less scrolling ---------- */
.filters { padding: 10px 14px 8px; }
.filters-title { margin-bottom: 8px; font-size: 13px; font-weight: 600; }
.filter-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 0 12px; }
.filter-grid .span-2 { grid-column: span 2; }
.filters .field { margin-bottom: 8px; }
.filters label { font-size: 11px; margin-bottom: 2px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
.filters input[type=text], .filters input[type=number], .filters input[type=date], .filters select { padding: 5px 8px; font-size: 13px; }
.filters .hint { display: none; }
.filters .row { margin-top: 0; }
.filters .row .btn { padding: 5px 12px; font-size: 13px; }
@media (max-width: 860px) { .filter-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); } }
@media (max-width: 520px) { .filter-grid { grid-template-columns: 1fr 1fr; } .filter-grid .span-2 { grid-column: 1 / -1; } }
/* fields and buttons share rows (the grid only groups them) */
.filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 0 12px; }
.filters-title { flex: 0 0 100%; }
.filter-grid { display: contents; }
.filters .field { flex: 1 1 150px; min-width: 130px; max-width: 260px; }
.filters .field.span-2 { flex: 2 1 300px; max-width: 520px; }
.filters > .row { flex: 0 0 auto; margin: 0 0 8px; }

/* ---------- documentation tree ---------- */
.tree-bar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.tree-search { flex: 1 1 220px; min-width: 180px; max-width: 360px; padding: 6px 10px; font-size: 13px; }
.tree-legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); margin-bottom: 12px; }
.tc-ok { color: #059669; } .tc-review { color: #0845fb; } .tc-draft { color: #6b7280; } .tc-late { color: #dc2626; font-weight: 600; }
.doc-tree details.tree-group { margin: 4px 0; border-left: 3px solid var(--border); padding-left: 10px; }
.doc-tree details.tree-group > summary { cursor: pointer; list-style: none; display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; padding: 6px 8px; border-radius: 8px; font-size: 14px; }
.doc-tree details.tree-group > summary::-webkit-details-marker { display: none; }
.doc-tree details.tree-group > summary::before { content: "▸"; color: var(--primary); transition: transform .15s ease; display: inline-block; }
.doc-tree details.tree-group[open] > summary::before { transform: rotate(90deg); }
.doc-tree details.tree-group > summary:hover { background: #f1f5fe; }
.tg-label { font-weight: 700; color: #0b1530; }
.tg-counts { margin-left: auto; display: inline-flex; gap: 10px; font-size: 12px; align-items: baseline; }
.tg-n { font-weight: 700; color: #0b1530; background: var(--primary-soft); border-radius: 999px; padding: 0 8px; }
.tree-children { padding-left: 18px; border-left: 1px dashed var(--border); margin-left: 6px; }
.tree-doc { padding: 3px 0; }
.tree-doc > .doc-line { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.tree-owner { font-size: 12px; }
.tree-empty { padding: 4px 8px; font-size: 13px; }
.tree-hidden { display: none !important; }

/* ======================= alfisec DMS ======================= */
.topbar .top-search { flex: 1 1 320px; max-width: 520px; display: flex; gap: 6px; margin: 0; }
.topbar .top-search input { padding: 7px 12px; }
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; font-size: 13px; color: var(--muted); margin-bottom: 10px; }
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--primary); }
.crumbs .sep { opacity: .5; }
.crumbs b { color: var(--text); }
.folder-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; margin-bottom: 16px; }
.folder-card { display: flex; gap: 12px; align-items: center; padding: 12px 14px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; color: var(--text); text-decoration: none; transition: border-color .15s, box-shadow .15s; }
.folder-card:hover { border-color: var(--primary); box-shadow: 0 4px 14px rgba(11,21,48,.08); text-decoration: none; }
.folder-card .fi { width: 38px; height: 38px; border-radius: 9px; background: #fef3c7; color: #b45309; display: grid; place-items: center; flex-shrink: 0; }
.folder-card .fi.locked { background: #eaf0fd; color: var(--primary); }
.folder-card b { display: block; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.folder-card small { color: var(--muted); font-size: 12px; }
.folder-card > div { min-width: 0; }
.ficon { display: inline-grid; place-items: center; min-width: 38px; height: 22px; padding: 0 5px; border-radius: 5px; font-size: 10px; font-weight: 800; letter-spacing: .03em; color: #fff; background: #64748b; text-transform: uppercase; }
.ficon.pdf { background: #dc2626; } .ficon.doc, .ficon.docx, .ficon.odt, .ficon.rtf { background: #2563eb; }
.ficon.xls, .ficon.xlsx, .ficon.ods, .ficon.csv { background: #16a34a; } .ficon.ppt, .ficon.pptx, .ficon.odp { background: #ea580c; }
.ficon.png, .ficon.jpg, .ficon.jpeg, .ficon.gif, .ficon.webp, .ficon.svg { background: #9333ea; } .ficon.zip, .ficon.rar, .ficon.7z { background: #a16207; }
.ficon.none { background: #cbd5e1; }
.doc-title { display: flex; align-items: center; gap: 10px; }
.doc-title a { font-weight: 600; }
.doc-num { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; color: var(--muted); white-space: nowrap; }
.lock-pill { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 600; padding: 1px 8px; border-radius: 999px; background: #fff7ed; color: #c2410c; border: 1px solid #fed7aa; white-space: nowrap; }
.doc-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: start; }
@media (max-width: 1100px) { .doc-layout { grid-template-columns: 1fr; } }
.preview { background: #e8ecf3; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; margin-bottom: 16px; }
.preview iframe { display: block; width: 100%; height: 78vh; min-height: 520px; border: 0; background: #fff; }
.preview img { display: block; max-width: 100%; margin: 0 auto; background: #fff; }
.preview pre { margin: 0; padding: 16px; max-height: 70vh; overflow: auto; background: #fff; font-size: 12.5px; white-space: pre-wrap; }
.preview-empty { padding: 48px 16px; text-align: center; color: var(--muted); }
.preview-empty .ficon { min-width: 64px; height: 36px; font-size: 14px; margin-bottom: 10px; }
.side-card h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-bottom: 10px; }
.side-card .kv { grid-template-columns: 120px 1fr; font-size: 13px; }
.actions-stack { display: flex; flex-direction: column; gap: 8px; }
.actions-stack .btn { justify-content: flex-start; }
.actions-stack form { margin: 0; }
.wf-steps { display: flex; gap: 0; margin: 0 0 14px; font-size: 12px; }
.wf-steps span { flex: 1; text-align: center; padding: 6px 4px; background: #eef1f6; color: var(--muted); font-weight: 600; position: relative; }
.wf-steps span:first-child { border-radius: 6px 0 0 6px; } .wf-steps span:last-child { border-radius: 0 6px 6px 0; }
.wf-steps span.done { background: #dcfce7; color: #166534; }
.wf-steps span.now { background: var(--primary); color: #fff; }
.callout { padding: 12px 14px; border-radius: 8px; margin-bottom: 14px; font-size: 13px; border: 1px solid; }
.callout.info { background: #eff6ff; border-color: #bfdbfe; color: #1e3a8a; }
.callout.warn { background: #fffbeb; border-color: #fde68a; color: #92400e; }
.callout.bad { background: #fef2f2; border-color: #fecaca; color: #991b1b; }
.callout b { display: block; margin-bottom: 2px; }
.timeline { list-style: none; margin: 0; padding: 0; font-size: 13px; }
.timeline li { padding: 7px 0; border-bottom: 1px solid var(--border); display: flex; gap: 10px; }
.timeline li:last-child { border-bottom: 0; }
.timeline time { color: var(--muted); white-space: nowrap; font-size: 12px; min-width: 92px; }
.inline-form { display: inline; margin: 0; }
details.pop > summary { list-style: none; }
details.pop[open] > summary { margin-bottom: 8px; }
.pop-body { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 12px; margin-top: 6px; }
.dropzone { border: 2px dashed #c4d4f7; border-radius: 10px; padding: 18px; text-align: center; background: #f6f8ff; }
.dropzone.drag { border-color: var(--primary); background: #eaf0fd; }
.dropzone input[type=file] { margin-top: 8px; }
mark { background: #fef08a; padding: 0 1px; border-radius: 2px; }
.excerpt { font-size: 12.5px; color: var(--muted); margin-top: 3px; }
.acl-row { display: grid; grid-template-columns: minmax(0, 1fr) 160px 40px; gap: 8px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--border); }
.setup-steps { font-size: 13px; color: var(--muted); margin: -6px 0 16px; }
.tag { display: inline-block; font-size: 11px; padding: 1px 7px; border-radius: 4px; background: #eef1f6; color: #475569; margin: 1px 2px 1px 0; }
