:root {
  --bg: #10161c;
  --bg2: #17212b;
  --card: #1c2833;
  --line: #314253;
  --text: #e7eef4;
  --muted: #93a4b5;
  --brass: #e0a45c;
  --brass-2: #8a6230;
  --ok: #3cba8b;
  --danger: #e36d6d;
  --info: #79b4ef;
  --shadow: 0 12px 30px rgba(0, 0, 0, .25);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font: 15px/1.5 "Segoe UI", "Helvetica Neue", sans-serif;
  background:
    radial-gradient(900px 280px at 10% -10%, rgba(224, 164, 92, .16), transparent 60%),
    var(--bg);
  color: var(--text);
}
a { color: var(--brass); text-decoration: none; }
a:hover { text-decoration: underline; }
button, .btn, input, select, textarea {
  font: inherit;
  color: var(--text);
}
button, .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 14px;
  border-radius: 8px;
  border: 1px solid var(--brass-2);
  background: var(--brass);
  color: #1b140c;
  font-weight: 650;
  cursor: pointer;
}
button.ghost, .btn.ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--line);
}
button.danger, .btn.danger { background: var(--danger); border-color: #8d3b3b; color: #1b0d0d; }
button.ghost.danger { background: transparent; color: var(--danger); }
input, select, textarea {
  width: 100%;
  min-height: 42px;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #121a22;
}
textarea { min-height: 90px; }
label { display: flex; flex-direction: column; gap: 6px; color: var(--muted); font-size: 13px; }
label.check { flex-direction: row; align-items: center; color: var(--text); }
label.check input { width: auto; min-height: 0; }
#navtoggle { position: absolute; opacity: 0; pointer-events: none; }
.app { min-height: 100vh; display: flex; }
aside {
  width: 240px;
  flex: none;
  background: rgba(16, 22, 28, .92);
  border-right: 1px solid var(--line);
  padding: 18px 14px;
}
.brand { display: flex; gap: 10px; align-items: center; margin-bottom: 22px; }
.brand.inline { margin-bottom: 16px; }
.brand strong, .brand small { display: block; }
.brand small { color: var(--muted); }
.mark {
  width: 42px; height: 42px; display: grid; place-items: center;
  border-radius: 10px; background: var(--brass); color: #1b140c; font-weight: 800;
}
nav { display: flex; flex-direction: column; gap: 4px; }
nav a { color: var(--muted); padding: 9px 10px; border-radius: 8px; }
nav a.on, nav a:hover { background: var(--bg2); color: var(--text); text-decoration: none; }
.main { flex: 1; min-width: 0; }
header {
  display: flex; gap: 12px; align-items: center; justify-content: flex-end;
  padding: 14px 22px; border-bottom: 1px solid var(--line);
}
.navbtn { display: none; }
.who { color: var(--muted); margin-right: auto; }
.content { padding: 22px; max-width: 1180px; }
h1 { font-size: 28px; line-height: 1.2; margin: 0 0 8px; }
h2 { font-size: 18px; margin: 0 0 12px; }
.lead, .muted { color: var(--muted); }
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
  box-shadow: var(--shadow);
  margin: 14px 0;
}
.stats, .grid2, .fields { display: grid; gap: 12px; }
.stats { grid-template-columns: repeat(4, 1fr); }
.grid2 { grid-template-columns: 1fr 1fr; }
.fields { grid-template-columns: 1fr 1fr; }
.fields .wide { grid-column: 1 / -1; }
.stats article {
  background: var(--card);
  border: 1px solid var(--line);
  border-top: 3px solid var(--brass);
  border-radius: 14px;
  padding: 14px;
}
.stats span, .stats small { display: block; color: var(--muted); }
.stats strong { display: block; font-size: 26px; margin-top: 4px; }
.stats small { margin-top: 4px; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-size: 12px; font-weight: 650; letter-spacing: .04em; text-transform: uppercase; }
td small { display: block; color: var(--muted); }
code, .script { font-family: ui-monospace, "Cascadia Mono", monospace; font-size: 13px; }
code { word-break: break-all; }
.script { width: 100%; background: #101820; }
.pill {
  display: inline-flex; align-items: center; min-height: 24px; padding: 0 8px;
  border-radius: 999px; background: #243140; color: var(--text); font-size: 12px;
}
.pill.active { background: rgba(60, 186, 139, .18); color: var(--ok); }
.pill.inactive, .pill.muted { background: #243140; color: var(--muted); }
.pill.expired, .pill.blocked { background: rgba(227, 109, 109, .16); color: var(--danger); }
.flash { border-radius: 10px; padding: 10px 12px; margin: 10px 0; }
.flash.ok { background: rgba(60, 186, 139, .15); }
.flash.err { background: rgba(227, 109, 109, .15); }
.flash.warn { background: rgba(224, 164, 92, .15); }
.titlebar, .actions, .inline, .filters { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.filters input, .filters select { width: auto; min-width: 160px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.facts { display: grid; grid-template-columns: 140px 1fr; gap: 8px 12px; margin: 0; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; }
.bar { height: 8px; background: #121a22; border-radius: 99px; overflow: hidden; margin: 8px 0; }
.bar span { display: block; height: 100%; background: var(--brass); }
.qr { width: min(280px, 100%); background: white; padding: 8px; border-radius: 8px; }
.login { min-height: calc(100vh - 80px); display: grid; place-items: center; }
.narrow { width: min(420px, 100%); }
.limit { display: flex; justify-content: space-between; gap: 16px; align-items: end; }
.limit form { display: flex; gap: 8px; align-items: end; flex-wrap: wrap; }
.limit form label { width: 140px; }
ul.plain { padding-left: 18px; }
.danger-zone { border-color: #6d3535; }
:focus-visible { outline: 2px solid var(--brass); outline-offset: 2px; }
@media (max-width: 980px) {
  .stats { grid-template-columns: 1fr 1fr; }
  .grid2, .fields, .limit { grid-template-columns: 1fr; display: grid; }
  .limit form, .limit form label { width: 100%; }
}
@media (max-width: 860px) {
  .navbtn { display: inline-flex; }
  aside {
    position: fixed; z-index: 20; inset: 0 auto 0 0; transform: translateX(-105%);
    transition: transform .18s ease; height: 100vh;
  }
  #navtoggle:checked ~ .app aside { transform: none; }
  .content { padding: 16px; }
  header { padding: 12px 16px; }
  table.r, table.r tbody, table.r tr, table.r td { display: block; width: 100%; }
  table.r thead { display: none; }
  table.r tr { border: 1px solid var(--line); border-radius: 12px; margin: 0 0 12px; padding: 8px; }
  table.r td { display: flex; justify-content: space-between; gap: 12px; border: 0; padding: 6px 4px; }
  table.r td::before { content: attr(data-label); color: var(--muted); }
  .facts { grid-template-columns: 1fr; }
}
