:root {
  --bg-core: #070a0e;
  --bg-surface: #0c1117;
  --bg-surface-raised: #121822;
  --bg-surface-hover: #17212d;
  --bg-surface-active: #1d2a3a;
  --bg-input: #090d12;
  
  --line-subtle: #19232f;
  --line-border: #223040;
  --line-focus: #38bdf8;
  
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --text-faint: #475569;
  
  --accent-emerald: #10b981;
  --accent-emerald-glow: rgba(16, 185, 129, 0.18);
  --accent-lime: #b8f26a;
  --accent-cyan: #38bdf8;
  --accent-cyan-glow: rgba(56, 189, 248, 0.18);
  --accent-amber: #f59e0b;
  --accent-amber-glow: rgba(245, 158, 11, 0.18);
  --accent-rose: #f43f5e;
  --accent-rose-glow: rgba(244, 63, 94, 0.18);
  --accent-purple: #a855f7;

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
  
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.65);
  --shadow-glow: 0 0 25px rgba(16, 185, 129, 0.15);
}

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

html, body {
  margin: 0;
  padding: 0;
  background-color: var(--bg-core);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 13.5px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
}

/* Background atmospheric gradient */
body {
  background-image: 
    radial-gradient(ellipse 80% 50% at 50% -20%, rgba(16, 185, 129, 0.08), transparent 70%),
    radial-gradient(ellipse 60% 40% at 100% 100%, rgba(56, 189, 248, 0.05), transparent 60%);
  background-attachment: fixed;
}

/* Typography & Links */
h1, h2, h3, h4, p {
  margin: 0;
}

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

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

button {
  cursor: pointer;
  border: none;
  background: none;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 7px;
  height: 7px;
}
::-webkit-scrollbar-track {
  background: var(--bg-core);
}
::-webkit-scrollbar-thumb {
  background: var(--line-border);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* ============================================================
   AUTH / LOGIN VIEW
   ============================================================ */
.auth-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.auth-card {
  width: min(460px, 100%);
  background: var(--bg-surface);
  border: 1px solid var(--line-border);
  border-radius: var(--radius-xl);
  padding: 38px 34px;
  box-shadow: var(--shadow-lg), var(--shadow-glow);
  position: relative;
  overflow: hidden;
}

.auth-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent-emerald), var(--accent-cyan));
}

.auth-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 24px;
}

.brand-badge {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, #10b981, #059669);
  color: #070a0e;
  display: grid;
  place-items: center;
  font-size: 22px;
  font-weight: 900;
  box-shadow: 0 0 15px rgba(16, 185, 129, 0.4);
}

.auth-title {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text-primary);
}

.auth-subtitle {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.auth-desc {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 24px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--line-subtle);
  border-radius: var(--radius-md);
  padding: 12px 14px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-bottom: 18px;
}

.form-label {
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
}

.form-input {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--line-border);
  color: var(--text-primary);
  padding: 12px 14px;
  border-radius: var(--radius-md);
  outline: none;
  font-size: 13.5px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-input:focus {
  border-color: var(--accent-emerald);
  box-shadow: 0 0 0 3px var(--accent-emerald-glow);
}

.form-input::placeholder {
  color: var(--text-faint);
}

.btn-primary {
  width: 100%;
  background: linear-gradient(135deg, #10b981, #059669);
  color: #070a0e;
  font-weight: 700;
  font-size: 14px;
  padding: 13px 18px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  margin-top: 8px;
  box-shadow: 0 4px 15px rgba(16, 185, 129, 0.25);
  transition: transform 0.15s, box-shadow 0.15s, opacity 0.15s;
}

.btn-primary:hover:not(:disabled) {
  opacity: 0.95;
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.35);
}

.btn-primary:active:not(:disabled) {
  transform: translateY(0);
}

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

.auth-error {
  margin-top: 14px;
  padding: 10px 14px;
  background: var(--accent-rose-glow);
  border: 1px solid rgba(244, 63, 94, 0.3);
  border-radius: var(--radius-md);
  color: #fda4af;
  font-size: 12.5px;
  display: none;
  align-items: center;
  gap: 8px;
}

.auth-footer {
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid var(--line-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-faint);
}

/* ============================================================
   APP SHELL LAYOUT
   ============================================================ */
