/* PSA platform.
   Visual language follows skyict.nl/portaal: airy light surfaces, lilac panels, the logo's violet → rose → salmon
   gradient on primary actions, pill buttons, Plus Jakarta Sans. Light and dark follow the system. */

:root {
    color-scheme: light dark;

    --bg: #fcfafc;
    --panel: #ffffff;
    --lilac: #f2eef7;           /* section panels, table heads */
    --hover: #f7f4fa;
    --line: #e4dfee;
    --line-strong: #c4bdd6;
    --fg: #1f1a2e;
    --muted: #5b5470;

    --violet: #8878a8;
    --rose: #c47d96;
    --salmon: #f4a98f;
    --grad: linear-gradient(90deg, var(--violet), var(--rose) 55%, var(--salmon));

    --accent: #a84a70;          /* links, focus, current selection */
    --accent-weak: #f6e9f0;
    --btn-fg: #1f1a2e;          /* text on the gradient button */
    --dark: #1f1a2e;            /* dark pill button */
    --dark-fg: #ffffff;

    --ok: #11643a;   --ok-bg: #e4f5ea;   --ok-line: #bde3cb;
    --warn: #8a4b06; --warn-bg: #fdf1dc; --warn-line: #f1d7a2;
    --err: #a32018;  --err-bg: #fde9e7;  --err-line: #f4c3bd;

    --shadow: 0 1px 2px rgb(31 26 46 / .05);
    --shadow-pop: 0 14px 34px rgb(31 26 46 / .14);
    --r: 8px;
    --r-lg: 14px;
    --focus: 0 0 0 3px color-mix(in srgb, var(--accent) 26%, transparent);
    --font: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #141119;
        --panel: #1c1824;
        --lilac: #19151f;
        --hover: #231e2d;
        --line: #2f2940;
        --line-strong: #40395a;
        --fg: #efeaf6;
        --muted: #aaa2bd;

        --accent: #e8a0bd;
        --accent-weak: #35202c;
        --dark: #efeaf6;
        --dark-fg: #1f1a2e;

        --ok: #6fdfa2;   --ok-bg: #0f2a1d;   --ok-line: #1e4d34;
        --warn: #f2c56c; --warn-bg: #2a2209; --warn-line: #4d3e12;
        --err: #ff9f95;  --err-bg: #2f1311;  --err-line: #5a2520;

        --shadow: 0 1px 2px rgb(0 0 0 / .4);
        --shadow-pop: 0 14px 34px rgb(0 0 0 / .55);
    }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scrollbar-color: var(--line-strong) transparent; scrollbar-width: thin; }
