/* Palette: night-blue base (GTA night city), signage red for actions,
   money green only on amounts, amber for anything waiting on someone. */
:root {
  --bg: #0e1524;
  --bg-2: #141d30;
  --bg-3: #1b263d;
  --bg-4: #22304b;
  --line: #243251;
  --line-2: #33456a;
  --text: #edf1f8;
  --muted: #8d9bb8;
  --red: #e5383b;
  --red-2: #ff5256;
  --red-ink: #fff;
  --money: #3ddc84;
  --amber: #f2b440;
  --paper: #f4f6fa;
  --ink: #1a2233;
  --ink-2: #5b6780;
  --radius: 10px;
  --radius-s: 7px;
  --font: "Barlow", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --cond: "Barlow Condensed", "Barlow", system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --shadow: 0 10px 30px -12px rgba(3, 8, 20, .7);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; color: var(--text); font: 15px/1.45 var(--font);
  background: radial-gradient(1200px 500px at 20% -10%, #1a2848 0%, transparent 60%), var(--bg);
  background-attachment: fixed; min-height: 100vh;
}
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--red-2); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

input, select, textarea {
  background: var(--bg); border: 1px solid var(--line-2); border-radius: var(--radius-s);
  padding: 8px 11px; min-width: 0; outline: none; transition: border-color .12s, box-shadow .12s;
}
input:focus, select:focus, textarea:focus { border-color: var(--red); box-shadow: 0 0 0 3px rgba(229, 56, 59, .18); }
input::placeholder, textarea::placeholder { color: #5e6d8c; }
textarea { resize: vertical; width: 100%; }
input[type=number]::-webkit-inner-spin-button { -webkit-appearance: none; }
input[type=number] { -moz-appearance: textfield; }
input[type=date], input[type=time], select { color-scheme: dark; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  background: var(--bg-3); border: 1px solid var(--line-2); border-radius: var(--radius-s);
  padding: 8px 15px; cursor: pointer; white-space: nowrap; font-weight: 600;
  transition: background .12s, border-color .12s, transform .08s;
}
.btn:hover { background: var(--bg-4); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .6; cursor: progress; }
.btn.primary { background: var(--red); border-color: var(--red); color: var(--red-ink); box-shadow: 0 6px 18px -8px rgba(229, 56, 59, .8); }
.btn.primary:hover { background: var(--red-2); border-color: var(--red-2); }
.btn.ghost { background: transparent; }
.btn.danger { color: #ff8a8c; }
.btn.danger:hover { border-color: var(--red); background: rgba(229, 56, 59, .1); }
.btn.small { padding: 5px 11px; font-size: 13.5px; }
.btn.block { width: 100%; padding: 12px; font: 700 18px/1 var(--cond); letter-spacing: .3px; }
.link { background: none; border: 0; color: var(--muted); cursor: pointer; padding: 0; font-weight: 500; }
.link:hover { color: var(--text); }
.link.accent { color: var(--red-2); font-size: 13.5px; }
.link.accent:hover { color: #ff8a8c; }

.muted { color: var(--muted); }
.small { font-size: 13px; }
.empty { color: var(--muted); padding: 14px 0; margin: 0; }
.error { color: #ff8a8c; margin: 0; }
em { color: var(--red-2); font-style: normal; }
code { font-family: var(--mono); font-size: 12.5px; background: var(--bg-3); padding: 1px 5px; border-radius: 4px; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 18px;
  height: 60px; padding: 0 20px; background: rgba(14, 21, 36, .88); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 9px; text-decoration: none; font: 700 22px/1 var(--cond); letter-spacing: .2px; white-space: nowrap; }
.brand .logo { width: 24px; height: 24px; color: var(--red); }
.tag { font: 700 12px/1 var(--font); color: var(--red-ink); background: var(--red); padding: 3px 7px; border-radius: 5px; margin-left: 2px; }
.topbar nav { display: flex; gap: 2px; }
.topbar nav a { text-decoration: none; color: var(--muted); padding: 7px 11px; border-radius: var(--radius-s); font-weight: 500; }
.topbar nav a:hover { color: var(--text); background: var(--bg-3); }
.topbar .search { flex: 1; max-width: 480px; position: relative; }
.topbar .search input { width: 100%; padding-left: 36px; background: var(--bg-2); border-color: var(--line); border-radius: 999px; }
.topbar .search::before {
  content: ""; position: absolute; left: 13px; top: 50%; width: 14px; height: 14px; transform: translateY(-50%);
  background: var(--muted);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.5' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-4-4'/%3E%3C/svg%3E") center / contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.5' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-4-4'/%3E%3C/svg%3E") center / contain no-repeat;
}
.user { display: flex; align-items: center; gap: 9px; margin-left: auto; font-weight: 600; white-space: nowrap; }
.avatar {
  width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--red), #9b1d2a); color: #fff; font: 700 16px/1 var(--cond);
  box-shadow: 0 0 0 2px var(--bg), 0 0 0 3px var(--line-2);
}
.user + nav { margin-left: 0; }
.topbar nav.tabs { margin-left: 12px; height: 100%; align-items: stretch; }
.topbar nav.tabs a { display: flex; align-items: center; gap: 6px; border-radius: 0; padding: 0 12px; border-bottom: 2px solid transparent; }
.topbar nav.tabs a:hover { background: transparent; }
.topbar nav.tabs a.on { color: var(--text); border-bottom-color: var(--red); }
.topbar nav.tabs + nav { margin-left: auto; }

/* ---------- tool layout ---------- */
.layout { display: grid; grid-template-columns: 1fr 390px; align-items: start; }
main { padding: 20px 24px 40px; min-width: 0; }
.panel { position: sticky; top: 60px; height: calc(100vh - 60px); border-left: 1px solid var(--line); background: rgba(20, 29, 48, .7); }
.panel-inner { height: 100%; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 16px; }

.chips, .filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 22px; }
.chip {
  display: inline-flex; align-items: center; gap: 7px; text-decoration: none;
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 999px;
  padding: 6px 14px; cursor: pointer; color: var(--muted); font-weight: 600; font-size: 14px;
  transition: color .12s, border-color .12s, background .12s;
}
.chip:hover { color: var(--text); border-color: var(--line-2); }
.chip.on { color: #fff; background: var(--red); border-color: var(--red); }
.chip span { background: var(--bg-4); color: var(--text); border-radius: 999px; padding: 0 7px; font-size: 12px; line-height: 19px; }
.chip.on span { background: rgba(255, 255, 255, .22); color: #fff; }

main section { margin-bottom: 34px; }
main h3 { display: flex; align-items: baseline; gap: 10px; font: 700 26px/1 var(--cond); margin: 0 0 14px; letter-spacing: .2px; }
main h3 small { font: 600 14px var(--font); color: var(--muted); }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 14px; }
.card {
  position: relative; background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius);
  display: flex; flex-direction: column; overflow: hidden; transition: border-color .15s, transform .15s, box-shadow .15s;
}
.card:hover { border-color: var(--line-2); transform: translateY(-2px); box-shadow: var(--shadow); }
.card.sel { border-color: var(--red); box-shadow: 0 0 0 1px var(--red), 0 12px 28px -14px rgba(229, 56, 59, .7); }
.card-hit { all: unset; cursor: pointer; display: flex; flex-direction: column; flex: 1; }
.card-hit:focus-visible { outline: 2px solid var(--red-2); outline-offset: -2px; }
.card img, .card .noimg { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; background: #070b14; display: block; }
.card .name { padding: 10px 12px 0; font-weight: 600; font-size: 14.5px; line-height: 1.25; }
.card .price { padding: 3px 12px 10px; color: var(--money); font: 700 20px/1.1 var(--cond); font-variant-numeric: tabular-nums; }
.stepper { display: grid; grid-template-columns: 36px 1fr 36px; border-top: 1px solid var(--line); background: rgba(0, 0, 0, .15); }
.stepper button { background: none; border: 0; cursor: pointer; height: 34px; color: var(--muted); font-size: 18px; transition: color .1s, background .1s; }
.stepper button:hover { color: #fff; background: var(--bg-4); }
.stepper button:last-child:hover { background: var(--red); }
.stepper input { border: 0; border-radius: 0; background: transparent; text-align: center; padding: 0; font: 700 17px var(--cond); box-shadow: none; }
.card.sel .stepper input { color: #fff; }
.card.sel .stepper { background: rgba(229, 56, 59, .14); border-top-color: rgba(229, 56, 59, .4); }

/* ---------- receipt (récap) ---------- */
.receipt {
  position: relative; background: var(--paper); color: var(--ink); border-radius: 8px 8px 0 0;
  padding: 18px 18px 26px; filter: drop-shadow(0 14px 22px rgba(0, 0, 0, .45));
  --tooth: 8px;
  -webkit-mask: linear-gradient(#000 0 0) top / 100% calc(100% - var(--tooth)) no-repeat,
                conic-gradient(from -45deg at bottom, #0000, #000 1deg 89deg, #0000 90deg) bottom / calc(var(--tooth) * 2) var(--tooth) repeat-x;
          mask: linear-gradient(#000 0 0) top / 100% calc(100% - var(--tooth)) no-repeat,
                conic-gradient(from -45deg at bottom, #0000, #000 1deg 89deg, #0000 90deg) bottom / calc(var(--tooth) * 2) var(--tooth) repeat-x;
}
.receipt-head { display: flex; justify-content: space-between; align-items: flex-start; padding-bottom: 12px; border-bottom: 2px dashed #cfd5e1; }
.receipt h2 { font: 700 24px/1 var(--cond); margin: 0 0 5px; }
.receipt-meta { font-size: 13px; color: var(--ink-2); }
.receipt-meta strong { color: var(--ink); font-family: var(--cond); font-size: 15px; }
.receipt .link { color: var(--ink-2); font-size: 13.5px; }
.receipt .link:hover { color: var(--red); }
.recap { display: flex; flex-direction: column; gap: 1px; padding: 10px 0; }
.recap .empty { color: var(--ink-2); padding: 18px 0; text-align: center; }
.recap-cat { font: 700 15px var(--cond); color: var(--red); margin-top: 10px; }
.recap-cat:first-child { margin-top: 0; }
.recap-line { display: grid; grid-template-columns: auto 1fr auto 18px; gap: 8px; align-items: baseline; padding: 3px 0; font-variant-numeric: tabular-nums; font-size: 14.5px; }
.recap-line .q { color: var(--ink-2); font-weight: 600; }
.recap-line .n { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recap-line .t { font-weight: 600; }
.recap-line .x { background: none; border: 0; color: #a3adc2; cursor: pointer; font-size: 17px; line-height: 1; padding: 0; }
.recap-line .x:hover { color: var(--red); }
.total { display: flex; justify-content: space-between; align-items: baseline; padding-top: 12px; border-top: 2px dashed #cfd5e1; }
.total span { font-weight: 600; color: var(--ink-2); }
.total strong { font: 700 38px/1 var(--cond); color: var(--ink); font-variant-numeric: tabular-nums; letter-spacing: -.3px; }
.receipt-foot { margin-top: 10px; font-size: 12.5px; color: var(--ink-2); text-align: center; }

.panel #copy { position: sticky; bottom: 0; z-index: 2; box-shadow: 0 -14px 20px 4px #121a2c, 0 6px 18px -8px rgba(229, 56, 59, .8); }
@media (max-width: 1000px) { .panel #copy { position: static; box-shadow: none; } }
.fields { display: flex; flex-direction: column; gap: 12px; }
.fields label, label.stack, .field { display: flex; flex-direction: column; gap: 5px; font-size: 13.5px; font-weight: 600; color: var(--muted); }
.fields input, .fields textarea, .fields select { color: var(--text); font-size: 15px; font-weight: 400; background: var(--bg); }
.field-head { display: flex; justify-content: space-between; align-items: baseline; }

.preview summary { cursor: pointer; color: var(--muted); font-size: 14px; font-weight: 500; }
.preview summary:hover { color: var(--text); }
.preview pre {
  white-space: pre-wrap; word-break: break-word; font: 12px/1.55 var(--mono); background: var(--bg);
  border: 1px solid var(--line); border-radius: var(--radius-s); padding: 12px; margin: 10px 0 0; max-height: 360px; overflow: auto;
}

.mobile-bar { display: none; }
.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: var(--money); color: #06220f; padding: 10px 18px; border-radius: 999px; font-weight: 700;
  box-shadow: var(--shadow); transition: opacity .18s, transform .18s; z-index: 50; max-width: calc(100vw - 32px); text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.err { background: var(--red); color: #fff; }

/* ---------- lock screen ---------- */
body.lock { display: grid; place-items: center; padding: 16px; }
.lock-box {
  width: 100%; max-width: 380px; text-align: center; display: flex; flex-direction: column; gap: 16px; align-items: stretch;
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 16px; padding: 34px 28px 28px; box-shadow: var(--shadow);
}
.lock-logo { width: 54px; height: 54px; margin: 0 auto 2px; border-radius: 14px; display: grid; place-items: center; background: var(--red); color: #fff; box-shadow: 0 10px 26px -10px rgba(229, 56, 59, .9); }
.lock-logo .logo { width: 30px; height: 30px; }
.lock-box h1 { font: 700 32px/1 var(--cond); margin: 0; }
.lock-box p { margin: 0; }
.pin { display: flex; gap: 8px; justify-content: center; margin: 6px 0 4px; }
.pin input { width: 54px; height: 64px; text-align: center; font: 700 32px var(--cond); padding: 0; background: var(--bg); border-radius: 10px; }
.pin[data-digits="6"] input { width: 46px; height: 58px; font-size: 28px; }
.lock-box a { text-decoration: none; }
.lock-box a:hover { color: var(--text); }

/* ---------- admin ---------- */
.wrap { max-width: 1300px; margin: 0 auto; padding: 24px 20px 60px; }
.box { background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; margin-bottom: 18px; }
.box h2 { font: 700 24px/1 var(--cond); margin: 0 0 14px; }
.box h2 small { font: 600 14px var(--font); }
.flash { padding: 11px 16px; border-radius: var(--radius-s); margin-bottom: 18px; border: 1px solid; font-weight: 600; }
.flash.ok { border-color: rgba(61, 220, 132, .35); background: rgba(61, 220, 132, .1); color: #8ef0b8; }
.flash.err { border-color: rgba(229, 56, 59, .45); background: rgba(229, 56, 59, .12); color: #ffa3a5; }
.row-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.row-form input:not([type=file]) { flex: 1 1 160px; }
.row-form input.narrow { flex: 0 0 70px; }
.row-form input.narrow-date { flex: 0 0 auto; }
.row-form input[type=file] { flex: 1 1 200px; padding: 6px; font-size: 13px; }
.filters .grow { flex: 1 1 200px; border-radius: 999px; padding: 6px 14px; background: var(--bg-2); border-color: var(--line); }
.acts { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.acts.end { justify-content: flex-end; }
.badge { display: inline-block; min-width: 19px; padding: 0 6px; border-radius: 999px; background: var(--red); color: #fff; font-size: 11.5px; font-weight: 700; line-height: 19px; text-align: center; }

.item-rows { display: flex; flex-direction: column; gap: 8px; }
.item-row {
  display: grid; grid-template-columns: 80px minmax(0, 2fr) 120px minmax(0, 1fr) auto; gap: 10px; align-items: center;
  background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 7px;
}
.item-row:target { border-color: var(--red); }
.item-row.dirty, .cat-row.dirty { border-color: var(--amber); }
.thumb {
  width: 80px; height: 50px; border-radius: 6px; overflow: hidden; background: #070b14; cursor: pointer;
  display: grid; place-items: center; font-size: 11px; color: var(--muted); border: 1px dashed transparent;
}
.thumb:hover { border-color: var(--line-2); }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.price-in { position: relative; }
.price-in input { width: 100%; padding-right: 24px; text-align: right; font: 700 17px var(--cond); color: var(--money); }
.price-in span { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); color: var(--muted); }

.cat-head, .cat-row { display: grid; grid-template-columns: 70px 1fr 1fr auto; gap: 8px; align-items: center; }
.cat-head { font-size: 13px; font-weight: 600; color: var(--muted); padding: 0 1px 6px; }
.cat-row { padding: 4px 0; border: 1px solid transparent; border-radius: var(--radius-s); }

.table-wrap { overflow-x: auto; }
table.codes { width: 100%; border-collapse: collapse; }
.codes th { text-align: left; font-weight: 600; color: var(--muted); font-size: 13px; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.codes td { padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.codes tbody tr:hover td { background: rgba(255, 255, 255, .015); }
.codes tr.off td { opacity: .5; }
.codes tr.off td:last-child { opacity: 1; }
.codes td input { width: 100%; min-width: 140px; background: transparent; border-color: transparent; }
.codes td input:hover, .codes td input:focus { border-color: var(--line-2); }
form.inline { display: flex; gap: 6px; margin: 0; }
.code {
  font: 700 18px var(--cond); letter-spacing: 3px; background: var(--bg); border: 1px solid var(--line-2);
  border-radius: 6px; padding: 3px 10px; cursor: copy;
}
.code:hover { border-color: var(--red); }
.code.big { font-size: 30px; padding: 8px 18px; letter-spacing: 6px; }
.new-codes { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.status { display: inline-block; font-size: 12.5px; font-weight: 700; color: var(--muted); padding: 2px 9px; border-radius: 999px; background: var(--bg-3); }
.status.ok { color: var(--money); background: rgba(61, 220, 132, .12); }
.status.warn { color: var(--amber); background: rgba(242, 180, 64, .12); }
.status.bad { color: #ff8a8c; background: rgba(229, 56, 59, .14); }
textarea.mono { font: 12.5px/1.55 var(--mono); }
.box .acts { margin-top: 14px; }
.box label.stack + label.stack, .box p + label.stack { margin-top: 14px; }

/* refunds */
.refunds { display: flex; flex-direction: column; gap: 8px; }
.refund { background: var(--bg-2); border: 1px solid var(--line); border-left: 3px solid var(--amber); border-radius: var(--radius); overflow: hidden; }
.refund.done { border-left-color: var(--money); opacity: .7; }
.refund[open] { border-color: var(--line-2); border-left-color: var(--red); opacity: 1; box-shadow: var(--shadow); }
.refund summary {
  list-style: none; cursor: pointer; display: grid; align-items: center; gap: 14px; padding: 12px 16px;
  grid-template-columns: 96px minmax(0, 1.4fr) minmax(0, 1.2fr) minmax(0, 1fr) 90px 90px;
}
.refund summary::-webkit-details-marker { display: none; }
.refund summary:hover { background: var(--bg-3); }
.refund .ticket { font: 700 20px var(--cond); }
.refund .who { display: flex; flex-direction: column; min-width: 0; }
.refund .who > * { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.refund .amount { color: var(--money); text-align: right; font: 700 22px var(--cond); font-variant-numeric: tabular-nums; }
.refund summary > .status { justify-self: end; }
.refund-body { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; padding: 4px 16px 16px; border-top: 1px solid var(--line); }
.refund-body > div { min-width: 0; padding-top: 12px; }
.refund-body a { color: var(--red-2); word-break: break-all; }
table.lines { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.lines td { padding: 6px 8px 6px 0; border-bottom: 1px solid var(--line); }
.lines td.num { text-align: right; font-weight: 600; }
.lines tr.sum td { border-bottom: 0; font: 700 20px var(--cond); padding-top: 10px; }
.lines tr.sum td.num { color: var(--money); }
pre.msg { white-space: pre-wrap; word-break: break-word; font: 12px/1.55 var(--mono); background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius-s); padding: 12px; margin: 0 0 12px; max-height: 280px; overflow: auto; }

/* crashes */
.crashes td { vertical-align: middle; }
.crashes td.edit-cell form { align-items: center; }
.crashes td.edit-cell input { min-width: 0; background: var(--bg); border-color: var(--line); }
.crashes td.edit-cell input.url { min-width: 180px; flex: 1; }
.crashes td.acts { display: table-cell; }
.crashes td.acts .btn { margin: 2px 0; }

/* dialog */
dialog { background: var(--bg-2); color: var(--text); border: 1px solid var(--line-2); border-radius: 14px; padding: 24px; width: min(460px, calc(100vw - 32px)); box-shadow: var(--shadow); }
dialog::backdrop { background: rgba(5, 9, 18, .7); backdrop-filter: blur(3px); }
dialog h2 { font: 700 26px/1 var(--cond); margin: 0 0 4px; }
dialog form { display: flex; flex-direction: column; gap: 14px; }
dialog label { display: flex; flex-direction: column; gap: 5px; font-size: 13.5px; font-weight: 600; color: var(--muted); }
dialog input { color: var(--text); font-size: 15px; font-weight: 400; }
dialog p { margin: 0; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* ---------- responsive ---------- */
@media (max-width: 1000px) {
  .layout { grid-template-columns: 1fr; }
  .panel { position: static; height: auto; border-left: 0; border-top: 1px solid var(--line); }
  .panel-inner { overflow: visible; padding-bottom: 90px; max-width: 560px; margin: 0 auto; }
  .mobile-bar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: flex; align-items: center; gap: 12px;
    padding: 10px 16px; background: rgba(20, 29, 48, .96); backdrop-filter: blur(8px); border-top: 1px solid var(--line);
    transform: translateY(100%); transition: transform .18s;
  }
  .mobile-bar.show { transform: none; }
  .mobile-bar span { color: var(--muted); font-weight: 600; }
  .mobile-bar strong { color: var(--money); margin-left: auto; font: 700 24px var(--cond); }
  .mobile-bar a { background: var(--red); color: #fff; text-decoration: none; font-weight: 700; padding: 7px 16px; border-radius: var(--radius-s); }
}
@media (max-width: 900px) {
  main { padding: 16px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
  main h3 { font-size: 22px; }
  .topbar { flex-wrap: wrap; height: auto; padding: 10px 16px; row-gap: 10px; gap: 12px; }
  .topbar .search { order: 3; flex-basis: 100%; max-width: none; }
  .user-name { max-width: 110px; overflow: hidden; text-overflow: ellipsis; }
  .topbar nav a { padding: 7px 8px; }
  body.admin .topbar nav.tabs { order: 3; flex-basis: 100%; margin: 0 -16px; padding: 0 8px; overflow-x: auto; height: 40px; flex-wrap: nowrap; }
  .topbar nav.tabs a { white-space: nowrap; }
  .panel { top: auto; }
  .item-row { grid-template-columns: 80px 1fr 110px; }
  .item-row select { grid-column: 1 / 3; }
  .item-row .acts { grid-column: 3; justify-content: flex-end; }
  .cat-head { display: none; }
  .cat-row { grid-template-columns: 60px 1fr; }
  .cat-row .acts { grid-column: 1 / -1; }
  .refund summary { grid-template-columns: auto 1fr auto; row-gap: 4px; }
  .refund summary > :nth-child(3), .refund summary > :nth-child(4) { grid-column: 1 / -1; }
  .refund summary > :nth-child(3) { order: 5; }
  .refund summary > :nth-child(4) { order: 6; }
  .refund summary > .status { display: none; }
  .refund-body { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  body.tool .brand span { display: none; }
  body.tool .brand .logo { width: 28px; height: 28px; }
}

/* ---------- profile ---------- */
.user { text-decoration: none; padding: 4px 10px 4px 4px; border-radius: 999px; transition: background .12s; }
.user:hover { background: var(--bg-3); }
img.avatar { object-fit: cover; padding: 0; }
.avatar.sm { width: 28px; height: 28px; font-size: 14px; flex: none; }
.avatar.xl { width: 104px; height: 104px; font-size: 48px; box-shadow: 0 0 0 4px var(--bg-2), 0 0 0 5px var(--line-2); }
.author { display: flex; align-items: center; gap: 9px; min-width: 0; }
.wrap.narrow { max-width: 980px; }
.profile-card {
  display: grid; grid-template-columns: auto 1fr auto; gap: 24px; align-items: center;
  background: linear-gradient(120deg, #1d2a47 0%, var(--bg-2) 55%); border: 1px solid var(--line);
  border-radius: 14px; padding: 26px; margin-bottom: 30px; box-shadow: var(--shadow);
}
.avatar-edit { position: relative; display: block; cursor: pointer; border-radius: 50%; }
.avatar-overlay {
  position: absolute; inset: 0; border-radius: 50%; display: grid; place-items: center;
  background: rgba(8, 12, 22, .6); color: #fff; font-weight: 700; opacity: 0; transition: opacity .15s;
}
.avatar-edit:hover .avatar-overlay, .avatar-edit:focus-within .avatar-overlay { opacity: 1; }
.profile-id h1 { font: 700 38px/1 var(--cond); margin: 0 0 4px; }
.profile-id p { margin: 0 0 12px; }
.profile-id form { margin: 0; }
.stats { display: flex; gap: 10px; margin: 0; }
.stats div { background: rgba(14, 21, 36, .6); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 16px; min-width: 110px; }
.stats dt { font-size: 13px; font-weight: 600; color: var(--muted); }
.stats dd { margin: 4px 0 0; font: 700 30px/1 var(--cond); }
.stats dd small { font-size: 18px; color: var(--muted); }
.stats dd.money { color: var(--money); }
.section-title { font: 700 28px/1 var(--cond); margin: 0 0 14px; }
.empty-state { text-align: center; padding: 36px 20px; border: 2px dashed var(--line); border-radius: 14px; }
.empty-state p { margin: 0 0 6px; font-weight: 600; }
.empty-state .btn { margin-top: 12px; text-decoration: none; }
.refund summary.mine { grid-template-columns: 100px minmax(0, 1fr) 100px 100px; }
@media (max-width: 900px) {
  .profile-card { grid-template-columns: auto 1fr; padding: 20px; gap: 18px; }
  .avatar.xl { width: 80px; height: 80px; font-size: 38px; }
  .profile-id h1 { font-size: 30px; }
  .stats { grid-column: 1 / -1; }
  .stats div { flex: 1; min-width: 0; padding: 10px 12px; }
  .stats dd { font-size: 24px; }
  .refund summary.mine { grid-template-columns: auto 1fr auto; }
  .refund summary.mine > .status { display: none; }
  body.profile .brand span { display: none; }
}
@media (max-width: 480px) {
  .stats { gap: 6px; }
  .stats dt { font-size: 11.5px; overflow-wrap: anywhere; }
}

/* ---------- collapsible categories ---------- */
.list-tools { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 14px; font-size: 14px; }
.list-tools .link { color: var(--red-2); font-weight: 600; }
.list-tools .link:hover { color: #ff8a8c; }
main section.cat { margin-bottom: 10px; background: var(--bg-2); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; transition: border-color .15s; }
main section.cat:hover { border-color: var(--line-2); }
main section.cat.open { border-color: var(--line-2); }
.cat-head {
  all: unset; box-sizing: border-box; width: 100%; cursor: pointer; display: grid; align-items: center; gap: 16px;
  grid-template-columns: auto 1fr auto 24px; padding: 12px 16px;
}
.cat-head:focus-visible { outline: 2px solid var(--red-2); outline-offset: -2px; border-radius: 12px; }
.cat-thumbs { display: flex; }
.cat-thumbs img {
  width: 44px; height: 44px; object-fit: cover; border-radius: 9px; background: #070b14;
  border: 2px solid var(--bg-2); margin-left: -14px; box-shadow: 0 4px 10px -4px rgba(0, 0, 0, .6);
}
.cat-thumbs img:first-child { margin-left: 0; }
.cat-title { display: flex; flex-direction: column; min-width: 0; }
.cat-title strong { font: 700 26px/1.05 var(--cond); }
.cat-title small { color: var(--muted); font-size: 13.5px; font-weight: 500; }
.cat-sel { display: inline-block; background: rgba(229, 56, 59, .15); color: #ff9a9c; border: 1px solid rgba(229, 56, 59, .4); border-radius: 999px; padding: 4px 11px; font-size: 13.5px; font-weight: 700; white-space: nowrap; }
.chev { width: 24px; height: 24px; color: var(--muted); transition: transform .2s; }
.cat-head:hover .chev { color: var(--text); }
.cat.open .chev { transform: rotate(180deg); color: var(--red-2); }
.cat.open .cat-head { border-bottom: 1px solid var(--line); background: rgba(255, 255, 255, .015); }
section.cat > .grid { padding: 16px; animation: unfold .2s ease-out; }
@keyframes unfold { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
@media (max-width: 900px) {
  .cat-head { grid-template-columns: auto 1fr 20px; gap: 12px; padding: 10px 12px; }
  .cat-sum { grid-column: 1 / -1; order: 4; }
  .cat-sum:empty { display: none; }
  .cat-thumbs img { width: 36px; height: 36px; margin-left: -12px; }
  .cat-title strong { font-size: 22px; }
  section.cat > .grid { padding: 10px; }
}
.pin input[type=password] { font-family: var(--font); font-size: 44px; letter-spacing: 0; -webkit-text-security: disc; }
.pin input[type=password]::-ms-reveal { display: none; }