.app-shell {
  display: flex;
  min-height: 100vh;
  position: relative;
}

/* SIDEBAR */
.sidebar {
  width: 260px;
  background: var(--bg-surface);
  border-right: 1px solid var(--line-border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 40;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.sidebar-header {
  padding: 20px 18px;
  border-bottom: 1px solid var(--line-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand-link {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: inherit;
}

.brand-badge-sm {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, #10b981, #059669);
  color: #070a0e;
  display: grid;
  place-items: center;
  font-size: 16px;
  font-weight: 900;
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.3);
}

.brand-text-title {
  font-weight: 700;
  font-size: 13.5px;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 6px;
}

.brand-text-sub {
  font-size: 11px;
  color: var(--text-muted);
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-section-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-faint);
  padding: 12px 10px 6px;
}

.nav-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 12px;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  text-align: left;
  transition: background 0.15s, color 0.15s;
  position: relative;
}

.nav-btn:hover {
  background: var(--bg-surface-raised);
  color: var(--text-primary);
}

.nav-btn.active {
  background: var(--accent-emerald-glow);
  color: var(--accent-lime);
  font-weight: 600;
}

.nav-btn.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 6px;
  bottom: 6px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--accent-emerald);
}

.nav-icon {
  width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  opacity: 0.85;
}

.nav-btn.active .nav-icon {
  opacity: 1;
  color: var(--accent-lime);
}

.nav-badge {
  margin-left: auto;
  font-size: 10.5px;
  padding: 2px 7px;
  border-radius: 10px;
  background: var(--bg-surface-active);
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.sidebar-footer {
  padding: 14px 16px;
  border-top: 1px solid var(--line-subtle);
  background: rgba(0, 0, 0, 0.15);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.user-card {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, #1e293b, #0f172a);
  border: 1px solid var(--line-border);
  color: var(--accent-lime);
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 800;
  flex-shrink: 0;
}

.user-info {
  flex: 1;
  min-width: 0;
}

.user-name {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-role {
  font-size: 11px;
  color: var(--text-muted);
}

.sidebar-actions {
  display: flex;
  gap: 8px;
}

.btn-sidebar {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 10px;
  background: var(--bg-surface-raised);
  border: 1px solid var(--line-border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 11.5px;
  transition: all 0.15s;
}

.btn-sidebar:hover {
  background: var(--bg-surface-hover);
  color: var(--text-primary);
  border-color: var(--text-muted);
}

/* MAIN CONTENT */
.main-wrapper {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* TOPBAR */
.topbar {
  padding: 16px 28px;
  border-bottom: 1px solid var(--line-subtle);
  background: rgba(12, 17, 23, 0.7);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

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

.menu-toggle {
  display: none;
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-border);
  background: var(--bg-surface);
  color: var(--text-secondary);
  place-items: center;
}

.view-heading {
  display: flex;
  flex-direction: column;
}

.view-title {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text-primary);
}

.view-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 1px;
}

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

.stream-status-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: var(--bg-surface);
  border: 1px solid var(--line-border);
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--text-secondary);
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-emerald);
  box-shadow: 0 0 10px var(--accent-emerald);
  position: relative;
}

.pulse-dot.pulse-live::after {
  content: '';
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  border: 1px solid var(--accent-emerald);
  animation: pulse-ring 2s cubic-bezier(0.215, 0.61, 0.355, 1) infinite;
}

.pulse-dot.pulse-warning {
  background: var(--accent-amber);
  box-shadow: 0 0 10px var(--accent-amber);
}

.pulse-dot.pulse-error {
  background: var(--accent-rose);
  box-shadow: 0 0 10px var(--accent-rose);
}

@keyframes pulse-ring {
  0% { transform: scale(0.8); opacity: 0.9; }
  70% { transform: scale(2.2); opacity: 0; }
  100% { transform: scale(2.2); opacity: 0; }
}

.sync-time {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
}

.btn-icon-top {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  background: var(--bg-surface);
  border: 1px solid var(--line-border);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 500;
  transition: all 0.15s;
}

.btn-icon-top:hover {
  background: var(--bg-surface-raised);
  color: var(--text-primary);
  border-color: var(--text-muted);
}

