:root {
  color-scheme: dark;
  --black: #070707;
  --ink: #0d0d0d;
  --panel: #141414;
  --panel-2: #1b1b1b;
  --line: #2c2c2c;
  --line-strong: #414141;
  --text: #eeeeea;
  --soft: #c9c9c1;
  --muted: #888880;
  --dim: #63635e;
  --gold: #d6bd78;
  --gold-hover: #f0ddb0;
  --green: #65d28a;
  --orange: #e8a346;
  --red: #e35d4f;
  --blue: #73a7ff;
}

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

html { width: 100%; min-width: 0; overflow-x: hidden; overflow-x: clip; }

body {
  width: 100%;
  min-width: 0;
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  overflow-x: clip;
  background: var(--black);
  color: var(--text);
  font-size: 16px;
  font-family: "Microsoft YaHei UI", "Segoe UI", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

button, input, textarea, select { font: inherit; }
button { border: 0; }
h1, h2, h3, p { margin: 0; }

button:focus-visible,
a:focus-visible,
input[type="checkbox"]:focus-visible,
input[type="radio"]:focus-visible {
  outline: 2px solid var(--gold-hover);
  outline-offset: 3px;
}

.login-page {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 21px;
  background: var(--black);
}

.login-panel {
  width: min(390px, 100%);
  max-height: calc(100dvh - 24px);
  padding: 34px 32px 30px;
  overflow-y: auto;
  overscroll-behavior: contain;
  border-radius: 18px;
  background: var(--panel);
}

.login-panel h1 {
  margin-bottom: 12px;
  font-size: 24px;
  font-weight: 700;
}

.login-panel p {
  margin-bottom: 26px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.7;
}

.login-panel input {
  width: 100%;
  height: 42px;
  padding: 0 15px;
  border: 1px solid transparent;
  border-radius: 14px;
  outline: 0;
  background: var(--ink);
  color: var(--text);
  font-size: 15px;
}

.login-panel .primary-button {
  width: 100%;
  margin-top: 14px;
}

.login-error {
  min-height: 18px;
  display: block;
  margin-top: 12px;
  color: var(--gold-hover);
  font-size: 13px;
}

.app-shell {
  width: 100%;
  max-width: 1440px;
  min-width: 0;
  margin: 0 auto;
  padding: 0 36px 28px;
}

.topbar {
  min-height: 112px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding-top: 14px;
  border-bottom: 1px solid #202020;
}

.brand {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  border-radius: 8px;
  text-decoration: none;
}

.brand-logo {
  display: block;
  width: 280px;
  max-width: 100%;
  height: auto;
}

.top-actions,
.section-title-row,
.dialog-actions {
  display: flex;
  align-items: center;
}

.top-actions { flex: 0 0 auto; gap: 8px; }

.refresh-state {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
}

.refresh-state i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--dim);
}

.refresh-state.is-live i { background: var(--green); }
.refresh-state.is-error { color: var(--red); }
.refresh-state.is-error i { background: var(--red); }

.icon-button,
.plain-button,
.add-button,
.primary-button,
.secondary-button,
.card-icon-button,
.edit-button,
.trash-button,
.page-button,
.danger-button,
.cancel-button {
  border-radius: 10px;
  cursor: pointer;
  font-weight: 700;
  transition: background .16s ease, border-color .16s ease, color .16s ease, opacity .16s ease, transform .16s ease;
}

button:disabled { opacity: .45; cursor: not-allowed; }

.icon-button {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--soft);
}

.icon-button svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.icon-button:hover { background: transparent; color: var(--gold-hover); transform: translateY(-1px); }
.icon-button:active { transform: scale(.92); }
.icon-button.is-spinning svg { animation: spin .75s linear infinite; }

.plain-button {
  padding: 7px 8px;
  background: transparent;
  color: var(--muted);
}

.plain-button:hover { color: var(--gold-hover); }

main { padding-top: 42px; }
.section + .section { margin-top: 64px; }

.overview {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 56px;
}

.overview-card {
  --card-accent: var(--gold);
  position: relative;
  isolation: isolate;
  min-width: 0;
  min-height: 100px;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  grid-template-rows: 1fr;
  column-gap: 14px;
  padding: 17px 18px 15px;
  overflow: hidden;
  border: 1px solid var(--line);
  border: 1px solid color-mix(in srgb, var(--card-accent) 17%, var(--line));
  border-radius: 15px;
  background: var(--panel);
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--card-accent) 7%, transparent), transparent 50%),
    linear-gradient(180deg, #171717, #121212);
  box-shadow: inset 0 1px 0 #ffffff07, 0 12px 28px #00000024;
}

.overview-card::before {
  position: absolute;
  z-index: 2;
  inset: 0 18px auto;
  height: 1px;
  background: linear-gradient(90deg, var(--card-accent), transparent 78%);
  content: "";
  opacity: .45;
}

.overview-card::after {
  position: absolute;
  z-index: 0;
  top: -58px;
  right: -42px;
  width: 126px;
  height: 126px;
  border-radius: 50%;
  background: var(--card-accent);
  content: "";
  filter: blur(54px);
  opacity: .06;
  pointer-events: none;
}

