/*
  Poly.Pay admin: a neutral console (docs/design/2026-09-24-poly-pay-admin-ui-design.md).
  No web fonts and nothing from another origin: the admin of a payment service tells no third
  party who opened it, or when.
*/
:root {
    --page: #f6f7f9;
    --paper: #ffffff;
    --head: #fafbfc;
    --line: #d9dee3;
    --line-strong: #c8cfd6;
    --rule: #eef1f4;
    --hover: #f8fafb;
    --ink: #1d232a;
    --muted: #5b6672;
    --faint: #8a949e;
    --accent: #185fa5;
    --accent-deep: #134f8a;
    --accent-soft: #b5d4f4;
    --radius: 8px;

    --success-bg: #eaf3de;
    --success-fg: #27500a;
    --warning-bg: #faeeda;
    --warning-fg: #633806;
    --info-bg: #e6f1fb;
    --info-fg: #0c447c;
    --neutral-bg: #f1efe8;
    --neutral-fg: #444441;
    --danger-bg: #fcebeb;
    --danger-fg: #791f1f;

    --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --mono: ui-monospace, "Cascadia Mono", Consolas, monospace;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font: 14px/1.5 var(--sans);
    color: var(--ink);
    background: var(--page);
}

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

h1 { font-size: 20px; font-weight: 600; margin: 0; }
h2 { font-size: 15px; font-weight: 600; margin: 28px 0 10px; }

code, .mono { font-family: var(--mono); font-size: 12.5px; }
.muted { color: var(--muted); }
.none { color: var(--faint); }
.error { margin: 0; padding: 8px 12px; border-radius: 6px; background: var(--danger-bg); color: var(--danger-fg); }

/* ── Top bar ─────────────────────────────────────────────────────────────── */

.top {
    position: sticky;
    top: 0;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 28px;
    height: 52px;
    padding: 0 24px;
    background: var(--paper);
    border-bottom: 1px solid var(--line);
}

.top .brand { color: var(--ink); font-size: 15px; font-weight: 600; text-decoration: none; }
.top nav { display: flex; gap: 22px; align-self: stretch; }
.top nav a {
    display: flex;
    align-items: center;
    margin-bottom: -1px;
    border-bottom: 2px solid transparent;
    color: var(--muted);
    text-decoration: none;
}
.top nav a:hover { color: var(--ink); }
.top nav a.on { color: var(--accent); border-bottom-color: var(--accent); }
.top .who { display: flex; align-items: center; gap: 12px; margin-left: auto; color: var(--muted); }
.top .who form { margin: 0; }
.top .who button { height: 30px; }

main { max-width: 1280px; margin: 0 auto; padding: 24px; }

/* ── Page header ─────────────────────────────────────────────────────────── */

