:root {
  color-scheme: light;
  --brand: #e5b77b;
  --brand-strong: #cd9758;
  --accent: #6db7d9;

  --bg: #f2f4f8;
  --bg-soft: #ffffff;
  --surface: #ffffffcc;
  --surface-solid: #ffffff;
  --surface-muted: #f6ebdb;

  --text: #1a2733;
  --text-muted: #536272;
  --line: #d9e1ea;
  --line-strong: #bcc8d4;

  --ok: #27b06f;
  --bad: #dc5d5d;
  --unknown: #788999;

  --link: #2b9fcd;
  --link-hover: #0f7ea8;

  --shadow-sm: 0 10px 22px rgba(26, 50, 75, 0.1);
  --shadow-lg: 0 26px 48px rgba(20, 39, 58, 0.14);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b1017;
  --bg-soft: #131d2a;
  --surface: #111a26d9;
  --surface-solid: #172231;
  --surface-muted: #243244;

  --text: #edf3f8;
  --text-muted: #9eb0c1;
  --line: #2b3c4f;
  --line-strong: #3e556f;

  --ok: #57d89a;
  --bad: #ff8f8f;
  --unknown: #c5b8a6;

  --link: #86d9ff;
  --link-hover: #b7ecff;

  --shadow-sm: 0 10px 22px rgba(2, 8, 15, 0.45);
  --shadow-lg: 0 28px 54px rgba(1, 6, 12, 0.6);
}

* {
  box-sizing: border-box;
}

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

body {
  background:
    radial-gradient(90rem 44rem at -8% -12%, color-mix(in srgb, var(--brand) 60%, transparent), transparent 60%),
    radial-gradient(60rem 32rem at 100% 0%, color-mix(in srgb, var(--accent) 35%, transparent), transparent 66%),
    linear-gradient(150deg, var(--bg-soft), var(--bg));
  color: var(--text);
  font-family: "DM Sans", "Segoe UI", sans-serif;
  line-height: 1.45;
}

h1,
h2,
h3,
h4 {
  font-family: Outfit, "DM Sans", sans-serif;
  letter-spacing: -0.02em;
  margin: 0;
}

a {
  color: inherit;
}

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

.side-nav {
  position: sticky;
  top: 0;
  align-self: start;
  min-height: 100vh;
  border-right: 1px solid var(--line);
  padding: 1.1rem;
  background: color-mix(in srgb, var(--surface-solid) 92%, transparent);
  backdrop-filter: blur(12px);
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
}

.side-brand {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  text-decoration: none;
  padding: 0.65rem;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: linear-gradient(145deg, color-mix(in srgb, var(--surface-muted) 65%, var(--surface-solid)), var(--surface-solid));
}

.brand-logo {
  width: 44px;
  height: 44px;
  object-fit: contain;
  border-radius: 14px;
  box-shadow: var(--shadow-sm);
}

.side-brand span {
  display: grid;
  line-height: 1.18;
}

.side-brand strong {
  font-size: 1rem;
}

.side-brand small {
  color: var(--text-muted);
  font-size: 0.78rem;
}

.side-links {
  display: grid;
  gap: 0.45rem;
}

.side-links a {
  text-decoration: none;
  color: var(--text-muted);
  padding: 0.62rem 0.75rem;
  border: 1px solid transparent;
  border-radius: 12px;
  font-weight: 700;
  transition: all 0.16s ease;
}

.side-links a:hover,
.side-links a:focus-visible {
  color: var(--text);
  border-color: var(--line-strong);
  background: color-mix(in srgb, var(--brand) 16%, transparent);
}

.side-links a.active {
  color: #2a1d0f;
  border-color: color-mix(in srgb, var(--brand) 72%, var(--line));
  background: linear-gradient(135deg, color-mix(in srgb, var(--brand) 92%, #fff7e7), color-mix(in srgb, var(--brand) 65%, #efd1aa));
  box-shadow: 0 10px 18px rgba(128, 84, 38, 0.2);
}

:root[data-theme="dark"] .side-links a.active {
  color: #221809;
}

.side-actions {
  margin-top: auto;
  display: grid;
  gap: 0.5rem;
}

.wide {
  width: 100%;
}

.workspace {
  min-width: 0;
  padding: 1.1rem;
}

.workspace-header {
  margin-bottom: 1rem;
}

.workspace-title {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 1rem 1.1rem;
  background: linear-gradient(145deg, color-mix(in srgb, var(--surface-solid) 88%, transparent), color-mix(in srgb, var(--surface-muted) 45%, var(--surface-solid)));
  box-shadow: var(--shadow-sm);
}

.workspace-kicker {
  margin: 0;
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--brand-strong);
}

.workspace-title h1 {
  margin: 0.35rem 0;
  font-size: clamp(1.45rem, 1.1rem + 1.2vw, 2.1rem);
}

.workspace-title p {
  margin: 0;
  color: var(--text-muted);
}

.container {
  max-width: none;
  width: 100%;
  margin: 0;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  backdrop-filter: blur(8px);
  box-shadow: var(--shadow-sm);
  padding: 0.95rem;
  margin-bottom: 0.95rem;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.7rem;
  margin-bottom: 0.7rem;
}

.panel-head p {
  margin: 0.25rem 0 0;
}

.filter-panel {
  background:
    linear-gradient(140deg, color-mix(in srgb, var(--surface-solid) 88%, transparent), color-mix(in srgb, var(--surface-muted) 58%, var(--surface-solid)));
}

.metric-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.75rem;
  margin-bottom: 0.95rem;
}

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

