:root {
    --bg: #f5f6fa; --card: #fff; --ink: #1c2233; --muted: #6b7385; --line: #e3e6ee;
    --brand: #2f5bea; --brand-ink: #fff; --bad: #c62f3c; --bad-bg: #fdecee; --ok: #1f8a4c;
}
@media (prefers-color-scheme: dark) {
    :root { --bg: #12151d; --card: #1b1f2a; --ink: #e7e9f0; --muted: #9aa1b2; --line: #2b3040; --brand: #5b80ff; --bad-bg: #3a1c21; --bad: #ff8b95; }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--ink); 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; }
code { font: 13px ui-monospace, Consolas, monospace; }

.top { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; padding: 12px 20px; background: var(--card); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 18px; color: var(--ink); }
.brand:hover { text-decoration: none; }
.brand small { font-weight: 400; color: var(--muted); font-size: 13px; }
.logo { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 7px; background: var(--brand); color: #fff; font-size: 17px; }
.top nav { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.inline { display: inline; margin: 0; }
.linkbtn { background: none; border: 0; color: var(--brand); padding: 0; font: inherit; cursor: pointer; }

main { max-width: 820px; margin: 0 auto; padding: 24px 16px 60px; }
main.wide { max-width: 1240px; }
h1 { font-size: 34px; margin: 24px 0 4px; letter-spacing: -.5px; }
h2 { font-size: 18px; margin: 0 0 12px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.hero { text-align: center; margin-bottom: 28px; }

.shorten { display: flex; gap: 8px; margin: 22px auto 10px; max-width: 680px; }
.shorten input { flex: 1; min-width: 0; padding: 13px 14px; font-size: 16px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); color: var(--ink); }
.shorten input:focus { outline: 2px solid var(--brand); border-color: transparent; }
button, .btn { padding: 12px 20px; border: 0; border-radius: 10px; background: var(--brand); color: var(--brand-ink); font: inherit; font-weight: 600; cursor: pointer; }
button:disabled { opacity: .6; }
button.mini { padding: 4px 10px; font-size: 13px; border-radius: 7px; }
button.ghost { background: transparent; color: var(--brand); border: 1px solid var(--line); }
button.danger { background: var(--bad); }

.result { display: inline-flex; gap: 12px; align-items: center; padding: 10px 10px 10px 16px; background: var(--card); border: 1px solid var(--line); border-radius: 10px; font-size: 18px; font-weight: 600; }
.alert { max-width: 680px; margin: 10px auto; padding: 10px 14px; border-radius: 10px; background: var(--bad-bg); color: var(--bad); }
.note { padding: 10px 14px; border-radius: 10px; background: var(--card); border: 1px solid var(--line); margin-bottom: 16px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 18px; margin-bottom: 18px; overflow-x: auto; }
.row-between { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 8px; }

.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: left; font-weight: 600; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .4px; padding: 6px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 7px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl tr:last-child td { border-bottom: 0; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.clip { max-width: 340px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nowrap { white-space: nowrap; }
.tag { display: inline-block; padding: 1px 7px; border-radius: 20px; font-size: 11px; background: var(--line); color: var(--muted); }
.tag.off { background: var(--bad-bg); color: var(--bad); }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 18px; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; }
.kpi b { display: block; font-size: 26px; font-variant-numeric: tabular-nums; }
.kpi span { color: var(--muted); font-size: 13px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 800px) { .grid2 { grid-template-columns: 1fr; } }

.bars { display: flex; align-items: flex-end; gap: 3px; height: 140px; padding-top: 6px; }
.bars div { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; min-width: 0; }
.bars i { display: block; width: 100%; background: var(--brand); border-radius: 3px 3px 0 0; min-height: 1px; }
.bars small { font-size: 10px; color: var(--muted); margin-top: 3px; white-space: nowrap; }

.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.filters input { padding: 9px 12px; border: 1px solid var(--line); border-radius: 9px; background: var(--card); color: var(--ink); font: inherit; min-width: 240px; }
.filters button { padding: 9px 16px; }
.pager { display: flex; gap: 12px; justify-content: flex-end; margin-top: 10px; }

.login { max-width: 360px; margin: 60px auto; }
.login label { display: block; font-size: 13px; color: var(--muted); margin: 12px 0 4px; }
.login input { width: 100%; padding: 11px 12px; border: 1px solid var(--line); border-radius: 9px; background: var(--card); color: var(--ink); font: inherit; }
.login button { width: 100%; margin-top: 18px; }

@media (max-width: 560px) {
    .shorten { flex-direction: column; }
    h1 { font-size: 27px; }
    .result { font-size: 15px; }
}
