/* SERVO :: admin/style.css */

/* Saira, served locally: one variable file for every weight. */
@font-face {
    font-family: "Saira";
    font-style: normal;
    font-weight: 100 900;
    font-display: block;
    src: url("font/saira.woff2") format("woff2");
}

:root {
    /* Width of the inputs and buttons inside a sign-in card. */
    --control: 75%;

    /* Project palette; cyan and violet are the brand colors. */
    --cyan: #84fafa;
    --violet: #8765fe;
    --green: #76e63f;
    --orange: #f09d59;
    --ink: #212427;
    --paper: #c1c1c1;
    --steel: #5a6a7a;

    /* Roles built from the palette. */
    --bg: var(--ink);
    --panel: #272b2f;
    --raised: #1c1f22;
    --line: #39414a;
    --text: #e6e8ea;
    --muted: var(--steel);

    /* text colors */
    --on-violet: #fbfbc4;

    --ok: #5fe0a8;
    --err: #f87171;
    --warn: #fbbf24;
    --radius: 10px;

    /* One focus ring for the whole interface. */
    --ring: 0 0 0 3px rgba(132, 250, 250, .22);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html,
body {
    height: 100%;
}

body {
    background: var(--bg);
    color: var(--text);
    font: 16px "Saira", system-ui, sans-serif;
    -webkit-font-smoothing: antialiased;
}

b {
    font-weight: 400;
}

/* --- sign-in screen ------------------------------------------------- */

/* The sign-in card, centered. */
body.gate {
    display: grid;
    place-items: center;
    padding: max(4vmin, env(safe-area-inset-top)) 4vmin max(4vmin, env(safe-area-inset-bottom));
}

.card {
    width: 100%;
    min-width: 0;
    max-width: 400px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 32px 28px;
    animation: in 500ms cubic-bezier(.22, .61, .36, 1) both;
}

.brand {
    display: block;
    width: auto;
    height: 64px;
    margin: 0 auto 24px;
    object-fit: contain;
}

/* Sign-in cards are centered throughout. */
.card {
    text-align: center;
}

h1 {
    font-size: 17px;
    font-weight: 400;
    letter-spacing: .01em;
    margin-bottom: 6px;
}

h2 {
    font-weight: 400;
}

.sub {
    color: var(--muted);
    font-size: 14px;
    margin-bottom: 22px;
}

/* --- form ----------------------------------------------------------- */

label {
    display: block;
    font-size: 13px;
    color: var(--muted);
    margin-bottom: 6px;
    letter-spacing: .02em;
}

.field {
    margin-bottom: 16px;
}

input[type=text],
input[type=email],
input[type=password] {
    width: var(--control);
    background: var(--raised);
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--text);
    padding: 10px 12px;
    font: inherit;
    text-align: center;
    transition: border-color 150ms, box-shadow 150ms;
}

input:focus {
    outline: none;
    border-color: var(--cyan);
    box-shadow: var(--ring);
}

/* --- verification code ---------------------------------------------
   One invisible input across six boxes that mirror its value. */

.code {
    position: relative;
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 5px;
    width: min(max(var(--control), 220px), 100%);
    margin: 0 auto;
}

/* The input covers the whole grid but shows nothing itself. */
.code input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    padding: 0;
    border: 0;
    background: none;
    color: transparent;
    caret-color: transparent;
    font-size: 16px;
    /* keeps iOS from zooming on focus */
    z-index: 2;
}

.code input:focus {
    outline: none;
    box-shadow: none;
}

.code .box {
    display: grid;
    place-items: center;
    aspect-ratio: 3 / 4;
    background: var(--raised);
    border: 1px solid var(--line);
    border-radius: 8px;
    font: 600 16px/1 ui-monospace, "SF Mono", Menlo, Consolas, monospace;
    font-variant-numeric: tabular-nums;
    color: var(--text);
    transition: border-color 150ms, box-shadow 150ms;
}

/* The box waiting for the next digit. */
.code .box.on {
    border-color: var(--cyan);
    box-shadow: var(--ring);
}

