:root {
  color-scheme: dark;
  --bg: #060b14;
  --bg-soft: #0b1220;
  --panel: rgba(15, 25, 43, 0.86);
  --panel-strong: rgba(18, 29, 50, 0.96);
  --text: #f5f7fb;
  --muted: #9aa7bd;
  --line: rgba(132, 153, 188, 0.18);
  --accent: #5a4bff;
  --accent-strong: #776bff;
  --cyan: #1e9bff;
  --green: #22d48f;
  --red: #ff4e5f;
  --warning: #f5a524;
  --shadow: 0 22px 70px rgba(0, 0, 0, 0.34);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 74% 8%, rgba(80, 70, 255, 0.28), transparent 18rem),
    radial-gradient(circle at 20% 0%, rgba(0, 140, 255, 0.16), transparent 19rem),
    linear-gradient(135deg, #050914 0%, #07101d 44%, #050914 100%);
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
}

body::before {
  position: fixed;
  inset: 0;
  pointer-events: none;
  content: "";
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.028) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.028) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(circle at 70% 12%, #000 0, transparent 42%);
}

button,
input,
select {
  font: inherit;
}

button {
  min-height: 42px;
  border: 1px solid rgba(119, 107, 255, 0.36);
  border-radius: 8px;
  background: linear-gradient(135deg, #5147ff, #2d35d9);
  box-shadow: 0 10px 24px rgba(80, 70, 255, 0.23);
  color: #fff;
  cursor: pointer;
  font-weight: 800;
  padding: 0 14px;
}

button:hover {
  border-color: rgba(146, 139, 255, 0.72);
  filter: brightness(1.08);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

button.secondary {
  background: rgba(17, 27, 46, 0.86);
  box-shadow: none;
  color: #cfd7ff;
}

button.danger {
  border-color: rgba(255, 78, 95, 0.36);
  background: rgba(255, 78, 95, 0.12);
  box-shadow: none;
  color: #ff9aa4;
}

button.warning {
  border-color: rgba(245, 165, 36, 0.32);
  background: rgba(245, 165, 36, 0.12);
  box-shadow: none;
  color: #ffd28a;
}

input,
select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(9, 17, 31, 0.96);
  color: var(--text);
  padding: 0 12px;
  outline: 0;
}

input:focus,
select:focus {
  border-color: rgba(119, 107, 255, 0.72);
  box-shadow: 0 0 0 3px rgba(90, 75, 255, 0.18);
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.hidden {
  display: none !important;
}

.login-view {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
}

.login-panel {
  width: min(440px, 100%);
  border: 1px solid var(--line);
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(16, 27, 47, 0.96), rgba(8, 15, 28, 0.96));
  box-shadow: var(--shadow);
  padding: 30px;
}

.login-logo {
  display: block;
  width: 164px;
  height: auto;
  margin-bottom: 28px;
}

.login-panel h1,
.topbar h2 {
  margin: 0;
}

.eyebrow {
  margin: 0 0 9px;
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 2px;
  text-transform: uppercase;
}

.stack {
  display: grid;
  gap: 16px;
  margin-top: 24px;
}

.dashboard {
  display: grid;
  min-height: 100vh;
  grid-template-columns: 274px minmax(0, 1fr);
}

.sidebar {
  display: flex;
  min-height: 100vh;
  flex-direction: column;
  justify-content: space-between;
  border-right: 1px solid var(--line);
  background: rgba(5, 12, 23, 0.82);
  box-shadow: inset -1px 0 0 rgba(255, 255, 255, 0.03);
  padding: 0 18px 22px;
  backdrop-filter: blur(18px);
}

.brand {
  display: grid;
  height: 116px;
  place-items: center start;
  border-bottom: 1px solid var(--line);
}

.brand img {
  width: 194px;
  height: auto;
}

.tabs {
  display: grid;
  gap: 8px;
  margin: 22px 0;
}

.tab {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  border-color: transparent;
  background: transparent;
  box-shadow: none;
  color: #b6c0d4;
  text-align: left;
}

.tab span {
  display: inline-grid;
  width: 26px;
  place-items: center;
  color: #c6ccff;
  font-weight: 900;
}

.tab:hover,
.tab.active {
  border-color: rgba(119, 107, 255, 0.42);
  background: linear-gradient(90deg, rgba(82, 71, 255, 0.72), rgba(82, 71, 255, 0.18));
  box-shadow: 0 14px 34px rgba(83, 71, 255, 0.24);
  color: #fff;
}

.session-box {
  display: grid;
  gap: 12px;
  color: var(--muted);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.system-card {
  display: grid;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(14, 24, 42, 0.82);
  padding: 13px 14px;
}

.system-card span {
  color: #c5ccdb;
  font-weight: 800;
}

.system-card strong {
  color: var(--green);
}

.content {
  min-width: 0;
  padding: 34px 34px 56px;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
}

.topbar h2 {
  font-size: 42px;
  line-height: 1.08;
}

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

.clock-card {
  min-width: 184px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(10, 18, 32, 0.72);
  color: #cbd3e5;
  padding: 12px 16px;
  text-align: right;
}

.status {
  min-height: 24px;
  color: var(--muted);
  font-size: 14px;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(17, 28, 48, 0.86), rgba(10, 18, 32, 0.88));
  box-shadow: var(--shadow);
  padding: 18px;
}

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

.metric {
  display: grid;
  min-height: 132px;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(30, 43, 72, 0.86), rgba(15, 24, 42, 0.82));
  padding: 18px;
}

