:root {
  color-scheme: light;
  --font-body: "IBM Plex Sans", sans-serif;
  --font-mono: "IBM Plex Mono", monospace;
  --bg: #f3f0ea;
  --bg-strong: #ece8df;
  --surface: #ffffff;
  --surface-soft: #f7f4ee;
  --surface-muted: #f1ede5;
  --surface-contrast: #18222c;
  --border: #ddd5c8;
  --border-strong: #cfc4b2;
  --text: #17212b;
  --text-soft: #56616b;
  --text-muted: #7a857f;
  --brand: #1f394d;
  --brand-strong: #132836;
  --accent: #1f7a69;
  --success: #197454;
  --danger: #bd4f43;
  --shadow-lg: 0 28px 60px rgba(26, 34, 44, 0.08);
  --shadow-md: 0 14px 28px rgba(26, 34, 44, 0.06);
  --shadow-sm: 0 6px 14px rgba(26, 34, 44, 0.04);
  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-sm: 12px;
  --transition: 160ms ease;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #111722;
  --bg-strong: #0c121a;
  --surface: #18212d;
  --surface-soft: #1c2735;
  --surface-muted: #202d3d;
  --surface-contrast: #eef3f7;
  --border: #2d3947;
  --border-strong: #3b4959;
  --text: #edf2f6;
  --text-soft: #c0cad3;
  --text-muted: #8e9ba8;
  --brand: #adc5d8;
  --brand-strong: #d8e6f0;
  --accent: #6dd3ba;
  --success: #75dbab;
  --danger: #f1a097;
  --shadow-lg: 0 28px 70px rgba(0, 0, 0, 0.26);
  --shadow-md: 0 18px 36px rgba(0, 0, 0, 0.18);
  --shadow-sm: 0 8px 18px rgba(0, 0, 0, 0.14);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

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

body {
  font-family: var(--font-body);
  background:
    radial-gradient(circle at top left, rgba(31, 57, 77, 0.08), transparent 24%),
    radial-gradient(circle at bottom right, rgba(31, 122, 105, 0.06), transparent 22%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-strong) 100%);
  color: var(--text);
  line-height: 1.55;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

canvas {
  display: block;
  max-width: 100%;
}

.shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 280px;
  flex: 0 0 280px;
  padding: 26px 20px;
  background: rgba(255, 255, 255, 0.7);
  border-right: 1px solid var(--border);
  backdrop-filter: blur(18px);
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 20px;
  z-index: 20;
}

html[data-theme="dark"] .sidebar {
  background: rgba(17, 23, 34, 0.74);
}

.brand-card,
.sidebar-card,
.panel,
.hero__copy,
.hero__summary,
.auth-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.brand-card,
.sidebar-card {
  padding: 18px;
}

.brand-card__title {
  display: inline-block;
  margin: 6px 0 6px;
  font-size: 1.45rem;
  font-weight: 700;
  letter-spacing: -0.04em;
}

.brand-card__text,
.sidebar-card p {
  margin: 0;
  color: var(--text-soft);
}

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

.nav__item {
  padding: 13px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  color: var(--text-soft);
  transition: background var(--transition), border-color var(--transition), color var(--transition), transform var(--transition);
}

.nav__item:hover {
  background: var(--surface-soft);
  border-color: var(--border);
  color: var(--text);
  transform: translateX(2px);
}

.nav__item.is-active {
  background: var(--brand);
  border-color: var(--brand);
  color: #ffffff;
}

.nav__label {
  display: block;
  font-weight: 600;
}

.main {
  flex: 1;
  min-width: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 15;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 18px 28px;
  backdrop-filter: blur(16px);
  background: rgba(243, 240, 234, 0.78);
  border-bottom: 1px solid rgba(221, 213, 200, 0.8);
}

html[data-theme="dark"] .topbar {
  background: rgba(17, 23, 34, 0.8);
  border-bottom-color: rgba(45, 57, 71, 0.9);
}

.topbar__left,
.topbar__actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

.topbar__left {
  min-width: 0;
}

