:root {
  color-scheme: light;
  --bg: #fff;
  --surface: #ffffff;
  --surface-soft: #f8fafb;
  --sidebar: #111d21;
  --sidebar-soft: #1a292e;
  --ink: #142126;
  --muted: #65737a;
  --line: #d7e0e3;
  --line-strong: #bdcbd0;
  --primary: #087443;
  --primary-hover: #075f38;
  --primary-soft: #e8f5ee;
  --blue: #2563eb;
  --blue-soft: #eaf0ff;
  --warn: #a15c07;
  --warn-soft: #fff3df;
  --danger: #b42318;
  --danger-soft: #fff0ee;
  --shadow: 0 10px 28px rgba(20, 33, 38, 0.07);
  font-family: "Noto Sans SC", "Microsoft YaHei", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  background: var(--bg);
}

body {
  --global-nav-gutter: 0px;
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  padding-top: 0 !important;
  color: var(--ink);
  background: var(--bg);
}

button,
input,
select,
textarea {
  font: inherit;
}

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

button {
  border: 0;
}

a {
  color: inherit;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 232px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 24px 16px 18px;
  color: #f7fafb;
  background: var(--sidebar);
}

.brand {
  min-height: 52px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 8px;
}

.brand-mark {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border: 1px solid #406069;
  border-radius: 6px;
  color: #c9f7dd;
  background: #18352c;
  font-size: 13px;
  font-weight: 800;
}

.brand div,
.service-state div {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.brand strong {
  font-size: 16px;
}

.brand span:last-child,
.service-state span:last-child {
  color: #96aab1;
  font-size: 12px;
}

.service-state {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border: 1px solid #2b4047;
  border-radius: 6px;
  background: var(--sidebar-soft);
}

.service-state strong {
  font-size: 13px;
}

.state-dot {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: #8da0a6;
  box-shadow: 0 0 0 3px rgba(141, 160, 166, 0.13);
}

.state-dot.online {
  background: #35c878;
  box-shadow: 0 0 0 3px rgba(53, 200, 120, 0.14);
}

.state-dot.offline {
  background: #ef6a5b;
  box-shadow: 0 0 0 3px rgba(239, 106, 91, 0.14);
}

.primary-nav {
  display: grid;
  gap: 6px;
}

.nav-item {
  min-height: 44px;
  display: flex;
  align-items: center;
  padding: 0 14px;
  border-left: 3px solid transparent;
  border-radius: 4px;
  color: #aebdc2;
  background: transparent;
  cursor: pointer;
  text-align: left;
}

.nav-item:hover {
  color: #ffffff;
  background: #18282d;
}

.nav-item.active {
  border-left-color: #44d58b;
  color: #ffffff;
  background: #20343a;
  font-weight: 700;
}

.sidebar-spacer {
  flex: 1;
}

.modal-open {
  overflow: hidden;
}

.shop-modal {
  position: fixed;
  z-index: 1000;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
}

.shop-modal[hidden] {
  display: none !important;
}

.shop-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(9, 22, 26, 0.58);
  opacity: 0;
  backdrop-filter: blur(4px);
  transition: opacity 180ms ease;
}

.shop-modal-panel {
  position: relative;
  width: min(460px, 100%);
  max-height: calc(100svh - 48px);
  overflow-y: auto;
  padding: 28px;
  border: 1px solid #2b4850;
  border-radius: 8px;
  outline: none;
  color: #f3fbfa;
  background: #111d21;
  box-shadow: 0 24px 60px rgba(9, 22, 26, 0.34);
  opacity: 0;
  transform: translateY(10px) scale(0.98);
  transition: opacity 180ms ease, transform 180ms ease;
}

.shop-modal-panel::before {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  height: 3px;
  background: #44d58b;
}

.shop-modal.show .shop-modal-backdrop,
.shop-modal.show .shop-modal-panel {
  opacity: 1;
}

.shop-modal.show .shop-modal-panel {
  transform: translateY(0) scale(1);
}

