:root {
  --bg: #07100f;
  --bg-elevated: #0b1514;
  --surface: #0e1b19;
  --surface-strong: #132321;
  --surface-hover: #172a27;
  --border: rgba(177, 219, 208, 0.12);
  --border-strong: rgba(177, 219, 208, 0.2);
  --text: #f2f8f6;
  --text-soft: #b2c2be;
  --muted: #718580;
  --green: #36e3a1;
  --green-strong: #1acb8a;
  --cyan: #55d7e7;
  --amber: #f2bd5c;
  --violet: #aa8cff;
  --danger: #ff7b7b;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.34);
  --shadow-soft: 0 8px 30px rgba(0, 0, 0, 0.24);
  --radius: 18px;
  --radius-small: 12px;
  --rail-width: 84px;
  --topbar-height: 68px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
}

:root[data-theme="light"] {
  --bg: #eef3f1;
  --bg-elevated: #ffffff;
  --surface: #ffffff;
  --surface-strong: #f4f8f6;
  --surface-hover: #eaf1ee;
  --border: rgba(16, 41, 36, 0.1);
  --border-strong: rgba(16, 41, 36, 0.16);
  --text: #0d1b18;
  --text-soft: #3f5650;
  --muted: #6d827c;
  --green: #12b981;
  --green-strong: #0e9d6d;
  --shadow: 0 24px 60px rgba(20, 60, 50, 0.16);
  --shadow-soft: 0 8px 24px rgba(20, 60, 50, 0.1);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.hidden {
  display: none !important;
}

.mono {
  font-family: var(--mono);
  font-size: 0.86em;
}

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

a {
  color: inherit;
  text-decoration: none;
}

button {
  font-family: inherit;
  cursor: pointer;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 13px;
  background: linear-gradient(135deg, var(--green), var(--green-strong));
  color: #04211a;
  font-weight: 800;
  font-size: 17px;
  letter-spacing: -0.03em;
  box-shadow: 0 8px 24px rgba(54, 227, 161, 0.32);
}

/* ---- Account access ---- */
.auth-screen {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  grid-template-rows: 1fr auto;
  min-height: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  color: #f4f7f5;
  background:
    radial-gradient(620px 420px at 50% 48%, rgba(0, 154, 91, 0.06), transparent 72%),
    #1a1b1a;
}

.auth-tools {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 2;
  display: flex;
  gap: 8px;
}

.auth-tool {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  color: #d5d9d7;
  background: transparent;
  border: 1px solid rgba(238, 246, 242, 0.48);
  border-radius: 50%;
}

.auth-tool:hover {
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.82);
  background: rgba(255, 255, 255, 0.05);
}

.auth-tool svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.45;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.auth-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-width: 0;
  min-height: calc(100vh - 54px);
  padding: 72px 24px 42px;
}

.auth-brand {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 25px;
  color: #00bd72;
  font-size: 17px;
  letter-spacing: -0.03em;
}

.auth-brand-icon {
  display: grid;
  place-items: center;
  width: 27px;
  height: 22px;
  color: #03150d;
  background: #00bd72;
  border-radius: 5px;
  box-shadow: 0 6px 18px rgba(0, 189, 114, 0.22);
}

