/* ============================================================
   ZapMailer Pro — main.css
   Design system: dark SaaS dashboard
   ============================================================ */

/* ── Google Fonts are loaded in base.html via <link> ──────── */

/* ── CSS Custom Properties ─────────────────────────────────── */
:root {
  /* Colours */
  --bg:          #0A1A1F;
  --mid-dark:    #0F2830;
  --card:        #132F38;
  --card-hover:  #183844;
  --border:      #1E4050;
  --cyan:        #16C2D5;
  --cyan-dim:    rgba(22, 194, 213, 0.15);
  --gold:        #F5B731;
  --gold-hover:  #FFC94A;
  --gold-dim:    rgba(245, 183, 49, 0.15);
  --text:        #F0F4F5;
  --muted:       #8FA8B0;
  --success:     #34D399;
  --success-dim: rgba(52, 211, 153, 0.15);
  --warning:     #FB923C;
  --warning-dim: rgba(251, 146, 60, 0.15);
  --purple:      #A78BFA;
  --purple-dim:  rgba(167, 139, 250, 0.15);
  --error:       #F87171;
  --error-dim:   rgba(248, 113, 113, 0.15);

  /* Sidebar */
  --sidebar-w:   240px;

  /* Typography */
  --font-sans:   'DM Sans', system-ui, sans-serif;
  --font-mono:   'Space Mono', monospace;

  /* Spacing & shape */
  --radius-sm:   8px;
  --radius-md:   12px;
  --radius-lg:   16px;
  --radius-xl:   20px;

  /* Shadows */
  --shadow-card: 0 4px 24px rgba(0, 0, 0, 0.35);
  --shadow-sm:   0 2px 8px  rgba(0, 0, 0, 0.25);
  --shadow-glow-cyan: 0 0 20px rgba(22, 194, 213, 0.2);
  --shadow-glow-gold: 0 0 20px rgba(245, 183, 49, 0.25);

  /* Transitions */
  --t: 180ms ease;
}

/* ── Base Reset ─────────────────────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 15px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
}

body {
  background-color: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  line-height: 1.6;
  min-height: 100vh;
}

a {
  color: var(--cyan);
  text-decoration: none;
  transition: color var(--t), opacity var(--t);
}
a:hover { color: var(--gold); }

img { max-width: 100%; display: block; }

ul, ol { list-style: none; }

input, button, select, textarea {
  font-family: inherit;
  font-size: inherit;
}

/* ── Scrollbar ──────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--mid-dark); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--muted); }

/* ── Layout Shell ───────────────────────────────────────────── */
.layout {
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ────────────────────────────────────────────────── */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  background: var(--mid-dark);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 100;
  overflow-y: auto;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 24px 20px 20px;
  border-bottom: 1px solid var(--border);
  text-decoration: none;
}

.sidebar-logo-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--cyan), #0EA5C5);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 18px;
  color: #fff;
  flex-shrink: 0;
  box-shadow: var(--shadow-glow-cyan);
}

.sidebar-logo-text {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.3px;
  line-height: 1.2;
}
.sidebar-logo-text span {
  color: var(--cyan);
}

.sidebar-nav {
  padding: 16px 12px;
  flex: 1;
}

.nav-section-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--muted);
  padding: 8px 8px 4px;
  margin-top: 8px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  transition: background var(--t), color var(--t);
  margin-bottom: 2px;
  white-space: nowrap;
}

.nav-link:hover {
  background: var(--card);
  color: var(--text);
}

.nav-link.active {
  background: var(--cyan-dim);
  color: var(--cyan);
  font-weight: 600;
}

.nav-link .nav-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  opacity: 0.85;
}

.sidebar-footer {
  padding: 16px 12px;
  border-top: 1px solid var(--border);
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
}

.sidebar-user-avatar {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, var(--cyan-dim), var(--purple-dim));
  border: 1px solid var(--border);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--cyan);
  flex-shrink: 0;
}

.sidebar-user-info {
  flex: 1;
  min-width: 0;
}

.sidebar-user-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-role {
  font-size: 11px;
  color: var(--muted);
}

