:root {
  --bg: #fafafa;
  --bg-elevated: #ffffff;
  --bg-subtle: #f3f4f6;
  --bg-hover: #eef0f4;
  --text: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --accent: #0f172a;
  --accent-hover: #1e293b;
  --accent-fg: #ffffff;
  --brand: #2563eb;
  --brand-soft: rgba(37, 99, 235, 0.1);
  --success: #10b981;
  --success-soft: rgba(16, 185, 129, 0.12);
  --warning: #f59e0b;
  --warning-soft: rgba(245, 158, 11, 0.14);
  --danger: #ef4444;
  --danger-soft: rgba(239, 68, 68, 0.12);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 8px 24px -4px rgba(15, 23, 42, 0.06), 0 2px 6px -1px rgba(15, 23, 42, 0.04);
  --font-sans: -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', Consolas, 'Liberation Mono', Menlo, monospace;
}

[data-theme="dark"] {
  --bg: #090d16;
  --bg-elevated: #111827;
  --bg-subtle: #1e293b;
  --bg-hover: #263349;
  --text: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --border: #1e293b;
  --border-strong: #334155;
  --accent: #f8fafc;
  --accent-hover: #e2e8f0;
  --accent-fg: #090d16;
  --brand: #3b82f6;
  --brand-soft: rgba(59, 130, 246, 0.16);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 10px 30px -6px rgba(0, 0, 0, 0.45);
}

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

html, body {
  margin: 0;
  padding: 0;
  background-color: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

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

.container {
  width: 100%;
  max-width: 920px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Header */
.site-header {
  border-bottom: 1px solid var(--border);
  background: var(--bg-elevated);
  position: sticky;
  top: 0;
  z-index: 30;
}

.header-inner {
  height: 62px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand-logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: -0.03em;
}

.brand-mark {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  background: var(--accent);
  color: var(--accent-fg);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 700;
}

.brand-dot {
  color: var(--brand);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-item {
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 500;
  transition: background 0.15s ease, color 0.15s ease;
}

.nav-item:hover,
.nav-item.active {
  color: var(--text);
  background: var(--bg-subtle);
}

/* Account Dropdown in Header */
.account-menu-wrap {
  position: relative;
  display: inline-flex;
}

.account-trigger {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 10px 5px 6px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  font-family: inherit;
  font-size: 0.86rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}

.account-trigger:hover,
.account-trigger.active {
  background: var(--bg-subtle);
  border-color: var(--border-strong);
}

.account-avatar {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  background: var(--brand-soft);
  color: var(--brand);
  font-weight: 700;
  font-size: 0.78rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.account-email {
  max-width: 170px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-caret {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.account-dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 215px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  padding: 6px;
  display: none;
  flex-direction: column;
  z-index: 80;
}

.account-dropdown-menu.open {
  display: flex;
}

.account-dropdown-header {
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.account-dropdown-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  font-weight: 600;
}

.account-dropdown-email {
  font-size: 0.84rem;
  color: var(--text);
  word-break: break-all;
}

.account-dropdown-divider {
  height: 1px;
  background: var(--border);
  margin: 4px 0;
}

.account-dropdown-item {
  width: 100%;
  text-align: left;
  padding: 8px 10px;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: var(--text);
  font-family: inherit;
  font-size: 0.86rem;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  transition: background 0.12s ease, color 0.12s ease;
}

.account-dropdown-item:hover {
  background: var(--bg-subtle);
}

.account-dropdown-logout {
  color: var(--danger);
}

.account-dropdown-logout:hover {
  background: var(--danger-soft);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
  text-decoration: none;
}

.btn-primary {
  background: var(--accent);
  color: var(--accent-fg);
}

.btn-primary:hover {
  background: var(--accent-hover);
}

.btn-secondary {
  background: var(--bg-elevated);
  color: var(--text);
  border-color: var(--border-strong);
}

.btn-secondary:hover {
  background: var(--bg-subtle);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: transparent;
  padding: 7px 10px;
}

.btn-ghost:hover {
  background: var(--bg-subtle);
  color: var(--text);
}

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

.btn-danger:hover {
  background: var(--danger);
  color: #ffffff;
}

.btn-sm {
  padding: 6px 11px;
  font-size: 0.82rem;
}

.icon-btn {
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
}

.icon-btn:hover {
  color: var(--text);
  border-color: var(--border-strong);
  background: var(--bg-subtle);
}

/* Main Content */
.main-content {
  flex: 1;
  padding: 42px 0 64px;
}

/* Hero Section */
.hero {
  text-align: center;
  margin-bottom: 28px;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand);
  font-size: 0.78rem;
  font-weight: 600;
  margin-bottom: 14px;
}

.hero h1 {
  font-size: clamp(1.85rem, 4vw, 2.55rem);
  font-weight: 800;
  letter-spacing: -0.035em;
  margin: 0 0 10px;
  line-height: 1.15;
}

.hero p {
  color: var(--text-secondary);
  font-size: 1.02rem;
  max-width: 540px;
  margin: 0 auto;
}

/* Card & Shortener Box */
.card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 22px;
}

.shorten-bar {
  display: flex;
  gap: 10px;
  align-items: stretch;
}

.url-input-wrap {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
}

.url-input {
  width: 100%;
  height: 48px;
  padding: 0 16px;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--border-strong);
  background: var(--bg);
  color: var(--text);
  font-size: 0.98rem;
  font-family: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.url-input:focus,
.field-input:focus,
.field-select:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
}

.shorten-submit {
  height: 48px;
  padding: 0 24px;
  border-radius: var(--radius-md);
  font-size: 0.96rem;
}

.title-inline-bar {
  margin-top: 10px;
}

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

.title-inline-input:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
}

/* Advanced Options Toggle & Panel */
.options-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
  gap: 10px;
}

