/* rollDetect Insights — light theme styled after Bühler Insights */
:root {
  --teal: #0794a5;
  --teal-dark: #0a7583;
  --navy: #14263c;
  --navy-2: #1d3450;
  --bg: #f2f4f6;
  --surface: #ffffff;
  --border: #e3e7ea;
  --ink: #22313f;
  --ink-2: #5a6a78;
  --ink-3: #8a97a3;
  --ok: #1e8e5a;
  --watch: #d97b1f;
  --critical: #c43d3d;
  --ok-bg: #e7f4ee;
  --watch-bg: #faf0e2;
  --critical-bg: #f9e9e9;
  --series-1: #0794a5;
  --series-2: #5b5fc7;
  --series-3: #d97b1f;
  --series-4: #b5487e;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font: 14px/1.45 "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  background: var(--bg); color: var(--ink);
}
.shell { display: flex; min-height: 100vh; }

/* ---------- sidebar ---------- */
.sidebar {
  width: 200px; flex: 0 0 200px; background: var(--navy); color: #cfd8e1;
  display: flex; flex-direction: column; position: sticky; top: 0;
  height: 100vh;
}
.brand { display: flex; align-items: center; gap: 9px; padding: 18px 16px 22px; color: #fff; }
.brand-mark { width: 22px; height: 22px; border-radius: 6px; background: var(--teal)
  url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Cpath d='M8 64 L23 36 L38 64 L53 36 L68 64 L83 36 L93 55' stroke='white' stroke-width='9' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E")
  center/contain no-repeat; }
.brand-text { font-size: 14px; letter-spacing: .2px; }
.brand-text b { font-weight: 600; }
.sidebar a {
  display: flex; align-items: center; gap: 12px; padding: 11px 16px;
  color: #cfd8e1; text-decoration: none; font-size: 13.5px;
  border-left: 3px solid transparent;
}
.sidebar a svg { width: 18px; height: 18px; fill: currentColor; flex: 0 0 18px; }
.sidebar a:hover { background: var(--navy-2); color: #fff; }
.sidebar a.active { background: var(--navy-2); color: #fff; border-left-color: var(--teal); }
.sidebar-foot { margin-top: auto; padding: 14px 16px; font-size: 11.5px; color: #7d8fa3; }

/* ---------- topbar ---------- */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 52px; background: var(--surface); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 20px; position: sticky; top: 0; z-index: 10;
}
.topbar-title { font-size: 16px; font-weight: 600; }
.topbar-right { display: flex; align-items: center; gap: 14px; color: var(--ink-2); font-size: 12.5px; }
.avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--teal);
  display: inline-block; }

.content { padding: 18px 20px 40px; max-width: 1500px; width: 100%; margin: 0 auto; }

/* ---------- cards & layout ---------- */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
  padding: 16px 18px; margin-bottom: 16px;
}
.card h2 { font-size: 14.5px; font-weight: 600; margin-bottom: 4px; }
.card .sub { color: var(--ink-2); font-size: 12px; margin-bottom: 10px; }
.grid { display: grid; gap: 14px; }
.grid.kpis { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); margin-bottom: 16px; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 1000px) { .two-col { grid-template-columns: 1fr; } }

/* KPI stat tiles */
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
  padding: 13px 16px; }
.kpi .kpi-label { font-size: 11.5px; color: var(--ink-2); text-transform: uppercase;
  letter-spacing: .4px; }
.kpi .kpi-value { font-size: 26px; font-weight: 600; margin-top: 2px; }
.kpi .kpi-hint { font-size: 11.5px; color: var(--ink-3); }
.kpi.k-crit .kpi-value { color: var(--critical); }
.kpi.k-watch .kpi-value { color: var(--watch); }
.kpi.k-ok .kpi-value { color: var(--ok); }

/* status chips — always icon + label, never color alone */
.chip { display: inline-flex; align-items: center; gap: 5px; border-radius: 20px;
  font-size: 11px; font-weight: 600; padding: 2px 9px; letter-spacing: .3px; }
.chip::before { content: ""; width: 7px; height: 7px; border-radius: 50%; }
.chip.OK { background: var(--ok-bg); color: var(--ok); }
.chip.OK::before { background: var(--ok); }
.chip.WATCH { background: var(--watch-bg); color: var(--watch); }
.chip.WATCH::before { background: var(--watch); border-radius: 1px; }
.chip.CRITICAL { background: var(--critical-bg); color: var(--critical); }
.chip.CRITICAL::before { background: var(--critical); clip-path: polygon(50% 0, 100% 100%, 0 100%); border-radius: 0; }

.kpi.linked { display: block; text-decoration: none; color: inherit; cursor: pointer; }
.kpi.linked:hover { box-shadow: 0 2px 10px rgba(20, 38, 60, .12); }
.kpi { position: relative; }
.info-btn { position: absolute; top: 8px; right: 8px; width: 17px; height: 17px;
  border-radius: 50%; border: 1px solid var(--border); background: #fff;
  color: var(--ink-3); font-size: 11px; line-height: 15px; text-align: center;
  cursor: pointer; padding: 0; font-family: Georgia, serif; font-style: italic; }
.info-btn:hover { color: var(--teal-dark); border-color: var(--teal); }
.info-pop { position: absolute; top: 28px; right: 4px; z-index: 30; width: 250px;
  background: var(--navy); color: #e7edf3; border-radius: 8px; padding: 10px 12px;
  font-size: 12px; line-height: 1.5; box-shadow: 0 6px 20px rgba(20,38,60,.35);
  text-transform: none; letter-spacing: 0; font-weight: 400; }

