:root {
  --color-primary: #FFCF06;
  --color-primary-hover: #E6BA00;
  --color-primary-text: #1a1a1a;
  --color-bg-dark: #1a1a1a;
  --color-bg-darker: #111111;
  --color-bg: #f0f0f0;
  --color-surface: #ffffff;
  --color-text: #1a1a1a;
  --color-text-light: #6b7280;
  --color-text-inverse: #ffffff;
  --color-border: #e5e7eb;
  --color-blocked: #D32F2F;
  --color-blocked-bg: #fdecea;
  --color-allowed: #2E7D32;
  --color-allowed-bg: #e8f5e9;
  --color-warning: #F59E0B;
  --color-warning-bg: #fef3c7;
  --color-unknown: #6b7280;
  --color-unknown-bg: #f3f4f6;
  --color-accent-red: #B6121B;
  --color-blacklist: #D32F2F;
  --color-whitelist: #2E7D32;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.12);
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.5;
  min-height: 100vh;
}

/* ===== HEADER ===== */
header {
  background: var(--color-bg-dark);
  color: var(--color-text-inverse);
}

.header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 32px;
  max-width: 1400px;
  margin: 0 auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-logo {
  height: 48px;
  width: auto;
  border-radius: 4px;
}

.brand-text h1 {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: 2px;
  line-height: 1.2;
}

.brand-accent {
  color: var(--color-primary);
}

.subtitle {
  font-size: 12px;
  color: #9ca3af;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  font-weight: 500;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-badge {
  background: var(--color-allowed);
  color: white;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 20px;
  letter-spacing: 1.5px;
  animation: pulse 2s ease-in-out infinite;
}

.btn-logout {
  color: #9ca3af;
  font-size: 11px;
  font-weight: 600;
  text-decoration: none;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  padding: 4px 12px;
  border: 1px solid #4b5563;
  border-radius: 20px;
  transition: all 0.2s;
}

.btn-logout:hover {
  color: white;
  border-color: #9ca3af;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

.header-accent {
  height: 3px;
  background: linear-gradient(90deg, var(--color-primary), var(--color-primary) 40%, var(--color-accent-red) 100%);
}

/* ===== TABS ===== */
.tabs {
  display: flex;
  gap: 0;
  background: var(--color-bg-darker);
  padding: 0 32px;
  border-bottom: 1px solid #333;
}

.tab {
  padding: 14px 24px;
  border: none;
  background: none;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  font-weight: 600;
  color: #9ca3af;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  border-bottom: 3px solid transparent;
  margin-bottom: -1px;
  transition: color 0.2s, border-color 0.2s;
}

.tab:hover { color: #e5e7eb; }
.tab.active {
  color: var(--color-primary);
  border-bottom-color: var(--color-primary);
}

/* ===== TAB CONTENT ===== */
.tab-content {
  display: none;
  padding: 28px 32px;
  max-width: 1400px;
  margin: 0 auto;
}
.tab-content.active { display: block; }

/* ===== METRIC CARDS ===== */
.metrics-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-bottom: 28px;
}

.metric-card {
  background: var(--color-surface);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  text-align: center;
  border-left: 4px solid var(--color-primary);
  position: relative;
  overflow: hidden;
  transition: box-shadow 0.2s, transform 0.2s;
}

.metric-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.metric-card.metric-blocked { border-left-color: var(--color-blocked); }
.metric-card.metric-allowed { border-left-color: var(--color-allowed); }
.metric-card.metric-flagged { border-left-color: var(--color-warning); }

.metric-icon {
  font-size: 24px;
  margin-bottom: 8px;
  opacity: 0.8;
}

.metric-value {
  font-size: 36px;
  font-weight: 800;
  margin-bottom: 4px;
  letter-spacing: -0.5px;
}

.metric-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--color-text-light);
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* ===== CLASSIFICATION BREAKDOWN ===== */
.breakdown-section {
  background: var(--color-surface);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  margin-bottom: 28px;
}

.breakdown-section h3,
.feed-section h3 {
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--color-text);
  margin-bottom: 20px;
}

.breakdown-bar {
  display: flex;
  align-items: center;
  margin-bottom: 12px;
  gap: 14px;
}

