/* Bunker.tools — neo-retro theme.
   Old-school window chrome (title bars, hard offset shadows, mono labels)
   on a calm, readable modern base. Plain CSS, no build step and no CDN. */

:root {
    --bg: #f2efe7;
    --grid: rgba(27, 27, 31, 0.07);
    --surface: #fffdf8;
    --surface-2: #f7f4ec;
    --ink: #1b1b1f;
    --ink-soft: #5f5d58;
    --line: #1b1b1f;
    --line-soft: rgba(27, 27, 31, 0.14);
    --accent: #3651f5;
    --accent-hover: #2a43d9;
    --accent-soft: #e5e9ff;
    --on-accent: #ffffff;
    --green: #17985a;
    --green-soft: #def3e6;
    --yellow: #ffd23f;
    --yellow-soft: #fff3c4;
    --red: #d93d42;
    --red-soft: #fde3e3;
    --on-status: #ffffff;
    --shadow-color: #1b1b1f;
    --shadow: 6px 6px 0 var(--shadow-color);
    --shadow-sm: 3px 3px 0 var(--shadow-color);

    --radius: 12px;
    --radius-sm: 8px;
    --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
    --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "DejaVu Sans Mono", "Liberation Mono", monospace;
    color-scheme: light;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #111216;
        --grid: rgba(236, 235, 228, 0.05);
        --surface: #1b1c21;
        --surface-2: #23242a;
        --ink: #ecebe4;
        --ink-soft: #a3a29b;
        --line: #4a4b53;
        --line-soft: rgba(236, 235, 228, 0.12);
        --accent: #7088ff;
        --accent-hover: #889cff;
        --accent-soft: #262c4d;
        --on-accent: #0d0f1a;
        --green: #3ccf7f;
        --green-soft: #183527;
        --yellow: #ffd23f;
        --yellow-soft: #3a3217;
        --red: #ff6b6f;
        --red-soft: #3d1d20;
        --on-status: #101114;
        --shadow-color: #000000;
        color-scheme: dark;
    }
}

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

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

body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    font-family: var(--sans);
    font-size: 16px;
    line-height: 1.55;
    color: var(--ink);
    background-color: var(--bg);
    background-image:
        linear-gradient(var(--grid) 1px, transparent 1px),
        linear-gradient(90deg, var(--grid) 1px, transparent 1px);
    background-size: 24px 24px;
    -webkit-font-smoothing: antialiased;
    /* Shows the page the inline style in base.html keeps hidden until this file loads. */
    visibility: visible;
    animation: none;
}

a {
    color: var(--accent);
    text-underline-offset: 3px;
}

a:hover {
    color: var(--accent-hover);
}

::selection {
    background: var(--yellow);
    color: #1b1b1f;
}

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

code,
pre {
    font-family: var(--mono);
    font-size: 0.92em;
}

/* ---------- Menu bar & status bar ---------- */

.menubar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 8px 16px;
    background: var(--surface);
    border-bottom: 2px solid var(--line);
    font-family: var(--mono);
    font-size: 14px;
    overflow-x: auto;
    white-space: nowrap;
}

.menubar a {
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    color: var(--ink);
    text-decoration: none;
}

.menubar a:hover {
    background: var(--surface-2);
    color: var(--ink);
}

.menubar a[aria-current="page"] {
    background: var(--accent);
    color: var(--on-accent);
}

.menubar a[aria-current="page"] .hk {
    color: inherit;
}

.lang-switch {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    margin-left: 6px;
    font-size: 12px;
}

.lang-switch b,
.menubar .lang-switch a {
    padding: 4px 6px;
}

.lang-switch b {
    border: 1.5px solid var(--line);
    border-radius: var(--radius-sm);
}

.menubar .brand {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-right: 10px;
    padding-left: 0;
    font-weight: 700;
    color: var(--ink);
}

/* The mascot avatar is the logo. */
.menubar .brand::before {
    content: "";
    width: 24px;
    height: 24px;
    margin: -4px 0;
    background: url("mascot/avatar.svg") center / contain no-repeat;
}

.menubar .brand:hover {
    background: none;
}

