/* PII Pseudonymizer by Kwizmo.
   Brand colours: Kwizmo purple (Pantone 267, #61398B) carries the interface;
   Kwizmo red (Pantone 193, #BF0D3E) is used sparingly, like the dot in the
   logo: for the main action and for errors. Replaced values are marked with a
   purple tint. System fonts only: no requests to third parties. */

:root {
    --kwizmo-purple: #61398B;
    --kwizmo-red: #BF0D3E;

    --ink: #241B30;
    --ink-soft: #5B5168;
    --desk: #F3F0F7;
    --paper: #FFFFFF;
    --rule: #DCD5E6;
    --field: #FCFBFE;

    --pen: var(--kwizmo-purple);          /* links, secondary buttons, focus */
    --pen-hover: #4A2B6B;
    --pen-soft: #EFE9F6;

    --action: var(--kwizmo-red);          /* main button */
    --action-hover: #9A0A32;
    --on-action: #FFFFFF;

    --marker: #E9E0F4;                    /* replaced values */
    --marker-edge: var(--kwizmo-purple);

    --alert: var(--kwizmo-red);
    --alert-soft: #FBEBEF;

    --code-bg: #241B30;
    --code-ink: #F1ECF7;

    --font-text: Seravek, "Gill Sans Nova", Ubuntu, Calibri, "DejaVu Sans", source-sans-pro, sans-serif;
    --font-mono: ui-monospace, "Cascadia Code", "Source Code Pro", Menlo, Consolas, "DejaVu Sans Mono", monospace;

    --step--1: 0.875rem;
    --step-0: 1rem;
    --step-1: 1.25rem;
    --step-2: 1.625rem;
    --step-3: 2.25rem;

    --space: 1.5rem;
    --radius-sheet: 6px;
    --radius-control: 4px;

    color-scheme: light;
}

@media (prefers-color-scheme: dark) {
    :root {
        --ink: #EEE9F4;
        --ink-soft: #B5ABC2;
        --desk: #15101C;
        --paper: #201A2A;
        --rule: #3B3149;
        --field: #1A1523;

        --pen: #C3A8E6;
        --pen-hover: #DCCBF2;
        --pen-soft: #33284A;

        --action: var(--kwizmo-red);
        --action-hover: #D8174E;
        --on-action: #FFFFFF;

        --marker: #3F2D59;
        --marker-edge: #A98BD6;

        --alert: #FF8FA8;
        --alert-soft: #3A1622;

        --code-bg: #0F0B15;
        --code-ink: #EEE9F4;
        color-scheme: dark;
    }
}

*,
*::before,
*::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    background: var(--desk);
    color: var(--ink);
    font-family: var(--font-text);
    font-size: var(--step-0);
    line-height: 1.5;
}

a { color: var(--pen); text-underline-offset: 0.15em; }
a:hover { color: var(--pen-hover); }

:focus-visible {
    outline: 3px solid var(--pen);
    outline-offset: 2px;
}

[hidden] { display: none !important; }

.visually-hidden {
    position: absolute !important;
    width: 1px; height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

.skip {
    position: absolute;
    left: 1rem; top: -3rem;
    background: var(--paper);
    padding: 0.5rem 1rem;
    z-index: 10;
}
.skip:focus { top: 1rem; }

.wrap {
    width: min(100% - 2rem, 76rem);
    margin-inline: auto;
}

/* Header ------------------------------------------------------------- */

.masthead {
    background: var(--paper);
    border-bottom: 1px solid var(--rule);
    box-shadow: inset 0 3px 0 var(--kwizmo-purple);
}
.masthead-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    min-height: 4rem;
}
.brand {
    display: inline-flex;
    align-items: center;
    gap: 0.8rem;
    color: var(--ink);
    text-decoration: none;
    padding: 0.35rem 0;
}
.brand:hover { color: var(--ink); }
.brand picture { display: block; line-height: 0; }
.brand-logo { display: block; width: 120px; height: auto; }
.brand-name {
    font-weight: 600;
    font-size: var(--step-0);
    color: var(--ink-soft);
    padding-left: 0.8rem;
    border-left: 1px solid var(--rule);
    line-height: 1.6;
}
.masthead nav a { font-weight: 600; text-decoration: none; }
.masthead nav a:hover { text-decoration: underline; }
.masthead nav a[aria-current="page"] {
    color: var(--ink);
    text-decoration: underline;
    text-decoration-color: var(--kwizmo-red);
    text-decoration-thickness: 2px;
    text-underline-offset: 0.35em;
}

