:root {
  --bg: #f5f7f9;
  --ink: #172a35;
  --muted: #65757f;
  --line: #e3e9ec;
  --teal: #087f73;
  --nav: #112e35;
  --amber: #a35b0a;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system,
    BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--bg);
  font-synthesis: none;
}

* { box-sizing: border-box; }
body { margin: 0; }
button, input, select { font: inherit; }
button, a, select { touch-action: manipulation; }
a { color: inherit; }

button {
  cursor: pointer;
  background: var(--teal);
  color: white;
  border: 0;
  border-radius: 8px;
  padding: 12px 18px;
  font-weight: 650;
  display: inline-flex;
  gap: 22px;
  align-items: center;
  justify-content: center;
}

button:disabled { opacity: .55; cursor: wait; }

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 3px solid #28b5a4;
  outline-offset: 3px;
}

input, select {
  border: 1px solid #cdd7dc;
  border-radius: 7px;
  padding: 11px 12px;
  background: white;
  color: var(--ink);
  max-width: 100%;
}

label {
  display: block;
  font-size: 12px;
  font-weight: 650;
  margin-bottom: 7px;
}

.muted {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.65;
}

.eyebrow {
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 2px;
  color: var(--teal);
  margin: 0 0 10px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 19px;
  font-weight: 750;
  text-decoration: none;
  letter-spacing: -.6px;
}

.brand-light { font-weight: 400; }

.brand-symbol {
  display: grid;
  place-items: center;
  width: 32px;
  height: 34px;
  border-radius: 8px;
  background: #18a592;
  color: white;
  font-size: 21px;
  font-weight: 800;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 235px;
  background: var(--nav);
  color: #ecf5f4;
  padding: 32px 22px;
  display: flex;
  flex-direction: column;
}

.workspace {
  font-size: 11px;
  letter-spacing: 2px;
  color: #a4b9bd;
  margin: 48px 12px 22px;
}

.workspace span {
  font-size: 9px;
  border: 1px solid #3b555a;
  border-radius: 4px;
  padding: 3px 5px;
  margin-left: 8px;
  letter-spacing: 1px;
}

nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 12px;
  border-radius: 7px;
  text-decoration: none;
  font-size: 12px;
}

.nav-active { background: #24484d; color: #b8f1e7; }

.sidebar-bottom {
  margin-top: auto;
  font-size: 12px;
  color: #c6d9dc;
  padding: 16px 12px;
}

.sidebar-bottom p {
  font-size: 10px;
  color: #8eaaaf;
  margin-top: 7px;
}

.main-shell { margin-left: 235px; }

.topbar {
  height: 70px;
  background: white;
  border-bottom: 1px solid var(--line);
  padding: 0 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--muted);
}

.topbar > div {
  display: flex;
  align-items: center;
  gap: 20px;
}

.separator { padding: 0 14px; color: #b5c0c5; }

.text-button {
  padding: 5px 0;
  background: none;
  color: var(--muted);
  font-size: 12px;
}

.dashboard {
  padding: 36px 40px 24px;
  max-width: 1600px;
  margin: auto;
}

.page-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 27px;
  gap: 20px;
}

h1 {
  font-size: 29px;
  letter-spacing: -1px;
  margin: 0;
  font-weight: 680;
}

.page-heading .muted { margin: 9px 0 0; }

.private-badge {
  white-space: nowrap;
  background: #e7f1ed;
  color: #437565;
  padding: 8px 11px;
  border-radius: 20px;
  font-size: 10px;
  font-weight: 650;
}

.filterbar {
  display: flex;
  align-items: end;
  gap: 14px;
  background: white;
  border: 1px solid var(--line);
  padding: 16px 18px;
  border-radius: 10px;
  margin-bottom: 22px;
}

.filterbar select { font-size: 12px; min-width: 190px; }
.filterbar button { font-size: 12px; padding: 12px 16px; }

