.modal {
  position: fixed;
  inset: 0;
  background: #000b;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 18px;
}
.modal-card {
  position: relative;
  width: min(760px, 96vw);
  max-height: 92vh;
  overflow: auto;
  background: #10161e;
  border: 1px solid #35414d;
  padding: 24px;
  box-shadow: 0 30px 90px #000;
}
.modal-close {
  position: absolute;
  right: 14px;
  top: 10px;
  border: 0;
  background: transparent;
  color: #fff;
  font-size: 25px;
}
.edit-form {
  display: grid;
  gap: 14px;
}
.edit-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.edit-form label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 11px;
}
.edit-form input,
.edit-form select,
.edit-form textarea,
[data-second-control] {
  background: #080d12;
  border: 1px solid #2a3541;
  color: #fff;
  padding: 8px;
  outline: 0;
}
.asset-editor {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.clickable {
  cursor: pointer;
}
.clickable:hover {
  background: #151d25;
}
@media (max-width: 600px) {
  .edit-grid,
  .asset-editor {
    grid-template-columns: 1fr;
  }
}

#admin aside {
  padding: 20px 12px 14px;
}
#admin aside nav {
  display: flex;
  flex-direction: column;
  gap: 3px;
  overflow-y: auto;
  min-height: 0;
  padding-right: 4px;
  scrollbar-width: thin;
  scrollbar-color: transparent transparent;
  scrollbar-gutter: stable;
  overscroll-behavior: contain;
}
#admin aside nav:hover {
  scrollbar-color: #536a84 transparent;
}
#admin aside nav::-webkit-scrollbar {
  width: 4px;
}
#admin aside nav::-webkit-scrollbar-track {
  background: transparent;
}
#admin aside nav::-webkit-scrollbar-thumb {
  background: transparent;
  border-radius: 999px;
}
#admin aside nav:hover::-webkit-scrollbar-thumb {
  background: #536a84;
}
#admin aside nav::-webkit-scrollbar-thumb:hover {
  background: #6f8aa8;
}
#admin aside nav button {
  flex: 0 0 auto;
  border-radius: 7px;
  padding: 10px 12px;
}
#admin aside nav button.active {
  background: linear-gradient(90deg, #25351d, #17201a);
  color: var(--lime);
  box-shadow: inset 3px 0 var(--lime);
}
.nav-section {
  color: #53606c;
  font-size: 9px;
  font-style: normal;
  letter-spacing: 0.16em;
  padding: 16px 12px 6px;
  text-transform: uppercase;
}
#admin .content {
  padding-top: 22px;
}
#admin .title {
  background: linear-gradient(120deg, #111923, #0d141b);
  border: 1px solid var(--line);
  padding: 20px 22px;
  margin-bottom: 14px;
}
#admin .title h1 {
  font-size: 23px;
}
#admin .stat {
  min-height: 98px;
  position: relative;
  overflow: hidden;
}
#admin .stat::after {
  content: "";
  position: absolute;
  width: 46px;
  height: 46px;
  right: -18px;
  bottom: -18px;
  border: 10px solid #b8ff3f0b;
  border-radius: 50%;
}
#admin .stat strong {
  font-size: 23px;
}
#admin .panel {
  border-radius: 5px;
  overflow: hidden;
}
#admin .panel-head {
  background: #111923;
}
#admin .table tbody tr:hover {
  background: #141d26;
}
#admin .table td {
  vertical-align: middle;
}
#admin .table td small {
  color: var(--muted);
}
@media (max-width: 700px) {
  #admin aside {
    width: min(280px, 86vw);
  }
  #admin .title {
    padding: 16px;
  }
  #admin .title h1 {
    font-size: 20px;
  }
  .admin-ext-stats {
    grid-template-columns: 1fr 1fr !important;
  }
  .admin-ext-stats .stat {
    min-height: 88px;
  }
}