.shop-modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid #36545c;
  border-radius: 6px;
  color: #c4d3d7;
  background: #17282e;
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
}

.shop-modal-close:hover {
  color: #ffffff;
  background: #20343a;
}

.shop-modal-kicker {
  display: block;
  margin-bottom: 9px;
  color: #9cb0b6;
  font-size: 13px;
  font-weight: 700;
}

.shop-modal-title {
  display: inline-block;
  max-width: calc(100% - 44px);
  color: #d6ffe8;
  font-size: 23px;
  font-weight: 800;
  line-height: 1.24;
  overflow-wrap: anywhere;
  text-decoration: none;
}

.shop-modal-title:hover {
  text-decoration: underline;
}

.shop-modal-detail {
  margin: 12px 0 0;
  color: #c1cdd1;
  font-size: 15px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.shop-modal-detail strong {
  color: #ffffff;
  font-weight: 800;
}

.shop-modal-qr {
  width: fit-content;
  max-width: 100%;
  margin: 18px 0 0;
  padding: 8px;
  border-radius: 9px;
  background: #ffffff;
  box-shadow: 0 12px 30px rgba(5, 12, 15, 0.2);
}

.shop-modal-qr img {
  width: min(260px, 100%);
  height: auto;
  display: block;
  border-radius: 6px;
}

.shop-modal-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 24px;
}

.shop-modal-primary,
.shop-modal-secondary {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 16px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 800;
  text-decoration: none;
}

.shop-modal-primary {
  color: #ffffff;
  background: var(--primary);
}

.shop-modal-primary:hover {
  background: var(--primary-hover);
}

.shop-modal-secondary {
  border: 1px solid #36545c;
  color: #dce8eb;
  background: #17282e;
}

.shop-modal-secondary:hover {
  background: #20343a;
}

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

.topbar {
  min-height: 82px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 16px clamp(20px, 3vw, 42px);
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.94);
}

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

.global-mode-bar {
  box-sizing: border-box;
  width: calc(100% + var(--global-nav-gutter) + var(--global-nav-gutter));
  height: 74px;
  margin-inline: calc(0px - var(--global-nav-gutter));
  display: block;
  padding: 20px 16px 14px;
  background: var(--bg);
}

.global-mode-switch {
  box-sizing: border-box;
  width:min(1605px,100%);
  height: 40px;
  margin: 0;
  display: grid;
  grid-template-columns:repeat(15,minmax(0,1fr));
  grid-auto-rows: 38px;
  overflow: hidden;
  border: 1px solid #b8ad99;
  background: #ffffff;
}

.global-mode-switch a {
  height: 38px;
  min-width: 0;
  display: grid;
  place-items: center;
  padding: 0 8px;
  color: #222222;
  background: #ffffff;
  text-decoration: none;
  font-size: 14px;
  font-weight: 700;
}

.global-mode-switch a + a {
  border-left: 1px solid #b8ad99;
}

.global-mode-switch a:hover:not(.active) {
  background: #f3efe4;
}

.global-mode-switch a.active {
  color: #ffffff;
  background: #111111;
}

.topbar h1,
.section-heading h2,
.panel-heading h2 {
  margin: 0;
  letter-spacing: 0;
}

.topbar h1 {
  margin-top: 4px;
  font-size: 23px;
  line-height: 1.25;
}

