﻿/* ============================================================
   XListening Web · 全局样式
   ============================================================ */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}
:root {
  --brand: #2563eb;
  --brand-strong: #1d4ed8;
  --brand-soft: #dbeafe;
  --surface: #ffffff;
  --surface-muted: #f8fafc;
  --surface-subtle: #f1f5f9;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --text: #0f172a;
  --text-muted: #64748b;
  --text-subtle: #94a3b8;
  --success: #16a34a;
  --success-soft: #dcfce7;
  --warning: #d97706;
  --warning-soft: #fef3c7;
  --danger: #dc2626;
  --danger-soft: #fee2e2;
  --radius: 8px;
  --radius-card: 12px;
  --radius-full: 999px;
  --font-sans: -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}
html, body {
  font-family: var(--font-sans);
  color: var(--text);
  background: var(--surface-muted);
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font-family: inherit; cursor: pointer; }

/* ============================================================
   视图容器
   ============================================================ */
#app { height: 100vh; overflow: hidden; }
/* ============================================================
   布局:桌面端风格(顶部栏 + 左侧导航 + 主内容区)
   ============================================================ */
.view { height: 100vh; display: flex; flex-direction: column; overflow: hidden; }
.view-center {
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

/* ============================================================
   登录 / 注册 / 激活 界面
   ============================================================ */
.card {
  background: var(--surface);
  border-radius: var(--radius-card);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
  padding: 40px;
  width: 100%;
  max-width: 400px;
}
.auth-card {
  max-width: 420px;
}
.logo-circle {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand), #7c3aed);
  color: #fff;
  font-size: 24px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
}
.logo-circle.check-icon {
  background: linear-gradient(135deg, var(--success), #16a34a);
}
.card-title {
  text-align: center;
  font-size: 22px;
  font-weight: 700;
  margin: 0 0 8px;
}
.card-subtitle {
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
  margin: 0 0 24px;
}
.form-group {
  margin-bottom: 16px;
}
.form-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 6px;
  color: var(--text);
}
.form-input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  background: var(--surface);
  color: var(--text);
}
.form-input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
}
.form-input::placeholder {
  color: var(--text-subtle);
}
.password-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.password-wrap .form-input {
  padding-right: 60px;
}
.pwd-toggle {
  position: absolute;
  right: 8px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 12px;
  padding: 4px 8px;
  cursor: pointer;
}
.pwd-toggle:hover {
  color: var(--brand);
}
.error-msg {
  background: var(--danger-soft);
  color: var(--danger);
  padding: 8px 12px;
  border-radius: var(--radius);
  font-size: 13px;
  margin-bottom: 12px;
}
.btn-primary {
  width: 100%;
  padding: 11px 20px;
  background: linear-gradient(135deg, var(--brand), #7c3aed);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: filter 0.2s, transform 0.1s;
}
.btn-primary:hover {
  filter: brightness(1.05);
}
.btn-primary:active {
  transform: scale(0.98);
}
.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.card-footer {
  text-align: center;
  margin-top: 16px;
  font-size: 13px;
  color: var(--text-muted);
}
.card-footer a {
  color: var(--brand);
  font-weight: 500;
}

/* 激活码输入框 */
.code-input-group {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}
.code-input {
  flex: 1;
  padding: 12px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  font-family: monospace;
  letter-spacing: 1px;
  text-transform: uppercase;
  outline: none;
  background: var(--surface);
  color: var(--text);
}
.code-input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
}
.btn-activate {
  padding: 12px 24px;
  background: linear-gradient(135deg, var(--success), #16a34a);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: filter 0.2s;
  white-space: nowrap;
}
.btn-activate:hover {
  filter: brightness(1.05);
}
.hint-box {
  background: var(--surface-subtle);
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.8;
}
.btn-link {
  background: transparent;
  border: none;
  color: var(--brand);
  font-size: 13px;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
}
.btn-link:hover {
  color: var(--brand-strong);
}

#main-view {
  display: flex !important;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

/* ============================================================
   顶部状态栏 (h-14, 固定高度)
   ============================================================ */
.top-bar {
  height: 56px;
  shrink: 0;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  flex-shrink: 0;
  user-select: none;
}
.top-left, .top-right {
  display: flex;
  align-items: center;
  gap: 12px;
}
.app-logo {
  width: 36px;
  height: 36px;
  background: var(--brand);
  color: #fff;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 18px;
}
.app-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
}
.app-divider {
  color: var(--border-strong);
  font-size: 14px;
}
.app-subtitle {
  font-size: 13px;
  color: var(--text-muted);
}
.status-pill {
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  gap: 4px;
}
.top-btn {
  height: 32px;
  padding: 0 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 6px;
  font-size: 13px;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: all 120ms ease;
}
.top-btn:hover {
  border-color: var(--brand);
  color: var(--brand);
}
.top-btn-danger:hover {
  border-color: var(--danger);
  color: var(--danger);
}

