@import url("https://fonts.googleapis.com/css2?family=Noto+Sans+SC:wght@400;500;600;700&display=swap");

:root {
  --bg: #eef2f7;
  --side: #f5f5f5;
  --side-hover: #ebebeb;
  --side-active: #ffffff;
  --ink: #0f0f0f;
  --muted: #5f6673;
  --muted-2: #3f4654;
  --surface: #ffffff;
  --surface-soft: #f7f7f8;
  --line: rgba(0, 0, 0, 0.06);
  --line-strong: rgba(0, 0, 0, 0.1);
  --accent: #3b6ef5;
  --accent-ink: #ffffff;
  --accent-soft: rgba(59, 110, 245, 0.12);
  --danger: #e24b4a;
  --danger-soft: #fff1f0;
  --ok: #18a058;
  --ok-soft: #e8f8ef;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow: 0 10px 28px rgba(20, 40, 80, 0.08);
  --shadow-nav: 0 1px 3px rgba(0, 0, 0, 0.06);
  --font: "Noto Sans SC", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --radius: 16px;
  --radius-sm: 12px;
  --radius-pill: 999px;
  --side-w: 200px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
}

body {
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(1000px 480px at 12% -10%, rgba(59, 110, 245, 0.12), transparent 55%),
    radial-gradient(800px 420px at 90% 0%, rgba(120, 160, 255, 0.08), transparent 50%),
    var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

/* —— Layout (Doubao-like) —— */
.layout {
  display: grid;
  grid-template-columns: var(--side-w) 1fr;
  height: 100vh;
  overflow: hidden;
  background: transparent;
}

.side {
  background: rgba(255, 255, 255, 0.55);
  backdrop-filter: blur(14px);
  padding: 10px 8px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  border-right: 1px solid rgba(255, 255, 255, 0.4);
  overflow: hidden;
}

.brand {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 6px 8px 10px;
}

.brand-mark {
  width: 24px;
  height: 24px;
  border-radius: 8px;
  background:
    radial-gradient(circle at 28% 28%, #5b8cff 0%, #3b6ef5 42%, #1f3fbf 100%);
  box-shadow: inset 0 -1px 0 rgba(255, 255, 255, 0.25);
  flex-shrink: 0;
}

.brand strong {
  display: block;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

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

.nav-label {
  margin: 6px 10px 2px;
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
}

.nav {
  display: grid;
  gap: 2px;
  flex: 1;
  align-content: start;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 8px;
  text-align: left;
  border: 0;
  background: transparent;
  color: var(--ink);
  padding: 8px 10px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: background 0.15s ease, box-shadow 0.15s ease;
}

.nav-item svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  opacity: 0.72;
}

.nav-item:hover {
  background: var(--side-hover);
}

.nav-item.active {
  background: var(--side-active);
  box-shadow: var(--shadow-nav);
}

.nav-item.active svg {
  opacity: 1;
}

.side-foot {
  margin-top: auto;
  padding-top: 8px;
}

.logout {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  background: transparent;
  color: var(--muted-2);
  border-radius: 12px;
  padding: 10px 12px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
}

.logout:hover {
  background: var(--side-hover);
  color: var(--ink);
}

.main {
  padding: 10px 12px;
  background: transparent;
  min-width: 0;
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.view {
  display: none;
  flex: 1;
  min-height: 0;
  overflow: auto;
}

.view.active {
  display: flex;
  flex-direction: column;
  animation: fadeIn 0.22s ease;
}

#view-tasks.active,
#view-dispatch.active,
#view-windows.active,
#view-accounts.active,
#view-launch.active {
  overflow: hidden;
}

.acc-toolbar {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 10px;
}

.acc-toolbar-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.acc-toolbar-row input[type="search"] {
  flex: 1;
  min-width: 160px;
}

.acc-page-info {
  margin-left: auto;
  white-space: nowrap;
  font-size: 12px;
}

.acc-bind-list {
  flex: 1;
  min-height: 0;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.acc-row {
  display: grid;
  grid-template-columns: 18px 10px 36px minmax(100px, max-content) minmax(80px, 1fr) minmax(100px, max-content);
  align-items: center;
  gap: 10px;
  border: 1px solid #ebebeb;
  border-radius: 12px;
  background: #fff;
  padding: 12px 14px;
  min-height: 48px;
}

.acc-row-check {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  cursor: pointer;
}

.acc-row-check input {
  width: 15px;
  height: 15px;
  margin: 0;
}

.acc-row-grip {
  width: 6px;
  height: 14px;
  justify-self: center;
  background:
    radial-gradient(circle, #c5c9d2 1.2px, transparent 1.3px) 0 0 / 6px 6px,
    radial-gradient(circle, #c5c9d2 1.2px, transparent 1.3px) 0 3px / 6px 6px;
  opacity: 0.9;
}

.acc-row-idx {
  font-size: 12px;
  font-weight: 600;
  color: #8b93a3;
  font-variant-numeric: tabular-nums;
}

.acc-row-name {
  font-size: 14px;
  font-weight: 700;
  color: #1f2430;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.acc-row-sub {
  font-size: 13px;
  color: #9aa3b2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.acc-row-ma {
  font-size: 12px;
  color: #a0a8b6;
  text-align: right;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 220px;
  justify-self: end;
}

.acc-row-body {
  flex: 1;
  min-width: 0;
}

.acc-row-title {
  font-size: 13px;
  font-weight: 700;
}

.acc-row-meta {
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
}

.thin-scroll,
.side-group-scroll {
  scrollbar-width: thin;
  scrollbar-color: #c9d2e3 transparent;
}

.thin-scroll::-webkit-scrollbar,
.side-group-scroll::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

.thin-scroll::-webkit-scrollbar-thumb,
.side-group-scroll::-webkit-scrollbar-thumb {
  background: #c9d2e3;
  border-radius: 999px;
}

.thin-scroll::-webkit-scrollbar-track,
.side-group-scroll::-webkit-scrollbar-track {
  background: transparent;
}

.side-group-scroll {
  flex: 1;
  min-height: 0;
  overflow: auto;
  align-content: start;
}

.launch-workspace {
  grid-template-columns: minmax(180px, 220px) minmax(200px, 1fr) minmax(280px, 1.2fr) minmax(220px, 1fr) !important;
  gap: 10px !important;
}

.launch-col-groups .vf-group-list {
  flex: 1;
  overflow: auto;
}


.launch-dev-actions {
  margin: 0 0 8px;
  flex-wrap: wrap;
  gap: 8px;
}

.launch-dev-actions .ghost.active,
#btnAutoUpdate.active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
}

.launch-dev-actions .ghost#btnSkipAccount:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.launch-col-devices,
.launch-col-devices .vf-card,
.launch-col-devices .launch-dev-list,
.launch-col-tasks,
.launch-col-tasks .vf-card {
  min-width: 0;
}

.launch-dev-list {
  flex: 1;
  min-height: 0;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-right: 2px;
}

/* Device card — official style; checkbox must NOT inherit input{width:100%} */
.launch-dev-card {
  position: relative;
  display: block;
  border: 1px solid #d6e4ff;
  border-radius: 12px;
  background: #fff;
  padding: 12px 14px 12px 36px;
  cursor: pointer;
  width: 100%;
  box-sizing: border-box;
  min-width: 0;
  color: var(--ink);
}

.launch-dev-card.selected {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
}

.launch-dev-card > input[type="checkbox"] {
  position: absolute;
  left: 12px;
  top: 14px;
  width: auto !important;
  max-width: none !important;
  height: auto !important;
  margin: 0 !important;
  padding: 0 !important;
  border: none !important;
  background: transparent !important;
  box-shadow: none !important;
  accent-color: var(--accent);
}

.launch-dev-main {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  width: 100%;
}

.launch-dev-top,
.launch-dev-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  min-width: 0;
}

.launch-dev-head {
  align-items: center;
  gap: 8px;
}

.launch-dev-idx {
  flex: 0 0 18px;
  font-size: 13px;
  color: #9ca3af;
  line-height: 1;
}

.launch-dev-hwid {
  flex: 1 1 auto;
  min-width: 0;
}

.launch-dev-top strong,
.launch-dev-hwid {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--ink);
  line-height: 1.2;
}

.notify-workspace {
  padding: 8px 0;
}

.notify-desc {
  margin: 0 0 16px;
  line-height: 1.5;
}

.notify-toggles {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.notify-toggle {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 12px 14px;
  border: 1px solid #e8e8e8;
  border-radius: 10px;
  cursor: pointer;
}

.notify-toggle input {
  width: auto !important;
  margin-top: 4px;
}

.notify-toggle strong {
  display: block;
  margin-bottom: 4px;
}

.notify-toggle small {
  color: var(--muted);
  line-height: 1.4;
}

.notify-add-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 12px;
}

.notify-add-row input {
  flex: 1;
  min-width: 200px;
}

.notify-email-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.notify-email-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid #eee;
  border-radius: 8px;
  background: #fafafa;
}

.notify-status {
  margin-top: 12px;
  min-height: 1.2em;
}

.notify-batch-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 0 14px 12px;
  color: var(--ink);
}

