:root {
  color-scheme: light;
  --canvas: #edf1f4;
  --surface: #ffffff;
  --surface-subtle: #f6f8f9;
  --surface-hover: #eef3f2;
  --sidebar: #10161d;
  --sidebar-raised: #171f28;
  --sidebar-hover: #1d2833;
  --sidebar-active: #20343a;
  --sidebar-line: #27323d;
  --ink: #151b22;
  --muted: #56616d;
  --faint: #73808d;
  --line: #d7dee3;
  --line-strong: #b9c4cc;
  --accent: #0f766e;
  --accent-hover: #0a5f59;
  --accent-soft: #e5f4f1;
  --success: #147447;
  --success-soft: #e9f6ef;
  --warning: #946200;
  --warning-soft: #fff5d8;
  --danger: #b4233c;
  --danger-soft: #fff0f2;
  --info: #315f78;
  --info-soft: #edf5f8;
  --sidebar-width: 244px;
  --topbar-height: 76px;
  --radius: 7px;
  --z-sidebar: 40;
  --z-backdrop: 30;
  --z-sticky: 20;
  --z-dialog: 60;
  --z-toast: 70;
  font-family: "Microsoft YaHei UI", "PingFang SC", "Noto Sans CJK SC", system-ui, sans-serif;
  color: var(--ink);
  background: var(--canvas);
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

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

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.5;
}

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

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

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
a:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid rgba(15, 118, 110, 0.24);
  outline-offset: 2px;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.52;
}

[hidden] {
  display: none !important;
}

svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.skip-link {
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 100;
  padding: 8px 12px;
  border-radius: 5px;
  background: var(--ink);
  color: #fff;
  text-decoration: none;
  transform: translateY(-150%);
}

.skip-link:focus {
  transform: translateY(0);
}

.button,
.icon-button {
  min-height: 36px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease;
}

.button {
  padding: 0 13px;
  font-size: 13px;
  font-weight: 700;
}

.button:hover:not(:disabled),
.icon-button:hover:not(:disabled) {
  border-color: #8f9da7;
  background: var(--surface-hover);
}