/* ===== 激活提示条 ===== */
.license-banner {
  background: linear-gradient(90deg, #fff7ed, #fef3c7);
  border-bottom: 1px solid #fde68a;
  padding: 10px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.license-banner-left {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #92400e;
  font-size: 14px;
}
.license-banner-icon {
  width: 20px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #f59e0b;
  color: white;
  border-radius: 50%;
  font-size: 12px;
  font-weight: bold;
  flex-shrink: 0;
}
.license-banner-title {
  font-weight: 600;
}
.license-banner-desc {
  color: #b45309;
  opacity: 0.85;
  font-size: 13px;
}
.license-banner-btn {
  background: var(--brand);
  color: white;
  border: none;
  padding: 7px 18px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 120ms ease;
  flex-shrink: 0;
}
.license-banner-btn:hover {
  background: #2563eb;
}
.license-banner.is-expired {
  background: linear-gradient(90deg, #fef2f2, #fee2e2);
  border-color: #fecaca;
}
.license-banner.is-expired .license-banner-title {
  color: #b91c1c;
}
.license-banner.is-expired .license-banner-desc {
  color: #991b1b;
}
.license-banner.is-expired .license-banner-btn {
  background: #dc2626;
}
.license-banner.is-expired .license-banner-btn:hover {
  background: #b91c1c;
}

/* 迷你刷新按钮 */
.mini-btn {
  background: transparent;
  border: 1px solid rgba(100, 116, 139, 0.3);
  color: #64748b;
  font-size: 12px;
  padding: 1px 6px;
  border-radius: 4px;
  cursor: pointer;
  margin-left: 4px;
  transition: all 0.2s;
  line-height: 1;
  font-family: inherit;
}
.mini-btn:hover {
  background: #3b82f6;
  border-color: #3b82f6;
  color: white;
}
.mini-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.mini-btn.spinning {
  animation: spin 1s linear infinite;
}
@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.user-info {
  font-size: 13px;
  color: var(--text-muted);
}
.user-info b {
  color: var(--text);
  font-weight: 500;
}

/* ============================================================
   主体:flex 布局
   ============================================================ */
.body-wrap {
  flex: 1;
  min-height: 0;
  display: flex;
  overflow: hidden;
}

/* ============================================================
   左侧导航 (208px)
   ============================================================ */
.left-nav {
  width: 208px;
  shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  padding: 12px 0;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  user-select: none;
}
.nav-section {
  margin-bottom: 8px;
}
.nav-title-label {
  padding: 0 20px;
  margin-bottom: 8px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.25em;
  color: var(--text-muted);
}
.nav-list {
  padding: 0 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: none;
  background: transparent;
  border-radius: 8px;
  cursor: pointer;
  text-align: left;
  width: 100%;
  transition: background 120ms ease;
}
.nav-item:hover {
  background: var(--surface-muted);
}
.nav-item.active {
  background: var(--brand-soft);
}
.nav-item.active .nav-item-title {
  color: var(--brand-strong);
  font-weight: 600;
}
.nav-icon {
  font-size: 16px;
  flex-shrink: 0;
  width: 20px;
  text-align: center;
}
.nav-text {
  flex: 1;
  min-width: 0;
}
.nav-item-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
}
.nav-item-sub {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* 操作流程说明 */
.nav-flow {
  padding: 0 12px;
  margin-top: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.flow-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.2em;
  color: var(--text-muted);
  padding: 0 4px;
  margin-bottom: 4px;
}
.flow-card {
  background: var(--surface-muted);
  border-radius: 12px;
  padding: 12px;
  font-size: 12px;
  line-height: 1.6;
}
.flow-card-title {
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
  font-size: 13px;
}
.flow-card-desc {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.5;
}

/* 授权信息(底部) */
.nav-auth {
  margin-top: auto;
  padding: 12px;
  border-top: 1px solid var(--border);
}
.auth-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* ============================================================
   主内容区
   ============================================================ */
.main-content {
  flex: 1;
  min-width: 0;
  overflow-y: auto;
  padding: 24px;
  background: var(--bg);
}
.section-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 16px;
}
.placeholder-text {
  color: var(--text-subtle);
  font-size: 14px;
  padding: 40px 0;
  text-align: center;
}

/* ============================================================
   设备管理弹窗
   ============================================================ */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}
.modal-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
}
.modal-card {
  position: relative;
  width: 90%;
  max-width: 500px;
  background: var(--surface);
  border-radius: var(--radius-card);
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.15);
  z-index: 1;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
}
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.modal-title {
  font-size: 16px;
  font-weight: 600;
}
.modal-close {
  width: 28px;
  height: 28px;
  border: none;
  background: none;
  color: var(--text-muted);
  font-size: 18px;
  border-radius: var(--radius);
}
.modal-close:hover {
  background: var(--surface-subtle);
  color: var(--text);
}
.modal-body {
  padding: 16px 20px;
  overflow-y: auto;
  flex: 1;
}
.modal-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
}

