:root {
  color-scheme: light;
  --bg: #f3f5f2;
  --surface: #ffffff;
  --surface-soft: #f7f8f6;
  --surface-strong: #eef1ed;
  --ink: #171b18;
  --ink-soft: #59615b;
  --ink-faint: #818982;
  --line: #dfe4df;
  --line-strong: #cbd2cc;
  --green: #16845b;
  --green-dark: #0f6545;
  --green-soft: #e5f4ec;
  --amber: #a7670b;
  --amber-soft: #f9eed8;
  --coral: #c34f42;
  --coral-soft: #f9e8e5;
  --blue: #356995;
  --blue-soft: #e7eff6;
  --radius: 7px;
  --header-height: 62px;
  --mono: "Cascadia Code", "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --sans: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #111513;
  --surface: #181d1a;
  --surface-soft: #1d231f;
  --surface-strong: #252c27;
  --ink: #edf2ed;
  --ink-soft: #abb5ad;
  --ink-faint: #7f8a82;
  --line: #303832;
  --line-strong: #414b43;
  --green: #41b988;
  --green-dark: #62cfa0;
  --green-soft: #173829;
  --amber: #e1a94f;
  --amber-soft: #382b17;
  --coral: #ed8175;
  --coral-soft: #41231f;
  --blue: #76a8d3;
  --blue-soft: #1f3243;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { min-width: 320px; background: var(--bg); }

body {
  min-height: 100vh;
  margin: 0;
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--line) 26%, transparent) 1px, transparent 1px),
    linear-gradient(color-mix(in srgb, var(--line) 26%, transparent) 1px, transparent 1px),
    var(--bg);
  background-size: 32px 32px;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  letter-spacing: 0;
}

button, input, textarea, select { font: inherit; letter-spacing: 0; }
button, a { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }
a { color: inherit; text-decoration: none; }
svg { display: block; width: 16px; height: 16px; stroke-width: 1.8; }
.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; }
.language-control { display: inline-flex; min-height: 34px; align-items: center; gap: 5px; padding: 0 6px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); color: var(--ink-soft); }
.language-control > svg { width: 14px; height: 14px; flex: 0 0 auto; color: var(--ink-faint); }
.language-select { min-width: 70px; height: 32px; padding: 0 18px 0 2px; border: 0; outline: 0; background: transparent; color: var(--ink); font-size: 12px; font-weight: 650; cursor: pointer; }
.language-control:focus-within { border-color: var(--blue); box-shadow: 0 0 0 3px color-mix(in srgb, var(--blue) 10%, transparent); }

.app-shell { min-height: 100vh; }

.topbar {
  position: sticky;
  z-index: 30;
  top: 0;
  min-height: var(--header-height);
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(14px);
}

.topbar-inner {
  display: flex;
  min-height: var(--header-height);
  max-width: 1500px;
  margin: 0 auto;
  padding: 0 28px;
  align-items: center;
  gap: 24px;
}

.brand { display: inline-flex; align-items: center; gap: 10px; flex: 0 0 auto; }
.brand-mark { display: grid; width: 29px; height: 29px; grid-template-columns: repeat(3, 5px); align-items: end; justify-content: center; gap: 2px; border-radius: 6px; background: var(--ink); padding: 7px 0; }
.brand-mark span { width: 5px; border-radius: 1px; background: var(--surface); }
.brand-mark span:nth-child(1) { height: 7px; }
.brand-mark span:nth-child(2) { height: 14px; background: #72dfaa; }
.brand-mark span:nth-child(3) { height: 10px; }
.brand-copy { display: grid; gap: 1px; }
.brand-copy strong { font-size: 16px; line-height: 1; letter-spacing: 0; }
.brand-copy small { color: var(--ink-faint); font-family: var(--mono); font-size: 9px; letter-spacing: 0.14em; }

.service-cluster { display: flex; align-items: center; gap: 8px; }
.service-pill, .topbar-metric { display: inline-flex; height: 30px; align-items: center; border: 1px solid var(--line); border-radius: 999px; background: var(--surface-soft); }
.service-pill { gap: 7px; padding: 0 11px; color: var(--ink-soft); font-size: 13px; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--amber); }
.status-dot.online { background: var(--green); }
.status-dot.offline { background: var(--coral); }
.topbar-metric { gap: 6px; padding: 0 10px; font-size: 12px; }
.topbar-metric span { color: var(--ink-faint); }
.topbar-metric strong { font-variant-numeric: tabular-nums; }
.topbar-actions { display: flex; margin-left: auto; align-items: center; gap: 6px; }

.workspace { width: 100%; max-width: 1500px; margin: 0 auto; padding: 27px 28px 64px; }
.page-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 18px; }
.page-heading h1 { margin: 3px 0 0; font-size: 28px; line-height: 1.15; font-weight: 680; }
.eyebrow, .panel-kicker { margin: 0; color: var(--green); font-family: var(--mono); font-size: 11px; font-weight: 650; letter-spacing: 0.13em; }
.heading-actions, .section-actions, .panel-actions { display: flex; align-items: center; gap: 8px; }