.menubar .spacer {
    flex: 1;
}

.hk {
    text-decoration: underline;
    text-decoration-thickness: 2px;
    text-decoration-color: var(--accent);
    text-underline-offset: 3px;
}

.statusbar {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 20px;
    padding: 12px 16px;
    border-top: 2px solid var(--line);
    background: var(--surface);
    font-family: var(--mono);
    font-size: 13px;
    color: var(--ink-soft);
}

.statusbar a {
    color: var(--ink-soft);
    text-decoration: none;
}

.statusbar a:hover {
    color: var(--ink);
}

.statusbar .key {
    display: inline-block;
    margin-right: 6px;
    padding: 0 6px;
    border: 1.5px solid var(--line);
    border-radius: 5px;
    background: var(--surface-2);
    box-shadow: 0 2px 0 var(--shadow-color);
    color: var(--ink);
    font-size: 11px;
    font-weight: 700;
    line-height: 18px;
}

/* ---------- Layout ---------- */

.desktop {
    flex: 1;
    width: 100%;
    padding: 40px 16px 56px;
}

.desktop--center {
    display: flex;
    align-items: flex-start;
    justify-content: center;
}

.col {
    width: 100%;
    max-width: 560px;
    margin: 0 auto;
}

.col--wide {
    max-width: 1180px;
}

.col--home {
    max-width: 720px;
}

.stack > * + * {
    margin-top: 16px;
}

.stack-lg > * + * {
    margin-top: 32px;
}

.stack-sm > * + * {
    margin-top: 8px;
}

.mt {
    margin-top: 8px;
}

.row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

.row--between {
    justify-content: space-between;
}

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

.center {
    text-align: center;
}

.muted {
    color: var(--ink-soft);
}

.small {
    font-size: 14px;
}

.nowrap {
    white-space: nowrap;
}

.break {
    word-break: break-all;
}

.accent-text {
    color: var(--accent);
    font-family: var(--mono);
}

.error-text {
    color: var(--red);
}

/* ---------- Windows ---------- */

.window {
    position: relative;
    padding: 0 24px 24px;
    background: var(--surface);
    border: 2px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

/* Title bar like an old-school OS window, flat and calm */
.window-title {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 -24px 20px;
    padding: 10px 16px;
    border-bottom: 2px solid var(--line);
    border-radius: calc(var(--radius) - 2px) calc(var(--radius) - 2px) 0 0;
    background: var(--accent-soft);
    font-family: var(--mono);
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.02em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.stack > .window-title + *,
.stack-lg > .window-title + * {
    margin-top: 0;
}

.window--alert {
    background: var(--yellow-soft);
}

.window--alert .window-title {
    background: var(--yellow);
    color: #1b1b1f;
}

h1,
h2,
h3 {
    margin: 0;
    line-height: 1.2;
}

.display {
    font-family: var(--mono);
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.kicker {
    font-family: var(--mono);
    font-size: 12px;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--ink-soft);
}

p {
    margin: 0;
}

/* Dotted key/value rows: "Цена ........ $30" */
.kv {
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.kv > span:first-child {
    color: var(--ink-soft);
}

.kv .dots {
    flex: 1;
    min-width: 16px;
    border-bottom: 2px dotted var(--line-soft);
    transform: translateY(-4px);
}

.kv b {
    font-family: var(--mono);
}

/* ---------- Form controls ---------- */

.label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
}

legend.label {
    padding: 0;
}

.input,
.select,
.textarea {
    display: block;
    width: 100%;
    padding: 10px 12px;
    border: 2px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--ink);
    font: inherit;
    transition: box-shadow 0.12s ease, border-color 0.12s ease;
}

.input::placeholder,
.textarea::placeholder {
    color: var(--ink-soft);
    opacity: 0.7;
}

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

.input[readonly] {
    background: var(--surface-2);
    color: var(--ink-soft);
    font-family: var(--mono);
}

.textarea {
    min-height: 84px;
    resize: vertical;
}

.input--sm {
    padding: 6px 10px;
    font-size: 13px;
}

/* Tariff tiles: equal size, side by side, with a round radio.
   The card follows its input as a sibling (input:checked + .choice-card):
   :has() is not re-evaluated reliably when another radio gets checked. */
.choices {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
    border: 0;
    margin: 0;
    padding: 0;
}

.choices > legend {
    padding: 0;
    margin-bottom: 6px;
}

.choice {
    position: relative;
    display: flex;
    cursor: pointer;
}

.choice input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.choice-card {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 12px 14px 14px;
    border: 2px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface);
    transition: transform 0.12s ease, box-shadow 0.12s ease, background-color 0.12s ease, border-color 0.12s ease;
}

