/* =================================================================
   SwiftTracker — Microsoft Fluent Design Theme (Dark)
   ================================================================= */

:root {
  /* Fluent neutrals — dark theme */
  --bg:            #1F1F1F;
  --bg-alt:        #202020;
  --card:          #282828;
  --card-hover:    #2D2D2D;
  --card-pressed:  #303030;
  --layer:         #333333;
  --stroke:        #3D3D3D;
  --stroke-soft:   #2E2E2E;
  --stroke-strong: #4A4A4A;

  --text:          #FFFFFF;
  --text-2:        #C8C6C4;
  --text-3:        #8A8886;
  --text-4:        #605E5C;

  /* Fluent accent */
  --accent:        #0078D4;
  --accent-hover:  #106EBE;
  --accent-press:  #005A9E;
  --accent-light:  rgba(0, 120, 212, 0.15);
  --accent-focus:  #4CC2FF;

  /* Semantic */
  --success:       #107C10;
  --success-soft:  rgba(16, 124, 16, 0.15);
  --warning:       #FFB900;
  --warning-soft:  rgba(255, 185, 0, 0.15);
  --danger:        #D13438;
  --danger-soft:   rgba(209, 52, 56, 0.15);
  --info:          #0078D4;
  --info-soft:     rgba(0, 120, 212, 0.15);

  /* Fluent radii */
  --r-sm: 4px;
  --r-md: 6px;
  --r-lg: 8px;

  /* Fluent elevation */
  --depth-2:  0 1px 2px rgba(0,0,0,0.14), 0 0 2px rgba(0,0,0,0.12);
  --depth-4:  0 2px 4px rgba(0,0,0,0.14), 0 0 4px rgba(0,0,0,0.12);
  --depth-8:  0 4px 8px rgba(0,0,0,0.14), 0 0 8px rgba(0,0,0,0.12);
  --depth-16: 0 8px 16px rgba(0,0,0,0.14), 0 0 16px rgba(0,0,0,0.12);

  /* Fluent motion */
  --ease: cubic-bezier(0.33, 0, 0.67, 1);
  --dur-fast: 100ms;
  --dur: 150ms;
  --dur-slow: 200ms;

  /* Font — Segoe UI first */
  --font: 'Segoe UI Variable', 'Segoe UI', -apple-system, BlinkMacSystemFont,
          'Helvetica Neue', Arial, sans-serif;
  --mono: 'Cascadia Code', 'Consolas', 'SF Mono', Menlo, Monaco, monospace;
}

*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font);
  font-size: 14px;
  font-weight: 400;
  line-height: 20px;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
}

h1, h2, h3, h4 { font-weight: 600; letter-spacing: -0.005em; }
h1 { font-size: 28px; line-height: 36px; }
h2 { font-size: 20px; line-height: 28px; }
h3 { font-size: 16px; line-height: 22px; }

a { color: var(--accent-focus); text-decoration: none; transition: color var(--dur); }
a:hover { color: var(--accent); text-decoration: underline; }

code, pre, .mono { font-family: var(--mono); }