.options-toggle {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border-radius: 6px;
}

.options-toggle:hover {
  color: var(--text);
  background: var(--bg-subtle);
}

.options-hint {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.options-grid {
  display: none;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 14px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px dashed var(--border);
}

.options-grid.open {
  display: grid;
}

.field-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.field-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.prefix-input-group {
  display: flex;
  align-items: center;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--bg);
  overflow: hidden;
}

.prefix-tag {
  padding: 0 10px;
  background: var(--bg-subtle);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.82rem;
  border-right: 1px solid var(--border);
  height: 38px;
  display: inline-flex;
  align-items: center;
  user-select: none;
}

.prefix-input-group input {
  border: none;
  background: transparent;
  color: var(--text);
  height: 38px;
  padding: 0 10px;
  width: 100%;
  font-family: var(--font-mono);
  font-size: 0.88rem;
}

.prefix-input-group input:focus {
  outline: none;
}

.field-input,
.field-select {
  height: 38px;
  padding: 0 11px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--bg);
  color: var(--text);
  font-size: 0.88rem;
  font-family: inherit;
  width: 100%;
}

/* Result Spotlight Banner */
.result-card {
  margin-top: 18px;
  padding: 18px 20px;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--brand);
  background: var(--brand-soft);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.result-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.result-caption {
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--brand);
}

.result-short-link {
  font-family: var(--font-mono);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text);
  word-break: break-all;
}

.result-short-link:hover {
  text-decoration: underline;
}

.result-original {
  font-size: 0.84rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 460px;
}

.result-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-shrink: 0;
  flex-wrap: wrap;
  margin-left: auto;
}

