/* ── CSS Variables ────────────────────────────────────────────────────────── */
:root {
  --bg-base: #0f172a;
  --bg-surface: #1e293b;
  --bg-elevated: #293548;
  --border: #334155;
  --accent: #3b82f6;
  --accent-secondary: #06b6d4;
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --success: #22c55e;
  --warning: #f59e0b;
  --danger: #ef4444;
  --sidebar-width: 240px;
  --header-height: 60px;
  --radius: 8px;
  --radius-lg: 12px;
}

/* ── Reset ────────────────────────────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  height: 100%;
}

body {
  background: var(--bg-base);
  color: var(--text-primary);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.5;
  height: 100%;
  min-height: 100vh;
}

a {
  color: var(--accent);
  text-decoration: none;
}

/* ── Layout ───────────────────────────────────────────────────────────────── */
.layout {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ── Sidebar ──────────────────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
  position: relative;
  z-index: 100;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 16px;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border);
  letter-spacing: -0.3px;
}

.sidebar-logo span {
  font-size: 1.4rem;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 12px 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius);
  color: var(--text-secondary);
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
  cursor: pointer;
  text-decoration: none;
  font-size: 0.875rem;
}

.nav-item:hover {
  background: var(--bg-elevated);
  color: var(--text-primary);
}

.nav-item.active {
  background: rgba(59, 130, 246, 0.15);
  color: var(--accent);
  border: 1px solid rgba(59, 130, 246, 0.2);
}

.nav-icon {
  font-size: 1rem;
  width: 20px;
  text-align: center;
  flex-shrink: 0;
}

.sidebar-footer {
  padding: 12px 8px;
  border-top: 1px solid var(--border);
}

/* ── Main Content ─────────────────────────────────────────────────────────── */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

/* ── Header ───────────────────────────────────────────────────────────────── */
.header {
  height: var(--header-height);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 50;
  flex-shrink: 0;
}

.header h2 {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
}

.user-info {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

/* ── Page Content ─────────────────────────────────────────────────────────── */
.page-content {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
}

/* ── Stats Grid ───────────────────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: border-color 0.2s, box-shadow 0.2s;
  cursor: default;
}

.stat-card:hover {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(59, 130, 246, 0.1);
}

.stat-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.stat-icon {
  font-size: 1.25rem;
  opacity: 0.8;
}

.stat-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--accent);
  line-height: 1;
  margin-top: 4px;
}

.stat-label {
  font-size: 0.8rem;
  color: var(--text-secondary);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ── Card ─────────────────────────────────────────────────────────────────── */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 20px;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.card-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
}

.card-actions {
  display: flex;
  gap: 8px;
}

/* ── Charts Row ───────────────────────────────────────────────────────────── */
.charts-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 20px;
}

.chart-container {
  position: relative;
  height: 220px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ── Table ────────────────────────────────────────────────────────────────── */
.table-wrapper {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th {
  color: var(--text-secondary);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  text-align: left;
  padding: 8px 16px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

td {
  padding: 12px 16px;
  border-bottom: 1px solid rgba(51, 65, 85, 0.5);
  font-size: 0.875rem;
  color: var(--text-primary);
}

tr:last-child td {
  border-bottom: none;
}

tr:hover td {
  background: var(--bg-elevated);
}

.font-mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.8rem;
}

/* ── Badges ───────────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  white-space: nowrap;
}

.badge-critical {
  background: #7f1d1d;
  color: #fca5a5;
}

.badge-high {
  background: #7c2d12;
  color: #fdba74;
}

.badge-medium {
  background: #713f12;
  color: #fde68a;
}

.badge-low {
  background: #1e3a5f;
  color: #93c5fd;
}

.badge-online {
  background: #14532d;
  color: #86efac;
}

.badge-offline {
  background: #450a0a;
  color: #fca5a5;
}

.badge-warning {
  background: #713f12;
  color: #fde68a;
}

.badge-status-open {
  background: #7f1d1d;
  color: #fca5a5;
}

.badge-status-investigating {
  background: #713f12;
  color: #fde68a;
}

.badge-status-resolved {
  background: #14532d;
  color: #86efac;
}

.badge-admin {
  background: #312e81;
  color: #a5b4fc;
}

.badge-operator {
  background: #164e63;
  color: #67e8f9;
}

/* ── Buttons ──────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 500;
  transition: background 0.15s, opacity 0.15s, transform 0.1s;
  text-decoration: none;
  white-space: nowrap;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover {
  background: #2563eb;
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}

.btn-danger:hover {
  background: #dc2626;
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid transparent;
}

.btn-ghost:hover {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border-color: var(--border);
}

/* ── Forms ────────────────────────────────────────────────────────────────── */
.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  margin-bottom: 6px;
  color: var(--text-secondary);
  font-size: 0.8rem;
  font-weight: 500;
}

.form-input {
  width: 100%;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  color: var(--text-primary);
  font-size: 0.875rem;
  transition: border-color 0.15s, box-shadow 0.15s;
  outline: none;
}

.form-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.form-input::placeholder {
  color: var(--text-secondary);
  opacity: 0.6;
}

/* ── Login ────────────────────────────────────────────────────────────────── */
.login-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-base);
  padding: 20px;
}

