/* ============================================================
   style.css — Incident Outage Tracker
   Razer-inspired dark UI design system
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Rajdhani:wght@400;500;600;700&family=Inter:wght@300;400;500;600&family=JetBrains+Mono:wght@400;500&display=swap');

/* ============================================================
   CSS Custom Properties — Design Tokens
   ============================================================ */
:root {
  /* Backgrounds */
  --bg-base:        #080808;
  --bg-surface:     #111111;
  --bg-card:        #161616;
  --bg-hover:       #1c1c1c;
  --bg-input:       #0e0e0e;
  --bg-modal:       #131313;

  /* Borders */
  --border:         #252525;
  --border-bright:  #363636;
  --border-accent:  rgba(68, 214, 44, 0.4);

  /* Razer Green Palette */
  --accent:         #44d62c;
  --accent-hover:   #52e838;
  --accent-dim:     rgba(68, 214, 44, 0.08);
  --accent-glow:    rgba(68, 214, 44, 0.25);
  --accent-glow-lg: rgba(68, 214, 44, 0.15);

  /* Text */
  --text-primary:   #f0f0f0;
  --text-secondary: #888888;
  --text-muted:     #4a4a4a;
  --text-accent:    #44d62c;

  /* Status colours */
  --status-investigating-bg:    rgba(255, 107, 53, 0.12);
  --status-investigating-text:  #ff6b35;
  --status-investigating-border: rgba(255, 107, 53, 0.35);

  --status-identified-bg:    rgba(255, 215, 0, 0.10);
  --status-identified-text:  #ffd700;
  --status-identified-border: rgba(255, 215, 0, 0.35);

  --status-monitoring-bg:    rgba(79, 195, 247, 0.10);
  --status-monitoring-text:  #4fc3f7;
  --status-monitoring-border: rgba(79, 195, 247, 0.35);

  --status-resolved-bg:    rgba(68, 214, 44, 0.10);
  --status-resolved-text:  #44d62c;
  --status-resolved-border: rgba(68, 214, 44, 0.35);

  /* Impact colours */
  --impact-critical: #ff3333;
  --impact-major:    #ff8800;
  --impact-minor:    #ffd700;
  --impact-none:     #888888;

  /* Danger */
  --danger:       #ff4444;
  --danger-hover: #ff2222;
  --danger-dim:   rgba(255, 68, 68, 0.10);

  /* Typography */
  --font-ui:    'Inter', system-ui, sans-serif;
  --font-head:  'Rajdhani', 'Inter', sans-serif;
  --font-mono:  'JetBrains Mono', 'Courier New', monospace;

  /* Spacing */
  --radius-sm: 4px;
  --radius:    6px;
  --radius-lg: 10px;

  /* Transitions */
  --transition: 0.18s ease;
}

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

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

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

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

/* ============================================================
   Scrollbar
   ============================================================ */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-surface); }
::-webkit-scrollbar-thumb { background: #333; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

/* ============================================================
   Typography
   ============================================================ */
h1, h2, h3, h4 {
  font-family: var(--font-head);
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-primary);
}

h1 { font-size: 1.8rem; }
h2 { font-size: 1.4rem; }
h3 { font-size: 1.1rem; }

.mono { font-family: var(--font-mono); font-size: 0.82rem; }
.text-muted { color: var(--text-secondary); }
.text-accent { color: var(--accent); }

/* ============================================================
   Buttons
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 16px;
  border-radius: var(--radius);
  font-family: var(--font-ui);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all var(--transition);
  white-space: nowrap;
  letter-spacing: 0.02em;
}

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

.btn--primary {
  background: var(--accent);
  color: #000;
  border-color: var(--accent);
  font-weight: 600;
}
.btn--primary:hover:not(:disabled) {
  background: var(--accent-hover);
  box-shadow: 0 0 12px var(--accent-glow);
}

.btn--secondary {
  background: transparent;
  color: var(--accent);
  border-color: var(--accent);
}
.btn--secondary:hover:not(:disabled) {
  background: var(--accent-dim);
  box-shadow: 0 0 8px var(--accent-glow);
}

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

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

.btn--sm { padding: 4px 10px; font-size: 0.78rem; }
.btn--icon {
  padding: 6px 8px;
  background: transparent;
  border-color: var(--border);
  color: var(--text-secondary);
}
.btn--icon:hover { color: var(--accent); border-color: var(--accent); }

/* ============================================================
   Form Controls
   ============================================================ */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