.button, .icon-button, .input-action, .text-action {
  border: 0;
  cursor: pointer;
  transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease, transform 80ms ease, opacity 150ms ease;
}
.button:active:not(:disabled), .icon-button:active:not(:disabled), .input-action:active:not(:disabled) { transform: translateY(1px); }
.button:focus-visible, .icon-button:focus-visible, .input-action:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible, summary:focus-visible { outline: 2px solid color-mix(in srgb, var(--green) 50%, transparent); outline-offset: 2px; }
.button:disabled, .icon-button:disabled { cursor: not-allowed; opacity: 0.45; }
.button { display: inline-flex; min-height: 36px; align-items: center; justify-content: center; gap: 8px; padding: 0 13px; border: 1px solid transparent; border-radius: 6px; font-size: 13px; font-weight: 620; }
.button-compact { min-height: 32px; padding: 0 10px; }
.button-secondary { border-color: var(--line); background: var(--surface); }
.button-secondary:hover, .button-quiet:hover { background: var(--surface-strong); }
.button-quiet { background: transparent; color: var(--ink-soft); }
.button-primary { background: var(--ink); color: var(--surface); }
.button-primary:hover { background: color-mix(in srgb, var(--ink) 88%, var(--green)); }
.button-danger-quiet { border-color: var(--line); background: transparent; color: var(--coral); }
.button-danger-quiet:hover { border-color: color-mix(in srgb, var(--coral) 30%, var(--line)); background: var(--coral-soft); }
.icon-button, .input-action { display: inline-grid; width: 34px; height: 34px; flex: 0 0 auto; place-items: center; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); }
.icon-button:hover, .input-action:hover { background: var(--surface-strong); }
.input-action { width: 30px; height: 30px; border: 0; background: transparent; color: var(--ink-faint); }
.text-action { padding: 0; background: transparent; color: var(--green); font-size: 12px; }

.summary-band { display: grid; margin-bottom: 14px; grid-template-columns: repeat(4, 1fr); border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.summary-item { display: flex; min-height: 76px; align-items: center; gap: 12px; padding: 14px 18px; border-right: 1px solid var(--line); }
.summary-item:last-child { border-right: 0; }
.summary-icon { display: grid; width: 36px; height: 36px; place-items: center; border-radius: 6px; }
.summary-item div { display: grid; gap: 4px; }
.summary-item span:not(.summary-icon) { color: var(--ink-faint); font-size: 12px; }
.summary-item strong { font-family: var(--mono); font-size: 22px; line-height: 1; font-variant-numeric: tabular-nums; }
.tone-green { background: var(--green-soft); color: var(--green); }
.tone-amber { background: var(--amber-soft); color: var(--amber); }
.tone-ink { background: var(--surface-strong); color: var(--ink); }
.tone-coral { background: var(--coral-soft); color: var(--coral); }

.desk-grid { display: grid; grid-template-columns: minmax(310px, 390px) minmax(0, 1fr); gap: 14px; align-items: stretch; }
.tool-panel { min-width: 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.submit-panel { display: flex; min-height: 740px; flex-direction: column; }
.panel-header { display: flex; min-height: 71px; align-items: center; justify-content: space-between; gap: 16px; padding: 15px 18px; border-bottom: 1px solid var(--line); }
.panel-header h2, .section-header h2, .modal-header h2 { margin: 4px 0 0; font-size: 17px; font-weight: 680; }
.count-badge, .title-count, .section-count { color: var(--ink-faint); font-family: var(--mono); font-size: 12px; font-weight: 520; }
.count-badge { padding: 5px 8px; border-radius: 4px; background: var(--surface-strong); }

#submit-form { display: flex; flex: 1; flex-direction: column; gap: 15px; padding: 17px 18px 18px; }
.field-group { display: grid; gap: 7px; min-width: 0; }
.field-group > span, .field-label-row label, .field-group > label, .option-group legend { color: var(--ink-soft); font-size: 12px; font-weight: 630; }
.field-label-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.field-state { color: var(--ink-faint); font-family: var(--mono); font-size: 11px; }
.field-state.valid { color: var(--green); }
.field-state.invalid { color: var(--coral); }
.input-shell, .select-shell, .search-shell { display: flex; min-width: 0; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface-soft); }
.input-shell { min-height: 39px; padding-left: 11px; }
.input-shell > svg, .select-shell > svg:first-child, .search-shell > svg { flex: 0 0 auto; color: var(--ink-faint); }
.input-shell input { width: 100%; min-width: 0; height: 37px; padding: 0; border: 0; outline: 0; background: transparent; color: var(--ink); }
.input-shell:focus-within, .select-shell:focus-within, .search-shell:focus-within, textarea:focus { border-color: color-mix(in srgb, var(--green) 62%, var(--line)); box-shadow: 0 0 0 3px color-mix(in srgb, var(--green) 10%, transparent); }
.input-suffix { padding-right: 11px; color: var(--ink-faint); font-family: var(--mono); font-size: 11px; }
.select-shell { position: relative; min-height: 39px; padding-left: 11px; }
.select-shell select { width: 100%; height: 37px; padding: 0 34px 0 0; border: 0; outline: 0; background: transparent; color: var(--ink); appearance: none; }
.select-shell > svg:last-child { position: absolute; right: 10px; pointer-events: none; color: var(--ink-faint); }
textarea { width: 100%; min-height: 110px; resize: vertical; padding: 10px 11px; border: 1px solid var(--line); border-radius: 6px; outline: 0; background: var(--surface-soft); color: var(--ink); font-family: var(--mono); font-size: 12px; line-height: 1.7; }
.field-grow { flex: 1; }
.field-grow textarea { min-height: 190px; flex: 1; resize: none; }
.input-meta { display: flex; justify-content: space-between; color: var(--ink-faint); font-family: var(--mono); font-size: 10px; }
.field-row { display: grid; gap: 10px; }
.two-columns { grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.8fr); }