/* A blinking caret drawn inside the active empty box. */
.code .box.on:empty::after {
    content: "";
    width: 2px;
    height: 16px;
    background: var(--cyan);
    animation: caret 1.06s steps(1) infinite;
}

@keyframes caret {

    0%,
    50% {
        opacity: 1;
    }

    50.01%,
    100% {
        opacity: 0;
    }
}

@media (prefers-reduced-motion: reduce) {
    .code .box.on:empty::after {
        animation: none;
    }
}

/* The sign-in card's own button, scoped to the gate. */
.gate button {
    width: var(--control);
    background: var(--violet);
    color: var(--on-violet);
    border: 0;
    border-radius: 8px;
    padding: 12px 16px;
    margin: 12px 0;
    font-size: 18px;
    font-weight: 400;
    letter-spacing: 1px;
    cursor: pointer;
    transition: filter 150ms, transform 60ms;
}

.gate button:hover {
    filter: brightness(1.1);
}

.gate button:active {
    transform: translateY(1px);
}

/* Locked out. */
.gate button:disabled,
.gate button:disabled:hover {
    opacity: .4;
    filter: none;
    cursor: not-allowed;
    transform: none;
}

input:disabled {
    cursor: not-allowed;
}

.code:has(input:disabled) .box {
    opacity: .4;
    border-style: dashed;
}

.gate button.ghost {
    background: transparent;
    color: var(--muted);
    border: 1px solid var(--line);
}

.gate button.ghost:hover {
    color: var(--text);
}

/* --- messages ------------------------------------------------------- */

.msg {
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 14px;
    margin-bottom: 16px;
    border: 1px solid transparent;
}

.msg.err {
    background: rgba(248, 113, 113, .12);
    border-color: rgba(248, 113, 113, .35);
    color: #fca5a5;
}

.msg.ok {
    background: rgba(74, 222, 128, .12);
    border-color: rgba(74, 222, 128, .35);
    color: #86efac;
}

.msg.warn {
    background: rgba(251, 191, 36, .12);
    border-color: rgba(251, 191, 36, .35);
    color: #fcd34d;
}

/* --- authenticator setup -------------------------------------------- */

/* White plate for the QR code. */
.qr {
    width: min(240px, 100%);
    margin: 0 auto 16px;
    padding: 4px;
    border-radius: 8px;
    background: #fff;
    line-height: 0;
}

.qr svg {
    display: block;
    width: 100%;
    height: auto;
}

/* The key in groups of four, wrapping between groups. */
.secret {
    text-align: center;
    font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
    font-size: 13px;
    letter-spacing: .05em;
    line-height: 1.8;
    color: var(--muted);
    background: var(--raised);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 8px 6px;
    margin-bottom: 20px;
    user-select: all;
    overflow-wrap: break-word;
    text-indent: .05em;
}

.steps {
    list-style: none;
    counter-reset: s;
    margin: 0 auto 20px;
    width: fit-content;
    max-width: 100%;
    text-align: left;
}

.steps li {
    counter-increment: s;
    position: relative;
    padding-left: 30px;
    margin-bottom: 8px;
    font-size: 14px;
    color: var(--muted);
}

.steps li::before {
    content: counter(s);
    position: absolute;
    left: 0;
    top: 1px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--line);
    color: var(--text);
    font-size: 12px;
    font-weight: 600;
    display: grid;
    place-items: center;
}

/* --- application shell ----------------------------------------------
   Sidebar beside the work area; below 900px a drawer toggled by a checkbox. */

.shell {
    display: grid;
    grid-template-columns: 232px minmax(0, 1fr);
    min-height: 100%;
}

#drawer {
    display: none;
}

.side {
    background: var(--panel);
    border-right: 1px solid var(--line);
    padding: 18px 13px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.side .logo {
    height: 26px;
    width: auto;
    object-fit: contain;
    align-self: flex-start;
    margin: 3px 8px 21px;
}

.side .group {
    font-size: 11px;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--muted);
    margin: 16px 10px 6px;
}

.side a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 8px;
    color: var(--text);
    text-decoration: none;
    font-size: 14px;
    border: 1px solid transparent;
    transition: background 140ms, color 140ms;
}

