/* ============================================================
   SGH Content Studio — Design System
   Premium editorial dashboard CSS
   ============================================================ */

/* ── Custom Properties ────────────────────────────────────── */
:root {
  /* Colors */
  --primary:        #2563EB;
  --primary-light:  #DBEAFE;
  --primary-dark:   #1D4ED8;
  --primary-hover:  #1E40AF;
  --success:        #16A34A;
  --success-light:  #DCFCE7;
  --warning:        #D97706;
  --warning-light:  #FEF3C7;
  --error:          #DC2626;
  --error-light:    #FEE2E2;
  --info:           #0891B2;
  --info-light:     #CFFAFE;

  /* Text */
  --text-primary:   #0F172A;
  --text-secondary: #475569;
  --text-muted:     #94A3B8;
  --text-inverse:   #FFFFFF;

  /* Surfaces */
  --surface:        #FFFFFF;
  --surface-2:      #F8FAFC;
  --surface-3:      #F1F5F9;
  --surface-hover:  #EFF6FF;

  /* Borders */
  --border:         #E2E8F0;
  --border-hover:   #CBD5E1;
  --border-focus:   #2563EB;

  /* Sidebar */
  --sidebar-bg:     #0F172A;
  --sidebar-text:   #94A3B8;
  --sidebar-active-bg: #1E3A8A;
  --sidebar-active-text: #FFFFFF;
  --sidebar-hover-bg: #1E293B;
  --sidebar-width:  260px;
  --topbar-height:  60px;

  /* Shadows */
  --shadow-sm:   0 1px 2px 0 rgba(0,0,0,0.05);
  --shadow:      0 1px 3px 0 rgba(0,0,0,0.1), 0 1px 2px -1px rgba(0,0,0,0.1);
  --shadow-md:   0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -2px rgba(0,0,0,0.1);
  --shadow-lg:   0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -4px rgba(0,0,0,0.1);
  --shadow-xl:   0 20px 25px -5px rgba(0,0,0,0.1), 0 8px 10px -6px rgba(0,0,0,0.1);

  /* Spacing */
  --space-1: 4px; --space-2: 8px; --space-3: 12px;
  --space-4: 16px; --space-5: 20px; --space-6: 24px;
  --space-8: 32px; --space-10: 40px; --space-12: 48px;

  /* Radii */
  --radius-sm: 4px; --radius: 8px; --radius-lg: 12px;
  --radius-xl: 16px; --radius-full: 9999px;

  /* Typography */
  --font-ui:    'Inter', system-ui, sans-serif;
  --font-hindi: 'Noto Sans Devanagari', 'Inter', sans-serif;
  --font-mono:  'JetBrains Mono', 'Fira Code', monospace;

  /* Transitions */
  --transition: 200ms ease;
  --transition-slow: 300ms ease;
}

/* ── Reset & Base ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 15px; scroll-behavior: smooth; }

body {
  font-family: var(--font-ui);
  color: var(--text-primary);
  background: var(--surface-2);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

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

img { max-width: 100%; height: auto; display: block; }

button { cursor: pointer; font-family: inherit; }

input, select, textarea { font-family: inherit; }

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

/* ── App Layout ───────────────────────────────────────────── */
#app {
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ──────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 200;
  transition: transform var(--transition-slow);
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-5) var(--space-4);
  border-bottom: 1px solid #1E293B;
  min-height: 68px;
}

.sidebar-logo svg { flex-shrink: 0; }