.button.primary {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

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

.button.danger {
  border-color: #d9a2ad;
  background: var(--danger-soft);
  color: var(--danger);
}

.button.quiet {
  border-color: transparent;
  background: transparent;
  color: var(--muted);
}

.icon-button {
  width: 38px;
  min-width: 38px;
  padding: 0;
  display: inline-grid;
  place-items: center;
}

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

.login-view {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: #e8edf0;
}

.login-shell {
  width: min(820px, 100%);
  min-height: 470px;
  display: grid;
  grid-template-columns: minmax(290px, 0.9fr) minmax(360px, 1.1fr);
  overflow: hidden;
  border: 1px solid #c8d1d8;
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 4px 8px rgba(16, 22, 29, 0.08);
}

.login-brand {
  min-width: 0;
  padding: 42px 36px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  background: var(--sidebar);
  color: #fff;
}

.login-brand > div:nth-child(2) {
  margin-top: 18px;
}

.login-brand strong {
  display: block;
  font-size: 21px;
}

.login-brand span {
  display: block;
  margin-top: 5px;
  color: #aeb9c4;
  font-size: 13px;
}

.login-brand dl {
  width: 100%;
  margin: auto 0 0;
}

.login-brand dl div {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 0;
  border-top: 1px solid var(--sidebar-line);
  font-size: 12px;
}

.login-brand dt {
  color: #8f9da9;
}

.login-brand dd {
  margin: 0;
  color: #dce4e9;
  font-family: "Cascadia Mono", Consolas, monospace;
  text-align: right;
}

.brand-emblem {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #e8f5f3;
  color: var(--accent-hover);
  font-size: 21px;
  font-weight: 900;
}

.brand-emblem.compact {
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  border-radius: 6px;
  font-size: 16px;
}

.login-form {
  align-self: center;
  display: grid;
  gap: 10px;
  padding: 48px 56px;
}

.login-form h1 {
  margin: 0;
  font-size: 24px;
  line-height: 1.35;
}

.login-form > div p {
  margin: 5px 0 18px;
  color: var(--muted);
}

.login-form label,
.operation-form > label,
.filter-bar label {
  color: #3b4651;
  font-size: 12px;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
}

input,
select {
  min-height: 38px;
  padding: 7px 10px;
}

textarea {
  padding: 9px 10px;
  resize: vertical;
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 12px;
  line-height: 1.6;
}

input:hover,
select:hover,
textarea:hover {
  border-color: #8f9da7;
}

input::placeholder,
textarea::placeholder {
  color: #667482;
  opacity: 1;
}

.login-submit {
  width: 100%;
  min-height: 42px;
  margin-top: 12px;
}

.form-error,
.list-error {
  margin: 5px 0 0;
  color: var(--danger);
  font-size: 12px;
  font-weight: 700;
}

.workspace-view {
  min-height: 100vh;
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: var(--z-sidebar);
  width: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  border-right: 1px solid #080c10;
  background: var(--sidebar);
  color: #d7e0e7;
}

.sidebar-brand {
  min-height: var(--topbar-height);
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 14px 15px;
  border-bottom: 1px solid var(--sidebar-line);
  background: #0d1319;
}

.sidebar-brand strong {
  display: block;
  color: #fff;
  font-size: 14px;
}

.sidebar-brand span {
  display: block;
  margin-top: 2px;
  color: #95a3af;
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 10px;
}

.sidebar-close {
  display: none;
  margin-left: auto;
  border-color: transparent;
  background: transparent;
  color: #b6c0c9;
}

.sidebar-nav {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 12px 9px 18px;
}

.nav-group {
  padding: 13px 10px 6px;
  color: #7e8c98;
  font-size: 11px;
  font-weight: 700;
}

.nav-link {
  width: 100%;
  min-height: 40px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 11px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: #b6c1cb;
  cursor: pointer;
  font-size: 13px;
  font-weight: 650;
  text-align: left;
  transition: background-color 150ms ease, color 150ms ease, border-color 150ms ease;
}

.nav-link + .nav-link {
  margin-top: 3px;
}

.nav-link:hover {
  background: var(--sidebar-hover);
  color: #fff;
}

.nav-link.active {
  border-color: #2d4a4f;
  background: var(--sidebar-active);
  color: #fff;
}

.nav-link svg {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  color: #8e9ba7;
}

.nav-link.active svg {
  color: #63c7bd;
}

.sidebar-foot {
  display: grid;
  gap: 5px;
  padding: 13px 16px 16px;
  border-top: 1px solid var(--sidebar-line);
  background: #0d1319;
  color: #8f9da9;
  font-size: 11px;
}

.sidebar-backdrop {
  display: none;
}

.app-shell {
  grid-column: 2;
  min-width: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
  min-height: var(--topbar-height);
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 10px 24px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.97);
}

.menu-button {
  display: none;
}

.page-title {
  min-width: 220px;
}

.breadcrumb {
  color: var(--faint);
  font-size: 11px;
}

.page-title h1 {
  margin: 2px 0 0;
  font-size: 20px;
  line-height: 1.25;
}

.page-title p {
  display: none;
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.topbar-meta {
  margin-left: auto;
  display: grid;
  justify-items: end;
  white-space: nowrap;
}

.topbar-meta strong {
  color: #27414a;
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 12px;
}

.topbar-meta span {
  color: var(--faint);
  font-size: 11px;
}

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

.realtime-state,
.health-state,
.mode-label,
.state-text {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 3px 8px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--surface-subtle);
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
  white-space: nowrap;
}

.realtime-state[data-kind="ok"],
.health-state[data-kind="ok"],
.state-text[data-kind="ok"] {
  border-color: #aad7bf;
  background: var(--success-soft);
  color: var(--success);
}

.realtime-state[data-kind="warning"],
.health-state[data-kind="warning"],
.state-text[data-kind="warning"] {
  border-color: #e5cd91;
  background: var(--warning-soft);
  color: var(--warning);
}

