:root {
  color-scheme: dark;
  --bg: #071019;
  --bg-soft: #0c1724;
  --bg-strong: #111f31;
  --card: rgba(15, 26, 39, 0.88);
  --card-strong: rgba(9, 18, 28, 0.94);
  --border: rgba(143, 182, 219, 0.18);
  --border-strong: rgba(95, 209, 255, 0.24);
  --text: #edf5ff;
  --muted: #8ea6c1;
  --primary: #5fd1ff;
  --primary-soft: rgba(95, 209, 255, 0.18);
  --accent: #7df7c5;
  --violet: #a78bfa;
  --rose: #fb7185;
  --gold: #fbbf24;
  --warning: #ffc869;
  --danger: #ff8c8c;
  --shadow: 0 26px 70px rgba(0, 0, 0, 0.4);
  --radius: 22px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100vh;
  font-family: "Segoe UI", "Inter", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(95, 209, 255, 0.2), transparent 28%),
    radial-gradient(circle at top right, rgba(125, 247, 197, 0.15), transparent 20%),
    linear-gradient(160deg, #050a11 0%, #0a1320 44%, #07111b 100%);
}

a {
  color: var(--primary);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

h1,
h2,
h3,
p {
  margin: 0;
}

button {
  border: none;
  cursor: pointer;
  font: inherit;
}

input,
select,
textarea,
.compact-input {
  width: 100%;
  border: 1px solid rgba(161, 196, 232, 0.18);
  border-radius: 14px;
  background: rgba(9, 17, 27, 0.72);
  color: var(--text);
  padding: 12px 14px;
  outline: none;
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus,
.compact-input:focus {
  border-color: rgba(95, 209, 255, 0.58);
  box-shadow: 0 0 0 3px rgba(95, 209, 255, 0.12);
}

.hidden {
  display: none !important;
}

.shell,
.login-view,
.dashboard-view {
  min-height: 100vh;
}

.stack {
  display: flex;
  flex-direction: column;
}

.gap-12 {
  gap: 12px;
}

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

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

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 11px;
  color: var(--primary);
}

.login-view {
  display: grid;
  place-items: center;
  padding: 32px;
}

.login-card,
.panel-card,
.hero-card,
.modal-card {
  background: var(--card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.login-card {
  width: min(100%, 460px);
  padding: 36px;
  border-radius: 30px;
}

.brand-mark {
  width: 76px;
  height: 76px;
  border-radius: 24px;
  display: grid;
  place-items: center;
  font-size: 42px;
  font-weight: 800;
  margin-bottom: 18px;
  background: linear-gradient(135deg, rgba(95, 209, 255, 0.22), rgba(125, 247, 197, 0.2));
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 7px;
  font-size: 13px;
  color: var(--muted);
}

.primary-button,
.ghost-button {
  border-radius: 14px;
  padding: 12px 16px;
  font-weight: 600;
  transition: transform 150ms ease, border-color 150ms ease, background 150ms ease;
}

.primary-button {
  background: linear-gradient(135deg, var(--primary), #8fb5ff 54%, var(--violet));
  color: #03101b;
  box-shadow: 0 14px 34px rgba(95, 209, 255, 0.22);
}

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

.ghost-button.danger {
  color: #ffd7d7;
  border-color: rgba(255, 140, 140, 0.24);
}

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

.primary-button.small,
.ghost-button.small {
  padding: 9px 12px;
  font-size: 12px;
}

.error-text {
  margin-top: 14px;
  min-height: 20px;
  color: #ff9a9a;
  font-size: 13px;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px 10px;
}

.topbar-actions {
  display: flex;
  gap: 10px;
}

.content {
  padding: 0 20px 20px;
}

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

.hero-card {
  position: relative;
  overflow: hidden;
  padding: 16px 18px;
  border-radius: 20px;
  background:
    radial-gradient(circle at top right, rgba(255, 255, 255, 0.08), transparent 38%),
    linear-gradient(160deg, rgba(17, 31, 49, 0.96), rgba(10, 18, 29, 0.94));
}

.hero-card::before {
  content: "";
  position: absolute;
  inset: 0 auto auto 0;
  width: 100%;
  height: 4px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
}

.hero-grid .hero-card:nth-child(2)::before {
  background: linear-gradient(90deg, var(--gold), #ffd86b);
}

.hero-grid .hero-card:nth-child(3)::before {
  background: linear-gradient(90deg, var(--accent), #5fd1ff);
}

.hero-grid .hero-card:nth-child(4)::before {
  background: linear-gradient(90deg, var(--violet), #6ee7f9);
}

.hero-title {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--muted);
}

.hero-value {
  font-size: 31px;
  font-weight: 800;
  margin: 6px 0 8px;
}

.hero-value-sm {
  font-size: 22px;
}

.overview-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}

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

.panel-card {
  position: relative;
  overflow: hidden;
  border-radius: 20px;
  padding: 14px;
  background:
    radial-gradient(circle at top right, rgba(95, 209, 255, 0.08), transparent 28%),
    linear-gradient(180deg, rgba(16, 28, 43, 0.96), rgba(8, 15, 24, 0.94));
}

.panel-card::before {
  content: "";
  position: absolute;
  inset: 0 auto auto 0;
  width: 100%;
  height: 3px;
  background: linear-gradient(90deg, rgba(95, 209, 255, 0.8), rgba(125, 247, 197, 0.6));
  opacity: 0.9;
}

.span-2 {
  grid-column: span 2;
}

.span-3 {
  grid-column: span 3;
}

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

.section-toggle {
  cursor: pointer;
  user-select: none;
}

.compact-disclosure {
  overflow: hidden;
  transition: border-color 160ms ease, transform 160ms ease, box-shadow 160ms ease;
}

.compact-disclosure summary {
  list-style: none;
}

.compact-disclosure summary::-webkit-details-marker {
  display: none;
}

.disclosure-toggle {
  cursor: pointer;
  margin-bottom: 0;
}

.compact-disclosure:hover {
  border-color: rgba(95, 209, 255, 0.26);
  transform: translateY(-1px);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.24);
}

.compact-disclosure .disclosure-body {
  display: none;
  padding-top: 10px;
}

.compact-disclosure[open] .disclosure-body {
  display: block;
}

.compact-disclosure[open] .pill.info {
  background: linear-gradient(135deg, rgba(125, 247, 197, 0.18), rgba(95, 209, 255, 0.12));
  border-color: rgba(125, 247, 197, 0.34);
  color: #d9fff0;
}

.section-kicker {
  color: var(--accent);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  margin-bottom: 4px;
}

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

.compact-input {
  min-width: 260px;
  padding: 10px 12px;
}

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

.telemetry-card {
  min-height: 136px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
  padding: 12px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background:
    radial-gradient(circle at top right, rgba(95, 209, 255, 0.14), transparent 34%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.015)),
    rgba(8, 16, 26, 0.62);
}

.telemetry-copy {
  display: grid;
  gap: 5px;
}

.telemetry-title {
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.telemetry-value {
  font-size: 24px;
  line-height: 1;
  font-weight: 800;
}

.spark-svg {
  width: 100%;
  height: 52px;
  display: block;
}

.table-wrap {
  overflow: auto;
  max-height: 460px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  background: rgba(5, 12, 19, 0.56);
}

.table-footer {
  margin-top: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 12px 14px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 13px;
}

thead th {
  position: sticky;
  top: 0;
  background: linear-gradient(180deg, rgba(16, 28, 43, 0.98), rgba(8, 16, 26, 0.96));
  z-index: 1;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

tbody tr:hover {
  background: linear-gradient(90deg, rgba(95, 209, 255, 0.08), rgba(125, 247, 197, 0.04));
}

.list-stack {
  display: grid;
  gap: 8px;
}

.list-item {
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  padding: 11px 12px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.015)),
    var(--card-strong);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.list-item.tight {
  padding: 12px 14px;
}

.list-item.clickable {
  cursor: pointer;
}

.list-item.clickable:hover,
.clickable-row:hover {
  background:
    radial-gradient(circle at left center, rgba(95, 209, 255, 0.12), transparent 30%),
    rgba(95, 209, 255, 0.08);
}

.list-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.mini-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 12px;
}

.mini-line {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 12px;
  padding: 8px 10px;
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(95, 209, 255, 0.08), rgba(255, 255, 255, 0.02));
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.metric-row {
  display: grid;
  gap: 8px;
}

.progress-track {
  width: 100%;
  height: 10px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.05);
}

.progress-bar {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--primary), var(--accent));
}