/* Alerts & Messages */
.alerts {
  margin-bottom: 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.alert {
  padding: 11px 15px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border: 1px solid transparent;
}

.alert-error,
.alert-danger {
  background: var(--danger-soft);
  color: var(--danger);
  border-color: rgba(239, 68, 68, 0.25);
}

.alert-success {
  background: var(--success-soft);
  color: var(--success);
  border-color: rgba(16, 185, 129, 0.25);
}

/* Section Headers */
.section-block {
  margin-top: 36px;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  gap: 12px;
}

.section-title {
  font-size: 1.05rem;
  font-weight: 700;
  margin: 0;
  letter-spacing: -0.01em;
}

.dashboard-filter-bar {
  flex-wrap: wrap;
  gap: 12px;
}

.dashboard-filter-form {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.dashboard-search-field {
  width: 265px;
}

.dashboard-filter-controls {
  display: flex;
  gap: 8px;
  align-items: center;
}

.dashboard-status-select {
  width: 150px;
}

/* Link List Items */
.links-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.link-row {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.link-row:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-sm);
}

.link-info {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.link-top {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.short-url-anchor {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.98rem;
  color: var(--brand);
}

.short-url-anchor:hover {
  text-decoration: underline;
}

.link-title-tag {
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--text);
}

.link-title-pill {
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--text);
  background: var(--bg-subtle);
  padding: 2px 9px;
  border-radius: 6px;
}

.edit-title-trigger {
  background: transparent;
  border: 1px dashed var(--border-strong);
  color: var(--text-muted);
  font-size: 0.75rem;
  font-family: inherit;
  padding: 2px 8px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.edit-title-trigger:hover {
  color: var(--text);
  border-color: var(--text-secondary);
  background: var(--bg-subtle);
}

.inline-title-editor {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
  margin-bottom: 4px;
  max-width: 520px;
}

.inline-title-input {
  height: 34px;
  font-size: 0.84rem;
}

.link-dest {
  font-size: 0.83rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 520px;
}

.link-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.78rem;
  color: var(--text-muted);
  flex-wrap: wrap;
}

.link-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-active {
  background: var(--success-soft);
  color: var(--success);
}

.badge-expired,
.badge-limit_reached {
  background: var(--warning-soft);
  color: var(--warning);
}

.badge-disabled {
  background: var(--danger-soft);
  color: var(--danger);
}

.clicks-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  background: var(--bg-subtle);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 600;
}

/* KPI Grid */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(185px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}

.kpi-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px 18px;
}

.kpi-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
  margin-bottom: 6px;
}

.kpi-value {
  font-size: 1.55rem;
  font-weight: 800;
  font-family: var(--font-mono);
  letter-spacing: -0.02em;
}

.kpi-sub {
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* Stats Header & Layout */
.stats-top-nav {
  margin-bottom: 10px;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
  transition: color 0.15s ease;
}

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

.stats-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 22px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--border);
}

.stats-header-info {
  flex: 1;
  min-width: 0;
}

.stats-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.stats-title {
  margin: 0;
  font-size: 1.55rem;
  font-family: var(--font-mono);
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.stats-subtitle {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  font-weight: 600;
  font-size: 0.95rem;
  margin-top: 6px;
}

.stats-target {
  display: flex;
  align-items: baseline;
  gap: 6px;
  color: var(--text-muted);
  font-size: 0.86rem;
  margin-top: 6px;
  min-width: 0;
  max-width: 100%;
}

.stats-target span {
  flex-shrink: 0;
}

.stats-target-link {
  color: var(--brand);
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
}

.stats-target-link:hover {
  text-decoration: underline;
}

.stats-header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-shrink: 0;
  flex-wrap: wrap;
  margin-left: auto;
}

.inline-action-form {
  display: inline-flex;
  margin: 0;
}

.stats-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 18px;
  margin-bottom: 20px;
}

.stats-columns {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 18px;
  margin-bottom: 20px;
}

/* Bar Chart */
.chart-bars {
  height: 160px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px;
  padding-top: 24px;
}

.chart-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
  justify-content: flex-end;
  gap: 6px;
}

.chart-count {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.chart-bar-wrap {
  width: 100%;
  max-width: 42px;
  flex: 1;
  display: flex;
  align-items: flex-end;
  background: var(--bg-subtle);
  border-radius: 6px;
  overflow: hidden;
}

.chart-bar {
  width: 100%;
  background: var(--brand);
  border-radius: 6px 6px 0 0;
  transition: height 0.3s ease;
}

.chart-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

/* Progress list in stats */
.stat-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.stat-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stat-item-head {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
}

.stat-bar-bg {
  height: 6px;
  border-radius: 999px;
  background: var(--bg-subtle);
  overflow: hidden;
}

.stat-bar-fill {
  height: 100%;
  background: var(--brand);
  border-radius: 999px;
}

/* QR Preview Box */
.qr-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 12px;
}

.qr-img {
  width: 176px;
  height: 176px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: #ffffff;
  padding: 6px;
}

.qr-img-lg {
  width: 210px;
  height: 210px;
}

/* Split Button & Format Dropdown for QR Download */
.qr-download-group {
  position: relative;
  display: inline-flex;
}

.split-btn {
  display: inline-flex;
  align-items: stretch;
}

.split-btn-main {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
  padding-right: 12px;
}

.split-btn-arrow {
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
  padding: 0 9px;
  border-left: 1px solid rgba(255, 255, 255, 0.22);
  font-size: 0.78rem;
}

