:root {
  --ink: #17201d;
  --muted: #69736f;
  --line: #dce3df;
  --line-strong: #c9d3ce;
  --surface: #ffffff;
  --surface-soft: #f5f7f6;
  --canvas: #eef2f0;
  --primary: #087f5b;
  --primary-dark: #066346;
  --primary-soft: #e7f6f0;
  --blue: #2563eb;
  --blue-soft: #eaf1ff;
  --amber: #b45309;
  --amber-soft: #fff5df;
  --red: #c23b3b;
  --red-soft: #fff0ef;
  --shadow: 0 18px 50px rgba(26, 44, 36, 0.08);
  --radius: 8px;
  font-family: Inter, "Segoe UI", "Microsoft YaHei", system-ui, sans-serif;
  color: var(--ink);
  background: var(--canvas);
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  min-height: 100%;
}

body {
  min-height: 100vh;
  margin: 0;
  background: var(--canvas);
}

button,
input,
textarea,
select {
  font: inherit;
  letter-spacing: 0;
}

button,
summary {
  -webkit-tap-highlight-color: transparent;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: wait;
  opacity: 0.62;
}

svg {
  display: block;
  width: 1.1rem;
  height: 1.1rem;
  flex: 0 0 auto;
}

[hidden] {
  display: none !important;
}

.topbar {
  height: 72px;
  padding: 0 clamp(20px, 4vw, 64px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: var(--ink);
  text-decoration: none;
}

.brand-mark {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  color: white;
  background: var(--primary);
  border-radius: 7px;
}

.brand-mark svg {
  width: 21px;
  height: 21px;
}

.brand > span:last-child {
  display: grid;
  gap: 1px;
}

.brand strong {
  font-size: 14px;
  line-height: 1.2;
  letter-spacing: 0;
}

.brand small {
  color: var(--muted);
  font-size: 11px;
}

.topbar-status,
.operator-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #14a56f;
  box-shadow: 0 0 0 4px #e5f6ef;
}

.live-dot.paused {
  background: var(--amber);
  box-shadow: 0 0 0 4px var(--amber-soft);
}

.topbar-command {
  min-height: 38px;
  padding-inline: 12px;
  white-space: nowrap;
}

.topbar-command.paused {
  color: var(--primary-dark);
  border-color: #a9cdbf;
  background: var(--primary-soft);
}

.customer-shell {
  width: min(1160px, calc(100% - 40px));
  min-height: calc(100vh - 130px);
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(380px, 0.78fr);
  background: var(--surface);
  border-inline: 1px solid var(--line);
}

.link-submit-shell {
  width: min(1240px, calc(100% - 40px));
  min-height: calc(100vh - 130px);
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(430px, 1.1fr);
  background: var(--surface);
  border-inline: 1px solid var(--line);
}

.link-form-section,
.link-status-section {
  padding: clamp(42px, 5vw, 68px);
}

.link-form-section {
  border-right: 1px solid var(--line);
}

.link-status-section {
  background: var(--surface-soft);
}

.link-task-list {
  display: grid;
  gap: 8px;
  margin-top: 22px;
}

.link-task-row {
  min-width: 0;
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
}

.link-task-body {
  min-width: 0;
  display: grid;
  gap: 5px;
}

.link-task-body strong {
  font-family: "Cascadia Code", Consolas, monospace;
  font-size: 12px;
}

.link-task-body a {
  overflow: hidden;
  color: var(--primary-dark);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.queue-ahead-hint { color: var(--amber); font-size: 11px; }

.link-task-side {
  display: flex;
  align-items: center;
  gap: 7px;
}

.link-status-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 16px;
}

.submit-section,
.status-section {
  padding: clamp(42px, 5vw, 72px);
}

.submit-section {
  border-right: 1px solid var(--line);
}

.status-section {
  background: var(--surface-soft);
}

.section-heading {
  margin-bottom: 36px;
}

.customer-live-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 24px;
  margin-top: 22px;
  color: var(--muted);
  font-size: 11px;
}

.customer-live-summary > div {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.customer-live-summary svg { width: 15px; height: 15px; color: var(--primary); }
.customer-live-summary strong { color: var(--ink); font-size: 16px; font-variant-numeric: tabular-nums; }

.eyebrow {
  display: block;
  margin-bottom: 8px;
  color: var(--primary);
  font-size: 11px;
  font-weight: 750;
  line-height: 1.3;
  letter-spacing: 0;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

.section-heading h1,
.admin-heading h1 {
  margin-bottom: 12px;
  font-size: 32px;
  line-height: 1.2;
  letter-spacing: 0;
}

.upstream-panel,
.payment-records-panel,
.access-token-panel,
.account-inventory-panel,
.cdk-panel,
.scanner-management-panel {
  margin-bottom: 26px;
  padding: 22px 24px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
}

.access-token-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 18px;
}

.payment-records-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 18px;
}

.payment-records-heading h2 {
  margin: 0;
  font-size: 18px;
}

.payment-records-stats {
  max-width: 100%;
  display: inline-flex;
  align-items: stretch;
  padding: 3px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-soft);
}

.payment-record-stat {
  min-width: 82px;
  min-height: 44px;
  padding: 5px 10px;
  border: 1px solid transparent;
  border-radius: 4px;
  color: var(--muted);
  background: transparent;
  text-align: left;
  white-space: nowrap;
}

.payment-record-stat:hover {
  color: var(--ink);
  background: #edf2f0;
}

.payment-record-stat.active {
  color: var(--primary-dark);
  border-color: #bad7cb;
  background: var(--surface);
}

.payment-record-stat span,
.payment-record-stat strong {
  display: block;
}

.payment-record-stat span {
  font-size: 9px;
  font-weight: 650;
}

.payment-record-stat strong {
  margin-top: 2px;
  color: var(--ink);
  font-size: 15px;
  font-variant-numeric: tabular-nums;
}

.payment-records-toolbar {
  display: grid;
  grid-template-columns: minmax(170px, 200px) minmax(190px, 230px) minmax(240px, 1fr) auto;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 11px;
}

.payment-record-outcome-filter,
.payment-record-source-filter {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 8px;
}

.payment-record-outcome-filter select,
.payment-record-source-filter select {
  min-width: 0;
  min-height: 32px;
  padding: 4px 26px 4px 8px;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  color: var(--ink);
  background: var(--surface);
  font-size: 11px;
}

.payment-record-search {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 32px;
  padding: 0 9px;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  background: var(--surface);
}

.payment-record-search svg {
  flex: 0 0 auto;
  width: 15px;
  color: var(--muted);
}

.payment-record-search input {
  min-width: 0;
  min-height: 28px;
  padding: 3px 0;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 11px;
}

.payment-record-toolbar-actions,
.payment-record-pagination {
  display: flex;
  align-items: center;
  gap: 6px;
}

.payment-record-pagination {
  padding-left: 4px;
  border-left: 1px solid var(--line);
}

