:root {
  color-scheme: dark;
  --bg: #08111f;
  --panel: rgba(10, 24, 44, 0.82);
  --panel-strong: rgba(14, 32, 58, 0.92);
  --stroke: rgba(163, 192, 226, 0.16);
  --text: #edf4ff;
  --muted: #9db2cf;
  --accent: #f2b84b;
  --accent-soft: rgba(242, 184, 75, 0.16);
  --success: #52c79f;
  --warning: #ffcb67;
  --danger: #ff7f72;
  --shadow: 0 18px 40px rgba(3, 10, 20, 0.32);
  --radius: 22px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: "Avenir Next", "Segoe UI", system-ui, sans-serif;
}

body {
  position: relative;
}

.background {
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  position: fixed;
}

.orb {
  border-radius: 999px;
  filter: blur(28px);
  opacity: 0.34;
  position: absolute;
}

.orb-one {
  background: #184b8f;
  height: 320px;
  left: -90px;
  top: -90px;
  width: 320px;
}

.orb-two {
  background: #c8771d;
  height: 280px;
  right: -60px;
  top: 140px;
  width: 280px;
}

.grid {
  background-image:
    linear-gradient(rgba(141, 171, 211, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(141, 171, 211, 0.08) 1px, transparent 1px);
  background-size: 48px 48px;
  height: 100%;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.6), transparent);
  width: 100%;
}

.page {
  margin: 0 auto;
  max-width: 1440px;
  padding: 32px 20px 48px;
  position: relative;
  z-index: 1;
}

.panel {
  backdrop-filter: blur(18px);
  background: var(--panel);
  border: 1px solid var(--stroke);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
}

.hero {
  align-items: stretch;
  display: grid;
  gap: 22px;
  grid-template-columns: minmax(0, 1.8fr) minmax(280px, 1fr);
  margin-bottom: 20px;
}

.hero h1,
.section-header h2,
.notice-panel h2 {
  font-family: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Georgia, serif;
  letter-spacing: 0.01em;
  margin: 0 0 10px;
}

.eyebrow {
  color: var(--accent);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  margin: 0 0 10px;
  text-transform: uppercase;
}

.lead,
.hint,
.notice-card p,
.steps-list,
.message {
  color: var(--muted);
}

.hero-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 18px;
}

.hero-side {
  display: grid;
  gap: 12px;
}

.metric-card {
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.02));
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 18px;
  padding: 16px;
}

.metric-label {
  color: var(--muted);
  display: block;
  font-size: 0.82rem;
  margin-bottom: 6px;
}

.status-pill,
.status-chip {
  align-items: center;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  display: inline-flex;
  font-size: 0.82rem;
  gap: 8px;
  padding: 8px 12px;
}

.status-fresh {
  background: rgba(82, 199, 159, 0.14);
  color: #aef0d7;
}

.status-stale {
  background: rgba(255, 203, 103, 0.16);
  color: #ffe5a6;
}

.status-error,
.status-auth_required {
  background: rgba(255, 127, 114, 0.16);
  color: #ffc3be;
}

.status-loading {
  background: rgba(127, 178, 255, 0.16);
  color: #c3dcff;
}

.notice-panel {
  align-items: start;
  display: grid;
  gap: 16px;
  grid-template-columns: 1.3fr minmax(280px, 1fr);
  margin-bottom: 20px;
}

.auth-gate {
  margin-bottom: 20px;
}

.auth-form {
  max-width: 420px;
}

.locked-note {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 18px;
  color: var(--muted);
  margin-bottom: 16px;
  padding: 14px 16px;
}

.notice-card {
  background: var(--panel-strong);
  border: 1px solid rgba(242, 184, 75, 0.16);
  border-radius: 18px;
  padding: 18px;
}

.steps-list {
  line-height: 1.7;
  margin: 0;
  padding-left: 18px;
}

.content-grid {
  display: grid;
  gap: 20px;
  grid-template-columns: minmax(300px, 380px) minmax(0, 1fr);
}

.column {
  display: grid;
  gap: 20px;
}

.column-wide {
  align-content: start;
}

.section-header {
  align-items: baseline;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  justify-content: space-between;
  margin-bottom: 14px;
}

.tabs {
  display: inline-flex;
  gap: 8px;
  margin-bottom: 14px;
}

.tab,
.primary-button,
.ghost-button {
  border: 0;
  border-radius: 14px;
  cursor: pointer;
  font: inherit;
  transition: transform 140ms ease, opacity 140ms ease, background 140ms ease;
}

.tab {
  background: rgba(255, 255, 255, 0.06);
  color: var(--muted);
  padding: 10px 14px;
}

.tab.active {
  background: var(--accent-soft);
  color: var(--text);
}

.primary-button {
  background: linear-gradient(135deg, #efb34c, #d48b2b);
  color: #1d1302;
  font-weight: 700;
  padding: 12px 16px;
}

.ghost-button {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  padding: 12px 16px;
}

.primary-button:hover,
.ghost-button:hover,
.tab:hover {
  transform: translateY(-1px);
}

.stack {
  display: grid;
  gap: 14px;
}

.hidden {
  display: none;
}

label {
  color: var(--muted);
  display: grid;
  font-size: 0.92rem;
  gap: 8px;
}

input,
select,
textarea {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 14px;
  color: var(--text);
  font: inherit;
  min-height: 48px;
  padding: 12px 14px;
  width: 100%;
}

textarea {
  min-height: 120px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(242, 184, 75, 0.65);
  box-shadow: 0 0 0 3px rgba(242, 184, 75, 0.12);
  outline: none;
}

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

.message {
  min-height: 1.2em;
}

.message.error {
  color: #ffc3be;
}

.message.success {
  color: #aef0d7;
}

.list-grid,
.dynamic-fields,
.entity-balances {
  display: grid;
  gap: 12px;
}

.card,
.bank-spec,
.entity-card,
.connection-card,
.total-card {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 18px;
  padding: 16px;
}

.bank-spec {
  display: grid;
  gap: 10px;
}

.bank-spec ul {
  margin: 0;
  padding-left: 18px;
}

.bank-spec-title,
.entity-card h3,
.connection-card h3,
.total-card strong {
  margin: 0;
}

.field-help {
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.45;
}

.totals-strip {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  margin-bottom: 16px;
}

.entity-card-header,
.connection-card-header {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: space-between;
}

.subtle {
  color: var(--muted);
  font-size: 0.84rem;
}

.entity-bank,
.entity-account {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  margin-top: 12px;
  padding-top: 12px;
}

.entity-account {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
}

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

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

.accounts-table th,
.accounts-table td {
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding: 12px 8px;
  text-align: left;
}

.accounts-table th {
  color: var(--muted);
  font-weight: 600;
}

.empty-state {
  color: var(--muted);
  padding: 10px 0;
}

@media (max-width: 1080px) {
  .hero,
  .notice-panel,
  .content-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .page {
    padding: 18px 12px 32px;
  }

  .panel {
    border-radius: 18px;
    padding: 16px;
  }

  .inline-fields {
    grid-template-columns: 1fr;
  }
}