.side a:hover {
    background: rgba(255, 255, 255, .04);
}

/* The section being viewed. */
.side a.on {
    background: rgba(135, 101, 254, .15);
    border-color: rgba(135, 101, 254, .38);
    color: #fff;
}

.side a svg {
    width: 17px;
    height: 17px;
    flex: none;
    opacity: .8;
}

.side a.on svg {
    opacity: 1;
    color: var(--cyan);
}

/* Quiet button on the sidebar. */
.side .btn.quiet {
    background: rgba(255, 255, 255, .05);
}

.side .btn.quiet:hover {
    background: rgba(255, 255, 255, .09);
}

.side .me {
    margin-top: auto;
    border-top: 1px solid var(--line);
    padding: 14px 10px 3px;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* User avatar on a cyan-to-violet gradient. */
.avatar {
    width: 30px;
    height: 30px;
    flex: none;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, var(--cyan), var(--violet));
    color: #101318;
}

.avatar svg {
    width: 17px;
    height: 17px;
    stroke-width: 2.1;
}

/* The text beside an avatar. */
.me .txt,
td .who .txt {
    min-width: 0;
}

.me .nm {
    font-size: 13px;
    line-height: 1.25;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.me .rl {
    font-size: 11px;
    color: var(--muted);
}

.side .out {
    margin-top: 10px;
}

.side .out .btn {
    width: 100%;
}

.work {
    min-width: 0;
    display: flex;
    flex-direction: column;
}

/* Nothing in the shell may widen the page. */
.top,
main.page {
    min-width: 0;
}

/* --- page header ---------------------------------------------------- */

.top {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 24px;
    border-bottom: 1px solid var(--line);
    background: rgba(39, 43, 47, .86);
    backdrop-filter: blur(8px);
    position: sticky;
    top: 0;
    z-index: 5;
}

.top h1 {
    font-size: 16px;
    margin: 0;
}

.top .spacer {
    flex: 1;
}

.top .count {
    font-size: 12px;
    color: var(--muted);
}

/* Hamburger, for the drawer. */
.burger {
    display: none;
    width: 34px;
    height: 34px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--raised);
    cursor: pointer;
    place-items: center;
    color: var(--text);
}

.burger svg {
    width: 17px;
    height: 17px;
}

main.page {
    padding: 24px;
    flex: 1;
}

/* --- toolbar -------------------------------------------------------- */

.tools {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin-bottom: 18px;
}

/* Search box. */
.search {
    position: relative;
    flex: 0 1 192px;
    min-width: 0;
}

.search svg {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 15px;
    height: 15px;
    color: var(--muted);
    pointer-events: none;
}

/* Inputs inside the shell; their height matches .btn. */
.search input[type=text],
.form input[type=text],
.form input[type=email],
.form input[type=password],
.form input[type=number],
.form select {
    width: 100%;
    text-align: left;
    padding: 8px 12px;
    font-size: 14px;
}

/* Room for the magnifier; must follow the padding shorthand above. */
.search input[type=text] {
    padding-left: 34px;
}

.tools .spacer {
    flex: 1;
}

/* --- buttons in the shell ------------------------------------------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: auto;
    padding: 8px 14px 8px 15px;
    border-radius: 8px;
    border: 1px solid transparent;
    background: var(--violet);
    color: var(--on-violet);
    /* Not the font shorthand: `inherit` is invalid inside it. */
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    line-height: 1;
    letter-spacing: 1px;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
    transition: filter 140ms, border-color 140ms, background 140ms, transform 60ms;
}

.btn:hover {
    filter: brightness(1.06);
}

.btn:active {
    transform: translateY(1px);
}

.btn svg {
    width: 15px;
    height: 15px;
}

.btn.quiet {
    background: var(--raised);
    border-color: var(--line);
    color: var(--text);
}

.btn.quiet:hover {
    border-color: var(--steel);
    filter: none;
}

.btn.danger {
    background: transparent;
    border-color: rgba(248, 113, 113, .45);
    color: #fca5a5;
}