/* Intro -------------------------------------------------------------- */

.intro { padding: 2.5rem 0 1.5rem; }
.intro h1 {
    font-size: clamp(var(--step-2), 4vw, var(--step-3));
    line-height: 1.15;
    letter-spacing: -0.01em;
    margin: 0 0 0.75rem;
    max-width: 22ch;
}
.intro p { max-width: 68ch; margin: 0 0 0.5rem; color: var(--ink-soft); }
.intro .privacy-line { color: var(--ink); font-weight: 600; }
.intro .privacy-line::before {
    content: "";
    display: inline-block;
    width: 0.6em;
    height: 0.6em;
    margin-right: 0.5em;
    border-radius: 50%;
    background: var(--kwizmo-red);
    vertical-align: 0.05em;
}

/* Workbench ---------------------------------------------------------- */

.workbench {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: var(--space);
    align-items: start;
}

.sheet {
    background: var(--paper);
    border: 1px solid var(--rule);
    border-radius: var(--radius-sheet);
    padding: var(--space);
}

h2 { font-size: var(--step-1); margin: 0 0 1rem; line-height: 1.25; }

.field { margin-bottom: 1.25rem; }
.field > label,
.label-row label { display: block; font-weight: 700; margin-bottom: 0.35rem; }
.label-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 1rem;
}
.counter { font-size: var(--step--1); color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.counter.over { color: var(--alert); font-weight: 700; }

textarea,
input[type="password"],
input[type="text"],
select {
    width: 100%;
    font: inherit;
    color: var(--ink);
    background: var(--field);
    border: 1px solid var(--rule);
    border-radius: var(--radius-control);
    padding: 0.6rem 0.7rem;
}
textarea {
    font-family: var(--font-mono);
    font-size: 0.9rem;
    line-height: 1.55;
    resize: vertical;
    min-height: 6rem;
}
textarea[readonly] { background: var(--paper); }
select { max-width: 22rem; }

/* Options ------------------------------------------------------------ */

.option {
    border: 0;
    border-top: 1px solid var(--rule);
    margin: 0;
    padding: 1rem 0 1.1rem;
    min-width: 0;
}
.option legend {
    font-weight: 700;
    padding: 0;
    float: left;
    width: 100%;
    margin-bottom: 0.5rem;
}
.option legend + * { clear: left; }
.optional { font-weight: 400; color: var(--ink-soft); font-size: var(--step--1); margin-left: 0.35rem; }

.hint {
    font-size: var(--step--1);
    color: var(--ink-soft);
    margin: 0.4rem 0 0;
    max-width: 70ch;
}

.checks {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
    gap: 0.35rem 1.25rem;
}
.checks li,
.check-line {
    display: grid;
    grid-template-columns: 1.25rem 1fr;
    gap: 0.5rem;
    align-items: start;
}
.checks label { cursor: pointer; }
.checks .hint { display: block; margin-top: 0.05rem; }
input[type="checkbox"] {
    width: 1.1rem;
    height: 1.1rem;
    margin: 0.2rem 0 0;
    accent-color: var(--pen);
}

.bulk { display: flex; gap: 1rem; margin-bottom: 0.5rem; }

.key-row { display: flex; gap: 0.5rem; }
.key-row input { flex: 1; font-family: var(--font-mono); }

.submit-area {
    border-top: 1px solid var(--rule);
    padding-top: 1.1rem;
}
.terms-line { margin-bottom: 1rem; }

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

button { font: inherit; cursor: pointer; }

.primary,
.secondary {
    border-radius: var(--radius-control);
    padding: 0.6rem 1.1rem;
    font-weight: 700;
    border: 2px solid var(--pen);
}
.primary { background: var(--action); border-color: var(--action); color: var(--on-action); }
.primary:hover { background: var(--action-hover); border-color: var(--action-hover); }
.primary:disabled { opacity: 0.7; cursor: progress; }
.secondary { background: transparent; color: var(--pen); }
.secondary:hover { background: var(--pen-soft); }

.button {
    border-radius: var(--radius-control);
    padding: 0.6rem 1.1rem;
    font-weight: 700;
    border: 2px solid var(--pen);
    background: transparent;
    color: var(--pen);
}
.button:hover { background: var(--pen-soft); }
.button.primary { background: var(--action); border-color: var(--action); color: var(--on-action); }
.button.primary:hover { background: var(--action-hover); border-color: var(--action-hover); }

.link-button {
    background: none;
    border: 0;
    padding: 0;
    color: var(--pen);
    text-decoration: underline;
    text-underline-offset: 0.15em;
    font-size: var(--step--1);
}

.actions,
.restore-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.6rem;
    margin-top: 0.9rem;
}
.status { font-size: var(--step--1); color: var(--ink-soft); }