.choice:hover .choice-card {
    background: var(--surface-2);
}

.choice-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 22px;
    margin-bottom: 8px;
}

.choice .mark {
    flex: none;
    width: 22px;
    height: 22px;
    border: 2px solid var(--line);
    border-radius: 50%;
    background: var(--surface);
    transition: background-color 0.12s ease, box-shadow 0.12s ease, border-color 0.12s ease;
}

.choice input:checked + .choice-card {
    background: var(--accent-soft);
    border-color: var(--accent);
    box-shadow: var(--shadow-sm);
    transform: translate(-2px, -2px);
}

.choice input:checked + .choice-card .mark {
    border-color: var(--accent);
    background: var(--accent);
    box-shadow: inset 0 0 0 4px var(--accent-soft);
}

.choice input:focus-visible + .choice-card {
    outline: 3px solid var(--accent);
    outline-offset: 2px;
}

.choice-title {
    font-weight: 600;
}

.choice-price {
    font-family: var(--mono);
    font-size: 24px;
    font-weight: 700;
    line-height: 1.2;
}

.choice-hint {
    font-size: 13px;
    color: var(--ink-soft);
}

/* ---------- Home page perks ---------- */
.perks {
    display: grid;
    gap: 12px;
}

.perk {
    padding: 12px 14px 14px;
    border: 2px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface);
}

.perk-title {
    margin-bottom: 4px;
    font-family: var(--mono);
    font-weight: 700;
}

.perk p {
    margin: 0;
    font-size: 14px;
    color: var(--ink-soft);
}

/* ---------- Mascot ---------- */
/* Illustrations are 320 px tall files shown at 160 px for sharp retina screens. */
.mascot {
    display: block;
    width: auto;
    height: 160px;
    margin: 0 auto;
}

.mascot--md {
    height: 120px;
}

/* A page headline with the mascot to its right; 240 px files shown at 120 px. */
.hero {
    display: flex;
    align-items: center;
    gap: 20px;
}

.hero-text {
    flex: 1;
    min-width: 0;
}

.hero-mascot {
    flex: none;
    width: auto;
    height: 120px;
}

/* The robot hangs over the top edge of a window, its fingers on the title bar, or sits on that edge;
   the window keeps room above. Positions count from inside the 2px border, hence the +2px.
   In hanging.png the edge line starts 14/180 of the height above the bottom, so it covers the border. */
.window--peek,
.window--sit {
    margin-top: 92px;
}

.window--peek > .peek,
.window--sit > .peek {
    --peek-h: 96px;
    position: absolute;
    right: 32px;
    bottom: calc(100% + 2px - var(--peek-h) * 14 / 180);
    width: auto;
    height: var(--peek-h);
    margin: 0;
    pointer-events: none;
}

.window--sit {
    margin-top: 104px;
}

.window--sit > .peek {
    --peek-h: 110px;
    bottom: calc(100% + 1px);
}

/* ---------- Home page products ---------- */
.products {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr));
    gap: 14px;
}

.product {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 16px;
    border: 2px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
    color: var(--ink);
    text-decoration: none;
    transition: transform 0.08s, box-shadow 0.08s;
}

.product:hover {
    color: var(--ink);
    transform: translate(-1px, -1px);
    box-shadow: 4px 4px 0 var(--shadow-color);
}

.product-title {
    font-family: var(--mono);
    font-size: 18px;
    font-weight: 700;
}

.product-text {
    flex: 1;
    font-size: 14px;
    color: var(--ink-soft);
}

.product-price {
    font-family: var(--mono);
    font-weight: 700;
}