/* CONTENT CONTAINER */
.content-area {
  flex: 1;
  padding: 24px 28px 48px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* DEGRADED BANNER */
.banner-degraded {
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: var(--radius-lg);
  padding: 12px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  color: #fde68a;
  font-size: 12.5px;
}

.banner-degraded-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ============================================================
   GRID SYSTEMS & CARDS
   ============================================================ */
.grid-metrics {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}

.metric-card {
  background: var(--bg-surface);
  border: 1px solid var(--line-border);
  border-radius: var(--radius-lg);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  position: relative;
  overflow: hidden;
  transition: border-color 0.2s, transform 0.2s;
}

.metric-card:hover {
  border-color: var(--line-focus);
}

.metric-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.metric-label {
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
}

.metric-icon-box {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  background: var(--bg-surface-raised);
  display: grid;
  place-items: center;
  color: var(--accent-cyan);
}

.metric-value-wrap {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.metric-value-lg {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.04em;
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-variant-numeric: tabular-nums;
}

.metric-badge {
  font-size: 10.5px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 10px;
}

.badge-emerald {
  background: var(--accent-emerald-glow);
  color: #34d399;
}
.badge-cyan {
  background: var(--accent-cyan-glow);
  color: #38bdf8;
}
.badge-amber {
  background: var(--accent-amber-glow);
  color: #fbbf24;
}
.badge-rose {
  background: var(--accent-rose-glow);
  color: #f87171;
}

.progress-track {
  width: 100%;
  height: 5px;
  background: var(--bg-surface-raised);
  border-radius: 3px;
  overflow: hidden;
  margin-top: 2px;
}

.progress-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.4s ease;
}
.fill-emerald { background: var(--accent-emerald); }
.fill-cyan { background: var(--accent-cyan); }
.fill-amber { background: var(--accent-amber); }
.fill-rose { background: var(--accent-rose); }

.metric-sub {
  font-size: 11px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* SECTION CARDS */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--line-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--line-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255, 255, 255, 0.01);
}

.card-title-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.card-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.card-subtitle {
  font-size: 11.5px;
  color: var(--text-muted);
}

.card-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-body {
  padding: 20px;
}

/* TWO-COL LAYOUTS */
.grid-2col {
  display: grid;
  grid-template-columns: 1.25fr 0.75fr;
  gap: 16px;
}

.grid-equal {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

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

/* ============================================================
   SERVICE MATRIX
   ============================================================ */
.service-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
}

.service-card {
  background: var(--bg-surface-raised);
  border: 1px solid var(--line-border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: border-color 0.15s, background 0.15s;
}

.service-card:hover {
  background: var(--bg-surface-hover);
  border-color: rgba(56, 189, 248, 0.3);
}

.service-icon-box {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  border: 1px solid var(--line-subtle);
  display: grid;
  place-items: center;
  color: var(--accent-cyan);
  flex-shrink: 0;
}

.service-info {
  flex: 1;
  min-width: 0;
}

.service-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  font-family: var(--font-mono);
}

.service-role {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.service-status-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  font-family: var(--font-mono);
}

.service-status-pill.status-active {
  background: var(--accent-emerald-glow);
  color: var(--accent-lime);
  border: 1px solid rgba(16, 185, 129, 0.25);
}

.service-status-pill.status-inactive,
.service-status-pill.status-failed {
  background: var(--accent-rose-glow);
  color: #f87171;
  border: 1px solid rgba(244, 63, 94, 0.25);
}

.service-status-pill.status-unknown {
  background: var(--accent-amber-glow);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.25);
}

.status-dot-sm {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}
.status-active .status-dot-sm { background: var(--accent-emerald); }
.status-failed .status-dot-sm { background: var(--accent-rose); }
.status-unknown .status-dot-sm { background: var(--accent-amber); }

/* ============================================================
   TABLES & DATA LISTS
   ============================================================ */
.table-container {
  width: 100%;
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 12.5px;
}

.data-table th {
  padding: 11px 16px;
  background: rgba(255, 255, 255, 0.015);
  border-bottom: 1px solid var(--line-border);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.data-table td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--line-subtle);
  color: var(--text-secondary);
}

.data-table tr:hover td {
  background: var(--bg-surface-raised);
}

.data-table tr:last-child td {
  border-bottom: none;
}

