:root {
  --bg: #f4f5f7;
  --panel: #ffffff;
  --panel-soft: #f9fafb;
  --line: #e5e7eb;
  --line-soft: #f3f4f6;
  --text: #111827;
  --text-soft: #374151;
  --muted: #6b7280;
  --muted-2: #9ca3af;
  --blue: #2563eb;
  --blue-50: #eff6ff;
  --blue-100: #dbeafe;
  --indigo: #6366f1;
  --indigo-50: #eef2ff;
  --green: #22c55e;
  --green-50: #f0fdf4;
  --teal: #0d9488;
  --teal-50: #f0fdfa;
  --orange: #f97316;
  --orange-50: #fff7ed;
  --red: #ef4444;
  --red-50: #fef2f2;
  --terminal: #18181b;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 10px rgba(15, 23, 42, 0.08);
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", Arial, sans-serif;
  font-size: 14px;
  letter-spacing: 0;
}

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

button {
  cursor: pointer;
}

svg {
  display: block;
}

.app-shell {
  height: 100vh;
  display: flex;
  overflow: hidden;
  background: var(--bg);
}

.sidebar {
  width: 256px;
  background: var(--panel);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  box-shadow: 4px 0 24px rgba(0, 0, 0, 0.02);
  z-index: 2;
}

.brandbar {
  height: 64px;
  display: flex;
  align-items: center;
  padding: 0 24px;
  border-bottom: 1px solid var(--line-soft);
  flex-shrink: 0;
}

.brand-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--blue);
  color: #fff;
  display: grid;
  place-items: center;
  margin-right: 12px;
  box-shadow: inset 0 1px 2px rgba(255, 255, 255, 0.25);
}

.brand-icon svg {
  width: 20px;
  height: 20px;
}

.brand-title {
  color: var(--text);
  font-size: 16px;
  line-height: 20px;
  font-weight: 800;
}

.brand-subtitle {
  margin-top: 2px;
  color: var(--muted);
  font-size: 10px;
  line-height: 14px;
  font-weight: 600;
}

.sidebar-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
}

.nav-group + .nav-group {
  margin-top: 28px;
}

.nav-heading {
  padding: 0 12px;
  margin-bottom: 8px;
  color: var(--muted-2);
  font-size: 11px;
  line-height: 16px;
  font-weight: 800;
}

.nav-button {
  width: 100%;
  height: 40px;
  border: 0;
  background: transparent;
  color: #4b5563;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 12px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  text-align: left;
  transition: background 0.2s ease, color 0.2s ease;
}

.nav-button + .nav-button {
  margin-top: 4px;
}

.nav-button span:first-child,
.topbar [data-icon],
h2 [data-icon],
.pill [data-icon],
.proxy-state [data-icon],
.last-update [data-icon] {
  display: inline-grid;
  place-items: center;
  flex-shrink: 0;
}

.nav-button svg {
  width: 16px;
  height: 16px;
  color: var(--muted-2);
}

.nav-button:hover {
  background: var(--panel-soft);
  color: var(--text);
}

.nav-button.active {
  background: var(--blue-50);
  color: #1d4ed8;
}

.nav-button.active svg {
  color: var(--blue);
}

