:root {
  color-scheme: light;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  background: #f4f7fb;
  color: #17233d;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
}

.topbar,
main {
  width: min(1120px, calc(100% - 40px));
  margin: 0 auto;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto minmax(180px, 1fr);
  align-items: center;
  gap: 18px;
  padding: 18px 0;
}

.brand-heading {
  display: flex;
  align-items: center;
  gap: 12px;
  transition: opacity 0.18s ease;
}

.brand-logo {
  width: 50px;
  height: 50px;
  border-radius: 16px;
  object-fit: cover;
  box-shadow: 0 0 28px rgb(137 18 213 / 26%);
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: 26px;
}

h2 {
  margin-top: 4px;
  font-size: 23px;
}

h3 {
  font-size: 17px;
}

.eyebrow {
  color: #687591;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.status {
  border: 1px solid #cdd8e9;
  border-radius: 999px;
  color: #49617c;
  font-size: 12px;
  font-weight: 700;
  padding: 8px 12px;
}

.tabs {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin: 0 0 14px;
  padding: 10px 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
}

.topbar .logout-button {
  justify-self: end;
  transition: opacity 0.18s ease;
}

.topbar.navigation-only .brand-heading,
.topbar.navigation-only .logout-button {
  opacity: 0;
  pointer-events: none;
}

.hero-balance {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.54fr);
  align-items: center;
  gap: 16px;
  border-radius: 20px;
  background: linear-gradient(135deg, #123c96, #2563eb);
  box-shadow: 0 16px 40px rgb(37 99 235 / 20%);
  color: #ffffff;
  padding: 22px 30px;
}

.hero-main,
.hero-breakdown {
  position: relative;
  z-index: 1;
}

.hero-breakdown {
  display: grid;
  gap: 7px;
  align-content: center;
}

.hero-mini-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border: 1px solid rgb(255 255 255 / 16%);
  border-radius: 14px;
  background: rgb(255 255 255 / 9%);
  padding: 10px 14px;
}

.hero-mini-card strong {
  display: block;
  margin-top: 0;
  font-size: 18px;
  text-align: right;
  white-space: nowrap;
}

.hero-balance .eyebrow,
.hero-balance p {
  color: rgb(255 255 255 / 74%);
}

.hero-balance h2 {
  margin-top: 6px;
  font-size: clamp(36px, 5vw, 54px);
}

.hero-balance small {
  font-size: 18px;
}

.hero-main p:last-child {
  margin-top: 8px;
  font-size: 13px;
}

.dashboard-change {
  color: rgb(255 255 255 / 86%);
  font-size: 14px;
  font-weight: 800;
  margin-top: 10px;
}

.dashboard-change.positive {
  color: #bbf7d0;
}

.dashboard-change.negative {
  color: #fecdd3;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 16px;
}

.summary-card {
  border: 1px solid #e0e6f0;
  border-radius: 16px;
  background: #ffffff;
  padding: 18px;
}

.summary-card strong {
  display: block;
  margin-top: 7px;
  font-size: 22px;
}

.pnl-panel {
  border: 1px solid #e0e6f0;
  border-radius: 18px;
  background: #ffffff;
  box-shadow: 0 10px 30px rgb(34 52 84 / 5%);
  padding: 24px;
}