.domain-name-cell {
  font-weight: 700;
  color: var(--text-primary);
  font-family: var(--font-mono);
  display: flex;
  align-items: center;
  gap: 8px;
}

.table-empty {
  padding: 36px 20px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
}

/* ============================================================
   FILE MANAGER
   ============================================================ */
.file-manager-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.breadcrumbs {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-surface-raised);
  border: 1px solid var(--line-border);
  border-radius: var(--radius-md);
  padding: 6px 12px;
  font-family: var(--font-mono);
  font-size: 12px;
  flex: 1;
  min-width: 200px;
  overflow-x: auto;
}

.crumb-btn {
  color: var(--accent-cyan);
  padding: 2px 4px;
  border-radius: 4px;
}
.crumb-btn:hover {
  background: var(--bg-surface-hover);
  text-decoration: underline;
}

.crumb-sep {
  color: var(--text-faint);
}

.crumb-current {
  color: var(--text-primary);
  font-weight: 600;
}

.file-row-btn {
  background: none;
  border: none;
  color: inherit;
  font: inherit;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0;
  text-align: left;
}

.file-row-btn:hover {
  color: var(--accent-cyan);
}

.file-upload-panel {
  background: var(--bg-surface-raised);
  border: 1px dashed var(--line-border);
  border-radius: var(--radius-lg);
  padding: 24px;
  text-align: center;
  margin-bottom: 18px;
  transition: border-color 0.2s, background 0.2s;
}

.file-upload-panel.dragover {
  border-color: var(--accent-emerald);
  background: var(--accent-emerald-glow);
}