/* Blue/white operations theme aligned with the reference administration UI. */
body {
  background: #f3f6fb;
  color: #172033;
}
.login-shell {
  background: linear-gradient(135deg, #edf5ff, #f8fbff);
}
.login-card {
  background: #fff;
  border: 1px solid #dce5f0;
  box-shadow: 0 24px 70px #1d4f9120;
}
.login-card h1,
.login-card .brand {
  color: #172033;
}
.login-card .brand i,
.primary,
.login-card button {
  background: #1677ff;
  color: #fff;
}
.login-card input {
  background: #f8fafe;
  border-color: #d9e2ef;
  color: #172033;
}
#admin aside {
  background: #151c26;
  border-color: #202a37;
}
#admin aside .brand i {
  background: #1677ff;
  color: #fff;
}
#admin aside nav button {
  color: #aab5c4;
}
#admin aside nav button:hover {
  background: #202b39;
  color: #fff;
}
#admin aside nav button.active {
  background: #1677ff;
  color: #fff;
  box-shadow: none;
}
.nav-section {
  color: #687789;
}
#admin main {
  background: #f3f6fb;
  min-height: 100vh;
}
#admin header {
  background: #ffffffed;
  border-color: #dde5ef;
  color: #182136;
  box-shadow: 0 1px 8px #28466e0a;
}
#admin header small {
  color: #8b98aa;
}
#admin .content {
  max-width: 1680px;
}
#admin .title {
  background: transparent;
  border: 0;
  padding: 6px 2px 12px;
}
#admin .title h1 {
  color: #172033;
}
#admin .title p {
  color: #7d899a;
}
#admin .stat,
#admin .panel {
  background: #fff;
  border-color: #e2e8f0;
  box-shadow: 0 2px 9px #21436b0b;
  border-radius: 10px;
}
#admin .stat small {
  color: #8591a2;
}
#admin .stat strong {
  color: #172033;
}
#admin .stat strong.up,
#admin .up {
  color: #13ad73;
}
#admin .danger,
#admin .down {
  color: #ef5350;
}
#admin .stat::after {
  border-color: #1677ff0d;
}
#admin .panel-head {
  background: #fff;
  border-color: #e7ecf3;
}
#admin .panel-head h3 {
  color: #222d40;
}
#admin .table th {
  color: #7d8998;
  background: #f8fafc;
  font-weight: 600;
}
#admin .table td {
  color: #344054;
  border-color: #edf0f5;
}
#admin .table tbody tr:hover {
  background: #f5f9ff;
}
#admin .table td small,
#admin .empty {
  color: #8a96a7;
}
#admin .btn {
  background: #fff;
  border-color: #ccd7e5;
  color: #456078;
  border-radius: 5px;
}
#admin .btn.green {
  background: #1677ff;
  border-color: #1677ff;
  color: #fff;
}
#admin .btn.red {
  color: #ef5350;
  border-color: #ffcdd2;
}
#admin input,
#admin select,
#admin textarea,
#admin [data-second-control] {
  background: #fff;
  border: 1px solid #d7e0eb;
  color: #27364a;
  border-radius: 5px;
}
#admin input:focus,
#admin select:focus,
#admin textarea:focus {
  border-color: #1677ff;
  box-shadow: 0 0 0 3px #1677ff16;
}
#admin .badge {
  background: #e8f3ff;
  color: #1677ff;
}
#admin .modal {
  background: #17203380;
}
#admin .modal-card {
  background: #fff;
  border-color: #dce4ee;
  color: #27364a;
  border-radius: 10px;
}
#admin .modal-close {
  color: #657287;
}
#admin .primary {
  background: #1677ff;
  color: #fff;
  border-radius: 5px;
  width: auto;
  padding-inline: 22px;
}
.content-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.admin-copy-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 12px;
  padding: 5px;
  overflow-x: auto;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 9px;
}
.admin-copy-tabs button {
  flex: 0 0 auto;
  padding: 9px 18px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #6f7d90;
}
.admin-copy-tabs button.active {
  background: #1677ff;
  color: #fff;
}
.dash-primary {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}
.dash-kpi {
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: 112px;
  padding: 20px;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 11px;
  box-shadow: 0 2px 9px #21436b0b;
}
.dash-kpi > i {
  display: grid;
  place-items: center;
  flex: 0 0 52px;
  width: 52px;
  height: 52px;
  border-radius: 10px;
  font-size: 22px;
  font-style: normal;
}
.dash-kpi > i.blue {
  color: #1683ff;
  background: #e9f4ff;
}
.dash-kpi > i.green {
  color: #16b978;
  background: #e8faf2;
}
.dash-kpi > i.cyan {
  color: #18b6c7;
  background: #e5f8fa;
}
.dash-kpi > i.orange {
  color: #ff9100;
  background: #fff4e4;
}
.dash-kpi small,
.dash-kpi span {
  display: block;
  color: #8793a5;
}
.dash-kpi strong {
  display: block;
  margin: 5px 0;
  color: #172033;
  font-size: 27px;
}
.dash-kpi span {
  font-size: 10px;
}
.dash-sections,
.dash-charts {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-top: 14px;
}
.dash-summary,
.dash-chart {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 11px;
  padding: 19px;
  box-shadow: 0 2px 9px #21436b0b;
}
.dash-summary h3,
.dash-chart h3 {
  margin: 0 0 18px;
  padding-bottom: 12px;
  border-bottom: 1px solid #edf1f6;
  font-size: 13px;
}
.dash-summary > div {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  row-gap: 22px;
  text-align: center;
}
.dash-summary span b,
.dash-summary span small {
  display: block;
}
.dash-summary span b {
  font-size: 20px;
}
.dash-summary span small {
  margin-top: 7px;
  color: #8793a5;
  font-size: 9px;
}
.dash-summary .positive {
  color: #12b978;
}
.dash-summary .warning {
  color: #ff9100;
}
.dash-chart {
  min-height: 270px;
}
.dash-bars {
  height: 190px;
  display: flex;
  align-items: end;
  gap: 9px;
  padding-top: 22px;
}
.dash-bar {
  position: relative;
  display: grid;
  grid-template-rows: 1fr auto;
  align-items: end;
  flex: 1;
  height: 100%;
  text-align: center;
}
.dash-bar-value {
  position: absolute;
  top: -17px;
  width: 100%;
  color: #6f7d90;
  font-size: 9px;
}
.dash-bar-stack {
  height: 100%;
  display: flex;
  align-items: end;
  justify-content: center;
  gap: 2px;
  border-bottom: 1px solid #dfe6ef;
}
.dash-bar-stack i {
  display: block;
  width: min(15px, 40%);
  min-height: 2px;
  border-radius: 3px 3px 0 0;
}
.dash-bar small {
  padding-top: 7px;
  color: #8b97a8;
  font-size: 8px;
}
.dash-legend {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 5px;
  margin-top: 10px;
  color: #7e8a9a;
  font-size: 9px;
}
.dash-legend i {
  width: 8px;
  height: 8px;
  margin-left: 8px;
}
.report-pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 13px 16px;
  background: #fff;
  border-top: 1px solid #edf1f6;
  color: #7e8b9d;
  font-size: 11px;
}
.pagination-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}
.pagination-controls button {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 1px solid #d7e0eb;
  border-radius: 5px;
  background: #fff;
  color: #456078;
  font-size: 18px;
}
.pagination-controls button:hover:not(:disabled) {
  border-color: #1677ff;
  color: #1677ff;
}
.pagination-controls button:disabled {
  cursor: not-allowed;
  opacity: 0.35;
}
.pagination-controls label {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: 6px;
}
.pagination-controls select {
  min-width: 72px;
  height: 30px;
  padding: 0 7px;
  border: 1px solid #d7e0eb;
  border-radius: 5px;
  background: #fff;
  color: #344054;
}
.setting-sections {
  display: grid;
  gap: 16px;
}
.setting-sections fieldset {
  margin: 0;
  border: 1px solid #e1e8f1;
  border-radius: 8px;
  padding: 18px;
}
.setting-sections legend {
  padding: 0 8px;
  color: #26364b;
  font-weight: 700;
}
.setting-group {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.setting-group label {
  display: grid;
  gap: 7px;
  color: #66758a;
  font-size: 11px;
}
.setting-group small {
  color: #9aa5b4;
}
.setting-save {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 2px;
  color: #7e8b9d;
}
@media (max-width: 700px) {
  .setting-group {
    grid-template-columns: 1fr;
  }
  .setting-save {
    align-items: stretch;
    flex-direction: column;
    gap: 10px;
  }
  #admin .primary {
    width: 100%;
  }
  .dash-primary,
  .dash-sections,
  .dash-charts {
    grid-template-columns: 1fr;
  }
  .dash-primary {
    gap: 9px;
  }
  .dash-kpi {
    min-height: 94px;
    padding: 15px;
  }
  .dash-chart {
    min-height: 245px;
  }
  .report-pagination {
    align-items: flex-start;
    flex-direction: column;
  }
  .pagination-controls {
    align-self: stretch;
    justify-content: flex-end;
  }
}
@media (min-width: 701px) and (max-width: 1150px) {
  .dash-primary {
    grid-template-columns: repeat(2, 1fr);
  }
  .dash-sections,
  .dash-charts {
    grid-template-columns: 1fr;
  }
}