body {
    margin: 0; background: var(--bg); color: var(--fg);
    font: 15px/1.55 var(--font);
    font-feature-settings: "tnum" 1;
    -webkit-font-smoothing: antialiased;
    caret-color: var(--accent);
    min-height: 100vh; display: flex; flex-direction: column;
}
::selection { background: color-mix(in srgb, var(--rose) 35%, transparent); }
::placeholder { color: var(--muted); opacity: .75; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
a { color: var(--accent); text-underline-offset: .2em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
.wrap { width: 100%; max-width: 78rem; margin: 0 auto; padding-inline: clamp(1rem, 3vw, 2.5rem); }

/* ---------- top bar ---------- */
.topbar { position: sticky; top: 0; z-index: 30; background: var(--bg); border-bottom: 1px solid var(--line); }
.bar { display: flex; align-items: center; gap: .5rem 1.25rem; min-height: 4.25rem; }
.brand { display: flex; align-items: center; gap: .8rem; text-decoration: none; color: var(--fg); flex: none; }
.brand img { display: block; width: 6.4rem; height: auto; }
.brand small { font-size: .8125rem; font-weight: 600; color: var(--muted); padding-left: .8rem; border-left: 1px solid var(--line-strong); line-height: 1.2; white-space: nowrap; }
.who { color: var(--muted); font-weight: 600; font-size: .875rem; padding-left: .8rem; border-left: 1px solid var(--line-strong); white-space: nowrap; }

.bar nav { display: flex; align-items: center; gap: .15rem; margin-left: auto; }
.bar nav > a, .dropdown > summary {
    display: inline-flex; align-items: center; gap: .35rem; cursor: pointer;
    padding: .5rem .85rem; border-radius: 999px; color: var(--fg); text-decoration: none; font-weight: 550; font-size: .9375rem;
    transition: background-color .15s ease, color .15s ease;
}
.bar nav > a:hover, .dropdown > summary:hover { background: var(--lilac); }
.bar nav a[aria-current="page"], .dropdown[data-active] > summary { background: var(--lilac); font-weight: 700; }
.bar > .cta { flex: none; }
.nav-cta-mobile { display: none !important; }

.dropdown { position: relative; }
.dropdown > summary { list-style: none; }
.dropdown > summary::-webkit-details-marker { display: none; }
.dropdown > summary::after {
    content: ""; width: .6rem; height: .6rem; background: currentColor; flex: none; transition: transform .15s ease;
    -webkit-mask: var(--chev) center / contain no-repeat; mask: var(--chev) center / contain no-repeat;
    --chev: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2 4.5l4 4 4-4'/%3E%3C/svg%3E");
}
.dropdown[open] > summary::after { transform: rotate(180deg); }
.dropdown-panel {
    position: absolute; top: calc(100% + .45rem); left: 0; min-width: 16.5rem; z-index: 40;
    background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-pop); padding: .4rem;
}
.dropdown-panel a { display: block; padding: .6rem .8rem; border-radius: 10px; color: var(--fg); text-decoration: none; font-weight: 550; }
.dropdown-panel a small { display: block; color: var(--muted); font-weight: 450; font-size: .8125rem; }
.dropdown-panel a:hover { background: var(--lilac); }
.dropdown-panel a[aria-current="page"] { background: var(--lilac); font-weight: 700; }

.menu-toggle { display: none; margin-left: auto; }

/* ---------- page ---------- */
main { width: 100%; max-width: 78rem; margin: 0 auto; padding: 2.25rem clamp(1rem, 3vw, 2.5rem) 4rem; flex: 1; }
h1 { font-size: 1.875rem; line-height: 1.15; font-weight: 700; letter-spacing: -.025em; margin: 0 0 1.25rem; text-wrap: balance; }
h2 { font-size: 1.1875rem; line-height: 1.3; font-weight: 650; letter-spacing: -.015em; margin: 2.25rem 0 .8rem; }
p { margin: 0 0 1rem; }
p.lead { max-width: 68ch; margin-top: 0; font-size: 1.0625rem; }
.muted { color: var(--muted); }
p.muted { max-width: 70ch; }
.mono, code { font-family: var(--mono); font-size: .92em; }
code { background: var(--lilac); border: 1px solid var(--line); border-radius: 4px; padding: .05em .35em; }

.page-head { display: flex; justify-content: space-between; align-items: center; gap: .75rem 1rem; flex-wrap: wrap; margin-bottom: 1.1rem; }
.page-head h1 { margin: 0; }
.crumbs { font-size: .85rem; color: var(--muted); margin-bottom: .4rem; }
.crumbs a { color: inherit; text-decoration: none; }
.crumbs a:hover { color: var(--accent); text-decoration: underline; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.nowrap { white-space: nowrap; }

/* ---------- hero (dashboards) ---------- */
.hero { margin: .5rem 0 2.25rem; }
.hero h1 { font-size: clamp(2.4rem, 6.2vw, 4.4rem); line-height: 1.02; letter-spacing: -.035em; font-weight: 700; margin: 0; }
.grad { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; padding-bottom: .08em; }
.brush { display: block; width: clamp(5rem, 9vw, 7.5rem); height: auto; margin: .6rem 0 1.1rem; }
.hero p { font-size: clamp(1.05rem, 1.8vw, 1.3rem); max-width: 40ch; color: var(--fg); margin: 0; }

/* ---------- lilac panel with tiles, rings, lists ---------- */
.panel { background: var(--lilac); border-radius: var(--r-lg); padding: clamp(1rem, 2.4vw, 2rem); }
.panel-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.panel-head h2 { margin: 0; font-size: 1.1875rem; }
.panel-head .muted { font-size: .8125rem; }
.tiles { display: grid; gap: 1rem; margin-bottom: 1rem; }
.tiles.t4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.tiles.t3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.tile { background: var(--panel); border-radius: var(--r); padding: 1.1rem 1.25rem; display: flex; flex-direction: column; justify-content: space-between; gap: .5rem; text-decoration: none; color: inherit; min-width: 0; }
a.tile { transition: box-shadow .15s ease; }
a.tile:hover { box-shadow: var(--shadow-pop); text-decoration: none; }
.tile .num { font-size: 2.1rem; line-height: 1.05; font-weight: 700; letter-spacing: -.03em; }
.tile .num small { font-size: 1rem; font-weight: 600; letter-spacing: 0; color: var(--muted); margin-left: .15rem; }
.tile .cap { color: var(--muted); font-size: .875rem; }
.tile.center { align-items: center; text-align: center; padding-block: 1.4rem 1.1rem; }
.ring { width: 8.5rem; height: 8.5rem; }
.ring .bg { fill: none; stroke: var(--lilac); stroke-width: 9; }
.ring .fg { fill: none; stroke-width: 9; stroke-linecap: round; transform: rotate(-90deg); transform-origin: 60px 60px; }
.ring text { font: 700 30px var(--font); fill: var(--fg); letter-spacing: -.03em; }
.gauge { height: .5rem; border-radius: 999px; background: var(--lilac); overflow: hidden; }
.gauge > span { display: block; height: 100%; border-radius: 999px; background: var(--grad); }
.gauge-scale { display: flex; justify-content: space-between; color: var(--muted); font-size: .8125rem; margin-top: .35rem; }

.split { display: grid; grid-template-columns: 1.4fr 1fr; gap: 1rem; margin-bottom: 1rem; }
.box { background: var(--panel); border-radius: var(--r); padding: 1.1rem 1.25rem 1.25rem; min-width: 0; }
.box-head { display: flex; justify-content: space-between; align-items: center; gap: .75rem; margin-bottom: .8rem; }
.box-head h2 { margin: 0; font-size: 1.0625rem; }
.rows { list-style: none; margin: 0; padding: 0; display: grid; gap: .4rem; }
.rows li { display: flex; justify-content: space-between; align-items: center; gap: 1rem; background: var(--lilac); border-radius: 6px; padding: .65rem .9rem; transition: background-color .15s ease; }
.rows li:hover { background: color-mix(in srgb, var(--lilac) 72%, var(--rose) 14%); }
.rows a { color: var(--fg); text-decoration: none; min-width: 0; overflow-wrap: anywhere; font-weight: 500; }
.rows a:hover { text-decoration: underline; }
.rows .side { color: var(--muted); font-size: .8125rem; white-space: nowrap; }
.rows li.empty { display: block; color: var(--muted); background: transparent; padding-inline: 0; }
.rows li.empty:hover { background: transparent; }
.contact { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.avatar { width: 3.4rem; height: 3.4rem; border-radius: 50%; background: var(--grad); color: var(--btn-fg); display: grid; place-items: center; font-weight: 700; font-size: 1.05rem; flex: none; }
.contact .name { font-size: 1.1rem; font-weight: 700; display: block; }
.contact .who-label { color: var(--muted); font-size: .8125rem; display: block; }

/* ---------- cards ---------- */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 1.1rem 1.25rem; margin-bottom: 1.25rem; box-shadow: var(--shadow); }
.card > :last-child { margin-bottom: 0; }
.card.stack { display: grid; gap: 1.1rem; max-width: 34rem; }
.card.stack.wide { max-width: 48rem; }
.card.stack.reply { max-width: none; }
.sync-panel { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 1rem; }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem 1rem; margin-bottom: 1.25rem; }
.two-col { display: grid; grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr)); gap: 1.25rem; }
.spaced { margin-top: 1.25rem; }
.note { margin: .75rem 0 0; font-size: .9rem; }
.portal-panel { display: flex; justify-content: space-between; gap: 1rem 1.5rem; flex-wrap: wrap; align-items: flex-start; }
.portal-panel p { margin: .25rem 0 .6rem; }
.copy-row { display: flex; gap: .5rem; flex-wrap: wrap; }
.copy-row input { flex: 1 1 22rem; min-width: 0; }

