/* ═══════════════════════════════════════════════════════════════════════
   Cloud Server — Design System & Styles
   ═══════════════════════════════════════════════════════════════════════ */

/* ── Design Tokens ──────────────────────────────────────────────────── */

:root {
  /* Colors — Light Theme */
  --color-bg:            #f0f2f5;
  --color-surface:       #ffffff;
  --color-surface-alt:   #f7f8fa;
  --color-border:        #e2e5ea;
  --color-border-light:  #eef0f3;
  --color-text:          #1a1d2e;
  --color-text-secondary:#6b7280;
  --color-text-muted:    #9ca3af;
  --color-primary:       #4f46e5;
  --color-primary-hover: #4338ca;
  --color-primary-bg:    #eef2ff;
  --color-primary-border:#c7d2fe;
  --color-success:       #059669;
  --color-success-bg:    #ecfdf5;
  --color-success-border:#a7f3d0;
  --color-danger:        #dc2626;
  --color-danger-hover:  #b91c1c;
  --color-danger-bg:     #fef2f2;
  --color-danger-border: #fecaca;
  --color-warning:       #d97706;
  --color-warning-bg:    #fffbeb;
  --color-warning-border:#fde68a;
  --color-info:          #0891b2;
  --color-info-bg:       #ecfeff;
  --color-info-border:   #a5f3fc;

  /* Spacing */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-section: 1.5rem;

  /* Sizing */
  --max-width: 1100px;
  --header-height: 56px;

  /* Typography */
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: "SF Mono", "Fira Code", "Consolas", monospace;
  --text-xs: 0.72rem;
  --text-sm: 0.82rem;
  --text-base: 0.92rem;
  --text-lg: 1.1rem;
  --text-xl: 1.4rem;
  --text-2xl: 1.75rem;
  --weight-normal: 400;
  --weight-medium: 500;
  --weight-semibold: 600;
  --weight-bold: 700;
  --leading-tight: 1.25;
  --leading-normal: 1.5;

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

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 10px 30px rgba(0,0,0,0.12);

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-normal: 200ms ease;
  --transition-slow: 300ms ease;

  /* Focus */
  --focus-ring: 0 0 0 3px rgba(79,70,229,0.35);
}

/* ── Dark Theme ─────────────────────────────────────────────────────── */

[data-theme="dark"] {
  --color-bg:            #0f1117;
  --color-surface:       #1a1d2a;
  --color-surface-alt:   #222637;
  --color-border:        #2a2d3e;
  --color-border-light:  #232637;
  --color-text:          #e4e6f0;
  --color-text-secondary:#8b8fa8;
  --color-text-muted:    #5c6080;
  --color-primary:       #6366f1;
  --color-primary-hover: #818cf8;
  --color-primary-bg:    #1e1b4b;
  --color-primary-border:#3730a3;
  --color-success:       #10b981;
  --color-success-bg:    #064e3b;
  --color-success-border:#065f46;
  --color-danger:        #ef4444;
  --color-danger-hover:  #f87171;
  --color-danger-bg:     #4c0519;
  --color-danger-border: #7f1d1d;
  --color-warning:       #f59e0b;
  --color-warning-bg:    #451a03;
  --color-warning-border:#78350f;
  --color-info:          #22d3ee;
  --color-info-bg:       #083344;
  --color-info-border:   #155e75;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.2);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.3);
  --shadow-lg: 0 10px 30px rgba(0,0,0,0.4);
  --focus-ring: 0 0 0 3px rgba(99,102,241,0.45);
}

/* ── Reset & Base ───────────────────────────────────────────────────── */

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: var(--leading-normal);
  color: var(--color-text);
  background: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
}

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

code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background: var(--color-surface-alt);
  padding: 1px 5px;
  border-radius: var(--radius-sm);
}

/* ── Icons ──────────────────────────────────────────────────────────── */

.icon {
  width: 1.15em;
  height: 1.15em;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  vertical-align: -0.2em;
  flex-shrink: 0;
}
.icon-filled { fill: currentColor; stroke: none; }

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

.hidden { display: none !important; }

/* ── Skeleton / Shimmer ─────────────────────────────────────────────── */

