:root,
[data-theme="light"] {
  color-scheme: light;
  --lime: #d7ff45;
  --lime-strong: #c8f032;
  --lime-soft: #f4ffd9;
  --on-lime: #121212;
  --on-lime-muted: #1a1a1a;
  --ink: #121212;
  --muted: #667085;
  --line: #eaecf0;
  --line-strong: #d0d5dd;
  --bg: #ffffff;
  --bg-soft: #f7f8fa;
  --card: #ffffff;
  --surface: #ffffff;
  --input-bg: #ffffff;
  --text-secondary: #344054;
  --text-tertiary: #475467;
  --hover-bg: #fafafa;
  --hover-accent-bg: #fcfff5;
  --header-bg: #ffffff;
  --header-glass: rgba(255, 255, 255, 0.92);
  --row-selected-bg: #fcffe8;
  --toast-bg: #121212;
  --toast-fg: #ffffff;
  --backdrop: rgba(18, 18, 18, 0.42);
  --status-validating-bg: #fffaeb;
  --status-validating-fg: #b54708;
  --status-error-bg: #fef3f2;
  --status-error-fg: #b42318;
  --status-pending-bg: #f2f4f7;
  --status-pending-fg: #475467;
  --status-online-fg: #3f6212;
  --danger-surface: #fef3f2;
  --danger-border: #fecdca;
  --chip-live-border: #e3f7a3;
  --notif-unread-bg: #fcfff3;
  --notif-unread-border: #dcf59a;
  --select-option-selected-hover: #eafbc0;
  --stat-accent-end: #eefcb0;
  --focus-border: #98a2b3;
  --focus-ring: rgba(215, 255, 69, 0.35);
  --check-border-active: #c8e86a;
  --tab-active-border: #dcf59a;
  --spinner-track: rgba(180, 71, 8, 0.22);
  --danger: #d92d20;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.06);
  --shadow-md: 0 8px 24px rgba(16, 24, 40, 0.08);
  --radius: 14px;
  --radius-lg: 20px;
}

[data-theme="dark"] {
  color-scheme: dark;
  --lime: #d7ff45;
  --lime-strong: #c8f032;
  --lime-soft: #2a3314;
  --on-lime: #121212;
  --on-lime-muted: #1a1a1a;
  --ink: #f2f4f7;
  --muted: #98a2b3;
  --line: #2a3140;
  --line-strong: #3d4659;
  --bg: #0f1115;
  --bg-soft: #151922;
  --card: #1a1f28;
  --surface: #1a1f28;
  --input-bg: #12161e;
  --text-secondary: #e4e7ec;
  --text-tertiary: #98a2b3;
  --hover-bg: #222833;
  --hover-accent-bg: #1e2410;
  --header-bg: #151922;
  --header-glass: rgba(21, 25, 34, 0.92);
  --row-selected-bg: #252d14;
  --toast-bg: #f2f4f7;
  --toast-fg: #121212;
  --backdrop: rgba(0, 0, 0, 0.65);
  --status-validating-bg: #3d2e0a;
  --status-validating-fg: #fdb022;
  --status-error-bg: #3d1f1c;
  --status-error-fg: #fda29b;
  --status-pending-bg: #252932;
  --status-pending-fg: #98a2b3;
  --status-online-fg: #bef264;
  --danger-surface: #3d1f1c;
  --danger-border: #912018;
  --chip-live-border: #4d6a1a;
  --notif-unread-bg: #222a12;
  --notif-unread-border: #4d6a1a;
  --select-option-selected-hover: #354018;
  --stat-accent-end: #3d4a18;
  --focus-border: #667085;
  --focus-ring: rgba(215, 255, 69, 0.22);
  --check-border-active: #6a8f1a;
  --tab-active-border: #4d6a1a;
  --spinner-track: rgba(253, 176, 34, 0.25);
  --danger: #f97066;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 12px 32px rgba(0, 0, 0, 0.45);
}

