:root {
  color-scheme: dark;
  --bg: #0b0c10;
  --bg-elev: #14161d;
  --bg-elev-2: #1b1e27;
  --bg-elev-3: #232733;
  --border: #272b37;
  --border-strong: #353a49;
  --text: #eceef4;
  --text-dim: #a2a8b8;
  --text-faint: #6c7284;
  --accent: #8b5cf6;
  --accent-strong: #a78bfa;
  --accent-2: #ec4899;
  --accent-grad: linear-gradient(135deg, #7c4dff 0%, #ec4899 100%);
  --ok: #22c55e;
  --ok-bg: rgba(34, 197, 94, 0.14);
  --warn: #f5a524;
  --warn-bg: rgba(245, 165, 36, 0.14);
  --info: #38bdf8;
  --info-bg: rgba(56, 189, 248, 0.14);
  --danger: #f43f5e;
  --danger-bg: rgba(244, 63, 94, 0.14);
  --muted-bg: rgba(162, 168, 184, 0.12);
  --accent-bg: rgba(139, 92, 246, 0.16);
  --radius: 16px;
  --radius-sm: 11px;
  --header-h: 52px;
  --tabbar-h: 58px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --gutter: 16px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}

a {
  color: var(--accent-strong);
  text-decoration: none;
}

button,
input,
textarea,
select {
  font: inherit;
  color: inherit;
}

h1,
h2,
h3,
p {
  margin: 0;
}

.hidden {
  display: none !important;
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.noscript {
  padding: 24px;
  text-align: center;
  color: var(--text-dim);
}

.mono {
  font-family: var(--mono);
  font-size: 0.92em;
  word-break: break-all;
}

.dim {
  color: var(--text-dim);
}

.faint {
  color: var(--text-faint);
}

.num {
  font-variant-numeric: tabular-nums;
}

/* Boot & spinner */
.boot {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 24px;
}

.boot-logo {
  border-radius: 18px;
  box-shadow: 0 12px 40px rgba(139, 92, 246, 0.35);
}

.spinner {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.14);
  border-top-color: var(--accent-strong);
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Shell */
.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  padding-top: var(--safe-top);
  padding-left: max(var(--gutter), var(--safe-left));
  padding-right: max(var(--gutter), var(--safe-right));
  background: rgba(11, 12, 16, 0.82);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.app-header-inner {
  max-width: 760px;
  margin: 0 auto;
  height: var(--header-h);
  display: flex;
  align-items: center;
  gap: 10px;
}

.header-brand {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  flex: none;
}

.header-back {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  margin-left: -8px;
  padding: 8px 6px;
  border: 0;
  background: none;
  color: var(--accent-strong);
  font-size: 16px;
  cursor: pointer;
}

.header-title {
  flex: 1;
  min-width: 0;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.icon-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 0;
  background: none;
  color: var(--text-dim);
  cursor: pointer;
}

.icon-btn:active,
.icon-btn.is-active {
  color: var(--text);
  background: var(--bg-elev-2);
}

.conn-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  margin: 0 8px;
  background: var(--text-faint);
  transition: background 0.3s;
}

.conn-dot[data-state="open"] {
  background: var(--ok);
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.18);
}

.conn-dot[data-state="connecting"] {
  background: var(--warn);
  animation: pulse 1.2s ease-in-out infinite;
}

.conn-dot[data-state="closed"] {
  background: var(--danger);
}

@keyframes pulse {
  50% {
    opacity: 0.35;
  }
}

.app-main {
  max-width: 760px;
  margin: 0 auto;
  padding: 14px max(var(--gutter), var(--safe-right)) calc(var(--tabbar-h) + var(--safe-bottom) + 28px) max(var(--gutter), var(--safe-left));
}

.view {
  display: flex;
  flex-direction: column;
  gap: 16px;
  animation: fade-in 0.18s ease-out;
}

@keyframes fade-in {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
}

.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  padding-bottom: var(--safe-bottom);
  padding-left: var(--safe-left);
  padding-right: var(--safe-right);
  background: rgba(16, 17, 23, 0.86);
  -webkit-backdrop-filter: saturate(180%) blur(22px);
  backdrop-filter: saturate(180%) blur(22px);
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  user-select: none;
  -webkit-user-select: none;
}

.tabbar-inner {
  max-width: 760px;
  margin: 0 auto;
  height: var(--tabbar-h);
  display: grid;
  grid-template-columns: repeat(5, 1fr);
}

.tab {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--text-faint);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.tab.is-active {
  color: var(--accent-strong);
}

