/* ===== Staatsolie SRI Portal — theme ===== */
:root {
    --ink: #16181D;
    --ink-2: #2B2F38;
    --muted: #6B7280;
    --bg: #F3F4F6;
    --surface: #FFFFFF;
    --border: #E4E7EC;
    --border-strong: #D0D5DD;

    --yellow: #FFD100;
    --yellow-600: #E6B800;
    --yellow-tint: #FFF7D1;

    --green: #15803D; --green-bg: #DCFCE7;
    --red: #B91C1C;   --red-bg: #FEE2E2;
    --amber: #B45309; --amber-bg: #FEF3C7;

    --maxw: 1760px;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 1px 3px rgba(16,24,40,.06), 0 1px 2px rgba(16,24,40,.04);
    --shadow-md: 0 8px 24px rgba(16,24,40,.10);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: "PT Sans", "Segoe UI", system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
    color: var(--ink);
    background: var(--bg);
    line-height: 1.5;
    /* Sticky footer: fill the viewport so the footer sits at the bottom. */
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}
main { flex: 1 0 auto; width: 100%; }

/* Staatsolie house style: Oswald for headings/titles, PT Sans for body. */
h1, h2, h3, h4,
.page-title, .header .title, .section-title, .stat .n, .proj-head h3 {
    font-family: "Oswald", "PT Sans", "Segoe UI", Arial, sans-serif;
    font-weight: 600; letter-spacing: .01em;
}

a { color: inherit; }

/* ===== Header ===== */
.header {
    background: var(--ink);
    border-bottom: 4px solid var(--yellow);
}
.header-inner {
    max-width: var(--maxw); margin: 0 auto; padding: 14px 22px;
    display: flex; align-items: center; gap: 16px;
}
.header .logo { height: 40px; border-radius: 6px; }
.header .titles { display: flex; flex-direction: column; }
.header .title { color: #fff; font-weight: 800; font-size: 1.15rem; letter-spacing: -.01em; }
.header .sub { color: var(--yellow); font-size: .76rem; font-weight: 600; }
.header .spacer { flex: 1; }
.header .user {
    display: flex; align-items: center; gap: 12px;
    color: #CBD0D8; font-size: .85rem;
}
.header .user b { color: #fff; font-weight: 600; }
.role-chip {
    background: rgba(255,209,0,.15); color: var(--yellow);
    border: 1px solid rgba(255,209,0,.35);
    padding: 2px 9px; border-radius: 999px; font-size: .72rem; font-weight: 700;
}
.role-chip-link { text-decoration: none; cursor: pointer; }
.role-chip-link:hover { background: rgba(255,209,0,.3); }
.logout-form { display: inline; margin: 0; }
.logout-link { color: #CBD0D8; text-decoration: none; font-weight: 600; background: none;
               border: 0; padding: 0; font: inherit; cursor: pointer; }
.logout-link:hover { color: #fff; }

/* ===== Nav tabs ===== */
.nav {
    background: var(--surface); border-bottom: 1px solid var(--border);
}
.nav-inner { max-width: var(--maxw); margin: 0 auto; padding: 0 22px; display: flex; gap: 4px; }
.nav a {
    padding: 13px 16px; text-decoration: none; color: var(--muted);
    font-weight: 600; font-size: .92rem; border-bottom: 3px solid transparent;
    display: inline-flex; align-items: center; gap: 8px;
}
.nav a:hover { color: var(--ink); }
.nav a.active { color: var(--ink); border-bottom-color: var(--yellow); }
.nav .badge {
    background: var(--amber-bg); color: var(--amber);
    font-size: .72rem; font-weight: 800; padding: 1px 8px; border-radius: 999px;
}

/* ===== Layout ===== */
.container { max-width: var(--maxw); margin: 0 auto; padding: 26px 22px 60px; }
.page-title { font-size: 1.5rem; font-weight: 800; margin: 0 0 4px; letter-spacing: -.01em; }
.page-sub { color: var(--muted); margin: 0 0 20px; }

/* ===== Flash messages ===== */
.flash { border-radius: var(--radius-sm); padding: 12px 16px; margin-bottom: 16px; font-weight: 500; }
.flash.success { background: var(--green-bg); color: var(--green); }
.flash.error { background: var(--red-bg); color: var(--red); }

/* ===== Cards ===== */
.card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px;
}
.card + .card { margin-top: 18px; }

/* ===== Buttons ===== */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 11px 18px; border-radius: var(--radius-sm); border: 1px solid transparent;
    font-weight: 700; font-size: .92rem; cursor: pointer; text-decoration: none;
    transition: background .12s, border-color .12s, transform .02s;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--yellow); color: var(--ink); border-color: var(--yellow-600); }