[data-theme="dark"] .split-btn-arrow {
  border-left-color: rgba(9, 13, 22, 0.22);
}

.qr-dropdown-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 225px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  padding: 5px;
  display: none;
  flex-direction: column;
  gap: 2px;
  z-index: 60;
  text-align: left;
}

.qr-dropdown-group.open .qr-dropdown-menu,
.qr-dropdown-menu.open {
  display: flex;
}

.qr-dropdown-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 0.82rem;
  color: var(--text);
  transition: background 0.12s ease;
}

.qr-dropdown-item:hover {
  background: var(--bg-subtle);
}

.qr-format-badge {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--brand-soft);
  color: var(--brand);
}

/* Code / API block */
.code-block {
  background: #0d131f;
  color: #e2e8f0;
  border-radius: var(--radius-md);
  padding: 16px 18px;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  overflow-x: auto;
  line-height: 1.6;
  border: 1px solid var(--border);
}

/* API Token Box in Dashboard */
.token-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.token-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.token-box {
  margin-top: 14px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.token-code {
  font-family: var(--font-mono);
  font-size: 0.88rem;
  color: var(--text);
  word-break: break-all;
  user-select: all;
}

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(9, 13, 22, 0.55);
  backdrop-filter: blur(3px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}

.modal-backdrop.open {
  display: flex;
}

.modal-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  width: 100%;
  max-width: 360px;
  text-align: center;
  box-shadow: var(--shadow-md);
}

/* Auth Form */
.auth-wrap {
  max-width: 420px;
  margin: 24px auto;
}

.btn-google {
  width: 100%;
  height: 42px;
  background: var(--bg-elevated);
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: 0.9rem;
  font-weight: 600;
}

.btn-google:hover {
  background: var(--bg-subtle);
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 16px 0;
  color: var(--text-muted);
  font-size: 0.78rem;
}

.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.auth-form p {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.auth-form label {
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.auth-form input {
  height: 42px;
  padding: 0 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--bg);
  color: var(--text);
  font-size: 0.92rem;
}

.auth-form .helptext,
.auth-form ul {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin: 2px 0 0;
  padding-left: 16px;
}

.errorlist {
  color: var(--danger) !important;
  list-style: none;
  padding-left: 0 !important;
}

/* Table */
.table-wrap {
  overflow-x: auto;
}

.clean-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.86rem;
}

.clean-table th,
.clean-table td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}