.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 26px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.03));
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.pill.active {
  color: #baf5dd;
  border-color: rgba(125, 247, 197, 0.22);
}

.pill.disabled,
.pill.suspended,
.pill.revoked,
.pill.expired {
  color: #ffd1d1;
  border-color: rgba(255, 121, 121, 0.24);
}

.pill.grace,
.pill.rc,
.pill.warning {
  color: #ffe4b3;
  border-color: rgba(255, 200, 105, 0.24);
}

.pill.info {
  color: #d7edff;
  border-color: rgba(95, 209, 255, 0.22);
}

.pill.critical,
.pill.danger {
  color: #ffd1d1;
  border-color: rgba(255, 140, 140, 0.26);
}

.clickable-row {
  cursor: pointer;
}

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

.checkbox-line {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
}

.checkbox-line input {
  width: auto;
  margin: 0;
}

.modal {
  border: none;
  padding: 0;
  background: transparent;
}

.modal::backdrop {
  background: rgba(0, 0, 0, 0.58);
  backdrop-filter: blur(4px);
}

.modal-card {
  width: min(92vw, 900px);
  margin: auto;
  border-radius: 24px;
  padding: 16px;
}

.modal-card.large {
  width: min(96vw, 1080px);
}

.modal-header,
.modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.modal-header {
  margin-bottom: 18px;
}