.option-group { min-width: 0; margin: 0; padding: 0; border: 0; }
.option-group legend { margin-bottom: 7px; }
.legend-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 7px; }
.legend-row legend { margin: 0; }
.lock-note { color: var(--amber); font-size: 11px; }
.segmented { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 2px; padding: 3px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface-strong); }
.segmented button { min-height: 31px; padding: 0 8px; border: 0; border-radius: 4px; background: transparent; color: var(--ink-faint); cursor: pointer; font-size: 12px; font-weight: 600; }
.segmented button:hover { color: var(--ink); }
.segmented button[aria-pressed="true"] { background: var(--surface); color: var(--ink); }
.segmented button:disabled { cursor: not-allowed; opacity: 0.48; }

.advanced-fields { border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.advanced-fields summary { display: flex; min-height: 40px; align-items: center; justify-content: space-between; color: var(--ink-soft); cursor: pointer; font-size: 12px; font-weight: 630; list-style: none; }
.advanced-fields summary::-webkit-details-marker { display: none; }
.advanced-fields summary span { display: inline-flex; align-items: center; gap: 7px; }
.advanced-fields[open] summary > svg { transform: rotate(180deg); }
.advanced-body { display: grid; gap: 13px; padding: 4px 0 14px; }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; cursor: pointer; }
.switch-row > span:first-child { display: grid; gap: 2px; }
.switch-row strong { color: var(--ink-soft); font-size: 12px; }
.switch-row small { color: var(--ink-faint); font-size: 10px; }
.switch-row input { position: absolute; opacity: 0; pointer-events: none; }
.switch { position: relative; width: 34px; height: 20px; flex: 0 0 auto; border-radius: 999px; background: var(--line-strong); transition: background 150ms ease; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 14px; height: 14px; border-radius: 50%; background: var(--surface); transition: transform 150ms ease; }
.switch-row input:checked + .switch { background: var(--green); }
.switch-row input:checked + .switch::after { transform: translateX(14px); }
.is-hidden { display: none !important; }
.policy-note { display: flex; align-items: flex-start; gap: 8px; padding: 9px 10px; border: 1px solid color-mix(in srgb, var(--amber) 24%, var(--line)); border-radius: 5px; background: var(--amber-soft); color: var(--amber); font-size: 11px; line-height: 1.5; }
.policy-note svg { margin-top: 1px; flex: 0 0 auto; }
.submit-button { min-height: 43px; margin-top: auto; }
.submit-button kbd { min-width: 24px; padding: 2px 5px; border-radius: 3px; background: color-mix(in srgb, var(--surface) 15%, transparent); color: inherit; font-family: var(--mono); font-size: 11px; }

