/* dPayment console
   A switchboard for school bill-pay gateways: every project is a line that is either
   patched through to the vendor or held. Colour carries that one meaning and nothing
   else, so a screen of lines can be read at a glance. */

:root {
    --bg: #eef1f6;
    --surface: #ffffff;
    --surface-2: #f6f8fb;
    --line: #dde4ee;
    --line-strong: #c6d0de;
    --text: #0f1826;
    --muted: #5b6b80;
    --live: #0b8f6b;
    --live-soft: #dcf5ec;
    --held: #c14a17;
    --held-soft: #fdeadf;
    --key: #3350e8;
    --key-soft: #e6eaff;
    --danger: #c02626;

    --radius: 10px;
    --radius-sm: 6px;
    --rail: 272px;
    --shadow: 0 1px 2px rgb(15 24 38 / 6%), 0 8px 24px -16px rgb(15 24 38 / 28%);

    --display: "Space Grotesk", ui-sans-serif, system-ui, sans-serif;
    --body: "IBM Plex Sans", ui-sans-serif, system-ui, -apple-system, sans-serif;
    --mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", "Menlo", monospace;

    color-scheme: light;
}

[data-theme="dark"] {
    --bg: #090d14;
    --surface: #111927;
    --surface-2: #161f30;
    --line: #223047;
    --line-strong: #2e405c;
    --text: #dbe4f2;
    --muted: #8598b3;
    --live: #34d6a3;
    --live-soft: #0d2f28;
    --held: #ff9058;
    --held-soft: #33200f;
    --key: #829aff;
    --key-soft: #1a2444;
    --danger: #ff6b6b;
    --shadow: 0 1px 2px rgb(0 0 0 / 40%), 0 12px 32px -20px rgb(0 0 0 / 80%);

    color-scheme: dark;
}

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

html, body { height: 100%; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--body);
    font-size: 15px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--key); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 { font-family: var(--display); font-weight: 600; letter-spacing: -0.015em; margin: 0; }

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

/* ---------- Rail ---------- */

.rail {
    position: fixed;
    inset: 0 auto 0 0;
    width: var(--rail);
    background: var(--surface);
    border-right: 1px solid var(--line);
    display: flex;
    flex-direction: column;
    padding: 22px 16px;
    gap: 26px;
    z-index: 20;
}

.brand { display: flex; align-items: center; gap: 11px; padding: 0 6px; }

.brand__mark {
    width: 34px;
    height: 34px;
    border-radius: 9px;
    background: var(--text);
    color: var(--surface);
    display: grid;
    place-items: center;
    font-family: var(--display);
    font-weight: 700;
    font-size: 16px;
    flex: none;
}

.brand__name { display: block; font-family: var(--display); font-weight: 600; font-size: 17px; letter-spacing: -0.02em; line-height: 1.2; }
.brand__sub { display: block; font-size: 10.5px; color: var(--muted); letter-spacing: 0.1em; text-transform: uppercase; }

.rail__nav { display: flex; flex-direction: column; gap: 2px; }

.rail__label {
    font-size: 10.5px;
    letter-spacing: 0.13em;
    text-transform: uppercase;
    color: var(--muted);
    padding: 0 8px 8px;
}

.rail__link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 10px;
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 14.5px;
    transition: background 120ms ease, color 120ms ease;
}

.rail__link:hover { background: var(--surface-2); text-decoration: none; }
.rail__link svg { width: 17px; height: 17px; color: var(--muted); flex: none; }

.rail__link.is-active { background: var(--key-soft); color: var(--key); font-weight: 500; }
.rail__link.is-active svg { color: var(--key); }

.rail__foot { margin-top: auto; border-top: 1px solid var(--line); padding-top: 16px; }

.who { display: flex; align-items: center; gap: 10px; padding: 0 4px 12px; min-width: 0; }

.who__dot {
    width: 30px; height: 30px; border-radius: 50%;
    background: var(--key-soft); color: var(--key);
    display: grid; place-items: center;
    font-family: var(--display); font-weight: 600; font-size: 13px;
    flex: none;
}

