:root {
  color-scheme: dark;
  --bg: #07131a;
  --bg-soft: #0d1d25;
  --panel: rgba(10, 23, 31, 0.82);
  --panel-strong: rgba(8, 18, 25, 0.94);
  --panel-muted: rgba(16, 34, 44, 0.92);
  --line: rgba(158, 197, 212, 0.14);
  --line-strong: rgba(158, 197, 212, 0.24);
  --text: #ecf7fb;
  --muted: #8fa7b3;
  --muted-strong: #a9c1cc;
  --accent: #37d0c9;
  --accent-2: #5eead4;
  --accent-warm: #f59e0b;
  --danger: #ff6b7c;
  --success: #34d399;
  --shadow: 0 28px 80px rgba(0, 0, 0, 0.34);
  --radius: 24px;
  --radius-sm: 16px;
  --font-ui: "IBM Plex Sans", ui-sans-serif, sans-serif;
  --font-display: "Sora", ui-sans-serif, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  font-family: var(--font-ui);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

a {
  color: inherit;
}

.backdrop {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: -1;
}

.aurora {
  position: absolute;
  border-radius: 999px;
  filter: blur(80px);
  opacity: 0.6;
}

.aurora-a {
  width: 42rem;
  height: 42rem;
  top: -10rem;
  left: -10rem;
  background: radial-gradient(circle, rgba(55, 208, 201, 0.36), transparent 68%);
}

.aurora-b {
  width: 30rem;
  height: 30rem;
  top: 8rem;
  right: -8rem;
  background: radial-gradient(circle, rgba(16, 185, 129, 0.24), transparent 70%);
}

.aurora-c {
  width: 34rem;
  height: 34rem;
  bottom: -12rem;
  left: 30%;
  background: radial-gradient(circle, rgba(245, 158, 11, 0.16), transparent 70%);
}

.grid-noise {
  position: absolute;
  inset: 0;
  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: 42px 42px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.5), transparent 88%);
}

.app-shell {
  width: min(1480px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 24px 0 64px;
}

.surface {
  background: linear-gradient(180deg, rgba(15, 32, 41, 0.92), rgba(7, 18, 25, 0.88));
  border: 1px solid var(--line);
  backdrop-filter: blur(20px) saturate(140%);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
  box-shadow: var(--shadow);
}

.hero {
  position: relative;
  overflow: hidden;
  padding: 28px;
  border-radius: 32px;
}

.hero::after {
  content: "";
  position: absolute;
  inset: auto -10% -45% auto;
  width: 28rem;
  height: 28rem;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(55, 208, 201, 0.18), transparent 68%);
}

.hero-top {
  display: flex;
  gap: 18px;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(55, 208, 201, 0.12);
  border: 1px solid rgba(55, 208, 201, 0.2);
  color: var(--accent-2);
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-weight: 700;
}

.hero h1,
.login-card h1 {
  font-family: var(--font-display);
  font-size: clamp(2rem, 5vw, 3.7rem);
  line-height: 1.02;
  margin: 14px 0 12px;
  letter-spacing: -0.04em;
  max-width: 10ch;
}

.lead {
  max-width: 60rem;
  color: var(--muted-strong);
  line-height: 1.65;
  font-size: 1.02rem;
}

.hero-actions,
.inline-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
}