* { box-sizing: border-box; }
html {
  background: var(--bg);
}
html, body { height: 100%; }
body {
  margin: 0;
  font-family: "Inter", system-ui, -apple-system, sans-serif;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

body.auth-mode {
  background: var(--bg);
}
body.app-mode {
  background: var(--bg-soft);
}

.auth-scene { display: none; }

a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }

#app {
  position: relative;
  z-index: 1;
  min-height: 100vh;
}

/* Brand */
.fastoo-logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.fastoo-logo-icon {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: radial-gradient(circle at 30% 30%, #ffffff 0%, #dff86a 35%, #9fd624 100%);
  border: 1px solid rgba(0, 0, 0, 0.06);
  box-shadow: inset 0 -2px 4px rgba(0, 0, 0, 0.08);
}
.fastoo-logo-text {
  font-size: 22px;
  text-transform: lowercase;
}
.fastoo-logo.compact .fastoo-logo-text {
  font-size: 18px;
}

/* Buttons */
.btn {
  border: 0;
  border-radius: 10px;
  padding: 12px 18px;
  cursor: pointer;
  font-weight: 600;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.btn:active { transform: translateY(1px); }
.btn-primary,
.btn-lime {
  background: var(--lime);
  color: var(--on-lime);
  box-shadow: var(--shadow-sm);
}
.btn-primary:hover,
.btn-lime:hover {
  background: var(--lime-strong);
  color: var(--on-lime);
}
.btn-primary:active,
.btn-lime:active {
  color: var(--on-lime-muted);
}
.btn-lime.active {
  color: var(--on-lime);
}
.btn-outline {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line-strong);
}
.btn-outline:hover {
  background: var(--hover-bg);
}
.btn-outline.active {
  border-color: var(--ink);
  background: var(--surface);
}
.btn-secondary {
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line-strong);
}
.btn-danger {
  background: var(--danger-surface);
  color: var(--danger);
  border: 1px solid var(--danger-border);
}
.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.theme-toggle-icon {
  flex-shrink: 0;
}
.theme-toggle-label {
  font-size: 13px;
}
.btn-small {
  padding: 8px 12px;
  font-size: 13px;
}
.btn-block {
  width: 100%;
}

/* Auth layout */
.auth-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 32px;
  border-bottom: 1px solid var(--line);
  background: var(--header-glass);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 5;
}
.header-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}
.auth-main {
  flex: 1;
  display: grid;
  place-items: center;
  padding: 48px 20px 64px;
}
.auth-form-panel {
  width: min(420px, 100%);
}
.auth-form-panel h2 {
  margin: 0;
  font-size: 32px;
  letter-spacing: -0.03em;
}
.auth-sub {
  margin: 10px 0 28px;
  color: var(--muted);
  font-size: 15px;
}
.auth-card-lite {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 28px;
}

/* App shell */
.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 24px;
  background: var(--header-bg);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 4;
}
.app-header-meta {
  display: flex;
  align-items: center;
  gap: 12px;
}
.user-chip {
  padding: 8px 12px;
  border-radius: 999px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  font-size: 13px;
  color: var(--muted);
}
.user-chip strong {
  color: var(--ink);
}
.app-body-wrap {
  flex: 1;
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 0;
}
.app-nav {
  background: var(--header-bg);
  border-right: 1px solid var(--line);
  padding: 18px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.app-nav button {
  border: 0;
  background: transparent;
  text-align: left;
  padding: 11px 14px;
  border-radius: 10px;
  color: var(--text-secondary);
  font-weight: 600;
  cursor: pointer;
}
.app-nav button:hover {
  background: var(--bg-soft);
}
.app-nav button.active {
  background: var(--lime-soft);
  color: var(--text-secondary);
}
[data-theme="dark"] .app-nav button.active {
  color: var(--status-online-fg);
}
.app-nav .spacer { flex: 1; }

.content {
  padding: 28px 32px 48px;
  width: 100%;
  max-width: 1480px;
  margin: 0 auto;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  margin-bottom: 24px;
}
.topbar h2 {
  margin: 0;
  font-size: 28px;
  letter-spacing: -0.03em;
}
.topbar-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
}
.accounts-table-card {
  min-width: 0;
}
.chips {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.chip {
  padding: 7px 11px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--text-tertiary);
  font-size: 12px;
  font-weight: 600;
}
.chip-live {
  background: var(--lime-soft);
  border-color: var(--chip-live-border);
  color: var(--status-online-fg);
}