label {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

input[type="text"],
input[type="password"],
input[type="email"],
input[type="date"],
select,
textarea {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-family: var(--font-ui);
  font-size: 0.88rem;
  padding: 8px 12px;
  transition: border-color var(--transition), box-shadow var(--transition);
  width: 100%;
  appearance: none;
  -webkit-appearance: none;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23888' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
  cursor: pointer;
}

select option { background: var(--bg-card); color: var(--text-primary); }

textarea { resize: vertical; min-height: 90px; }

/* Checkbox (multi-select functions) */
.checkbox-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.checkbox-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
  font-size: 0.82rem;
}

.checkbox-item:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent-dim);
  color: var(--accent);
}

.checkbox-item input[type="checkbox"] {
  width: auto;
  accent-color: var(--accent);
}

/* ============================================================
   Navbar
   ============================================================ */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  height: 56px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  gap: 16px;
}

/* Green accent line at bottom of navbar */
.navbar::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--accent) 0%, transparent 60%);
}

.navbar__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.navbar__logo {
  width: 28px;
  height: 28px;
  background: var(--accent);
  clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
}

.navbar__title {
  font-family: var(--font-head);
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-primary);
}

.navbar__title span { color: var(--accent); }

.navbar__tabs {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: 1;
  justify-content: center;
}

.tab-btn {
  padding: 8px 20px;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-secondary);
  font-family: var(--font-head);
  font-size: 0.92rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}

.tab-btn:hover { color: var(--text-primary); }
.tab-btn.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.navbar__user {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.role-badge {
  padding: 2px 8px;
  border-radius: 2px;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.role-badge--admin  { background: var(--accent-dim); color: var(--accent); border: 1px solid var(--border-accent); }
.role-badge--editor { background: rgba(167,139,250,0.10); color: #a78bfa; border: 1px solid rgba(167,139,250,0.35); }
.role-badge--viewer { background: rgba(79,195,247,0.08); color: #4fc3f7; border: 1px solid rgba(79,195,247,0.3); }
.role-badge--bot    { background: rgba(255,215,0,0.08); color: #ffd700; border: 1px solid rgba(255,215,0,0.3); }

.user-name { font-size: 0.85rem; color: var(--text-secondary); }

/* ============================================================
   Main layout
   ============================================================ */
.main { padding: 24px; max-width: 1400px; margin: 0 auto; }

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

/* ============================================================
   Tab Header (title + actions row)
   ============================================================ */
.tab-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.tab-header h2 { flex-shrink: 0; }

.tab-header__actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  flex-wrap: wrap;
}

/* ============================================================
   Filters bar (Permanent Incidents tab)
   ============================================================ */
.filters-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 14px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 20px;
}

.filters-bar input,
.filters-bar select {
  width: auto;
  min-width: 140px;
}

.filters-bar input[type="text"] { flex: 1; min-width: 200px; }
.filters-bar input[type="date"] { min-width: 140px; }

.filters-bar__label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  flex-shrink: 0;
}

.filters-bar__divider {
  width: 1px;
  height: 24px;
  background: var(--border);
}

/* ============================================================
   Incidents Table
   ============================================================ */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
}

table.incidents-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.86rem;
}

.incidents-table thead {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-bright);
}

.incidents-table th {
  padding: 11px 14px;
  text-align: left;
  font-family: var(--font-head);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-secondary);
  white-space: nowrap;
}

.incidents-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text-primary);
  vertical-align: middle;
}

.incidents-table tbody tr { background: var(--bg-surface); transition: background var(--transition); }
.incidents-table tbody tr:hover { background: var(--bg-hover); }
.incidents-table tbody tr:last-child td { border-bottom: none; }