.login-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 40px;
  width: 400px;
  max-width: 90vw;
}

.login-logo {
  text-align: center;
  margin-bottom: 32px;
}

.login-logo h1 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-top: 8px;
  margin-bottom: 4px;
}

.login-logo p {
  color: var(--text-secondary);
  font-size: 0.875rem;
}

/* ── Filter Bar ───────────────────────────────────────────────────────────── */
.filter-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.filter-btn {
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}

.filter-btn:hover {
  background: var(--bg-elevated);
  color: var(--text-primary);
}

.filter-btn.active {
  background: rgba(59, 130, 246, 0.15);
  color: var(--accent);
  border-color: rgba(59, 130, 246, 0.4);
}

/* ── Toast ────────────────────────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  font-size: 0.875rem;
  z-index: 9999;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  animation: toast-in 0.2s ease;
  max-width: 320px;
}

.toast-error {
  border-left: 3px solid var(--danger);
  color: #fca5a5;
}

.toast-success {
  border-left: 3px solid var(--success);
  color: #86efac;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ── AI Chat ──────────────────────────────────────────────────────────────── */
.chat-container {
  display: flex;
  flex-direction: column;
  height: calc(100vh - var(--header-height) - 48px);
  max-height: 700px;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  background: var(--bg-elevated);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  margin-bottom: 12px;
  min-height: 200px;
}

.chat-input-area {
  display: flex;
  gap: 8px;
}

.chat-input-area input {
  flex: 1;
}

/* ── Empty State ──────────────────────────────────────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px;
  color: var(--text-secondary);
  gap: 8px;
  text-align: center;
}

.empty-state-icon {
  font-size: 2.5rem;
  opacity: 0.5;
  margin-bottom: 8px;
}

/* ── Info Card / User Card ────────────────────────────────────────────────── */
.info-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}

.info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid rgba(51, 65, 85, 0.4);
  font-size: 0.875rem;
}

.info-row:last-child {
  border-bottom: none;
}

.info-row-label {
  color: var(--text-secondary);
  font-weight: 500;
}

.info-row-value {
  color: var(--text-primary);
}

/* ── Banner ───────────────────────────────────────────────────────────────── */
.banner {
  background: rgba(59, 130, 246, 0.1);
  border: 1px solid rgba(59, 130, 246, 0.3);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 20px;
  color: var(--text-primary);
  font-weight: 500;
}

/* ── Risk Score Bar ───────────────────────────────────────────────────────── */
.risk-bar-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
}

.risk-bar-bg {
  flex: 1;
  height: 6px;
  background: var(--bg-elevated);
  border-radius: 999px;
  overflow: hidden;
  min-width: 60px;
}

.risk-bar-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.4s ease;
}