/* Result ------------------------------------------------------------- */

.summary { margin: 0 0 0.9rem; color: var(--ink-soft); font-size: var(--step--1); }

.empty {
    color: var(--ink-soft);
    border: 1px dashed var(--rule);
    border-radius: var(--radius-control);
    padding: 2.5rem 1.5rem;
    margin: 0;
    text-align: center;
}

.view-switch { display: inline-flex; margin-bottom: 0.6rem; border: 1px solid var(--rule); border-radius: var(--radius-control); }
.tab {
    background: transparent;
    border: 0;
    padding: 0.35rem 0.9rem;
    color: var(--ink-soft);
    font-size: var(--step--1);
}
.tab[aria-pressed="true"] { background: var(--pen-soft); color: var(--ink); font-weight: 700; }

.marked-view {
    font-family: var(--font-mono);
    font-size: 0.9rem;
    line-height: 1.75;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    border: 1px solid var(--rule);
    border-radius: var(--radius-control);
    padding: 0.8rem 0.9rem;
    max-height: 32rem;
    overflow: auto;
    background: var(--paper);
}

/* the marker stroke */
mark {
    color: inherit;
    background: var(--marker);
    box-shadow: inset 0 -0.14em 0 var(--marker-edge);
    padding: 0.05em 0.25em;
    margin: 0 -0.05em;
    border-radius: 0.2em;
    -webkit-box-decoration-break: clone;
    box-decoration-break: clone;
}

.mapping { margin-top: 1.25rem; border-top: 1px solid var(--rule); padding-top: 0.9rem; }
.mapping summary { cursor: pointer; font-weight: 700; }
.table-scroll { overflow-x: auto; margin-top: 0.75rem; max-height: 24rem; overflow-y: auto; }
table { border-collapse: collapse; width: 100%; font-size: var(--step--1); }
th, td { text-align: left; padding: 0.4rem 0.6rem; border-bottom: 1px solid var(--rule); vertical-align: top; }
th { position: sticky; top: 0; background: var(--paper); }
.mapping td:nth-child(2), .mapping td:nth-child(3) { font-family: var(--font-mono); overflow-wrap: anywhere; }
.mapping td:first-child { white-space: nowrap; color: var(--ink-soft); }

/* Notices ------------------------------------------------------------ */

.notice {
    border-left: 4px solid var(--alert);
    background: var(--alert-soft);
    padding: 0.7rem 1rem;
    margin: 0 0 1rem;
    border-radius: 0 var(--radius-control) var(--radius-control) 0;
}
.notice p { margin: 0; }
.notice p + p { margin-top: 0.35rem; }

/* Restore ------------------------------------------------------------ */

.restore-sheet { margin-top: var(--space); }
.restore-sheet > p { max-width: 70ch; color: var(--ink-soft); margin-top: 0; }
.restore-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space);
}
.restore-controls { margin-top: 0; align-items: end; }
.file-field { margin-bottom: 0; margin-right: auto; }
.file-field label { display: block; font-weight: 700; margin-bottom: 0.35rem; }
input[type="file"] { font: inherit; font-size: var(--step--1); max-width: 100%; }

/* Terms -------------------------------------------------------------- */

.terms {
    margin: 2rem auto;
    max-width: 48rem;
    line-height: 1.6;
}
.terms h1 { font-size: var(--step-3); line-height: 1.15; margin: 0 0 0.25rem; }
.terms h2 { margin-top: 2rem; margin-bottom: 0.5rem; }
.terms p, .terms li { max-width: 70ch; }
.terms ul { padding-left: 1.25rem; }
.terms li + li { margin-top: 0.3rem; }

/* API documentation -------------------------------------------------- */

.masthead nav { display: flex; gap: 1.25rem; flex-wrap: wrap; }