.notify-batch-row input[type="number"] {
  width: 88px !important;
  flex: 0 0 auto;
}

.launch-acc-ok {
  font-size: 13px;
  color: #333;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 48%;
}

.launch-acc-name {
  flex: 0 1 auto;
  max-width: 46%;
  font-size: 14px;
  font-weight: 700;
  color: #4a7cf7;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: right;
}

.launch-acc-unassigned {
  flex: 0 1 auto;
  max-width: 46%;
  font-size: 13px;
  font-weight: 600;
  color: #4a7cf7;
  white-space: nowrap;
  text-align: right;
}

.launch-acc-state {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}

.launch-dev-meta {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.45;
  white-space: normal;
  overflow: visible;
}

.launch-dev-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-top: 2px;
}

.launch-dev-status {
  font-size: 12px;
  font-weight: 600;
}

.launch-dev-status.on {
  color: #16a34a;
}

.launch-dev-status.off {
  color: #dc2626;
}

.launch-acc-tag {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}

/* Task card — match 分组任务列表: left info + right stacked actions */
.launch-task-card.vf-task-row,
article.launch-task-card {
  display: flex !important;
  flex-direction: row;
  align-items: stretch !important;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  grid-template-columns: none !important;
  background: #fff;
  border: 1px solid #e6e8ee;
  border-radius: 10px;
}