.topbar__label {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.topbar__subtle {
  margin: 4px 0 0;
  color: var(--text-soft);
}

.page {
  width: min(1320px, calc(100vw - 320px));
  margin: 0 auto;
  padding: 26px 28px 44px;
}

.kicker {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(300px, 0.9fr);
  gap: 18px;
}

.hero__copy,
.hero__summary {
  padding: 28px;
}

.hero__copy {
  position: relative;
  overflow: hidden;
}

.hero__copy::after {
  content: "";
  position: absolute;
  inset: auto 28px 0 28px;
  height: 1px;
  background: linear-gradient(90deg, rgba(31, 57, 77, 0.14), transparent);
}

.hero__copy h1 {
  margin: 12px 0 14px;
  max-width: 11ch;
  font-size: clamp(2.15rem, 4vw, 3.6rem);
  line-height: 0.98;
  letter-spacing: -0.06em;
}

.hero__copy p:last-of-type {
  margin: 0;
  max-width: 760px;
  color: var(--text-soft);
  font-size: 1rem;
}

.hero__actions,
.form__actions,
.command-actions,
.command-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.hero__actions {
  margin-top: 22px;
}

.hero__summary {
  display: grid;
  gap: 12px;
  align-content: start;
}

.summary-item {
  padding: 16px 16px 14px;
  border-radius: var(--radius-md);
  background: var(--surface-soft);
  border: 1px solid var(--border);
}

.summary-item span {
  display: block;
  margin-bottom: 8px;
  color: var(--text-muted);
  font-size: 0.84rem;
}

.summary-item strong {
  display: block;
  font-size: 1rem;
  line-height: 1.35;
  letter-spacing: -0.02em;
}

.summary-item__detail {
  display: block;
  margin-top: 6px;
  color: var(--text-muted);
  font-size: 0.78rem;
}

.card-grid,
.layout-grid,
.chart-grid,
.service-grid {
  display: grid;
  gap: 16px;
}

.card-grid {
  margin-top: 16px;
}

.card-grid--three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.card-grid--four {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

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

.layout-grid {
  margin-top: 16px;
  grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.8fr);
}

.chart-grid {
  margin-top: 16px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.service-grid {
  margin-top: 16px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.panel {
  padding: 22px;
  box-shadow: var(--shadow-md);
}

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

.panel__header h2,
.metric-panel h2,
.service-card h2,
.chart-panel h2,
.table-panel h2,
.auth-panel__header h2 {
  margin: 8px 0 0;
  font-size: 1.18rem;
  letter-spacing: -0.03em;
}

.metric-panel {
  background: linear-gradient(180deg, var(--surface) 0%, var(--surface-soft) 100%);
}

.metric-value {
  margin: 16px 0 10px;
  font-size: clamp(1.45rem, 2.2vw, 2.2rem);
  font-weight: 700;
  line-height: 1.06;
  letter-spacing: -0.05em;
}

.panel__subtle {
  margin: 0;
  color: var(--text-soft);
}

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

.section-heading h2 {
  margin: 8px 0 0;
  font-size: 1.38rem;
  letter-spacing: -0.04em;
}

.section-heading > p {
  margin: 0;
  max-width: 620px;
  color: var(--text-soft);
  text-align: right;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-soft);
  color: var(--text);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.badge--solid {
  border-color: var(--surface-contrast);
  background: var(--surface-contrast);
  color: var(--bg);
}

.badge--success {
  border-color: rgba(25, 116, 84, 0.18);
  background: rgba(25, 116, 84, 0.1);
  color: var(--success);
}

.badge--danger {
  border-color: rgba(189, 79, 67, 0.18);
  background: rgba(189, 79, 67, 0.1);
  color: var(--danger);
}

.primary-button,
.ghost-button,
.menu-button,
.mobile-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 44px;
  padding: 0 16px;
  border-radius: 14px;
  border: 1px solid var(--border);
  transition: transform var(--transition), box-shadow var(--transition), background var(--transition), border-color var(--transition), color var(--transition);
}

.primary-button {
  background: var(--brand);
  border-color: var(--brand);
  color: #ffffff;
  box-shadow: var(--shadow-sm);
  font-weight: 700;
}

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

.ghost-button,
.menu-button,
.mobile-close {
  background: var(--surface);
  color: var(--text);
}

.ghost-button__dot {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 0 0 5px rgba(31, 122, 105, 0.12);
}

.primary-button--wide {
  width: 100%;
}

.menu-button,
.mobile-close {
  display: none;
}

.user-chip {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 44px;
  padding: 6px 14px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--surface);
}

.user-chip strong {
  font-size: 0.94rem;
}

.user-chip__label {
  color: var(--text-muted);
  font-size: 0.64rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
}

.notification-list {
  display: grid;
  gap: 10px;
}

.notification-list__empty,
.empty-state {
  display: grid;
  place-items: center;
  min-height: 160px;
  padding: 20px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  background: var(--surface-soft);
  color: var(--text-soft);
  text-align: center;
}

.notification-item {
  display: grid;
  gap: 8px;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--surface-soft);
}

.notification-item--alert {
  border-color: rgba(189, 79, 67, 0.2);
  background: linear-gradient(180deg, rgba(189, 79, 67, 0.07) 0%, var(--surface-soft) 100%);
}

.notification-item__meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.notification-item__message {
  margin: 0;
  font-weight: 600;
}

.notification-item__type {
  font-family: var(--font-mono);
}

.key-list {
  display: grid;
  gap: 0;
}

.key-list__item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}

.key-list__item:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.key-list__item span {
  color: var(--text-muted);
}

.key-list__item strong {
  text-align: right;
}

.meter {
  width: 100%;
  height: 10px;
  border-radius: 999px;
  overflow: hidden;
  background: #e7e1d7;
  border: 1px solid rgba(0, 0, 0, 0.04);
}

html[data-theme="dark"] .meter {
  background: #243244;
  border-color: rgba(255, 255, 255, 0.04);
}

.meter span {
  display: block;
  width: var(--meter-fill, 0%);
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--brand) 0%, var(--accent) 100%);
  transition: width 220ms ease;
}

.mono {
  font-family: var(--font-mono);
}

