:root {
  color-scheme: light;
  --bg: #f5f7f6;
  --surface: #ffffff;
  --surface-2: #edf3f0;
  --surface-3: #e5eee9;
  --text: #17211c;
  --muted: #607169;
  --line: #d8e1dc;
  --accent: #07856f;
  --accent-2: #0e6bcb;
  --accent-3: #d89119;
  --danger: #c2414b;
  --success: #11845b;
  --shadow: 0 18px 45px rgba(18, 31, 26, .08);
  --radius: 8px;
  --sidebar: #10241f;
  --sidebar-text: #edf9f4;
  --focus: 0 0 0 3px rgba(7, 133, 111, .18);
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #101513;
  --surface: #18211d;
  --surface-2: #202c27;
  --surface-3: #293831;
  --text: #eff7f3;
  --muted: #a4b5ad;
  --line: #34453e;
  --accent: #36c5a6;
  --accent-2: #70aefa;
  --accent-3: #e3aa44;
  --danger: #fb7185;
  --success: #4ade80;
  --shadow: 0 18px 45px rgba(0, 0, 0, .24);
  --sidebar: #0c1210;
  --sidebar-text: #eff7f3;
}

* {
  box-sizing: border-box;
}

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

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.boot {
  min-height: 100vh;
  display: grid;
  place-items: center;
  gap: 14px;
  align-content: center;
  color: var(--muted);
}

.boot-mark,
.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 8px;
  background: var(--accent);
  color: white;
  font-weight: 800;
  letter-spacing: 0;
}

.brand-logo {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  object-fit: cover;
  border: 1px solid rgba(255, 255, 255, .18);
  background: #06110f;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(360px, .9fr);
}

.login-aside {
  padding: clamp(28px, 5vw, 72px);
  background:
    linear-gradient(160deg, rgba(7, 133, 111, .92), rgba(16, 36, 31, .96)),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160' viewBox='0 0 160 160'%3E%3Cpath d='M0 80h160M80 0v160' stroke='%23ffffff' stroke-opacity='.08'/%3E%3Ccircle cx='80' cy='80' r='42' fill='none' stroke='%23ffffff' stroke-opacity='.08'/%3E%3C/svg%3E");
  color: white;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 100%;
}

.login-copy {
  max-width: 620px;
}

.login-copy h1 {
  margin: 54px 0 18px;
  font-size: clamp(2.4rem, 6vw, 5rem);
  line-height: .95;
  letter-spacing: 0;
}

.login-copy p {
  max-width: 520px;
  font-size: 1.05rem;
  line-height: 1.7;
  color: rgba(255, 255, 255, .82);
}

.login-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 36px;
}

.login-stat {
  border: 1px solid rgba(255, 255, 255, .18);
  border-radius: var(--radius);
  padding: 16px;
  background: rgba(255, 255, 255, .08);
}

.login-stat strong {
  display: block;
  font-size: 1.25rem;
}

.login-panel {
  display: grid;
  place-items: center;
  padding: clamp(24px, 4vw, 56px);
}

