/* Line Monitor: app-specific styles on top of base.css. */
:root { --series-A: #1463d6; --series-B: #eb6834; }
@media (prefers-color-scheme: dark) { :root { --series-A: #3987e5; --series-B: #d95926; } }

/* live indicator */
.live { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); white-space: nowrap; }
.live .pulse { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); }
.live[data-connected="true"] .pulse { background: var(--ok); animation: pulse 2s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--ok) 45%, transparent); } 100% { box-shadow: 0 0 0 8px transparent; } }

/* KPIs and lines */
.shift { margin: 0 0 8px; }
.kpi .value { font-variant-numeric: tabular-nums; }
.kpi .delta abbr { text-decoration: none; }
.line { margin-top: 28px; }
.line-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px 16px; flex-wrap: wrap; margin-bottom: 10px; }
.line-head h2, .chart-head h2 { margin: 0; }
.oee { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.grid.machines { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }

/* machine cards */
.machine { display: block; color: inherit; text-decoration: none; border-left: 3px solid var(--border); transition: border-color 0.4s; }
.machine:hover { box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 35%, transparent); }
.machine[data-state="running"] { border-left-color: var(--ok); }
.machine[data-state="changeover"] { border-left-color: var(--info); }
.machine[data-state="down"] { border-left-color: var(--bad); }
.machine-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.machine-name { font-weight: 600; margin-top: 6px; }
.job { margin-top: 2px; }
.units { display: flex; align-items: baseline; gap: 5px; margin: 10px 0 6px; font-size: 20px; font-variant-numeric: tabular-nums; }
.units .pct { margin-left: auto; }
.facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 12px 0 0; }
.facts dt { color: var(--muted); font-size: 12px; }
.facts dd { margin: 0; font-size: 13px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.reason { margin-top: 8px; color: var(--muted); }
.machine[data-state="down"] .reason { color: var(--bad); font-weight: 600; }

/* chart and alerts */
.grid.bottom { grid-template-columns: 3fr 2fr; align-items: start; margin-top: 28px; }
.grid.detail { grid-template-columns: minmax(230px, 1fr) 2fr; align-items: start; }
.grid.bottom .card h2, .grid.detail .card h2 { margin-top: 0; }
.chart-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px 16px; flex-wrap: wrap; margin-bottom: 10px; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.legend i, .chart-tip i { display: inline-block; width: 14px; height: 3px; border-radius: 2px; vertical-align: middle; margin-right: 6px; }
.chart-box { position: relative; }
svg.chart { display: block; width: 100%; height: auto; font-size: 11px; }
svg.chart .grid line { stroke: var(--border); stroke-width: 1; }
svg.chart text { fill: var(--muted); }
svg.chart .series { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
svg.chart circle { stroke: var(--surface); stroke-width: 2; }
.chart-cursor { position: absolute; top: 0; bottom: 0; border-left: 1px solid var(--muted); pointer-events: none; }
.chart-tip { position: absolute; top: 8px; padding: 6px 10px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; box-shadow: var(--shadow); font-size: 12px; white-space: nowrap; pointer-events: none; z-index: 2; }
.alerts { list-style: none; padding: 0; margin: 0; max-height: 480px; overflow-y: auto; }
.alerts li { display: flex; gap: 8px; align-items: baseline; padding: 7px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.alerts li:last-child { border-bottom: 0; }
.alerts .when { color: var(--muted); font-size: 12px; white-space: nowrap; }
.alerts .msg a { font-weight: 600; text-decoration: none; }

@media (max-width: 800px) {
  .grid.bottom, .grid.detail { grid-template-columns: 1fr; }
  .page-title { align-items: flex-start; }
  svg.chart { font-size: 16px; } /* the SVG scales down with the viewport, its text should not */
}
