html {
  font-size: 15px;
  min-height: 100%;
}

body {
  min-height: 100vh;
  margin: 0;
  color: #172033;
  background: #f4f7fb;
  font-family: "Segoe UI", "Microsoft YaHei", Arial, sans-serif;
}

a {
  color: #1f66d1;
  text-decoration: none;
}

a:hover {
  color: #174ea6;
}

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

.app-sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 22px 18px;
  color: #dbe7f6;
  background: #162033;
  border-right: 1px solid #24324a;
}

.app-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: #ffffff;
}

.app-brand:hover {
  color: #ffffff;
}

.app-brand-mark {
  display: inline-grid;
  width: 44px;
  height: 44px;
  place-items: center;
  color: #0f172a;
  background: #7dd3fc;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 800;
}

.app-brand strong,
.app-brand small {
  display: block;
}

.app-brand strong {
  font-size: 17px;
  line-height: 1.2;
}

.app-brand small {
  margin-top: 3px;
  color: #9fb2cc;
  font-size: 12px;
}

.app-nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.app-nav a {
  display: flex;
  align-items: center;
  min-height: 42px;
  padding: 10px 12px;
  color: #c8d5e8;
  border-radius: 8px;
  font-weight: 600;
}

.app-nav a:hover,
.app-nav a:focus {
  color: #ffffff;
  background: #22304a;
}

.app-sidebar-note {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px;
  color: #b8c7dd;
  background: #101827;
  border: 1px solid #28384f;
  border-radius: 8px;
  font-size: 13px;
}

.status-dot {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  background: #2dd4bf;
  border-radius: 50%;
  box-shadow: 0 0 0 3px rgba(45, 212, 191, 0.14);
}

.app-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  background:
    linear-gradient(180deg, #fbfdff 0, #f4f7fb 220px, #f4f7fb 100%);
}

.app-topbar {
  min-height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px clamp(16px, 1.8vw, 28px);
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid #dfe7f1;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.8) inset;
}

.app-topbar-title {
  color: #111827;
  font-size: 18px;
  font-weight: 700;
}

.app-topbar-subtitle {
  margin-top: 3px;
  color: #64748b;
  font-size: 13px;
}

.app-content {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: clamp(14px, 1.6vw, 24px) clamp(16px, 1.8vw, 28px) 20px;
}

.app-footer {
  margin-top: auto;
  padding: 10px clamp(16px, 1.8vw, 28px);
  color: #718096;
  font-size: 13px;
  border-top: 1px solid #e3eaf3;
  background: rgba(255, 255, 255, 0.42);
}

.dashboard-body {
  overflow: hidden;
}

.dashboard-body .app-shell,
.dashboard-body .app-main {
  height: 100vh;
  min-height: 0;
}