.overview-card.is-online { --card-accent: var(--green); }
.overview-card.is-jobs { --card-accent: var(--gold); }
.overview-card.is-reserve { --card-accent: var(--orange); }
.overview-card.is-workflow { --card-accent: var(--blue); }

.overview-card > * { position: relative; z-index: 1; }

.overview-symbol {
  width: 44px;
  height: 44px;
  align-self: center;
  display: grid;
  place-items: center;
  border: 1px solid #3d382a;
  border: 1px solid color-mix(in srgb, var(--card-accent) 36%, transparent);
  border-radius: 14px;
  background: #12110e;
  background: color-mix(in srgb, var(--card-accent) 10%, var(--ink));
  color: var(--card-accent);
  box-shadow: inset 0 0 16px color-mix(in srgb, var(--card-accent) 5%, transparent);
}

.overview-symbol svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
  filter: drop-shadow(0 0 6px color-mix(in srgb, var(--card-accent) 38%, transparent));
}

.overview-copy {
  min-width: 0;
  align-self: center;
  display: flex;
  align-items: flex-start;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
}

.overview-card small {
  overflow: hidden;
  color: var(--soft);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: .02em;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.overview-card strong {
  align-self: center;
  justify-self: end;
  margin-right: 16px;
  color: var(--gold-hover);
  font: 700 32px/1 "Bahnschrift", "Segoe UI", sans-serif;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.035em;
  text-shadow: 0 0 18px color-mix(in srgb, var(--gold) 18%, transparent);
  white-space: nowrap;
}

.overview-card em {
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  letter-spacing: .02em;
  line-height: 1.4;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.section-header {
  min-height: 38px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 15px;
}

.section-title-row { min-width: 0; gap: 9px; }
.section-title-row h1, .section-title-row h2 { font-size: 23px; letter-spacing: -.02em; }

.count-badge {
  min-width: 26px;
  height: 24px;
  display: inline-grid;
  place-items: center;
  padding: 0 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font: 700 12px/1 "Bahnschrift", "Segoe UI", sans-serif;
}

.add-button {
  height: 35px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0 11px;
  border: 1px solid #51482f;
  background: #1d1a12;
  color: var(--gold-hover);
  font-size: 13px;
}

.add-button:hover { border-color: var(--gold); background: #272217; }

.global-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}

.global-action-button {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid #38342a;
  border-radius: 9px;
  background: #171510;
  color: var(--gold);
}

.global-action-button svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
  transform-box: fill-box;
  transform-origin: center;
}

.global-action-button:hover:not(:disabled) {
  border-color: #6d603d;
  background: #211d14;
  color: var(--gold-hover);
}

.global-action-button.is-loading.restart svg { animation: spin .75s linear infinite; }
.global-action-button.is-loading.memory svg { animation: memoryRelease .85s ease-in-out infinite; }
.global-action-button.is-loading.probe svg { animation: probeSignal .85s ease-in-out infinite; }

.backend-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(330px, 100%), 1fr));
  justify-content: start;
  gap: 12px;
}

.compute-card {
  --state-color: var(--red);
  position: relative;
  isolation: isolate;
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
  transition: background .18s ease, border-color .18s ease, opacity .18s ease;
}

.compute-card.is-running { --state-color: var(--green); }
.compute-card.is-starting { --state-color: var(--orange); }
.compute-card.is-stopped { --state-color: var(--red); }
.compute-card:not(.is-running),
.compute-card.is-unscheduled {
  border-color: #1e1e1e;
  background: #0b0b0b;
}

.compute-card:not(.is-running) .card-main,
.compute-card:not(.is-running) .card-footer,
.compute-card.is-unscheduled .card-main,
.compute-card.is-unscheduled .card-footer {
  opacity: .46;
  filter: grayscale(.78) saturate(.5) brightness(.72);
  transition: filter .18s ease, opacity .18s ease;
}

.card-action-overlay {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 18px;
  border-radius: inherit;
  background: rgba(5, 5, 5, .93);
  box-shadow: inset 0 0 0 1px rgba(214, 189, 120, .12);
}

.card-action-overlay.is-closing { animation: cardOverlayOut .22s ease both; }

