:root {
  color-scheme: dark;
  --bg: #071013;
  --bg-2: #0d191f;
  --panel: rgba(13, 25, 31, 0.78);
  --panel-strong: rgba(18, 34, 42, 0.94);
  --text: #eef6f5;
  --muted: #9fb5b4;
  --subtle: #6f8586;
  --line: rgba(159, 181, 180, 0.18);
  --accent: #6be49f;
  --accent-2: #58c7ff;
  --accent-3: #f4cf6a;
  --danger: #ff6f7a;
  --ok: #69e89b;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.34);
  --radius: 28px;
  --radius-sm: 16px;
  --font: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 20% 0%, rgba(88, 199, 255, 0.16), transparent 30%),
    radial-gradient(circle at 92% 12%, rgba(107, 228, 159, 0.14), transparent 24%),
    linear-gradient(135deg, #071013 0%, #0b171b 45%, #0f1514 100%);
  font-family: var(--font);
  overflow-x: hidden;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

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

.is-hidden {
  display: none !important;
}

.ambient {
  position: fixed;
  inset: auto;
  width: 520px;
  height: 520px;
  border-radius: 50%;
  filter: blur(44px);
  opacity: 0.22;
  pointer-events: none;
  z-index: -1;
}

.ambient-a {
  left: -160px;
  top: 140px;
  background: #58c7ff;
}

.ambient-b {
  right: -180px;
  bottom: 40px;
  background: #6be49f;
}

.glass-panel {
  border: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.015)),
    var(--panel);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
}

.login-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(320px, 620px);
  gap: 28px;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
}

.login-card,
.login-visual {
  border-radius: var(--radius);
  padding: clamp(24px, 4vw, 46px);
}

.login-card {
  width: 100%;
}

.brand-logo {
  display: block;
  max-width: 100%;
  height: auto;
}

.login-logo-panel {
  width: min(360px, 100%);
  margin-bottom: 24px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.94);
  padding: 18px 22px;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.22);
}

.login-logo {
  width: 100%;
}

.login-title {
  max-width: 520px;
  margin: 18px 0 14px;
  font-size: clamp(38px, 6vw, 62px);
  line-height: 0.98;
  letter-spacing: -0.06em;
}

.topbar-logo-frame {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 96px;
  height: 42px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.94);
  padding: 7px 9px;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.18);
}

.topbar-logo {
  width: 100%;
}

.brand-row,
.brand-mini {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-row h1 {
  margin: 0;
  font-size: clamp(26px, 4vw, 38px);
  letter-spacing: -0.045em;
}

.mark {
  display: inline-grid;
  place-items: center;
  width: 54px;
  height: 54px;
  border-radius: 18px;
  color: #06120f;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  font-weight: 900;
  letter-spacing: -0.08em;
  box-shadow: 0 18px 45px rgba(107, 228, 159, 0.23);
}

.mark.small {
  width: 38px;
  height: 38px;
  border-radius: 13px;
  font-size: 18px;
}

.eyebrow,
.hero-kicker {
  margin: 0 0 10px;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.login-card h2,
.login-title,
.hero-copy h1 {
  margin: 18px 0 14px;
  line-height: 0.98;
  letter-spacing: -0.06em;
}

.login-card h2 {
  max-width: 520px;
  font-size: clamp(38px, 6vw, 62px);
}

.hero-copy h1 {
  max-width: 780px;
  font-size: clamp(40px, 7vw, 82px);
}

.login-card p,
.hero-copy p,
.section-heading p,
.section-card p,
.footer {
  color: var(--muted);
  line-height: 1.65;
}

.muted {
  max-width: 54ch;
}

.login-form {
  display: grid;
  gap: 16px;
  margin-top: 30px;
}

.login-form label,
.toolbar label,
.search-box {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 700;
}

.login-form input,
.toolbar input,
.toolbar select {
  min-height: 46px;
  width: 100%;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.045);
  padding: 0 14px;
  outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.login-form input:focus,
.toolbar input:focus,
.toolbar select:focus {
  border-color: rgba(107, 228, 159, 0.78);
  box-shadow: 0 0 0 4px rgba(107, 228, 159, 0.12);
  background: rgba(255, 255, 255, 0.07);
}

.primary-btn,
.ghost-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  border-radius: 999px;
  border: 0;
  padding: 0 20px;
  font-weight: 850;
  transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease, opacity 0.18s ease;
}

.primary-btn {
  color: #06120f;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 18px 45px rgba(107, 228, 159, 0.21);
}

.primary-btn.compact {
  min-height: 42px;
}

.ghost-btn {
  color: var(--text);
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid var(--line);
}

.primary-btn:hover,
.ghost-btn:hover {
  transform: translateY(-1px);
}

.login-error {
  min-height: 22px;
  margin: 0;
  color: var(--danger) !important;
  font-weight: 750;
}

.credential-note {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-top: 20px;
  color: var(--muted);
  font-size: 0.82rem;
}

.credential-note strong,
.credential-note code {
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.045);
  padding: 6px 10px;
}