/* The modal is a sibling of #admin, so it needs its own light theme. */
#admin-modal {
  --panel: #fff;
  --line: #dce4ee;
  --text: #27364a;
  --muted: #657287;
  background: #17203380;
  color-scheme: light;
  color: var(--text);
}
#admin-modal .modal-card {
  background: #fff;
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 12px;
  box-shadow: 0 20px 64px #17203330;
}
#admin-modal .modal-close { color: #657287; }
#admin-modal h2 { margin: 0 32px 22px 0; color: #172b4d; }
#admin-modal input:not([type="checkbox"]):not([type="radio"]),
#admin-modal select,
#admin-modal textarea {
  min-width: 0;
  width: 100%;
  background: #fff;
  color: #27364a;
  border: 1px solid #d7e0eb;
  border-radius: 6px;
  padding: 10px 12px;
  outline: none;
}
#admin-modal input::placeholder,
#admin-modal textarea::placeholder { color: #7b8798; }
#admin-modal input:focus,
#admin-modal select:focus,
#admin-modal textarea:focus { border-color: #1677ff; box-shadow: 0 0 0 3px #1677ff16; }
#admin-modal select option { color: #27364a; background: #fff; }
#admin-modal .primary { color: #fff; background: #1677ff; border-radius: 6px; padding: 11px 20px; }
#admin-modal .muted { color: #657287; line-height: 1.8; }
#loan-product-form { display: grid; gap: 16px; }
#loan-product-form label { display: grid; gap: 8px; min-width: 0; color: #3b4b60; font-size: 13px; }
#loan-product-form .copy-form-grid { gap: 16px; }
#loan-product-form p { margin: 0; }
#loan-product-preview { background: #f4f8ff; color: #27364a; border: 1px solid #dce8fa; border-radius: 8px; padding: 16px; line-height: 1.8; }
#loan-product-preview > b { display: block; color: #165dcc; margin-bottom: 6px; }
@media (max-width: 600px) { #loan-product-form .copy-form-grid { grid-template-columns: 1fr; } }
.platform-chart { display:block; width:100%; height:auto; max-height:210px; background:#f5f9ff; border-radius:6px; margin:12px 0; }
.platform-preview { background:#f5f9ff; border:1px solid #dce8fa; border-radius:8px; padding:14px; color:#27364a; }
.platform-preview-values { display:flex; justify-content:space-between; flex-wrap:wrap; gap:10px; font-size:12px; }
#admin-modal .edit-form label { color:#3b4b60; font-size:12px; }
.platform-candle-preview { width:100%; height:auto; display:block; background:#fff; border-radius:6px; margin:12px 0; }
.platform-generator-actions { display:flex; gap:10px; }
#platform-generator-form button:disabled { opacity:.5; cursor:default; }
#platform-generation-preview .muted { font-size:11px; margin-bottom:0; }