.docs {
    margin: 2rem auto;
    max-width: 60rem;
    line-height: 1.6;
}
.docs h1 { font-size: var(--step-3); line-height: 1.15; margin: 0 0 1rem; }
.docs h2 { margin-top: 2.5rem; margin-bottom: 0.6rem; padding-top: 1.25rem; border-top: 1px solid var(--rule); }
.docs h3 { font-size: var(--step-0); margin: 1.5rem 0 0.4rem; }
.docs > p, .docs section > p, .docs li { max-width: 72ch; }
.docs section { scroll-margin-top: 1rem; }
.docs .table-scroll { max-height: none; overflow-y: visible; }
.docs table { margin: 0.25rem 0 0.75rem; min-width: 34rem; }
.docs td:first-child, .docs td:nth-child(2) { white-space: nowrap; }
.docs td:last-child { min-width: 14rem; }
.docs th[scope="row"] { white-space: nowrap; font-weight: 600; }
.docs td code, .docs p code, .docs li code, .terms code {
    font-family: var(--font-mono);
    font-size: 0.85em;
    background: var(--desk);
    padding: 0.08em 0.3em;
    border-radius: 2px;
    overflow-wrap: anywhere;
}

.toc {
    border: 1px solid var(--rule);
    border-radius: var(--radius-control);
    padding: 0.8rem 1.1rem;
    margin: 1.5rem 0;
    background: var(--field);
}
.toc p { margin: 0 0 0.35rem; font-weight: 700; }
.toc ul { margin: 0; padding: 0; list-style: none; columns: 2 16rem; column-gap: 2rem; }
.toc li { margin: 0.15rem 0; }

.steps { padding-left: 1.5rem; }
.steps li + li { margin-top: 0.4rem; }

.code { margin: 1rem 0 1.25rem; }
.code figcaption {
    font-size: var(--step--1);
    color: var(--ink-soft);
    margin-bottom: 0.3rem;
}
.code pre {
    margin: 0;
    padding: 0.9rem 1rem;
    background: var(--code-bg);
    color: var(--code-ink);
    border-radius: var(--radius-control);
    overflow-x: auto;
    font-family: var(--font-mono);
    font-size: 0.82rem;
    line-height: 1.55;
    tab-size: 4;
}
@media (prefers-color-scheme: dark) {
    .code pre { border: 1px solid var(--rule); }
}

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

.footer {
    padding: 2rem 0 3rem;
    font-size: var(--step--1);
    color: var(--ink-soft);
}
.footer p { margin: 0 0 0.35rem; max-width: 80ch; }

/* Content pages: business, gateway, extension, accuracy ------------- */

a.button { display: inline-block; text-decoration: none; text-align: center; }
.docs .lead { font-size: var(--step-1); line-height: 1.45; max-width: 60ch; }
.docs kbd {
    font-family: var(--font-mono);
    font-size: 0.85em;
    border: 1px solid var(--rule);
    border-bottom-width: 2px;
    border-radius: 4px;
    padding: 0.05em 0.35em;
    background: var(--field);
}
.download-row, .cta { display: flex; flex-wrap: wrap; gap: 0.75rem; margin: 1.25rem 0; }
.notice-info, .docs .notice[role="note"] { border-left-color: var(--pen); background: var(--pen-soft); }

.stat-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
    gap: 0.75rem;
    margin: 1.25rem 0 0.5rem;
}
.stat {
    border: 1px solid var(--rule);
    border-top: 4px solid var(--pen);
    border-radius: var(--radius-control);
    padding: 0.8rem 1rem;
    background: var(--field);
}
.stat-value { display: block; font-size: var(--step-2); font-weight: 700; color: var(--pen); line-height: 1.2; }
.stat-label { display: block; color: var(--ink-soft); font-size: var(--step--1); margin-top: 0.2rem; }

