
:root {
  --sidebar-width: 296px;
  --subnav-width: 256px;
  --content-max-width: 1200px;
  --app-bg: #f2f5fb;
  --card-radius: 1rem;
  --shadow-soft: 0 10px 30px rgba(15, 23, 42, 0.08);
  --text-muted-2: #64748b;
}

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

body {
  background: radial-gradient(circle at top right, #eef4ff 0, #f2f5fb 48%, #eef2f8 100%);
  color: #0f172a;
}

.app-shell {
  display: flex;
  min-height: 100vh;
  padding: 14px 14px 14px 16px;
}

.content-limit {
  width: 100%;
  max-width: var(--content-max-width);
  margin: 0 auto;
}

.sidebar {
  width: var(--sidebar-width);
  background: linear-gradient(185deg, #0a1732 0%, #101b36 45%, #0f1a35 100%);
  color: #cbd5e1;
  position: fixed;
  left: 16px;
  top: 14px;
  bottom: 14px;
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 1030;
  border-radius: 1.15rem;
  box-shadow: 0 20px 40px rgba(2, 6, 23, 0.35);
}

.sidebar .brand {
  padding: 1.3rem 1.35rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, .09);
}

.sidebar .brand small {
  color: #94a3b8;
}

.nav-groups {
  padding: .85rem .7rem 1.2rem;
}

.nav-group + .nav-group {
  margin-top: .25rem;
}

.nav-group-toggle {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  border: 0;
  background: transparent;
  color: #94a3b8;
  font-size: .74rem;
  text-transform: uppercase;
  letter-spacing: .07em;
  border-radius: .7rem;
  padding: .62rem .62rem .48rem;
  font-weight: 700;
}

.nav-group-toggle:hover,
.nav-group-toggle.active {
  color: #dbeafe;
  background: rgba(148, 163, 184, .12);
}

.nav-group-arrow {
  transition: transform .2s ease;
}

.nav-group-toggle[aria-expanded="true"] .nav-group-arrow {
  transform: rotate(0deg);
}

.nav-group-toggle[aria-expanded="false"] .nav-group-arrow {
  transform: rotate(-90deg);
}

.sidebar .nav-link {
  color: #cbd5e1;
  border-radius: .8rem;
  margin: .15rem .25rem;
  padding: .67rem .88rem;
  font-weight: 500;
}

.sidebar .nav-link:hover,
.sidebar .nav-link.active {
  background: rgba(59, 130, 246, .21);
  color: #fff;
}

.sidebar .nav-link .badge {
  font-size: .68rem;
}

.content-wrap {
  margin-left: calc(var(--sidebar-width) + 24px);
  width: calc(100% - var(--sidebar-width) - 24px);
  min-width: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 1020;
  backdrop-filter: blur(8px);
  background: rgba(242, 245, 251, .9);
  border-bottom: 1px solid rgba(15, 23, 42, .08);
}

.topbar-main {
  padding: .95rem 0 .82rem;
}

.topbar-head {
  min-width: 260px;
}

.page-head h1 {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0;
}

.page-head p {
  margin: .3rem 0 0;
  color: var(--text-muted-2);
}

.topbar-actions .btn {
  border-radius: .65rem;
  padding-inline: .72rem;
}

.quick-actions-bar {
  border-top: 1px solid rgba(15, 23, 42, .06);
  padding: .56rem 0 .65rem;
  display: flex;
  align-items: center;
  gap: .75rem;
  flex-wrap: wrap;
}

.quick-actions-label {
  font-size: .74rem;
  text-transform: uppercase;
  letter-spacing: .07em;
  font-weight: 700;
  color: #475569;
}

.quick-actions-list {
  display: flex;
  flex-wrap: wrap;
  gap: .45rem;
}

.quick-action-link {
  display: inline-flex;
  align-items: center;
  border-radius: .65rem;
  border: 1px solid #dbe3f0;
  background: #fff;
  color: #1e293b;
  text-decoration: none;
  font-size: .84rem;
  padding: .35rem .65rem;
  transition: all .16s ease;
}

.quick-action-link:hover {
  background: #eff6ff;
  border-color: #bfdbfe;
  color: #1d4ed8;
}

.workbench {
  display: grid;
  grid-template-columns: minmax(0, var(--subnav-width)) minmax(0, 1fr);
  gap: 1rem;
  padding: 1rem 1rem .8rem;
}

.subnav-panel {
  min-width: 0;
}

.subnav-card {
  position: sticky;
  top: 136px;
  background: #fff;
  border: 1px solid rgba(15, 23, 42, .08);
  border-radius: 1rem;
  box-shadow: var(--shadow-soft);
  padding: .9rem;
}

.subnav-title {
  color: #334155;
  font-size: .74rem;
  text-transform: uppercase;
  letter-spacing: .07em;
  font-weight: 800;
  margin-bottom: .65rem;
}

.subnav-link {
  display: block;
  color: #334155;
  text-decoration: none;
  border-radius: .65rem;
  padding: .52rem .62rem;
  margin-bottom: .2rem;
  font-size: .9rem;
}

.subnav-link:hover {
  background: #eff6ff;
  color: #1d4ed8;
}

.subnav-link.active {
  background: #dbeafe;
  color: #1d4ed8;
  font-weight: 700;
}

.subnav-divider {
  margin: .55rem 0 .6rem;
  border-color: #e2e8f0;
}

.content-main {
  min-width: 0;
}

.card {
  border: 0;
  border-radius: var(--card-radius);
  box-shadow: var(--shadow-soft);
}

.metric-card .metric-value {
  font-size: 1.8rem;
  font-weight: 800;
  line-height: 1;
}

.metric-card .metric-label,
.muted-2 {
  color: var(--text-muted-2);
}

.table thead th {
  color: #64748b;
  font-size: .8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .03em;
  border-bottom-width: 1px;
}

.table td, .table th {
  vertical-align: middle;
}

.status-dot {
  width: .7rem;
  height: .7rem;
  display: inline-block;
  border-radius: 999px;
  margin-right: .45rem;
}

.status-ok { background: #22c55e; }
.status-warn { background: #f59e0b; }
.status-danger { background: #ef4444; }
.status-muted { background: #94a3b8; }

.kpi-tile {
  min-height: 150px;
}

.log-console {
  background: #0b1220;
  color: #d2e6ff;
  border-radius: 1rem;
  padding: 1rem 1.1rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: .83rem;
  line-height: 1.55;
  max-height: 430px;
  overflow: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

main pre:not(.log-console),
.card pre:not(.log-console) {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: .75rem;
  padding: .8rem .9rem;
  max-height: 560px;
  overflow: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

details > summary {
  cursor: pointer;
}

.step-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 999px;
  font-weight: 700;
  background: #e2e8f0;
  color: #0f172a;
}

.step-pill.active {
  background: #2563eb;
  color: #fff;
}

.config-chip {
  padding: .45rem .7rem;
  border-radius: 999px;
  background: #eff6ff;
  color: #1d4ed8;
  font-weight: 600;
  display: inline-flex;
  margin: .15rem;
  font-size: .8rem;
}

.secret-mask {
  letter-spacing: .12em;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.timeline {
  border-left: 2px solid #e2e8f0;
  padding-left: 1rem;
  margin-left: .5rem;
}

.timeline-item {
  position: relative;
  padding-bottom: 1rem;
}

.timeline-item:before {
  content: "";
  position: absolute;
  left: -1.42rem;
  top: .25rem;
  width: .8rem;
  height: .8rem;
  border-radius: 999px;
  background: #2563eb;
  box-shadow: 0 0 0 4px #dbeafe;
}

.server-hero {
  background: linear-gradient(135deg, #0f172a 0%, #1d4ed8 100%);
  color: #fff;
}

.server-grid-card {
  overflow: hidden;
  transition: transform .16s ease, box-shadow .16s ease;
}

.server-grid-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 34px rgba(15, 23, 42, 0.12);
}

.server-grid-head {
  padding: 1rem 1rem .9rem;
  background: linear-gradient(135deg, #1e293b 0%, #2563eb 100%);
  color: #fff;
}

.list-soft > * + * {
  border-top: 1px solid #eef2f7;
}

.quick-link {
  text-decoration: none;
  color: inherit;
  display: block;
}

.quick-link:hover .card {
  transform: translateY(-1px);
}

.form-text code {
  color: #1d4ed8;
}

.page-footer {
  color: #64748b;
  font-size: .88rem;
}

.settings-tabs .nav-link {
  border-radius: .6rem;
  padding: .42rem .7rem;
  border: 1px solid #e2e8f0;
  background: #fff;
  color: #334155;
  font-weight: 600;
}

.settings-tabs .nav-link.active {
  background: #2563eb;
  border-color: #2563eb;
}

.modal-dialog {
  margin: 2rem auto;
}

.modal-content {
  border-radius: 1rem;
  border: 0;
  box-shadow: 0 24px 48px rgba(15, 23, 42, .22);
}

.modal-body {
  max-height: calc(100vh - 200px);
  overflow: auto;
}

.text-modal-console {
  background: #0b1220;
  color: #d2e6ff;
  min-height: 180px;
  max-height: 68vh;
}

@media (max-width: 1300px) {
  .workbench {
    grid-template-columns: minmax(0, 232px) minmax(0, 1fr);
  }
}

@media (max-width: 1099.98px) {
  :root {
    --subnav-width: 220px;
  }

  .app-shell {
    padding: .75rem;
  }

  .sidebar {
    left: .75rem;
    top: .75rem;
    bottom: .75rem;
  }

  .content-wrap {
    margin-left: calc(var(--sidebar-width) + 16px);
    width: calc(100% - var(--sidebar-width) - 16px);
  }
}

@media (max-width: 991.98px) {
  .app-shell {
    display: block;
    padding: .65rem;
  }

  .sidebar {
    position: static;
    width: 100%;
    max-height: none;
    margin-bottom: .75rem;
  }

  .content-wrap {
    margin-left: 0;
    width: 100%;
  }

  .workbench {
    display: block;
    padding-inline: .1rem;
  }

  .subnav-panel {
    margin-bottom: .75rem;
  }

  .subnav-card {
    position: static;
  }
}