.login-card {
  width: min(100%, 420px);
  padding: 28px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.login-card h2,
.section-title h2,
.panel h2,
.detail-header h2 {
  margin: 0;
  letter-spacing: 0;
}

.login-card p,
.fine-print,
.muted {
  color: var(--muted);
}

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 22px;
  background: var(--sidebar);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand small {
  color: rgba(255, 255, 255, .64);
}

.nav {
  display: grid;
  gap: 7px;
}

.nav button,
.mobile-nav button {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 0;
  border-radius: var(--radius);
  padding: 12px 14px;
  color: inherit;
  background: transparent;
  text-align: left;
}

.nav button.active,
.nav button:hover {
  background: rgba(255, 255, 255, .12);
}

.sidebar-footer {
  margin-top: auto;
  display: grid;
  gap: 10px;
  color: rgba(255, 255, 255, .72);
}

.main {
  min-width: 0;
  padding: 24px clamp(18px, 3vw, 36px) 36px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  margin-bottom: 22px;
}

.topbar h1 {
  margin: 0 0 5px;
  font-size: clamp(1.55rem, 3vw, 2.4rem);
  line-height: 1.08;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.mobile-nav {
  display: none;
  position: sticky;
  bottom: 0;
  z-index: 20;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 4px;
  padding: 8px;
  border-top: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(14px);
}

.mobile-nav button {
  justify-content: center;
  padding: 10px 6px;
  color: var(--muted);
}

.mobile-nav button.active {
  color: var(--accent);
  background: var(--surface-2);
}

.icon {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  padding: 9px 13px;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}

.btn:hover {
  border-color: color-mix(in srgb, var(--accent) 48%, var(--line));
}

.btn:focus-visible,
.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  box-shadow: var(--focus);
  border-color: var(--accent);
}

.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

.btn.subtle {
  background: var(--surface-2);
}

.btn.danger {
  color: var(--danger);
}

.btn.icon-only {
  width: 40px;
  padding: 0;
}

.grid {
  display: grid;
  gap: 16px;
}

.kpi-grid {
  grid-template-columns: repeat(5, minmax(150px, 1fr));
}

.content-grid {
  grid-template-columns: minmax(0, 1.55fr) minmax(320px, .8fr);
}

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

.three-col {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.panel,
.metric-card,
.table-wrap,
.investment-card,
.alert-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.panel {
  padding: 18px;
}

.metric-card {
  padding: 16px;
  min-height: 132px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.metric-card span,
.eyebrow {
  color: var(--muted);
  font-size: .82rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.metric-card strong {
  font-size: clamp(1.25rem, 2.5vw, 1.75rem);
  line-height: 1.1;
  overflow-wrap: anywhere;
}

.metric-card small {
  color: var(--muted);
}

.section-title,
.panel-head,
.detail-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 16px;
}

.panel-head p,
.section-title p {
  margin: 5px 0 0;
  color: var(--muted);
}

.rates-strip {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 10px;
  color: var(--muted);
  background: var(--surface);
  font-size: .88rem;
  white-space: nowrap;
}

.pill.strong {
  color: var(--text);
  font-weight: 800;
}

.chart-box {
  min-height: 260px;
}

.chart {
  display: block;
  width: 100%;
  height: auto;
}

.chart-grid {
  stroke: var(--line);
  stroke-width: 1;
}

.chart-axis {
  fill: var(--muted);
  font-size: 12px;
}

.chart-line {
  fill: none;
  stroke: var(--accent);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.chart-dot {
  fill: var(--surface);
  stroke: var(--accent);
  stroke-width: 2;
}

.bar {
  fill: var(--accent-2);
}

.ranking {
  display: grid;
  gap: 10px;
}

.rank-row {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
}

.rank-number {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: color-mix(in srgb, var(--accent) 16%, transparent);
  color: var(--accent);
  font-weight: 900;
}

.rank-row strong,
.investment-card strong,
.table td,
.table th {
  overflow-wrap: anywhere;
}

.positive {
  color: var(--success);
}

.negative,
.danger-text {
  color: var(--danger);
}

.investment-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
}

.crypto-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 14px;
}

.crypto-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 16px;
  display: grid;
  gap: 16px;
}

.crypto-price {
  display: block;
  font-size: clamp(1.35rem, 2.6vw, 2rem);
  line-height: 1.1;
}

.mini-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.mini-stats span {
  display: grid;
  gap: 4px;
  padding: 10px;
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--muted);
  font-size: .82rem;
}

.mini-stats strong {
  color: var(--text);
}

.secure-bank-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--accent) 14%, transparent), transparent),
    var(--surface-2);
}

.secure-bank-hero strong {
  display: block;
  font-size: 1.2rem;
  margin-bottom: 5px;
}

.secure-bank-hero p {
  margin: 0;
  color: var(--muted);
}

.timeline {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.timeline div,
.provider-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 14px;
}

.timeline span {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--accent);
  color: white;
  font-weight: 900;
  margin-bottom: 10px;
}

.timeline p,
.provider-card p {
  margin: 6px 0 0;
}

.provider-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
}

.provider-card {
  display: grid;
  gap: 12px;
}

.investment-card {
  padding: 16px;
  display: grid;
  gap: 14px;
}

.investment-card.selected {
  border-color: var(--accent);
}

.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.card-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 14px;
}

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

.field.span-2 {
  grid-column: span 2;
}