.realtime-state[data-kind="error"],
.health-state[data-kind="error"],
.state-text[data-kind="error"] {
  border-color: #e4b1ba;
  background: var(--danger-soft);
  color: var(--danger);
}

.user-name {
  min-width: 0;
  max-width: 130px;
  overflow: hidden;
  color: #35414c;
  font-size: 12px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#main-content {
  min-width: 0;
  padding: 24px;
}

.error-banner {
  margin-bottom: 16px;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 16px;
  border: 1px solid #e4b1ba;
  border-radius: var(--radius);
  background: var(--danger-soft);
  color: var(--danger);
}

.error-banner div {
  flex: 1;
  min-width: 0;
}

.error-banner strong {
  display: block;
}

.error-banner p {
  margin: 2px 0 0;
  overflow-wrap: anywhere;
}

.page-section {
  min-width: 0;
}

.page-section.active {
  animation: view-in 160ms ease-out both;
}

@keyframes view-in {
  from { opacity: 0.55; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.view-heading {
  min-height: 58px;
  margin-bottom: 16px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.view-heading h2 {
  margin: 0;
  font-size: 22px;
  line-height: 1.3;
}

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

.metric-strip,
.compact-metrics {
  margin: 0 0 16px;
  display: grid;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.metric-strip {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

.compact-metrics {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

.metric-strip > div,
.compact-metrics > div {
  min-width: 0;
  padding: 15px 16px;
}

.metric-strip > div + div,
.compact-metrics > div + div {
  border-left: 1px solid var(--line);
}

.metric-strip dt,
.compact-metrics dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.metric-strip dd,
.compact-metrics dd {
  margin: 5px 0 0;
  color: #1c3037;
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 22px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.metric-strip span {
  display: block;
  margin-top: 2px;
  overflow: hidden;
  color: var(--faint);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.span-two {
  grid-column: 1 / -1;
}

.workspace-panel {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.page-section > .workspace-panel + .workspace-panel,
.page-section > .workspace-panel + div,
.page-section > div + .workspace-panel {
  margin-top: 16px;
}

.panel-heading {
  min-height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
}

.panel-heading h3 {
  margin: 0;
  font-size: 15px;
}

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

.mode-label {
  border-color: #9fcfc9;
  background: var(--accent-soft);
  color: var(--accent-hover);
  font-family: "Cascadia Mono", Consolas, monospace;
}

.table-scroll {
  width: 100%;
  overflow: auto;
}

table {
  width: 100%;
  min-width: 920px;
  border-collapse: collapse;
  font-size: 12px;
}

th,
td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f2f5f6;
  color: #3d4b56;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

tbody tr {
  transition: background-color 120ms ease;
}

tbody tr:hover {
  background: #f7faf9;
}

tbody tr:last-child td {
  border-bottom: 0;
}

.empty-row {
  padding: 28px 16px;
  color: var(--faint);
  text-align: center;
}

.numeric {
  font-family: "Cascadia Mono", Consolas, monospace;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.identifier-cell {
  max-width: 320px;
  font-family: "Cascadia Mono", Consolas, monospace;
  overflow-wrap: anywhere;
}

.channel-name {
  display: grid;
  gap: 2px;
}

.channel-name strong {
  font-size: 12px;
}

.channel-name span {
  color: var(--faint);
  font-family: "Cascadia Mono", Consolas, monospace;
}

.task-bar {
  min-height: 12px;
  margin: 18px 16px 12px;
  display: flex;
  overflow: hidden;
  border-radius: 4px;
  background: #e4e9ec;
}

.task-segment {
  display: block;
  min-width: 2px;
}

.task-queued { background: #b68216; }
.task-running { background: #267e7a; }
.task-submitted { background: #597985; }
.task-succeeded { background: #2d8a59; }
.task-failed { background: #bd4457; }
.task-manual-review { background: #a66a27; }
.task-cancelled { background: #7b8791; }
.task-expired { background: #5e6871; }

.status-list,
.fact-list {
  margin: 0;
}

.status-list {
  padding: 0 16px 14px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.status-list div,
.fact-list div {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 9px 0;
  border-bottom: 1px solid #e8ecef;
}

.status-list div:nth-last-child(-n+2) {
  border-bottom: 0;
}

.status-list div:nth-child(odd) {
  padding-right: 12px;
}

.status-list div:nth-child(even) {
  padding-left: 12px;
  border-left: 1px solid #e8ecef;
}

.status-list dt,
.fact-list dt {
  color: var(--muted);
  font-size: 12px;
}

.status-list dd,
.fact-list dd {
  margin: 0;
  color: #20343a;
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 12px;
  font-weight: 800;
  text-align: right;
  overflow-wrap: anywhere;
}

.workspace-panel > .fact-list {
  padding: 7px 16px 14px;
}

.fact-list div:last-child {
  border-bottom: 0;
}

.fact-list.horizontal {
  padding: 4px 16px 14px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.fact-list.horizontal div {
  display: grid;
  gap: 4px;
}

.fact-list.horizontal div:nth-child(3n+2),
.fact-list.horizontal div:nth-child(3n+3) {
  padding-left: 16px;
  border-left: 1px solid #e8ecef;
}

.fact-list.horizontal dd {
  text-align: left;
}

.operation-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  padding: 16px;
}

.payment-create-form {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.cdk-form {
  grid-template-columns: 180px 160px minmax(220px, 1fr) auto;
  align-items: end;
}

.operation-form > label {
  min-width: 0;
  display: grid;
  gap: 6px;
}

.operation-form .full {
  grid-column: 1 / -1;
}

.operation-form fieldset {
  min-width: 0;
  margin: 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.operation-form legend {
  padding: 0 4px;
  color: #3b4651;
  font-size: 12px;
  font-weight: 700;
}

.check-line {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
}

.check-line input {
  width: 16px;
  min-height: 16px;
  margin: 0;
  accent-color: var(--accent);
}

.form-actions {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
}

.form-state {
  flex: 1;
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.form-state[data-kind="ok"] { color: var(--success); }
.form-state[data-kind="warning"] { color: var(--warning); }
.form-state[data-kind="error"] { color: var(--danger); }

.filter-bar {
  min-height: 62px;
  padding: 10px 14px;
  display: flex;
  align-items: end;
  gap: 10px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-subtle);
}

.filter-bar label {
  min-width: 120px;
  display: grid;
  gap: 4px;
}

.filter-bar input,
.filter-bar select {
  min-height: 34px;
  padding-top: 5px;
  padding-bottom: 5px;
}

.filter-actions {
  margin-left: auto;
  display: flex;
  gap: 7px;
}

.pagination-bar {
  min-height: 50px;
  padding: 9px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-top: 1px solid var(--line);
  background: var(--surface-subtle);
  color: var(--muted);
  font-size: 12px;
}

.pagination-bar > div {
  display: flex;
  gap: 7px;
}

.admin-list-workspace {
  margin-top: 16px;
}

.task-progress-link {
  max-width: 280px;
  padding: 0;
  border: 0;
  background: transparent;
  color: #205f61;
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 12px;
  text-align: left;
  text-decoration: underline;
  text-decoration-color: #9abfbd;
  text-underline-offset: 3px;
  overflow-wrap: anywhere;
  cursor: pointer;
}

.copy-target {
  color: #205f61;
  text-decoration: underline;
  text-decoration-color: #9abfbd;
  text-underline-offset: 3px;
  cursor: copy;
}

.copy-target:hover,
.task-progress-link:hover {
  color: var(--accent-hover);
  text-decoration-color: var(--accent-hover);
}

.copy-target[data-copy-state="copied"] {
  color: var(--success);
  background: var(--success-soft);
}

.incomplete-value {
  color: var(--warning);
}

.integrity-missing,
.integrity-warning {
  color: var(--danger);
  font-weight: 700;
}

.cell-detail {
  display: block;
  max-width: 360px;
  margin-top: 3px;
  color: var(--muted);
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.payment-outcome {
  max-width: 380px;
}

.generated-results {
  margin: 0 16px 16px;
  overflow: hidden;
  border: 1px solid #acd3cd;
  border-radius: 6px;
  background: #f4fbf9;
}

.generated-results-head {
  padding: 9px 12px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid #c8e2de;
  color: #24544f;
  font-size: 12px;
}

#cdk-results-list {
  display: grid;
}

.generated-cdk-row {
  padding: 9px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid #d8ebe8;
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 12px;
}

.generated-cdk-row:last-child {
  border-bottom: 0;
}

.generated-cdk-row .copy-target {
  overflow-wrap: anywhere;
}

.row-actions {
  display: flex;
  gap: 6px;
  white-space: nowrap;
}

.row-action {
  min-height: 30px;
  padding: 4px 8px;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  background: #fff;
  color: #34424c;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}

.row-action.danger {
  border-color: #e0aab4;
  color: var(--danger);
}

.audit-filter {
  flex-wrap: wrap;
}

.audit-filter label {
  min-width: 145px;
  flex: 1 1 145px;
}

.audit-filter .filter-actions {
  flex: 0 0 auto;
}

dialog {
  width: min(1120px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  padding: 0;
  overflow: auto;
  border: 1px solid #9eabb5;
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 8px 18px rgba(16, 22, 29, 0.18);
}

dialog::backdrop {
  background: rgba(16, 22, 29, 0.52);
}

.dialog-head {
  position: sticky;
  top: 0;
  z-index: 2;
  min-height: 66px;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.dialog-head h2 {
  margin: 0;
  font-size: 18px;
}

.dialog-head p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.task-progress-summary {
  padding: 16px;
}

.task-progress-bar {
  height: 9px;
  overflow: hidden;
  border-radius: 4px;
  background: #e1e7ea;
}

.task-progress-bar span {
  width: 0;
  height: 100%;
  display: block;
  background: var(--accent);
  transition: width 180ms ease;
}

.task-progress-meta {
  margin-top: 8px;
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 12px;
}

.task-progress-meta strong {
  color: var(--ink);
  font-family: "Cascadia Mono", Consolas, monospace;
}

.task-progress-facts {
  margin: 14px 0 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border: 1px solid var(--line);
  border-radius: 6px;
}

.task-progress-facts div {
  min-width: 0;
  padding: 9px 10px;
}

.task-progress-facts div + div {
  border-left: 1px solid var(--line);
}

.task-progress-facts dt {
  color: var(--faint);
  font-size: 11px;
}

.task-progress-facts dd {
  margin: 3px 0 0;
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 12px;
  overflow-wrap: anywhere;
}

.task-progress-message {
  margin: 12px 0 0;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.dialog-foot {
  padding: 10px 14px;
  border-top: 1px solid var(--line);
  background: var(--surface-subtle);
  color: var(--muted);
  font-size: 12px;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: var(--z-toast);
  max-width: min(420px, calc(100vw - 32px));
  padding: 11px 14px;
  border: 1px solid #9fcfc9;
  border-radius: 6px;
  background: #f2faf8;
  color: #24544f;
  box-shadow: 0 3px 8px rgba(16, 22, 29, 0.13);
  font-size: 12px;
  font-weight: 700;
}

.toast[data-kind="error"] {
  border-color: #e0aab4;
  background: var(--danger-soft);
  color: var(--danger);
}

.clipboard-fallback {
  position: fixed;
  left: -9999px;
}

@media (max-width: 1320px) {
  .metric-strip,
  .compact-metrics {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .metric-strip > div:nth-child(4),
  .compact-metrics > div:nth-child(4) {
    border-left: 0;
  }

  .metric-strip > div:nth-child(n+4),
  .compact-metrics > div:nth-child(n+4) {
    border-top: 1px solid var(--line);
  }

  .topbar-meta {
    display: none;
  }

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

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

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

@media (max-width: 980px) {
  .workspace-view {
    display: block;
  }

  .sidebar {
    transform: translateX(-101%);
    transition: transform 180ms ease;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar-close {
    display: inline-grid;
  }

  .sidebar-backdrop {
    position: fixed;
    inset: 0;
    z-index: var(--z-backdrop);
    border: 0;
    background: rgba(16, 22, 29, 0.5);
  }

  .sidebar-backdrop.visible {
    display: block;
  }

  .app-shell {
    min-width: 0;
  }

  .menu-button {
    display: inline-grid;
  }

  .topbar {
    padding-left: 16px;
    padding-right: 16px;
  }

  .page-title {
    min-width: 0;
    flex: 1;
  }

  .breadcrumb,
  .page-title p {
    display: none;
  }

  .topbar-actions {
    margin-left: auto;
  }

  .user-name {
    display: none;
  }
}

@media (max-width: 760px) {
  #main-content {
    padding: 16px;
  }

  .topbar {
    min-height: 64px;
    gap: 10px;
  }

  .page-title h1 {
    font-size: 17px;
  }

  .realtime-state {
    display: none;
  }

  .view-heading {
    min-height: 0;
    align-items: center;
  }

  .view-heading h2 {
    font-size: 19px;
  }

  .view-heading p {
    font-size: 12px;
  }

  .metric-strip,
  .compact-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .metric-strip > div,
  .compact-metrics > div {
    border-top: 1px solid var(--line);
    border-left: 1px solid var(--line);
  }

  .metric-strip > div:nth-child(-n+2),
  .compact-metrics > div:nth-child(-n+2) {
    border-top: 0;
  }

  .metric-strip > div:nth-child(odd),
  .compact-metrics > div:nth-child(odd) {
    border-left: 0;
  }

  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .span-two {
    grid-column: auto;
  }

  .fact-list.horizontal {
    grid-template-columns: 1fr;
  }

  .fact-list.horizontal div:nth-child(n) {
    padding-left: 0;
    border-left: 0;
  }

  .operation-form,
  .payment-create-form,
  .cdk-form {
    grid-template-columns: 1fr;
  }

  .cdk-form .form-actions {
    grid-column: auto;
  }

  .filter-bar {
    align-items: stretch;
    flex-wrap: wrap;
  }

  .filter-bar label {
    min-width: calc(50% - 5px);
    flex: 1 1 calc(50% - 5px);
  }

  .filter-actions {
    width: 100%;
    margin-left: 0;
    justify-content: flex-end;
  }

  .task-progress-facts {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .task-progress-facts div:nth-child(3) {
    border-left: 0;
    border-top: 1px solid var(--line);
  }

  .task-progress-facts div:nth-child(4) {
    border-top: 1px solid var(--line);
  }
}

@media (max-width: 480px) {
  .login-view {
    padding: 0;
  }

  .login-shell {
    min-height: 100vh;
    grid-template-columns: 1fr;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .login-brand {
    min-height: 160px;
    padding: 24px;
  }

  .login-brand dl {
    display: none;
  }

  .login-form {
    padding: 30px 24px 42px;
  }

  .topbar {
    padding: 9px 10px;
  }

  .topbar-actions {
    gap: 5px;
  }

  .topbar-actions .button.quiet {
    width: 38px;
    padding: 0;
    overflow: hidden;
    color: transparent;
    position: relative;
  }

  .topbar-actions .button.quiet::after {
    content: "退";
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    color: var(--muted);
  }

  #main-content {
    padding: 12px 10px 20px;
  }

  .view-heading {
    margin-bottom: 12px;
  }

  .view-heading p {
    max-width: 27ch;
  }

  .metric-strip > div,
  .compact-metrics > div {
    padding: 12px;
  }

  .metric-strip dd,
  .compact-metrics dd {
    font-size: 19px;
  }

  .panel-heading {
    padding: 11px 12px;
  }

  .operation-form {
    padding: 12px;
  }

  .form-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .form-actions .button {
    width: 100%;
    min-height: 40px;
  }

  .filter-bar label {
    min-width: 100%;
    flex-basis: 100%;
  }

  .filter-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .filter-actions .button {
    min-width: 0;
  }

  .pagination-bar {
    align-items: flex-start;
    flex-direction: column;
  }

  .pagination-bar > div {
    width: 100%;
  }

  .pagination-bar .button {
    flex: 1;
  }

  .generated-cdk-row {
    align-items: flex-start;
    flex-direction: column;
  }
}

@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;
  }
}