/* ---------- tables ---------- */
table { width: 100%; border-collapse: separate; border-spacing: 0; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow); overflow: hidden; margin-bottom: .5rem; }
th, td { text-align: left; padding: .7rem .95rem; vertical-align: top; border-bottom: 1px solid var(--line); }
th { background: var(--lilac); color: var(--muted); font-size: .75rem; font-weight: 650; letter-spacing: .04em; text-transform: uppercase; white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
td.mono { white-space: nowrap; }
td .muted { font-size: .88em; }
@media (hover: hover) { tbody tr:hover td { background: var(--hover); } }
td[colspan] { color: var(--muted); padding: 1.75rem .95rem; text-align: center; }
td form { margin: 0; }
td a:not(.btn) { text-decoration: none; font-weight: 550; }
td a:not(.btn):hover { text-decoration: underline; }
table.background-work { box-shadow: none; background: transparent; }
table.background-work td, table.background-work th { padding-top: .55rem; padding-bottom: .55rem; }

/* ---------- forms ---------- */
form.inline { display: flex; flex-wrap: wrap; gap: .85rem; align-items: end; }
label { display: flex; flex-direction: column; gap: .3rem; font-size: .8125rem; font-weight: 600; color: var(--muted); }
label.grow { flex: 1 1 18rem; }
label.check { flex-direction: row; align-items: center; gap: .55rem; font-weight: 450; font-size: .9375rem; color: var(--fg); }
input, select, textarea {
    font: inherit; font-weight: 450; color: var(--fg); height: 2.6rem; padding: 0 .8rem;
    background: var(--panel); border: 1px solid var(--line-strong); border-radius: 10px;
    transition: border-color .15s ease, box-shadow .15s ease;
}
select { padding-right: 1.7rem; }
textarea { height: auto; padding: .6rem .8rem; min-height: 4.5rem; resize: vertical; line-height: 1.5; }
input:hover, select:hover, textarea:hover { border-color: color-mix(in srgb, var(--fg) 40%, var(--line-strong)); }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: none; border-color: var(--accent); box-shadow: var(--focus); }
input.narrow { width: 6.5rem; }
input[type=checkbox] { height: 1.1rem; width: 1.1rem; padding: 0; accent-color: var(--accent); flex: none; }
input:disabled, select:disabled, button:disabled { opacity: .55; cursor: not-allowed; }
.field-error { color: var(--err); font-size: .8125rem; font-weight: 500; }
.field-error:empty { display: none; }
.filters { margin-bottom: 1.1rem; }
.filters .grow { flex: 1 1 14rem; }
.row { display: flex; gap: 1rem; flex-wrap: wrap; align-items: end; }
.row > label { flex: 1 1 12rem; }
.shadow-opt { align-items: flex-start; }
.shadow-opt input { margin-top: .25rem; }
.shadow-opt .muted { font-weight: 450; font-size: .875rem; }

/* ---------- buttons: gradient primary, dark and outlined pills ---------- */
button, .btn {
    font: inherit; font-weight: 650; line-height: 1.2; text-decoration: none; cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
    height: 2.6rem; padding: 0 1.2rem; border: 1px solid transparent; border-radius: 999px;
    background: var(--grad); background-origin: border-box; color: var(--btn-fg);
    transition: filter .15s ease, box-shadow .15s ease, background-color .15s ease, border-color .15s ease;
}
button:hover, .btn:hover { filter: brightness(1.05) saturate(1.06); box-shadow: 0 6px 16px color-mix(in srgb, var(--rose) 35%, transparent); text-decoration: none; }
button:active, .btn:active { filter: brightness(.96); box-shadow: none; }
button:focus-visible, .btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
button.secondary, .btn.secondary { background: var(--panel); color: var(--fg); border-color: var(--line-strong); }
button.secondary:hover, .btn.secondary:hover { filter: none; box-shadow: none; background: var(--lilac); border-color: var(--violet); }
.btn.dark, button.dark { background: var(--dark); color: var(--dark-fg); }
.btn.dark:hover, button.dark:hover { filter: none; box-shadow: none; opacity: .88; }
button.danger { background: transparent; color: var(--err); border-color: var(--err-line); }
button.danger:hover { filter: none; box-shadow: none; background: var(--err-bg); border-color: var(--err); }
.actions { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; margin-bottom: 1rem; }
.sync-panel.actions { margin-bottom: 1.25rem; }
.actions form { margin: 0; }
p.actions { margin-top: 1.25rem; }
td button, td .btn { height: 2.15rem; padding: 0 .85rem; font-size: .875rem; }

