:root {
  --primary-color: #4F46E5;
  --primary-light: #6366F1;
  --primary-dark: #4338CA;
  --primary-gradient: linear-gradient(135deg, #4F46E5 0%, #6366F1 100%);
  --success-color: #10B981;
  --warning-color: #F59E0B;
  --error-color: #EF4444;
  --bg-color: #F3F4F6;
  --bg-card: #FFFFFF;
  --bg-hover: #F9FAFB;
  --text-primary: #111827;
  --text-secondary: #374151;
  --text-muted: #6B7280;
  --border-color: #E5E7EB;
  --page-max-width: 1280px;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --scene: #14223A;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg-color);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
}
a { color: var(--primary-dark); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select { font-family: inherit; }

.app-container { display: flex; flex-direction: column; min-height: 100vh; }

.app-header {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 0;
  z-index: 100;
}
.header-content {
  max-width: var(--page-max-width);
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}
@media (min-width: 1280px) {
  .header-content {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    column-gap: 12px;
  }
  .module-tabs { width: 100%; justify-content: space-evenly; }
  .header-actions { justify-self: end; }
}
.logo-section { display: flex; align-items: center; gap: 14px; flex-shrink: 0; }
.logo-icon {
  width: 44px;
  height: 44px;
  background: var(--primary-gradient);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  box-shadow: var(--shadow-md);
}
.logo-icon svg { width: 26px; height: 26px; }
.app-title { font-size: 18px; font-weight: 700; letter-spacing: -0.5px; color: var(--text-primary); }

.module-tabs {
  display: flex;
  gap: 4px;
  background: var(--bg-color);
  padding: 4px;
  border-radius: var(--radius-lg);
}
.tab-link {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: var(--radius-md);
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
}
.tab-link:hover { color: var(--text-primary); background: var(--bg-card); text-decoration: none; }
.tab-link svg { width: 16px; height: 16px; }
.tab-link.active, .tab-dropdown.active > .tab-link {
  background: var(--bg-card);
  color: var(--primary-color);
  box-shadow: var(--shadow-sm);
  font-weight: 600;
}
.tab-dropdown { position: relative; }
.dropdown-arrow { width: 12px; height: 12px; transition: transform 0.15s ease; }
.tab-dropdown:hover .dropdown-arrow,
.tab-dropdown:focus-within .dropdown-arrow { transform: rotate(180deg); }
.dropdown-menu {
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 220px;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-color);
  padding: 8px;
  display: none;
  z-index: 1000;
}
.tab-dropdown:hover .dropdown-menu,
.tab-dropdown:focus-within .dropdown-menu { display: block; }
.dropdown-group { margin-bottom: 8px; padding-bottom: 8px; border-bottom: 1px solid var(--border-color); }
.dropdown-group:last-child { margin-bottom: 0; padding-bottom: 0; border-bottom: none; }
.dropdown-group-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.5px;
  padding: 6px 12px 4px;
}
.dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 500;
}
.dropdown-item:hover { background: var(--bg-hover); color: var(--primary-color); text-decoration: none; }
.dropdown-item.current { background: #eef2ff; color: var(--primary-color); font-weight: 600; }
.dropdown-badge {
  margin-left: auto;
  background: var(--bg-color);
  color: var(--text-muted);
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 600;
}
.header-actions { flex-shrink: 0; display: flex; align-items: center; gap: 10px; }
.language-switcher {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--bg-color);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 3px;
}
.lang-btn {
  padding: 5px 12px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 500;
  border-radius: 16px;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}
.lang-btn:hover { color: var(--text-primary); background: var(--bg-hover); }
.lang-btn.active, .lang-btn.active:hover {
  background: var(--primary-gradient);
  color: white;
  box-shadow: 0 2px 4px rgba(79, 70, 229, 0.3);
}
html.i18n-pending body { visibility: hidden; }
.version-badge {
  background: var(--primary-gradient);
  color: white;
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  box-shadow: var(--shadow-sm);
  white-space: nowrap;
}
@media (min-width: 1280px) {
  .tab-link { padding: 8px 10px; }
}
/* 英文标题较长：分两行，留出导航宽度；徽标与当前导航项重复，单行页头时不显示 */
html[lang="en"] .app-title { max-width: 10em; line-height: 1.25; }
@media (min-width: 901px) {
  html[lang="en"] .version-badge { display: none; }
}

.app-main {
  flex: 1;
  max-width: var(--page-max-width);
  width: 100%;
  margin: 0 auto;
  padding: 28px 24px 40px;
  min-width: 0;
}
.app-main.wide { max-width: var(--page-max-width); }

.app-footer {
  background: var(--bg-card);
  border-top: 1px solid var(--border-color);
  padding: 18px 24px;
  text-align: center;
}
.app-footer p { font-size: 12px; color: var(--text-muted); }
.app-footer .footer-icp { margin-top: 6px; }
.app-footer .footer-icp a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }

.module-banner {
  border-radius: var(--radius-xl);
  padding: 16px 24px;
  color: #fff;
  background:
    radial-gradient(circle 125px at calc(100% - 64px) 90px, rgba(255, 255, 255, 0.08) 99.5%, transparent 100%),
    linear-gradient(135deg, #7c3aed 0%, #4f46e5 100%);
  margin-bottom: 14px;
  position: relative;
  overflow: visible;
}
.module-banner h2 {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 6px;
  color: #fff;
  position: relative;
  z-index: 1;
}
.module-banner p, .module-banner .meta {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.94);
  position: relative;
  z-index: 1;
  margin: 0;
}
.module-banner .job-head { margin: 0; position: relative; z-index: 1; align-items: center; }
.module-banner .pill { background: rgba(255, 255, 255, 0.18); color: #fff; }

.card {
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-md);
}
.card.pad, .form { padding: 18px 20px; }
.card h2, .card h3 {
  font-size: 15px;
  margin: 0 0 14px;
  padding-left: 10px;
  border-left: 3px solid var(--primary-color);
}
.lead { margin: 0; color: var(--text-muted); font-size: 14px; line-height: 1.6; }

.split { display: grid; grid-template-columns: 1.15fr 0.85fr; gap: 14px; align-items: stretch; }
.sample {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 12px;
}
.sample p { color: var(--text-muted); font-size: 14px; line-height: 1.6; margin: 0; }