.page { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.page .sub { flex-basis: 100%; margin: 0; color: var(--muted); }
.lead { margin: -6px 0 16px; color: var(--muted); }

/* ── Controls ────────────────────────────────────────────────────────────── */

input, select, button { font: inherit; color: inherit; }

input, select {
    height: 34px;
    padding: 0 10px;
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 6px;
}

button {
    height: 34px;
    padding: 0 14px;
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 6px;
    cursor: pointer;
}
button:hover { background: var(--hover); border-color: var(--line-strong); }
button.primary { background: var(--accent); border-color: var(--accent); color: #ffffff; }
button.primary:hover { background: var(--accent-deep); }

input:focus, select:focus, button:focus-visible, a:focus-visible {
    outline: 2px solid var(--accent-soft);
    outline-offset: 1px;
}

.filters {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 12px;
    margin: 0 0 16px;
    padding: 12px 16px;
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: var(--radius);
}
.filters label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.filters a { align-self: center; }

.segments { display: inline-flex; overflow: hidden; background: var(--paper); border: 1px solid var(--line); border-radius: 6px; }
.segments a { padding: 6px 14px; border-left: 1px solid var(--line); color: var(--muted); text-decoration: none; }
.segments a:first-child { border-left: 0; }
.segments a:hover { color: var(--ink); }
.segments a.on { background: var(--info-bg); color: var(--accent); font-weight: 500; }

/* ── Tables ──────────────────────────────────────────────────────────────── */

table {
    width: 100%;
    margin-bottom: 16px;
    border-collapse: separate;
    border-spacing: 0;
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: var(--radius);
}

th, td { padding: 9px 12px; text-align: left; vertical-align: middle; border-bottom: 1px solid var(--rule); }
thead th { background: var(--head); border-bottom-color: var(--line); color: var(--muted); font-size: 12px; font-weight: 500; white-space: nowrap; }
thead th:first-child { border-top-left-radius: var(--radius); }
thead th:last-child { border-top-right-radius: var(--radius); }
tbody tr:last-child > * { border-bottom: 0; }
tbody tr:hover > td { background: var(--hover); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
td time { white-space: nowrap; }

table.kv tbody tr:hover > td { background: none; }
table.kv th { width: 220px; color: var(--muted); font-weight: 400; }

/* The ledger: one <tbody> per posting, its head spanning its entries. */
table.ledger td { vertical-align: top; }
table.ledger td[rowspan] { border-bottom: 0; }
table.ledger tbody + tbody > tr:first-child > * { border-top: 1px solid var(--line); }
table.ledger tbody:hover > tr > td { background: var(--hover); }

/* ── Badges and values ───────────────────────────────────────────────────── */

.badge {
    display: inline-block;
    padding: 1px 8px;
    border-radius: 999px;
    font-size: 12px;
    line-height: 18px;
    white-space: nowrap;
}
.tone-success { background: var(--success-bg); color: var(--success-fg); }
.tone-warning { background: var(--warning-bg); color: var(--warning-fg); }
.tone-info { background: var(--info-bg); color: var(--info-fg); }
.tone-neutral { background: var(--neutral-bg); color: var(--neutral-fg); }
.tone-danger { background: var(--danger-bg); color: var(--danger-fg); }

.value { display: inline-flex; align-items: center; gap: 2px; white-space: nowrap; }

.copy {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    padding: 0;
    background: transparent;
    border: 0;
    border-radius: 4px;
    color: var(--faint);
}
.copy:hover { background: var(--rule); color: var(--ink); }
.copy svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.3; }
.copy.copied { color: var(--success-fg); }
.copy.copied::after {
    content: "Copied";
    position: absolute;
    bottom: calc(100% + 4px);
    left: 50%;
    transform: translateX(-50%);
    padding: 2px 6px;
    border-radius: 4px;
    background: var(--ink);
    color: #ffffff;
    font: 11px/1.4 var(--sans);
    white-space: nowrap;
}

/* ── Dashboard ───────────────────────────────────────────────────────────── */

.figures { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 16px; }
.figure { padding: 14px 16px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); }
.figure span { display: block; color: var(--muted); font-size: 12px; }
.figure strong { display: block; margin-top: 4px; font-size: 22px; font-weight: 600; font-variant-numeric: tabular-nums; }
.figure small { display: block; margin-top: 4px; color: var(--muted); font-size: 12px; }

.card { margin-bottom: 16px; padding: 16px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); }
.card > header { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.card > header h2 { margin: 0; }

.chart { display: block; width: 100%; height: 160px; border-bottom: 1px solid var(--line); }
.chart .bar { fill: var(--accent-soft); }
.chart .bar:hover, .chart .bar.now { fill: var(--accent); }
.axis { display: flex; justify-content: space-between; margin-top: 6px; color: var(--faint); font-size: 12px; }

/* ── Empty states and paging ─────────────────────────────────────────────── */

.empty {
    margin-bottom: 16px;
    padding: 32px 24px;
    text-align: center;
    background: var(--paper);
    border: 1px dashed var(--line-strong);
    border-radius: var(--radius);
}
.empty strong { display: block; font-size: 15px; font-weight: 600; }
.empty p { margin: 6px 0 0; color: var(--muted); }
.empty .command {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 14px;
    padding: 6px 6px 6px 12px;
    background: var(--page);
    border: 1px solid var(--rule);
    border-radius: 6px;
    color: var(--ink);
}

.pager { display: flex; justify-content: space-between; margin: 0 0 16px; }

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

body.bare main { display: flex; align-items: center; justify-content: center; min-height: 100vh; }

.login { width: 340px; padding: 28px; background: var(--paper); border: 1px solid var(--line); border-radius: 12px; }
.login h1 span { color: var(--muted); font-weight: 400; }
.login form { display: flex; flex-direction: column; gap: 14px; margin-top: 20px; }
.login label { display: flex; flex-direction: column; gap: 6px; color: var(--muted); font-size: 13px; }
.login input { width: 100%; height: 38px; color: var(--ink); }
.login button { height: 38px; margin-top: 6px; }
.login .error { margin-top: 16px; }