.dashboard-body .app-content {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.dashboard-body .app-footer {
  flex: 0 0 auto;
}

h1,
.h1,
.h2,
.h3 {
  color: #111827;
  font-weight: 750;
}

.h3,
h1.h3 {
  font-size: 24px;
}

.btn {
  border-radius: 7px;
  font-weight: 650;
}

.btn-primary {
  background: #2563eb;
  border-color: #2563eb;
}

.btn-primary:hover {
  background: #1d4ed8;
  border-color: #1d4ed8;
}

.btn-outline-primary,
.btn-outline-secondary,
.btn-outline-warning {
  background: #ffffff;
}

.table {
  --table-border: #c8d3df;
  --table-row-border: #e8eef6;
  --bs-table-bg: #ffffff;
  --bs-table-color: #273449;
  --bs-table-striped-bg: #fafcff;
  --bs-table-hover-bg: #f4f7fb;
  --bs-table-hover-color: #0f172a;
  width: 100%;
  table-layout: auto;
  border-collapse: separate;
  border-spacing: 0;
  overflow: hidden;
  margin-bottom: 0;
  color: var(--bs-table-color);
  background: #ffffff;
  border: 1px solid var(--table-border);
  border-radius: 8px;
  box-shadow:
    0 1px 2px rgba(15, 23, 42, 0.05),
    0 8px 20px rgba(15, 23, 42, 0.05);
}

.table > :not(caption) > * > * {
  padding: 11px 14px;
  border-bottom: 1px solid var(--table-row-border);
  overflow-wrap: anywhere;
}

.table thead th {
  color: #475569;
  background:
    linear-gradient(180deg, #f3f7fb 0%, #eaf1f8 100%);
  border-bottom: 1px solid #d2dde9;
  font-size: 13px;
  font-weight: 750;
  white-space: nowrap;
}

.table tbody tr {
  transition: background-color .16s ease, color .16s ease;
}

.table tbody tr:nth-child(odd) > * {
  --bs-table-accent-bg: #ffffff;
}

.table tbody tr:nth-child(even) > * {
  --bs-table-accent-bg: #fafcff;
}

.table-hover > tbody > tr:hover > * {
  --bs-table-accent-bg: var(--bs-table-hover-bg);
  color: var(--bs-table-hover-color);
}

.table-hover > tbody > tr:hover > *:first-child {
  box-shadow: inset 4px 0 0 #2563eb;
}

.table tbody td {
  color: #29364a;
  line-height: 1.45;
}

.table tbody td:first-child,
.table tbody th:first-child {
  color: #111827;
  font-weight: 620;
}

.table tbody tr:hover td:first-child,
.table tbody tr:hover th:first-child {
  color: #111827;
}

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

.table-striped > tbody > tr:nth-of-type(odd) > * {
  --bs-table-accent-bg: #ffffff;
}

.table-striped > tbody > tr:nth-of-type(even) > * {
  --bs-table-accent-bg: #fafcff;
}

code {
  color: #0f3d77;
  background: #eaf3ff;
  border-radius: 5px;
  padding: 2px 5px;
  font-size: 0.88em;
}

.cert-pem {
  max-width: 960px;
  max-height: 360px;
  padding: 16px;
  overflow: auto;
  color: #0f172a;
  background: #ffffff;
  border: 1px solid #dfe7f1;
  border-radius: 8px;
  white-space: pre-wrap;
  word-break: break-all;
}

.command-block {
  overflow: hidden;
  background: #ffffff;
  border: 1px solid #dfe7f1;
  border-radius: 8px;
}

.command-block-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  color: #475569;
  background: #f8fafc;
  border-bottom: 1px solid #dfe7f1;
  font-size: 13px;
  font-weight: 750;
}

.command-block-body {
  margin: 0;
  padding: 14px;
  color: #0f172a;
  background: #ffffff;
  white-space: pre-wrap;
  word-break: break-word;
}

.command-block-body code {
  padding: 0;
  color: inherit;
  background: transparent;
}

.event-output {
  max-width: 520px;
  max-height: 180px;
  margin: 0;
  padding: 10px;
  overflow: auto;
  color: #0f172a;
  background: #f8fafc;
  border: 1px solid #dfe7f1;
  border-radius: 7px;
  white-space: pre-wrap;
  word-break: break-word;
}

form.col-lg-6,
form.col-lg-8,
.row:has(dt) {
  max-width: 860px;
  padding: 24px;
  background: #ffffff;
  border: 1px solid #dfe7f1;
  border-radius: 8px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.form-label,
dt {
  color: #475569;
  font-size: 13px;
  font-weight: 750;
}

.form-control,
.form-select {
  min-height: 42px;
  border-color: #cbd5e1;
  border-radius: 7px;
}

.form-control:focus,
.form-select:focus,
.form-check-input:focus,
.btn:focus,
.btn:active:focus,
.btn-link.nav-link:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 0.18rem rgba(37, 99, 235, 0.16);
}

.form-check-input:checked {
  background-color: #2563eb;
  border-color: #2563eb;
}

dd {
  color: #1f2937;
  margin-bottom: 12px;
}

.alert {
  border-radius: 8px;
}

.dashboard-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: end;
  padding: 20px;
  color: #ffffff;
  background: #172033;
  border: 1px solid #24324a;
  border-radius: 8px;
}

.dashboard-hero-copy {
  max-width: 720px;
}

