:root {
  --ink: #111827;
  --muted: #667085;
  --subtle: #98a2b3;
  --paper: #f7faff;
  --panel: rgba(255, 255, 255, 0.88);
  --panel-solid: #ffffff;
  --line: #dbe5f3;
  --line-soft: #edf2f8;
  --brand: #2563eb;
  --brand-dark: #1e3a8a;
  --brand-soft: #eaf1ff;
  --cyan: #0891b2;
  --amber: #b45309;
  --shadow: 0 20px 55px rgba(15, 23, 42, 0.08);
  --shadow-soft: 0 10px 28px rgba(15, 23, 42, 0.05);
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  background:
    radial-gradient(circle at 18% 8%, rgba(37, 99, 235, 0.14), transparent 28%),
    linear-gradient(180deg, #f9fbff 0%, var(--paper) 45%, #ffffff 100%);
  color: var(--ink);
  font-family: "IBM Plex Sans", ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

.app-nav {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 6px 24px rgba(15, 23, 42, 0.04);
  backdrop-filter: blur(16px);
}

.app-nav .container-fluid {
  max-width: 1320px;
  min-height: 68px;
  padding-inline: 28px;
}

.navbar-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--brand-dark);
  font-size: 1rem;
  font-weight: 700;
}

.navbar-brand:hover {
  color: var(--brand);
}

.brand-mark {
  display: inline-grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 10px;
  background: linear-gradient(145deg, var(--brand), var(--brand-dark));
  color: #ffffff;
  font-size: 0.95rem;
  font-weight: 700;
  box-shadow: 0 10px 24px rgba(37, 99, 235, 0.24);
}

.app-nav .navbar-toggler {
  border: 1px solid var(--line);
  border-radius: 12px;
}

.app-nav .nav-pills {
  gap: 6px;
  margin-left: 22px;
}

.app-nav .nav-link {
  color: #344054;
  border-radius: 999px;
  padding: 8px 13px;
  font-size: 0.94rem;
  font-weight: 600;
}

.app-nav .nav-link:hover,
.app-nav .nav-link:focus {
  background: var(--brand-soft);
  color: var(--brand-dark);
}

.nav-action .btn {
  border-radius: 999px;
  padding: 7px 14px;
  font-weight: 600;
}

.page-shell {
  padding: 34px 0 56px;
}

.dashboard-grid,
.narrow-shell {
  max-width: 1180px;
  margin: 0 auto;
}

.narrow-shell {
  max-width: 720px;
}

.page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin: 4px 0 24px;
}

.page-header.compact {
  align-items: flex-end;
}

.page-header h1,
.login-panel h1 {
  margin: 0;
  color: #101828;
  font-size: clamp(2rem, 5vw, 3.6rem);
  font-weight: 700;
  letter-spacing: 0;
  line-height: 0.98;
}

.narrow-shell .page-header h1 {
  font-size: clamp(2rem, 5vw, 3rem);
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--brand);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.metric-grid,
.chart-grid,
.scenario-grid {
  display: grid;
  gap: 16px;
}

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

.chart-grid,
.scenario-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 18px;
}

.metric-card,
.content-band,
.chart-panel,
.scenario-card,
.entry-form,
.login-panel {
  background:
    linear-gradient(135deg, rgba(37, 99, 235, 0.055), rgba(255, 255, 255, 0) 36%),
    var(--panel);
  border: 1px solid rgba(219, 229, 243, 0.88);
  border-radius: 18px;
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(12px);
}

.metric-card {
  position: relative;
  min-height: 142px;
  overflow: hidden;
  padding: 22px;
}

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

.metric-card span,
.scenario-card span {
  position: relative;
  z-index: 1;
  display: block;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 600;
}