.btn.danger:hover {
    background: rgba(248, 113, 113, .12);
    filter: none;
}

.btn:disabled,
.btn:disabled:hover {
    opacity: .45;
    cursor: not-allowed;
    transform: none;
    filter: none;
}

/* Square 30px button for row actions. */
.icon {
    width: 30px;
    min-width: 30px;
    max-width: 30px;
    height: 30px;
    min-height: 30px;
    padding: 0;
    flex: 0 0 30px;
    letter-spacing: 0;
}

/* --- data table ------------------------------------------------------ */

.frame {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
}

.frame .scroll {
    overflow-x: auto;
}

table.data {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

table.data th {
    background: var(--raised);
    color: var(--muted);
    /* Not the font shorthand: `inherit` is invalid inside it. */
    font-size: 12px;
    font-weight: 600;
    line-height: 1.4;
    letter-spacing: .06em;
    text-transform: uppercase;
    text-align: left;
    padding: 10px 14px;
    border-bottom: 1px solid var(--line);
    white-space: nowrap;
}

table.data th a {
    color: inherit;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

table.data th a:hover {
    color: var(--text);
}

table.data th .dir {
    color: var(--cyan);
}

table.data td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--line);
    vertical-align: middle;
}

table.data tbody tr:last-child td {
    border-bottom: 0;
}

table.data tbody tr:hover {
    background: rgba(255, 255, 255, .025);
}

/* Every column centered except the first; overrides .right and .mid. */
table.data th,
table.data td,
table.data td.right,
table.data th.right,
table.data td.mid,
table.data th.mid {
    text-align: center;
}

table.data th:first-child,
table.data td:first-child {
    text-align: left;
}

td .who {
    display: flex;
    align-items: center;
    gap: 9px;
}

/* The identity block is always two lines tall. */
td .who .txt {
    min-height: 35px;
}

/* Every row the same fixed height, content clipped to it. */
table.data tbody td {
    height: 62px;
    max-height: 62px;
    padding-top: 8px;
    padding-bottom: 8px;
    overflow: hidden;
}

/* The client name, untouched by a row tint. */
td .who .nm {
    color: var(--text);
    font-weight: 500;
    line-height: 18px;
    white-space: nowrap;
}

/* Every line in a data cell. */
table.data tbody td>div {
    line-height: 18px;
}

td .who .un,
table.data tbody td>div.un {
    line-height: 17px;
    white-space: nowrap;
}

td .un {
    color: var(--muted);
    font-size: 13px;
}

td.mono {
    font-family: ui-monospace, Menlo, Consolas, monospace;
    font-size: 13px;
    color: var(--muted);
    white-space: nowrap;
}

/* Row actions: links and buttons in their own forms. */
.rowacts {
    display: flex;
    align-items: center;
    gap: 6px;
    justify-content: center;
}

.rowacts form {
    display: flex;
    align-items: center;
    margin: 0;
}

/* Undoes the sign-in card's button width and margin. */
.rowacts button {
    width: auto;
    margin: 0;
}

/* The amount field when settling an installment. */
.rowacts form.settle {
    gap: 4px;
}

.rowacts form.settle input {
    width: 8ch;
    padding: 4px 6px;
    margin: 0;
    text-align: right;
    font-family: ui-monospace, Menlo, Consolas, monospace;
    font-size: 13px;
    color: var(--text);
    background: var(--raised);
    border: 1px solid var(--line);
    border-radius: var(--radius);
}

.rowacts form.settle input:focus {
    outline: none;
    border-color: var(--cyan);
}

/* Empty list. */
.empty {
    padding: 40px 16px;
    text-align: center;
    color: var(--muted);
    font-size: 14px;
}

.empty svg {
    width: 26px;
    height: 26px;
    display: block;
    margin: 0 auto 10px;
    opacity: .5;
}

/* --- badges ---------------------------------------------------------- */

.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 8px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    border: 1px solid var(--line);
    color: var(--muted);
    white-space: nowrap;
}

.badge.on {
    color: var(--cyan);
    border-color: rgba(132, 250, 250, .4);
    background: rgba(132, 250, 250, .1);
}

