:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b1017;
  --bg-2: #0e141c;
  --card: #161d28;
  --card-2: #1c2533;
  --line: rgba(255, 255, 255, 0.08);
  --text: #f5f7fb;
  --muted: #8d98aa;
  --green: #3dffb0;
  --green-solid: #1faa62;
  --red: #ff5a5a;
  --orange: #f5b042;
  --btn: #f3f5f8;
  --btn-text: #12161c;
  --input: #0e141c;
  --wait: #f3c56b;
  --wait-bg: #3a3120;
}
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f3f5f7;
  --bg-2: #ffffff;
  --card: #ffffff;
  --card-2: #f7f8fa;
  --line: rgba(16, 24, 40, 0.1);
  --text: #14181f;
  --muted: #667085;
  --green: #0f9f62;
  --green-solid: #178a4e;
  --red: #d92d20;
  --orange: #b76e00;
  --btn: #14181f;
  --btn-text: #ffffff;
  --input: #ffffff;
  --wait: #8a5a00;
  --wait-bg: #fff6e3;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: Manrope, sans-serif;
  background: var(--bg);
  color: var(--text);
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
::placeholder { color: var(--muted); }
::selection { background: rgba(61, 255, 176, 0.28); }

.shell { display: grid; grid-template-columns: 272px minmax(0, 1fr); min-height: 100vh; }
.d-sidebar {
  background: var(--bg-2);
  border-right: 1px solid var(--line);
  padding: 22px 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 22px;
  position: sticky;
  top: 0;
  height: 100vh;
}
.brand { display: flex; align-items: flex-start; gap: 12px; padding: 0 8px; }
.brand img, .auth-brand img {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  object-fit: cover;
  display: block;
  margin-top: 2px;
}
.brand-name, .auth-brand .name { font-weight: 800; letter-spacing: -0.04em; font-size: 20px; line-height: 1; }
.brand-tag {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
  margin-top: 4px;
  max-width: 168px;
  font-weight: 600;
}
.nav-section { display: flex; flex-direction: column; gap: 4px; }
.nav-label {
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 4px 12px 8px;
}
.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  border-radius: 12px;
  padding: 11px 12px;
  color: var(--muted);
  font-weight: 700;
}
.nav-link svg { flex: 0 0 auto; }
.nav-link.is-active, .nav-link:hover {
  background: color-mix(in srgb, var(--text) 7%, transparent);
  color: var(--text);
}
.sidebar-footer { margin-top: auto; padding: 8px; display: flex; flex-direction: column; gap: 10px; }
.workspace-name { font-weight: 800; overflow-wrap: anywhere; }
.workspace-role { color: var(--muted); font-size: 13px; margin-top: 2px; }
.main { min-width: 0; }
.d-topbar {
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 0 28px;
  position: sticky;
  top: 0;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: blur(12px);
  z-index: 5;
}
.hamburger {
  display: none;
  margin-right: auto;
  background: transparent;
  border: 0;
  color: var(--text);
  padding: 8px;
}
.scrim { display: none; }
.content {
  padding: 8px 32px 48px;
  max-width: 1180px;
}
.content > * { animation: rise 0.28s ease; }
@keyframes rise {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}
.page-head { margin-bottom: 22px; }
.page-head h1 {
  margin: 0;
  font-size: 36px;
  line-height: 1.05;
  letter-spacing: -0.05em;
  font-weight: 800;
}
.page-head p { margin: 8px 0 0; color: var(--muted); font-size: 18px; }