/* An operator's name can be a long email address, so it is allowed to shorten rather
   than push past the rail. The full value stays available as a tooltip. */
.who__text { min-width: 0; flex: 1; }

.who__name {
    display: block;
    font-size: 13.5px;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.who__role { display: block; font-size: 11.5px; color: var(--muted); }

.rail__actions { display: flex; gap: 6px; }

/* ---------- Rail resizer ---------- */

/* A thin grab strip sitting exactly on the seam between the rail and the page. */
.railgrip {
    position: fixed;
    top: 0;
    bottom: 0;
    left: var(--rail);
    width: 9px;
    margin-left: -4px;
    z-index: 30;
    padding: 0;
    border: 0;
    background: transparent;
    cursor: col-resize;
    touch-action: none;
}

.railgrip::after {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: 3px;
    width: 3px;
    border-radius: 3px;
    background: transparent;
    transition: background 120ms ease;
}

.railgrip:hover::after,
.railgrip:focus-visible::after,
body.is-resizing .railgrip::after { background: var(--key); }

.railgrip:focus-visible { outline: none; }

body.is-resizing { cursor: col-resize; user-select: none; }

@media (prefers-reduced-motion: reduce) {
    .railgrip::after { transition: none; }
}

/* ---------- Shell ---------- */

.shell { margin-left: var(--rail); padding: 30px 34px 64px; }
.wrap { max-width: 1260px; margin: 0 auto; }

.page__head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
    margin-bottom: 22px;
}

.eyebrow {
    font-family: var(--mono);
    font-size: 11px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 5px;
}

.page__title { font-size: 27px; }
.page__note { color: var(--muted); font-size: 14px; margin-top: 4px; }
.page__actions { display: flex; gap: 8px; align-items: center; }

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

.btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    border: 1px solid var(--line-strong);
    background: var(--surface);
    color: var(--text);
    font: inherit;
    font-size: 14px;
    font-weight: 500;
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background 120ms ease, border-color 120ms ease, transform 120ms ease;
    text-decoration: none;
    white-space: nowrap;
}

.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn svg { width: 16px; height: 16px; }

.btn--key { background: var(--key); border-color: var(--key); color: #fff; }
.btn--key:hover { background: var(--key); filter: brightness(1.08); }

.btn--quiet { border-color: transparent; background: transparent; color: var(--muted); }
.btn--quiet:hover { background: var(--surface-2); color: var(--text); }

.btn--icon { padding: 7px; border-radius: var(--radius-sm); }
.btn--icon svg { width: 16px; height: 16px; }

.btn--danger { color: var(--danger); border-color: var(--line-strong); }

/* ---------- Panels ---------- */

.panel {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.panel + .panel { margin-top: 20px; }

.panel__head {
    padding: 15px 20px;
    border-bottom: 1px solid var(--line);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}

.panel__title { font-size: 15px; font-family: var(--display); font-weight: 600; }
.panel__body { padding: 20px; }

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

.notice {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--line);
    background: var(--surface);
    margin-bottom: 18px;
    font-size: 14px;
}

.notice svg { width: 18px; height: 18px; flex: none; margin-top: 1px; }
.notice--good { border-color: var(--live); background: var(--live-soft); color: var(--live); }
.notice--bad { border-color: var(--danger); background: var(--held-soft); color: var(--danger); }
.notice--warn { border-color: var(--held); background: var(--held-soft); color: var(--held); }

.field-error { color: var(--danger); font-size: 13px; margin-top: 5px; display: block; }

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

.tablewrap { overflow-x: auto; }

table.data { width: 100%; border-collapse: collapse; font-size: 14px; }

table.data th {
    text-align: left;
    font-family: var(--mono);
    font-size: 10.5px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--muted);
    font-weight: 500;
    padding: 11px 14px;
    border-bottom: 1px solid var(--line);
    background: var(--surface-2);
    white-space: nowrap;
}