.eyebrow {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.topbar-state {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
  background: var(--surface);
  font-size: 13px;
  white-space: nowrap;
}

.content {
  width: min(100%, 1500px);
  margin: 0 auto;
  padding: 28px clamp(18px, 3vw, 42px) 48px;
}

.view[hidden] {
  display: none;
}

.section-heading,
.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

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

.section-heading h2 {
  margin-top: 5px;
  font-size: 22px;
}

.heading-actions,
.action-bar,
.qr-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 9px;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.panel-heading {
  min-height: 58px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.panel-heading h2 {
  margin-top: 4px;
  font-size: 17px;
}

.workflow-strip {
  min-height: 72px;
  display: grid;
  grid-template-columns: max-content minmax(36px, 1fr) max-content minmax(36px, 1fr) max-content;
  align-items: center;
  gap: 14px;
  margin-bottom: 20px;
  padding: 12px 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.workflow-step {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
}

.workflow-step > span {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: var(--surface);
  font-size: 12px;
  font-weight: 800;
}

.workflow-step div {
  display: grid;
  gap: 2px;
}

.workflow-step strong {
  color: inherit;
  font-size: 13px;
  white-space: nowrap;
}

.workflow-step small {
  font-size: 11px;
  white-space: nowrap;
}

.workflow-step.active,
.workflow-step.complete {
  color: var(--ink);
}

.workflow-step.active > span {
  border-color: var(--primary);
  color: #ffffff;
  background: var(--primary);
}

.workflow-step.complete > span {
  border-color: #8bc8a8;
  color: var(--primary);
  background: var(--primary-soft);
}

.workflow-line {
  height: 1px;
  background: var(--line);
}

.workflow-line.complete {
  background: #8bc8a8;
}

.workspace-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(390px, 0.85fr);
  align-items: start;
  gap: 20px;
}

.mail-grid {
  display: grid;
  grid-template-columns: minmax(360px, 0.82fr) minmax(0, 1.18fr);
  align-items: start;
  gap: 20px;
}

.side-column {
  min-width: 0;
  display: grid;
  gap: 20px;
}

.form-panel,
.runtime-panel,
.result-panel,
.recent-panel,
.history-panel {
  padding: 20px;
}

.security-label {
  color: var(--primary);
  font-size: 12px;
  font-weight: 700;
  text-align: right;
}

.field {
  min-width: 0;
  display: grid;
  align-content: start;
  gap: 7px;
}

.field-wide {
  grid-column: 1 / -1;
}

.form-panel > .field {
  margin-top: 20px;
}

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

label,
.field > label {
  color: #28383e;
  font-size: 13px;
  font-weight: 700;
}

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

input,
select {
  min-height: 44px;
  padding: 0 12px;
}

textarea {
  min-height: 150px;
  resize: vertical;
  padding: 12px;
  line-height: 1.6;
}

input:focus,
select:focus,
textarea:focus,
button:focus-visible,
a:focus-visible,
summary:focus-visible {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.13);
}

input[readonly],
input:disabled,
select:disabled {
  color: #54656b;
  background: #f2f5f6;
  cursor: not-allowed;
}

.field-meta {
  min-height: 18px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

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

.advanced > summary,
.raw-details > summary {
  min-height: 48px;
  display: flex;
  align-items: center;
  color: #34464c;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  list-style: none;
  outline: none;
}

.advanced > summary::-webkit-details-marker,
.raw-details > summary::-webkit-details-marker {
  display: none;
}

.advanced > summary::after,
.raw-details > summary::after {
  content: "+";
  margin-left: auto;
  color: var(--muted);
  font-size: 18px;
  font-weight: 400;
}

.advanced[open] > summary::after,
.raw-details[open] > summary::after {
  content: "−";
}

.advanced[open] {
  padding-bottom: 18px;
}

.checkbox-field {
  min-height: 44px;
  align-content: center;
}

.checkline {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  cursor: pointer;
}

.checkline input {
  width: 18px;
  min-height: 18px;
  margin: 0;
  accent-color: var(--primary);
}

.proxy-chain-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 24px minmax(0, 1fr);
  align-items: end;
  gap: 8px;
  margin-top: 6px;
}

.chain-arrow {
  height: 44px;
  display: grid;
  place-items: center;
  color: var(--muted);
}

.search-select {
  position: relative;
}

.search-menu {
  position: absolute;
  z-index: 30;
  top: calc(100% + 5px);
  left: 0;
  right: 0;
  max-height: 220px;
  display: none;
  overflow-y: auto;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--surface);
  box-shadow: 0 12px 24px rgba(20, 33, 38, 0.13);
}

.search-menu.show {
  display: block;
}

.search-option {
  min-height: 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 11px;
  color: #34464c;
  font-size: 12px;
  cursor: pointer;
}

