:root {
  --bg: #f6f7f9; --card: #fff; --text: #14181f; --muted: #667085; --line: #e4e7ec;
  --brand: #4f46e5; --brand-d: #4338ca; --ok: #067647; --ok-bg: #ecfdf3;
  --err: #b42318; --err-bg: #fef3f2; --bar: #c7d2fe;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #0f1218; --card: #171b24; --text: #eef0f4; --muted: #98a2b3; --line: #262c38;
    --brand: #818cf8; --brand-d: #a5b4fc; --ok: #75e0a7; --ok-bg: #0b2a1c;
    --err: #fda29b; --err-bg: #2d1311; --bar: #3730a3; }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
.wrap { max-width: 980px; margin: 0 auto; padding: 0 16px 48px; }
header.top { display: flex; align-items: center; justify-content: space-between;
  padding: 18px 0; }
header.top .logo { font-weight: 700; font-size: 18px; color: var(--text); }
header.top .logo span { color: var(--brand); }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  padding: 20px; margin-bottom: 18px; }
h1 { font-size: 22px; margin: 0 0 4px; }
h2 { font-size: 15px; margin: 0 0 12px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
label { display: block; font-weight: 600; font-size: 13px; margin-bottom: 6px; }
input[type=text], input[type=password], input[type=url] {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--bg); color: var(--text); font: inherit; }
input:focus { outline: 2px solid var(--brand); outline-offset: -1px; }
.btn { display: inline-block; padding: 10px 16px; border-radius: 8px; border: 1px solid var(--brand);
  background: var(--brand); color: #fff; font: inherit; font-weight: 600; cursor: pointer; }
.btn:hover { background: var(--brand-d); text-decoration: none; }
.btn.ghost { background: transparent; color: var(--text); border-color: var(--line); }
.btn.ghost:hover { background: var(--bg); }
.btn.danger { background: transparent; color: var(--err); border-color: var(--line); }
.btn.danger:hover { background: var(--err-bg); }
.btn.sm { padding: 5px 10px; font-size: 13px; }
.form-grid { display: grid; grid-template-columns: 1fr 260px auto; gap: 12px; align-items: end; }
.prefix { display: flex; align-items: center; border: 1px solid var(--line); border-radius: 8px;
  background: var(--bg); overflow: hidden; }
.prefix span { padding: 0 0 0 12px; color: var(--muted); font-size: 13px; white-space: nowrap; }
.prefix input { border: 0; background: transparent; padding-left: 2px; }
.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 16px; font-size: 14px; }
.flash.success { background: var(--ok-bg); color: var(--ok); }
.flash.error { background: var(--err-bg); color: var(--err); }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .04em;
  color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--line); }
td { padding: 12px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.trunc { max-width: 300px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.actions { display: flex; gap: 6px; justify-content: flex-end; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 18px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 16px; }
.stat b { display: block; font-size: 28px; line-height: 1.2; }
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.bars { display: flex; align-items: flex-end; gap: 4px; height: 120px; }
.bars div { flex: 1; background: var(--bar); border-radius: 4px 4px 0 0; min-height: 2px;
  position: relative; }
.bars-x { display: flex; gap: 4px; font-size: 10px; color: var(--muted); margin-top: 4px; }
.bars-x span { flex: 1; text-align: center; }
.row { display: flex; justify-content: space-between; gap: 10px; padding: 6px 0; font-size: 14px; }
.meter { height: 6px; background: var(--line); border-radius: 3px; margin-bottom: 4px; }
.meter i { display: block; height: 100%; background: var(--brand); border-radius: 3px; }
.shortbox { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.shortbox code { background: var(--bg); border: 1px solid var(--line); padding: 6px 10px;
  border-radius: 8px; font-size: 14px; word-break: break-all; }
.login { max-width: 360px; margin: 14vh auto 0; }
.empty { text-align: center; padding: 28px 0; }
.scroll { overflow-x: auto; }
@media (max-width: 720px) {
  .form-grid, .cols, .stats { grid-template-columns: 1fr; }
  .trunc { max-width: 160px; }
}