.account-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(220px, 0.55fr);
  gap: 16px;
  align-items: stretch;
}
.balance-panel, .card, .pay-card, .rail-card, .modal-card, .auth-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04), 0 18px 40px rgba(0, 0, 0, 0.16);
}
:root[data-theme="light"] .balance-panel,
:root[data-theme="light"] .card,
:root[data-theme="light"] .pay-card,
:root[data-theme="light"] .rail-card,
:root[data-theme="light"] .modal-card,
:root[data-theme="light"] .auth-card {
  box-shadow: 0 12px 32px rgba(16, 24, 40, 0.06);
}
.balance-panel { padding: 26px 26px 22px; }
.eyebrow {
  color: var(--muted);
  font-size: 13px;
  letter-spacing: 0.16em;
  font-weight: 700;
}
.money, .pay-sum, .rail-card b, .kpi-value {
  font-variant-numeric: tabular-nums;
}
.money {
  margin: 10px 0 8px;
  font-size: 64px;
  font-weight: 800;
  letter-spacing: -0.06em;
  line-height: 0.95;
}
.money span {
  font-size: 28px;
  margin-left: 8px;
  font-weight: 700;
  letter-spacing: -0.04em;
}
.insurance, .insurance-inline { color: var(--red); font-weight: 800; }
.insurance { margin-bottom: 18px; font-size: 16px; }
.pill-row, .gx-actions, .modal-actions, .filters { display: flex; gap: 10px; flex-wrap: wrap; }
.btn {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text);
  border-radius: 999px;
  min-height: 46px;
  padding: 0 18px;
  font-weight: 700;
}
.btn--primary { background: var(--btn); color: var(--btn-text); border-color: transparent; }
.btn--primary:hover { filter: brightness(0.96); }
.btn:hover { background: color-mix(in srgb, var(--text) 6%, transparent); }
.btn--primary:hover { background: var(--btn); }
.btn--danger { color: var(--red); }
.btn--block { width: 100%; }
.btn.is-on {
  border-color: rgba(61, 255, 176, 0.45);
  background: rgba(61, 255, 176, 0.1);
  color: var(--text);
}
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 70%, var(--card));
  color: var(--muted);
  display: grid;
  place-items: center;
  padding: 0;
}
.rail { display: flex; flex-direction: column; gap: 10px; }
.rail-card { padding: 16px 16px 14px; }
.rail-card span, .rail-card small, .note, .gx-meta, .field-label, .kpi-label { color: var(--muted); }
.rail-card span { display: block; font-size: 13px; }
.rail-card b {
  display: block;
  margin-top: 6px;
  font-size: 28px;
  letter-spacing: -0.04em;
}
.rail-card small { display: block; margin-top: 4px; }

