/* Dashboard grid */
.dash-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--sp-4); }
.dash-chart-card {
  background: var(--bg-card); border: 1px solid var(--border-color);
  border-radius: var(--r-lg); padding: var(--sp-5);
}
.dash-chart-card h4 {
  font-size: var(--fs-sm); font-weight: 600; margin-bottom: var(--sp-4);
  color: var(--text-secondary);
}
.chart-container { position: relative; height: 250px; }
@media (max-width: 1024px) { .dash-grid { grid-template-columns: 1fr; } }

/* ===================================================================
   OEE PAGE — Premium Industrial Dashboard
   =================================================================== */

/* ---------- Filter bar ---------- */
.oee-filter-bar {
  display: flex; justify-content: space-between; align-items: center;
  flex-wrap: wrap; gap: var(--sp-3); margin-bottom: var(--sp-5);
  padding: var(--sp-3) var(--sp-4);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--r-lg);
}
.oee-period-btns { display: flex; gap: var(--sp-2); }
.oee-period-btns .oee-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; border: 1px solid var(--border-color);
  border-radius: var(--r-md); background: transparent;
  color: var(--text-secondary); font-family: var(--font);
  font-size: var(--fs-sm); font-weight: 500;
  cursor: pointer; transition: var(--t-fast);
}
.oee-period-btns .oee-btn .material-icons-round { font-size: 16px; }
.oee-period-btns .oee-btn:hover {
  color: var(--text-primary); border-color: var(--brand-yellow);
  background: var(--brand-yellow-soft);
}
.oee-period-btns .oee-btn.active {
  background: var(--brand-yellow); color: var(--brand-dark);
  border-color: var(--brand-yellow); font-weight: 600;
  box-shadow: 0 2px 10px rgba(255,229,0,0.25);
}
.oee-date-range {
  display: flex; align-items: center; gap: var(--sp-2);
  font-size: var(--fs-sm); color: var(--text-muted);
}
.oee-date-range span { font-weight: 500; }
.oee-date-range input[type="date"] {
  background: var(--bg-input); border: 1px solid var(--border-color);
  border-radius: var(--r-md); padding: 7px 12px; color: var(--text-primary);
  font-size: var(--fs-sm); font-family: var(--font);
  transition: var(--t-fast);
}
.oee-date-range input[type="date"]:focus {
  outline: none; border-color: var(--brand-yellow);
  box-shadow: 0 0 0 2px var(--brand-yellow-soft);
}

/* ---------- Warning banner ---------- */
.oee-warning {
  display: flex; align-items: flex-start; gap: var(--sp-3);
  background: linear-gradient(135deg, rgba(245,158,11,0.08), rgba(245,158,11,0.03));
  border: 1px solid rgba(245,158,11,0.2);
  border-radius: var(--r-lg); padding: var(--sp-4) var(--sp-5);
  margin-bottom: var(--sp-5);
  font-size: var(--fs-sm); color: var(--text-secondary); line-height: 1.6;
}
.oee-warning .material-icons-round {
  color: #f59e0b; font-size: 22px; flex-shrink: 0; margin-top: 1px;
}
.oee-warning strong { color: var(--text-primary); }
.oee-warning small { opacity: 0.7; }

/* ---------- Gauge cards ---------- */
.oee-gauges {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: var(--sp-4); margin-bottom: var(--sp-5);
}
.oee-gauge-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--r-lg); padding: var(--sp-5) var(--sp-4);
  display: flex; flex-direction: column; align-items: center;
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
  position: relative; overflow: hidden;
}
.oee-gauge-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0;
  height: 3px; border-radius: var(--r-lg) var(--r-lg) 0 0;
  background: linear-gradient(90deg, transparent, var(--brand-yellow), transparent);
  opacity: 0; transition: opacity 0.3s;
}
.oee-gauge-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 32px rgba(0,0,0,0.2);
  border-color: rgba(255,229,0,0.15);
}
.oee-gauge-card:hover::before { opacity: 1; }

.gauge-ring { position: relative; width: 130px; height: 130px; }
.gauge-ring svg { width: 100%; height: 100%; filter: drop-shadow(0 0 6px rgba(0,0,0,0.3)); }
.gauge-center {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  text-align: center;
}
.gauge-value { font-size: 24px; font-weight: 800; letter-spacing: -0.5px; }
.gauge-label {
  display: flex; align-items: center; gap: 5px;
  margin-top: var(--sp-3); font-size: var(--fs-sm); font-weight: 600;
  color: var(--text-secondary); letter-spacing: 0.2px;
}

/* ---------- Benchmark comparison ---------- */
.oee-benchmark {
  background: var(--bg-card); border: 1px solid var(--border-color);
  border-radius: var(--r-lg); padding: var(--sp-5) var(--sp-6);
  margin-bottom: var(--sp-5);
}
.oee-benchmark-title {
  font-size: var(--fs-sm); font-weight: 700; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.5px;
  margin-bottom: var(--sp-4);
  display: flex; align-items: center; gap: var(--sp-2);
}
.oee-benchmark-title .material-icons-round { font-size: 16px; color: var(--brand-yellow); }
.benchmark-item {
  display: flex; align-items: center; gap: var(--sp-4);
  padding: var(--sp-2) 0;
}
.benchmark-label {
  font-size: var(--fs-sm); font-weight: 500; color: var(--text-secondary);
  min-width: 160px; flex-shrink: 0;
}
.benchmark-bar {
  flex: 1; height: 10px; background: var(--bg-tertiary);
  border-radius: 5px; overflow: hidden; position: relative;
}
.benchmark-fill {
  height: 100%; border-radius: 5px;
  transition: width 1.2s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
}
.benchmark-fill::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.15));
  border-radius: inherit;
}
.benchmark-value {
  font-size: var(--fs-sm); font-weight: 700;
  min-width: 55px; text-align: right;
  font-variant-numeric: tabular-nums;
}