/* ---------- messages ---------- */
.alert {
    --c: var(--ok); --bgc: var(--ok-bg); --lc: var(--ok-line);
    position: relative; margin: 0 0 1rem; padding: .75rem 1rem .75rem 2.75rem;
    color: var(--c); background: var(--bgc); border: 1px solid var(--lc); border-radius: 12px;
    max-width: 62rem; overflow-wrap: anywhere;
}
.alert.warn { --c: var(--warn); --bgc: var(--warn-bg); --lc: var(--warn-line); }
.alert.err { --c: var(--err); --bgc: var(--err-bg); --lc: var(--err-line); }
.alert.info { --c: var(--accent); --bgc: var(--accent-weak); --lc: color-mix(in srgb, var(--accent) 28%, var(--line)); }
.alert::before {
    content: ""; position: absolute; left: 1rem; top: .9rem; width: 1.1rem; height: 1.1rem; background: currentColor;
    -webkit-mask: var(--glyph) center / contain no-repeat; mask: var(--glyph) center / contain no-repeat;
    --glyph: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M8 12.5l2.7 2.7L16 9.5'/%3E%3C/svg%3E");
}
.alert.warn::before { --glyph: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 4l9 16H3L12 4z'/%3E%3Cpath d='M12 10v4M12 17h.01'/%3E%3C/svg%3E"); }
.alert.err::before { --glyph: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 7.5v5M12 16h.01'/%3E%3C/svg%3E"); }
.alert.info::before { --glyph: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 11v5M12 8h.01'/%3E%3C/svg%3E"); }
.alert a { color: inherit; font-weight: 650; }
.alert ul { margin: .4rem 0 0; padding-left: 1.1rem; }
.alert details { margin-top: .35rem; }
.alert summary { cursor: pointer; font-weight: 650; }
.alert.err:empty, .validation-summary-valid { display: none; }
.alert .muted { color: inherit; opacity: .8; }

/* ---------- status, tags, flags ---------- */
.status { display: inline-flex; align-items: center; gap: .5rem; font-weight: 600; white-space: nowrap; }
.status::before { content: ""; width: .55rem; height: .55rem; border-radius: 50%; background: currentColor; flex: none; }
.status.st-on { color: var(--ok); }
.status.st-off { color: var(--muted); }
.status.st-off::before { background: transparent; border: 2px solid currentColor; }
.status.st-info { color: var(--accent); }
.status.st-warn { color: var(--warn); }
.status.st-err { color: var(--err); }
.tag { display: inline-block; margin-left: .35rem; padding: .08rem .55rem; border-radius: 999px; font-size: .6875rem; font-weight: 700; letter-spacing: .03em; text-transform: uppercase; color: var(--accent); background: var(--accent-weak); vertical-align: .08em; }
.tag.t-err { color: var(--err); background: var(--err-bg); }
.tag.t-warn { color: var(--warn); background: var(--warn-bg); }
.tag.t-muted { color: var(--muted); background: var(--lilac); }
.shadow-tag { vertical-align: .2em; font-size: .7rem; }
.flag { display: inline-flex; align-items: center; gap: .35rem; margin-left: .35rem; color: var(--warn); font-weight: 600; font-size: .875em; }
.flag::before {
    content: ""; width: 1em; height: 1em; flex: none; background: currentColor;
    -webkit-mask: var(--glyph) center / contain no-repeat; mask: var(--glyph) center / contain no-repeat;
    --glyph: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 4l9 16H3L12 4z'/%3E%3Cpath d='M12 10v4M12 17h.01'/%3E%3C/svg%3E");
}
tr.rule-allow td:nth-child(3) strong, tr.rule-block td:nth-child(3) strong { display: inline-block; padding: .1rem .6rem; border-radius: 999px; font-size: .8125rem; font-weight: 700; white-space: nowrap; }
tr.rule-allow td:nth-child(3) strong { color: var(--ok); background: var(--ok-bg); }
tr.rule-block td:nth-child(3) strong { color: var(--err); background: var(--err-bg); }
tr.rule-allow td:first-child, tr.rule-block td:first-child { color: var(--muted); width: 2.5rem; }
table.rules th:nth-child(1) { width: 2.5rem; }
table.rules th:nth-child(2) { width: 22%; }
table.rules th:nth-child(3) { width: 7.5rem; }
table.rules th:nth-child(6) { width: 5.5rem; }
table.rules th:nth-child(7) { width: 7rem; }
table.rules td .muted { display: block; margin-top: .15rem; font-size: .8125rem; line-height: 1.4; }
table.rules td:nth-child(4) .muted, table.rules td:nth-child(5) .muted { margin: 0 0 .1rem; }
table.rules br { display: none; }
table.rules td:nth-child(4), table.rules td:nth-child(5) { min-width: 11rem; }
table.rules td .mono { overflow-wrap: break-word; }

/* ---------- tickets ---------- */
.ticket-layout { display: grid; grid-template-columns: minmax(0, 1fr) 18rem; gap: 1.5rem; align-items: start; }
.ticket-layout aside { display: grid; gap: 1rem; }
.ticket-layout aside .card { margin: 0; }
.ticket-layout h2 { margin-top: 0; }
.facts { display: grid; grid-template-columns: auto 1fr; gap: .45rem .9rem; margin: 0; font-size: .9rem; }
.facts dt { color: var(--muted); font-size: .8125rem; font-weight: 600; padding-top: .08rem; }
.facts dd { margin: 0; overflow-wrap: anywhere; }
.ticket-meta { display: flex; flex-wrap: wrap; gap: .25rem .6rem; align-items: center; margin: -.5rem 0 1.25rem; }
.thread { list-style: none; margin: 0 0 1.25rem; padding: 0; display: grid; gap: .75rem; }
.msg { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg); padding: .85rem 1.1rem; box-shadow: var(--shadow); }
.msg.staff { background: var(--lilac); border-color: transparent; }
.msg.internal { background: var(--warn-bg); border-color: var(--warn-line); }
.msg-head { display: flex; gap: .2rem .6rem; align-items: center; flex-wrap: wrap; margin-bottom: .3rem; }
.msg-head time { margin-left: auto; font-size: .8125rem; }
.msg-body { white-space: pre-wrap; overflow-wrap: anywhere; }
.reply h2 { margin: 0; }
.reply textarea { min-height: 7rem; }
.tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--line); margin-bottom: 1rem; overflow-x: auto; }
.tabs a { padding: .6rem 1rem; text-decoration: none; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; font-weight: 600; white-space: nowrap; }
.tabs a:hover { color: var(--fg); }
.tabs a[aria-current="page"] { color: var(--fg); border-bottom-color: var(--accent); }
.timelog { margin-top: 2rem; }
.timelog-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; flex-wrap: wrap; }
.timelog-head h2 { margin: 0 0 .6rem; }
.timelog-head p { margin: 0 0 .6rem; }
.time-form { margin-bottom: 1rem; }
.time-form .grow { flex: 1 1 14rem; }