.launch-task-main {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  flex: 1;
  min-width: 0;
}

.launch-task-main .vf-task-idx {
  margin-top: 3px;
  font-size: 13px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

.launch-task-main .vf-task-body {
  flex: 1;
  min-width: 0;
  cursor: default;
}

.launch-task-card .vf-task-title {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 6px;
  color: #1a1d26;
}

.launch-task-card .vf-task-meta {
  white-space: normal !important;
  overflow: visible !important;
  text-overflow: clip !important;
  line-height: 1.5;
  word-break: break-word;
  font-size: 12px;
  color: var(--muted);
}

.launch-task-stats {
  font-size: 12px;
  color: #4a5160;
  margin-top: 8px;
  line-height: 1.4;
}

.launch-task-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  justify-content: center;
  flex-shrink: 0;
}

.launch-task-actions .danger,
.launch-task-actions .ghost {
  padding: 6px 14px;
  font-size: 12px;
  min-width: 64px;
}

.dispatch-task-card .vf-task-body {
  min-width: 0;
}

.dispatch-task-card .launch-task-stats {
  margin-top: 6px;
}

.launch-log-hint {
  margin: 0 0 6px;
  font-size: 11px;
}

.launch-log {
  flex: 1;
  min-height: 0;
  margin: 0;
  font-size: 11px;
  line-height: 1.45;
}