.hero-grid {
  margin-top: 24px;
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.hero-stat {
  padding: 18px;
  border-radius: 22px;
  background: rgba(8, 19, 25, 0.58);
  border: 1px solid rgba(158, 197, 212, 0.12);
}

.hero-stat-label {
  color: var(--muted);
  font-size: 0.86rem;
}

.hero-stat-value {
  margin-top: 8px;
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 700;
}

.topbar {
  display: grid;
  gap: 16px;
  grid-template-columns: minmax(260px, 1.3fr) minmax(220px, 0.9fr) auto;
  margin-top: 18px;
}

.field {
  display: grid;
  gap: 8px;
}

.field label {
  font-size: 0.85rem;
  color: var(--muted);
  font-weight: 600;
}

.text-input,
.select-input,
.text-area {
  width: 100%;
  border: 1px solid var(--line);
  background: rgba(7, 18, 25, 0.9);
  border-radius: 16px;
  color: var(--text);
  padding: 13px 14px;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.text-input:focus,
.select-input:focus,
.text-area:focus {
  outline: none;
  border-color: rgba(55, 208, 201, 0.55);
  box-shadow: 0 0 0 4px rgba(55, 208, 201, 0.12);
}

.text-area {
  min-height: 120px;
  resize: vertical;
}

.button,
.ghost-button,
.danger-button {
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 12px 18px;
  font-weight: 700;
  letter-spacing: 0.01em;
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease, opacity 160ms ease;
}

.button:active,
.ghost-button:active,
.danger-button:active {
  transform: translateY(1px);
}

.button:disabled,
.ghost-button:disabled,
.danger-button:disabled {
  opacity: 0.56;
  cursor: not-allowed;
}

.button {
  background: linear-gradient(135deg, var(--accent), #1fb6ae);
  color: #072126;
  box-shadow: 0 16px 36px rgba(55, 208, 201, 0.22);
}

.ghost-button {
  background: rgba(255, 255, 255, 0.02);
  color: var(--text);
  border-color: var(--line);
}

.danger-button {
  background: rgba(255, 107, 124, 0.13);
  color: #ffc0c9;
  border-color: rgba(255, 107, 124, 0.22);
}

.section {
  margin-top: 22px;
  padding: 22px;
  border-radius: 30px;
}

.section-head {
  display: flex;
  gap: 16px;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.section-head h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.4rem;
  letter-spacing: -0.03em;
}

.section-head p {
  margin: 6px 0 0;
  color: var(--muted);
  max-width: 48rem;
}

.pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line);
  color: var(--muted-strong);
  font-size: 0.9rem;
}

.kpi-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.kpi-card {
  padding: 18px;
  border-radius: 22px;
  background: rgba(8, 19, 25, 0.72);
  border: 1px solid var(--line);
}

.kpi-card strong {
  display: block;
  font-family: var(--font-display);
  font-size: 2rem;
  margin-top: 10px;
}

.kpi-label {
  color: var(--muted);
  font-size: 0.9rem;
}

.dashboard-grid {
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(0, 1.4fr) minmax(320px, 0.8fr);
}

.panel-grid {
  display: grid;
  gap: 14px;
}

.health-card,
.alert-card,
.audit-item,
.empty-card {
  padding: 18px;
  border-radius: 22px;
  background: rgba(8, 19, 25, 0.72);
  border: 1px solid var(--line);
}

.health-card h3,
.subpanel h3 {
  margin: 0 0 8px;
  font-size: 1rem;
}

.mini-meta {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: 999px;
  padding: 7px 11px;
  border: 1px solid transparent;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.badge-ok {
  background: rgba(52, 211, 153, 0.12);
  color: #9cf1d0;
  border-color: rgba(52, 211, 153, 0.22);
}

.badge-warn {
  background: rgba(245, 158, 11, 0.12);
  color: #ffd180;
  border-color: rgba(245, 158, 11, 0.22);
}

.badge-error {
  background: rgba(255, 107, 124, 0.12);
  color: #ffc0c9;
  border-color: rgba(255, 107, 124, 0.22);
}

.badge-neutral {
  background: rgba(143, 167, 179, 0.12);
  color: #d2dfe6;
  border-color: rgba(143, 167, 179, 0.18);
}

.table-shell {
  overflow: auto;
  border-radius: 22px;
  border: 1px solid var(--line);
  background: rgba(8, 19, 25, 0.76);
}

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

th,
td {
  text-align: left;
  padding: 14px 14px;
  border-bottom: 1px solid rgba(158, 197, 212, 0.1);
  vertical-align: top;
}

th {
  font-size: 0.78rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

tbody tr:hover {
  background: rgba(255, 255, 255, 0.02);
}

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.stack-sm {
  display: grid;
  gap: 5px;
}

.muted {
  color: var(--muted);
}

.small {
  font-size: 0.85rem;
}

.tiny {
  font-size: 0.78rem;
}

.toolbar-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.split-row {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.triple-row {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.check-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 52px;
}

.check-row input {
  accent-color: var(--accent);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(4, 10, 15, 0.72);
  backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  z-index: 90;
}

.modal-card {
  width: min(760px, 100%);
  border-radius: 30px;
  padding: 24px;
}

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

.modal-head h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.4rem;
}

.modal-grid {
  display: grid;
  gap: 14px;
}

.modal-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 20px;
  flex-wrap: wrap;
}

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

.login-card {
  width: min(760px, 100%);
  padding: 32px;
  border-radius: 34px;
}

.login-grid {
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(0, 1.1fr) minmax(280px, 0.9fr);
  align-items: start;
}

.hint-box {
  padding: 16px 18px;
  border-radius: 20px;
  background: rgba(8, 19, 25, 0.72);
  border: 1px solid var(--line);
  color: var(--muted-strong);
  line-height: 1.6;
}

.status-banner {
  margin-top: 16px;
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted-strong);
}

.status-banner.error {
  border-color: rgba(255, 107, 124, 0.26);
  background: rgba(255, 107, 124, 0.08);
  color: #ffc7cf;
}

.status-banner.success {
  border-color: rgba(52, 211, 153, 0.24);
  background: rgba(52, 211, 153, 0.08);
  color: #b9f4df;
}

.toast-root {
  position: fixed;
  right: 18px;
  bottom: 18px;
  display: grid;
  gap: 10px;
  z-index: 100;
}

.toast {
  min-width: 260px;
  max-width: 360px;
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: rgba(8, 19, 25, 0.92);
  box-shadow: var(--shadow);
}

.toast-title {
  font-weight: 700;
  margin-bottom: 4px;
}

.toast-body {
  color: var(--muted-strong);
  font-size: 0.92rem;
  line-height: 1.5;
}

.loading-dot::after {
  content: " •";
  animation: blink 1s steps(1) infinite;
}

@keyframes blink {
  50% {
    opacity: 0.25;
  }
}

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

  .hero-grid,
  .kpi-grid,
  .triple-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 880px) {
  .app-shell {
    width: min(100vw - 20px, 1480px);
  }

  .topbar,
  .split-row,
  .hero-grid,
  .kpi-grid,
  .triple-row {
    grid-template-columns: 1fr;
  }

  .hero,
  .section,
  .modal-card,
  .login-card {
    padding: 20px;
    border-radius: 26px;
  }

  table {
    min-width: 720px;
  }
}