::selection { background: var(--accent); color: #fff; }

::-webkit-scrollbar { width: 12px; height: 12px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: #4A4A4A;
  border-radius: 6px;
  border: 3px solid var(--bg);
}
::-webkit-scrollbar-thumb:hover { background: #6A6A6A; }

/* Focus — Fluent style: 2px underline + outer glow */
*:focus-visible {
  outline: 2px solid var(--accent-focus);
  outline-offset: 1px;
  border-radius: var(--r-sm);
}

/* ============ Buttons ============ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 32px;
  padding: 0 16px;
  border-radius: var(--r-sm);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  text-decoration: none;
  white-space: nowrap;
  transition: background var(--dur), border-color var(--dur), color var(--dur);
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn:hover { text-decoration: none; }

.btn-primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); border-color: var(--accent-hover); color: #fff; }
.btn-primary:active:not(:disabled) { background: var(--accent-press); border-color: var(--accent-press); }

.btn-outline {
  background: transparent;
  color: var(--text);
  border-color: var(--stroke-strong);
}
.btn-outline:hover:not(:disabled) { background: rgba(255,255,255,0.05); color: var(--text); }
.btn-outline:active:not(:disabled) { background: rgba(255,255,255,0.09); }

.btn-warning {
  background: transparent;
  color: var(--warning);
  border-color: var(--warning);
}
.btn-warning:hover:not(:disabled) { background: var(--warning-soft); color: var(--warning); }

.btn-danger {
  background: transparent;
  color: var(--danger);
  border-color: var(--danger);
}
.btn-danger:hover:not(:disabled) { background: var(--danger-soft); color: var(--danger); }

.btn-sm { height: 24px; padding: 0 10px; font-size: 12px; gap: 6px; }
.btn-xs { height: 22px; padding: 0 8px; font-size: 11px; gap: 4px; }
.btn-lg { height: 40px; padding: 0 24px; font-size: 15px; }
.btn-full { width: 100%; }

/* ============ Header ============ */
.site-header {
  background: var(--bg-alt);
  border-bottom: 1px solid var(--stroke);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(30px) saturate(125%);
  -webkit-backdrop-filter: blur(30px) saturate(125%);
  background-color: rgba(32, 32, 32, 0.85);
}
.header-inner {
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 24px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-weight: 600;
  font-size: 14px;
}
.logo:hover { color: var(--text); text-decoration: none; }
.logo svg { border-radius: var(--r-sm); }
.header-nav { display: flex; align-items: center; gap: 4px; }
.nav-link {
  display: inline-flex;
  align-items: center;
  height: 32px;
  padding: 0 12px;
  border-radius: var(--r-sm);
  color: var(--text-2);
  font-size: 13px;
  font-weight: 400;
  transition: background var(--dur), color var(--dur);
}
.nav-link:hover { background: rgba(255,255,255,0.06); color: var(--text); text-decoration: none; }
.nav-link.active { background: var(--accent-light); color: var(--accent-focus); font-weight: 600; }

/* ============ Hero (home) ============ */
.hero { padding: 80px 24px 60px; text-align: center; }
.hero-content { max-width: 720px; margin: 0 auto; }
.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 12px;
  background: var(--accent-light);
  color: var(--accent-focus);
  border: 1px solid rgba(76, 194, 255, 0.3);
  border-radius: 100px;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 20px;
}
.hero h1 {
  font-size: clamp(32px, 5vw, 48px);
  line-height: 1.1;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 20px;
}
.hero-subtext {
  font-size: 16px;
  line-height: 1.6;
  color: var(--text-2);
  max-width: 560px;
  margin: 0 auto 32px;
}
.hero-actions { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }

.section-inner { max-width: 1200px; margin: 0 auto; padding: 0 24px; }
.section-title { font-size: 24px; font-weight: 600; text-align: center; margin-bottom: 8px; }
.section-subtext { text-align: center; color: var(--text-2); font-size: 14px; margin-bottom: 40px; }
.section-hint { font-size: 12px; color: var(--text-3); }

.features { padding: 60px 0; }
.feature-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 12px; margin-top: 32px; }
.feature-card {
  padding: 20px;
  background: var(--card);
  border: 1px solid var(--stroke);
  border-radius: var(--r-lg);
  transition: background var(--dur), border-color var(--dur);
}
.feature-card:hover { background: var(--card-hover); border-color: var(--stroke-strong); }
.feature-icon {
  width: 32px; height: 32px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 16px;
  margin-bottom: 12px;
  background: var(--accent-light);
  border-radius: var(--r-sm);
}
.feature-card h3 { font-size: 14px; margin-bottom: 6px; }
.feature-card p { font-size: 13px; color: var(--text-2); line-height: 1.5; }

