:root {
  --ink: #10232a;
  --ink-2: #17333d;
  --teal: #1ec8b0;
  --teal-d: #149684;
  --amber: #e2a93b;
  --red: #d4523e;
  --blue: #3b82c4;
  --paper: #eef2f4;
  --card: #ffffff;
  --line: #d7e0e4;
  --muted: #5f7380;
  --text: #1c2a32;
  --shadow: 0 10px 30px rgba(16, 35, 42, 0.08);
  --radius: 16px;
  --sidebar: 272px;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
  --sans: "Outfit", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--sans);
  color: var(--text);
  background: var(--paper);
}
a { color: inherit; }
button, input, select, textarea { font-family: inherit; }

.login-body {
  min-height: 100vh;
  background:
    radial-gradient(circle at 20% 20%, rgba(30, 200, 176, 0.18), transparent 32%),
    linear-gradient(135deg, #0c1c22 0%, #12303a 50%, #0b181d 100%);
  color: #e8f3f1;
}
.login-shell {
  max-width: 1080px;
  margin: 0 auto;
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  align-items: center;
  gap: 40px;
  padding: 32px;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}
.lede { font-size: 20px; line-height: 1.45; color: #c5ddd8; max-width: 460px; }
.brand-points { padding: 0; list-style: none; color: #9fb8b3; }
.brand-points li { margin: 10px 0; padding-left: 16px; border-left: 2px solid var(--teal); }
.brand-logo {
  display: block;
  width: auto;
  max-width: 100%;
  height: auto;
  object-fit: contain;
}
.brand-logo.login-hero {
  height: 72px;
  max-width: min(100%, 420px);
  margin-bottom: 18px;
}
.brand-logo.login-panel-logo {
  height: 34px;
  margin-bottom: 10px;
}
.brand-logo.sidebar-logo {
  height: 26px;
  max-width: 168px;
}
/* White artwork: keep white on dark, recolor on light. */
.brand-logo.tone-white {
  filter: drop-shadow(0 10px 22px rgba(30, 200, 176, 0.28));
}
.brand-logo.tone-teal {
  filter: brightness(0) invert(64%) sepia(42%) saturate(620%) hue-rotate(127deg) brightness(96%) contrast(94%);
}
.brand-logo.tone-ink {
  filter: brightness(0) invert(12%) sepia(22%) saturate(748%) hue-rotate(152deg) brightness(94%) contrast(96%);
}
.brand-mark {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: var(--teal);
  flex-shrink: 0;
}
.brand-bolt {
  height: 22px;
  width: auto;
  display: block;
  filter: drop-shadow(0 1px 0 rgba(8, 36, 31, 0.12));
}
.login-panel {
  background: #f7fbfa;
  color: var(--text);
  border-radius: 24px;
  padding: 36px;
  box-shadow: var(--shadow);
}
.login-panel h2 { margin: 0 0 6px; }
.login-panel label, .stack label { display: block; font-size: 13px; font-weight: 600; margin: 14px 0 8px; }
.login-panel input, .field, select, textarea, input[type="text"], input[type="email"], input[type="password"], input[type="number"], input[type="datetime-local"] {
  width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 10px;
  padding: 11px 12px;
  font-size: 15px;
}
.btn {
  border: 0;
  border-radius: 10px;
  padding: 11px 16px;
  font-weight: 600;
  cursor: pointer;
  background: #dce7ea;
  color: var(--ink);
}
.btn.primary { background: var(--teal); color: #06241f; }
.btn.ghost { background: transparent; border: 1px solid var(--line); }
.btn.warn { background: var(--amber); }
.btn.danger { background: var(--red); color: #fff; }
.btn.block { width: 100%; margin-top: 16px; }
.btn:disabled { opacity: 0.6; cursor: wait; }
.form-error { color: var(--red); font-size: 14px; }
.demo-box {
  margin-top: 22px;
  padding: 12px 14px;
  background: #ecf4f2;
  border-radius: 12px;
  display: grid;
  gap: 4px;
  font-size: 13px;
  color: var(--muted);
}
.muted { color: var(--muted); }

.app-shell { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar);
  background: linear-gradient(180deg, var(--ink) 0%, #0c1b21 100%);
  color: #d7eeea;
  padding: 18px 14px 28px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: auto;
  flex-shrink: 0;
}
.sidebar-brand {
  display: flex;
  gap: 10px;
  align-items: center;
  text-decoration: none;
  padding: 8px 8px 18px;
}
.sidebar-brand-text { min-width: 0; display: grid; gap: 4px; }
.sidebar-brand em { font-style: normal; font-size: 12px; color: #8aa8a3; }
.nav-label {
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #7f9995;
  margin: 16px 10px 8px;
}
.side-nav a {
  display: block;
  text-decoration: none;
  padding: 9px 12px;
  border-radius: 10px;
  color: #cfe4e0;
  font-size: 14px;
}
.side-nav a.active, .side-nav a:hover { background: rgba(30, 200, 176, 0.14); color: #fff; }
.main { flex: 1; min-width: 0; }
.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px 24px 8px;
}
.topbar h1 { margin: 0; font-size: 28px; }
.crumb { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.user-chip { display: grid; justify-items: end; font-size: 13px; }
.user-chip small { color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
.text-btn { background: none; border: 0; color: var(--teal-d); cursor: pointer; font-weight: 600; padding: 0; }
.icon-btn, .menu-btn {
  display: none;
  border: 0;
  background: #fff;
  width: 40px; height: 40px;
  border-radius: 10px;
  cursor: pointer;
}
.content { padding: 8px 24px 40px; }
.grid { display: grid; gap: 16px; }
.grid.kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.two { grid-template-columns: 1.4fr 0.8fr; }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  min-width: 0;
}
.card h3 { margin: 0 0 12px; font-size: 16px; }
.kpi .label { color: var(--muted); font-size: 13px; }
.kpi .value { font-family: var(--mono); font-size: 28px; margin: 6px 0 2px; }
.kpi .sub { font-size: 12px; color: var(--muted); }
.kpi { border-top: 3px solid var(--teal); }
.kpi.warn { border-top-color: var(--amber); }
.kpi.danger { border-top-color: var(--red); }
.table-wrap { overflow: auto; }
table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
table.data th, table.data td {
  text-align: left;
  padding: 10px 8px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
table.data th { font-size: 12px; color: var(--muted); font-weight: 600; }
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #e5f7f3;
  color: #0d5d52;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 600;
}
.pill.bad { background: #fde8e4; color: #8a2618; }
.pill.warn { background: #fff4dc; color: #8a5b0a; }
.pill.idle { background: #e8eef2; color: #44555e; }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; align-items: center; }
.toolbar input, .toolbar select { width: auto; min-width: 160px; }
.live-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.meter-card h4 { margin: 0 0 4px; }
.reading { font-family: var(--mono); font-size: 26px; }
.reading small { font-size: 12px; color: var(--muted); }
.meta { display: flex; justify-content: space-between; color: var(--muted); font-size: 12px; margin-top: 10px; }
.tree details { margin-left: 12px; }
.tree > details { margin-left: 0; }
.tree summary { cursor: pointer; padding: 6px 0; font-weight: 600; }
.asset-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 10px;
  background: #f4f8f8;
  border-radius: 10px;
  margin: 6px 0;
  font-size: 14px;
}
.wizard { display: grid; grid-template-columns: 180px 1fr; gap: 18px; }
.steps { list-style: none; padding: 0; margin: 0; }
.steps li { padding: 8px 0; color: var(--muted); }
.steps li.on { color: var(--ink); font-weight: 700; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.stack { display: grid; gap: 4px; }
.insight { padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.empty { color: var(--muted); padding: 20px; text-align: center; }
.toast-wrap { position: fixed; right: 16px; bottom: 16px; display: grid; gap: 8px; z-index: 40; }
.toast {
  background: var(--ink);
  color: #fff;
  padding: 10px 14px;
  border-radius: 10px;
  min-width: 220px;
}
.mono { font-family: var(--mono); }
.chart-box { height: 280px; }
.map-editor { min-height: 220px; font-family: var(--mono); font-size: 12px; }

.live-dot {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: #0d5d52;
  background: #e5f7f3;
  border-radius: 999px;
  padding: 4px 10px;
}
.live-dot i {
  width: 8px; height: 8px; border-radius: 50%;
  background: #1ec8b0;
  box-shadow: 0 0 0 0 rgba(30, 200, 176, 0.7);
}
.live-dot.pulse i { animation: livepulse 0.6s ease-out; }
.live-ago { font-size: 12px; color: var(--muted); }
@keyframes livepulse {
  0% { box-shadow: 0 0 0 0 rgba(30, 200, 176, 0.7); }
  100% { box-shadow: 0 0 0 10px rgba(30, 200, 176, 0); }
}

.skin-switch {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 16px;
}
.skin-switch a {
  text-decoration: none;
  padding: 7px 12px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid var(--line);
  font-size: 13px;
  font-weight: 600;
}
.skin-switch a.on { background: var(--ink); color: #fff; border-color: var(--ink); }

.dash-intro { margin-bottom: 18px; }
.dash-intro h2 { margin: 0 0 6px; }
.dash-intro p { margin: 0; color: var(--muted); }
.dash-gallery {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}
.dash-tile {
  display: block;
  position: relative;
  overflow: hidden;
  text-decoration: none;
  min-height: 230px;
  padding: 22px 22px 88px;
  border-radius: 20px;
  color: #fff;
  box-shadow: var(--shadow);
}
.dash-tile .dash-kicker {
  display: inline-block;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  opacity: 0.7;
  margin-bottom: 8px;
}
.dash-tile h2 { margin: 0 0 8px; font-size: 28px; }
.dash-tile p { margin: 0; max-width: 340px; line-height: 1.4; opacity: 0.88; }
.dash-tile .go { display: inline-block; margin-top: 16px; font-weight: 700; }
.dash-tile.executive {
  background: linear-gradient(155deg, #eef7f5 0%, #d5efe9 55%, #1ec8b0 140%);
  color: #10232a;
}
.dash-tile.analog { background: linear-gradient(155deg, #2a2114 0%, #120e09 70%); }
.dash-tile.led { background: linear-gradient(155deg, #07141a 0%, #0a2a24 80%); }
.dash-tile.vertical { background: linear-gradient(155deg, #151920 0%, #2a3344 90%); }
.dash-tile.executive .go { color: #0d5d52; }
.dash-tile.analog .go, .dash-tile.led .go, .dash-tile.vertical .go { color: var(--teal); }
.mini-preview {
  position: absolute;
  right: 16px;
  bottom: 14px;
  display: flex;
  gap: 8px;
  align-items: flex-end;
}
.mini-exec i {
  width: 42px; height: 28px; border-radius: 6px;
  background: rgba(16, 35, 42, 0.12);
  border-top: 3px solid #149684;
}
.mini-analog i {
  width: 44px; height: 44px; border-radius: 50%;
  background: radial-gradient(circle at 40% 30%, #f6ecd0, #8a7348);
  box-shadow: inset 0 0 0 3px #3a2f1c;
}
.mini-led b {
  width: 10px; height: 36px;
  background: linear-gradient(#d4523e, #e2a93b, #1ec8b0);
  border-radius: 2px;
  opacity: 0.85;
}
.mini-vert i {
  width: 22px; height: 54px; border-radius: 6px;
  background: #0c0c0c;
  border: 1px solid #444;
}

.analog-room, .vert-room {
  background: #16120c;
  border-radius: 18px;
  padding: 16px;
}
.vert-room { background: #12161c; }
.rack-banner {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  align-items: baseline;
  margin-bottom: 14px;
  color: #d7c79a;
}
.rack-banner.dark { color: #9ad7c8; }
.rack-banner span { font-size: 13px; opacity: 0.75; }

.analog-board, .live-grid.analog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
}
.analog-wrap { text-align: center; }
.analog-bezel {
  background: radial-gradient(circle at 40% 30%, #3a3a3a, #111);
  border-radius: 50%;
  padding: 10px;
  box-shadow: inset 0 1px 0 #666, 0 10px 24px rgba(0,0,0,0.28);
}
.analog-svg { width: 100%; height: auto; display: block; }
.analog-svg .needle {
  transform-box: view-box;
  transform-origin: 100px 108px;
  transition: transform 0.8s cubic-bezier(.2,.85,.2,1);
}
.gauge-brand { font-size: 9px; fill: #7a6a48; letter-spacing: 0.16em; text-transform: uppercase; }
.gauge-unit { font-size: 11px; fill: #3b2f1c; font-weight: 700; }
.analog-readout { font-family: var(--mono); margin-top: 8px; color: #eee; }
.analog-readout strong { font-size: 22px; margin-right: 6px; }
.analog-label { font-size: 12px; color: #b7c4c0; margin-top: 2px; }
.analog-board .analog-readout { color: var(--text); }
.analog-board .analog-label { color: var(--muted); }
.analog-room .analog-readout { color: #eee; }
.analog-room .analog-label { color: #c9b896; }

.instrument {
  background: linear-gradient(165deg, #2b2b2b, #121212);
  color: #eee;
  border-radius: 14px;
  padding: 12px;
  box-shadow: 0 12px 28px rgba(16, 35, 42, 0.2);
}
.inst-head, .inst-foot, .inst-aux {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
.inst-head { font-size: 13px; font-weight: 600; margin-bottom: 8px; }
.inst-foot { font-size: 11px; color: #8b9a96; margin-top: 8px; }
.inst-aux { margin-top: 8px; gap: 6px; }
.lamp {
  width: 10px; height: 10px; border-radius: 50%;
  background: #555;
  box-shadow: inset 0 1px 1px #000;
}
.lamp.run { background: #3dff7a; box-shadow: 0 0 8px #3dff7a; }
.lamp.idle { background: #e2a93b; }
.lamp.off { background: #d4523e; }

.lcd-box { flex: 1; min-width: 0; }
.lcd-label { font-size: 9px; letter-spacing: 0.12em; color: #8b9a96; margin-bottom: 3px; }
.lcd {
  background: #07140d;
  border: 2px solid #2c4a38;
  border-radius: 4px;
  padding: 4px 6px;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  box-shadow: inset 0 0 12px rgba(0,0,0,0.6);
}
.lcd-digits {
  font-family: var(--mono);
  color: #7CFF6B;
  text-shadow: 0 0 6px rgba(124, 255, 107, 0.45);
  font-size: 16px;
  white-space: pre;
}
.lcd-unit { font-size: 10px; color: #4d8a58; margin-left: 4px; }
.din-face { background: #0c0c0c; border: 1px solid #333; border-radius: 8px; padding: 10px; }
.din-title { font-size: 11px; letter-spacing: 0.08em; margin-bottom: 8px; color: #9ad7c8; }

.led-stack {
  display: flex;
  flex-direction: column-reverse;
  gap: 3px;
  padding: 8px 6px;
  background: #0a0a0a;
  border-radius: 6px;
  border: 1px solid #222;
}
.led {
  height: 7px;
  border-radius: 1px;
  background: #1a1a1a;
  opacity: 0.25;
}
.led.ok { background: #1ec8b0; }
.led.warm { background: #e2a93b; }
.led.hot { background: #d4523e; }
.led.on { opacity: 1; box-shadow: 0 0 6px currentColor; }

.skin-led .led-wall {
  background: #070b0e;
  border-radius: 18px;
  padding: 18px;
  color: #d7eeea;
}
.led-kpis, .led-meters, .vert-grid {
  display: grid;
  gap: 14px;
}
.led-kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 16px; }
.led-meters { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
.led-kpi, .led-cell {
  background: #10161a;
  border: 1px solid #1e2a30;
  border-radius: 10px;
  padding: 10px;
}
.led-name { font-size: 11px; display: flex; justify-content: space-between; margin-bottom: 6px; }
.vert-grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.vert-card .led-stack { margin: 8px 0; }

.live-help { font-size: 13px; line-height: 1.45; margin: 0 0 16px; }
.live-help code { font-size: 12px; background: #eef4f3; padding: 1px 5px; border-radius: 4px; }
.toolbox h3 { margin-top: 0; }
.toolbox-grid label.check { display: flex; align-items: center; gap: 8px; margin-top: 28px; }
.toolbox select[multiple] { min-height: 88px; }
.report-table tr.subtotal { background: #eef6f4; font-weight: 600; }
.report-table tr.total { background: #10232a; color: #fff; font-weight: 700; }

.secure-steps { margin: 0; padding-left: 18px; color: var(--muted); line-height: 1.45; }
.secure-steps li { margin: 8px 0; }
.secure-steps code { font-size: 12px; background: #eef4f3; padding: 1px 5px; border-radius: 4px; }

.andon-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
}
.andon-card {
  background: #10161a;
  color: #d7eeea;
  border-radius: 16px;
  padding: 16px;
  border-top: 4px solid #1ec8b0;
  box-shadow: var(--shadow);
}
.andon-card.down { border-top-color: #d4523e; }
.andon-card.watch { border-top-color: #e2a93b; }
.andon-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.andon-oee { font-size: 42px; line-height: 1; margin: 8px 0; }
.andon-oee small { font-size: 14px; margin-left: 6px; color: #8aa8a3; }
.andon-apq { display: flex; gap: 12px; font-size: 13px; color: #9ad7c8; margin-bottom: 10px; }
.andon-faults { font-size: 13px; display: grid; gap: 6px; }

@media (max-width: 1080px) {
  .grid.kpis, .grid.two, .grid.three, .wizard, .form-grid, .login-shell, .led-kpis, .dash-gallery { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    left: 0; top: 0;
    transform: translateX(-105%);
    z-index: 20;
    transition: transform 0.2s ease;
  }
  .sidebar.open { transform: none; }
  .menu-btn { display: inline-grid; place-items: center; }
  .login-shell { padding-top: 48px; }
}
@media (max-width: 720px) {
  .content, .topbar { padding-left: 14px; padding-right: 14px; }
  .topbar { flex-wrap: wrap; }
  .top-actions { width: 100%; justify-content: space-between; }
}