.product-cta {
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    background: var(--accent);
    color: var(--on-accent);
    font-weight: 600;
    text-align: center;
}

.product:hover .product-cta {
    background: var(--accent-hover);
}

/* ---------- eSIM ---------- */
.esim-countries {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(130px, 40%), 1fr));
    gap: 8px;
}

.esim-country {
    display: flex;
    flex-direction: column;
    gap: 0;
    min-width: 0;
    padding: 7px 10px;
    font-size: 14px;
    line-height: 1.3;
    border: 2px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--ink);
    text-decoration: none;
}

.esim-country:hover {
    background: var(--surface-2);
    color: var(--ink);
}

.esim-country[hidden] {
    display: none;
}

.esim-country-name {
    display: flex;
    align-items: flex-start;
    font-weight: 600;
}

/* A long name wraps next to its flag, not under it. */
.esim-country-name .flag {
    flex: none;
    margin-top: 3px;
}

/* A small flag with a thin frame, like the rest of the UI. */
.flag {
    display: inline-block;
    width: 21px;
    height: 14px;
    margin-right: 7px;
    vertical-align: -1px;
    border: 1px solid var(--line-soft);
    border-radius: 2px;
    object-fit: cover;
}

.flag--lg {
    width: 30px;
    height: 20px;
    margin-right: 10px;
    vertical-align: 0;
}

/* The QR code stays black on white in dark mode too: phone cameras need the contrast. */
.esim-qr {
    display: flex;
    justify-content: center;
}

.esim-qr svg {
    width: min(260px, 100%);
    height: auto;
    border: 2px solid var(--line);
    border-radius: var(--radius-sm);
    background: #ffffff;
}

.esim-usage {
    height: 12px;
    border: 2px solid var(--line);
    border-radius: 999px;
    background: var(--surface);
    overflow: hidden;
}

.esim-usage-bar {
    display: block;
    height: 100%;
    background: var(--accent);
}

.esim-usage-bar--low {
    background: var(--red);
}

/* ---------- My numbers ---------- */
.number-link {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--ink);
    text-decoration: none;
}

.number-link:hover {
    background: var(--surface-2);
    color: var(--ink);
}

.number-link > span:first-child {
    flex: 1;
    min-width: 0;
}

.number-link .perk-title {
    display: block;
}

.number-link-arrow {
    font-family: var(--mono);
    font-weight: 700;
}

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

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 46px;
    padding: 10px 20px;
    border: 2px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--accent);
    color: var(--on-accent);
    font-family: var(--mono);
    font-size: 15px;
    font-weight: 700;
    text-decoration: none;
    text-align: center;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    transition: transform 0.1s ease, box-shadow 0.1s ease, background-color 0.12s ease;
}

.btn:hover {
    background: var(--accent-hover);
    color: var(--on-accent);
    transform: translate(-1px, -1px);
    box-shadow: 4px 4px 0 var(--shadow-color);
}

.btn:active {
    transform: translate(3px, 3px);
    box-shadow: none;
}

.btn[disabled] {
    background: var(--surface-2);
    color: var(--ink-soft);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn--block {
    display: flex;
    width: 100%;
}

.btn--gray {
    background: var(--surface);
    color: var(--ink);
}

.btn--gray:hover {
    background: var(--surface-2);
    color: var(--ink);
}

.btn--danger {
    background: var(--red);
    color: var(--on-status);
}

.btn--danger:hover {
    background: var(--red);
    color: var(--on-status);
    filter: brightness(1.08);
}

.btn--sm {
    min-height: 34px;
    padding: 4px 12px;
    font-size: 13px;
}

.linkbtn {
    padding: 0;
    border: 0;
    background: none;
    color: var(--accent);
    font: inherit;
    text-decoration: underline;
    text-underline-offset: 3px;
    cursor: pointer;
}

/* ---------- Notes, badges ---------- */

.note {
    padding: 12px 14px;
    border: 2px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--accent-soft);
}

.note--ok {
    background: var(--green-soft);
}

.note--warn {
    background: var(--yellow-soft);
}

.note--error {
    background: var(--red-soft);
}