.metric-card {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 0.86rem 0.95rem;
  background:
    radial-gradient(65rem 24rem at 0 0, color-mix(in srgb, var(--brand) 22%, transparent), transparent 65%),
    linear-gradient(145deg, var(--surface-solid), color-mix(in srgb, var(--surface-muted) 52%, var(--surface-solid)));
  box-shadow: var(--shadow-sm);
}

.metric-label {
  display: block;
  font-size: 0.77rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.metric-value {
  display: block;
  margin-top: 0.4rem;
  font-size: clamp(1.4rem, 1rem + 1.2vw, 2.15rem);
  font-weight: 800;
  line-height: 1;
}

.bento-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 0.95rem;
}

.bento-grid > .panel {
  margin-bottom: 0;
}

.wide-panel {
  grid-column: span 12;
}

.chart-panel {
  grid-column: span 12;
  min-height: 420px;
}

.table-panel {
  grid-column: span 6;
}

.chart-wrap {
  position: relative;
  height: 320px;
  width: 100%;
}

.range-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.42rem;
}

.range-group {
  margin-bottom: 0.6rem;
}

.filters,
.inline-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  align-items: end;
}

.panel > .filters {
  margin-bottom: 0.95rem;
}

.field-inline {
  display: grid;
  gap: 0.35rem;
  min-width: 220px;
}

.filters label,
.inline-form label {
  color: var(--text-muted);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

input,
select,
button {
  font: inherit;
}

input,
select {
  min-height: 40px;
  border: 1px solid var(--line-strong);
  border-radius: 11px;
  padding: 0.55rem 0.72rem;
  background: var(--surface-solid);
  color: var(--text);
}

input::placeholder {
  color: color-mix(in srgb, var(--text-muted) 80%, transparent);
}

input:focus,
select:focus,
button:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--brand) 72%, transparent);
  outline-offset: 1px;
}