/* ---------- Stats row ---------- */
.oee-stats-row {
  display: grid; grid-template-columns: repeat(6, 1fr);
  gap: var(--sp-3); margin-bottom: var(--sp-5);
}
.oee-stat {
  background: var(--bg-card); border: 1px solid var(--border-color);
  border-radius: var(--r-lg); padding: var(--sp-4);
  display: flex; flex-direction: column; align-items: center;
  text-align: center; gap: 4px;
  transition: border-color 0.2s;
}
.oee-stat:hover { border-color: rgba(255,229,0,0.15); }
.oee-stat .material-icons-round { font-size: 22px; color: var(--brand-yellow); }
.oee-stat-val {
  font-size: 18px; font-weight: 700; color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}
.oee-stat-label {
  font-size: 10px; color: var(--text-muted); font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.3px;
}

/* ---------- Detail sections ---------- */
.oee-section {
  background: var(--bg-card); border: 1px solid var(--border-color);
  border-radius: var(--r-lg); padding: var(--sp-5);
  margin-bottom: var(--sp-4);
}
.oee-section-title {
  display: flex; align-items: center; gap: var(--sp-2);
  font-size: var(--fs-sm); font-weight: 700; color: var(--text-secondary);
  margin-bottom: var(--sp-4); text-transform: uppercase; letter-spacing: 0.3px;
}
.oee-section-title .material-icons-round {
  font-size: 18px; color: var(--brand-yellow);
}

/* ---------- Six Big Losses ---------- */
.six-losses-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--sp-3);
}
.loss-card {
  display: flex; align-items: center; gap: var(--sp-3);
  background: var(--bg-tertiary); border-radius: var(--r-md);
  padding: var(--sp-4);
  border: 1px solid transparent;
  transition: all 0.2s;
}
.loss-card:hover {
  border-color: var(--border-color);
  background: var(--bg-card-hover);
  transform: translateY(-1px);
}
.loss-icon .material-icons-round { font-size: 26px; }
.loss-info { flex: 1; min-width: 0; }
.loss-name { font-size: var(--fs-sm); font-weight: 600; color: var(--text-primary); }
.loss-category { font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.3px; }
.loss-note { font-size: 10px; color: var(--text-muted); margin-top: 2px; font-style: italic; }
.loss-value {
  font-size: var(--fs-sm); font-weight: 700; color: var(--text-primary);
  white-space: nowrap; font-variant-numeric: tabular-nums;
}

/* ---------- OEE badges ---------- */
.oee-badge {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 3px 12px; border-radius: var(--r-full);
  font-size: var(--fs-xs); font-weight: 700;
  min-width: 60px; font-variant-numeric: tabular-nums;
}
.oee-excellent { background: rgba(34,197,94,0.15); color: #22c55e; }
.oee-good { background: rgba(74,222,128,0.12); color: #4ade80; }
.oee-average { background: rgba(245,158,11,0.12); color: #f59e0b; }
.oee-poor { background: rgba(239,68,68,0.12); color: #ef4444; }
.pillar-badge {
  font-weight: 600; font-size: var(--fs-sm);
  font-variant-numeric: tabular-nums;
}

/* ---------- Formula card ---------- */
.oee-formula-card {
  background: linear-gradient(135deg, var(--bg-card), var(--bg-tertiary));
  border: 1px solid var(--border-color);
  border-radius: var(--r-lg); padding: var(--sp-5) var(--sp-6);
  margin-top: var(--sp-4);
}
.formula-title {
  display: flex; align-items: center; gap: var(--sp-2);
  font-size: var(--fs-sm); font-weight: 700; color: var(--text-secondary);
  margin-bottom: var(--sp-4); text-transform: uppercase; letter-spacing: 0.3px;
}
.formula-title .material-icons-round { font-size: 18px; color: var(--brand-yellow); }
.formula-body {
  display: grid; grid-template-columns: repeat(2, 1fr);
  gap: var(--sp-3);
}
.formula-line {
  font-size: var(--fs-sm); color: var(--text-muted);
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  letter-spacing: -0.3px;
  padding: var(--sp-2) var(--sp-3);
  background: var(--bg-primary);
  border-radius: var(--r-sm);
  border: 1px solid var(--border-light);
}
.formula-label { font-weight: 700; margin-right: var(--sp-2); }
.formula-result {
  grid-column: 1 / -1;
  font-weight: 600; color: var(--text-primary);
  border-color: var(--brand-yellow-soft);
  background: var(--brand-yellow-soft);
}
.formula-result .formula-label { color: var(--brand-yellow); }

/* ---------- Table scroll ---------- */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* ---------- Responsive ---------- */
@media (max-width: 1200px) {
  .oee-gauges { grid-template-columns: repeat(2, 1fr); }
  .oee-stats-row { grid-template-columns: repeat(3, 1fr); }
  .six-losses-grid { grid-template-columns: repeat(2, 1fr); }
  .formula-body { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  .oee-gauges { grid-template-columns: 1fr 1fr; }
  .oee-stats-row { grid-template-columns: repeat(2, 1fr); }
  .six-losses-grid { grid-template-columns: 1fr; }
  .oee-filter-bar { flex-direction: column; align-items: stretch; }
  .oee-period-btns { justify-content: center; }
  .benchmark-label { min-width: 100px; font-size: 11px; }
}