.login-visual {
  min-height: 520px;
  display: grid;
  align-content: end;
  gap: 22px;
  overflow: hidden;
  position: relative;
}

.login-visual::before {
  content: "";
  position: absolute;
  inset: 28px;
  border-radius: 24px;
  background:
    linear-gradient(90deg, rgba(255,255,255,0.08) 1px, transparent 1px),
    linear-gradient(0deg, rgba(255,255,255,0.08) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(circle, #000 0%, transparent 70%);
  opacity: 0.28;
}

.circuit-card {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(0, 0, 0, 0.16);
}

.node {
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-weight: 850;
}

.node.active {
  color: #06120f;
  background: var(--accent);
}

.line {
  flex: 1;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
}

.login-stat-grid,
.metric-grid,
.detail-grid,
.info-grid {
  display: grid;
  gap: 16px;
}

.login-stat-grid {
  position: relative;
  z-index: 1;
  grid-template-columns: repeat(3, 1fr);
}

.login-stat-grid article,
.metric-card,
.mini-card {
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.04);
  padding: 18px;
}

.login-stat-grid span,
.metric-card span,
.mini-card span {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.login-stat-grid strong,
.metric-card strong,
.mini-card strong {
  display: block;
  margin-top: 8px;
  font-size: clamp(19px, 2vw, 28px);
  letter-spacing: -0.04em;
}

.app-shell {
  width: min(1500px, calc(100% - 36px));
  margin: 0 auto;
  padding: 20px 0 54px;
}

.topbar {
  position: sticky;
  top: 14px;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: rgba(7, 16, 19, 0.78);
  backdrop-filter: blur(20px);
  padding: 12px 14px;
  box-shadow: 0 22px 70px rgba(0, 0, 0, 0.24);
}

.brand-mini {
  color: var(--text);
  text-decoration: none;
}

.brand-mini strong,
.brand-mini small {
  display: block;
}

.brand-mini small {
  color: var(--muted);
  margin-top: 1px;
}

.topnav {
  display: flex;
  align-items: center;
  gap: 8px;
}

.topnav a {
  color: var(--muted);
  border-radius: 999px;
  padding: 10px 14px;
  text-decoration: none;
  font-weight: 750;
}

.topnav a:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.045);
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.clock-badge {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 12px;
  font-size: 0.85rem;
  font-weight: 800;
  white-space: nowrap;
}

.hero-section {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 22px;
  align-items: end;
  padding: 76px 4px 28px;
}

.hero-copy p:not(.hero-kicker) {
  max-width: 720px;
  margin: 0;
  font-size: clamp(1rem, 1.4vw, 1.18rem);
}

.hero-panel {
  border-radius: var(--radius);
  padding: 26px;
}

.status-dot {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 0 9px rgba(105, 232, 155, 0.12);
}

.hero-panel p {
  margin: 20px 0 6px;
  color: var(--muted);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.78rem;
}

.hero-panel strong {
  display: block;
  font-size: 2rem;
  line-height: 1.05;
  letter-spacing: -0.05em;
}

.hero-panel small {
  display: block;
  color: var(--muted);
  margin-top: 12px;
}

.metric-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 22px;
}

.metric-card {
  min-height: 142px;
}

.metric-card small {
  display: block;
  color: var(--subtle);
  margin-top: 8px;
}

.section-card {
  border-radius: var(--radius);
  padding: clamp(20px, 3vw, 30px);
  margin-top: 22px;
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 22px;
  margin-bottom: 20px;
}