.skeleton-container {
  padding: var(--space-section) 0;
}
.skeleton-stats {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: var(--space-3);
  margin-bottom: var(--space-section);
}
.skeleton-card {
  height: 100px;
  background: linear-gradient(
    90deg,
    var(--color-surface-alt) 25%,
    var(--color-border) 37%,
    var(--color-surface-alt) 63%
  );
  background-size: 200% 100%;
  animation: shimmer 1.4s ease infinite;
  border-radius: var(--radius-lg);
}
.skeleton-panel {
  height: 160px;
  background: linear-gradient(
    90deg,
    var(--color-surface-alt) 25%,
    var(--color-border) 37%,
    var(--color-surface-alt) 63%
  );
  background-size: 200% 100%;
  animation: shimmer 1.4s ease infinite;
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-section);
}
@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ── Header ─────────────────────────────────────────────────────────── */

header {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: var(--header-height);
  padding: 0 var(--space-5);
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  backdrop-filter: blur(8px);
}

.header-brand {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}
.header-brand h1 {
  font-size: var(--text-lg);
  font-weight: var(--weight-bold);
  color: var(--color-text);
  letter-spacing: -0.01em;
}
.logo-icon {
  width: 1.4em;
  height: 1.4em;
  color: var(--color-primary);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

/* ── Status Badge ───────────────────────────────────────────────────── */

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 10px 2px 6px;
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  transition: background var(--transition-fast), color var(--transition-fast);
}
.status-badge::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}
.status-badge.online {
  background: var(--color-success-bg);
  color: var(--color-success);
}
.status-badge.online::before { background: var(--color-success); }
.status-badge.offline {
  background: var(--color-danger-bg);
  color: var(--color-danger);
}
.status-badge.offline::before { background: var(--color-danger); }
.status-badge.checking {
  background: var(--color-surface-alt);
  color: var(--color-text-muted);
}
.status-badge.checking::before { background: var(--color-text-muted); }

/* ── IP Chips ───────────────────────────────────────────────────────── */

.ip-chips {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
}
.ip-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-family: var(--font-mono);
  cursor: pointer;
  border: 1px solid var(--color-border);
  background: var(--color-surface-alt);
  color: var(--color-text-secondary);
  transition: all var(--transition-fast);
  user-select: none;
}
.ip-chip:hover {
  border-color: var(--color-primary-border);
  background: var(--color-primary-bg);
  color: var(--color-primary);
}
.ip-chip.copied {
  background: var(--color-success-bg);
  border-color: var(--color-success-border);
  color: var(--color-success);
}

/* ── Theme Toggle ───────────────────────────────────────────────────── */

.theme-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-secondary);
  transition: all var(--transition-fast);
  flex-shrink: 0;
}
.theme-btn:hover {
  border-color: var(--color-primary-border);
  background: var(--color-primary-bg);
  color: var(--color-primary);
}
.theme-btn:focus-visible { box-shadow: var(--focus-ring); }
[data-theme="dark"] .icon-sun { display: block; }
[data-theme="dark"] .icon-moon { display: none; }
[data-theme="light"] .icon-sun { display: none; }
[data-theme="light"] .icon-moon { display: block; }

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

main {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: var(--space-section) var(--space-5);
  animation: fade-in 300ms ease;
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

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

.stats-row {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: var(--space-3);
  margin-bottom: var(--space-section);
}
.stat-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-3);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.stat-card:hover {
  border-color: var(--color-primary-border);
  box-shadow: var(--shadow-md);
}
.stat-icon-row {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  color: var(--color-text-muted);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.stat-icon { color: var(--color-primary); }
.stat-value {
  font-size: var(--text-xl);
  font-weight: var(--weight-bold);
  color: var(--color-text);
  line-height: var(--leading-tight);
}
.stat-sub {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  line-height: var(--leading-tight);
}

/* Mini progress bar in stat cards */
.stat-bar-wrap {
  margin-top: auto;
  height: 4px;
  background: var(--color-border-light);
  border-radius: var(--radius-full);
  overflow: hidden;
}
.stat-bar-fill {
  height: 100%;
  border-radius: var(--radius-full);
  transition: width 400ms ease, background 400ms ease;
}
.stat-bar-fill.normal  { background: var(--color-primary); }
.stat-bar-fill.warning { background: var(--color-warning); }
.stat-bar-fill.critical{ background: var(--color-danger); }

/* ── Panel ──────────────────────────────────────────────────────────── */

.panel {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-section);
  overflow: hidden;
}
.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--color-border);
}
.panel-header h2 {
  font-size: var(--text-lg);
  font-weight: var(--weight-semibold);
  color: var(--color-text);
}
.panel-body { padding: var(--space-4); }

/* ── Tabs ───────────────────────────────────────────────────────────── */