.btn {
  min-height: 40px;
  border-radius: 11px;
  padding: 0.55rem 0.88rem;
  border: 1px solid transparent;
  background: linear-gradient(145deg, color-mix(in srgb, var(--brand) 90%, #fff8ea), color-mix(in srgb, var(--brand) 68%, #f1d0a4));
  color: #2f2316;
  font-weight: 800;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.14s ease, filter 0.14s ease;
}

.btn:hover,
.btn:focus-visible {
  transform: translateY(-1px);
  filter: brightness(1.04);
}

.btn.ghost {
  background: color-mix(in srgb, var(--surface-solid) 84%, transparent);
  color: var(--text);
  border-color: var(--line-strong);
}

.btn.subtle {
  background: transparent;
  color: var(--text-muted);
  border-color: var(--line-strong);
}

.range-buttons .btn.active {
  background: linear-gradient(145deg, color-mix(in srgb, var(--brand) 84%, #fff5e6), color-mix(in srgb, var(--brand) 64%, #eec38e));
  border-color: color-mix(in srgb, var(--brand) 70%, var(--line-strong));
}

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

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

thead {
  background: color-mix(in srgb, var(--surface-muted) 64%, var(--surface-solid));
}

th,
td {
  white-space: nowrap;
  text-align: left;
  border-bottom: 1px solid var(--line);
  padding: 0.62rem 0.62rem;
  font-size: 0.93rem;
}

tbody tr:nth-child(even) {
  background: color-mix(in srgb, var(--surface-muted) 40%, transparent);
}

tbody tr:hover {
  background: color-mix(in srgb, var(--brand) 14%, transparent);
}

.server-link {
  color: var(--link);
  text-decoration: none;
  font-weight: 800;
  border-bottom: 1px solid color-mix(in srgb, var(--link) 44%, transparent);
}

.server-link:hover,
.server-link:focus-visible {
  color: var(--link-hover);
  border-bottom-color: color-mix(in srgb, var(--link-hover) 52%, transparent);
}

.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  border: 1px solid;
  padding: 0.22rem 0.52rem;
  font-size: 0.75rem;
  font-weight: 800;
}

.pill.online {
  color: var(--ok);
  border-color: color-mix(in srgb, var(--ok) 42%, var(--line));
  background: color-mix(in srgb, var(--ok) 16%, transparent);
}

.pill.offline {
  color: var(--bad);
  border-color: color-mix(in srgb, var(--bad) 42%, var(--line));
  background: color-mix(in srgb, var(--bad) 16%, transparent);
}

.pill.unknown {
  color: var(--unknown);
  border-color: color-mix(in srgb, var(--unknown) 34%, var(--line));
  background: color-mix(in srgb, var(--unknown) 14%, transparent);
}

.pill.info {
  color: #3f87d6;
  border-color: color-mix(in srgb, #3f87d6 40%, var(--line));
  background: color-mix(in srgb, #3f87d6 16%, transparent);
}

.pill.warning {
  color: #b87b1f;
  border-color: color-mix(in srgb, #b87b1f 42%, var(--line));
  background: color-mix(in srgb, #b87b1f 16%, transparent);
}

.pill.critical {
  color: var(--bad);
  border-color: color-mix(in srgb, var(--bad) 42%, var(--line));
  background: color-mix(in srgb, var(--bad) 16%, transparent);
}

.detail-hero {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.8rem;
}

.detail-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

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

.kv {
  list-style: none;
  padding: 0;
  margin: 0;
}

.kv li {
  display: flex;
  justify-content: space-between;
  gap: 0.85rem;
  border-bottom: 1px dashed var(--line);
  padding: 0.44rem 0;
}

.kv span {
  color: var(--text-muted);
  font-weight: 600;
}

.kv strong {
  text-align: right;
}

.notice {
  margin-bottom: 0.9rem;
  border: 1px solid color-mix(in srgb, var(--brand) 62%, var(--line));
  border-radius: 12px;
  padding: 0.72rem 0.84rem;
  background: color-mix(in srgb, var(--brand) 18%, transparent);
}

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

.error {
  color: var(--bad);
  font-weight: 700;
}

code {
  font-family: "JetBrains Mono", "SFMono-Regular", Consolas, monospace;
  font-size: 0.9em;
  background: color-mix(in srgb, var(--surface-muted) 65%, var(--surface-solid));
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.08rem 0.28rem;
}

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1rem;
}

.login-layout {
  width: min(1100px, 100%);
  min-height: min(680px, calc(100vh - 2rem));
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  border-radius: 24px;
  overflow: hidden;
  border: 1px solid var(--line);
  box-shadow: var(--shadow-lg);
  background: var(--surface-solid);
}

.login-brand-panel {
  padding: 2rem;
  background:
    radial-gradient(60rem 24rem at 0 0, color-mix(in srgb, var(--brand) 62%, transparent), transparent 62%),
    radial-gradient(45rem 20rem at 100% 100%, color-mix(in srgb, var(--accent) 44%, transparent), transparent 68%),
    linear-gradient(145deg, color-mix(in srgb, var(--surface-muted) 78%, var(--surface-solid)), var(--surface-solid));
  display: grid;
  align-content: center;
  gap: 0.6rem;
}

.login-logo {
  width: 78px;
  height: 78px;
  object-fit: contain;
  border-radius: 16px;
  box-shadow: var(--shadow-sm);
}

.login-brand-panel h1 {
  font-size: clamp(1.65rem, 1.2rem + 1vw, 2.3rem);
}

.login-brand-panel p {
  margin: 0;
  color: var(--text-muted);
  max-width: 48ch;
}

.login-form-panel {
  padding: 2rem;
  display: grid;
  align-content: center;
}

.login-form-panel h2 {
  margin-bottom: 0.35rem;
}

.login-form-panel form {
  margin-top: 0.8rem;
  display: grid;
  gap: 0.5rem;
}

.login-form-panel label {
  color: var(--text-muted);
  font-size: 0.84rem;
  font-weight: 700;
}

@media (max-width: 1220px) {
  .layout {
    grid-template-columns: 235px minmax(0, 1fr);
  }

  .wide-panel {
    grid-column: span 12;
  }

  .chart-panel {
    grid-column: span 12;
  }

  .table-panel {
    grid-column: span 6;
  }
}

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

  .side-nav {
    position: static;
    min-height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .side-actions {
    margin-top: 0;
  }

  .workspace {
    padding-top: 0.85rem;
  }

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

  .chart-panel,
  .table-panel {
    grid-column: span 12;
  }

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

  .login-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 620px) {
  .workspace,
  .side-nav {
    padding: 0.75rem;
  }

  .panel,
  .workspace-title {
    border-radius: 14px;
  }

  .metric-strip,
  .metric-strip.three {
    grid-template-columns: 1fr;
  }

  .chart-wrap {
    height: 300px;
  }

  .filters,
  .inline-form {
    flex-direction: column;
    align-items: stretch;
  }

  .field-inline {
    min-width: 0;
  }

  .btn,
  input,
  select {
    width: 100%;
  }

  .detail-hero {
    flex-direction: column;
    align-items: flex-start;
  }
}