.cell-id { font-family: var(--font-mono); color: var(--text-muted); font-size: 0.78rem; }
.cell-title { font-weight: 500; cursor: pointer; }
.cell-title:hover { color: var(--accent); }
.cell-tags { display: flex; gap: 4px; flex-wrap: wrap; }
.cell-actions { display: flex; gap: 6px; align-items: center; justify-content: flex-end; white-space: nowrap; }
.cell-date { font-family: var(--font-mono); font-size: 0.78rem; color: var(--text-secondary); white-space: nowrap; }

/* ============================================================
   Status & Impact Badges
   ============================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border: 1px solid;
  white-space: nowrap;
}

.badge--investigating {
  background: var(--status-investigating-bg);
  color: var(--status-investigating-text);
  border-color: var(--status-investigating-border);
}
.badge--identified {
  background: var(--status-identified-bg);
  color: var(--status-identified-text);
  border-color: var(--status-identified-border);
}
.badge--monitoring {
  background: var(--status-monitoring-bg);
  color: var(--status-monitoring-text);
  border-color: var(--status-monitoring-border);
}
.badge--resolved {
  background: var(--status-resolved-bg);
  color: var(--status-resolved-text);
  border-color: var(--status-resolved-border);
}

.badge--type-internal { background: rgba(150,100,255,0.1); color: #a78bfa; border-color: rgba(150,100,255,0.3); }
.badge--type-vonage   { background: rgba(251,146,60,0.1); color: #fb923c; border-color: rgba(251,146,60,0.3); }

.badge--impact-critical { background: rgba(255,51,51,0.12); color: #ff3333; border-color: rgba(255,51,51,0.35); }
.badge--impact-major    { background: rgba(255,136,0,0.12); color: #ff8800; border-color: rgba(255,136,0,0.35); }
.badge--impact-minor    { background: rgba(255,215,0,0.10); color: #ffd700; border-color: rgba(255,215,0,0.35); }

.badge--system { background: var(--bg-hover); color: var(--text-secondary); border-color: var(--border); font-size: 0.70rem; }
.badge--function { background: var(--accent-dim); color: var(--accent); border-color: var(--border-accent); font-size: 0.70rem; }
.badge--country { background: var(--bg-hover); color: #60a5fa; border-color: rgba(96,165,250,0.25); font-size: 0.70rem; }

/* ============================================================
   Live Incidents Grid (cards)
   ============================================================ */
.live-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 16px;
}

.incident-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
  transition: border-color var(--transition), box-shadow var(--transition);
  position: relative;
  overflow: hidden;
}

.incident-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 3px; height: 100%;
}

.incident-card.status--investigating::before { background: var(--status-investigating-text); }
.incident-card.status--identified::before    { background: var(--status-identified-text); }
.incident-card.status--monitoring::before    { background: var(--status-monitoring-text); }
.incident-card.status--resolved::before      { background: var(--status-resolved-text); }

.incident-card:hover {
  border-color: var(--border-bright);
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
}

.card__header { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; margin-bottom: 10px; }
.card__title  { font-weight: 600; font-size: 0.92rem; line-height: 1.4; flex: 1; }
.card__badges { display: flex; gap: 5px; flex-wrap: wrap; }
.card__meta   { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }
.card__meta-row { display: flex; align-items: center; gap: 6px; font-size: 0.78rem; color: var(--text-secondary); }
.card__body   { font-size: 0.82rem; color: var(--text-secondary); line-height: 1.5; margin-bottom: 12px; max-height: 60px; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; }
.card__footer { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.card__tags   { display: flex; gap: 4px; flex-wrap: wrap; }
.card__promoted { font-size: 0.75rem; color: var(--accent); font-family: var(--font-mono); }

/* ============================================================
   Dashboard — KPI Cards
   ============================================================ */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 14px;
  margin-bottom: 28px;
}

.kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  transition: border-color var(--transition);
}

.kpi-card:hover { border-color: var(--border-bright); }

.kpi-card__label {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.kpi-card__value {
  font-family: var(--font-head);
  font-size: 2.2rem;
  font-weight: 700;
  line-height: 1;
  color: var(--text-primary);
}

.kpi-card__value--accent { color: var(--accent); }
.kpi-card__value--warn   { color: var(--status-investigating-text); }

/* ============================================================
   Dashboard — Charts Grid
   ============================================================ */
.charts-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 20px;
}

.chart-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
}

