/* Source: web/semantic.html */
.tab-bar {
      display: flex;
      gap: 8px;
      border-bottom: 1px solid var(--line-border);
      margin-bottom: 20px;
    }
    .tab-btn {
      padding: 10px 18px;
      background: none;
      border: none;
      font-size: 13px;
      font-weight: 600;
      color: var(--text-dim);
      cursor: pointer;
      border-bottom: 2px solid transparent;
      transition: all 0.15s;
    }
    .tab-btn:hover { color: var(--brand); }
    .tab-btn.active {
      color: var(--brand);
      border-bottom-color: var(--brand);
    }
    .tab-content { display: none; }
    .tab-content.active { display: block; }

    /* 交互式 AI 机器人聊天流与容器样式 */
    .chat-container {
      display: flex;
      flex-direction: column;
      height: 720px;
      background: #ffffff;
      border: 1px solid var(--line-border);
      border-radius: 12px;
      box-shadow: 0 4px 16px rgba(0, 0, 0, 0.04);
      overflow: hidden;
      margin-bottom: 20px;
    }

    .chat-header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      padding: 12px 20px;
      border-bottom: 1px solid var(--line-border);
      background: #ffffff;
    }

    .chat-header-title {
      display: flex;
      align-items: center;
      gap: 12px;
    }

    .chat-header-avatar {
      width: 36px;
      height: 36px;
      border-radius: 10px;
      background: #eff6ff;
      color: #2563eb;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 20px;
      box-shadow: 0 2px 6px rgba(37,99,235,0.12);
    }

    .chat-stream {
      flex: 1;
      overflow-y: auto;
      padding: 20px;
      background: #f8fafc;
      display: flex;
      flex-direction: column;
      gap: 16px;
      scroll-behavior: smooth;
    }

    .chat-row {
      display: flex;
      gap: 12px;
      max-width: 90%;
      animation: chatFadeIn 0.2s ease-in-out;
    }

    @keyframes chatFadeIn {
      from { opacity: 0; transform: translateY(4px); }
      to { opacity: 1; transform: translateY(0); }
    }

    .chat-row.user {
      margin-left: auto;
      flex-direction: row-reverse;
    }

    .chat-row.ai {
      margin-right: auto;
    }

    .chat-avatar {
      width: 36px;
      height: 36px;
      border-radius: 50%;
      background: #e0f2fe;
      color: #0284c7;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 18px;
      flex-shrink: 0;
      box-shadow: 0 2px 5px rgba(0,0,0,0.06);
    }

    .chat-avatar.user {
      background: #2563eb;
      color: #ffffff;
    }

    .chat-bubble {
      border-radius: 12px;
      padding: 12px 16px;
      font-size: 13.5px;
      line-height: 1.65;
      box-shadow: 0 1px 3px rgba(0,0,0,0.04);
      word-break: break-word;
    }

    .chat-bubble.user {
      background: #2563eb;
      color: #ffffff;
      border-bottom-right-radius: 2px;
    }

    .chat-bubble.ai {
      background: #ffffff;
      border: 1px solid #e2e8f0;
      color: #1e293b;
      border-bottom-left-radius: 2px;
      max-width: 100%;
    }

    .chat-sender-name {
      font-size: 11px;
      font-weight: 700;
      color: #64748b;
      margin-bottom: 6px;
    }

    .chat-text {
      font-size: 13.5px;
    }

    .chat-data-table-wrapper {
      margin-top: 12px;
      border: 1px solid #e2e8f0;
      border-radius: 8px;
      overflow-x: auto;
      max-height: 280px;
      overflow-y: auto;
      background: #ffffff;
    }

    .sql-accordion {
      margin-top: 10px;
      background: #f8fafc;
      border: 1px solid #e2e8f0;
      border-radius: 6px;
      padding: 8px 12px;
      font-size: 12px;
    }

    .sql-accordion summary {
      cursor: pointer;
      display: flex;
      justify-content: space-between;
      align-items: center;
      font-weight: 600;
      color: #475569;
      user-select: none;
    }

    .sql-box-inline {
      background: #0f172a;
      color: #38bdf8;
      padding: 10px 12px;
      border-radius: 6px;
      font-family: monospace;
      font-size: 11.5px;
      overflow-x: auto;
      margin: 6px 0 0 0;
      line-height: 1.5;
    }

    .followup-box {
      margin-top: 12px;
      padding-top: 10px;
      border-top: 1px dashed #e2e8f0;
    }

    .followup-list {
      display: flex;
      flex-wrap: wrap;
      gap: 6px;
    }

    .followup-tag {
      background: #eff6ff;
      color: #2563eb;
      border: 1px solid #bfdbfe;
      padding: 4px 10px;
      border-radius: 14px;
      font-size: 11.5px;
      cursor: pointer;
      transition: all 0.15s;
    }

    .followup-tag:hover {
      background: #dbeafe;
      border-color: #93c5fd;
      color: #1d4ed8;
    }

    .chat-loading {
      display: flex;
      align-items: center;
      gap: 6px;
      padding: 4px 0;
    }

    .chat-loading .dot {
      width: 6px;
      height: 6px;
      border-radius: 50%;
      background: #94a3b8;
      animation: dotBlink 1.4s infinite ease-in-out both;
    }
    .chat-loading .dot:nth-child(1) { animation-delay: -0.32s; }
    .chat-loading .dot:nth-child(2) { animation-delay: -0.16s; }

    @keyframes dotBlink {
      0%, 80%, 100% { transform: scale(0); opacity: 0.3; }
      40% { transform: scale(1); opacity: 1; }
    }

    .chat-input-area {
      padding: 12px 18px 14px 18px;
      border-top: 1px solid var(--line-border);
      background: #ffffff;
    }

    .preset-chip-list {
      display: flex;
      flex-wrap: wrap;
      gap: 6px;
      margin-bottom: 10px;
    }

    .preset-chip {
      background: #f1f5f9;
      color: #334155;
      border: 1px solid #cbd5e1;
      border-radius: 14px;
      padding: 4px 10px;
      font-size: 11.5px;
      cursor: pointer;
      transition: all 0.15s;
    }

    .preset-chip:hover {
      background: #e2e8f0;
      border-color: #94a3b8;
      color: var(--brand);
    }

    .chat-input-box {
      display: flex;
      gap: 10px;
      align-items: center;
      background: #ffffff;
      border: 1.5px solid #cbd5e1;
      border-radius: 10px;
      padding: 6px 10px 6px 14px;
      transition: all 0.15s;
    }

    .chat-input-box:focus-within {
      border-color: #2563eb;
      box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
    }

    .chat-input-box input {
      flex: 1;
      border: none;
      outline: none;
      background: transparent;
      font-size: 13.5px;
      color: #0f172a;
    }

    .table-container {
      max-height: 320px;
      overflow-y: auto;
      border: 1px solid var(--line-border);
      border-radius: 6px;
    }