.tab-icon {
  position: relative;
  display: flex;
}

.badge {
  position: absolute;
  top: -5px;
  right: -11px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--danger);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
  font-variant-numeric: tabular-nums;
  border: 2px solid var(--bg);
}

.icon-btn .badge {
  top: 2px;
  right: 2px;
}

/* Cards & sections */
.card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}

.card-flush {
  padding: 0;
  overflow: hidden;
}

.card-title {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.card-sub {
  color: var(--text-dim);
  font-size: 13.5px;
}

.card + .card {
  margin-top: 0;
}

.section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  padding: 0 4px;
}

.section-title {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-faint);
}

.section-link {
  font-size: 14px;
  font-weight: 600;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.row-wrap {
  flex-wrap: wrap;
}

.row-between {
  justify-content: space-between;
}

.grow {
  flex: 1;
  min-width: 0;
}

/* Stats */
.stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

@media (min-width: 620px) {
  .stats {
    grid-template-columns: repeat(3, 1fr);
  }
}

.stat {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  min-width: 0;
}

.stat-label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-dim);
}

.stat-value {
  margin-top: 4px;
  font-size: 26px;
  font-weight: 750;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stat-sub {
  margin-top: 2px;
  font-size: 12px;
  color: var(--text-faint);
}

.stat.tone-ok .stat-value {
  color: var(--ok);
}

.stat.tone-info .stat-value {
  color: var(--info);
}

.stat.tone-warn .stat-value {
  color: var(--warn);
}

.stat.tone-accent .stat-value {
  background: var(--accent-grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.stat-wide {
  grid-column: 1 / -1;
}

.stats-3 {
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.stats-3 .stat {
  padding: 12px 10px;
}

.stats-3 .stat-value {
  font-size: 23px;
}

.stats-3 .stat-sub {
  display: none;
}

@media (min-width: 420px) {
  .stats-3 .stat-sub {
    display: block;
  }
}

/* Sale card */
.sale-card {
  position: relative;
  overflow: hidden;
  background: linear-gradient(160deg, rgba(124, 77, 255, 0.2), rgba(236, 72, 153, 0.12) 60%, rgba(20, 22, 29, 0) 100%), var(--bg-elev);
  border-color: rgba(167, 139, 250, 0.35);
}

.sale-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.sale-name {
  font-size: 17px;
  font-weight: 750;
}

.sale-figures {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  margin: 14px 0 10px;
}

.sale-remaining {
  font-size: 44px;
  line-height: 1;
  font-weight: 800;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}

.sale-remaining small {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-dim);
  letter-spacing: 0;
  margin-left: 6px;
}

.sale-chrono {
  text-align: right;
}

.chrono {
  display: block;
  font-family: var(--mono);
  font-size: 24px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.chrono-label {
  font-size: 12px;
  color: var(--text-dim);
}

.progress {
  height: 8px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  width: 0;
  border-radius: 4px;
  background: var(--accent-grad);
  transition: width 0.4s ease;
}

.sale-meta {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  font-size: 13px;
  color: var(--text-dim);
}

.sale-actions {
  margin-top: 14px;
  display: flex;
  gap: 10px;
}

.sale-actions .btn {
  flex: 1;
}

/* Lists */
.list {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.list-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  min-height: 56px;
  color: inherit;
  border-top: 1px solid var(--border);
}

.list-item:first-child {
  border-top: 0;
}

a.list-item:active,
button.list-item:active {
  background: var(--bg-elev-2);
}

button.list-item {
  width: 100%;
  border-left: 0;
  border-right: 0;
  border-bottom: 0;
  background: none;
  text-align: left;
  cursor: pointer;
}

.list-item:first-child {
  border-top: 0;
}

.li-main {
  flex: 1;
  min-width: 0;
}

.li-title {
  font-weight: 650;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.li-sub {
  margin-top: 2px;
  font-size: 13px;
  color: var(--text-dim);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
}

.li-side {
  flex: none;
  text-align: right;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}

.li-amount {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.li-chevron {
  flex: none;
  color: var(--text-faint);
  display: flex;
}

.li-check {
  flex: none;
}

.list-footer {
  padding: 10px 14px;
  border-top: 1px solid var(--border);
  text-align: center;
  font-size: 13px;
  color: var(--text-faint);
}

/* Key/value */
.kv {
  display: grid;
  grid-template-columns: minmax(110px, auto) 1fr;
  gap: 9px 14px;
  margin: 0;
  font-size: 14.5px;
}

.kv dt {
  color: var(--text-dim);
}

.kv dd {
  margin: 0;
  text-align: right;
  min-width: 0;
  overflow-wrap: anywhere;
}

/* Pills */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 22px;
  padding: 0 9px;
  border-radius: 11px;
  font-size: 12px;
  font-weight: 650;
  white-space: nowrap;
  background: var(--muted-bg);
  color: var(--text-dim);
}

.pill.tone-ok {
  background: var(--ok-bg);
  color: var(--ok);
}

.pill.tone-warn {
  background: var(--warn-bg);
  color: var(--warn);
}

.pill.tone-info {
  background: var(--info-bg);
  color: var(--info);
}

.pill.tone-danger {
  background: var(--danger-bg);
  color: var(--danger);
}

.pill.tone-accent {
  background: var(--accent-bg);
  color: var(--accent-strong);
}

.pill-live::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  animation: pulse 1.4s ease-in-out infinite;
}

/* Buttons */
.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  padding: 0 18px;
  border-radius: 13px;
  border: 1px solid transparent;
  font-size: 15.5px;
  font-weight: 650;
  cursor: pointer;
  text-align: center;
  transition: transform 0.08s ease, opacity 0.15s;
  touch-action: manipulation;
  line-height: 1.2;
  text-wrap: balance;
}

.btn:active:not(:disabled) {
  transform: scale(0.97);
}

.btn:disabled {
  opacity: 0.45;
  cursor: default;
}

.btn-primary {
  background: var(--accent-grad);
  color: #fff;
  box-shadow: 0 6px 20px rgba(139, 92, 246, 0.28);
}

.btn-secondary {
  background: var(--bg-elev-2);
  border-color: var(--border-strong);
  color: var(--text);
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}

.btn-danger-soft {
  background: var(--danger-bg);
  color: var(--danger);
}

.btn-ok {
  background: var(--ok);
  color: #05200f;
}

.btn-ghost {
  background: none;
  color: var(--accent-strong);
}

.btn-sm {
  min-height: 36px;
  padding: 0 13px;
  border-radius: 10px;
  font-size: 14px;
}

.btn-xs {
  min-height: 30px;
  padding: 0 10px;
  border-radius: 9px;
  font-size: 13px;
}

.btn-block {
  width: 100%;
}

.btn.is-busy {
  color: transparent !important;
}

.btn.is-busy::after {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2.5px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  animation: spin 0.7s linear infinite;
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.btn-row .btn {
  flex: 1 1 140px;
}

/* Forms */
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field-label {
  font-size: 13px;
  font-weight: 650;
  color: var(--text-dim);
}

.field-hint {
  font-size: 12.5px;
  color: var(--text-faint);
}

.field-hint.field-warn {
  color: var(--warn);
}

.input {
  width: 100%;
  min-height: 46px;
  padding: 11px 13px;
  border-radius: 12px;
  border: 1px solid var(--border-strong);
  background: var(--bg-elev-2);
  font-size: 16px;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.25);
}

.input::placeholder {
  color: var(--text-faint);
}

select.input {
  padding-right: 40px;
  cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--text-dim) 50%), linear-gradient(135deg, var(--text-dim) 50%, transparent 50%);
  background-position: calc(100% - 21px) 50%, calc(100% - 15px) 50%;
  background-size: 6px 6px;
  background-repeat: no-repeat;
}

.input.mono {
  font-size: 16px;
}

.field[hidden],
.field-hint[hidden] {
  display: none;
}

.tx-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

textarea.input {
  min-height: 140px;
  resize: vertical;
  font-family: var(--mono);
  font-size: 14px;
  line-height: 1.5;
}

textarea.input-text {
  font-family: var(--font);
  font-size: 16px;
  min-height: 84px;
}

.input-group {
  position: relative;
  display: flex;
  align-items: center;
}

.input-group .input {
  padding-right: 44px;
}

.input-suffix {
  position: absolute;
  right: 14px;
  color: var(--text-dim);
  pointer-events: none;
}

.search {
  position: relative;
}

.search .input {
  padding-left: 40px;
}

.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-faint);
  display: flex;
}