.dashboard-kicker {
  margin: 0 0 8px;
  color: #7dd3fc;
  font-size: 12px;
  font-weight: 850;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.dashboard-hero h1 {
  margin: 0;
  color: #ffffff;
  font-size: 26px;
  line-height: 1.2;
}

.dashboard-hero p:not(.dashboard-kicker) {
  margin: 6px 0 0;
  color: #c8d5e8;
  line-height: 1.5;
}

.dashboard-hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.dashboard-health-strip {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  padding-top: 12px;
  border-top: 1px solid #2b3b55;
}

.dashboard-health-strip div,
.dashboard-stat-card,
.dashboard-risk-panel,
.dashboard-workbench-panel,
.dashboard-action,
.dashboard-process {
  border: 1px solid #dfe7f1;
  border-radius: 8px;
  background: #ffffff;
}

.dashboard-health-strip div {
  min-height: 56px;
  padding: 10px 12px;
  background: #111a2b;
  border-color: #2b3b55;
}

.dashboard-health-strip span,
.dashboard-stat-card span,
.dashboard-action span {
  display: block;
  color: #64748b;
  font-size: 13px;
  font-weight: 750;
}

.dashboard-health-strip span {
  color: #9fb2cc;
}

.dashboard-health-strip strong {
  display: block;
  margin-top: 2px;
  color: #ffffff;
  font-size: 22px;
  line-height: 1;
}

.dashboard-viewport {
  display: grid;
  align-content: start;
  gap: 12px;
  min-height: 0;
  height: 100%;
  overflow: auto;
}

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

.dashboard-stat-card {
  min-height: 88px;
  padding: 12px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.dashboard-stat-card strong {
  display: block;
  margin-top: 6px;
  color: #111827;
  font-size: 25px;
  line-height: 1;
}

.dashboard-stat-card small {
  display: block;
  margin-top: 7px;
  color: #718096;
  line-height: 1.5;
}

.dashboard-stat-card.is-warning {
  border-color: #f7c948;
  background: #fffdf4;
}

.dashboard-stat-card.is-danger {
  border-color: #f5b5ad;
  background: #fff8f6;
}

.dashboard-risk-panel {
  min-width: 0;
  padding: 14px;
}

.dashboard-section-heading {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 10px;
}

.dashboard-section-heading h2 {
  margin: 0;
  color: #111827;
  font-size: 16px;
  line-height: 1.3;
}

.dashboard-count-badge {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 5px 10px;
  color: #92400e;
  background: #fff7ed;
  border: 1px solid #fed7aa;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 750;
  white-space: nowrap;
}

.dashboard-empty {
  padding: 12px;
  color: #64748b;
  background: #f8fafc;
  border: 1px dashed #cbd5e1;
  border-radius: 8px;
}

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

.dashboard-risk-item {
  display: grid;
  gap: 5px;
  padding: 10px;
  background: #fffaf0;
  border: 1px solid #fed7aa;
  border-radius: 8px;
}

.dashboard-risk-item div {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px;
}

.dashboard-risk-item strong {
  color: #92400e;
}

.dashboard-risk-item span,
.dashboard-risk-item p {
  color: #475569;
}

.dashboard-risk-item p {
  margin: 0;
  line-height: 1.45;
}

.dashboard-operations-grid {
  display: grid;
  grid-template-columns: minmax(260px, .45fr) minmax(0, 1.55fr);
  gap: 12px;
  align-items: stretch;
  min-height: 0;
}

.dashboard-workbench {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(300px, .65fr);
  gap: 12px;
  min-height: 0;
}

.dashboard-workbench-panel {
  min-width: 0;
  min-height: 0;
  padding: 14px;
  overflow: hidden;
}

.dashboard-table-wrap {
  min-width: 0;
  overflow-x: auto;
}

.dashboard-table time {
  white-space: nowrap;
}

.dashboard-table {
  --table-border: #ccd7e4;
  --table-row-border: #e8eef6;
  background: #ffffff;
  box-shadow: none;
}

.dashboard-table > :not(caption) > * > * {
  padding: 9px 10px;
}

.dashboard-table thead th {
  background: #edf4fb;
}

.dashboard-table td code {
  display: inline-block;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: bottom;
  white-space: nowrap;
}

.dashboard-quick-actions {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.dashboard-action {
  display: grid;
  gap: 5px;
  min-height: 86px;
  padding: 12px;
  color: #172033;
}

.dashboard-action:hover,
.dashboard-action:focus {
  color: #172033;
  border-color: #b7c6da;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
}

.dashboard-action strong {
  color: #111827;
  font-size: 16px;
}

.dashboard-action small {
  color: #64748b;
  line-height: 1.35;
}

.dashboard-process {
  padding: 14px;
}

.dashboard-assist-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, .42fr);
  gap: 12px;
  align-items: stretch;
  min-height: 0;
}

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

.dashboard-card {
  min-height: 148px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 18px;
  color: #172033;
  background: #ffffff;
  border: 1px solid #dfe7f1;
  border-radius: 8px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.dashboard-card:hover {
  border-color: #b7c6da;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
}

.dashboard-card-title {
  color: #111827;
  font-size: 16px;
  font-weight: 750;
}

.dashboard-card-text {
  margin-top: 8px;
  color: #64748b;
  font-size: 13px;
  line-height: 1.6;
}

.dashboard-card-link {
  margin-top: 16px;
  color: #1d4ed8;
  font-weight: 750;
}

.dashboard-panel {
  padding: 22px;
  background: #ffffff;
  border: 1px solid #dfe7f1;
  border-radius: 8px;
}

.dashboard-panel h2 {
  margin-bottom: 14px;
  font-size: 18px;
}

.flow-list {
  display: grid;
  gap: 7px;
  padding: 0;
  margin: 0;
  list-style: none;
}

.flow-list li {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr);
  gap: 8px;
  align-items: start;
  color: #334155;
  line-height: 1.35;
}

.flow-index {
  display: inline-grid;
  width: 22px;
  height: 22px;
  place-items: center;
  color: #ffffff;
  background: #2563eb;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 800;
}

.auth-body {
  min-height: 100vh;
  background: #0f172a;
}

.auth-split-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(420px, 1fr);
  min-height: 100vh;
  background: #0f172a;
}