.chart-panel canvas {
  min-height: 300px;
}

.service-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.service-card__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.service-card p {
  margin: 0;
}

.terminal-panel {
  margin-top: 16px;
}

.command-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  margin-top: 18px;
}

.command-input,
.field input {
  width: 100%;
  min-height: 48px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  color: var(--text);
  outline: 0;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.command-input:focus,
.field input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 4px rgba(31, 57, 77, 0.08);
}

.command-actions {
  justify-content: flex-end;
}

.command-presets {
  margin-top: 14px;
}

.terminal-screen {
  margin: 18px 0 0;
  min-height: 280px;
  max-height: 540px;
  overflow: auto;
  padding: 18px;
  border-radius: var(--radius-lg);
  background: #10161e;
  color: #eaf1f7;
  border: 1px solid #1d2b39;
  font-family: var(--font-mono);
  font-size: 0.9rem;
  line-height: 1.7;
}

.table-panel {
  margin-top: 16px;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.table {
  width: 100%;
  min-width: 580px;
  border-collapse: collapse;
  background: var(--surface);
}

.table th,
.table td {
  padding: 14px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.table th {
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  background: var(--surface-soft);
}

.table tr:last-child td {
  border-bottom: 0;
}

.auth-body {
  display: grid;
  place-items: center;
  padding: 28px;
}

.auth-shell {
  width: min(1160px, 100%);
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(360px, 0.8fr);
  gap: 18px;
}

.auth-panel {
  padding: 30px;
}

.auth-panel--intro {
  background:
    linear-gradient(180deg, rgba(24, 34, 44, 0.96), rgba(19, 30, 40, 0.96)),
    var(--surface-contrast);
  border-color: rgba(255, 255, 255, 0.06);
  color: #eff4f8;
}

.auth-panel--intro .kicker,
.auth-panel--intro p {
  color: rgba(239, 244, 248, 0.74);
}

.auth-panel--intro h1 {
  margin: 10px 0 14px;
  max-width: 10ch;
  color: #ffffff;
  font-size: clamp(2.3rem, 4vw, 3.9rem);
  line-height: 0.98;
  letter-spacing: -0.06em;
}

.auth-panel__header h2 {
  margin-bottom: 0;
}

.auth-highlights {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 28px;
}

.mini-card {
  padding: 18px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.mini-card h2 {
  margin: 12px 0 8px;
  font-size: 1.05rem;
  letter-spacing: -0.03em;
}

.mini-card p {
  margin: 0;
  font-size: 0.95rem;
}

.alert {
  padding: 14px 16px;
  margin-bottom: 18px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--surface-soft);
}

.alert--danger {
  border-color: rgba(189, 79, 67, 0.18);
  background: rgba(189, 79, 67, 0.08);
  color: var(--danger);
}

.form {
  display: grid;
  gap: 18px;
}

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

.field span {
  font-weight: 600;
}

.mobile-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  border: 0;
  background: rgba(15, 21, 28, 0.42);
  z-index: 10;
}

@media (max-width: 1220px) {
  .card-grid--metrics {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

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

  .page {
    width: auto;
  }
}

@media (max-width: 1080px) {
  .sidebar {
    position: fixed;
    left: 0;
    transform: translateX(-100%);
    transition: transform 220ms ease;
    width: min(88vw, 280px);
    box-shadow: var(--shadow-lg);
  }

  .shell.is-menu-open .sidebar {
    transform: translateX(0);
  }

  .shell.is-menu-open .mobile-backdrop {
    display: block;
  }

  .menu-button,
  .mobile-close {
    display: inline-flex;
  }

  .mobile-close {
    margin-top: auto;
  }

  .page {
    padding: 22px 20px 36px;
  }

  .topbar {
    padding: 16px 20px;
  }

  .hero,
  .layout-grid,
  .auth-shell {
    grid-template-columns: 1fr;
  }

  .card-grid--three,
  .card-grid--four,
  .card-grid--metrics,
  .chart-grid,
  .service-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .section-heading > p {
    text-align: left;
  }
}

@media (max-width: 760px) {
  .topbar,
  .topbar__left,
  .topbar__actions {
    flex-direction: column;
    align-items: stretch;
  }

  .topbar__actions {
    width: 100%;
  }

  .topbar__actions .ghost-button,
  .topbar__actions .primary-button,
  .topbar__actions .user-chip,
  .topbar__actions form {
    width: 100%;
  }

  .hero__copy,
  .hero__summary,
  .panel,
  .auth-panel,
  .brand-card,
  .sidebar-card {
    padding: 20px;
  }

  .card-grid--three,
  .card-grid--four,
  .card-grid--metrics,
  .chart-grid,
  .service-grid,
  .auth-highlights {
    grid-template-columns: 1fr;
  }

  .command-form {
    grid-template-columns: 1fr;
  }

  .command-actions {
    justify-content: stretch;
  }

  .command-actions button,
  .hero__actions a,
  .command-presets button,
  .form__actions button {
    width: 100%;
  }

  .hero__copy h1,
  .auth-panel--intro h1 {
    max-width: none;
  }
}
