:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #edf1f4;
  color: #122033;
  --navy: #101b2d;
  --teal: #0c9b89;
  --teal-dark: #087467;
  --line: #d9e0e7;
  --muted: #68788b;
  --orange: #f3a712;
  --red: #dc3e4e;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-width: 320px; }
button, input { font: inherit; }

.topbar {
  position: sticky;
  z-index: 20;
  top: 0;
  display: grid;
  grid-template-columns: minmax(240px, 1fr) auto minmax(240px, 1fr);
  align-items: center;
  min-height: 72px;
  padding: 0 clamp(18px, 4vw, 64px);
  background: rgba(16, 27, 45, .97);
  color: white;
  box-shadow: 0 8px 25px rgba(14, 25, 40, .18);
}

.brand { display: flex; gap: 12px; align-items: center; color: inherit; text-decoration: none; }
.brand-mark { display: grid; width: 40px; height: 40px; place-items: center; border-radius: 10px; background: var(--teal); font-weight: 900; letter-spacing: -.04em; }
.brand strong, .brand small { display: block; }
.brand strong { font-size: 15px; }
.brand small { margin-top: 2px; color: #9eadbc; font-size: 11px; }
nav { display: flex; align-self: stretch; gap: 6px; }
.nav-link { display: grid; position: relative; place-items: center; padding: 0 16px; color: #c4ced9; font-size: 13px; font-weight: 750; text-decoration: none; }
.nav-link.active, .nav-link:hover { color: white; }
.nav-link.active::after { position: absolute; right: 12px; bottom: 0; left: 12px; height: 3px; border-radius: 3px 3px 0 0; background: #3dd6bd; content: ""; }
.nav-link.muted { opacity: .45; cursor: default; }
.live-indicator { display: grid; grid-template-columns: auto auto; justify-self: end; column-gap: 8px; align-items: center; }
.live-indicator > span { width: 9px; height: 9px; border-radius: 50%; background: #39d98a; box-shadow: 0 0 0 5px rgba(57,217,138,.13); }
.live-indicator b { font-size: 12px; }
.live-indicator small { grid-column: 2; color: #8797a8; font-size: 10px; }

main { width: min(1540px, calc(100% - 40px)); margin: 0 auto 70px; }
.section-heading, .analytics-heading { display: flex; justify-content: space-between; align-items: end; gap: 20px; padding: 36px 0 18px; }
.section-heading h1, .analytics-heading h2 { margin: 0; font-size: clamp(30px, 4vw, 48px); letter-spacing: -.035em; }
.section-heading p:not(.eyebrow) { margin: 8px 0 0; color: var(--muted); }
.eyebrow { margin: 0 0 5px; color: var(--teal-dark); font-size: 11px; font-weight: 850; letter-spacing: .15em; text-transform: uppercase; }
.button { min-height: 42px; padding: 0 18px; border: 0; border-radius: 9px; background: var(--teal); color: white; cursor: pointer; font-size: 13px; font-weight: 800; }
.button:hover { background: var(--teal-dark); }
.button.secondary { border: 1px solid #c8d1da; background: white; color: #25384d; }
.button:disabled { opacity: .55; cursor: progress; }

.notice { margin-bottom: 14px; padding: 12px 16px; border: 1px solid #d7e0e8; border-radius: 9px; background: #e7edf2; color: #526477; font-size: 13px; }
.notice.ok { border-color: #b8e4d8; background: #e5f6f1; color: #146c5e; }
.notice.error { border-color: #f0c4c9; background: #fff0f1; color: #9e2f3b; }

.fleet { display: grid; gap: 18px; }
.machine-card { overflow: hidden; border: 1px solid #d6dee6; border-top: 4px solid #8090a0; border-radius: 16px; background: white; box-shadow: 0 12px 35px rgba(23, 40, 61, .08); }
.machine-card.status-printing { border-top-color: var(--teal); }
.machine-card.status-waiting { border-top-color: var(--orange); }
.machine-card.status-error { border-top-color: var(--red); }
.machine-card.status-offline { border-top-color: #536170; }
.machine-card-head { display: flex; justify-content: space-between; align-items: center; padding: 20px 24px 8px; }
.machine-card-head h2 { margin: 3px 0 0; font-size: 25px; }
.area-label { color: var(--muted); font-size: 11px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.state-wrap { display: grid; justify-items: end; gap: 5px; }
.state-wrap small { color: var(--muted); font-size: 11px; }
.state-pill { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 999px; background: #edf1f4; font-size: 12px; font-weight: 850; }
.state-pill i { width: 9px; height: 9px; border-radius: 50%; background: #778697; }
.status-printing .state-pill { background: #ddf5ef; color: #0a7164; }
.status-printing .state-pill i { background: var(--teal); box-shadow: 0 0 0 4px rgba(12,155,137,.13); }
.status-waiting .state-pill { background: #fff1cf; color: #855b00; }
.status-waiting .state-pill i { background: var(--orange); }
.status-error .state-pill { background: #fde4e7; color: #9d2936; }
.status-error .state-pill i { background: var(--red); }
.status-offline .state-pill { background: #e4e7ea; color: #45525f; }

.machine-layout { display: grid; grid-template-columns: minmax(260px, .9fr) minmax(360px, 1.3fr) minmax(210px, .65fr); min-height: 260px; padding: 8px 24px 20px; }
.machine-figure { display: grid; align-content: center; justify-items: center; min-width: 0; border-right: 1px solid var(--line); }
.printer-svg { width: min(100%, 320px); height: auto; filter: drop-shadow(0 9px 8px rgba(18,32,51,.08)); }
.machine-light { fill: #7c8a98; }
.machine-light.printing { fill: #26d2b5; filter: drop-shadow(0 0 5px #26d2b5); }
.machine-light.waiting { fill: #f3a712; }
.machine-light.error { fill: #ef4d5d; filter: drop-shadow(0 0 5px #ef4d5d); }
.machine-figure p { margin: 2px 10px 0; color: var(--muted); font-size: 12px; text-align: center; }
.output-block { display: grid; align-content: center; padding: 10px clamp(24px, 4vw, 56px); }
.metric-label { color: var(--muted); font-size: 12px; font-weight: 750; }
.hero-number { display: flex; gap: 9px; align-items: baseline; margin: 2px 0 19px; }
.hero-number strong { font-size: clamp(46px, 5.5vw, 78px); line-height: .98; letter-spacing: -.055em; }
.hero-number span { color: var(--teal-dark); font-size: 19px; font-weight: 850; }
.progress-caption { display: flex; justify-content: space-between; gap: 16px; color: var(--muted); font-size: 11px; }
.progress-caption b { color: #26394e; }
.progress-track { height: 10px; margin: 8px 0 10px; overflow: hidden; border-radius: 999px; background: #e8edf1; }
.progress-track i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #0d9987, #3ad5bd); }
.benchmark-row { display: flex; justify-content: space-between; gap: 12px; color: var(--muted); font-size: 10px; }
.benchmark-row b { display: block; margin-top: 2px; color: #2b3c50; font-size: 12px; }
.load-block { display: grid; align-content: center; justify-items: center; border-left: 1px solid var(--line); }
.load-ring { display: grid; width: 152px; height: 152px; place-items: center; border-radius: 50%; background: conic-gradient(var(--teal) var(--load), #e7ecf0 0); }
.load-ring::before { grid-area: 1/1; width: 118px; height: 118px; border-radius: 50%; background: white; content: ""; }
.load-ring > div { z-index: 1; grid-area: 1/1; text-align: center; }
.load-ring strong, .load-ring span { display: block; }
.load-ring strong { font-size: 31px; letter-spacing: -.04em; }
.load-ring span { color: var(--muted); font-size: 11px; }
.load-block p { margin: 12px 0 0; color: #3e5064; font-size: 12px; line-height: 1.5; text-align: center; }
.load-block p span { color: var(--muted); }

.machine-details { display: grid; grid-template-columns: 1fr 1.25fr 1.25fr; border-top: 1px solid var(--line); }
.machine-details > div { padding: 16px 22px; }
.machine-details > div + div { border-left: 1px solid var(--line); }
.quick-metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.quick-metrics span, .current-job > span, .ink-panel > span { display: block; color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; }
.quick-metrics b { display: block; margin-top: 4px; font-size: 16px; }
.current-job { display: grid; gap: 3px; }
.current-job b { overflow: hidden; margin-top: 2px; text-overflow: ellipsis; white-space: nowrap; }
.current-job small { color: var(--muted); }
.current-job.active { box-shadow: inset 3px 0 var(--teal); }
.ink-panel > div { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 8px; }
.ink-cell { display: grid; grid-template-columns: auto auto; justify-content: start; align-items: center; column-gap: 5px; }
.ink-cell b { grid-column: 1/-1; margin-top: 2px; font-size: 11px; }
.ink-dot { width: 8px; height: 8px; border-radius: 50%; }
.ink-dot.cyan { background: #00aeca; }.ink-dot.magenta { background: #d62d78; }.ink-dot.yellow { background: #f0c800; }.ink-dot.black { background: #17212d; }
.event-line { display: grid; grid-template-columns: auto 1fr auto auto; align-items: center; gap: 12px; min-height: 52px; padding: 9px 22px; border-top: 1px solid var(--line); background: #f7f9fa; }
.event-line > span { color: var(--muted); font-size: 10px; font-weight: 800; text-transform: uppercase; }
.event-line b { overflow: hidden; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.event-line time { color: var(--muted); font-size: 11px; }
.event-line button { padding: 7px 10px; border: 1px solid #ccd4dc; border-radius: 7px; background: white; color: #526274; font-size: 11px; font-weight: 750; }
.event-line.event-error { background: #fff5f5; }
.event-line.event-error > span { color: #b23744; }

.analytics-heading { margin-top: 28px; padding-top: 48px; border-top: 1px solid #cfd8e0; }
.analytics-heading h2 { font-size: 32px; }
.period { display: flex; gap: 10px; align-items: end; flex-wrap: wrap; }
label { display: grid; gap: 5px; color: var(--muted); font-size: 11px; font-weight: 750; }
input { min-height: 42px; padding: 8px 11px; border: 1px solid #c7d1da; border-radius: 9px; background: white; color: #1d3045; }
.summary-cards { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.summary-cards article { padding: 17px; border: 1px solid var(--line); border-radius: 11px; background: white; }
.summary-cards span { display: block; min-height: 30px; color: var(--muted); font-size: 11px; font-weight: 750; }
.summary-cards strong { display: block; margin-top: 6px; font-size: clamp(20px, 2.4vw, 31px); letter-spacing: -.03em; }
.panel { margin-top: 18px; overflow: hidden; border: 1px solid var(--line); border-radius: 12px; background: white; }
.panel-title { display: flex; justify-content: space-between; padding: 17px 20px; border-bottom: 1px solid var(--line); }
.panel-title h2 { margin: 0; font-size: 18px; }
.panel-title span { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; }
.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; font-size: 12px; }
th { position: sticky; top: 72px; padding: 11px 12px; background: #e8f4f2; color: #15675d; text-align: left; white-space: nowrap; }
td { max-width: 420px; padding: 10px 12px; overflow: hidden; border-top: 1px solid #edf0f3; text-overflow: ellipsis; white-space: nowrap; }
tbody tr:hover { background: #f7fafb; }

@media (max-width: 1120px) {
  .topbar { grid-template-columns: 1fr auto; }
  .topbar nav { display: none; }
  .machine-layout { grid-template-columns: .9fr 1.1fr; }
  .load-block { grid-column: 1/-1; grid-template-columns: auto 1fr; gap: 20px; justify-content: center; padding: 20px; border-top: 1px solid var(--line); border-left: 0; }
  .load-ring { width: 116px; height: 116px; }
  .load-ring::before { width: 88px; height: 88px; }
  .machine-details { grid-template-columns: 1fr 1fr; }
  .ink-panel { grid-column: 1/-1; border-top: 1px solid var(--line); border-left: 0 !important; }
}

@media (max-width: 760px) {
  main { width: min(100% - 20px, 1540px); }
  .topbar { min-height: 64px; padding: 0 14px; }
  .brand small, .live-indicator b { display: none; }
  .section-heading, .analytics-heading { align-items: start; flex-direction: column; }
  .machine-card-head { padding: 16px 16px 4px; }
  .machine-layout { grid-template-columns: 1fr; padding: 4px 16px 16px; }
  .machine-figure { border-right: 0; border-bottom: 1px solid var(--line); }
  .printer-svg { max-width: 270px; }
  .output-block { padding: 24px 8px; }
  .load-block { grid-template-columns: 1fr; }
  .machine-details { grid-template-columns: 1fr; }
  .machine-details > div + div, .ink-panel { border-top: 1px solid var(--line); border-left: 0; }
  .event-line { grid-template-columns: 1fr auto; }
  .event-line > span, .event-line b { grid-column: 1/-1; }
  .event-line button { display: none; }
  .summary-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 440px) {
  .summary-cards { grid-template-columns: 1fr; }
  .quick-metrics { grid-template-columns: 1fr 1fr; }
  .ink-panel > div { grid-template-columns: repeat(2, 1fr); }
  .benchmark-row { flex-wrap: wrap; }
}