/* 题型配置 - 容器 */
.types-container {
  display: block;
}
.type-group-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  margin: 16px 0 6px;
  padding-left: 4px;
}
.type-group-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 20px;
}
/* 题型配置 - 每行排版 */
.type-row {
  display: grid;
  grid-template-columns: 16px 110px 1fr auto auto auto;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px dashed var(--border);
}
.type-row:last-child { border-bottom: 0; }
.type-name { font-size: 13.5px; font-weight: 600; color: var(--text); }
.type-desc { font-size: 12px; color: var(--text-sub, #888); }
.type-unit-tag {
  font-size: 12px; color: var(--primary);
  background: var(--primary-lo, #e6f0ff);
  padding: 3px 8px; border-radius: 999px;
  font-weight: 600;
}
.type-count, .type-qpp {
  display: inline-flex; align-items: center; gap: 4px;
}
.type-count > label, .type-qpp > label {
  font-size: 12px; color: var(--text-sub, #888);
}
.type-count > input, .type-qpp > input {
  width: 64px; height: 30px;
  padding: 0 8px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #fff; color: var(--text); font-size: 13.5px;
}
.type-count > input:focus, .type-qpp > input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(24,144,255,0.18);
  outline: none;
}
.dev-count {
  font-size: 12px;
  color: var(--text-muted);
}
.dev-count b {
  color: var(--brand);
  font-weight: 500;
}

/* 设备列表项 */
.dev-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 8px;
  background: var(--surface-muted);
}
.dev-item.current {
  border-color: var(--brand);
  background: var(--brand-soft);
}
.dev-icon-box {
  width: 36px;
  height: 36px;
  border-radius: var(--radius);
  background: var(--surface-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}
.dev-info { flex: 1; min-width: 0; }
.dev-name {
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 2px;
}
.dev-meta {
  font-size: 12px;
  color: var(--text-muted);
}
.dev-status-tag {
  font-size: 12px;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  background: var(--success-soft);
  color: var(--success);
  margin-right: 8px;
  white-space: nowrap;
}
.btn-unbind {
  padding: 4px 12px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text-muted);
  border-radius: var(--radius);
  font-size: 12px;
  white-space: nowrap;
  transition: all 120ms ease;
}
.btn-unbind:hover:not(:disabled) {
  border-color: var(--danger);
  color: var(--danger);
  background: var(--danger-soft);
}
.btn-unbind:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ============================================================
   Toast 提示
   ============================================================ */
.toast {
  position: fixed;
  top: 24px;
  left: 50%;
  transform: translateX(-50%);
  padding: 10px 20px;
  background: var(--text);
  color: #fff;
  border-radius: var(--radius);
  font-size: 13px;
  z-index: 2000;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}
.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }
.toast.warning { background: var(--warning); }

/* ============================================================
   响应式
   ============================================================ */
@media (max-width: 600px) {
  .auth-card {
    max-width: 100%;
    padding: 24px 20px;
  }
  .top-bar {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  .auth-info-row {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* 暗色主题支持 */
@media (prefers-color-scheme: dark) {
  :root {
    --brand: #60a5fa;
    --brand-strong: #3b82f6;
    --brand-soft: #1e3a8a;
    --surface: #1e293b;
    --surface-muted: #0f172a;
    --surface-subtle: #334155;
    --border: #334155;
    --border-strong: #475569;
    --text: #f1f5f9;
    --text-muted: #94a3b8;
    --text-subtle: #64748b;
    --success: #4ade80;
    --success-soft: #14532d;
    --warning: #fbbf24;
    --warning-soft: #78350f;
    --danger: #f87171;
    --danger-soft: #7f1d1d;
  }
}

/* ============================================================
   功能中心:标签页导航
   ============================================================ */
/* tabs-nav 已移至左侧导航 */
.tab-panel { display: none; }
.tab-panel.active { display: block; }

.panel-header {
  margin-bottom: 20px;
}
.panel-title {
  font-size: 16px;
  font-weight: 600;
  margin: 0 0 4px;
}
.panel-sub {
  font-size: 12px;
  color: var(--text-muted);
  margin: 0;
}

/* 区块 */
.panel-section {
  margin-bottom: 20px;
}
.section-head {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 10px;
}

/* 表单网格 */
.form-grid {
  display: grid;
  gap: 12px;
}
.form-grid-3 { grid-template-columns: repeat(3, 1fr); }
.form-grid-2 { grid-template-columns: repeat(2, 1fr); }
.form-group.span-2 { grid-column: span 2; }

/* 多行文本 */
.form-textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  font-family: var(--font-sans);
  outline: none;
  resize: vertical;
  transition: border-color 120ms ease;
}
.form-textarea:focus { border-color: var(--brand); }

/* 操作行 */
.action-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}
.action-row .ml-auto { margin-left: auto; }

/* 次要按钮 */
.btn-secondary {
  padding: 8px 14px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  color: var(--text);
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  transition: all 120ms ease;
}
.btn-secondary:hover {
  border-color: var(--brand);
  color: var(--brand);
}
.btn-secondary.btn-sm {
  padding: 4px 10px;
  font-size: 12px;
}

.btn-success {
  padding: 10px 20px;
  background: var(--success);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  transition: background-color 120ms ease;
}
.btn-success:hover { filter: brightness(0.95); }
.btn-success:disabled {
  background: var(--border-strong);
  cursor: not-allowed;
}
.btn-danger {
  padding: 10px 20px;
  background: var(--danger);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  transition: background-color 120ms ease;
}
.btn-danger:hover { filter: brightness(0.95); }
.btn-danger.btn-sm {
  padding: 4px 10px;
  font-size: 12px;
}

.hidden { display: none !important; }

.status-text {
  font-size: 12px;
  color: var(--text-muted);
}

/* 文件选择组 */
.file-input-group {
  display: flex;
  gap: 8px;
}
.file-input-group .form-input { flex: 1; }

/* 天数选择列表 */
.days-list {
  max-height: 220px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 8px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.day-chip {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-muted);
  font-size: 13px;
  cursor: pointer;
  user-select: none;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.day-chip-num {
  font-weight: 600;
  color: var(--text);
}
.day-chip-topic {
  font-size: 11px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.day-chip:hover { border-color: var(--brand); }
.day-chip.selected {
  background: var(--brand-soft);
  border-color: var(--brand);
  color: var(--brand-strong);
  font-weight: 500;
}
/* 目录选择器 */
.dir-picker-group {
  position: relative;
  display: flex;
  gap: 8px;
}
.dir-picker-group .form-input {
  flex: 1;
}
.dir-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 300px;
  margin-top: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
  max-height: 320px;
  overflow-y: auto;
  z-index: 100;
}
.dir-dropdown-title {
  padding: 8px 12px;
  font-size: 12px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  background: var(--surface-muted);
}
.dir-dropdown-item {
  padding: 8px 12px;
  cursor: pointer;
  font-size: 13px;
  word-break: break-all;
  line-height: 1.5;
  border-bottom: 1px solid var(--border-light);
  transition: background 0.15s;
}
.dir-dropdown-item:last-child { border-bottom: none; }
.dir-dropdown-item:hover {
  background: var(--brand-soft);
  color: var(--brand-strong);
}
.dir-dropdown-empty {
  padding: 16px 12px;
  text-align: center;
  color: var(--text-muted);
  font-size: 12px;
}

/* 声音选择组 */
.voice-group {
  display: flex;
  gap: 8px;
}
.voice-group .form-input { flex: 1; }

/* 单选组 */
.radio-group {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
}
.radio-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  cursor: pointer;
}
.radio-label input[type="radio"] {
  accent-color: var(--brand);
}

/* 复选框 */
.checkbox-group {
  margin-top: 8px;
}
.checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-muted);
  cursor: pointer;
}
.checkbox-label input[type="checkbox"] {
  accent-color: var(--brand);
}

