/* ==========================================================================
   AI 网页通 V3.1 风格 × Villa Scheme Studio 本地模块化工作台样式层
   - 支持 Light / Dark / Auto 三态主题
   - 左侧 224px 固定导航栏 + 顶栏面包屑与状态胶囊 + 卡片化主视区
   - 桥接 studio-workbench / studio-artifacts 变量，确保全模块主题统一
   ========================================================================== */

:root,
html[data-theme="light"] {
  --wt-font-sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", sans-serif;
  --wt-font-mono: var(--wt-font-sans);
  --font-sans: var(--wt-font-sans);
  --font-mono: var(--wt-font-sans);

  /* 严格 4 级字号体系 (Strictly 4 Font Sizes) */
  --fs-xl: 20px; /* Level 1: 大标题 */
  --fs-lg: 16px; /* Level 2: 左边栏导航 & 二级标题 */
  --fs-md: 14px; /* Level 3: 正文、表单、按钮 */
  --fs-sm: 12px; /* Level 4: 徽标、胶囊、终端 */

  --wt-bg: #f5f6f8;
  --wt-surface: #ffffff;
  --wt-surface-2: #f9fafc;
  --wt-surface-3: #f1f4f9;
  --wt-line: #e4e8f0;
  --wt-line-strong: #cbd5e1;
  --wt-text: #161b26;
  --wt-text-2: #5b6476;
  --wt-muted: #7c8699;
  --wt-accent: #355ee8;
  --wt-accent-hover: #294ec9;
  --wt-accent-soft: #eef2fe;
  --wt-ok: #16944d;
  --wt-ok-soft: #eaf8f0;
  --wt-warn: #d97706;
  --wt-warn-soft: #fef5e7;
  --wt-bad: #d93848;
  --wt-bad-soft: #fdf0f1;
  --wt-shadow: 0 1px 2px rgba(22, 27, 38, 0.05), 0 4px 14px rgba(22, 27, 38, 0.04);
  --wt-shadow-lg: 0 12px 32px rgba(22, 27, 38, 0.12);

  /* 桥接旧组件 CSS tokens 到 WebTong 亮色主题 */
  --bg-primary: var(--wt-bg);
  --bg-secondary: var(--wt-surface);
  --bg-tertiary: var(--wt-surface-2);
  --bg-elevated: var(--wt-surface-3);
  --bg-input: var(--wt-surface);
  --border-subtle: var(--wt-line);
  --border-strong: var(--wt-line-strong);
  --border-focus: var(--wt-accent);
  --text-primary: var(--wt-text);
  --text-secondary: var(--wt-text-2);
  --text-muted: var(--wt-muted);
  --text-inverse: #ffffff;
  --accent-cyan: var(--wt-accent);
  --accent-blue: var(--wt-accent);
  --accent-blue-hover: var(--wt-accent-hover);
  --accent-glow: rgba(53, 94, 232, 0.14);
  --status-pass: var(--wt-ok);
  --status-pass-bg: var(--wt-ok-soft);
  --status-review: var(--wt-warn);
  --status-review-bg: var(--wt-warn-soft);
  --status-fail: var(--wt-bad);
  --status-fail-bg: var(--wt-bad-soft);
  --status-running: #355ee8;
  --status-running-bg: rgba(53, 94, 232, 0.12);
}