.qty-row {
  display: flex;
  gap: 8px;
  align-items: stretch;
}

.qty-row .input {
  flex: 1;
  text-align: center;
  font-size: 22px;
  font-weight: 700;
}

.stepper {
  width: 52px;
  flex: none;
  border-radius: 12px;
  border: 1px solid var(--border-strong);
  background: var(--bg-elev-2);
  font-size: 24px;
  font-weight: 600;
  cursor: pointer;
}

.stepper:active {
  background: var(--bg-elev-3);
}

.switch-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  min-height: 54px;
  border-top: 1px solid var(--border);
  cursor: pointer;
}

.switch-row:first-child {
  border-top: 0;
}

.switch {
  flex: none;
  position: relative;
  width: 51px;
  height: 31px;
  margin: 0;
  border-radius: 16px;
  background: var(--bg-elev-3);
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
  transition: background 0.2s;
  outline: none;
}

.switch::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 27px;
  height: 27px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
  transition: transform 0.2s;
}

.switch:checked {
  background: var(--ok);
}

.switch:checked::after {
  transform: translateX(20px);
}

.switch:disabled {
  opacity: 0.4;
}

.switch:focus-visible {
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.35);
}

/* Chips / segmented */
.chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  margin: 0 calc(-1 * var(--gutter));
  padding: 2px var(--gutter);
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.chips::-webkit-scrollbar {
  display: none;
}