.grid { display: grid; gap: 20px; }
.grid.stats {
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
}
.page-stack {
  display: flex;
  flex-direction: column;
  gap: 24px;
}
.page-stack > .filter-bar,
.page-stack > .dashboard-accounts-card,
.page-stack > .rate-card,
.page-stack > .grid.stats {
  margin: 0;
}
.rate-form {
  display: flex;
  gap: 12px;
  align-items: end;
  max-width: 520px;
}
.rate-form .field-label { flex: 1; }
.rate-form .btn { height: 46px; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 20px 22px;
}
.card h3 {
  margin: 0 0 8px;
  font-size: 14px;
  color: var(--muted);
  font-weight: 600;
}
.card .value {
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -0.03em;
}
.stat-card {
  position: relative;
  overflow: hidden;
}
.stat-card::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--lime), var(--stat-accent-end));
}
.muted { color: var(--muted); }

.field-label {
  display: grid;
  gap: 6px;
  font-size: 14px;
  font-weight: 600;
}
.field-title { display: block; color: var(--text-secondary); }
.field-hint {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
}
.field-error {
  font-size: 12px;
  font-weight: 600;
  color: var(--danger);
  line-height: 1.3;
}
.field-error:empty {
  display: none;
}
.password-wrap {
  position: relative;
  display: block;
}
.password-wrap input { padding-right: 46px; }
.password-toggle {
  position: absolute;
  top: 50%;
  right: 8px;
  transform: translateY(-50%);
  border: 0;
  background: transparent;
  color: var(--muted);
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  cursor: pointer;
}
.password-toggle:hover {
  background: var(--bg-soft);
  color: var(--ink);
}
input.invalid,
textarea.invalid {
  border-color: #fda29b;
  box-shadow: 0 0 0 3px rgba(217, 45, 32, 0.12);
}

.form-grid {
  display: grid;
  gap: 14px;
}
label {
  display: grid;
  gap: 6px;
  font-size: 14px;
  font-weight: 600;
}
input, textarea {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  padding: 12px 14px;
  background: var(--input-bg);
  color: var(--ink);
}
input:focus, textarea:focus {
  outline: none;
  border-color: var(--focus-border);
  box-shadow: 0 0 0 3px var(--focus-ring);
}
textarea { min-height: 88px; resize: vertical; }