/* 预设按钮组 */
.preset-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* 提示文本 */
.hint-text {
  font-size: 12px;
  color: var(--text-subtle);
  margin-top: 6px;
}

/* 进度条 */
.progress-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 16px 0;
}
.progress-bar {
  flex: 1;
  height: 6px;
  background: var(--surface-subtle);
  border-radius: var(--radius-full);
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: var(--brand);
  transition: width 200ms ease;
}

/* 日志区 */
.log-section {
  margin: 16px 0;
}
.log-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  font-size: 14px;
  font-weight: 600;
}
.logbox {
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  font-family: "Consolas", "Monaco", monospace;
  font-size: 12px;
  color: var(--text-muted);
  max-height: 200px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-all;
  user-select: text;
}
.logbox .log-line { margin-bottom: 2px; }
.logbox .log-info { color: var(--text-muted); }
.logbox .log-success { color: var(--success); }
.logbox .log-warn { color: var(--warning); }
.logbox .log-error { color: var(--danger); }

.btn-mini {
  padding: 2px 8px;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-subtle);
  border-radius: var(--radius);
  font-size: 12px;
}
.btn-mini:hover {
  border-color: var(--brand);
  color: var(--brand);
}

/* 底部操作区 */
.action-bottom {
  display: flex;
  gap: 12px;
  margin-top: 20px;
}