.launch-log-actions {
  margin-top: 8px;
  flex-wrap: wrap;
}

.launch-log-actions .primary,
.launch-log-actions .danger,
.launch-log-actions .ghost {
  flex: 1;
  min-width: 80px;
}

@media (max-width: 1200px) {
  .launch-workspace {
    grid-template-columns: 1fr 1fr !important;
    overflow: auto !important;
  }
}


.win-workspace {
  grid-template-columns: 220px 1fr !important;
}

.win-bind-list {
  flex: 1;
  min-height: 0;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.win-bind-row {
  border: 1px solid #e8e8e8;
  border-radius: 12px;
  background: #fff;
  padding: 12px 14px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.win-gear-btn {
  flex: 0 0 32px;
  width: 32px;
  height: 32px;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  background: #fafafa;
  color: #666;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  padding: 0;
}

.win-gear-btn:hover {
  background: #f0f4ff;
  color: #2f6fed;
  border-color: #c9d8ff;
}

.win-hwid-display {
  min-width: 120px;
  max-width: 200px;
  height: 32px;
  padding: 6px 10px;
  border: 1px solid #e8e8e8;
  border-radius: 8px;
  background: #f7f7f7;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: #333;
}

.dlg-gpu-config {
  border: none;
  border-radius: 14px;
  padding: 0;
  width: min(420px, calc(100vw - 32px));
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.18);
}

.dlg-gpu-config::backdrop {
  background: rgba(0, 0, 0, 0.35);
}

.dlg-gpu-form {
  padding: 18px 20px 16px;
}

.dlg-gpu-head {
  margin-bottom: 14px;
}

.gpu-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.gpu-toggle-row input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.gpu-switch {
  position: relative;
  width: 44px;
  height: 24px;
  border-radius: 999px;
  background: #d9d9d9;
  transition: background 0.2s;
  flex: 0 0 44px;
}

.gpu-switch::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.2s;
}

.gpu-toggle-row input:checked + .gpu-switch {
  background: #2f6fed;
}

.gpu-toggle-row input:checked + .gpu-switch::after {
  transform: translateX(20px);
}

.gpu-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.gpu-fields label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
}

.gpu-fields input {
  height: 36px;
  padding: 6px 10px;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  font-size: 14px;
}

.gpu-fields input:disabled {
  background: #f5f5f5;
  color: #aaa;
}

.gpu-hwid-hint {
  margin: 10px 0 0;
  font-size: 12px;
}

.dlg-gpu-actions {
  margin-top: 16px;
  justify-content: flex-end;
}

.win-bind-main {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  flex: 1;
  min-width: 0;
}

.win-bind-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.win-bind-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.win-bind-top .win-title {
  font-size: 14px;
  font-weight: 700;
}

.win-bind-meta {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.4;
}

.win-bind-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.win-bind-actions .win-hwid,
.win-bind-actions .win-alias,
.win-bind-note .win-alias {
  width: auto;
  min-width: 160px;
  max-width: 260px;
  flex: 1;
  padding: 6px 10px;
  height: 32px;
  border-radius: 8px;
  font-size: 12px;
}