.quickstart { padding: 60px 0; }
.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 12px; }
.step {
  background: var(--card);
  padding: 20px;
  border-radius: var(--r-lg);
  border: 1px solid var(--stroke);
}
.step-number {
  width: 24px; height: 24px;
  background: var(--accent);
  color: #fff;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 12px;
  margin-bottom: 12px;
}
.step h3 { font-size: 13px; margin-bottom: 8px; }
.code-block {
  display: block;
  background: #1A1A1A;
  color: #D4D4D4;
  padding: 12px;
  border-radius: var(--r-sm);
  font-family: var(--mono);
  font-size: 11.5px;
  line-height: 1.6;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-all;
  border: 1px solid var(--stroke);
}

/* ============ Login ============ */
.login-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 24px; }
.login-container { width: 100%; max-width: 400px; }
.login-card {
  background: var(--card);
  border: 1px solid var(--stroke);
  border-radius: var(--r-lg);
  padding: 32px 28px;
  box-shadow: var(--depth-16);
}
.login-header { text-align: center; margin-bottom: 24px; }
.login-header svg { margin-bottom: 16px; border-radius: var(--r-sm); }
.login-header h1 { font-size: 24px; margin-bottom: 6px; }
.login-subtext { color: var(--text-2); font-size: 13px; }
.form-group { margin-bottom: 16px; }
.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text);
}
.form-group input {
  width: 100%;
  height: 32px;
  padding: 0 10px;
  background: #1F1F1F;
  border: 1px solid var(--stroke-strong);
  border-bottom: 1px solid var(--text-3);
  border-radius: var(--r-sm);
  font-family: inherit;
  font-size: 14px;
  color: var(--text);
  outline: none;
  transition: border-color var(--dur), background var(--dur);
}
.form-group input::placeholder { color: var(--text-4); }
.form-group input:focus {
  background: #1A1A1A;
  border-color: var(--stroke-strong);
  border-bottom: 2px solid var(--accent-focus);
  padding-bottom: 0;
}
.helper-text { display: block; font-size: 12px; color: var(--text-3); margin-top: 4px; }
.form-error {
  margin-top: 12px;
  padding: 10px 12px;
  background: var(--danger-soft);
  color: #FF99A4;
  border-radius: var(--r-sm);
  font-size: 13px;
  border: 1px solid rgba(209, 52, 56, 0.3);
}
.login-footer { text-align: center; margin-top: 20px; }
.login-footer a { color: var(--text-3); font-size: 13px; }
.login-footer a:hover { color: var(--text); }

/* ============ Dashboard ============ */
.dashboard { max-width: 1440px; margin: 0 auto; padding: 24px; }
.welcome-section {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 16px; margin-bottom: 20px; flex-wrap: wrap;
}
.welcome-text h1 { font-size: 24px; margin-bottom: 4px; font-weight: 600; }
.welcome-text p { color: var(--text-2); font-size: 13px; }
.welcome-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* Session panel */
.session-panel {
  background: var(--card);
  border: 1px solid var(--stroke);
  border-radius: var(--r-lg);
  padding: 20px;
  margin-bottom: 20px;
}
.session-panel-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px; flex-wrap: wrap; gap: 12px;
}
.session-panel-header h2 { font-size: 15px; }
.session-badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px;
  border-radius: 100px;
  font-size: 11px; font-weight: 600;
  background: var(--success-soft);
  color: #6CCB5F;
  border: 1px solid rgba(108, 203, 95, 0.3);
}
.session-badge::before {
  content: ''; width: 6px; height: 6px; border-radius: 50%;
  background: #6CCB5F;
  animation: pulse-dot 2s infinite;
}
@keyframes pulse-dot { 0%,100% { opacity: 1; } 50% { opacity: 0.3; } }

.session-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 8px;
}
.session-item {
  padding: 12px;
  background: var(--bg-alt);
  border: 1px solid var(--stroke-soft);
  border-radius: var(--r-md);
  display: flex; flex-direction: column; gap: 4px;
}
.session-label {
  font-size: 11px; font-weight: 600; color: var(--text-3);
  text-transform: uppercase; letter-spacing: 0.5px;
}
.session-value { font-size: 13px; font-weight: 600; color: var(--text); word-break: break-all; }
.session-hint { font-size: 11px; color: var(--text-4); }