/* 文件列表 */
.file-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 200px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-muted);
}
.file-list:empty::after {
  content: "暂无文件,请点击「添加 MD 文件」";
  display: block;
  padding: 16px;
  text-align: center;
  color: var(--text-subtle);
  font-size: 13px;
}
.file-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.file-item:last-child { border-bottom: none; }
.file-item-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.file-item-del {
  width: 24px;
  height: 24px;
  border: none;
  background: none;
  color: var(--text-subtle);
  font-size: 16px;
  border-radius: var(--radius);
}
.file-item-del:hover {
  background: var(--danger-soft);
  color: var(--danger);
}

/* 响应式 */
@media (max-width: 768px) {
  .form-grid-3 { grid-template-columns: 1fr; }
  .form-grid-2 { grid-template-columns: 1fr; }
  .form-group.span-2 { grid-column: span 1; }
  .days-list { grid-template-columns: repeat(3, 1fr); }
  .radio-group { flex-direction: column; gap: 8px; }
}


/* ============================================================
   卡片通用头部
   ============================================================ */
.downloads-card,
.history-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  margin-top: 16px;
  overflow: hidden;
}
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-muted);
}
.card-head-title {
  font-size: 15px;
  font-weight: 600;
  margin: 0;
}
.card-head-actions {
  display: flex;
  gap: 6px;
}
.card-body {
  padding: 12px 16px;
  max-height: 400px;
  overflow-y: auto;
}

/* ============================================================
   文件筛选 chips
   ============================================================ */