.userbar {
  border-top: 1px solid var(--line-soft);
  padding: 16px 24px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.avatar {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  background: #e5e7eb;
  color: #4b5563;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 800;
}

.user-name {
  color: var(--text);
  font-size: 14px;
  line-height: 20px;
  font-weight: 600;
}

.user-mail {
  color: var(--muted);
  font-size: 12px;
  line-height: 16px;
}

.main-shell {
  min-width: 0;
  flex: 1;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.topbar {
  height: 64px;
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 0 32px;
  flex-shrink: 0;
  z-index: 1;
}

.crumbs,
.status-row {
  display: flex;
  align-items: center;
  min-width: 0;
}

.crumbs {
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
}

.crumbs svg {
  width: 16px;
  height: 16px;
  margin: 0 8px;
  color: var(--muted-2);
}

.crumb-current {
  color: var(--text);
}

.crumb-split {
  margin: 0 12px;
  color: #d1d5db;
}

.target-label {
  color: var(--muted-2);
  font-size: 12px;
  font-weight: 500;
}

.status-row {
  gap: 20px;
  color: var(--muted);
}

.pill,
.proxy-state,
.last-update,
.start-button {
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.start-button,
.primary-button {
  border: 1px solid #bfdbfe;
  border-radius: 999px;
  background: var(--blue);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  padding: 7px 12px;
  box-shadow: 0 1px 2px rgba(37, 99, 235, 0.22);
}

.secondary-button {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
  padding: 8px 12px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-shadow: var(--shadow);
}

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

.secondary-button svg {
  width: 14px;
  height: 14px;
}

.start-button:hover,
.primary-button:hover {
  background: #1d4ed8;
}

.start-button.stop {
  border-color: #fecaca;
  background: #dc2626;
  box-shadow: 0 1px 2px rgba(220, 38, 38, 0.22);
}

.start-button.stop:hover {
  background: #b91c1c;
}

.start-button:disabled,
.primary-button:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

.start-button svg {
  width: 12px;
  height: 12px;
}

.pill {
  border-radius: 999px;
  padding: 6px 12px;
  border: 1px solid var(--blue-100);
  font-size: 12px;
  font-weight: 700;
}

.pill svg {
  width: 14px;
  height: 14px;
}

.pill-blue {
  background: var(--blue-50);
  color: var(--blue);
}

.pill-stopped {
  background: var(--red-50);
  color: #dc2626;
  border-color: #fecaca;
}

.proxy-state {
  color: #16a34a;
  font-weight: 700;
}

.proxy-state.disabled {
  color: var(--muted);
}

.proxy-state svg,
.last-update svg {
  width: 16px;
  height: 16px;
}

.last-update {
  border-left: 1px solid var(--line);
  padding-left: 20px;
  color: var(--muted-2);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 12px;
}

.content {
  flex: 1;
  overflow-y: auto;
  padding: 32px;
}

.page-container {
  width: min(1200px, 100%);
  margin: 0 auto;
  padding-bottom: 40px;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

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

.kpi-card {
  min-height: 128px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: box-shadow 0.2s ease;
}

.kpi-card:hover {
  box-shadow: var(--shadow-md);
}

.kpi-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.kpi-label {
  color: var(--muted);
  font-size: 14px;
  line-height: 20px;
  font-weight: 600;
}

.kpi-icon {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.kpi-icon svg {
  width: 16px;
  height: 16px;
}

.kpi-icon.blue {
  background: var(--blue-50);
  color: var(--blue);
}

.kpi-icon.indigo {
  background: var(--indigo-50);
  color: var(--indigo);
}

.kpi-icon.gray {
  background: #f3f4f6;
  color: #4b5563;
}

.kpi-icon.green {
  background: var(--green-50);
  color: #16a34a;
}

.kpi-icon.teal {
  background: var(--teal-50);
  color: var(--teal);
}

.kpi-icon.orange {
  background: var(--orange-50);
  color: var(--orange);
}

.kpi-value {
  margin-top: 18px;
  color: var(--text);
  font-size: 24px;
  line-height: 32px;
  font-weight: 800;
  word-break: break-word;
}

.kpi-note {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 16px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.kpi-note svg {
  width: 12px;
  height: 12px;
  color: #22c55e;
}

.overview-grid {
  display: grid;
  grid-template-columns: minmax(0, 8fr) minmax(300px, 4fr);
  gap: 24px;
}

.left-stack,
.right-stack {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.panel {
  padding: 20px;
}

h2 {
  margin: 0;
  color: var(--text);
  font-size: 16px;
  line-height: 24px;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 8px;
}

h2 svg {
  width: 16px;
  height: 16px;
  color: var(--blue);
}

.progress-panel {
  padding: 20px;
}

.progress-panel h2 {
  margin-bottom: 22px;
}

.progress-block + .progress-block {
  margin-top: 24px;
}

.progress-meta {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 8px;
  color: var(--text-soft);
  font-size: 14px;
  line-height: 20px;
}

.progress-meta strong {
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 13px;
}

.progress-track {
  height: 10px;
  width: 100%;
  overflow: hidden;
  border-radius: 999px;
  background: #f3f4f6;
}

.progress-fill {
  height: 100%;
  width: 0;
  border-radius: inherit;
  transition: width 0.4s ease;
}

.progress-fill.blue {
  background: #3b82f6;
}

.progress-fill.indigo {
  background: #6366f1;
}

.task-panel {
  padding: 0;
  overflow: hidden;
}

.panel-header,
.log-title,
.table-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.toolbar-stack {
  min-width: 0;
}

.toolbar-meta {
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
  line-height: 16px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

.panel-header {
  min-height: 50px;
  padding: 12px 20px;
  background: rgba(249, 250, 251, 0.8);
  border-bottom: 1px solid var(--line);
}

.pid-badge {
  color: var(--muted);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 5px 10px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 12px;
  font-weight: 700;
  box-shadow: var(--shadow);
}

.task-body {
  padding: 20px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px 32px;
}

.span-2 {
  grid-column: span 2;
}

.field-label {
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 13px;
  line-height: 18px;
}

.mono-lg,
.course-chip,
.proxy-strip strong,
.detail-value {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

.mono-lg {
  color: var(--text);
  font-size: 18px;
  line-height: 28px;
  font-weight: 600;
}

.stage-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  max-width: 100%;
  color: var(--blue);
  background: var(--blue-50);
  border: 1px solid var(--blue-100);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 14px;
  line-height: 20px;
  font-weight: 700;
}

.stage-badge svg {
  width: 12px;
  height: 12px;
  flex-shrink: 0;
}

.course-chip {
  color: var(--text-soft);
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  font-size: 13px;
  line-height: 22px;
  word-break: break-word;
}

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

.metric-box {
  min-height: 78px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  padding: 12px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.metric-box span {
  color: var(--muted);
  font-size: 12px;
  line-height: 16px;
}

.metric-box strong {
  display: block;
  margin-top: 6px;
  color: var(--text);
  font-size: 24px;
  line-height: 32px;
  font-weight: 800;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

.metric-box.teal {
  background: var(--teal-50);
  border-color: #ccfbf1;
}

.metric-box.teal span,
.metric-box.teal strong {
  color: #115e59;
}

.metric-box.muted {
  background: var(--panel-soft);
}

.health-panel h2 {
  margin-bottom: 18px;
}

.health-panel h2 svg {
  color: var(--green);
}

.account-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 12px;
  line-height: 16px;
}

.account-row strong {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  color: var(--muted);
}

.stacked-bar {
  height: 10px;
  border-radius: 999px;
  overflow: hidden;
  background: #e5e7eb;
  display: flex;
  gap: 2px;
}

.bar.green {
  background: var(--green);
}

.bar.blue {
  background: #60a5fa;
}

.bar.indigo {
  background: #6366f1;
}

.bar.red {
  background: #f87171;
}

.legend-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
  margin-top: 12px;
  font-size: 12px;
  line-height: 16px;
}

.legend-row span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.legend-row .green {
  color: #16a34a;
}

.legend-row .blue {
  color: var(--blue);
}

.legend-row .indigo {
  color: #4f46e5;
}

.legend-row .red {
  color: var(--red);
}

.dot {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  flex-shrink: 0;
}

.dot.green {
  background: var(--green);
}

.dot.blue {
  background: #60a5fa;
}

.dot.indigo {
  background: #6366f1;
}

.dot.red {
  background: #f87171;
}

.proxy-strip {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  margin: 18px -20px -20px;
  padding: 16px 20px;
  border-top: 1px solid var(--line-soft);
  border-radius: 0 0 8px 8px;
  background: var(--panel-soft);
}

.proxy-strip > div:last-child {
  text-align: right;
}

.field-caption {
  color: var(--muted);
  font-size: 12px;
  line-height: 16px;
  margin-top: 4px;
}

.proxy-strip strong {
  display: block;
  color: var(--text-soft);
  font-size: 13px;
  line-height: 20px;
  word-break: break-word;
}

.log-panel {
  padding: 0;
  overflow: hidden;
  min-height: 400px;
  display: flex;
  flex-direction: column;
}

.log-title {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.log-title h2 {
  font-size: 14px;
}

.log-title h2 svg {
  color: var(--muted);
}

.icon-button {
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted-2);
  display: grid;
  place-items: center;
}

.icon-button:hover {
  background: var(--panel-soft);
  color: var(--text);
}

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

.terminal {
  flex: 1;
  min-height: 328px;
  max-height: 430px;
  overflow: auto;
  background: var(--terminal);
  padding: 14px 16px;
  color: #d1d5db;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 12px;
  line-height: 20px;
}

.log-entry {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 10px;
}

.log-entry + .log-entry {
  margin-top: 10px;
}

.log-time {
  color: #71717a;
}

.log-message {
  color: #93c5fd;
  word-break: break-word;
}

.log-message.good {
  color: #22c55e;
}

.log-message.warn {
  color: #facc15;
}

.log-message.bad {
  color: #f87171;
}

.analysis-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 24px;
}

.chart-panel h2 {
  margin-bottom: 18px;
}

.chart-panel canvas {
  width: 100%;
  display: block;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-top: 24px;
}

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

.summary-card span {
  color: var(--muted);
  font-size: 12px;
  line-height: 16px;
  font-weight: 600;
}

.summary-card strong {
  display: block;
  margin-top: 8px;
  color: var(--text);
  font-size: 22px;
  line-height: 30px;
}

.table-panel {
  padding: 0;
  overflow: hidden;
}

.table-toolbar {
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
}

.filters {
  display: flex;
  gap: 10px;
}

.filters input,
.filters select {
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  padding: 0 12px;
  outline: none;
}

.filters input:focus,
.filters select:focus {
  border-color: #93c5fd;
  box-shadow: 0 0 0 3px rgba(147, 197, 253, 0.28);
}

.table-wrap {
  overflow: auto;
  max-height: calc(100vh - 180px);
}

.table-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 12px;
  padding: 14px 20px;
  border-top: 1px solid var(--line);
  background: rgba(249, 250, 251, 0.8);
}

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

.pager-label {
  color: var(--muted);
  font-size: 12px;
  line-height: 16px;
  font-weight: 600;
}

.pager-input {
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  padding: 0 10px;
  outline: none;
  box-shadow: var(--shadow);
}

.pager-input:focus {
  border-color: #93c5fd;
  box-shadow: 0 0 0 3px rgba(147, 197, 253, 0.28);
}

.pager-number {
  width: 78px;
}

.footer-meta {
  color: var(--muted);
  font-size: 12px;
  line-height: 16px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

table {
  width: 100%;
  min-width: 980px;
  border-collapse: collapse;
}

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

th {
  background: var(--panel-soft);
  color: #4b5563;
  font-size: 12px;
  line-height: 16px;
  font-weight: 800;
}

td {
  color: var(--text-soft);
  font-size: 13px;
  line-height: 20px;
}

.empty-cell {
  color: var(--muted);
  text-align: center;
  padding: 28px 14px;
}

tbody tr:hover {
  background: #f8fbff;
}

.tag {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 12px;
  line-height: 16px;
  font-weight: 700;
}

.tag.done {
  background: var(--green-50);
  color: #15803d;
}

.tag.pending {
  background: #f3f4f6;
  color: #4b5563;
}

.tag.error {
  background: var(--red-50);
  color: #dc2626;
}

.rank-list {
  padding: 4px 20px 18px;
}

.rank-row {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) 64px;
  gap: 12px;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--line-soft);
}

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

.rank-index {
  color: var(--text-muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  font-weight: 700;
}

.rank-name {
  color: var(--text-soft);
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rank-value {
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  text-align: right;
  font-weight: 800;
}

.rank-empty {
  padding: 24px 0;
  color: var(--text-muted);
  text-align: center;
}

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

.detail-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: var(--panel-soft);
}

.detail-label {
  color: var(--muted);
  font-size: 12px;
  line-height: 16px;
  font-weight: 700;
}

.detail-value {
  margin-top: 6px;
  color: var(--text);
  font-size: 14px;
  line-height: 20px;
  word-break: break-word;
}

.control-form {
  margin-top: 22px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}

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

.form-grid label,
.check-grid label {
  color: var(--text-soft);
  font-size: 13px;
  line-height: 18px;
  font-weight: 700;
}

.form-grid label.wide {
  grid-column: span 2;
}

.form-grid label span {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 12px;
}

.field-help {
  display: block;
  margin-top: 6px;
  color: var(--muted-2);
  font-size: 12px;
  line-height: 16px;
  font-weight: 600;
}

.form-grid input,
.form-grid select,
.form-grid textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  outline: none;
}

.form-grid input,
.form-grid select {
  height: 38px;
  padding: 0 11px;
}

.form-grid textarea {
  min-height: 120px;
  padding: 10px 11px;
  resize: vertical;
}

.form-grid input:focus,
.form-grid select:focus,
.form-grid textarea:focus {
  border-color: #93c5fd;
  box-shadow: 0 0 0 3px rgba(147, 197, 253, 0.28);
}

.check-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 20px;
  margin-top: 16px;
}

.check-grid label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.form-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 18px;
}

.primary-button {
  border-radius: 8px;
  padding: 9px 13px;
}

.save-state {
  min-height: 18px;
  color: var(--muted);
  font-size: 12px;
}

.save-state.good {
  color: #16a34a;
}

.save-state.bad {
  color: #dc2626;
}

.danger-button,
.ghost-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 8px;
  padding: 9px 13px;
  font-size: 12px;
  font-weight: 800;
}

.danger-button {
  border: 1px solid #fecaca;
  background: #ef4444;
  color: #fff;
  box-shadow: 0 1px 2px rgba(239, 68, 68, 0.2);
}

.danger-button:hover {
  background: #dc2626;
}

.ghost-button {
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text-soft);
}

.ghost-button:hover {
  background: var(--panel-soft);
  color: var(--text);
}

.danger-button:disabled,
.ghost-button:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

.primary-button svg,
.danger-button svg,
.ghost-button svg {
  width: 14px;
  height: 14px;
}

.register-top-panel {
  margin-bottom: 24px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px 24px;
  align-items: center;
}

.register-progress {
  display: flex;
  align-items: center;
  gap: 20px;
  min-width: 0;
}

.register-progress-main {
  display: grid;
  grid-template-columns: auto auto minmax(180px, 1fr);
  gap: 12px;
  align-items: center;
  width: min(100%, 620px);
}

.register-progress-main span {
  color: var(--muted);
  font-weight: 800;
}

.register-progress-main strong,
.register-stat-row b {
  color: #0284c7;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

.register-stat-row {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 700;
}

.register-stat-row span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.register-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.register-grid {
  display: grid;
  grid-template-columns: minmax(280px, 0.85fr) minmax(0, 1.8fr);
  gap: 24px;
}

.form-grid.single {
  grid-template-columns: 1fr;
}

.rerun-grid {
  display: grid;
  grid-template-columns: minmax(300px, 0.9fr) minmax(0, 1.6fr);
  gap: 24px;
  margin-top: 24px;
}

.rerun-result {
  margin-top: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  color: var(--text-soft);
  font-size: 13px;
  line-height: 20px;
  padding: 12px;
  word-break: break-word;
}

.rerun-result strong,
.rerun-result span {
  display: block;
}

.rerun-result span {
  margin-top: 6px;
  color: var(--muted);
}

.register-log-panel {
  padding: 0;
  overflow: hidden;
}

.register-hint {
  display: grid;
  gap: 4px;
  padding: 12px 16px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.2);
  background: #111827;
  color: #cbd5e1;
}

.register-hint strong {
  color: #e5e7eb;
  font-size: 13px;
  line-height: 18px;
}

.register-hint span {
  color: #94a3b8;
  font-size: 12px;
  line-height: 18px;
}

.register-hint.captcha strong,
.register-hint.mail strong,
.register-hint.wait strong {
  color: #facc15;
}

.register-hint.warn strong {
  color: #fb7185;
}

.register-hint.browser strong,
.register-hint.form strong,
.register-hint.submit strong,
.register-hint.running strong {
  color: #60a5fa;
}

.register-terminal {
  min-height: 500px;
  max-height: calc(100vh - 310px);
  background: #0f172a;
}

.terminal-empty {
  height: 100%;
  min-height: 440px;
  display: grid;
  place-items: center;
  color: #94a3b8;
  font-size: 15px;
  letter-spacing: 0;
}

.path-chip {
  max-width: min(560px, 52vw);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
  border: 1px solid var(--line);
  background: var(--panel-soft);
  border-radius: 999px;
  padding: 6px 10px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 12px;
}

.mono-text {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

.empty-cell {
  text-align: center;
  color: var(--muted);
  padding: 42px 16px;
}

.tag.unused {
  background: var(--green-50);
  color: #15803d;
}

.tag.used {
  background: var(--blue-50);
  color: var(--blue);
}

.tag.expired {
  background: var(--red-50);
  color: #dc2626;
}

.tag.unknown {
  background: #f3f4f6;
  color: #4b5563;
}

.muted-text {
  color: var(--muted);
}

.custom-scrollbar::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

.custom-scrollbar::-webkit-scrollbar-track {
  background: transparent;
}

.custom-scrollbar::-webkit-scrollbar-thumb {
  background: #d1d5db;
  border-radius: 10px;
}

.custom-scrollbar:hover::-webkit-scrollbar-thumb {
  background: #9ca3af;
}

@media (max-width: 1280px) {
  .kpi-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .overview-grid,
  .analysis-grid,
  .register-grid {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 900px) {
  .app-shell {
    display: block;
    overflow: auto;
  }

  .sidebar {
    width: 100%;
    height: auto;
  }

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

  .main-shell {
    height: auto;
    min-height: 100vh;
  }

  .topbar {
    height: auto;
    min-height: 64px;
    align-items: flex-start;
    flex-direction: column;
    padding: 16px;
  }

  .status-row {
    flex-wrap: wrap;
    gap: 10px;
  }

  .content {
    padding: 16px;
  }

  .right-stack,
  .summary-grid,
  .detail-grid,
  .rerun-grid {
    grid-template-columns: 1fr;
  }

  .register-top-panel {
    grid-template-columns: 1fr;
  }

  .register-progress,
  .register-actions {
    justify-content: flex-start;
  }

  .register-progress-main {
    grid-template-columns: 1fr;
    width: 100%;
  }

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

  .form-grid label.wide {
    grid-column: span 1;
  }
}

@media (max-width: 640px) {
  .kpi-grid,
  .task-body,
  .filter-grid,
  .sidebar-scroll {
    grid-template-columns: 1fr;
  }

  .span-2 {
    grid-column: span 1;
  }

  .table-toolbar,
  .filters,
  .proxy-strip {
    flex-direction: column;
    align-items: stretch;
  }

  .proxy-strip > div:last-child {
    text-align: left;
  }
}