.search-option:hover {
  background: var(--blue-soft);
}

.search-option span:last-child {
  color: var(--muted);
  font-weight: 700;
}

.action-bar {
  margin-top: 20px;
}

.primary,
.secondary,
.text-button,
.button-link {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 800;
  line-height: 1;
  text-decoration: none;
}

.primary {
  color: #ffffff;
  background: var(--primary);
}

.primary:hover {
  background: var(--primary-hover);
}

.secondary {
  color: #31434a;
  border-color: var(--line-strong);
  background: var(--surface);
}

.secondary:hover {
  border-color: #8fa2a9;
  background: var(--surface-soft);
}

.secondary.danger {
  color: var(--danger);
  border-color: #e7bbb6;
}

.secondary.danger:hover {
  background: var(--danger-soft);
}

.text-button {
  min-height: 34px;
  padding: 0 6px;
  color: var(--blue);
  background: transparent;
}

.text-button:hover {
  text-decoration: underline;
}

button:disabled,
.disabled {
  opacity: 0.48;
  pointer-events: none;
  cursor: not-allowed;
}

.operation-status {
  min-height: 34px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 12px;
}

.operation-status .error {
  color: var(--danger);
  font-weight: 700;
}

.status-badge {
  min-height: 26px;
  display: inline-flex;
  align-items: center;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.status-badge.neutral {
  color: #56666c;
  background: #edf1f2;
}

.status-badge.running {
  color: #1e4e9e;
  background: var(--blue-soft);
}

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

.status-badge.error {
  color: var(--danger);
  background: var(--danger-soft);
}

.step-log {
  height: 310px;
  margin-top: 16px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfcfc;
}

.step-item {
  display: grid;
  grid-template-columns: 58px 46px minmax(105px, 0.6fr) minmax(160px, 1.4fr);
  gap: 9px;
  align-items: start;
  padding: 10px 11px;
  border-bottom: 1px solid #e9eef0;
  font-size: 11px;
  line-height: 1.5;
}

.step-item:last-child {
  border-bottom: 0;
}

.step-time {
  color: #8a989d;
  font-variant-numeric: tabular-nums;
}

.step-name {
  color: #2d3e44;
  font-weight: 700;
}

.step-detail {
  color: var(--muted);
  overflow-wrap: anywhere;
}

.step-status-ok,
.step-status-info,
.step-status-fail,
.step-status-warn {
  font-weight: 800;
}

.step-status-ok {
  color: var(--primary);
}

.step-status-info {
  color: var(--blue);
}

.step-status-fail {
  color: var(--danger);
}

.step-status-warn {
  color: var(--warn);
}

.step-log > .step-detail {
  display: grid;
  min-height: 100%;
  place-items: center;
  padding: 24px;
  text-align: center;
}

.result-empty {
  min-height: 338px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  margin-top: 16px;
  color: var(--muted);
  text-align: center;
}

.result-empty strong {
  color: #405158;
  font-size: 14px;
}

.result-empty span {
  font-size: 12px;
}

.empty-qr {
  width: 132px;
  height: 132px;
  margin-bottom: 7px;
  border: 1px dashed #bcc9cd;
  border-radius: 6px;
  background: #f6f8f9;
}

.result-content {
  margin-top: 16px;
}

.qr-result {
  display: grid;
  grid-template-columns: minmax(210px, 260px) minmax(130px, 1fr);
  align-items: start;
  gap: 18px;
}

.qr-frame {
  width: 100%;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

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

.qr-placeholder {
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.qr-actions {
  align-content: start;
}

.qr-actions > * {
  width: 100%;
}

.result-details {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.result-note {
  min-height: 34px;
  display: flex;
  align-items: center;
  padding: 7px 10px;
  border-left: 3px solid var(--primary);
  color: #28543e;
  background: var(--primary-soft);
  font-size: 12px;
}

.result-row {
  display: grid;
  gap: 5px;
}

.result-row > span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.result-row code {
  max-height: 116px;
  overflow: auto;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 5px;
  color: #31434a;
  background: var(--surface-soft);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11px;
  line-height: 1.5;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.raw-details {
  border-top: 1px solid var(--line);
}

.raw-details[open] {
  display: grid;
  gap: 10px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.stat-card {
  min-height: 132px;
  display: grid;
  align-content: center;
  gap: 6px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.stat-card span,
.stat-card small {
  color: var(--muted);
  font-size: 12px;
}

.stat-card strong {
  color: var(--ink);
  font-size: 27px;
  line-height: 1.15;
}

.recent-panel {
  min-height: 320px;
}

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

.mail-list,
.register-list,
.account-list {
  margin-top: 16px;
}

.account-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 150px;
  gap: 10px;
  margin-top: 16px;
}

.mail-message-box,
.register-job-box {
  display: grid;
  gap: 10px;
  margin-top: 16px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: #35464c;
  background: var(--surface-soft);
  font-size: 12px;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.register-job-box:empty {
  display: none;
}

.mail-message-item {
  display: grid;
  gap: 4px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.mail-message-item:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.mail-message-item strong {
  color: var(--ink);
}

.token-transfer {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.token-transfer textarea {
  min-height: 120px;
}

.token-transfer button {
  width: max-content;
}

.task-row {
  min-height: 70px;
  display: grid;
  grid-template-columns: minmax(160px, 1.1fr) minmax(220px, 1.5fr) minmax(125px, 0.7fr) minmax(255px, auto);
  align-items: center;
  gap: 14px;
  padding: 12px 4px;
  border-bottom: 1px solid var(--line);
}

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

.task-primary,
.task-link,
.task-time {
  min-width: 0;
}

.task-primary {
  display: grid;
  gap: 4px;
}

.task-primary strong {
  font-size: 13px;
}

.task-primary span,
.task-link,
.task-time {
  color: var(--muted);
  font-size: 12px;
}

.task-link {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.task-actions {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 6px;
}

.task-actions button,
.task-actions a {
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 5px;
  color: #3b4d53;
  background: var(--surface);
  cursor: pointer;
  font-size: 11px;
  font-weight: 700;
  text-decoration: none;
}

.task-actions button:hover,
.task-actions a:hover {
  border-color: #8fa2a9;
  background: var(--surface-soft);
}

.task-actions .delete-task {
  color: var(--danger);
}

.history-columns {
  display: grid;
  grid-template-columns: minmax(160px, 1.1fr) minmax(220px, 1.5fr) minmax(125px, 0.7fr) minmax(255px, auto);
  gap: 14px;
  padding: 0 4px 11px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.empty-state {
  min-height: 220px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  color: var(--muted);
  text-align: center;
}

.empty-state strong {
  color: #405158;
}

@media (max-width: 1180px) {
  .workspace-grid {
    grid-template-columns: minmax(0, 1fr);
  }

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

  .side-column {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    align-items: start;
  }

  .step-log {
    height: 420px;
  }

  .task-row,
  .history-columns {
    grid-template-columns: minmax(150px, 1fr) minmax(190px, 1.2fr) 120px minmax(225px, auto);
  }
}

@media (max-width: 900px) {
  .global-mode-bar {
    height: 220px;
    padding: 12px 12px 8px;
  }

  .global-mode-switch {
    height: 200px;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-template-rows: repeat(5, 40px);
    grid-auto-rows: 40px;
  }

  .global-mode-switch a {
    height: 40px;
  }

  .global-mode-switch a:nth-child(3n + 1) {
    border-left: 0;
  }

  .global-mode-switch a:nth-child(n + 4) {
    border-top: 1px solid #b8ad99;
  }

  .app-shell {
    display: block;
  }

  .sidebar {
    position: sticky;
    z-index: 50;
    top: 0;
    width: 100%;
    height: auto;
    display: grid;
    grid-template-columns: minmax(190px, auto) 1fr;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
  }

  .brand {
    min-height: 44px;
    padding: 0;
  }

  .brand-mark {
    width: 34px;
    height: 34px;
  }

  .service-state,
  .sidebar-spacer {
    display: none;
  }

  .primary-nav {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    justify-self: end;
    gap: 4px;
  }

  .nav-item {
    min-height: 38px;
    justify-content: center;
    padding: 0 8px;
    border-left: 0;
    border-bottom: 2px solid transparent;
    text-align: center;
    white-space: nowrap;
  }

  .nav-item.active {
    border-left-color: transparent;
    border-bottom-color: #44d58b;
  }

  .topbar {
    min-height: 72px;
  }

  .side-column {
    grid-template-columns: minmax(0, 1fr);
  }

  .step-log {
    height: 310px;
  }

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

  .history-columns {
    display: none;
  }

  .task-row {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px 14px;
  }

  .task-primary,
  .task-link {
    grid-column: 1;
  }

  .task-time,
  .task-actions {
    grid-column: 2;
  }

  .task-time {
    grid-row: 1;
    text-align: right;
  }

  .task-actions {
    grid-row: 2 / span 2;
    max-width: 230px;
  }
}

@media (max-width: 680px) {
  .sidebar {
    grid-template-columns: 1fr;
    padding: 9px 12px 7px;
  }

  .brand {
    display: none;
  }

  .primary-nav {
    width: 100%;
    justify-self: stretch;
  }

  .nav-item {
    padding: 0 4px;
    font-size: 11px;
  }

  .topbar {
    min-height: 66px;
    align-items: flex-start;
    flex-wrap: wrap;
    padding: 12px 16px;
  }

  .topbar-actions {
    width: 100%;
    justify-content: space-between;
  }

  .topbar h1 {
    font-size: 19px;
  }

  .topbar-state {
    min-height: 32px;
    padding: 0 9px;
    font-size: 11px;
  }

  .content {
    padding: 18px 12px 34px;
  }

  .section-heading {
    align-items: flex-end;
  }

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

  .workflow-strip {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
    padding: 10px;
  }

  .workflow-line {
    display: none;
  }

  .workflow-step {
    align-items: flex-start;
    gap: 7px;
  }

  .workflow-step > span {
    width: 26px;
    height: 26px;
  }

  .workflow-step small {
    display: none;
  }

  .workflow-step strong {
    white-space: normal;
    line-height: 1.35;
  }

  .form-panel,
  .runtime-panel,
  .result-panel,
  .recent-panel,
  .history-panel {
    padding: 16px;
  }

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

  .field-wide {
    grid-column: auto;
  }

  textarea {
    min-height: 132px;
  }

  .security-label {
    max-width: 116px;
  }

  .proxy-chain-row {
    grid-template-columns: minmax(0, 1fr);
  }

  .chain-arrow {
    display: none;
  }

  .action-bar > button {
    flex: 1 1 calc(50% - 6px);
  }

  .action-bar > .primary {
    flex-basis: 100%;
  }

  .step-item {
    grid-template-columns: 50px 40px minmax(0, 1fr);
  }

  .step-detail {
    grid-column: 1 / -1;
    padding-left: 90px;
  }

  .step-log > .step-detail {
    padding: 24px;
  }

  .qr-result {
    grid-template-columns: minmax(0, 1fr);
  }

  .qr-frame {
    width: min(100%, 290px);
    justify-self: center;
  }

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

  .qr-actions > * {
    width: auto;
  }

  .qr-actions > .primary {
    grid-column: 1 / -1;
  }

  .stats-grid {
    gap: 10px;
  }

  .stat-card {
    min-height: 112px;
    padding: 14px;
  }

  .stat-card strong {
    font-size: 23px;
  }

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

  .token-transfer button {
    width: 100%;
  }

  .task-primary,
  .task-link,
  .task-time,
  .task-actions {
    grid-column: 1;
    grid-row: auto;
    text-align: left;
  }

  .task-actions {
    max-width: none;
    justify-content: flex-start;
  }

  .heading-actions {
    justify-content: flex-end;
  }

  .heading-actions .primary {
    display: none;
  }
}

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