.section-heading h2,
.section-card h2,
.detail-header h2 {
  margin: 0;
  font-size: clamp(26px, 3vw, 42px);
  letter-spacing: -0.055em;
}

.section-heading p,
.section-card p,
.detail-header p {
  margin: 8px 0 0;
}

.toolbar {
  display: grid;
  grid-template-columns: 210px 180px 150px 150px auto auto;
  gap: 10px;
  align-items: end;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(2, 8, 10, 0.27);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 1180px;
}

.data-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  color: var(--muted);
  background: rgba(14, 26, 32, 0.96);
  border-bottom: 1px solid var(--line);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-align: left;
  text-transform: uppercase;
}

.data-table th,
.data-table td {
  padding: 15px 14px;
  white-space: nowrap;
}

.data-table tbody tr {
  border-bottom: 1px solid rgba(159, 181, 180, 0.1);
  transition: background 0.18s ease;
}

.data-table tbody tr:hover,
.data-table tbody tr.selected {
  background: rgba(107, 228, 159, 0.065);
}

.data-table tbody tr {
  cursor: pointer;
}

.data-table tbody td {
  color: #dce9e7;
  font-size: 0.92rem;
}

.date-cell strong,
.machine-cell strong {
  display: block;
}

.date-cell span,
.machine-cell span {
  display: block;
  margin-top: 4px;
  color: var(--subtle);
  font-size: 0.8rem;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border-radius: 999px;
  border: 1px solid rgba(107, 228, 159, 0.25);
  color: var(--accent);
  background: rgba(107, 228, 159, 0.08);
  padding: 6px 10px;
  font-weight: 850;
}

.pill::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: currentColor;
}

.diag-ok {
  color: var(--ok);
  font-weight: 900;
}

.detail-btn {
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255,255,255,0.05);
  padding: 8px 12px;
  font-weight: 800;
}

.empty-state {
  margin: 18px 0 0;
  padding: 18px;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: 16px;
}

.detail-panel {
  scroll-margin-top: 110px;
}

.detail-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.detail-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 18px;
}

.chart-card {
  border: 1px solid var(--line);
  border-radius: 22px;
  background: rgba(2, 8, 10, 0.25);
  padding: 16px;
  margin-bottom: 18px;
}

.chart-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  color: var(--muted);
  margin-bottom: 10px;
}

.chart-heading span {
  color: var(--text);
  font-weight: 850;
}

#tempChart {
  display: block;
  width: 100%;
  height: 220px;
}

.chart-grid-line {
  stroke: rgba(159, 181, 180, 0.15);
  stroke-width: 1;
}

.chart-line {
  fill: none;
  stroke: url(#tempGradient);
  stroke-width: 4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.chart-area {
  fill: url(#areaGradient);
  opacity: 0.65;
}

.chart-point {
  fill: var(--bg);
  stroke: var(--accent);
  stroke-width: 3;
}

.chart-label,
.chart-temp-label {
  fill: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.compact-table {
  min-width: 980px;
}

.compact-table th,
.compact-table td {
  padding: 12px 12px;
}

.info-grid {
  grid-template-columns: 1fr 1fr;
}

.legend-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.legend-item {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 12px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.035);
  font-weight: 800;
}

.rule-list {
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 10px;
}

.rule-list li {
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px;
  background: rgba(255,255,255,0.035);
}

.footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
  padding: 28px 6px 0;
  font-size: 0.9rem;
}

@media (max-width: 1180px) {
  .login-shell,
  .hero-section,
  .info-grid {
    grid-template-columns: 1fr;
  }

  .login-visual {
    min-height: 340px;
  }

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

  .section-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .toolbar {
    grid-template-columns: repeat(3, minmax(150px, 1fr));
  }
}

@media (max-width: 760px) {
  .app-shell {
    width: min(100% - 22px, 1500px);
  }

  .topbar {
    align-items: stretch;
    flex-direction: column;
  }

  .topnav,
  .top-actions {
    justify-content: space-between;
    overflow-x: auto;
  }

  .metric-grid,
  .detail-grid,
  .toolbar,
  .login-stat-grid {
    grid-template-columns: 1fr;
  }

  .hero-section {
    padding-top: 42px;
  }

  .login-shell {
    padding: 18px 12px;
  }

  .login-card,
  .login-visual,
  .section-card {
    border-radius: 20px;
  }
}