.metric-icon {
  display: grid;
  width: 64px;
  height: 64px;
  place-items: center;
  border-radius: 16px;
  font-size: 26px;
  font-weight: 900;
}

.metric-icon.purple {
  background: rgba(90, 75, 255, 0.22);
  color: #9188ff;
}

.metric-icon.blue {
  background: rgba(30, 155, 255, 0.18);
  color: #62bcff;
}

.metric-icon.green {
  background: rgba(34, 212, 143, 0.16);
  color: #4ce8aa;
}

.metric-icon.red {
  background: rgba(255, 78, 95, 0.16);
  color: #ff7886;
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.metric strong {
  display: block;
  margin-top: 8px;
  font-size: 32px;
}

.footer-card {
  display: grid;
  gap: 7px;
  margin-top: 28px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(13, 22, 38, 0.72);
  padding: 20px;
}

.footer-card strong {
  color: #8178ff;
}

.footer-card span {
  color: var(--muted);
}

.form-row,
.form-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  margin-bottom: 16px;
}

.form-grid {
  grid-template-columns: minmax(180px, 260px) minmax(180px, 1fr) minmax(150px, 220px) auto;
}

.form-grid.three {
  grid-template-columns: minmax(180px, 1fr) minmax(180px, 1fr) auto;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  min-width: 780px;
  border-collapse: collapse;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 14px 11px;
  text-align: left;
  vertical-align: middle;
}

th {
  color: #a7b1c4;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

td {
  color: #dde5f5;
  font-size: 14px;
}

tbody tr:hover {
  background: rgba(119, 107, 255, 0.06);
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 7px;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 900;
}

.badge.ok {
  background: rgba(34, 212, 143, 0.12);
  color: #4ce8aa;
}

.badge.off {
  background: rgba(154, 167, 189, 0.12);
  color: #b5c0d4;
}

.badge.warn {
  background: rgba(245, 165, 36, 0.13);
  color: #ffd28a;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.mono {
  font-family: Consolas, "Courier New", monospace;
  overflow-wrap: anywhere;
}

@media (max-width: 1080px) {
  .dashboard {
    grid-template-columns: 1fr;
  }

  .sidebar {
    min-height: 0;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .brand {
    height: 96px;
  }

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

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

  .topbar {
    flex-direction: column;
  }
}

@media (max-width: 720px) {
  .content {
    padding: 22px 14px 40px;
  }

  .topbar h2 {
    font-size: 32px;
  }

  .tabs,
  .metrics,
  .form-row,
  .form-grid,
  .form-grid.three,
  .top-actions {
    grid-template-columns: 1fr;
  }

  .top-actions {
    display: grid;
    width: 100%;
  }

  .clock-card {
    text-align: left;
  }
}
