:root {
  --sidebar-width: 264px;
  --page-bg: #f5f7fb;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --surface-strong: #eef4ff;
  --border: #dbe3ef;
  --border-soft: #edf1f6;
  --text: #172033;
  --muted: #667085;
  --primary: #2563eb;
  --primary-strong: #1d4ed8;
  --accent: #0f766e;
  --warning: #b7791f;
  --danger: #dc2626;
  --shadow: 0 10px 28px rgba(23, 32, 51, 0.08);
  --shadow-soft: 0 5px 18px rgba(23, 32, 51, 0.05);
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  background: var(--page-bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

a {
  color: inherit;
}

.app-body {
  overflow-x: hidden;
}

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

.app-sidebar {
  position: sticky;
  top: 0;
  width: var(--sidebar-width);
  height: 100vh;
  flex: 0 0 var(--sidebar-width);
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  padding: 1.25rem;
  background: var(--surface);
  border-right: 1px solid var(--border);
}

.app-content-shell {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.app-topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 76px;
  padding: 1rem 1.75rem;
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid var(--border-soft);
  backdrop-filter: blur(12px);
}

.app-content {
  width: 100%;
  padding: 1.5rem 1.75rem 2rem;
}

.brand-lockup {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--text);
  text-decoration: none;
}

.brand-mark {
  width: 2.5rem;
  height: 2.5rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 2.5rem;
  border-radius: 8px;
  color: var(--primary-strong);
  background: var(--surface-strong);
  border: 1px solid #d8e6ff;
  font-size: 1.15rem;
}

.brand-name {
  display: block;
  font-weight: 760;
  line-height: 1.15;
}

.brand-subtitle {
  display: block;
  margin-top: 0.15rem;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.2;
}

.sidebar-nav {
  display: grid;
  gap: 0.25rem;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  min-height: 2.6rem;
  padding: 0.65rem 0.75rem;
  border-radius: 8px;
  color: #475467;
  font-weight: 620;
  text-decoration: none;
  transition: background-color 0.16s ease, color 0.16s ease, transform 0.16s ease;
}

.sidebar-link i {
  width: 1.25rem;
  color: #667085;
  font-size: 1.05rem;
  text-align: center;
}

.sidebar-link:hover {
  color: var(--primary-strong);
  background: #f3f7ff;
  transform: translateX(2px);
}

.sidebar-link:hover i,
.sidebar-link.active i,
.sidebar-link.active {
  color: var(--primary-strong);
}

.sidebar-link.active {
  background: var(--surface-strong);
}

.sidebar-footer {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 2.5rem;
  padding: 0.65rem 0.75rem;
  color: var(--accent);
  background: #edf8f5;
  border: 1px solid #d5eee8;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 650;
}

.status-dot {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(15, 118, 110, 0.12);
}

.topbar-title-group,
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.topbar-title-group {
  min-width: 0;
}

.topbar-eyebrow {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 760;
  letter-spacing: 0;
  text-transform: uppercase;
}

.topbar-title {
  margin: 0;
  color: var(--text);
  font-size: clamp(1.25rem, 2vw, 1.55rem);
  font-weight: 760;
  line-height: 1.18;
}

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

.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
  box-shadow: 0 8px 18px rgba(37, 99, 235, 0.18);
}

.btn-primary:hover,
.btn-primary:focus {
  background: var(--primary-strong);
  border-color: var(--primary-strong);
}

.btn-outline-secondary {
  color: #475467;
  border-color: var(--border);
  background: var(--surface);
}

.btn-outline-secondary:hover,
.btn-outline-secondary:focus {
  color: var(--primary-strong);
  background: #f3f7ff;
  border-color: #cfe0ff;
}

.btn-outline-danger {
  background: var(--surface);
  border-color: #f2c7c7;
}

.btn-soft {
  color: #475467;
  background: var(--surface-soft);
  border: 1px solid var(--border);
}

.btn-soft:hover,
.btn-soft:focus {
  color: var(--primary-strong);
  background: #f3f7ff;
  border-color: #cfe0ff;
}

