/* ── /oee: OEE & förluster ───────────────────────────────────────────────── */
.oe-card { background: var(--cc-surface); border: 1px solid var(--cc-border); border-radius: 14px; box-shadow: var(--cc-shadow); padding: 20px 22px; min-width: 0; }
.oe-card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.oe-card-head h2 { font-size: 1.05rem; font-weight: 700; margin: 0; letter-spacing: -.005em; }
.oe-card-head span { font-size: .78rem; color: #64748b; }
.oe-label { font-size: .74rem; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: #64748b; }
.oe-big { font-size: clamp(2.4rem, 1.6rem + 2.2vw, 3.6rem); font-weight: 800; line-height: 1.05; letter-spacing: -.02em; font-variant-numeric: tabular-nums; color: #0f172a; margin: 4px 0 6px; }
.oe-sub { font-size: .86rem; color: #475569; }
.oe-note { font-size: .76rem; color: #64748b; margin: 14px 0 0; line-height: 1.45; }
.oe-empty { color: #64748b; font-size: .9rem; margin: 6px 0; }
.up { color: #15803d; } .down { color: #b91c1c; } .eq { color: #64748b; }

.oe-clear { display: inline-flex; align-items: center; gap: 4px; align-self: center; justify-self: start; height: 36px; padding: 0 12px; border-radius: 8px;
  border: 1px solid var(--cc-border); background: var(--cc-surface); font: inherit; font-size: .85rem; cursor: pointer; color: #334155; }
.oe-clear:hover { border-color: #94a3b8; }

/* Översta raden */
.oe-top { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 16px; margin-bottom: 16px; }
.oe-cmp { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px; font-size: .86rem; color: #475569; }
.oe-delta { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.oe-delta.big { font-size: .95rem; }
.oe-target { margin: 16px 0 18px; }
.oe-target-bar { position: relative; height: 10px; border-radius: 5px; background: #e8edf3; }
.oe-target-bar i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 5px; background: #1e3a5f; }
.oe-target-bar b { position: absolute; top: -5px; bottom: -5px; width: 2px; margin-left: -1px; background: #0f172a; }
.oe-target-txt { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; margin-top: 8px; font-size: .82rem; color: #475569; }
.oe-target-txt .up, .oe-target-txt .down { font-weight: 700; }
.oe-target-txt a { color: #1d4ed8; font-weight: 600; text-decoration: none; }
.oe-apq { display: grid; gap: 10px; border-top: 1px solid var(--cc-border); padding-top: 14px; }
.oe-f { display: grid; grid-template-columns: 7.5rem 4.2rem minmax(0, 1fr) 5.6rem; align-items: center; gap: 10px; font-size: .88rem; }
.oe-f-l { color: #334155; font-weight: 600; }
.oe-f b { font-variant-numeric: tabular-nums; text-align: right; }
.oe-f-bar { height: 6px; border-radius: 3px; background: #e8edf3; overflow: hidden; }
.oe-f-bar i { display: block; height: 100%; background: #64748b; border-radius: 3px; }
.oe-f-d { text-align: right; font-size: .8rem; }
.oe-days { margin-top: 16px; border-top: 1px solid var(--cc-border); padding-top: 12px; }
.oe-days-h { display: flex; justify-content: space-between; font-size: .76rem; color: #64748b; margin-bottom: 6px; }
.oe-days-leg i { display: inline-block; width: 12px; height: 0; border-top: 2px dashed #0f172a; vertical-align: middle; margin-right: 5px; }
.oe-days-plot { position: relative; height: 56px; display: flex; align-items: flex-end; gap: 3px; }
.oe-days-plot em { position: absolute; left: 0; right: 0; border-top: 2px dashed rgba(15,23,42,.55); z-index: 1; pointer-events: none; }
.oe-day { flex: 1; height: 100%; display: flex; align-items: flex-end; }
.oe-day i { display: block; width: 100%; background: #94a3b8; border-radius: 2px 2px 0 0; }
.oe-day:hover i { background: #1e3a5f; }
.oe-days-x { display: flex; justify-content: space-between; font-size: .72rem; color: #94a3b8; margin-top: 4px; }

.oe-loss-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.oe-loss-cmp { text-align: right; font-size: .82rem; max-width: 14rem; }
.oe-loss-cmp b { display: block; font-size: 1.15rem; font-variant-numeric: tabular-nums; }
.oe-loss-cmp span { color: #475569; }
.oe-cost { margin-top: 6px; font-size: .9rem; font-weight: 600; color: #0f172a; }

.oe-wf { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 14px; margin-top: 34px; }
.oe-wf-col { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.oe-wf-plot { position: relative; height: 200px; border-bottom: 1px solid #cbd5e1; }
.oe-wf-plot i { position: absolute; left: 12%; right: 12%; border-radius: 3px 3px 0 0; }
.oe-wf-plot b { position: absolute; left: 0; right: 0; text-align: center; font-size: .86rem; font-weight: 700; font-variant-numeric: tabular-nums; color: #0f172a; white-space: nowrap; }
.oe-wf-col > span { font-size: .78rem; color: #475569; text-align: center; line-height: 1.3; }
.oe-wf-pl { background: #475569; } .oe-wf-av { background: #dc2626; } .oe-wf-pe { background: #f59e0b; } .oe-wf-qu { background: #7c3aed; } .oe-wf-ef { background: #15803d; }

.oe-alert { display: flex; align-items: center; gap: 10px; padding: 10px 14px; margin-bottom: 16px; border-radius: 10px; background: #fffbeb; border: 1px solid #fde68a; color: #78350f; font-size: .86rem; }
.oe-alert a { color: #92400e; font-weight: 700; }

/* Mittenraden */
.oe-mid { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: 16px; margin-bottom: 16px; align-items: start; }
.oe-rank { list-style: none; margin: 0; padding: 0; }
.oe-rank li { display: grid; grid-template-columns: 1.6rem minmax(0, 1fr) 5.2rem 4.8rem auto; gap: 12px; align-items: center; padding: 12px 0; border-top: 1px solid var(--cc-border); }
.oe-rank li:first-child { border-top: 0; padding-top: 2px; }
.oe-rank-n { font-weight: 800; color: #94a3b8; font-variant-numeric: tabular-nums; }
.oe-rank-title { display: flex; align-items: center; gap: 8px; min-width: 0; }
.oe-rank-title i { flex: none; width: 10px; height: 10px; border-radius: 2px; }
.oe-rank-title b { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.oe-rank-meta { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: .78rem; color: #64748b; margin: 2px 0 6px 18px; }
.oe-rank-bar { height: 6px; border-radius: 3px; background: #eef2f6; margin-left: 18px; overflow: hidden; }
.oe-rank-bar i { display: block; height: 100%; border-radius: 3px; }
.oe-rank-val { text-align: right; font-variant-numeric: tabular-nums; }
.oe-rank-val b { display: block; font-size: 1.05rem; }
.oe-rank-val span { font-size: .78rem; color: #64748b; }
.oe-rank-trend { text-align: right; font-size: .82rem; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.oe-rank-act { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.oe-act { display: inline-flex; align-items: center; height: 30px; padding: 0 10px; border-radius: 7px; border: 1px solid #cbd5e1; background: #fff;
  font: inherit; font-size: .78rem; font-weight: 600; color: #1e293b; text-decoration: none; cursor: pointer; white-space: nowrap; }
.oe-act:hover { border-color: #64748b; background: #f8fafc; }

.oe-heat-scroll { overflow-x: auto; margin: 0 -4px; padding: 0 4px; }
.oe-heat-t { width: 100%; border-collapse: separate; border-spacing: 4px; font-size: .84rem; }
.oe-heat-t thead th { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: #64748b; text-align: center; padding: 0 4px 4px; }
.oe-heat-t thead th:first-child, .oe-heat-t tbody th, .oe-heat-t tfoot th { text-align: left; }
.oe-heat-t tbody th, .oe-heat-t tfoot th { font-weight: 500; white-space: nowrap; padding-right: 8px; max-width: 13rem; overflow: hidden; text-overflow: ellipsis; }
.oe-heat-t tbody th a { color: #0f172a; text-decoration: none; } .oe-heat-t tbody th a:hover { text-decoration: underline; }
.oe-heat-t tfoot th { font-weight: 700; }
.oe-heat-t td { padding: 0; min-width: 4.6rem; }
.oe-hc { display: flex; flex-direction: column; align-items: center; justify-content: center; width: 100%; min-height: 50px; border: 2px solid transparent; border-radius: 8px;
  font: inherit; cursor: pointer; font-variant-numeric: tabular-nums; }
.oe-hc b { font-size: .95rem; } .oe-hc small { font-size: .7rem; opacity: .8; }
.oe-hc:hover { border-color: rgba(15,23,42,.35); }
.oe-hc.on { border-color: #0f172a; }
.oe-hc.none { color: #94a3b8; cursor: default; background: #f8fafc; }
.h0 { background: #fecaca; color: #7f1d1d; } .h1 { background: #fed7aa; color: #7c2d12; } .h2 { background: #fef3c7; color: #713f12; }
.h3 { background: #d9f2e3; color: #14532d; } .h4 { background: #a7e3bf; color: #14532d; }
.oe-heat-t tfoot .oe-hc { min-height: 44px; }
.oe-heat-leg { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 12px; font-size: .74rem; color: #64748b; }
.oe-heat-leg i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; vertical-align: -2px; margin-right: 5px; }

/* Detaljflikar */
.oe-detail { padding-top: 8px; }
.oe-tabnote { margin: 0 0 14px; }
.oe-bars { display: grid; gap: 8px; max-width: 980px; }
.oe-bars-row { display: grid; grid-template-columns: minmax(9rem, 15rem) minmax(0, 1fr) 5rem; gap: 12px; align-items: center; font-size: .86rem; }
.oe-bars-row.oe-pareto { grid-template-columns: minmax(9rem, 15rem) minmax(0, 1fr) 5rem 3.6rem 3.4rem; }
.oe-bars-row > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.oe-bars-row b, .oe-bars-row small { text-align: right; font-variant-numeric: tabular-nums; } .oe-bars-row small { color: #64748b; }
.oe-bars-track { height: 10px; border-radius: 3px; background: #eef2f6; overflow: hidden; }
.oe-bars-track i { display: block; height: 100%; border-radius: 3px; }
.oe-facts { display: flex; flex-wrap: wrap; gap: 8px 24px; margin-top: 14px; font-size: .84rem; color: #64748b; }
.oe-facts b { color: #0f172a; margin-left: 4px; font-variant-numeric: tabular-nums; }

/* Mörkt läge */
.app-root.dark-mode .oe-big, .app-root.dark-mode .oe-wf-plot b, .app-root.dark-mode .oe-cost, .app-root.dark-mode .oe-heat-t tbody th a, .app-root.dark-mode .oe-facts b { color: #f1f5f9; }
.app-root.dark-mode .oe-target-bar, .app-root.dark-mode .oe-f-bar, .app-root.dark-mode .oe-rank-bar, .app-root.dark-mode .oe-bars-track { background: rgba(148,163,184,.18); }
.app-root.dark-mode .oe-target-bar i { background: #93c5fd; } .app-root.dark-mode .oe-target-bar b { background: #f1f5f9; }
.app-root.dark-mode .oe-act, .app-root.dark-mode .oe-clear { background: transparent; color: #e2e8f0; border-color: rgba(148,163,184,.35); }

/* Responsivt: surfplatta, mobil, TV */
@media (max-width: 1279px) { .oe-mid { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 1099px) { .oe-top { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 719px) {
  .oe-card { padding: 16px; }
  .oe-wf { gap: 6px; } .oe-wf-plot { height: 150px; } .oe-wf-plot b { font-size: .72rem; } .oe-wf-col > span { font-size: .68rem; }
  .oe-f { grid-template-columns: 6.4rem 3.8rem minmax(0, 1fr); } .oe-f-d { grid-column: 2 / -1; text-align: left; margin-top: -6px; }
  .oe-rank li { grid-template-columns: 1.3rem minmax(0, 1fr) 4.6rem; }
  .oe-rank-trend { grid-column: 2; text-align: left; margin-left: 18px; }
  .oe-rank-act { grid-column: 2 / -1; justify-content: flex-start; margin-left: 18px; }
  .oe-loss-cmp { text-align: left; }
  .oe-bars-row, .oe-bars-row.oe-pareto { grid-template-columns: minmax(0, 1fr) 4.4rem; } .oe-bars-track, .oe-bars-row small { display: none; }
}
@media (min-width: 1800px) { .oe-card { padding: 24px 28px; } .oe-wf-plot { height: 240px; } .oe-rank li { padding: 14px 0; } .oe-f, .oe-bars-row { font-size: .95rem; } }