.btn {
  border: 0;
  border-radius: 10px;
  padding: 10px 18px;
  background: var(--primary-gradient);
  color: white;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: inline-block;
  text-align: center;
}
.btn:hover { color: white; text-decoration: none; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3); }
.btn.ghost {
  background: #eef2ff;
  color: #3730a3;
  box-shadow: none;
}
.btn.ghost:hover { color: #3730a3; box-shadow: none; transform: none; }
.btn.block { width: 100%; }

.form { margin-top: 14px; }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 16px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field.full { grid-column: 1 / -1; }
.field label, .group-title { font-size: 13px; color: var(--text-muted); }
.group-title { font-weight: 600; color: var(--text-secondary); margin-bottom: 2px; }
.field input, .field select, .toolbar select, .toolbar input[type="number"] {
  height: 40px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0 12px;
  background: white;
  color: var(--text-primary);
  font-size: 14px;
}
.field small, .file em { color: var(--text-muted); font-size: 12px; font-style: normal; }
.choices { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.choice {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 12px;
  background: #fff;
  cursor: pointer;
}
.choice:has(input:checked) { border-color: var(--primary-color); background: #eef2ff; }
.choice strong { display: block; font-size: 14px; color: var(--text-primary); }
.choice small { display: block; color: var(--text-muted); line-height: 1.45; margin-top: 4px; }
.files { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.file {
  border: 1px dashed #c7d2fe;
  border-radius: var(--radius-lg);
  padding: 12px;
  background: #fafbff;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  color: var(--text-secondary);
}
.file input { font-size: 12px; }
.actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 4px; }
.inline-form { margin-top: 16px; }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--border-color); }
th { color: var(--text-muted); font-weight: 600; font-size: 12px; }
.pill {
  display: inline-block;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 12px;
  background: var(--bg-color);
  color: var(--text-secondary);
}
.pill.done { background: #d1fae5; color: #047857; }
.pill.error { background: #fee2e2; color: #b91c1c; }
.pill.running, .pill.queued { background: #fef3c7; color: #b45309; }

.job-head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; }
.job-title-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.job-title-row h2 { margin: 0; }
.job-head-actions { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; flex: none; }
.job-delete { margin: 0; }
.btn.ghost.danger { color: #b91c1c; border-color: #fecaca; background: #fff; }
.btn.ghost.danger:hover { color: #991b1b; background: #fef2f2; border-color: #f87171; box-shadow: none; transform: none; }
.side .tdip-redo { display: flex; flex-wrap: wrap; gap: 8px; }
.side .tdip-redo form { margin: 0; flex: 1 1 auto; }
.side .tdip-redo form .btn { width: 100%; }
.ttl-chip { display: inline-flex; align-items: center; vertical-align: middle; z-index: 2; }
.ttl-chip-face {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 12px; font-weight: 500; line-height: 1;
  color: #4338ca; background: #eef2ff;
  border: 1px solid #e0e7ff; border-radius: 999px;
  padding: 3px 10px 3px 7px; white-space: nowrap; cursor: help;
}
.ttl-clock { width: 13px; height: 13px; flex: none; }
.ttl-chip .ask-tip {
  top: auto; bottom: calc(100% + 8px); left: 50%; right: auto;
  transform: translateX(-50%);
  width: max-content; max-width: 260px;
  text-align: center; white-space: nowrap;
  z-index: 40;
}
.ttl-chip .ask-tip::after {
  content: ""; position: absolute; left: 50%; bottom: -5px;
  margin-left: -5px; border: 5px solid transparent; border-top-color: #0f172a; border-bottom-width: 0;
}
.meta { color: var(--text-muted); font-size: 13px; margin-top: 4px; }

.layout { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 14px; align-items: start; }
.side { padding: 16px 18px; position: sticky; top: 88px; }
.side h2 { font-size: 15px; }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 14px; }
.stat { background: var(--bg-hover); border-radius: var(--radius-md); padding: 8px 10px; }
.stat b { display: block; font-size: 18px; color: var(--text-primary); }
.stat span { color: var(--text-muted); font-size: 12px; }
.links { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.links a { font-size: 13px; }
.links a.btn { font-size: 14px; }

.stage { min-height: 680px; overflow: hidden; display: flex; flex-direction: column; }
.tabs {
  display: flex;
  gap: 4px;
  padding: 8px;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-color);
}
.tabs button {
  border: 0;
  background: transparent;
  border-radius: var(--radius-md);
  padding: 8px 14px;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 500;
}
.tabs button.on {
  background: white;
  color: var(--primary-color);
  box-shadow: var(--shadow-sm);
  font-weight: 600;
}
.menu {
  display: flex;
  gap: 6px;
  padding: 8px 12px 0;
}
.menu button {
  height: 30px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
}
.menu button.on {
  background: #eef2ff;
  color: var(--primary-color);
  border-color: #c7d2fe;
  font-weight: 600;
}
.toolbar .offmenu { display: none !important; }
.toolbar {
  display: flex;
  gap: 4px;
  align-items: center;
  flex-wrap: wrap;
  position: relative;
  z-index: 4;
  padding: 6px 10px 7px;
  border-bottom: 1px solid var(--border-color);
  font-size: 12px;
}
.toolbar .group {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
  padding: 0;
  margin: 0;
}
.toolbar .group:last-child { padding-right: 0; }
/* 父级已隐藏的控件（如收起的弹出框内按钮）不算可见 */
.toolbar .group:not(:has(:is(label, button.tool, .ask, .cmap-edit):not([hidden]):not(.offmenu):not([hidden] *))) { display: none; }
/* 控件组不加框，组间以留白区分 */
.toolbar .cluster {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 3px 8px;
  padding: 2px 0;
}
.toolbar .cluster:not(:has(:is(label, button.tool, .ask):not([hidden]):not(.offmenu):not([hidden] *))) { display: none; }
.toolbar label { display: flex; align-items: center; gap: 3px; color: var(--text-muted); white-space: nowrap; }
.toolbar select, .toolbar input[type="number"] { height: 26px; padding: 0 4px; font-size: 12px; }
.toolbar input[type="number"] { width: 58px; }
.toolbar input.num { width: 58px; }
.toolbar input.num-s { width: 46px; }
.toolbar input.coord { width: 74px; padding: 0 3px; font-variant-numeric: tabular-nums; }
.toolbar .clip-grid input.num-s { width: 46px; }
.toolbar input[type="range"] { width: 52px; accent-color: #4f46e5; }
.toolbar .tool {
  height: 26px;
  padding: 0 7px;
  border: 1px solid var(--border-color);
  border-radius: 7px;
  background: white;
  color: var(--text);
  font-size: 12px;
  cursor: pointer;
}
.toolbar .tool:hover { border-color: #c7d2fe; color: var(--primary-color); }
.ask {
  position: relative;
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  vertical-align: middle;
}
.ask[hidden] { display: none !important; }
.ask-btn {
  width: 16px;
  height: 16px;
  padding: 0;
  border: 1px solid var(--border-color);
  border-radius: 50%;
  background: #fff;
  color: var(--text-muted);
  font-size: 11px;
  line-height: 14px;
  cursor: help;
}
.ask-btn:hover,
.ask-btn:focus-visible {
  border-color: #c7d2fe;
  color: var(--primary-color);
  outline: none;
}
.ask-tip {
  display: none;
  position: absolute;
  z-index: 30;
  top: calc(100% + 6px);
  left: 0;
  width: max-content;
  max-width: 260px;
  padding: 6px 8px;
  border-radius: 8px;
  background: #0f172a;
  color: #f8fafc;
  font-size: 12px;
  line-height: 1.45;
  font-weight: 400;
  white-space: normal;
  text-align: left;
  box-shadow: var(--shadow-md);
  pointer-events: none;
}
.ask:hover .ask-tip,
.ask:focus-within .ask-tip,
.ask.open .ask-tip { display: block; }
.toolbar .group > .ask:last-child .ask-tip { left: auto; right: 0; }
.toolbar .group.clip-dock {
  flex: 1 0 100%;
  margin-right: 0;
  border-right: 0;
  padding-right: 0;
  align-items: flex-start;
  gap: 8px 18px;
}
.clip-block {
  flex: 1 1 420px;
  min-width: 280px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.clip-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
}
.clip-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px 16px;
}
.toolbar .clip-grid label { min-width: 0; }
.toolbar .clip-grid input[type="range"] { width: auto; flex: 1 1 72px; min-width: 72px; }
.toolbar .clip-grid input[type="number"] { width: 72px; }
.toolbar .clip-grid output {
  min-width: 7.6em;
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: var(--text-secondary);
  font-size: 12px;
}
.cmap-edit {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  flex-basis: 100%;
}
.cmap-edit[hidden] { display: none !important; }
#cmap-stops { display: flex; flex-wrap: wrap; gap: 8px 12px; flex-basis: 100%; }
.cmap-stop { display: flex; align-items: center; gap: 4px; }
.cmap-stop input[type="number"] { width: 64px; }
.cmap-stop input[type="color"] { width: 36px; height: 28px; padding: 0; border: 1px solid var(--border-color); background: white; }
.well-labels {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 2;
}
.well-labels[hidden] { display: none; }
.litho-colors {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  align-items: center;
}
.litho-colors[hidden] { display: none; }
.litho-colors label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
}
.litho-colors input[type="color"] {
  width: 28px;
  height: 22px;
  padding: 0;
  border: 1px solid var(--border-color);
  background: white;
}
.readout {
  position: absolute;
  left: 14px;
  top: 12px;
  z-index: 2;
  max-width: 70%;
  padding: 6px 10px;
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.82);
  color: #f8fafc;
  font-size: 12px;
  line-height: 1.45;
  pointer-events: none;
}
.view.light .readout {
  background: rgba(255, 255, 255, 0.94);
  color: var(--text);
  border: 1px solid var(--border-color);
}
.view { flex: 1; height: 640px; min-height: 640px; background: var(--scene); position: relative; }
.view.light { background: var(--bg-card); }
.view.paper { background: #fafafa; }
.view.gray { background: #625d5a; }
.view .plot { position: absolute; inset: 0; width: 100%; height: 100%; display: block; outline: none; }
.view-dock {
  position: absolute;
  left: 14px;
  bottom: 12px;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 8px;
}
.hint {
  position: relative;
}
.view-btn {
  height: 26px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.75);
  background: rgba(15, 23, 42, 0.45);
  color: #e2e8f0;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
}
.view-btn:hover { border-color: #a5b4fc; color: #fff; }
.view.light .view-btn,
.view.paper .view-btn {
  border-color: var(--border-color);
  background: rgba(255, 255, 255, 0.92);
  color: #334155;
}
.view.gray .view-btn {
  border-color: rgba(226, 232, 240, 0.55);
  background: rgba(30, 41, 59, 0.45);
  color: #e6e8ec;
}
.hint .ask-btn {
  border-color: rgba(148, 163, 184, 0.75);
  background: rgba(15, 23, 42, 0.45);
  color: #e2e8f0;
}
.hint .ask-tip { top: auto; bottom: calc(100% + 6px); left: 0; right: auto; }
.view.light .hint .ask-btn,
.view.paper .hint .ask-btn {
  border-color: var(--border-color);
  background: rgba(255, 255, 255, 0.92);
  color: #334155;
}
.view.gray .hint .ask-btn {
  border-color: rgba(226, 232, 240, 0.55);
  background: rgba(30, 41, 59, 0.45);
  color: #e6e8ec;
}
#viewer:fullscreen {
  width: 100%;
  height: 100%;
  min-height: 0;
  margin: 0;
  border-radius: 0;
  background: var(--bg-color);
  overflow: hidden;
}
#viewer:fullscreen .toolbar {
  flex: 0 0 auto;
  max-height: 42vh;
  overflow: auto;
}
#viewer:fullscreen .view {
  flex: 1 1 auto;
  height: auto;
  min-height: 0;
}
.loading, .empty-note {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #cbd5e1;
}
.view.light .loading, .view.light .empty-note { color: var(--text-muted); }

.gallery {
  position: absolute;
  inset: 0;
  z-index: 2;
  overflow: auto;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding: 12px;
  background: var(--bg-color);
}
.gallery a {
  background: white;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  color: inherit;
}
.gallery a:hover { text-decoration: none; border-color: #c7d2fe; }
.gallery img, .gallery canvas { width: 100%; height: auto; display: block; background: white; }
.gallery .sheet {
  background: white;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.gallery span { display: block; padding: 8px 10px; font-size: 13px; }

.stepper { display: flex; gap: 0; padding: 8px 4px 18px; }
.step { flex: 1; text-align: center; font-size: 13px; color: var(--text-muted); }
.step::before {
  content: "";
  display: block;
  width: 14px;
  height: 14px;
  margin: 0 auto 8px;
  border-radius: 50%;
  border: 2px solid #d1d5db;
  background: white;
}
.step.on { color: var(--primary-dark); }
.step.on::before { border-color: var(--primary-color); background: var(--primary-color); }
.step.done { color: #047857; }
.step.done::before { border-color: var(--success-color); background: var(--success-color); }
.banner {
  background: #fef2f2;
  color: #b91c1c;
  border-radius: var(--radius-md);
  padding: 12px 14px;
  font-size: 14px;
}
.prose { line-height: 1.75; font-size: 15px; color: var(--text-secondary); }
.prose h2 {
  font-size: 15px;
  margin: 22px 0 8px;
  padding-left: 10px;
  border-left: 3px solid var(--primary-color);
  color: var(--text-primary);
}
.prose p { margin: 0 0 10px; }
.prose code { background: #eef2ff; color: var(--primary-dark); padding: 1px 6px; border-radius: 6px; }
.recent { margin-top: 14px; }

@media (min-width: 901px) and (max-width: 1279px) {
  .module-tabs { flex-wrap: wrap; min-width: 0; }
}
@media (max-width: 1100px) {
  .module-tabs { flex-wrap: wrap; }
  .tab-link { padding: 8px 10px; }
  .app-title { font-size: 16px; }
}
@media (min-width: 901px) and (max-width: 1200px) {
  .module-tabs .tab-link > svg:not(.dropdown-arrow) { display: none; }
}
@media (min-width: 901px) and (max-width: 1024px) {
  .version-badge { display: none; }
}
@media (max-width: 900px) {
  .header-content { flex-wrap: wrap; }
  .module-tabs { position: relative; width: 100%; }
  .tab-dropdown { position: static; }
  .dropdown-menu {
    left: 8px;
    right: 8px;
    width: auto;
    min-width: 0;
    max-height: min(70vh, 420px);
    overflow-y: auto;
  }
  .split, .layout, .grid, .choices, .files, .gallery { grid-template-columns: 1fr; }
  .side { position: static; }
  .app-main { padding: 18px 14px 32px; }
  .app-footer { padding: 16px 12px; }
}

/* 三维激电：首页、任务记录、说明、错误页 */
.tdip-banner { display: flex; align-items: center; gap: 20px; padding: 12px 22px; }
.tdip-banner-text { position: relative; z-index: 1; min-width: 0; display: flex; align-items: baseline; gap: 6px 16px; flex-wrap: wrap; }
.module-banner.tdip-banner h2 { margin: 0; font-size: 20px; }
.tdip-access {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 0 14px;
  padding: 10px 14px; border: 1px solid #fde68a; border-radius: 10px; background: #fffbeb; color: #92400e;
  font-size: 13px; line-height: 1.5;
}
.tdip-access[hidden], .tdip-access [hidden] { display: none; }
.tdip-access p { margin: 0; }
.tdip-access-btn {
  flex: none; padding: 4px 14px; border-radius: 14px; background: #f59e0b; color: #fff; font-weight: 600;
  text-decoration: none;
}
.tdip-access-btn:hover { background: #d97706; }

.tdip-quick { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.tdip-q { padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.tdip-q-head { display: flex; align-items: center; gap: 10px; }
.tdip-q-head > div { min-width: 0; }
.card .tdip-q-head h2 { margin: 0; padding: 0; border: 0; font-size: 15px; line-height: 1.3; }
.tdip-q-head small { display: block; font-size: 12px; color: var(--text-muted); }
.tdip-q-icon {
  flex: none; width: 34px; height: 34px; padding: 7px; border-radius: 10px; background: #eef2ff;
  fill: none; stroke: var(--primary-color); stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round;
}
.tdip-q .tdip-submit { margin: 0; justify-content: flex-start; }
.tdip-q .tdip-submit:not(:has(.tdip-progress:not([hidden]), .btn:not([hidden]))) { display: none; }
.tdip-q .tdip-submit .btn { min-width: 0; padding: 6px 14px; font-size: 13px; }
.tdip-q .tdip-bar { width: 110px; }
.tdip-drop { flex: 1; justify-content: center; align-items: center; text-align: center; gap: 4px; padding: 12px; cursor: pointer; }
.tdip-drop:hover { border-color: var(--primary-color); background: #f5f7ff; }
.tdip-drop.drag { padding: 11px; }
.tdip-drop .tdip-file-row { justify-content: center; flex-wrap: wrap; }
.tdip-drop .tdip-file-btn { font-weight: 600; }
.tdip-drop .tdip-file-hint { display: inline-flex; align-items: center; justify-content: center; gap: 4px; flex-wrap: wrap; }
.tdip-drop .ask-tip { left: 50%; transform: translateX(-50%); }
.tdip-recent { margin-top: 14px; padding: 12px 20px 14px; }
.tdip-recent[hidden], .tdip-recent-row[hidden] { display: none; }
.tdip-recent-head { display: flex; align-items: center; gap: 6px 10px; flex-wrap: wrap; }
.card .tdip-recent-head h2 { margin: 0; }
.tdip-recent-count, .tdip-recent-note { font-size: 12px; color: var(--text-muted); }
.tdip-recent-tools { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.tdip-recent-btn { border: 0; background: none; color: var(--primary-color); font: inherit; font-size: 12px; padding: 3px 8px; border-radius: 6px; cursor: pointer; }
.tdip-recent-btn:hover { background: #eef2ff; }
.tdip-recent-list { list-style: none; margin: 10px 0 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.tdip-recent-row { display: flex; min-width: 0; border: 1px solid var(--border-color); border-radius: var(--radius-md); background: #fafbff; overflow: hidden; }
.tdip-recent-link { flex: 1; min-width: 0; padding: 8px 10px; display: flex; flex-direction: column; gap: 4px; color: inherit; }
.tdip-recent-link:hover { background: #f1f4ff; text-decoration: none; }
.tdip-recent-link b { font-size: 13px; font-weight: 600; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tdip-recent-meta { display: flex; align-items: center; gap: 4px 8px; flex-wrap: wrap; font-size: 12px; color: var(--text-muted); }
.tdip-recent-kind { font-style: normal; color: var(--primary-dark); background: #eef2ff; border-radius: 4px; padding: 0 6px; }
.tdip-recent-meta .pill { font-style: normal; padding: 0 7px; margin-left: auto; }
.tdip-recent-drop { flex: none; width: 34px; border: 0; border-left: 1px solid var(--border-color); background: none; color: #94a3b8; font-size: 16px; line-height: 1; cursor: pointer; }
.tdip-recent-drop:hover { color: #b91c1c; background: #fef2f2; }
.tdip-card { display: flex; flex-direction: column; gap: 12px; }
.tdip-card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.card .tdip-card-head h2 { margin: 0; }
.tdip-tag {
  font-size: 12px; color: var(--primary-dark); background: #eef2ff;
  border: 1px solid #e0e7ff; border-radius: 999px; padding: 1px 10px; white-space: nowrap;
}
.tdip-note { margin: 0; color: var(--text-muted); font-size: 13px; line-height: 1.6; }
.tdip-note.small { font-size: 12px; }
.tdip-note code, .tdip-file-hint code, .tdip-prose-extra code {
  font-family: Consolas, "SFMono-Regular", Menlo, monospace; font-size: 12px;
  background: #eef2ff; color: var(--primary-dark); padding: 0 5px; border-radius: 4px; white-space: nowrap;
}

.tdip-file {
  display: flex; flex-direction: column; gap: 6px;
  border: 1px dashed #c7d2fe; border-radius: var(--radius-lg);
  padding: 10px 12px; background: #fafbff;
  transition: border-color 0.15s ease, background 0.15s ease, opacity 0.15s ease;
}
.tdip-file.picked { border-style: solid; border-color: #a5b4fc; background: #f5f7ff; }
.tdip-file.drag { border: 2px dashed var(--primary-color); background: #eef2ff; padding: 9px 11px; }
.tdip-file.off { opacity: 0.5; }
.tdip-file-name { font-size: 13px; font-weight: 600; color: var(--text-secondary); }
.tdip-req, .tdip-opt {
  display: inline-block; font-style: normal; font-weight: 500; font-size: 11px; line-height: 16px;
  padding: 0 6px; margin-left: 4px; border-radius: 999px; vertical-align: 1px; white-space: nowrap;
}
.tdip-req { color: #b91c1c; background: #fef2f2; border: 1px solid #fecaca; }
.tdip-opt { color: var(--text-muted); background: var(--bg-hover); border: 1px solid var(--border-color); }
.tdip-err { margin: 0; font-size: 12px; color: #b91c1c; line-height: 1.5; grid-column: 1 / -1; }
.tdip-err::before { content: "! "; font-weight: 700; }
.tdip-file.invalid { border-color: #f87171; border-style: solid; background: #fff7f7; }
.tdip-field input[aria-invalid="true"] { border-color: var(--error-color, #dc2626); }
.tdip-files > [data-full] { display: flex; min-width: 0; }
.tdip-files > [data-full] > .tdip-file { flex: 1; }
.tdip-files:has(> [data-full][hidden]) { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.tdip-file.grow { flex: 1; justify-content: center; align-items: center; text-align: center; gap: 8px; padding: 18px; }
.tdip-file.grow .tdip-file-row { justify-content: center; }
.tdip-file.grow.drag { padding: 17px; }
.tdip-file.grow .tdip-file-hint { max-width: 36em; }
.tdip-outcome { margin: 0; flex: 1 1 320px; font-size: 13px; line-height: 1.6; color: var(--text-secondary); }
.tdip-outcome b { color: var(--primary-dark); font-weight: 600; }
.tdip-limit { flex-basis: 100%; }
.tdip-sample-params { display: block; margin-top: 2px; font-size: 12px; color: var(--text-muted); }
.tdip-sample-groups { display: flex; flex-direction: column; gap: 8px; }
.tdip-sample-row { display: grid; grid-template-columns: 56px minmax(0, 1fr); align-items: center; gap: 8px; }
.tdip-sample-label { font-size: 12px; font-weight: 600; color: var(--text-muted); white-space: nowrap; }
.tdip-sample-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.tdip-sample-actions .btn { width: 100%; padding: 9px 10px; font-size: 13px; }
.tdip-sample { position: relative; }
.tdip-sample-dl { font-size: 12px; }
.tdip-sample-dl summary {
  display: inline-flex; align-items: center; gap: 6px; width: max-content; cursor: pointer; list-style: none;
  color: var(--primary-dark); font-weight: 500; padding: 2px 0;
}
.tdip-sample-dl summary::-webkit-details-marker { display: none; }
.tdip-sample-dl summary::after {
  content: ""; width: 5px; height: 5px; margin-top: -3px;
  border: solid currentColor; border-width: 0 1.5px 1.5px 0; transform: rotate(45deg); transition: transform 0.15s ease, margin 0.15s ease;
}
.tdip-sample-dl[open] summary::after { transform: rotate(-135deg); margin-top: 3px; }
.tdip-sample-dl summary:hover { color: var(--primary-color); }
.tdip-sample-dl summary:focus-visible { outline: 2px solid var(--primary-color); outline-offset: 2px; border-radius: 4px; }
.tdip-sample-pop {
  position: absolute; z-index: 40; top: calc(100% + 6px); right: 0; width: max(100%, 400px); max-width: calc(100vw - 32px);
  display: flex; flex-direction: column; gap: 12px; padding: 14px 16px 16px; box-sizing: border-box;
  background: #fff; border: 1px solid var(--border-color); border-radius: var(--radius-lg); box-shadow: 0 12px 32px rgba(15, 23, 42, 0.16);
  color: var(--text-secondary); line-height: 1.55;
}
.tdip-pop-head { display: flex; align-items: center; gap: 8px; }
.tdip-pop-head b { font-size: 14px; color: var(--text-primary); }
.tdip-pop-close {
  margin-left: auto; width: 26px; height: 26px; border: 0; border-radius: 6px; background: none;
  color: #94a3b8; font-size: 18px; line-height: 1; cursor: pointer;
}
.tdip-pop-close:hover { background: var(--bg-hover); color: var(--text-primary); }
.tdip-pop-facts { display: grid; grid-template-columns: 3em minmax(0, 1fr); gap: 6px 12px; margin: 0; }
.tdip-pop-facts dt { color: var(--text-muted); }
.tdip-pop-facts dd { margin: 0; color: var(--text-secondary); }
.tdip-pop-facts small { display: block; font-size: 11.5px; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.tdip-pop-sub { margin-bottom: -6px; font-size: 12px; font-weight: 600; color: var(--text-muted); }
.tdip-sample-files { list-style: none; margin: 0; padding: 0; border: 1px solid var(--border-color); border-radius: var(--radius-md); overflow: visible; }
.tdip-sample-files li { display: grid; grid-template-columns: 38px minmax(0, 1fr) 16px 52px 28px; align-items: center; gap: 10px; padding: 6px 8px 6px 10px; }
.tdip-sample-files li + li { border-top: 1px solid var(--border-color); }
.tdip-sample-files li:hover { background: #fafbff; }
.tdip-kind {
  font-style: normal; font-size: 10.5px; font-weight: 600; letter-spacing: 0.02em; text-align: center; line-height: 18px;
  color: var(--primary-dark); background: #eef2ff; border-radius: 4px;
}
.tdip-sample-files li b { font-size: 12.5px; font-weight: 600; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tdip-sample-files .ask-tip { left: auto; right: -8px; max-width: 280px; }
.tdip-sample-files li > span:not(.ask) { font-size: 11.5px; color: var(--text-muted); font-variant-numeric: tabular-nums; white-space: nowrap; text-align: right; }
.tdip-dl-btn {
  display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 26px; border-radius: 6px;
  color: var(--primary-color); border: 1px solid transparent;
}
.tdip-dl-btn:hover { background: #eef2ff; border-color: #c7d2fe; text-decoration: none; }
.tdip-dl-btn svg, .tdip-dl-all svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.tdip-dl-all { display: flex; align-items: center; justify-content: center; gap: 6px; width: 100%; padding: 8px 12px; font-size: 13px; box-sizing: border-box; }
.tdip-dl-all:hover { text-decoration: none; }
.tdip-file-row { position: relative; display: flex; align-items: center; gap: 8px; min-width: 0; }
.tdip-file-input { position: absolute; left: 0; bottom: 0; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.tdip-file-btn {
  flex: none; height: 26px; padding: 0 12px; cursor: pointer;
  border: 1px solid #c7d2fe; border-radius: 7px; background: #fff;
  color: var(--primary-dark); font-size: 12px; font-weight: 600;
}
.tdip-file-btn:hover { background: #eef2ff; }
.tdip-file-btn:focus-visible, .tdip-file-clear:focus-visible { outline: 2px solid var(--primary-color); outline-offset: 1px; }
.tdip-file-picked { min-width: 0; font-size: 12px; color: var(--text-muted); cursor: pointer; word-break: break-all; }
.tdip-file.picked .tdip-file-picked { color: #047857; font-variant-numeric: tabular-nums; }
.tdip-file-picked.bad { color: #b91c1c; }
.tdip-file-clear {
  flex: none; width: 20px; height: 20px; padding: 0; cursor: pointer; line-height: 18px;
  border: 1px solid var(--border-color); border-radius: 50%; background: #fff; color: var(--text-muted); font-size: 13px;
}
.tdip-file-clear:hover { color: #b91c1c; border-color: #fca5a5; }
.tdip-file-hint { margin: 0; font-size: 12px; color: var(--text-muted); line-height: 1.55; cursor: auto; user-select: text; }
.tdip-only { display: inline-flex; align-items: center; gap: 8px; }
.tdip-only small { max-width: 230px; font-size: 11px; line-height: 1.4; color: var(--text-muted); }
.tdip-coords {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 14px;
  margin: 12px 0; padding: 10px 12px; border: 1px solid #c7d2fe; border-radius: var(--radius-lg); background: #f5f7ff;
}
.tdip-coords > div:first-child { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.tdip-coords b { font-size: 14px; color: var(--primary-dark); }
.tdip-coords small { font-size: 12px; color: var(--text-muted); }
.tdip-coords-btns { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; }
.tdip-coords-btns .btn { display: inline-flex; align-items: center; justify-content: center; height: 30px; padding: 0 12px; font-size: 12px; line-height: 1; white-space: nowrap; }
.side .side-coords .tdip-coords-btns { display: grid; grid-template-columns: auto 1fr; }
.side .side-coords .tdip-coords-more { grid-column: 1 / -1; }
.tdip-coords-more { font-size: 12px; }
.tdip-coords.early { margin: 12px 4px 0; }
.side .tdip-coords.side-coords { flex-direction: column; align-items: stretch; margin: 10px 0; }
.tdip-qc { margin: 0 0 10px; border: 1px solid var(--border-color); border-radius: var(--radius-lg); background: #fff; font-size: 12px; }
.tdip-qc summary {
  cursor: pointer; padding: 8px 10px; font-weight: 600; color: var(--text-secondary);
  display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; list-style-position: inside;
}
.tdip-qc summary span { font-weight: 400; color: var(--text-muted); }
.tdip-qc-flag { display: inline-block; margin-left: 6px; padding: 0 6px; border-radius: 999px; font-size: 11px; font-weight: 600; line-height: 16px; color: #b45309; background: #fef3c7; }
.tdip-qc-warn { margin: 6px 0 0; padding: 6px 8px; border-radius: var(--radius-md); background: #fffbeb; border: 1px solid #fde68a; color: #92400e; font-size: 12px; line-height: 1.55; }
.tdip-qc summary:focus-visible { outline: 2px solid var(--primary-color); outline-offset: 1px; border-radius: var(--radius-lg); }
.tdip-qc[open] summary { border-bottom: 1px solid var(--border-color); }
.tdip-qc dl { margin: 0; padding: 8px 10px 10px; display: flex; flex-direction: column; gap: 8px; }
.tdip-qc dl > div { display: flex; flex-direction: column; gap: 2px; }
.tdip-qc dt { font-size: 11px; color: var(--text-muted); }
.tdip-qc dd { margin: 0; color: var(--text-primary); line-height: 1.55; }
.tdip-qc dd small { display: block; margin-top: 2px; font-size: 11px; color: var(--text-muted); line-height: 1.5; }
.tdip-qc ul { margin: 0; padding-left: 16px; }
.tdip-qc li { margin: 1px 0; }
.tdip-qc.wide { margin: 0; }
.tdip-qc.wide dl > div { display: grid; grid-template-columns: 90px minmax(0, 1fr); gap: 10px; }
.tdip-qc.wide dt { font-size: 12px; padding-top: 1px; }

.tdip-check {
  border: 1px solid var(--border-color); border-radius: var(--radius-lg); background: var(--bg-hover);
  padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; font-size: 12px; color: var(--text-secondary);
}
.tdip-check.ok { border-color: #a7f3d0; background: #f0fdf7; }
.tdip-check.warn { border-color: #fcd34d; background: #fffbeb; }
.tdip-check.bad { border-color: #fca5a5; background: #fef2f2; }
.tdip-check:focus { outline: none; }
.tdip-check.bad:focus { box-shadow: 0 0 0 3px #fecaca; }
.tdip-check-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tdip-check-head b { font-size: 13px; color: var(--text-primary); }
.tdip-check-head em { font-style: normal; font-size: 11px; padding: 0 8px; border-radius: 999px; line-height: 18px; background: #e2e8f0; color: var(--text-secondary); }
.tdip-check.ok .tdip-check-head em { background: #d1fae5; color: #047857; }
.tdip-check.warn .tdip-check-head em { background: #fef3c7; color: #92400e; }
.tdip-check.bad .tdip-check-head em { background: #fee2e2; color: #b91c1c; }
.tdip-check.loading .tdip-check-head em::before {
  content: ""; display: inline-block; width: 8px; height: 8px; margin-right: 5px; border-radius: 50%;
  border: 1.5px solid currentColor; border-right-color: transparent; animation: tdip-spin 0.8s linear infinite; vertical-align: -1px;
}
@keyframes tdip-spin { to { transform: rotate(360deg); } }
.tdip-check-sum { margin: 0; font-size: 13px; color: var(--text-primary); }
.tdip-check-sum b { font-variant-numeric: tabular-nums; }
.tdip-strip { display: flex; gap: 2px; align-items: stretch; height: 22px; }
.tdip-strip span { flex: 1 1 0; min-width: 3px; border-radius: 2px; background: #e0e7ff; position: relative; overflow: hidden; }
.tdip-strip span i { position: absolute; left: 0; right: 0; bottom: 0; background: var(--primary-color); }
.tdip-strip-axis { display: flex; justify-content: space-between; gap: 8px; font-size: 11px; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.tdip-strip-axis .legend { display: inline-flex; gap: 10px; }
.tdip-strip-axis .legend i { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 4px; vertical-align: -1px; background: var(--primary-color); }
.tdip-strip-axis .legend i.est { background: #e0e7ff; }
.tdip-check-list { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 4px; }
.tdip-check-list li { position: relative; padding-left: 16px; line-height: 1.55; }
.tdip-check-list li::before { content: ""; position: absolute; left: 3px; top: 7px; width: 6px; height: 6px; border-radius: 50%; background: #94a3b8; }
.tdip-check-list li.warn::before { background: #d97706; }
.tdip-check-list li.bad { color: #b91c1c; }
.tdip-check-list li.bad::before { background: #dc2626; }
.tdip-check-list li.ok::before { background: #10b981; }
.tdip-check-list li.info { color: var(--text-muted); }
.tdip-check-more summary { cursor: pointer; font-size: 12px; color: var(--primary-dark); width: max-content; }
.tdip-check-more summary:focus-visible { outline: 2px solid var(--primary-color); outline-offset: 2px; border-radius: 4px; }
.tdip-check-more table { margin-top: 6px; border-collapse: collapse; font-size: 12px; font-variant-numeric: tabular-nums; background: #fff; border: 1px solid var(--border-color); }
.tdip-check-more th, .tdip-check-more td { padding: 3px 10px; text-align: right; border-bottom: 1px solid var(--border-color); }
.tdip-check-more th { background: var(--bg-hover); color: var(--text-muted); font-weight: 600; }
.tdip-check-more td:first-child, .tdip-check-more th:first-child { text-align: left; }
.tdip-check-more td.full { color: #047857; }
.tdip-check-more .tdip-check-table { max-height: 260px; overflow: auto; width: max-content; max-width: 100%; }
.tdip-covered { margin: 0; padding: 9px 12px; border: 1px solid #a7f3d0; border-radius: var(--radius-lg); background: #f0fdf7; color: #065f46; font-size: 12px; }
[data-est][hidden] { display: none !important; }
.tdip-stations { max-width: 980px; margin: 0 auto; display: flex; flex-direction: column; gap: 12px; }
.tdip-stations .tdip-facts { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.tdip-stations .tdip-facts dd small { display: block; font-size: 11px; font-weight: 400; color: var(--text-muted); }
.tdip-extract { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 2px; }
.tdip-extract .btn { height: 28px; padding: 0 12px; font-size: 12px; }
.tdip-extract a { font-size: 12px; }
.tdip-extract em { font-style: normal; font-size: 12px; color: var(--text-muted); }
.tdip-extract em.bad { color: #b91c1c; }
.tdip-extract em.ok { color: #047857; }

.tdip-facts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin: 0; }
.tdip-facts div { background: var(--bg-hover); border: 1px solid var(--border-color); border-radius: var(--radius-md); padding: 6px 10px; }
.tdip-facts dt { font-size: 11px; color: var(--text-muted); }
.tdip-facts dd { margin: 0; font-size: 14px; font-weight: 600; color: var(--text-primary); font-variant-numeric: tabular-nums; }
.tdip-form { margin-top: 14px; padding: 16px 20px 0; display: flex; flex-direction: column; gap: 14px; }
.tdip-flows { margin-top: 18px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.tdip-flow {
  position: relative; display: flex; align-items: center; gap: 12px; padding: 12px 16px; text-align: left;
  font: inherit; color: var(--text-secondary); background: var(--bg-card); cursor: pointer;
  border: 1.5px solid var(--border-color); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm);
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}
.tdip-flow:hover { border-color: #c7d2fe; }
.tdip-flow:focus-visible { outline: 2px solid var(--primary-color); outline-offset: 2px; }
.tdip-flow[aria-selected="true"] { border-color: var(--primary-color); background: #eef2ff; box-shadow: 0 4px 14px rgba(79, 70, 229, 0.14); }
.tdip-flow[aria-selected="true"]::after {
  content: ""; position: absolute; left: 50%; bottom: -8px; width: 14px; height: 14px; background: #eef2ff;
  border-right: 1.5px solid var(--primary-color); border-bottom: 1.5px solid var(--primary-color);
  transform: translateX(-50%) rotate(45deg);
}
.tdip-flow-icon {
  flex: none; width: 38px; height: 38px; padding: 8px; border-radius: 10px; background: #eef2ff;
  fill: none; stroke: var(--primary-color); stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round;
}
.tdip-flow[aria-selected="true"] .tdip-flow-icon { background: var(--primary-color); stroke: #fff; }
.tdip-flow-text { min-width: 0; }
.tdip-flow-text b { display: block; font-size: 16px; color: var(--text-primary); }
.tdip-flow[aria-selected="true"] .tdip-flow-text b { color: var(--primary-dark); }
.tdip-flow-text small { display: block; margin-top: 2px; font-size: 12px; line-height: 1.45; color: var(--text-muted); }
.tdip-card-sub { font-size: 12px; color: var(--text-muted); margin-right: auto; }
.tdip-modes { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 22px; }
.tdip-mode { display: flex; align-items: center; gap: 8px 10px; flex-wrap: wrap; min-width: 0; }
.tdip-mode[hidden] { display: none; }
.tdip-mode-label { font-size: 13px; font-weight: 600; color: var(--text-secondary); white-space: nowrap; }
.tdip-seg { display: inline-flex; padding: 3px; gap: 2px; border-radius: 10px; background: #eef1f7; border: 1px solid var(--border-color); flex-wrap: wrap; }
.tdip-seg label { position: relative; cursor: pointer; }
.tdip-seg input { position: absolute; width: 1px; height: 1px; margin: 0; opacity: 0; pointer-events: none; }
.tdip-seg span {
  display: inline-flex; align-items: center; gap: 4px; height: 28px; padding: 0 14px; border-radius: 7px;
  font-size: 13px; color: var(--text-secondary); white-space: nowrap; transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}
.tdip-seg label:hover span { color: var(--primary-dark); }
.tdip-seg input:checked + span { background: #fff; color: var(--primary-dark); font-weight: 600; box-shadow: 0 1px 3px rgba(15, 23, 42, 0.12); }
.tdip-seg input:focus-visible + span { outline: 2px solid var(--primary-color); outline-offset: 1px; }
.tdip-seg input:disabled + span { opacity: 0.5; cursor: not-allowed; }
.tdip-seg .tdip-rec { margin-left: 2px; }
.tdip-seg-desc { flex: 1 1 260px; margin: 0; font-size: 12px; color: var(--text-muted); line-height: 1.5; }
.tdip-seg-desc:empty { display: none; }
.tdip-mode-note {
  margin: -4px 0 0; padding: 7px 12px; border-radius: var(--radius-md); background: #f5f7ff; border-left: 3px solid #a5b4fc;
  font-size: 12.5px; color: var(--text-secondary); line-height: 1.55;
}
.tdip-mode-note[hidden] { display: none; }
.tdip-section-title .ask { margin-left: -2px; }
.tdip-group legend .ask, .tdip-file-name .ask { vertical-align: -3px; }
.tdip-section { display: flex; flex-direction: column; gap: 10px; }
.tdip-section-title { font-size: 13px; font-weight: 600; color: var(--text-secondary); display: flex; align-items: center; gap: 8px; }
.tdip-section-title::after { content: ""; flex: 1; height: 1px; background: var(--border-color); }
.tdip-files { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.tdip-files:has(> [data-theory][hidden]) { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.tdip-reveal { display: grid; grid-template-rows: 0fr; opacity: 0; transition: grid-template-rows 0.25s ease, opacity 0.2s ease, margin 0.25s ease; margin-top: -10px; }
.tdip-reveal > div { overflow: hidden; min-height: 0; }
.tdip-reveal.open { grid-template-rows: 1fr; opacity: 1; margin-top: 0; }
.tdip-dem-panel {
  position: relative; margin-top: 9px; display: flex; flex-direction: column; gap: 8px;
  border: 1px solid #c7d2fe; border-radius: var(--radius-lg); background: #f5f7ff; padding: 10px 12px 12px;
}
.tdip-rec {
  display: inline-block; font-style: normal; font-weight: 600; font-size: 11px; line-height: 16px; padding: 0 6px; margin-left: 4px;
  border-radius: 999px; color: #047857; background: #d1fae5; border: 1px solid #a7f3d0; vertical-align: 1px; white-space: nowrap;
}
.tdip-dem-panel .tdip-reveal { margin-top: -8px; }
.tdip-dem-panel .tdip-reveal.open { margin-top: 0; }
.tdip-steps {
  list-style: none; margin: 0; padding: 10px 0 0; border-top: 1px dashed #c7d2fe;
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-flow: column; grid-template-rows: auto auto; gap: 12px 10px;
  font-size: 12px; color: var(--text-secondary); line-height: 1.6;
}
.tdip-steps li { position: relative; display: flex; gap: 8px; min-width: 0; padding-left: 2px; }
.tdip-steps li.last { grid-row: 1 / 3; }
.tdip-steps li:first-child::before { content: ""; position: absolute; left: 10.5px; top: 24px; bottom: -10px; width: 1px; background: #c7d2fe; }
.tdip-steps li > div { display: flex; flex-direction: column; gap: 3px; min-width: 0; flex: 1; }
.tdip-steps li strong { font-size: 12.5px; color: var(--text-primary); }
.tdip-steps li .tdip-file { margin-top: 4px; background: #fff; }
.tdip-steps b {
  flex: none; width: 18px; height: 18px; border-radius: 50%; margin-top: 1px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 11px; color: #fff; background: var(--primary-color);
}
.tdip-formula { padding-top: 2px; }
.tdip-adv { border: 1px solid var(--border-color); border-radius: var(--radius-lg); background: var(--bg-hover); }
.tdip-adv summary { cursor: pointer; padding: 8px 12px; font-size: 12px; font-weight: 600; color: var(--text-secondary); list-style-position: inside; }
.tdip-adv summary span { font-weight: 400; color: var(--text-muted); margin-left: 6px; }
.tdip-adv[open] summary { border-bottom: 1px solid var(--border-color); }
.tdip-adv-body { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 280px)); gap: 10px 24px; padding: 10px 12px 12px; background: #fff; border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
.tdip-params { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 10px; }
.tdip-group {
  border: 1px solid var(--border-color); border-radius: var(--radius-lg);
  padding: 8px 12px 10px; display: grid; grid-template-columns: 1fr 1fr; gap: 8px 10px; align-content: start; min-width: 0;
}
.tdip-group legend { padding: 0 4px; font-size: 12px; font-weight: 600; color: var(--primary-dark); }
.tdip-field { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.tdip-field.wide { grid-column: 1 / -1; }
.tdip-file-hint b[data-theory-need] { font-weight: 600; color: var(--text-secondary); }
.tdip-file-hint b[data-theory-need].off { font-weight: 400; color: var(--text-muted); }
.tdip-field label { font-size: 12px; color: var(--text-muted); }
.tdip-field input {
  width: 100%; height: 32px; border: 1px solid var(--border-color); border-radius: var(--radius-md);
  padding: 0 10px; background: #fff; color: var(--text-primary); font-size: 13px; font-variant-numeric: tabular-nums;
}
.tdip-field select {
  width: 100%; height: 32px; border: 1px solid var(--border-color); border-radius: var(--radius-md);
  padding: 0 8px; background: #fff; color: var(--text-primary); font-size: 13px;
}
.tdip-field select:focus { outline: none; border-color: var(--primary-light); box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15); }
.tdip-crs [hidden] { display: none !important; }
.tdip-tick { grid-column: 1 / -1; display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-secondary); cursor: pointer; }
.tdip-tick input { width: 15px; height: 15px; margin: 0; accent-color: var(--primary-color); }
.tdip-crs-tm { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr; gap: 8px 10px; padding-top: 8px; border-top: 1px dashed var(--border-color); }
.tdip-crs-now { grid-column: 1 / -1; margin: 0; padding: 6px 8px; border-radius: var(--radius-md); background: #eef2ff; color: var(--primary-dark); font-size: 12px; line-height: 1.5; }
.tdip-crs-now:empty { display: none; }
.tdip-crs-now b { font-weight: 600; }
.tdip-crs-now.bad { background: #fef2f2; color: #b91c1c; }
.tdip-field input:focus { outline: none; border-color: var(--primary-light); box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15); }
.tdip-field input:user-invalid { border-color: var(--error-color); }
.tdip-unit { display: flex; }
.tdip-unit input { border-radius: var(--radius-md) 0 0 var(--radius-md); min-width: 0; }
.tdip-unit span {
  display: grid; place-items: center; min-width: 30px; padding: 0 8px; font-size: 12px; color: var(--text-muted);
  border: 1px solid var(--border-color); border-left: 0; border-radius: 0 var(--radius-md) var(--radius-md) 0; background: var(--bg-hover);
}
.tdip-help { grid-column: 1 / -1; margin: 0; font-size: 11.5px; color: var(--text-muted); line-height: 1.5; }

.tdip-actions {
  position: sticky; bottom: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 4px 12px; flex-wrap: wrap;
  margin: 0 -20px; padding: 10px 20px 12px; border-top: 1px solid var(--border-color);
  background: rgba(255, 255, 255, 0.97); border-radius: 0 0 var(--radius-xl) var(--radius-xl);
  box-shadow: 0 -8px 18px -12px rgba(15, 23, 42, 0.25);
}
.tdip-submit { display: flex; align-items: center; gap: 12px; margin-left: auto; }
.tdip-card .tdip-submit { margin-top: auto; justify-content: flex-end; }
.tdip-submit .btn { min-width: 120px; }
.tdip-submit .btn:disabled, .tdip-sample-actions .btn:disabled { opacity: 0.6; cursor: wait; transform: none; box-shadow: none; }
.tdip-progress { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-secondary); }
.tdip-progress[hidden] { display: none; }
.tdip-bar { width: 160px; height: 6px; border-radius: 999px; background: #e0e7ff; overflow: hidden; }
.tdip-bar i { display: block; height: 100%; width: 0; background: var(--primary-color); transition: width 0.2s ease; }
.tdip-progress em { font-style: normal; font-variant-numeric: tabular-nums; }
.tdip-progress.bad { color: #b91c1c; }
.tdip-progress.bad .tdip-bar { display: none; }

.side .side-props { margin: -4px 0 10px; font-size: 12px; color: var(--text-secondary); line-height: 1.6; }
.side .side-all { margin-bottom: 4px; font-size: 13px; padding: 8px 12px; }
.tdip-credit { margin: 8px 0 4px; font-size: 11px; line-height: 1.55; color: #94a3b8; overflow-wrap: anywhere; }
.tdip-redo { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; margin: 8px 0 4px; font-size: 12px; color: var(--text-muted); }
.tdip-redo .btn { display: inline-flex; align-items: center; height: 30px; padding: 0 12px; font-size: 12px; white-space: nowrap; }
.side .tdip-redo .btn { flex: 1 1 100%; justify-content: center; }
.tdip-redo a:not(.btn) { color: var(--primary-color); }

.tdip-reuse {
  display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 14px;
  margin: 0 0 14px; padding: 9px 12px; border: 1px solid #c7d2fe; border-radius: 8px; background: #f5f7ff;
  font-size: 13px; line-height: 1.6; color: var(--text-secondary);
}
.tdip-reuse p { margin: 0; flex: 1 1 320px; }
.tdip-reuse a { color: var(--primary-color); }
.tdip-reuse-off { font-size: 12px; white-space: nowrap; }
.tdip-reuse.bad { display: block; border-color: #fca5a5; background: #fef2f2; color: #b91c1c; }
.tdip-file.reused { border-color: #c7d2fe; }
.tdip-file.reused .tdip-file-picked { color: var(--primary-color); }

.tdip-error { max-width: 560px; margin: 40px auto; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.tdip-error-code { font-size: 44px; font-weight: 700; color: #c7d2fe; line-height: 1; font-variant-numeric: tabular-nums; }
.card.tdip-error h2 { border: 0; padding: 0; margin: 0; font-size: 18px; }
.tdip-error .tdip-note { font-size: 14px; }
.tdip-error-actions { display: flex; gap: 8px; margin-top: 8px; }

.tdip-guide { display: grid; grid-template-columns: 180px minmax(0, 1fr); gap: 14px; align-items: start; }
.tdip-toc { position: sticky; top: 96px; padding: 12px 10px; display: flex; flex-direction: column; gap: 2px; }
.tdip-toc b { font-size: 12px; color: var(--text-muted); padding: 0 8px 6px; }
.tdip-toc a { font-size: 13px; color: var(--text-secondary); padding: 5px 8px; border-radius: var(--radius-sm); }
.tdip-toc a:hover { background: #eef2ff; color: var(--primary-color); text-decoration: none; }
.tdip-prose-extra ol, .tdip-prose-extra ul { margin: 0 0 10px 20px; padding: 0; }
.tdip-prose-extra li { margin: 2px 0; }
.tdip-prose-extra ul li::marker { color: #a5b4fc; }
.tdip-prose-extra h3 { margin: 16px 0 6px; font-size: 15px; font-weight: 600; color: var(--text-primary, #1e293b); }
.tdip-prose-extra h3 + ul, .tdip-prose-extra h3 + p { margin-top: 0; }
.tdip-spec { width: 100%; margin: 4px 0 12px; font-size: 13px; border: 1px solid var(--border-color); border-radius: var(--radius-md); overflow: hidden; }
.tdip-spec th { background: var(--bg-hover); color: var(--text-secondary); font-size: 12px; }
.tdip-spec th, .tdip-spec td { padding: 7px 10px; vertical-align: top; }
.tdip-spec td:first-child { white-space: nowrap; font-weight: 600; color: var(--text-primary); }
@media (max-width: 520px) {
  .tdip-spec th, .tdip-spec td { padding: 6px 7px; }
  .tdip-spec td:first-child { white-space: normal; }
}

@media (max-width: 1100px) {
  .tdip-params { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
  .tdip-quick { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tdip-quick .tdip-sample { grid-column: 1 / -1; }
}
@media (max-width: 900px) {
  .tdip-quick, .tdip-files, .tdip-params, .tdip-guide, .tdip-adv-body, .tdip-recent-list { grid-template-columns: 1fr; }
  .tdip-flows { gap: 10px; }
  .tdip-flow { flex-direction: column; align-items: flex-start; gap: 6px; padding: 10px 12px; }
  .tdip-flow-text small { display: none; }
  .tdip-recent { padding: 12px 14px 14px; }
  .tdip-files:has(> [data-full][hidden]) { grid-template-columns: 1fr; }
  .tdip-steps { grid-template-columns: 1fr; grid-auto-flow: row; grid-template-rows: none; }
  .tdip-steps li.last { grid-row: auto; }
  .tdip-sample-pop { left: 0; right: 0; width: auto; max-width: none; }
  .tdip-facts, .tdip-stations .tdip-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tdip-toc { position: static; flex-direction: row; flex-wrap: wrap; }
  .tdip-toc b { width: 100%; }
  .tdip-actions { position: static; flex-direction: column; align-items: stretch; box-shadow: none; }
  .tdip-outcome, .tdip-limit { flex: none; }
  .tdip-submit { margin-left: 0; flex-direction: column; align-items: stretch; }
  .tdip-bar { width: 100%; }
  .tdip-progress { flex-direction: column; align-items: stretch; }
}
@media (prefers-reduced-motion: reduce) {
  .tdip-reveal, .tdip-choice, .tdip-file { transition: none; }
}