/* ── Top Header ─────────────────────────────────────────────── */
.header {
  position: fixed;
  top: 0;
  left: var(--sidebar-w);
  right: 0;
  height: 60px;
  background: rgba(10, 26, 31, 0.9);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  z-index: 90;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.header-breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
}
.header-breadcrumb .separator { opacity: 0.4; }
.header-breadcrumb .current {
  color: var(--text);
  font-weight: 500;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-user {
  display: flex;
  align-items: center;
  gap: 8px;
}

.header-user-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
}

.btn-logout {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--t);
  text-decoration: none;
}
.btn-logout:hover {
  border-color: var(--error);
  color: var(--error);
  background: var(--error-dim);
}

/* ── Main Content ───────────────────────────────────────────── */
.main-content {
  margin-left: var(--sidebar-w);
  padding-top: 60px;
  min-height: 100vh;
  flex: 1;
}

.page-container {
  padding: 32px 28px;
  max-width: 1400px;
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 28px;
  gap: 16px;
  flex-wrap: wrap;
}

.page-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
  letter-spacing: -0.3px;
}

.page-subtitle {
  font-size: 14px;
  color: var(--muted);
  margin-top: 4px;
}

/* ── Flash Messages ─────────────────────────────────────────── */
.flash-container {
  padding: 0 28px;
  padding-top: 12px;
}

.flash {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 8px;
  border: 1px solid transparent;
  position: relative;
}

.flash-success {
  background: var(--success-dim);
  border-color: rgba(52, 211, 153, 0.3);
  color: var(--success);
}
.flash-danger, .flash-error {
  background: var(--error-dim);
  border-color: rgba(248, 113, 113, 0.3);
  color: var(--error);
}
.flash-warning {
  background: var(--warning-dim);
  border-color: rgba(251, 146, 60, 0.3);
  color: var(--warning);
}
.flash-info {
  background: var(--cyan-dim);
  border-color: rgba(22, 194, 213, 0.3);
  color: var(--cyan);
}

.flash-close {
  margin-left: auto;
  background: none;
  border: none;
  color: inherit;
  opacity: 0.6;
  cursor: pointer;
  font-size: 16px;
  padding: 0 4px;
  transition: opacity var(--t);
  flex-shrink: 0;
}
.flash-close:hover { opacity: 1; }

/* ── Card Component ─────────────────────────────────────────── */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-card);
}

.card-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  gap: 12px;
  flex-wrap: wrap;
}

/* ── Metric Cards ───────────────────────────────────────────── */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.metric-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  box-shadow: var(--shadow-card);
  border-left: 3px solid var(--cyan);
  transition: transform var(--t), box-shadow var(--t);
  position: relative;
  overflow: hidden;
}
.metric-card::after {
  content: '';
  position: absolute;
  top: 0; right: 0;
  width: 80px; height: 80px;
  border-radius: 50%;
  transform: translate(30%, -30%);
  opacity: 0.06;
}

.metric-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-card), 0 8px 32px rgba(0,0,0,0.2);
}

.metric-card.accent-cyan  { border-left-color: var(--cyan); }
.metric-card.accent-cyan::after  { background: var(--cyan); }
.metric-card.accent-gold  { border-left-color: var(--gold); }
.metric-card.accent-gold::after  { background: var(--gold); }
.metric-card.accent-green { border-left-color: var(--success); }
.metric-card.accent-green::after { background: var(--success); }
.metric-card.accent-red   { border-left-color: var(--error); }
.metric-card.accent-red::after   { background: var(--error); }
.metric-card.accent-amber { border-left-color: var(--warning); }
.metric-card.accent-amber::after { background: var(--warning); }
.metric-card.accent-purple{ border-left-color: var(--purple); }
.metric-card.accent-purple::after{ background: var(--purple); }

.metric-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
}

.metric-value {
  font-family: var(--font-mono);
  font-size: 32px;
  font-weight: 700;
  color: var(--text);
  line-height: 1;
  letter-spacing: -1px;
}

.metric-card.accent-cyan  .metric-value { color: var(--cyan); }
.metric-card.accent-gold  .metric-value { color: var(--gold); }
.metric-card.accent-green .metric-value { color: var(--success); }
.metric-card.accent-red   .metric-value { color: var(--error); }
.metric-card.accent-amber .metric-value { color: var(--warning); }
.metric-card.accent-purple.metric-value { color: var(--purple); }