.field.span-3 {
  grid-column: span 3;
}

.field.span-4 {
  grid-column: span 4;
}

.field.span-5 {
  grid-column: span 5;
}

.field.span-6 {
  grid-column: span 6;
}

.field.span-8 {
  grid-column: span 8;
}

.field.span-12 {
  grid-column: span 12;
}

.field label {
  color: var(--muted);
  font-weight: 800;
  font-size: .86rem;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  padding: 10px 11px;
}

.field textarea {
  resize: vertical;
  min-height: 84px;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
}

.check-row input {
  width: 18px;
  height: 18px;
}

.form-actions {
  grid-column: span 12;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.table-wrap {
  overflow-x: auto;
}

.table {
  width: 100%;
  border-collapse: collapse;
  min-width: 720px;
}

.table th,
.table td {
  padding: 13px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.table th {
  color: var(--muted);
  font-size: .78rem;
  letter-spacing: .08em;
  text-transform: uppercase;
}

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

.detail-layout {
  display: grid;
  grid-template-columns: minmax(280px, .82fr) minmax(0, 1.4fr);
  gap: 16px;
}

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

.detail-list button {
  text-align: left;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  padding: 12px;
}

.detail-list button.active {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 10%, var(--surface));
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.summary-item {
  padding: 13px;
  border-radius: var(--radius);
  background: var(--surface-2);
  border: 1px solid var(--line);
}

.summary-item span {
  display: block;
  color: var(--muted);
  font-size: .8rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .07em;
  margin-bottom: 8px;
}

.summary-item strong {
  font-size: 1.08rem;
  overflow-wrap: anywhere;
}

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

.projection {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  background: var(--surface-2);
}

.projection span {
  color: var(--muted);
  font-size: .84rem;
  font-weight: 800;
}

.projection strong {
  display: block;
  margin-top: 6px;
}

.alert-list {
  display: grid;
  gap: 10px;
}

.alert-card {
  padding: 13px;
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr);
  gap: 10px;
  box-shadow: none;
}

.alert-icon {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--surface-2);
}

.alert-card.warn .alert-icon {
  color: var(--accent-3);
}

.alert-card.danger .alert-icon {
  color: var(--danger);
}

.alert-card.info .alert-icon {
  color: var(--accent-2);
}

.compare-selector {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.compare-selector label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 11px;
  background: var(--surface);
}

.toast {
  position: fixed;
  z-index: 30;
  right: 20px;
  bottom: 20px;
  max-width: min(420px, calc(100vw - 40px));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  padding: 14px 16px;
  box-shadow: var(--shadow);
  transform: translateY(18px);
  opacity: 0;
  pointer-events: none;
  transition: .18s ease;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

.empty {
  padding: 22px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  text-align: center;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 1180px) {
  .kpi-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .content-grid,
  .detail-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  .login-shell,
  .app-layout {
    grid-template-columns: 1fr;
  }

  .login-aside {
    min-height: auto;
  }

  .login-copy h1 {
    margin-top: 32px;
  }

  .sidebar {
    display: none;
  }

  .main {
    padding-bottom: 92px;
  }

  .mobile-nav {
    display: grid;
  }

  .topbar,
  .section-title,
  .panel-head,
  .detail-header {
    align-items: stretch;
    flex-direction: column;
  }

  .top-actions {
    justify-content: flex-start;
  }

  .summary-grid,
  .projection-grid,
  .three-col,
  .two-col,
  .timeline {
    grid-template-columns: 1fr;
  }

  .field.span-2,
  .field.span-3,
  .field.span-4,
  .field.span-5,
  .field.span-6,
  .field.span-8,
  .field.span-12 {
    grid-column: span 12;
  }
}

@media (max-width: 640px) {
  .login-stats,
  .kpi-grid {
    grid-template-columns: 1fr;
  }

  .login-card {
    padding: 20px;
  }

  .main {
    padding-left: 14px;
    padding-right: 14px;
  }

  .panel,
  .metric-card,
  .investment-card {
    padding: 14px;
  }

  .btn {
    width: 100%;
  }

  .btn.icon-only {
    width: 40px;
  }

  .card-actions .btn,
  .top-actions .btn,
  .form-actions .btn {
    width: auto;
  }
}