.chip {
  flex: none;
  height: 34px;
  padding: 0 14px;
  border-radius: 17px;
  border: 1px solid var(--border-strong);
  background: var(--bg-elev);
  color: var(--text-dim);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.chip.is-active {
  background: var(--text);
  border-color: var(--text);
  color: var(--bg);
}

.chip-count {
  margin-left: 6px;
  opacity: 0.7;
  font-variant-numeric: tabular-nums;
}

/* Notices */
.notice {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 13px 14px;
  border-radius: var(--radius-sm);
  background: var(--info-bg);
  color: var(--text);
  font-size: 14px;
  border: 1px solid rgba(56, 189, 248, 0.22);
}

.notice-icon {
  flex: none;
  display: flex;
  color: var(--info);
  margin-top: 1px;
}

.notice.tone-warn {
  background: var(--warn-bg);
  border-color: rgba(245, 165, 36, 0.25);
}

.notice.tone-warn .notice-icon {
  color: var(--warn);
}

.notice.tone-danger {
  background: var(--danger-bg);
  border-color: rgba(244, 63, 94, 0.25);
}

.notice.tone-danger .notice-icon {
  color: var(--danger);
}

.notice.tone-ok {
  background: var(--ok-bg);
  border-color: rgba(34, 197, 94, 0.25);
}

.notice.tone-ok .notice-icon {
  color: var(--ok);
}

.notice-body {
  flex: 1;
  min-width: 0;
}

.notice-title {
  font-weight: 700;
  margin-bottom: 2px;
}

a.notice {
  color: var(--text);
}

a.notice:active {
  opacity: 0.8;
}

.steps {
  margin: 8px 0 0;
  padding-left: 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.steps .inline-icon {
  display: inline-flex;
  vertical-align: -4px;
  color: var(--info);
}

/* Empty / error / loading */
.empty {
  padding: 30px 18px;
  text-align: center;
  color: var(--text-faint);
  font-size: 14.5px;
}

.empty-icon {
  display: flex;
  justify-content: center;
  margin-bottom: 10px;
  color: var(--text-faint);
  opacity: 0.7;
}

.state-error {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 28px 18px;
  text-align: center;
  color: var(--text-dim);
}

.skeleton {
  border-radius: var(--radius);
  background: linear-gradient(90deg, var(--bg-elev) 0%, var(--bg-elev-2) 50%, var(--bg-elev) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.3s ease-in-out infinite;
  border: 1px solid var(--border);
}

.skeleton-lg {
  height: 150px;
}

.skeleton-md {
  height: 84px;
}

.skeleton-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

@keyframes shimmer {
  from {
    background-position: 100% 0;
  }
  to {
    background-position: -100% 0;
  }
}

/* Codes */
.code-list {
  display: flex;
  flex-direction: column;
}

.code-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-top: 1px solid var(--border);
}

.code-item:first-child {
  border-top: 0;
}

.code-value {
  flex: 1;
  min-width: 0;
  font-family: var(--mono);
  font-size: 13.5px;
  word-break: break-all;
  user-select: all;
  -webkit-user-select: all;
}

.checkbox {
  width: 22px;
  height: 22px;
  margin: 0;
  accent-color: var(--accent);
  cursor: pointer;
}

.bulk-bar {
  position: sticky;
  top: calc(var(--header-h) + var(--safe-top) + 6px);
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--bg-elev-3);
  border: 1px solid var(--border-strong);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

.counter-line {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--text-faint);
}

/* Payments */
.payment {
  padding: 12px 14px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.payment:first-child {
  border-top: 0;
}

.copyable {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.copyable .mono {
  flex: 1;
  min-width: 0;
}

.copy-btn {
  flex: none;
  width: 32px;
  height: 32px;
  border-radius: 9px;
  border: 0;
  background: var(--bg-elev-2);
  color: var(--text-dim);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.copy-btn:active {
  background: var(--bg-elev-3);
  color: var(--text);
}

/* Help */
.help-message {
  margin-top: 8px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--bg-elev-2);
  font-size: 14px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.help-item {
  padding: 14px;
  border-top: 1px solid var(--border);
}

.help-item:first-child {
  border-top: 0;
}

.help-actions {
  margin-top: 12px;
  display: flex;
  gap: 8px;
}

.help-actions .btn {
  flex: 1;
}

/* Setup report */
.report {
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 14px;
}

.report ul {
  margin: 4px 0 0;
  padding-left: 18px;
  color: var(--text-dim);
}

/* Login */
.login {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(var(--safe-top) + 24px) max(var(--gutter), var(--safe-right)) calc(var(--safe-bottom) + 24px) max(var(--gutter), var(--safe-left));
  background: radial-gradient(120% 60% at 50% 0%, rgba(124, 77, 255, 0.22) 0%, rgba(11, 12, 16, 0) 60%), var(--bg);
}

.login-card {
  width: 100%;
  max-width: 380px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.login-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
  text-align: center;
}

.login-logo {
  width: 84px;
  height: 84px;
  border-radius: 22px;
  box-shadow: 0 14px 44px rgba(139, 92, 246, 0.4);
}

.login-title {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.login-error {
  min-height: 20px;
  color: var(--danger);
  font-size: 14px;
  text-align: center;
}

/* Toasts */
.toast-stack {
  position: fixed;
  z-index: 100;
  top: calc(var(--safe-top) + 8px);
  left: max(12px, var(--safe-left));
  right: max(12px, var(--safe-right));
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  width: 100%;
  max-width: 440px;
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(35, 39, 51, 0.96);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-strong);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
  font-size: 14.5px;
  cursor: pointer;
  animation: toast-in 0.22s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}

.toast--out {
  animation: toast-out 0.2s ease-in forwards;
}

.toast-icon {
  flex: none;
  display: flex;
  margin-top: 1px;
}

.toast--success .toast-icon {
  color: var(--ok);
}

.toast--error .toast-icon {
  color: var(--danger);
}

.toast--info .toast-icon {
  color: var(--accent-strong);
}

.toast-body {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
}

.toast-title {
  font-weight: 700;
}

.toast-msg {
  color: var(--text-dim);
}

.toast-title + .toast-msg {
  margin-top: 1px;
}

.toast-body > .toast-msg:only-child {
  color: var(--text);
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(-12px) scale(0.97);
  }
}

@keyframes toast-out {
  to {
    opacity: 0;
    transform: translateY(-10px);
  }
}

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: rgba(0, 0, 0, 0.6);
  animation: fade 0.18s ease-out;
}

.modal {
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 22px max(20px, var(--safe-right)) calc(var(--safe-bottom) + 18px) max(20px, var(--safe-left));
  border-radius: 22px 22px 0 0;
  background: var(--bg-elev);
  border: 1px solid var(--border-strong);
  border-bottom: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
  animation: sheet-in 0.26s cubic-bezier(0.2, 0.9, 0.3, 1);
}

.modal-title {
  font-size: 19px;
  font-weight: 750;
}

.modal-msg {
  color: var(--text-dim);
  font-size: 15px;
  white-space: pre-line;
  overflow-wrap: anywhere;
}

.modal-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 4px;
}

.modal-backdrop.modal--out {
  animation: fade-out 0.18s ease-in forwards;
}

@media (min-width: 620px) {
  .modal-backdrop {
    align-items: center;
  }
  .modal {
    border-radius: 22px;
    border-bottom: 1px solid var(--border-strong);
    padding-bottom: 20px;
  }
}

@keyframes fade {
  from {
    opacity: 0;
  }
}

@keyframes fade-out {
  to {
    opacity: 0;
  }
}

@keyframes sheet-in {
  from {
    transform: translateY(40px);
    opacity: 0.4;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

:focus-visible {
  outline: 2px solid var(--accent-strong);
  outline-offset: 2px;
}

.input:focus-visible,
.switch:focus-visible {
  outline: none;
}