.plans {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(12.5rem, 1fr));
    gap: 1rem;
    margin: 1.5rem 0 0.5rem;
    align-items: stretch;
}
.docs .plan {
    display: flex;
    flex-direction: column;
    border: 1px solid var(--rule);
    border-radius: var(--radius-control);
    padding: 1rem 1.1rem 1.1rem;
    background: var(--field);
}
.docs .plan h2 { border: 0; margin: 0; padding: 0; font-size: var(--step-1); }
.docs .plan-highlight { border: 2px solid var(--pen); box-shadow: 0 6px 20px rgba(97, 57, 139, 0.12); }
.plan-price { font-size: var(--step-2); font-weight: 700; margin: 0.35rem 0 0; color: var(--ink); line-height: 1.15; }
.plan-per { display: block; font-size: var(--step--1); font-weight: 400; color: var(--ink-soft); }
.sub-row td { color: var(--ink-soft); font-size: var(--step--1); padding-left: 1.25rem; }
/* tool page: toolbar, folded options, misses, hiding the real values */
.text-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; margin: 0.4rem 0 0; }
.text-tools .sep { color: var(--ink-soft); font-size: var(--step--1); }
.file-label { position: relative; overflow: hidden; }
.file-label input[type="file"] { position: absolute; inset: 0; opacity: 0; width: 100%; cursor: pointer; }
.file-name { font-style: italic; }
.file-chip { display: inline-flex; align-items: baseline; gap: 0.45rem; font-size: var(--step--1);
    border: 1px solid var(--rule); border-radius: 999px; padding: 0.1rem 0.6rem 0.1rem 0.75rem; background: var(--field); }
.file-chip-size { color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.file-clear { font-size: inherit; }
.file-note { margin: 0.4rem 0 0; }
/* a file is shown read-only: it is the file, not this box, that gets sent */
textarea.previewing { background: var(--field); cursor: default; }
.primary-action { margin-top: 1rem; }
.primary-action .hint kbd { font: inherit; border: 1px solid var(--rule); border-bottom-width: 2px;
    border-radius: 4px; padding: 0 0.25rem; background: var(--field); }
details.options { border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); margin: 1.5rem 0 1rem; }
details.options > summary { cursor: pointer; padding: 0.8rem 0; display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: baseline; list-style: none; }
details.options > summary::-webkit-details-marker { display: none; }
details.options > summary::before { content: '\25B8'; color: var(--ink-soft); display: inline-block; transition: transform 0.12s; }
details.options[open] > summary::before { transform: rotate(90deg); }
/* with the options folded the second button sits right under the first one */
details.options:not([open]) + .submit-area { display: none; }
details.options .options-title { font-weight: 600; }
details.options[open] > summary { border-bottom: 1px solid var(--rule); margin-bottom: 0.5rem; }
.misses { border-left: 3px solid var(--rule); padding: 0.1rem 0 0.1rem 0.8rem; margin: 1rem 0; font-size: var(--step--1); }
.miss-words { display: flex; flex-wrap: wrap; gap: 0.35rem; margin: 0.4rem 0 0; }
.miss { border: 1px dashed var(--rule); border-radius: 999px; padding: 0.05rem 0.6rem; background: var(--field); }
.restore-link { margin: 0.9rem 0 0; font-size: var(--step--1); }
.file-result { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem; margin: 0.8rem 0; }
/* "Hide real values": blur every place on the page that can show the real data.
   Set on <html> by an inline script before the first paint, so nothing flashes. */
.hide-values-line { margin-left: auto; font-size: var(--step--1); align-items: center; }
.hide-values-line .hint { font-size: inherit; }
.pii-hide .real-value,
.pii-hide .real-value::placeholder {
    color: transparent !important;
    text-shadow: 0 0 9px var(--ink);
    caret-color: transparent;
    user-select: none;
}
.pii-hide textarea.real-value { resize: none; }
@media (prefers-reduced-motion: no-preference) {
    .real-value { transition: text-shadow 0.12s; }
}