.badge {
    display: inline-block;
    padding: 1px 8px;
    border: 1.5px solid var(--line);
    border-radius: 999px;
    font-family: var(--mono);
    font-size: 12px;
    font-weight: 700;
    line-height: 18px;
    background: var(--yellow);
    color: #1b1b1f;
    white-space: nowrap;
    vertical-align: middle;
}

.badge--green {
    background: var(--green);
    color: var(--on-status);
}

.badge--red {
    background: var(--red);
    color: var(--on-status);
}

.badge--gray {
    background: var(--surface-2);
    color: var(--ink-soft);
}

.badge--cyan {
    background: var(--accent-soft);
    color: var(--accent);
}

/* Progress steps: [x] [>] [ ] */
.steps {
    display: grid;
    gap: 8px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.steps li {
    display: flex;
    gap: 12px;
    color: var(--ink-soft);
}

.steps li::before {
    content: "[ ]";
    flex: none;
    font-family: var(--mono);
    font-weight: 700;
}

.steps li.done {
    color: var(--ink);
}

.steps li.done::before {
    content: "[x]";
    color: var(--green);
}

.steps li.current {
    color: var(--ink);
    font-weight: 600;
}

.steps li.current::before {
    content: "[>]";
    color: var(--accent);
    animation: blink 1s steps(2, start) infinite;
}

/* Numbered steps under a dashed rule, after a few facts ("Перед покупкой"). */
.stack > .steps--split {
    margin-top: 22px;
    padding-top: 18px;
    border-top: 1.5px dashed var(--line-soft);
}

.step-hint {
    display: block;
    margin-top: 4px;
    font-size: 14px;
    color: var(--ink-soft);
}

/* Plain numbered list variant ("Как это работает") */
.steps--numbered {
    counter-reset: step;
}

.steps--numbered li {
    color: var(--ink);
}

.steps--numbered li::before {
    counter-increment: step;
    content: counter(step);
    display: inline-grid;
    place-items: center;
    width: 26px;
    height: 26px;
    border: 2px solid var(--line);
    border-radius: 50%;
    background: var(--yellow);
    color: #1b1b1f;
    font-size: 13px;
}

@keyframes blink {
    to {
        visibility: hidden;
    }
}

/* ---------- SMS cabinet ---------- */

.phone {
    font-family: var(--mono);
    font-size: clamp(28px, 7vw, 40px);
    font-weight: 700;
    letter-spacing: 0.01em;
    color: var(--ink);
    word-break: break-all;
}

.stat {
    padding: 12px 14px;
    border: 2px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface-2);
}

.stat-label {
    font-family: var(--mono);
    font-size: 11px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--ink-soft);
}

.stat-value {
    margin-top: 4px;
    font-family: var(--mono);
    font-size: 22px;
    font-weight: 700;
}

.stat-value.is-ok {
    color: var(--green);
}

.stat-value.is-bad {
    color: var(--red);
}

.sms-list {
    margin: 0 -8px;
}

.sms {
    padding: 14px 8px;
    border-top: 1px solid var(--line-soft);
    animation: sms-in 0.25s ease-out;
}

.sms:first-child {
    border-top: 0;
}

.sms-head {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    font-family: var(--mono);
    font-size: 13px;
    color: var(--ink-soft);
}

.sms-sender {
    font-weight: 700;
    color: var(--ink);
    word-break: break-all;
}

.sms-body {
    margin-top: 6px;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.otp {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
    padding: 6px 14px;
    border: 2px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--yellow);
    color: #1b1b1f;
    font-family: var(--mono);
    font-size: 22px;
    font-weight: 700;
    letter-spacing: 0.12em;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    transition: transform 0.1s ease, box-shadow 0.1s ease;
}

.otp small {
    font-size: 12px;
    font-weight: 400;
    letter-spacing: 0;
}

.otp:active {
    transform: translate(3px, 3px);
    box-shadow: none;
}

.empty {
    padding: 28px 8px;
    text-align: center;
    font-family: var(--mono);
    color: var(--ink-soft);
}

@keyframes sms-in {
    from {
        opacity: 0;
        transform: translateY(4px);
    }
}

/* ---------- Tables (admin) ---------- */

