/* ============================================================
   Short URL - dark navy design system
   ============================================================ */
:root {
  --bg: #05080f;
  --panel: #0b1220;
  --panel-soft: #080d17;
  --panel-hover: #131c2e;
  --border: #1b2940;
  --border-strong: #2c405f;
  --text: #e8eefc;
  --muted: #8ea3c4;
  --muted-2: #5f7396;
  --accent: #e6eaf5;
  --accent-hover: #ffffff;
  --accent-soft: rgba(230, 234, 245, 0.25);
  --danger: #fca5a5;
  --danger-border: #7f1d1d;
  --radius: 10px;
  --radius-sm: 6px;
  /* spacing scale */
  --space-1: 8px;
  --space-2: 16px;
  --space-3: 24px;
  --space-4: 32px;
  --font-sans: "Space Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  isolation: isolate;
}
h1, h2, h3 { margin: 0; }
a { color: inherit; text-decoration: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

/* ============================================================
   Navbar
   ============================================================ */
.navbar {
  position: sticky; top: 0; z-index: 30;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 16px;
  padding: 14px 24px;
  border-bottom: 1px solid var(--border);
  background: rgba(5, 8, 15, 0.85);
  backdrop-filter: blur(10px);
}
.brand {
  justify-self: start;
  display: inline-flex; align-items: center; gap: 9px;
  font-weight: 700; font-size: 16px; letter-spacing: -0.01em;
}
.brand-icon { display: inline-flex; color: var(--text); }
.brand-icon svg { width: 19px; height: 19px; }
.nav-center { justify-self: center; display: flex; align-items: center; gap: 2px; }
.nav-link {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 12px; border-radius: var(--radius-sm);
  color: var(--muted); font-size: 14px; font-weight: 500;
  transition: color .15s, background .15s;
}
.nav-link:hover { color: var(--text); background: var(--panel-hover); }
.nav-link svg { width: 15px; height: 15px; }
.nav-right { justify-self: end; display: flex; align-items: center; gap: 10px; }
.user-pill {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 6px 12px; border: 1px solid var(--border); border-radius: 999px;
  font-size: 13px; color: var(--muted);
}
.user-pill svg { width: 14px; height: 14px; }
.nav-logout { color: var(--muted); font-size: 14px; font-weight: 500; padding: 6px 4px; }
.nav-logout:hover { color: var(--text); }

/* ============================================================
   Buttons
   ============================================================ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 9px 16px; border: 1px solid transparent; border-radius: var(--radius-sm);
  font-family: var(--font-sans); font-size: 14px; font-weight: 600; cursor: pointer;
  transition: opacity .15s, background .15s, border-color .15s, color .15s;
}
.btn-primary { background: var(--accent); color: #0a0f1e; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-ghost { background: transparent; border-color: var(--border); color: var(--text); }
.btn-ghost:hover { border-color: var(--border-strong); background: var(--panel-hover); }
.btn-outline {
  background: transparent; border-color: var(--border); color: var(--muted);
  font-size: 13px; padding: 7px 12px;
}
.btn-outline:hover { color: var(--text); border-color: var(--border-strong); }
.btn-outline svg { width: 14px; height: 14px; }
.btn-outline .chevron { transition: transform .18s; }
.btn-outline[aria-expanded="true"] .chevron { transform: rotate(180deg); }
.btn-block { width: 100%; }
button { font-family: var(--font-sans); }
button:not(.btn):not(.icon-btn):not(.copy-mini) {
  background: var(--accent); color: #0a0f1e; border: 0; border-radius: var(--radius-sm);
  padding: 10px 16px; font-weight: 600; font-size: 14px; cursor: pointer;
}
button:not(.btn):not(.icon-btn):not(.copy-mini):hover { background: var(--accent-hover); }

/* ============================================================
   Home layout
   ============================================================ */
.page {
  display: grid; grid-template-columns: 1.05fr 1px 1fr; gap: 44px; align-items: start;
  max-width: 1180px; margin: 0 auto; padding: 60px 24px 24px;
}
.divider { width: 1px; align-self: stretch; background: var(--border); }
.hero-col { position: relative; isolation: isolate; }
.hero-col::before {
  content: ""; position: absolute; top: -40px; left: -40px;
  width: min(540px, 95%); height: 360px; z-index: -1; pointer-events: none;
  background-image: radial-gradient(rgba(120, 160, 255, .08) 1px, transparent 1px);
  background-size: 22px 22px;
  -webkit-mask-image: radial-gradient(ellipse at 20% 20%, #000 0%, transparent 72%);
  mask-image: radial-gradient(ellipse at 20% 20%, #000 0%, transparent 72%);
}
.hero-title {
  font-size: clamp(46px, 7vw, 82px); line-height: .98; font-weight: 700;
  letter-spacing: -.035em; margin: 0 0 22px;
}
.hero-title span { display: block; }
.hero-title .line-muted { color: var(--muted); }
.hero-sub { color: var(--muted); font-size: 16px; max-width: 44ch; margin: 0 0 38px; }

.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.stat { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; }
.stat-icon {
  width: 34px; height: 34px; display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--border); border-radius: 8px; color: var(--muted); margin-bottom: 16px;
}
.stat-icon svg { width: 16px; height: 16px; }
.stat-label {
  font-size: 11px; letter-spacing: .12em; text-transform: uppercase;
  color: var(--muted); font-weight: 600; margin-bottom: 6px;
}
.stat-value { font-family: var(--font-mono); font-size: 26px; font-weight: 600; letter-spacing: -.02em; }
.stat .value { font-family: var(--font-mono); font-size: 26px; font-weight: 600; }
.stat .label {
  font-size: 11px; letter-spacing: .12em; text-transform: uppercase;
  color: var(--muted); font-weight: 600;
}

/* ============================================================
   Create panel
   ============================================================ */
.panel-col { display: flex; flex-direction: column; gap: 22px; }
.create-panel { background: var(--panel-soft); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.panel-head h2 { font-size: 17px; font-weight: 600; }
.create-form { display: flex; flex-direction: column; gap: 16px; }
.field { display: flex; flex-direction: column; gap: 8px; }
.field label {
  font-size: 11px; letter-spacing: .12em; text-transform: uppercase;
  color: var(--muted); font-weight: 600;
}
input[type=text], input[type=url], input[type=email], input[type=password],
input[type=datetime-local], input[type=number] {
  width: 100%; background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius-sm);
  color: var(--text); font-family: var(--font-mono); font-size: 14px; padding: 11px 12px;
  transition: border-color .15s, box-shadow .15s;
}
input::placeholder { color: var(--muted-2); }
input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
input[type=datetime-local] { color-scheme: dark; }
.input-prefix {
  display: flex; align-items: stretch; background: var(--panel);
  border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden;
  transition: border-color .15s, box-shadow .15s;
}
.input-prefix:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.input-prefix .prefix {
  display: flex; align-items: center; padding: 0 2px 0 12px;
  color: var(--muted); font-family: var(--font-mono); font-size: 14px;
}
.input-prefix input { background: transparent; border: 0; border-radius: 0; box-shadow: none; }
.input-prefix input:focus { box-shadow: none; }
.advanced-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.advanced-grid[hidden] { display: none; }
.section-label {
  font-size: 11px; letter-spacing: .12em; text-transform: uppercase;
  color: var(--muted); font-weight: 600;
}

/* ============================================================
   Recent links
   ============================================================ */
.recent { display: flex; flex-direction: column; gap: 12px; }
.recent-list {
  display: flex; flex-direction: column; gap: 10px;
  max-height: 320px; overflow-y: auto; padding-right: 4px;
}
.recent-list::-webkit-scrollbar { width: 8px; }
.recent-list::-webkit-scrollbar-thumb { background: var(--border); border-radius: 8px; }
.link-card {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 12px 14px;
}
.link-card--new { border-color: var(--border-strong); background: var(--panel-hover); }
.link-main { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.link-short { font-family: var(--font-mono); font-size: 14px; font-weight: 600; color: var(--text); }
.link-full {
  font-family: var(--font-mono); font-size: 12px; color: var(--muted);
  max-width: 42ch; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  user-select: all;
}
.link-dest {
  font-family: var(--font-mono); font-size: 12px; color: var(--muted);
  max-width: 38ch; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.link-actions { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
.click-count {
  display: inline-flex; align-items: center; gap: 5px;
  font-family: var(--font-mono); font-size: 12px; color: var(--muted);
}
.click-count svg { width: 13px; height: 13px; }
.icon-btn {
  width: 30px; height: 30px; display: inline-flex; align-items: center; justify-content: center;
  background: transparent; border: 1px solid var(--border); border-radius: var(--radius-sm);
  color: var(--muted); cursor: pointer;
  transition: color .15s, border-color .15s, background .15s;
}
.icon-btn:hover { color: var(--text); border-color: var(--border-strong); background: var(--panel-hover); }
.icon-btn svg { width: 14px; height: 14px; }
.icon-btn.copied { color: var(--text); border-color: #4ade80; }
.empty-note { color: var(--muted); font-size: 13px; margin: 0; }
.guest-note { color: var(--muted); font-size: 13px; text-align: center; margin: 0; }
.guest-note a { color: var(--text); text-decoration: underline; }

/* ============================================================
   Flash / errors
   ============================================================ */
.form-error {
  border: 1px solid var(--danger-border); background: #1a0f0f; color: var(--danger);
  border-radius: var(--radius-sm); padding: 10px 12px; font-size: 13px; margin: 0 0 16px;
}

/* ============================================================
   Generic inner pages
   ============================================================ */
.container { max-width: 680px; margin: 0 auto; padding: 48px 24px; }
.container--wide { max-width: 960px; }
.card {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 22px; margin-bottom: 20px;
}
.card h2 { font-size: 18px; margin-bottom: 14px; }
.card h3 { font-size: 15px; margin: 16px 0 8px; }
.muted { color: var(--muted); }
.muted a { color: var(--text); }
.error { color: var(--danger); }
.result { color: var(--text); }
.stack { display: flex; flex-direction: column; gap: 14px; }
.stack form, .card form { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; gap: 20px; flex-wrap: wrap; }
.row > div { flex: 1; min-width: 220px; }
.qr img {
  display: block; width: 200px; height: 200px; border: 1px solid var(--border);
  border-radius: var(--radius); background: #fff; padding: 6px;
}
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 11px 8px; border-bottom: 1px solid var(--border); }
th {
  font-size: 11px; letter-spacing: .1em; text-transform: uppercase;
  color: var(--muted); font-weight: 600;
}
tr:last-child td { border-bottom: 0; }
.clicks { font-family: var(--font-mono); font-weight: 600; }
.badge {
  display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px;
  background: var(--panel-hover); border: 1px solid var(--border); color: var(--muted);
}
.badge.expired { background: #1a0f14; border-color: var(--danger-border); color: var(--danger); }

/* ============================================================
   Footer
   ============================================================ */
.site-footer {
  border-top: 1px solid var(--border); margin-top: 56px; padding: 20px 24px;
  text-align: center; font-size: 12px; color: var(--muted-2);
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 900px) {
  .page { grid-template-columns: 1fr; gap: 34px; padding: 44px 20px 16px; }
  .divider { display: none; }
}
@media (max-width: 720px) {
  .navbar {
    display: flex; flex-wrap: wrap;
    align-items: center; justify-content: space-between;
    gap: 8px 12px; padding: 12px 16px;
  }
  .brand { order: 1; }
  .nav-right { order: 2; }
  .nav-center {
    order: 3; flex-basis: 100%; flex-wrap: wrap;
    justify-content: center; gap: 4px;
  }
  .nav-link { padding: 7px 10px; }
  .user-pill { display: none; }
}
@media (max-width: 560px) {
  .stats { grid-template-columns: 1fr; }
  .advanced-grid { grid-template-columns: 1fr; }
  .hero-title { font-size: clamp(40px, 12vw, 60px); }
  .link-dest { max-width: 24ch; }
}

/* ============================================================
   Background globe
   ============================================================ */
.bg-globe {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  pointer-events: none;
  display: block;
}

/* ============================================================
   Dashboard
   ============================================================ */
.dashboard {
  max-width: 1100px;
  margin: 0 auto;
  padding: var(--space-4) var(--space-3) var(--space-3);
}
.dashboard-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: var(--space-2); margin-bottom: var(--space-3);
}
.eyebrow {
  margin: 0 0 var(--space-1);
  font-size: 11px; letter-spacing: .14em; text-transform: uppercase;
  color: var(--muted); font-weight: 600;
}
.dashboard-title { font-size: 30px; font-weight: 700; letter-spacing: -.02em; }

.dashboard .stats { gap: var(--space-3); margin-bottom: var(--space-3); }
.dashboard .stat { padding: var(--space-3); }
.dashboard .card { padding: var(--space-4); margin-bottom: 0; }
.dashboard .card + .card { margin-top: var(--space-3); }
.dashboard table th, .dashboard table td { padding: 14px 12px; }

.table-scroll { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table-scroll table { min-width: 760px; }

.short-cell { display: flex; align-items: center; gap: 12px; }
.short-cell__text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.short-link { font-family: var(--font-mono); font-size: 14px; font-weight: 600; color: var(--text); }
.short-full {
  font-family: var(--font-mono); font-size: 11px;
  max-width: 26ch; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.dest-cell { max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.row-actions { display: flex; align-items: center; gap: 8px; }

/* QR thumbnail */
.qr-thumb {
  flex: 0 0 auto; display: inline-flex; padding: 3px; line-height: 0;
  background: #fff; border: 1px solid var(--border); border-radius: 8px;
}
.qr-thumb img { display: block; width: 48px; height: 48px; border-radius: 5px; }
.qr-thumb--empty {
  width: 48px; height: 48px; background: var(--panel-hover); border-style: dashed;
}

/* QR modal (CSS-only :target) */
.qr-modal { display: none; position: fixed; inset: 0; z-index: 100; }
.qr-modal:target { display: flex; align-items: center; justify-content: center; padding: var(--space-3); }
.qr-modal__backdrop {
  position: absolute; inset: 0;
  background: rgba(0, 0, 0, .78);
  backdrop-filter: blur(2px);
}
.qr-modal__panel {
  position: relative; z-index: 1;
  display: flex; flex-direction: column; align-items: center; gap: var(--space-2);
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  padding: var(--space-3); text-align: center;
}
.qr-modal__panel img {
  width: 240px; height: 240px; padding: 10px; border-radius: 10px; background: #fff;
}
.qr-modal__url { font-family: var(--font-mono); font-size: 12px; margin: 0; word-break: break-all; }
.qr-modal__actions { display: flex; gap: var(--space-1); }

/* Link analytics details */
.meta-list { margin: 0; display: flex; flex-direction: column; gap: 12px; }
.meta-item { display: grid; grid-template-columns: 110px 1fr; gap: 12px; align-items: baseline; }
.meta-item dt {
  margin: 0; font-size: 11px; letter-spacing: .1em; text-transform: uppercase;
  color: var(--muted); font-weight: 600;
}
.meta-item dd { margin: 0; font-family: var(--font-mono); font-size: 13px; word-break: break-all; }
.meta-item dd a { color: var(--text); }

.copy-mini {
  font-family: var(--font-sans); font-size: 11px; margin-left: 8px;
  background: transparent; border: 1px solid var(--border); color: var(--muted);
  border-radius: 6px; padding: 3px 8px; cursor: pointer;
  transition: color .15s, border-color .15s;
}
.copy-mini:hover { color: var(--text); border-color: var(--border-strong); }
.copy-mini.copied { color: var(--text); border-color: #4ade80; }

@media (max-width: 560px) {
  .dashboard { padding: var(--space-3) var(--space-2) var(--space-2); }
  .dashboard-head { flex-direction: column; align-items: flex-start; }
  .dashboard-title { font-size: 24px; }
}

