/* ==========================================================================
   BASE – design tokens, resets, and shared utilities
   Modern Minimalist Theme
   ========================================================================== */

:root {
  color-scheme: light;

  /* ---- Surfaces & ink ---- */
  --bg: #fafafa;
  --surface: #ffffff;
  --surface-sunken: #f4f4f5;
  --border: #e4e4e7;
  --border-strong: #d4d4d8;

  --ink: #09090b;
  --ink-soft: #52525b;
  --ink-faint: #a1a1aa;

  --accent: #18181b;
  --accent-soft: #27272a;
  --on-accent: #ffffff;

  /* ---- Status colors (Vibrant & Modern) ---- */
  --operational: #10b981; 
  --degraded: #f59e0b;
  --down: #ef4444;
  --maintenance: #3b82f6;
  --unknown: #71717a;
  --missing: #e4e4e7;

  /* ---- Spacing ---- */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-7: 32px;
  --space-8: 40px;
  --space-9: 56px;

  /* ---- Shape & shadow ---- */
  --radius-sm: 6px;
  --radius: 12px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow-md: 0 8px 24px rgba(0,0,0,0.04);
}

:root[data-theme="dark"] {
  color-scheme: dark;

  /* Ultra-dark modern aesthetic */
  --bg: #09090b;
  --surface: #121214;
  --surface-sunken: #18181b;
  --border: #27272a;
  --border-strong: #3f3f46;

  --ink: #fafafa;
  --ink-soft: #a1a1aa;
  --ink-faint: #52525b;

  --accent: #ffffff;
  --accent-soft: #e4e4e7;
  --on-accent: #09090b;

  --operational: #10b981;
  --degraded: #f59e0b;
  --down: #ef4444;
  --maintenance: #3b82f6;
  --unknown: #52525b;
  --missing: #27272a;

  --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
  --shadow-md: 0 8px 32px rgba(0,0,0,0.4);
}

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

html, body {
  background: var(--bg);
  color: var(--ink);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

main { flex: 1; }
a { color: inherit; text-decoration: none; }
h1, h2, h3 { font-weight: 600; letter-spacing: -0.02em; }
button, input, select, textarea { font-family: inherit; font-size: inherit; }

:focus-visible {
  outline: 2px solid var(--accent-soft);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

.hidden { display: none !important; }

/* ----- Shared button styles ----- */
.btn {
  padding: 8px 16px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: 0.15s;
}
.btn:hover { background: var(--surface-sunken); }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent-soft); border-color: var(--accent-soft); }
.btn-danger { background: var(--surface); border-color: var(--down); color: var(--down); }
.btn-danger:hover { background: var(--down-tint); }
.btn-secondary { background: var(--surface); color: var(--ink-soft); }
.btn-sm { padding: 4px 10px; font-size: 0.75rem; }
.btn-block { width: 100%; justify-content: center; }

/* ----- Theme toggle ----- */
.theme-toggle {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: 50%;
  background: var(--surface-sunken);
  color: var(--ink-soft);
  cursor: pointer;
  flex-shrink: 0;
  transition: 0.2s;
}
.theme-toggle:hover { background: var(--border); color: var(--ink); }
.theme-toggle svg { width: 15px; height: 15px; }
.theme-toggle .icon-moon { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: block; }

/* ----- Shared form elements ----- */
.form-group { margin-bottom: var(--space-4); }
.form-group label {
  display: block;
  margin-bottom: 6px;
  color: var(--ink-soft);
  font-size: 0.8125rem;
  font-weight: 500;
}
.form-group input, .form-group select, .form-group textarea {
  width: 100%;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  color: var(--ink);
  transition: 0.2s;
}
.form-group input::placeholder, .form-group textarea::placeholder { color: var(--ink-faint); }
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  outline: none;
  border-color: var(--accent-soft);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-soft) 15%, transparent);
}
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 var(--space-4); }
.form-grid .full-width { grid-column: 1 / -1; }

/* ----- Toast (shared) ----- */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  z-index: 200;
}
.toast {
  background: var(--accent);
  color: var(--on-accent);
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: var(--shadow-md);
}
.toast.error { background: var(--down); }

.spinner {
  width: 14px;
  height: 14px;
  border: 2px solid color-mix(in srgb, currentColor 25%, transparent);
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}