/* ---------- footer ---------- */
.foot { text-align: center; color: var(--muted); font-size: .8125rem; padding: 0 1rem 2.25rem; }

/* ---------- tablet / phone ---------- */
@media (max-width: 1000px) {
    .tiles.t4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .tiles.t3 { grid-template-columns: 1fr; }
    .tiles.t3 .tile.center { flex-direction: row; text-align: left; justify-content: flex-start; gap: 1.25rem; padding: 1rem 1.25rem; }
    .split { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
    .ticket-layout { grid-template-columns: 1fr; }

    /* collapsible menu */
    .bar { flex-wrap: wrap; min-height: 3.75rem; }
    .brand img { width: 5.6rem; }
    .brand small, .who { display: none; }
    .bar > .cta { display: none; }
    .menu-toggle { display: inline-flex; height: 2.4rem; }
    .bar nav { flex-direction: column; align-items: stretch; width: 100%; margin: 0; padding: .25rem 0 .9rem; gap: .1rem; }
    .js .bar nav { display: none; }
    .js .topbar.open .bar nav { display: flex; }
    .bar nav > a, .dropdown > summary { padding: .8rem .9rem; min-height: 44px; border-radius: 12px; justify-content: space-between; }
    .dropdown-panel { position: static; min-width: 0; border: 0; box-shadow: none; padding: 0 0 .3rem .6rem; background: transparent; }
    .dropdown-panel a { padding: .7rem .9rem; min-height: 44px; }
    .dropdown { width: 100%; }
    .dropdown > summary { display: flex; }
    .bar nav > a.nav-cta-mobile { display: inline-flex !important; justify-content: center; margin-top: .4rem; }
    main { padding: 1.5rem 1rem max(2.5rem, env(safe-area-inset-bottom)); }
}
@media (max-width: 700px) {
    body { font-size: 16px; }
    h1 { font-size: 1.55rem; }
    h2 { margin-top: 1.75rem; }
    .tiles.t4 { grid-template-columns: 1fr 1fr; gap: .75rem; }
    .tile .num { font-size: 1.75rem; }

    form.inline { flex-direction: column; align-items: stretch; }
    form.inline > label, form.inline > button, form.inline > .btn { width: 100%; }
    form.inline > .grow, .filters .grow, .time-form .grow { flex: none; width: 100%; }
    input, select, textarea { font-size: 16px; height: 2.9rem; width: 100%; }
    textarea { height: auto; }
    input[type=checkbox] { width: 1.3rem; height: 1.3rem; }
    input.narrow { width: 100%; }
    button, .btn { height: 2.9rem; min-height: 44px; }
    .actions form, .actions .btn, .actions button { flex: 1 1 auto; }
    .sync-panel > div { width: 100%; }
    .card { padding: 1rem; }
    .card.stack, .card.stack.wide { max-width: none; }
    .row > label { flex-basis: 100%; }
    .msg-head time { margin-left: 0; width: 100%; }

    /* tables become cards */
    table, tbody { display: block; width: 100%; }
    table { background: transparent; border: 0; box-shadow: none; border-radius: 0; overflow: visible; }
    thead { display: none; }
    tr { display: block; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg); margin-bottom: .75rem; padding: .3rem .95rem; box-shadow: var(--shadow); }
    td { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; padding: .55rem 0; border-bottom: 1px solid var(--line); text-align: right; word-break: break-word; }
    tbody tr:hover td { background: transparent; }
    td::before { content: attr(data-label); flex: none; max-width: 42%; padding-top: .12rem; color: var(--muted); font-size: .72rem; font-weight: 650; letter-spacing: .04em; text-transform: uppercase; text-align: left; }
    td[data-label=""]::before { display: none; }
    td.empty { display: none; }
    td.span, td[colspan] { display: block; text-align: left; border-bottom: 0; padding: 1rem 0; }
    td.span::before { display: none; }
    td:last-child { border-bottom: 0; }
    td .v { display: block; flex: 1 1 auto; min-width: 0; text-align: right; }
    td .v:has(> form), td .v:has(> .btn) { width: 100%; text-align: center; }
    td .v:has(> input[type=checkbox]) { text-align: left; }
    td form, td .btn, td button { width: 100%; height: 2.7rem; font-size: 1rem; }
    td:has(> .v > input[type=checkbox]) { justify-content: flex-start; }
    td.mono, .nowrap { white-space: normal; }
    tr.rule-allow td:first-child, tr.rule-block td:first-child { width: auto; }
    table.rules th:nth-child(n) { width: auto; }
    .two-col { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

.attachments { list-style: none; margin: .6rem 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: .35rem .9rem; }
.attachments li::before { content: "\1F4CE\00a0"; }
.hint { font-size: .8125rem; font-weight: 400; }
input[type="file"] { max-width: 100%; padding: 0 .4rem 0 .35rem; color: var(--muted); font-size: .9375rem; cursor: pointer; }
input[type="file"]::file-selector-button {
    font: inherit; font-weight: 650; font-size: .875rem; color: var(--fg); cursor: pointer;
    height: 1.9rem; padding: 0 .95rem; margin: 0 .75rem 0 0; border: 1px solid var(--line-strong); border-radius: 999px;
    background: var(--panel); transition: background-color .15s ease, border-color .15s ease;
}
input[type="file"]:hover::file-selector-button { background: var(--lilac); border-color: var(--violet); }
input[type="file"]:focus-visible::file-selector-button { border-color: var(--accent); }
input[type="file"]:disabled::file-selector-button { cursor: not-allowed; }
.rename { margin: -.25rem 0 1rem; }
.rename summary { cursor: pointer; color: var(--muted, inherit); font-size: .875rem; }
.rename form { margin-top: .6rem; }
.phones { list-style: none; margin: 0 0 .4rem; padding: 0; }
.phones li { display: flex; gap: .3rem; align-items: center; }
.inline-form { display: inline; margin: 0; }
button.link { background: none; border: 0; padding: 0 .35rem; color: inherit; box-shadow: none; min-height: 0; cursor: pointer; }
tr.inactive td { opacity: .6; }
.logout, .logout-mobile { margin: 0; }
.logout-mobile { display: none; }
@media (max-width: 760px) { .logout { display: none; } .logout-mobile { display: block; } }
fieldset.choice { border: 0; padding: 0; margin: 0; display: grid; gap: .4rem; }
fieldset.choice legend { padding: 0; margin-bottom: .3rem; font-weight: 600; }
.asset-field { display: grid; gap: .35rem; }
.asset-row { display: flex; gap: .5rem; align-items: stretch; }
.asset-row input { flex: 1; min-width: 0; }
.asset-status { font-size: .875rem; min-height: 1.2em; }
.asset-status.ok { color: var(--ok, #1a7f4b); }
.asset-status.bad { color: var(--err, #b3261e); }
.asset-dialog { border: 0; border-radius: var(--r-lg, 1rem); padding: 1rem; width: min(92vw, 28rem); }
.asset-dialog::backdrop { background: rgb(0 0 0 / .6); }
.asset-dialog video { width: 100%; border-radius: .75rem; background: #000; aspect-ratio: 4 / 3; object-fit: cover; }
.asset-dialog-help { margin: 0 0 .6rem; }

/* contract chart */
svg.chart { width: 100%; height: auto; max-width: 720px; display: block; }
svg.chart .grid { stroke: var(--line); stroke-width: 1; }
svg.chart .axis { fill: var(--muted); font-size: 11px; font-family: inherit; }
svg.chart .val { fill: var(--fg); font-size: 11px; font-weight: 700; font-family: inherit; }
svg.chart .bar { fill: url(#cg); }
svg.chart .bar.over { fill: #d9534f; }
svg.chart .incl { stroke: var(--accent); stroke-width: 2; stroke-dasharray: 6 4; }
svg.chart .incl-label { fill: var(--accent); font-weight: 700; }
.meter { height: .7rem; border-radius: 999px; background: var(--lilac); overflow: hidden; border: 1px solid var(--line); }
.meter > span { display: block; height: 100%; background: var(--grad); }
.meter.over > span { background: #d9534f; }

/* kanban + to-do's (staff) */
.kanban { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(15rem, 1fr); gap: .8rem; overflow-x: auto; padding: .9rem 0 1.2rem; scroll-snap-type: x proximity; }
.kcol { background: var(--lilac); border: 1px solid var(--line); border-radius: 14px; padding: .6rem; display: flex; flex-direction: column; gap: .5rem; min-height: 14rem; scroll-snap-align: start; }
.kcol.over { outline: 2px dashed var(--accent); outline-offset: -2px; }
.khead { display: flex; justify-content: space-between; align-items: center; padding: .1rem .3rem; }
.khead h2 { margin: 0; font-size: .8125rem; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.kcount { background: var(--panel); border: 1px solid var(--line); border-radius: 999px; padding: 0 .55rem; font-size: .75rem; font-weight: 700; }
.kcards { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .5rem; min-height: 2.5rem; flex: 1; }
.kcard { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: .6rem .7rem; cursor: grab; box-shadow: var(--shadow); }
.kcard.dragging { opacity: .45; }
.ktitle { display: block; font-weight: 650; color: var(--fg); text-decoration: none; overflow-wrap: anywhere; }
.ktitle:hover { color: var(--accent); }
.kmeta { display: flex; flex-wrap: wrap; gap: .3rem; margin-top: .4rem; }
.kchip { font-size: .75rem; padding: .05rem .5rem; border-radius: 999px; background: var(--lilac); color: var(--muted); text-decoration: none; border: 1px solid var(--line); }
.kchip.ok { color: var(--ok, #1a7f4b); } .kchip.late, .late { color: #d9534f; font-weight: 700; }
.kmove { display: flex; gap: .3rem; margin-top: .5rem; }
.kmove form { margin: 0; } .kmove button { padding: .1rem .6rem; min-height: 2rem; }
.kadd input { width: 100%; background: transparent; border: 1px dashed var(--line-strong); }
.proj-settings { position: relative; } .proj-settings > summary { list-style: none; cursor: pointer; }
.proj-settings[open] > form { margin-top: .6rem; max-width: 28rem; }
ul.todos { list-style: none; margin: .8rem 0; padding: 0; display: grid; gap: .3rem; }
ul.todos li { display: flex; align-items: center; gap: .5rem; padding: .4rem .6rem; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; }
ul.todos li form { margin: 0; } ul.todos .todo-text { flex: 1; overflow-wrap: anywhere; } ul.todos li.done .todo-text { text-decoration: line-through; color: var(--muted); }
.todo-box { background: none; border: 0; box-shadow: none; font-size: 1.3rem; padding: 0 .2rem; min-height: 0; cursor: pointer; color: var(--accent); }
@media (max-width: 760px) { .kanban { grid-auto-columns: 85%; } .kcard { cursor: default; } }

.legal { display: inline-flex; gap: .5rem; flex-wrap: wrap; margin-left: .6rem; } .legal a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }

/* staff "meekijken" banner in the customer portal */
.impersonation { display: flex; gap: .8rem; align-items: center; justify-content: center; flex-wrap: wrap; padding: .5rem 1rem; background: var(--warn-bg); color: var(--warn); border-bottom: 1px solid var(--warn-line); font-size: .875rem; position: sticky; top: 0; z-index: 50; }
.impersonation form { margin: 0; }

/* contract: service window and supported components (staff and portal) */
.svc-comps { list-style: none; margin: 0; padding: 0; display: grid; gap: .1rem; }
.svc-comps li { display: grid; gap: .1rem; padding: .6rem 0; border-top: 1px solid var(--line); }
.svc-comps li:first-child { border-top: 0; }
.svc-comps .muted { font-size: .88rem; }
.svc-pair { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 19rem), 1fr)); gap: 1.25rem; margin-bottom: 1.25rem; align-items: start; }

/* contract: components fold open after the first few */
.svc-more { margin-top: auto; }
.svc-more > summary { cursor: pointer; color: var(--accent); font-weight: 600; list-style: none; padding: .4rem 0; }
.svc-more > summary::-webkit-details-marker { display: none; }
.svc-more .when-open { display: none; }
.svc-more[open] .when-open { display: inline; }
.svc-more[open] .when-closed { display: none; }
.svc-more > .svc-comps li:first-child { border-top: 1px solid var(--line); }
.svc-more-btn { margin-top: auto; align-self: flex-start; }

/* iPhone install instructions */
.ios-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 1rem; }
.ios-steps li { display: grid; grid-template-columns: 2rem minmax(0, 1fr); gap: .8rem; align-items: start; }
.ios-steps .n { display: inline-grid; place-items: center; width: 2rem; height: 2rem; border-radius: 50%; background: var(--accent-weak); color: var(--accent); font-weight: 700; }
.ios-steps p { margin: .2rem 0 0; font-size: .92rem; }
.ios-share { vertical-align: -4px; color: var(--accent); }

/* ticket maker */
.mk-layout { display: grid; grid-template-columns: minmax(0, 1fr) 20rem; gap: 1.25rem; align-items: start; }
.mk-form { display: grid; gap: 1.25rem; }
.mk-form .card, .mk-side .card { margin: 0; }
.mk-side { display: grid; gap: 1.25rem; }
.mk-card { display: grid; gap: 1.1rem; align-content: start; }
.mk-card > h2 { margin: 0; font-size: 1.1rem; }
.mk-field { border: 0; margin: 0; padding: 0; display: grid; gap: .5rem; min-width: 0; }
.mk-field > legend { padding: 0; font-weight: 600; margin-bottom: .1rem; }
.choice-group { display: grid; grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr)); gap: .6rem; }
.choice { position: relative; display: block; }
.choice input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.choice .c-box { display: grid; gap: .1rem; height: 100%; padding: .7rem .85rem; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); transition: border-color .12s ease, background .12s ease; }
.choice:hover .c-box { border-color: var(--line-strong); }
.choice input:checked + .c-box { border-color: var(--accent); background: var(--accent-weak); }
.choice input:focus-visible + .c-box { box-shadow: var(--focus); }
.choice .c-title { font-weight: 650; }
.choice .c-sub { font-size: .8rem; color: var(--muted); line-height: 1.35; }
.choice.c-high input:checked + .c-box { border-color: var(--warn); background: var(--warn-bg); }
.mk-tips { list-style: none; margin: 0; padding: 0; display: grid; gap: .65rem; }
.mk-tips li { display: grid; grid-template-columns: 1.6rem minmax(0, 1fr); gap: .5rem; align-items: start; font-size: .92rem; }
.mk-tips .n { display: inline-grid; place-items: center; width: 1.6rem; height: 1.6rem; border-radius: 50%; background: var(--lilac); color: var(--muted); font-size: .78rem; font-weight: 700; }
.mk-meta { display: grid; gap: .15rem; font-size: .9rem; }
.mk-actions { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; }
@media (max-width: 900px) { .mk-layout { grid-template-columns: 1fr; } }
@media (max-width: 700px) { .mk-actions .btn, .mk-actions button { flex: 1 1 100%; } .choice-group { grid-template-columns: 1fr; } }

/* attachments with camera (attach-field.js) */
.attach-field { display: grid; gap: .6rem; }
.attach-field .attach-input:not([hidden]) { width: 100%; }
.attach-bar { display: flex; flex-wrap: wrap; gap: .5rem; }
.attach-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .5rem; }
.attach-list:empty { display: none; }
.attach-item { display: grid; grid-template-columns: 3rem minmax(0, 1fr) auto; gap: .75rem; align-items: center; padding: .45rem .6rem .45rem .45rem; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); }
.attach-thumb { width: 3rem; height: 3rem; border-radius: 8px; object-fit: cover; background: var(--lilac); }
.attach-thumb.doc { display: grid; place-items: center; font-size: .7rem; font-weight: 800; color: var(--muted); letter-spacing: .04em; }
.attach-name { display: grid; min-width: 0; font-size: .92rem; }
.attach-name strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attach-name .muted { font-size: .8rem; }
.attach-remove { width: 2.2rem; height: 2.2rem; min-height: 0; padding: 0; font-size: 1.2rem; line-height: 1; }
.attach-msg { margin: 0; font-size: .85rem; } .attach-msg:empty { display: none; } .attach-msg.bad { color: var(--err); }
.attach-video { width: 100%; max-height: 60vh; background: #000; border-radius: 12px; }
.attach-cam { width: min(40rem, calc(100vw - 2rem)); }
.attach-camcount { margin: .6rem 0; min-height: 1.2em; }
@media (max-width: 700px) { .attach-bar button { flex: 1 1 0; } }
.attach-block { display: grid; gap: .5rem; } .attach-title { font-weight: 600; font-size: .9rem; }

/* wizard (wizard.js): one question at a time; without script all steps are shown */
.wizard .wz-progress, .wizard .wz-nav, .wizard .wz-review { display: none; }
.wizard.wz-on .wz-progress { display: grid; }
.wizard.wz-on .wz-nav { display: flex; }
.wizard.wz-on .wz-review { display: grid; }
.wizard.wz-on .wz-step:not(.wz-active) { display: none; }
.wizard.wz-on:not(.wz-at-end) .wz-final { display: none; }
.wz-progress { gap: .55rem; margin-bottom: .25rem; }
.wz-label { margin: 0; font-weight: 650; font-size: .92rem; color: var(--muted); }
.wz-bar { height: .4rem; border-radius: 999px; background: var(--lilac); overflow: hidden; }
.wz-bar > span { display: block; height: 100%; border-radius: 999px; background: var(--grad); transition: width .25s ease; }
.wz-dots { list-style: none; margin: 0; padding: 0; display: flex; gap: .4rem; flex-wrap: wrap; font-size: .8rem; color: var(--muted); }
.wz-dots li { padding: .15rem .6rem; border-radius: 999px; border: 1px solid var(--line); }
.wz-dots li.done { color: var(--fg); border-color: var(--line-strong); }
.wz-dots li.now { color: var(--accent); border-color: var(--accent); background: var(--accent-weak); font-weight: 650; }
.wz-q { margin: 0; font-size: 1.35rem; }
.wz-help { margin: 0; font-size: .92rem; }
.wz-big .c-box { padding: .95rem 1.05rem; } .wz-big .c-title { font-size: 1.05rem; }
.wz-err { margin: 0; color: var(--err); font-weight: 600; }
.wz-nav { justify-content: space-between; gap: .6rem; }
.wz-nav > button { min-width: 7.5rem; } .wz-nav [data-wz-next] { margin-left: auto; }
.wz-summary { display: grid; gap: .1rem; margin: 0; }
.wz-summary dt { color: var(--muted); font-size: .78rem; font-weight: 650; letter-spacing: .04em; text-transform: uppercase; margin-top: .8rem; }
.wz-summary dd { margin: 0; display: flex; gap: .75rem; align-items: flex-start; justify-content: space-between; }
.wz-val { overflow-wrap: anywhere; white-space: pre-wrap; min-width: 0; }
.wz-edit { flex: none; height: 2rem; min-height: 0; padding: 0 .8rem; font-size: .8rem; }
@media (max-width: 760px) {
    .wz-dots { display: none; }
    .wizard-mode .mk-side { display: none; }
    .wizard.wz-on .wz-nav, .wizard.wz-on.wz-at-end .wz-final { position: sticky; bottom: calc(4.6rem + env(safe-area-inset-bottom)); z-index: 15; padding: .7rem .85rem; margin: 0 -.85rem; background: color-mix(in srgb, var(--bg) 94%, transparent); border-top: 1px solid var(--line); backdrop-filter: blur(8px); }
    .wizard.wz-on .wz-nav > button { flex: 1 1 0; }
    .wizard.wz-on .wz-nav [data-wz-next]:only-of-type { margin-left: 0; }
    .wz-q { font-size: 1.25rem; }
}
.wizard .wz-js { display: none; }
.wizard.wz-on .wz-js { display: inline-flex; }
.wizard.wz-on.wz-at-end .wz-nav { display: none; }
.wizard.wz-on .wz-final .wz-cancel { display: none; }
@media (max-width: 760px) { .wizard.wz-on.wz-at-end .wz-final button { flex: 1 1 0; } }

/* several devices on one ticket */
.asset-chips { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .4rem; }
.asset-chips:empty { display: none; }
.asset-chip { display: inline-flex; align-items: center; gap: .45rem; max-width: 100%; padding: .25rem .3rem .25rem .7rem; border-radius: 999px; border: 1px solid var(--line, #d9d2e6); background: var(--surface-2, rgba(136,120,168,.12)); font-size: .85rem; }
.asset-chip i { font-style: normal; color: var(--muted, #6b6480); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.asset-chip button { all: unset; cursor: pointer; width: 1.5rem; height: 1.5rem; display: grid; place-items: center; border-radius: 50%; line-height: 1; }
.asset-chip button:hover, .asset-chip button:focus-visible { background: rgba(0,0,0,.12); outline: none; }