.chart-card--wide { grid-column: 1 / -1; }

.chart-card__title {
  font-family: var(--font-head);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin-bottom: 16px;
}

.chart-wrap { position: relative; height: 260px; }

.year-filter {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
}

.year-filter label { color: var(--text-secondary); font-size: 0.82rem; }
.year-filter select { width: auto; min-width: 100px; }

/* ============================================================
   Modal
   ============================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  backdrop-filter: blur(4px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: all;
}

.modal {
  background: var(--bg-modal);
  border: 1px solid var(--border-bright);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 580px;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6), 0 0 0 1px var(--border);
  transform: translateY(12px);
  transition: transform 0.2s ease;
}

.modal-overlay.open .modal { transform: translateY(0); }

.modal--wide { max-width: 760px; }

.modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
}

.modal__header h3 { font-size: 1rem; }

.modal__close {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: color var(--transition);
  line-height: 1;
}

.modal__close:hover { color: var(--text-primary); }

.modal__body { padding: 22px; display: flex; flex-direction: column; gap: 18px; }

.modal__footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 22px;
  border-top: 1px solid var(--border);
}

/* ============================================================
   Detail View (inside modal)
   ============================================================ */
.detail-section { margin-bottom: 18px; }
.detail-section h4 {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.detail-item__label { font-size: 0.72rem; color: var(--text-muted); margin-bottom: 3px; }
.detail-item__value { font-size: 0.88rem; color: var(--text-primary); }

.detail-description { font-size: 0.86rem; color: var(--text-secondary); line-height: 1.6; }

/* ============================================================
   Comments
   ============================================================ */
.comments-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 250px;
  overflow-y: auto;
  padding-right: 4px;
}

.comment-item {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
  position: relative;
}

.comment-item__meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.comment-item__author { font-size: 0.78rem; font-weight: 600; color: var(--accent); }
.comment-item__time   { font-family: var(--font-mono); font-size: 0.72rem; color: var(--text-muted); }
.comment-item__text   { font-size: 0.84rem; color: var(--text-secondary); line-height: 1.5; }

.comment-item__delete {
  position: absolute;
  top: 8px; right: 8px;
  background: none; border: none;
  color: var(--text-muted); font-size: 0.8rem;
  cursor: pointer; padding: 2px 6px; border-radius: var(--radius-sm);
}
.comment-item__delete:hover { color: var(--danger); }

.comment-form { display: flex; gap: 8px; align-items: flex-end; }
.comment-form textarea { flex: 1; min-height: 60px; }

/* ============================================================
   Pagination
   ============================================================ */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 20px;
  flex-wrap: wrap;
}

.page-btn {
  padding: 5px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.82rem;
  cursor: pointer;
  transition: all var(--transition);
}

.page-btn:hover { border-color: var(--accent); color: var(--accent); }
.page-btn.active { background: var(--accent); color: #000; border-color: var(--accent); font-weight: 600; }
.page-btn:disabled { opacity: 0.4; cursor: not-allowed; }

.pagination-info { font-size: 0.78rem; color: var(--text-muted); }

/* ============================================================
   Empty states & Loading
   ============================================================ */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  color: var(--text-muted);
  gap: 10px;
  text-align: center;
}

.empty-state__icon { font-size: 2.5rem; opacity: 0.4; }
.empty-state__text { font-size: 0.9rem; }

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

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

.loading-overlay {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px;
}

/* ============================================================
   User Management table — fixed-width columns for alignment
   ============================================================ */
table.users-table {
  table-layout: fixed;
}

/* Column widths — must match the colgroup order in renderTable */
table.users-table th:nth-child(1) { width: 56px;  }   /* ID */
table.users-table th:nth-child(2) { width: 160px; }   /* Username */
table.users-table th:nth-child(3) { width: 160px; }   /* Display Name */
table.users-table th:nth-child(4) { width: 90px;  }   /* Role */
table.users-table th:nth-child(5) { width: 160px; }   /* Telegram ID */
table.users-table th:nth-child(6) { width: 90px;  }   /* Status */
table.users-table th:nth-child(7) { width: 110px; }   /* Created */
table.users-table th:nth-child(8) { width: 148px; }   /* Actions */