.table-wrap {
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
th, td {
  text-align: left;
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
th {
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
}
.th-sort {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  cursor: pointer;
}
.th-sort-mark {
  font-size: 11px;
  line-height: 1;
  opacity: 0.4;
}
th.is-sorted .th-sort-mark {
  opacity: 1;
}
.balance-table .th-sort {
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
}
.balance-table th.num .th-sort {
  width: 100%;
  justify-content: flex-end;
}
.ledger-pager {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 14px;
}
tr[data-ledger-account] {
  cursor: pointer;
}
tr[data-ledger-account]:hover td {
  background: var(--row-selected-bg);
}
tr[data-select-account] {
  cursor: pointer;
}
tr[data-select-account]:hover td {
  background: var(--row-selected-bg);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}
.status-pill.online { background: var(--lime-soft); color: var(--status-online-fg); }
.status-pill.validating { background: var(--status-validating-bg); color: var(--status-validating-fg); }
.status-pill.error { background: var(--status-error-bg); color: var(--status-error-fg); }
.status-pill.pending { background: var(--status-pending-bg); color: var(--status-pending-fg); }

.account-status {
  display: grid;
  gap: 4px;
  justify-items: start;
}
.account-status-sub {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-tertiary);
  line-height: 1.3;
  max-width: 220px;
}
.account-status-sub.muted {
  color: var(--muted);
  font-weight: 500;
}
.account-status-sub.status-sub-error {
  color: var(--status-error-fg);
  font-weight: 500;
}
.status-spinner {
  width: 10px;
  height: 10px;
  border: 2px solid var(--spinner-track);
  border-top-color: var(--status-validating-fg);
  border-radius: 50%;
  animation: status-spin 0.65s linear infinite;
}
@keyframes status-spin {
  to { transform: rotate(360deg); }
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--backdrop);
  backdrop-filter: blur(4px);
}
.auth-mode-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  margin: 2px 0 18px;
  padding: 4px;
  background: var(--input-bg);
  border: 1px solid var(--line);
  border-radius: 14px;
}
.auth-mode-btn {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--muted);
  border-radius: 11px;
  min-height: 44px;
  padding: 8px 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font: 600 14px/1.2 Inter, system-ui, sans-serif;
  cursor: default;
}
.auth-mode-btn.is-selected,
.auth-mode-btn.is-selected:disabled {
  background: var(--lime);
  color: var(--on-lime);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.16);
  opacity: 1;
}
.auth-mode-btn.is-soon,
.auth-mode-btn.is-soon:disabled {
  opacity: 1;
  color: var(--text-tertiary);
  cursor: not-allowed;
}
.auth-mode-badge {
  font-size: 11px;
  font-weight: 650;
  line-height: 1.3;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--status-pending-bg);
  color: var(--muted);
}
.token-life {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 8px 12px;
  margin-bottom: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}
.token-life-main {
  display: flex;
  align-items: baseline;
  gap: 10px;
  min-width: 0;
}
.token-life-main strong {
  font-size: 13px;
  font-weight: 650;
}
.token-life.is-expired {
  border-color: var(--status-error-fg);
}
.token-countdown {
  font-variant-numeric: tabular-nums;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.02em;
}
#edit-token-form {
  margin: -4px 0 12px;
}
#edit-token-form textarea {
  min-height: 64px;
}
.confirm-backdrop {
  z-index: 220;
}
.confirm-modal h3 {
  margin: 0 0 8px;
}
.confirm-modal .modal-actions {
  margin-top: 18px;
}
.modal.modal-wide {
  width: min(920px, 100%);
  max-height: min(92vh, 900px);
}
.modal {
  width: min(480px, 100%);
  max-height: min(90vh, 720px);
  overflow: auto;
  padding: 22px;
  animation: modal-in 0.18s ease-out;
}
@keyframes modal-in {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to { opacity: 1; transform: none; }
}
.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}
.modal-head h3 {
  margin: 0 0 6px;
  font-size: 20px;
  letter-spacing: -0.02em;
}
.modal-lead {
  margin: 0;
  font-size: 13px;
  line-height: 1.45;
}
.modal-close {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--muted);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}
.modal-close:hover {
  background: var(--bg-soft);
  color: var(--ink);
}
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 4px;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
}
.dot.pulse { animation: pulse 1.4s infinite; }
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.45; transform: scale(0.85); }
}

.split {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 24px;
}

