:root {
  --bg: #f3f4f6;
  --bg-soft: #eef1f5;
  --surface: #ffffff;
  --surface-soft: #f9fafb;
  --text: #111827;
  --muted: #6b7280;
  --line: #e5e7eb;
  --accent: #0f766e;
  --accent-strong: #0b5f59;
  --success: #0e9f6e;
  --danger: #b42318;
  --danger-soft: #fff1f0;
  --radius: 14px;
  --shadow: 0 6px 16px rgba(15, 23, 42, 0.06);
}

* {
  box-sizing: border-box;
}

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

body {
  color: var(--text);
  font-family: "IBM Plex Sans", "Manrope", "Segoe UI", sans-serif;
  background: linear-gradient(180deg, var(--bg) 0%, var(--bg-soft) 100%);
}

a {
  color: inherit;
}

.shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 248px 1fr;
}

.sidebar {
  padding: 16px;
  border-right: 1px solid var(--line);
  background: var(--surface);
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: inherit;
}

.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.06em;
}

.brand-title {
  font-size: 15px;
  font-weight: 700;
}

.brand-eyebrow,
.eyebrow {
  color: var(--muted);
  font-size: 12px;
}

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

.nav-link {
  text-decoration: none;
  border-radius: 10px;
  padding: 10px 12px;
  border: 1px solid transparent;
  color: #4b5563;
  font-weight: 600;
}

.nav-link:hover {
  background: var(--surface-soft);
  border-color: var(--line);
}

.nav-link.is-active {
  background: #e8f6f4;
  border-color: #c5ece8;
  color: #0f5e57;
}

.sidebar-foot {
  margin-top: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  background: var(--surface-soft);
}

.main {
  padding: 20px;
  width: min(1440px, 100%);
}

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

.page-title {
  margin: 0;
  font-size: clamp(24px, 4vw, 30px);
  line-height: 1.1;
}

.page-subtitle {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.card-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  margin-bottom: 14px;
}

.metric-card,
.panel,
.login-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.metric-card {
  padding: 14px;
}

.metric-label {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
}

.metric-value {
  margin-top: 8px;
  font-size: clamp(24px, 3vw, 32px);
  line-height: 1;
  font-weight: 700;
}

.metric-sub,
.muted,
.tiny,
.table-sub,
.empty-state p,
.panel p {
  color: var(--muted);
}

.metric-sub,
.tiny {
  font-size: 13px;
}

.panel {
  padding: 16px;
  margin-bottom: 14px;
}

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

.panel-head h3 {
  margin: 0;
  font-size: 19px;
}

.panel-head-wrap {
  flex-wrap: wrap;
}

.panel-tools {
  display: grid;
  gap: 8px;
  justify-items: end;
}

.quick-actions {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.quick-link {
  display: block;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  text-decoration: none;
  background: var(--surface-soft);
}

.quick-link:hover {
  border-color: #c7d2fe;
  background: #f1f5f9;
}

.quick-title {
  display: block;
  font-size: 14px;
  font-weight: 700;
}

.quick-sub {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.split-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.detail-layout {
  grid-template-columns: 1.2fr 0.8fr;
}

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

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

.field span {
  font-size: 12px;
  color: #4b5563;
  font-weight: 700;
}

.field input,
.field textarea,
.search-input {
  width: 100%;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  padding: 10px 12px;
  font: inherit;
  color: var(--text);
  background: #fff;
}

.field textarea {
  resize: vertical;
  min-height: 84px;
}

.field input:focus,
.field textarea:focus,
.search-input:focus {
  outline: 2px solid #ccfbf1;
  border-color: var(--accent);
}

.primary-btn,
.ghost-btn,
.danger-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 10px;
  border: 1px solid transparent;
  text-decoration: none;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}

.primary-btn {
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: #fff;
}

.primary-btn:hover {
  filter: brightness(0.95);
}

.ghost-btn {
  background: #fff;
  border-color: #d1d5db;
  color: #374151;
}

.ghost-btn:hover {
  background: #f9fafb;
}

.danger-btn {
  background: var(--danger-soft);
  border-color: #f7c8c5;
  color: var(--danger);
}

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

.table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
}

.table th,
.table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  font-size: 14px;
}

.table th {
  background: #f9fafb;
  color: #4b5563;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  position: sticky;
  top: 0;
  z-index: 1;
}

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

.table-title {
  font-weight: 700;
  font-size: 14px;
}

.table-sub {
  margin-top: 2px;
  font-size: 12px;
}

.text-link {
  color: var(--accent-strong);
  font-weight: 700;
  text-decoration: none;
}

.text-link:hover {
  text-decoration: underline;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 56px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  color: #4b5563;
  background: #f3f4f6;
}

.status-pill.is-online,
.good {
  color: var(--success);
}

.status-pill.is-warn {
  color: #b45309;
  background: #fffbeb;
}

.status-pill.is-offline {
  color: var(--danger);
  background: #fef2f2;
}

.bad {
  color: var(--danger);
}

.empty-state {
  border: 1px dashed #d1d5db;
  border-radius: 12px;
  padding: 14px;
  background: #fafafa;
}

.empty-state h3 {
  margin: 0 0 6px;
}

.code-block {
  margin-top: 4px;
  padding: 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #f8fafc;
  font-family: "SFMono-Regular", "Menlo", monospace;
  font-size: 12px;
  overflow-wrap: anywhere;
}

code {
  font-family: "SFMono-Regular", "Menlo", monospace;
  font-size: 12px;
  background: #f3f4f6;
  border-radius: 6px;
  padding: 2px 5px;
  overflow-wrap: anywhere;
}

.meta-list {
  margin: 0;
  display: grid;
  gap: 6px;
}

.meta-list div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding: 8px 0;
}

.meta-list dt {
  color: #4b5563;
  font-weight: 600;
}

.meta-list dd {
  margin: 0;
  text-align: right;
  font-weight: 600;
}

.alert {
  margin-bottom: 12px;
  border: 1px solid #f5b7b1;
  background: #fff5f5;
  color: var(--danger);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 14px;
}

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

.login-wrap {
  width: min(460px, 100%);
}

.login-card {
  padding: 18px;
}

.login-title {
  margin: 0;
  font-size: 24px;
  line-height: 1.1;
}

.w-full {
  width: 100%;
}

.mt-12 {
  margin-top: 12px;
}

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

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

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

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--line);
    position: sticky;
    top: 0;
    z-index: 3;
  }

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

@media (max-width: 680px) {
  .main,
  .sidebar {
    padding: 12px;
  }

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

  .topbar {
    flex-direction: column;
  }

  .topbar-actions {
    width: 100%;
  }

  .topbar-actions .primary-btn,
  .topbar-actions .ghost-btn,
  .topbar-actions .danger-btn {
    flex: 1;
  }

  .panel-tools {
    width: 100%;
    justify-items: stretch;
  }
}
