:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

/* Lightweight utility subset used by the server-rendered shell. */
.bg-slate-950 { background-color: #020617; }
.bg-slate-950\/80 { background-color: rgba(2, 6, 23, .8); }
.text-slate-100 { color: #f1f5f9; }
.text-slate-300 { color: #cbd5e1; }
.text-slate-400 { color: #94a3b8; }
.border-b { border-bottom-width: 1px; }
.border-white\/10 { border-color: rgba(255,255,255,.1); }
.backdrop-blur { backdrop-filter: blur(12px); }
.mx-auto { margin-left: auto; margin-right: auto; }
.max-w-7xl { max-width: 80rem; }
.px-5 { padding-left: 1.25rem; padding-right: 1.25rem; }
.py-4 { padding-top: 1rem; padding-bottom: 1rem; }
.py-8 { padding-top: 2rem; padding-bottom: 2rem; }
.flex { display: flex; }
.grid { display: grid; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: .5rem; }
.gap-3 { gap: .75rem; }
.gap-8 { gap: 2rem; }
.block { display: block; }
.hidden { display: none; }
.text-sm { font-size: .875rem; }
.text-lg { font-size: 1.125rem; }
@media (min-width: 768px) { .md\:inline { display: inline; } }
@media (min-width: 1024px) {
  .lg\:items-center { align-items: center; }
  .lg\:grid-cols-\[1\.1fr_0\.9fr\] { grid-template-columns: 1.1fr .9fr; }
}

* { box-sizing: border-box; }
body { min-height: 100vh; margin: 0; background:
  radial-gradient(circle at top left, rgba(59, 130, 246, 0.22), transparent 32rem),
  radial-gradient(circle at bottom right, rgba(20, 184, 166, 0.16), transparent 34rem),
  #020617;
}
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; }

.site-header { position: sticky; top: 0; z-index: 20; }
.brand-mark {
  display: grid; place-items: center; width: 42px; height: 42px; border-radius: 14px;
  background: linear-gradient(135deg, #38bdf8, #14b8a6); color: #020617; font-weight: 900; font-size: 1.55rem;
  box-shadow: 0 18px 48px rgba(20, 184, 166, 0.24);
}

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .55rem;
  min-height: 2.55rem; border: 1px solid rgba(255,255,255,.13); border-radius: 999px;
  padding: .58rem 1rem; background: rgba(255,255,255,.06); color: #e2e8f0;
  cursor: pointer; transition: transform .18s ease, background .18s ease, border-color .18s ease;
}
.btn:hover { transform: translateY(-1px); background: rgba(255,255,255,.1); border-color: rgba(255,255,255,.24); }
.btn.primary { border-color: transparent; background: linear-gradient(135deg, #38bdf8, #14b8a6); color: #031019; font-weight: 800; }
.btn.ghost { background: rgba(15,23,42,.68); }
.btn.danger { background: rgba(239,68,68,.12); border-color: rgba(248,113,113,.25); color: #fecaca; }
.btn.large { min-height: 3.2rem; padding-inline: 1.35rem; }
.text-button { color: #67e8f9; background: none; border: 0; cursor: pointer; margin-top: 1rem; }

.hero-card, .feature-panel, .panel, .auth-card {
  border: 1px solid rgba(255,255,255,.12); background: rgba(15,23,42,.72); border-radius: 28px;
  box-shadow: 0 24px 80px rgba(0,0,0,.32); backdrop-filter: blur(18px);
}
.hero-card { padding: clamp(2rem, 5vw, 4.6rem); }
.hero-card h1, .auth-card h1, .panel h1 { font-size: clamp(2.1rem, 5vw, 4.75rem); line-height: .98; letter-spacing: -.06em; margin: .5rem 0 1.2rem; }
.lead { color: #cbd5e1; font-size: clamp(1rem, 2vw, 1.2rem); line-height: 1.8; max-width: 54rem; }
.eyebrow { color: #67e8f9; text-transform: uppercase; letter-spacing: .18em; font-weight: 800; font-size: .75rem; margin: 0 0 .4rem; }
.hero-actions { display: flex; flex-wrap: wrap; gap: .8rem; margin-top: 2rem; }
.feature-panel { display: grid; gap: 1rem; padding: 1.2rem; }
.feature-panel article { display: grid; gap: .35rem; padding: 1.2rem; border-radius: 22px; background: rgba(255,255,255,.05); }
.feature-panel i { color: #67e8f9; font-size: 1.45rem; }
.feature-panel span { color: #94a3b8; }

.auth-layout { display: grid; place-items: center; min-height: 68vh; }
.auth-card { width: min(100%, 480px); padding: 2rem; }
.form-stack { display: grid; gap: 1rem; margin-top: 1.3rem; }
label { display: grid; gap: .45rem; color: #cbd5e1; font-weight: 650; }
input, select {
  width: 100%; border: 1px solid rgba(255,255,255,.12); border-radius: 16px; color: #f8fafc;
  background: rgba(2,6,23,.72); outline: none; padding: .88rem 1rem;
}
input:focus, select:focus { border-color: #22d3ee; box-shadow: 0 0 0 4px rgba(34,211,238,.12); }

.dashboard-grid { display: grid; gap: 1.5rem; grid-template-columns: minmax(0, 1.2fr) minmax(280px, .8fr); }
.panel { padding: 1.35rem; }
.panel-header { margin-bottom: 1.2rem; }
.panel-header h2, .admin-grid h2 { margin: .2rem 0; font-size: 1.45rem; }
.row-header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.stat-list { display: grid; gap: .85rem; }
.stat-list div { padding: 1rem; border-radius: 18px; background: rgba(255,255,255,.05); }
.stat-list dt { color: #94a3b8; font-size: .82rem; }
.stat-list dd { margin: .2rem 0 0; color: #f8fafc; word-break: break-word; }
.mt-6 { margin-top: 1.5rem; }

.links-list { display: grid; gap: 1rem; }
.link-card { display: grid; gap: .9rem; padding: 1rem; border: 1px solid rgba(255,255,255,.1); border-radius: 22px; background: rgba(2,6,23,.52); }
.link-card.inactive { opacity: .55; }
.link-card header { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; }
.link-card header span:first-child { min-width: 0; display: grid; gap: .25rem; }
.link-card strong { word-break: break-word; }
.link-card a { color: #67e8f9; word-break: break-all; }
.original-url { color: #94a3b8; margin: 0; word-break: break-all; }
.click-badge { white-space: nowrap; border-radius: 999px; padding: .4rem .7rem; background: rgba(34,211,238,.12); color: #a5f3fc; }
.link-actions { display: flex; flex-wrap: wrap; gap: .6rem; }
.link-card canvas { border-radius: 16px; background: white; padding: .45rem; }
.empty-state { padding: 2rem; color: #94a3b8; text-align: center; border: 1px dashed rgba(255,255,255,.16); border-radius: 22px; }

.modal-backdrop { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 1rem; background: rgba(2,6,23,.78); backdrop-filter: blur(10px); }
.modal-card { width: min(100%, 900px); max-height: 88vh; overflow: auto; border: 1px solid rgba(255,255,255,.12); border-radius: 26px; background: #0f172a; padding: 1.35rem; }
.stats-grid { display: grid; gap: 1rem; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.stats-grid article, .modal-card section { margin-top: 1rem; padding: 1rem; border-radius: 20px; background: rgba(255,255,255,.04); }
.stats-grid ul { list-style: none; padding: 0; margin: .7rem 0 0; display: grid; gap: .5rem; }
.stats-grid li { display: flex; justify-content: space-between; gap: 1rem; color: #cbd5e1; }

.admin-grid { display: grid; gap: 1.5rem; }
.table-wrap { overflow-x: auto; border: 1px solid rgba(255,255,255,.1); border-radius: 18px; }
table { width: 100%; border-collapse: collapse; min-width: 720px; }
th, td { padding: .8rem; border-bottom: 1px solid rgba(255,255,255,.08); text-align: left; vertical-align: middle; }
th { color: #94a3b8; font-size: .82rem; text-transform: uppercase; letter-spacing: .08em; }
td small { color: #94a3b8; }
td input, td select { min-width: 92px; padding: .55rem .7rem; border-radius: 12px; }

#toast-region { position: fixed; right: 1rem; bottom: 1rem; z-index: 80; display: grid; gap: .7rem; }
.toast { padding: .9rem 1rem; border-radius: 16px; background: rgba(20,184,166,.95); color: #021011; font-weight: 800; box-shadow: 0 18px 40px rgba(0,0,0,.35); }
.toast.error { background: rgba(248,113,113,.95); color: #220606; }

@media (max-width: 900px) {
  .dashboard-grid, .stats-grid { grid-template-columns: 1fr; }
  .row-header { align-items: flex-start; flex-direction: column; }
  .site-header nav { align-items: flex-start; gap: 1rem; flex-direction: column; }
  #session-actions { flex-wrap: wrap; }
}