.badge.root {
    color: #b9a3ff;
    border-color: rgba(135, 101, 254, .45);
    background: rgba(135, 101, 254, .16);
}

.badge.warn {
    color: var(--warn);
    border-color: rgba(251, 191, 36, .4);
    background: rgba(251, 191, 36, .1);
}

.badge.err {
    color: #fca5a5;
    border-color: rgba(248, 113, 113, .4);
    background: rgba(248, 113, 113, .1);
}

.dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

/* --- forms in the shell ---------------------------------------------- */

.form {
    max-width: 460px;
}

.form .field {
    margin-bottom: 18px;
    text-align: left;
}

.form label {
    font-size: 12px;
    color: var(--text);
    font-weight: 500;
}

/* Select-only properties; padding and font come from the rule above. */
.form select {
    background: var(--raised);
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--text);
    font-family: inherit;
}

.form select:focus {
    outline: none;
    border-color: var(--cyan);
    box-shadow: var(--ring);
}

.hint {
    font-size: 12px;
    color: var(--muted);
    margin-top: 6px;
}

/* A checkbox and its label on one line, the whole row clickable. */
.check {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 11px 13px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--raised);
    cursor: pointer;
}

.check input {
    color: var(--violet);
    width: 16px;
    height: 16px;
    margin-top: 2px;
    flex: none;
}

.check>span {
    min-width: 0;
}

.check .t {
    display: block;
    font-size: 14px;
    font-weight: 500;
}

.check .hint {
    display: block;
    margin-top: 3px;
}

.check:has(input:disabled) {
    opacity: .55;
    cursor: not-allowed;
}

.actions {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-top: 22px;
    padding-top: 19px;
    border-top: 1px solid var(--line);
}

.actions .spacer {
    flex: 1;
}

/* Buttons in an action strip share a minimum width. */
.actions .btn {
    min-width: 132px;
}

/* Except the square ones, which are square. */
.actions .btn.icon {
    min-width: 30px;
}

/* A button's own form. */
.actions form {
    display: flex;
    align-items: center;
    margin: 0;
}

/* --- filter tabs ------------------------------------------------------ */

.filters {
    display: flex;
    gap: 2px;
    padding: 2px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--raised);
    flex: none;
}

.filters a {
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    color: var(--muted);
    text-decoration: none;
    white-space: nowrap;
    transition: background 140ms, color 140ms;
}

.filters a:hover {
    color: var(--text);
}

.filters a.on {
    background: var(--panel);
    color: var(--cyan);
}

/* --- wide form -------------------------------------------------------- */

.form.wide {
    max-width: 760px;
}

.form textarea {
    width: 100%;
    padding: 8px 12px;
    font: inherit;
    font-size: 14px;
    line-height: 1.5;
    color: var(--text);
    background: var(--raised);
    border: 1px solid var(--line);
    border-radius: 8px;
    resize: vertical;
}

.form textarea:focus {
    outline: none;
    border-color: var(--cyan);
    box-shadow: var(--ring);
}

/* Date inputs; the picker icon is inverted. */
.form input[type=date] {
    width: 100%;
    padding: 8px 12px;
    font: inherit;
    font-size: 14px;
    color: var(--text);
    background: var(--raised);
    border: 1px solid var(--line);
    border-radius: 8px;
}

.form input[type=date]:focus {
    outline: none;
    border-color: var(--cyan);
    box-shadow: var(--ring);
}

.form input[type=date]::-webkit-calendar-picker-indicator {
    filter: invert(1);
    opacity: .5;
    cursor: pointer;
}

.form input[type=date]::-webkit-calendar-picker-indicator:hover {
    opacity: .9;
}

/* A heading between groups of fields. */
.section {
    font-size: 12px;
    font-weight: 600;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--muted);
    margin: 29px 0 14px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--line);
}

.form .section:first-child {
    margin-top: 0;
}

/* Fields side by side. */
.row {
    display: flex;
    gap: 14px;
}

.row>.field {
    flex: 1;
    min-width: 0;
}

