:root {
  --bg: #f5f5f6;
  --card: #ffffff;
  --text: #1d1e21;
  --muted: #6b6e76;
  --line: #e3e4e8;
  --accent: #e35205;
  --accent-hover: #c44604;
  --accent-soft: #fdeee6;
  --ok: #1f7a46;
  --ok-soft: #e5f4ec;
  --bad: #b3261e;
  --bad-soft: #fbe9e8;
  --warn: #8a5a00;
  --warn-soft: #fdf3dc;
  --side: #2b2c2f;
  --side-text: #d9dadd;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #18191b;
    --card: #222326;
    --text: #e8e9eb;
    --muted: #9a9ca3;
    --line: #34363a;
    --accent-soft: #3a2316;
    --ok: #5cc48a;
    --ok-soft: #173325;
    --bad: #f08a83;
    --bad-soft: #3b1d1b;
    --warn: #e6b450;
    --warn-soft: #3a2f16;
    --side: #111214;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 22px; margin: 0 0 4px; }
h2 { font-size: 16px; margin: 0 0 12px; }
.sub { color: var(--muted); margin: 0 0 20px; }
.muted { color: var(--muted); }
.mono { font-family: Consolas, "Cascadia Mono", monospace; }

/* Layout */
.shell { display: flex; min-height: 100vh; }
.side {
  width: 220px;
  flex: none;
  background: var(--side);
  color: var(--side-text);
  padding: 20px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px 20px; color: #fff; font-weight: 600; }
.brand img { width: 30px; height: 30px; }
.side a {
  color: var(--side-text);
  padding: 8px 12px;
  border-radius: 8px;
  text-decoration: none;
}
.side a:hover { background: rgba(255, 255, 255, 0.07); }
.side a.on { background: var(--accent); color: #fff; }
.side .grow { flex: 1; }
.side .who { font-size: 13px; padding: 8px 12px; color: #9a9ca3; }
.side form button {
  width: 100%;
  text-align: left;
  background: none;
  border: 0;
  color: var(--side-text);
  padding: 8px 12px;
  border-radius: 8px;
  font: inherit;
  cursor: pointer;
}
.side form button:hover { background: rgba(255, 255, 255, 0.07); }
main { flex: 1; min-width: 0; padding: 28px 32px 48px; max-width: 1280px; }

@media (max-width: 800px) {
  .shell { flex-direction: column; }
  .side { width: auto; flex-direction: row; flex-wrap: wrap; padding: 12px; }
  .brand { padding: 0 8px 0 0; width: 100%; margin-bottom: 8px; }
  .side .grow, .side .who { display: none; }
  main { padding: 20px 16px 40px; }
}

/* Cards and grids */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 18px 20px;
  margin-bottom: 20px;
}
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; }
.stat .label { color: var(--muted); font-size: 13px; }
.stat .value { font-size: 26px; font-weight: 600; font-variant-numeric: tabular-nums; }
.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 20px; }
.cols .card { margin-bottom: 0; }

/* Tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th {
  text-align: left;
  font-weight: 600;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
td.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
td.nowrap { white-space: nowrap; }
.empty { color: var(--muted); padding: 14px 10px; }

/* Badges */
.badge {
  display: inline-block;
  padding: 1px 9px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.neutral { background: var(--line); color: var(--muted); }
.badge.accent { background: var(--accent-soft); color: var(--accent); }

/* Messages */
.msg { padding: 10px 14px; border-radius: 10px; margin-bottom: 18px; }
.msg.ok { background: var(--ok-soft); color: var(--ok); }
.msg.bad { background: var(--bad-soft); color: var(--bad); }

/* Forms */
label { display: block; font-size: 13px; font-weight: 600; margin: 12px 0 4px; }
input[type=text], input[type=password], input[type=date], select {
  width: 100%;
  max-width: 420px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
  color: var(--text);
  font: inherit;
}
input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.hint { color: var(--muted); font-size: 13px; margin-top: 4px; }
.btn {
  display: inline-block;
  border: 1px solid transparent;
  background: var(--accent);
  color: #fff;
  border-radius: 8px;
  padding: 8px 16px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}
.btn:hover { background: var(--accent-hover); text-decoration: none; }
.btn.light { background: var(--card); color: var(--text); border-color: var(--line); }
.btn.light:hover { background: var(--bg); }
.btn.danger { background: var(--card); color: var(--bad); border-color: var(--line); }
.btn.danger:hover { background: var(--bad-soft); }
.btn.small { padding: 4px 10px; font-size: 13px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.actions form { margin: 0; }
.inline { display: inline; margin: 0; }
.filters { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.filters label { margin-top: 0; }
.filters input, .filters select { width: 180px; }
.head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: 12px; }

/* Login pages */
.center { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px 16px; }
.box { width: 100%; max-width: 400px; }
.box .brand { color: var(--text); justify-content: center; padding-bottom: 18px; font-size: 18px; }
.box .brand img { width: 40px; height: 40px; }
.box input[type=text], .box input[type=password] { max-width: none; }
.box .btn { width: 100%; margin-top: 18px; }
.qr { background: #fff; padding: 10px; border-radius: 10px; width: 220px; margin: 8px auto; }
.qr svg { width: 200px; height: 200px; display: block; }
.secret { font-family: Consolas, monospace; font-size: 15px; letter-spacing: 0.05em; text-align: center; word-break: break-all; }
.centered { text-align: center; }

/* Public download page */
.dl { width: 100%; max-width: 560px; }
.dl .brand { color: var(--text); justify-content: center; padding-bottom: 18px; font-size: 20px; }
.dl .brand img { width: 44px; height: 44px; }
.dl-card { text-align: center; padding: 28px 24px; }
.dl-card .sub { margin-bottom: 22px; }
.dl-btn { font-size: 17px; padding: 14px 36px; border-radius: 10px; }
.dl-card .hint { margin-top: 12px; }
.steps { margin: 0; padding-left: 20px; }
.steps li { margin: 6px 0; }
.dl-hash { word-break: break-all; }
input[type=file] { font: inherit; color: var(--text); max-width: 420px; }
.code-input { font-size: 22px !important; letter-spacing: 0.3em; text-align: center; }