.card-label {
  position: relative;
  z-index: 2;
  display: flex;
  min-height: 40px;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.info-pill {
  display: inline-grid;
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  min-height: 28px;
  padding: 0;
  place-items: center;
  border: 1px solid rgba(37, 99, 235, 0.22);
  border-radius: 50%;
  background: rgba(234, 241, 255, 0.88);
  color: var(--brand-dark);
  font-size: 0.84rem;
  font-weight: 700;
  line-height: 1;
}

.info-pill:hover,
.info-pill:focus {
  border-color: rgba(37, 99, 235, 0.38);
  background: #dbeafe;
  outline: none;
}

.popover {
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  font-family: "IBM Plex Sans", ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.popover-header {
  background: #f3f7ff;
  border-bottom: 1px solid var(--line);
  color: #101828;
  font-weight: 700;
}

.popover-body {
  color: #344054;
  font-weight: 500;
}

.metric-card strong,
.scenario-card strong {
  position: relative;
  z-index: 1;
  display: block;
  color: #101828;
  font-size: clamp(2.1rem, 5vw, 3.25rem);
  font-weight: 700;
  line-height: 1;
}

.metric-card small,
.scenario-card small {
  position: relative;
  z-index: 1;
  color: var(--muted);
  font-weight: 600;
}

.accent-blue::before {
  background: var(--brand);
}

.accent-cyan::before {
  background: var(--cyan);
}

.accent-amber::before,
.scenario-card::before {
  background: var(--amber);
}

.content-band,
.chart-panel,
.entry-form,
.scenario-card,
.reference-panel {
  padding: 22px;
}

.content-band,
.reference-panel {
  margin-top: 18px;
}

.reference-panel {
  background: #f8fbff;
  border: 1px solid rgba(219, 229, 243, 0.9);
  border-radius: 18px;
}

.reference-panel h2 {
  margin: 0 0 12px;
  color: #101828;
  font-size: 1rem;
  font-weight: 700;
}

.reference-panel ul {
  margin: 0;
  padding-left: 1.1rem;
  color: #475467;
  font-size: 0.92rem;
  font-weight: 500;
}

.reference-panel li + li {
  margin-top: 10px;
}

.reference-panel a {
  color: var(--brand-dark);
  font-weight: 700;
  text-decoration: none;
}

.reference-panel a:hover {
  text-decoration: underline;
}

.section-heading h2,
.chart-panel h2 {
  margin: 0 0 16px;
  color: #101828;
  font-size: 1.05rem;
  font-weight: 700;
}

.comparison-table {
  margin-bottom: 0;
  min-width: 720px;
}

.comparison-table thead th {
  background: #f3f7ff;
  color: #344054;
  border-bottom: 1px solid var(--line);
  font-size: 0.86rem;
  font-weight: 700;
}

.comparison-table tbody tr {
  border-color: var(--line-soft);
}

.comparison-table tbody tr:hover {
  background: rgba(37, 99, 235, 0.035);
}

.comparison-table td,
.comparison-table th {
  padding: 16px 14px;
}

.comparison-table td {
  color: #1d2939;
  font-weight: 500;
}

.empty-row {
  color: var(--muted);
  text-align: center;
}

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

.btn-primary {
  background: linear-gradient(135deg, var(--brand), var(--brand-dark));
  border: 0;
  box-shadow: 0 14px 30px rgba(37, 99, 235, 0.2);
}

.btn-primary:hover,
.btn-primary:focus {
  background: linear-gradient(135deg, #1d4ed8, #172554);
  box-shadow: 0 16px 34px rgba(37, 99, 235, 0.26);
}

.btn-outline-secondary {
  border-color: var(--line);
  color: #344054;
}

.btn-xl {
  min-height: 64px;
  font-size: 1.15rem;
  font-weight: 700;
}

.entry-form .form-label {
  color: #344054;
  font-weight: 700;
}

.entry-form .form-control,
.entry-form .form-select,
.login-panel .form-control {
  min-height: 58px;
  border-color: #cad6e6;
  border-radius: 14px;
  color: #101828;
  font-weight: 500;
}

.entry-form .form-control:focus,
.entry-form .form-select:focus,
.login-panel .form-control:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

.login-wrap {
  display: grid;
  min-height: calc(100vh - 120px);
  place-items: center;
  padding: 24px;
}

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

.scenario-card {
  position: relative;
  min-height: 158px;
  overflow: hidden;
}

.alert {
  border: 0;
  border-radius: 14px;
}

@media (max-width: 900px) {
  .app-nav .container-fluid {
    padding-inline: 16px;
  }

  .app-nav .nav-pills {
    align-items: flex-start;
    margin: 14px 0 0;
  }

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

@media (max-width: 640px) {
  .page-shell {
    padding-top: 20px;
  }

  .page-header {
    align-items: stretch;
    flex-direction: column;
  }

  .page-header .btn {
    width: 100%;
  }

  .metric-grid,
  .chart-grid,
  .scenario-grid {
    grid-template-columns: 1fr;
  }

  .metric-card {
    min-height: 118px;
  }
}