.chart-card, .card { padding: 20px 22px; }
.chart-card { margin-top: 16px; overflow: hidden; }
.section-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 8px;
  font-size: 18px;
  letter-spacing: -0.03em;
}
.section-title i {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: color-mix(in srgb, var(--text) 6%, transparent);
  color: var(--green);
}
.chart { width: 100%; height: auto; display: block; }
.chart .gridline { stroke: rgba(255, 255, 255, 0.08); stroke-dasharray: 4 5; }
:root[data-theme="light"] .chart .gridline { stroke: rgba(16, 24, 40, 0.1); }
.chart .tick { fill: var(--muted); font-size: 12px; font-family: Manrope, sans-serif; }
.chart-line { fill: none; stroke: #3dffb0; stroke-width: 3; stroke-linejoin: round; stroke-linecap: round; }
.chart-area { fill: rgba(61, 255, 176, 0.14); }
:root[data-theme="light"] .chart-line { stroke: #12a36a; }
:root[data-theme="light"] .chart-area { fill: rgba(18, 163, 106, 0.12); }

.stack { display: flex; flex-direction: column; gap: 14px; margin-top: 16px; }
.appeal-list { max-width: 760px; }
.archive-grid, .office-grid {
  display: grid;
  gap: 14px;
}
.archive-grid, .visual-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.visual-grid { display: grid; gap: 14px; margin-top: 16px; }
.visual-card .gx-req { white-space: pre-line; }
.bank-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  max-height: 320px;
  overflow: auto;
  margin-top: 8px;
  padding-right: 2px;
}
.bank-tile {
  display: flex;
  align-items: center;
  gap: 8px;
  text-align: left;
  border: 1px solid var(--line);
  background: var(--input);
  border-radius: 14px;
  min-height: 52px;
  padding: 6px 8px;
  color: var(--text);
  font-weight: 700;
  font-size: 13px;
  line-height: 1.2;
}
.bank-tile span:last-child { min-width: 0; }
.bank-tile.is-on { border-color: #3dffb0; box-shadow: inset 0 0 0 1px #3dffb0; }
.bank-mark {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  flex: 0 0 36px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: -0.03em;
}
.bank-line, .bank-dd { display: flex; align-items: center; gap: 8px; }
.bank-line { margin-top: 12px; font-weight: 800; }
.bank-dd { justify-content: flex-end; }
.showcase-box, .request-box { margin-bottom: 16px; }
.showcase-form { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.showcase-form .field { flex: 1 1 160px; margin: 0; }
.showcase-check {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  font-weight: 700;
}
.showcase-check input { width: auto; min-height: 0; }
.visual-lock { margin: 12px 0 2px; font-weight: 800; color: var(--muted); }
.office-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-top: 16px; }
.archive-grid .empty-state { grid-column: 1 / -1; }
.pay-card { padding: 16px 16px 12px; min-width: 0; }
.pay-head { display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.status {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 800;
  color: #fff;
  white-space: nowrap;
}
.status.ok { background: var(--green-solid); }
.status.bad { background: #e24a4a; }
.status.wait { background: var(--wait-bg); color: var(--wait); }
.pay-sum { font-size: 26px; font-weight: 800; letter-spacing: -0.04em; text-align: right; }
.pay-sum small { font-size: 14px; color: var(--muted); margin-left: 4px; font-weight: 700; }
.rows { margin: 12px 0 4px; }
.rows div, .sheet div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 0;
  border-top: 1px solid var(--line);
  font-size: 14px;
}
.rows dt, .sheet span { color: var(--muted); }
.rows dd { margin: 0; text-align: right; overflow-wrap: anywhere; font-weight: 700; }
.green { color: var(--green); font-weight: 800; }
.copy {
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 0 0 0 6px;
  min-height: 0;
}
.gx-req, .addr {
  background: var(--input);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 14px;
  overflow-wrap: anywhere;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
  line-height: 1.45;
}
.gx-actions { margin-top: 12px; }
.gx-actions form, .ins-row {
  display: flex;
  gap: 8px;
  flex: 1 1 280px;
  align-items: center;
}
.search, .chip { border-radius: 999px; }
.search { margin-bottom: 12px; padding: 14px 18px; background: transparent; }
.filters { margin-bottom: 16px; }
.chip {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  min-height: 36px;
  padding: 0 14px;
  font-weight: 700;
}
.chip.is-on { color: var(--text); background: color-mix(in srgb, var(--text) 8%, transparent); }

.empty-state {
  min-height: calc(100vh - 240px);
  display: grid;
  place-items: center;
  align-content: center;
  text-align: center;
  gap: 0;
}
.empty-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  color: #9aa6b8;
  margin: 0 auto;
}
.empty-state h2 { margin: 16px 0 8px; font-size: 28px; letter-spacing: -0.04em; }
.empty-state p, .note { color: var(--muted); line-height: 1.5; }
.empty-state p { margin: 0 auto; max-width: 420px; }

.gx-split { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(280px, 0.85fr); gap: 16px; align-items: start; }
.gx-fields, .field { display: flex; flex-direction: column; gap: 8px; }
.field.is-hidden { display: none; }
.pay-switch { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.pay-switch-btn {
  min-height: 48px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text);
  font-weight: 800;
}
.pay-switch-btn.is-on { background: var(--btn); color: var(--btn-text); border-color: transparent; }
.card form.gx-fields, .auth-card { gap: 14px; }
.field-label { font-weight: 700; font-size: 14px; }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--input);
  border-radius: 16px;
  min-height: 48px;
  padding: 12px 14px;
  outline: none;
}
textarea { min-height: 110px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: rgba(255, 255, 255, 0.28); }
:root[data-theme="light"] input:focus,
:root[data-theme="light"] select:focus,
:root[data-theme="light"] textarea:focus { border-color: rgba(16, 24, 40, 0.28); }
.card + .card, .section-gap { margin-top: 16px; }
.feed p { margin: 8px 0; }