/* Active domain banner */
.active-domain-banner {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  padding: 14px 18px;
  background: var(--card);
  border: 1px solid var(--stroke);
  border-left: 3px solid var(--accent);
  border-radius: var(--r-md);
  margin-bottom: 20px;
}
.active-domain-label {
  font-size: 12px; font-weight: 600; color: var(--text-3);
  text-transform: uppercase; letter-spacing: 0.5px;
}
.active-domain-value {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--accent-focus);
  font-weight: 600;
  flex: 1;
  word-break: break-all;
  min-width: 200px;
}

/* Stats grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 8px;
  margin-bottom: 20px;
}
.stat-card {
  background: var(--card);
  border: 1px solid var(--stroke);
  border-radius: var(--r-lg);
  padding: 18px;
  transition: background var(--dur);
}
.stat-card:hover { background: var(--card-hover); }
.stat-label {
  font-size: 12px; color: var(--text-3); font-weight: 600;
  margin-bottom: 8px; text-transform: uppercase; letter-spacing: 0.5px;
}
.stat-value {
  font-size: 28px; font-weight: 700; color: var(--text);
  line-height: 1; margin-bottom: 4px;
  font-variant-numeric: tabular-nums;
}
.stat-hint { font-size: 11px; color: var(--text-4); }

/* Domain section */
.domain-section {
  background: var(--card);
  border: 1px solid var(--stroke);
  border-radius: var(--r-lg);
  padding: 20px;
  margin-bottom: 20px;
}
.domain-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  margin-bottom: 16px; flex-wrap: wrap; gap: 12px;
}
.domain-header h2 { font-size: 15px; margin-bottom: 2px; }
.add-domain-form {
  display: flex; gap: 8px; flex-wrap: wrap;
  margin-bottom: 16px;
  padding: 14px;
  background: var(--bg-alt);
  border: 1px solid var(--stroke-soft);
  border-radius: var(--r-md);
}
.add-domain-form .form-field { flex: 1; min-width: 180px; display: flex; flex-direction: column; gap: 4px; }
.add-domain-form .form-actions { display: flex; gap: 6px; align-items: flex-end; }
.field-hint { font-size: 11px; color: var(--text-4); }
.domain-table-wrapper {
  overflow-x: auto;
  border-radius: var(--r-md);
  border: 1px solid var(--stroke);
}
.domain-table { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 760px; }
.domain-table th {
  text-align: left; padding: 10px 14px;
  background: var(--bg-alt);
  font-weight: 600; font-size: 11px;
  text-transform: uppercase; color: var(--text-3);
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--stroke);
  white-space: nowrap;
}
.domain-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--stroke-soft);
  vertical-align: middle;
  color: var(--text-2);
}
.domain-table tr:last-child td { border-bottom: none; }
.domain-table tr.row-active { background: var(--accent-light); }
.domain-table tr:hover td { background: rgba(255,255,255,0.02); }

