/* golink — UI v2 */
@font-face {
  font-family: Inter;
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url(/static/fonts/inter-variable.woff2) format("woff2");
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg:        #09090b;
  --surface:   #18181b;
  --surface-2: #27272a;
  --border:    #3f3f46;
  --border-2:  #52525b;
  --text:      #fafafa;
  --muted:     #a1a1aa;
  --muted-2:   #71717a;
  --accent:    #818cf8;
  --accent-2:  #6366f1;
  --accent-hover: #a5b4fc;
  --accent-bg: rgba(129,140,248,.12);
  --danger:    #f87171;
  --danger-bg: rgba(248,113,113,.12);
  --success:   #4ade80;
  --success-bg: rgba(74,222,128,.1);
  --warning:   #fbbf24;
  --radius:    8px;
  --radius-lg: 12px;
}

/* ── Scrollbar ────────────────────────────────────────────── */

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-2); }

html { height: 100%; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: Inter, system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

code {
  font-family: ui-monospace, "Cascadia Code", "Fira Code", monospace;
  font-size: 0.9em;
}

/* ── Layout ───────────────────────────────────────────────── */

.layout {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ── Navigation ───────────────────────────────────────────── */

.nav {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 56px;
  padding: 0 24px;
  border-bottom: 1px solid var(--border);
  background: rgba(9,9,11,.8);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-brand {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.5px;
  color: var(--text);
}
.nav-brand span {
  background: linear-gradient(135deg, var(--accent), #a78bfa);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.nav-spacer { flex: 1; }

.nav-email {
  font-size: 13px;
  color: var(--muted);
}

/* ── Main content ─────────────────────────────────────────── */

.main {
  flex: 1;
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 32px 24px 64px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.page-header {
  display: flex;
  align-items: baseline;
  gap: 16px;
  flex-wrap: wrap;
}

.page-title {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.5px;
}

/* ── Cards ────────────────────────────────────────────────── */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
}

.create-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: 2px solid var(--accent);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
}

.create-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
}

.create-card-title {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ── Section header (above table) ─────────────────────────── */

.section-header {
  display: flex;
  align-items: center;
  gap: 10px;
}

.section-title {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
}

.count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* ── Forms ────────────────────────────────────────────────── */

.form-row {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  min-width: 120px;
}

.label {
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.input {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  height: 38px;
  padding: 0 12px;
  transition: border-color 0.15s, box-shadow 0.15s;
  outline: none;
  width: 100%;
}

.input::placeholder { color: var(--muted-2); }

.input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-bg);
}

.input:hover:not(:focus) {
  border-color: var(--border-2);
}

/* ── Buttons ──────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 38px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--muted);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s, box-shadow 0.15s;
  white-space: nowrap;
  text-decoration: none;
}

.btn:hover {
  background: var(--border);
  color: var(--text);
  border-color: var(--border-2);
}

.btn:active {
  transform: translateY(1px);
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  font-weight: 600;
}

.btn-primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  color: #fff;
  box-shadow: 0 0 0 3px var(--accent-bg);
}

.btn-danger {
  background: transparent;
  color: var(--danger);
  border-color: transparent;
}

.btn-danger:hover {
  background: var(--danger-bg);
  border-color: var(--danger);
  color: var(--danger);
}

.btn-full { width: 100%; }

/* ── Auth pages ───────────────────────────────────────────── */

.auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(ellipse 60% 50% at 50% -10%, rgba(129,140,248,.15), transparent),
    var(--bg);
}

.auth-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 36px 40px;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 25px 50px rgba(0,0,0,.5);
}

.auth-title {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -1px;
  text-align: center;
  margin-bottom: 4px;
  color: var(--text);
}

.auth-title .accent { color: var(--accent); }

.auth-sub {
  font-size: 13px;
  color: var(--muted);
  text-align: center;
  margin-bottom: 28px;
}

.auth-stack {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* ── Badges ───────────────────────────────────────────────── */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.badge-expired {
  background: rgba(251,191,36,.1);
  color: #fbbf24;
  border: 1px solid rgba(251,191,36,.25);
}

.badge-locked {
  background: rgba(167,139,250,.1);
  color: #a78bfa;
  border: 1px solid rgba(167,139,250,.25);
  font-size: 12px;
}

/* ── Table ────────────────────────────────────────────────── */

.table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.table-wrap table {
  width: 100%;
  border-collapse: collapse;
}

.table-wrap thead {
  border-bottom: 1px solid var(--border);
}

.table-wrap th {
  padding: 12px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.table-wrap td {
  padding: 13px 16px;
  vertical-align: middle;
  border-bottom: 1px solid rgba(63,63,70,.4);
}

.table-wrap tr:last-child td {
  border-bottom: none;
}

.table-wrap tbody tr {
  transition: background 0.12s;
}

.table-wrap tbody tr:hover {
  background: rgba(255,255,255,.03);
}

.td-slug {
  font-weight: 600;
  font-size: 13px;
  min-width: 100px;
}

.td-slug a {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--accent);
  font-family: ui-monospace, monospace;
}

.td-slug a:hover { color: var(--accent-hover); }

.td-target {
  max-width: 300px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
  font-size: 13px;
}

.td-count {
  font-variant-numeric: tabular-nums;
  font-size: 13px;
  color: var(--muted);
  white-space: nowrap;
}

.td-count-active {
  color: var(--accent);
  font-weight: 600;
}

.td-actions {
  white-space: nowrap;
  text-align: right;
}

.td-actions .btn {
  height: 30px;
  padding: 0 10px;
  font-size: 12px;
}

.empty {
  text-align: center;
  padding: 56px 16px !important;
  color: var(--muted-2);
  font-size: 14px;
}

.empty-icon {
  display: block;
  margin: 0 auto 12px;
  opacity: 0.25;
}

.empty-msg {
  display: block;
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
  margin-bottom: 4px;
}

.empty-hint {
  font-size: 13px;
  color: var(--muted-2);
}

/* ── Row animation (HTMX afterbegin) ──────────────────────── */

@keyframes fadeSlideIn {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.row-new {
  animation: fadeSlideIn 0.22s ease-out forwards;
}

/* ── Copy button ──────────────────────────────────────────── */

.btn-copy {
  background: transparent;
  border-color: transparent;
  color: var(--muted-2);
  padding: 0 6px;
  font-size: 11px;
  height: 24px;
}

.btn-copy:hover {
  background: var(--surface-2);
  border-color: var(--border);
  color: var(--accent);
}

.btn-copy.copied {
  color: var(--success);
  border-color: rgba(74,222,128,.3);
  background: var(--success-bg);
}

/* ── Alerts ───────────────────────────────────────────────── */

.alert {
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 13px;
  line-height: 1.5;
}

.alert-error {
  background: var(--danger-bg);
  border: 1px solid rgba(248,113,113,.3);
  color: var(--danger);
}

/* ── Stats ────────────────────────────────────────────────── */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
}

.stat-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
}

.stat-value {
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -1.5px;
  color: var(--accent);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

/* ── Chart ────────────────────────────────────────────────── */

.chart-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
}

.chart-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 16px;
}