.card-action-content {
  width: min(290px, 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.card-action-icon {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  margin-bottom: 10px;
  border: 1px solid #665936;
  border-radius: 50%;
  background: #1b1710;
  color: var(--gold-hover);
  box-shadow: 0 0 24px rgba(214, 189, 120, .12);
}

.card-action-icon svg {
  width: 25px;
  height: 25px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
  transform-box: fill-box;
  transform-origin: center;
}

.card-action-overlay.is-working .card-action-icon.is-restart svg { animation: spin .75s linear infinite; }
.card-action-overlay.is-working .card-action-icon.is-memory svg { animation: memoryRelease .85s ease-in-out infinite; }
.card-action-overlay.is-working .card-action-icon.is-probe svg { animation: probeSignal .85s ease-in-out infinite; }
.card-action-overlay.is-success .card-action-icon { border-color: #315b3f; background: #102018; color: var(--green); }
.card-action-overlay.is-error .card-action-icon { border-color: #67312b; background: #251412; color: #ef8d82; }

.card-action-content small {
  margin-bottom: 4px;
  color: var(--dim);
  font-size: 11px;
  letter-spacing: .12em;
}

.card-action-content strong {
  color: var(--text);
  font-size: 16px;
  line-height: 1.4;
}

.card-action-content > span:last-child {
  max-width: 100%;
  max-height: 4.2em;
  margin-top: 5px;
  overflow: auto;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.card-main { padding: 14px 14px 12px; }

.card-command-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) repeat(3, 30px) auto;
  align-items: center;
  gap: 5px;
}

.environment-identity {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 9px;
}

.environment-activity-rotor {
  position: relative;
  width: 48px;
  height: 48px;
  flex: 0 0 48px;
  display: block;
  transform-origin: center center;
}

.environment-activity-icon {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
}

.environment-activity-rotor.is-spin-idle,
.environment-activity-rotor.is-spin-slow,
.environment-activity-rotor.is-spin-medium,
.environment-activity-rotor.is-spin-fast { will-change: transform; }

.environment-copy {
  min-width: 0;
  min-height: 48px;
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  justify-content: center;
  gap: 8px;
}

.environment-name {
  width: 100%;
  flex: 0 1 auto;
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
  color: var(--text);
  font-size: 16px;
  font-weight: 700;
  text-decoration: none;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.environment-name:hover { color: var(--gold-hover); }

.card-icon-button {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--soft);
}

.card-icon-button svg,
.edit-button svg,
.trash-button svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

.card-icon-button:hover { background: #211d14; color: var(--gold-hover); }
.lifecycle-status {
  min-width: 59px;
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  color: var(--soft);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.status-dot {
  width: 10px;
  height: 10px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--state-color);
  box-shadow: 0 0 11px var(--state-color);
}

.is-starting .status-dot { animation: pulse 1s ease-in-out infinite; }

.switch {
  position: relative;
  flex: 0 0 auto;
  width: 37px;
  height: 30px;
  display: inline-grid;
  place-items: center;
}

.switch input { position: absolute; width: 1px; height: 1px; opacity: 0; }

.switch-track {
  position: relative;
  width: 34px;
  height: 19px;
  display: block;
  border: 1px solid #414141;
  border-radius: 999px;
  background: #222;
  cursor: pointer;
  transition: .18s ease;
}

.switch-track::after {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #888880;
  content: "";
  transition: .18s ease;
}

.switch input:checked + .switch-track { border-color: #73643c; background: #332d1d; }
.switch input:checked + .switch-track::after { background: var(--gold-hover); transform: translateX(15px); }
.switch input:focus-visible + .switch-track { outline: 2px solid var(--gold-hover); outline-offset: 3px; }

.task-summary {
  display: flex;
  align-items: baseline;
  gap: 7px;
  min-width: 0;
  margin-top: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.15;
}

.task-summary strong {
  color: var(--text);
  font: 700 26px/1 "Bahnschrift", "Segoe UI", sans-serif;
  font-variant-numeric: tabular-nums;
}

.task-summary span + span { color: var(--dim); }

.task-summary-breakdown {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
}

.task-summary-breakdown > span {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  white-space: nowrap;
}

.task-summary-breakdown i {
  color: #50504b;
  font-style: normal;
}

.task-summary-number {
  color: var(--gold-hover);
  font: 700 17px/1 "Bahnschrift", "Segoe UI", sans-serif;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 12px color-mix(in srgb, var(--gold) 14%, transparent);
}

.resource-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
  margin-top: 17px;
}

.resource-item {
  min-width: 0;
  min-height: 68px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 12px 10px;
  border: 0;
  border-radius: 10px;
  background: var(--ink);
}

.resource-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.resource-head span { color: var(--muted); font-size: 12px; }
.resource-head strong { max-width: 100%; overflow: hidden; color: var(--soft); font: 700 12px/1.2 "Bahnschrift", "Segoe UI", sans-serif; text-overflow: ellipsis; white-space: nowrap; }

.meter {
  height: 6px;
  overflow: hidden;
  margin-top: 7px;
  border-radius: 99px;
  background: #292929;
}

.meter i {
  width: clamp(0%, calc(var(--progress, 0) * 1%), 100%);
  height: 100%;
  display: block;
  border-radius: inherit;
  background: var(--gold);
}

.card-footer {
  min-height: 42px;
  display: grid;
  grid-template-columns: 37px minmax(0, 1fr) auto;
  align-items: center;
  gap: 7px;
  padding: 0 13px;
  border-top: 1px solid var(--line);
  background: #101010;
}

.backend-address {
  min-width: 0;
  overflow: hidden;
  color: var(--dim);
  font: 11px/1.2 "Cascadia Mono", Consolas, monospace;
  text-decoration: none;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.backend-address:hover { color: var(--gold-hover); }

.card-footer-actions {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 3px;
}

.edit-button,
.trash-button {
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  padding: 0;
  background: transparent;
}

.edit-button { color: var(--muted); }
.edit-button:hover { background: #211d14; color: var(--gold-hover); }

.trash-button {
  color: #9c5a53;
}

.trash-button:hover { background: #281412; color: #ef8d82; }

.empty-panel,
.empty-state {
  display: grid;
  place-content: center;
  min-height: 135px;
  padding: 25px;
  color: var(--muted);
  text-align: center;
}

.empty-panel { grid-column: 1 / -1; border: 1px dashed var(--line); border-radius: 14px; }
.empty-panel strong, .empty-state strong { color: var(--soft); font-size: 14px; }
.empty-panel p, .empty-state p { margin-top: 6px; font-size: 12px; }

select, input, textarea {
  border: 1px solid #323232;
  border-radius: 9px;
  outline: none;
  background: var(--ink);
  color: var(--text);
}

select { color-scheme: dark; }

select option {
  background-color: var(--ink);
  color: var(--soft);
}

select option:checked {
  background: #292416 linear-gradient(#292416, #292416);
  color: var(--gold-hover);
}

select option:hover,
select option:focus {
  background: #211d14 linear-gradient(#211d14, #211d14);
  color: var(--gold-hover);
}

select:focus,
input:focus,
textarea:focus {
  border-color: #76683f;
  outline: none;
  box-shadow: none;
}

.themed-select {
  position: relative;
}

.environment-select {
  flex: 0 0 auto;
  width: 154px;
}

.page-size-select {
  flex: 0 0 auto;
  width: 66px;
}

.themed-select-button {
  width: 100%;
  height: 35px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 11px;
  border: 1px solid #51482f;
  border-radius: 10px;
  outline: none;
  background: #13110d;
  color: var(--soft);
  font-size: 13px;
  cursor: pointer;
  transition: border-color .16s ease, background .16s ease, box-shadow .16s ease;
}

.themed-select-button:hover {
  border-color: #75663d;
  background: #19160f;
  color: var(--gold-hover);
}

.themed-select-button:focus-visible,
.themed-select.is-open .themed-select-button {
  border-color: var(--gold);
  outline: none;
  background: #1c1810;
  box-shadow: none;
  color: var(--gold-hover);
}

.themed-select-value {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.themed-select-chevron {
  flex: 0 0 auto;
  width: 7px;
  height: 7px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: translateY(-2px) rotate(45deg);
  transition: transform .16s ease;
}

.themed-select.is-open .themed-select-chevron {
  transform: translateY(2px) rotate(225deg);
}

.themed-select-menu {
  position: absolute;
  z-index: 40;
  top: calc(100% + 6px);
  left: 0;
  width: max-content;
  min-width: 100%;
  max-width: min(280px, calc(100vw - 30px));
  max-height: 240px;
  display: grid;
  gap: 3px;
  padding: 5px;
  overflow-y: auto;
  border: 1px solid #665936;
  border-radius: 12px;
  background: #12110e;
  box-shadow: 0 18px 42px #000c;
}

.page-size-select .themed-select-menu {
  top: auto;
  right: 0;
  bottom: calc(100% + 6px);
  left: auto;
  min-width: 82px;
}

.themed-select-option {
  max-width: 100%;
  min-width: 0;
  min-height: 34px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 10px;
  border: 1px solid transparent;
  border-radius: 8px;
  outline: none;
  background: transparent;
  color: var(--soft);
  font-size: 13px;
  line-height: 1.3;
  text-align: left;
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
  cursor: pointer;
}

.themed-select-option:hover,
.themed-select-option:focus-visible {
  border-color: #4f452b;
  outline: none;
  background: #292416;
  color: var(--gold-hover);
}

.themed-select-option.is-selected {
  border-color: var(--gold-hover);
  background: var(--gold-hover);
  color: #17130b;
  font-weight: 700;
}

.themed-select-option.is-selected::after {
  margin-left: auto;
  content: "✓";
  font-size: 12px;
}

.themed-select-option.is-selected:hover,
.themed-select-option.is-selected:focus-visible {
  border-color: #fff4d3;
  background: #f5e5bd;
  color: #17130b;
}

.table-shell {
  width: 100%;
  max-width: 100%;
  min-height: 128px;
  overflow: visible;
  contain: inline-size paint;
  border: 0;
  border-radius: 0;
  background: transparent;
}

table { width: 100%; min-width: 0; border-collapse: collapse; }
.task-table { table-layout: auto; }
th, td { padding: 9px 10px; border-bottom: 0; text-align: left; vertical-align: middle; }
th { color: var(--gold-hover); font-size: 13px; font-weight: 700; letter-spacing: .02em; white-space: nowrap; }
td { color: var(--muted); font: 500 13px/1.45 "Microsoft YaHei UI", "Segoe UI", sans-serif; }
tbody tr:last-child td { border-bottom: 0; }

@media (min-width: 961px) {
  .task-table,
  .task-table thead,
  .task-table tbody { display: block; }

  .task-table tr {
    display: grid;
    grid-template-columns:
      minmax(88px, .8fr)
      minmax(86px, .75fr)
      minmax(180px, 1.55fr)
      minmax(74px, .65fr)
      minmax(142px, 1.15fr)
      minmax(190px, 1.55fr);
    column-gap: 14px;
    padding: 0 12px;
    border-bottom: 1px solid #191919;
    background: transparent;
  }

  .task-table th,
  .task-table td {
    min-width: 0;
    padding: 10px 0;
    border-bottom: 0;
  }

  .task-table .task-id {
    display: block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .task-table tbody tr:last-child { border-bottom: 0; }
}

.task-environment,
.workflow-name {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.task-environment,
.task-environment.is-unassigned,
.workflow-name { color: inherit; font: inherit; }

.status-badge {
  --status-color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 7px;
  border-radius: 999px;
  background: #1b1b1b;
  color: inherit;
  font: inherit;
  white-space: nowrap;
}

.status-badge::before { width: 5px; height: 5px; border-radius: 50%; background: var(--status-color); content: ""; }
.status-badge,
.cancel-button { flex: 0 0 auto; }
.status-badge.completed { --status-color: #92dfad; background: #112219; }
.status-badge.failed, .status-badge.cancelled { --status-color: #ef8d82; background: #281412; }
.status-badge.in_progress, .status-badge.uploading { --status-color: var(--blue); background: #121e32; }

.task-status-cell {
  min-width: 0;
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 6px;
}

.task-error-summary {
  display: block;
  min-width: 0;
  flex: 1 1 auto;
  overflow: hidden;
  color: inherit;
  font: inherit;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.task-error-summary:focus-visible {
  outline: 1px solid var(--gold-hover);
  outline-offset: 2px;
}

.task-error-tooltip {
  position: fixed;
  z-index: 120;
  width: min(390px, calc(100vw - 24px));
  max-height: min(420px, calc(100dvh - 24px));
  padding: 12px 14px;
  overflow-y: auto;
  border: 1px solid #554938;
  border-radius: 8px;
  background: linear-gradient(145deg, #1a1814, #11100e);
  box-shadow: 0 18px 48px #000d, inset 0 1px 0 #ffffff08;
  pointer-events: none;
}

.task-error-tooltip strong {
  display: block;
  margin-bottom: 6px;
  color: var(--gold-hover);
  font-size: 12px;
  letter-spacing: .08em;
}

.task-error-tooltip p {
  margin: 0;
  color: #b5b2a9;
  font: 13px/1.65 "Cascadia Mono", Consolas, monospace;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.task-id { display: inline-block; max-width: none; overflow: visible; color: inherit; font: inherit; text-overflow: clip; white-space: nowrap; }
.task-time, .duration { white-space: nowrap; }
.task-time, .duration { color: inherit; font: inherit; }
.cancel-button { padding: 5px 7px; background: transparent; color: inherit; font: inherit; }
.cancel-button:hover { background: #281412; }

.task-pagination {
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 10px;
  color: var(--dim);
  font-size: 12px;
}

.page-size-label,
.page-controls { display: flex; align-items: center; gap: 8px; }

.page-button {
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--muted);
  font-size: 12px;
}

.page-button:hover:not(:disabled) { border-color: #5c5135; color: var(--gold-hover); }

.page-footer {
  display: flex;
  justify-content: space-between;
  margin-top: 28px;
  padding-top: 16px;
  border-top: 1px solid #1e1e1e;
  color: var(--dim);
  font-size: 11px;
}

.primary-button {
  min-height: 42px;
  padding: 0 17px;
  background: var(--gold);
  color: var(--black);
}

.primary-button:hover { background: var(--gold-hover); }
.secondary-button { min-height: 42px; padding: 0 16px; border: 1px solid #363636; background: var(--panel-2); color: var(--soft); }
.secondary-button:hover { border-color: #525252; }

dialog {
  width: min(540px, calc(100vw - 28px));
  max-height: calc(100dvh - 24px);
  padding: 0;
  overflow: hidden;
  border: 1px solid #303030;
  border-radius: 17px;
  background: #111;
  color: var(--text);
  box-shadow: 0 35px 100px #000b;
}

dialog::backdrop { background: #030303d9; backdrop-filter: blur(5px); }
dialog > form,
.settings-dialog-body {
  max-height: calc(100dvh - 26px);
  padding: 24px;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 15px; }
.dialog-head h2 { font-size: 21px; }
.dialog-close { width: 30px; height: 30px; padding: 0; border-radius: 8px; background: transparent; color: var(--muted); cursor: pointer; font-size: 21px; }
.dialog-close:hover { background: #222; color: var(--text); }
.dialog-copy { margin: 9px 0 20px; color: var(--muted); font-size: 13px; }
#settingsDialog {
  width: min(520px, calc(100vw - 28px));
  border-color: #292929;
  background: linear-gradient(180deg, #12110f 0, #101010 120px);
}
.settings-dialog-body > .dialog-head { align-items: flex-start; }
.settings-dialog-body > .dialog-head .dialog-copy { margin: 4px 0 0; }
.settings-dialog-body > .dialog-head h2 { display: flex; align-items: center; gap: 9px; }
.settings-dialog-body > .dialog-head h2::before {
  width: 3px;
  height: 16px;
  border-radius: 2px;
  background: var(--gold);
  content: "";
}
.settings-sections { margin-top: 14px; }
.settings-section {
  position: relative;
  padding: 20px 0;
}
.settings-section + .settings-section { border-top: 1px solid #292929; }
.settings-section + .settings-section::before {
  position: absolute;
  top: -1px;
  left: 0;
  width: 34px;
  height: 1px;
  background: linear-gradient(90deg, var(--gold), #6d603c);
  content: "";
}
.settings-section-head {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  min-width: 0;
}
.settings-section-head > div { min-width: 0; }
.settings-section-index {
  display: flex;
  align-items: center;
  gap: 5px;
  padding-top: 3px;
  color: #aa9865;
  font: 700 11px/1 "Bahnschrift", "Segoe UI", sans-serif;
  letter-spacing: .08em;
}
.settings-section-index::after { width: 7px; height: 1px; background: #4b422d; content: ""; }
.settings-section h3 { margin: 0 0 5px; color: var(--text); font-size: 15px; line-height: 1.25; letter-spacing: .01em; }
.settings-section-head p { margin: 0; color: #8d8d86; font-size: 12px; line-height: 1.55; }
.settings-section-head p strong { color: var(--gold-hover); font-variant-numeric: tabular-nums; }
.settings-section.is-refresh-section,
.settings-section.is-task-section {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  column-gap: 18px;
  align-items: center;
}
.settings-section.is-refresh-section > .settings-message,
.settings-section.is-task-section > .settings-inline-confirm,
.settings-section.is-task-section > .settings-message { grid-column: 1 / -1; }
.settings-section.is-refresh-section > .settings-message,
.settings-section.is-task-section > .settings-inline-confirm,
.settings-section.is-task-section > .settings-message { margin-left: 40px; }
.settings-control-row {
  display: grid;
  grid-template-columns: 112px auto;
  gap: 9px;
  align-items: center;
  margin: 0;
}
.number-input {
  height: 40px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--ink);
  overflow: hidden;
}
.number-input:focus-within { border-color: #76683f; }
.number-input input { width: 100%; height: 38px; padding: 0 8px 0 11px; border: 0; background: transparent; color: var(--text); font-variant-numeric: tabular-nums; }
.number-input input:focus { border: 0; box-shadow: none; }
.number-input em { padding: 0 11px 0 4px; color: var(--dim); font-size: 12px; font-style: normal; }
.settings-message { min-height: 18px; display: block; margin-top: 7px; color: var(--green); font-size: 12px; line-height: 1.55; }
.settings-message:empty { min-height: 0; margin-top: 0; }
.settings-message.is-error { color: #ef8d82; }
.settings-action-row { display: flex; justify-content: flex-end; margin: 0; }
.settings-action-button {
  width: 104px;
  min-width: 104px;
  height: 40px;
  min-height: 40px;
  display: inline-grid;
  place-items: center;
  padding: 0 12px;
  border: 1px solid #443d2b;
  border-radius: 9px;
  background: #171613;
  color: var(--gold);
  box-shadow: inset 0 1px 0 #ffffff05;
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: .03em;
  white-space: nowrap;
  transition: background .16s ease, border-color .16s ease, color .16s ease,
    opacity .16s ease, transform .16s ease;
}
.settings-action-button.is-gold:hover:not(:disabled) { border-color: #746641; background: #211d14; color: var(--gold-hover); }
.settings-action-button.is-danger { border-color: #50322f; background: #181313; color: #df8278; }
.settings-action-button.is-danger:hover:not(:disabled) { border-color: #77453f; background: #211413; color: #ffaaa0; }
.settings-action-button:focus-visible { outline: 2px solid #8b7949; outline-offset: 2px; }
.settings-action-button.is-danger:focus-visible { outline-color: #8b5049; }
.settings-action-button:active:not(:disabled) { transform: translateY(1px); }
.settings-inline-confirm {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
  margin-top: 12px;
  padding: 2px 0 2px 12px;
  border: 0;
  border-left: 2px solid #653832;
  border-radius: 0;
  background: transparent;
}
.settings-inline-confirm strong { display: block; color: #f3b2aa; font-size: 13px; }
.settings-inline-confirm p { margin: 4px 0 0; color: var(--muted); font-size: 11px; line-height: 1.55; }
.settings-confirm-actions { display: flex; flex: 0 0 auto; gap: 7px; }
.settings-password-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 12px; margin: 12px 0 0 40px; }
.settings-password-form .field { margin: 7px 0; }
.settings-password-form .is-full { grid-column: 1 / -1; }
.settings-password-actions { display: flex; justify-content: flex-end; margin-top: 4px; padding-top: 4px; }
.field { display: block; margin: 12px 0; color: var(--muted); font-size: 13px; }
.field > span { display: flex; justify-content: space-between; margin-bottom: 6px; }
.field em { color: var(--dim); font-size: 11px; font-style: normal; }
.field input { width: 100%; height: 40px; padding: 0 12px; }
.field textarea { width: 100%; padding: 10px 12px; resize: vertical; font: 13px/1.5 "Cascadia Mono", Consolas, monospace; }
.field-help { display: block; margin-top: 7px; color: var(--muted); font-size: 12px; line-height: 1.6; }
.dialog-error {
  min-height: 18px;
  display: block;
  margin-top: 10px;
  color: #ef8d82;
  font-size: 12px;
  line-height: 1.6;
}
.dialog-error:empty { min-height: 0; margin-top: 0; }
.field input[aria-invalid="true"] { border-color: var(--red); }
.secret-input { position: relative; display: block !important; margin: 0 !important; }
.secret-input input { padding-right: 45px; font-family: "Cascadia Mono", Consolas, monospace; }
.secret-toggle {
  position: absolute;
  top: 50%;
  right: 5px;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  padding: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--dim);
  transform: translateY(-50%);
}
.secret-toggle:hover { background: #211d14; color: var(--gold-hover); }
.secret-toggle:focus-visible { outline: 1px solid var(--gold-hover); outline-offset: 1px; }
.secret-toggle svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.secret-toggle .eye-closed { display: none; }
.secret-toggle.is-visible .eye-open { display: none; }
.secret-toggle.is-visible .eye-closed { display: block; }
.check-field { display: inline-flex; align-items: center; gap: 8px; margin-top: 3px; color: var(--muted); font-size: 13px; cursor: pointer; }
.check-field input { width: 14px; height: 14px; margin: 0; accent-color: var(--gold); }
.dialog-actions { justify-content: flex-end; gap: 9px; margin-top: 21px; padding-top: 17px; border-top: 1px solid var(--line); }

.confirm-popover {
  position: fixed;
  z-index: 95;
  width: min(310px, calc(100vw - 24px));
  max-height: calc(100dvh - 24px);
  padding: 15px;
  overflow-y: auto;
  overscroll-behavior: contain;
  border: 1px solid #54302c;
  border-radius: 12px;
  background: #15100f;
  color: var(--text);
  box-shadow: 0 22px 70px #000d;
}

.confirm-popover strong { display: block; font-size: 15px; }
.confirm-popover p { margin: 8px 0 13px; color: var(--muted); font-size: 12px; line-height: 1.65; }
.confirm-popover > div { display: flex; justify-content: flex-end; gap: 7px; }
.secondary-button.compact { min-height: 31px; padding: 0 11px; font-size: 12px; }

.danger-button {
  min-height: 31px;
  padding: 0 11px;
  background: #7a3029;
  color: #fff0ed;
  font-size: 12px;
}

.danger-button:hover { background: #9a3b32; }

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 80;
  max-width: min(380px, calc(100vw - 30px));
  padding: 11px 14px;
  border: 1px solid #414141;
  border-radius: 11px;
  background: var(--panel-2);
  color: var(--soft);
  box-shadow: 0 20px 60px #0009;
  font-size: 13px;
  overflow-wrap: anywhere;
  opacity: 0;
  pointer-events: none;
  transform: translateY(15px);
  transition: .18s ease;
}

.toast.show { opacity: 1; transform: none; }
.toast.is-error { border-color: #5a2b26; background: #271513; color: #ef8d82; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 50% { opacity: .45; transform: scale(.75); } }
@keyframes probeSignal {
  0%, 100% { transform: scale(.88); }
  50% { transform: scale(1.08); }
}
@keyframes memoryRelease {
  0%, 100% { transform: translateY(-1px) scale(.94); }
  50% { transform: translateY(1px) scale(1.04); }
}
@keyframes cardOverlayOut { to { opacity: 0; } }

@media (max-width: 1100px) {
  .app-shell { padding: 0 24px 26px; }
  .topbar { min-height: 100px; padding-top: 10px; }
  .brand-logo { width: 240px; }
  main { padding-top: 36px; }
  .overview { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .section + .section { margin-top: 56px; }
}

@media (max-width: 960px) {
  .icon-button,
  .global-action-button,
  .card-icon-button,
  .edit-button,
  .trash-button,
  .dialog-close,
  .secret-toggle {
    width: 40px;
    height: 40px;
  }

  .plain-button,
  .page-button { min-height: 40px; }
  .add-button,
  .themed-select-button { height: 40px; }
  .switch { width: 44px; height: 44px; }
  .card-command-row { grid-template-columns: minmax(0, 1fr) repeat(3, 40px); }
  .lifecycle-status { grid-column: 1 / -1; justify-self: end; }
  .task-summary { flex-wrap: wrap; }

  .table-shell { overflow: visible; contain: inline-size; }
  .task-table,
  .task-table tbody { display: block; min-width: 0; }
  .task-table thead { display: none; }
  .task-table tbody { display: grid; gap: 10px; }
  .task-table tr {
    position: relative;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 13px 18px;
    padding: 15px 16px;
    border: 1px solid #202020;
    border-radius: 12px;
    background: linear-gradient(180deg, #151515, #111);
  }
  .task-table tbody tr:last-child { border-bottom: 1px solid #202020; }
  .task-table td { min-width: 0; display: block; padding: 0; border: 0; }
  .task-table td::before {
    display: block;
    margin-bottom: 5px;
    color: var(--dim);
    font-size: 11px;
    letter-spacing: .04em;
    content: attr(data-label);
  }
  .task-table .task-id {
    display: block;
    max-width: 100%;
    overflow: visible;
    overflow-wrap: anywhere;
    line-height: 1.5;
    text-overflow: clip;
    white-space: normal;
  }
  .task-table .task-status-cell { flex-wrap: wrap; }
  .task-table .task-error-summary { flex-basis: 100%; white-space: normal; }
}

@media (max-width: 640px) {
  .app-shell { padding: 0 15px 24px; }
  .topbar { min-height: 88px; gap: 14px; padding-top: 8px; }
  .brand-logo { width: 168px; }
  .top-actions { gap: 6px; }
  .refresh-state span { display: none; }
  main { padding-top: 30px; }
  .overview { gap: 9px; margin-bottom: 44px; }
  .section + .section { margin-top: 52px; }
  .overview-card { min-height: 88px; grid-template-columns: 38px minmax(0, 1fr) auto; column-gap: 11px; padding: 14px; }
  .overview-symbol { width: 38px; height: 38px; border-radius: 12px; }
  .overview-card strong { margin-right: 8px; font-size: 29px; }
  .overview-card small { font-size: 13px; }
  .section-header { align-items: flex-start; flex-direction: column; gap: 8px; }
  .global-actions { width: 100%; justify-content: flex-end; }
  .section-title-row { width: 100%; flex-wrap: wrap; }
  .task-title-row .environment-select { flex: 1; min-width: 140px; max-width: 220px; }
  .backend-grid { grid-template-columns: minmax(0, 1fr); }
  .card-command-row { grid-template-columns: minmax(0, 1fr) repeat(3, 40px); }
  .task-table tbody { gap: 8px; }
  .task-table tr { grid-template-columns: minmax(80px, .75fr) minmax(0, 1.25fr); gap: 10px; padding: 13px; }
  .task-table td:nth-child(3),
  .task-table td:nth-child(6) { grid-column: 1 / -1; }
  .task-pagination { align-items: stretch; flex-direction: column; }
  .page-controls {
    width: 100%;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 8px;
  }
  .page-size-label { grid-column: 1 / -1; justify-self: start; }
  #previousPage { grid-column: 1; }
  #pageInfo { grid-column: 2; align-self: center; text-align: center; }
  #nextPage { grid-column: 3; }
  .page-footer { flex-wrap: wrap; gap: 8px 14px; }
  dialog { width: min(540px, calc(100vw - 20px)); border-radius: 14px; }
  dialog > form { padding: 18px; }
  .field input { height: 44px; font-size: 16px; }
  .field textarea { font-size: 16px; }
  .confirm-popover {
    right: 12px;
    bottom: max(12px, env(safe-area-inset-bottom));
    left: 12px !important;
    top: auto !important;
    width: auto;
  }
  .toast {
    right: 12px;
    bottom: max(12px, env(safe-area-inset-bottom));
    max-width: calc(100vw - 24px);
  }
}

@media (max-width: 420px) {
  .topbar { min-height: 82px; gap: 12px; }
  .brand-logo { width: 154px; }
  .overview-symbol { display: none; }
  .overview-card { grid-template-columns: minmax(0, 1fr) auto; column-gap: 8px; }
  .resource-grid { grid-template-columns: 1fr; }
  .dialog-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dialog-actions > button { width: 100%; }
  .confirm-popover > div > button { flex: 1 1 0; }
  .settings-dialog-body { padding: 18px 14px; }
  .settings-section { padding: 18px 0; }
  .settings-section.is-refresh-section,
  .settings-section.is-task-section { grid-template-columns: 1fr; }
  .settings-section.is-refresh-section > .settings-control-row,
  .settings-section.is-refresh-section > .settings-message,
  .settings-section.is-task-section > .settings-action-row,
  .settings-section.is-task-section > .settings-inline-confirm,
  .settings-section.is-task-section > .settings-message { grid-column: 1; }
  .settings-section.is-refresh-section > .settings-message,
  .settings-section.is-task-section > .settings-inline-confirm,
  .settings-section.is-task-section > .settings-message { margin-left: 0; }
  .settings-section.is-refresh-section > .settings-control-row,
  .settings-section.is-task-section > .settings-action-row { margin-top: 12px; }
  .settings-control-row { grid-template-columns: minmax(0, 1fr) auto; }
  .settings-control-row .number-input { height: 40px; }
  .settings-control-row .number-input input { height: 38px; }
  .settings-password-form { grid-template-columns: 1fr; margin-left: 0; }
  .settings-password-form .field,
  .settings-password-form .is-full { grid-column: 1; }
  .settings-inline-confirm { align-items: stretch; flex-direction: column; }
  .settings-confirm-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .settings-confirm-actions > button { width: 100%; min-height: 40px; }
  .settings-action-button { height: 40px; min-height: 40px; }
}

@media (max-width: 360px) {
  .app-shell { padding-right: 12px; padding-left: 12px; }
  .topbar { gap: 4px; }
  .brand-logo { width: 136px; }
  .refresh-state { display: none; }
  .overview-card { min-height: 82px; gap: 6px; padding: 12px; }
  .overview-card strong { margin-right: 4px; font-size: 26px; }
  .overview-card small { font-size: 12px; }
  .overview-card em { font-size: 11px; }
  .environment-identity { grid-column: 1 / -1; }
  .card-command-row .card-icon-button.restart { grid-column: 2; grid-row: 2; }
  .card-command-row .card-icon-button.memory { grid-column: 3; grid-row: 2; }
  .card-command-row .card-icon-button.probe { grid-column: 4; grid-row: 2; }
  .card-command-row .lifecycle-status { grid-column: 1; grid-row: 2; justify-self: start; }
  .page-button { padding: 0 8px; }
  .login-page { padding: 12px; }
  .login-panel { padding: 28px 24px 24px; }
  .themed-select-menu { max-width: calc(100vw - 24px); }
}

@media (prefers-reduced-motion: reduce) {
  .environment-activity-rotor { will-change: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