.sidebar-logo-text { display: flex; flex-direction: column; }
.sidebar-logo-name { color: #F8FAFC; font-weight: 700; font-size: 1rem; letter-spacing: -0.01em; }
.sidebar-logo-version { color: #475569; font-size: 0.7rem; }

.sidebar-nav {
  flex: 1;
  padding: var(--space-4) var(--space-3);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-section-label {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #334155;
  padding: var(--space-4) var(--space-3) var(--space-2);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 9px var(--space-3);
  border-radius: var(--radius);
  color: var(--sidebar-text);
  font-size: 0.875rem;
  font-weight: 500;
  transition: all var(--transition);
  text-decoration: none;
  position: relative;
}

.nav-item:hover {
  background: var(--sidebar-hover-bg);
  color: #E2E8F0;
  text-decoration: none;
}

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

.nav-item.active .nav-icon { color: #60A5FA; }

.nav-icon { width: 18px; height: 18px; flex-shrink: 0; }

.nav-badge {
  margin-left: auto;
  background: var(--primary);
  color: white;
  font-size: 0.6rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: var(--radius-full);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.sidebar-footer {
  padding: var(--space-4);
  border-top: 1px solid #1E293B;
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 150;
  backdrop-filter: blur(2px);
}

/* ── Main wrapper ─────────────────────────────────────────── */
.main-wrapper {
  flex: 1;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ── Top bar ──────────────────────────────────────────────── */
.top-bar {
  height: var(--topbar-height);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-6);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}

.top-bar-left { display: flex; align-items: center; gap: var(--space-4); }

.hamburger {
  display: none;
  background: none;
  border: none;
  color: var(--text-secondary);
  padding: var(--space-2);
  border-radius: var(--radius-sm);
}
.hamburger:hover { background: var(--surface-3); }

.breadcrumb { font-size: 0.9rem; font-weight: 600; color: var(--text-primary); }

.top-bar-right { display: flex; align-items: center; gap: var(--space-3); }

.connection-status {
  display: flex; align-items: center; gap: 5px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
  border: 1px solid var(--border);
  background: var(--surface-2);
  cursor: pointer;
  transition: all var(--transition);
}
.connection-status:hover { border-color: var(--border-hover); background: var(--surface-3); }

.status-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--text-muted);
}
.status-dot.ok     { background: var(--success); box-shadow: 0 0 4px var(--success); }
.status-dot.error  { background: var(--error); }
.status-dot.loading{ background: var(--warning); animation: pulse-dot 1s infinite; }

@keyframes pulse-dot { 0%,100%{ opacity:1; } 50%{ opacity:0.4; } }

/* ── Page content ─────────────────────────────────────────── */
.page-content {
  flex: 1;
  padding: var(--space-6);
  max-width: 1400px;
  width: 100%;
}

/* ── Buttons ──────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: var(--space-2);
  padding: 8px 16px;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 600;
  font-family: inherit;
  border: 1.5px solid transparent;
  transition: all var(--transition);
  cursor: pointer;
  line-height: 1;
  white-space: nowrap;
  text-decoration: none;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn svg { width: 16px; height: 16px; flex-shrink: 0; }

.btn-primary { background: var(--primary); color: white; border-color: var(--primary); }
.btn-primary:hover:not(:disabled) { background: var(--primary-dark); border-color: var(--primary-dark); box-shadow: 0 4px 12px rgba(37,99,235,0.35); }

.btn-secondary { background: var(--surface); color: var(--text-primary); border-color: var(--border); }
.btn-secondary:hover:not(:disabled) { background: var(--surface-3); border-color: var(--border-hover); }

.btn-danger { background: var(--error); color: white; border-color: var(--error); }
.btn-danger:hover:not(:disabled) { background: #B91C1C; border-color: #B91C1C; }

.btn-ghost { background: transparent; color: var(--text-secondary); border-color: transparent; }
.btn-ghost:hover:not(:disabled) { background: var(--surface-3); color: var(--text-primary); }

.btn-success { background: var(--success); color: white; border-color: var(--success); }
.btn-success:hover:not(:disabled) { background: #15803D; }

.btn-sm { padding: 5px 10px; font-size: 0.8rem; }
.btn-lg { padding: 12px 24px; font-size: 1rem; }
.btn-icon { padding: 8px; }
.btn-full { width: 100%; }

/* Loading state */
.btn.loading { position: relative; color: transparent !important; }
.btn.loading::after {
  content: '';
  position: absolute;
  width: 16px; height: 16px;
  border: 2px solid rgba(255,255,255,0.4);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

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

/* ── Cards ────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.card-header {
  padding: var(--space-5) var(--space-6);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--space-4);
}
.card-title { font-size: 1rem; font-weight: 700; color: var(--text-primary); }
.card-subtitle { font-size: 0.8rem; color: var(--text-muted); margin-top: 2px; }
.card-body { padding: var(--space-6); }
.card-footer { padding: var(--space-4) var(--space-6); border-top: 1px solid var(--border); background: var(--surface-2); display: flex; align-items: center; gap: var(--space-3); }

/* ── Badges ───────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.badge-success { background: var(--success-light); color: var(--success); }
.badge-warning { background: var(--warning-light); color: var(--warning); }
.badge-error   { background: var(--error-light);   color: var(--error); }
.badge-info    { background: var(--info-light);    color: var(--info); }
.badge-gray    { background: var(--surface-3);    color: var(--text-secondary); }
.badge-primary { background: var(--primary-light); color: var(--primary); }

/* ── Forms ────────────────────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: var(--space-2); }

.form-label {
  font-size: 0.8rem; font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase; letter-spacing: 0.04em;
}

.form-input, .form-select, .form-textarea {
  padding: 9px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-family: inherit;
  color: var(--text-primary);
  background: var(--surface);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
  width: 100%;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}
.form-input::placeholder { color: var(--text-muted); }
.form-textarea { resize: vertical; min-height: 120px; }
.form-error { font-size: 0.8rem; color: var(--error); }

.char-counter { font-size: 0.75rem; color: var(--text-muted); text-align: right; }
.char-counter.over { color: var(--error); }

/* ── Tables ───────────────────────────────────────────────── */
.table-wrapper { overflow-x: auto; border-radius: var(--radius-lg); border: 1px solid var(--border); }

.data-table {
  width: 100%;
  font-size: 0.875rem;
}
.data-table thead { background: var(--surface-2); }
.data-table th {
  padding: 10px 14px;
  text-align: left;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.data-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text-primary);
  vertical-align: middle;
}
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: var(--surface-hover); }

/* ── Modals ───────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(15,23,42,0.6);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  padding: var(--space-4);
  animation: fade-in 200ms ease;
}
.modal {
  background: var(--surface);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  width: 100%; max-width: 500px;
  max-height: 90vh;
  display: flex; flex-direction: column;
  animation: slide-up 200ms ease;
}
.modal-lg  { max-width: 800px; }
.modal-xl  { max-width: 1100px; }
.modal-header {
  padding: var(--space-5) var(--space-6);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.modal-header h3 { font-size: 1.05rem; font-weight: 700; }
.modal-close {
  background: none; border: none;
  color: var(--text-muted); padding: 4px;
  border-radius: var(--radius-sm);
  font-size: 1.2rem; line-height: 1;
}
.modal-close:hover { background: var(--surface-3); color: var(--text-primary); }
.modal-body { padding: var(--space-6); overflow-y: auto; flex: 1; }
.modal-footer {
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid var(--border);
  display: flex; justify-content: flex-end; gap: var(--space-3);
}

/* ── Toasts ───────────────────────────────────────────────── */
.toast-container {
  position: fixed; bottom: var(--space-6); right: var(--space-6);
  z-index: 2000;
  display: flex; flex-direction: column; gap: var(--space-2);
  max-width: 380px; width: calc(100% - 32px);
}

.toast {
  display: flex; align-items: flex-start; gap: var(--space-3);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-4) var(--space-5);
  box-shadow: var(--shadow-lg);
  animation: slide-in-right 250ms ease;
  cursor: pointer;
  border-left: 4px solid var(--border);
}
.toast-success { border-left-color: var(--success); }
.toast-error   { border-left-color: var(--error); }
.toast-warning { border-left-color: var(--warning); }
.toast-info    { border-left-color: var(--info); }
.toast-icon { font-size: 1.1rem; flex-shrink: 0; margin-top: 1px; }
.toast-message { font-size: 0.875rem; color: var(--text-primary); flex: 1; font-weight: 500; }
.toast-dismiss { color: var(--text-muted); font-size: 1rem; flex-shrink: 0; }
.toast.removing { animation: slide-out-right 200ms ease forwards; }

/* ── Skeleton ─────────────────────────────────────────────── */
.skeleton {
  background: linear-gradient(90deg, var(--surface-3) 25%, var(--border) 50%, var(--surface-3) 75%);
  background-size: 200% 100%;
  animation: skeleton-pulse 1.5s ease infinite;
  border-radius: var(--radius-sm);
}
@keyframes skeleton-pulse { 0%{background-position:200% 0} 100%{background-position:-200% 0} }
.skeleton-text { height: 16px; margin-bottom: 8px; }
.skeleton-text.sm { height: 12px; }
.skeleton-text.lg { height: 22px; }

/* ── Progress ─────────────────────────────────────────────── */
.progress-bar {
  height: 6px; background: var(--border);
  border-radius: var(--radius-full); overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), #60A5FA);
  border-radius: var(--radius-full);
  transition: width 300ms ease;
}