.auth-brand-icon svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.auth-card {
  width: 100%;
  max-width: 386px;
  padding: 29px 30px 24px;
  background:
    radial-gradient(360px 260px at 100% 100%, rgba(0, 140, 78, 0.13), transparent 70%),
    #07100c;
  border: 1px solid rgba(40, 86, 67, 0.3);
  border-radius: 12px;
  box-shadow: 0 22px 58px rgba(0, 0, 0, 0.42), 0 0 0 1px rgba(0, 130, 75, 0.04);
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.auth-heading {
  margin-bottom: 2px;
  text-align: center;
}

.auth-heading h1 {
  margin: 0;
  color: #f8faf9;
  font-size: 23px;
  line-height: 1.2;
  letter-spacing: -0.035em;
}

.auth-heading p {
  margin: 7px 0 0;
  color: #91a09a;
  font-size: 12.5px;
}

.auth-field {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.auth-field > span:first-child,
.auth-label-row {
  color: #e2e9e6;
  font-size: 11.5px;
  font-weight: 600;
}

.auth-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.auth-input {
  position: relative;
  display: flex;
  align-items: center;
  height: 42px;
  color: #75837e;
  background: #020705;
  border: 1px solid rgba(16, 112, 71, 0.38);
  border-radius: 7px;
  transition: border-color 0.16s, box-shadow 0.16s, background 0.16s;
}

.auth-input:focus-within {
  color: #00bd72;
  border-color: rgba(0, 189, 114, 0.82);
  box-shadow: 0 0 0 3px rgba(0, 189, 114, 0.1);
  background: #030a07;
}

.auth-input > svg {
  flex: 0 0 auto;
  width: 17px;
  height: 17px;
  margin-left: 12px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.55;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.auth-input input {
  min-width: 0;
  flex: 1;
  height: 100%;
  padding: 0 11px;
  color: #f0f5f2;
  background: transparent;
  border: 0;
  outline: 0;
  font: 12.5px var(--font);
}

.auth-input input::placeholder {
  color: #54615c;
}

.password-toggle {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 38px;
  height: 100%;
  padding: 0;
  color: #79857f;
  background: transparent;
  border: 0;
}

.password-toggle:hover,
.password-toggle.active {
  color: #00bd72;
}

.password-toggle svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.45;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.auth-link {
  display: inline;
  padding: 0;
  color: #00bd72;
  background: transparent;
  border: 0;
  font: inherit;
  font-weight: 600;
}

.auth-link:hover {
  color: #22dc93;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.auth-error {
  min-height: 16px;
  margin: -3px 0 -2px;
  color: #ff8585;
  font-size: 11.5px;
  line-height: 1.35;
  text-align: center;
}

.auth-submit {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  width: 100%;
  height: 43px;
  padding: 0 18px;
  color: #b9c4bf;
  background: rgba(1, 8, 5, 0.72);
  border: 1px solid rgba(11, 105, 64, 0.38);
  border-radius: 7px;
  font-size: 13px;
  font-weight: 600;
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.015), 0 8px 24px rgba(0, 0, 0, 0.16);
}

.auth-submit:hover {
  color: #eef7f2;
  border-color: rgba(0, 189, 114, 0.7);
  background: rgba(0, 68, 40, 0.2);
}

.auth-submit:disabled {
  cursor: progress;
  opacity: 0.68;
}

.auth-submit[aria-busy="true"] span {
  opacity: 0;
}

.auth-submit[aria-busy="true"]::before {
  position: absolute;
  width: 15px;
  height: 15px;
  content: "";
  border: 2px solid rgba(255, 255, 255, 0.24);
  border-top-color: #00bd72;
  border-radius: 50%;
  animation: auth-spin 0.7s linear infinite;
}

.auth-submit svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.auth-switch {
  margin: -1px 0 0;
  color: #89968f;
  font-size: 11px;
  text-align: center;
}

.auth-consent {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  color: #96a49e;
  font-size: 10.5px;
  line-height: 1.5;
}

.auth-consent input {
  width: 13px;
  height: 13px;
  margin: 1px 0 0;
  accent-color: #00bd72;
}

.auth-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 32px;
  min-height: 54px;
  padding: 12px 24px 20px;
  color: #7e8581;
  font-size: 10px;
}

.auth-footer button {
  padding: 0;
  color: inherit;
  background: none;
  border: 0;
  font: inherit;
}

.auth-footer button:hover {
  color: #c9cecb;
}

:root[data-theme="light"] .auth-screen {
  color: #12211b;
  background:
    radial-gradient(620px 420px at 50% 48%, rgba(0, 154, 91, 0.08), transparent 72%),
    #eef2ef;
}

:root[data-theme="light"] .auth-card {
  background: #ffffff;
  border-color: rgba(20, 76, 54, 0.13);
  box-shadow: 0 22px 58px rgba(26, 60, 47, 0.14);
}

:root[data-theme="light"] .auth-heading h1,
:root[data-theme="light"] .auth-field > span:first-child,
:root[data-theme="light"] .auth-label-row {
  color: #10231b;
}

:root[data-theme="light"] .auth-input {
  color: #607069;
  background: #f8fbf9;
  border-color: rgba(19, 93, 64, 0.2);
}

:root[data-theme="light"] .auth-input input {
  color: #10231b;
}

:root[data-theme="light"] .auth-submit {
  color: #17412f;
  background: #f6faf8;
  border-color: rgba(19, 93, 64, 0.24);
}

:root[data-theme="light"] .auth-tool {
  color: #2b3f37;
  border-color: rgba(28, 57, 45, 0.3);
}

@keyframes auth-spin {
  to {
    transform: rotate(360deg);
  }
}

.field {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.field > span {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-soft);
  letter-spacing: 0.01em;
}

.field input,
.field select {
  width: 100%;
  padding: 12px 14px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-small);
  color: var(--text);
  font-size: 14.5px;
  font-family: inherit;
  transition: border-color 0.16s, box-shadow 0.16s;
}