.files-filter {
  display: flex;
  gap: 6px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.filter-chip {
  padding: 4px 12px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  color: var(--text-muted);
  border-radius: var(--radius-full);
  font-size: 12px;
  cursor: pointer;
  transition: all 120ms ease;
}
.filter-chip:hover {
  border-color: var(--brand);
  color: var(--brand);
}
.filter-chip.active {
  background: var(--brand-soft);
  border-color: var(--brand);
  color: var(--brand-strong);
  font-weight: 500;
}

/* ============================================================
   文件列表
   ============================================================ */
.files-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.file-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-muted);
  transition: border-color 120ms ease;
}
.file-row:hover {
  border-color: var(--brand);
}
.file-icon {
  width: 28px;
  height: 28px;
  border-radius: var(--radius);
  background: var(--surface-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}
.file-info {
  flex: 1;
  min-width: 0;
}
.file-name {
  font-size: 13px;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.file-meta {
  font-size: 11px;
  color: var(--text-subtle);
  margin-top: 2px;
}
.file-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}
.btn-download {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  background: var(--brand);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: 12px;
  text-decoration: none;
  transition: filter 120ms ease;
}
.btn-download:hover {
  filter: brightness(0.95);
  text-decoration: none;
}
.btn-delete-file {
  padding: 4px 8px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  color: var(--text-subtle);
  border-radius: var(--radius);
  font-size: 12px;
  transition: all 120ms ease;
}
.btn-delete-file:hover {
  border-color: var(--danger);
  color: var(--danger);
  background: var(--danger-soft);
}

/* ============================================================
   历史任务列表
   ============================================================ */
.tasks-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.task-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-muted);
  transition: border-color 120ms ease;
}
.task-row:hover {
  border-color: var(--brand-strong);
}
.task-type-badge {
  width: 32px;
  height: 32px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
  background: var(--surface-subtle);
}
.task-type-md { background: var(--brand-soft); }
.task-type-audio { background: var(--success-soft); }
.task-type-docx { background: var(--warning-soft); }
.task-type-units { background: var(--surface-subtle); }
.task-info {
  flex: 1;
  min-width: 0;
}
.task-desc {
  font-size: 13px;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.task-meta {
  font-size: 11px;
  color: var(--text-subtle);
  margin-top: 2px;
}
.task-status-tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
  flex-shrink: 0;
}
.task-status-pending,
.task-status-running {
  background: var(--brand-soft);
  color: var(--brand-strong);
}
.task-status-done {
  background: var(--success-soft);
  color: var(--success);
}
.task-status-failed {
  background: var(--danger-soft);
  color: var(--danger);
}
.task-status-partial {
  background: var(--warning-soft);
  color: var(--warning);
}
.task-status-cancelled {
  background: var(--warning-soft);
  color: var(--warning);
}
.task-retry-btn {
  flex-shrink: 0;
  border: 1px solid var(--brand);
  background: var(--brand-soft);
  color: var(--brand-strong);
  border-radius: 6px;
  padding: 2px 8px;
  font-size: 12px;
  cursor: pointer;
  margin-right: 6px;
  white-space: nowrap;
}
.task-retry-btn:hover {
  background: var(--brand);
  color: #fff;
}
.task-del-btn {
  flex-shrink: 0;
  background: transparent;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 14px;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: all 0.15s;
}
.task-del-btn:hover {
  background: var(--danger-soft);
  color: var(--danger);
}
.task-mini-progress {
  width: 50px;
  height: 4px;
  background: var(--surface-subtle);
  border-radius: var(--radius-full);
  overflow: hidden;
  flex-shrink: 0;
}
.task-mini-progress-fill {
  height: 100%;
  background: var(--brand);
  transition: width 200ms ease;
}


/* ============================================================
   授权信息:圆形天数 + 详情
   ============================================================ */
.days-circle {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--brand-soft);
  color: var(--brand-strong);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.days-num {
  font-size: 18px;
  font-weight: 700;
  line-height: 1;
}
.days-label {
  font-size: 9px;
  color: var(--text-muted);
  margin-top: 2px;
}
.auth-detail {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.detail-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 11px;
}
.detail-label {
  color: var(--text-muted);
  flex-shrink: 0;
}
.detail-value {
  color: var(--text);
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}


/* ============================================================
   表单元素美化:input / select / textarea
   ============================================================ */