html[data-theme="dark"] {
  --wt-bg: #101722;
  --wt-surface: #161f2e;
  --wt-surface-2: #1c2638;
  --wt-surface-3: #222e44;
  --wt-line: #263349;
  --wt-line-strong: #374863;
  --wt-text: #eef3fb;
  --wt-text-2: #a5b2c7;
  --wt-muted: #7f8da5;
  --wt-accent: #6284ff;
  --wt-accent-hover: #7b98ff;
  --wt-accent-soft: #1b2a4d;
  --wt-ok: #38c97a;
  --wt-ok-soft: rgba(56, 201, 122, 0.14);
  --wt-warn: #f5b841;
  --wt-warn-soft: rgba(245, 184, 65, 0.15);
  --wt-bad: #f26877;
  --wt-bad-soft: rgba(242, 104, 119, 0.14);
  --wt-shadow: 0 2px 6px rgba(0, 0, 0, 0.28), 0 8px 20px rgba(0, 0, 0, 0.22);
  --wt-shadow-lg: 0 14px 36px rgba(0, 0, 0, 0.45);

  /* 桥接旧组件 CSS tokens 到 WebTong 暗色主题 */
  --bg-primary: var(--wt-bg);
  --bg-secondary: var(--wt-surface);
  --bg-tertiary: var(--wt-surface-2);
  --bg-elevated: var(--wt-surface-3);
  --bg-input: #0e1420;
  --border-subtle: var(--wt-line);
  --border-strong: var(--wt-line-strong);
  --border-focus: var(--wt-accent);
  --text-primary: var(--wt-text);
  --text-secondary: var(--wt-text-2);
  --text-muted: var(--wt-muted);
  --text-inverse: #0e1420;
  --accent-cyan: var(--wt-accent);
  --accent-blue: var(--wt-accent);
  --accent-blue-hover: var(--wt-accent-hover);
  --accent-glow: rgba(98, 132, 255, 0.18);
  --status-pass: var(--wt-ok);
  --status-pass-bg: var(--wt-ok-soft);
  --status-review: var(--wt-warn);
  --status-review-bg: var(--wt-warn-soft);
  --status-fail: var(--wt-bad);
  --status-fail-bg: var(--wt-bad-soft);
  --status-running: #6284ff;
  --status-running-bg: rgba(98, 132, 255, 0.18);
}

*, *::before, *::after {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: var(--wt-bg);
  color: var(--wt-text);
  font-family: var(--wt-font-sans);
  font-size: var(--fs-md);
  font-variant-numeric: tabular-nums;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

.mono {
  font-family: var(--wt-font-sans);
  font-variant-numeric: tabular-nums;
}

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

h1, h2 {
  font-size: var(--fs-xl);
  font-weight: 700;
}

h3, h4 {
  font-size: var(--fs-lg);
  font-weight: 700;
}

input, select, textarea, button {
  font-family: var(--wt-font-sans);
  font-size: var(--fs-md);
}

code, pre {
  font-family: var(--wt-font-mono);
  font-size: var(--fs-sm);
}

/* --------------------------------------------------------------------------
   App Shell Grid Layout (WebTong Fixed Left Sidebar)
   -------------------------------------------------------------------------- */

.app-layout {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  min-height: 100vh;
  width: 100%;
}

.sidebar {
  background: var(--wt-surface);
  border-right: 1px solid var(--wt-line);
  padding: 18px 12px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 40;
}

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

.brand-mark {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--wt-accent), #1e40af);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: var(--fs-lg);
  letter-spacing: 0.02em;
  box-shadow: 0 4px 12px rgba(53, 94, 232, 0.28);
  overflow: hidden;
  flex-shrink: 0;
}

.brand-mark img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.brand-meta {
  min-width: 0;
}

.brand-title {
  font-weight: 700;
  font-size: var(--fs-xl);
  color: var(--wt-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.brand-sub {
  font-size: var(--fs-md);
  color: var(--wt-muted);
  display: flex;
  align-items: center;
  gap: 5px;
}

.nav-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sidebar nav.tabs-navigation {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 14px;
  padding: 0;
  margin: 0;
  border: 0;
  background: transparent;
  overflow: visible;
}

.nav-label {
  font-size: var(--fs-md);
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--wt-muted);
  padding: 6px 10px 4px;
  text-transform: uppercase;
}

.nav-link,
.sidebar .nav-link.tab-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  border: 0;
  border-bottom: 0;
  background: transparent;
  color: var(--wt-text-2);
  padding: 10px 10px;
  border-radius: 9px;
  cursor: pointer;
  font-size: var(--fs-lg);
  font-weight: 500;
  text-align: left;
  transition: background-color 140ms ease, color 140ms ease, transform 120ms ease;
}

.nav-link:hover,
.sidebar .nav-link.tab-btn:hover {
  background: var(--wt-surface-2);
  color: var(--wt-text);
  border-bottom: 0;
}

.nav-link.active,
.sidebar .nav-link.tab-btn.active {
  background: var(--wt-accent-soft);
  color: var(--wt-accent);
  font-weight: 600;
  border-bottom: 0;
}

