/* ===== Base ===== */
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  font-family: -apple-system, BlinkMacSystemFont, system-ui, "Segoe UI", sans-serif;
  background: #0b0d12;
  color: #e8eaed;
  margin: 0;
  line-height: 1.45;
  min-height: 100vh;
}
.wrap {
  max-width: 1100px;
  margin: 0 auto;
  padding: 20px 20px 96px; /* extra bottom room for Prefetch FAB */
}
h1 { margin: 0; font-size: 18px; font-weight: 700; letter-spacing: -0.02em; }
h2 { margin: 0 0 8px; font-size: 16px; font-weight: 650; letter-spacing: -0.01em; }
h3 { margin: 0; font-size: 13px; color: #c4c9d2; font-weight: 600; }
code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.92em;
  background: #12151c;
  border: 1px solid #2a2f3a;
  border-radius: 4px;
  padding: 0 4px;
}

/* Screen-reader / programmatically synced controls */
.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

/* ===== Header ===== */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(11, 13, 18, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid #1e2330;
}
.app-header-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 10px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.app-brand { min-width: 0; }
.app-brand-sub {
  display: block;
  font-size: 11px;
  color: #7b8494;
  margin-top: 1px;
}
.app-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
}

/* Account chip + dropdown */
.account-menu { position: relative; }
.account-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: min(360px, 62vw);
  padding: 6px 10px 6px 8px;
  background: #141820;
  border: 1px solid #2a3140;
  border-radius: 999px;
  cursor: pointer;
  color: #e8eaed;
  text-align: left;
  transition: border-color 0.15s, background 0.15s;
}
.account-chip:hover { border-color: #3b82f6; background: #161d2a; }
.account-menu.open .account-chip {
  border-color: #2563eb;
  background: #11203a;
}
.account-chip-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #1c2433;
  border: 1px solid #2a3140;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  flex: none;
}
.account-chip-text {
  display: flex;
  flex-direction: column;
  gap: 0;
  min-width: 0;
  flex: 1;
}
.account-chip-kicker {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: #7b8494;
  line-height: 1.2;
}
.account-chip .profile-info {
  font-size: 12px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 0;
  margin: 0;
  border: none;
  background: transparent;
  line-height: 1.3;
  color: #c8ced8;
}
.account-chip .profile-info.muted { font-weight: 400; color: #7b8494; }
.account-chip .profile-info.profile-ok { color: #4ade80; }
.account-chip .profile-info.profile-err { color: #f87171; }
.account-chip-caret {
  color: #7b8494;
  font-size: 11px;
  flex: none;
  transition: transform 0.15s;
}
.account-menu.open .account-chip-caret { transform: rotate(180deg); }

.account-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: min(420px, calc(100vw - 24px));
  max-height: min(80vh, 640px);
  overflow: auto;
  background: #141820;
  border: 1px solid #2a3140;
  border-radius: 12px;
  padding: 14px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.45);
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 120;
}
.account-panel[hidden] { display: none !important; }
.account-panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}
.account-panel-head strong { font-size: 13px; display: block; margin-bottom: 2px; }
.account-panel-head .hint { margin: 0; }
.account-panel-divider {
  height: 1px;
  background: #242a36;
  margin: 4px 0;
}