.field input:focus,
.field select:focus {
  outline: none;
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(54, 227, 161, 0.16);
}

.field input:disabled {
  color: var(--muted);
  background: var(--surface-strong);
}

.form-error {
  margin: 2px 0 0;
  min-height: 17px;
  color: var(--danger);
  font-size: 13px;
}

.primary-button,
.ghost-button,
.danger-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 18px;
  border-radius: var(--radius-small);
  font-size: 14px;
  font-weight: 600;
  border: 1px solid transparent;
  transition: transform 0.12s, background 0.16s, border-color 0.16s, opacity 0.16s;
}

.primary-button {
  background: linear-gradient(135deg, var(--green), var(--green-strong));
  color: #04211a;
  box-shadow: 0 10px 24px rgba(54, 227, 161, 0.26);
}

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

.primary-button:disabled {
  opacity: 0.6;
  transform: none;
  cursor: progress;
}

.ghost-button {
  background: transparent;
  border-color: var(--border-strong);
  color: var(--text);
}

.ghost-button:hover {
  background: var(--surface-hover);
}

.danger-button {
  background: rgba(255, 123, 123, 0.12);
  border-color: rgba(255, 123, 123, 0.3);
  color: var(--danger);
}

.danger-button:hover {
  background: rgba(255, 123, 123, 0.2);
}

.primary-button svg,
.ghost-button svg {
  width: 17px;
  height: 17px;
  fill: currentColor;
}

/* ---- App shell ---- */
.app-shell {
  display: grid;
  grid-template-columns: var(--rail-width) 1fr;
  height: 100vh;
  overflow: hidden;
}

.rail {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 20px 0;
  background: var(--bg-elevated);
  border-right: 1px solid var(--border);
}

.rail-brand {
  margin-bottom: 14px;
}

.rail-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 100%;
  align-items: center;
  flex: 1;
}

.rail-link {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  width: 64px;
  padding: 9px 4px;
  border-radius: 14px;
  color: var(--muted);
  transition: color 0.16s, background 0.16s;
}

.rail-link svg {
  width: 22px;
  height: 22px;
}

.rail-link span {
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.01em;
  text-align: center;
  line-height: 1.1;
}

.rail-link:hover {
  color: var(--text-soft);
  background: var(--surface-hover);
}

.rail-active {
  color: var(--green);
  background: rgba(54, 227, 161, 0.1);
}

.rail-active::before {
  content: "";
  position: absolute;
  left: -20px;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 26px;
  border-radius: 0 3px 3px 0;
  background: var(--green);
}

.rail-footer {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.rail-button {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  transition: color 0.16s, background 0.16s;
}

.rail-button svg {
  width: 19px;
  height: 19px;
  fill: currentColor;
}

.rail-button:hover {
  color: var(--text);
  background: var(--surface-hover);
}

.workspace {
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: var(--topbar-height);
  padding: 0 26px;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg-elevated) 88%, transparent);
  backdrop-filter: blur(10px);
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  color: var(--muted);
}