/* Narrow field, e.g. the postcode. */
.row.narrow>.field:first-child {
    flex: 0 0 120px;
}

/* Number inputs. */
.form input[type=number] {
    background: var(--raised);
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--text);
    font-family: inherit;
    transition: border-color 150ms, box-shadow 150ms;
}

.form input[type=number]:focus {
    outline: none;
    border-color: var(--cyan);
    box-shadow: var(--ring);
}

/* An unframed checkbox under a field. */
.check.plain {
    border: 0;
    background: none;
    padding: 7px 0 0;
    align-items: center;
}

.check.plain .t {
    font-size: 12px;
    color: var(--muted);
    font-weight: 400;
}

.check.plain:hover .t {
    color: var(--text);
}

/* --- read-only record facts ------------------------------------------- */

.facts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(176px, 1fr));
    gap: 13px;
    margin: 0;
    padding: 14px 16px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--raised);
}

.facts dt {
    font-size: 12px;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 4px;
}

.facts dd {
    margin: 0;
    font-size: 13px;
    color: var(--text);
}

.facts dd.mono {
    font-family: ui-monospace, Menlo, Consolas, monospace;
}

/* Key badges in the list. */
.keys {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

/* --- flash message ---------------------------------------------------- */

.flash {
    max-width: 760px;
}

/* --- pagination -------------------------------------------------------- */

.pager {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 11px 14px;
    border-top: 1px solid var(--line);
    font-size: 13px;
    color: var(--muted);
}

.pager .spacer {
    flex: 1;
}

.pager a,
.pager span.here {
    padding: 4px 9px;
    border-radius: 6px;
    border: 1px solid var(--line);
    text-decoration: none;
    color: var(--text);
}

.pager span.here {
    background: rgba(135, 101, 254, .18);
    border-color: rgba(135, 101, 254, .4);
}

.pager a:hover {
    border-color: var(--steel);
}

/* --- dashboard --------------------------------------------------------- */

.cards {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.panel {
    padding: 22px;
}

.panel h2 {
    font-size: 15px;
    margin-bottom: 12px;
}

/* The welcome card. */
.panel.hello h2 {
    font-size: 17px;
    margin-bottom: 6px;
}

.panel .hint {
    margin-bottom: 16px;
}

.panel.hello .hint {
    margin-bottom: 0;
}

/* The clients with a problem, one line each. */
.trouble {
    list-style: none;
    margin: 0 0 16px;
    padding: 0;
    border-top: 1px solid var(--line);
}

.trouble li {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    padding: 9px 0;
    border-bottom: 1px solid var(--line);
    font-size: 13px;
}

.trouble a {
    color: var(--text);
    font-weight: 500;
    text-decoration: none;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.trouble a:hover {
    color: var(--cyan);
}

/* The reasons. */
.trouble .why {
    flex: none;
    color: var(--err);
    font-size: 12px;
}

/* --- attention tiles ----------------------------------------------------
   The color is the urgency; a calm tile goes gray. */

.tiles {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 12px;
    margin-bottom: 24px;
}

.tile {
    display: block;
    padding: 18px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    color: inherit;
    text-decoration: none;
    transition: border-color 140ms cubic-bezier(.22, .61, .36, 1);
}

.tile:hover {
    border-color: var(--steel);
}

.tile .n {
    font-size: 30px;
    font-weight: 600;
    line-height: 1;
}

.tile .l {
    font-size: 13px;
    color: var(--muted);
    margin-top: 8px;
}

.tile.err .n {
    color: var(--err);
}

.tile.warn .n {
    color: var(--warn);
}

.tile.ok .n {
    color: var(--ok);
}

.tile.calm .n {
    color: var(--muted);
}

/* A plain figure, neither warning nor calm. */
.tile.plain .n {
    color: var(--text);
}

/* The license row, three across. */
.tiles.three {
    grid-template-columns: repeat(3, 1fr);
}

@media (max-width: 720px) {
    .tiles.three {
        grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    }
}

/* --- module grid -------------------------------------------------------- */

.modules {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(165px, 1fr));
    gap: 8px 18px;
}

/* --- repeating rows ----------------------------------------------------- */

.repeat {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 14px 16px;
    margin-bottom: 12px;
    background: var(--raised);
}

.repeat .drop {
    margin-top: 10px;
}

/* --- the schedule -------------------------------------------------------
   Installment rows: late ones tinted, settled ones dimmed. */

.data tr.due {
    background: rgba(251, 191, 36, .06);
}

.data tr.overdue {
    background: rgba(248, 113, 113, .08);
}

.data tr.settled {
    color: var(--muted);
}

/* --- the one-time key ---------------------------------------------------
   Not .secret: the sign-in page uses that name. */

.apikey {
    font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
    font-size: 14px;
    line-height: 1.6;
    word-break: break-all;
    user-select: all;
    padding: 12px 14px;
    margin-top: 10px;
    border: 1px dashed var(--cyan);
    border-radius: 8px;
    background: var(--raised);
    color: var(--cyan);
}

/* --- the credential, handed over once ----------------------------------
   The client id and the key, with a copy button beside them. */

.handover {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-top: 10px;
}

/* The two lines, aligned; a long key wraps. */
.handover pre {
    flex: 1;
    margin: 0;
    font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
    font-size: 13px;
    line-height: 1.7;
    white-space: pre-wrap;
    word-break: break-all;
    user-select: all;
    padding: 12px 14px;
    border: 1px dashed var(--cyan);
    border-radius: 8px;
    background: var(--raised);
    color: var(--cyan);
}

/* Fixed width for the changing copy label. */
.handover .btn {
    flex: 0 0 auto;
    min-width: 118px;
}

@media (max-width: 560px) {
    .handover {
        flex-direction: column;
    }

    .handover .btn {
        align-self: stretch;
    }
}


/* --- tight forms -------------------------------------------------------- */

.form.tight .field {
    margin-bottom: 10px;
}

.form.tight .section {
    margin-top: 18px;
    margin-bottom: 8px;
}

.form.tight .section:first-child {
    margin-top: 0;
}

.form.tight textarea {
    margin-bottom: 0;
}

/* Rows of fields. */
.form.tight .row {
    flex-wrap: wrap;
}

/* Growing and shrinking fields. */
.row>.field.grow {
    flex: 2;
}

.row>.field.narrow {
    flex: 0 0 110px;
}

.row>.field.shrink {
    flex: 0 0 auto;
}

/* A checkbox in a row of inputs, under an empty label. */
.form.tight .field.shrink .check {
    align-items: center;
    padding-top: 9px;
    padding-bottom: 9px;
}

/* Its field. */
.form.tight .field.shrink {
    align-self: flex-start;
}

/* --- the contacts grid -------------------------------------------------- */

.grid {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 4px;
}

.grid th {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--muted);
    text-align: left;
    padding: 0 6px 6px;
}

.grid td {
    padding: 0 3px 6px;
}

.grid td:first-child,
.grid th:first-child {
    padding-left: 0;
}

.grid td:last-child,
.grid th:last-child {
    padding-right: 0;
}

/* Inputs inside the grid. */
.grid input[type=text],
.grid input[type=email] {
    width: 100%;
    text-align: left;
    padding: 7px 9px;
    font-size: 13px;
}

/* The radio and checkbox columns. */
.grid .tick {
    width: 28px;
    text-align: center;
    vertical-align: middle;
}

/* Their single-character headings. */
.grid th.tick {
    font-size: 13px;
    color: var(--text);
    letter-spacing: 0;
    text-align: center;
}

.grid input[type=radio],
.grid input[type=checkbox] {
    accent-color: var(--violet);
    cursor: pointer;
}

/* --- centered actions ---------------------------------------------------- */

.actions.center {
    justify-content: center;
}

/* --- fields no password manager may touch -------------------------------
   The nofill animation lets script.js detect an autofill. */

@keyframes nofill {
    from {
        opacity: 1;
    }

    to {
        opacity: 1;
    }
}

input[data-nofill]:-webkit-autofill {
    animation-name: nofill;
    animation-duration: 1ms;
}

/* Readonly until clicked, so it must not look disabled. */
input[data-nofill][readonly] {
    cursor: text;
    opacity: 1;
}

/* --- narrow screens ---------------------------------------------------- */

@media (max-width: 900px) {
    .shell {
        grid-template-columns: minmax(0, 1fr);
    }

    .side {
        position: fixed;
        z-index: 20;
        left: 0;
        top: 0;
        width: 232px;
        transform: translateX(-100%);
        transition: transform 200ms ease;
    }

    #drawer:checked~.shell .side {
        transform: none;
    }

    /* Tapping the page outside the open drawer closes it. */
    #drawer:checked~.shell .work::before {
        content: "";
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, .5);
        z-index: 15;
    }

    .burger {
        display: grid;
    }

    .top {
        padding: 13px 18px;
    }

    main.page {
        padding: 18px;
    }

    /* Paired fields stack rather than squeeze. */
    .row {
        flex-wrap: wrap;
    }

    .row>.field {
        flex: 1 1 100%;
    }

    .row.narrow>.field:first-child {
        flex: 0 0 120px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .side {
        transition: none;
    }
}