.win-bind-note {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.win-bind-note .note-label {
  font-size: 12px;
  color: var(--muted);
  flex-shrink: 0;
}

.win-bind-fields {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
}

.win-bind-fields .win-hwid,
.win-bind-fields .win-alias {
  width: auto;
  min-width: 160px;
  max-width: 240px;
  flex: 1;
  padding: 6px 10px;
  height: 32px;
  border-radius: 8px;
  font-size: 12px;
}

.win-bind-fields .win-title {
  font-size: 13px;
  margin-right: 4px;
}

.win-bind-fields .win-hwid-text,
.win-bind-top .win-hwid-text {
  font-size: 12px;
  color: var(--muted);
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.win-bind-fields .primary,
.win-bind-fields .ghost,
.win-bind-fields .danger,
.win-bind-actions .primary,
.win-bind-actions .ghost,
.win-bind-actions .danger,
.win-bind-note .primary,
.win-bind-note .ghost {
  padding: 6px 12px;
  font-size: 12px;
  flex-shrink: 0;
}


.dispatch-workspace {
  grid-template-columns: 1.1fr 1fr !important;
}

.dispatch-groups {
  max-height: 180px;
  overflow: auto;
  margin-bottom: 8px;
}

.dispatch-g-item {
  align-items: flex-start;
}

.dispatch-g-item strong {
  display: block;
  font-size: 13px;
}

.dispatch-g-item small {
  display: block;
  margin-top: 2px;
  font-weight: 400;
  font-size: 11px;
  line-height: 1.35;
}

.dispatch-detail {
  flex: 1;
  min-height: 0;
  overflow: auto;
  border-top: 1px solid var(--line);
  padding-top: 8px;
}

.dispatch-detail-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.dispatch-win-list {
  display: grid;
  gap: 6px;
}

.dispatch-win-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid #e8e8e8;
  border-radius: 10px;
  background: #fff;
}

.dispatch-win-row .title {
  font-size: 13px;
  font-weight: 600;
}

.dispatch-win-row .meta {
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
}

.dispatch-online-pick {
  display: grid;
  gap: 4px;
  max-height: 160px;
  overflow: auto;
  padding: 6px;
  background: var(--surface-soft);
  border-radius: 8px;
}


@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: none; }
}

.page-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-end;
  margin-bottom: 22px;
}

.page-head h1 {
  margin: 0;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.2;
}

.page-head p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 14px;
  font-weight: 400;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.toolbar.tight {
  margin-bottom: 0;
  gap: 6px;
  flex-wrap: nowrap;
}

.dispatch-pool-hint {
  margin: 10px 2px 0;
  font-size: 12px;
}

.dispatch-win-row button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.toolbar select {
  width: auto;
  min-width: 160px;
}

/* —— Controls —— */
button {
  border: 0;
  background: var(--surface-soft);
  color: var(--ink);
  border-radius: var(--radius-pill);
  padding: 8px 16px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: background 0.15s ease, color 0.15s ease, transform 0.1s ease;
}

button:hover {
  background: #ececed;
}

button:active {
  transform: scale(0.98);
}

button.primary {
  background: var(--accent);
  color: var(--accent-ink);
}

button.primary:hover {
  background: #2f5de0;
}

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

button.danger:hover {
  background: #ffe4e2;
}

button.ghost {
  background: transparent;
  color: var(--muted-2);
}

button.ghost:hover {
  background: var(--surface-soft);
  color: var(--ink);
}

button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}

input, select, textarea {
  border: 1px solid transparent;
  border-radius: 14px;
  padding: 10px 14px;
  background: var(--surface-soft);
  color: var(--ink);
  width: 100%;
  outline: none;
  transition: box-shadow 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

input[type="checkbox"],
input[type="radio"] {
  width: auto;
  padding: 0;
  border-radius: 0;
  background: transparent;
}

input:hover, select:hover, textarea:hover {
  background: #f0f0f1;
}

input:focus, select:focus, textarea:focus {
  background: #fff;
  border-color: var(--line-strong);
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.04);
}

input[type="search"] {
  max-width: 280px;
}

textarea {
  resize: vertical;
  min-height: 96px;
  line-height: 1.5;
}

/* —— Panels / cards —— */
.split {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 14px;
  min-height: 480px;
}

.pane {
  background: var(--surface-soft);
  border: 1px solid transparent;
  border-radius: var(--radius);
  padding: 10px;
}

.pane.grow {
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--line);
}

.list-pane {
  padding: 8px;
}

.group-item {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  padding: 10px 12px;
  border-radius: 12px;
  cursor: pointer;
  color: var(--ink);
  font-size: 14px;
  font-weight: 500;
}