.table-wrap {
    overflow-x: auto;
    margin: 0 -8px;
}

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

.table th {
    padding: 8px;
    text-align: left;
    font-family: var(--mono);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--ink-soft);
    border-bottom: 2px solid var(--line);
    white-space: nowrap;
}

.table td {
    padding: 12px 8px;
    vertical-align: top;
    border-bottom: 1px solid var(--line-soft);
}

.table tr:hover td {
    background: var(--surface-2);
}

.table .num {
    text-align: right;
}

.actions {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
}

details > summary {
    cursor: pointer;
    list-style: none;
}

details > summary::-webkit-details-marker {
    display: none;
}

details > summary .toggle::before {
    content: "[+]";
    font-family: var(--mono);
    font-weight: 700;
    color: var(--accent);
}

details[open] > summary .toggle::before {
    content: "[−]";
}

/* ---------- FAQ and legal pages ---------- */

.faq-item {
    border-top: 1.5px dashed var(--line);
    padding: 12px 0;
}

.faq-item:first-of-type {
    border-top: 0;
}

.faq-item > summary {
    font-weight: 700;
}

.faq-answer {
    margin-top: 8px;
    color: var(--ink-soft);
}

.faq-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.faq-nav a {
    padding: 6px 12px;
    border: 2px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--ink);
    font-family: var(--mono);
    font-weight: 700;
    text-decoration: none;
}

.faq-nav a:hover {
    background: var(--surface-2);
    color: var(--ink);
}

/* Anchored sections stop below the sticky menu bar. */
.window[id] {
    scroll-margin-top: 64px;
}

/* Terms and privacy: a reading-width column, sections split by a dashed rule like the FAQ. */
.col--legal {
    max-width: 760px;
}

.prose {
    font-size: 15px;
    line-height: 1.65;
}

.prose p,
.prose ul {
    margin: 0;
}

.prose > * + * {
    margin-top: 12px;
}

.prose > h2 {
    margin-top: 26px;
    padding-top: 22px;
    border-top: 1.5px dashed var(--line-soft);
    font-family: var(--mono);
    font-size: 15px;
    letter-spacing: 0.01em;
}

.prose > h2 + * {
    margin-top: 10px;
}

.prose ul {
    padding-left: 20px;
}

.prose li::marker {
    color: var(--accent);
}

.prose li + li {
    margin-top: 6px;
}

.prose b {
    font-weight: 600;
}

.statusbar-copy {
    margin-left: auto;
}

.qr {
    display: block;
    margin: 0 auto;
    padding: 8px;
    border: 2px solid var(--line);
    border-radius: var(--radius-sm);
    background: #fff;
}

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

.section-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: var(--mono);
    font-size: 15px;
}

.right {
    text-align: right;
}

.grid-2--wide {
    gap: 32px 24px;
    align-items: start;
}

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

.search-row .input {
    flex: 1;
    min-width: 0;
}

.chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border: 2px solid var(--line);
    border-radius: 999px;
    background: var(--surface);
    color: var(--ink);
    font-family: var(--mono);
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
}

.chip:hover {
    background: var(--surface-2);
    color: var(--ink);
}

.chip.active {
    background: var(--ink);
    color: var(--surface);
}

.chip-count {
    font-weight: 400;
    opacity: 0.7;
}

.action-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
}

.stat-card {
    padding: 14px 16px;
    border: 2px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface-2);
}

.stat-big {
    font-family: var(--mono);
    font-size: 30px;
    font-weight: 700;
    line-height: 1.1;
}

.timeline {
    display: grid;
    gap: 8px;
    margin: 0;
    padding: 0;
    list-style: none;
    font-size: 14px;
}

.timeline li {
    display: grid;
    grid-template-columns: 150px 1fr;
    gap: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--line-soft);
}

.timeline li:last-child {
    border-bottom: 0;
}

.row-link {
    cursor: pointer;
}

.row-main {
    color: var(--ink);
    text-decoration: none;
}

.row-main:hover {
    color: var(--accent);
}

.advanced {
    margin-top: 6px;
    padding-top: 10px;
    border-top: 1px dashed var(--line-soft);
}