@keyframes in {
    from {
        opacity: 0;
        transform: translateY(6px);
    }

    to {
        opacity: 1;
        transform: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .card {
        animation: none;
    }
}

/* Nothing is underlined. */
a {
    color: var(--cyan);
    text-decoration: none;
}

a:hover {
    filter: brightness(1.15);
}

/* Tables scroll inside their own box, never the page. */
.scroll {
    overflow-x: auto;
}

/* --- a module that comes with every contract ----------------------------
   Disabled but not faded. */
.modules .check.plain:has(input:disabled) {
    opacity: 1;
    cursor: default;
}

/* Every module in the grid reads the same. */
.modules .check.plain .t {
    font-size: 14px;
    color: var(--text);
}

.modules .check.plain {
    padding: 0;
}

.modules .check.plain input {
    margin-top: 0;
}

.modules .check.plain input:disabled {
    accent-color: var(--violet);
    cursor: default;
}

/* --- a fact standing where a field would ---------------------------------
   The fixed client on a saved contract. */

.form .fixed {
    padding: 4px 0;
    font-size: 13px;
    line-height: 1.35;
}

.form .fixed .un {
    color: var(--muted);
    font-size: 12px;
}

/* --- the module catalog ----------------------------------------------- */

.catalog input[type=text] {
    width: 100%;
    padding: 6px 9px;
    background: var(--raised);
    border: 1px solid var(--line);
    border-radius: 6px;
    color: var(--text);
    font-family: inherit;
    font-size: 13px;
}

.catalog select {
    width: 100%;
    padding: 6px 9px;
    background: var(--raised);
    border: 1px solid var(--line);
    border-radius: 6px;
    color: var(--text);
    font-family: inherit;
    font-size: 13px;
}

.catalog input[type=text]:focus,
.catalog select:focus {
    outline: none;
    border-color: var(--cyan);
    box-shadow: var(--ring);
}

/* The token, monospace. */
.catalog input.mono {
    font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
    font-size: 12px;
}

/* The empty row for a new module. */
.catalog tr.fresh td {
    border-top: 1px dashed var(--line);
}

.catalog tr.fresh input::placeholder {
    color: var(--muted);
    opacity: .7;
}

/* The checkbox columns. */
.catalog .tick {
    width: 64px;
    text-align: center;
}

.catalog input[type=checkbox] {
    accent-color: var(--violet);
    width: 16px;
    height: 16px;
    cursor: pointer;
}
/* --- the daily support password ----------------------------------------- */

.daily {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.daily .mono {
    user-select: all;
    font-size: 14px;
    color: var(--cyan);
}

/* The label beside it. */
.panel .daily {
    margin-top: 14px;
    font-size: 12px;
    color: var(--muted);
}

/* Its icon button. */
.daily .btn.icon {
    padding: 6px;
}

/* The caption above the QR code. */
.scan {
    text-align: center;
    font-size: 13px;
    letter-spacing: .04em;
    color: var(--muted);
    margin: 24px 0 14px;
}