.upload-result-banner {
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 12.5px;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.upload-result-success {
  background: var(--accent-emerald-glow);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: #6ee7b7;
}
.upload-result-error {
  background: var(--accent-rose-glow);
  border: 1px solid rgba(244, 63, 94, 0.3);
  color: #fda4af;
}

/* ============================================================
   OPERATOR TERMINAL / CONSOLE
   ============================================================ */
.terminal-window {
  background: #040608;
  border: 1px solid #1e293b;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.8), var(--shadow-md);
  display: flex;
  flex-direction: column;
}

.terminal-titlebar {
  background: #0b0f14;
  border-bottom: 1px solid #1a222d;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.terminal-dots {
  display: flex;
  align-items: center;
  gap: 6px;
}

.t-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}
.t-dot-red { background: #ff5f56; }
.t-dot-yellow { background: #ffbd2e; }
.t-dot-green { background: #27c93f; }

.terminal-title-text {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--text-muted);
}

.terminal-chips {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: #070a0e;
  border-bottom: 1px solid #141b24;
  overflow-x: auto;
  flex-wrap: nowrap;
}

.chip-btn {
  background: #111822;
  border: 1px solid #233041;
  border-radius: 4px;
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 3px 8px;
  white-space: nowrap;
  transition: all 0.15s;
}

.chip-btn:hover {
  background: #192534;
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
}

.terminal-viewport {
  min-height: 340px;
  max-height: 520px;
  overflow-y: auto;
  padding: 16px 18px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.65;
  color: #cbd5e1;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.term-entry {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.term-cmd-line {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.term-prompt {
  color: var(--accent-lime);
  font-weight: 700;
  flex-shrink: 0;
}

.term-cmd {
  color: #f8fafc;
  font-weight: 600;
}

.term-time {
  font-size: 10px;
  color: var(--text-faint);
  margin-left: auto;
}

.term-output {
  margin: 0;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.02);
  border-left: 2px solid #2a384c;
  border-radius: 0 4px 4px 0;
  color: #94a3b8;
  white-space: pre-wrap;
  word-break: break-all;
  font-size: 12px;
  font-family: var(--font-mono);
}

.term-output.term-err {
  border-left-color: var(--accent-rose);
  color: #fda4af;
  background: rgba(244, 63, 94, 0.05);
}

.terminal-input-bar {
  padding: 10px 16px;
  background: #090d12;
  border-top: 1px solid #1a222d;
  display: flex;
  align-items: center;
  gap: 8px;
}

.term-input-field {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: #f8fafc;
  font-family: var(--font-mono);
  font-size: 13px;
}

/* ============================================================
   MAIL HEALTH & ACTIONS
   ============================================================ */
.mail-card-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.mail-queue-box {
  background: var(--bg-surface-raised);
  border: 1px solid var(--line-border);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-top: 14px;
}

.action-card {
  background: var(--bg-surface);
  border: 1px solid var(--line-border);
  border-radius: var(--radius-lg);
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.action-header {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.action-icon {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-md);
  background: var(--bg-surface-raised);
  border: 1px solid var(--line-subtle);
  display: grid;
  place-items: center;
  color: var(--accent-cyan);
  flex-shrink: 0;
}

.action-info h4 {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
}

.action-info p {
  font-size: 12.5px;
  color: var(--text-muted);
  margin-top: 4px;
}

.action-status-box {
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: 12px;
  font-family: var(--font-mono);
}

/* ============================================================
   AUDIT TRAIL
   ============================================================ */
.audit-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.audit-item {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 12px 14px;
  background: var(--bg-surface-raised);
  border: 1px solid var(--line-subtle);
  border-radius: var(--radius-md);
  transition: background 0.15s;
}

.audit-item:hover {
  background: var(--bg-surface-hover);
}

.audit-time {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  min-width: 70px;
  padding-top: 2px;
}

.audit-body {
  flex: 1;
  min-width: 0;
}

.audit-action-title {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.audit-actor-tag {
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--accent-cyan);
}

.audit-detail {
  font-size: 11.5px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  margin-top: 3px;
  word-break: break-all;
}

/* ============================================================
   BUTTONS & FORM ELEMENTS
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px 14px;
  border-radius: var(--radius-md);
  font-size: 12.5px;
  font-weight: 600;
  transition: all 0.15s;
}

.btn-secondary {
  background: var(--bg-surface-raised);
  border: 1px solid var(--line-border);
  color: var(--text-primary);
}
.btn-secondary:hover {
  background: var(--bg-surface-hover);
  border-color: var(--text-muted);
}

.btn-danger {
  background: var(--accent-rose-glow);
  border: 1px solid rgba(244, 63, 94, 0.35);
  color: #fda4af;
}
.btn-danger:hover {
  background: rgba(244, 63, 94, 0.3);
  border-color: var(--accent-rose);
}

.btn-sm {
  padding: 5px 10px;
  font-size: 11.5px;
  border-radius: var(--radius-sm);
}

.search-input-wrap {
  position: relative;
  width: 220px;
}

.search-input {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--line-border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  padding: 6px 12px 6px 30px;
  font-size: 12px;
  outline: none;
}
.search-input:focus {
  border-color: var(--accent-emerald);
}

.search-icon-pos {
  position: absolute;
  left: 9px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

/* ============================================================
   TOAST NOTIFICATIONS
   ============================================================ */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  min-width: 280px;
  max-width: 420px;
  background: var(--bg-surface-raised);
  border: 1px solid var(--line-border);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 12px;
  animation: toast-in 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.toast-success {
  border-color: rgba(16, 185, 129, 0.4);
  background: #0c1813;
  color: #6ee7b7;
}

.toast-error {
  border-color: rgba(244, 63, 94, 0.4);
  background: #1f0f12;
  color: #fda4af;
}

.toast-info {
  border-color: rgba(56, 189, 248, 0.4);
  background: #0d1622;
  color: #7dd3fc;
}

@keyframes toast-in {
  from { transform: translateY(20px) scale(0.95); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}

/* Backdrop for Mobile Sidebar */
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  z-index: 35;
}

/* ============================================================
   RESPONSIVE MEDIA QUERIES
   ============================================================ */
@media (max-width: 1100px) {
  .grid-metrics {
    grid-template-columns: repeat(2, 1fr);
  }
  .grid-2col {
    grid-template-columns: 1fr;
  }
  .grid-3col {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    transform: translateX(-100%);
    box-shadow: var(--shadow-lg);
  }
  
  .sidebar.open {
    transform: translateX(0);
  }
  
  .sidebar-backdrop.open {
    display: block;
  }

  .menu-toggle {
    display: grid;
  }

  .topbar {
    padding: 14px 18px;
  }

  .content-area {
    padding: 18px 14px 40px;
  }

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

  .mail-card-grid,
  .grid-equal {
    grid-template-columns: 1fr;
  }

  .terminal-chips {
    overflow-x: auto;
  }
}