/* Source: web/push.html */
.modal-lg {
      width: 900px;
      max-width: 95vw;
      max-height: 85vh;
      overflow-y: auto;
    }
    .url-cell {
      max-width: 280px;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
      font-family: monospace;
      font-size: 11px;
      background: #f8fafc;
      padding: 2px 6px;
      border-radius: 4px;
      border: 1px solid #e2e8f0;
      display: inline-block;
      vertical-align: middle;
    }

/* Source: web/calc.html */
.stat-kpi-grid {
      display: grid;
      grid-template-columns: repeat(4, 1fr);
      gap: 16px;
      margin-bottom: 20px;
    }
    .stat-kpi-card {
      background: #f8fafc;
      border: 1px solid #e2e8f0;
      border-radius: 8px;
      padding: 16px;
    }
    .stat-kpi-label {
      font-size: 12px;
      color: #64748b;
      font-weight: 600;
    }
    .stat-kpi-val {
      font-size: 24px;
      font-weight: 800;
      color: #0f172a;
      margin-top: 4px;
      font-family: monospace;
    }
    .stat-kpi-sub {
      font-size: 11px;
      color: #94a3b8;
      margin-top: 2px;
    }
    .compare-grid {
      display: grid;
      grid-template-columns: repeat(4, 1fr);
      gap: 12px;
      margin: 16px 0;
    }
    .compare-card {
      background: #f8fafc;
      border: 1px solid #e2e8f0;
      border-radius: 8px;
      padding: 14px;
      text-align: center;
    }
    .compare-label {
      font-size: 12px;
      font-weight: 700;
      color: #475569;
      margin-bottom: 8px;
    }
    .compare-val-row {
      display: flex;
      justify-content: space-around;
      align-items: baseline;
      margin-bottom: 6px;
    }
    .compare-val-old {
      font-size: 16px;
      color: #64748b;
      text-decoration: line-through;
    }
    .compare-val-new {
      font-size: 22px;
      font-weight: 800;
      font-family: monospace;
    }
    .diff-badge {
      font-size: 11px;
      padding: 2px 6px;
      border-radius: 4px;
      font-weight: 700;
      display: inline-block;
    }
    .diff-pos { background: #ecfdf5; color: #059669; }
    .diff-neg { background: #fef2f2; color: #dc2626; }
    .diff-zero { background: #f1f5f9; color: #64748b; }

/* Source: web/weights.html */
/* 堆叠进度条与单卡进度条 */
    .stacked-bar-wrap {
      height: 12px;
      border-radius: 6px;
      overflow: hidden;
      display: flex;
      background: #e2e8f0;
      margin-bottom: 20px;
      border: 1px solid var(--line-border);
    }
    .stacked-segment {
      height: 100%;
      transition: width 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    }
    .mini-progress {
      height: 6px;
      background: #e2e8f0;
      border-radius: 3px;
      overflow: hidden;
      margin: 8px 0 12px;
    }
    .mini-fill {
      height: 100%;
      border-radius: 3px;
      transition: width 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    }

    .slider-row {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 16px;
      margin-bottom: 14px;
      padding-bottom: 12px;
      border-bottom: 1px solid var(--line-faint);
    }
    .slider-info { width: 230px; }
    .slider-name { font-weight: 700; font-size: 13px; color: #0f172a; }
    .slider-sub { font-size: 11px; color: var(--text-dim); }
    .slider-control { flex: 1; display: flex; align-items: center; gap: 14px; }
    .slider-control input[type=range] { flex: 1; accent-color: var(--brand); cursor: pointer; }
    .slider-val { width: 55px; text-align: right; font-weight: 800; font-size: 14px; color: var(--brand); font-family: monospace; }
    .slider-weight-total { width: 95px; text-align: right; font-size: 12px; color: var(--text-muted); }

/* Source: web/lineage.html */
.filter-btn-group {
      display: flex;
      gap: 8px;
      flex-wrap: wrap;
      margin-bottom: 16px;
    }
    .filter-btn {
      padding: 6px 14px;
      border-radius: 6px;
      font-size: 12px;
      font-weight: 600;
      background: #ffffff;
      border: 1px solid #cbd5e1;
      color: #475569;
      cursor: pointer;
      display: inline-flex;
      align-items: center;
      gap: 6px;
      transition: all 0.15s ease;
    }
    .filter-btn:hover {
      background: #f8fafc;
      color: #0f172a;
      border-color: #94a3b8;
    }
    .filter-btn.active {
      background: #2563eb;
      color: #ffffff;
      border-color: #2563eb;
    }
    .quick-stat-badge {
      background: #e2e8f0;
      color: #334155;
      padding: 1px 7px;
      border-radius: 10px;
      font-size: 11px;
      font-weight: 700;
    }
    .filter-btn.active .quick-stat-badge {
      background: rgba(255, 255, 255, 0.25);
      color: #ffffff;
    }

    .clean-table {
      width: 100%;
      border-collapse: collapse;
      font-size: 13px;
      text-align: left;
    }
    .clean-table th {
      background: #f8fafc;
      padding: 12px 14px;
      font-weight: 700;
      color: #334155;
      border-bottom: 2px solid #e2e8f0;
      white-space: nowrap;
    }
    .clean-table td {
      padding: 13px 14px;
      border-bottom: 1px solid #f1f5f9;
      vertical-align: middle;
      color: #1e293b;
    }
    .clean-table tbody tr:hover td {
      background: #f8fafc;
      cursor: pointer;
    }
    .stage-text {
      font-weight: 700;
      font-size: 12px;
      color: #0f172a;
      letter-spacing: 0.5px;
    }
    .table-name-text {
      font-family: Consolas, Monaco, "Courier New", monospace;
      font-weight: 700;
      color: #2563eb;
      font-size: 13px;
    }
    .upstream-list {
      display: flex;
      flex-direction: column;
      gap: 4px;
      font-family: Consolas, Monaco, "Courier New", monospace;
      font-size: 12px;
      color: #475569;
      line-height: 1.4;
    }

    .drawer-overlay {
      display: none;
      position: fixed;
      top: 0; left: 0; width: 100vw; height: 100vh;
      background: rgba(15, 23, 42, 0.6);
      backdrop-filter: blur(4px);
      z-index: 9999;
      justify-content: center;
      align-items: center;
      animation: fadeIn 0.15s ease;
    }
    @keyframes fadeIn {
      from { opacity: 0; }
      to { opacity: 1; }
    }
    .drawer-box {
      background: #ffffff;
      border-radius: 14px;
      width: 920px;
      max-width: 92vw;
      max-height: 88vh;
      display: flex;
      flex-direction: column;
      box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
      border: 1px solid #e2e8f0;
      overflow: hidden;
      animation: slideUp 0.2s ease;
    }
    @keyframes slideUp {
      from { transform: translateY(16px); opacity: 0; }
      to { transform: translateY(0); opacity: 1; }
    }
    .drawer-header {
      padding: 18px 24px;
      border-bottom: 1px solid #e2e8f0;
      background: #f8fafc;
      display: flex;
      justify-content: space-between;
      align-items: center;
    }
    .drawer-title {
      font-size: 17px;
      font-weight: 800;
      color: #0f172a;
      display: flex;
      align-items: center;
      gap: 10px;
    }
    .drawer-body {
      padding: 22px 26px;
      overflow-y: auto;
      flex: 1;
    }
    .drawer-meta-grid {
      display: grid;
      grid-template-columns: repeat(4, 1fr);
      gap: 12px;
      margin-bottom: 20px;
      background: #f8fafc;
      padding: 14px 18px;
      border-radius: 10px;
      border: 1px solid #e2e8f0;
    }
    .drawer-meta-label {
      font-size: 11px;
      color: #64748b;
      margin-bottom: 3px;
    }
    .drawer-meta-val {
      font-size: 13px;
      font-weight: 700;
      color: #0f172a;
    }
    .drawer-section-title {
      font-size: 13px;
      font-weight: 700;
      color: #0f172a;
      margin-bottom: 8px;
      display: flex;
      justify-content: space-between;
      align-items: center;
    }
    .drawer-desc-box {
      background: #f8fafc;
      padding: 12px 16px;
      border-radius: 8px;
      border: 1px solid #e2e8f0;
      color: #334155;
      font-size: 13px;
      line-height: 1.6;
      margin-bottom: 18px;
    }
    .drawer-rule-item {
      font-size: 12px;
      color: #334155;
      line-height: 1.6;
      margin-bottom: 6px;
      padding: 6px 12px;
      background: #ffffff;
      border-left: 3px solid #2563eb;
      border-radius: 0 6px 6px 0;
      border-top: 1px solid #f1f5f9;
      border-right: 1px solid #f1f5f9;
      border-bottom: 1px solid #f1f5f9;
    }
    .sql-code-container {
      position: relative;
      background: #0f172a;
      border-radius: 8px;
      margin-bottom: 18px;
      overflow: hidden;
    }
    .sql-code-box {
      color: #f8fafc;
      font-family: Consolas, Monaco, "Courier New", monospace;
      font-size: 12px;
      line-height: 1.5;
      padding: 16px 20px;
      overflow-x: auto;
      white-space: pre-wrap;
      word-break: break-all;
      margin: 0;
    }
    .copy-sql-btn {
      position: absolute;
      top: 10px;
      right: 12px;
      background: rgba(255, 255, 255, 0.12);
      border: 1px solid rgba(255, 255, 255, 0.2);
      color: #cbd5e1;
      padding: 4px 10px;
      font-size: 11px;
      border-radius: 4px;
      cursor: pointer;
      transition: all 0.2s ease;
    }
    .copy-sql-btn:hover {
      background: rgba(255, 255, 255, 0.25);
      color: #ffffff;
    }
    .analysis-item {
      font-size: 12px;
      color: #475569;
      line-height: 1.6;
      margin-bottom: 6px;
      background: #f8fafc;
      padding: 8px 12px;
      border-radius: 6px;
      border: 1px solid #e2e8f0;
    }
    .drawer-footer {
      padding: 14px 24px;
      border-top: 1px solid #e2e8f0;
      background: #f8fafc;
      display: flex;
      justify-content: flex-end;
    }


/* SPA View Panel Transitions */
.subview-panel {
  display: none;
  animation: fadeInView 0.15s ease-in-out;
}
.subview-panel.active {
  display: block;
}
@keyframes fadeInView {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Sidebar active indicator */
.sidebar-nav .nav-item {
  cursor: pointer;
  user-select: none;
}