.task-panel { display: flex; min-height: 740px; flex-direction: column; overflow: hidden; }
.task-header { flex: 0 0 auto; }
.title-count { margin-left: 5px; }
.task-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 15px; padding: 10px 13px; border-bottom: 1px solid var(--line); background: var(--surface-soft); }
.tabs { display: flex; min-width: 0; align-items: center; gap: 3px; overflow-x: auto; }
.tabs button { display: inline-flex; height: 30px; flex: 0 0 auto; align-items: center; gap: 5px; padding: 0 9px; border: 0; border-radius: 5px; background: transparent; color: var(--ink-faint); cursor: pointer; font-size: 12px; }
.tabs button[aria-selected="true"] { background: var(--surface); color: var(--ink); }
.tabs span { font-family: var(--mono); font-size: 10px; }
.search-shell { width: min(260px, 30vw); min-height: 33px; flex: 0 0 auto; padding: 0 9px; background: var(--surface); }
.search-shell input { width: 100%; min-width: 0; height: 31px; border: 0; outline: 0; background: transparent; color: var(--ink); font-size: 12px; }
.table-wrap { position: relative; min-height: 0; flex: 1; overflow: auto; }
.data-table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.data-table th { padding: 10px 12px; border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--surface) 95%, transparent); color: var(--ink-faint); font-size: 10px; font-weight: 680; letter-spacing: 0.08em; text-align: left; text-transform: uppercase; }
.data-table td { height: 61px; padding: 9px 12px; border-bottom: 1px solid var(--line); color: var(--ink-soft); font-size: 12px; vertical-align: middle; }
.data-table tbody tr { transition: background 120ms ease; }
.data-table tbody tr { scroll-margin-top: calc(var(--header-height) + 12px); }
.data-table tbody tr:hover { background: var(--surface-soft); }
.task-table th:nth-child(1) { width: 23%; }
.task-table th:nth-child(2) { width: 17%; }
.task-table th:nth-child(3) { width: 15%; }
.task-table th:nth-child(4) { width: 23%; }
.task-table th:nth-child(5) { width: 17%; }
.task-table th:nth-child(6) { width: 5%; }
.account-cell { display: grid; min-width: 0; gap: 4px; }
.account-cell strong { overflow: hidden; color: var(--ink); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.account-cell code, .muted-code { overflow: hidden; color: var(--ink-faint); font-family: var(--mono); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.method-cell { display: grid; gap: 4px; }
.method-cell strong { color: var(--ink); font-size: 11px; }
.status-badge { display: inline-flex; min-height: 23px; align-items: center; gap: 6px; padding: 0 8px; border-radius: 999px; background: var(--surface-strong); color: var(--ink-soft); font-size: 10px; font-weight: 700; }
.status-badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--ink-faint); }
.status-badge.queued { background: var(--amber-soft); color: var(--amber); }
.status-badge.queued::before { background: var(--amber); }
.status-badge.running, .status-badge.payment-pending, .status-badge.awaiting-blik-code { background: var(--blue-soft); color: var(--blue); }
.status-badge.running::before, .status-badge.payment-pending::before, .status-badge.awaiting-blik-code::before { background: var(--blue); }
.status-badge.succeeded { background: var(--green-soft); color: var(--green); }
.status-badge.succeeded::before { background: var(--green); }
.status-badge.failed, .status-badge.payment-failed, .status-badge.canceled { background: var(--coral-soft); color: var(--coral); }
.status-badge.failed::before, .status-badge.payment-failed::before, .status-badge.canceled::before { background: var(--coral); }
.progress-cell { display: grid; gap: 5px; }
.progress-line { display: flex; align-items: center; gap: 8px; }
.progress-track { width: 100%; height: 5px; flex: 1; overflow: hidden; border: 0; border-radius: 999px; background: var(--surface-strong); appearance: none; }
.progress-track::-webkit-progress-bar { border-radius: inherit; background: var(--surface-strong); }
.progress-track::-webkit-progress-value { border-radius: inherit; background: var(--green); transition: width 240ms ease; }
.progress-track::-moz-progress-bar { border-radius: inherit; background: var(--green); }
.progress-line code { width: 30px; color: var(--ink-faint); font-family: var(--mono); font-size: 10px; text-align: right; }
.progress-step { overflow: hidden; color: var(--ink-faint); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.row-action { display: grid; width: 28px; height: 28px; place-items: center; border: 0; border-radius: 4px; background: transparent; color: var(--ink-faint); cursor: pointer; }
.row-action:hover { background: var(--surface-strong); color: var(--ink); }
.empty-state { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 9px; color: var(--ink-faint); }
.empty-visual { display: grid; width: 52px; height: 52px; place-items: center; border: 1px dashed var(--line-strong); border-radius: 50%; }
.empty-visual svg { width: 20px; height: 20px; }
.empty-state strong { font-size: 12px; font-weight: 560; }
.panel-footer { display: flex; min-height: 38px; flex: 0 0 auto; align-items: center; justify-content: space-between; gap: 16px; padding: 0 14px; border-top: 1px solid var(--line); background: var(--surface-soft); color: var(--ink-faint); font-family: var(--mono); font-size: 10px; }
.panel-footer span:first-child { display: inline-flex; align-items: center; gap: 7px; }
.live-indicator { width: 6px; height: 6px; border-radius: 50%; background: var(--green); }

.results-section { margin-top: 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.section-header { display: flex; min-height: 68px; align-items: center; justify-content: space-between; gap: 16px; padding: 13px 18px; border-bottom: 1px solid var(--line); }
.results-table-shell { position: relative; min-height: 112px; overflow-x: auto; }
.results-table th:nth-child(1) { width: 24%; }
.results-table th:nth-child(2) { width: 15%; }
.results-table th:nth-child(3) { width: 12%; }
.results-table th:nth-child(4) { width: 23%; }
.results-table th:nth-child(5) { width: 21%; }
.results-table th:nth-child(6) { width: 5%; }
.compact-empty { padding: 34px 18px; color: var(--ink-faint); font-size: 12px; text-align: center; }

.modal { width: 100%; max-width: none; height: 100%; max-height: none; margin: 0; padding: 0; border: 0; background: transparent; color: var(--ink); }
.modal::backdrop { background: rgba(8, 12, 9, 0.58); backdrop-filter: blur(3px); }
.modal[open] { display: grid; place-items: center; padding: 18px; }
.modal-shell { width: min(520px, 100%); max-height: min(760px, calc(100vh - 36px)); overflow: hidden; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.modal-wide { width: min(880px, 100%); }
.modal-header { display: flex; min-height: 69px; align-items: center; justify-content: space-between; gap: 16px; padding: 13px 17px; border-bottom: 1px solid var(--line); }
.modal-body { max-height: calc(100vh - 170px); padding: 17px; overflow: auto; }
.modal-footer { display: flex; min-height: 62px; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 17px; border-top: 1px solid var(--line); color: var(--ink-faint); font-size: 12px; }
.detail-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; border: 1px solid var(--line); background: var(--line); }
.detail-item { min-width: 0; padding: 12px; background: var(--surface); }
.detail-item span { display: block; margin-bottom: 6px; color: var(--ink-faint); font-size: 10px; text-transform: uppercase; }
.detail-item strong, .detail-item code { display: block; overflow: hidden; color: var(--ink); font-family: var(--mono); font-size: 12px; font-weight: 550; text-overflow: ellipsis; white-space: nowrap; }
.detail-section { margin-top: 17px; }
.detail-section h3 { margin: 0 0 9px; color: var(--ink-soft); font-size: 12px; }
.detail-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 17px; }
.artifact-box { padding: 12px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface-soft); }
.artifact-box code { display: block; overflow-wrap: anywhere; color: var(--ink-soft); font-family: var(--mono); font-size: 11px; line-height: 1.6; }
.inline-form { display: flex; gap: 8px; }
.inline-form input { min-width: 0; flex: 1; height: 36px; padding: 0 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface-soft); color: var(--ink); }
.merge-result { margin-top: 14px; padding: 12px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface-soft); font-size: 12px; line-height: 1.6; }
.merge-result code { font-family: var(--mono); overflow-wrap: anywhere; }
.ledger-summary { display: flex; gap: 8px; margin-bottom: 13px; }
.ledger-summary span { padding: 7px 10px; border-radius: 5px; background: var(--surface-strong); color: var(--ink-soft); font-size: 11px; }
.ledger-summary strong { margin-left: 5px; color: var(--ink); font-family: var(--mono); }
.modal-table-wrap { overflow-x: auto; }