.nav-link-main {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.nav-icon {
  font-size: var(--fs-lg);
  width: 20px;
  text-align: center;
  flex-shrink: 0;
}

.nav-badge {
  font-size: var(--fs-sm);
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--wt-surface-3);
  color: var(--wt-text-2);
  font-weight: 600;
  flex-shrink: 0;
}

.nav-link.active .nav-badge {
  background: var(--wt-accent);
  color: #fff;
}

.sidebar-footer {
  margin-top: auto;
  padding: 10px 8px 4px;
  border-top: 1px solid var(--wt-line);
  font-size: var(--fs-sm);
  color: var(--wt-muted);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sidebar-mode-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 9px;
  border-radius: 7px;
  background: var(--wt-ok-soft);
  color: var(--wt-ok);
  font-weight: 600;
  font-size: var(--fs-sm);
  width: fit-content;
}

.sidebar-port-info {
  font-size: var(--fs-sm);
}

/* --------------------------------------------------------------------------
   Main Column & Topbar
   -------------------------------------------------------------------------- */

.main-pane {
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: var(--wt-bg);
}

.topbar {
  background: var(--wt-surface);
  border-bottom: 1px solid var(--wt-line);
  min-height: 56px;
  padding: 10px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  position: sticky;
  top: 0;
  z-index: 30;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.crumb {
  font-size: var(--fs-xl);
  font-weight: 700;
  color: var(--wt-text);
  margin: 0;
}

.crumb-sub {
  font-size: var(--fs-md);
  color: var(--wt-muted);
  padding-left: 10px;
  border-left: 1px solid var(--wt-line);
}

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

/* Status Pills */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: var(--fs-sm);
  font-weight: 600;
  border: 1px solid var(--wt-line);
  background: var(--wt-surface-2);
  color: var(--wt-text-2);
  white-space: nowrap;
}

.pill-dot {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: currentColor;
}

.pill.ok {
  background: var(--wt-ok-soft);
  color: var(--wt-ok);
  border-color: color-mix(in srgb, var(--wt-ok) 30%, transparent);
}

.pill.warn {
  background: var(--wt-warn-soft);
  color: var(--wt-warn);
  border-color: color-mix(in srgb, var(--wt-warn) 30%, transparent);
}

.pill.bad {
  background: var(--wt-bad-soft);
  color: var(--wt-bad);
  border-color: color-mix(in srgb, var(--wt-bad) 30%, transparent);
}

.pill.accent {
  background: var(--wt-accent-soft);
  color: var(--wt-accent);
  border-color: color-mix(in srgb, var(--wt-accent) 30%, transparent);
}

/* Buttons */
.btn,
button.wt-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 8px;
  font-family: var(--wt-font-sans);
  font-size: var(--fs-md);
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--wt-line);
  background: var(--wt-surface);
  color: var(--wt-text);
  transition: all 140ms ease;
  white-space: nowrap;
  text-decoration: none;
}

.btn:hover:not(:disabled) {
  background: var(--wt-surface-2);
  border-color: var(--wt-line-strong);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--wt-accent);
  border-color: var(--wt-accent);
  color: #ffffff;
}

.btn-primary:hover:not(:disabled) {
  background: var(--wt-accent-hover);
  border-color: var(--wt-accent-hover);
  color: #ffffff;
}

.btn-secondary {
  background: var(--wt-surface-2);
  border-color: var(--wt-line);
  color: var(--wt-text);
}

.btn-outline {
  background: transparent;
  border-color: var(--wt-line-strong);
  color: var(--wt-text-2);
}

.btn-ghost {
  background: transparent;
  border-color: var(--wt-line);
  color: var(--wt-text-2);
}

.btn-danger {
  background: var(--wt-bad-soft);
  border-color: color-mix(in srgb, var(--wt-bad) 35%, transparent);
  color: var(--wt-bad);
}

.btn-danger:hover:not(:disabled) {
  background: var(--wt-bad);
  color: #ffffff;
}

.btn-success {
  background: var(--wt-ok);
  border-color: var(--wt-ok);
  color: #ffffff;
}

.btn-sm {
  padding: 5px 10px;
  font-size: var(--fs-md);
  border-radius: 7px;
}