.range {
  font-size: 10px;
  color: var(--muted);
  margin: 0 0 4px auto;
  max-width: 240px;
  line-height: 1.6;
  text-align: right;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.metric {
  background: white;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 23px 22px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.metric > span {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}

.metric strong {
  font-size: 33px;
  letter-spacing: -1.4px;
  font-weight: 650;
}

.metric small { font-size: 10px; color: var(--muted); }
.metric.primary { background: #e9f4f0; border-color: #c9e4db; }
.metric.primary strong, .metric.primary > span { color: #126955; }

.quality-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-bottom: 1px solid var(--line);
  padding: 24px 0 20px;
}

.quality-strip > div {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 18px;
  border-right: 1px solid var(--line);
}

.quality-strip > div:first-child { padding-left: 0; }
.quality-strip > div:last-child { border: 0; }
.quality-strip strong { font-size: 20px; font-weight: 650; }

.quality-strip span {
  font-size: 10px;
  color: var(--muted);
  line-height: 1.5;
  max-width: 110px;
}

.coverage-note {
  font-size: 11px;
  line-height: 1.6;
  color: var(--muted);
  margin: 12px 0 22px;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: white;
  margin: 0 0 20px;
  overflow: hidden;
}

.panel-heading {
  padding: 22px 24px 17px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

h2 { font-size: 14px; font-weight: 650; margin: 0; }

.panel-heading p {
  font-size: 11px;
  color: var(--muted);
  margin: 6px 0 0;
}

.legend {
  font-size: 10px;
  color: var(--muted);
  display: flex;
  gap: 7px;
  align-items: center;
}

.legend i {
  width: 7px;
  height: 7px;
  background: var(--teal);
  border-radius: 50%;
}

.trend { padding: 4px 20px 18px; overflow-x: auto; }

.trend svg {
  width: 100%;
  min-width: 450px;
  height: 210px;
  display: block;
}

.trend text { fill: #71818b; font-size: 10px; }
.trend .grid { stroke: #e9eef0; stroke-dasharray: 3 4; }

.trend .trend-line {
  stroke: var(--teal);
  fill: none;
  stroke-width: 2.5;
}

.trend .trend-point {
  fill: white;
  stroke: var(--teal);
  stroke-width: 2;
}

.trend .trend-area { fill: #e8f4f0; }
.trend details { margin-top: 12px; font-size: 11px; }
.trend summary { cursor: pointer; color: var(--teal); }

.table-wrap { overflow: auto; }

table {
  border-collapse: collapse;
  width: 100%;
  font-size: 11px;
  white-space: nowrap;
}

thead { background: #f8fafb; color: var(--muted); }

th, td {
  padding: 15px 14px;
  text-align: right;
  border-bottom: 1px solid #edf1f3;
}

th { font-size: 10px; font-weight: 600; }
th:first-child, td:first-child { text-align: left; padding-left: 24px; }
tbody tr:last-child td { border-bottom: 0; }

.account-button {
  background: none;
  color: var(--ink);
  padding: 0;
  font-size: 11px;
  font-weight: 650;
  text-align: left;
}

.oee-cell { font-weight: 750; color: #126955; }
.warning { color: var(--amber); font-weight: 650; }

.pill {
  background: #f0f4f5;
  border: 1px solid var(--line);
  font-size: 10px;
  padding: 5px 9px;
  border-radius: 20px;
}

.dashboard-footer {
  font-size: 10px;
  color: var(--muted);
  line-height: 1.7;
}

.dashboard-footer p { margin: 4px 0; }

.error {
  color: #a82e35;
  font-size: 12px;
  line-height: 1.6;
}

.banner {
  background: #fff1f0;
  padding: 13px 16px;
  border: 1px solid #f0cdcb;
  border-radius: 8px;
}

.empty {
  text-align: center;
  padding: 36px;
  color: var(--muted);
  font-size: 13px;
}

[hidden] { display: none !important; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px;
  background:
    radial-gradient(
      ellipse at 20% 10%,
      #e1eee8 0,
      transparent 55%
    ),
    #f5f7f9;
}

.login-card {
  background: white;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 42px;
  width: 440px;
  max-width: 100%;
  box-shadow: 0 15px 65px #173a3010;
}

.login-card .brand { margin-bottom: 42px; }
.login-card h1 { font-size: 34px; line-height: 1.17; }
.login-card form { margin-top: 26px; }
.login-card input { width: 100%; margin-bottom: 17px; }
.login-card button { width: 100%; justify-content: space-between; }
.login-card .error:empty { display: none; }

.login-foot {
  font-size: 10px;
  color: var(--muted);
  margin: 28px 0 0;
}

@media (min-width: 1500px) {
  .metric strong { font-size: 40px; }
  .dashboard { padding-top: 44px; }
  .trend svg { height: 240px; }
}

@media (max-width: 1150px) {
  .sidebar { width: 195px; padding: 28px 14px; }
  .brand { font-size: 17px; }
  .main-shell { margin-left: 195px; }
  .dashboard { padding: 28px 24px; }
  .topbar { padding: 0 24px; }
  .filterbar { flex-wrap: wrap; }

  .range {
    max-width: none;
    flex-basis: 100%;
    text-align: left;
    margin: 0;
  }

  .metrics { gap: 10px; }
  .metric { padding: 19px 15px; }
  .metric strong { font-size: 29px; }
  .quality-strip > div { padding: 0 10px; }
  .quality-strip span { font-size: 9px; }
}

@media (max-width: 760px) {
  .sidebar {
    position: static;
    width: 100%;
    padding: 16px 20px;
    display: block;
  }

  .sidebar .brand { font-size: 18px; }
  .workspace, nav, .sidebar-bottom { display: none; }
  .main-shell { margin-left: 0; }
  .topbar { height: 50px; padding: 0 20px; }
  .dashboard { padding: 25px 16px; }
  .page-heading { align-items: start; }
  .private-badge { display: none; }
  h1 { font-size: 25px; }

  .metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .filterbar { gap: 12px; padding: 14px; }
  .filterbar > div { flex: 1 1 160px; }
  .filterbar select { width: 100%; min-width: 0; }

  .quality-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
  }

  .quality-strip > div { padding: 0; border: 0; }
  .quality-strip span { font-size: 10px; }
  .panel-heading { padding: 18px; }
  .legend { display: none; }
  .login-card { padding: 30px; }
  .metric small { line-height: 1.5; }
}