/* ── Utility classes ──────────────────────────────────────────────────────── */
.text-secondary {
  color: var(--text-secondary);
}

.text-danger {
  color: var(--danger);
}

.text-success {
  color: var(--success);
}

.text-warning {
  color: var(--warning);
}

.text-accent {
  color: var(--accent);
}

.text-sm {
  font-size: 0.8rem;
}

.text-xs {
  font-size: 0.72rem;
}

.mt-4 { margin-top: 4px; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mb-16 { margin-bottom: 16px; }

/* ── Loading Skeleton ─────────────────────────────────────────────────────── */
.skeleton {
  background: linear-gradient(90deg, var(--bg-elevated) 25%, var(--border) 50%, var(--bg-elevated) 75%);
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s infinite;
  border-radius: var(--radius);
}

@keyframes skeleton-loading {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ── Responsive ───────────────────────────────────────────────────────────── */
@media (max-width: 1200px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .charts-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .sidebar {
    display: none;
  }

  .stats-grid {
    grid-template-columns: 1fr 1fr;
  }

  .page-content {
    padding: 16px;
  }

  .header {
    padding: 0 16px;
  }
}

@media (max-width: 480px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }
}

/* ── Modal ────────────────────────────────────────────────────────────────── */
.modal {
  position: fixed; inset: 0; z-index: 1000;
  display: flex; align-items: center; justify-content: center;
}
.modal-overlay {
  position: absolute; inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
}
.modal-card {
  position: relative; z-index: 1;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  width: 480px; max-width: 90vw;
  box-shadow: 0 25px 50px rgba(0,0,0,0.5);
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 24px; border-bottom: 1px solid var(--border);
}
.modal-body { padding: 24px; }
.modal-footer {
  display: flex; justify-content: flex-end; gap: 8px;
  padding: 16px 24px; border-top: 1px solid var(--border);
}
.simulate-result-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  margin-top: 16px;
}
.risk-score-display {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--danger);
  text-align: center;
  margin: 8px 0;
}

/* ── Section Title ───────────────────────────────────────────────── */
.section-title {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-secondary);
  margin: 1.5rem 0 0.75rem;
}