table.data td { padding: 13px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.data tr:last-child td { border-bottom: 0; }
table.data tbody tr:hover { background: var(--surface-2); }

td.right, th.right { text-align: right; }

/* The signal bar: the left edge of every line says whether it is patched or held. */
table.data td.signal {
    position: relative;
    padding-left: 22px;
}

td.signal::before {
    content: "";
    position: absolute;
    left: 0;
    top: 8px;
    bottom: 8px;
    width: 3px;
    border-radius: 0 3px 3px 0;
    background: var(--line-strong);
}

tr.is-live td.signal::before { background: var(--live); }
tr.is-held td.signal::before { background: var(--held); }

.mono { font-family: var(--mono); font-size: 12.5px; }
.muted { color: var(--muted); }
.stack { display: flex; flex-direction: column; gap: 3px; }
.rowname { font-weight: 500; }
.rowsub { font-size: 12px; color: var(--muted); }
.rowactions { display: flex; gap: 6px; justify-content: flex-end; }

/* ---------- Patch switch: the one physical control on the page ---------- */

.patch { display: inline-flex; align-items: center; gap: 10px; }

.patch__switch {
    appearance: none;
    border: 1px solid var(--line-strong);
    background: var(--surface-2);
    width: 26px;
    height: 44px;
    border-radius: 13px;
    padding: 3px;
    cursor: pointer;
    position: relative;
    display: block;
    transition: border-color 140ms ease, background 140ms ease;
}

.patch__switch::after {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    right: 3px;
    height: 18px;
    border-radius: 9px;
    background: var(--muted);
    transition: transform 160ms cubic-bezier(.3, .8, .4, 1), background 160ms ease;
}

.patch__switch[data-state="live"] { border-color: var(--live); background: var(--live-soft); }
.patch__switch[data-state="live"]::after { transform: translateY(0); background: var(--live); }

.patch__switch[data-state="held"] { border-color: var(--held); background: var(--held-soft); }
.patch__switch[data-state="held"]::after { transform: translateY(18px); background: var(--held); }

.patch__label { font-size: 12.5px; font-weight: 500; line-height: 1.25; }
.patch__label small { display: block; font-weight: 400; color: var(--muted); font-size: 11.5px; }
tr.is-live .patch__label { color: var(--live); }
tr.is-held .patch__label { color: var(--held); }

@media (prefers-reduced-motion: reduce) {
    .patch__switch::after { transition: none; }
    .btn { transition: none; }
}

/* ---------- Key/value strips ---------- */

.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 18px; font-size: 14px; }
.kv dt { color: var(--muted); font-size: 12.5px; }
.kv dd { margin: 0; font-family: var(--mono); font-size: 12.5px; word-break: break-all; }

.endpoint {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    padding: 8px 10px;
    font-family: var(--mono);
    font-size: 12px;
    overflow: hidden;
}

.endpoint span { overflow-x: auto; white-space: nowrap; flex: 1; }

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

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px 22px;
}

.field { display: flex; flex-direction: column; gap: 6px; }
.field--wide { grid-column: 1 / -1; }

.field label { font-size: 13px; font-weight: 500; }

.field input,
.field select,
.field textarea {
    font: inherit;
    font-size: 14px;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-sm);
    padding: 9px 11px;
    width: 100%;
    transition: border-color 120ms ease, box-shadow 120ms ease;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
    outline: none;
    border-color: var(--key);
    box-shadow: 0 0 0 3px var(--key-soft);
}

.field input.mono, .field textarea.mono { font-family: var(--mono); font-size: 13px; }
.field__hint { font-size: 12px; color: var(--muted); }

.form-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    padding-top: 20px;
    margin-top: 20px;
    border-top: 1px solid var(--line);
}

/* ---------- Empty state ---------- */

.empty { padding: 54px 20px; text-align: center; }
.empty h3 { font-size: 17px; margin-bottom: 6px; }
.empty p { color: var(--muted); margin: 0 0 18px; font-size: 14px; }