.clean-table th {
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 22px 0;
  color: var(--text-muted);
  font-size: 0.84rem;
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

/* ==========================================================================
   Trendy Cyber-Bento Error Pages (400 / 403 / 404 / 410 / 500)
   ========================================================================== */
.error-stage {
  position: relative;
  padding: 26px 0 42px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.error-ambient {
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
  width: min(680px, 92vw);
  height: 320px;
  border-radius: 999px;
  filter: blur(78px);
  opacity: 0.26;
  pointer-events: none;
  z-index: 0;
  animation: ambientFloat 9s ease-in-out infinite alternate;
}

[data-theme="dark"] .error-ambient {
  opacity: 0.34;
}

.error-ambient-violet {
  background: radial-gradient(circle at 30% 40%, #3b82f6 0%, #8b5cf6 55%, transparent 80%);
}

.error-ambient-amber {
  background: radial-gradient(circle at 35% 40%, #f59e0b 0%, #ea580c 55%, transparent 80%);
}

.error-ambient-cyan {
  background: radial-gradient(circle at 35% 40%, #06b6d4 0%, #3b82f6 55%, transparent 80%);
}

.error-ambient-rose {
  background: radial-gradient(circle at 35% 40%, #ef4444 0%, #ec4899 55%, transparent 80%);
}

@keyframes ambientFloat {
  0% { transform: translateX(-50%) scale(0.96) translateY(0); }
  100% { transform: translateX(-48%) scale(1.05) translateY(12px); }
}

.error-bento-card {
  position: relative;
  z-index: 1;
  width: 100%;
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: 22px;
  padding: 28px 30px;
  box-shadow: var(--shadow-md);
  overflow: hidden;
  transition: transform 0.18s ease, border-color 0.2s ease;
  transform: perspective(1100px) rotateX(var(--tilt-x, 0deg)) rotateY(var(--tilt-y, 0deg));
}

.error-bento-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(var(--border-strong) 1px, transparent 1px);
  background-size: 20px 20px;
  opacity: 0.32;
  pointer-events: none;
}

.error-spotlight {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(
    420px circle at var(--mouse-x, 50%) var(--mouse-y, 35%),
    rgba(59, 130, 246, 0.11),
    transparent 65%
  );
  z-index: 0;
}

.error-top-bar {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.error-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px;
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  border: 1px solid var(--border-strong);
  background: var(--bg-subtle);
}

.error-pill-violet {
  color: #6366f1;
  border-color: rgba(99, 102, 241, 0.35);
  background: rgba(99, 102, 241, 0.1);
}

.error-pill-amber {
  color: #f59e0b;
  border-color: rgba(245, 158, 11, 0.35);
  background: rgba(245, 158, 11, 0.12);
}

.error-pill-cyan {
  color: #06b6d4;
  border-color: rgba(6, 182, 212, 0.35);
  background: rgba(6, 182, 212, 0.12);
}

.error-pill-rose {
  color: #ef4444;
  border-color: rgba(239, 68, 68, 0.35);
  background: rgba(239, 68, 68, 0.12);
}

.error-pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 8px currentColor;
  animation: dotPulse 1.8s infinite;
}

@keyframes dotPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.8); }
}

.error-node-id {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
  padding: 4px 10px;
  border-radius: 6px;
  background: var(--bg-subtle);
}

.error-hero-grid {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: 1.35fr 0.95fr;
  gap: 28px;
  align-items: center;
  margin-bottom: 26px;
}

.error-glitch-wrap {
  display: inline-flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 8px;
}

.error-glitch-code {
  position: relative;
  font-family: var(--font-mono);
  font-size: clamp(3.6rem, 7vw, 5.2rem);
  font-weight: 900;
  line-height: 0.95;
  letter-spacing: -0.05em;
  color: var(--text);
  display: inline-block;
}

.error-glitch-code::before,
.error-glitch-code::after {
  content: attr(data-text);
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  opacity: 0.65;
}

.error-glitch-code::before {
  color: #3b82f6;
  transform: translate(-2px, 1px);
  clip-path: polygon(0 0, 100% 0, 100% 42%, 0 42%);
  animation: glitchTop 3.6s infinite linear alternate-reverse;
}

.error-glitch-code::after {
  color: #ec4899;
  transform: translate(2px, -1px);
  clip-path: polygon(0 60%, 100% 60%, 100% 100%, 0 100%);
  animation: glitchBottom 2.9s infinite linear alternate-reverse;
}

@keyframes glitchTop {
  0%, 88% { transform: translate(0, 0); }
  92% { transform: translate(-3px, 1px); }
  96% { transform: translate(3px, -1px); }
  100% { transform: translate(-1px, 0); }
}

@keyframes glitchBottom {
  0%, 85% { transform: translate(0, 0); }
  90% { transform: translate(3px, 1px); }
  95% { transform: translate(-3px, -1px); }
  100% { transform: translate(1px, 0); }
}

.error-slash-badge {
  font-family: var(--font-mono);
  font-size: 1rem;
  font-weight: 800;
  padding: 4px 9px;
  border-radius: 8px;
  background: var(--accent);
  color: var(--accent-fg);
  transform: translateY(-8px);
}

.error-headline {
  margin: 0 0 10px;
  font-size: clamp(1.5rem, 3vw, 2.05rem);
  font-weight: 800;
  letter-spacing: -0.025em;
  line-height: 1.2;
}

.error-lead {
  margin: 0 0 20px;
  color: var(--text-secondary);
  font-size: 0.96rem;
  line-height: 1.6;
}

.error-lead code {
  font-family: var(--font-mono);
  font-size: 0.88rem;
  padding: 2px 7px;
  border-radius: 6px;
  background: var(--bg-subtle);
  color: var(--brand);
}

/* Instant Claim Free Alias Box on 404 */
.error-claim-box {
  margin: 0 0 22px;
  padding: 15px 16px;
  border-radius: var(--radius-md);
  border: 1px dashed var(--brand);
  background: var(--brand-soft);
}

.error-claim-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}

.error-claim-spark {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--brand);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.error-claim-slug {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 6px;
  background: var(--bg-elevated);
  color: var(--text);
}