.btn-theme {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border-radius: 8px;
  border: 1px solid var(--wt-line);
  background: var(--wt-surface-2);
  color: var(--wt-text-2);
  font-family: var(--wt-font-sans);
  font-size: var(--fs-md);
  font-weight: 600;
  cursor: pointer;
}

.btn-theme:hover {
  border-color: var(--wt-accent);
  color: var(--wt-text);
}

/* --------------------------------------------------------------------------
   Content Workspace & Views
   -------------------------------------------------------------------------- */

.content-wrap {
  padding: 20px 24px 36px;
  width: 100%;
  max-width: 1480px;
  margin: 0 auto;
  min-width: 0;
}

.view-panel {
  display: none;
  animation: wtFadeIn 160ms ease;
}

.view-panel.active {
  display: block;
}

@keyframes wtFadeIn {
  from { opacity: 0; transform: translateY(3px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Toast / Inline Message */
.ui-toast {
  display: none;
  margin-bottom: 14px;
  padding: 11px 14px;
  border-radius: 10px;
  font-size: var(--fs-md);
  font-weight: 500;
  border: 1px solid var(--wt-line);
  background: var(--wt-surface);
  color: var(--wt-text);
  box-shadow: var(--wt-shadow);
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.ui-toast.visible {
  display: flex;
}

.ui-toast.success {
  background: var(--wt-ok-soft);
  color: var(--wt-ok);
  border-color: color-mix(in srgb, var(--wt-ok) 35%, transparent);
}

.ui-toast.warn,
.ui-toast.warning {
  background: var(--wt-warn-soft);
  color: var(--wt-warn);
  border-color: color-mix(in srgb, var(--wt-warn) 35%, transparent);
}

.ui-toast.error {
  background: var(--wt-bad-soft);
  color: var(--wt-bad);
  border-color: color-mix(in srgb, var(--wt-bad) 35%, transparent);
}

.ui-toast.info {
  background: var(--wt-accent-soft);
  color: var(--wt-accent);
  border-color: color-mix(in srgb, var(--wt-accent) 35%, transparent);
}

/* Overview 3-Card Row (WebTong Reference) */
.overview-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}

.stat-card {
  background: var(--wt-surface);
  border: 1px solid var(--wt-line);
  border-radius: 12px;
  padding: 16px 18px;
  box-shadow: var(--wt-shadow);
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.stat-head {
  font-size: var(--fs-sm);
  color: var(--wt-muted);
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.stat-val {
  font-size: var(--fs-xl);
  font-weight: 700;
  color: var(--wt-text);
  line-height: 1.25;
}

.stat-sub {
  font-size: var(--fs-sm);
  color: var(--wt-text-2);
}

/* Standard Cards & Grids */
.card {
  background: var(--wt-surface);
  border: 1px solid var(--wt-line);
  border-radius: 12px;
  padding: 18px 20px;
  box-shadow: var(--wt-shadow);
  margin-bottom: 16px;
  min-width: 0;
}

.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.card-title {
  margin: 0;
  font-size: var(--fs-xl);
  font-weight: 700;
  color: var(--wt-text);
}

.card-subtitle {
  margin: 4px 0 0;
  font-size: var(--fs-md);
  color: var(--wt-muted);
}

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

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

.stat-tile {
  background: var(--wt-surface-2);
  border: 1px solid var(--wt-line);
  border-radius: 10px;
  padding: 12px 14px;
  min-width: 0;
}

.stat-label {
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--wt-muted);
  margin-bottom: 4px;
}

.stat-number {
  font-size: var(--fs-lg);
  font-weight: 700;
  color: var(--wt-text);
  word-break: break-all;
}

/* Forms & Inputs */
.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 12px;
}

.field label,
.form-label {
  font-size: var(--fs-md);
  font-weight: 600;
  color: var(--wt-text-2);
}

.field input,
.field select,
.field textarea,
.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 8px 11px;
  border-radius: 8px;
  border: 1px solid var(--wt-line);
  background: var(--bg-input);
  color: var(--wt-text);
  font-size: var(--fs-md);
  font-family: var(--wt-font-sans);
  transition: border-color 140ms ease, box-shadow 140ms ease;
}

.field input:focus,
.field select:focus,
.field textarea:focus,
.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--wt-accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* License Gate Banner & Activation Flow */
.license-gate-banner {
  background: linear-gradient(135deg, var(--wt-warn-soft), var(--wt-surface));
  border: 1px solid color-mix(in srgb, var(--wt-warn) 45%, transparent);
  border-radius: 12px;
  padding: 16px 18px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.license-gate-title {
  font-weight: 700;
  font-size: var(--fs-lg);
  color: var(--wt-text);
  margin-bottom: 3px;
}

.license-gate-desc {
  font-size: var(--fs-md);
  color: var(--wt-text-2);
}

.quick-fill-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 8px;
  margin-bottom: 12px;
}

.demo-chip {
  font-family: var(--wt-font-sans);
  font-variant-numeric: tabular-nums;
  font-size: var(--fs-sm);
  padding: 4px 9px;
  border-radius: 7px;
  border: 1px dashed var(--wt-accent);
  background: var(--wt-accent-soft);
  color: var(--wt-accent);
  cursor: pointer;
  font-weight: 600;
}

.demo-chip:hover {
  background: var(--wt-accent);
  color: #fff;
}

.demo-chip.expired {
  border-color: var(--wt-bad);
  background: var(--wt-bad-soft);
  color: var(--wt-bad);
}

/* macOS Dark Terminal Window (WebTong Audit & Runtime Log Style) */
.term {
  background: #0d121c;
  color: #dbe4f3;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid #1e293b;
  box-shadow: var(--wt-shadow);
}

.term-bar {
  background: #141c2b;
  border-bottom: 1px solid #1f2a3f;
  padding: 9px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.term-dots {
  display: flex;
  align-items: center;
  gap: 7px;
}

.term-bar .dot {
  width: 11px;
  height: 11px;
  border-radius: 999px;
  display: inline-block;
}

.term-bar .dot.red { background: #ef4444; }
.term-bar .dot.amber { background: #f59e0b; }
.term-bar .dot.green { background: #10b981; }

.term-title {
  font-size: var(--fs-sm);
  color: #94a3b8;
  font-family: var(--wt-font-sans);
}

.term-body {
  padding: 14px 16px;
  font-family: var(--wt-font-mono);
  font-size: var(--fs-sm);
  line-height: 1.65;
  max-height: 360px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

.log-ok { color: #34d399; }
.log-warn { color: #fbbf24; }
.log-err { color: #fb7185; }
.log-dim { color: #64748b; }

/* Audit Table */
.audit-table-wrap {
  width: 100%;
  overflow-x: auto;
}

.audit-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-md);
}

.audit-table th,
.audit-table td {
  text-align: left;
  padding: 9px 10px;
  border-bottom: 1px solid var(--wt-line);
}

.audit-table th {
  font-size: var(--fs-md);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--wt-muted);
  font-weight: 700;
  background: var(--wt-surface-2);
}

/* Modular Architecture & Hot-Update Cards */
.host-shell-card {
  background: linear-gradient(135deg, var(--wt-accent-soft), var(--wt-surface) 60%);
  border: 1px solid color-mix(in srgb, var(--wt-accent) 30%, var(--wt-line));
}

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

.module-card {
  background: var(--wt-surface);
  border: 1px solid var(--wt-line);
  border-radius: 12px;
  padding: 15px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.module-card:hover {
  border-color: var(--wt-accent);
  box-shadow: var(--wt-shadow);
}

.module-card.is-flashing {
  animation: wtHotFlash 1.2s ease;
}

@keyframes wtHotFlash {
  0% { box-shadow: 0 0 0 0 rgba(53, 94, 232, 0.55); border-color: var(--wt-accent); }
  50% { box-shadow: 0 0 0 6px rgba(53, 94, 232, 0.12); border-color: var(--wt-ok); }
  100% { box-shadow: var(--wt-shadow); border-color: var(--wt-line); }
}

.module-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.module-name {
  font-weight: 700;
  font-size: var(--fs-lg);
  color: var(--wt-text);
  display: flex;
  align-items: center;
  gap: 6px;
}

.module-id-tag {
  font-family: var(--wt-font-sans);
  font-variant-numeric: tabular-nums;
  font-size: var(--fs-sm);
  padding: 2px 7px;
  border-radius: 6px;
  background: var(--wt-surface-2);
  border: 1px solid var(--wt-line);
  color: var(--wt-text-2);
}

.module-meta-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  padding: 9px 10px;
  border-radius: 8px;
  background: var(--wt-surface-2);
  border: 1px solid var(--wt-line);
  font-size: var(--fs-sm);
}

.digest-chip {
  font-family: var(--wt-font-mono);
  font-size: var(--fs-sm);
  color: var(--wt-muted);
  word-break: break-all;
}

.dropzone-upload {
  border: 1.5px dashed var(--wt-line-strong);
  border-radius: 10px;
  padding: 16px;
  background: var(--wt-surface-2);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

/* Legacy Component Bridge Tweaks */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: var(--fs-sm);
  font-weight: 700;
  text-transform: uppercase;
}

.badge-pass { background: var(--wt-ok-soft); color: var(--wt-ok); }
.badge-fail { background: var(--wt-bad-soft); color: var(--wt-bad); }
.badge-review,
.badge-warn { background: var(--wt-warn-soft); color: var(--wt-warn); }
.badge-running { background: var(--wt-accent-soft); color: var(--wt-accent); }
.badge-idle { background: var(--wt-surface-3); color: var(--wt-muted); }

/* Slide-out Blender Progress Drawer */
#blender-task-drawer {
  position: fixed;
  right: 20px;
  bottom: 20px;
  width: min(400px, calc(100vw - 32px));
  background: var(--wt-surface);
  border: 1px solid var(--wt-line-strong);
  border-radius: 12px;
  box-shadow: var(--wt-shadow-lg);
  z-index: 60;
  display: none;
  flex-direction: column;
  overflow: hidden;
}

#blender-task-drawer.open {
  display: flex;
}

.drawer-header {
  padding: 12px 14px;
  border-bottom: 1px solid var(--wt-line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--wt-surface-2);
}

.drawer-body {
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 320px;
  overflow-y: auto;
}

.progress-track {
  height: 8px;
  border-radius: 999px;
  background: var(--wt-surface-3);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--wt-accent), var(--wt-ok));
  transition: width 220ms ease;
}

/* Responsive Breakpoints */
@media (max-width: 1100px) {
  .overview-stats,
  .card-grid-3 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .module-grid,
  .card-grid-2 {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 820px) {
  .app-layout {
    grid-template-columns: 1fr;
  }
  .sidebar {
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--wt-line);
  }
  .overview-stats,
  .card-grid-3 {
    grid-template-columns: 1fr;
  }
  .content-wrap {
    padding: 14px 16px 28px;
  }
  .topbar {
    padding: 10px 16px;
  }
}

/* 4-Tier Typography Utilities & Smart Update Helpers */
.wt-title { font-size: var(--fs-xl); font-weight: 700; }
.wt-nav { font-size: var(--fs-lg); font-weight: 600; }
.wt-body { font-size: var(--fs-md); }
.wt-meta { font-size: var(--fs-sm); }

.matrix-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin: 8px 0 12px;
}

.matrix-section-title {
  margin: 0;
  font-size: var(--fs-lg);
  font-weight: 700;
  color: var(--wt-text);
}

.module-card.needs-smart-update {
  border-color: rgba(217, 119, 6, 0.45);
  box-shadow: inset 3px 0 0 var(--wt-warn), var(--wt-shadow);
}

.vault-lock-box {
  background: var(--bg-card, var(--wt-surface-2));
  border: 1px dashed var(--border-subtle);
  border-radius: 8px;
  padding: 16px;
  margin: 8px 0 12px;
}

.vault-lock-heading {
  font-size: var(--fs-md);
  font-weight: 700;
  color: var(--wt-text);
}

.vault-unlocked-bar {
  background: rgba(16, 185, 129, 0.06);
  border: 1px solid rgba(16, 185, 129, 0.3);
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.digest-fname {
  font-size: var(--fs-sm);
  font-weight: 700;
}

.drawer-title {
  font-size: var(--fs-md);
  font-weight: 700;
}

.drawer-task-id {
  font-size: var(--fs-sm);
}

.drawer-progress-row {
  display: flex;
  justify-content: space-between;
  font-size: var(--fs-sm);
}

.drawer-log-terminal {
  max-height: 160px;
  padding: 10px;
  font-size: var(--fs-sm);
}

.stat-number {
  font-size: var(--fs-xl);
}