/* Support tickets */
.ticket-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: 32px 24px;
    align-items: start;
}

.chat {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 60vh;
    overflow-y: auto;
    padding: 12px;
    border: 2px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface-2);
}

.bubble {
    max-width: 80%;
    padding: 8px 12px;
    border: 2px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface);
}

.bubble--in {
    align-self: flex-start;
    border-bottom-left-radius: 2px;
}

.bubble--out {
    align-self: flex-end;
    border-bottom-right-radius: 2px;
    background: var(--accent-soft);
}

.bubble-meta {
    font-family: var(--mono);
    font-size: 11px;
    color: var(--ink-soft);
}

.bubble-text {
    margin-top: 4px;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.bubble-img {
    display: block;
    max-width: 100%;
    max-height: 320px;
    margin-top: 6px;
    border-radius: 4px;
}

.bubble-file {
    display: inline-block;
    margin-top: 6px;
}

.chat-system {
    align-self: center;
    font-family: var(--mono);
    font-size: 11px;
    color: var(--ink-soft);
}

@media (max-width: 900px) {
    .ticket-layout {
        grid-template-columns: 1fr;
    }

    .bubble {
        max-width: 92%;
    }
}

/* Tables turn into cards on phones */
@media (max-width: 720px) {
    .table--cards thead {
        display: none;
    }

    .table--cards,
    .table--cards tbody,
    .table--cards tr,
    .table--cards td {
        display: block;
        width: 100%;
    }

    .table--cards tr {
        margin-bottom: 12px;
        padding: 10px 12px;
        border: 2px solid var(--line);
        border-radius: var(--radius-sm);
        background: var(--surface);
    }

    .table--cards tr:hover td {
        background: none;
    }

    .table--cards td {
        display: flex;
        justify-content: space-between;
        align-items: baseline;
        gap: 12px;
        padding: 4px 0;
        border: 0;
        text-align: right;
    }

    .table--cards td::before {
        content: attr(data-label);
        flex: none;
        color: var(--ink-soft);
        font-family: var(--mono);
        font-size: 12px;
        text-align: left;
    }

    .table--cards td:first-child {
        padding-bottom: 8px;
        margin-bottom: 4px;
        border-bottom: 1px solid var(--line-soft);
        font-size: 16px;
    }

    .table--cards td:first-child::before {
        content: none;
    }

    .table--cards td[colspan] {
        display: block;
        text-align: left;
    }

    .table--cards td[colspan]::before {
        content: none;
    }

    .table-wrap {
        margin: 0;
        overflow: visible;
    }

    .timeline li {
        grid-template-columns: 1fr;
        gap: 2px;
    }

    .action-bar .btn,
    .action-bar form {
        width: 100%;
    }

    .right {
        text-align: left;
    }
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

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

@media (max-width: 560px) {
    body {
        font-size: 15px;
    }

    .desktop {
        padding: 24px 12px 40px;
    }

    .window {
        padding: 0 16px 18px;
        box-shadow: 4px 4px 0 var(--shadow-color);
    }

    .window-title {
        margin: 0 -16px 16px;
    }

    .display {
        font-size: 24px;
    }

    .prose {
        font-size: 14px;
    }

    .hero {
        gap: 12px;
    }

    .hero-mascot {
        height: 84px;
    }

    .window--peek {
        margin-top: 70px;
    }

    .window--peek > .peek {
        --peek-h: 72px;
        right: 16px;
    }

    .window--sit {
        margin-top: 84px;
    }

    .window--sit > .peek {
        --peek-h: 88px;
        right: 16px;
    }

    .grid-2 {
        grid-template-columns: 1fr;
    }

    .menubar {
        gap: 0;
        padding: 6px 4px;
        font-size: 12px;
    }

    .menubar a {
        padding: 6px 5px;
    }

    .lang-switch {
        margin-left: 2px;
    }

    /* On phones the brand is just its logo: the menu needs the room. */
    .menubar .brand {
        margin-right: 2px;
        gap: 0;
    }

    .menubar .brand-name {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0 0 0 0);
        white-space: nowrap;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation: none !important;
        transition: none !important;
    }
}