.metric-desc {
  font-size: 12px;
  color: var(--muted);
  margin-top: 6px;
}

/* ── Table Styles ───────────────────────────────────────────── */
.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

thead {
  background: var(--mid-dark);
  position: sticky;
  top: 0;
  z-index: 1;
}

th {
  padding: 12px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

td {
  padding: 13px 16px;
  color: var(--text);
  border-bottom: 1px solid rgba(30, 64, 80, 0.5);
  vertical-align: middle;
}

tbody tr:last-child td { border-bottom: none; }

tbody tr {
  transition: background var(--t);
}
tbody tr:hover { background: rgba(19, 47, 56, 0.6); }
tbody tr:nth-child(even) { background: rgba(15, 40, 48, 0.3); }
tbody tr:nth-child(even):hover { background: rgba(19, 47, 56, 0.6); }

.td-mono {
  font-family: var(--font-mono);
  font-size: 12px;
}

.td-email {
  font-weight: 500;
  color: var(--cyan);
}

.td-muted {
  color: var(--muted);
  font-size: 13px;
}

.table-empty {
  text-align: center;
  padding: 48px 16px;
  color: var(--muted);
  font-size: 14px;
}

/* ── Status Badges ──────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.3px;
  white-space: nowrap;
}
.badge::before {
  content: '';
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

.badge-active {
  background: var(--success-dim);
  color: var(--success);
  border: 1px solid rgba(52, 211, 153, 0.25);
}
.badge-unsubscribed {
  background: rgba(143, 168, 176, 0.1);
  color: var(--muted);
  border: 1px solid rgba(143, 168, 176, 0.2);
}
.badge-bounced {
  background: var(--warning-dim);
  color: var(--warning);
  border: 1px solid rgba(251, 146, 60, 0.25);
}
.badge-complained {
  background: var(--error-dim);
  color: var(--error);
  border: 1px solid rgba(248, 113, 113, 0.25);
}
.badge-failed {
  background: var(--error-dim);
  color: var(--error);
  border: 1px solid rgba(248, 113, 113, 0.25);
}
.badge-sent {
  background: var(--success-dim);
  color: var(--success);
  border: 1px solid rgba(52, 211, 153, 0.25);
}
.badge-pending {
  background: var(--warning-dim);
  color: var(--warning);
  border: 1px solid rgba(251, 146, 60, 0.25);
}
.badge-skipped {
  background: var(--purple-dim);
  color: var(--purple);
  border: 1px solid rgba(167, 139, 250, 0.25);
}
.badge-default {
  background: var(--cyan-dim);
  color: var(--cyan);
  border: 1px solid rgba(22, 194, 213, 0.25);
}
.badge-inactive {
  background: rgba(143, 168, 176, 0.1);
  color: var(--muted);
  border: 1px solid rgba(143, 168, 176, 0.2);
}

/* ── Button Styles ──────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: all var(--t);
  white-space: nowrap;
  line-height: 1;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
}

.btn-primary {
  background: linear-gradient(135deg, var(--gold) 0%, var(--gold-hover) 100%);
  color: #0A1A1F;
  box-shadow: 0 4px 12px rgba(245, 183, 49, 0.3);
}
.btn-primary:hover {
  background: linear-gradient(135deg, var(--gold-hover) 0%, #FFD26B 100%);
  box-shadow: 0 6px 20px rgba(245, 183, 49, 0.45);
  transform: translateY(-1px);
  color: #0A1A1F;
}
.btn-primary:active { transform: translateY(0); }

.btn-secondary {
  background: transparent;
  color: var(--cyan);
  border: 1px solid var(--cyan);
}
.btn-secondary:hover {
  background: var(--cyan-dim);
  box-shadow: var(--shadow-glow-cyan);
  color: var(--cyan);
}

.btn-danger {
  background: var(--error-dim);
  color: var(--error);
  border: 1px solid rgba(248, 113, 113, 0.4);
}
.btn-danger:hover {
  background: var(--error);
  color: #fff;
  border-color: var(--error);
}

.btn-ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
}
.btn-ghost:hover {
  background: var(--card);
  color: var(--text);
  border-color: var(--muted);
}

.btn-success {
  background: var(--success-dim);
  color: var(--success);
  border: 1px solid rgba(52, 211, 153, 0.4);
}
.btn-success:hover {
  background: var(--success);
  color: #0A1A1F;
  border-color: var(--success);
}

/* ── Form Styles ────────────────────────────────────────────── */
.form-group {
  margin-bottom: 18px;
}

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}
.form-label .required {
  color: var(--error);
  margin-left: 3px;
}