.chart-wrap {
  width: 100%;
  overflow: hidden;
}

.chart-wrap svg {
  width: 100%;
  height: auto;
}

/* ── Two-column layout ────────────────────────────────────── */

.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

@media (max-width: 600px) {
  .two-col { grid-template-columns: 1fr; }
}

/* ── Reference lists ──────────────────────────────────────── */

.ref-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 4px;
}

.ref-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-radius: 6px;
  transition: background 0.1s;
}

.ref-item:hover { background: var(--surface-2); }

.ref-name {
  font-size: 13px;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ref-count {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  margin-left: 8px;
  flex-shrink: 0;
}

/* ── Privacy notice ───────────────────────────────────────── */

.privacy-notice {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 12px;
  color: var(--muted);
}

/* ── Stats page header ────────────────────────────────────── */

.stats-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.stats-header-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stats-slug {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.5px;
  font-family: ui-monospace, "Cascadia Code", monospace;
  color: var(--accent);
}

.stats-target {
  font-size: 13px;
  color: var(--muted);
  max-width: 560px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Utilities ────────────────────────────────────────────── */

.text-muted { color: var(--muted); }
.text-sm    { font-size: 12px; }

.mb-8  { margin-bottom: 8px; }
.mt-16 { margin-top: 16px; }

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
  text-decoration: none;
  transition: color 0.15s;
}

.back-link:hover { color: var(--text); }

/* ── API key display ──────────────────────────────────────── */

.api-key {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-family: ui-monospace, monospace;
  font-size: 12px;
  color: var(--accent);
}