/* ── Step Wizard ──────────────────────────────────────────── */
.step-wizard {
  display: flex; align-items: flex-start;
  gap: 0; overflow-x: auto;
  padding-bottom: var(--space-2);
}
.step {
  display: flex; align-items: center;
  flex: 1; min-width: 80px;
}
.step-item {
  display: flex; flex-direction: column; align-items: center;
  gap: 6px; flex: 1;
}
.step-circle {
  width: 32px; height: 32px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.8rem; font-weight: 700;
  border: 2px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  transition: all var(--transition);
  flex-shrink: 0;
}
.step.active   .step-circle { border-color: var(--primary); background: var(--primary); color: white; }
.step.complete .step-circle { border-color: var(--success); background: var(--success); color: white; }
.step-label { font-size: 0.7rem; font-weight: 600; color: var(--text-muted); text-align: center; white-space: nowrap; }
.step.active   .step-label { color: var(--primary); }
.step.complete .step-label { color: var(--success); }
.step-line { flex: 1; height: 2px; background: var(--border); margin-top: -20px; min-width: 20px; }
.step.complete + .step .step-line { background: var(--success); }

/* ── Tabs ─────────────────────────────────────────────────── */
.tabs { display: flex; border-bottom: 2px solid var(--border); gap: 0; }
.tab {
  padding: var(--space-3) var(--space-5);
  font-size: 0.875rem; font-weight: 600;
  color: var(--text-secondary);
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  cursor: pointer; background: none; border-top: none; border-left: none; border-right: none;
  transition: all var(--transition);
  white-space: nowrap;
}
.tab:hover { color: var(--primary); background: var(--primary-light); border-radius: var(--radius) var(--radius) 0 0; }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }

/* ── Alerts ───────────────────────────────────────────────── */
.alert {
  display: flex; align-items: flex-start; gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  border-radius: var(--radius-lg);
  font-size: 0.875rem;
  border: 1px solid;
}
.alert-icon { font-size: 1rem; flex-shrink: 0; margin-top: 1px; }
.alert-info    { background: var(--info-light);    border-color: #A5F3FC; color: #164E63; }
.alert-success { background: var(--success-light); border-color: #BBF7D0; color: #14532D; }
.alert-warning { background: var(--warning-light); border-color: #FDE68A; color: #78350F; }
.alert-error   { background: var(--error-light);   border-color: #FECACA; color: #7F1D1D; }

/* ── Chips / Tags ─────────────────────────────────────────── */
.chip-container { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: center; min-height: 40px; padding: 6px 10px; border: 1.5px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.chip-container:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,0.1); }
.chip {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--primary-light); color: var(--primary);
  padding: 2px 8px; border-radius: var(--radius-full);
  font-size: 0.8rem; font-weight: 600;
}
.chip-remove { background: none; border: none; color: var(--primary); font-size: 1rem; line-height: 1; cursor: pointer; padding: 0; }
.chip-input { border: none; outline: none; font-size: 0.875rem; min-width: 100px; background: transparent; flex: 1; }

/* ── Score Ring ───────────────────────────────────────────── */
.score-ring {
  width: 100px; height: 100px;
  position: relative; display: flex; align-items: center; justify-content: center;
}
.score-ring svg { transform: rotate(-90deg); }
.score-ring-bg   { fill: none; stroke: var(--border); stroke-width: 8; }
.score-ring-fill { fill: none; stroke: var(--primary); stroke-width: 8; stroke-linecap: round; transition: stroke-dashoffset 600ms ease; }
.score-ring-fill.good    { stroke: var(--success); }
.score-ring-fill.ok      { stroke: var(--warning); }
.score-ring-fill.bad     { stroke: var(--error); }
.score-value { position: absolute; font-size: 1.4rem; font-weight: 800; color: var(--text-primary); }

/* ── Split Panel ──────────────────────────────────────────── */
.split-panel { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-6); align-items: start; }
.split-panel.left-heavy { grid-template-columns: 3fr 2fr; }

/* ── Link Rows ────────────────────────────────────────────── */
.link-row { display: grid; grid-template-columns: auto 1fr auto auto auto; gap: var(--space-3); align-items: center; padding: var(--space-3) 0; border-bottom: 1px solid var(--border); }
.link-type-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.link-type-dot.official { background: var(--success); }
.link-type-dot.third-party { background: var(--warning); }
.link-type-dot.broken { background: var(--error); }

/* ── Audit Findings ───────────────────────────────────────── */
.audit-finding {
  display: flex; align-items: flex-start; gap: var(--space-3);
  padding: var(--space-4);
  border-radius: var(--radius);
  border: 1px solid;
  font-size: 0.875rem;
  margin-bottom: var(--space-3);
}
.audit-critical { background: var(--error-light);   border-color: #FECACA; }
.audit-warning  { background: var(--warning-light); border-color: #FDE68A; }
.audit-info     { background: var(--info-light);    border-color: #BAE6FD; }

/* ── Version Diff ─────────────────────────────────────────── */
.diff-added   { background: #DCFCE7; color: #14532D; padding: 0 2px; border-radius: 2px; }
.diff-removed { background: #FEE2E2; color: #7F1D1D; padding: 0 2px; border-radius: 2px; text-decoration: line-through; }

/* ── Article Preview ──────────────────────────────────────── */
.article-preview {
  font-family: var(--font-ui);
  font-size: 0.95rem;
  line-height: 1.8;
  color: var(--text-primary);
}
.article-preview h1 { font-size: 1.4rem; font-weight: 800; margin-bottom: 1rem; color: #1E3A5F; }
.article-preview h2 { font-size: 1.15rem; font-weight: 700; margin: 1.5rem 0 0.75rem; color: #1E3A5F; border-left: 3px solid var(--primary); padding-left: 10px; }
.article-preview h3 { font-size: 1rem; font-weight: 700; margin: 1.2rem 0 0.5rem; color: #334155; }
.article-preview p  { margin-bottom: 0.9rem; }
.article-preview table { margin: 1rem 0; font-size: 0.875rem; }
.article-preview th { background: #EFF6FF; font-weight: 600; padding: 8px 12px; border: 1px solid #BFDBFE; text-align: left; }
.article-preview td { padding: 8px 12px; border: 1px solid var(--border); }
.article-preview tr:nth-child(even) td { background: #F8FAFC; }
.article-preview a  { color: var(--primary); }
.article-preview ul, .article-preview ol { padding-left: 1.5rem; margin-bottom: 0.9rem; }
.article-preview li { margin-bottom: 4px; }
.article-preview .hindi-text { font-family: var(--font-hindi); }

/* ── Hindi text ───────────────────────────────────────────── */
.hindi-text { font-family: var(--font-hindi); }

/* ── Dashboard Stats ──────────────────────────────────────── */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--space-4); }
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: var(--space-5); display: flex; flex-direction: column; gap: var(--space-2); }
.stat-value { font-size: 2rem; font-weight: 800; color: var(--text-primary); line-height: 1; }
.stat-label { font-size: 0.8rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }
.stat-change { font-size: 0.75rem; font-weight: 600; }
.stat-change.up   { color: var(--success); }
.stat-change.down { color: var(--error); }

/* ── Connection Health Cards ──────────────────────────────── */
.health-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-4); }
.health-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: var(--space-5); }
.health-status { display: flex; align-items: center; gap: var(--space-2); margin-bottom: var(--space-3); }
.health-status-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--text-muted); }
.health-status-dot.connected    { background: var(--success); box-shadow: 0 0 6px var(--success); }
.health-status-dot.disconnected { background: var(--error); }
.health-name { font-size: 0.9rem; font-weight: 700; }
.health-detail { font-size: 0.8rem; color: var(--text-secondary); }

/* ── Search & Filters ─────────────────────────────────────── */
.search-bar { display: flex; align-items: center; gap: var(--space-3); }
.search-input-wrap { position: relative; flex: 1; }
.search-icon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--text-muted); width: 16px; height: 16px; }
.search-input-wrap .form-input { padding-left: 34px; }
.filter-row { display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; }

/* ── Loading screen ───────────────────────────────────────── */
.loading-screen {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-height: 400px; gap: var(--space-4); color: var(--text-muted);
}
.spinner {
  width: 36px; height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

/* ── Login ────────────────────────────────────────────────── */
.login-overlay {
  position: fixed; inset: 0;
  background: linear-gradient(135deg, #0F172A 0%, #1E3A8A 50%, #0F172A 100%);
  z-index: 3000;
  display: flex; align-items: center; justify-content: center;
  padding: var(--space-4);
}
.login-card {
  background: rgba(255,255,255,0.07);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--radius-xl);
  padding: var(--space-8);
  width: 100%; max-width: 400px;
  box-shadow: 0 32px 64px rgba(0,0,0,0.5);
}
.login-logo {
  display: flex; flex-direction: column; align-items: center; gap: var(--space-3);
  margin-bottom: var(--space-8);
}
.login-logo h1 { font-size: 1.3rem; font-weight: 800; color: white; }
.login-logo p  { font-size: 0.85rem; color: rgba(255,255,255,0.6); }
.login-form { display: flex; flex-direction: column; gap: var(--space-5); }
.login-form .form-label { color: rgba(255,255,255,0.7); }
.login-form .form-input { background: rgba(255,255,255,0.08); border-color: rgba(255,255,255,0.15); color: white; }
.login-form .form-input:focus { border-color: #60A5FA; }
.login-form .form-input::placeholder { color: rgba(255,255,255,0.3); }
.login-error { background: rgba(220,38,38,0.2); border: 1px solid rgba(220,38,38,0.4); color: #FCA5A5; padding: var(--space-3) var(--space-4); border-radius: var(--radius); font-size: 0.85rem; min-height: 0; display: none; }
.login-error.visible { display: block; }

/* ── SEO Preview ──────────────────────────────────────────── */
.seo-preview {
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: var(--space-4) var(--space-5);
  font-family: Arial, sans-serif;
  background: var(--surface);
}
.seo-url     { color: #1a0dab; font-size: 0.8rem; margin-bottom: 3px; }
.seo-title   { color: #1a0dab; font-size: 1.05rem; font-weight: 400; margin-bottom: 4px; }
.seo-title:hover { text-decoration: underline; cursor: pointer; }
.seo-desc    { color: #4d5156; font-size: 0.85rem; line-height: 1.5; }
.seo-breadcrumb { color: #006621; font-size: 0.8rem; }
.seo-limit-bar { height: 4px; border-radius: 2px; background: var(--border); margin-top: 4px; }
.seo-limit-fill { height: 100%; border-radius: 2px; background: var(--success); transition: width 0.2s, background 0.2s; }
.seo-limit-fill.warn { background: var(--warning); }
.seo-limit-fill.over { background: var(--error); }

/* ── Animations ───────────────────────────────────────────── */
@keyframes fade-in    { from{opacity:0} to{opacity:1} }
@keyframes slide-up   { from{opacity:0;transform:translateY(20px)} to{opacity:1;transform:translateY(0)} }
@keyframes slide-in-right  { from{opacity:0;transform:translateX(100%)} to{opacity:1;transform:translateX(0)} }
@keyframes slide-out-right { from{opacity:1;transform:translateX(0)} to{opacity:0;transform:translateX(100%)} }
@keyframes zoom-in    { from{opacity:0;transform:scale(0.95)} to{opacity:1;transform:scale(1)} }

.animate-in { animation: fade-in 300ms ease; }

/* ── Utility ──────────────────────────────────────────────── */
.flex { display: flex; } .flex-col { flex-direction: column; }
.items-center { align-items: center; } .justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; } .gap-3 { gap: 12px; } .gap-4 { gap: 16px; }
.text-muted { color: var(--text-muted); } .text-sm { font-size: 0.8rem; } .text-xs { font-size: 0.72rem; }
.font-bold { font-weight: 700; } .font-semibold { font-weight: 600; }
.mt-4 { margin-top: 16px; } .mt-6 { margin-top: 24px; } .mb-4 { margin-bottom: 16px; } .mb-6 { margin-bottom: 24px; }
.w-full { width: 100%; } .truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hidden { display: none !important; }

/* ── Empty State ──────────────────────────────────────────── */
.empty-state {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: var(--space-12); gap: var(--space-4); text-align: center;
}
.empty-state-icon { font-size: 3rem; opacity: 0.4; }
.empty-state-title { font-size: 1.1rem; font-weight: 700; color: var(--text-secondary); }
.empty-state-text  { font-size: 0.875rem; color: var(--text-muted); max-width: 380px; }

/* ── Drag & Drop Zone ─────────────────────────────────────── */
.drop-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-10);
  text-align: center;
  transition: all var(--transition);
  cursor: pointer;
}
.drop-zone:hover, .drop-zone.drag-over {
  border-color: var(--primary);
  background: var(--primary-light);
}
.drop-zone input[type="file"] { display: none; }

/* ── Mobile Responsive ────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .sidebar-overlay.visible {
    display: block;
  }
  .main-wrapper { margin-left: 0; }
  .hamburger { display: flex; }
  .page-content { padding: var(--space-4); }
  .stat-grid  { grid-template-columns: repeat(2, 1fr); }
  .health-grid { grid-template-columns: 1fr; }
  .split-panel, .split-panel.left-heavy { grid-template-columns: 1fr; }
  .top-bar { padding: 0 var(--space-4); }
  .step-wizard { flex-wrap: nowrap; overflow-x: auto; }
  .step-label { display: none; }
  .tabs { overflow-x: auto; }
  .tab { padding: var(--space-3) var(--space-4); }
  .data-table { font-size: 0.8rem; }
  .data-table th, .data-table td { padding: 8px 10px; }
  .modal { max-width: 100%; border-radius: var(--radius-lg) var(--radius-lg) 0 0; position: fixed; bottom: 0; left: 0; right: 0; max-height: 90vh; }
  .modal-overlay { align-items: flex-end; padding: 0; }
  .btn { min-height: 44px; }
  .drop-zone { padding: var(--space-6); }
  .toast-container { bottom: var(--space-4); right: var(--space-4); left: var(--space-4); max-width: none; width: auto; }
}

@media (max-width: 480px) {
  .stat-grid { grid-template-columns: 1fr 1fr; gap: var(--space-3); }
  .stat-value { font-size: 1.5rem; }
  .search-bar { flex-direction: column; }
  .filter-row { gap: var(--space-2); }
}