.tab-nav {
  display: flex;
  gap: 4px;
  background: var(--color-surface-alt);
  padding: 3px;
  border-radius: var(--radius-md);
}
.tab {
  background: transparent;
  border: none;
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--color-text-secondary);
  transition: all var(--transition-fast);
  white-space: nowrap;
}
.tab:hover { color: var(--color-text); }
.tab.active {
  background: var(--color-surface);
  color: var(--color-primary);
  box-shadow: var(--shadow-sm);
}
.tab:focus-visible { box-shadow: var(--focus-ring); }

.tab-content { display: none; }
.tab-content.active { display: block; }

/* ── Drop Zone ──────────────────────────────────────────────────────── */

.drop-zone {
  border: 2px dashed var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-6);
  text-align: center;
  cursor: pointer;
  position: relative;
  transition: all var(--transition-fast);
}
.drop-zone:hover,
.drop-zone.drag-over {
  border-color: var(--color-primary);
  background: var(--color-primary-bg);
}
.drop-zone input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  z-index: 5;
}
.drop-icon {
  width: 2.5rem;
  height: 2.5rem;
  color: var(--color-text-muted);
  margin-bottom: var(--space-2);
  transition: color var(--transition-fast);
}
.drop-zone:hover .drop-icon,
.drop-zone.drag-over .drop-icon { color: var(--color-primary); }
.drop-zone p { font-size: var(--text-base); color: var(--color-text); margin-bottom: 4px; }
.drop-zone small { font-size: var(--text-xs); color: var(--color-text-muted); }
.browse-btn {
  background: none;
  border: none;
  color: var(--color-primary);
  cursor: pointer;
  font-size: inherit;
  text-decoration: underline;
  padding: 0;
}

/* ── File Info ──────────────────────────────────────────────────────── */

.file-info {
  margin-top: var(--space-2);
  padding: var(--space-2) var(--space-3);
  background: var(--color-primary-bg);
  border: 1px solid var(--color-primary-border);
  border-radius: var(--radius-md);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: var(--text-sm);
}

/* ── Form ──────────────────────────────────────────────────────────── */

.form-row { margin-top: var(--space-2); }
.form-inline { display: flex; gap: var(--space-2); }

input[type="text"],
input[type="search"] {
  flex: 1;
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-family: var(--font-sans);
  color: var(--color-text);
  background: var(--color-surface);
  outline: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
input[type="text"]:focus,
input[type="search"]:focus {
  border-color: var(--color-primary);
  box-shadow: var(--focus-ring);
}
input::placeholder { color: var(--color-text-muted); }

.rename-input {
  flex: none;
  width: 100%;
  max-width: 200px;
}

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

.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
  user-select: none;
  font-family: var(--font-sans);
}
.btn:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; pointer-events: none; }

.btn-primary {
  width: 100%;
  margin-top: var(--space-2);
  padding: var(--space-2) var(--space-4);
  background: var(--color-primary);
  color: #fff;
  border: none;
}
.btn-primary:hover:not(:disabled) { background: var(--color-primary-hover); }

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

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

.btn-ghost {
  background: transparent;
  color: var(--color-text-secondary);
  border: none;
  padding: var(--space-1) var(--space-2);
}
.btn-ghost:hover { background: var(--color-surface-alt); color: var(--color-text); }

/* ── Template Options ───────────────────────────────────────────────── */