input[type="text"],
input[type="password"],
input[type="number"],
input[type="url"],
input[type="search"],
select,
textarea {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  font-family: var(--font-sans);
  outline: none;
  transition: border-color 120ms ease, box-shadow 120ms ease;
  box-sizing: border-box;
}
input[type="text"]:focus,
input[type="password"]:focus,
input[type="number"]:focus,
input[type="url"]:focus,
input[type="search"]:focus,
select:focus,
textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
}
input[type="text"]:hover,
input[type="password"]:hover,
input[type="number"]:hover,
input[type="url"]:hover,
input[type="search"]:hover,
select:hover,
textarea:hover {
  border-color: var(--brand);
}

/* select 自定义箭头 + 去除默认外观 */
select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 32px;
  cursor: pointer;
  min-height: 34px;
}
select option {
  padding: 6px 10px;
  background: var(--surface);
  color: var(--text);
}
select option:hover {
  background: var(--brand-soft);
}
select option:checked {
  background: var(--brand);
  color: #fff;
}

/* label 美化 */
.form-group > label,
label.form-label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 4px;
}

/* ============================================================
   主内容区卡片美化
   ============================================================ */
.panel-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 18px;
  margin-bottom: 16px;
}
.section-head {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}
.panel-header {
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}
.panel-title {
  font-size: 17px;
  font-weight: 700;
  margin: 0 0 4px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.panel-sub {
  font-size: 12px;
  color: var(--text-muted);
  margin: 0;
}

/* ============================================================
   顶部栏品牌按钮
   ============================================================ */
.top-btn-brand {
  background: var(--brand-soft);
  border-color: transparent;
  color: var(--brand-strong);
  font-weight: 600;
}
.top-btn-brand:hover {
  background: var(--brand);
  color: #fff;
  border-color: var(--brand);
}

/* ============================================================
   左侧导航:紧凑文件列表
   ============================================================ */
.nav-files,
.nav-tasks {
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}
.nav-section-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  margin-bottom: 6px;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.15em;
}
.nav-mini-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 12px;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 4px;
  transition: all 120ms ease;
}
.nav-mini-btn:hover {
  background: var(--surface-muted);
  color: var(--brand);
}
.nav-files-filter {
  display: flex;
  gap: 2px;
  padding: 0 8px 6px;
  flex-wrap: wrap;
}
.nav-filter-chip {
  padding: 2px 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-muted);
  border-radius: 10px;
  font-size: 10px;
  cursor: pointer;
  transition: all 120ms ease;
}
.nav-filter-chip:hover {
  border-color: var(--brand);
  color: var(--brand);
}
.nav-filter-chip.active {
  background: var(--brand-soft);
  border-color: var(--brand);
  color: var(--brand-strong);
  font-weight: 600;
}
.nav-files-list {
  padding: 0 8px;
  max-height: 180px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.nav-file-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 6px;
  border-radius: 4px;
  transition: background 120ms ease;
  text-decoration: none;
}
.nav-file-item:hover {
  background: var(--surface-muted);
  text-decoration: none;
}
.nav-file-icon {
  font-size: 12px;
  flex-shrink: 0;
}
.nav-file-name {
  font-size: 11px;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  min-width: 0;
}
.nav-file-size {
  font-size: 9px;
  color: var(--text-muted);
  flex-shrink: 0;
}
.nav-file-del {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 10px;
  cursor: pointer;
  padding: 0 2px;
  opacity: 0;
  transition: opacity 120ms ease;
}
.nav-file-item:hover .nav-file-del {
  opacity: 1;
}
.nav-file-del:hover {
  color: var(--danger);
}
.nav-placeholder {
  font-size: 11px;
  color: var(--text-subtle);
  padding: 8px 12px;
  margin: 0;
}

/* ============================================================
   左侧导航:紧凑任务列表
   ============================================================ */