.payment-record-pagination > span {
  min-width: 132px;
  color: var(--muted);
  text-align: center;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.payment-record-list {
  max-height: 520px;
  margin-top: 18px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.payment-record-list .queue-empty {
  min-height: 240px;
}

.payment-record-table {
  width: 100%;
  min-width: 1120px;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 11px;
}

.payment-record-table th,
.payment-record-table td {
  padding: 9px 8px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

.payment-record-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  color: var(--muted);
  background: #f8faf9;
  font-size: 11px;
  font-weight: 650;
}

.payment-record-table th:nth-child(1) { width: 94px; }
.payment-record-table th:nth-child(2) { width: 165px; }
.payment-record-table th:nth-child(3) { width: 300px; }
.payment-record-table th:nth-child(4) { width: 118px; }
.payment-record-table th:nth-child(5) { width: 178px; }
.payment-record-table th:nth-child(6) { width: 240px; }
.payment-record-table th:nth-child(7) { width: 46px; }

.payment-record-table td > strong,
.payment-record-table td > small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.payment-record-table td:nth-child(6) {
  overflow: hidden;
}

.payment-record-table td > small {
  margin-top: 4px;
  color: var(--muted);
}

.payment-record-table a {
  color: var(--primary-dark);
}

.payment-record-link {
  display: inline-flex !important;
  align-items: center;
  gap: 5px;
  font-weight: 700;
  text-decoration: none;
}

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

.payment-record-link svg {
  width: 13px;
  height: 13px;
}

.payment-record-row:hover td {
  background: #f8faf9;
}

.payment-record-row td:last-child {
  text-align: right;
}

.access-token-heading h2 {
  margin: 0 0 6px;
  font-size: 18px;
}

.access-token-heading p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.access-token-stats {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px 16px;
  color: var(--muted);
  font-size: 11px;
}

.access-token-stats strong {
  margin-left: 4px;
  color: var(--ink);
  font-size: 16px;
}

.access-token-import-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 12px;
}

.access-token-import-form textarea {
  min-height: 116px;
  resize: vertical;
  font-family: "Cascadia Code", Consolas, monospace;
  font-size: 11px;
  line-height: 1.45;
}

.access-token-import-form .primary-button {
  min-height: 46px;
}

.auto-dispatch-form {
  display: grid;
  grid-template-columns: minmax(430px, 1fr) auto auto auto;
  align-items: end;
  gap: 12px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.auto-dispatch-targets {
  display: grid;
  grid-template-columns: repeat(3, minmax(120px, 1fr));
  gap: 8px;
  min-width: 0;
}

.auto-dispatch-targets .field {
  min-width: 0;
}

.dispatch-mode-field {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 46px;
  margin: 0;
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.dispatch-mode-field legend {
  padding: 0 4px;
  color: var(--muted);
  font-size: 10px;
}

.dispatch-mode-field label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text);
  font-size: 12px;
  white-space: nowrap;
}

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

.auto-dispatch-form .primary-button {
  min-height: 46px;
}

.task-timeout-form {
  grid-template-columns: minmax(220px, 1fr) auto;
}

.toggle-field {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 46px;
  color: var(--text);
  font-size: 12px;
  white-space: nowrap;
}

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

.auto-dispatch-status {
  margin-top: 10px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.auto-dispatch-log-panel {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.auto-dispatch-log-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.auto-dispatch-log-heading > div {
  min-width: 0;
  display: grid;
  gap: 5px;
}

.auto-dispatch-log-heading strong {
  color: var(--ink);
  font-size: 13px;
}

#auto-dispatch-diagnosis {
  color: var(--green);
  font-size: 11px;
  line-height: 1.5;
}

#auto-dispatch-diagnosis.blocked { color: var(--danger); }

.auto-dispatch-log-list {
  max-height: 320px;
  margin-top: 12px;
  overflow: auto;
  border-top: 1px solid var(--line);
}

.auto-dispatch-log-row {
  padding: 10px 2px;
  border-bottom: 1px solid var(--line);
}

.auto-dispatch-log-row-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.auto-dispatch-log-row-heading strong {
  color: var(--ink);
  font-size: 12px;
}

.auto-dispatch-log-row.failed .auto-dispatch-log-row-heading strong { color: var(--danger); }

.auto-dispatch-log-row time {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
}

.auto-dispatch-log-row code {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.5;
  overflow-wrap: anywhere;
  white-space: normal;
}

.auto-dispatch-log-empty {
  padding: 18px 2px;
  color: var(--muted);
  font-size: 12px;
}

.access-token-list {
  max-height: 520px;
  margin-top: 18px;
  overflow: auto;
  border-top: 1px solid var(--line);
}

.access-token-list-toolbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 16px;
  color: var(--muted);
  font-size: 11px;
}

.access-token-list-toolbar select {
  min-height: 32px;
  padding: 4px 26px 4px 8px;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  color: var(--ink);
  background: var(--surface);
  font-size: 11px;
}

.access-token-list-toolbar > span {
  min-width: 136px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.access-token-table {
  width: 100%;
  min-width: 1100px;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 11px;
}

.access-token-table th,
.access-token-table td {
  padding: 9px 8px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

.access-token-table th {
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
}

.access-token-table th:nth-child(1) { width: 116px; }
.access-token-table th:nth-child(2) { width: 220px; }
.access-token-table th:nth-child(4) { width: 148px; }
.access-token-table th:nth-child(5) { width: 180px; }
.access-token-table th:nth-child(6) { width: 124px; }

.access-token-table td > strong,
.access-token-table td > small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.access-token-table td > small {
  margin-top: 4px;
  color: var(--muted);
}

.access-token-value-cell textarea {
  width: 100%;
  min-height: 48px;
  padding: 7px 8px;
  resize: none;
  font-family: "Cascadia Code", Consolas, monospace;
  font-size: 10px;
  line-height: 1.35;
}

.access-token-actions {
  white-space: nowrap;
}

.account-inventory-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 18px;
}

.account-inventory-heading h2 {
  margin: 0;
  font-size: 18px;
}

.account-inventory-stats {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px 16px;
  color: var(--muted);
  font-size: 11px;
}

.account-inventory-stats strong {
  margin-left: 4px;
  color: var(--ink);
  font-size: 16px;
}

.account-import-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(180px, 260px) minmax(130px, 160px) auto;
  align-items: end;
  gap: 12px;
}

.account-import-form textarea {
  min-height: 116px;
  resize: vertical;
  font-family: "Cascadia Code", Consolas, monospace;
  font-size: 11px;
  line-height: 1.45;
}

.account-import-file-field input {
  min-height: 46px;
  padding: 9px;
  font-size: 11px;
}

.account-import-form .primary-button {
  min-height: 46px;
}

.account-list-toolbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 16px;
  color: var(--muted);
  font-size: 11px;
}

.account-copy-actions {
  display: flex;
  gap: 8px;
  margin-right: auto;
}

.account-copy-missing {
  white-space: nowrap;
}

.account-list-toolbar select {
  width: 220px;
  min-height: 32px;
  padding: 4px 26px 4px 8px;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  color: var(--ink);
  background: var(--surface);
  font-size: 11px;
}

.account-list-toolbar label,
.account-list-toolbar > span {
  white-space: nowrap;
}