.filter-bar {
  margin-top: 0;
  margin-bottom: 24px;
  padding: 20px 22px;
}
.filter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  align-items: end;
}
.filter-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 18px;
  gap: 12px;
}
.filter-count {
  font-size: 13px;
}
.filter-grid .check-field {
  grid-column: 1 / -1;
  justify-self: start;
}
.check-field {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  min-height: 42px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--input-bg);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}
.check-field:hover {
  border-color: #c8f032;
  background: var(--hover-accent-bg);
}
.check-field:has(.check-field-input:checked) {
  background: var(--lime-soft);
  border-color: var(--check-border-active);
  box-shadow: var(--shadow-sm);
  color: var(--text-secondary);
}
.check-field:has(.check-field-input:focus-visible) {
  outline: 2px solid var(--lime-strong);
  outline-offset: 2px;
}
.check-field-input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  margin: 0;
}
.check-field-box {
  position: relative;
  z-index: 1;
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  border-radius: 6px;
  border: 1.5px solid var(--line-strong);
  background: var(--input-bg);
  display: grid;
  place-items: center;
  pointer-events: none;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.check-field-box::after {
  content: "";
  width: 5px;
  height: 9px;
  margin-top: -2px;
  border: solid var(--ink);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg) scale(0);
  opacity: 0;
  transition: transform 0.12s ease, opacity 0.12s ease;
}
.check-field:has(.check-field-input:checked) .check-field-box {
  background: linear-gradient(180deg, var(--lime) 0%, var(--lime-strong) 100%);
  border-color: #9fd624;
}
.check-field:has(.check-field-input:checked) .check-field-box::after {
  transform: rotate(45deg) scale(1);
  opacity: 1;
  border-color: var(--on-lime);
}
.check-field-label {
  position: relative;
  z-index: 1;
  pointer-events: none;
  letter-spacing: -0.01em;
}
select {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  padding: 12px 14px;
  background: var(--input-bg);
  color: var(--ink);
}
.role-select {
  width: auto;
  min-width: 132px;
  padding: 8px 34px 8px 12px;
  border-radius: 8px;
  font-weight: 600;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none'%3E%3Cpath d='M6 9l6 6 6-6' stroke='%2398a2b3' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
}
.tx-filter-bar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
  margin-top: 14px;
  align-items: end;
}
.tx-filter-count {
  margin: 0;
  align-self: center;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}
.tx-fields {
  border: 0;
  margin: 0;
  padding: 0;
  min-inline-size: 0;
}
.tx-fields:disabled {
  opacity: 0.6;
}
.tx-loading {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(8, 10, 14, 0.62);
  cursor: wait;
}
.tx-loading-card {
  display: grid;
  justify-items: center;
  gap: 14px;
  min-width: min(320px, 100%);
  padding: 28px 32px;
  border-radius: 16px;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-md);
  text-align: center;
}
.tx-loading-card p {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
}
.tx-loading-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--line-strong);
  border-top-color: var(--lime-strong);
  border-radius: 50%;
  animation: status-spin 0.7s linear infinite;
}
.tx-card-select {
  appearance: none;
  padding-right: 42px;
  font-weight: 600;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none'%3E%3Cpath d='M6 9l6 6 6-6' stroke='%2398a2b3' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  cursor: pointer;
}

.custom-select {
  position: relative;
}
.custom-select-trigger {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  padding: 12px 14px;
  background: var(--input-bg);
  color: var(--ink);
  font-weight: 600;
  cursor: pointer;
  text-align: left;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.custom-select-trigger:hover:not(:disabled) {
  border-color: #c8f032;
  background: var(--hover-accent-bg);
}
.custom-select.is-open .custom-select-trigger {
  border-color: var(--focus-border);
  box-shadow: 0 0 0 3px var(--focus-ring);
}
.custom-select.is-disabled .custom-select-trigger {
  opacity: 0.55;
  cursor: not-allowed;
  background: var(--bg-soft);
}
.custom-select-value {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.custom-select-chevron {
  flex-shrink: 0;
  color: var(--muted);
  display: grid;
  place-items: center;
  transition: transform 0.15s ease, color 0.15s ease;
}
.custom-select.is-open .custom-select-chevron {
  transform: rotate(180deg);
  color: var(--ink);
}
.custom-select-menu {
  position: absolute;
  z-index: 30;
  left: 0;
  right: 0;
  top: calc(100% + 6px);
  margin: 0;
  padding: 6px;
  list-style: none;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow-md);
  max-height: 260px;
  overflow: auto;
}
.custom-select-option {
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
}
.custom-select-option:hover {
  background: var(--bg-soft);
}
.custom-select-option.is-selected {
  background: var(--lime-soft);
  color: var(--text-secondary);
}
[data-theme="dark"] .custom-select-option.is-selected {
  color: var(--status-online-fg);
}
.custom-select-option.is-selected:hover {
  background: var(--select-option-selected-hover);
}

.detail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}
.detail-head h3 { margin: 0; font-size: 18px; }
.detail-tabs {
  display: flex;
  gap: 8px;
  margin: 16px 0;
}
.detail-tabs button {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 999px;
  padding: 8px 12px;
  cursor: pointer;
  font-weight: 600;
  color: var(--text-tertiary);
}
.detail-tabs button.active {
  background: var(--lime-soft);
  border-color: var(--tab-active-border);
  color: var(--text-secondary);
}
[data-theme="dark"] .detail-tabs button.active {
  color: var(--status-online-fg);
}
.detail-block { margin-top: 8px; }

