/* ============================================================
   Admin panel (/admin). Built on the account page's cards and rail
   (css/account.css) and its tokens, so it reads as part of Settings.
   ============================================================ */

/*
 * The panel, the password screen or the not-found screen, decided before
 * the first paint from what this browser remembers (the inline script in
 * the page's head) and corrected when /api/admin/me answers.
 */
html:not(.adm-yes) #adm-app { display: none; }
html.adm-yes #adm-404,
html.adm-lock #adm-404 { display: none; }
#adm-lock { display: none; }
html.adm-lock:not(.adm-yes) #adm-lock { display: grid; }

/* ── The password screen ────────────────────────────────────────────── */

.adm-lock-card {
    width: min(460px, 100%);
}

.adm-lock-card .ac-card-inner {
    padding: 36px 34px 30px;
}

.adm-lock-mark {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 52px;
    margin: 0 auto 14px;
    border: 2px solid var(--pr-accent);
    border-radius: 10px;
    background: color-mix(in srgb, var(--pr-accent) 14%, transparent);
    color: var(--pr-ink);
}

.adm-lock-card .adm-label {
    margin-bottom: 4px;
}

.adm-lock-card .nf-title {
    margin-top: 0;
}

.adm-lock-card .nf-text {
    margin-bottom: 22px;
}

.adm-lock-form {
    text-align: left;
}

.adm-lock-row {
    display: flex;
    gap: 10px;
}

.adm-lock-row .ac-input {
    flex: 1 1 auto;
    min-width: 0;
}

.adm-lock-row .pr-btn {
    flex: 0 0 auto;
    min-width: 96px;
}

/* One line kept for the message, so the card never changes height. */
.adm-lock-msg {
    min-height: 1.4em;
    margin-top: 10px;
    line-height: 1.4;
}

@media (max-width: 420px) {
    .adm-lock-card .ac-card-inner {
        padding: 30px 20px 24px;
    }
}

.adm-wrap {
    padding-top: 110px;
    padding-bottom: 60px;
}

.adm-rail-id {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 4px 4px 16px;
    margin-bottom: 8px;
    border-bottom: 1px solid var(--pr-line);
}

.adm-shield {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: linear-gradient(140deg, #6b5fc7, #3b82f6);
    color: #fff;
    flex: 0 0 auto;
}

.adm-rail-title {
    margin: 0;
    font-family: var(--font-display, 'Khand', sans-serif);
    font-size: 1.35rem;
    line-height: 1.1;
    color: var(--pr-ink);
}

.adm-rail-role {
    margin: 2px 0 0;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--pr-muted);
}

.adm-rail-role.is-owner {
    color: #f5b942;
}

.adm-label {
    margin: 0 0 8px;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--pr-faint);
}

.adm-hint {
    margin: 0 0 12px;
    color: var(--pr-muted);
    font-size: 0.86rem;
    line-height: 1.55;
}

.adm-empty {
    margin: 10px 0 0;
    color: var(--pr-muted);
    font-size: 0.88rem;
    list-style: none;
}

/* ── Overview ───────────────────────────────────────────────── */

.adm-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
    margin-bottom: 22px;
}

.adm-stat {
    display: grid;
    gap: 2px;
    padding: 14px 14px 12px;
    border: 1px solid var(--pr-line);
    border-radius: 12px;
    background: var(--pr-current-bg);
}

.adm-stat strong {
    font-family: var(--font-display, 'Khand', sans-serif);
    font-size: 1.7rem;
    line-height: 1;
    color: var(--pr-ink);
}

.adm-stat-k {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--pr-ink);
}

.adm-stat-sub {
    font-size: 0.74rem;
    color: var(--pr-faint);
}

.adm-privs {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 8px;
}

.adm-priv {
    display: grid;
    gap: 2px;
    padding: 10px 12px 10px 14px;
    border-left: 3px solid var(--pr-accent);
    border-radius: 0 10px 10px 0;
    background: var(--pr-current-bg);
    font-size: 0.86rem;
    color: var(--pr-muted);
}

.adm-priv strong {
    color: var(--pr-ink);
    font-size: 0.92rem;
}

.adm-priv--owner {
    border-left-color: #f5b942;
}

/* ── Lists of accounts ──────────────────────────────────────── */

.adm-search {
    position: relative;
    display: block;
    margin-bottom: 12px;
}

.adm-search svg {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--pr-faint);
    pointer-events: none;
}

.adm-search .ac-input {
    padding-left: 36px;
}

.adm-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 6px;
}

.adm-row {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--pr-line);
    border-radius: 10px;
    background: transparent;
    color: var(--pr-ink);
    text-align: left;
    font: inherit;
    cursor: pointer;
    transition: border-color .15s ease, background .15s ease;
}

.adm-row:hover,
.adm-row:focus-visible {
    border-color: var(--pr-line-strong);
    background: var(--pr-current-bg);
    outline: none;
}

.adm-av {
    flex: 0 0 auto;
    border-radius: 50%;
    object-fit: cover;
    background: var(--pr-current-bg);
}

.adm-row-copy {
    display: grid;
    gap: 2px;
    min-width: 0;
    flex: 1 1 auto;
}