.breakdown-bar .bar-label {
  width: 120px;
  font-size: 12px;
  font-weight: 600;
  text-align: right;
  flex-shrink: 0;
  color: var(--color-text-light);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.breakdown-bar .bar-track {
  flex: 1;
  height: 28px;
  background: var(--color-bg);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.breakdown-bar .bar-fill {
  height: 100%;
  border-radius: var(--radius-sm);
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  min-width: 2px;
}

.breakdown-bar .bar-count {
  width: 50px;
  font-size: 14px;
  font-weight: 700;
}

.bar-fill.blacklisted { background: var(--color-blocked); }
.bar-fill.whitelisted { background: var(--color-allowed); }
.bar-fill.spam_detected { background: var(--color-warning); }
.bar-fill.legitimate { background: #43a047; }
.bar-fill.unknown { background: var(--color-unknown); }

/* ===== LIVE FEED ===== */
.feed-section {
  background: var(--color-surface);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
}

.live-feed {
  max-height: 420px;
  overflow-y: auto;
}

.live-feed::-webkit-scrollbar { width: 6px; }
.live-feed::-webkit-scrollbar-track { background: transparent; }
.live-feed::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 3px; }

.feed-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--color-border);
  animation: slideIn 0.3s ease;
  border-radius: var(--radius-sm);
  transition: background 0.15s;
}

.feed-item:hover { background: #fafafa; }

@keyframes slideIn {
  from { opacity: 0; transform: translateX(-12px); }
  to { opacity: 1; transform: translateX(0); }
}

.feed-item:last-child { border-bottom: none; }

.feed-time {
  font-size: 11px;
  font-weight: 500;
  color: var(--color-text-light);
  width: 70px;
  flex-shrink: 0;
  font-family: 'Inter', monospace;
}

.feed-number {
  font-weight: 700;
  font-size: 13px;
  width: 130px;
  flex-shrink: 0;
  font-family: 'Inter', monospace;
  letter-spacing: 0.3px;
}

.feed-label {
  font-size: 12px;
  color: var(--color-text-light);
  width: 170px;
  flex-shrink: 0;
  font-weight: 500;
}

.feed-reason {
  font-size: 12px;
  color: var(--color-text-light);
  flex: 1;
}

/* ===== AUTO-WHITELIST SECTION ===== */
.auto-whitelist-section {
  background: var(--color-surface);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  margin-top: 28px;
  border-top: 3px solid var(--color-whitelist);
}

.auto-whitelist-section h3 {
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--color-text);
  margin-bottom: 20px;
}

.section-note {
  font-weight: 500;
  color: var(--color-text-light);
  text-transform: none;
  letter-spacing: 0;
  font-size: 12px;
}

.auto-whitelist-feed {
  max-height: 300px;
  overflow-y: auto;
}

/* ===== BADGES ===== */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  flex-shrink: 0;
}