.error-claim-desc {
  margin: 0 0 10px;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.error-claim-form {
  display: flex;
  gap: 8px;
}

.error-claim-input {
  flex: 1;
  height: 38px;
  padding: 0 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--bg-elevated);
  color: var(--text);
  font-size: 0.88rem;
}

.error-claim-btn {
  height: 38px;
  padding: 0 14px;
  font-size: 0.85rem;
  white-space: nowrap;
}

.error-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* SVG Artwork Frame */
.error-art-frame {
  border-radius: 18px;
  border: 1px solid var(--border);
  background: var(--bg);
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 220px;
  position: relative;
  overflow: hidden;
}

.error-svg {
  width: 100%;
  max-width: 260px;
  height: auto;
}

.svg-orbit {
  fill: none;
  stroke: var(--border-strong);
  stroke-width: 1.5;
  stroke-dasharray: 6 6;
  transform-origin: 130px 110px;
  animation: orbitSpin 22s linear infinite;
}

.svg-orbit-2 {
  stroke-dasharray: 4 8;
  animation-direction: reverse;
  animation-duration: 15s;
}

.svg-orbit-warn {
  stroke: rgba(245, 158, 11, 0.45);
}

.svg-orbit-danger {
  stroke: rgba(239, 68, 68, 0.45);
}

.svg-orbit-danger-2 {
  stroke: rgba(236, 72, 153, 0.4);
  animation-direction: reverse;
}

@keyframes orbitSpin {
  to { transform: rotate(360deg); }
}

.svg-cable {
  fill: none;
  stroke-width: 5;
  stroke-linecap: round;
}

.svg-cable-dashed {
  stroke: #8b5cf6;
  stroke-dasharray: 10 6;
}

.svg-node-pulse {
  animation: dotPulse 1.5s ease-in-out infinite;
}

.svg-spark {
  animation: sparkFloat 2.2s ease-in-out infinite alternate;
}

.svg-spark-2 {
  animation-delay: 0.5s;
}

.svg-spark-3 {
  animation-delay: 1s;
}

@keyframes sparkFloat {
  0% { transform: translateY(-6px) scale(0.85); opacity: 0.45; }
  100% { transform: translateY(6px) scale(1.2); opacity: 1; }
}

.svg-shield {
  fill: rgba(245, 158, 11, 0.1);
  stroke: #f59e0b;
  stroke-width: 2.5;
  stroke-linejoin: round;
}

.svg-lock-body {
  fill: #f59e0b;
}

.svg-lock-shackle {
  fill: none;
  stroke: #f59e0b;
  stroke-width: 3.5;
  stroke-linecap: round;
}

.svg-laser-scan {
  stroke: #ef4444;
  stroke-width: 2;
  stroke-dasharray: 8 4;
  animation: laserSweep 2.4s ease-in-out infinite alternate;
}

@keyframes laserSweep {
  0% { transform: translateY(-36px); opacity: 0.35; }
  50% { opacity: 0.95; }
  100% { transform: translateY(36px); opacity: 0.35; }
}

.wave-bar {
  fill: #06b6d4;
  transform-origin: center 106px;
  animation: waveBounce 1.2s ease-in-out infinite alternate;
}