.template-options { display: flex; gap: var(--space-2); margin-top: var(--space-2); }
.template-btn {
  flex: 1;
  background: var(--color-surface-alt);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  cursor: pointer;
  text-align: left;
  overflow: hidden;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  font-family: var(--font-sans);
}
.template-btn:hover {
  border-color: var(--color-primary-border);
  box-shadow: var(--shadow-md);
}
.template-btn:focus-visible { box-shadow: var(--focus-ring); }
.template-btn.submitting { opacity: 0.6; pointer-events: none; }
.tpreview { height: 52px; padding: var(--space-2); }
.tpreview-blank { background: var(--color-border-light); display: flex; align-items: center; justify-content: center; }
.tpreview-blank::after { content: ""; width: 60px; height: 8px; background: var(--color-border); border-radius: var(--radius-full); }
.tpreview-spa { background: #0f0f23; display: flex; align-items: center; justify-content: center; gap: 6px; }
.tpreview-spa::before { content: ""; width: 16px; height: 16px; background: #6366f1; border-radius: var(--radius-sm); }
.tpreview-spa::after  { content: ""; width: 30px; height: 6px; background: rgba(255,255,255,0.2); border-radius: var(--radius-full); }
.tmeta { padding: var(--space-2) var(--space-3); border-top: 1px solid var(--color-border); }
.tmeta strong { font-size: var(--text-sm); display: block; color: var(--color-text); }
.tmeta span { font-size: var(--text-xs); color: var(--color-text-muted); }

/* ── Progress ───────────────────────────────────────────────────────── */

.progress { margin-top: var(--space-2); }
.progress-bar {
  height: 6px;
  background: var(--color-surface-alt);
  border-radius: var(--radius-full);
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: var(--color-primary);
  border-radius: var(--radius-full);
  transition: width 300ms ease;
}
.progress-fill.complete { background: var(--color-success); }
.progress-fill.error { background: var(--color-danger); }
.progress-text {
  font-size: var(--text-xs);
  color: var(--color-text-secondary);
  margin-top: 4px;
  display: block;
}

/* ── Result ─────────────────────────────────────────────────────────── */

.result {
  margin-top: var(--space-2);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  animation: fade-in var(--transition-normal) ease;
}
.result.success {
  background: var(--color-success-bg);
  border: 1px solid var(--color-success-border);
  color: var(--color-success);
}
.result.error {
  background: var(--color-danger-bg);
  border: 1px solid var(--color-danger-border);
  color: var(--color-danger);
}

/* ── Sites Toolbar ──────────────────────────────────────────────────── */

.sites-toolbar {
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}
.search-box {
  position: relative;
  display: flex;
  align-items: center;
  max-width: 300px;
  width: 100%;
}
.search-box input {
  width: 100%;
  padding: var(--space-2) var(--space-2) var(--space-2) calc(var(--space-5) + 4px);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  background: var(--color-surface);
  color: var(--color-text);
  outline: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
.search-box input:focus {
  border-color: var(--color-primary);
  box-shadow: var(--focus-ring);
}
.search-box .search-icon {
  position: absolute;
  left: var(--space-2);
  color: var(--color-text-muted);
  pointer-events: none;
}
.search-clear {
  position: absolute;
  right: 4px;
  width: 24px;
  height: 24px;
  border-radius: var(--radius-full);
  border: none;
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-muted);
  transition: all var(--transition-fast);
}
.search-clear:hover { background: var(--color-surface-alt); color: var(--color-text); }
.search-results { font-size: var(--text-xs); color: var(--color-text-muted); white-space: nowrap; }

/* ── Badge ──────────────────────────────────────────────────────────── */

.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  background: var(--color-primary-bg);
  color: var(--color-primary);
}

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

.table-wrapper { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th {
  text-align: left;
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  color: var(--color-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 2px solid var(--color-border);
  white-space: nowrap;
}
td {
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-sm);
  border-bottom: 1px solid var(--color-border-light);
  vertical-align: middle;
}
tbody tr { transition: background var(--transition-fast); }
tbody tr:hover { background: var(--color-surface-alt); }
td[data-label="Name"] strong { color: var(--color-text); }

/* Access badge + link in URL column */
.site-url-cell {
  display: flex;
  align-items: center;
  gap: var(--space-1);
}
.access-icon {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}
.access-icon.public { color: var(--color-success); }
.access-icon.local  { color: var(--color-text-muted); }

/* ── Site Actions ───────────────────────────────────────────────────── */

.site-actions {
  display: flex;
  gap: 4px;
  flex-wrap: nowrap;
}
.site-actions button {
  background: none;
  border: 1px solid var(--color-border);
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  font-size: var(--text-xs);
  cursor: pointer;
  color: var(--color-text-secondary);
  transition: all var(--transition-fast);
  white-space: nowrap;
  font-family: var(--font-sans);
}
.site-actions button:hover { border-color: var(--color-primary-border); color: var(--color-primary); }
.site-actions button.toggle-access { font-weight: var(--weight-medium); min-width: 48px; text-align: center; }
.site-actions button.toggle-access.public {
  background: var(--color-success-bg);
  border-color: var(--color-success-border);
  color: var(--color-success);
}
.site-actions button.toggle-access.local {
  background: var(--color-surface-alt);
  border-color: var(--color-border);
  color: var(--color-text-secondary);
}
.site-actions button.delete-btn:hover {
  border-color: var(--color-danger-border);
  color: var(--color-danger);
  background: var(--color-danger-bg);
}

/* ── Empty State ────────────────────────────────────────────────────── */

.empty-state {
  text-align: center;
  padding: var(--space-8) var(--space-4);
  color: var(--color-text-muted);
}
.empty-state-icon {
  width: 3rem;
  height: 3rem;
  color: var(--color-border);
  margin-bottom: var(--space-3);
}
.empty-state h3 {
  font-size: var(--text-lg);
  font-weight: var(--weight-semibold);
  color: var(--color-text-secondary);
  margin-bottom: 4px;
}
.empty-state p { font-size: var(--text-sm); }

/* ── Toast ──────────────────────────────────────────────────────────── */

.toast-container {
  position: fixed;
  bottom: var(--space-4);
  right: var(--space-4);
  z-index: 100;
  display: flex;
  flex-direction: column-reverse;
  gap: var(--space-2);
  pointer-events: none;
  max-width: 380px;
}
.toast {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  box-shadow: var(--shadow-lg);
  pointer-events: auto;
  animation: toast-in var(--transition-normal) ease forwards;
}
.toast.exiting { animation: toast-out var(--transition-fast) ease forwards; }
.toast.success { background: var(--color-success); color: #fff; }
.toast.error   { background: var(--color-danger);  color: #fff; }
.toast.info    { background: var(--color-info);     color: #fff; }
.toast-msg { flex: 1; line-height: var(--leading-tight); }
.toast-close {
  background: none;
  border: none;
  color: inherit;
  opacity: 0.7;
  cursor: pointer;
  padding: 2px;
  display: flex;
  align-items: center;
  flex-shrink: 0;
}
.toast-close:hover { opacity: 1; }

@keyframes toast-in  { from { opacity: 0; transform: translateY(8px); } }
@keyframes toast-out { to   { opacity: 0; transform: translateX(24px); } }

/* ── Modal ──────────────────────────────────────────────────────────── */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fade-in 200ms ease;
}
.modal {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  max-width: 420px;
  width: calc(100% - 2rem);
  box-shadow: var(--shadow-lg);
  animation: modal-in var(--transition-normal) ease;
}
@keyframes modal-in { from { opacity: 0; transform: scale(0.95); } }
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-3);
}
.modal-header h3 { font-size: var(--text-lg); font-weight: var(--weight-semibold); }
.modal-close {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  border: none;
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-muted);
  transition: all var(--transition-fast);
}
.modal-close:hover { background: var(--color-surface-alt); color: var(--color-text); }
.modal p { color: var(--color-text-secondary); margin-bottom: var(--space-4); font-size: var(--text-sm); }
.modal-actions { display: flex; gap: var(--space-2); justify-content: flex-end; }

/* ── Footer ─────────────────────────────────────────────────────────── */

footer {
  text-align: center;
  padding: var(--space-4);
  color: var(--color-text-muted);
  font-size: var(--text-xs);
  border-top: 1px solid var(--color-border);
}
footer .kbd {
  display: inline-block;
  padding: 1px 6px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  background: var(--color-surface-alt);
  font-family: var(--font-mono);
  font-size: 0.85em;
}

/* ── Responsive — 1024px ────────────────────────────────────────────── */

@media (max-width: 1024px) {
  .stats-row { grid-template-columns: repeat(3, 1fr); }
}

/* ── Responsive — 768px ─────────────────────────────────────────────── */

@media (max-width: 768px) {
  .stats-row { grid-template-columns: repeat(2, 1fr); }
  .sites-toolbar { flex-direction: column; align-items: stretch; }
  .search-box { max-width: 100%; }
  .header-actions { gap: var(--space-2); }
  .ip-chips { display: none; }
}

/* ── Responsive — 480px ─────────────────────────────────────────────── */

@media (max-width: 480px) {
  header {
    flex-direction: column;
    height: auto;
    padding: var(--space-3) var(--space-3);
    gap: var(--space-2);
  }
  .header-brand h1 { font-size: var(--text-base); }
  .header-actions { width: 100%; justify-content: flex-end; }

  .stats-row { grid-template-columns: 1fr; }

  .form-inline { flex-direction: column; }
  .template-options { flex-direction: column; }

  .table-wrapper th { display: none; }
  .table-wrapper td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-3);
  }
  .table-wrapper td::before {
    content: attr(data-label);
    font-weight: var(--weight-semibold);
    font-size: var(--text-xs);
    color: var(--color-text-secondary);
    flex-shrink: 0;
  }
  .site-actions { flex-wrap: wrap; justify-content: flex-end; }
}
