/* FluxOps App Dashboard Styles — matches landing page design tokens */
:root {
  --bg: #0a0a0f;
  --bg-subtle: #12121a;
  --bg-card: #16161f;
  --fg: #e8e8ed;
  --fg-muted: #8a8a9a;
  --fg-dim: #5a5a6a;
  --accent: #00d4aa;
  --accent-2: #6366f1;
  --accent-3: #f59e0b;
  --accent-4: #ec4899;
  --red: #ef4444;
  --yellow: #f59e0b;
  --green: #00d4aa;
  --gradient: linear-gradient(135deg, #00d4aa 0%, #6366f1 50%, #ec4899 100%);
  --border: #1e1e2a;
  --radius: 12px;
  --radius-sm: 8px;
  --max-w: 1280px;
  --nav-h: 64px;
}

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

body {
  background: var(--bg);
  color: var(--fg);
  font-family: 'DM Sans', sans-serif;
  line-height: 1.6;
  min-height: 100vh;
}

h1, h2, h3, h4, h5 { font-family: 'Space Grotesk', sans-serif; line-height: 1.15; }

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

/* ── NAV ── */
.app-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--nav-h);
  background: rgba(10, 10, 15, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 0;
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--fg);
  text-decoration: none;
  margin-right: 32px;
}

.nav-logo-mark {
  width: 32px;
  height: 32px;
  background: var(--gradient);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  color: white;
  font-weight: 800;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1;
}

.nav-link {
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--fg-muted);
  text-decoration: none;
  transition: color 0.15s, background 0.15s;
}

.nav-link:hover { color: var(--fg); background: rgba(255,255,255,0.05); text-decoration: none; }
.nav-link.active { color: var(--accent); background: rgba(0, 212, 170, 0.08); }

.nav-actions { display: flex; align-items: center; gap: 10px; }

/* ── LAYOUT ── */
.app-shell {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 32px 24px;
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 28px;
  gap: 16px;
  flex-wrap: wrap;
}

.page-title { font-size: 1.6rem; font-weight: 700; color: var(--fg); }
.page-subtitle { font-size: 0.9rem; color: var(--fg-muted); margin-top: 4px; }

/* ── STAT CARDS ── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

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

.stat-label {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-dim);
  margin-bottom: 8px;
}

.stat-value {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 2rem;
  font-weight: 700;
  line-height: 1;
}

.stat-value.green { color: var(--green); }
.stat-value.yellow { color: var(--yellow); }
.stat-value.red { color: var(--red); }
.stat-value.neutral { color: var(--fg); }

.stat-sub { font-size: 0.8rem; color: var(--fg-muted); margin-top: 4px; }

/* ── CARDS ── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

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

.card-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--fg);
}

.card-body { padding: 0; }

/* ── TABLES ── */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.data-table th {
  text-align: left;
  padding: 10px 20px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--fg-dim);
  border-bottom: 1px solid var(--border);
}

.data-table td {
  padding: 14px 20px;
  border-bottom: 1px solid rgba(30, 30, 42, 0.6);
  vertical-align: middle;
}

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

.data-table tbody tr:hover { background: rgba(255,255,255,0.02); }

/* ── HEALTH BADGES ── */
.health-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 100px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.health-badge.green { background: rgba(0,212,170,0.12); color: var(--green); border: 1px solid rgba(0,212,170,0.25); }
.health-badge.yellow { background: rgba(245,158,11,0.12); color: var(--yellow); border: 1px solid rgba(245,158,11,0.25); }
.health-badge.red { background: rgba(239,68,68,0.12); color: var(--red); border: 1px solid rgba(239,68,68,0.25); }

.health-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.health-dot.green { background: var(--green); box-shadow: 0 0 6px var(--green); }
.health-dot.yellow { background: var(--yellow); box-shadow: 0 0 6px var(--yellow); }
.health-dot.red { background: var(--red); box-shadow: 0 0 6px var(--red); animation: pulse-red 1.5s ease-in-out infinite; }

@keyframes pulse-red {
  0%, 100% { opacity: 1; box-shadow: 0 0 6px var(--red); }
  50% { opacity: 0.6; box-shadow: 0 0 12px var(--red); }
}

/* ── PRIORITY BADGES ── */
.priority-badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 100px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.priority-badge.critical { background: rgba(239,68,68,0.15); color: var(--red); }
.priority-badge.high { background: rgba(245,158,11,0.15); color: var(--yellow); }
.priority-badge.medium { background: rgba(99,102,241,0.15); color: var(--accent-2); }
.priority-badge.low { background: rgba(138,138,154,0.1); color: var(--fg-muted); }

/* ── STATUS BADGES ── */
.status-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 100px;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.status-badge.scheduled { background: rgba(99,102,241,0.12); color: var(--accent-2); }
.status-badge.in_progress { background: rgba(245,158,11,0.12); color: var(--yellow); }
.status-badge.completed { background: rgba(0,212,170,0.12); color: var(--green); }
.status-badge.overdue { background: rgba(239,68,68,0.12); color: var(--red); }

/* ── HEALTH SCORE BAR ── */
.health-bar-wrap { display: flex; align-items: center; gap: 10px; }
.health-bar-bg {
  flex: 1;
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
  min-width: 60px;
}
.health-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.4s ease;
}
.health-bar-fill.green { background: var(--green); }
.health-bar-fill.yellow { background: var(--yellow); }
.health-bar-fill.red { background: var(--red); }
.health-score-num {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.8rem;
  font-weight: 600;
  min-width: 28px;
  text-align: right;
}