.group-item:hover {
  background: rgba(0, 0, 0, 0.04);
}

.group-item.active {
  background: #fff;
  box-shadow: var(--shadow-nav);
  font-weight: 600;
}

.group-item small {
  display: block;
  color: var(--muted);
  font-weight: 400;
  margin-top: 2px;
  font-size: 12px;
}

.table-wrap {
  overflow: auto;
  max-height: 620px;
  border-radius: 12px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

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

th {
  color: var(--muted);
  font-weight: 500;
  font-size: 12px;
  position: sticky;
  top: 0;
  background: #fff;
}

tr:hover td {
  background: rgba(0, 0, 0, 0.015);
}

.cards {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}

.card {
  background: var(--surface-soft);
  border: 1px solid transparent;
  border-radius: var(--radius);
  padding: 16px 18px;
  transition: background 0.15s ease, box-shadow 0.15s ease;
}

.card:hover {
  background: #f0f0f1;
}

.card h3 {
  margin: 0 0 6px;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.card .meta {
  color: var(--muted-2);
  font-size: 13px;
  line-height: 1.55;
}

.card .row-actions {
  margin-top: 14px;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

/* —— VF-style task workspace —— */
.vf-workspace {
  display: grid;
  grid-template-columns: 260px minmax(200px, 0.9fr) minmax(280px, 1.3fr);
  gap: 10px;
  align-items: stretch;
  flex: 1;
  min-height: 0;
  height: 100%;
  overflow: hidden;
}

.vf-col {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.vf-col-left {
  overflow: auto;
}

.vf-card {
  background: #ffffff;
  border: 1px solid rgba(20, 40, 80, 0.08);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 10px 12px;
  min-height: 0;
}

.vf-card-fill {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.vf-card-title {
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 8px;
  letter-spacing: -0.01em;
}

.vf-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 8px;
  align-content: start;
}

.vf-form .span-2,
.vf-form-foot.span-2 {
  grid-column: 1 / -1;
}

.vf-form label {
  display: grid;
  gap: 2px;
  font-size: 11px;
  color: var(--muted);
  font-weight: 500;
}

.vf-form label[hidden],
.vf-form .is-hidden {
  display: none !important;
}

.vf-form input,
.vf-form select {
  width: 100%;
  max-width: 100%;
  border-radius: 8px;
  padding: 4px 8px;
  background: #f3f5f9;
  font-size: 12px;
  height: 28px;
}

.vf-form-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 2px;
  padding-top: 6px;
  border-top: 1px solid var(--line);
}

.vf-form-foot .primary {
  margin-left: auto;
  padding: 6px 14px;
  font-size: 12px;
}

.vf-group-create {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 6px;
}

.vf-group-create input {
  flex: 1;
  min-width: 100px;
  padding: 5px 8px;
  font-size: 12px;
  border-radius: 8px;
}

.vf-group-create button {
  padding: 5px 10px;
  font-size: 12px;
}

.vf-group-list {
  display: grid;
  gap: 4px;
  flex: 0 0 auto;
  min-height: 0;
  overflow: visible;
}

.vf-group-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  width: 100%;
  height: auto;
  border: 1px solid #e8ecf3;
  background: #fff;
  border-radius: 10px;
  padding: 6px 10px;
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  text-align: left;
}

.vf-group-item em {
  font-style: normal;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: 999px;
  padding: 1px 7px;
  font-size: 11px;
}

.vf-group-item:hover {
  border-color: #c9d4f0;
}

.vf-group-item span {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.vf-group-item small {
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
}

.vf-group-item.active {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
  background: #f5f8ff;
}

.vf-panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 6px;
  flex-shrink: 0;
}

.vf-panel-head.tight {
  margin-bottom: 6px;
}

.vf-panel-head select,
.vf-panel-head input[type="search"] {
  width: auto;
  min-width: 90px;
  flex: 1;
  padding: 5px 8px;
  font-size: 12px;
  border-radius: 8px;
}

.vf-panel-head button {
  padding: 5px 10px;
  font-size: 12px;
}

.vf-acc-list,
.vf-task-list {
  flex: 1;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-height: 0;
  max-height: none;
  padding-right: 2px;
}

.vf-acc-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 6px 10px;
  border: 1px solid #e8ecf3;
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
}

.vf-acc-row input {
  width: auto;
  margin: 0;
  accent-color: var(--accent);
}

.vf-acc-name {
  font-size: 12px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
}

.vf-panel {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.vf-pager {
  display: flex;
  align-items: center;
  gap: 6px;
}

.vf-pager button {
  padding: 5px 10px;
  font-size: 12px;
}

.vf-task-row {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px;
  align-items: center;
  padding: 7px 10px;
  border: 1px solid #e8e8e8;
  border-radius: 10px;
  background: #fff;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.vf-task-row:hover {
  border-color: #c9d4f0;
  box-shadow: var(--shadow-sm);
}

.vf-task-check {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  user-select: none;
}

.vf-task-check input {
  width: auto;
  margin: 0;
  accent-color: var(--accent);
}

.vf-task-idx {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted-2);
  font-variant-numeric: tabular-nums;
  min-width: 1.4em;
}

.vf-task-body {
  min-width: 0;
  cursor: pointer;
}

.vf-task-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.25;
  margin-bottom: 2px;
}