.pnl-panel > div:first-child {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.pnl-panel h2 {
  margin-top: 4px;
}

.panel-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.manual-balance-row {
  align-items: end;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 14px 0 8px;
}

.manual-balance-row label {
  color: #60708e;
  font-size: 13px;
  font-weight: 700;
}

.manual-balance-row p {
  align-self: center;
  color: var(--muted, #60708e);
  font-size: 12px;
  margin: 0;
}

.account-status-group,
.farm-account-title,
.inline-balance-editor,
.account-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.account-status-group {
  justify-content: flex-end;
}

.balance-mode-control {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line, #d8deea);
  border-radius: 999px;
  background: rgb(6 2 13 / 42%);
  color: var(--muted, #738099);
  font-size: 11px;
  font-weight: 800;
  padding: 5px 8px;
  user-select: none;
}

.balance-mode-control > span {
  transition: color 0.18s ease;
}

.balance-mode-control > span.active {
  color: var(--text, #17213a);
}

.balance-mode-switch {
  position: relative;
  display: inline-flex;
  width: 32px;
  height: 18px;
  cursor: pointer;
}

.balance-mode-switch input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.balance-mode-slider {
  width: 100%;
  height: 100%;
  border: 1px solid rgb(34 211 207 / 42%);
  border-radius: 999px;
  background: rgb(34 211 207 / 18%);
  transition: background 0.18s ease, border-color 0.18s ease;
}

.balance-mode-slider::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--cyan, #22d3cf);
  box-shadow: 0 0 10px rgb(34 211 207 / 38%);
  transition: transform 0.18s ease, background 0.18s ease;
}

.balance-mode-switch input:checked + .balance-mode-slider {
  border-color: rgb(177 69 255 / 52%);
  background: rgb(137 18 213 / 25%);
}

.balance-mode-switch input:checked + .balance-mode-slider::after {
  background: #c96cff;
  transform: translateX(14px);
}

.balance-mode-switch input:focus-visible + .balance-mode-slider {
  outline: 2px solid var(--cyan, #22d3cf);
  outline-offset: 2px;
}

.inline-balance-editor {
  margin-top: 5px;
}

.compact-save-button {
  min-height: 34px;
  padding: 7px 12px;
}

.compact-save-button[hidden] {
  display: none;
}

.balance-source-badge {
  display: inline-block;
  border: 1px solid rgb(34 211 207 / 24%);
  border-radius: 999px;
  background: rgb(34 211 207 / 9%);
  color: var(--cyan, #148b88);
  font-size: 11px;
  font-weight: 800;
  padding: 2px 7px;
  vertical-align: middle;
}

.balance-mode-note {
  display: block;
  margin-top: 6px;
  color: var(--muted, #738099);
  font-family: inherit;
  font-size: 11px;
}

.farm-account-main {
  min-width: 0;
  flex: 1 1 360px;
}

.farm-account-title {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  min-height: 34px;
  gap: 12px;
}

.farm-account-title .network-name {
  min-width: 0;
  overflow-wrap: anywhere;
}

.farm-account-title > .balance-mode-control {
  position: static;
  justify-self: end;
  margin-left: 0;
  transform: none;
}

.account-actions {
  justify-content: flex-end;
}

.api-account-balance strong {
  color: var(--text, #17213a);
  font-family: inherit;
  font-size: 15px;
}

.pnl-panel p:not(.eyebrow) {
  color: #60708e;
  font-size: 13px;
  margin-top: 6px;
}

.pnl-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 22px;
  margin-top: 26px;
  padding-top: 8px;
}

.pnl-metric {
  min-height: 72px;
}

.pnl-metric span {
  color: #77849a;
  display: block;
  font-size: 12px;
  font-weight: 700;
}

.pnl-metric strong {
  display: block;
  font-size: 21px;
  margin-top: 8px;
}

.pnl-metric small {
  display: block;
  font-size: 13px;
  font-weight: 800;
  margin-top: 5px;
}

.pnl-metric.extra {
  display: none;
}

.pnl-panel.expanded .pnl-metric.extra {
  display: block;
}

.pnl-toggle {
  display: block;
  margin: 18px auto 0;
}

.calendar-weekdays,
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
}

.calendar-weekdays {
  color: #77849a;
  font-size: 13px;
  font-weight: 800;
  margin-top: 18px;
  text-align: center;
}

.calendar-day {
  min-height: 82px;
  border: 1px solid #e0e6f0;
  border-left: 0;
  border-top: 0;
  padding: 11px 9px;
  text-align: center;
}

.calendar-day:nth-child(7n + 1) {
  border-left: 1px solid #e0e6f0;
}

.calendar-day.empty {
  background: #f8fafd;
}

.calendar-day strong {
  display: block;
}

.calendar-day span {
  display: block;
  font-size: 12px;
  font-weight: 750;
  margin-top: 8px;
}

.calendar-day small {
  color: #77849a;
  display: block;
  font-size: 11px;
  font-weight: 750;
  margin-top: 6px;
}

.compact-history {
  margin-top: 20px;
}

.dashboard-sources {
  margin-top: 16px;
}

.source-list {
  display: grid;
  gap: 2px;
  padding-top: 10px;
}

.source-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid #edf0f5;
  padding: 12px 0;
}

.source-row span {
  color: #60708e;
  font-size: 13px;
}

.source-row strong {
  white-space: nowrap;
}

.transfer-book-actions {
  justify-content: flex-end;
  margin-top: 0;
}

.transfer-address-row > div {
  min-width: 0;
}

.transfer-address-row span {
  display: block;
  overflow-wrap: anywhere;
}

.source-list-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 22px;
}

.source-list-grid .source-row,
.source-list-grid .source-row > div {
  min-width: 0;
}

.source-list-grid .source-row > div strong,
.source-list-grid .source-row > div span {
  overflow: hidden;
  text-overflow: ellipsis;
}

.source-list-grid .source-row > strong {
  text-align: right;
}

.source-row .positive {
  color: #108142;
}

.source-row .negative {
  color: #c74343;
}

.source-row.alert-row {
  border-color: rgb(255 77 109 / 28%);
  background: rgb(255 77 109 / 6%);
  border-radius: 12px;
  padding: 12px;
}

.neutral {
  color: #2563eb;
  font-weight: 750;
}

.positive {
  color: #108142;
  font-weight: 750;
}

.negative {
  color: #c74343;
  font-weight: 750;
}

.source-row strong span {
  display: block;
  margin-top: 3px;
  color: #60708e;
  font-size: 12px;
  font-weight: 650;
  text-align: right;
}

.snapshot-details-card {
  border-bottom: 1px solid #edf0f5;
}

.snapshot-details-card > summary {
  cursor: pointer;
  list-style: none;
}

.snapshot-details-card > summary::-webkit-details-marker {
  display: none;
}

.snapshot-details-card[open] > summary {
  border-bottom: 1px solid rgb(255 255 255 / 8%);
}

.snapshot-details {
  display: grid;
  gap: 6px;
  padding: 8px 0 14px 18px;
}

.snapshot-source-row {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  border: 1px solid rgb(255 255 255 / 8%);
  border-radius: 12px;
  padding: 9px 12px;
  background: rgb(255 255 255 / 4%);
}

.snapshot-source-row span {
  display: block;
  color: #9f8ab8;
  font-size: 12px;
  margin-top: 2px;
}

.order-summary {
  margin-top: 14px;
}

.tab {
  border: 1px solid #d7dfeb;
  border-radius: 999px;
  background: #ffffff;
  color: #60708e;
  font-size: 14px;
  font-weight: 750;
  padding: 9px 15px;
}

.tab.active {
  border-color: #2563eb;
  background: #edf4ff;
  color: #2563eb;
}

.intro,
.notice,
.wallet-card,
.empty-state {
  border: 1px solid #e0e6f0;
  border-radius: 18px;
  background: #ffffff;
  box-shadow: 0 10px 30px rgb(34 52 84 / 5%);
}

.intro {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 26px;
}

.intro p:not(.eyebrow) {
  max-width: 680px;
  margin-top: 10px;
  color: #60708e;
  line-height: 1.55;
}

.intro .card-refresh-status {
  color: var(--cyan, #148b88);
  font-size: 12px;
  font-weight: 750;
}

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

button {
  cursor: pointer;
  font: inherit;
}

.primary,
.secondary,
.danger {
  border-radius: 10px;
  font-size: 14px;
  font-weight: 750;
  padding: 11px 15px;
}

.primary {
  border: 1px solid #2563eb;
  background: #2563eb;
  color: #ffffff;
}

.secondary {
  border: 1px solid #d7dfeb;
  background: #ffffff;
  color: #31435f;
}

.danger {
  border: 0;
  background: transparent;
  color: #c74343;
  padding: 6px 0;
}

.notice {
  margin-top: 16px;
  border-color: #f2dfab;
  background: #fffaf0;
  color: #7a5c16;
  font-size: 13px;
  line-height: 1.55;
  padding: 14px 16px;
}

.notice:has(#zerion-status) {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.launch-warning {
  margin-bottom: 16px;
  border: 1px solid #efb4b4;
  border-radius: 14px;
  background: #fff1f1;
  color: #a52b2b;
  font-size: 14px;
  line-height: 1.5;
  padding: 14px 16px;
}

.wallet-list {
  display: grid;
  gap: 16px;
  margin-top: 22px;
}

.wallet-card {
  padding: 20px;
}

.wallet-heading,
.address-row,
.dialog-heading,
.dialog-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.wallet-heading {
  border-bottom: 1px solid #edf0f5;
  padding-bottom: 16px;
}

.wallet-heading > div:last-child {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.wallet-heading p {
  margin-top: 5px;
  color: #77849a;
  font-size: 13px;
}

.address-list {
  display: grid;
  gap: 10px;
  padding-top: 16px;
}

.address-row {
  border-radius: 12px;
  background: #f8fafd;
  padding: 12px 14px;
}

.network-name {
  font-size: 14px;
  font-weight: 750;
}

.wallet-address {
  margin-top: 4px;
  color: #738099;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 12px;
  overflow-wrap: anywhere;
}

.inline-balance-input {
  width: 130px;
  margin-right: 6px;
  padding: 7px 9px;
  font-size: 13px;
}

.empty-addresses {
  color: #77849a;
  font-size: 13px;
  padding: 18px 0 3px;
}

.empty-state {
  margin-top: 22px;
  padding: 46px 20px;
  text-align: center;
}

.empty-state p {
  margin-top: 7px;
  color: #77849a;
  font-size: 14px;
}

.empty-icon {
  display: grid;
  width: 42px;
  height: 42px;
  margin: 0 auto 12px;
  border-radius: 50%;
  background: #edf4ff;
  color: #2563eb;
  font-size: 27px;
  place-items: center;
}

dialog {
  width: min(460px, calc(100% - 32px));
  border: 0;
  border-radius: 18px;
  box-shadow: 0 24px 80px rgb(27 43 71 / 22%);
  padding: 22px;
}

dialog::backdrop {
  background: rgb(20 31 52 / 42%);
}

form,
label {
  display: grid;
  gap: 14px;
}

label {
  gap: 7px;
  color: #40516d;
  font-size: 13px;
  font-weight: 750;
}

input,
select {
  width: 100%;
  border: 1px solid #d6deea;
  border-radius: 10px;
  background: #ffffff;
  color: #17233d;
  font: inherit;
  padding: 11px 12px;
}

.dialog-heading {
  margin-bottom: 4px;
}

.form-help {
  color: #687591;
  font-size: 13px;
  line-height: 1.5;
}

.form-error {
  border-radius: 10px;
  background: #fff1f1;
  color: #b33434;
  font-size: 13px;
  line-height: 1.45;
  padding: 10px 12px;
}

.balance-summary {
  color: #60708e;
  font-size: 13px;
  margin-top: 14px;
}

.flow-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.flow-summary span {
  border: 1px solid #d7dfeb;
  border-radius: 999px;
  background: #f8fafd;
  color: #60708e;
  font-size: 12px;
  font-weight: 750;
  padding: 7px 10px;
}

.balance-details {
  margin-top: 12px;
  overflow-x: auto;
}

.balance-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.balance-table th,
.balance-table td {
  border-bottom: 1px solid #edf0f5;
  padding: 10px 8px;
  text-align: right;
  white-space: nowrap;
}

.balance-table th {
  color: #77849a;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.balance-table th:first-child,
.balance-table td:first-child,
.balance-table th:nth-child(2),
.balance-table td:nth-child(2) {
  padding-left: 0;
  text-align: left;
}

.balance-table td:first-child,
.balance-table td:nth-child(2) {
  color: #17233d;
  font-weight: 750;
}

.balance-table th:last-child,
.balance-table td:last-child {
  padding-right: 0;
}

.optional {
  color: #8290a6;
  font-size: 12px;
  font-weight: 500;
}

.dialog-actions {
  justify-content: flex-end;
  margin-top: 4px;
}

.icon-button {
  border: 0;
  background: transparent;
  color: #7b8798;
  font-size: 27px;
  line-height: 1;
}

@media (max-width: 640px) {
  .topbar,
  main {
    width: min(100% - 24px, 1120px);
  }

  .brand-logo {
    width: 38px;
    height: 38px;
  }

  .hero-balance,
  .source-list-grid {
    grid-template-columns: 1fr;
  }

  .hero-balance {
    gap: 16px;
  }

  .intro,
  .wallet-heading,
  .farm-account-row {
    align-items: stretch;
    flex-direction: column;
  }

  .intro .primary,
  .intro .secondary,
  .wallet-heading .primary {
    width: 100%;
  }

  .intro-actions {
    width: 100%;
    justify-content: stretch;
  }

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

  .pnl-metrics {
    grid-template-columns: 1fr 1fr;
  }

  .account-status-group,
  .account-actions {
    justify-content: flex-start;
  }

  .farm-account-title {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
  }
}

/* Dark channel theme */
:root {
  color-scheme: dark;
  background: #05000b;
  color: #f5edff;
  --bg-deep: #05000b;
  --card: rgb(14 6 25 / 84%);
  --card-strong: rgb(21 9 37 / 91%);
  --line: rgb(177 69 255 / 20%);
  --line-strong: rgb(31 214 211 / 38%);
  --text: #f5edff;
  --muted: #a997c1;
  --purple: #8912d5;
  --purple-soft: #4e096c;
  --cyan: #22d3cf;
  --cyan-soft: #55b8d7;
  --danger: #ff5d86;
  --success: #45f0b0;
}

body {
  min-height: 100vh;
  background:
    radial-gradient(circle at 50% 8%, rgb(137 18 213 / 22%), transparent 34rem),
    linear-gradient(180deg, rgb(5 0 11 / 72%), rgb(5 0 11 / 94%)),
    url("assets/wallpaper.png") center / cover fixed;
  color: var(--text);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 18% 18%, rgb(34 211 207 / 10%), transparent 22rem),
    radial-gradient(circle at 82% 22%, rgb(137 18 213 / 16%), transparent 24rem),
    linear-gradient(90deg, rgb(5 0 11 / 40%), transparent, rgb(5 0 11 / 50%));
  z-index: 0;
}

.topbar,
main {
  position: relative;
  z-index: 1;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  color: var(--text);
  text-shadow: 0 0 24px rgb(137 18 213 / 45%);
}

.brand-logo {
  background: rgb(5 0 11 / 72%);
  border: 1px solid rgb(34 211 207 / 24%);
  box-shadow:
    0 0 18px rgb(34 211 207 / 20%),
    0 0 34px rgb(137 18 213 / 18%);
}

.eyebrow,
.wallet-heading p,
.source-row span,
.empty-addresses,
.empty-state p,
.balance-summary,
.calendar-weekdays,
.calendar-day small,
.pnl-panel p:not(.eyebrow),
.form-help,
label,
.manual-balance-row label,
.wallet-address,
.optional {
  color: var(--muted);
}

.status,
.tab,
.primary,
.secondary,
.summary-card,
.pnl-panel,
.intro,
.notice,
.wallet-card,
.empty-state,
dialog {
  backdrop-filter: blur(18px);
}

.status {
  border-color: var(--line-strong);
  background: rgb(12 5 22 / 62%);
  color: #d8fbff;
  box-shadow: 0 0 22px rgb(34 211 207 / 12%);
}

.tabs {
  flex-wrap: wrap;
}

.tab {
  border-color: var(--line);
  background: rgb(12 5 22 / 68%);
  color: #d8c7f2;
  transition: 0.18s ease;
}

.tab:hover {
  border-color: var(--line-strong);
  color: #ffffff;
  transform: translateY(-1px);
}

.tab.active {
  border-color: var(--cyan);
  background: linear-gradient(135deg, rgb(137 18 213 / 42%), rgb(34 211 207 / 20%));
  color: #ffffff;
  box-shadow: 0 0 28px rgb(137 18 213 / 26%);
}

.hero-balance {
  position: relative;
  overflow: hidden;
  border: 1px solid rgb(34 211 207 / 34%);
  background:
    radial-gradient(circle at 74% 26%, rgb(34 211 207 / 36%), transparent 18rem),
    radial-gradient(circle at 20% 20%, rgb(162 23 222 / 58%), transparent 19rem),
    linear-gradient(135deg, rgb(24 5 41 / 95%), rgb(73 5 96 / 92%));
  box-shadow:
    0 24px 80px rgb(0 0 0 / 42%),
    0 0 70px rgb(137 18 213 / 30%);
  min-height: 0;
}

.hero-balance::after {
  content: "D";
  position: absolute;
  right: 28px;
  bottom: -28px;
  color: rgb(34 211 207 / 10%);
  font-size: 145px;
  font-weight: 900;
  line-height: 1;
}

.hero-balance .eyebrow,
.hero-balance p {
  color: rgb(245 237 255 / 78%);
}

.hero-mini-card {
  min-height: 0;
  border-color: rgb(177 69 255 / 22%);
  background:
    linear-gradient(135deg, rgb(255 255 255 / 8%), rgb(34 211 207 / 5%)),
    rgb(5 0 11 / 26%);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 6%);
}

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

.hero-mini-card strong small {
  display: block;
  font-size: 12px;
  margin-top: 3px;
}

.dashboard-change.positive,
.positive,
.source-row .positive {
  color: var(--success);
}

.dashboard-change.negative,
.negative,
.source-row .negative {
  color: var(--danger);
}

.neutral {
  color: var(--cyan);
}

.summary-card,
.pnl-panel,
.intro,
.wallet-card,
.empty-state {
  border-color: var(--line);
  background: var(--card);
  box-shadow:
    0 22px 70px rgb(0 0 0 / 34%),
    inset 0 1px 0 rgb(255 255 255 / 4%);
}

.summary-card strong,
.pnl-metric strong,
.wallet-card h3,
.intro h2,
.empty-state h3,
.balance-table td:first-child,
.balance-table td:nth-child(2) {
  color: var(--text);
}

.wallet-heading,
.source-row,
.balance-table th,
.balance-table td {
  border-color: rgb(177 69 255 / 16%);
}

.address-row,
.calendar-day,
.calendar-day.empty {
  border-color: rgb(177 69 255 / 16%);
  background: rgb(6 2 13 / 48%);
}

.calendar-day {
  transition: 0.16s ease;
}

.calendar-day.has-data {
  cursor: pointer;
}

.calendar-day:hover {
  border-color: var(--line-strong);
  background: rgb(34 211 207 / 8%);
}

.day-analysis-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

#dashboard-note {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
}

.primary {
  border-color: transparent;
  background: linear-gradient(135deg, var(--purple), var(--cyan));
  color: #ffffff;
  box-shadow: 0 12px 30px rgb(137 18 213 / 28%);
}

.secondary {
  border-color: var(--line);
  background: rgb(10 4 19 / 68%);
  color: #e9dfff;
}

.primary:hover,
.secondary:hover {
  border-color: var(--line-strong);
  filter: brightness(1.08);
}

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

.notice {
  border-color: rgb(34 211 207 / 25%);
  background: rgb(34 211 207 / 8%);
  color: #d8fbff;
}

.launch-warning,
.form-error {
  border: 1px solid rgb(255 93 134 / 24%);
  background: rgb(255 93 134 / 11%);
  color: #ffc3d2;
}

.operations-soft-warning {
  border: 1px solid rgb(177 69 255 / 20%);
  border-radius: 14px;
  background: rgb(12 5 22 / 46%);
  color: var(--muted);
  padding: 12px 14px;
}

input,
select {
  border-color: rgb(177 69 255 / 26%);
  background: rgb(5 0 11 / 62%);
  color: var(--text);
  outline: none;
}

input:focus,
select:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgb(34 211 207 / 12%);
}

dialog {
  border: 1px solid var(--line);
  background: var(--card-strong);
  color: var(--text);
  box-shadow:
    0 24px 90px rgb(0 0 0 / 58%),
    0 0 70px rgb(137 18 213 / 20%);
}

dialog::backdrop {
  background: rgb(5 0 11 / 72%);
  backdrop-filter: blur(8px);
}

.icon-button {
  color: #d8c7f2;
}

.empty-icon {
  background: linear-gradient(135deg, var(--purple), var(--cyan));
  color: #ffffff;
}

.flow-summary span {
  border-color: rgb(177 69 255 / 20%);
  background: rgb(6 2 13 / 44%);
  color: #d8c7f2;
}

.farm-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
  color: #b9a6d4;
  font-size: 12px;
}

.farm-meta span,
.farm-meta-copy,
.farm-details summary {
  border: 1px solid rgb(177 69 255 / 18%);
  border-radius: 999px;
  background: rgb(6 2 13 / 38%);
  padding: 4px 9px;
}

.farm-meta-copy {
  cursor: pointer;
  color: #b9a6d4;
  font: inherit;
}

.farm-meta-copy:hover,
.farm-meta-copy.copied {
  border-color: var(--cyan);
  color: #d8fbff;
}

.farm-meta-copy > span {
  border: 0;
  background: transparent;
  padding: 0;
}

.farm-details {
  margin-top: 8px;
  color: #cbb9e7;
  font-size: 13px;
}

.farm-details summary {
  display: inline-block;
  cursor: pointer;
}

.farm-details p {
  margin: 8px 0 0;
}

.farm-api-card-error {
  margin: 8px 0 0;
}
.month-navigation {
  display: flex;
  gap: 8px;
}

.month-navigation button {
  min-width: 44px;
  padding: 10px 14px;
}

.logout-button {
  min-height: 40px;
  padding-inline: 16px;
}

.login-page {
  min-height: 100svh;
}

.login-shell {
  display: grid;
  width: min(440px, calc(100% - 32px));
  min-height: 100svh;
  margin: 0 auto;
  padding: 32px 0;
  place-items: center;
}

.login-card {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--card-strong);
  box-shadow:
    0 28px 90px rgb(0 0 0 / 52%),
    0 0 70px rgb(137 18 213 / 22%),
    inset 0 1px 0 rgb(255 255 255 / 5%);
  padding: 28px;
  backdrop-filter: blur(22px);
}

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