.badge-blocked { background: var(--color-blocked-bg); color: var(--color-blocked); }
.badge-allowed { background: var(--color-allowed-bg); color: var(--color-allowed); }
.badge-blacklisted { background: var(--color-blocked-bg); color: var(--color-blocked); }
.badge-whitelisted { background: var(--color-allowed-bg); color: var(--color-allowed); }
.badge-spam_detected { background: var(--color-warning-bg); color: #b45309; }
.badge-legitimate { background: var(--color-allowed-bg); color: var(--color-allowed); }
.badge-unknown { background: var(--color-unknown-bg); color: var(--color-unknown); }

/* ===== PHONE LISTS ===== */
.lists-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.list-column {
  background: var(--color-surface);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
}

.whitelist-column { border-top: 3px solid var(--color-whitelist); }
.blacklist-column { border-top: 3px solid var(--color-blacklist); }

.list-header {
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 20px;
  padding-bottom: 0;
  border-bottom: none;
}

.whitelist-header { color: var(--color-whitelist); }
.blacklist-header { color: var(--color-blacklist); }

.add-form {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
}

.add-form input {
  flex: 1;
  padding: 10px 14px;
  border: 2px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: 'Inter', sans-serif;
  transition: border-color 0.2s;
}

.add-form input:focus {
  outline: none;
  border-color: var(--color-primary);
}

.btn-add-whitelist, .btn-add-blacklist {
  padding: 10px 18px;
  border: none;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 12px;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

.btn-add-whitelist {
  background: var(--color-allowed);
  color: white;
}
.btn-add-whitelist:hover { background: #256029; }

.btn-add-blacklist {
  background: var(--color-blocked);
  color: white;
}
.btn-add-blacklist:hover { background: #b71c1c; }

.list-entry {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  transition: box-shadow 0.2s;
}

.list-entry:hover { box-shadow: var(--shadow); }

.list-entry-info {
  display: flex;
  flex-direction: column;
}

.list-entry-phone {
  font-weight: 700;
  font-size: 14px;
  font-family: 'Inter', monospace;
  letter-spacing: 0.3px;
}

.list-entry-label {
  font-size: 12px;
  color: var(--color-text-light);
  font-weight: 500;
}

.btn-remove {
  padding: 6px 14px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: white;
  color: var(--color-text-light);
  font-size: 11px;
  font-weight: 600;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  transition: all 0.2s;
}

.btn-remove:hover {
  background: var(--color-blocked);
  color: white;
  border-color: var(--color-blocked);
}

.list-entry-actions {
  display: flex;
  gap: 6px;
  align-items: center;
}

.btn-move {
  padding: 6px 14px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: white;
  color: var(--color-text-light);
  font-size: 11px;
  font-weight: 600;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  transition: all 0.2s;
}

.btn-move-whitelist:hover {
  background: var(--color-allowed);
  color: white;
  border-color: var(--color-allowed);
}

.btn-move-blacklist:hover {
  background: var(--color-blocked);
  color: white;
  border-color: var(--color-blocked);
}

/* ===== CALL LOG ===== */
.log-controls {
  margin-bottom: 16px;
}

.log-controls select {
  padding: 10px 14px;
  border: 2px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: 'Inter', sans-serif;
  font-weight: 500;
  background: var(--color-surface);
  cursor: pointer;
  transition: border-color 0.2s;
}

.log-controls select:focus {
  outline: none;
  border-color: var(--color-primary);
}

.call-log-table {
  width: 100%;
  background: var(--color-surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border-collapse: collapse;
  font-size: 13px;
  overflow: hidden;
}

.call-log-table th {
  text-align: left;
  padding: 14px 16px;
  background: var(--color-bg-dark);
  font-weight: 700;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #9ca3af;
  border-bottom: none;
}

.call-log-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--color-border);
}

.call-log-table tbody tr:nth-child(even) { background: #fafafa; }
.call-log-table tbody tr:hover { background: #f5f5f5; }

.btn-flag {
  padding: 4px 10px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: white;
  font-size: 10px;
  font-weight: 600;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  transition: all 0.2s;
  text-transform: uppercase;
}

.btn-flag:hover { border-color: var(--color-warning); }
.btn-flag.flagged {
  background: var(--color-warning-bg);
  border-color: var(--color-warning);
  color: #b45309;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-top: 20px;
}

.pagination button {
  padding: 10px 20px;
  border: 2px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  font-family: 'Inter', sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  transition: all 0.2s;
}

.pagination button:hover:not(:disabled) {
  border-color: var(--color-primary);
  background: var(--color-primary);
  color: var(--color-primary-text);
}

.pagination button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

#log-page-info {
  font-size: 12px;
  font-weight: 500;
  color: var(--color-text-light);
}

/* ===== SIMULATION ===== */
.sim-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--color-surface);
  border-radius: var(--radius);
  padding: 20px 24px;
  box-shadow: var(--shadow);
  margin-bottom: 28px;
}

.sim-status {
  font-size: 14px;
  font-weight: 500;
}

.status-stopped {
  color: var(--color-blocked);
  font-weight: 700;
}

.status-running {
  color: var(--color-allowed);
  font-weight: 700;
}

.sim-buttons { display: flex; gap: 10px; }

.btn-start, .btn-stop {
  padding: 10px 24px;
  border: none;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 12px;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  transition: all 0.2s;
}

.btn-start {
  background: var(--color-primary);
  color: var(--color-primary-text);
}
.btn-start:hover { background: var(--color-primary-hover); }
.btn-start:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-stop {
  background: var(--color-blocked);
  color: white;
}
.btn-stop:hover { background: #b71c1c; }
.btn-stop:disabled { opacity: 0.4; cursor: not-allowed; }

h3 {
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 12px;
}

.sim-description {
  color: var(--color-text-light);
  font-size: 13px;
  margin-bottom: 20px;
  line-height: 1.6;
}

.profiles-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.profile-card {
  background: var(--color-surface);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  border-left: 4px solid var(--color-unknown);
  transition: box-shadow 0.2s, transform 0.2s;
}

.profile-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.profile-card.legitimate { border-left-color: var(--color-allowed); }
.profile-card.robocaller { border-left-color: var(--color-blocked); }
.profile-card.mixed { border-left-color: var(--color-warning); }

.profile-card h4 {
  margin-bottom: 4px;
  font-size: 15px;
  font-weight: 700;
}

.profile-card .profile-phone {
  color: var(--color-text-light);
  font-size: 13px;
  margin-bottom: 10px;
  font-family: 'Inter', monospace;
  font-weight: 500;
}

.profile-card .profile-traits {
  font-size: 12px;
  color: var(--color-text-light);
  margin-bottom: 14px;
  line-height: 1.6;
}

.profile-card .btn-trigger {
  padding: 10px 18px;
  border: 2px solid var(--color-primary);
  border-radius: var(--radius-sm);
  background: white;
  color: var(--color-primary-text);
  font-weight: 700;
  font-size: 12px;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  transition: all 0.2s;
  width: 100%;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.profile-card .btn-trigger:hover {
  background: var(--color-primary);
  color: var(--color-primary-text);
}

.empty-message {
  text-align: center;
  color: var(--color-text-light);
  padding: 24px;
  font-size: 13px;
  font-weight: 500;
}

/* ===== SHIELD SETUP (NUCLEUS VOICE) ===== */
.nucleus-status-bar {
  background: var(--color-bg-dark);
  border-radius: var(--radius);
  padding: 16px 24px;
  margin-bottom: 24px;
  color: var(--color-text-inverse);
}

.nucleus-status-info {
  display: flex;
  gap: 32px;
  font-size: 13px;
  font-weight: 500;
}

.nucleus-setup-section {
  background: var(--color-surface);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  margin-bottom: 28px;
}

.nucleus-setup-section h3 { margin-bottom: 8px; }

.nucleus-setup-buttons {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}

.nucleus-agents-section,
.nucleus-numbers-section {
  margin-bottom: 28px;
}

/* ===== FOOTER ===== */
footer {
  text-align: center;
  padding: 24px 32px;
  font-size: 12px;
  color: var(--color-text-light);
  border-top: 1px solid var(--color-border);
  margin-top: 40px;
}

footer strong {
  font-weight: 700;
  color: var(--color-text);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1024px) {
  .metrics-row {
    grid-template-columns: repeat(2, 1fr);
  }

  .profiles-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .lists-container {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .header-content {
    padding: 14px 16px;
  }

  .brand-logo {
    height: 36px;
  }

  .brand-text h1 {
    font-size: 17px;
    letter-spacing: 1px;
  }

  .subtitle {
    font-size: 10px;
  }

  .tabs {
    padding: 0 8px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .tab {
    padding: 12px 14px;
    font-size: 11px;
    white-space: nowrap;
  }

  .tab-content {
    padding: 20px 16px;
  }

  .metrics-row {
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }

  .metric-card {
    padding: 16px;
  }

  .metric-value {
    font-size: 28px;
  }

  .profiles-grid {
    grid-template-columns: 1fr;
  }

  .sim-controls {
    flex-direction: column;
    gap: 14px;
    align-items: flex-start;
  }

  .call-log-table {
    font-size: 11px;
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .call-log-table th,
  .call-log-table td {
    padding: 8px 10px;
    white-space: nowrap;
  }

  .add-form {
    flex-direction: column;
  }

  .add-form input {
    min-width: 0;
    width: 100%;
  }

  .btn-add-whitelist, .btn-add-blacklist {
    width: 100%;
    text-align: center;
  }

  .list-entry {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .list-entry-actions {
    width: 100%;
  }

  .list-entry-actions .btn-move,
  .list-entry-actions .btn-remove {
    flex: 1;
    text-align: center;
  }

  .nucleus-status-info {
    flex-direction: column;
    gap: 8px;
  }

  .nucleus-setup-buttons {
    flex-direction: column;
  }

  .nucleus-setup-buttons .btn-start,
  .nucleus-setup-buttons .btn-stop {
    width: 100%;
    text-align: center;
  }

  footer {
    margin-top: 24px;
    padding: 16px;
  }
}

@media (max-width: 480px) {
  .metrics-row {
    grid-template-columns: 1fr;
  }

  .brand-text h1 {
    font-size: 15px;
  }

  .header-badge {
    font-size: 10px;
    padding: 3px 10px;
  }

  .breakdown-bar {
    flex-wrap: wrap;
    gap: 6px;
  }

  .breakdown-bar .bar-label {
    width: auto;
    text-align: left;
  }

  .feed-item {
    flex-wrap: wrap;
    gap: 6px;
  }

  .feed-time,
  .feed-number,
  .feed-label {
    width: auto;
  }
}