.balance-sheet {
  margin: 4px 0 14px;
  background: #fff;
  color: #101828;
  border: 1px solid #eaecf0;
  border-radius: 12px;
  overflow: hidden;
}
.balance-total-block {
  padding: 16px 18px 6px;
}
.balance-kicker {
  color: #667085;
  font-size: 14px;
  font-weight: 500;
}
.balance-total {
  margin-top: 2px;
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.15;
  color: #101828;
}
.balance-table th {
  color: #667085;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  padding: 12px 18px;
  border-bottom: 1px solid #eaecf0;
  background: #fff;
}
.balance-table td {
  padding: 14px 18px;
  border-bottom: 1px solid #f2f4f7;
  background: #fff;
  color: #101828;
  vertical-align: middle;
}
.balance-table tr:last-child td {
  border-bottom: 0;
}
.balance-table .num,
.balance-table th.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.currency-cell {
  display: flex;
  align-items: center;
  gap: 12px;
}
.currency-icon,
.currency-fallback {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  flex: 0 0 auto;
}
.currency-fallback {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #f2f4f7;
  color: #344054;
  font-weight: 700;
}
.currency-code {
  font-weight: 700;
  font-size: 14px;
  line-height: 1.2;
}
.currency-name {
  color: #667085;
  font-size: 13px;
  line-height: 1.3;
}
.balance-cell-total {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}
tr.row-selected td { background: var(--row-selected-bg); }

.toast-stack {
  position: fixed;
  top: 16px;
  right: 16px;
  display: grid;
  gap: 10px;
  z-index: 50;
}
.toast {
  min-width: 260px;
  max-width: 360px;
  background: var(--toast-bg);
  color: var(--toast-fg);
  padding: 14px 16px;
  border-radius: 12px;
  box-shadow: var(--shadow-md);
  animation: slideIn 0.25s ease;
}
@keyframes slideIn {
  from { transform: translateY(-8px); opacity: 0; }
  to { transform: none; opacity: 1; }
}

.notif-list {
  display: grid;
  gap: 14px;
  max-height: 420px;
  overflow: auto;
}
.notif {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
  background: var(--surface);
}
.notif.unread {
  border-color: var(--notif-unread-border);
  background: var(--notif-unread-bg);
}
.notif-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.empty {
  padding: 28px;
  text-align: center;
  color: var(--muted);
}