.modal {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(0, 0, 0, 0.62);
  display: grid;
  place-items: center;
  padding: 18px;
}
.modal-card { width: min(560px, 100%); padding: 22px 22px 18px; box-shadow: 0 24px 80px rgba(0, 0, 0, 0.45); }
.modal-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 16px; }
.modal-head h2 { margin: 0; font-size: 28px; letter-spacing: -0.04em; }
.modal-card .field { margin-bottom: 12px; }
.sheet {
  margin-top: 4px;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 4px 16px;
  background: color-mix(in srgb, var(--bg) 55%, transparent);
}
.sheet div:first-child { border-top: 0; }
.fee { color: var(--orange); font-weight: 800; }
.modal-actions { justify-content: flex-end; margin-top: 16px; }
.gx-err { color: var(--red); font-weight: 700; min-height: 0; }
.gx-ok { color: var(--green); font-weight: 700; }

.rules-layer {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(0, 0, 0, 0.62);
  display: grid;
  place-items: end center;
  padding: 12px;
}
.rules-sheet {
  width: min(720px, 100%);
  max-height: min(92vh, 860px);
  display: flex;
  flex-direction: column;
  background: var(--bg);
  border-radius: 24px 24px 18px 18px;
  overflow: hidden;
  border: 1px solid var(--line);
}
.rules-scroll { overflow: auto; padding: 22px; }
.rules-kicker { color: var(--muted); letter-spacing: 0.14em; font-size: 12px; font-weight: 800; }
.rules-sheet h3, .rules-page h3 { margin: 8px 0; letter-spacing: -0.04em; }
.rules-lead { color: var(--muted); }
.rule {
  margin-top: 10px;
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--card);
}
.rule p { color: var(--muted); line-height: 1.5; }
.rules-bar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 14px;
  border-top: 1px solid var(--line);
  background: var(--bg-2);
}
.rules-bar label { display: flex; gap: 8px; align-items: center; font-weight: 700; }
.rules-bar input { width: auto; min-height: 0; }
.rules-actions { display: flex; gap: 8px; }

.auth-shell { min-height: 100vh; display: grid; grid-template-columns: 1.15fr 0.85fr; }
.auth-aside {
  padding: 48px;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(700px 320px at 15% 85%, rgba(61, 255, 176, 0.14), transparent 60%),
    var(--bg);
}
.auth-brand { display: flex; align-items: center; gap: 12px; }
.auth-aside-body { margin-top: auto; padding-bottom: 8vh; }
.auth-aside h1 {
  margin: 0;
  max-width: 12ch;
  font-size: 58px;
  line-height: 0.98;
  letter-spacing: -0.055em;
}
.auth-aside p { max-width: 36ch; color: var(--muted); font-size: 18px; line-height: 1.5; }
.auth-main { display: grid; place-items: center; padding: 32px; }
.auth-card {
  width: min(440px, 100%);
  padding: 28px;
  display: flex;
  flex-direction: column;
}
.auth-card h2 { margin: 0; font-size: 32px; letter-spacing: -0.04em; }
.auth-card .sub { color: var(--muted); margin: 8px 0 6px; line-height: 1.45; }

@media (max-width: 1100px) {
  .archive-grid, .visual-grid { grid-template-columns: 1fr 1fr; }
  .account-layout, .gx-split { grid-template-columns: 1fr; }
  .money { font-size: 52px; }
}
@media (max-width: 860px) {
  .shell { display: block; }
  .d-sidebar {
    position: fixed;
    z-index: 30;
    transform: translateX(-105%);
    transition: transform 0.2s ease;
    width: min(84vw, 300px);
  }
  body.has-drawer-open .d-sidebar { transform: none; }
  body.has-drawer-open .scrim {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 25;
  }
  .hamburger { display: inline-flex; }
  .content { padding: 4px 16px 32px; }
  .page-head h1 { font-size: 32px; }
  .archive-grid, .visual-grid, .office-grid, .pair, .ins-row, .auth-shell { grid-template-columns: 1fr; }
  .gx-actions form, .ins-row { flex-direction: column; align-items: stretch; }
  .auth-aside { padding: 28px 20px 4px; }
  .auth-aside-body { margin-top: 28px; padding-bottom: 12px; }
  .auth-aside h1 { font-size: 36px; }
  .auth-main { padding: 12px 16px 28px; }
  .money { font-size: 46px; }
  .rules-bar { flex-direction: column; align-items: stretch; }
}