/* ── Bay Grid ─────────────────────────────────────────────────────── */
.bay-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.bay-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem 1.2rem;
  border-left: 3px solid var(--border);
  transition: border-color 0.2s;
}
.bay-card.healthy  { border-left-color: #22c55e; }
.bay-card.degraded { border-left-color: #f59e0b; }
.bay-card.critical { border-left-color: #ef4444; }

.bay-card-name {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-bottom: 0.35rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bay-card-status {
  font-size: 1rem;
  font-weight: 700;
  text-transform: capitalize;
  margin-bottom: 0.4rem;
}
.bay-card-status.healthy  { color: #22c55e; }
.bay-card-status.degraded { color: #f59e0b; }
.bay-card-status.critical { color: #ef4444; }

.bay-card-counts {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

/* ── Filter Label ────────────────────────────────────────────────── */
.filter-label {
  font-size: 0.75rem;
  color: var(--text-secondary);
  align-self: center;
  margin-right: 0.25rem;
}

/* ── Last Updated Indicator ──────────────────────────────────────── */
.last-updated {
  font-size: 0.75rem;
  color: var(--text-secondary);
  float: right;
  margin-top: 4px;
}

/* ── AI Assistant Chat ───────────────────────────────────────────── */
.chat-message {
  display: flex;
  margin-bottom: 4px;
}
.chat-message-user {
  justify-content: flex-end;
}
.chat-message-ai, .chat-message-error {
  justify-content: flex-start;
}
.chat-bubble {
  max-width: 85%;
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 0.9rem;
  line-height: 1.6;
}
.chat-message-user .chat-bubble {
  background: var(--accent);
  color: white;
  border-bottom-right-radius: 4px;
}
.chat-message-ai .chat-bubble, .ai-bubble {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
  max-width: 90%;
}
.chat-message-error .chat-bubble {
  background: rgba(239,68,68,0.1);
  border: 1px solid var(--danger);
  color: var(--danger);
}
.ai-answer {
  margin-bottom: 12px;
}
.ai-section {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.ai-section-title {
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.ai-recommendations {
  padding-left: 20px;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.875rem;
}
.ai-references {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.ref-badge {
  background: rgba(59,130,246,0.15);
  border: 1px solid rgba(59,130,246,0.3);
  color: var(--accent);
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
}
.ai-source {
  margin-top: 10px;
  font-size: 0.75rem;
  color: var(--text-secondary);
  text-align: right;
}
.ai-context-badge {
  background: rgba(6,182,212,0.1);
  border: 1px solid rgba(6,182,212,0.3);
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 0.8rem;
  color: var(--accent-secondary);
  margin-bottom: 10px;
}
.ai-welcome {
  padding: 24px;
  text-align: center;
}
.typing-indicator {
  display: flex;
  gap: 4px;
  align-items: center;
  padding: 14px 18px !important;
}
.typing-indicator span {
  width: 8px;
  height: 8px;
  background: var(--text-secondary);
  border-radius: 50%;
  animation: typing-bounce 1.2s infinite;
}
.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }
@keyframes typing-bounce {
  0%, 60%, 100% { transform: translateY(0); }
  30% { transform: translateY(-8px); }
}
.suggested-query-btn {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-secondary);
  padding: 8px 10px;
  text-align: left;
  cursor: pointer;
  font-size: 0.78rem;
  line-height: 1.4;
  transition: all 0.15s;
  width: 100%;
}
.suggested-query-btn:hover {
  background: var(--bg-surface);
  border-color: var(--accent);
  color: var(--text-primary);
}

/* ── Health Score Badge ───────────────────────────────────────────── */
.health-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  min-width: 32px;
  text-align: center;
}
.health-ok       { background: rgba(34,197,94,0.15);  color: #22c55e; border: 1px solid rgba(34,197,94,0.3); }
.health-fair     { background: rgba(245,158,11,0.15); color: #f59e0b; border: 1px solid rgba(245,158,11,0.3); }
.health-poor     { background: rgba(249,115,22,0.15); color: #f97316; border: 1px solid rgba(249,115,22,0.3); }
.health-critical { background: rgba(239,68,68,0.15);  color: #ef4444; border: 1px solid rgba(239,68,68,0.3); }

/* ── PM Status Badge ─────────────────────────────────────────────── */
.pm-badge {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
}
.pm-overdue  { background: rgba(239,68,68,0.15);  color: #ef4444; border: 1px solid rgba(239,68,68,0.3); }
.pm-due-soon { background: rgba(245,158,11,0.15); color: #f59e0b; border: 1px solid rgba(245,158,11,0.3); }
.pm-ok       { background: rgba(34,197,94,0.1);   color: #22c55e; border: 1px solid rgba(34,197,94,0.25); }

/* ── Maintenance Grid (Dashboard) ────────────────────────────────── */
.maint-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.maint-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.9rem 1rem;
  transition: border-color 0.2s;
}
.maint-card:hover { border-color: var(--accent); }

.maint-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.25rem;
}

.maint-device-name {
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 140px;
}

.maint-card-meta {
  font-size: 0.72rem;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

.maint-card-pm {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.maint-card-hours {
  font-size: 0.7rem;
  color: var(--text-secondary);
  white-space: nowrap;
}

/* ── Maintenance count badge (section title) ─────────────────────── */
.maint-badge {
  margin-left: 0.6rem;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 600;
  vertical-align: middle;
}
.maint-badge-alert { background: rgba(239,68,68,0.15); color: #ef4444; border: 1px solid rgba(239,68,68,0.3); }
.maint-badge-warn  { background: rgba(245,158,11,0.15); color: #f59e0b; border: 1px solid rgba(245,158,11,0.3); }

@media (max-width: 1200px) {
  .maint-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
  .maint-grid { grid-template-columns: 1fr; }
  .bay-grid   { grid-template-columns: repeat(2, 1fr); }
}