.modal-footer {
  margin-top: 18px;
  justify-content: flex-end;
}

.modal-body {
  display: grid;
  gap: 18px;
}

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

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

.detail-card {
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 14px;
  padding: 12px;
  background: rgba(8, 16, 26, 0.45);
}

.detail-card h3 {
  margin-bottom: 10px;
  font-size: 14px;
}

.detail-line {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 0;
  font-size: 13px;
}

.detail-line span:first-child {
  color: var(--muted);
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  padding: 14px 16px;
  border-radius: 16px;
  background: rgba(8, 18, 28, 0.96);
  border: 1px solid rgba(95, 209, 255, 0.24);
  box-shadow: var(--shadow);
  min-width: 240px;
  z-index: 50;
}

@media (max-width: 1280px) {
  .overview-grid,
  .panel-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .span-3 {
    grid-column: span 2;
  }
}

@media (max-width: 1100px) {
  .hero-grid,
  .overview-grid,
  .panel-grid,
  .detail-grid,
  .modal-grid,
  .mini-grid {
    grid-template-columns: 1fr;
  }

  .span-2,
  .span-3 {
    grid-column: span 1;
  }

  .table-footer,
  .section-header,
  .topbar {
    flex-direction: column;
    align-items: stretch;
  }
}

@media (max-width: 760px) {
  .topbar,
  .content {
    padding-left: 16px;
    padding-right: 16px;
  }

  .topbar-actions,
  .inline-actions,
  .checkbox-grid {
    width: 100%;
    grid-template-columns: 1fr;
    flex-direction: column;
  }

  .topbar-actions button,
  .inline-actions button,
  .compact-input {
    width: 100%;
  }

  .modal-card,
  .modal-card.large {
    width: min(96vw, 96vw);
  }
}