.domain-status {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 9px;
  border-radius: 100px;
  font-size: 11px; font-weight: 600;
  text-transform: capitalize;
}
.domain-status::before {
  content: ''; width: 5px; height: 5px; border-radius: 50%; background: currentColor;
}
.domain-status-healthy  { background: var(--success-soft); color: #6CCB5F; }
.domain-status-spam     { background: var(--warning-soft); color: var(--warning); }
.domain-status-down     { background: var(--danger-soft);  color: #FF99A4; }
.domain-status-disabled { background: rgba(255,255,255,0.06); color: var(--text-3); }

.badge-active {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  font-size: 9px;
  padding: 2px 6px;
  border-radius: 3px;
  font-weight: 700;
  letter-spacing: 0.5px;
  margin-right: 8px;
  vertical-align: middle;
}
.domain-actions { display: flex; gap: 4px; flex-wrap: wrap; }

.rotation-log { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--stroke-soft); }
.rotation-log h3 {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px;
  color: var(--text-3); margin-bottom: 10px; font-weight: 600;
}
.rotation-list { list-style: none; }
.rotation-item {
  display: flex; gap: 12px; align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--stroke-soft);
  font-size: 12px; flex-wrap: wrap;
}
.rotation-item:last-child { border-bottom: none; }
.rotation-time { color: var(--text-3); min-width: 160px; font-family: var(--mono); font-size: 11px; }
.rotation-old { color: #FF99A4; text-decoration: line-through; font-family: var(--mono); font-size: 11px; }
.rotation-arrow { color: var(--text-4); }
.rotation-new { color: #6CCB5F; font-weight: 600; font-family: var(--mono); font-size: 11px; }
.rotation-reason { color: var(--text-3); font-style: italic; font-size: 11px; }
.rotation-empty { color: var(--text-3); font-size: 12px; padding: 6px 0; }

/* Table section */
.table-section {
  background: var(--card);
  border: 1px solid var(--stroke);
  border-radius: var(--r-lg);
  overflow: hidden;
  margin-bottom: 20px;
}
.table-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid var(--stroke);
  flex-wrap: wrap; gap: 12px;
}
.table-header h2 { font-size: 15px; margin-bottom: 2px; }
.table-controls { display: flex; gap: 8px; flex-wrap: wrap; }

.select-input, .text-input {
  height: 32px;
  padding: 0 10px;
  background: #1F1F1F;
  border: 1px solid var(--stroke-strong);
  border-bottom: 1px solid var(--text-3);
  border-radius: var(--r-sm);
  font-family: inherit;
  font-size: 13px;
  color: var(--text);
  outline: none;
  transition: border-color var(--dur), background var(--dur);
}
.select-input:focus, .text-input:focus {
  background: #1A1A1A;
  border-bottom: 2px solid var(--accent-focus);
}
.select-input option { background: var(--layer); color: var(--text); }
.text-input { min-width: 240px; }
.text-input::placeholder { color: var(--text-4); }

.table-wrapper { overflow-x: auto; }
.events-table { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 960px; }
.events-table th {
  text-align: left; padding: 10px 14px;
  background: var(--bg-alt);
  font-weight: 600; color: var(--text-3);
  font-size: 11px; text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--stroke);
  white-space: nowrap;
}
.events-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--stroke-soft);
  vertical-align: middle;
  color: var(--text-2);
}
.events-table tr:last-child td { border-bottom: none; }
.events-table tr:hover td { background: rgba(255,255,255,0.02); }