/* ---------- Student picker ---------- */

.picker { border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--surface); }
.picker__search { border: 0; border-bottom: 1px solid var(--line); border-radius: var(--radius-sm) var(--radius-sm) 0 0; }
.picker__list { max-height: 260px; overflow-y: auto; padding: 6px; display: flex; flex-direction: column; gap: 2px; }

.picker__item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 9px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 14px;
}

.picker__item:hover { background: var(--surface-2); }
.picker__item input { width: 15px; height: 15px; accent-color: var(--key); flex: none; }
.picker__id { font-family: var(--mono); font-size: 12.5px; }
.picker__meta { margin-left: auto; font-size: 12px; color: var(--muted); }
.picker__meta.is-locked { color: var(--held); }
.picker__none { padding: 16px; color: var(--muted); font-size: 13.5px; text-align: center; }
.picker__foot { border-top: 1px solid var(--line); padding: 9px 12px; background: var(--surface-2); }

.req {
    font-family: var(--mono);
    font-size: 10px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--held);
    background: var(--held-soft);
    border-radius: 3px;
    padding: 1px 5px;
    margin-left: 6px;
    vertical-align: 1px;
}

.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn:disabled:hover { background: var(--key); }

/* ---------- Sign in ---------- */

.signin { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.signin__card { width: 100%; max-width: 390px; }
.signin__head { text-align: center; margin-bottom: 26px; }
.signin__head .brand { justify-content: center; margin-bottom: 14px; }
.signin__title { font-size: 22px; }
.signin__note { color: var(--muted); font-size: 13.5px; margin-top: 4px; }
.signin .form-grid { grid-template-columns: 1fr; }
.signin .btn { width: 100%; justify-content: center; }
.signin__foot { text-align: center; margin-top: 18px; font-size: 12px; color: var(--muted); font-family: var(--mono); }

.check { display: flex; align-items: center; gap: 8px; font-size: 13.5px; }
.check input { width: 15px; height: 15px; accent-color: var(--key); }

/* ---------- Manual ---------- */

.manual { background: var(--surface); color: var(--text); }
.manual h2 { font-size: 19px; margin: 30px 0 10px; }
.manual h3 { font-size: 15px; margin: 22px 0 8px; }
.manual p { margin: 0 0 12px; }
.manual pre {
    font-family: var(--mono);
    font-size: 12px;
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    padding: 11px 13px;
    overflow-x: auto;
    margin: 0 0 12px;
}
.manual__cover { text-align: center; padding: 48px 0 34px; border-bottom: 1px solid var(--line); }
.manual__cover h1 { font-size: 30px; }
.manual__cover p { color: var(--muted); margin-top: 8px; }
.samples { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }

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

@media (max-width: 980px) {
    .rail {
        position: static;
        width: auto;
        flex-direction: row;
        align-items: center;
        gap: 14px;
        padding: 12px 16px;
        border-right: 0;
        border-bottom: 1px solid var(--line);
        flex-wrap: wrap;
    }

    .rail__nav { flex-direction: row; flex-wrap: wrap; }
    .railgrip { display: none; }
    .rail__label, .who__role, .brand__sub { display: none; }
    .rail__foot { margin: 0 0 0 auto; border: 0; padding: 0; display: flex; align-items: center; gap: 10px; }
    .who { padding: 0; }
    .who__name { max-width: 150px; }
    .shell { margin-left: 0; padding: 20px 16px 48px; }
    .form-grid, .samples { grid-template-columns: 1fr; }
    .page__title { font-size: 22px; }
}

/* ---------- Print: the manual only ---------- */

@media print {
    .rail, .page__head, .noprint { display: none !important; }
    .shell { margin: 0; padding: 0; }
    .panel { border: 0; box-shadow: none; }
    body { background: #fff; font-size: 11.5pt; }
    .manual pre, .endpoint { border-color: #ccc; background: #f5f5f5; }
    .pagebreak { page-break-before: always; }
    table.data th { background: #f2f2f2; }
}