.form-hint {
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
}

.form-control {
  width: 100%;
  background: var(--mid-dark);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 10px 14px;
  font-size: 14px;
  transition: border-color var(--t), box-shadow var(--t);
  outline: none;
}
.form-control::placeholder { color: var(--muted); opacity: 0.7; }
.form-control:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(22, 194, 213, 0.15);
}
.form-control:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

textarea.form-control {
  resize: vertical;
  min-height: 100px;
}

select.form-control {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%238FA8B0' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form-check {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}
.form-check input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--cyan);
  cursor: pointer;
}

.form-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-top: 8px;
}

/* ── Search + Filter Bar ────────────────────────────────────── */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.search-input-wrapper {
  position: relative;
  flex: 1;
  min-width: 200px;
  max-width: 360px;
}

.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}

.search-input {
  padding-left: 36px;
}

/* ── Pagination ─────────────────────────────────────────────── */
.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  font-size: 13px;
  flex-wrap: wrap;
  gap: 12px;
}

.pagination-info { color: var(--muted); }

.pagination-links {
  display: flex;
  align-items: center;
  gap: 4px;
}

.page-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  transition: all var(--t);
}
.page-link:hover {
  background: var(--card);
  color: var(--text);
  border-color: var(--muted);
}
.page-link.active {
  background: var(--cyan-dim);
  border-color: var(--cyan);
  color: var(--cyan);
  font-weight: 700;
}
.page-link.disabled {
  opacity: 0.35;
  pointer-events: none;
}

/* ── Status Filter Tabs ─────────────────────────────────────── */
.tab-bar {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0;
  overflow-x: auto;
}

.tab-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color var(--t), border-color var(--t);
  white-space: nowrap;
}
.tab-link:hover { color: var(--text); }
.tab-link.active {
  color: var(--cyan);
  border-bottom-color: var(--cyan);
  font-weight: 600;
}

.tab-count {
  background: rgba(143, 168, 176, 0.15);
  border-radius: 10px;
  padding: 1px 7px;
  font-size: 11px;
  font-family: var(--font-mono);
}
.tab-link.active .tab-count {
  background: var(--cyan-dim);
  color: var(--cyan);
}

/* ── Activity Feed ──────────────────────────────────────────── */
.activity-feed { }

.activity-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid rgba(30, 64, 80, 0.4);
}
.activity-item:last-child { border-bottom: none; }

.activity-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--cyan);
  flex-shrink: 0;
  margin-top: 6px;
}

.activity-dot.dot-success  { background: var(--success); }
.activity-dot.dot-error    { background: var(--error); }
.activity-dot.dot-warning  { background: var(--warning); }
.activity-dot.dot-purple   { background: var(--purple); }
.activity-dot.dot-cyan     { background: var(--cyan); }

.activity-body { flex: 1; min-width: 0; }

.activity-event {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 2px;
}

.activity-msg {
  font-size: 14px;
  color: var(--text);
  line-height: 1.4;
}

.activity-time {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
  flex-shrink: 0;
  white-space: nowrap;
  margin-top: 4px;
}

/* ── Detail Profile Card ────────────────────────────────────── */
.profile-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: var(--shadow-card);
}

.profile-avatar {
  width: 56px;
  height: 56px;
  background: linear-gradient(135deg, var(--cyan-dim), var(--purple-dim));
  border: 2px solid var(--border);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 700;
  color: var(--cyan);
  flex-shrink: 0;
}

.profile-info { flex: 1; }

.profile-name {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}
.profile-email {
  font-size: 14px;
  color: var(--cyan);
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin-top: 20px;
}

.detail-item {}
.detail-item-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 4px;
}
.detail-item-value {
  font-size: 14px;
  color: var(--text);
  font-weight: 500;
}
.detail-item-value.mono {
  font-family: var(--font-mono);
  font-size: 12px;
}