.cell-email { color: var(--text); font-weight: 500; }
.cell-subject { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }
.cell-dest { max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cell-ip { font-family: var(--mono); font-size: 11.5px; color: var(--text-3); }
.cell-domain { font-family: var(--mono); font-size: 11px; color: var(--text-3); max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cell-time { white-space: nowrap; color: var(--text-3); font-size: 11.5px; font-family: var(--mono); }
.cell-dest a { color: var(--accent-focus); }

.event-badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px;
  border-radius: 100px;
  font-size: 11px; font-weight: 600;
  text-transform: capitalize;
  white-space: nowrap;
}
.event-open        { background: var(--info-soft);    color: #4CC2FF; }
.event-click       { background: var(--success-soft); color: #6CCB5F; }
.event-unsubscribe { background: var(--danger-soft);  color: #FF99A4; }

.table-empty { text-align: center; padding: 40px 16px !important; color: var(--text-3); font-size: 13px; }
.pagination {
  display: flex; align-items: center; justify-content: center; gap: 16px;
  padding: 14px 20px;
  border-top: 1px solid var(--stroke);
  background: var(--bg-alt);
}
#pageInfo { font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums; }

/* ============ Toasts ============ */
.toast-container {
  position: fixed;
  top: 64px;
  right: 20px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
  max-width: 380px;
}
.toast {
  pointer-events: auto;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  background: var(--layer);
  border: 1px solid var(--stroke-strong);
  border-left: 3px solid var(--accent);
  border-radius: var(--r-md);
  box-shadow: var(--depth-16);
  animation: toastIn var(--dur-slow) var(--ease);
  min-width: 300px;
}
.toast.removing { animation: toastOut var(--dur) var(--ease) forwards; }
.toast-icon { font-size: 16px; line-height: 1; flex-shrink: 0; margin-top: 2px; }
.toast-body { flex: 1; min-width: 0; }
.toast-title { font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 2px; }
.toast-message { font-size: 12px; color: var(--text-2); word-wrap: break-word; }
.toast-close {
  background: transparent; border: none; cursor: pointer;
  color: var(--text-3); font-size: 16px; padding: 0 4px;
  line-height: 1; border-radius: var(--r-sm);
}
.toast-close:hover { color: var(--text); background: rgba(255,255,255,0.06); }
.toast-success { border-left-color: var(--success); }
.toast-success .toast-icon { color: #6CCB5F; }
.toast-error { border-left-color: var(--danger); }
.toast-error .toast-icon { color: #FF99A4; }
.toast-warning { border-left-color: var(--warning); }
.toast-warning .toast-icon { color: var(--warning); }
.toast-info { border-left-color: var(--info); }
.toast-info .toast-icon { color: var(--accent-focus); }

@keyframes toastIn { from { opacity: 0; transform: translateX(24px); } to { opacity: 1; transform: translateX(0); } }
@keyframes toastOut { to { opacity: 0; transform: translateX(24px); } }

/* ============ Modal ============ */
.modal-overlay {
  position: fixed; inset: 0; z-index: 999;
  background: rgba(0,0,0,0.5);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  animation: fadeIn var(--dur) var(--ease);
}
.modal-card {
  background: var(--layer);
  border: 1px solid var(--stroke-strong);
  border-radius: var(--r-lg);
  padding: 24px;
  max-width: 400px;
  width: 100%;
  box-shadow: var(--depth-16);
  animation: modalIn var(--dur-slow) var(--ease);
}
.modal-icon { font-size: 24px; margin-bottom: 10px; }
.modal-card h3 { font-size: 18px; margin-bottom: 6px; }
.modal-card p { font-size: 13px; color: var(--text-2); margin-bottom: 20px; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes modalIn { from { opacity: 0; transform: scale(0.96); } to { opacity: 1; transform: scale(1); } }

/* ============ Footer ============ */
.site-footer {
  border-top: 1px solid var(--stroke);
  background: var(--bg-alt);
  padding: 32px 24px;
  margin-top: 48px;
}
.footer-inner { max-width: 1440px; margin: 0 auto; text-align: center; }
.footer-brand {
  display: flex; align-items: center; justify-content: center;
  gap: 10px; font-weight: 600; margin-bottom: 14px; font-size: 13px;
}
.footer-links { display: flex; justify-content: center; gap: 24px; margin-bottom: 14px; flex-wrap: wrap; }
.footer-links a { color: var(--text-3); font-size: 12px; }
.footer-copy { font-size: 12px; color: var(--text-3); }

/* ============ Confirm page ============ */
.confirm-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 24px; }
.confirm-card {
  background: var(--card);
  border: 1px solid var(--stroke);
  border-radius: var(--r-lg);
  padding: 40px 32px;
  text-align: center;
  max-width: 440px;
  box-shadow: var(--depth-16);
}
.confirm-icon { width: 48px; height: 48px; color: #6CCB5F; margin-bottom: 18px; }
.confirm-card h1 { font-size: 22px; margin-bottom: 10px; }
.confirm-card p { color: var(--text-2); margin-bottom: 6px; font-size: 14px; }
.confirm-card .subtext { font-size: 13px; color: var(--text-3); margin-bottom: 20px; }

/* ============ GLOBE PAGE ============ */
.globe-page { padding: 0; }
.globe-layout {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 16px;
  padding: 20px 24px;
  max-width: 1600px;
  margin: 0 auto;
}
@media (max-width: 1080px) { .globe-layout { grid-template-columns: 1fr; } }

.globe-panel {
  background: var(--card);
  border: 1px solid var(--stroke);
  border-radius: var(--r-lg);
  overflow: hidden;
  position: relative;
  min-height: 620px;
  background-image:
    radial-gradient(circle at 30% 20%, rgba(0,120,212,0.08), transparent 50%),
    radial-gradient(circle at 80% 80%, rgba(76,194,255,0.05), transparent 50%);
}
.globe-canvas { width: 100%; height: 100%; min-height: 620px; display: block; }
.globe-toolbar {
  position: absolute;
  top: 16px;
  left: 16px;
  right: 16px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  pointer-events: none;
  z-index: 2;
  gap: 12px;
}
.globe-toolbar > * { pointer-events: auto; }
.globe-title {
  background: rgba(32,32,32,0.85);
  border: 1px solid var(--stroke);
  border-radius: var(--r-md);
  padding: 8px 14px;
  backdrop-filter: blur(10px);
}
.globe-title h2 { font-size: 14px; margin-bottom: 1px; }
.globe-title p { font-size: 11px; color: var(--text-3); }
.globe-controls { display: flex; gap: 6px; background: rgba(32,32,32,0.85); padding: 4px; border-radius: var(--r-md); border: 1px solid var(--stroke); backdrop-filter: blur(10px); }
.globe-controls .btn { height: 28px; }
.globe-controls .btn.active { background: var(--accent); border-color: var(--accent); color: #fff; }

.globe-legend {
  position: absolute;
  bottom: 16px;
  left: 16px;
  background: rgba(32,32,32,0.85);
  border: 1px solid var(--stroke);
  border-radius: var(--r-md);
  padding: 10px 14px;
  backdrop-filter: blur(10px);
  font-size: 11px;
  color: var(--text-2);
  display: flex;
  gap: 16px;
  z-index: 2;
}
.globe-legend-item { display: flex; align-items: center; gap: 6px; }
.globe-legend-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: #6CCB5F;
  box-shadow: 0 0 8px #6CCB5F;
}

/* Side panel */
.insights-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.insight-card {
  background: var(--card);
  border: 1px solid var(--stroke);
  border-radius: var(--r-lg);
  padding: 16px;
}
.insight-card h3 {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-3);
  font-weight: 600;
  margin-bottom: 12px;
}
.insight-list { list-style: none; }
.insight-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--stroke-soft);
  font-size: 13px;
}
.insight-item:last-child { border-bottom: none; }
.insight-country { display: flex; align-items: center; gap: 8px; color: var(--text); }
.insight-flag { font-size: 16px; }
.insight-count { font-family: var(--mono); font-weight: 600; color: var(--accent-focus); font-size: 12px; }

.insight-big { font-size: 32px; font-weight: 700; letter-spacing: -0.5px; color: var(--text); line-height: 1; }
.insight-big-label { font-size: 11px; color: var(--text-3); margin-top: 4px; text-transform: uppercase; letter-spacing: 0.5px; }

.live-dot {
  display: inline-block;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: #6CCB5F;
  margin-right: 6px;
  animation: pulse-dot 1.5s infinite;
}

@media (max-width: 768px) {
  .header-inner { padding: 0 16px; }
  .dashboard { padding: 16px; }
  .welcome-section { flex-direction: column; align-items: flex-start; }
  .table-header { flex-direction: column; align-items: stretch; }
  .text-input { min-width: 0; width: 100%; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .stat-value { font-size: 22px; }
  .toast-container { right: 12px; left: 12px; top: 60px; max-width: none; }
  .globe-layout { padding: 12px; }
  .globe-panel { min-height: 480px; }
  .globe-canvas { min-height: 480px; }
}
@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
}