.adm-row-name {
    font-weight: 600;
    font-size: 0.92rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.adm-row-sub {
    font-size: 0.78rem;
    color: var(--pr-faint);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.adm-row-privs {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.adm-row-go {
    flex: 0 0 auto;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--pr-accent);
}

.adm-chips {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 5px;
    flex: 0 0 auto;
}

.adm-chip,
.adm-tag {
    display: inline-block;
    padding: 2px 8px;
    border: 1px solid var(--pr-line-strong);
    border-radius: 999px;
    font-size: 0.66rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    color: var(--pr-muted);
    white-space: nowrap;
}

.adm-tag {
    letter-spacing: 0;
    font-weight: 600;
    font-size: 0.72rem;
}

.adm-chip--owner,
.adm-tag--owner {
    border-color: rgba(245, 185, 66, 0.55);
    color: #f5b942;
}

.adm-chip--admin {
    border-color: color-mix(in srgb, var(--pr-accent) 55%, transparent);
    color: var(--pr-accent);
}

/* ── Activity ───────────────────────────────────────────────── */

.adm-log {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
}

.adm-log-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 2px 12px;
    padding: 10px 0;
    border-top: 1px solid var(--pr-line);
    font-size: 0.88rem;
    color: var(--pr-muted);
}

.adm-log-row:first-child {
    border-top: 0;
}

.adm-log-line strong {
    color: var(--pr-ink);
}

.adm-log-more {
    grid-column: 1;
    font-size: 0.8rem;
    color: var(--pr-faint);
}

.adm-log-at {
    grid-column: 2;
    grid-row: 1;
    font-size: 0.78rem;
    color: var(--pr-faint);
    white-space: nowrap;
}

/* ── One account, in a sheet ────────────────────────────────── */

.adm-sheet {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: grid;
    place-items: center;
    padding: 90px 16px 24px;
    background: rgba(5, 6, 16, 0.62);
    backdrop-filter: blur(3px);
}

.adm-sheet[hidden] {
    display: none;
}

.adm-sheet-box {
    position: relative;
    width: min(640px, 100%);
    max-height: calc(100vh - 120px);
    overflow-y: auto;
    padding: 26px 26px 22px;
    border: 1px solid var(--pr-line-strong);
    border-radius: 16px;
    background: var(--pr-surface);
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
    outline: none;
}

.adm-sheet-close {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 30px;
    height: 30px;
    border: 1px solid var(--pr-line-strong);
    border-radius: 50%;
    background: transparent;
    color: var(--pr-muted);
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
}

.adm-sheet-close:hover {
    color: var(--pr-ink);
    border-color: var(--pr-accent);
}

.adm-acct-head {
    display: flex;
    align-items: center;
    gap: 14px;
    padding-right: 36px;
    margin-bottom: 16px;
}

.adm-acct-id {
    display: grid;
    gap: 4px;
    min-width: 0;
    flex: 1 1 auto;
}

.adm-acct-name {
    margin: 0;
    font-family: var(--font-display, 'Khand', sans-serif);
    font-size: 1.6rem;
    line-height: 1;
    color: var(--pr-ink);
    overflow-wrap: anywhere;
}

.adm-acct-sub {
    margin: 0;
    color: var(--pr-muted);
    font-size: 0.88rem;
}

.adm-acct-view {
    flex: 0 0 auto;
    padding: 7px 14px;
    font-size: 0.82rem;
}

.adm-facts {
    display: grid;
    grid-template-columns: max-content minmax(0, 1fr);
    gap: 6px 16px;
    margin: 0 0 18px;
    padding: 14px 16px;
    border: 1px solid var(--pr-line);
    border-radius: 12px;
    font-size: 0.87rem;
}

.adm-facts dt {
    color: var(--pr-faint);
    font-weight: 600;
}

.adm-facts dd {
    margin: 0;
    color: var(--pr-ink);
    overflow-wrap: anywhere;
}

.adm-block {
    padding-top: 16px;
    margin-top: 16px;
    border-top: 1px solid var(--pr-line);
}

.adm-block--danger .adm-label {
    color: var(--pr-error);
}

.adm-checks {
    list-style: none;
    margin: 0 0 12px;
    padding: 0;
    display: grid;
    gap: 6px;
}

.adm-check {
    position: relative;
    display: grid;
    grid-template-columns: 22px minmax(0, 1fr);
    gap: 12px;
    align-items: start;
    padding: 10px 12px;
    border: 1px solid var(--pr-line);
    border-radius: 10px;
    cursor: pointer;
    transition: border-color .15s ease, background .15s ease;
}

.adm-check:hover {
    border-color: var(--pr-line-strong);
}

.adm-check input {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
}

.adm-check-box {
    width: 22px;
    height: 22px;
    margin-top: 1px;
    border: 1.5px solid var(--pr-line-strong);
    border-radius: 6px;
    background: transparent;
    transition: background .15s ease, border-color .15s ease;
}

.adm-check input:checked + .adm-check-box {
    border-color: var(--pr-accent);
    background: var(--pr-accent) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4 8.4l2.6 2.6L12 5.4' fill='none' stroke='%230a0a19' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 16px no-repeat;
}

.adm-check input:focus-visible + .adm-check-box {
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--pr-accent) 35%, transparent);
}

.adm-check:has(input:checked) {
    border-color: color-mix(in srgb, var(--pr-accent) 50%, transparent);
    background: color-mix(in srgb, var(--pr-accent) 6%, transparent);
}

.adm-check:has(input:disabled) {
    cursor: default;
    opacity: 0.85;
}

.adm-check-copy {
    display: grid;
    gap: 2px;
    font-size: 0.82rem;
    color: var(--pr-muted);
}

.adm-check-copy strong {
    color: var(--pr-ink);
    font-size: 0.9rem;
}

.adm-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.adm-actions .ac-input {
    width: auto;
    flex: 1 1 160px;
}

.adm-credit .ac-input:first-of-type {
    flex: 0 1 110px;
}

.adm-dollar {
    color: var(--pr-muted);
    font-weight: 600;
}

.adm-msg {
    display: block;
    margin-top: 8px;
    font-size: 0.84rem;
    color: var(--pr-muted);
}

.adm-actions .adm-msg {
    display: inline;
    margin: 0 0 0 4px;
}