.nav-label-short {
  display: none;
}
.nav-label-full {
  display: inline;
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.mobile-back-btn {
  display: none;
  margin-bottom: 12px;
}
.mobile-hint {
  display: none;
}
.mobile-panel-hidden {
  display: none !important;
}

@media (max-width: 980px) {
  .app-body-wrap {
    grid-template-columns: 1fr;
    padding-bottom: 72px;
  }
  .content {
    padding: 18px 16px 28px;
  }
  .topbar {
    flex-direction: column;
    align-items: stretch;
  }
  .topbar-compact {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
  .topbar-actions {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
  }
  .topbar-actions .btn-primary {
    width: 100%;
  }
  .topbar-actions .chips {
    justify-content: flex-start;
  }
  .split {
    grid-template-columns: 1fr;
  }
  .filter-grid {
    grid-template-columns: 1fr;
  }
  .filter-actions {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  .filter-actions .btn {
    width: 100%;
  }
  .detail-head {
    flex-direction: column;
    align-items: flex-start;
  }
  .detail-tabs {
    flex-wrap: wrap;
  }
  .notif-actions {
    flex-wrap: wrap;
  }
  .notif-actions .btn {
    flex: 1 1 auto;
  }
  .site-header {
    padding: 14px 16px;
    flex-wrap: wrap;
    gap: 12px;
  }
  .header-actions {
    flex-wrap: wrap;
    justify-content: flex-end;
  }
  .auth-main {
    padding: 32px 16px 48px;
  }
  .auth-form-panel h2 {
    font-size: 26px;
  }
  .app-header {
    flex-wrap: wrap;
    padding: 12px 16px;
    gap: 10px;
  }
  .app-header-meta {
    flex-wrap: wrap;
    justify-content: flex-end;
    width: 100%;
  }
  .app-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 40;
    flex-direction: row;
    justify-content: space-around;
    gap: 4px;
    padding: 8px 10px calc(8px + env(safe-area-inset-bottom, 0px));
    border-right: 0;
    border-top: 1px solid var(--line);
    border-bottom: 0;
    background: var(--header-bg);
    box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.08);
  }
  [data-theme="dark"] .app-nav {
    box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.35);
  }
  .app-nav button {
    flex: 1 1 0;
    min-width: 0;
    text-align: center;
    padding: 10px 6px;
    font-size: 12px;
    white-space: nowrap;
  }
  .app-nav .spacer {
    display: none;
  }
  .nav-label-full {
    display: none;
  }
  .nav-label-short {
    display: inline;
  }
  .modal-backdrop {
    padding: 12px;
    align-items: flex-end;
  }
  .modal {
    width: 100%;
    max-height: calc(92vh - env(safe-area-inset-bottom, 0px));
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
  }
  .modal-actions {
    flex-direction: column-reverse;
  }
  .modal-actions .btn {
    width: 100%;
  }
}

@media (max-width: 640px) {
  .rate-form {
    flex-direction: column;
    align-items: stretch;
    max-width: none;
  }
  body {
    overflow-x: hidden;
  }
  .app-header-meta .user-chip-role {
    display: none;
  }
  .user-chip {
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .theme-toggle-label {
    display: none;
  }
  .topbar h2 {
    font-size: 22px;
  }
  .card {
    padding: 14px;
  }
  .grid.stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .card .value {
    font-size: 24px;
  }
  th, td {
    padding: 10px 8px;
    font-size: 13px;
  }
  .accounts-table-card .table-wrap {
    margin: 0 -6px;
    padding: 0 6px;
  }
  .accounts-table-card table {
    min-width: 720px;
  }
  .row-actions {
    flex-direction: column;
    align-items: stretch;
    min-width: 108px;
  }
  .row-actions .btn-small {
    width: 100%;
    padding: 10px 8px;
  }
  .account-status-sub {
    max-width: 160px;
  }
  .mobile-back-btn {
    display: inline-flex;
  }
  .mobile-hint {
    display: block;
  }
  .accounts-split.is-detail-view .mobile-hint {
    display: none;
  }
  .toast-stack {
    left: 12px;
    right: 12px;
    top: auto;
    bottom: calc(76px + env(safe-area-inset-bottom, 0px));
  }
  .toast {
    min-width: 0;
    max-width: none;
    width: 100%;
  }
  .check-field {
    white-space: normal;
    width: 100%;
  }
  input,
  textarea,
  select,
  .custom-select-trigger {
    font-size: 16px;
  }
  .header-actions {
    width: 100%;
    justify-content: space-between;
  }
  .header-actions .theme-toggle {
    order: -1;
  }
  .site-header .btn {
    flex: 1 1 auto;
    text-align: center;
    padding: 10px 12px;
  }
}