.login-logo {
  width: 48px;
  height: 48px;
}

.login-brand h1 {
  font-size: 22px;
}

.login-copy {
  margin-top: 30px;
}

.login-copy h2 {
  font-size: 28px;
}

.login-copy p,
.login-security-note {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.login-copy p {
  margin-top: 9px;
}

.login-form {
  margin-top: 24px;
}

.login-form input[type="password"] {
  min-height: 48px;
  font-size: 16px;
}

.remember-control {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  border: 1px solid rgb(177 69 255 / 18%);
  border-radius: 14px;
  background: rgb(6 2 13 / 42%);
  padding: 12px;
  cursor: pointer;
}

.remember-control input {
  flex: 0 0 auto;
  width: 19px;
  height: 19px;
  margin: 1px 0 0;
  accent-color: var(--cyan);
}

.remember-control span {
  display: grid;
  gap: 3px;
}

.remember-control strong {
  color: var(--text);
  font-size: 13px;
}

.remember-control small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

.login-error {
  margin: 0;
}

.login-submit {
  width: 100%;
  min-height: 48px;
}

.login-submit:disabled,
.logout-button:disabled {
  cursor: wait;
  opacity: 0.68;
}

.login-security-note {
  margin-top: 18px;
  text-align: center;
}

@media (max-width: 760px) {
  html {
    -webkit-text-size-adjust: 100%;
  }

  body {
    background-attachment: scroll;
    padding-bottom: env(safe-area-inset-bottom);
  }

  .topbar,
  main {
    width: calc(100% - 24px);
  }

  .topbar {
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 10px;
    padding: max(14px, env(safe-area-inset-top)) 0 12px;
  }

  .brand-heading {
    min-width: 0;
    gap: 9px;
  }

  .brand-logo {
    width: 40px;
    height: 40px;
    border-radius: 13px;
  }

  .brand-heading h1 {
    overflow: hidden;
    font-size: 19px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .brand-heading .eyebrow {
    font-size: 9px;
  }

  .logout-button {
    flex: 0 0 auto;
    min-height: 38px;
    padding: 8px 12px;
  }

  .tabs {
    width: 100%;
    margin: 0;
    padding: 6px 0;
    flex-wrap: nowrap;
    justify-content: flex-start;
    gap: 7px;
    overflow-x: auto;
    background: transparent;
    box-shadow: none;
    scrollbar-width: none;
    backdrop-filter: blur(18px);
    -webkit-overflow-scrolling: touch;
  }

  .tabs::-webkit-scrollbar {
    display: none;
  }

  .tab {
    flex: 0 0 auto;
    min-height: 42px;
    padding: 9px 14px;
    touch-action: manipulation;
  }

  .hero-balance {
    grid-template-columns: 1fr;
    gap: 18px;
    border-radius: 18px;
    padding: 20px 16px;
  }

  .hero-balance h2 {
    font-size: clamp(30px, 10vw, 42px);
    overflow-wrap: anywhere;
  }

  .hero-balance small {
    font-size: 15px;
  }

  .hero-balance::after {
    right: 8px;
    font-size: 104px;
  }

  .hero-mini-card {
    gap: 9px;
    padding: 10px 12px;
  }

  .hero-mini-card strong {
    font-size: 16px;
  }

  .source-list-grid,
  .summary-grid {
    grid-template-columns: 1fr;
  }

  .intro,
  .wallet-heading,
  .farm-account-row {
    align-items: stretch;
    flex-direction: column;
  }

  .intro,
  .wallet-card,
  .pnl-panel {
    border-radius: 16px;
    padding: 16px;
  }

  .intro {
    gap: 18px;
  }

  .intro h2 {
    font-size: 21px;
  }

  .intro p:not(.eyebrow) {
    font-size: 13px;
  }

  .intro-actions,
  .wallet-heading > div:last-child {
    width: 100%;
    justify-content: stretch;
  }

  .intro-actions > button,
  .intro > button,
  .wallet-heading > div:last-child > button {
    flex: 1 1 140px;
  }

  .wallet-list {
    gap: 12px;
    margin-top: 14px;
  }

  .wallet-heading {
    gap: 12px;
    padding-bottom: 13px;
  }

  .wallet-card > .primary,
  .wallet-card > .secondary,
  .wallet-card > .danger {
    width: 100%;
    min-height: 43px;
    margin-top: 8px;
  }

  .wallet-card > .danger {
    border: 1px solid rgb(255 93 134 / 22%);
    border-radius: 10px;
    background: rgb(255 93 134 / 7%);
    padding: 9px 12px;
  }

  .address-row:not(.farm-account-row) {
    align-items: stretch;
    flex-direction: column;
  }

  .address-row:not(.farm-account-row) > button {
    width: 100%;
  }

  .farm-account-row {
    gap: 14px;
    padding: 14px 12px;
  }

  .farm-account-main {
    flex-basis: auto;
  }

  .farm-account-title {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
  }

  .farm-account-title > .balance-mode-control {
    position: static;
    justify-self: end;
    transform: none;
  }

  .account-status-group {
    justify-content: space-between;
  }

  .account-actions {
    display: grid;
    width: 100%;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .account-actions button {
    min-width: 0;
    min-height: 42px;
    padding: 9px 8px;
  }

  .account-actions .danger {
    border: 1px solid rgb(255 93 134 / 22%);
    background: rgb(255 93 134 / 7%);
  }

  .manual-balance-row {
    align-items: stretch;
    flex-direction: column;
  }

  .manual-balance-row label,
  .inline-balance-editor {
    width: 100%;
  }

  .inline-balance-editor {
    flex-wrap: nowrap;
  }

  .inline-balance-input {
    flex: 1 1 auto;
    width: auto;
    min-width: 0;
    min-height: 42px;
    margin-right: 0;
    font-size: 16px;
  }

  .compact-save-button {
    flex: 0 0 auto;
    min-height: 42px;
  }

  .balance-mode-control {
    min-height: 34px;
  }

  .balance-details {
    margin-inline: -4px;
    padding: 0 4px 7px;
    -webkit-overflow-scrolling: touch;
  }

  .balance-table {
    min-width: 520px;
  }

  .balance-table th,
  .balance-table td {
    padding-block: 11px;
  }

  .source-row {
    align-items: flex-start;
    gap: 10px;
  }

  .source-row > div {
    min-width: 0;
  }

  .source-row strong {
    max-width: 48%;
    text-align: right;
    white-space: normal;
  }

  .snapshot-details {
    padding-left: 0;
  }

  .snapshot-source-row {
    gap: 8px;
    padding: 9px;
  }

  .pnl-panel > div:first-child {
    align-items: stretch;
    flex-direction: column;
  }

  .pnl-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px 10px;
    margin-top: 18px;
  }

  .month-navigation {
    align-self: flex-end;
  }

  .calendar-weekdays {
    font-size: 11px;
  }

  .calendar-day {
    min-height: 64px;
    padding: 8px 3px;
  }

  .calendar-day span,
  .calendar-day small {
    font-size: 9px;
  }

  dialog {
    width: calc(100% - 16px);
    max-height: calc(100dvh - 16px);
    margin: auto auto 8px;
    border-radius: 20px;
    padding: 18px;
  }

  dialog form {
    max-height: calc(100dvh - 52px);
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  .dialog-actions {
    position: sticky;
    bottom: -1px;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding-top: 10px;
    background: linear-gradient(180deg, transparent, var(--card-strong) 24%);
  }

  .dialog-actions button {
    min-height: 44px;
  }

  .login-shell {
    width: min(440px, calc(100% - 24px));
    padding: max(12px, env(safe-area-inset-top)) 0
      max(12px, env(safe-area-inset-bottom));
  }

  .login-card {
    border-radius: 20px;
    padding: 22px 18px;
  }

  .login-copy {
    margin-top: 25px;
  }

  .login-copy h2 {
    font-size: 25px;
  }
}

@media (max-width: 380px) {
  .brand-heading .eyebrow {
    display: none;
  }

  .brand-heading h1 {
    font-size: 17px;
  }

  .account-actions {
    grid-template-columns: 1fr;
  }

  .hero-mini-card {
    align-items: flex-start;
    flex-direction: column;
  }

  .hero-mini-card strong {
    text-align: left;
  }
}

.audit-overview {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.audit-metric {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgb(6 2 13 / 48%);
  padding: 12px;
}

.audit-metric span,
.audit-row-meta,
.audit-row-values small {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.audit-metric strong {
  display: block;
  margin-top: 5px;
  color: var(--text);
  font-size: 18px;
}

.audit-issues {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.audit-issue {
  border: 1px solid rgb(255 190 92 / 28%);
  border-radius: 12px;
  background: rgb(255 190 92 / 8%);
  color: #ffe0a6;
  font-size: 13px;
  padding: 10px 12px;
}

.audit-issue.critical {
  border-color: rgb(255 93 134 / 32%);
  background: rgb(255 93 134 / 10%);
  color: #ffc3d2;
}

.bank-audit-list {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.bank-audit-row {
  display: grid;
  grid-template-columns: minmax(180px, 1.4fr) minmax(120px, 0.8fr) minmax(180px, 1fr);
  align-items: center;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgb(6 2 13 / 42%);
  padding: 11px 13px;
  min-width: 0;
}

.audit-row-title {
  min-width: 0;
}

.audit-row-title,
.audit-row-values {
  overflow: hidden;
}

.audit-row-title strong {
  display: block;
  color: var(--text);
}

.audit-row-values {
  color: var(--text);
  font-weight: 750;
  text-align: right;
}

.audit-status {
  justify-self: start;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  padding: 6px 9px;
}

.audit-status.ok,
.audit-status.manual {
  border-color: rgb(56 221 166 / 28%);
  color: var(--success);
}

.audit-status.duplicate,
.audit-status.error {
  border-color: rgb(255 93 134 / 28%);
  color: var(--danger);
}

.audit-status.stale,
.audit-status.not-connected {
  border-color: rgb(255 190 92 / 28%);
  color: #ffd58a;
}

@media (min-width: 900px) {
  .bank-audit-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px 10px;
  }

  .bank-audit-row {
    grid-template-columns: minmax(120px, 1fr) auto minmax(150px, 0.9fr);
  }
}

@media (max-width: 760px) {
  .audit-overview {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .bank-audit-row {
    grid-template-columns: 1fr auto;
  }

  .audit-row-values {
    grid-column: 1 / -1;
    text-align: left;
  }
}