/* ── BUTTONS ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 600;
  font-family: 'DM Sans', sans-serif;
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: opacity 0.15s, transform 0.1s;
}

.btn:hover { opacity: 0.85; text-decoration: none; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn-primary { background: var(--accent); color: #0a0a0f; }
.btn-secondary { background: rgba(255,255,255,0.07); color: var(--fg); border: 1px solid var(--border); }
.btn-danger { background: rgba(239,68,68,0.15); color: var(--red); border: 1px solid rgba(239,68,68,0.3); }
.btn-sm { padding: 5px 12px; font-size: 0.8rem; }

/* ── FORMS ── */
.form-section { max-width: 680px; }

.form-group { margin-bottom: 20px; }

.form-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--fg-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 7px;
}

.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--fg);
  font-size: 0.9rem;
  font-family: 'DM Sans', sans-serif;
  transition: border-color 0.15s;
  outline: none;
  -webkit-appearance: none;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--accent);
}

.form-select option { background: var(--bg-card); }

.form-textarea { min-height: 100px; resize: vertical; }

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

.form-error {
  background: rgba(239,68,68,0.1);
  border: 1px solid rgba(239,68,68,0.3);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  color: var(--red);
  font-size: 0.875rem;
  margin-bottom: 20px;
}

/* ── GRID LAYOUTS ── */
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.three-col { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.main-aside { display: grid; grid-template-columns: 1fr 340px; gap: 20px; }

@media (max-width: 900px) {
  .two-col, .main-aside { grid-template-columns: 1fr; }
  .three-col { grid-template-columns: 1fr 1fr; }
  .form-row { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
  .three-col { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ── EMPTY STATE ── */
.empty-state {
  text-align: center;
  padding: 60px 24px;
  color: var(--fg-muted);
}

.empty-state h3 { color: var(--fg); font-size: 1.1rem; margin-bottom: 8px; }
.empty-state p { font-size: 0.9rem; margin-bottom: 20px; }

/* ── DETAIL META ── */
.detail-meta {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}

.meta-item {}
.meta-key { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.07em; color: var(--fg-dim); margin-bottom: 4px; font-weight: 600; }
.meta-val { font-size: 0.9rem; color: var(--fg); font-weight: 500; }

/* ── SENSOR TILES ── */
.sensor-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 14px; padding: 20px 24px; }

.sensor-tile {
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
}

.sensor-type { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--fg-dim); font-weight: 600; margin-bottom: 4px; }
.sensor-value { font-family: 'Space Grotesk', sans-serif; font-size: 1.5rem; font-weight: 700; }
.sensor-unit { font-size: 0.75rem; color: var(--fg-muted); }
.sensor-time { font-size: 0.72rem; color: var(--fg-dim); margin-top: 6px; }

.sensor-tile.warn { border-color: rgba(245,158,11,0.35); }
.sensor-tile.warn .sensor-value { color: var(--yellow); }
.sensor-tile.crit { border-color: rgba(239,68,68,0.35); }
.sensor-tile.crit .sensor-value { color: var(--red); }

/* ── ALERTS ── */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  font-size: 0.875rem;
}

.alert-warning { background: rgba(245,158,11,0.08); border: 1px solid rgba(245,158,11,0.25); color: var(--fg); }
.alert-critical { background: rgba(239,68,68,0.08); border: 1px solid rgba(239,68,68,0.25); color: var(--fg); }
.alert-icon { font-size: 1rem; flex-shrink: 0; margin-top: 1px; }

/* ── TABS ── */
.tabs { display: flex; border-bottom: 1px solid var(--border); margin-bottom: 24px; gap: 4px; }
.tab {
  padding: 10px 18px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--fg-muted);
  border-bottom: 2px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: color 0.15s;
  margin-bottom: -1px;
}
.tab:hover { color: var(--fg); text-decoration: none; }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }

/* ── SECTION DIVIDERS ── */
.section-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--fg-dim);
  margin: 28px 0 14px;
}

/* ── BREADCRUMB ── */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  color: var(--fg-muted);
  margin-bottom: 16px;
}

.breadcrumb a { color: var(--fg-muted); text-decoration: none; }
.breadcrumb a:hover { color: var(--accent); }
.breadcrumb-sep { color: var(--fg-dim); }
.breadcrumb-current { color: var(--fg); }

/* ── SPARKLINE CANVAS ── */
.sparkline-wrap { display: inline-block; vertical-align: middle; }

/* ── OVERDUE BANNER ── */
.overdue-banner {
  background: rgba(239,68,68,0.08);
  border: 1px solid rgba(239,68,68,0.25);
  border-radius: var(--radius);
  padding: 14px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  font-size: 0.875rem;
}

.overdue-banner strong { color: var(--red); }

/* ── GRADIENT TEXT ── */
.gradient-text {
  background: var(--gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ── TOOLTIPS ── */
[title] { cursor: help; }

/* ── MISC ── */
.text-muted { color: var(--fg-muted); }
.text-red { color: var(--red); }
.text-yellow { color: var(--yellow); }
.text-green { color: var(--green); }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.mb-4 { margin-bottom: 16px; }
.flex-row { display: flex; align-items: center; gap: 10px; }
.spacer { flex: 1; }