.account-list-toolbar > span {
  min-width: 200px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.account-list {
  max-height: 520px;
  margin-top: 18px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.account-table {
  width: 100%;
  min-width: 980px;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 11px;
}

.account-table th,
.account-table td {
  padding: 9px 8px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

.account-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  color: var(--muted);
  background: #f8faf9;
  font-weight: 650;
}

.account-table th:nth-child(1) { width: 110px; }
.account-table th:nth-child(2) { width: 230px; }
.account-table th:nth-child(3) { width: 170px; }
.account-table th:nth-child(4) { width: 170px; }
.account-table th:nth-child(5) { width: 150px; }
.account-table th:nth-child(6) { width: 118px; }

.account-table td > strong,
.account-table td > small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-table td > small {
  margin-top: 4px;
  color: var(--muted);
}

.account-table td:nth-child(2) > small {
  overflow: visible;
  text-overflow: clip;
  white-space: normal;
  overflow-wrap: anywhere;
}

.account-actions {
  white-space: nowrap;
}

.account-result-dialog {
  width: min(760px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  padding: 24px;
  overflow: auto;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  color: var(--ink);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
}

.account-result-dialog::backdrop {
  background: rgb(19 28 25 / 46%);
}

.account-result-dialog textarea {
  width: 100%;
  min-height: 360px;
  margin-top: 16px;
  resize: vertical;
  font-family: "Cascadia Code", Consolas, monospace;
  font-size: 11px;
  line-height: 1.5;
}

@media (max-width: 900px) {
  .account-inventory-heading {
    display: grid;
  }

  .account-inventory-stats {
    justify-content: flex-start;
  }

  .account-import-form {
    grid-template-columns: 1fr;
  }

  .account-list-toolbar {
    flex-wrap: wrap;
    justify-content: flex-start;
  }

  .account-list-toolbar > span {
    margin-left: auto;
  }

  .account-copy-actions {
    width: 100%;
    margin-right: 0;
  }
}

@media (max-width: 560px) {
  .account-inventory-panel {
    padding: 18px 16px;
  }

  .account-inventory-stats {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .account-list-toolbar > span {
    order: 3;
    width: 100%;
    min-width: 0;
    margin-left: 0;
    text-align: left;
  }

  .account-list-toolbar select {
    width: 100%;
  }

  .account-copy-actions {
    flex-direction: column;
  }

  .account-copy-actions .account-copy-missing {
    width: 100%;
  }

  .account-table {
    min-width: 0;
    table-layout: auto;
  }

  .account-table thead {
    display: none;
  }

  .account-table tbody,
  .account-table tr {
    display: block;
  }

  .account-table tr {
    position: relative;
    padding: 12px 52px 12px 12px;
    border-bottom: 1px solid var(--line);
  }

  .account-table td {
    display: block;
    width: auto;
    padding: 4px 0;
    border: 0;
  }

  .account-table td:nth-child(2) strong {
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .account-table td:nth-child(3),
  .account-table td:nth-child(4),
  .account-table td:nth-child(5) {
    color: var(--muted);
  }

  .account-table td:nth-child(4)::before {
    content: "扫码 / Scan: ";
  }

  .account-table td:nth-child(5)::before {
    content: "领取 / Delivery: ";
  }

  .account-table td:last-child {
    position: absolute;
    top: 10px;
    right: 10px;
  }

  .account-result-dialog {
    padding: 18px;
  }

  .account-result-dialog textarea {
    min-height: 300px;
  }
}

.scanner-management-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 18px;
}

.scanner-management-heading h2 {
  margin: 0 0 6px;
  font-size: 18px;
  letter-spacing: 0;
}

.scanner-management-heading p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.scanner-account-stats {
  display: flex;
  gap: 16px;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.scanner-account-stats strong {
  margin-left: 4px;
  color: var(--ink);
  font-size: 16px;
}

.scanner-account-form {
  display: grid;
  grid-template-columns: minmax(180px, 0.7fr) minmax(220px, 1fr) minmax(120px, 0.45fr) auto;
  align-items: end;
  gap: 12px;
}

.scanner-account-form > * {
  min-width: 0;
}

.scanner-account-form .primary-button {
  min-height: 46px;
}

.scanner-account-list,
.scanner-activity-list {
  margin-top: 18px;
  overflow-x: auto;
  border-top: 1px solid var(--line);
}

.scanner-account-table,
.scanner-activity-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.scanner-account-table th,
.scanner-account-table td,
.scanner-activity-table th,
.scanner-activity-table td {
  padding: 9px 8px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}

.scanner-account-table th,
.scanner-activity-table th {
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
}

.scanner-account-actions {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
}

.scanner-type-select {
  min-width: 92px;
  min-height: 34px;
  padding: 6px 28px 6px 9px;
}

.scanner-activity-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 20px;
  color: var(--muted);
  font-size: 11px;
}

.scanner-activity-heading strong {
  color: var(--ink);
  font-size: 12px;
}

.scan-result {
  font-weight: 700;
}

.scan-result.success {
  color: var(--primary-dark);
}

.scan-result.failed {
  color: var(--red);
}

.dialog-icon.neutral {
  color: var(--primary);
  background: var(--primary-soft);
}

.upstream-panel {
  display: grid;
  grid-template-columns: minmax(360px, 0.85fr) minmax(420px, 1.15fr);
  align-items: center;
  gap: 8px 32px;
}

.upstream-heading {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  grid-row: 1;
}

.upstream-settings {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.upstream-provider-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.upstream-provider-option {
  min-width: 0;
  min-height: 48px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 34px;
  align-items: center;
  gap: 8px;
  padding: 6px 7px 6px 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--muted);
  background: var(--surface-soft);
}

.upstream-provider-toggle {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 9px;
  cursor: pointer;
}

.upstream-provider-toggle input {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--primary);
}

.upstream-provider-toggle span {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.upstream-provider-toggle strong {
  color: var(--ink);
  font-size: 12px;
  letter-spacing: 0;
}

.upstream-provider-toggle small {
  font-size: 10px;
  white-space: nowrap;
}

.upstream-provider-toggle small.configured {
  color: var(--primary-dark);
}

.upstream-provider-independent {
  grid-column: 1 / -1;
}

.upstream-provider-static {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 9px;
}

.upstream-provider-static > svg {
  width: 16px;
  height: 16px;
  color: var(--primary);
}

.upstream-provider-static span {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.upstream-provider-static strong {
  color: var(--ink);
  font-size: 12px;
}

.upstream-provider-static small {
  color: var(--muted);
  font-size: 10px;
  white-space: nowrap;
}

.upstream-provider-static small.configured {
  color: var(--primary-dark);
}

.upstream-provider-option.editing {
  border-color: var(--primary);
  background: var(--surface);
  box-shadow: 0 0 0 1px var(--primary-soft);
}

.upstream-provider-edit {
  width: 34px;
  min-height: 34px;
  color: var(--muted);
}

.upstream-provider-option.editing .upstream-provider-edit {
  color: var(--primary);
  background: var(--primary-soft);
}

.upstream-routing-form {
  display: grid;
  gap: 8px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.upstream-routing-heading,
.upstream-route-summary {
  display: flex;
  align-items: center;
  gap: 12px;
}

.upstream-routing-heading {
  justify-content: space-between;
}

.upstream-routing-heading strong {
  font-size: 12px;
  color: var(--ink);
}

.upstream-routing-heading .primary-button {
  min-height: 34px;
}

.upstream-route-row {
  display: grid;
  grid-template-columns: minmax(250px, 0.8fr) minmax(180px, 1.2fr);
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.upstream-route-summary {
  min-width: 0;
  font-size: 11px;
  color: var(--muted);
}

.upstream-route-summary > strong {
  width: 66px;
  color: var(--ink);
  font-size: 11px;
}

.upstream-route-summary span {
  flex: 1;
  white-space: nowrap;
}

.upstream-route-summary b {
  display: inline-block;
  min-width: 34px;
  color: var(--primary-dark);
  font-variant-numeric: tabular-nums;
}

.upstream-route-row input[type="range"] {
  width: 100%;
  margin: 0;
  accent-color: var(--primary);
}

.upstream-route-summary-triple {
  gap: 8px;
}

.upstream-route-summary-triple > strong {
  flex: 0 0 66px;
}

.upstream-route-triple {
  display: grid;
  grid-template-columns: repeat(3, minmax(58px, 1fr)) 48px;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.upstream-route-triple input {
  width: 100%;
  min-width: 0;
  height: 34px;
  padding: 5px 7px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.upstream-route-triple output {
  color: var(--primary-dark);
  font-size: 11px;
  font-weight: 700;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.upstream-route-triple output.invalid {
  color: var(--danger);
}

.upstream-icon {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  color: var(--primary);
  background: var(--primary-soft);
}

.upstream-icon svg {
  width: 21px;
  height: 21px;
}

.upstream-heading h2 {
  margin: 0 0 5px;
  font-size: 18px;
  letter-spacing: 0;
}

.upstream-heading p {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
}

.upstream-cdk-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 46px;
  align-items: end;
  gap: 10px;
}

.upstream-provider-field,
.upstream-url-field {
  grid-column: 1 / -1;
}

.upstream-url-control {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 46px 46px;
  gap: 8px;
}

.upstream-url-control .icon-button {
  width: 46px;
  height: 46px;
}

.upstream-cdk-form > * {
  min-width: 0;
}

.upstream-cdk-form .primary-button,
.upstream-clear {
  min-height: 46px;
}

.upstream-clear {
  width: 46px;
  color: var(--red);
}

.upstream-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  color: var(--muted);
  font-size: 11px;
}

.upstream-meta code {
  color: var(--ink);
  font-family: "Cascadia Code", Consolas, monospace;
  font-size: 12px;
}

.upstream-meta span:last-child {
  margin-left: auto;
}

.cdk-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 18px;
}

.cdk-heading h2 {
  margin: 0 0 6px;
  font-size: 18px;
}

.cdk-heading p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.cdk-stats {
  display: flex;
  gap: 16px;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.cdk-stats strong {
  margin-left: 4px;
  color: var(--ink);
  font-size: 16px;
}

.cdk-form {
  display: grid;
  grid-template-columns: 150px 110px 100px 120px 100px minmax(170px, 1fr) auto;
  align-items: end;
  gap: 12px;
}

.cdk-form > *,
.cdk-form input[type='datetime-local'] {
  min-width: 0;
}

.cdk-form .primary-button {
  min-height: 46px;
}

.cdk-output {
  margin-top: 16px;
  padding: 12px;
  border: 1px solid #b8dfcc;
  border-radius: 6px;
  background: var(--primary-soft);
}

.cdk-output-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  color: var(--primary-dark);
  font-size: 12px;
}

.cdk-output textarea {
  min-height: 130px;
  max-height: 360px;
  resize: vertical;
  color: var(--ink);
  background: var(--surface);
  font-family: ui-monospace, Consolas, monospace;
  font-size: 12px;
}

.cdk-list-toolbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-top: 18px;
}

.cdk-list-filters {
  display: flex;
  align-items: flex-end;
  gap: 10px;
}

.cdk-list-filter select {
  min-width: 180px;
}

.cdk-list-filters .icon-button {
  margin-bottom: 4px;
}

#cdk-filter-result {
  padding-bottom: 12px;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.cdk-list {
  min-height: 180px;
  max-height: min(560px, 65vh);
  margin-top: 18px;
  overflow: auto;
  border-top: 1px solid var(--line);
}

.cdk-purpose-group {
  padding: 14px 0 4px;
}

.cdk-purpose-group + .cdk-purpose-group {
  margin-top: 8px;
  border-top: 1px solid var(--line-strong);
}

.cdk-purpose-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 8px 10px;
}

.cdk-purpose-heading strong { font-size: 13px; }
.cdk-purpose-heading span { color: var(--muted); font-size: 11px; }
.cdk-empty.compact { min-height: 58px; margin: 0; padding: 20px 8px; }

.cdk-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.cdk-table th,
.cdk-table td {
  padding: 9px 8px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}

.cdk-table th {
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
}

.cdk-code-cell code {
  display: inline-block;
  min-width: 230px;
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 12px;
  letter-spacing: 0;
}

.cdk-code-cell .icon-button { margin-left: 8px; }

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

.cdk-status.active { color: var(--primary-dark); }
.cdk-status.used { color: var(--blue); }
.cdk-status.revoked,
.cdk-status.expired { color: var(--red); }

.cdk-empty {
  margin: 14px 0 2px;
  color: var(--muted);
  font-size: 12px;
}

.scan-daily {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.scan-daily-heading {
  display: flex;
  justify-content: space-between;
  margin-bottom: 9px;
  color: var(--muted);
  font-size: 11px;
}

.scan-daily-list {
  display: grid;
  gap: 6px;
}

.scan-daily-row {
  display: grid;
  grid-template-columns: 42px 1fr 44px;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 10px;
}

.scan-daily-track {
  min-height: 8px;
  display: flex;
  gap: 2px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-soft);
}

.scan-daily-track i {
  min-width: 2px;
  display: block;
  min-height: 8px;
}

.scan-daily-success { background: var(--primary); }
.scan-daily-failed { background: var(--red); }

.scan-daily-row strong {
  color: var(--ink);
  font-size: 10px;
  font-weight: 650;
  text-align: right;
}

.scan-console {
  min-height: 100vh;
  background: var(--canvas);
}

.scan-main {
  width: min(1420px, calc(100% - 48px));
  margin: 0 auto;
  padding: 32px 0 46px;
}

.scan-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 28px;
  margin-bottom: 26px;
}

.scan-heading h1 {
  margin: 0;
  font-size: 32px;
}

.scan-heading-title > div,
.scan-detail-title,
.scan-task-identity {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.scan-heading-title .status-badge {
  flex: 0 0 auto;
}

.scan-detail-title h2 {
  margin: 0;
}

.scan-channel-meta {
  max-width: 320px;
  margin: 4px 0 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.scan-channel-meta strong {
  color: #35413c;
  font-weight: 700;
}

.scan-type-label {
  flex: 0 0 auto;
  color: var(--primary-dark);
  font-size: 10px;
  font-weight: 750;
}

.scan-metrics {
  display: flex;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
}

.scan-metrics > div {
  min-width: 100px;
  display: grid;
  gap: 5px;
  padding: 10px 14px;
  border-right: 1px solid var(--line);
}

.scan-metrics > div:last-child { border-right: 0; }
.scan-metrics span { color: var(--muted); font-size: 11px; }
.scan-metrics strong { font-size: 18px; font-variant-numeric: tabular-nums; }
.scan-metric-personal strong { color: var(--primary-dark); }

.scan-presence-panel {
  min-height: 340px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 34px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  text-align: center;
}

.scan-presence-panel .presence-icon {
  width: 56px;
  height: 56px;
  display: grid;
  place-items: center;
  margin-bottom: 16px;
  border-radius: 7px;
  color: var(--amber);
  background: var(--amber-soft);
}

.scan-presence-panel .presence-icon svg { width: 25px; height: 25px; }
.scan-presence-panel h2 { margin: 0 0 8px; font-size: 18px; }
.scan-presence-panel p { max-width: 480px; margin: 0 0 22px; color: var(--muted); font-size: 12px; line-height: 1.6; }

.scan-presence-panel[hidden] { display: none; }
.scan-presence-panel + #scan-online-content { min-width: 0; }

.scan-workspace {
  min-height: calc(100vh - 194px);
  display: grid;
  grid-template-columns: minmax(300px, 0.55fr) minmax(520px, 1fr);
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
}

.scan-auto-dispatch-note {
  min-height: 42px;
  margin-bottom: 16px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 9px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  color: var(--muted);
  background: var(--surface);
  font-size: 12px;
}

.scan-auto-dispatch-note svg {
  color: var(--green);
}

.scan-auto-dispatch-note.paused {
  color: #805f14;
  border-color: #e5ca8b;
  background: var(--amber-soft);
}

.scan-auto-dispatch-note.paused svg {
  color: var(--amber);
}

.scan-queue { border-right: 1px solid var(--line); }

.scan-task-list {
  display: grid;
  align-content: start;
  gap: 1px;
  padding: 8px;
  background: var(--surface-soft);
}

.scan-task-row {
  min-height: 66px;
  display: grid;
  gap: 4px;
  padding: 13px 14px;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--ink);
  background: var(--surface);
  text-align: left;
}

.scan-task-row:hover,
.scan-task-row.selected {
  border-color: #a9c6bb;
  background: var(--primary-soft);
}

.scan-task-row-header { min-width: 0; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.scan-task-row-header > strong { min-width: 0; }
.scan-task-expiry { flex: 0 0 auto; display: inline-flex; align-items: baseline; gap: 5px; color: #945009; font-size: 10px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.scan-task-expiry strong { min-width: 38px; color: currentColor; font-size: 12px; text-align: right; }
.scan-task-expiry.expired { color: var(--red); }
.scan-task-row small { color: var(--muted); font-size: 11px; }

.scan-detail {
  min-width: 0;
  padding: 34px 42px;
}

.scan-qr-frame {
  width: min(420px, 100%);
  aspect-ratio: 1;
  margin: 30px auto 18px;
  display: grid;
  place-items: center;
  padding: 16px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: white;
}

.scan-qr-frame img { width: 100%; height: 100%; object-fit: contain; }
.payment-countdown { width: min(420px, 100%); min-height: 42px; margin: 0 auto 18px; padding: 8px 12px; display: flex; align-items: center; justify-content: center; gap: 9px; border: 1px solid #f0d49d; border-radius: 6px; color: #945009; background: var(--amber-soft); font-size: 12px; text-align: center; }
.payment-countdown svg { width: 16px; height: 16px; }
.payment-countdown span { min-width: 0; overflow-wrap: anywhere; }
.payment-countdown strong { min-width: 48px; font-variant-numeric: tabular-nums; font-size: 17px; }
.payment-countdown.expired { border-color: #f0c4c1; color: #ae3232; background: var(--red-soft); }
.scan-claim-panel { min-height: 460px; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 28px; text-align: center; }
.scan-claim-panel .claim-icon { width: 54px; height: 54px; display: grid; place-items: center; margin-bottom: 16px; border-radius: 7px; color: var(--primary); background: var(--primary-soft); }
.scan-claim-panel .claim-icon svg { width: 24px; height: 24px; }
.scan-claim-panel h3 { margin: 0 0 7px; font-size: 16px; }
.scan-claim-panel p { max-width: 480px; margin: 0 0 24px; color: var(--muted); font-size: 12px; line-height: 1.6; }
.scan-dismiss-panel { min-height: 460px; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 28px; text-align: center; }
.scan-dismiss-panel .dismiss-icon { width: 54px; height: 54px; display: grid; place-items: center; margin-bottom: 16px; border-radius: 7px; color: var(--red); background: var(--red-soft); }
.scan-dismiss-panel.success .dismiss-icon { color: var(--primary); background: var(--primary-soft); }
.scan-dismiss-panel .dismiss-icon svg { width: 24px; height: 24px; }
.scan-dismiss-panel h3 { margin: 0 0 7px; font-size: 16px; }
.scan-dismiss-panel p { max-width: 500px; margin: 0 0 24px; color: var(--muted); font-size: 12px; line-height: 1.6; }
.scan-generating-panel { min-height: 460px; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 28px; text-align: center; }
.scan-generating-panel .generating-icon { width: 54px; height: 54px; display: grid; place-items: center; margin-bottom: 16px; border-radius: 7px; color: var(--blue); background: var(--blue-soft); }
.scan-generating-panel .generating-icon svg { width: 24px; height: 24px; animation: spin 1s linear infinite; }
.scan-generating-panel h3 { margin: 0 0 7px; font-size: 16px; }
.scan-generating-panel p { max-width: 500px; margin: 0; color: var(--muted); font-size: 12px; line-height: 1.6; }
.scan-link-row { display: flex; align-items: center; justify-content: center; gap: 8px; max-width: min(620px, 100%); margin: 0 auto 22px; }
.scan-detail-link { min-width: 0; overflow: hidden; color: var(--primary-dark); font-size: 12px; text-align: center; text-overflow: ellipsis; text-decoration: underline; white-space: nowrap; }
.scan-detail-link.placeholder { color: var(--muted); text-decoration: none; }
.scan-ideal-completion { display: grid; gap: 7px; width: min(620px, 100%); margin: 0 auto 22px; }
.scan-ideal-completion[hidden] { display: none; }
.scan-ideal-completion > span { color: var(--muted); font-size: 11px; font-weight: 700; }
.scan-ideal-completion input { padding-right: 13px; font-size: 12px; }
.scan-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; }

@media (max-width: 900px) {
  .scan-heading { display: grid; align-items: start; }
  .scan-metrics { width: 100%; }
  .scan-metrics > div { min-width: 0; flex: 1; }
  .scan-workspace { grid-template-columns: 1fr; }
  .scan-queue { border-right: 0; border-bottom: 1px solid var(--line); }
  .scan-task-list { max-height: 330px; overflow: auto; }
}

@media (max-width: 560px) {
  .scan-main { width: calc(100% - 28px); padding-top: 22px; }
  .scan-heading h1 { font-size: 27px; }
  .scan-metrics > div { padding: 9px 8px; }
  .scan-metrics strong { font-size: 16px; }
  .scan-detail { padding: 24px 18px; }
  .scan-detail .detail-topline { display: grid; }
  .scan-detail .detail-topline .status-badge { max-width: 100%; justify-self: start; text-align: left; white-space: normal; }
  .scan-actions { display: grid; }
}

.section-heading p {
  max-width: 520px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.75;
}

.submission-form,
.login-panel {
  display: grid;
  gap: 22px;
}

.field {
  display: grid;
  gap: 8px;
}

.field label {
  color: #394440;
  font-size: 13px;
  font-weight: 650;
}

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

.label-row span {
  color: #89928e;
  font-size: 11px;
}

.text-button {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 0;
  padding: 3px 0;
  color: var(--primary-dark);
  background: transparent;
  font: inherit;
  font-size: 11px;
  cursor: pointer;
}

.text-button:hover:not(:disabled) {
  color: var(--primary);
}

.text-button:disabled {
  cursor: wait;
  opacity: 0.55;
}

.file-input-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

.plan-result {
  margin-top: 8px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: #53635c;
  background: #f7faf8;
  font-size: 12px;
  white-space: pre-line;
}

.plan-result.plus {
  border-color: #b8dfcc;
  color: #126343;
  background: #effaf4;
}

.plan-result.free,
.plan-result.error {
  border-color: #e8c2b9;
  color: #9a3f2e;
  background: #fff7f4;
}

.field-hint {
  margin: 6px 0 0;
  color: #89928e;
  font-size: 11px;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  color: var(--ink);
  background: var(--surface);
  outline: none;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

input {
  height: 46px;
  padding: 0 45px 0 13px;
}

select {
  height: 46px;
  padding: 0 36px 0 13px;
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, #6f7a75 50%),
    linear-gradient(135deg, #6f7a75 50%, transparent 50%);
  background-position:
    calc(100% - 17px) 19px,
    calc(100% - 12px) 19px;
  background-repeat: no-repeat;
  background-size: 5px 5px, 5px 5px;
}

textarea {
  min-height: 86px;
  padding: 12px 44px 12px 13px;
  line-height: 1.5;
  resize: vertical;
}

textarea.concealed {
  -webkit-text-security: disc;
}

input::placeholder,
textarea::placeholder {
  color: #a4aba8;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(8, 127, 91, 0.1);
}

.input-with-action,
.textarea-with-action,
.input-with-icon {
  position: relative;
}

.input-with-icon > svg {
  position: absolute;
  top: 14px;
  left: 14px;
  z-index: 1;
  color: #7a8580;
}

.input-with-icon input {
  padding-left: 42px;
}

.icon-button {
  width: 38px;
  height: 38px;
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: #5d6864;
  background: var(--surface);
  transition: color 150ms ease, border-color 150ms ease, background 150ms ease;
}

.icon-button:hover {
  color: var(--primary);
  border-color: #a9c6bb;
  background: var(--primary-soft);
}

.field-action {
  position: absolute;
  top: 4px;
  right: 4px;
  border-color: transparent;
  background: transparent;
}

.textarea-action {
  top: 5px;
}

.advanced-fields {
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.advanced-fields summary {
  min-height: 50px;
  display: grid;
  grid-template-columns: 20px 1fr auto;
  align-items: center;
  gap: 9px;
  color: #44504b;
  font-size: 13px;
  cursor: pointer;
  list-style: none;
}

.advanced-fields summary::-webkit-details-marker {
  display: none;
}

.advanced-fields summary small {
  color: #909995;
  font-size: 11px;
}

.advanced-content {
  display: grid;
  gap: 18px;
  padding: 5px 0 22px;
}

.primary-button,
.secondary-button {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 0 18px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  transition: background 150ms ease, border-color 150ms ease, transform 150ms ease;
}

.primary-button {
  border: 1px solid var(--primary);
  color: white;
  background: var(--primary);
  box-shadow: 0 7px 18px rgba(8, 127, 91, 0.16);
}

.primary-button:hover:not(:disabled) {
  border-color: var(--primary-dark);
  background: var(--primary-dark);
}

.primary-button.danger-button {
  border-color: var(--red);
  background: var(--red);
  box-shadow: 0 7px 18px rgba(194, 59, 59, 0.14);
}

.primary-button.danger-button:hover:not(:disabled) {
  border-color: #a82f2f;
  background: #a82f2f;
}

.primary-button:active:not(:disabled),
.secondary-button:active:not(:disabled) {
  transform: translateY(1px);
}

.secondary-button {
  border: 1px solid var(--line-strong);
  color: #3c4843;
  background: var(--surface);
}

.secondary-button:hover:not(:disabled) {
  border-color: #aebbb5;
  background: #f9fbfa;
}

.danger-text {
  color: var(--red);
}

.submit-button {
  width: 100%;
}

.loading svg,
.status-icon.running svg,
.processing-icon svg {
  animation: spin 1s linear infinite;
}

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

.form-message {
  padding: 11px 13px;
  border-radius: 6px;
  font-size: 12px;
  line-height: 1.5;
}

.error-message {
  color: #a52d2d;
  border: 1px solid #f0c4c1;
  background: var(--red-soft);
}

.preflight-message {
  max-height: 220px;
  overflow: auto;
  color: #684b08;
  border: 1px solid #e7ce88;
  background: #fff8df;
  white-space: pre-line;
  overflow-wrap: anywhere;
}

.status-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--line);
}

.status-header h2,
.panel-toolbar h2 {
  margin-bottom: 0;
  font-size: 18px;
  line-height: 1.3;
  letter-spacing: 0;
}

.status-badge {
  min-height: 25px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 3px 9px;
  border: 1px solid transparent;
  border-radius: 999px;
  white-space: nowrap;
  font-size: 11px;
  font-weight: 700;
}

.status-badge.idle,
.status-badge.stopped {
  color: #6b7471;
  border-color: #d6ddda;
  background: #f0f3f2;
}

.status-badge.running {
  color: #2458b8;
  border-color: #c8d9fb;
  background: var(--blue-soft);
}

.status-badge.waiting {
  color: #945009;
  border-color: #f0d49d;
  background: var(--amber-soft);
}

.status-badge.success {
  color: #08704f;
  border-color: #bbe2d2;
  background: var(--primary-soft);
}

.status-badge.failed {
  color: #ae3232;
  border-color: #f0c4c1;
  background: var(--red-soft);
}

.empty-status,
.detail-empty,
.queue-empty {
  min-height: 340px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: var(--muted);
}

.empty-icon,
.detail-empty > span,
.queue-empty > span {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  margin-bottom: 16px;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: #82908a;
  background: var(--surface);
}

.empty-icon svg,
.detail-empty > span svg,
.queue-empty > span svg {
  width: 22px;
  height: 22px;
}

.empty-status strong,
.queue-empty strong {
  margin-bottom: 7px;
  color: #45514c;
  font-size: 14px;
}

.empty-status p,
.detail-empty p,
.queue-empty p {
  margin: 0;
  font-size: 12px;
}

.active-status {
  padding-top: 26px;
}

.reference-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  color: var(--muted);
  font-size: 12px;
}

.reference-row code {
  color: #33403b;
  font-family: "Cascadia Code", Consolas, monospace;
  font-size: 12px;
}

.status-visual {
  display: grid;
  grid-template-columns: 52px 1fr;
  align-items: center;
  gap: 16px;
  margin-top: 30px;
}

.status-icon {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  border-radius: 7px;
}

.status-icon svg {
  width: 24px;
  height: 24px;
}

.status-icon.running {
  color: var(--blue);
  background: var(--blue-soft);
}

.status-icon.waiting {
  color: var(--amber);
  background: var(--amber-soft);
}

.status-icon.success {
  color: var(--primary);
  background: var(--primary-soft);
}

.status-icon.failed {
  color: var(--red);
  background: var(--red-soft);
}

.status-icon.stopped {
  color: #68716e;
  background: #e9edeb;
}

.status-visual h3 {
  margin-bottom: 5px;
  font-size: 16px;
  line-height: 1.4;
  letter-spacing: 0;
}

.status-visual p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.progress-wrap {
  margin-top: 28px;
}

.progress-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 9px;
  color: var(--muted);
  font-size: 11px;
}

.progress-track {
  height: 5px;
  overflow: hidden;
  border-radius: 3px;
  background: #dfe6e2;
}

.progress-track span {
  display: block;
  width: 12%;
  height: 100%;
  border-radius: inherit;
  background: var(--blue);
  transition: width 350ms ease;
}

.timeline {
  display: grid;
  grid-template-columns: auto 1fr auto 1fr auto 1fr auto;
  align-items: start;
  margin-top: 38px;
}

.timeline-step {
  width: 42px;
  display: grid;
  justify-items: center;
  gap: 7px;
  color: #98a19e;
}

.timeline-step span {
  width: 27px;
  height: 27px;
  display: grid;
  place-items: center;
  border: 1px solid #cfd7d3;
  border-radius: 50%;
  background: var(--surface-soft);
}

.timeline-step svg {
  width: 13px;
  height: 13px;
}

.timeline-step b {
  white-space: nowrap;
  font-size: 10px;
  font-weight: 650;
}

.timeline-step.done,
.timeline-step.current {
  color: var(--primary);
}

.timeline-step.done span {
  color: white;
  border-color: var(--primary);
  background: var(--primary);
}

.timeline-step.current span {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(8, 127, 91, 0.1);
}

.timeline-step.failed {
  color: var(--red);
}

.timeline-step.failed span {
  border-color: var(--red);
  box-shadow: 0 0 0 4px rgba(194, 59, 59, 0.1);
}

.timeline-line {
  height: 1px;
  margin-top: 13px;
  background: #cfd7d3;
}

.timeline-line.done {
  background: var(--primary);
}

.status-actions,
.detail-actions {
  display: flex;
  gap: 10px;
  margin-top: 34px;
}

.status-actions > *,
.detail-actions > * {
  flex: 1;
}

.site-footer {
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  width: min(1160px, calc(100% - 40px));
  margin: 0 auto;
  color: #7a8580;
  font-size: 11px;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 50;
  max-width: min(360px, calc(100vw - 48px));
  padding: 12px 16px;
  border: 1px solid #27332e;
  border-radius: 6px;
  color: white;
  background: #202a26;
  box-shadow: var(--shadow);
  font-size: 12px;
}

/* Operator console */
.login-view {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: #e9eeeb;
}

.login-panel {
  width: min(420px, 100%);
  padding: 38px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.login-brand {
  margin-bottom: 18px;
}

.login-heading {
  margin: 16px 0 4px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

.login-heading h1 {
  margin: 0;
  font-size: 24px;
  letter-spacing: 0;
}

.admin-topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  padding-inline: clamp(18px, 3vw, 44px);
}

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

.operator-label {
  margin-right: 10px;
}

.admin-main {
  width: min(1480px, calc(100% - 48px));
  margin: 0 auto;
  padding: 32px 0 46px;
}

.admin-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 32px;
  margin-bottom: 26px;
}

.admin-heading h1 {
  margin: 0;
}

.metrics {
  display: flex;
  align-items: stretch;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
}

.metrics > div {
  min-width: 100px;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 18px;
  padding: 10px 14px;
  border-right: 1px solid var(--line);
}

.metrics > div:last-child {
  border-right: 0;
}

.metrics span {
  color: var(--muted);
  font-size: 11px;
}

.metrics strong {
  font-size: 18px;
  font-variant-numeric: tabular-nums;
}

.admin-workspace {
  min-height: calc(100vh - 194px);
  display: grid;
  grid-template-columns: minmax(400px, 0.85fr) minmax(520px, 1.15fr);
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 10px 32px rgba(35, 53, 45, 0.05);
}

.queue-panel {
  border-right: 1px solid var(--line);
}

.panel-toolbar {
  min-height: 65px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 0 20px;
  border-bottom: 1px solid var(--line);
}

.panel-toolbar h2 {
  font-size: 15px;
}

.segmented-control {
  display: inline-flex;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-soft);
}

.segmented-control button {
  min-width: 52px;
  height: 29px;
  padding: 0 10px;
  border: 0;
  border-radius: 4px;
  color: var(--muted);
  background: transparent;
  font-size: 11px;
  font-weight: 650;
}

.segmented-control button.active {
  color: var(--ink);
  background: var(--surface);
  box-shadow: 0 1px 4px rgba(28, 45, 37, 0.1);
}

.platform-type-switch {
  flex: 0 0 auto;
}

.platform-type-switch button {
  min-width: 48px;
  white-space: nowrap;
}

.type-mode-switch {
  width: fit-content;
}

.type-mode-switch button {
  min-width: 92px;
}

.payment-type-field {
  padding-bottom: 2px;
}

.task-list {
  max-height: calc(100vh - 260px);
  overflow: auto;
}

.task-row {
  width: 100%;
  min-height: 78px;
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 12px 17px;
  border: 0;
  border-bottom: 1px solid #e8ecea;
  text-align: left;
  color: var(--ink);
  background: var(--surface);
  transition: background 120ms ease, box-shadow 120ms ease;
}

.task-row:hover {
  background: #f8faf9;
}

.task-row.selected {
  background: #f0f8f5;
  box-shadow: inset 3px 0 var(--primary);
}

.task-row-icon {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 6px;
}

.task-row-icon.running {
  color: var(--blue);
  background: var(--blue-soft);
}

.task-row-icon.waiting {
  color: var(--amber);
  background: var(--amber-soft);
}

.task-row-icon.success {
  color: var(--primary);
  background: var(--primary-soft);
}

.task-row-icon.failed {
  color: var(--red);
  background: var(--red-soft);
}

.task-row-icon.stopped {
  color: #68716e;
  background: #edf0ef;
}

.task-row-body {
  min-width: 0;
  display: grid;
  gap: 6px;
}

.task-row-body strong {
  font-family: "Cascadia Code", Consolas, monospace;
  font-size: 12px;
}

.task-row-body small {
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.task-row-side {
  display: flex;
  align-items: center;
  gap: 8px;
}

.task-row-side > svg {
  width: 15px;
  height: 15px;
  color: #9ca5a1;
}

.queue-empty {
  min-height: 380px;
}

.detail-panel {
  min-width: 0;
  padding: 32px clamp(28px, 4vw, 58px);
  background: #fbfcfb;
}

.detail-empty {
  min-height: 100%;
}

.detail-empty h2 {
  margin-bottom: 8px;
  color: #46524d;
  font-size: 16px;
  letter-spacing: 0;
}

.task-detail {
  max-width: 640px;
  margin: 0 auto;
}

.detail-topline {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.detail-topline h2 {
  margin: 0;
  font-family: "Cascadia Code", Consolas, monospace;
  font-size: 18px;
  letter-spacing: 0;
}

.qr-section {
  display: grid;
  justify-items: center;
  padding: 28px 0 20px;
}

.qr-frame {
  position: relative;
  width: min(265px, 100%);
  aspect-ratio: 1;
  padding: 15px;
  background: white;
}

.qr-frame img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.qr-corner {
  position: absolute;
  width: 24px;
  height: 24px;
  border-color: var(--primary);
  border-style: solid;
}

.qr-corner.top-left {
  top: 0;
  left: 0;
  border-width: 2px 0 0 2px;
}

.qr-corner.top-right {
  top: 0;
  right: 0;
  border-width: 2px 2px 0 0;
}

.qr-corner.bottom-left {
  bottom: 0;
  left: 0;
  border-width: 0 0 2px 2px;
}

.qr-corner.bottom-right {
  right: 0;
  bottom: 0;
  border-width: 0 2px 2px 0;
}

.qr-section p {
  margin: 13px 0 0;
  color: var(--muted);
  font-size: 11px;
}

.processing-section {
  min-height: 255px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.processing-icon {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  margin-bottom: 15px;
  border-radius: 7px;
  color: var(--blue);
  background: var(--blue-soft);
}

.processing-icon svg {
  width: 24px;
  height: 24px;
}

.processing-section h3 {
  margin-bottom: 6px;
  font-size: 15px;
}

.processing-section p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.detail-list {
  margin: 0;
  border-top: 1px solid var(--line);
}

.detail-list > div {
  min-height: 44px;
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  align-items: center;
  gap: 16px;
  border-bottom: 1px solid var(--line);
}

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

.detail-list dd {
  min-width: 0;
  margin: 0;
  overflow: hidden;
  color: #35413c;
  font-family: "Cascadia Code", Consolas, monospace;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.link-value {
  display: flex;
  align-items: center;
  gap: 7px;
}

.link-value span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.icon-button.compact {
  width: 30px;
  height: 30px;
}

.icon-button.compact svg {
  width: 14px;
  height: 14px;
}

.detail-error {
  display: grid;
  grid-template-columns: 18px 1fr;
  gap: 9px;
  margin-top: 18px;
  padding: 12px;
  border: 1px solid #efc6c3;
  border-radius: 6px;
  color: #a93030;
  background: var(--red-soft);
  font-size: 12px;
  line-height: 1.5;
}

.failure-dialog {
  width: min(430px, calc(100% - 32px));
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  color: var(--ink);
  background: var(--surface);
  box-shadow: 0 24px 70px rgba(21, 34, 28, 0.22);
}

.failure-dialog::backdrop {
  background: rgba(23, 32, 29, 0.46);
}

.failure-dialog form {
  display: grid;
  gap: 24px;
  padding: 28px;
}

.dialog-heading {
  display: grid;
  grid-template-columns: 46px 1fr;
  align-items: center;
  gap: 14px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
}

.dialog-icon {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  color: var(--red);
  background: var(--red-soft);
}

.dialog-icon svg {
  width: 22px;
  height: 22px;
}

.dialog-heading .eyebrow {
  color: var(--red);
}

.dialog-heading h2 {
  margin: 0;
  font-size: 18px;
  letter-spacing: 0;
}

.dialog-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

@media (max-width: 980px) {
  .customer-shell {
    grid-template-columns: 1fr;
  }

  .link-submit-shell {
    grid-template-columns: 1fr;
  }

  .submit-section {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .link-form-section {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .admin-workspace {
    grid-template-columns: minmax(330px, 0.85fr) minmax(430px, 1.15fr);
    overflow-x: auto;
  }

  .metrics > div {
    min-width: 88px;
    gap: 10px;
  }
}

@media (max-width: 720px) {
  .topbar {
    height: 64px;
    padding-inline: 16px;
  }

  .admin-topbar {
    height: auto;
    min-height: 112px;
    padding-block: 8px;
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .admin-topbar .brand {
    justify-self: start;
  }

  .admin-topbar .topbar-actions {
    width: 100%;
    min-width: 0;
    display: grid;
    grid-template-columns: repeat(4, 38px);
    justify-content: space-between;
    gap: 6px;
  }

  .admin-topbar .topbar-command,
  .admin-topbar .icon-button {
    flex: 0 0 38px;
  }

  .admin-topbar .platform-type-switch {
    grid-column: 1 / -1;
    grid-row: 1;
    width: 100%;
    min-width: 0;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .admin-topbar .topbar-actions > .topbar-command:first-child {
    grid-column: 1;
    grid-row: 2;
  }

  .admin-topbar #toggle-submissions {
    grid-column: 2;
    grid-row: 2;
  }

  .admin-topbar #refresh-button {
    grid-column: 3;
    grid-row: 2;
  }

  .admin-topbar #logout-button {
    grid-column: 4;
    grid-row: 2;
  }

  .admin-topbar .platform-type-switch button {
    min-width: 0;
    padding-inline: 6px;
  }

  .customer-shell,
  .link-submit-shell,
  .site-footer {
    width: 100%;
    border-inline: 0;
  }

  .submit-section,
  .status-section,
  .link-form-section,
  .link-status-section {
    padding: 34px 20px 40px;
  }

  .section-heading {
    margin-bottom: 28px;
  }

  .customer-live-summary { gap: 10px 18px; }

  .section-heading h1,
  .admin-heading h1 {
    font-size: 27px;
  }

  .status-section {
    min-height: 470px;
  }

  .site-footer {
    padding: 0 20px;
  }

  .operator-label {
    display: none;
  }

  .topbar-command {
    width: 38px;
    padding: 0;
  }

  .topbar-command span {
    display: none;
  }

  .admin-main {
    width: 100%;
    padding: 24px 16px 32px;
  }

  .admin-heading {
    display: grid;
    align-items: start;
  }

  .cdk-heading {
    display: grid;
    gap: 12px;
  }

  .cdk-list-toolbar,
  .cdk-list-filters {
    width: 100%;
    align-items: stretch;
  }

  .cdk-list-toolbar {
    flex-wrap: wrap;
  }

  .cdk-list-filters {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr)) auto;
  }

  .cdk-list-filter select {
    width: 100%;
    min-width: 0;
  }

  .cdk-list-filters .icon-button {
    align-self: end;
    margin-bottom: 4px;
  }

  #cdk-filter-result {
    width: 100%;
    padding-bottom: 0;
  }

  .scanner-management-heading {
    display: grid;
    gap: 12px;
  }

  .access-token-heading {
    display: grid;
    gap: 12px;
  }

  .payment-records-heading {
    display: grid;
    gap: 12px;
  }

  .access-token-stats {
    justify-content: flex-start;
  }

  .payment-records-stats {
    width: 100%;
    justify-content: flex-start;
  }

  .payment-records-toolbar {
    grid-template-columns: 1fr;
  }

  .payment-record-search {
    width: 100%;
  }

  .payment-record-toolbar-actions {
    justify-content: flex-end;
  }

  .payment-record-pagination {
    margin-left: auto;
  }

  .payment-record-outcome-filter select,
  .payment-record-source-filter select {
    width: 100%;
  }

  .payment-records-panel {
    padding: 18px 14px;
  }

  .payment-record-list {
    max-height: 560px;
    overflow-x: hidden;
    border: 0;
    border-radius: 0;
  }

  .payment-record-table {
    min-width: 0;
    display: block;
  }

  .payment-record-table thead {
    display: none;
  }

  .payment-record-table tbody {
    display: grid;
    gap: 9px;
  }

  .payment-record-table tr {
    display: grid;
    grid-template-columns: 100px minmax(0, 1fr) 32px;
    gap: 10px 12px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--surface);
  }

  .payment-record-table td {
    min-width: 0;
    padding: 0;
    border-bottom: 0;
  }

  .payment-record-table td:nth-child(1) { grid-column: 1; grid-row: 1; }
  .payment-record-table td:nth-child(2) { grid-column: 2; grid-row: 1; }
  .payment-record-table td:nth-child(3) { grid-column: 1 / -1; grid-row: 2; }
  .payment-record-table td:nth-child(4) { grid-column: 1; grid-row: 3; }
  .payment-record-table td:nth-child(5) { grid-column: 2 / -1; grid-row: 3; }
  .payment-record-table td:nth-child(6) { grid-column: 1 / -1; grid-row: 4; }
  .payment-record-table td:nth-child(7) { grid-column: 3; grid-row: 1; }

  .payment-record-table td[data-label]::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 4px;
    color: var(--muted);
    font-size: 9px;
    font-weight: 650;
  }

  .payment-record-row:hover td {
    background: transparent;
  }

  .access-token-import-form {
    grid-template-columns: 1fr;
  }

  .auto-dispatch-form {
    grid-template-columns: 1fr;
  }

  .auto-dispatch-targets {
    grid-template-columns: 1fr;
  }

  .auto-dispatch-form .primary-button,
  .toggle-field {
    width: 100%;
  }

  .access-token-list-toolbar {
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .access-token-list-toolbar > span {
    min-width: 0;
    margin-left: auto;
  }

  .scanner-account-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .scanner-account-form .primary-button {
    grid-column: 1 / -1;
  }

  .upstream-panel {
    grid-template-columns: 1fr;
  }

  .upstream-heading {
    grid-row: auto;
    grid-template-columns: 46px minmax(0, 1fr);
  }

  .upstream-heading .status-badge {
    grid-column: 2;
    justify-self: start;
  }

  .upstream-cdk-form {
    grid-template-columns: minmax(0, 1fr) 46px;
    margin-top: 12px;
  }

  .upstream-provider-list {
    grid-template-columns: 1fr;
  }

  .upstream-route-row {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .upstream-route-summary-triple {
    flex-wrap: wrap;
  }

  .upstream-route-summary-triple > strong {
    flex-basis: 100%;
  }

  .upstream-cdk-form .field {
    grid-column: 1 / -1;
  }

  .upstream-meta {
    margin-top: 4px;
  }

  .scan-heading { align-items: stretch; flex-direction: column; }
  .scan-metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .scan-metrics > div { min-width: 0; }
  .scan-metrics > div:nth-child(3) { border-right: 0; }
  .scan-metrics > div:nth-child(-n + 3) { border-bottom: 1px solid var(--line); }

  .cdk-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .cdk-form .primary-button {
    grid-column: 1 / -1;
  }

  .cdk-list { max-height: min(480px, 62vh); }

  .metrics {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .metrics > div {
    min-width: 0;
    grid-template-columns: 1fr;
    gap: 5px;
  }

  .metrics > div:nth-child(3n) { border-right: 0; }
  .metrics > div:nth-child(-n + 3) { border-bottom: 1px solid var(--line); }

  .admin-workspace {
    min-height: 0;
    grid-template-columns: 1fr;
    overflow: visible;
  }

  .queue-panel {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .task-list {
    max-height: 390px;
  }

  .detail-panel {
    min-height: 540px;
    padding: 28px 20px;
  }

  .detail-empty {
    min-height: 450px;
  }
}

@media (max-width: 430px) {
  .cdk-list-filters {
    grid-template-columns: 1fr;
  }

  .cdk-list-filters .icon-button {
    justify-self: end;
  }

  .topbar-status {
    font-size: 11px;
  }

  .login-panel {
    padding: 28px 20px;
  }

  .timeline-step {
    width: 36px;
  }

  .timeline-step b {
    font-size: 9px;
  }

  .status-actions,
  .detail-actions {
    flex-direction: column;
  }

  .panel-toolbar {
    padding-inline: 14px;
  }

  .task-row {
    grid-template-columns: 36px minmax(0, 1fr);
  }

  .link-task-row {
    grid-template-columns: 36px minmax(0, 1fr);
  }

  .link-task-side {
    grid-column: 2;
    justify-content: space-between;
  }

  .task-row-side {
    grid-column: 2;
    justify-content: space-between;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Mailbox */
.mail-page {
  background: var(--canvas);
}

.mail-main {
  width: min(1280px, calc(100% - 40px));
  margin: 0 auto;
  padding: 42px 0 56px;
}

.mail-heading,
.mail-toolbar,
.mail-list-heading,
.mail-pagination,
.mail-reader-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.mail-heading {
  align-items: flex-start;
  margin-bottom: 28px;
}

.mail-heading h1 {
  margin: 8px 0 8px;
  font-size: clamp(28px, 4vw, 40px);
  line-height: 1.12;
  letter-spacing: 0;
}

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

.mail-config-message {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  margin-bottom: 20px;
  padding: 14px 16px;
  border: 1px solid #f0d49d;
  border-radius: var(--radius);
  color: #70410d;
  background: var(--amber-soft);
}

.mail-import-panel {
  margin-bottom: 20px;
  padding: 22px 24px 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.mail-import-heading {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 20px;
}

.mail-import-heading h2 {
  margin: 6px 0 4px;
  font-size: 18px;
}

.mail-import-heading p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.mail-import-form {
  display: grid;
  gap: 16px;
}

.mail-import-form .field {
  max-width: 720px;
}

.mail-import-form textarea,
.mail-import-form input {
  width: 100%;
}

.mail-import-form .advanced-fields {
  max-width: 720px;
}

.mail-import-form .primary-button {
  justify-self: start;
}

.mail-config-message p {
  margin: 4px 0 0;
  color: #8b5a1a;
  font-size: 12px;
}

.mail-config-icon {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  color: #9a5a0b;
  background: #ffeac1;
}

.mail-toolbar {
  justify-content: flex-start;
  flex-wrap: wrap;
  margin-bottom: 16px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.mail-folder-field {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
}

.mail-folder-field select {
  min-height: 38px;
  padding: 0 30px 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  color: var(--ink);
  background: var(--surface);
}

.mail-search {
  min-width: min(360px, 100%);
  min-height: 38px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  padding-left: 10px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  color: var(--muted);
  background: var(--surface);
}

.mail-search input {
  min-width: 0;
  flex: 1;
  border: 0;
  outline: 0;
  color: var(--ink);
  background: transparent;
  font-size: 13px;
}

.mail-layout {
  min-height: 650px;
  display: grid;
  grid-template-columns: minmax(340px, 0.85fr) minmax(0, 1.35fr);
  gap: 16px;
}

.mail-list-panel,
.mail-reader {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.mail-list-panel {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.mail-list-heading {
  align-items: flex-start;
  padding: 22px 20px 18px;
  border-bottom: 1px solid var(--line);
}

.mail-list-heading h2 {
  margin: 6px 0 0;
  font-size: 18px;
}

.mail-list-count {
  color: var(--muted);
  font-size: 12px;
}

.mail-list {
  min-height: 0;
  flex: 1;
}

.mail-row {
  width: 100%;
  min-height: 96px;
  display: grid;
  grid-template-columns: 9px minmax(0, 1fr) 22px;
  gap: 11px;
  align-items: start;
  padding: 14px 18px;
  border: 0;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  text-align: left;
  background: var(--surface);
  transition: background 120ms ease;
}

.mail-row:hover,
.mail-row.selected {
  background: #f4f8f6;
}

.mail-row-marker {
  width: 7px;
  height: 7px;
  margin-top: 6px;
  border-radius: 50%;
  background: transparent;
}

.mail-row.unread .mail-row-marker {
  background: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

.mail-row-content,
.mail-row-top {
  min-width: 0;
  display: flex;
}

.mail-row-content {
  flex-direction: column;
  gap: 4px;
}

.mail-row-top {
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.mail-row-top strong,
.mail-row-subject,
.mail-row-preview {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mail-row-top strong {
  font-size: 12px;
}

.mail-row-top time {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 11px;
}

.mail-row-subject {
  font-size: 13px;
  font-weight: 700;
}

.mail-row-preview {
  color: var(--muted);
  font-size: 11px;
}

.mail-row-tags {
  display: flex;
  justify-content: flex-end;
  color: var(--muted);
}

.mail-row-tags svg {
  width: 15px;
  height: 15px;
}

.mail-list-empty,
.mail-reader-empty {
  min-height: 260px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 28px;
  color: var(--muted);
  text-align: center;
  font-size: 12px;
}

.mail-list-empty svg {
  width: 25px;
  height: 25px;
}

.mail-list-empty.error {
  color: var(--red);
}

.mail-pagination {
  min-height: 54px;
  justify-content: center;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
}

.mail-reader {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.mail-reader-empty {
  min-height: 100%;
  flex: 1;
}

.mail-reader-empty > svg {
  width: 30px;
  height: 30px;
  color: var(--primary);
}

.mail-reader-empty p {
  margin: 0;
}

.mail-reader-header {
  align-items: flex-start;
  padding: 24px 26px 18px;
  border-bottom: 1px solid var(--line);
}

.mail-reader-header h2 {
  min-width: 0;
  margin: 7px 0 0;
  font-size: 21px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.mail-reader-actions {
  flex: 0 0 auto;
}

.mail-meta {
  display: grid;
  gap: 8px;
  padding: 16px 26px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-soft);
}

.mail-meta-row {
  display: grid;
  grid-template-columns: 68px minmax(0, 1fr);
  gap: 12px;
  color: var(--muted);
  font-size: 12px;
}

.mail-meta-row strong {
  min-width: 0;
  color: var(--ink);
  font-weight: 500;
  overflow-wrap: anywhere;
}

.mail-body {
  min-height: 0;
  flex: 1;
  margin: 0;
  padding: 26px;
  color: #25312d;
  font: 13px/1.75 Inter, "Segoe UI", "Microsoft YaHei", system-ui, sans-serif;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  overflow: auto;
}

.mail-reader.is-loading .mail-reader-empty svg {
  animation: mail-spin 900ms linear infinite;
}

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

@media (max-width: 900px) {
  .mail-layout {
    grid-template-columns: 1fr;
  }

  .mail-list-panel {
    min-height: 480px;
  }

  .mail-reader {
    min-height: 520px;
  }
}

@media (max-width: 720px) {
  .mail-main {
    width: 100%;
    padding: 28px 16px 40px;
  }

  .mail-heading {
    display: grid;
    gap: 12px;
  }

  .mail-heading h1 {
    font-size: 29px;
  }

  .mail-config-message {
    grid-template-columns: 38px minmax(0, 1fr);
  }

  .mail-config-message .secondary-button {
    grid-column: 1 / -1;
    justify-self: start;
  }

  .mail-toolbar {
    align-items: stretch;
  }

  .mail-folder-field,
  .mail-search,
  .mail-toolbar > .secondary-button {
    width: 100%;
  }

  .mail-folder-field {
    justify-content: space-between;
  }

  .mail-folder-field select {
    flex: 1;
  }

  .mail-reader-header,
  .mail-meta,
  .mail-body {
    padding-inline: 18px;
  }
}

.account-page {
  min-height: 100vh;
  background: #f2f5f3;
}

.account-delivery-shell {
  width: min(1180px, calc(100% - 48px));
  margin: 0 auto;
  padding: 48px 0 64px;
  display: grid;
  grid-template-columns: minmax(320px, 0.8fr) minmax(0, 1.2fr);
  gap: 24px;
  align-items: start;
}

.account-redeem-section,
.account-delivery-result {
  min-width: 0;
  padding: 28px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface);
}

.account-redeem-section .section-heading h1 {
  margin-bottom: 0;
  font-size: 25px;
}

.account-redeem-form {
  display: grid;
  gap: 18px;
  margin-top: 32px;
}

.account-redeem-form .primary-button {
  min-height: 48px;
}

.account-format-control {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  width: 100%;
}

.account-format-control button {
  height: 40px;
  font-size: 12px;
}

.account-redeem-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 10px;
}

.account-redeem-actions .primary-button,
.account-redeem-actions .secondary-button {
  width: 100%;
  min-height: 48px;
}

.account-redeem-form .password-field {
  position: relative;
}

.account-redeem-form .password-field input,
.account-redeem-form .password-field textarea {
  width: 100%;
  padding-right: 48px;
}

.account-redeem-form .password-field textarea {
  min-height: 116px;
  resize: vertical;
  font-family: "Cascadia Code", Consolas, monospace;
  line-height: 1.5;
}

.account-redeem-form .password-field .field-action {
  top: 8px;
  transform: none;
}

.masked-cdk-input {
  -webkit-text-security: disc;
}

.account-redeem-section .form-error {
  white-space: pre-line;
}

.account-delivery-result {
  min-height: 520px;
}

.account-delivery-result .empty-status {
  min-height: 462px;
}

.account-result-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.account-result-heading h2 {
  margin: 0;
  font-size: 20px;
}

.account-result-meta {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 140px 100px;
  margin-top: 22px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-soft);
}

.account-result-meta > div {
  min-width: 0;
  padding: 12px 14px;
}

.account-result-meta > div + div {
  border-left: 1px solid var(--line);
}

.account-result-meta span,
.account-result-meta strong {
  display: block;
}

.account-verification {
  margin-top: 16px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfcfb;
}

.account-verification-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.account-verification-heading h3 {
  margin: 2px 0 0;
  font-size: 15px;
}

.account-verification-summary {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.account-verification-summary span {
  color: var(--muted);
  font-size: 10px;
}

.account-verification-summary strong {
  font-size: 12px;
  text-align: right;
}

.account-verification-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.account-verification-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 52px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--surface);
}

.account-verification-item > div {
  min-width: 0;
}

.account-verification-item strong,
.account-verification-item small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-verification-item strong {
  font-size: 12px;
}

.account-verification-item small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
}

.account-verification .status-badge {
  min-width: 112px;
  justify-content: center;
}

.account-result-meta span {
  color: var(--muted);
  font-size: 10px;
}

.account-result-meta strong {
  margin-top: 4px;
  overflow: hidden;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#delivered-account-json {
  width: 100%;
  min-height: 320px;
  margin-top: 16px;
  resize: vertical;
  font-family: "Cascadia Code", Consolas, monospace;
  font-size: 11px;
  line-height: 1.5;
}

.account-result-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 14px;
}

.live-dot.offline {
  background: var(--red);
  box-shadow: none;
}

@media (max-width: 820px) {
  .account-delivery-shell {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .account-delivery-shell {
    width: calc(100% - 28px);
    padding-top: 24px;
  }

  .account-redeem-section,
  .account-delivery-result {
    padding: 20px 18px;
  }

  .account-result-heading,
  .account-result-actions {
    display: grid;
  }

  .account-verification-heading,
  .account-verification-summary {
    align-items: stretch;
    flex-direction: column;
  }

  .account-verification-heading .secondary-button {
    width: 100%;
  }

  .account-verification-summary strong {
    text-align: left;
  }

  .account-verification-item {
    grid-template-columns: 1fr;
  }

  .account-verification .status-badge {
    width: 100%;
  }

  .account-redeem-actions {
    grid-template-columns: 1fr;
  }

  .account-result-meta {
    grid-template-columns: 1fr;
  }

  .account-result-meta > div + div {
    border-top: 1px solid var(--line);
    border-left: 0;
  }
}