/* status page */
.status-line { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.5rem; font-size: var(--step-1); margin: 1rem 0 1.5rem; }
.status-dot { width: 0.7rem; height: 0.7rem; border-radius: 50%; display: inline-block; background: var(--ink-soft); }
.status-up .status-dot { background: #1a7f44; }
.status-down .status-dot { background: var(--alert); }
.status-unknown .status-dot { background: #b8860b; }
.uptime-strip { display: flex; gap: 2px; align-items: flex-end; margin: 0.75rem 0; }
.uptime-day { flex: 1 1 auto; min-width: 2px; height: 2.2rem; border-radius: 2px; background: var(--rule); }
.uptime-ok { background: #1a7f44; }
.uptime-warn { background: #b8860b; }
.uptime-bad { background: var(--alert); }
.uptime-none { background: var(--rule); }
.uptime-key { display: inline-block; width: 0.7rem; height: 0.7rem; border-radius: 2px; vertical-align: -0.05rem; margin: 0 0.15rem 0 0.9rem; }

/* billing */
.frozen-note { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem; margin: 1rem 0; color: var(--ink-soft); }
.inline-form { display: inline; }
.badge-frozen { display: inline-block; font-size: var(--step--1); border-radius: 999px; padding: 0.05rem 0.6rem;
    background: var(--pen); color: var(--paper); letter-spacing: 0.02em; }
.badge-frozen.small { font-size: 0.72em; padding: 0 0.45rem; vertical-align: 0.1em; }
.button.danger { border-color: var(--alert); color: var(--alert); }
table tfoot th, table tfoot td { border-top: 2px solid var(--rule); font-weight: 600; padding-top: 0.6rem; }
.sub-row td code { font-size: 0.9em; }
.plan-for { color: var(--ink-soft); margin: 0 0 0.5rem; }
.docs .plan ul { padding-left: 1.1rem; margin: 0.25rem 0 1rem; flex: 1; }
.docs .plan li { margin: 0.25rem 0; }
.docs .plan .button { margin-top: auto; }

.steps { counter-reset: none; padding-left: 1.4rem; }
.steps li { margin: 0.3rem 0; }
.footer-links a { white-space: nowrap; }

@media (prefers-color-scheme: dark) {
    .docs .plan-highlight { box-shadow: none; }
}

/* Diagram: the two keys of a gateway request ------------------------- */
.keys-figure { margin: 1.25rem 0; }
.keys-figure svg { display: block; width: 100%; max-width: 30rem; margin: 0 auto; height: auto; font-family: var(--font-text); }
.keys-figure figcaption { color: var(--ink-soft); font-size: var(--step--1); text-align: center; margin-top: 0.5rem; }
.kd-box { fill: var(--field); stroke: var(--rule); stroke-width: 1.5; }
.kd-box-accent { fill: var(--pen-soft); stroke: var(--pen); }
.kd-title { fill: var(--ink); font-size: 15.5px; font-weight: 600; }
.kd-sub { fill: var(--ink-soft); font-size: 12.5px; }
.kd-note { fill: var(--ink-soft); font-size: 12.5px; }
.kd-code { font-family: var(--font-mono); font-size: 12.5px; font-weight: 600; }
.kd-line { fill: none; stroke-width: 2; }
.kd-purple, .kd-purple-fill { stroke: var(--pen); }
.kd-purple-text { fill: var(--pen); }
.kd-purple-fill { fill: var(--pen); }
.kd-red { stroke: var(--alert); }
.kd-red-text { fill: var(--alert); }
.kd-red-fill { fill: var(--alert); stroke: none; }
.kd-ink { stroke: var(--ink-soft); }
.kd-ink-fill { fill: var(--ink-soft); stroke: none; }
.kd-purple-fill { stroke: none; }

/* Admin page ---------------------------------------------------------- */

.admin-bar { display: flex; flex-wrap: wrap; gap: 0.75rem 1.25rem; align-items: baseline; justify-content: space-between; }
.admin-bar h1 { margin-bottom: 0; }
.admin-who { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: center; font-size: var(--step--1); color: var(--ink-soft); }
.admin-who form { display: inline; }

.admin-login { max-width: 22rem; }
.admin-form { max-width: 34rem; }
.admin-form p, .admin-login p { margin: 0 0 0.9rem; }
.admin-form label, .admin-login label { display: block; font-weight: 600; margin-bottom: 0.2rem; }
.admin-form label.check { font-weight: 400; display: flex; gap: 0.5rem; align-items: center; margin: 0.2rem 0; }
.admin-form input[type="text"], .admin-form input[type="number"], .admin-form input[type="password"],
.admin-login input { width: 100%; }
.admin-form fieldset { border: 1px solid var(--rule); border-radius: var(--radius-control); padding: 0.6rem 0.8rem; margin: 0 0 0.9rem; }
.admin-form legend { font-weight: 600; padding: 0 0.3rem; }
.admin-form .hint { display: block; margin-top: 0.15rem; }
.field-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); gap: 0 1rem; }
.danger-line { margin-top: 1.5rem; }
.danger-line a { color: var(--alert); }
.admin-form.danger { margin-top: 0.5rem; }

.new-key { border: 2px solid var(--pen); border-radius: var(--radius-control); padding: 0.9rem 1rem; margin: 1rem 0; background: var(--pen-soft); }
.new-key h2 { margin-top: 0; }
.new-key code.key-value {
    display: block;
    overflow-wrap: anywhere;
    font-family: var(--font-mono);
    font-size: var(--step-0);
    padding: 0.6rem 0.7rem;
    background: var(--code-bg);
    color: var(--code-ink);
    border-radius: var(--radius-control);
    user-select: all;                      /* one click selects the whole key */
}
.new-key .key-actions { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: center; margin-top: 0.6rem; }
.new-key .copied { color: var(--pen); font-size: var(--step--1); }

.notice-ok { border-left-color: var(--pen); background: var(--pen-soft); }
.row-actions { white-space: nowrap; display: flex; gap: 0.5rem; align-items: center; }
.row-actions form { display: inline; }
.button.small, .primary.small, .secondary.small { font-size: var(--step--1); padding: 0.3rem 0.7rem; font-weight: 600; border-width: 1px; }
.row-actions .button { min-width: 4.5rem; }
tr.is-off th, tr.is-off td { color: var(--ink-soft); }
table th .hint { display: block; font-weight: 400; margin-top: 0.1rem; }
.tag { display: inline-block; font-size: var(--step--1); border: 1px solid var(--rule); border-radius: 999px; padding: 0 0.5rem; color: var(--ink-soft); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

.quota { display: inline-block; width: 5rem; height: 0.5rem; background: var(--rule); border-radius: 999px; overflow: hidden; vertical-align: middle; margin-left: 0.4rem; }
.quota-fill { display: block; height: 100%; background: var(--pen); }
.quota-fill.is-high { background: #C97A12; }
.quota-fill.is-full { background: var(--alert); }
.quota-none { color: var(--ink-soft); font-size: var(--step--1); }
.quota-fill.w0 { width: 0%; }
.quota-fill.w5 { width: 5%; }
.quota-fill.w10 { width: 10%; }
.quota-fill.w15 { width: 15%; }
.quota-fill.w20 { width: 20%; }
.quota-fill.w25 { width: 25%; }
.quota-fill.w30 { width: 30%; }
.quota-fill.w35 { width: 35%; }
.quota-fill.w40 { width: 40%; }
.quota-fill.w45 { width: 45%; }
.quota-fill.w50 { width: 50%; }
.quota-fill.w55 { width: 55%; }
.quota-fill.w60 { width: 60%; }
.quota-fill.w65 { width: 65%; }
.quota-fill.w70 { width: 70%; }
.quota-fill.w75 { width: 75%; }
.quota-fill.w80 { width: 80%; }
.quota-fill.w85 { width: 85%; }
.quota-fill.w90 { width: 90%; }
.quota-fill.w95 { width: 95%; }
.quota-fill.w100 { width: 100%; }

.month-picker { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: center; margin: 0.75rem 0 1rem; }
.month-picker select { max-width: 14rem; }
.history { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr)); gap: 0.2rem 1rem; }
.history li { display: flex; justify-content: space-between; border-bottom: 1px solid var(--rule); padding: 0.2rem 0; }
.history.incidents { grid-template-columns: 1fr; }
.history.incidents li { gap: 1rem; }

@media (max-width: 30rem) {
    .admin-bar { flex-direction: column; align-items: flex-start; }
}

/* Small screens ------------------------------------------------------ */

@media (max-width: 56rem) {
    .workbench,
    .restore-grid { grid-template-columns: 1fr; }
    .intro { padding-top: 1.75rem; }
}

@media (max-width: 40rem) {
    .masthead-row { flex-wrap: wrap; row-gap: 0.4rem; }
    .masthead nav { width: 100%; justify-content: flex-start; flex-wrap: wrap; column-gap: 1rem; row-gap: 0.2rem; }
}

@media (max-width: 30rem) {
    :root { --space: 1rem; }
    .brand-name { display: none; }
    .key-row { flex-wrap: wrap; }
    .key-row input { flex-basis: 100%; }
    .primary, .secondary { width: 100%; }
    .actions .primary, .actions .secondary { width: auto; flex: 1 1 auto; }
}

@media (prefers-reduced-motion: reduce) {
    * { scroll-behavior: auto !important; transition: none !important; }
}

@media print {
    body { background: #fff; }
    .masthead nav, form, .restore-sheet, .actions, .view-switch { display: none !important; }
    .workbench { grid-template-columns: 1fr; }
    .sheet { border: 0; }
}