table.users-table td {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Actions cell in user table — pin width so rows don't jitter */
table.users-table .cell-actions {
  min-width: 130px;
  justify-content: flex-end;
}

/* Fix Delete button to a specific width so all three second-slot items match */
table.users-table .delete-user-btn {
  width: 72px;
  justify-content: center;
}

/* "you" label — must be the same width as the Delete button */
.user-self-label {
  display: inline-block;
  width: 72px;
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-muted);
  font-style: italic;
}

/* Invisible placeholder — must be the same width as the Delete button */
.action-placeholder {
  display: inline-block;
  width: 72px;
}

/* User search bar (same style as live-search-input but wider) */
.user-search-input {
  width: 260px;
  padding: 5px 12px;
  font-size: 0.82rem;
  height: 32px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-family: var(--font-ui);
  transition: border-color var(--transition), box-shadow var(--transition);
}

.user-search-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

.user-search-input::placeholder { color: var(--text-muted); }

/* ============================================================
   Live Incidents — inline search input
   ============================================================ */
.live-search-input {
  width: 220px;
  padding: 5px 12px;
  font-size: 0.82rem;
  height: 32px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-family: var(--font-ui);
  transition: border-color var(--transition), box-shadow var(--transition);
}

.live-search-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

.live-search-input::placeholder { color: var(--text-muted); }

/* ============================================================
   Toast notifications
   ============================================================ */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  padding: 12px 18px;
  border-radius: var(--radius);
  font-size: 0.85rem;
  font-weight: 500;
  border: 1px solid;
  max-width: 340px;
  opacity: 0;
  transform: translateX(20px);
  transition: all 0.25s ease;
  pointer-events: all;
}

.toast.show { opacity: 1; transform: translateX(0); }

.toast--success { background: var(--status-resolved-bg); color: var(--accent); border-color: var(--border-accent); }
.toast--error   { background: var(--danger-dim); color: var(--danger); border-color: rgba(255,68,68,0.35); }
.toast--info    { background: var(--status-monitoring-bg); color: #4fc3f7; border-color: rgba(79,195,247,0.35); }

/* ============================================================
   Login page
   ============================================================ */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-base);
  position: relative;
  overflow: hidden;
}

/* Subtle green grid background */
.login-page::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(68,214,44,0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(68,214,44,0.04) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none;
}

.login-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 40px;
  width: 100%;
  max-width: 400px;
  position: relative;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}

/* Green top border accent */
.login-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), transparent);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.login-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 28px;
}

.login-logo__hex {
  width: 36px;
  height: 36px;
  background: var(--accent);
  clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
  flex-shrink: 0;
}

.login-logo__text {
  font-family: var(--font-head);
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  line-height: 1.1;
}

.login-logo__text span { color: var(--accent); display: block; font-size: 0.7rem; letter-spacing: 0.12em; }

.login-form { display: flex; flex-direction: column; gap: 16px; }

.login-form .btn--primary {
  width: 100%;
  justify-content: center;
  padding: 10px;
  font-size: 0.92rem;
  letter-spacing: 0.04em;
}

.login-error {
  background: var(--danger-dim);
  border: 1px solid rgba(255,68,68,0.35);
  border-radius: var(--radius);
  padding: 8px 12px;
  font-size: 0.82rem;
  color: var(--danger);
  display: none;
}

/* ============================================================
   Promote confirmation chip
   ============================================================ */
.promote-info {
  background: var(--accent-dim);
  border: 1px solid var(--border-accent);
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: 0.84rem;
  color: var(--accent);
  margin-bottom: 4px;
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 900px) {
  .charts-grid { grid-template-columns: 1fr; }
  .chart-card--wide { grid-column: 1; }
}

@media (max-width: 700px) {
  .navbar { padding: 0 14px; }
  .navbar__title { display: none; }
  .main { padding: 14px; }
  .live-grid { grid-template-columns: 1fr; }
  .detail-grid { grid-template-columns: 1fr; }
  .filters-bar { flex-direction: column; align-items: stretch; }
  .tab-btn { padding: 8px 12px; font-size: 0.82rem; }
}

@media (max-width: 480px) {
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .modal { max-width: 100%; }
}