.breadcrumb a {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--text-soft);
  font-weight: 600;
}

.breadcrumb svg {
  width: 17px;
  height: 17px;
  fill: currentColor;
}

.crumb-separator {
  color: var(--muted);
}

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

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.merchant-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 13px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-soft);
}

.merchant-chip svg {
  width: 16px;
  height: 16px;
  fill: var(--green);
}

.icon-button {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 11px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-soft);
  transition: color 0.16s, background 0.16s;
}

.icon-button svg {
  width: 19px;
  height: 19px;
  fill: currentColor;
}

.icon-button:hover {
  color: var(--text);
  background: var(--surface-hover);
}

.view {
  flex: 1;
  overflow-y: auto;
  padding: 30px 34px 60px;
}

.view:focus {
  outline: none;
}

/* ---- Page primitives ---- */
.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 26px;
}

.page-head h1 {
  margin: 0;
  font-size: 27px;
  letter-spacing: -0.025em;
}

.page-head p {
  margin: 6px 0 0;
  color: var(--text-soft);
  font-size: 14.5px;
}

.page-actions {
  display: flex;
  gap: 10px;
  flex-shrink: 0;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.metric-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.metric-card::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 3px;
  height: 100%;
  background: var(--accent, var(--green));
}

.metric-ok {
  --accent: var(--green);
}
.metric-warn {
  --accent: var(--amber);
}
.metric-neutral {
  --accent: var(--muted);
}
.metric-accent {
  --accent: var(--violet);
}
.metric-danger {
  --accent: var(--danger);
}

.metric-label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.metric-value {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.metric-caption {
  font-size: 12.5px;
  color: var(--text-soft);
}

.split-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 18px;
}

.panel {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
}

.panel-head h2 {
  margin: 0;
  font-size: 15.5px;
  font-weight: 650;
  letter-spacing: -0.01em;
}

.panel > *:not(.panel-head):not(.panel-foot) {
  padding: 6px 20px 18px;
}

.panel-foot {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
}

.text-link {
  background: none;
  border: none;
  color: var(--green);
  font-size: 13px;
  font-weight: 600;
  padding: 0;
}

.text-link:hover {
  text-decoration: underline;
}

/* ---- Tables ---- */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

.data-table th {
  text-align: left;
  padding: 10px 12px;
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
}

.data-table td {
  padding: 13px 12px;
  border-bottom: 1px solid var(--border);
  color: var(--text-soft);
}

.data-table tbody tr:last-child td {
  border-bottom: none;
}

.data-table tbody tr {
  transition: background 0.14s;
}

.data-table tbody tr:hover {
  background: var(--surface-hover);
}

.data-table .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  font-weight: 600;
}

.cell-user {
  display: flex;
  align-items: center;
  gap: 11px;
}

.cell-user strong {
  display: block;
  color: var(--text);
  font-size: 13.5px;
}

.cell-user span {
  font-size: 12px;
  color: var(--muted);
}

.avatar {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--surface-strong);
  border: 1px solid var(--border);
  font-size: 12px;
  font-weight: 700;
  color: var(--green);
  flex-shrink: 0;
}

/* ---- Badges & chips ---- */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
}

.badge-ok {
  background: rgba(54, 227, 161, 0.14);
  color: var(--green);
}
.badge-warn {
  background: rgba(242, 189, 92, 0.14);
  color: var(--amber);
}
.badge-danger {
  background: rgba(255, 123, 123, 0.14);
  color: var(--danger);
}
.badge-neutral {
  background: var(--surface-strong);
  color: var(--text-soft);
}

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
}

.chip {
  padding: 8px 15px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 600;
  transition: color 0.14s, background 0.14s, border-color 0.14s;
}

.chip:hover {
  background: var(--surface-hover);
}

.chip-active {
  background: rgba(54, 227, 161, 0.12);
  border-color: rgba(54, 227, 161, 0.4);
  color: var(--green);
}