.vf-task-meta {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.vf-task-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

/* left: both cards hug content — do not stretch 默认分组 */
.vf-col-left > .vf-card:first-child,
.vf-col-left > .vf-card:last-child {
  flex: 0 0 auto;
}

.vf-col-left > .vf-card:last-child {
  display: block;
}

@media (max-width: 1200px) {
  .vf-workspace {
    grid-template-columns: 1fr 1fr;
  }
  .vf-col-left {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    overflow: hidden;
  }
}

@media (max-width: 900px) {
  html, body {
    overflow: auto;
    height: auto;
  }
  .layout {
    height: auto;
    overflow: visible;
  }
  .main {
    height: auto;
    overflow: visible;
  }
  .vf-workspace,
  .vf-col-left {
    grid-template-columns: 1fr;
    height: auto;
    overflow: visible;
  }
  .vf-task-meta {
    white-space: normal;
  }
}

.device-grid {
  display: grid;
  gap: 8px;
}

.device {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  align-items: center;
  background: var(--surface-soft);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  cursor: pointer;
  transition: background 0.15s ease, box-shadow 0.15s ease;
}

.device:hover {
  background: #efefef;
}

.device.selected {
  background: #fff;
  box-shadow: inset 0 0 0 1.5px var(--ink);
}

.device .title {
  font-weight: 600;
  font-size: 14px;
}

.device .meta {
  color: var(--muted);
  font-size: 12px;
  margin-top: 3px;
  word-break: break-all;
}

.badge {
  border-radius: var(--radius-pill);
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 600;
}

.badge.online {
  background: var(--ok-soft);
  color: var(--ok);
}

.badge.offline {
  background: #f0f0f0;
  color: var(--muted);
}

.badge.task-running,
.badge.task-idle,
.badge.task-offline {
  margin-left: 6px;
}

.badge.task-running {
  background: #dbeafe;
  color: #1d4ed8;
}

.badge.task-idle {
  background: #f3f4f6;
  color: #6b7280;
}

.badge.task-offline {
  background: #f0f0f0;
  color: var(--muted);
}

.launch-dev-status.task-running {
  color: #1d4ed8;
}

.launch-dev-status.task-idle {
  color: #6b7280;
}

.launch-dev-status.task-update-now {
  color: #b45309;
  font-weight: 600;
}

.launch-dev-status.task-update-wait {
  color: #7c3aed;
  font-weight: 600;
}

.form-card {
  display: grid;
  grid-template-columns: 1.2fr 1fr auto;
  gap: 12px;
  align-items: end;
  margin-bottom: 14px;
  background: var(--surface-soft) !important;
}

.form-card:hover {
  background: var(--surface-soft) !important;
}

.form-card label {
  display: grid;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
}

.log {
  margin-top: 16px;
  max-height: 240px;
  overflow: auto;
  background: #111111;
  color: #d6d6d6;
  border-radius: var(--radius);
  padding: 14px 16px;
  font-size: 12px;
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  white-space: pre-wrap;
  line-height: 1.5;
}

.muted { color: var(--muted); font-size: 13px; }
.empty { color: var(--muted); padding: 28px 8px; font-size: 14px; }

/* —— Dialogs —— */
dialog {
  border: 0;
  border-radius: 20px;
  padding: 0;
  box-shadow: var(--shadow);
  width: min(520px, calc(100% - 2rem));
  background: #fff;
}

dialog::backdrop {
  background: rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(2px);
}

.dlg {
  padding: 22px 22px 18px;
  display: grid;
  gap: 12px;
}

.dlg h3 {
  margin: 0 0 4px;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.dlg label {
  display: grid;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
}

.dlg .check {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  font-size: 13px;
}

.dlg .check input {
  width: auto;
}

.dlg .toolbar {
  margin-top: 4px;
  justify-content: flex-end;
}

.dlg-stop-mode {
  width: min(480px, calc(100vw - 2rem));
  gap: 14px;
}

.dlg-stop-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.dlg-stop-head h3 {
  margin: 0;
}

.dlg-close {
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}

.dlg-close:hover {
  background: #f3f4f6;
  color: var(--ink);
}

.stop-mode-list {
  display: grid;
  gap: 10px;
}

.stop-mode-option {
  display: flex !important;
  align-items: flex-start;
  gap: 12px;
  margin: 0;
  padding: 12px 14px;
  border: 1px solid #e8e8e8;
  border-radius: 12px;
  background: #fff;
  cursor: pointer;
  color: var(--ink);
  font-weight: 400;
}

.stop-mode-option:hover {
  border-color: #c9d4f0;
}

.stop-mode-option:has(input:checked) {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
  background: #f5f8ff;
}

.stop-mode-option input {
  width: auto !important;
  margin-top: 3px;
  flex: 0 0 auto;
  accent-color: var(--accent);
}

.stop-mode-option span {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.stop-mode-option strong {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
}

.stop-mode-option small {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.4;
}

.dlg-stop-actions {
  margin-top: 6px;
}

/* —— Login —— */
.login-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background:
    radial-gradient(900px 480px at 50% -20%, rgba(59, 110, 245, 0.08), transparent 60%),
    #f7f7f8;
}

.login-shell {
  width: min(400px, calc(100% - 2rem));
}

.login-card {
  display: grid;
  gap: 12px;
  background: #fff !important;
  border-radius: 20px !important;
  padding: 28px 26px !important;
  box-shadow: var(--shadow);
}

.login-card:hover {
  background: #fff !important;
}

.login-card h1 {
  margin: 0;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.login-card .primary {
  width: 100%;
  margin-top: 6px;
  padding: 12px 16px;
  font-size: 14px;
}

.login-card label {
  display: grid;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
}

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

.error {
  color: var(--danger);
  margin: 0;
  font-size: 13px;
}

@media (max-width: 960px) {
  .layout {
    grid-template-columns: 1fr;
  }
  .side {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    padding: 10px;
  }
  .brand {
    padding: 6px 8px;
  }
  .nav {
    display: flex;
    flex-wrap: wrap;
    flex: 1;
  }
  .nav-label, .side-foot {
    width: 100%;
  }
  .main {
    padding: 20px 16px 32px;
  }
  .page-head {
    flex-direction: column;
    align-items: stretch;
  }
  .page-head h1 {
    font-size: 24px;
  }
  .split {
    grid-template-columns: 1fr;
  }
  .form-card {
    grid-template-columns: 1fr;
  }
  .cards {
    grid-template-columns: 1fr;
  }
}