/* attention strip */
.attention-strip { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 10px; margin-bottom: 16px; }
.attn-card { background: var(--surface); border: 1px solid var(--border);
  border-left: 3px solid var(--watch); border-radius: 8px; padding: 10px 12px;
  text-decoration: none; color: var(--ink); display: block; }
.attn-card:hover { box-shadow: 0 2px 10px rgba(20, 38, 60, .12); }
.attn-card:has(.chip.CRITICAL) { border-left-color: var(--critical); }
.attn-line { font-size: 12px; color: var(--ink-2); margin-top: 4px; }
.attn-cost { color: var(--critical); font-weight: 600; }

/* misc units — keep µ out of uppercase transforms */
table.data th .unit { text-transform: none; }
.swap-list { list-style: none; font-size: 12.5px; color: var(--ink-2); }
.swap-list li { padding: 3px 0; border-bottom: 1px solid #eef1f3; }

/* planner: table on desktop, cards on mobile */
.planner-cards { display: none; }
@media (max-width: 760px) {
  .planner-table { display: none; }
  .planner-cards { display: grid; gap: 10px; }
  .plan-card { background: var(--surface); border: 1px solid var(--border);
    border-radius: 8px; padding: 10px 12px; text-decoration: none; color: var(--ink); display: block; }
}

/* fleet grid */
.section-title { font-size: 13px; font-weight: 600; color: var(--ink-2);
  margin: 18px 0 8px; text-transform: uppercase; letter-spacing: .5px; }
.fleet { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 10px; }
.pair-card { background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
  padding: 10px 12px; cursor: pointer; text-decoration: none; color: var(--ink);
  transition: box-shadow .12s; display: block; }
.pair-card:hover { box-shadow: 0 2px 10px rgba(20, 38, 60, .12); }
.pair-card .pc-top { display: flex; justify-content: space-between; align-items: center; }
.pair-card .pc-label { font-weight: 600; font-size: 13px; }
.pair-card .pc-loc { color: var(--ink-3); font-size: 11px; margin-top: 1px; }
.wearbar { height: 6px; background: #edf0f2; border-radius: 3px; margin: 8px 0 5px; overflow: hidden; }
.wearbar i { display: block; height: 100%; border-radius: 3px; }
.pair-card .pc-foot { display: flex; justify-content: space-between; font-size: 11px; color: var(--ink-2); }

/* charts */
.chart { width: 100%; height: 300px; }
.chart.tall { height: 340px; }
.chart.short { height: 220px; }

/* tables */
table.data { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data th { text-align: left; color: var(--ink-2); font-weight: 600; font-size: 11.5px;
  text-transform: uppercase; letter-spacing: .4px; padding: 8px 10px;
  border-bottom: 1px solid var(--border); white-space: nowrap; }
table.data td { padding: 9px 10px; border-bottom: 1px solid #eef1f3; white-space: nowrap; }
table.data tr:hover td { background: #f7fafb; }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table-wrap { overflow-x: auto; }
a.rowlink { color: var(--teal-dark); font-weight: 600; text-decoration: none; }
a.rowlink:hover { text-decoration: underline; }

/* detail header */
.detail-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin-bottom: 14px; }
.detail-head h1 { font-size: 20px; font-weight: 600; }
.spec-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.spec-chip { background: #eef4f6; color: var(--ink-2); border-radius: 4px;
  padding: 3px 8px; font-size: 11.5px; }
.back { color: var(--teal-dark); text-decoration: none; font-size: 13px; }

/* forms */
form.panel { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); align-items: end; }
form.panel label { display: block; font-size: 11.5px; color: var(--ink-2); margin-bottom: 3px; }
form.panel input, form.panel select, form.panel textarea {
  width: 100%; padding: 7px 9px; border: 1px solid var(--border); border-radius: 6px;
  font: inherit; color: var(--ink); background: #fff; }
form.panel .full { grid-column: 1 / -1; }
.btn { background: var(--teal); color: #fff; border: 0; border-radius: 6px;
  padding: 9px 18px; font: inherit; font-weight: 600; cursor: pointer; }
.btn:hover { background: var(--teal-dark); }
.btn.secondary { background: #eef1f3; color: var(--ink); }
.form-msg { font-size: 12.5px; margin-top: 6px; }
.form-msg.ok { color: var(--ok); }
.form-msg.err { color: var(--critical); }

/* misc */
.muted { color: var(--ink-3); }
.mono { font-variant-numeric: tabular-nums; }
.legend-row { display: flex; flex-wrap: wrap; gap: 14px; font-size: 12px; color: var(--ink-2); margin-bottom: 6px; }
.legend-row .sw { display: inline-block; width: 14px; height: 3px; border-radius: 2px; vertical-align: middle; margin-right: 5px; }

/* ---------- mobile ---------- */
@media (max-width: 760px) {
  .shell { flex-direction: column; }
  .sidebar { width: 100%; flex: none; height: auto; position: sticky; top: 0; z-index: 20;
    flex-direction: row; align-items: center; overflow-x: auto; }
  .brand { padding: 10px 12px; }
  .brand-text { display: none; }
  .sidebar a { padding: 12px 10px; border-left: 0; border-bottom: 3px solid transparent; }
  .sidebar a.active { border-left: 0; border-bottom-color: var(--teal); }
  .sidebar a span { display: none; }
  .sidebar-foot { display: none; }
  .content { padding: 12px 10px 30px; }
  .topbar { padding: 0 12px; }
  .tz { display: none; }
  .grid.kpis { grid-template-columns: repeat(2, 1fr); }
  .kpi .kpi-value { font-size: 21px; }
  .fleet { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
  .chart { height: 240px; }
}