.adm-msg.is-ok { color: #22c55e; }
.adm-msg.is-error { color: var(--pr-error); }

.pr-btn.adm-danger {
    border-color: color-mix(in srgb, var(--pr-error) 60%, transparent);
    color: var(--pr-error);
}

.pr-btn.adm-danger:not(:disabled):hover {
    background: var(--pr-error);
    color: #fff;
}

.pr-btn.adm-danger:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

@media (max-width: 639.98px) {
    .adm-sheet-box {
        padding: 22px 16px 18px;
    }

    .adm-acct-head {
        flex-wrap: wrap;
    }

    .adm-row .adm-chips {
        display: none;
    }
}

/* ── Bans, editing, clearing ────────────────────────────────── */

.adm-chip--banned {
    border-color: color-mix(in srgb, var(--pr-error) 60%, transparent);
    color: var(--pr-error);
}

.adm-banned {
    display: grid;
    gap: 3px;
    margin-bottom: 14px;
    padding: 12px 14px;
    border: 1px solid color-mix(in srgb, var(--pr-error) 50%, transparent);
    border-radius: 12px;
    background: color-mix(in srgb, var(--pr-error) 8%, transparent);
    font-size: 0.85rem;
    color: var(--pr-muted);
}

.adm-banned strong {
    color: var(--pr-error);
    font-size: 0.92rem;
}

.adm-banned-note {
    margin-top: 4px;
    color: var(--pr-ink);
    white-space: pre-wrap;
}

.adm-note {
    margin-top: 16px;
    padding: 10px 12px;
    border-radius: 10px;
    background: var(--pr-current-bg);
}

.adm-select {
    width: auto;
    flex: 0 1 180px;
}

.adm-actions .adm-days {
    flex: 0 1 100px;
}

.adm-days[hidden] {
    display: none;
}

.adm-note-input {
    display: block;
    width: 100%;
    margin: 8px 0;
    resize: vertical;
}

.adm-form {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px 12px;
    margin-bottom: 12px;
}

.adm-field {
    display: grid;
    gap: 4px;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--pr-faint);
    min-width: 0;
}

.adm-field.is-wide {
    grid-column: 1 / -1;
}

.adm-field textarea {
    resize: vertical;
}

.adm-field--check {
    display: flex;
    align-items: center;
    gap: 8px;
    align-self: end;
    padding-bottom: 10px;
    color: var(--pr-ink);
    font-weight: 500;
    font-size: 0.86rem;
    cursor: pointer;
}

.adm-field--check input {
    width: 16px;
    height: 16px;
    accent-color: var(--pr-accent);
}

@media (max-width: 639.98px) {
    .adm-form {
        grid-template-columns: minmax(0, 1fr);
    }
}

/* Dropdowns: the open list is drawn by the browser, so it gets the theme's
   own colours and colour scheme, not transparent-over-white. */
.adm-sheet select.ac-input {
    background-color: var(--pr-surface);
    color: var(--pr-ink);
    color-scheme: dark;
}

html[data-theme="light"] .adm-sheet select.ac-input {
    color-scheme: light;
}

.adm-sheet select.ac-input option {
    background-color: var(--pr-surface);
    color: var(--pr-ink);
}

/* The sheet's frame stays still and only its contents scroll, so the close
   button is always in the top right corner. */
.adm-sheet-box {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 0;
}

#adm-sheet-body {
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 26px 26px 22px;
    scrollbar-width: thin;
    scrollbar-color: var(--pr-line-strong) transparent;
}

.adm-sheet-close {
    z-index: 3;
    background: var(--pr-surface);
}

@media (max-width: 639.98px) {
    .adm-sheet-box {
        padding: 0;
    }

    #adm-sheet-body {
        padding: 22px 16px 18px;
    }
}

/* Your privileges: a plain list. A tick, the name, one quiet line under it,
   hairlines between. No stripes, no tinted cards. */
.adm-privs {
    gap: 0;
    border: 1px solid var(--pr-line);
    border-radius: 12px;
    overflow: hidden;
}

.adm-priv {
    position: relative;
    gap: 2px;
    padding: 12px 16px 12px 44px;
    border-left: 0;
    border-radius: 0;
    background: transparent;
    font-size: 0.84rem;
}

.adm-priv + .adm-priv {
    border-top: 1px solid var(--pr-line);
}

.adm-priv::before {
    content: '';
    position: absolute;
    left: 16px;
    top: 14px;
    width: 16px;
    height: 16px;
    background: var(--pr-muted);
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3.5 8.4l2.9 2.9 6.1-6.3' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 16px no-repeat;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3.5 8.4l2.9 2.9 6.1-6.3' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 16px no-repeat;
}

.adm-priv strong {
    font-size: 0.9rem;
    font-weight: 600;
}

/* The owner line reads as a heading for the rest, not as another stripe. */
.adm-priv--owner {
    background: var(--pr-current-bg);
}

.adm-priv--owner::before {
    background: var(--pr-ink);
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 3l7.5 3v5.5c0 4.6-3.2 8.3-7.5 9.5-4.3-1.2-7.5-4.9-7.5-9.5V6z' fill='none' stroke='black' stroke-width='2' stroke-linejoin='round'/%3E%3C/svg%3E") center / 16px no-repeat;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 3l7.5 3v5.5c0 4.6-3.2 8.3-7.5 9.5-4.3-1.2-7.5-4.9-7.5-9.5V6z' fill='none' stroke='black' stroke-width='2' stroke-linejoin='round'/%3E%3C/svg%3E") center / 16px no-repeat;
}


/* ── Statistic charts (js/admin-chart.js) ───────────────────── */

.adm-stat {
    position: relative;
}

.adm-stat-chart {
    position: absolute;
    top: 10px;
    right: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    padding: 0;
    border: 1px solid transparent;
    border-radius: 8px;
    background: transparent;
    color: var(--pr-faint);
    cursor: pointer;
    transition: color .15s ease, border-color .15s ease, background .15s ease;
}

.adm-stat-chart:hover,
.adm-stat-chart:focus-visible {
    color: var(--pr-ink);
    border-color: var(--pr-line-strong);
    background: var(--pr-surface);
    outline: none;
}

.adm-chart-box {
    --adm-chart: #3d8fe8;
    width: min(820px, 100%);
}

html[data-theme="light"] .adm-chart-box {
    --adm-chart: #2563eb;
}

.adm-chart-body {
    overflow-y: auto;
    padding: 24px 26px 22px;
}

.adm-chart-title {
    margin: 0 0 14px;
    font-family: var(--font-display, 'Khand', sans-serif);
    font-size: 1.7rem;
    line-height: 1;
    color: var(--pr-ink);
}

.adm-chart-controls {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 18px;
}

.adm-seg {
    display: inline-flex;
    padding: 3px;
    border: 1px solid var(--pr-line);
    border-radius: 10px;
    gap: 2px;
}