/* ===== Cards ===== */
.card {
  background: #12151c;
  border: 1px solid #222833;
  border-radius: 12px;
  padding: 18px;
  margin-bottom: 16px;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.02);
}
.card--compact { padding: 0; overflow: hidden; }
.card--run {
  border-color: #1e3a5f;
  background: linear-gradient(180deg, #131a28 0%, #12151c 48%);
}
.card-summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  user-select: none;
}
.card-summary::-webkit-details-marker { display: none; }
.card-summary::after {
  content: "▾";
  color: #7b8494;
  font-size: 12px;
  transition: transform 0.15s;
}
details[open] > .card-summary::after { transform: rotate(180deg); }
.card-summary:hover { background: #161b25; }
.card-summary-title { font-size: 14px; font-weight: 650; color: #e8eaed; }
.card-summary-meta { font-size: 12px; color: #7b8494; }
.card-body { padding: 0 18px 18px; }

.section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 10px;
}
.section-head h2,
.section-head h3 { margin: 0; flex: 1; min-width: 0; }
.section-head--sub {
  margin: 0 0 8px;
  align-items: center;
}
.section-titles { min-width: 0; flex: 1; }
.section-kicker {
  display: block;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: #60a5fa;
  margin-bottom: 3px;
}
.section-head-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  flex: none;
}
.section-divider {
  height: 1px;
  background: #222833;
  margin: 14px 0;
}
.hint { color: #8b93a1; font-size: 12px; margin: 0 0 12px; }
.hint.compact { margin-bottom: 8px; }
.muted { color: #8b93a1; font-size: 12px; }

/* ===== Form controls ===== */
textarea, input, select {
  width: 100%;
  background: #0c0e13;
  border: 1px solid #2a2f3a;
  color: #e8eaed;
  border-radius: 8px;
  padding: 9px 10px;
  font-family: ui-monospace, Menlo, monospace;
  font-size: 12px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
textarea:focus, input:focus, select:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}
textarea { resize: vertical; min-height: 72px; }
label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 12px;
  color: #b0b7c3;
}
.grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid .span-2 { grid-column: 1 / -1; }
.row { display: flex; gap: 8px; align-items: center; margin-top: 10px; }
.row-wrap { flex-wrap: wrap; }
button {
  background: #232937;
  color: #e8eaed;
  border: 1px solid #323949;
  padding: 8px 14px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: background 0.12s, border-color 0.12s;
}
button:hover { background: #2d3444; }
button.primary { background: #2563eb; border-color: #2563eb; color: #fff; }
button.primary:hover { background: #1d4ed8; }
button.danger { background: #b91c1c; border-color: #b91c1c; color: #fff; }
button.danger:disabled { opacity: 0.4; cursor: not-allowed; }
button.ghost {
  background: transparent;
  border-color: #353a45;
  color: #9aa3b2;
  font-size: 12px;
  padding: 6px 12px;
}
button.ghost:hover { background: #1a1f2a; color: #e8eaed; }
.run-start { padding: 10px 20px; font-size: 14px; font-weight: 600; }
.run-actions { margin-top: 4px; }

/* ===== Auth ===== */
.auth-gate {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: #0b0d12;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.auth-box {
  background: #12151c;
  border: 1px solid #222833;
  border-radius: 12px;
  padding: 28px;
  width: 100%;
  max-width: 340px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.auth-box h2 { margin: 0; }
.auth-error { color: #f87171; font-size: 12px; min-height: 16px; }

/* ===== Select cards (override mode, price mode) ===== */
.select-cards {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin: 4px 0 12px;
}
.select-cards--3 { grid-template-columns: repeat(3, 1fr); }
.select-cards--4 { grid-template-columns: repeat(4, 1fr); }
.select-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  width: 100%;
  text-align: left;
  padding: 14px;
  background: #0c0e13;
  border: 1px solid #2a2f3a;
  border-radius: 10px;
  cursor: pointer;
  color: #c8ced8;
  font-family: inherit;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}
.select-card:hover { border-color: #3b82f6; background: #101826; }
.select-card.selected {
  border-color: #2563eb;
  background: #11203a;
  box-shadow: inset 0 0 0 1px #2563eb;
  color: #e8eaed;
}
.select-card:disabled,
.select-card.disabled {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}
.select-card-badge {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: #93c5fd;
  background: #1a2740;
  border: 1px solid #1e3a5f;
  border-radius: 999px;
  padding: 2px 8px;
}
.select-card-badge--fast {
  color: #fbbf24;
  background: #2a2110;
  border-color: #b45309;
}
.select-card-title {
  font-size: 14px;
  font-weight: 650;
  color: inherit;
}
.select-card-desc {
  font-size: 12px;
  color: #8b93a1;
  line-height: 1.4;
}
.select-card.selected .select-card-desc { color: #a8b0bd; }

/* ===== Segmented control (use_coins) ===== */
.promo-inline-row {
  display: grid;
  grid-template-columns: 1fr minmax(120px, 200px);
  gap: 12px;
  align-items: end;
  margin-bottom: 4px;
}
.promo-inline-main { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.promo-inline-preview { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field-meta {
  font-size: 11px;
  color: #8b93a1;
}
.segmented {
  display: inline-flex;
  width: 100%;
  max-width: 360px;
  background: #0c0e13;
  border: 1px solid #2a2f3a;
  border-radius: 10px;
  padding: 3px;
  gap: 2px;
}
.segmented-btn {
  flex: 1;
  border: none;
  background: transparent;
  color: #9aa3b2;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
}
.segmented-btn:hover { color: #e8eaed; background: #1a1f2a; }
.segmented-btn.selected {
  background: #2563eb;
  color: #fff;
}
.segmented-btn.selected:hover { background: #1d4ed8; }

/* ===== Mode toggle (input source) ===== */
.mode-toggle { display: flex; gap: 8px; margin-bottom: 14px; }
.mode-toggle-opt {
  flex: 1;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px;
  background: #0c0e13;
  border: 1px solid #2a2f3a;
  border-radius: 10px;
  cursor: pointer;
  font-size: 13px;
  color: #b0b7c3;
}
.mode-toggle-opt input[type="radio"] {
  width: 16px;
  height: 16px;
  flex: none;
  accent-color: #2563eb;
  cursor: pointer;
}
.mode-toggle-opt:has(input:checked) {
  border-color: #2563eb;
  color: #e8eaed;
  background: #11203a;
}

/* ===== Inset panels ===== */
.inset-panel {
  margin-top: 4px;
  padding: 12px;
  background: #0c0e13;
  border: 1px solid #2a2f3a;
  border-radius: 10px;
}
.po-override-panel { margin-top: 4px; }
.max-price-field { margin-top: 4px; }
.readonly-details {
  margin-top: 12px;
  border-top: 1px dashed #2a2f3a;
  padding-top: 10px;
}
.readonly-details summary {
  cursor: pointer;
  font-size: 12px;
  color: #8b93a1;
  user-select: none;
  margin-bottom: 8px;
}
.readonly-details summary:hover { color: #e8eaed; }

/* ===== Timing grid ===== */
.timing-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 4px;
}
.timing-block {
  background: #0c0e13;
  border: 1px solid #2a2f3a;
  border-radius: 10px;
  padding: 12px;
  min-width: 0;
}
.timing-block--full { grid-column: 1 / -1; }

/* ===== Stats ===== */
.stats {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  margin-top: 12px;
}
.stats .box {
  background: #0c0e13;
  border: 1px solid #2a2f3a;
  padding: 10px 8px;
  border-radius: 8px;
  text-align: center;
}
.stats .box b { display: block; font-size: 18px; }
.stats .box span { font-size: 11px; color: #8b93a1; }
.recent {
  background: #0c0e13;
  border: 1px solid #2a2f3a;
  border-radius: 8px;
  padding: 10px;
  max-height: 280px;
  overflow: auto;
  font-size: 11px;
  white-space: pre-wrap;
  word-break: break-all;
}

.url-result-label {
  font-size: 11px;
  color: #8b93a1;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.url-result-val {
  font-size: 15px;
  font-family: ui-monospace, Menlo, monospace;
  color: #4ade80;
  word-break: break-all;
}
.url-result-val--url { font-size: 12px; color: #60a5fa; }
.model-header { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.model-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.model-chip {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  width: auto;
  background: #0c0e13;
  border: 1px solid #2a2f3a;
  border-radius: 8px;
  padding: 8px 12px;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
}
.model-chip:hover { border-color: #3b82f6; }
.model-chip.selected { border-color: #2563eb; background: #11203a; }
.model-chip .chip-name { font-size: 13px; color: #e8eaed; }
.model-chip .chip-price {
  font-size: 11px;
  color: #4ade80;
  font-family: ui-monospace, Menlo, monospace;
}
.gen-get-preview { margin-top: 12px; display: flex; flex-direction: column; gap: 6px; }
.gen-get-preview .recent { max-height: 200px; }

/* ===== Copy / Paste config ===== */
.config-section-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 6px 8px;
  margin: 8px 0 4px;
}
.config-section-opt {
  flex-direction: row;
  align-items: center;
  gap: 8px;
  width: auto;
  padding: 6px 10px;
  background: #0c0e13;
  border: 1px solid #2a2f3a;
  border-radius: 8px;
  cursor: pointer;
  font-size: 12px;
  color: #b0b7c3;
  user-select: none;
}
.config-section-opt input[type="checkbox"] {
  width: 16px;
  height: 16px;
  flex: none;
  accent-color: #2563eb;
  cursor: pointer;
}
.config-section-opt:has(input:checked) {
  border-color: #2563eb;
  color: #e8eaed;
  background: #11203a;
}
.config-transfer-actions { flex-wrap: wrap; }
.config-paste-details { margin-top: 10px; }
.config-paste-details summary {
  cursor: pointer;
  font-size: 12px;
  color: #8b93a1;
  user-select: none;
  margin-bottom: 8px;
}
.config-paste-details summary:hover { color: #e8eaed; }
.config-paste-details textarea {
  margin-bottom: 6px;
  font-size: 11px;
  min-height: 80px;
}
#configTransferInfo.ok { color: #4ade80; }
#configTransferInfo.err { color: #f87171; }
#addressLoadInfo.ok { color: #4ade80; }
#addressLoadInfo.err { color: #f87171; }

.config-include-opt {
  flex: none;
  flex-direction: row;
  align-items: center;
  gap: 6px;
  width: auto;
  padding: 4px 10px;
  background: #0c0e13;
  border: 1px solid #2a2f3a;
  border-radius: 999px;
  cursor: pointer;
  font-size: 11px;
  color: #8b93a1;
  user-select: none;
  white-space: nowrap;
}
.config-include-opt input[type="checkbox"] {
  width: 14px;
  height: 14px;
  flex: none;
  accent-color: #2563eb;
  cursor: pointer;
}
.config-include-opt:hover { border-color: #3b82f6; color: #e8eaed; }
.config-include-opt:has(input:checked) {
  border-color: #2563eb;
  color: #93c5fd;
  background: #11203a;
}
.card:has(> .section-head .config-include-opt input:checked),
.card:has(> .section-head .section-head-actions .config-include-opt input:checked) {
  border-color: #1e3a5f;
}

/* ===== Collect voucher ===== */
.voucher-manual-grid { margin-top: 10px; }
.voucher-collect-list { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.voucher-collect-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: start;
  background: #0c0e13;
  border: 1px solid #2a2f3a;
  border-radius: 8px;
  padding: 10px 12px;
}
.voucher-collect-main { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.voucher-collect-ids {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 12px;
  font-family: ui-monospace, Menlo, monospace;
}
.voucher-collect-discount {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.35;
}
.voucher-collect-discount--ok { color: #4ade80; }
.voucher-collect-discount--err { color: #f87171; font-weight: 500; font-size: 12px; }
.voucher-collect-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: stretch;
}
.voucher-collect-use-btn {
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 6px;
  border: 1px solid #2563eb;
  background: #1e3a5f;
  color: #e8eaed;
  cursor: pointer;
  white-space: nowrap;
}
.voucher-collect-use-btn:hover:not(:disabled) {
  background: #2563eb;
  border-color: #3b82f6;
}
.voucher-collect-use-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  border-color: #2a2f3a;
  background: #151922;
}
.voucher-collect-sig {
  font-size: 11px;
  font-family: ui-monospace, Menlo, monospace;
  word-break: break-all;
}
.recent-collect-ok { color: #4ade80; font-weight: 600; }
.recent-collect-err { color: #f87171; }
.job-voucher-ok {
  font-size: 11px;
  color: #4ade80;
  font-family: ui-monospace, Menlo, monospace;
  margin-top: 2px;
}

/* ===== Jobs ===== */
.jobs-list { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.job-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: start;
  background: #0c0e13;
  border: 1px solid #2a2f3a;
  border-radius: 10px;
  padding: 12px;
  cursor: pointer;
}
.job-row:hover { border-color: #3b82f6; }
.job-row.selected { border-color: #2563eb; background: #11203a; }
.job-row-main { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.job-row-top { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.job-id { font-family: ui-monospace, Menlo, monospace; font-size: 12px; color: #60a5fa; }
.job-badge {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid #2a2f3a;
  color: #b0b7c3;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.job-badge.status-running { color: #4ade80; border-color: #4ade80; }
.job-badge.status-scheduled { color: #fbbf24; border-color: #fbbf24; }
.job-badge.status-pending { color: #93c5fd; border-color: #93c5fd; }
.job-badge.status-finished { color: #8b93a1; border-color: #353a45; }
.job-badge.status-stopped,
.job-badge.status-cancelled { color: #f87171; border-color: #7f1d1d; }
.job-badge.phase { color: #c4b5fd; border-color: #4c1d95; }
.job-meta {
  font-size: 11px;
  color: #8b93a1;
  font-family: ui-monospace, Menlo, monospace;
  line-height: 1.45;
  word-break: break-all;
}
.job-error { font-size: 11px; color: #f87171; }
.job-row-actions { display: flex; flex-direction: column; gap: 6px; flex: none; }
.job-row-actions button { padding: 4px 10px; font-size: 12px; white-space: nowrap; }
.jobs-empty {
  padding: 12px;
  text-align: center;
  color: #8b93a1;
  font-size: 12px;
  border: 1px dashed #2a2f3a;
  border-radius: 8px;
  margin-top: 10px;
}
#recentSourceHint { font-weight: 400; text-transform: none; letter-spacing: 0; }

/* ===== Cart ===== */
.cart-list { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.cart-empty {
  margin-top: 12px;
  padding: 14px;
  background: #0c0e13;
  border: 1px dashed #2a2f3a;
  border-radius: 8px;
  text-align: center;
}
.cart-card {
  background: #0c0e13;
  border: 1px solid #2a2f3a;
  border-radius: 10px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.cart-card.cart-card--error { border-color: #7f1d1d; }
.cart-card.cart-card--ready { border-color: #1e3a2f; }
.cart-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px 12px;
  flex-wrap: wrap;
}
.cart-card-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  flex: 1 1 180px;
}
.cart-card-name {
  font-size: 14px;
  font-weight: 600;
  color: #e5e7eb;
  line-height: 1.35;
  word-break: break-word;
}
.cart-card-name.cart-card-name--empty {
  color: #6b7280;
  font-weight: 400;
  font-style: italic;
}
.cart-card-ids {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 8px;
  font-size: 12px;
  font-family: ui-monospace, Menlo, monospace;
}
.cart-id-pill {
  background: #1a1d26;
  border: 1px solid #2a2f3a;
  border-radius: 4px;
  padding: 2px 8px;
  color: #4ade80;
}
.cart-id-pill span { color: #8b93a1; margin-right: 4px; }
.cart-card-url { font-size: 11px; color: #60a5fa; word-break: break-all; line-height: 1.4; }
.cart-card-status { font-size: 12px; color: #8b93a1; }
.cart-card-status.status-error { color: #f87171; }
.cart-card-status.status-ok { color: #4ade80; }
.cart-card-status.status-wait { color: #fbbf24; }

/* qty left of Nhân bản/Xóa — same top band as name + shop/item/model */
.cart-card-side {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 8px;
  flex: 0 0 auto;
  margin-left: auto;
}
.cart-card-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: none;
  align-items: stretch;
}
.cart-dup-btn {
  flex: none;
  padding: 4px 10px;
  font-size: 12px;
  color: #60a5fa;
  border-color: #1e3a5f;
  background: transparent;
  white-space: nowrap;
}
.cart-dup-btn:hover { background: #0f1a2a; }
.cart-remove-btn {
  flex: none;
  padding: 4px 10px;
  font-size: 12px;
  color: #f87171;
  border-color: #7f1d1d;
  background: transparent;
  white-space: nowrap;
}
.cart-remove-btn:hover { background: #2a1212; }
.cart-qty-row {
  display: flex;
  align-items: center;
  gap: 3px;
  flex: none;
  height: 30px;
}
.cart-qty-btn {
  width: 28px;
  height: 28px;
  padding: 0;
  font-size: 15px;
  line-height: 1;
  flex: none;
}
.cart-qty-input {
  width: 48px;
  height: 28px;
  text-align: center;
  padding: 2px 4px;
  flex: none;
  font-size: 13px;
  /* hide number spinners — we have ± buttons */
  -moz-appearance: textfield;
}
.cart-qty-input::-webkit-outer-spin-button,
.cart-qty-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
/* Variants: full width under header (never squeeze qty) */
.cart-models {
  width: 100%;
  min-width: 0;
}
.cart-models .model-header { margin-bottom: 6px; }
.cart-shop-group-hint { font-size: 11px; color: #8b93a1; margin-top: -2px; }

/* Narrow: qty + actions sit under name/ids as one compact toolbar */
@media (max-width: 560px) {
  .cart-card-top {
    flex-direction: column;
    align-items: stretch;
  }
  .cart-card-meta {
    flex: 1 1 auto;
  }
  .cart-card-side {
    margin-left: 0;
    width: 100%;
    justify-content: space-between;
    align-items: center;
    padding-top: 2px;
    border-top: 1px solid #1e2330;
    padding-top: 8px;
  }
  .cart-card-actions {
    flex-direction: row;
    align-items: center;
  }
  .cart-dup-btn,
  .cart-remove-btn {
    padding: 5px 10px;
  }
}

@media (max-width: 380px) {
  .cart-qty-input { width: 40px; }
  .cart-qty-btn { width: 26px; height: 26px; font-size: 14px; }
  .cart-qty-row { height: 26px; }
}

/* ===== Prefetch FAB (always on-screen) ===== */
.prefetch-fab {
  position: fixed;
  z-index: 95;
  right: max(16px, env(safe-area-inset-right, 0px));
  bottom: max(20px, env(safe-area-inset-bottom, 0px));
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  max-width: min(300px, calc(100vw - 28px));
  pointer-events: none;
}
.prefetch-fab > * { pointer-events: auto; }

.prefetch-fab-btn {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  padding: 10px 16px 10px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: linear-gradient(145deg, #fb923c 0%, #ea580c 52%, #c2410c 100%);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.15;
  cursor: pointer;
  box-shadow:
    0 0 0 1px rgba(234, 88, 12, 0.28),
    0 10px 28px rgba(234, 88, 12, 0.38),
    0 4px 14px rgba(0, 0, 0, 0.4);
  transition: transform 0.14s ease, filter 0.14s ease, box-shadow 0.14s ease, opacity 0.14s ease;
}
.prefetch-fab-btn:hover {
  filter: brightness(1.07);
  transform: translateY(-1px);
  box-shadow:
    0 0 0 1px rgba(251, 146, 60, 0.45),
    0 14px 32px rgba(234, 88, 12, 0.45),
    0 6px 16px rgba(0, 0, 0, 0.4);
}
.prefetch-fab-btn:active {
  transform: translateY(1px);
  filter: brightness(0.98);
}
.prefetch-fab-btn:disabled {
  opacity: 0.82;
  cursor: wait;
  transform: none;
  filter: none;
}
.prefetch-fab-btn:focus-visible {
  outline: 2px solid #fdba74;
  outline-offset: 3px;
}

.prefetch-fab-icon {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  flex: none;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.18);
  font-size: 15px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12);
}
.prefetch-fab.is-loading .prefetch-fab-icon {
  animation: prefetch-fab-spin 0.7s linear infinite;
}
@keyframes prefetch-fab-spin {
  to { transform: rotate(360deg); }
}

.prefetch-fab-copy {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
  text-align: left;
  min-width: 0;
}
.prefetch-fab-copy strong {
  font-size: 13.5px;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.prefetch-fab-copy span {
  font-size: 11px;
  font-weight: 500;
  opacity: 0.9;
}

.prefetch-fab-status {
  max-width: 100%;
  padding: 8px 12px;
  border-radius: 10px;
  background: rgba(20, 24, 32, 0.94);
  border: 1px solid #2a3140;
  color: #c8ced8;
  font-size: 12px;
  line-height: 1.35;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  word-break: break-word;
  cursor: default;
}
.prefetch-fab-status[data-kind="ok"] {
  border-color: #166534;
  color: #86efac;
}
.prefetch-fab-status[data-kind="warn"] {
  border-color: #854d0e;
  color: #fde68a;
}
.prefetch-fab-status[data-kind="err"] {
  border-color: #7f1d1d;
  color: #fca5a5;
}
.prefetch-fab-status[data-kind="busy"] {
  border-color: #1e3a5f;
  color: #93c5fd;
}
.prefetch-fab-status.is-clickable {
  cursor: pointer;
}
.prefetch-fab-status.is-clickable:hover {
  border-color: #3b82f6;
  color: #e8eaed;
}

/* ===== Prefetch ===== */
.prefetch-panel {
  margin-top: 12px;
  padding: 12px;
  background: #0c0e13;
  border: 1px solid #2a2f3a;
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.prefetch-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
}
.prefetch-summary { display: flex; flex-direction: column; gap: 12px; }
.prefetch-section { display: flex; flex-direction: column; gap: 6px; }
.prefetch-section-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: #8b93a1;
}
.prefetch-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 8px;
}
.prefetch-stat {
  background: #1a1d26;
  border: 1px solid #2a2f3a;
  border-radius: 8px;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.prefetch-stat-label {
  font-size: 10px;
  color: #8b93a1;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.prefetch-stat-value {
  font-size: 13px;
  font-family: ui-monospace, Menlo, monospace;
  color: #e5e7eb;
  word-break: break-all;
}
.prefetch-stat-value.ok { color: #4ade80; }
.prefetch-stat-value.warn { color: #fbbf24; }
.prefetch-stat-value.err { color: #f87171; }
.prefetch-stat-value.hl { color: #60a5fa; font-size: 15px; font-weight: 600; }
.prefetch-list { display: flex; flex-direction: column; gap: 6px; }
.prefetch-row {
  background: #1a1d26;
  border: 1px solid #2a2f3a;
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.prefetch-row.invalid { border-color: #7f1d1d; }
.prefetch-row-title {
  color: #e5e7eb;
  font-family: ui-monospace, Menlo, monospace;
  word-break: break-all;
}
.prefetch-row-meta { color: #8b93a1; font-size: 11px; }
.prefetch-empty { color: #6b7280; font-size: 12px; font-style: italic; }
.prefetch-raw summary {
  cursor: pointer;
  font-size: 12px;
  color: #8b93a1;
  user-select: none;
}
.prefetch-raw pre { margin-top: 8px; max-height: 240px; overflow: auto; }

/* ===== Override table ===== */
.override-table { display: flex; flex-direction: column; gap: 8px; }
.override-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  align-items: end;
}
.override-row--single { align-items: center; }
.override-setting { display: flex; flex-direction: column; gap: 4px; }
.override-setting select,
.override-setting input { height: 36px; }
.override-label { font-size: 12px; color: #b0b7c3; }
.override-preview-col { display: flex; align-items: flex-end; }
.override-preview {
  width: 100%;
  font-size: 12px;
  font-family: ui-monospace, Menlo, monospace;
  padding: 0 10px;
  border-radius: 8px;
  background: #0c0e13;
  border: 1px solid #2a2f3a;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #8b93a1;
  height: 36px;
}
.override-preview.value-true { color: #4ade80; border-color: #4ade80; }
.override-preview.value-false { color: #f87171; border-color: #f87171; }
.override-preview.value-from-body { color: #60a5fa; }

/* ===== Time preview ===== */
.time-preview-row {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: -4px;
}
.time-preview { font-size: 11px; padding: 2px 8px; border-radius: 4px; }
.time-preview.valid { color: #4ade80; }
.time-preview.invalid { color: #f87171; }

.clock-sync-row {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 2px;
}
.clock-sync-row button.ghost { padding: 3px 10px; font-size: 11px; }
.clock-status { font-size: 11px; padding: 2px 8px; border-radius: 4px; color: #8b93a1; }
.clock-status.ok { color: #4ade80; }
.clock-status.warn { color: #fbbf24; }
.clock-status.bad { color: #f87171; }

/* ===== Voucher override ===== */
.auto-apply-row {
  display: flex;
  flex-wrap: wrap;
  gap: 16px 24px;
  margin: 0 0 8px;
}
.checkbox-label {
  flex-direction: row;
  align-items: center;
  gap: 8px;
  width: auto;
  cursor: pointer;
  font-family: ui-monospace, Menlo, monospace;
  color: #e8eaed;
}
.checkbox-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  flex: none;
  accent-color: #2563eb;
  cursor: pointer;
}
.override-preview.value-auto,
.voucher-preview-val.value-auto { color: #fbbf24; border-color: #fbbf24; }
.voucher-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 4px;
  padding: 10px;
  background: #0c0e13;
  border: 1px solid #222833;
  border-radius: 8px;
}
.voucher-fields--hidden { display: none; }
.voucher-fields--full { grid-template-columns: 1fr; }
.voucher-preview-val {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.voucher-preview-val.value-from-body { color: #60a5fa; }
.voucher-preview-val.value-false { color: #f87171; }

.voucher-invalid-msgs {
  font-size: 12px;
  font-family: ui-monospace, Menlo, monospace;
  color: #f87171;
  background: #1a0a0a;
  border: 1px solid #f87171;
  border-radius: 8px;
  padding: 8px 10px;
  margin-top: 8px;
  white-space: pre-wrap;
  word-break: break-all;
  line-height: 1.5;
}

/* ===== Recommend platform vouchers ===== */
.recommend-platform-panel {
  margin: 8px 0 12px;
  padding: 10px;
  background: #0c0e13;
  border: 1px solid #2a2f3a;
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.recommend-platform-actions { margin-top: 0; flex-wrap: wrap; }
#recommendPlatformInfo.ok { color: #4ade80; }
#recommendPlatformInfo.err { color: #f87171; }
.recommend-platform-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 420px;
  overflow: auto;
  padding-right: 2px;
}
.recommend-platform-summary { font-size: 11px; }
.recommend-platform-section { display: flex; flex-direction: column; gap: 6px; }
.recommend-platform-section-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: #8b93a1;
}
.recommend-platform-inactive-wrap {
  margin-top: 4px;
  padding-top: 10px;
  border-top: 1px dashed #2a2f3a;
  display: flex;
  flex-direction: column;
  gap: 12px;
  opacity: 0.92;
}
.recommend-platform-inactive-head {
  color: #6b7280 !important;
  font-weight: 600;
}
.recommend-platform-section--inactive .recommend-platform-section-title {
  color: #6b7280;
  text-transform: none;
  letter-spacing: 0.2px;
}
.recommend-platform-rows { display: flex; flex-direction: column; gap: 6px; }
.recommend-platform-empty {
  color: #6b7280;
  font-size: 12px;
  font-style: italic;
  padding: 6px 0;
}
.recommend-voucher-row {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  width: 100%;
  text-align: left;
  background: #1a1d26;
  border: 1px solid #2a2f3a;
  border-radius: 8px;
  padding: 8px 10px;
  cursor: pointer;
  font-family: inherit;
  color: #e8eaed;
}
.recommend-voucher-row:hover { border-color: #3b82f6; background: #121a2a; }
.recommend-voucher-row.selected {
  border-color: #2563eb;
  background: #11203a;
  box-shadow: inset 0 0 0 1px #2563eb;
}
.recommend-voucher-row.recommended { border-color: #b45309; }
.recommend-voucher-row.recommended.selected { border-color: #2563eb; }
.recommend-voucher-row.inapplicable { opacity: 0.55; }
.recommend-voucher-row.inapplicable:hover { opacity: 0.85; }
.recommend-voucher-title {
  font-size: 13px;
  font-weight: 600;
  color: #e5e7eb;
  line-height: 1.35;
}
.recommend-voucher-meta {
  font-size: 11px;
  color: #8b93a1;
  font-family: ui-monospace, Menlo, monospace;
  word-break: break-all;
  line-height: 1.35;
}
.recommend-voucher-reason {
  font-size: 11px;
  color: #f87171;
  line-height: 1.3;
}
.recommend-voucher-badge {
  position: absolute;
  top: 6px;
  right: 8px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  color: #fbbf24;
  background: #2a2110;
  border: 1px solid #b45309;
  border-radius: 4px;
  padding: 1px 6px;
}

/* ===== Address ===== */
.address-select-row {
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 8px;
  margin-top: 0;
}
.address-select-label {
  flex: 1 1 200px;
  min-width: 0;
  margin: 0;
}
.address-select-label select {
  margin-top: 4px;
  font-family: inherit;
  font-size: 12px;
}
.address-preview {
  margin-top: 4px;
  padding: 8px 10px;
  background: #0c0e13;
  border: 1px solid #2a2f3a;
  border-radius: 8px;
  font-size: 12px;
  line-height: 1.45;
  color: #b0b7c3;
}
.address-preview strong { color: #e8eaed; font-weight: 600; }
.address-card-sep { color: #6b7280; font-weight: 400; }
.address-card-phone {
  font-weight: 500;
  color: #b0b7c3;
  font-family: ui-monospace, Menlo, monospace;
  font-size: 12px;
}
.address-card-line {
  margin-top: 4px;
  font-size: 12px;
  color: #8b93a1;
  line-height: 1.4;
  word-break: break-word;
}
.address-default-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  color: #4ade80;
  border: 1px solid #4ade80;
  border-radius: 999px;
  padding: 1px 8px;
  background: transparent;
  vertical-align: middle;
}

/* ===== Payment channels (§3b) ===== */
/* Override global label { flex-direction: column } for payment rows. */
.payment-toolbar {
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}
/* Guard panel. Labels here must NOT inherit the global label{flex-direction:column},
   and must not shrink inside a flex row — that wraps every word onto its own line. */
.payment-guard {
  margin-bottom: 10px;
  padding: 10px 12px;
  background: #0c0e13;
  border: 1px solid #2a2f3a;
  border-radius: 8px;
}
.payment-guard .pg-check {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 9px;
  margin: 0;
  cursor: pointer;
}
/* Global `input { width: 100% }` (line 254) applies to checkboxes too — without an
   explicit size the box eats the whole row and squeezes the text to one character
   per line. Same pattern as .checkbox-label / .config-section-opt. */
.payment-guard .pg-check > input[type="checkbox"] {
  width: 16px;
  height: 16px;
  flex: none;
  margin: 1px 0 0;
  accent-color: #2563eb;
  cursor: pointer;
}
.pg-check-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1 1 auto;
  min-width: 0;
}
.pg-check-title {
  font-size: 12.5px;
  color: #e8eaed;
  line-height: 1.4;
}
.pg-check-desc {
  font-size: 11.5px;
  color: #8a91a0;
  line-height: 1.45;
}
.pg-check--slim .pg-check-title { color: #cfd4dd; }

.pg-spl {
  margin-top: 12px;
  padding-top: 11px;
  border-top: 1px solid #22262f;
  display: flex;
  flex-direction: column;
  gap: 11px;
}
.pg-spl[hidden] { display: none; }
.pg-spl-head {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #7f8794;
}
.pg-spl-hint {
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
  color: #6f7683;
}
.pg-spl-head code {
  font-size: 10.5px;
  background: #171b23;
  border-radius: 4px;
  padding: 1px 4px;
}
.pg-field {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
}
.pg-field-label {
  font-size: 12px;
  color: #8a91a0;
  flex: 0 0 auto;
}
.pg-radios {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.payment-guard .pg-radios label {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
  white-space: nowrap;
  margin: 0;
  padding: 5px 10px;
  font-size: 12px;
  color: #b0b7c3;
  background: #12151c;
  border: 1px solid #272c37;
  border-radius: 999px;
  cursor: pointer;
  transition: border-color 0.12s, color 0.12s, background 0.12s;
}
.payment-guard .pg-radios label:hover {
  border-color: #3a4152;
  color: #e8eaed;
}
.payment-guard .pg-radios label:has(input:checked) {
  border-color: #4d90fe;
  background: #101a29;
  color: #e8eaed;
}
.payment-guard .pg-radios input[type="radio"] {
  width: 14px;
  height: 14px;
  flex: none;
  margin: 0;
  accent-color: #2563eb;
  cursor: pointer;
}
.payment-resolve-note {
  margin-bottom: 10px;
  padding: 8px 10px;
  border: 1px solid #2a2f3a;
  border-left-width: 3px;
  border-radius: 8px;
  font-size: 12px;
  line-height: 1.45;
  word-break: break-word;
}
.payment-resolve-note.is-ok {
  border-left-color: #4d90fe;
  background: #0d1420;
  color: #a9c4ea;
}
.payment-resolve-note.is-warn,
.payment-resolve-note.is-dropped {
  border-left-color: #e0a33e;
  background: #1a140a;
  color: #e8c58a;
}
.payment-resolve-note.is-blocked {
  border-left-color: #e05a5a;
  background: #1c0f0f;
  color: #f0a0a0;
}
.payment-selected-preview {
  margin-bottom: 10px;
  padding: 8px 10px;
  background: #0c0e13;
  border: 1px solid #2a2f3a;
  border-radius: 8px;
  font-size: 12px;
  line-height: 1.45;
  color: #b0b7c3;
  word-break: break-word;
}
.payment-selected-preview strong {
  color: #e8eaed;
  font-weight: 600;
  display: block;
  margin-bottom: 4px;
}
.payment-selected-json {
  font-family: ui-monospace, Menlo, monospace;
  font-size: 11px;
  color: #8b93a1;
  word-break: break-all;
}
.payment-channel-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 360px;
  overflow: auto;
  padding-right: 2px;
}
.payment-empty {
  margin: 0;
  font-style: italic;
}
.payment-channel {
  background: #0c0e13;
  border: 1px solid #2a2f3a;
  border-radius: 8px;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: border-color 0.12s, box-shadow 0.12s;
}
.payment-channel.is-disabled {
  opacity: 0.5;
}
.payment-channel.is-selected {
  border-color: #2563eb;
  box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.35);
  background: #0e1524;
}
/* Single horizontal row — must beat global label { flex-direction: column } */
.payment-channel-main {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  align-items: center !important;
  gap: 10px !important;
  cursor: pointer;
  user-select: none;
  color: inherit;
  font-size: inherit;
  min-width: 0;
}
.payment-channel-main input[type="radio"] {
  margin: 0 !important;
  accent-color: #2563eb;
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  align-self: center;
}
.payment-channel-icon {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  object-fit: contain;
  background: #1a1d26;
  border: 1px solid #2a2f3a;
  flex: 0 0 auto;
  display: block;
}
.payment-channel-icon--placeholder {
  background: #1a1d26;
}
.payment-channel-body {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
  justify-content: center;
}
.payment-channel-name {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  line-height: 1.3;
  min-width: 0;
}
.payment-channel-name-text {
  font-size: 13px;
  font-weight: 600;
  color: #e8eaed;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.payment-channel-meta {
  font-size: 11px;
  color: #7b8494;
  font-family: ui-monospace, Menlo, monospace;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.payment-badge {
  display: inline-block;
  flex: 0 0 auto;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  border-radius: 999px;
  padding: 1px 7px;
  line-height: 1.3;
}
.payment-badge--current {
  color: #60a5fa;
  border: 1px solid #2563eb;
  background: rgba(37, 99, 235, 0.12);
}
.payment-badge--disabled {
  color: #f87171;
  border: 1px solid #7f1d1d;
  background: rgba(127, 29, 29, 0.2);
}
.payment-badge--sub {
  color: #4ade80;
  border: 1px solid #166534;
  background: rgba(22, 101, 52, 0.2);
}
/* Compact sub-option picker (only shown for the selected channel) */
.payment-option-select-wrap {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  margin-left: 26px; /* align under name (radio 16 + gap 10) */
  padding-left: 10px;
  border-left: 2px solid #2a3a5c;
}
.payment-option-select-label {
  flex: 0 0 auto;
  font-size: 11px;
  color: #8b93a1;
  white-space: nowrap;
}
.payment-option-select {
  flex: 1 1 auto;
  min-width: 0;
  height: 34px;
  margin: 0;
  font-size: 12px;
  font-family: inherit;
}

/* Shop voucher cards */
.shop-voucher-card {
  background: #0c0e13;
  border: 1px solid #262a33;
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 8px;
}
.shop-voucher-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.shop-toggle-label { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.shop-toggle-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: #2563eb;
}
.shop-name { font-size: 14px; font-weight: 500; color: #e8eaed; }
.shop-id-badge {
  font-size: 11px;
  color: #8b93a1;
  background: #1a1d26;
  padding: 2px 6px;
  border-radius: 4px;
  font-family: ui-monospace, Menlo, monospace;
}
.shop-mode-select {
  width: auto;
  min-width: 100px;
  background: #0c0e13;
  border: 1px solid #2a2f3a;
  color: #e8eaed;
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 12px;
}
.shop-mode-select:disabled { opacity: 0.4; }
.shop-voucher-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 8px;
}
.shop-voucher-fields--full { grid-template-columns: 1fr; }

/* ===== Voucher validation ===== */
.voucher-check-row { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.shop-voucher-check { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.check-btn { padding: 6px 12px; font-size: 12px; white-space: nowrap; }
.check-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.check-hint { font-size: 11px; }
.shop-check-result { flex: 1; min-width: 0; }
.shop-check-label { flex: none; font-size: 12px; }
.override-preview.voucher-valid,
.override-preview.voucher-invalid {
  white-space: normal;
  height: auto;
  min-height: 36px;
  padding: 6px 10px;
  line-height: 1.4;
}
.override-preview.voucher-valid { color: #4ade80; border-color: #4ade80; }
.override-preview.voucher-invalid { color: #f87171; border-color: #f87171; }

/* ===== Diff panel ===== */
.diff-section {
  margin: 6px 0;
  padding: 8px 10px;
  background: #0c0e13;
  border: 1px solid #2a2f3a;
  border-radius: 8px;
}
.diff-section h4 {
  margin: 0 0 4px;
  font-size: 11px;
  color: #8b93a1;
  font-family: ui-monospace, Menlo, monospace;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.diff-line {
  display: grid;
  grid-template-columns: 200px 1fr 1fr;
  gap: 8px;
  padding: 4px 0;
  font-size: 12px;
  font-family: ui-monospace, Menlo, monospace;
  align-items: start;
}
.diff-line + .diff-line { border-top: 1px solid #1a1d26; }
.diff-field {
  color: #9ca3af;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.diff-original { color: #f87171; overflow: hidden; text-overflow: ellipsis; }
.diff-final { color: #4ade80; overflow: hidden; text-overflow: ellipsis; }
.diff-shop-sub {
  margin: 4px 0 4px 8px;
  padding: 6px 8px;
  background: #13151c;
  border-radius: 4px;
}
.diff-shop-label {
  font-size: 11px;
  color: #fbbf24;
  margin-bottom: 2px;
  font-family: ui-monospace, Menlo, monospace;
}

/* ===== §5 Advanced price rules ===== */
.price-rules-panel {
  margin-top: 4px;
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 10px;
  padding: 12px;
  background: rgba(15, 23, 42, 0.35);
}
.price-rules-baseline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-bottom: 10px;
}
.price-rules-baseline-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  margin-bottom: 2px;
}
.price-rules-baseline-title {
  font-size: 12px;
  font-weight: 600;
  color: #cbd5e1;
}
.baseline-chip {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.25);
  background: rgba(30, 41, 59, 0.7);
  font-size: 11px;
  font-family: ui-monospace, Menlo, monospace;
}
.baseline-chip b { color: #94a3b8; font-weight: 500; }
.baseline-chip span { color: #e2e8f0; }
.baseline-chip.is-null span { color: #64748b; font-style: italic; }
.baseline-empty { font-size: 12px; color: #94a3b8; }

.rule-group {
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-left: 3px solid rgba(96, 165, 250, 0.55);
  border-radius: 8px;
  padding: 8px 10px 10px;
  background: rgba(30, 41, 59, 0.35);
}
.rule-group + .rule-group,
.rule-row + .rule-group,
.rule-group + .rule-row { margin-top: 8px; }
.rule-group--or { border-left-color: rgba(251, 191, 36, 0.6); }
.rule-group-head {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.rule-group-children { display: flex; flex-direction: column; gap: 8px; }
.rule-op-select {
  font-size: 12px;
  font-weight: 600;
  padding: 3px 8px;
  min-width: 74px;
}
.rule-group-hint { font-size: 11px; color: #94a3b8; }
.rule-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.rule-row select,
.rule-row input { padding: 5px 8px; font-size: 12px; }
.rule-field { min-width: 210px; flex: 1 1 210px; }
.rule-cmp { min-width: 110px; }
.rule-value { width: 130px; }
.rule-value-preview {
  font-size: 11px;
  color: #94a3b8;
  font-family: ui-monospace, Menlo, monospace;
  min-width: 90px;
}
.rule-value-preview.is-hidden { visibility: hidden; }
.rule-btn {
  padding: 3px 9px;
  font-size: 11px;
  border-radius: 6px;
  border: 1px solid rgba(148, 163, 184, 0.3);
  background: rgba(51, 65, 85, 0.7);
  color: #cbd5e1;
  cursor: pointer;
}
.rule-btn:hover { background: rgba(71, 85, 105, 0.9); color: #f1f5f9; }
.rule-btn--del { color: #fca5a5; border-color: rgba(248, 113, 113, 0.35); }
.rule-btn--del:hover { background: rgba(127, 29, 29, 0.5); color: #fecaca; }
.rule-preview {
  margin-top: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(2, 6, 23, 0.6);
  border: 1px solid rgba(148, 163, 184, 0.18);
  font-size: 11px;
  font-family: ui-monospace, Menlo, monospace;
  color: #a5b4fc;
  word-break: break-word;
}
.rule-preview.is-warn { color: #fbbf24; }

/* ===== Responsive ===== */
@media (max-width: 900px) {
  .select-cards--3 { grid-template-columns: 1fr; }
  .select-cards--4 { grid-template-columns: repeat(2, 1fr); }
  .timing-grid { grid-template-columns: 1fr; }
  .timing-block--full { grid-column: auto; }
}

@media (max-width: 720px) {
  .wrap { padding: 14px 12px 96px; }
  .prefetch-fab { bottom: max(14px, env(safe-area-inset-bottom, 0px)); right: max(12px, env(safe-area-inset-right, 0px)); }
  .prefetch-fab-btn { padding: 9px 14px 9px 9px; }
  .prefetch-fab-icon { width: 32px; height: 32px; }
  .app-header-inner { padding: 8px 12px; }
  .app-brand-sub { display: none; }
  .account-chip { max-width: min(240px, 54vw); padding: 5px 8px 5px 6px; }
  .account-chip-kicker { display: none; }
  .card { padding: 14px; border-radius: 10px; }
  .card-summary { padding: 12px 14px; }
  .card-body { padding: 0 14px 14px; }
  .select-cards { grid-template-columns: 1fr; }
  .promo-inline-row { grid-template-columns: 1fr; }
  .segmented { max-width: none; }
  .grid,
  .grid-2 { grid-template-columns: 1fr; }
  .grid .span-2 { grid-column: auto; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .override-row { grid-template-columns: 1fr; }
  .time-preview-row { grid-template-columns: 1fr; }
  .voucher-fields { grid-template-columns: 1fr; }
  .shop-voucher-fields { grid-template-columns: 1fr; }
  .shop-voucher-header { flex-direction: column; align-items: flex-start; }
  .diff-line { grid-template-columns: 1fr; gap: 2px; }
  .job-row { grid-template-columns: 1fr; }
  .job-row-actions { flex-direction: row; flex-wrap: wrap; }
  .mode-toggle { flex-direction: column; }
}

@media (max-width: 420px) {
  .account-chip-text { display: none; }
  .account-chip { border-radius: 50%; width: 40px; height: 40px; padding: 0; justify-content: center; max-width: none; }
  .account-chip-caret { display: none; }
  .account-chip-avatar { border: none; background: transparent; }
}

/* ===== Insurance overrides (§3c) ===== */
.insurance-toolbar { margin-bottom: 10px; }
.insurance-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 420px;
  overflow: auto;
  padding-right: 2px;
}
.insurance-empty { margin: 0; font-style: italic; }
.insurance-group {
  background: #0c0e13;
  border: 1px solid #2a2f3a;
  border-radius: 8px;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.insurance-group-title {
  font-size: 12px;
  font-weight: 600;
  color: #e8eaed;
  word-break: break-word;
}
.insurance-group-meta {
  font-family: ui-monospace, Menlo, monospace;
  font-size: 11px;
  color: #8b93a1;
  word-break: break-all;
}
.insurance-row {
  border-top: 1px solid #1e2330;
  padding-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.insurance-row:first-of-type { border-top: none; padding-top: 0; }
.insurance-row.is-overridden { border-left: 2px solid #2563eb; padding-left: 8px; }
.insurance-row-title {
  font-size: 12px;
  color: #e8eaed;
  font-weight: 600;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px;
}
.insurance-premium { color: #f59e0b; font-weight: 700; }
.insurance-row-meta {
  font-size: 11px;
  color: #8b93a1;
  font-family: ui-monospace, Menlo, monospace;
  word-break: break-all;
}
.insurance-state-before { color: #8b93a1; }
.insurance-state-after { color: #e8eaed; font-weight: 700; }
.insurance-state-after.is-changed { color: #4ade80; }
.insurance-row .segmented { max-width: 300px; }

/* ===== Gifts / add-on deal (§3d) ===== */
.gift-toolbar { margin-bottom: 10px; gap: 12px; align-items: center; }
.gift-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 420px;
  overflow: auto;
  padding-right: 2px;
}
.gift-empty { margin: 0; font-style: italic; }
.gift-group {
  background: #0c0e13;
  border: 1px solid #2a2f3a;
  border-radius: 8px;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.gift-group-title {
  font-size: 12px;
  font-weight: 600;
  color: #e8eaed;
  word-break: break-word;
}
.gift-group-meta {
  font-family: ui-monospace, Menlo, monospace;
  font-size: 11px;
  color: #8b93a1;
  word-break: break-all;
}
.gift-row {
  border-top: 1px solid #1e2330;
  padding: 8px 6px;
  display: flex;
  flex-direction: row;         /* beat global label { flex-direction: column } */
  align-items: flex-start;
  gap: 10px;
  border-radius: 6px;
  cursor: pointer;
  font-size: inherit;
  color: inherit;
}
.gift-row:first-of-type { border-top: none; }
.gift-row:hover { background: #12151c; }
.gift-row.is-picked { background: rgba(74, 222, 128, 0.07); box-shadow: inset 2px 0 0 #4ade80; }
.gift-row.is-disabled { cursor: not-allowed; opacity: 0.55; }
.gift-row.is-disabled:hover { background: none; }
/* Global `input { width: 100% }` (line 254) applies to checkboxes too — pin size. */
.gift-check {
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  margin: 2px 0 0;
  accent-color: #4ade80;
  cursor: pointer;
}
.gift-row.is-disabled .gift-check { cursor: not-allowed; }
.gift-row-body { flex: 1 1 auto; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.gift-row-title {
  font-size: 12.5px;
  color: #e8eaed;
  font-weight: 600;
  line-height: 1.35;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}
.gift-row-name { word-break: break-word; }
.gift-row-meta {
  font-size: 11px;
  color: #8b93a1;
  font-family: ui-monospace, Menlo, monospace;
  word-break: break-all;
}
.gift-row-price {
  flex: 0 0 auto;
  font-size: 12px;
  font-weight: 700;
  color: #f59e0b;
  white-space: nowrap;
  margin-top: 1px;
}
.gift-row-price.is-free { color: #4ade80; }
.gift-badge {
  font-size: 10px;
  font-weight: 700;
  color: #4ade80;
  border: 1px solid #2a5c3a;
  border-radius: 4px;
  padding: 1px 5px;
  white-space: nowrap;
}
.gift-badge.is-soldout { color: #f87171; border-color: #5c2a2a; }
.gift-note { font-size: 11px; color: #f59e0b; margin-top: 4px; }