.btn-icon {
  width: 2rem;
  height: 2rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.language-select {
  width: auto;
  min-width: 6.25rem;
  border-color: var(--border);
  border-radius: 8px;
  font-weight: 620;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  padding: 1rem;
  box-shadow: var(--shadow-soft);
}

.panel .h6 {
  margin-bottom: 0.85rem;
  color: #344054;
  font-weight: 760;
}

.metric-card {
  min-height: 116px;
  position: relative;
  overflow: hidden;
}

.metric-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: var(--primary);
}

.metric-card .value {
  color: var(--text);
  font-size: 1.85rem;
  font-weight: 780;
  line-height: 1.1;
}

.badge {
  border-radius: 999px;
  padding: 0.36rem 0.6rem;
  font-weight: 700;
}

.badge-status {
  letter-spacing: 0;
}

.table {
  margin-bottom: 0;
}

.table thead th {
  background: var(--surface-soft);
  color: #667085;
  border-bottom: 1px solid var(--border);
  font-size: 0.78rem;
  font-weight: 760;
  white-space: nowrap;
}

.table td,
.table th {
  vertical-align: middle;
  padding: 0.82rem 0.75rem;
}

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

.table tbody tr:hover {
  background: #fbfdff;
}

.table-responsive {
  border-radius: 8px;
}

.form-control,
.form-select {
  border-color: var(--border);
  border-radius: 8px;
}

.form-control:focus,
.form-select:focus {
  border-color: #9ec1ff;
  box-shadow: 0 0 0 0.2rem rgba(37, 99, 235, 0.12);
}

.form-label {
  color: #344054;
  font-size: 0.86rem;
  font-weight: 700;
}

.modal-content {
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.modal-header,
.modal-footer {
  border-color: var(--border-soft);
}

.code-box,
.config-box {
  background: #101828;
  color: #e4e7ec;
  border: 1px solid #1d2939;
  border-radius: 8px;
  padding: 1rem;
  min-height: 160px;
  max-height: 65vh;
  overflow: auto;
  white-space: pre-wrap;
}

.config-box {
  min-height: 520px;
}

.app-content > .d-flex.align-items-center.justify-content-between.mb-3 {
  justify-content: flex-end !important;
  gap: 0.75rem;
  margin-bottom: 1rem !important;
}

.login-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1.5rem;
  background:
    linear-gradient(135deg, rgba(245, 247, 251, 0.98), rgba(236, 244, 241, 0.98)),
    #f5f7fb;
}

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

.login-panel {
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  padding: 1.25rem;
  box-shadow: var(--shadow);
}

.login-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 2rem;
}

.login-brand .brand-subtitle {
  color: var(--muted);
}

.login-copy {
  margin-bottom: 1.5rem;
}

.input-with-icon {
  position: relative;
}

.input-with-icon i {
  position: absolute;
  left: 0.9rem;
  top: 50%;
  z-index: 2;
  color: #98a2b3;
  transform: translateY(-50%);
}

.input-with-icon .form-control {
  min-height: 2.75rem;
  padding-left: 2.35rem;
}

.btn-login {
  min-height: 2.75rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
}

.mobile-nav {
  --bs-offcanvas-width: min(320px, 88vw);
  background: var(--surface);
}

.mobile-nav .offcanvas-header {
  border-bottom: 1px solid var(--border-soft);
}

.mobile-nav .offcanvas-body {
  padding: 1rem;
}

@media (max-width: 991.98px) {
  .app-sidebar {
    display: none;
  }

  .app-topbar {
    min-height: 70px;
    padding: 0.85rem 1rem;
  }

  .app-content {
    padding: 1rem;
  }

  .topbar-actions {
    gap: 0.5rem;
  }
}

@media (max-width: 575.98px) {
  .app-topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .topbar-actions {
    width: 100%;
    justify-content: flex-end;
  }

  .topbar-title {
    font-size: 1.22rem;
  }

  .panel {
    padding: 0.85rem;
  }

  .login-panel {
    padding: 1rem;
  }
}