.toast-region { position: fixed; z-index: 80; right: 18px; bottom: 18px; display: grid; width: min(360px, calc(100vw - 36px)); gap: 8px; pointer-events: none; }
.toast { display: flex; min-height: 48px; align-items: flex-start; gap: 10px; padding: 12px; border: 1px solid var(--line-strong); border-radius: 6px; background: var(--ink); color: var(--surface); font-size: 12px; line-height: 1.5; pointer-events: auto; }
.toast svg { margin-top: 1px; flex: 0 0 auto; }
.toast.success svg { color: #72dfaa; }
.toast.error svg { color: #ff9c8f; }
.toast.warning svg { color: #ffc86c; }

.spin { animation: spin 900ms linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 1120px) {
  .service-cluster .topbar-metric { display: none; }
  .desk-grid { grid-template-columns: 340px minmax(0, 1fr); }
  .task-table th:nth-child(2), .task-table td:nth-child(2), .task-table th:nth-child(5), .task-table td:nth-child(5) { display: none; }
  .task-table th:nth-child(1) { width: 32%; }
  .task-table th:nth-child(3) { width: 20%; }
  .task-table th:nth-child(4) { width: 41%; }
  .task-table th:nth-child(6) { width: 7%; }
}

@media (max-width: 820px) {
  .topbar-inner { padding: 0 16px; gap: 12px; }
  .service-cluster { margin-left: auto; }
  .topbar-actions { margin-left: 0; }
  .action-label { display: none; }
  .workspace { padding: 21px 16px 48px; }
  .page-heading { align-items: flex-start; }
  .summary-band { grid-template-columns: repeat(2, 1fr); }
  .summary-item:nth-child(2) { border-right: 0; }
  .summary-item:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .desk-grid { grid-template-columns: 1fr; }
  .submit-panel, .task-panel { min-height: auto; }
  .field-grow textarea { min-height: 210px; resize: vertical; }
  .task-panel { min-height: 560px; }
  .results-table th:nth-child(3), .results-table td:nth-child(3), .results-table th:nth-child(4), .results-table td:nth-child(4) { display: none; }
  .results-table th:nth-child(1) { width: 34%; }
  .results-table th:nth-child(2) { width: 24%; }
  .results-table th:nth-child(5) { width: 34%; }
  .results-table th:nth-child(6) { width: 8%; }
}

@media (max-width: 560px) {
  :root { --header-height: 56px; }
  .brand-copy small, .service-pill #service-label, .topbar-actions .button { display: none; }
  .service-pill { width: 30px; padding: 0; justify-content: center; }
  .topbar-inner { gap: 8px; }
  .page-heading { display: grid; }
  .heading-actions { width: 100%; }
  .heading-actions .button { flex: 1; }
  .summary-item { min-height: 69px; padding: 11px 12px; }
  .summary-icon { width: 32px; height: 32px; }
  .summary-item strong { font-size: 19px; }
  .two-columns { grid-template-columns: 1fr; }
  .task-header { align-items: flex-start; }
  .task-toolbar { align-items: stretch; flex-direction: column; }
  .search-shell { width: 100%; }
  .task-table th:nth-child(4), .task-table td:nth-child(4) { display: none; }
  .task-table th:nth-child(1) { width: 48%; }
  .task-table th:nth-child(3) { width: 42%; }
  .task-table th:nth-child(6) { width: 10%; }
  .task-panel { min-height: 500px; }
  .detail-grid { grid-template-columns: repeat(2, 1fr); }
  .modal[open] { padding: 8px; }
  .modal-shell { max-height: calc(100vh - 16px); }
  .results-table th:nth-child(5), .results-table td:nth-child(5) { display: none; }
  .results-table th:nth-child(1) { width: 50%; }
  .results-table th:nth-child(2) { width: 40%; }
  .results-table th:nth-child(6) { width: 10%; }
}

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

/* Screenshot-aligned operations console. */
body { background: var(--bg); }
.console-workspace { max-width: 1580px; padding-top: 12px; }
.topbar-inner { max-width: 1580px; }
.credit-cluster { display: flex; align-items: center; gap: 8px; }
.credit-pill { display: inline-flex; height: 30px; align-items: center; gap: 7px; padding: 0 11px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface-soft); color: var(--ink-faint); font-size: 12px; }
.credit-pill strong { font-family: var(--mono); font-size: 16px; font-variant-numeric: tabular-nums; }
.credit-pill.available strong { color: var(--green); }
.credit-pill.reserved strong { color: var(--amber); }

.scope-bar { display: flex; min-height: 38px; align-items: center; justify-content: space-between; gap: 16px; }
.scope-title { display: flex; align-items: center; gap: 8px; color: var(--ink-faint); font-size: 12px; }
.scope-title strong { color: var(--ink-soft); font-size: 13px; }
.network-stats { display: grid; margin-bottom: 12px; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.network-stat { display: grid; min-width: 0; min-height: 96px; align-content: center; gap: 5px; padding: 13px 15px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.network-stat > span { color: var(--ink-faint); font-size: 11px; }
.network-stat strong { display: flex; align-items: baseline; gap: 3px; color: var(--ink); font-family: var(--mono); font-size: 26px; line-height: 1; font-variant-numeric: tabular-nums; }
.network-stat strong em { font-family: var(--sans); font-size: 14px; font-style: normal; }
.network-stat .success-number { color: var(--green); }
.network-stat .failure-number { color: var(--coral); }
.network-stat small { color: var(--ink-faint); font-size: 10px; }

.operations-grid { display: grid; grid-template-columns: minmax(300px, 340px) minmax(0, 1fr) minmax(0, 1fr); gap: 12px; align-items: stretch; }
.operations-grid .tool-panel { height: 690px; }
.operations-grid .submit-panel { min-height: 0; overflow-y: auto; }
.operations-grid .submit-panel > .panel-header { position: sticky; z-index: 3; top: 0; background: var(--surface); }
.operations-grid .task-panel,
.payment-panel { display: flex; min-height: 0; flex-direction: column; overflow: hidden; }
.compact-panel-header { min-height: 52px; padding: 10px 14px; }
.compact-panel-header h2 { margin: 0; font-size: 15px; }
.compact-panel-header p { margin: 5px 0 0; color: var(--ink-faint); font-size: 11px; line-height: 1.45; }
.table-panel-header { flex: 0 0 auto; }
.panel-tabs-toolbar { display: grid; flex: 0 0 auto; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; padding: 8px 10px; }
.panel-tabs-toolbar .tabs { padding: 3px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); }
.panel-tabs-toolbar .tabs button { height: 28px; justify-content: center; border-radius: 4px; }
.panel-tabs-toolbar .tabs button[aria-selected="true"] { background: var(--blue-soft); color: var(--blue); }
.compact-search { width: 130px; }
.operations-table-wrap { min-height: 0; }
.operations-grid #submit-form { gap: 11px; padding: 12px 14px 14px; }
.operations-grid .field-grow { min-height: 160px; }
.operations-grid .field-grow textarea { min-height: 160px; }
.operations-grid .field-group { gap: 5px; }
.operations-grid .segmented button { min-height: 28px; }
.operations-grid .advanced-fields summary { min-height: 34px; }
.operations-grid .submit-button { min-height: 40px; }
.operations-grid .data-table td { height: 56px; padding: 8px 10px; }
.operations-grid .data-table th { padding: 9px 10px; }
.operations-grid .empty-state { inset: 39px 0 0; }
.operations-grid .panel-footer { min-height: 34px; }

.operations-grid .task-table th:nth-child(1) { width: 25%; }
.operations-grid .task-table th:nth-child(2) { width: 15%; }
.operations-grid .task-table th:nth-child(3) { width: 16%; }
.operations-grid .task-table th:nth-child(4) { width: 21%; }
.operations-grid .task-table th:nth-child(5) { width: 18%; }
.operations-grid .task-table th:nth-child(6) { width: 5%; }
.payment-panel .results-table th:nth-child(1) { width: 34%; }
.payment-panel .results-table th:nth-child(2) { width: 25%; }
.payment-panel .results-table th:nth-child(3) { width: 14%; }
.payment-panel .results-table th:nth-child(4) { width: 22%; }
.payment-panel .results-table th:nth-child(5) { width: 5%; }

/* Payment records use four columns: account, status, time, and assigned scanner. */
.payment-panel .results-table th:nth-child(1) { width: 36%; }
.payment-panel .results-table th:nth-child(2) { width: 24%; }
.payment-panel .results-table th:nth-child(3) { width: 18%; }
.payment-panel .results-table th:nth-child(4) { width: 22%; }

@media (max-width: 1300px) {
  .credit-cluster { display: none; }
  .operations-grid { grid-template-columns: minmax(290px, 320px) minmax(0, 1fr); }
  .payment-panel { grid-column: 2; }
  .operations-grid .submit-panel { height: 1392px; grid-row: span 2; }
  .operations-grid .task-panel,
  .operations-grid .payment-panel { height: 690px; }
}

@media (max-width: 1120px) {
  .operations-grid .task-table th:nth-child(2), .operations-grid .task-table td:nth-child(2),
  .operations-grid .task-table th:nth-child(5), .operations-grid .task-table td:nth-child(5) { display: table-cell; }
  .panel-tabs-toolbar { grid-template-columns: minmax(0, 1fr); }
  .compact-search { width: 100%; }
}

@media (max-width: 900px) {
  .network-stats { grid-template-columns: repeat(2, 1fr); }
  .operations-grid { grid-template-columns: 1fr; }
  .operations-grid .submit-panel,
  .operations-grid .task-panel,
  .operations-grid .payment-panel { height: auto; min-height: 560px; grid-column: auto; grid-row: auto; }
  .operations-grid .submit-panel { min-height: auto; }
  .operations-grid .field-grow textarea { min-height: 210px; resize: vertical; }
}

@media (max-width: 680px) {
  .console-workspace { padding: 10px 12px 40px; }
  .scope-bar { align-items: stretch; flex-direction: column; padding-bottom: 8px; }
  .scope-bar .heading-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .network-stats { gap: 8px; }
  .network-stat { min-height: 82px; padding: 10px 11px; }
  .network-stat strong { font-size: 22px; }
  .service-cluster { display: none; }
  .operations-grid .task-panel, .operations-grid .payment-panel { min-height: 520px; }
  .operations-grid .task-table th:nth-child(2), .operations-grid .task-table td:nth-child(2),
  .operations-grid .task-table th:nth-child(4), .operations-grid .task-table td:nth-child(4),
  .operations-grid .task-table th:nth-child(5), .operations-grid .task-table td:nth-child(5) { display: none; }
  .operations-grid .task-table th:nth-child(1) { width: 50%; }
  .operations-grid .task-table th:nth-child(3) { width: 40%; }
  .operations-grid .task-table th:nth-child(6) { width: 10%; }
  .payment-panel .results-table th:nth-child(3), .payment-panel .results-table td:nth-child(3),
  .payment-panel .results-table th:nth-child(4), .payment-panel .results-table td:nth-child(4) { display: none; }
  .payment-panel .results-table th:nth-child(1) { width: 52%; }
  .payment-panel .results-table th:nth-child(2) { width: 38%; }
  .payment-panel .results-table th:nth-child(5) { display: table-cell; width: 10%; }
  .panel-actions .button span { display: none; }
}

/* One-stop customer desk */
body {
  background: linear-gradient(112deg, color-mix(in srgb, #dff4f1 48%, var(--bg)) 0%, var(--bg) 54%, color-mix(in srgb, #eee6f8 52%, var(--bg)) 100%);
  background-attachment: fixed;
}
.topbar { min-height: 76px; }
.topbar-inner { min-height: 76px; max-width: 1560px; gap: 10px; padding: 0 20px; }
.one-stop-brand { margin-right: 18px; }
.one-stop-brand .brand-mark { width: 36px; height: 36px; border: 1px solid color-mix(in srgb, var(--green) 22%, var(--line)); background: var(--green-soft); }
.one-stop-brand .brand-mark span { background: var(--green); }
.one-stop-brand .brand-mark span:nth-child(2) { background: var(--blue); }
.one-stop-brand .brand-copy strong { color: var(--green-dark); font-size: 20px; font-weight: 680; }
.one-stop-brand .brand-copy strong em { color: var(--ink); font-size: 13px; font-style: normal; }
.one-stop-brand .brand-copy small { font-size: 8px; }
.credit-cluster { display: flex; align-items: center; gap: 7px; }
.credit-pill { display: inline-flex; min-height: 32px; align-items: center; gap: 7px; padding: 0 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--ink-soft); font-size: 11px; white-space: nowrap; }
.credit-pill strong { color: var(--blue); font: 17px/1 var(--mono); }
.credit-pill.reserved strong { color: var(--amber); }
.header-refresh { color: var(--ink-faint); }
.topbar-spacer { flex: 1; }
.topbar-actions { margin-left: 4px; }
.service-cluster .service-pill, .service-cluster .topbar-metric { height: 32px; background: var(--surface); }
.console-workspace { max-width: 1560px; padding: 14px 20px 55px; }
.activity-panel { overflow: hidden; margin-bottom: 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.activity-panel > header { display: flex; min-height: 68px; align-items: center; justify-content: space-between; gap: 18px; padding: 12px 17px; border-bottom: 1px solid var(--line); }
.activity-panel h2 { margin: 0; font-size: 15px; }
.activity-panel header p { margin: 5px 0 0; color: var(--ink-faint); font-size: 11px; }
.activity-totals { display: flex; align-items: center; gap: 18px; }
.activity-totals > span { display: grid; gap: 2px; color: var(--ink-faint); font-size: 10px; text-align: right; }
.activity-totals strong { color: var(--ink); font: 16px/1 var(--mono); }
.activity-totals strong.blue { color: var(--blue); }
.activity-totals strong.green { color: var(--green); }
.activity-totals strong.red { color: var(--coral); }
.activity-totals .realtime { display: inline-flex; grid-auto-flow: column; align-items: center; gap: 6px; color: var(--green); }
.activity-totals .realtime i { width: 6px; height: 6px; border-radius: 50%; background: var(--green); }
.activity-track { display: grid; grid-template-columns: repeat(10, minmax(20px, 1fr)); gap: 4px; padding: 13px 17px 8px; }
.activity-track i { height: 12px; border-radius: 999px; background: var(--surface-strong); }
.activity-track i.done { background: var(--green); }
.activity-track i.failed { background: var(--coral); }
.activity-panel > footer { display: flex; min-height: 34px; align-items: center; justify-content: space-between; gap: 12px; margin: 0 17px; border-top: 1px solid var(--line); color: var(--ink-faint); font: 9px var(--mono); }
.activity-legend { display: inline-flex; align-items: center; gap: 6px; font-family: var(--sans); }
.activity-legend i { width: 14px; height: 7px; margin-left: 10px; border-radius: 999px; background: var(--line-strong); }
.activity-legend i.done { background: var(--green); }
.activity-legend i.running { background: var(--blue); }
.activity-legend i.failed { background: var(--coral); }
.section-label { display: flex; height: 23px; align-items: center; gap: 7px; color: var(--ink-soft); font-size: 11px; }
.section-label .status-dot { width: 5px; height: 5px; }
.network-stats { margin-bottom: 12px; gap: 12px; }
.network-stat { min-height: 88px; padding: 12px 14px; }
.network-stat strong { font-size: 25px; }
.operations-grid { grid-template-columns: minmax(300px, 340px) minmax(0, 1fr) minmax(0, 1fr); gap: 12px; }
.operations-grid .tool-panel { height: 625px; }
.operations-grid .submit-panel { display: flex; overflow: hidden; }
.operations-grid .submit-panel > .panel-header { position: static; }
.operations-grid #submit-form { min-height: 0; gap: 10px; padding: 12px 14px; }
.operations-grid .field-grow { min-height: 0; flex: 1; }
.operations-grid .field-grow textarea { min-height: 245px; height: 100%; }
.cdk-field .input-shell { background: var(--surface); }
.submit-button { flex: 0 0 auto; background: #65b8c9; color: #fff; }
.submit-button:hover { background: #49a4b8; }
.side-tools { border-top: 1px solid var(--line); }
.side-tools > button { display: flex; width: 100%; min-height: 58px; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 14px; border: 0; border-bottom: 1px solid var(--line); background: transparent; color: var(--ink-soft); text-align: left; }
.side-tools > button:last-child { border-bottom: 0; }
.side-tools > button:hover { background: var(--surface-soft); }
.side-tools > button > span { display: grid; min-width: 0; grid-template-columns: 18px 1fr; align-items: center; gap: 1px 7px; }
.side-tools strong { color: var(--ink); font-size: 12px; }
.side-tools small { grid-column: 2; color: var(--ink-faint); font-size: 10px; }
.side-tools svg { width: 14px; height: 14px; }
.compact-panel-header { min-height: 54px; padding: 10px 14px; }
.compact-panel-header h2 { margin: 0; font-size: 15px; }
.compact-panel-header p { margin: 4px 0 0; color: var(--ink-faint); font-size: 10px; }
.panel-tabs-toolbar { padding: 8px 10px; }
.tabs { gap: 2px; }
.tabs button { height: 29px; padding: 0 8px; }
.tabs button[aria-selected="true"] { background: color-mix(in srgb, #caeaf1 72%, var(--surface)); color: var(--blue); }
.compact-search { display: none; }
.operations-grid .empty-state { inset: 40px 0 0; }
@media (max-width: 1280px) {
  .topbar-inner { flex-wrap: wrap; padding-top: 8px; padding-bottom: 8px; }
  .topbar-spacer { display: none; }
  .service-cluster { order: 4; width: 100%; }
  .topbar-actions { margin-left: auto; }
  .operations-grid { grid-template-columns: minmax(285px, 320px) minmax(0, 1fr); }
  .operations-grid .submit-panel { height: 1262px; grid-row: span 2; }
  .operations-grid .task-panel, .operations-grid .payment-panel { height: 625px; }
}
@media (max-width: 800px) {
  .topbar-inner { gap: 8px; }
  .one-stop-brand { margin-right: auto; }
  .credit-cluster { order: 3; width: 100%; }
  .service-cluster { display: flex; overflow-x: auto; }
  .header-refresh { display: none; }
  .activity-panel > header { align-items: flex-start; flex-direction: column; }
  .activity-totals { width: 100%; justify-content: space-between; gap: 6px; }
  .activity-totals .realtime { display: none; }
  .activity-legend { display: none; }
  .operations-grid { grid-template-columns: 1fr; }
  .operations-grid .submit-panel, .operations-grid .task-panel, .operations-grid .payment-panel { height: auto; min-height: 540px; grid-column: auto; grid-row: auto; }
  .operations-grid .submit-panel { min-height: 710px; }
  .operations-grid .field-grow textarea { min-height: 270px; }
}

@media (max-width: 520px) {
  .console-workspace { padding: 10px 10px 36px; }
  .one-stop-brand .brand-copy small { display: none; }
  .topbar-actions .action-label { display: none; }
  .topbar-actions .button { width: 34px; padding: 0; }
  .frontend-language { padding: 0 3px; }
  .frontend-language > svg { display: none; }
  .frontend-language .language-select { min-width: 61px; width: 61px; padding-right: 14px; }
  .credit-pill { flex: 1; justify-content: center; }
  .service-cluster { flex-wrap: nowrap; scrollbar-width: none; }
  .service-cluster::-webkit-scrollbar { display: none; }
  .service-cluster .service-pill { width: auto; min-width: max-content; flex: 0 0 auto; padding: 0 10px; white-space: nowrap; }
  .service-cluster #service-pill { width: 30px; min-width: 30px; padding: 0; }
  .network-stats { grid-template-columns: repeat(2, 1fr); }
  .activity-track { gap: 3px; padding-right: 10px; padding-left: 10px; }
  .activity-panel > footer { margin-right: 10px; margin-left: 10px; }
  .activity-totals > span { text-align: left; }
  .operations-grid .tool-panel { border-radius: 6px; }
  .panel-actions .button span { display: none; }
}

@media (max-width: 800px) {
  .payment-panel .results-table th:nth-child(3),
  .payment-panel .results-table td:nth-child(3) { display: none; }
  .payment-panel .results-table th:nth-child(4),
  .payment-panel .results-table td:nth-child(4) { display: table-cell; }
  .payment-panel .results-table th:nth-child(1) { width: 42%; }
  .payment-panel .results-table th:nth-child(2) { width: 32%; }
  .payment-panel .results-table th:nth-child(4) { width: 26%; }
}

/* PC typography */
@media (min-width: 901px) {
  body { font-size: 16px; }
  .brand-copy strong { font-size: 18px; }
  .brand-copy small, .one-stop-brand .brand-copy small { font-size: 10px; }
  .one-stop-brand .brand-copy strong { font-size: 22px; }
  .one-stop-brand .brand-copy strong em { font-size: 15px; }
  .language-select, .service-pill, .topbar-metric, .button, .credit-pill { font-size: 14px; }
  .credit-pill strong { font-size: 18px; }
  .activity-panel h2, .compact-panel-header h2 { font-size: 18px; }
  .activity-panel header p, .compact-panel-header p, .activity-totals > span,
  .activity-panel > footer, .section-label, .network-stat > span, .network-stat small,
  .input-meta, .side-tools small { font-size: 12px; }
  .network-stat strong { font-size: 29px; }
  .network-stat strong em { font-size: 16px; }
  .field-group > span, .field-label-row label, .field-group > label, .option-group legend,
  .field-state, .input-suffix, .segmented button, .advanced-fields summary,
  .switch-row strong, .switch-row small, .policy-note, .tabs button, .tabs span,
  .search-shell input, .side-tools strong { font-size: 14px; }
  textarea { font-size: 15px; }
  .panel-header h2, .section-header h2, .modal-header h2 { font-size: 19px; }
  .count-badge, .title-count, .section-count { font-size: 14px; }
  .data-table th { font-size: 13px; }
  .data-table td { font-size: 15px; }
  .account-cell strong { font-size: 15px; }
  .account-cell code, .muted-code, .progress-line code, .progress-step,
  .panel-footer, .status-badge { font-size: 12px; }
  .method-cell strong, .empty-state strong, .compact-empty, .toast { font-size: 14px; }
}