.nav-tasks-list {
  padding: 0 8px;
  max-height: 160px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.nav-task-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 6px;
  border-radius: 4px;
  transition: background 120ms ease;
}
.nav-task-item:hover {
  background: var(--surface-muted);
}
.nav-task-icon {
  font-size: 12px;
  flex-shrink: 0;
}
.nav-task-text {
  flex: 1;
  min-width: 0;
  font-size: 11px;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.nav-task-time {
  font-size: 9px;
  color: var(--text-muted);
  flex-shrink: 0;
}
.nav-task-status {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}
.nav-task-status.done { background: var(--success); }
.nav-task-status.failed { background: var(--danger); }
.nav-task-status.running { background: var(--brand); animation: pulse 1.2s infinite; }
.nav-task-status.cancelled { background: var(--warning); }
.nav-task-status.pending { background: var(--text-muted); }
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* 滚动条美化 */
.nav-files-list::-webkit-scrollbar,
.nav-tasks-list::-webkit-scrollbar,
.left-nav::-webkit-scrollbar,
.main-content::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
.nav-files-list::-webkit-scrollbar-track,
.nav-tasks-list::-webkit-scrollbar-track,
.left-nav::-webkit-scrollbar-track,
.main-content::-webkit-scrollbar-track {
  background: transparent;
}
.nav-files-list::-webkit-scrollbar-thumb,
.nav-tasks-list::-webkit-scrollbar-thumb,
.left-nav::-webkit-scrollbar-thumb,
.main-content::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 3px;
}
.nav-files-list::-webkit-scrollbar-thumb:hover,
.nav-tasks-list::-webkit-scrollbar-thumb:hover,
.left-nav::-webkit-scrollbar-thumb:hover,
.main-content::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* 教材同步区: section-head 右侧操作按钮 */
.section-head-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
}
.section-head-actions .status-text {
  font-size: 12px;
  font-weight: 400;
  color: var(--text-light);
}

/* ===== 题型配置美化：单列卡片式布局 ===== */
.type-group-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}
.type-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  grid-template-rows: auto auto;
  grid-template-areas:
    "checkbox name configs"
    "checkbox desc configs";
  gap: 4px 12px;
  align-items: center;
  padding: 12px 16px;
  background: #fafbfc;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  margin: 0;
  transition: border-color .2s, background .2s, box-shadow .2s;
}
.type-row:hover {
  border-color: #c9d3e0;
  background: #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}
.type-row input[type="checkbox"] {
  grid-area: checkbox;
  align-self: start;
  margin-top: 4px;
  width: 16px;
  height: 16px;
  cursor: pointer;
}
.type-name {
  grid-area: name;
  font-size: 14px;
  font-weight: 600;
  color: #1f2937;
  display: flex;
  align-items: center;
  gap: 8px;
}
.type-unit-tag {
  grid-area: name;
  justify-self: end;
  font-size: 11px;
  color: #6b7280;
  background: #eef2f7;
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: normal;
}
.type-desc {
  grid-area: desc;
  font-size: 12px;
  color: #6b7280;
  line-height: 1.5;
}
.type-count,
.type-qpp {
  display: flex;
  align-items: center;
  gap: 6px;
}
.type-count label,
.type-qpp label {
  font-size: 12px;
  color: #4b5563;
  white-space: nowrap;
}
.type-count input,
.type-qpp input {
  width: 56px;
  padding: 4px 8px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 13px;
  text-align: center;
  background: #fff;
  transition: border-color .2s;
}
.type-count input:focus,
.type-qpp input:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 2px rgba(59,130,246,0.1);
}

/* 配置项整体容器（右侧） */
.type-row .type-count ~ .type-count,
.type-row .type-count + .type-qpp {
  margin-top: 6px;
}

/* 把右侧配置项放进一个右列容器的替代方案：用 grid 右列 */
.type-count,
.type-qpp {
  grid-column: 3;
  justify-self: end;
}
.type-count {
  grid-row: 1;
}
.type-qpp {
  grid-row: 2;
}

/* 单位标签放在名称后面 */
.type-unit-tag {
  grid-area: auto;
  display: inline-block;
  margin-left: 8px;
}

/* 分组标题样式增强 */
.type-group-title {
  font-size: 13px;
  font-weight: 600;
  color: #374151;
  margin: 16px 0 8px 2px;
  padding-left: 8px;
  border-left: 3px solid #3b82f6;
}
.type-group-title:first-child {
  margin-top: 0;
}