.wave-bar-2 { fill: #3b82f6; animation-delay: 0.2s; }
.wave-bar-3 { fill: #6366f1; animation-delay: 0.4s; }
.wave-bar-4 { fill: #ec4899; animation-delay: 0.6s; }

@keyframes waveBounce {
  0% { transform: scaleY(0.45); }
  100% { transform: scaleY(1.08); }
}

.svg-core-triangle {
  fill: rgba(239, 68, 68, 0.12);
  stroke: #ef4444;
  stroke-width: 3;
  stroke-linejoin: round;
}

.svg-bolt {
  fill: none;
  stroke: #f59e0b;
  stroke-width: 3.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.svg-caption {
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 700;
  fill: var(--text-muted);
  letter-spacing: 0.08em;
}

/* Telemetry Terminal Console */
.error-telemetry {
  position: relative;
  z-index: 2;
  border-radius: 14px;
  background: #0b101b;
  border: 1px solid #1e293b;
  color: #cbd5e1;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  overflow: hidden;
}

.telemetry-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 14px;
  background: #111827;
  border-bottom: 1px solid #1e293b;
}

.telemetry-dots {
  display: inline-flex;
  gap: 6px;
}

.telemetry-dots span {
  width: 9px;
  height: 9px;
  border-radius: 50%;
}

.telemetry-dots span:nth-child(1) { background: #ef4444; }
.telemetry-dots span:nth-child(2) { background: #f59e0b; }
.telemetry-dots span:nth-child(3) { background: #10b981; }

.telemetry-title {
  color: #64748b;
  font-size: 0.74rem;
}

.telemetry-badge {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 4px;
  background: rgba(59, 130, 246, 0.18);
  color: #60a5fa;
}

.telemetry-body {
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.telemetry-line {
  display: flex;
  align-items: baseline;
  gap: 14px;
  flex-wrap: wrap;
}

.t-key {
  color: #64748b;
  min-width: 140px;
  font-weight: 600;
  font-size: 0.75rem;
}

.t-val {
  color: #e2e8f0;
  word-break: break-all;
}

.t-val-violet { color: #a78bfa; font-weight: 700; }
.t-val-amber { color: #fbbf24; font-weight: 700; }
.t-val-cyan { color: #22d3ee; font-weight: 700; }
.t-val-rose { color: #f87171; font-weight: 700; }
.t-val-trace { color: #34d399; }

@media (max-width: 680px) {
  .container {
    padding: 0 14px;
  }
  .header-inner {
    height: 56px;
    gap: 8px;
  }
  .brand-logo {
    gap: 7px;
    font-size: 1.02rem;
    flex-shrink: 0;
  }
  .brand-mark {
    width: 25px;
    height: 25px;
    font-size: 0.78rem;
  }
  .nav-links {
    gap: 4px;
    flex-shrink: 0;
  }
  .nav-item {
    padding: 5px 7px;
    font-size: 0.8rem;
    white-space: nowrap;
  }
  .nav-links .btn-sm {
    height: 30px;
    padding: 0 9px;
    font-size: 0.78rem;
    white-space: nowrap;
  }
  .account-trigger {
    padding: 3px 7px 3px 4px;
    gap: 4px;
  }
  .account-email {
    display: none;
  }
  .account-dropdown-menu {
    right: 0;
    max-width: calc(100vw - 28px);
  }
  .site-header .icon-btn {
    width: 30px;
    height: 30px;
    font-size: 0.85rem;
  }
  .error-bento-card {
    padding: 20px 18px;
  }
  .error-hero-grid {
    grid-template-columns: 1fr;
  }
  .error-claim-form {
    flex-direction: column;
  }
  .shorten-bar {
    flex-direction: column;
  }
  .token-header,
  .token-box {
    flex-direction: column;
    align-items: flex-start;
  }
  .stats-header {
    flex-direction: column;
    align-items: stretch;
    gap: 14px;
  }
  .stats-header-info {
    width: 100%;
    max-width: 100%;
  }
  .stats-title {
    font-size: 1.35rem;
    word-break: break-all;
  }
  .stats-header-actions {
    width: 100%;
    justify-content: flex-start;
    margin-left: 0;
  }
  .result-card {
    flex-direction: column;
    align-items: stretch;
  }
  .result-main {
    width: 100%;
  }
  .result-original {
    max-width: 100%;
  }
  .result-actions {
    width: 100%;
    justify-content: flex-start;
    margin-left: 0;
  }
  .stats-grid {
    grid-template-columns: 1fr;
  }
  .dashboard-filter-form {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
  }
  .dashboard-search-field {
    width: 100%;
  }
  .dashboard-filter-controls {
    width: 100%;
  }
  .dashboard-status-select {
    flex: 1;
    width: auto;
  }
  .link-row {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    padding: 14px;
    overflow: hidden;
  }
  .link-info {
    width: 100%;
  }
  .link-dest {
    max-width: 100%;
  }
  .inline-title-editor {
    flex-wrap: wrap;
    max-width: 100%;
  }
  .link-controls {
    width: 100%;
    flex-wrap: wrap;
    justify-content: flex-start;
    gap: 6px;
    padding-top: 10px;
    border-top: 1px solid var(--border);
  }
}

@media (max-width: 390px) {
  .brand-dot {
    display: none;
  }
  .nav-item {
    padding: 4px 6px;
    font-size: 0.76rem;
  }
}