.tag {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 6px;
  background: rgba(54, 227, 161, 0.14);
  color: var(--green);
  font-size: 10.5px;
  font-weight: 600;
  vertical-align: middle;
}

/* ---- Lists ---- */
.feed,
.ledger,
.stack-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
}

.feed-row,
.ledger-row,
.stack-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 2px;
  border-bottom: 1px solid var(--border);
}

.feed-row:last-child,
.ledger-row:last-child,
.stack-row:last-child {
  border-bottom: none;
}

.feed-icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--surface-strong);
  color: var(--green);
  font-weight: 700;
  font-size: 13px;
  flex-shrink: 0;
}

.feed-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.feed-body strong {
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}

.feed-body span {
  font-size: 12px;
  color: var(--muted);
}

.ledger-row > div,
.stack-row > div {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.ledger-row strong,
.stack-row strong {
  font-size: 13.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ledger-row span,
.stack-row span {
  font-size: 12px;
  color: var(--muted);
}

.ledger-amount {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  font-size: 14px;
}

.ledger-amount.pos {
  color: var(--green);
}

.ledger-amount.neg {
  color: var(--danger);
}

.row-delete {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 20px;
  line-height: 1;
  transition: color 0.14s, background 0.14s;
}

.row-delete:hover {
  color: var(--danger);
  background: rgba(255, 123, 123, 0.1);
}

.mini-list {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.mini-list > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.mini-list > div:last-child {
  border-bottom: none;
}

.mini-list dt {
  color: var(--muted);
  font-size: 13px;
}

.mini-list dd {
  margin: 0;
  font-weight: 600;
  font-size: 13.5px;
  font-variant-numeric: tabular-nums;
}

.balance-hero {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 20px;
  margin-bottom: 4px;
  border-radius: var(--radius-small);
  background: linear-gradient(135deg, rgba(54, 227, 161, 0.14), rgba(85, 215, 231, 0.07));
  border: 1px solid rgba(54, 227, 161, 0.2);
}

.balance-hero-label {
  font-size: 12.5px;
  color: var(--text-soft);
  font-weight: 600;
}

.balance-hero-value {
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

/* ---- Fees ---- */
.fee-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 16px;
}

.fee-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 18px;
  background: var(--surface-strong);
  border: 1px solid var(--border);
  border-radius: var(--radius-small);
  transition: opacity 0.16s;
}

.fee-card.fee-off {
  opacity: 0.62;
}

.fee-card header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.fee-card h3 {
  margin: 0;
  font-size: 16px;
}

.fee-lines {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.fee-lines > div {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
}

.fee-lines dt {
  color: var(--muted);
}

.fee-lines dd {
  margin: 0;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.fee-hint {
  margin: 0;
  font-size: 12px;
  color: var(--amber);
}

.inline-note {
  margin-top: 16px;
  padding: 14px 18px;
  border-radius: var(--radius-small);
  background: var(--surface-strong);
  border: 1px solid var(--border);
  font-size: 13.5px;
  color: var(--text-soft);
}

.inline-note strong {
  color: var(--text);
}

/* ---- Switch ---- */
.switch {
  position: relative;
  display: inline-block;
  width: 42px;
  height: 24px;
  flex-shrink: 0;
}

.switch input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.switch-track {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: var(--surface-hover);
  border: 1px solid var(--border-strong);
  transition: background 0.18s;
}

.switch-track::before {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--muted);
  transition: transform 0.18s, background 0.18s;
}

.switch input:checked + .switch-track {
  background: rgba(54, 227, 161, 0.24);
  border-color: var(--green);
}

.switch input:checked + .switch-track::before {
  transform: translateX(18px);
  background: var(--green);
}

/* ---- Forms in panels ---- */
.form-panel {
  gap: 0;
}

.form-panel .field-grid {
  padding: 20px;
}

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

.checkbox {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 20px 14px;
  font-size: 13.5px;
  color: var(--text-soft);
  cursor: pointer;
}

.checkbox input {
  width: 18px;
  height: 18px;
  accent-color: var(--green);
}

.side-column {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.cred-box {
  display: flex;
  flex-direction: column;
  gap: 12px;
  font-size: 13.5px;
  color: var(--text-soft);
  line-height: 1.5;
}

.cred-box .danger-button {
  align-self: flex-start;
  margin-top: 4px;
}

/* ---- Empty / loading / error ---- */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 42px 20px;
  text-align: center;
}

.empty-mark {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 16px;
  background: var(--surface-strong);
  color: var(--muted);
  font-size: 24px;
}

.empty-state h3 {
  margin: 0;
  font-size: 15px;
}

.empty-state p {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
}

.load-error {
  padding: 20px;
  border-radius: var(--radius-small);
  background: rgba(255, 123, 123, 0.08);
  border: 1px solid rgba(255, 123, 123, 0.24);
  color: var(--danger);
  font-size: 13.5px;
}

.skeleton-stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 8px 0;
}

.skeleton-row {
  height: 44px;
  border-radius: var(--radius-small);
  background: linear-gradient(100deg, var(--surface-strong) 30%, var(--surface-hover) 50%, var(--surface-strong) 70%);
  background-size: 220% 100%;
  animation: shimmer 1.3s ease-in-out infinite;
}

@keyframes shimmer {
  from {
    background-position: 180% 0;
  }
  to {
    background-position: -80% 0;
  }
}

/* ---- Modal ---- */
.modal-root {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: none;
}

.modal-root.visible {
  display: block;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(4, 12, 11, 0.62);
  backdrop-filter: blur(4px);
  animation: fade 0.16s ease;
}

.modal-card {
  width: min(460px, 100%);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  animation: pop 0.18s ease;
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 22px;
  border-bottom: 1px solid var(--border);
}

.modal-head h2 {
  margin: 0;
  font-size: 17px;
}

.modal-close {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 22px;
  line-height: 1;
}

.modal-close:hover {
  color: var(--text);
  background: var(--surface-hover);
}

.modal-form {
  display: flex;
  flex-direction: column;
  gap: 15px;
  padding: 22px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 4px;
}

.drawer-body {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 22px;
}

.drawer-body .mini-list dd {
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.drawer-block h3 {
  margin: 0 0 8px;
  font-size: 13px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.drawer-actions {
  display: flex;
  gap: 10px;
  padding-top: 4px;
  border-top: 1px solid var(--border);
}

.drawer-actions button {
  flex: 1;
}

.tx-row {
  cursor: pointer;
}

.tx-row:hover {
  background: var(--surface-hover);
}

@keyframes fade {
  from {
    opacity: 0;
  }
}

@keyframes pop {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.98);
  }
}

/* ---- Toast ---- */
.toast {
  position: fixed;
  bottom: 26px;
  left: 50%;
  transform: translate(-50%, 20px);
  z-index: 80;
  padding: 13px 22px;
  border-radius: var(--radius-small);
  background: var(--surface-strong);
  border: 1px solid var(--border-strong);
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s, transform 0.22s;
}

.toast.visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.toast-error {
  border-color: rgba(255, 123, 123, 0.4);
  color: var(--danger);
}

@media (max-width: 720px) {
  :root {
    --rail-width: 64px;
  }
  .auth-screen {
    display: block;
  }
  .auth-tools {
    top: 16px;
    right: 16px;
  }
  .auth-stage {
    min-height: calc(100vh - 64px);
    padding: 68px 18px 32px;
  }
  .auth-brand {
    margin-bottom: 20px;
  }
  .auth-card {
    width: calc(100vw - 32px);
    max-width: none;
    padding: 27px 20px 22px;
  }
  .auth-label-row {
    gap: 8px;
  }
  .auth-label-row .auth-link {
    flex: 0 0 auto;
  }
  .auth-footer {
    flex-wrap: wrap;
    gap: 10px 22px;
    padding-bottom: 18px;
  }
  .rail-link span {
    display: none;
  }
  .view {
    padding: 22px 18px 48px;
  }
  .page-head {
    flex-direction: column;
    align-items: flex-start;
  }
  .merchant-chip span {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}