.btn-primary:hover { background: var(--yellow-600); }
.btn-ghost { background: var(--surface); color: var(--ink); border-color: var(--border-strong); }
.btn-ghost:hover { border-color: var(--ink); }
.btn-success { background: var(--green); color: #fff; }
.btn-success:hover { background: #12692F; }
.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover { background: #9E1717; }
.btn-warning { background: #F59E0B; color: #1A1A1A; }
.btn-warning:hover { background: #D97706; }
.btn-block { width: 100%; }
.btn-row { display: flex; gap: 12px; flex-wrap: wrap; }

/* ===== Forms ===== */
.form-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field.full { grid-column: span 6; }
.field.half { grid-column: span 3; }
.field.third { grid-column: span 2; }
.field label { font-size: .85rem; font-weight: 600; color: var(--ink-2); }
.field .req { color: var(--red); }
.field input, .field select, .field textarea {
    font: inherit; color: var(--ink); background: var(--surface);
    border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
    padding: 10px 12px; width: 100%;
}
.field textarea { min-height: 84px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus {
    outline: none; border-color: var(--yellow-600);
    box-shadow: 0 0 0 3px rgba(255,209,0,.25);
}
.field.has-error input, .field.has-error select, .field.has-error textarea {
    border-color: var(--red); box-shadow: 0 0 0 3px rgba(185,28,28,.12);
}
.field .err { color: var(--red); font-size: .8rem; }
.field input[readonly] { background: var(--bg); color: var(--ink-2); cursor: default; }

/* Block picker: the fixed block data of the chosen block (operator, address, PSC article). */
.block-info {
    margin: 2px 0 0; padding: 10px 12px; display: grid; gap: 4px; font-size: .85rem;
    background: var(--yellow-tint); border: 1px solid var(--yellow-600); border-radius: var(--radius-sm);
}
.block-info[hidden] { display: none; }
.block-info > div { display: grid; grid-template-columns: 110px 1fr; gap: 8px; }
.block-info dt { margin: 0; color: var(--muted); font-weight: 600; }
.block-info dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.hint { color: var(--muted); font-size: .85rem; }

/* ===== Section blocks (register) ===== */
.section { margin-bottom: 22px; }
.section-head {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 16px; margin-bottom: 16px;
    background: var(--yellow-tint); border: 1px solid #F3E4A0;
    border-left: 4px solid var(--yellow); border-radius: var(--radius-sm);
}
.section-num {
    width: 28px; height: 28px; flex: none; border-radius: 50%;
    background: var(--ink); color: var(--yellow);
    display: grid; place-items: center; font-weight: 800; font-size: .9rem;
}
.section-title { font-weight: 700; font-size: 1.02rem; white-space: nowrap; }

/* ===== Home ===== */
.hero {
    background: linear-gradient(90deg, #16181D 0%, #2B2F38 100%);
    border-radius: var(--radius); padding: 26px 28px; margin-bottom: 20px;
    border-left: 5px solid var(--yellow);
}
.hero h2 { color: #fff; margin: 0 0 6px; font-weight: 800; }
.hero p { color: #C9CDD4; margin: 0; }
.stat-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 20px; }
/* Page title with an action on the right (My proposals -> New proposal). */
.page-head { display: flex; align-items: flex-start; justify-content: space-between;
    gap: 16px; flex-wrap: wrap; }
.page-head .page-title, .page-head .page-sub { margin-top: 0; }

.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
        padding: 16px 18px; box-shadow: var(--shadow); }
/* A stat that is a filter link: same box, but it reacts and shows which one is on. */
a.stat { display: block; text-decoration: none; color: inherit;
    transition: border-color .12s, box-shadow .12s; }
a.stat:hover { border-color: var(--ink); }
a.stat.active { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
a.stat:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.stat .n { font-size: 1.7rem; font-weight: 800; }
.stat .l { color: var(--muted); font-size: .85rem; font-weight: 600; }
.stat.pending .n { color: #3730A3; }
.stat.draft .n { color: #4B5563; }
.stat-row.six { grid-template-columns: repeat(6, 1fr); }
.stat.sentback .n { color: var(--amber); }
.stat.tosign .n { color: #1E40AF; }
.stat.approved .n { color: var(--green); }
/* Kept: the realization tables still use a 'completed' tile. */
.stat.completed .n { color: var(--green); }
.stat.rejected .n { color: var(--red); }
.stat.closedout .n { color: #334155; }

.card-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.action-card {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 22px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 8px;
    transition: box-shadow .15s, transform .15s;
}
.action-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.action-card .emoji { font-size: 1.7rem; }
.action-card h3 { margin: 2px 0 0; font-size: 1.08rem; }
.action-card p { color: var(--muted); font-size: .9rem; margin: 0 0 10px; flex: 1; }

/* ===== Status pill ===== */
.pill { display: inline-block; padding: 3px 12px; border-radius: 999px; font-size: .78rem; font-weight: 800; }
.pill.Pending { background: #E0E7FF; color: #3730A3; }
.pill.Draft { background: #EEF0F3; color: #4B5563; border: 1px dashed #C4C9D1; }
.pill.Sent-back { background: var(--amber-bg); color: var(--amber); }
.pill.To-Sign { background: #DBEAFE; color: #1E40AF; }
.pill.Approved { background: var(--green-bg); color: var(--green); }
.pill.Rejected { background: var(--red-bg); color: var(--red); }

/* ===== Approvals ===== */
.filter-row { display: flex; gap: 8px; margin-bottom: 18px; flex-wrap: wrap; }
.filter-row a {
    padding: 7px 14px; border-radius: 999px; text-decoration: none; font-weight: 600;
    font-size: .86rem; color: var(--muted); border: 1px solid var(--border-strong); background: var(--surface);
}
.filter-row a.active { background: var(--ink); color: #fff; border-color: var(--ink); }
.proj-card { position: relative; }
.proj-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.proj-head h3 { margin: 0; font-size: 1.1rem; }
.facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px 18px; margin-bottom: 12px; }
.facts .k { color: var(--muted); font-size: .78rem; font-weight: 600; }
.facts .v { font-weight: 600; margin-bottom: 6px; }
/* A negative carry-forward is a real signal on the SRI overview, not a styling
   nicety: the block has approved more than its obligation. */
.facts .v.neg { color: var(--red); }
/* The overview's money columns line up when the digits are the same width. */
.overview-table td.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.overview-table td.nowrap { white-space: nowrap; }
details.details { border-top: 1px dashed var(--border); padding-top: 10px; margin-top: 4px; }
details.details summary { cursor: pointer; font-weight: 600; color: var(--ink-2); }
.detail-grid { margin-top: 12px; display: grid; grid-template-columns: 1fr 1fr; gap: 4px 20px; }
.detail-grid .k { color: var(--muted); font-size: .78rem; }
.detail-grid .v { font-weight: 500; margin-bottom: 8px; }
.decision-box {
    margin-top: 14px; padding: 12px 14px; border-radius: var(--radius-sm);
    background: var(--bg); border: 1px solid var(--border);
}
.decide-form { margin-top: 14px; display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.decide-form .field { flex: 1; min-width: 240px; }

/* ===== Two-column layout with left sidebar (approvals) ===== */
.layout { display: flex; gap: 22px; align-items: flex-start; }
.sidebar {
    width: 220px; flex: none; background: var(--surface);
    border: 1px solid var(--border); border-radius: var(--radius);
    box-shadow: var(--shadow); padding: 14px; position: sticky; top: 16px;
}
.content { flex: 1; min-width: 0; }
.side-title { font-size: .72rem; font-weight: 800; text-transform: uppercase;
    letter-spacing: .04em; color: var(--muted); margin: 0 0 6px 4px; }
.side-link {
    display: flex; align-items: center; justify-content: space-between; gap: 8px;
    padding: 8px 10px; border-radius: var(--radius-sm); text-decoration: none;
    color: var(--ink-2); font-weight: 600; font-size: .9rem;
}
.side-link:hover { background: var(--bg); }
.side-link.active { background: var(--ink); color: #fff; }
.side-count {
    background: var(--bg); color: var(--muted); font-size: .74rem; font-weight: 800;
    padding: 1px 8px; border-radius: 999px;
}
.side-link.active .side-count { background: rgba(255,255,255,.2); color: #fff; }

/* ===== Tracking number ===== */
.tracking {
    font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
    background: var(--yellow-tint); border: 1px solid #F3E4A0;
    padding: 1px 8px; border-radius: 6px; font-size: .92em;
}

/* ===== Budget table (form input) ===== */
.budget-table table { width: 100%; border-collapse: collapse; margin-bottom: 10px; }
.budget-table th {
    text-align: left; font-size: .78rem; color: var(--muted); font-weight: 700;
    padding: 4px 6px;
}
.budget-table td { padding: 3px 6px; }
.budget-table input {
    font: inherit; width: 100%; padding: 8px 10px;
    border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
}
.budget-table input:focus { outline: none; border-color: var(--yellow-600);
    box-shadow: 0 0 0 3px rgba(255,209,0,.25); }
.btn-remove {
    border: none; background: var(--red-bg); color: var(--red);
    width: 30px; height: 30px; border-radius: var(--radius-sm); cursor: pointer;
    font-weight: 800;
}
.btn-remove:hover { background: #FCC; }

/* ===== Mini table (budget display) ===== */
.mini-table { width: 100%; border-collapse: collapse; margin-top: 6px; font-size: .9rem; }
.mini-table th { text-align: left; font-size: .76rem; color: var(--muted);
    border-bottom: 1px solid var(--border); padding: 6px 8px; }
.mini-table td { padding: 6px 8px; border-bottom: 1px solid var(--border); }
.mini-table .total-row td { border-bottom: none; border-top: 2px solid var(--border-strong); }

.muted { color: var(--muted); }
.stat-row.five { grid-template-columns: repeat(5, 1fr); }
.stat-row.seven { grid-template-columns: repeat(7, 1fr); }

.pill.Completed { background: var(--green-bg); color: var(--green); }
.pill.Closed-out { background: #E2E8F0; color: #334155; }

/* ===== Signing chain ===== */
.sign-chain { display: flex; gap: 10px; flex-wrap: wrap; margin: 12px 0 4px; }
.sign-step {
    flex: 1; min-width: 150px; border: 1px solid var(--border);
    border-radius: var(--radius-sm); padding: 10px 12px; background: var(--bg);
}
.sign-step.done { border-color: #A7F3D0; background: #F0FDF4; }
.sign-step.current { border-color: #93C5FD; background: #EFF6FF; }
.sign-role { font-size: .72rem; font-weight: 800; text-transform: uppercase;
    letter-spacing: .04em; color: var(--muted); }
.sign-name { font-weight: 700; margin: 2px 0; }
.sign-mail { font-size: .76rem; color: var(--muted); word-break: break-all; margin-bottom: 2px; }
.sign-state { font-size: .82rem; }

.delegate-form { display: flex; gap: 8px; align-items: center; }
.delegate-form select {
    font: inherit; padding: 9px 10px; border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm); background: var(--surface);
}

/* ===== Role tags (admin) ===== */
.role-tag { padding: 2px 10px; border-radius: 999px; font-size: .76rem; font-weight: 800; }
.role-tag.operator { background: #E0E7FF; color: #3730A3; }
.role-tag.reviewer { background: var(--yellow-tint); color: #92700A; }
.role-tag.signer   { background: #DBEAFE; color: #1E40AF; }
.role-tag.admin    { background: #F3E8FF; color: #6B21A8; }

/* ===== Admin: user management ===== */
.user-add, .user-edit { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.user-add input, .user-add select,
.user-edit input, .user-edit select,
.pw-form input {
    font: inherit; padding: 8px 10px; border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm); background: var(--surface);
}
.user-add input:focus, .user-add select:focus,
.user-edit input:focus, .user-edit select:focus, .pw-form input:focus {
    outline: none; border-color: var(--yellow-600); box-shadow: 0 0 0 3px rgba(255,209,0,.25);
}
.user-row { border-top: 1px solid var(--border); padding: 14px 0; display: flex;
    flex-direction: column; gap: 8px; }
.user-row:first-of-type { border-top: none; }
.user-id { display: flex; gap: 8px; align-items: center; }
.user-actions { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.pw-form { display: flex; gap: 6px; }
.chk { display: inline-flex; align-items: center; gap: 5px; font-size: .85rem; color: var(--ink-2); }

/* ===== Letter ===== */
.letter-paper {
    background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
    box-shadow: var(--shadow); padding: 40px 46px; max-width: 780px; margin: 0 auto;
}
.letter-head { display: flex; align-items: center; gap: 16px;
    border-bottom: 3px solid var(--yellow); padding-bottom: 14px; margin-bottom: 18px; }
.letter-logo { height: 42px; }
.letter-org { font-weight: 800; line-height: 1.3; }
.letter-meta { display: flex; justify-content: space-between; color: var(--ink-2);
    font-size: .9rem; margin-bottom: 18px; }
.letter-subject { font-size: 1.15rem; margin: 0 0 14px; }
.letter-table { width: 100%; border-collapse: collapse; margin: 14px 0; }
.letter-table td { padding: 7px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
.letter-table td:first-child { color: var(--muted); width: 40%; font-weight: 600; }
.letter-signatures { display: grid; grid-template-columns: 1fr 1fr; gap: 26px; margin: 30px 0 10px; }
.sig-slot { }
.sig-line { height: 42px; border-bottom: 1.5px solid var(--ink); position: relative; }
.sig-name { position: absolute; bottom: 4px; left: 4px; font-family: "Segoe Script", "Comic Sans MS", cursive;
    font-size: 1.25rem; color: #1E3A8A; }
.sig-label { font-size: .82rem; margin-top: 6px; }
.letter-foot { font-size: .8rem; margin-top: 22px; }
@media print {
    .header, .nav, .footer, .no-print { display: none !important; }
    .letter-paper { border: none; box-shadow: none; max-width: 100%; padding: 0; }
    body { background: #fff; }
}

/* ===== Login ===== */
.login-wrap { display: flex; flex-direction: column; }
.login-split { flex: 1; display: grid; grid-template-columns: 1.05fr .95fr; }
.login-brand {
    background: linear-gradient(135deg, #16181D 0%, #2B2F38 100%);
    color: #fff; display: flex; flex-direction: column; justify-content: center;
    padding: 64px; border-right: 6px solid var(--yellow); position: relative;
}
.login-brand img { height: 58px; width: fit-content; border-radius: 8px; margin-bottom: 30px; }
.login-brand h1 { font-size: 2.15rem; font-weight: 700; margin: 0 0 12px; line-height: 1.12; }
.login-brand p { color: #C9CDD4; max-width: 440px; font-size: 1.02rem; }
.login-panel { display: flex; align-items: center; justify-content: center; padding: 48px 40px; background: var(--surface); }
.login-card { width: 100%; max-width: 400px; }
.login-card h2 { margin: 0 0 4px; font-size: 1.7rem; }
.login-card .sub { color: var(--muted); margin: 0 0 26px; }
.login-card .field { margin-bottom: 18px; }
.login-card .btn-block { margin-top: 4px; padding: 13px; font-size: 1rem; }
.demo-creds {
    margin-top: 24px; padding: 12px 14px; border-radius: var(--radius-sm);
    background: var(--yellow-tint); border: 1px solid #F3E4A0; font-size: .84rem;
}
.demo-creds b { display: block; margin-bottom: 4px; }
.demo-creds code { background: rgba(0,0,0,.06); padding: 1px 6px; border-radius: 4px; }

/* ===== Admin: users grouped by role ===== */
.role-group { border: 1px solid var(--border); border-radius: var(--radius-sm); margin-bottom: 16px; overflow: hidden; }
.role-group-head {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 16px; background: #F8F9FB; border-bottom: 1px solid var(--border);
    font-family: "Oswald", sans-serif; text-transform: uppercase; letter-spacing: .04em; font-size: .9rem;
}
.role-group-head .count { color: var(--muted); font-family: "PT Sans", sans-serif; }
.role-group .user-row { padding: 14px 16px; }
.role-group .user-row + .user-row { border-top: 1px solid var(--border); }

/* Admin users table */
.admin-table-wrap { overflow-x: auto; }
table.admin-table { width: 100%; border-collapse: collapse; font-size: .9rem; }
table.admin-table th, table.admin-table td { padding: 10px 12px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: middle; }
table.admin-table thead th { background: #F8F9FB; font-family: "Oswald", sans-serif; text-transform: uppercase; letter-spacing: .03em; font-size: .82rem; white-space: nowrap; }
table.admin-table tr.role-sep td { background: #FCFCFD; padding: 8px 12px; }
table.admin-table input, table.admin-table select { padding: 7px 9px; width: 100%; min-width: 120px; }
table.admin-table input[type="checkbox"] { width: auto; min-width: 0; }
table.admin-table td.col-actions { white-space: normal; min-width: 260px; }
table.admin-table td.col-actions .btn { margin: 2px 2px 2px 0; }
table.admin-table .pw-inline { display: inline-flex; gap: 6px; align-items: center; margin-right: 6px; }
table.admin-table .pw-inline input { min-width: 130px; }
.btn-sm { padding: 6px 12px; font-size: .82rem; }

/* ===== Footer ===== */
.footer { margin-top: 40px; color: var(--muted); font-size: .82rem; }
.footer-inner { max-width: var(--maxw); margin: 0 auto; padding: 18px 22px 12px;
    border-top: 1px solid var(--line, #e4e4e4);
    display: flex; align-items: center; justify-content: center; gap: 16px; flex-wrap: wrap; }
.footer-logo { height: 34px; width: auto; }
.footer-copy { color: var(--muted); text-align: center; }
/* Block assignment on the Access page: compact enough to live in a table cell. */
.block-select { min-width: 120px; font-size: .82rem; padding: 2px 4px; }
.hint-warn { color: var(--warn, #b26a00); }

.footer-bar { width: 100%; height: 26px; background: var(--ink); }
@media print { .footer-bar { display: none; } }

/* ===== Responsive ===== */
@media (max-width: 760px) {
    .form-grid { grid-template-columns: 1fr; }
    .field.full, .field.half, .field.third { grid-column: span 1; }
    .card-grid, .stat-row, .facts, .detail-grid { grid-template-columns: 1fr; }
    .layout { flex-direction: column; }
    .sidebar { width: 100%; position: static; }
    .login-split { grid-template-columns: 1fr; }
    .login-brand { display: none; }
}


/* ===== v1.14: notifications bell ===== */
.bell { position: relative; display: inline-flex; align-items: center; color: #CBD0D8; padding: 4px; border-radius: 8px; }
.bell:hover { color: #fff; background: rgba(255,255,255,.08); }
.bell.has-unread { color: var(--yellow); }
.bell-count {
    position: absolute; top: -4px; right: -6px; min-width: 18px; height: 18px; padding: 0 5px;
    border-radius: 999px; background: var(--red); color: #fff; font-size: .68rem; font-weight: 800;
    display: grid; place-items: center; border: 2px solid var(--ink);
}
.notif { display: flex; align-items: flex-start; gap: 12px; padding: 12px 6px; border-top: 1px solid var(--border);
    text-decoration: none; color: var(--ink); }
.notif:first-child { border-top: none; }
.notif:hover { background: var(--bg); }
.notif-dot { width: 9px; height: 9px; border-radius: 50%; background: transparent; margin-top: 7px; flex: none; }
.notif.unread .notif-dot { background: var(--yellow-600); }
.notif.unread .notif-text { font-weight: 700; }
.notif-body { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.notif-time { color: var(--muted); font-size: .8rem; }
.notif-go { color: var(--muted); font-size: .85rem; font-weight: 600; white-space: nowrap; }

/* ===== v1.14: hover help (field descriptions) ===== */
.help-icon {
    position: relative; display: inline-grid; place-items: center; width: 16px; height: 16px; margin-left: 6px;
    border-radius: 50%; background: var(--ink); color: var(--yellow); font-size: .68rem; font-weight: 800;
    cursor: help; vertical-align: middle; line-height: 1;
}
.help-tip {
    display: none; position: absolute; z-index: 30; left: -10px; top: 22px;
    width: max(260px, min(420px, 60vw)); background: var(--ink); color: #fff; font-weight: 400; font-size: .8rem;
    line-height: 1.45; padding: 10px 12px; border-radius: 8px; box-shadow: var(--shadow-md); text-align: left;
    white-space: normal;
}
.help-icon:hover .help-tip, .help-icon:focus .help-tip { display: block; }
.section-head .section-help { margin-left: auto; color: var(--muted); font-size: .82rem; font-weight: 400; }

/* ===== v1.14: register form extras ===== */
.doc-list { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.doc-chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 6px 5px 10px; border-radius: 999px;
    background: var(--yellow-tint); border: 1px solid #F3E4A0; font-size: .85rem; }
.doc-chip a { text-decoration: none; font-weight: 600; }
.doc-remove { border: none; background: var(--red-bg); color: var(--red); width: 20px; height: 20px; border-radius: 50%;
    cursor: pointer; font-weight: 800; line-height: 1; }
.save-row { align-items: center; }
.save-hint { flex-basis: 100%; }
.card-draft { border-style: dashed; }
.block-head { font-size: 1.05rem; margin: 22px 0 10px; display: flex; align-items: center; gap: 10px; }
.block-tag { background: var(--ink); color: var(--yellow); padding: 2px 10px; border-radius: 6px; font-size: .9rem; }
.alloc-table tfoot td { padding: 6px; }

/* ===== v1.14: admin access ===== */
.link-box { border-left: 4px solid var(--yellow); margin-bottom: 18px; }
.link-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.link-row input { flex: 1; min-width: 260px; font: inherit; font-size: .9rem; padding: 9px 10px;
    border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--bg); }
.badge-st { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: .74rem; font-weight: 700; white-space: nowrap; }
.badge-st.ok { background: var(--green-bg); color: var(--green); }
.badge-st.link { background: var(--amber-bg); color: var(--amber); }
.badge-st.off { background: var(--red-bg); color: var(--red); }
.login-help { margin-top: 18px; color: var(--muted); font-size: .88rem; }
.login-help a { color: var(--ink); text-decoration: none; }

/* ===== v1.14: dashboard / guide ===== */
table.admin-table th.num, table.admin-table td.num { text-align: right; }
table.admin-table tr.row-link { cursor: pointer; }
table.admin-table tr.row-link:hover td { background: var(--yellow-tint); }
.side-ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.focus-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.focus { border: 1px solid var(--border); border-left: 4px solid var(--yellow); border-radius: var(--radius-sm); padding: 12px 14px; }
.focus-name { font-weight: 800; margin-bottom: 4px; font-family: "Oswald", sans-serif; }
.focus-text { color: var(--ink-2); font-size: .9rem; }
.guide-table td { font-size: .9rem; vertical-align: top; }
@media (max-width: 760px) {
    .focus-grid { grid-template-columns: 1fr; }
    .stat-row.seven, .stat-row.six, .stat-row.five { grid-template-columns: 1fr 1fr; }
}

/* --- Utility classes (generated from former inline style="…" attributes;
   CSP style-src is 'self' + nonce, so templates carry no inline styles) --- */
.u-mt-12px { margin-top:12px; }
.u-maxw-420px { max-width:420px; }
.u-ta-right { text-align:right; }
.u-m-2px-6px-2px-0-p-6px-12px { margin:2px 6px 2px 0; padding:6px 12px; }
.u-mt-8px { margin-top:8px; }
.u-m-6px-0-10px { margin:6px 0 10px; }
.u-mb-18px { margin-bottom:18px; }
.u-mt-10px-gtc-repeat-4-1fr { margin-top:10px; grid-template-columns: repeat(4, 1fr); }
.u-m-10px-0-0 { margin:10px 0 0; }
.u-m-4px-0-10px { margin:4px 0 10px; }
.u-minw-240px { min-width:240px; }
.u-m-12px-0-0 { margin:12px 0 0; }
.u-m-0 { margin:0; }
.u-d-inline { display:inline; }
.u-ws-nowrap { white-space:nowrap; }
.u-mt-16px { margin-top:16px; }
.u-mb-12px { margin-bottom:12px; }
.u-mt-10px { margin-top:10px; }
.u-m-8px-0-12px { margin:8px 0 12px; }
.u-m-8px-0-10px { margin:8px 0 10px; }
.u-mt-6px { margin-top:6px; }
.u-mt-10px-bt-1px-dashed-var-line-e4e4e4-pt-10px { margin-top:10px; border-top:1px dashed var(--line,#e4e4e4); padding-top:10px; }
.u-d-flex-gap-8px-ai-center-fwrap-wrap { display:flex; gap:8px; align-items:center; flex-wrap:wrap; }
.u-flex-1-minw-220px-p-6px-8px { flex:1; min-width:220px; padding:6px 8px; }
.u-border-left-3px-solid-var-line-e4e4e4-padding-left-10px-m-8px-0 { border-left:3px solid var(--line,#e4e4e4); padding-left:10px; margin:8px 0; }
.u-m-2px-6px-2px-0-p-5px-10px { margin:2px 6px 2px 0; padding:5px 10px; }
.u-d-inline-ml-8px { display:inline; margin-left:8px; }
.u-bg-var-amber-bg-c-var-amber { background:var(--amber-bg); color:var(--amber); }
.u-ta-center-p-48px { text-align:center; padding:48px; }
.u-fs-2-4rem { font-size:2.4rem; }
.u-mb-16px { margin-bottom:16px; }
.u-m-10px-0 { margin:10px 0; }
.u-mt-14px { margin-top:14px; }
.u-m-8px-0 { margin:8px 0; }
.u-mb-20px { margin-bottom:20px; }
.u-mb-14px { margin-bottom:14px; }
.u-border-color-bbb-bg-fafafa { border-color:#bbb; background:#fafafa; }
.u-border-left-4px-solid-var-border-strong { border-left:4px solid var(--border-strong); }
.u-border-left-4px-solid-var-amber { border-left:4px solid var(--amber); }
.u-bg-var-amber-bg-c-var-amber-mt-10px { background:var(--amber-bg); color:var(--amber); margin-top:10px; }
.u-m-0-0-10px { margin:0 0 10px; }
.u-w-60 { width:60%; }
.u-mt-28px { margin-top:28px; }
.u-fs-10pt { font-size:10pt; }
.u-gtc-repeat-4-1fr { grid-template-columns: repeat(4, 1fr); }
.u-ai-center-gap-10px { align-items:center; gap:10px; }
.u-w-90px-p-7px-9px { width:90px; padding:7px 9px; }
.u-p-7px-9px { padding:7px 9px; }
.u-ws-pre-wrap { white-space:pre-wrap; }
.u-c-b91c1c { color:#B91C1C; }
.u-pos-static { position:static; }
.u-border-left-4px-solid-var-green-mb-18px { border-left:4px solid var(--green); margin-bottom:18px; }
.u-m-0-0-6px { margin:0 0 6px; }
.u-m-0-0-14px { margin:0 0 14px; }
.u-maxw-520px { max-width:520px; }
.u-w-160px { width:160px; }
.u-w-220px { width:220px; }
.u-w-40px { width:40px; }
.u-ta-right-c-var-muted-fs-85rem { text-align:right; color:var(--muted); font-size:.85rem; }
.u-w-150px { width:150px; }
.u-m-12px-0 { margin:12px 0; }

/* ===== v1.17: personal welcome + decision lock ===== */
.hero-meta { margin-top: 10px; color: #C9CDD4; font-size: .85rem; }
.hero-meta b { color: #fff; }
.todo-card { border-left: 4px solid var(--yellow); }
.todo-list { list-style: none; margin: 8px 0 0; padding: 0; }
.todo-list li {
    display: flex; align-items: center; justify-content: space-between; gap: 14px;
    padding: 10px 0; border-top: 1px solid var(--border); flex-wrap: wrap;
}
.todo-list li:first-child { border-top: none; }
.todo-list li.urgent .todo-text { font-weight: 700; }
.todo-text { flex: 1; min-width: 220px; }
.decision-head { display: flex; align-items: flex-start; gap: 8px; }
.decision-lock { flex: none; line-height: 1.5; }
.profile-link { text-decoration: none; }
.profile-link:hover b { color: var(--yellow); }
.u-maxw-560px { max-width: 560px; }

/* ===== Per operator, per block (reviewer dashboard) =====
   One card per operator, one row per block with a stacked status bar. */
.pf-legend { display: flex; flex-wrap: wrap; gap: 12px; margin: 0 0 12px; color: var(--muted); font-size: 12px; }
.pf-key { display: inline-flex; align-items: center; gap: 5px; }
.pf-swatch { width: 10px; height: 10px; border-radius: 2px; }
.pf-card { border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; margin-bottom: 12px; }
.pf-card:last-child { margin-bottom: 0; }
.pf-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 10px 12px; }
.pf-op { font-size: 15px; font-weight: 500; }
.pf-sum { color: var(--muted); font-size: 12px; text-align: right; white-space: nowrap; }
.pf-row { display: flex; align-items: center; gap: 10px; padding: 7px 12px;
    border-top: 1px solid var(--border); color: inherit; text-decoration: none; }
.pf-row:hover { background: var(--yellow-tint); }
.pf-block { flex: 0 0 78px; color: var(--muted); font-size: 12px; }
.pf-bar { display: flex; flex: 1 1 auto; gap: 2px; height: 22px; min-width: 0; }
.pf-amount { flex: 0 0 104px; text-align: right; font-size: 12px; }
.pf-seg { display: flex; align-items: center; justify-content: center; overflow: hidden;
    flex-basis: 0; min-width: 0; font-size: 11px; font-weight: 700; }
.pf-bar .pf-seg:first-child { border-radius: 4px 0 0 4px; }
.pf-bar .pf-seg:last-child { border-radius: 0 4px 4px 0; }
/* Segment colours match the status pills. */
.pf-seg.Pending, .pf-swatch.Pending { background: #E0E7FF; color: #3730A3; }
.pf-seg.Sent-back, .pf-swatch.Sent-back { background: #FEF3C7; color: #B45309; }
.pf-seg.Approved, .pf-swatch.Approved { background: #DBEAFE; color: #1E40AF; }
.pf-seg.Completed, .pf-swatch.Completed { background: #DCFCE7; color: #15803D; }
.pf-seg.Closed-out, .pf-swatch.Closed-out { background: #E2E8F0; color: #334155; }
.pf-seg.Rejected, .pf-swatch.Rejected { background: #FEE2E2; color: #B91C1C; }
/* A strict CSP forbids inline style attributes, so the proportional width of a
   segment comes from one of these flex-grow utilities, picked by the count.
   Capped at 8 because a block rarely holds more proposals of one status than
   that; everything above shares .seg-many, where one extra proposal would move
   the segment edge by less than a pixel anyway. */
.pf-seg.seg-1 { flex-grow: 1; }
.pf-seg.seg-2 { flex-grow: 2; }
.pf-seg.seg-3 { flex-grow: 3; }
.pf-seg.seg-4 { flex-grow: 4; }
.pf-seg.seg-5 { flex-grow: 5; }
.pf-seg.seg-6 { flex-grow: 6; }
.pf-seg.seg-7 { flex-grow: 7; }
.pf-seg.seg-8 { flex-grow: 8; }
.pf-seg.seg-many { flex-grow: 10; }
@media (max-width: 760px) {
    .pf-block { flex-basis: 64px; }
    .pf-amount { flex-basis: 84px; }
}

/* Previous reviewer feedback rounds (feedback_history macro) */
.feedback-history { list-style: none; margin: 8px 0 0; padding: 0; }
.feedback-history li { border-left: 3px solid var(--border); padding: 0 0 0 10px; margin-bottom: 10px; }
.feedback-history li:last-child { margin-bottom: 0; }
.feedback-history .fb-head { font-size: 12px; color: var(--ink-2); }
.feedback-history .fb-comment { margin-top: 2px; white-space: pre-line; }

/* ===== Admin cleanup (/admin/cleanup) ===== */
/* Neutral hint badge: "looks like test data". Deliberately grey — it must not read
   as a verdict, because it selects nothing and deletes nothing. */
.badge-st.neutral { background: #EEF0F3; color: #4B5563; border: 1px solid var(--border-strong); margin-left: 6px; }
.cl-warning { border-left: 4px solid var(--red); }
.cl-warning .section-title { color: var(--red); }
table.admin-table th.cl-tick, table.admin-table td.cl-tick { width: 52px; text-align: center; }
table.admin-table td.cl-tick input[type="checkbox"] { width: 17px; height: 17px; cursor: pointer; }
.cl-search { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.cl-search label { font-weight: 600; }
.cl-search input[type="search"] { min-width: 260px; }
.cl-confirm { max-width: 220px; margin-left: 10px; letter-spacing: .08em; text-transform: uppercase; }

/* ===== Admin failure log (/admin/errors) ===== */
.err-filter { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
/* The active filter button — same shape as the others, just clearly selected. */
.btn.btn-on { border-color: var(--ink); background: var(--yellow-tint); }
/* Tracebacks: monospace, scrollable, never widening the table. */
pre.err-detail {
    margin: 8px 0 6px; padding: 10px 12px; max-height: 320px; overflow: auto;
    background: #F8F9FB; border: 1px solid var(--border); border-radius: 6px;
    font-family: ui-monospace, "Consolas", monospace; font-size: .8rem;
    white-space: pre-wrap; word-break: break-word;
}
/* A failure the admin has dealt with stays in the list, but reads as background. */
table.admin-table tr.err-done td { background: #FCFCFD; color: var(--ink-2); }