.adm-seg[hidden] {
    display: none;
}

.adm-seg-btn {
    padding: 5px 12px;
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: var(--pr-muted);
    font: inherit;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s ease, color .15s ease;
}

.adm-seg-btn:hover {
    color: var(--pr-ink);
}

.adm-seg-btn[aria-pressed="true"] {
    background: var(--pr-current-bg);
    color: var(--pr-ink);
    box-shadow: inset 0 0 0 1px var(--pr-line-strong);
}

.adm-chart-hero {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 10px;
    margin: 0 0 8px;
    color: var(--pr-muted);
    font-size: 0.86rem;
}

.adm-chart-hero strong {
    font-family: var(--font-display, 'Khand', sans-serif);
    font-size: 2.2rem;
    line-height: 1;
    color: var(--pr-ink);
    font-weight: 600;
}

.adm-chart-plot {
    position: relative;
    margin: 0 -4px;
    border-radius: 10px;
    outline: none;
    transition: opacity .15s ease;
}

.adm-chart-plot:focus-visible {
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--adm-chart) 45%, transparent);
}

.adm-chart-plot.is-loading {
    opacity: 0.45;
}

.adm-chart-plot svg {
    display: block;
    width: 100%;
    height: auto;
    overflow: visible;
    touch-action: pan-y;
}

.adm-ch-grid {
    stroke: var(--pr-line);
    stroke-width: 1;
}

.adm-ch-base {
    stroke: var(--pr-line-strong);
    stroke-width: 1;
}

.adm-ch-tick {
    fill: var(--pr-faint);
    font-family: var(--font-body, 'Inter', sans-serif);
    font-size: 11px;
    font-variant-numeric: tabular-nums;
}

.adm-ch-line {
    fill: none;
    stroke: var(--adm-chart);
    stroke-width: 2;
    stroke-linejoin: round;
    stroke-linecap: round;
}

.adm-ch-area {
    fill: var(--adm-chart);
    opacity: 0.1;
}

.adm-ch-dot,
.adm-ch-hot {
    fill: var(--adm-chart);
    stroke: var(--pr-surface);
    stroke-width: 2;
}

.adm-ch-bar {
    fill: var(--adm-chart);
    transition: opacity .12s ease;
}

.adm-ch-bar.is-dim {
    opacity: 0.4;
}

.adm-ch-cross {
    stroke: var(--pr-muted);
    stroke-width: 1;
    stroke-dasharray: 3 3;
    pointer-events: none;
}

.adm-chart-tip {
    position: absolute;
    display: grid;
    gap: 1px;
    padding: 7px 10px;
    border: 1px solid var(--pr-line-strong);
    border-radius: 8px;
    background: var(--pr-surface);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
    pointer-events: none;
    white-space: nowrap;
    z-index: 2;
}

.adm-chart-tip[hidden] {
    display: none;
}

.adm-tip-k {
    color: var(--pr-muted);
    font-size: 0.74rem;
}

.adm-chart-tip strong {
    color: var(--pr-ink);
    font-size: 0.95rem;
    font-variant-numeric: tabular-nums;
}

.adm-tip-sub {
    color: var(--pr-faint);
    font-size: 0.72rem;
}

.adm-chart-foot {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-top: 10px;
}

.adm-chart-note {
    margin: 0;
    color: var(--pr-faint);
    font-size: 0.78rem;
    line-height: 1.5;
}

.adm-chart-table-btn {
    flex: 0 0 auto;
    font-size: 0.8rem;
}

.adm-chart-table {
    margin-top: 12px;
    max-height: 260px;
    overflow-y: auto;
    border: 1px solid var(--pr-line);
    border-radius: 10px;
}

.adm-chart-table[hidden] {
    display: none;
}

.adm-chart-table table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.84rem;
}

.adm-chart-table th,
.adm-chart-table td {
    padding: 7px 12px;
    text-align: left;
    border-bottom: 1px solid var(--pr-line);
    font-variant-numeric: tabular-nums;
}

.adm-chart-table th {
    position: sticky;
    top: 0;
    background: var(--pr-surface);
    color: var(--pr-faint);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.adm-chart-table td {
    color: var(--pr-ink);
}

.adm-chart-table th:not(:first-child),
.adm-chart-table td:not(:first-child) {
    text-align: right;
}

.adm-chart-table tr:last-child td {
    border-bottom: 0;
}

@media (max-width: 639.98px) {
    .adm-chart-body {
        padding: 22px 16px 18px;
    }

    .adm-chart-foot {
        flex-direction: column;
    }
}

/* Five tiles on one row on a desktop; the chart icon a touch clearer. */
.adm-stats {
    grid-template-columns: repeat(auto-fit, minmax(128px, 1fr));
}

.adm-stat-chart {
    color: var(--pr-muted);
}

.adm-ch-bar.is-dim {
    opacity: 0.6;
}

/* ── Applications ───────────────────────────────────────────── */

.apl-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 12px;
}

.apl-tab {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 6px 11px;
    border: 1px solid var(--pr-line);
    border-radius: 999px;
    background: transparent;
    color: var(--pr-muted);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
}

.apl-tab:hover { color: var(--pr-ink); border-color: var(--pr-line-strong); }

.apl-tab[aria-pressed="true"] {
    color: var(--pr-ink);
    border-color: var(--pr-accent);
    background: var(--pr-current-bg);
}

.apl-tab-n {
    font-variant-numeric: tabular-nums;
    font-size: 0.74rem;
    color: var(--pr-faint);
}

.apl-tools {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 14px;
}

.apl-search { flex: 1 1 auto; margin: 0; min-width: 0; }

select.ac-input.apl-select {
    flex: 0 0 auto;
    width: auto;
    padding-right: 34px;
    background-color: var(--pr-surface);
    color: var(--pr-ink);
    color-scheme: dark;
}

html[data-theme="light"] .apl-select { color-scheme: light; }
.apl-select option { background-color: var(--pr-surface); color: var(--pr-ink); }