.auth-hero-panel {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  min-height: 100vh;
  padding: 56px clamp(32px, 5.4vw, 78px);
  color: #ffffff;
  background:
    linear-gradient(135deg, rgba(15, 23, 42, 0.94) 0%, rgba(20, 78, 82, 0.92) 100%),
    #0f172a;
}

.auth-hero-copy {
  max-width: 560px;
}

.auth-kicker,
.auth-eyebrow {
  margin: 0 0 12px;
  color: #8de3dc;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.auth-hero-copy h1 {
  margin: 0;
  color: #ffffff;
  font-size: clamp(52px, 6vw, 76px);
  line-height: 1;
}

.auth-hero-copy p {
  max-width: 500px;
  margin: 18px 0 0;
  color: #d5e2ee;
  font-size: 16px;
  line-height: 1.8;
}

.auth-form-panel {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 32px clamp(24px, 5vw, 72px);
  background: #0f172a;
}

.auth-form-card {
  width: min(100%, 458px);
  margin: 0 auto;
  padding: 34px;
  background: #ffffff;
  border: 1px solid #dbe5ef;
  border-radius: 8px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.34);
}

.auth-form-header {
  margin-bottom: 28px;
}

.auth-form-header h1 {
  margin: 0;
  color: #111827;
  font-size: 28px;
  line-height: 1.2;
}

.auth-form-header p:last-child {
  margin: 12px 0 0;
  color: #64748b;
  line-height: 1.7;
}

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

.auth-field {
  display: grid;
  gap: 7px;
}

.auth-field .form-label {
  margin: 0;
}

.auth-field .form-control {
  min-height: 46px;
  background: #fbfdff;
}

.auth-actions {
  display: grid;
  gap: 14px;
  margin-top: 4px;
}

.auth-submit {
  min-height: 46px;
  width: 100%;
}

.auth-actions span {
  color: #64748b;
  font-size: 14px;
  text-align: center;
}

.auth-actions a {
  font-weight: 750;
}

@media (max-width: 991.98px) {
  .dashboard-body {
    overflow: auto;
  }

  .dashboard-body .app-shell,
  .dashboard-body .app-main {
    height: auto;
    min-height: 100vh;
  }

  .dashboard-body .app-content {
    display: block;
    overflow: visible;
  }

  .app-shell {
    grid-template-columns: 1fr;
  }

  .app-sidebar {
    position: static;
    height: auto;
    gap: 14px;
    padding: 16px;
  }

  .app-nav {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(104px, 1fr));
  }

  .app-nav a {
    justify-content: center;
    min-height: 38px;
    padding: 8px;
    font-size: 13px;
  }

  .app-sidebar-note {
    display: none;
  }

  .app-content,
  .app-topbar,
  .app-footer {
    padding-left: 18px;
    padding-right: 18px;
  }

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

  .dashboard-hero {
    grid-template-columns: 1fr;
    padding: 22px;
  }

  .dashboard-hero-actions {
    justify-content: flex-start;
  }

  .dashboard-stat-grid,
  .dashboard-quick-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .auth-hero-panel {
    min-height: auto;
    padding: 32px 24px;
  }

  .auth-hero-copy h1 {
    font-size: 42px;
  }

  .auth-form-panel {
    min-height: auto;
    padding: 28px 18px 40px;
  }
}

@media (max-width: 1280px) {
  .dashboard-operations-grid,
  .dashboard-assist-grid {
    grid-template-columns: 1fr;
  }

  .dashboard-workbench {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 575.98px) {
  .app-topbar {
    display: grid;
    gap: 12px;
    align-items: start;
  }

  .app-topbar .d-flex {
    flex-wrap: wrap;
    justify-content: flex-start;
    min-width: 0;
  }

  .app-topbar .text-muted.small {
    overflow-wrap: anywhere;
  }

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

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

  .dashboard-hero h1 {
    font-size: 24px;
  }

  .dashboard-health-strip,
  .dashboard-stat-grid,
  .dashboard-quick-actions {
    grid-template-columns: 1fr;
  }

  .dashboard-section-heading {
    display: grid;
  }

  .table > :not(caption) > * > * {
    padding: 10px;
  }

  .auth-form-card {
    padding: 24px;
  }
}