/* ── Code / Mono block ──────────────────────────────────────── */
.code-block {
  background: var(--mid-dark);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--cyan);
  overflow-x: auto;
}

/* ── Empty State ────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 60px 24px;
}
.empty-state-icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.4;
}
.empty-state-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
}
.empty-state-desc {
  font-size: 14px;
  color: var(--muted);
  max-width: 320px;
  margin: 0 auto 24px;
  line-height: 1.6;
}

/* ── Auth Layout ────────────────────────────────────────────── */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--bg);
  position: relative;
}

.auth-page::before {
  content: '';
  position: fixed;
  top: -200px;
  left: -200px;
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(22, 194, 213, 0.06) 0%, transparent 70%);
  pointer-events: none;
}
.auth-page::after {
  content: '';
  position: fixed;
  bottom: -200px;
  right: -100px;
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(245, 183, 49, 0.05) 0%, transparent 70%);
  pointer-events: none;
}

.auth-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-card), 0 0 60px rgba(22, 194, 213, 0.05);
  position: relative;
  z-index: 1;
}

.auth-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 32px;
  text-decoration: none;
}
.auth-logo-icon {
  width: 44px;
  height: 44px;
  background: linear-gradient(135deg, var(--cyan), #0EA5C5);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 22px;
  color: #fff;
  box-shadow: var(--shadow-glow-cyan);
}
.auth-logo-text {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.4px;
}
.auth-logo-text span { color: var(--cyan); }

.auth-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 6px;
  letter-spacing: -0.3px;
}
.auth-subtitle {
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 28px;
}

.auth-footer {
  text-align: center;
  margin-top: 20px;
  font-size: 13px;
  color: var(--muted);
}

/* ── Section separator ──────────────────────────────────────── */
.section-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  margin: 28px 0 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
  letter-spacing: -0.2px;
}

/* ── UTM / Metadata chips ───────────────────────────────────── */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 20px;
  background: var(--mid-dark);
  border: 1px solid var(--border);
  font-size: 12px;
  color: var(--muted);
  font-family: var(--font-mono);
}

/* ── Settings row ───────────────────────────────────────────── */
.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0;
  border-bottom: 1px solid rgba(30, 64, 80, 0.5);
  gap: 16px;
}
.settings-row:last-child { border-bottom: none; }
.settings-key {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--cyan);
  flex-shrink: 0;
  min-width: 200px;
}
.settings-val {
  font-size: 13px;
  color: var(--text);
  word-break: break-all;
}
.settings-val.masked {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 2px;
}

/* ── Divider ────────────────────────────────────────────────── */
.divider {
  height: 1px;
  background: var(--border);
  margin: 24px 0;
}

/* ── Loading Skeleton ───────────────────────────────────────── */
@keyframes shimmer {
  0%   { background-position: -400px 0; }
  100% { background-position: 400px 0; }
}
.skeleton {
  background: linear-gradient(90deg, var(--card) 25%, var(--mid-dark) 50%, var(--card) 75%);
  background-size: 800px 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}

/* ── Utility ────────────────────────────────────────────────── */
.flex         { display: flex; }
.flex-col     { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-4  { gap: 4px; }
.gap-8  { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.mt-8  { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-0  { margin-bottom: 0; }
.mb-8  { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.text-muted  { color: var(--muted); }
.text-cyan   { color: var(--cyan); }
.text-gold   { color: var(--gold); }
.text-success{ color: var(--success); }
.text-error  { color: var(--error); }
.text-sm { font-size: 13px; }
.text-xs { font-size: 11px; }
.font-mono { font-family: var(--font-mono); }
.font-bold { font-weight: 700; }
.w-full { width: 100%; }
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 1024px) {
  :root { --sidebar-w: 200px; }
  .page-container { padding: 24px 20px; }
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform var(--t);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .main-content {
    margin-left: 0;
  }
  .header {
    left: 0;
  }
  .metrics-grid {
    grid-template-columns: 1fr 1fr;
  }
  .form-row {
    grid-template-columns: 1fr;
  }
  .page-header {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (max-width: 480px) {
  .metrics-grid { grid-template-columns: 1fr; }
  .auth-card { padding: 28px 20px; }
  .filter-bar { flex-direction: column; align-items: stretch; }
  .search-input-wrapper { max-width: 100%; }
}
