:root {
  font: 16px/1.55 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color-scheme: light dark;
  --bg: #f5f8fd; --panel: #fff; --text: #18263e; --muted: #4c617c;
  --line: #cbd7e8; --blue: #2856b4; --on-blue: #fff; --tint: #e8effd;
  --danger: #a51f2c; --danger-bg: #ffedef; --danger-line: #d57a85;
  --success: #175747; --success-bg: #dcf1e8;
  --warning: #72511b; --warning-bg: #fff2d4;
  color: var(--text); background: var(--bg);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b111d; --panel: #141e30; --text: #edf2fb; --muted: #b4c2d7;
    --line: #3b4e6a; --blue: #a9c5ff; --on-blue: #132744; --tint: #243452;
    --danger: #ffb4bd; --danger-bg: #381c29; --danger-line: #a85a6a;
    --success: #9de1c9; --success-bg: #17352f;
    --warning: #f8d99b; --warning-bg: #3c301d;
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
a { color: var(--blue); }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; }
.shell { width: min(100% - 48px, 1340px); margin-inline: auto; }
.header { display: flex; justify-content: space-between; align-items: center; gap: 16px; min-height: 78px; border-bottom: 1px solid var(--line); }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-size: 24px; font-weight: 730; letter-spacing: -.7px; white-space: nowrap; }
.brand-mark { width: 34px; height: 34px; border-radius: 8px; display: block; }
.accent { color: var(--blue); }
.account { display: flex; align-items: center; gap: 12px; min-width: 0; }
.account-name { color: var(--muted); overflow-wrap: anywhere; font-size: 14px; }
.layout { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: clamp(24px, 4vw, 56px); padding-block: 36px 64px; }
.nav { display: flex; flex-direction: column; align-self: start; gap: 5px; }
.nav a { display: flex; align-items: center; gap: 10px; min-height: 45px; padding: 8px 12px; border-radius: 8px; color: var(--muted); font-weight: 650; text-decoration: none; }
.nav a:hover, .nav a[aria-current="page"] { background: var(--tint); color: var(--blue); }
.nav svg { width: 19px; height: 19px; flex: none; }
.nav-title { margin: 0 12px 5px; color: var(--muted); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .11em; }
.content { min-width: 0; }
.narrow { width: min(100%, 570px); margin-inline: auto; }
.login-page { padding-block: 56px 72px; }
.eyebrow { margin: 0 0 8px; color: var(--blue); letter-spacing: .09em; font-weight: 700; font-size: 13px; text-transform: uppercase; }
h1, h2, h3 { margin-top: 0; line-height: 1.22; overflow-wrap: anywhere; }
h1 { font-size: clamp(32px, 4vw, 48px); letter-spacing: -.035em; margin-bottom: 9px; }
h2 { font-size: 22px; margin-bottom: 12px; }
h3 { font-size: 18px; margin-bottom: 8px; }
.lead { color: var(--muted); font-size: 17px; margin: 0 0 25px; }
.panel { min-width: 0; padding: 22px; background: var(--panel); border: 1px solid var(--line); border-radius: 13px; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.actions form { display: inline-flex; }
.badge { display: inline-block; font-size: 13px; font-weight: 650; background: var(--tint); color: var(--blue); border-radius: 30px; padding: 3px 9px; white-space: nowrap; }
.badge.active { color: var(--success); background: var(--success-bg); }
.badge.paused { color: var(--warning); background: var(--warning-bg); }
.badge.off { color: var(--muted); background: var(--bg); border: 1px solid var(--line); }
.hint { font-size: 14px; color: var(--muted); margin: 9px 0 15px; overflow-wrap: anywhere; }
.hint:last-child { margin-bottom: 0; }
code, .mono { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }
form { margin: 0; min-width: 0; }
label { display: block; font-weight: 650; margin-bottom: 6px; }
input:not([type=hidden]), select { display: block; width: 100%; min-width: 0; min-height: 46px; padding: 9px 12px; color: var(--text); background: var(--bg); border: 1px solid var(--line); border-radius: 8px; font: inherit; }
input::placeholder { color: var(--muted); }
input.mono { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }
.login label:not(:first-child) { margin-top: 16px; }
.button { display: inline-flex; align-items: center; justify-content: center; min-height: 42px; padding: 7px 12px; border: 1px solid var(--line); border-radius: 8px; font: inherit; font-weight: 650; color: var(--text); text-align: center; text-decoration: none; background: var(--panel); cursor: pointer; }
.button:hover { background: var(--tint); }
.button.primary { background: var(--blue); color: var(--on-blue); border-color: var(--blue); }
.button.primary:hover { filter: brightness(.92); }
.button.danger { color: var(--danger); }
.button.compact { min-height: 35px; padding: 5px 8px; font-size: 13px; }
.login .primary, .copy { margin-top: 20px; }
.result { margin-bottom: 18px; }
.shorten, .section-form { margin-bottom: 26px; }
.form-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.form-actions { margin-top: 15px; }
.shorten-fields { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; }
.shorten .hint { margin-bottom: 0; }
.link-actions { margin-top: 12px; }
.result [role="status"]:empty { margin: 0; }
.qr { display: grid; justify-items: center; gap: 14px; margin: 20px 0 0; }
.qr img { display: block; width: min(100%, 224px); height: auto; aspect-ratio: 1; border-radius: 8px; background: #fff; image-rendering: pixelated; }
.notice { margin: 0 0 22px; padding: 12px 15px; border: 1px solid var(--line); border-radius: 8px; background: var(--tint); color: var(--text); }
.notice.error { color: var(--danger); border-color: var(--danger-line); background: var(--danger-bg); }
.shorten-error { margin: 12px 0 0; }
.metric-grid, .quick-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.metric-grid { margin: 0 0 28px; }
.metric-grid dt { color: var(--muted); font-weight: 600; font-size: 14px; }
.metric-grid dd { margin: 6px 0 0; font-size: 34px; line-height: 1.2; font-weight: 700; letter-spacing: -.025em; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.quick-grid a { text-decoration: none; color: inherit; }
.quick-grid a:hover { border-color: var(--blue); }
.quick-title { display: block; color: var(--blue); font-weight: 700; margin-bottom: 4px; }
.quick-description { color: var(--muted); font-size: 14px; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); background: var(--panel); border-radius: 12px; }
table { width: 100%; border-collapse: collapse; text-align: left; }
th, td { padding: 12px 14px; vertical-align: top; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
th { color: var(--muted); background: var(--bg); font-size: 13px; font-weight: 700; }
tbody tr:last-child td { border-bottom: 0; }
.table-main { font-weight: 700; overflow-wrap: anywhere; }
.destination { display: block; max-width: 38ch; margin-top: 3px; color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }
.table-sub { display: block; color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }
.table-actions { min-width: 145px; }
.pager { display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-end; margin-top: 15px; }
.link-filters { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; align-items: end; }
.link-search-field { grid-column: span 2; }
.link-filters label { font-size: 14px; }
.link-filters select { text-overflow: ellipsis; }
.link-filter-actions { grid-column: 1 / -1; }
.link-results-count { margin: 14px 0 9px; font-variant-numeric: tabular-nums; width: fit-content; }
#link-list[aria-busy="true"] { cursor: progress; }
.link-pager { align-items: center; gap: 6px; }
.link-pager .button { min-width: 42px; }
.pager-current, .pager-current:hover { background: var(--tint); border-color: var(--blue); color: var(--blue); cursor: default; }
.pager-gap { padding-inline: 4px; color: var(--muted); }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
footer { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 10px 18px; border-top: 1px solid var(--line); color: var(--muted); font-size: 14px; padding-block: 22px; }
footer a { font-weight: 650; text-decoration: none; color: inherit; }
footer a:hover, footer a:focus-visible { color: var(--blue); }
@media (max-width: 900px) {
  .layout { display: block; padding-block: 0 46px; }
  .nav { flex-direction: row; flex-wrap: wrap; margin: 0 0 27px; padding-block: 12px; border-bottom: 1px solid var(--line); }
  .nav-title { display: none; }
}
@media (max-width: 700px) {
  .link-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .link-pager { justify-content: center; }
  .metric-grid, .quick-grid { grid-template-columns: minmax(0, 1fr); gap: 9px; }
  .metric-grid .panel { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
  .metric-grid dd { margin: 0; font-size: 26px; }
  .table-wrap { overflow: visible; border: 0; background: transparent; }
  table, tbody, tr, td { display: block; }
  thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  tbody tr { padding: 13px; margin-bottom: 10px; border: 1px solid var(--line); border-radius: 11px; background: var(--panel); }
  tbody td { display: grid; grid-template-columns: minmax(75px, .4fr) minmax(0, 1fr); gap: 6px; padding: 5px 0; border: 0; }
  tbody td::before { content: attr(data-label); color: var(--muted); font-size: 12px; font-weight: 650; }
  tbody td > div { min-width: 0; }
  .table-actions { min-width: 0; }
}
@media (max-width: 520px) {
  .shell { width: calc(100% - 28px); }
  .header { min-height: 68px; }
  .panel { padding: 16px; }
  .brand { font-size: 20px; }
  .brand-mark { width: 28px; height: 28px; }
  .account-name { display: none; }
  .nav { gap: 4px; }
  .nav a { gap: 5px; padding: 7px; font-size: 14px; min-height: 40px; }
  .nav svg { width: 16px; height: 16px; }
  .form-fields, .shorten-fields { grid-template-columns: minmax(0, 1fr); }
}