.apl-filter-star,
.apl-star {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    border: 1px solid var(--pr-line);
    background: transparent;
    color: var(--pr-faint);
    cursor: pointer;
}

.apl-filter-star { width: 38px; height: 38px; border-radius: 10px; }
.apl-filter-star[aria-pressed="true"] { color: #e8b04a; border-color: #e8b04a; }

.apl-star { width: 30px; height: 30px; border: 0; border-radius: 8px; }
.apl-star:hover { color: var(--pr-ink); background: var(--pr-current-bg); }
.apl-star.is-on { color: #e8b04a; }
.apl-star--big { width: 38px; height: 38px; border: 1px solid var(--pr-line); }

.apl-list {
    list-style: none;
    margin: 0;
    padding: 0;
    border: 1px solid var(--pr-line);
    border-radius: 12px;
    overflow: hidden;
    transition: opacity 0.15s;
}

.apl-list:empty { display: none; }
.apl-list.is-loading { opacity: 0.55; }

.apl-row {
    display: flex;
    align-items: center;
    gap: 4px;
    padding-left: 8px;
}

.apl-row + .apl-row { border-top: 1px solid var(--pr-line); }

.apl-open {
    display: grid;
    grid-template-columns: minmax(0, 1.5fr) minmax(0, 1.1fr) auto 104px;
    align-items: center;
    gap: 14px;
    flex: 1 1 auto;
    min-width: 0;
    padding: 12px 16px 12px 6px;
    border: 0;
    background: transparent;
    color: var(--pr-ink);
    text-align: left;
    cursor: pointer;
}

.apl-row:hover { background: var(--pr-current-bg); }

.apl-who { display: grid; min-width: 0; }

.apl-name {
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.apl-row.is-new .apl-name::after {
    content: "";
    display: inline-block;
    width: 7px;
    height: 7px;
    margin-left: 8px;
    border-radius: 50%;
    background: var(--pr-accent);
    vertical-align: middle;
}

.apl-email,
.apl-when {
    font-size: 0.78rem;
    color: var(--pr-faint);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.apl-pos {
    font-size: 0.86rem;
    color: var(--pr-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.apl-meta {
    display: grid;
    justify-items: end;
    gap: 4px;
}

.apl-rating { display: inline-flex; gap: 3px; }

.apl-rating-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--pr-line-strong);
}

.apl-rating-dot.is-on { background: #e8b04a; }

/* Status: a small dot and a word, the same in the list and the sheet. */
.apl-status {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    justify-self: start;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--pr-muted);
    white-space: nowrap;
}

.apl-dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.apl-status--new .apl-dot { background: #3d8fe8; }
.apl-status--reviewing .apl-dot { background: #9a8cf0; }
.apl-status--interview .apl-dot { background: #e8b04a; }
.apl-status--offer .apl-dot { background: #3bb8a8; }
.apl-status--hired .apl-dot { background: #3fb86b; }
.apl-status--rejected .apl-dot { background: var(--pr-faint); }
.apl-status--rejected { color: var(--pr-faint); }

html[data-theme="light"] .apl-status--new .apl-dot { background: #2563eb; }

/* ── One application, in a sheet ── */

.apl-sheet-box { width: min(760px, 100%); }

.apl-sheet-body {
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 26px 26px 22px;
    scrollbar-width: thin;
    scrollbar-color: var(--pr-line-strong) transparent;
}

.apl-head {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding-right: 40px;
    margin-bottom: 18px;
}

.apl-head-copy { flex: 1 1 auto; min-width: 0; }
.apl-head-copy .adm-label { margin-bottom: 4px; }

.apl-head-name {
    margin: 0;
    font-family: var(--font-display, "Khand", sans-serif);
    font-size: 1.75rem;
    line-height: 1.05;
    color: var(--pr-ink);
    overflow-wrap: anywhere;
}

.apl-head-sub { margin: 4px 0 0; font-size: 0.85rem; color: var(--pr-muted); }

.apl-stage {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 0 0 16px;
    margin-bottom: 18px;
    border-bottom: 1px solid var(--pr-line);
}

.apl-steps {
    display: inline-flex;
    flex-wrap: wrap;
    border: 1px solid var(--pr-line);
    border-radius: 10px;
    overflow: hidden;
}

.apl-step {
    padding: 7px 12px;
    border: 0;
    background: transparent;
    color: var(--pr-muted);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
}

.apl-step + .apl-step { border-left: 1px solid var(--pr-line); }
.apl-step:hover { color: var(--pr-ink); }

.apl-step[aria-pressed="true"] {
    background: var(--pr-current-bg);
    color: var(--pr-ink);
    box-shadow: inset 0 -2px 0 var(--pr-accent);
}

.apl-rate { display: inline-flex; align-items: center; gap: 2px; }
.apl-rate-k { margin-right: 6px; font-size: 0.78rem; color: var(--pr-faint); font-weight: 600; }

.apl-rate-btn {
    display: inline-flex;
    padding: 3px;
    border: 0;
    background: transparent;
    color: var(--pr-line-strong);
    cursor: pointer;
}

.apl-rate-btn svg { width: 18px; height: 18px; }
.apl-rate-btn.is-on { color: #e8b04a; }
.apl-rate-btn:hover { color: #e8b04a; }

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

.apl-block.is-wide { grid-column: 1 / -1; }

.apl-kv {
    display: grid;
    grid-template-columns: minmax(7em, 0.8fr) minmax(0, 1.2fr);
    gap: 10px;
    padding: 5px 0;
    font-size: 0.87rem;
}

.apl-k { color: var(--pr-faint); }
.apl-v { color: var(--pr-ink); overflow-wrap: anywhere; }
.apl-link { color: var(--pr-accent); text-decoration: none; }
.apl-link:hover { text-decoration: underline; }

.apl-resume {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border: 1px solid var(--pr-line);
    border-radius: 12px;
    color: var(--pr-ink);
    text-decoration: none;
}

.apl-resume:hover { border-color: var(--pr-accent); color: var(--pr-ink); }
.apl-resume svg { flex: 0 0 auto; color: var(--pr-accent); }
.apl-resume-copy { display: grid; min-width: 0; font-size: 0.87rem; }
.apl-resume-copy strong { font-weight: 600; overflow-wrap: anywhere; }
.apl-resume-copy span { font-size: 0.78rem; color: var(--pr-faint); }

.apl-comment {
    margin: 0;
    color: var(--pr-ink);
    font-size: 0.9rem;
    line-height: 1.6;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.apl-comment.is-empty { color: var(--pr-faint); }

.apl-others { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }

.apl-other {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 14px;
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--pr-line);
    border-radius: 10px;
    background: transparent;
    color: var(--pr-ink);
    font-size: 0.86rem;
    text-align: left;
    cursor: pointer;
}

.apl-other:hover { border-color: var(--pr-line-strong); }

.apl-notes { padding-top: 18px; border-top: 1px solid var(--pr-line); }

.apl-note-form { display: flex; gap: 8px; align-items: flex-end; }
.apl-note-form textarea { flex: 1 1 auto; resize: vertical; min-height: 44px; }
.apl-note-form .pr-btn { flex: 0 0 auto; }

.apl-timeline { list-style: none; margin: 14px 0 0; padding: 0; }

.apl-ev {
    position: relative;
    padding: 0 0 14px 20px;
    font-size: 0.85rem;
    color: var(--pr-muted);
}

.apl-ev::before {
    content: "";
    position: absolute;
    left: 3px;
    top: 6px;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--pr-line-strong);
}

.apl-ev:not(:last-child)::after {
    content: "";
    position: absolute;
    left: 6px;
    top: 17px;
    bottom: 2px;
    width: 1px;
    background: var(--pr-line);
}

.apl-ev--note::before { background: var(--pr-accent); }
.apl-ev-top strong { color: var(--pr-ink); font-weight: 600; }
.apl-ev-top .apl-when { margin-left: 8px; }

.apl-ev-note {
    margin: 6px 0 0;
    padding: 9px 12px;
    border: 1px solid var(--pr-line);
    border-radius: 10px;
    color: var(--pr-ink);
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.apl-danger {
    margin-top: 8px;
    padding-top: 14px;
    border-top: 1px solid var(--pr-line);
}

.apl-delete {
    padding: 0;
    border: 0;
    background: none;
    color: #e26d6d;
    font-size: 0.85rem;
    cursor: pointer;
}

.apl-delete:hover { text-decoration: underline; }
.apl-delete[data-confirm="1"] { font-weight: 700; }

@media (max-width: 767.98px) {
    .apl-tools { flex-wrap: wrap; }
    .apl-search { flex-basis: 100%; }
    .apl-open { grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; }
    .apl-pos { grid-column: 1; }
    .apl-meta { grid-row: 1; grid-column: 2; }
    .apl-open .apl-status { grid-column: 2; justify-self: end; }
    .apl-grid { grid-template-columns: minmax(0, 1fr); }
    .apl-kv { grid-template-columns: minmax(0, 1fr); gap: 0; }
    .apl-sheet-body { padding: 22px 18px 18px; }
}


/* ── The Application Portal page (/applications) ───────────────── */

/* The rail lists the stages, so the tabs above the list are not repeated. */
.apl-page .apl-tabs { display: none; }

.apl-rail-stats a {
    display: flex;
    align-items: center;
    gap: 10px;
}

.apl-rail-stats .apl-status { gap: 0; }
.apl-rail-k { flex: 1 1 auto; }

.apl-rail-n {
    font-size: 0.78rem;
    font-variant-numeric: tabular-nums;
    color: var(--pr-faint);
}

.adm-portal-link { display: inline-flex; align-items: center; gap: 7px; }
.adm-portal-link[hidden] { display: none; }

@media (max-width: 991.98px) {
    .apl-page .apl-tabs { display: flex; }
    .apl-rail-stats { display: none; }
}

/* ── The resume, shown in the sheet (js/resume-viewer.js) ── */

.apl-resume { border-radius: 12px 12px 0 0; }
.apl-resume:hover { border-color: var(--pr-line); }
.apl-resume-copy { flex: 1 1 auto; }

.apl-resume-dl {
    flex: 0 0 auto;
    padding: 6px 14px;
    font-size: 0.8rem;
}

.apl-viewer {
    display: grid;
    justify-items: center;
    gap: 12px;
    max-height: 78vh;
    min-height: 160px;
    overflow: auto;
    overscroll-behavior: contain;
    padding: 14px 12px;
    border: 1px solid var(--pr-line);
    border-top: 0;
    border-radius: 0 0 12px 12px;
    background: var(--pr-current-bg);
    scrollbar-width: thin;
    scrollbar-color: var(--pr-line-strong) transparent;
}

.rv-page {
    display: block;
    max-width: 100%;
    background: #fff;
    border-radius: 2px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
}

.rv-docx {
    width: 100%;
    max-width: 720px;
    padding: 40px 44px;
    background: #fff;
    color: #1b1d24;
    border-radius: 2px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
    font-size: 0.92rem;
    line-height: 1.55;
    overflow-wrap: anywhere;
}

.rv-docx h1, .rv-docx h2, .rv-docx h3, .rv-docx h4 { color: #111; margin: 1em 0 0.4em; line-height: 1.2; }
.rv-docx h1 { font-size: 1.6rem; }
.rv-docx h2 { font-size: 1.25rem; }
.rv-docx h3 { font-size: 1.05rem; }
.rv-docx p { margin: 0 0 0.6em; }
.rv-docx a { color: #1d4ed8; }
.rv-docx img { max-width: 100%; height: auto; }
.rv-docx table { border-collapse: collapse; margin: 0.6em 0; }
.rv-docx td, .rv-docx th { border: 1px solid #d4d6de; padding: 4px 8px; vertical-align: top; }

.rv-status {
    align-self: center;
    margin: 0;
    color: var(--pr-muted);
    font-size: 0.86rem;
}

.rv-status.is-error { color: #e26d6d; }

@media (max-width: 767.98px) {
    .rv-docx { padding: 24px 20px; }
}

/* An applicant whose account was deleted: the old handle, struck through. */
.apl-acct-gone { display: inline-flex; flex-wrap: wrap; align-items: baseline; gap: 8px; color: var(--pr-muted); }
.apl-acct-gone s { text-decoration-thickness: 1.5px; }
.apl-acct-note { font-size: 0.76rem; color: var(--pr-faint); }


/* ── Badges, in the account sheet ──────────────────────────────── */

.adm-badges {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 8px;
}

.adm-badge {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border: 1px solid var(--pr-line);
    border-radius: 10px;
}

.adm-badge-img {
    flex: 0 0 auto;
    width: 28px;
    height: 28px;
}

.adm-badge-copy {
    display: grid;
    flex: 1 1 auto;
    min-width: 0;
    font-size: 0.86rem;
}

.adm-badge-copy strong {
    color: var(--pr-ink);
    font-weight: 600;
}

.adm-badge-copy span {
    color: var(--pr-faint);
    font-size: 0.78rem;
}

.adm-badge .pr-btn {
    flex: 0 0 auto;
    padding: 6px 14px;
    font-size: 0.8rem;
}

/* ── Database (js/admin-db.js) ──────────────────────────────── */

.adm-db-views {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: 8px;
    margin-bottom: 22px;
}

/* Every card the same height, whatever its text, so the grid is even. */
.adm-db-card {
    display: grid;
    grid-template-rows: auto 1fr auto;
    gap: 4px;
    min-height: 112px;
    padding: 12px 14px;
    border: 1px solid var(--pr-line);
    border-radius: 10px;
    background: transparent;
    color: var(--pr-ink);
    text-align: left;
    font: inherit;
    cursor: pointer;
    transition: border-color .15s ease, background .15s ease;
}

.adm-db-card:hover,
.adm-db-card:focus-visible,
.adm-db-trow:not(.is-count):hover,
.adm-db-trow:not(.is-count):focus-visible {
    border-color: var(--pr-line-strong);
    background: var(--pr-current-bg);
    outline: none;
}

.adm-db-card-title {
    font-weight: 600;
    font-size: 0.92rem;
    line-height: 1.3;
}

.adm-db-card-desc {
    font-size: 0.78rem;
    line-height: 1.45;
    color: var(--pr-muted);
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.adm-db-card-n,
.adm-db-trow-n {
    font-size: 0.76rem;
    font-weight: 600;
    color: var(--pr-accent);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.adm-db-tables {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 6px;
}

.adm-db-trow {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--pr-line);
    border-radius: 10px;
    background: transparent;
    color: var(--pr-ink);
    text-align: left;
    font: inherit;
    cursor: pointer;
    transition: border-color .15s ease, background .15s ease;
}

.adm-db-trow.is-count {
    cursor: default;
    border-style: dashed;
}

.adm-db-trow.is-count .adm-db-trow-n {
    color: var(--pr-faint);
}

.adm-db-trow-copy {
    display: grid;
    gap: 2px;
    min-width: 0;
    flex: 1 1 auto;
}

.adm-db-trow-name {
    font-weight: 600;
    font-size: 0.9rem;
}

.adm-db-trow-desc {
    font-size: 0.78rem;
    color: var(--pr-faint);
    line-height: 1.45;
}

/* The viewer: one fixed size while rows load, page or fail, so nothing
   in it jumps. Only the grid scrolls, both ways. */
.adm-db-box {
    width: min(1180px, 100%);
    height: min(820px, calc(100vh - 120px));
}

.adm-db-head {
    flex: 0 0 auto;
    padding: 22px 60px 12px 24px;
}

.adm-db-title {
    margin: 0 0 4px;
    font-family: var(--font-display, "Khand", sans-serif);
    font-size: 1.6rem;
    line-height: 1.05;
    color: var(--pr-ink);
}

.adm-db-desc {
    margin-bottom: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.adm-db-tools {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 40px;
}

.adm-db-search {
    flex: 0 1 380px;
    margin: 0;
}

.adm-db-search.is-off {
    visibility: hidden;
}

.adm-db-filter {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    max-width: 50%;
    padding: 4px 6px 4px 12px;
    border: 1px solid var(--pr-line-strong);
    border-radius: 999px;
    font-size: 0.78rem;
    color: var(--pr-ink);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.adm-db-filter[hidden] {
    display: none;
}

.adm-db-filter-x {
    width: 22px;
    height: 22px;
    border: 0;
    border-radius: 50%;
    background: var(--pr-current-bg);
    color: var(--pr-muted);
    line-height: 1;
    cursor: pointer;
}

.adm-db-count {
    margin-left: auto;
    font-size: 0.8rem;
    color: var(--pr-muted);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.adm-db-grid {
    position: relative;
    flex: 1 1 auto;
    min-height: 0;
    margin: 0 24px;
    overflow: auto;
    overscroll-behavior: contain;
    border: 1px solid var(--pr-line);
    border-radius: 10px;
    scrollbar-width: thin;
    scrollbar-color: var(--pr-line-strong) transparent;
    outline: none;
}

.adm-db-grid:focus-visible {
    border-color: var(--pr-line-strong);
}

/* While the next page is on its way the old rows stay, quieter. */
.adm-db-grid.is-busy .adm-db-table {
    opacity: 0.5;
}

.adm-db-table {
    width: max-content;
    min-width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.82rem;
}

.adm-db-table th {
    position: sticky;
    top: 0;
    z-index: 1;
    padding: 0;
    background: var(--pr-surface);
    border-bottom: 1px solid var(--pr-line-strong);
    text-align: left;
    white-space: nowrap;
}

.adm-db-th {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    width: 100%;
    padding: 9px 12px;
    border: 0;
    background: transparent;
    color: var(--pr-faint);
    font: inherit;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    text-align: left;
    cursor: pointer;
}

.adm-db-table th.is-num .adm-db-th {
    justify-content: flex-end;
}

.adm-db-th:hover,
.adm-db-th:focus-visible {
    color: var(--pr-ink);
    outline: none;
}

.adm-db-arrow {
    display: inline-block;
    width: 0.8em;
    color: var(--pr-accent);
}

.adm-db-td {
    max-width: 280px;
    padding: 7px 12px;
    border-bottom: 1px solid var(--pr-line);
    color: var(--pr-ink);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    vertical-align: top;
    font-variant-numeric: tabular-nums;
}

.adm-db-table tbody tr:hover .adm-db-td {
    background: var(--pr-current-bg);
}

.adm-db-td--int,
.adm-db-td--money,
.adm-db-td--bytes {
    text-align: right;
}

.adm-db-td.is-long {
    cursor: zoom-in;
}

.adm-db-td.is-open {
    max-width: 480px;
    white-space: pre-wrap;
    word-break: break-word;
    cursor: zoom-out;
}

.adm-db-null {
    color: var(--pr-faint);
}

/* A cell that can be changed: room for a pencil at its end, shown on hover
   or focus. The pencil and the "Saved" note sit over the cell, so a row
   never changes height. */
.adm-db-td.is-editable {
    position: relative;
    padding-right: 32px;
}

.adm-db-pen {
    position: absolute;
    top: 50%;
    right: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    margin-top: -11px;
    padding: 0;
    border: 1px solid transparent;
    border-radius: 6px;
    background: transparent;
    color: var(--pr-faint);
    cursor: pointer;
    opacity: 0;
    transition: opacity .12s ease, color .12s ease, border-color .12s ease;
}

.adm-db-table tbody tr:hover .adm-db-pen,
.adm-db-td.is-editing .adm-db-pen,
.adm-db-pen:focus-visible {
    opacity: 1;
}

.adm-db-pen:hover,
.adm-db-pen:focus-visible {
    color: var(--pr-accent);
    border-color: var(--pr-line-strong);
    outline: none;
}

.adm-db-td.is-editing {
    box-shadow: inset 0 0 0 1px var(--pr-accent);
}

@media (hover: none) {
    .adm-db-pen {
        opacity: 0.7;
    }
}

.adm-db-note {
    position: absolute;
    top: 50%;
    /* Beside the pencil, which stays usable. */
    right: 30px;
    transform: translateY(-50%);
    padding: 2px 8px;
    border: 1px solid var(--pr-line-strong);
    border-radius: 999px;
    background: var(--pr-surface);
    color: #22c55e;
    font-size: 0.74rem;
    font-weight: 600;
    white-space: nowrap;
}

.adm-db-note.is-error {
    color: var(--pr-error);
}

.adm-db-undo {
    padding: 0;
    border: 0;
    background: none;
    color: var(--pr-accent);
    font: inherit;
    text-decoration: underline;
    text-underline-offset: 2px;
    cursor: pointer;
}

/* The editor: under the cell, inside the scrolling rows. */
.adm-db-ed {
    position: absolute;
    z-index: 3;
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 0;
    padding: 12px;
    border: 1px solid var(--pr-line-strong);
    border-radius: 10px;
    background: var(--pr-surface);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.28);
    font-size: 0.84rem;
    color: var(--pr-ink);
}

.adm-db-ed-head {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin: 0;
}

.adm-db-ed-head span {
    color: var(--pr-muted);
    font-size: 0.76rem;
}

.adm-db-ed-input {
    width: 100%;
    margin: 0;
}

.adm-db-ed-area {
    min-height: 96px;
    resize: vertical;
}

.adm-db-ed-seg {
    align-self: flex-start;
}

.adm-db-ed-hint {
    color: var(--pr-faint);
    font-size: 0.74rem;
    font-variant-numeric: tabular-nums;
}

.adm-db-ed-hint.is-over {
    color: var(--pr-error);
}

.adm-db-ed-msg {
    margin: 0;
    min-height: 0;
}

.adm-db-ed-msg:empty {
    display: none;
}

.adm-db-ed-acts {
    display: flex;
    gap: 8px;
}

.adm-db-ed-acts .pr-btn {
    padding: 6px 14px;
    font-size: 0.82rem;
}

.adm-db-user {
    max-width: 100%;
    padding: 0;
    border: 0;
    background: none;
    color: var(--pr-accent);
    font: inherit;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.76rem;
    text-decoration: underline;
    text-decoration-color: transparent;
    text-underline-offset: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    cursor: pointer;
}

.adm-db-user:hover,
.adm-db-user:focus-visible {
    text-decoration-color: currentColor;
    outline: none;
}

/* Loading, empty and error sit over the grid, not in it, so the frame
   keeps its size. */
.adm-db-state {
    position: absolute;
    left: 0;
    right: 0;
    top: 44%;
    margin: 0;
    text-align: center;
    color: var(--pr-muted);
    font-size: 0.88rem;
    pointer-events: none;
}

.adm-db-state[hidden] {
    display: none;
}

.adm-db-state.is-error {
    color: #f87171;
}

.adm-db-foot {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 62px;
    padding: 12px 24px 16px;
}

.adm-db-tip {
    font-size: 0.76rem;
    color: var(--pr-faint);
}

.adm-db-pager {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: auto;
}

.adm-db-page {
    min-width: 96px;
    text-align: center;
    font-size: 0.8rem;
    color: var(--pr-muted);
    font-variant-numeric: tabular-nums;
}

.adm-db-pager .pr-btn {
    padding: 6px 12px;
    font-size: 0.8rem;
}

.adm-db-pager .pr-btn:disabled {
    opacity: 0.4;
    cursor: default;
}

.adm-db-label {
    margin-top: 4px;
}

/* An account opened from a row sits above the viewer. */
#adm-sheet {
    z-index: 2001;
}

@media (max-width: 639.98px) {
    .adm-db-head {
        padding: 18px 52px 10px 16px;
    }

    .adm-db-grid {
        margin: 0 12px;
    }

    .adm-db-foot {
        padding: 10px 12px 12px;
    }

    .adm-db-tip {
        display: none;
    }

    .adm-db-tools {
        flex-wrap: wrap;
        gap: 8px;
    }

    .adm-db-search {
        flex: 1 1 100%;
    }

    .adm-db-count {
        margin-left: 0;
    }

    .adm-db-desc {
        white-space: normal;
    }
}
