:root {
  color-scheme: dark;
  --bg: #0b1117;
  --surface: #111a22;
  --surface-2: #17232d;
  --line: #263642;
  --text: #eef4f7;
  --muted: #8ea0ac;
  --cyan: #1f8f7e;
  --blue: #4aa3ff;
  --orange: #f3a83b;
  --red: #ff6b6b;
  --green: #38d0b5;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; min-height: 100vh; background: radial-gradient(circle at 70% -20%, #15313d 0, transparent 35%), var(--bg); color: var(--text); }
button, input, select { font: inherit; }
button { cursor: pointer; }

.app-shell { width: min(1760px, 100%); margin: 0 auto; padding: 0 clamp(16px, 2.3vw, 44px) 48px; }
.topbar { height: 92px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); }
.client-layout { display: block; }
.client-layout.logged-in {
  display: grid;
  grid-template-columns: minmax(214px, 238px) minmax(0, 1fr);
  gap: clamp(18px, 1.6vw, 28px);
  align-items: start;
}
.client-main { min-width: 0; }
.client-sidebar {
  position: sticky;
  top: 18px;
  margin-top: 48px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: linear-gradient(145deg, var(--surface) 0%, var(--surface-2) 100%);
  box-shadow: 0 14px 40px #00000018;
}
.client-sidebar-title {
  padding: 8px 8px 14px;
  border-bottom: 1px solid var(--line);
}
.client-sidebar-title span,
.client-nav-button small {
  display: block;
  color: var(--muted);
  font-size: 10px;
  font-weight: 850;
  letter-spacing: .12em;
  text-transform: uppercase;
}
.client-sidebar-title strong {
  display: block;
  margin-top: 4px;
  color: var(--text);
  font-size: 16px;
}
.client-nav {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}
.client-nav-button {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 13px 12px;
  border: 1px solid transparent;
  border-left: 3px solid transparent;
  border-radius: 14px;
  background: transparent;
  color: var(--text);
  text-align: left;
}
.client-nav-button:hover {
  border-color: var(--line);
  border-left-color: var(--line);
  background: #ffffff70;
}
.client-nav-button.active {
  border-color: #64d5cf;
  border-left-color: var(--cyan);
  background: #e7fbf8;
  box-shadow: inset 0 0 0 1px #1f8f7e28;
}
.client-nav-icon {
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  color: var(--muted);
}
.client-nav-button.active .client-nav-icon,
.client-nav-button:hover .client-nav-icon {
  color: var(--cyan);
}
.client-nav-text { min-width: 0; }
.client-nav-button span {
  display: block;
  font-size: 14px;
  font-weight: 900;
}
.client-nav-button small {
  margin-top: 4px;
  letter-spacing: 0;
  text-transform: none;
}
.brand, .top-actions, .card-heading, .panel-title, .metric-footer, .dialog-header, .dialog-actions { display: flex; align-items: center; justify-content: space-between; }
.brand { gap: 14px; justify-content: flex-start; min-width: 0; }
.brand > div { min-width: 0; }
.brand-logo { display: block; width: 132px; max-width: 34vw; height: auto; object-fit: contain; flex: 0 0 auto; }
.eyebrow, .section-kicker { margin: 0 0 4px; color: var(--cyan); font-size: 11px; font-weight: 800; letter-spacing: .16em; }
.brand h1 { margin: 0; font-size: 18px; letter-spacing: -.02em; }
.top-actions { gap: 12px; flex-wrap: wrap; justify-content: flex-end; }
.top-actions .secondary-button { width: auto; }
.account-menu { position: relative; }
.account-menu-trigger {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface);
  color: var(--text);
  font-size: 20px;
  font-weight: 900;
  line-height: 1;
  letter-spacing: .04em;
}
.account-menu-trigger:hover { background: #ffffff70; }
.account-menu-panel {
  position: absolute;
  z-index: 20;
  top: calc(100% + 8px);
  right: 0;
  width: 220px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: linear-gradient(145deg, var(--surface) 0%, var(--surface-2) 100%);
  box-shadow: 0 14px 40px #00000022;
}
.account-menu-identity { display: flex; flex-direction: column; line-height: 1.3; }
.account-menu-identity strong { font-size: 13px; font-weight: 800; color: var(--text); }
.account-menu-identity span { font-size: 11px; color: var(--muted); }
.account-menu-plan {
  display: flex;
  flex-direction: column;
  margin: 12px 0;
  padding: 10px 0 0;
  border-top: 1px solid var(--line);
}
.account-menu-plan span { margin-bottom: 4px; color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.account-menu-plan strong { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 14px; }
.account-menu-item {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 10px 12px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: var(--text);
  font-weight: 700;
  text-align: left;
}
.account-menu-item:hover { background: #ffffff70; border-color: var(--line); }
.account-menu-item.danger { color: var(--red); }
.connection-pill { display: flex; gap: 9px; align-items: center; min-width: 132px; padding: 10px 14px; border: 1px solid #28413c; border-radius: 100px; background: #10221f; color: #8ee8bb; font-size: 12px; font-weight: 800; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 5px #38d0b520; }
.connection-pill.offline { color: #ff9999; border-color: #4c2929; background: #251617; }
.connection-pill.offline .status-dot { background: var(--red); box-shadow: 0 0 0 5px #ff6b6b20; }
.connection-pill.stale { color: #ffd590; border-color: #4f3e24; background: #251f14; }
.connection-pill.stale .status-dot { background: var(--orange); box-shadow: 0 0 0 5px #f3a83b20; }
.icon-button, .close-button { border: 1px solid var(--line); background: var(--surface); color: var(--text); }
.icon-button { width: 42px; height: 42px; border-radius: 11px; padding: 10px; }
.icon-button svg { width: 100%; fill: none; stroke: currentColor; stroke-width: 1.6; }

.hero { padding: 48px 0 30px; display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; }
.hero h2 { margin: 0; font-size: clamp(26px, 4vw, 42px); letter-spacing: -.045em; }
.hero-copy { margin: 11px 0 0; color: var(--muted); }
.hero-actions { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.last-update { text-align: right; }
.last-update span { display: block; margin-bottom: 6px; color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .12em; }
.last-update strong { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 18px; }

.metrics-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.asset-dashboard { display: grid; grid-template-columns: minmax(260px, .75fr) minmax(0, 1.8fr); gap: 18px; }
#dashboardPanel.mode-scale #selectedMetrics,
#dashboardPanel.mode-scale #runtimePanel,
#dashboardPanel.mode-scale #stopEventsPanel,
#dashboardPanel.mode-scale #qualityEventsPanel,
#dashboardPanel.mode-asset #scaleDashboard {
  display: none !important;
}
.asset-status-panel,
.asset-telemetry-card {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: linear-gradient(145deg, #15212a 0%, #101820 100%);
  box-shadow: 0 14px 40px #00000022;
}
.asset-status-panel { min-height: 350px; padding: 26px; text-align: center; }
.asset-status-panel h3 { margin: 0; font-size: clamp(24px, 4vw, 34px); letter-spacing: -.04em; }
.asset-illustration { display: grid; place-items: center; min-height: 145px; margin: 22px 0 18px; }
.crusher-icon {
  position: relative;
  width: 132px;
  height: 132px;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 50%, #38d86b 0 20%, #1e9246 21% 42%, transparent 43%),
    conic-gradient(from 15deg, #d8e0e2 0 8deg, #1a9c49 8deg 35deg, #d8e0e2 35deg 48deg, #1a9c49 48deg 78deg, #d8e0e2 78deg 91deg, #1a9c49 91deg 122deg, #d8e0e2 122deg 137deg, #1a9c49 137deg 165deg, #d8e0e2 165deg 180deg, #1a9c49 180deg 210deg, #d8e0e2 210deg 226deg, #1a9c49 226deg 254deg, #d8e0e2 254deg 270deg, #1a9c49 270deg 302deg, #d8e0e2 302deg 318deg, #1a9c49 318deg 348deg, #d8e0e2 348deg);
  border: 10px solid #c7ced0;
  box-shadow: inset 0 0 18px #0007, 0 12px 30px #0004;
}
.crusher-icon::before,
.crusher-icon::after {
  content: "";
  position: absolute;
  background: #c7ced0;
  box-shadow: inset 0 0 6px #0006;
}
.crusher-icon::before { left: -22px; bottom: -18px; width: 176px; height: 14px; border-radius: 4px; }
.crusher-icon::after { right: -28px; top: 40px; width: 28px; height: 52px; border-radius: 0 8px 8px 0; }
.asset-run-state { display: block; margin-top: 8px; color: var(--green); font-size: 32px; font-weight: 500; }
.asset-run-state.on { color: var(--green); }
.asset-run-state.off { color: var(--red); }
.asset-fault-state,
.asset-emergency-state { display: block; margin-top: 18px; color: var(--text); font-size: 22px; }
.asset-emergency-state { font-weight: 850; }
.asset-fault-state.fault { color: var(--orange); }
.asset-fault-state.ok { color: var(--text); }
.asset-emergency-state.emergency { color: var(--red); }
.asset-emergency-state.ok { color: var(--text); }
.asset-telemetry-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.asset-telemetry-card {
  min-width: 0;
  min-height: 166px;
  padding: 30px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}
.asset-telemetry-card span { color: var(--text); font-size: 18px; font-weight: 850; }
.asset-telemetry-card strong { min-width: 0; color: var(--text); overflow-wrap: anywhere; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: clamp(28px, 4vw, 40px); }
.asset-telemetry-card small { color: inherit; font-size: .55em; }
.nominal-value {
  width: 100%;
  margin: -8px 0 0;
  color: var(--blue);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: .02em;
}

/* Padrão de cor dos indicadores: ideal (turquesa), média (laranja), abaixo (vermelho), nominal (azul). */
.indicator-ideal { color: var(--green); }
.indicator-media { color: var(--orange); }
.indicator-baixo { color: var(--red); }
.oee-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-top: 18px; }
.oee-card { min-width: 0; padding: 18px; border: 1px solid var(--line); border-radius: 16px; background: linear-gradient(145deg, #13202a 0%, #0f171f 100%); box-shadow: 0 14px 40px #00000018; }
.oee-card span,
.oee-card small { display: block; color: var(--muted); font-size: 11px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.oee-card strong { display: block; margin: 8px 0 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: clamp(28px, 4vw, 42px); letter-spacing: -.06em; }
.oee-card small { font-weight: 700; letter-spacing: 0; text-transform: none; }
.oee-card span[title] { width: fit-content; border-bottom: 1px dotted var(--muted); cursor: help; }
.scale-summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.executive-title { margin-bottom: 14px; }
.customer-config-title { margin-top: 26px; padding-top: 20px; border-top: 1px solid var(--line); }
.inline-select { display: flex; align-items: center; gap: 10px; min-width: 170px; }
.inline-select select { min-height: 36px; }
.compact-select { display: flex; align-items: center; gap: 8px; width: auto; color: var(--muted); font-size: 11px; font-weight: 800; }
.compact-select select { min-width: 190px; min-height: 34px; padding: 0 9px; font-size: 12px; }
.executive-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 16px; }
.executive-card { min-width: 0; padding: 16px; border: 1px solid var(--line); border-radius: 16px; background: linear-gradient(145deg, #13202a 0%, #0f171f 100%); }
.executive-card span { display: block; color: var(--muted); font-size: 10px; font-weight: 850; letter-spacing: .08em; text-transform: uppercase; }
.executive-card strong { display: block; margin-top: 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: clamp(24px, 3.2vw, 34px); letter-spacing: -.06em; }
.executive-card small { display: block; margin-top: 5px; color: var(--muted); font-size: 11px; }
.executive-lists { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-bottom: 18px; }
.scale-card { border: 1px solid var(--line); border-radius: 16px; padding: 18px; background: linear-gradient(145deg, #13202a 0%, #0f171f 100%); }
.scale-select-card { width: 100%; color: inherit; text-align: left; }
.scale-select-card:hover { border-color: #3b6866; transform: translateY(-1px); transition: border-color .18s ease, transform .18s ease; }
.scale-select-card.selected { border-color: var(--cyan); box-shadow: inset 0 0 0 1px #1f8f7e55, 0 14px 40px #0000001f; }
.scale-card.online { border-color: #2d5c49; }
.scale-card.connected { border-color: #5f4724; background: linear-gradient(145deg, #231f15 0%, #11171d 100%); }
.scale-card.offline { border-color: #553030; background: linear-gradient(145deg, #211617 0%, #11171d 100%); }
.scale-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 15px; }
.scale-card-head strong { display: block; font-size: 15px; }
.scale-card-head span { display: block; margin-top: 4px; color: var(--muted); font-size: 11px; }
.scale-card-head em { padding: 5px 8px; border-radius: 999px; background: #173327; color: #85ebb8; font-size: 10px; font-style: normal; font-weight: 850; text-transform: uppercase; }
.scale-card.connected .scale-card-head em { background: #3a2d19; color: #ffd590; }
.scale-card.offline .scale-card-head em { background: #361d1f; color: #ffaaaa; }
.scale-card-values { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.scale-card-values div { min-width: 0; padding-top: 10px; border-top: 1px solid var(--line); }
.scale-card-values span, .scale-card-values small { display: block; color: var(--muted); font-size: 10px; }
.scale-card-values b { display: block; margin: 4px 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 18px; }
.scale-error { margin: 12px 0 0; color: #ffaaaa; font-size: 11px; line-height: 1.45; }
.scale-ok { margin: 12px 0 0; color: var(--green); font-size: 11px; line-height: 1.45; }
.scale-empty { grid-column: 1 / -1; padding: 18px; border: 1px dashed var(--line); border-radius: 14px; color: var(--muted); text-align: center; }
.metric-card, .panel { border: 1px solid var(--line); background: linear-gradient(145deg, #15212a 0%, #101820 100%); border-radius: 18px; box-shadow: 0 14px 40px #00000022; }
.metric-card { min-height: 250px; padding: 26px; position: relative; overflow: hidden; }
.metric-card::after { content: ""; position: absolute; right: -70px; bottom: -110px; width: 260px; height: 260px; border-radius: 50%; filter: blur(5px); opacity: .09; }
.flow-card::after { background: var(--cyan); }
.total-card::after { background: var(--blue); }
.card-heading { position: relative; z-index: 1; }
.card-heading p { margin: 0 0 7px; color: #c8d5db; font-size: 12px; font-weight: 850; letter-spacing: .1em; }
.card-heading span { color: var(--muted); font-size: 13px; }
.metric-icon { width: 46px; height: 46px; display: grid; place-items: center; border-radius: 13px; }
.metric-icon svg { width: 24px; fill: none; stroke: currentColor; stroke-width: 1.7; }
.flow-icon { color: var(--cyan); background: #1f8f7e17; }
.total-icon { color: var(--blue); background: #4aa3ff17; }
.metric-value { min-width: 0; display: flex; align-items: baseline; gap: 12px; margin: 37px 0 30px; position: relative; z-index: 1; }
.metric-value strong { min-width: 0; overflow-wrap: anywhere; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: clamp(42px, 6vw, 68px); line-height: .9; letter-spacing: -.07em; }
.metric-value span { color: var(--muted); font-size: 18px; font-weight: 700; }
.metric-footer { position: relative; z-index: 1; padding-top: 17px; border-top: 1px solid var(--line); color: var(--muted); font-size: 11px; letter-spacing: .04em; }
.live-badge { color: #80e8bd; font-weight: 800; }
.live-badge i { display: inline-block; width: 6px; height: 6px; margin-right: 6px; border-radius: 50%; background: var(--green); }

.content-grid { margin-top: 18px; display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(290px, .7fr); gap: 18px; }
.runtime-panel { grid-column: 1 / -1; }
.runtime-bars { display: grid; grid-template-columns: 1fr; gap: 9px; margin: 22px 0 16px; }
.runtime-bar { height: 34px; overflow: hidden; border-radius: 7px; background: #0d151c; border: 1px solid var(--line); }
.runtime-bar span { display: block; min-width: 2px; height: 100%; border-radius: inherit; }
.runtime-running span { background: linear-gradient(90deg, #31df4a, #31df4a88); }
.runtime-stopped span { background: linear-gradient(90deg, #ff4438, #ff443888); }
.runtime-fault span { background: linear-gradient(90deg, #f3a83b, #f3a83b88); }
.runtime-legend { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; color: var(--muted); font-size: 12px; }
.runtime-legend span,
.runtime-legend b { display: block; }
.runtime-legend b { margin-top: 4px; color: var(--text); font-size: 18px; }
.runtime-dot { display: inline-block; width: 8px; height: 8px; margin-right: 6px; border-radius: 50%; }
.runtime-dot.running { background: #31df4a; }
.runtime-dot.stopped { background: #ff4438; }
.runtime-dot.fault { background: #f3a83b; }
.panel { padding: 24px; }

body.auth-mode { display: flex; min-height: 100vh; }
body.auth-mode .app-shell { width: 100%; margin: 0; padding: 0; display: flex; align-items: center; justify-content: center; }
body.auth-mode #topbar,
body.auth-mode #hero { display: none; }
body.auth-mode .client-layout,
body.auth-mode .client-main { width: 100%; display: flex; justify-content: center; }

.login-screen { display: flex; flex-direction: column; align-items: center; width: 100%; max-width: 400px; padding: 24px; }
.login-logo { height: 72px; width: auto; margin-bottom: 36px; }
.login-card { width: 100%; padding: 32px; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; box-shadow: 0 14px 40px #00000022; }
.login-card h3 { margin: 0 0 6px; font-size: 22px; }
.login-subtitle { margin: 0 0 26px; color: var(--muted); font-size: 13px; }
.login-form { display: grid; gap: 18px; }
.login-form label { display: grid; gap: 7px; color: var(--muted); font-size: 12px; font-weight: 700; }
.input-icon-wrap { position: relative; display: flex; align-items: center; }
.input-icon-wrap .input-icon { position: absolute; left: 13px; width: 16px; height: 16px; color: var(--muted); pointer-events: none; }
.input-icon-wrap input { padding-left: 38px; }
.input-icon-wrap input#password { padding-right: 40px; }
.password-toggle { position: absolute; right: 4px; width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; border: 0; background: transparent; color: var(--muted); border-radius: 6px; padding: 0; }
.password-toggle:hover { color: var(--text); }
.password-toggle svg { width: 17px; height: 17px; }
.primary-button.login-submit { width: 100%; min-height: 48px; border-radius: 999px; background: var(--green); color: #04241a; font-size: 15px; }
#dashboardPanel { padding-bottom: 12px; }
#dashboardPanel .scale-summary { margin-bottom: 0; }
#guidedPanel { margin-top: 18px; }
.panel h3 { margin: 0; font-size: 18px; }
.range-chip { padding: 7px 10px; border: 1px solid #274742; border-radius: 8px; color: var(--cyan); font-size: 9px; font-weight: 850; letter-spacing: .12em; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 16px; margin-top: 14px; color: var(--muted); font-size: 11px; font-weight: 700; }
.chart-legend span { display: flex; align-items: center; gap: 6px; }
.chart-legend-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--green); }
.chart-legend-dot.medium { background: var(--orange); }
.chart-legend-dot.low { background: var(--red); }
.chart-legend-dot.nominal { border-radius: 2px; background: var(--blue); }
.chart-wrap { height: 260px; margin-top: 14px; position: relative; }
#flowChart, #cloudFlowChart { width: 100%; height: 100%; }
.chart-empty { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); font-size: 13px; }
.diagnostic-list { margin: 19px 0; }
.diagnostic-list div { display: flex; justify-content: space-between; gap: 15px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.diagnostic-list dt { color: var(--muted); font-size: 12px; }
.diagnostic-list dd { margin: 0; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; text-align: right; }
.ok-text { color: var(--green); }
.warning-text { color: var(--orange); }
.error-box { padding: 13px; margin-bottom: 14px; border: 1px solid #633333; border-radius: 10px; background: #2a1718; color: #ffaaaa; }
.error-box strong { font-size: 12px; }
.error-box p { margin: 6px 0 0; font-size: 11px; line-height: 1.45; }
.hidden { display: none !important; }

.primary-button, .secondary-button, .danger-button { min-height: 42px; padding: 0 16px; border-radius: 9px; font-weight: 800; }
.primary-button { border: 0; background: var(--cyan); color: #071315; }
.secondary-button { width: 100%; border: 1px solid var(--line); background: #17232d; color: var(--text); }
.danger-button { width: auto; border: 1px solid var(--red); background: transparent; color: var(--red); margin-right: auto; }
.danger-button:hover { background: var(--red); color: #1a0707; }

dialog { width: min(900px, calc(100% - 28px)); max-height: 92vh; padding: 0; overflow: hidden; border: 1px solid #344a57; border-radius: 18px; background: #101820; color: var(--text); box-shadow: 0 30px 100px #000c; }
dialog > form { max-height: 92vh; padding: 26px; overflow: auto; }
.asset-edit-dialog {
  width: min(1480px, calc(100vw - 40px));
  max-height: calc(100vh - 40px);
}
.asset-edit-dialog > form {
  max-height: calc(100vh - 40px);
  padding: clamp(22px, 2.6vw, 36px);
}
.asset-edit-dialog .form-grid {
  grid-template-columns: repeat(3, minmax(240px, 1fr));
}
.asset-edit-dialog .asset-variable-list {
  grid-template-columns: 1fr;
}
.asset-edit-dialog .asset-variable-row {
  grid-template-columns: repeat(6, minmax(130px, 1fr));
}
#passwordDialog,
#adminPasswordDialog,
#resetPasswordDialog { width: min(760px, calc(100% - 28px)); }
#passwordForm,
#adminPasswordForm,
#resetPasswordForm { padding: 30px; }
#passwordForm .form-grid,
#adminPasswordForm .form-grid,
#resetPasswordForm .form-grid { grid-template-columns: 1fr; }
.wide-dialog { width: calc(100% - 24px); height: calc(100% - 24px); max-height: calc(100% - 24px); padding: 26px; overflow: auto; box-sizing: border-box; }

.production-report-trigger { display: flex; justify-content: flex-end; margin: 4px 0 12px; }
.production-report-trigger .secondary-button { width: auto; }
.production-summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 18px 0 16px; }
.production-summary .oee-card { padding: 14px 16px; }
.production-summary .oee-card span:first-child { display: block; margin-bottom: 8px; padding-bottom: 8px; border-bottom: 1px solid var(--line); font-size: 11px; font-weight: 800; letter-spacing: .06em; color: var(--muted); }
.production-summary .oee-row { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.production-summary .oee-row div span { display: block; font-size: 11px; color: var(--muted); margin-bottom: 2px; }
.production-summary .oee-row strong { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 19px; letter-spacing: -.03em; }
.production-summary .oee-row strong.negative { color: var(--red); }
.production-summary .oee-row strong.positive { color: var(--cyan); }
.production-summary-note { display: block; margin-top: 10px; color: var(--orange); font-size: 11px; font-weight: 700; letter-spacing: 0; text-transform: none; }
.production-toolbar { display: flex; justify-content: space-between; align-items: flex-end; gap: 14px; margin-bottom: 12px; flex-wrap: wrap; }
.production-toolbar .inline-select input { min-height: 38px; }
.production-table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; }
.production-table { width: 100%; border-collapse: collapse; font-size: 12px; white-space: nowrap; }
.production-table thead th { position: sticky; top: 0; text-align: left; padding: 10px 12px; background: var(--surface-2); color: var(--muted); font-weight: 800; border-bottom: 1px solid var(--line); cursor: pointer; user-select: none; }
.production-table thead th:hover { color: var(--text); }
.production-table tbody td { padding: 9px 12px; border-bottom: 1px solid var(--line); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.production-table tbody td.production-text { font-family: Inter, sans-serif; }
.production-table tbody tr:last-child td { border-bottom: none; }
.production-table .production-empty { font-family: Inter, sans-serif; color: var(--muted); text-align: center; padding: 24px 12px; }
.production-pagination { display: flex; justify-content: center; align-items: center; gap: 14px; padding-top: 14px; color: var(--muted); font-size: 13px; }
.production-pagination select { width: auto; min-height: 34px; padding: 4px 8px; }
dialog::backdrop { background: #03070ac9; backdrop-filter: blur(6px); }
#settingsForm, #scaleForm { padding: 26px; overflow: auto; max-height: 92vh; }
.dialog-header { gap: 18px; }
.dialog-header h2 { margin: 0; font-size: clamp(22px, 4vw, 32px); line-height: 1.05; letter-spacing: -.04em; }
.dialog-header > div { min-width: 0; }
.close-button { flex: 0 0 auto; width: 38px; height: 38px; border-radius: 10px; font-size: 26px; line-height: 1; }
.warning-banner { margin: 22px 0; padding: 14px 16px; border: 1px solid #604822; border-radius: 11px; background: #2b2214; color: #ffd799; }
.warning-banner strong { font-size: 12px; }
.warning-banner p { margin: 5px 0 0; font-size: 11px; line-height: 1.5; }
.compact-warning { margin: 14px 0 0; }
.guided-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-top: 18px; }
.guide-card { min-width: 0; padding: 18px; border: 1px solid var(--line); border-radius: 16px; background: #0d151c; }
.guide-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.guide-card h4 { margin: 0; font-size: 16px; }
.guide-subtitle { display: block; margin-top: 7px; color: var(--muted); font-size: 11px; }
.guided-record-card { margin-top: 18px; }
.guided-form { margin-top: 16px; }
.record-history { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.record-list { display: grid; gap: 8px; margin-top: 12px; }
.record-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px; border: 1px solid var(--line); border-radius: 12px; background: #101a22; }
.record-row.selected { border-color: var(--cyan); background: #102326; }
.record-row strong, .record-row span { display: block; }
.record-row strong { font-size: 12px; }
.record-row span { margin-top: 3px; color: var(--muted); font-size: 11px; }
.record-actions { display: flex; align-items: center; gap: 8px; }
.stop-event-active { display: grid; gap: 5px; margin: 16px 0; padding: 14px 16px; border: 1px solid var(--line); border-radius: 13px; background: #101a22; }
.stop-event-active hr { grid-column: 1 / -1; width: 100%; margin: 5px 0; border: 0; border-top: 1px solid var(--line); }
.stop-event-active strong { font-size: 13px; }
.stop-event-active span { color: var(--muted); font-size: 12px; }
.stop-event-active.active-stop { border-color: #604822; background: #2b2214; color: #ffd799; }
.stop-event-active.active-stop span { color: #946200; }
.stop-event-form { align-items: end; }
.stop-event-pending-notice { margin: 0 0 4px; padding: 10px 14px; border: 1px solid #604822; border-radius: 10px; background: #2b2214; color: #ffd799; font-size: 12px; }
.quality-summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin: 16px 0; }
.quality-summary div { padding: 14px; border: 1px solid var(--line); border-radius: 13px; background: #101a22; }
.quality-summary span { display: block; color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.quality-summary strong { display: block; margin-top: 7px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 18px; }
.compact-button { width: auto; min-height: 34px; padding: 0 12px; white-space: nowrap; }
.pending-badge { font-style: normal; font-weight: 800; font-size: 10px; letter-spacing: .04em; color: #d8912b; background: #2b2214; border: 1px solid #604822; border-radius: 999px; padding: 2px 8px; margin-left: 6px; }
.config-list { display: grid; gap: 8px; margin: 15px 0 0; }
.config-list div { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.config-list dt { color: var(--muted); font-size: 11px; }
.config-list dd { margin: 0; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; text-align: right; }
.checklist { display: grid; gap: 8px; margin-top: 15px; }
.check-row { display: grid; grid-template-columns: auto 1fr; align-items: flex-start; gap: 10px; padding: 11px; border: 1px solid var(--line); border-radius: 11px; background: #101a22; color: var(--text); font-size: 12px; line-height: 1.45; }
.check-row input { width: 17px; min-height: 17px; margin-top: 1px; accent-color: var(--cyan); }
.check-row:has(input:checked) { border-color: #2d5c49; background: #10221f; color: #c9f6df; }
.form-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.form-grid .wide { grid-column: span 3; }
label { display: grid; gap: 7px; color: #aab8c1; font-size: 11px; font-weight: 700; }
.toggle-field { display: flex; align-items: center; gap: 10px; min-height: 42px; padding: 0 11px; border: 1px solid #31434e; border-radius: 8px; background: #0c141a; color: var(--text); }
.toggle-field input { width: 17px; min-height: 17px; padding: 0; accent-color: var(--cyan); }
.asset-telemetry-fieldset {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
}
.asset-telemetry-fieldset legend {
  padding: 0 8px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.asset-telemetry-fieldset .toggle-field {
  padding: 10px 11px;
}
.fieldset-help {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}
.sensor-scale-fieldset {
  grid-template-columns: 1fr;
}
.sensor-scale-grid {
  display: grid;
  grid-template-columns: minmax(160px, 1.2fr) repeat(4, minmax(92px, 1fr));
  gap: 9px;
  align-items: center;
}
.sensor-scale-grid strong {
  color: var(--muted);
  font-size: 10px;
  font-weight: 850;
  letter-spacing: .07em;
  text-transform: uppercase;
}
.sensor-scale-grid span {
  color: var(--text);
  font-size: 12px;
  font-weight: 800;
}
.sensor-scale-grid input {
  min-height: 38px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.asset-variable-fieldset {
  grid-template-columns: 1fr;
}
.asset-variable-list {
  display: grid;
  gap: 12px;
}
.asset-variable-row {
  display: grid;
  grid-template-columns: repeat(6, minmax(110px, 1fr));
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #101a22;
}
.asset-variable-row label {
  min-width: 0;
}
.asset-variable-row input,
.asset-variable-row select {
  min-height: 38px;
}
.asset-variable-actions {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.asset-variable-actions .toggle-field,
.asset-variable-actions .secondary-button {
  width: auto;
}
.keeper-json-template {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #0c141a;
}
.keeper-json-template-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.keeper-json-template-head strong,
.keeper-json-template-head small {
  display: block;
}
.keeper-json-template-head strong {
  color: var(--text);
  font-size: 13px;
}
.keeper-json-template-head small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
}
.keeper-json-template pre {
  overflow: auto;
  max-height: 260px;
  margin: 0;
  padding: 12px;
  border: 1px solid #31434e;
  border-radius: 10px;
  background: #071016;
  color: #b9f8ef;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  line-height: 1.5;
  white-space: pre;
}
input, select, textarea { width: 100%; min-height: 42px; padding: 0 11px; border: 1px solid #31434e; border-radius: 8px; outline: none; background: #0c141a; color: var(--text); }
textarea { padding-top: 11px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--cyan); box-shadow: 0 0 0 3px #1f8f7e15; }
.register-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; margin-top: 19px; }
.register-grid fieldset:last-child { grid-column: span 2; grid-template-columns: repeat(4, 1fr); }
fieldset { margin: 0; padding: 17px; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; border: 1px solid var(--line); border-radius: 12px; }
legend { padding: 0 7px; color: var(--text); font-size: 12px; font-weight: 850; }
.dialog-actions { justify-content: flex-end; gap: 10px; flex-wrap: wrap; padding-top: 22px; }
.dialog-actions .secondary-button { width: auto; }
.form-error { padding: 12px; border-radius: 8px; color: #ffaaaa; background: #2a1718; font-size: 12px; }
.form-success { padding: 12px; border-radius: 8px; color: #99f3c1; background: #10221f; font-size: 12px; }

.admin-grid { display: grid; gap: 16px; }
.admin-customer-card { border: 1px solid var(--line); border-radius: 16px; padding: 18px; background: linear-gradient(145deg, #13202a 0%, #0f171f 100%); }
.admin-add-scale { width: auto; min-height: 34px; }
.admin-table { display: grid; gap: 8px; margin-top: 14px; }
.admin-users { display: grid; gap: 8px; margin-top: 14px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: #0d151c; }
.admin-users > strong { color: #c8d5db; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; }
.admin-user-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 8px; border-top: 1px solid var(--line); }
.admin-user-row span, .admin-user-row small { display: block; }
.admin-user-row small { margin-top: 3px; color: var(--muted); font-size: 11px; }
.admin-user-row .secondary-button { width: auto; min-height: 34px; }
.admin-table-head, .admin-table-row { display: grid; grid-template-columns: 1.4fr .9fr .5fr .8fr 1fr auto; gap: 12px; align-items: center; }
.admin-table-head { padding: 0 10px 6px; color: var(--muted); font-size: 10px; font-weight: 850; letter-spacing: .1em; text-transform: uppercase; }
.admin-table-row { min-height: 54px; padding: 10px; border: 1px solid var(--line); border-radius: 12px; background: #0d151c; }
.admin-table-row b, .admin-table-row small { display: block; }
.admin-table-row small { margin-top: 3px; color: var(--muted); font-size: 11px; }
.admin-table-row code { color: var(--cyan); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.admin-table-row .secondary-button { width: auto; min-height: 34px; }
.admin-row-actions { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.admin-empty-row { padding: 14px; border: 1px dashed var(--line); border-radius: 12px; color: var(--muted); font-size: 12px; }
.admin-status-badge { display: inline-block; width: fit-content; padding: 5px 8px; border-radius: 999px; font-size: 10px; font-style: normal; font-weight: 850; letter-spacing: .04em; }
.admin-status-badge.online { background: #173327; color: #85ebb8; }
.admin-status-badge.connected { background: #3a2d19; color: #ffd590; }
.admin-status-badge.offline { background: #361d1f; color: #ffaaaa; }
.system-health-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-top: 14px; }
.system-health-card { min-width: 0; padding: 16px; border: 1px solid var(--line); border-radius: 16px; background: #0d151c; }
.system-health-card.wide { grid-column: span 2; }
.system-health-card.ok { border-color: #2d5c49; background: #10221f; }
.system-health-card.danger { border-color: #633333; background: #2a1718; }
.system-health-card span { display: block; color: var(--muted); font-size: 10px; font-weight: 850; letter-spacing: .08em; text-transform: uppercase; }
.system-health-card strong { display: block; margin: 8px 0 5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: clamp(22px, 3vw, 32px); letter-spacing: -.06em; }
.system-health-card small { display: block; overflow-wrap: anywhere; color: var(--muted); font-size: 11px; line-height: 1.4; }
.health-alert { display: grid; gap: 4px; margin-top: 14px; padding: 13px 14px; border: 1px solid #633333; border-radius: 12px; background: #2a1718; color: #ffaaaa; }
.health-alert strong { font-size: 12px; }
.health-alert span { font-size: 11px; line-height: 1.45; }

.report-body { background: #e7edf1; color: #14202a; }
.report-page { width: min(1180px, 100%); margin: 0 auto; padding: 24px; }
.report-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 18px; padding: 18px; border: 1px solid #c9d3db; border-radius: 16px; background: #101820; color: var(--text); }
.report-sheet { min-height: 900px; padding: 34px; border: 1px solid #c8d2da; border-radius: 18px; background: #fff; box-shadow: 0 18px 60px #12202a22; }
.report-loading { padding: 22px; color: #65737e; }
.report-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; padding-bottom: 20px; border-bottom: 2px solid #17232d; }
.report-logo { display: block; width: 190px; max-width: 60vw; height: auto; margin: 0 0 16px; }
.report-header h2 { margin: 0; color: #101820; font-size: 30px; letter-spacing: -.04em; }
.report-header-side { display: grid; justify-items: end; gap: 8px; color: #61707b; font-size: 11px; font-weight: 800; }
.report-muted { margin: 8px 0 0; color: #61707b; }
.report-status { min-width: 130px; padding: 9px 12px; border-radius: 999px; background: #e8f5ee; color: #137144; text-align: center; font-size: 12px; font-weight: 900; letter-spacing: .08em; }
.report-status.pending { background: #fff2d8; color: #925d00; }
.report-status.rejected { background: #ffe1e1; color: #a83232; }
.report-status.draft { background: #e8eef3; color: #516270; }
.report-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-top: 18px; }
.report-card { break-inside: avoid; padding: 18px; border: 1px solid #d6e0e7; border-radius: 14px; background: #fbfdfe; }
.report-card h3 { margin: 0 0 14px; color: #101820; font-size: 16px; }
.report-list { display: grid; gap: 8px; margin: 0; }
.report-list div { display: grid; grid-template-columns: minmax(130px, .75fr) minmax(0, 1fr); gap: 12px; padding-bottom: 8px; border-bottom: 1px solid #e2e9ee; }
.report-list dt { color: #667580; font-size: 11px; font-weight: 800; text-transform: uppercase; }
.report-list dd { margin: 0; color: #182733; font-size: 12px; font-weight: 700; text-align: right; overflow-wrap: anywhere; }
.compact-report-list { margin-top: 12px; }
.report-checklist { display: grid; gap: 8px; }
.report-check-row { display: grid; grid-template-columns: 24px 1fr; gap: 9px; align-items: flex-start; padding: 9px; border: 1px solid #e0e8ee; border-radius: 10px; background: #fff; color: #42515d; font-size: 12px; line-height: 1.4; }
.report-check-row strong { display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: #eef3f6; color: #788793; font-size: 12px; }
.report-check-row.checked { border-color: #bce7d0; background: #f2fbf6; color: #172b22; }
.report-check-row.checked strong { background: #1c8f58; color: #fff; }
.report-notes { min-height: 80px; margin: 0; white-space: pre-wrap; color: #243541; font-size: 13px; line-height: 1.55; }
.report-signatures { display: grid; grid-template-columns: 1fr 1fr; gap: 48px; margin-top: 54px; }
.report-signatures span { display: block; height: 1px; margin-bottom: 10px; background: #17232d; }
.report-signatures strong { color: #243541; font-size: 12px; }
.report-signatures small { display: block; margin-top: 4px; color: #667580; font-size: 10px; }

/* Tema claro fixo MOSLE Connect */
:root {
  color-scheme: light;
  --bg: #f4f8fb;
  --surface: #ffffff;
  --surface-2: #edf4f7;
  --line: #d7e4eb;
  --text: #12202a;
  --muted: #617482;
  --cyan: #1f8f7e;
  --blue: #2478d4;
  --orange: #b96b00;
  --red: #c93434;
  --green: #38d0b5;
}

body {
  background: radial-gradient(circle at 74% -18%, #d9f7f4 0, transparent 34%), var(--bg);
  color: var(--text);
}

.topbar { border-bottom-color: var(--line); }
.brand h1,
.hero h2,
.panel h3,
.guide-card h4,
.dialog-header h2 { color: var(--text); }
.eyebrow,
.section-kicker { color: var(--cyan); }

.connection-pill {
  border-color: #bce5d2;
  background: #edfdf5;
  color: #106c41;
}
.connection-pill.offline {
  border-color: #f3c8c8;
  background: #fff1f1;
  color: #9f2626;
}
.connection-pill.stale {
  border-color: #f1d9ab;
  background: #fff7e8;
  color: #8c5600;
}

.icon-button,
.close-button,
.secondary-button {
  border-color: var(--line);
  background: #ffffff;
  color: var(--text);
}
.secondary-button:hover,
.icon-button:hover,
.close-button:hover { background: #eef6f8; }
.primary-button {
  background: var(--cyan);
  color: #ffffff;
}

.metric-card,
.panel,
.scale-card,
.oee-card,
.executive-card,
.system-health-card,
.asset-status-panel,
.asset-telemetry-card,
.admin-customer-card {
  border-color: var(--line);
  background: linear-gradient(145deg, #ffffff 0%, #f8fbfd 100%);
  box-shadow: 0 14px 34px #19313f14;
}
.system-health-card.ok {
  border-color: #bce5d2;
  background: linear-gradient(145deg, #f1fff8 0%, #ffffff 100%);
}
.system-health-card.danger,
.health-alert {
  border-color: #efc5c5;
  background: #fff0f0;
  color: #a32323;
}
.asset-telemetry-card span,
.asset-fault-state,
.asset-emergency-state { color: var(--text); }
.runtime-bar { background: #eef5f8; }
.scale-card.connected {
  border-color: #e6c98f;
  background: linear-gradient(145deg, #fff8eb 0%, #ffffff 100%);
}
.scale-card.offline {
  border-color: #efc5c5;
  background: linear-gradient(145deg, #fff2f2 0%, #ffffff 100%);
}
.scale-select-card.selected {
  border-color: var(--cyan);
  box-shadow: inset 0 0 0 1px #1f8f7e40, 0 14px 34px #19313f14;
}
.scale-select-card:hover { border-color: #63bbb6; }
.scale-card-head em {
  background: #e8f8f0;
  color: #38d0b5;
}
.scale-card.connected .scale-card-head em {
  background: #fff0cf;
  color: #8c5600;
}
.scale-card.offline .scale-card-head em {
  background: #ffe5e5;
  color: #b12b2b;
}
.scale-error { color: #b12b2b; }
.scale-ok,
.ok-text,
.live-badge { color: var(--green); }
.warning-text { color: var(--orange); }

.card-heading p,
.admin-users > strong {
  color: #314755;
}
.metric-footer,
.scale-card-values div,
.diagnostic-list div,
.config-list div,
.record-history,
.admin-user-row {
  border-color: var(--line);
}
.flow-icon { color: var(--cyan); background: #e6f8f6; }
.total-icon { color: var(--blue); background: #eaf3ff; }
.range-chip {
  border-color: #bce5e1;
  background: #f0fbfa;
  color: var(--cyan);
}

.guide-card,
.record-row,
.stop-event-active,
.quality-summary div,
.admin-users,
.admin-table-row,
.check-row {
  border-color: var(--line);
  background: #ffffff;
  color: var(--text);
}
.record-row.selected {
  border-color: var(--cyan);
  background: #effbf9;
}
.stop-event-active.active-stop {
  border-color: #f1d9ab;
  background: #fff7e8;
  color: #7a4b00;
}
.stop-event-active.active-stop span { color: #8c5600; }
.stop-event-pending-notice { border-color: #f1d9ab; background: #fff7e8; color: #7a4b00; }
.check-row:has(input:checked) {
  border-color: #bce5d2;
  background: #edfdf5;
  color: #173c2b;
}

dialog {
  border-color: #c8dae3;
  background: #ffffff;
  color: var(--text);
  box-shadow: 0 30px 100px #0f24364a;
}
dialog::backdrop {
  background: #10202b85;
  backdrop-filter: blur(6px);
}
label { color: #536875; }
input,
select,
textarea,
.toggle-field {
  border-color: #c9d9e2;
  background: #ffffff;
  color: var(--text);
}
.asset-telemetry-fieldset {
  border-color: var(--line);
}
.asset-telemetry-fieldset .toggle-field {
  border-color: #c9d9e2;
  background: #ffffff;
}
input:focus,
select:focus,
textarea:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px #1f8f7e20;
}

.warning-banner {
  border-color: #e8cd94;
  background: #fff8e9;
  color: #7b5000;
}
.error-box,
.form-error {
  border-color: #efc5c5;
  background: #fff0f0;
  color: #a32323;
}
.form-success {
  background: #eaf9f1;
  color: #116b41;
}
.admin-status-badge.online { background: #e8f8f0; color: #38d0b5; }
.admin-status-badge.connected { background: #fff0cf; color: #8c5600; }
.admin-status-badge.offline { background: #ffe5e5; color: #b12b2b; }

.report-toolbar {
  border-color: var(--line);
  background: #ffffff;
  color: var(--text);
}

@media (min-width: 1800px) {
  .app-shell { width: min(1920px, 100%); }
  .client-layout.logged-in {
    grid-template-columns: 280px minmax(0, 1fr);
    gap: 32px;
  }
  .client-sidebar { padding: 20px; }
  .scale-summary { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .metric-card { min-height: 300px; }
  .asset-telemetry-card { min-height: 220px; padding: 36px; }
  .asset-telemetry-card strong { font-size: clamp(40px, 3vw, 60px); }
  .chart-wrap { height: 360px; }
}

@media (max-width: 1500px) {
  .client-layout.logged-in {
    grid-template-columns: minmax(204px, 220px) minmax(0, 1fr);
    gap: 18px;
  }
  .client-sidebar { padding: 14px; }
  .client-nav-button { padding: 12px 10px; }
  .scale-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .asset-dashboard { grid-template-columns: 1fr; }
  .asset-status-panel { min-height: auto; }
  .executive-grid,
  .oee-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 1180px) {
  .client-layout.logged-in { display: block; }
  .client-sidebar {
    position: static;
    margin: 18px 0 0;
    padding: 12px;
  }
  .client-sidebar-title { display: none; }
  .client-nav {
    display: flex;
    gap: 8px;
    margin-top: 0;
    overflow-x: auto;
    padding-bottom: 4px;
    scrollbar-width: thin;
  }
  .client-nav-button {
    flex: 0 0 178px;
    min-height: 66px;
  }
  .content-grid,
  .executive-lists { grid-template-columns: 1fr; }
  .metrics-grid,
  .guided-grid,
  .report-grid { grid-template-columns: 1fr; }
  .system-health-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 850px) {
  .app-shell { padding: 0 18px 30px; }
  .client-layout.logged-in { display: block; }
  .client-sidebar {
    position: static;
    margin: 18px 0 0;
    padding: 12px;
  }
  .client-sidebar-title { display: none; }
  .client-nav {
    display: flex;
    gap: 8px;
    margin-top: 0;
    overflow-x: auto;
    padding-bottom: 4px;
  }
  .client-nav-button {
    flex: 0 0 168px;
    min-height: 66px;
  }
  .hero { align-items: flex-start; flex-direction: column; padding-top: 34px; }
  .last-update { text-align: left; }
  .metrics-grid, .asset-dashboard, .content-grid, .scale-summary, .guided-grid, .report-grid, .executive-lists { grid-template-columns: 1fr; }
  .asset-telemetry-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .runtime-legend { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .oee-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .executive-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .system-health-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-grid { grid-template-columns: 1fr 1fr; }
  .asset-edit-dialog .form-grid { grid-template-columns: 1fr 1fr; }
  .form-grid .wide { grid-column: span 2; }
  .sensor-scale-grid { grid-template-columns: 1fr 1fr; }
  .sensor-scale-grid strong { display: none; }
  .sensor-scale-grid span { grid-column: span 2; margin-top: 10px; }
  .asset-variable-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .asset-edit-dialog .asset-variable-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 560px) {
  .topbar {
    height: auto;
    min-height: 80px;
    padding: 16px 0;
    align-items: flex-start;
    flex-direction: column;
    gap: 14px;
  }
  .top-actions {
    width: 100%;
    justify-content: flex-start;
  }
  .top-actions .secondary-button {
    flex: 1 1 120px;
  }
  .brand { gap: 10px; }
  .brand-logo { width: 104px; max-width: 38vw; }
  .brand .eyebrow { display: none; }
  .brand h1 { font-size: 15px; }
  .connection-pill {
    justify-content: center;
    min-width: auto;
    flex: 1 1 100%;
  }
  .account-menu-panel {
    left: 0;
    right: auto;
    width: min(220px, calc(100vw - 48px));
  }
  .quality-summary { grid-template-columns: 1fr; }
  .metric-card { min-height: 230px; padding: 21px; }
  .asset-telemetry-grid { grid-template-columns: 1fr; }
  .asset-status-panel { min-height: auto; }
  .runtime-legend { grid-template-columns: 1fr; }
  .oee-grid { grid-template-columns: 1fr; }
  .executive-grid { grid-template-columns: 1fr; }
  .system-health-grid { grid-template-columns: 1fr; }
  .system-health-card.wide { grid-column: auto; }
  .scale-card-values { grid-template-columns: 1fr; }
  .admin-table-head { display: none; }
  .admin-table-row { grid-template-columns: 1fr; }
  .form-grid, .register-grid, fieldset, .register-grid fieldset:last-child, .sensor-scale-grid, .asset-variable-row { grid-template-columns: 1fr; }
  .asset-edit-dialog .form-grid,
  .asset-edit-dialog .asset-variable-row { grid-template-columns: 1fr; }
  .record-row, .record-actions { align-items: stretch; flex-direction: column; }
  .register-grid fieldset:last-child { grid-column: auto; }
  .form-grid .wide, .sensor-scale-grid span { grid-column: auto; }
}

@media (max-width: 380px) {
  .app-shell { padding: 0 12px 26px; }
  .brand-logo { width: 94px; }
  .brand h1 { font-size: 14px; }
  .hero h2 { font-size: 30px; }
  .panel,
  .metric-card,
  .scale-card,
  .asset-status-panel,
  .asset-telemetry-card { border-radius: 14px; }
  .metric-value strong { font-size: 40px; }
  .asset-telemetry-card { padding: 22px; }
  .asset-telemetry-card strong { font-size: 34px; }
}

@media print {
  @page { size: A4; margin: 12mm; }
  body { background: #fff !important; }
  .no-print { display: none !important; }
  .report-page { width: 100%; padding: 0; }
  .report-sheet { min-height: auto; padding: 0; border: 0; border-radius: 0; box-shadow: none; }
  .report-grid { grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
  .report-card { padding: 12px; }
  .report-header h2 { font-size: 24px; }
  .report-list div { grid-template-columns: .8fr 1fr; }
  .report-check-row { padding: 7px; font-size: 10.5px; }
  .report-signatures { margin-top: 36px; }
}
