/* ==========================================================================
   番茄小说采集系统 · Spacious Clean Studio Design System
   ========================================================================== */

:root,
body {
  --fq-canvas: #f8fafc;
  --fq-surface: #ffffff;
  --fq-surface-subtle: #f1f5f9;
  --fq-surface-muted: #f8fafc;
  --fq-surface-hover: #f1f5f9;
  --fq-header-bg: rgba(255, 255, 255, 0.88);
  --fq-border: #e2e8f0;
  --fq-border-subtle: #edf2f7;
  --fq-border-strong: #cbd5e1;
  --fq-ink: #0f172a;
  --fq-ink-secondary: #475569;
  --fq-ink-muted: #94a3b8;
  --fq-accent: #2563eb;
  --fq-accent-soft: rgba(37, 99, 235, 0.08);
  --fq-shadow-xs: 0 1px 3px rgba(15, 23, 42, 0.03), 0 1px 2px rgba(15, 23, 42, 0.02);
  --fq-shadow-sm: 0 4px 12px -2px rgba(15, 23, 42, 0.05), 0 1px 3px rgba(15, 23, 42, 0.03);
  --fq-shadow-lg: 0 24px 48px -12px rgba(15, 23, 42, 0.12), 0 4px 12px rgba(15, 23, 42, 0.05);
  --fq-radius-lg: 14px;
  --fq-radius-md: 10px;
}

html[arco-theme="dark"],
body[arco-theme="dark"] {
  color-scheme: dark;
  --color-neutral-1: rgb(var(--gray-1));
  --color-neutral-2: rgb(var(--gray-2));
  --color-neutral-3: rgb(var(--gray-3));
  --color-neutral-4: rgb(var(--gray-4));
  --color-neutral-5: rgb(var(--gray-5));
  --color-neutral-6: rgb(var(--gray-6));
  --color-neutral-7: rgb(var(--gray-7));
  --color-neutral-8: rgb(var(--gray-8));
  --color-neutral-9: rgb(var(--gray-9));
  --color-neutral-10: rgb(var(--gray-10));

  --fq-canvas: #0b0f17;
  --fq-surface: #111827;
  --fq-surface-subtle: #1e293b;
  --fq-surface-muted: #161f30;
  --fq-surface-hover: #1e293b;
  --fq-header-bg: rgba(17, 24, 39, 0.86);
  --fq-border: rgba(255, 255, 255, 0.09);
  --fq-border-subtle: rgba(255, 255, 255, 0.06);
  --fq-border-strong: rgba(255, 255, 255, 0.16);
  --fq-ink: #f8fafc;
  --fq-ink-secondary: #94a3b8;
  --fq-ink-muted: #64748b;
  --fq-accent: #3b82f6;
  --fq-accent-soft: rgba(59, 130, 246, 0.15);
  --fq-shadow-xs: 0 1px 3px rgba(0, 0, 0, 0.3);
  --fq-shadow-sm: 0 4px 14px rgba(0, 0, 0, 0.35);
  --fq-shadow-lg: 0 24px 48px rgba(0, 0, 0, 0.55);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  font-family: -apple-system, BlinkMacSystemFont, "Inter", "SF Pro Text", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background-color: var(--fq-canvas);
  color: var(--fq-ink);
  -webkit-font-smoothing: antialiased;
}

.boot-loader {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--fq-ink-muted);
  font-size: 14px;
}

/* Global Arco refinements */
.arco-btn {
  border-radius: 8px !important;
  font-weight: 500;
}

.arco-input-wrapper,
.arco-textarea-wrapper,
.arco-select-view-single {
  border-radius: 10px !important;
  background-color: var(--fq-surface-muted) !important;
  border: 1px solid var(--fq-border) !important;
  transition: border-color 0.15s, background-color 0.15s !important;
}

.arco-input-wrapper:hover,
.arco-textarea-wrapper:hover,
.arco-select-view-single:hover {
  border-color: var(--fq-border-strong) !important;
}

.arco-input-wrapper.arco-input-focus,
.arco-textarea-wrapper.arco-textarea-focus,
.arco-select-view-single.arco-select-view-focus {
  background-color: var(--fq-surface) !important;
  border-color: var(--fq-accent) !important;
  box-shadow: 0 0 0 3px var(--fq-accent-soft) !important;
}

.arco-modal {
  border-radius: 16px !important;
  border: 1px solid var(--fq-border);
  box-shadow: var(--fq-shadow-lg) !important;
}

.arco-dropdown {
  border-radius: 10px !important;
  border: 1px solid var(--fq-border) !important;
  box-shadow: 0 12px 32px -6px rgba(15, 23, 42, 0.14) !important;
  padding: 5px !important;
}

.arco-dropdown-option {
  border-radius: 7px !important;
  line-height: 34px !important;
}

.arco-radio-group-button {
  display: inline-flex !important;
  align-items: center !important;
  gap: 4px !important;
  border-radius: 9px !important;
  padding: 3px !important;
  background-color: var(--fq-surface-subtle) !important;
}

.arco-radio-group-button .arco-radio-button::before {
  display: none !important;
}

.arco-radio-button {
  border-radius: 7px !important;
  border: none !important;
  margin: 0 !important;
}

body[arco-theme="dark"] .arco-radio-button.arco-radio-checked {
  background-color: var(--fq-surface) !important;
  color: var(--fq-ink) !important;
}

.arco-btn-group {
  display: inline-flex !important;
  align-items: center !important;
  gap: 8px !important;
}

.arco-btn-group > .arco-btn {
  border-radius: 7px !important;
  margin: 0 !important;
}

/* ==========================================================================
   Login View
   ========================================================================== */
.login-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 28px 16px;
}

.login-topbar {
  position: fixed;
  top: 22px;
  right: 28px;
}

.login-card {
  width: 100%;
  max-width: 420px;
  background: var(--fq-surface);
  border: 1px solid var(--fq-border);
  border-radius: 18px;
  padding: 38px 36px 32px;
  box-shadow: var(--fq-shadow-lg);
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 26px;
}

.brand-emblem {
  width: 42px;
  height: 42px;
  border-radius: 11px;
  background: linear-gradient(145deg, #1e293b 0%, #0f172a 100%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  flex-shrink: 0;
  box-shadow: 0 4px 10px rgba(15, 23, 42, 0.16);
}

body[arco-theme="dark"] .brand-emblem {
  background: linear-gradient(145deg, #3b82f6 0%, #1d4ed8 100%);
}

.brand-emblem.sm {
  width: 34px;
  height: 34px;
  border-radius: 9px;
}

.brand-logo-img {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  object-fit: cover;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(255, 92, 0, 0.22);
}

.brand-logo-img.sm {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  box-shadow: 0 2px 8px rgba(255, 92, 0, 0.18);
}

.nav-apk-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 13px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 550;
  color: #fff;
  background: linear-gradient(135deg, #ff6633 0%, #ff4500 100%);
  text-decoration: none;
  box-shadow: 0 2px 6px rgba(255, 69, 0, 0.25);
  transition: all 0.2s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.nav-apk-btn:hover {
  background: linear-gradient(135deg, #ff7744 0%, #ff5511 100%);
  box-shadow: 0 4px 12px rgba(255, 69, 0, 0.35);
  transform: translateY(-1px);
  color: #fff;
}

.nav-apk-btn:active {
  transform: translateY(0);
}

.device-apk-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 28px;
  padding: 0 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  color: #ff5500;
  background: rgba(255, 85, 0, 0.08);
  border: 1px solid rgba(255, 85, 0, 0.22);
  text-decoration: none;
  transition: all 0.2s ease;
}

.device-apk-btn:hover {
  background: rgba(255, 85, 0, 0.15);
  border-color: rgba(255, 85, 0, 0.38);
  color: #ff4400;
}

body[arco-theme="dark"] .device-apk-btn {
  color: #ff8855;
  background: rgba(255, 136, 85, 0.12);
  border-color: rgba(255, 136, 85, 0.3);
}

body[arco-theme="dark"] .device-apk-btn:hover {
  background: rgba(255, 136, 85, 0.2);
  color: #ffa377;
}

.pairing-download-bar {
  margin-top: 10px;
  margin-bottom: 12px;
  padding: 8px 12px;
  background: rgba(255, 85, 0, 0.06);
  border: 1px dashed rgba(255, 85, 0, 0.22);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12.5px;
  color: var(--fq-ink-secondary);
}

body[arco-theme="dark"] .pairing-download-bar {
  background: rgba(255, 136, 85, 0.08);
  border-color: rgba(255, 136, 85, 0.3);
}

.pairing-download-bar a {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-weight: 600;
  color: #ff5500;
  text-decoration: none;
}

.pairing-download-bar a:hover {
  text-decoration: underline;
}

.login-brand h1 {
  margin: 0;
  font-size: 19px;
  font-weight: 650;
  color: var(--fq-ink);
}

.login-brand p {
  margin: 3px 0 0;
  font-size: 13px;
  color: var(--fq-ink-secondary);
}

.login-hint-box {
  margin-top: 18px;
  padding: 10px 14px;
  border-radius: 9px;
  background: var(--fq-surface-muted);
  border: 1px solid var(--fq-border-subtle);
  font-size: 12.5px;
  color: var(--fq-ink-secondary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.login-hint-box code {
  font-family: "SF Mono", "JetBrains Mono", Menlo, monospace;
  font-size: 12px;
  color: var(--fq-ink);
  font-weight: 500;
}

/* ==========================================================================
   Sticky Top Bar — Wide & Breathable
   ========================================================================== */
.top-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--fq-header-bg);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--fq-border);
}

.top-nav-inner {
  max-width: 1440px;
  margin: 0 auto;
  padding: 14px 36px;
  min-height: 66px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.nav-title {
  margin: 0;
  font-size: 17px;
  font-weight: 650;
  letter-spacing: -0.01em;
  color: var(--fq-ink);
}

.nav-divider {
  width: 1px;
  height: 15px;
  background: var(--fq-border-strong);
}

.nav-subtitle {
  font-size: 13px;
  color: var(--fq-ink-muted);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.sync-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 32px;
  padding: 0 13px;
  border-radius: 999px;
  background: var(--fq-surface-muted);
  border: 1px solid var(--fq-border);
  font-size: 12.5px;
  color: var(--fq-ink-secondary);
  cursor: pointer;
  user-select: none;
  font-variant-numeric: tabular-nums;
}

.sync-pill:hover {
  border-color: var(--fq-border-strong);
}

.sync-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #10b981;
}

.sync-dot.paused {
  background: #f59e0b;
}

/* ==========================================================================
   Main Container & KPI Strip — Relaxed Airy Spacing
   ========================================================================== */
.console-main {
  max-width: 1440px;
  margin: 0 auto;
  padding: 32px 36px 88px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 20px;
}

.kpi-card {
  background: var(--fq-surface);
  border: 1px solid var(--fq-border);
  border-radius: var(--fq-radius-lg);
  padding: 20px 24px;
  box-shadow: var(--fq-shadow-xs);
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}

.kpi-card.clickable {
  cursor: pointer;
}

.kpi-card.clickable:hover {
  border-color: var(--fq-border-strong);
  box-shadow: var(--fq-shadow-sm);
}

.kpi-card.active {
  border-color: var(--fq-accent);
  box-shadow: 0 0 0 2px var(--fq-accent-soft);
}

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

.kpi-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--fq-ink-secondary);
}

.kpi-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
}

.kpi-dot.amber { background: #f59e0b; }
.kpi-dot.blue { background: #3b82f6; }
.kpi-dot.green { background: #10b981; }
.kpi-dot.red { background: #ef4444; }
.kpi-dot.slate { background: #64748b; }

.kpi-value {
  font-size: 30px;
  font-weight: 650;
  line-height: 1.1;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  color: var(--fq-ink);
}

.kpi-value small {
  font-size: 14px;
  font-weight: 400;
  color: var(--fq-ink-muted);
  margin-left: 4px;
}

.kpi-foot {
  font-size: 12.5px;
  color: var(--fq-ink-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ==========================================================================
   Full-Width Panel Cards (Composer & Aggregated Physical Devices)
   ========================================================================== */
.panel-card {
  background: var(--fq-surface);
  border: 1px solid var(--fq-border);
  border-radius: var(--fq-radius-lg);
  box-shadow: var(--fq-shadow-xs);
  padding: 24px 28px;
  width: 100%;
  display: flex;
  flex-direction: column;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.panel-head-left {
  display: flex;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
}

.panel-title {
  margin: 0;
  font-size: 16px;
  font-weight: 650;
  color: var(--fq-ink);
  display: inline-flex;
  align-items: center;
  gap: 9px;
}

.panel-subtitle {
  font-size: 13px;
  color: var(--fq-ink-muted);
}

.panel-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 22px;
  padding: 0 9px;
  border-radius: 999px;
  background: var(--fq-surface-subtle);
  color: var(--fq-ink-secondary);
  font-size: 12px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.url-textarea textarea {
  min-height: 112px !important;
  padding: 10px 4px !important;
  font-family: "SF Mono", "JetBrains Mono", Menlo, Consolas, "PingFang SC", monospace !important;
  font-size: 13.5px !important;
  line-height: 1.7 !important;
}

.composer-meta-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 16px;
  flex-wrap: wrap;
}

.composer-hint-text {
  font-size: 13px;
  color: var(--fq-ink-muted);
}

.composer-hint-text kbd {
  display: inline-block;
  padding: 1px 6px;
  font-family: "SF Mono", Menlo, monospace;
  font-size: 11.5px;
  border-radius: 5px;
  background: var(--fq-surface-subtle);
  border: 1px solid var(--fq-border);
  color: var(--fq-ink-secondary);
}

.composer-btns {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* TXT Dropzone */
.txt-dropzone {
  border: 1.5px dashed var(--fq-border-strong);
  border-radius: 12px;
  background: var(--fq-surface-muted);
  padding: 30px 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, background-color 0.15s;
}

.txt-dropzone:hover,
.txt-dropzone.dragging {
  border-color: var(--fq-accent);
  background: var(--fq-accent-soft);
}

.dropzone-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--fq-ink);
  margin-top: 8px;
}

.dropzone-sub {
  font-size: 12.5px;
  color: var(--fq-ink-muted);
  margin-top: 4px;
}

.selected-file-box {
  margin-top: 14px;
  padding: 14px 18px;
  border-radius: 10px;
  background: var(--fq-surface-muted);
  border: 1px solid var(--fq-border);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.selected-file-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.selected-file-info {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  font-size: 13.5px;
}

.selected-file-name {
  font-weight: 600;
  color: var(--fq-ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ==========================================================================
   Aggregated Physical Device Cards
   ========================================================================== */
.physical-device-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  gap: 16px;
}

.phys-dev-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 18px 22px;
  border-radius: 12px;
  border: 1px solid var(--fq-border);
  background: var(--fq-surface-muted);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.phys-dev-card.online {
  background: var(--fq-surface);
  border-color: rgba(16, 185, 129, 0.32);
  box-shadow: 0 2px 10px rgba(16, 185, 129, 0.05);
}

.phys-dev-card.busy {
  border-color: rgba(37, 99, 235, 0.35);
  box-shadow: 0 2px 10px rgba(37, 99, 235, 0.06);
}

.phys-dev-left {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
}

.phys-dev-avatar {
  width: 44px;
  height: 44px;
  border-radius: 11px;
  background: var(--fq-surface-subtle);
  color: var(--fq-ink-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.phys-dev-avatar.online {
  background: rgba(16, 185, 129, 0.12);
  color: #059669;
}

.phys-dev-avatar.busy {
  background: rgba(37, 99, 235, 0.12);
  color: #2563eb;
}

body[arco-theme="dark"] .phys-dev-avatar.online {
  color: #34d399;
  background: rgba(16, 185, 129, 0.18);
}

body[arco-theme="dark"] .phys-dev-avatar.busy {
  color: #60a5fa;
  background: rgba(59, 130, 246, 0.2);
}

.phys-dev-info {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.phys-dev-title-row {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
}

.phys-dev-name {
  font-size: 15px;
  font-weight: 650;
  color: var(--fq-ink);
}

.phys-dev-model {
  font-family: "SF Mono", "JetBrains Mono", Menlo, monospace;
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 6px;
  background: var(--fq-surface-subtle);
  color: var(--fq-ink-secondary);
}

.phys-cap-pill {
  font-size: 11.5px;
  padding: 2px 7px;
  border-radius: 6px;
  background: rgba(37, 99, 235, 0.09);
  color: var(--fq-accent);
  font-weight: 500;
}

.phys-dev-channels {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 12.5px;
}

.chan-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--fq-ink-secondary);
}

.chan-chip i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #94a3b8;
  display: inline-block;
}

.chan-chip.active {
  color: var(--fq-ink);
  font-weight: 500;
}

.chan-chip.active i {
  background: #10b981;
}

.chan-offline-hint {
  font-size: 12px;
  color: var(--fq-ink-muted);
  cursor: pointer;
  border-bottom: 1px dashed var(--fq-border-strong);
}

.chan-offline-hint:hover {
  color: var(--fq-accent);
  border-bottom-color: var(--fq-accent);
}

.phys-dev-right {
  text-align: right;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 5px;
}

.phys-state {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 26px;
  padding: 0 11px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 600;
}

.phys-state .state-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

.phys-state.online {
  background: rgba(16, 185, 129, 0.1);
  color: #059669;
}
.phys-state.online .state-dot { background: #10b981; }

.phys-state.busy {
  background: rgba(37, 99, 235, 0.1);
  color: #2563eb;
}
.phys-state.busy .state-dot {
  background: #2563eb;
  animation: devPulse 1.4s ease-in-out infinite;
}

.phys-state.offline {
  background: var(--fq-surface-subtle);
  color: var(--fq-ink-muted);
}
.phys-state.offline .state-dot { background: #94a3b8; }

body[arco-theme="dark"] .phys-state.online { color: #34d399; background: rgba(16, 185, 129, 0.16); }
body[arco-theme="dark"] .phys-state.busy { color: #60a5fa; background: rgba(59, 130, 246, 0.18); }

.phys-heartbeat {
  font-size: 12px;
  color: var(--fq-ink-muted);
  font-variant-numeric: tabular-nums;
}

.dev-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #cbd5e1;
  flex-shrink: 0;
}

body[arco-theme="dark"] .dev-dot {
  background: #475569;
}

.dev-dot.online {
  background: #10b981;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
}

@keyframes devPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.45; }
}

.channel-modal-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 14px;
  border-radius: 10px;
  background: var(--fq-surface-muted);
  border: 1px solid var(--fq-border-subtle);
}

.channel-modal-row.online {
  background: var(--fq-surface);
  border-color: rgba(16, 185, 129, 0.3);
}

/* ==========================================================================
   Task List Table — Spacious, Airy, Collision-Proof Grid
   ========================================================================== */
.table-card {
  padding: 0;
  overflow: hidden;
}

.table-card-header {
  padding: 20px 28px;
  border-bottom: 1px solid var(--fq-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.toolbar-filters {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.table-scroll-wrap {
  width: 100%;
}

.clean-task-table .arco-table-container {
  border: none !important;
  border-radius: 0 !important;
}

.clean-task-table .arco-table-content {
  overflow-x: auto !important;
  -webkit-overflow-scrolling: touch;
}

.clean-task-table .arco-table-element {
  table-layout: fixed !important;
  width: 100% !important;
  min-width: 1100px !important;
  border-collapse: collapse !important;
}

.clean-task-table .arco-table-th,
.clean-task-table .arco-table-td {
  overflow: hidden !important;
  vertical-align: middle !important;
}

.clean-task-table .arco-table-th {
  background-color: var(--fq-surface-muted) !important;
  color: var(--fq-ink-secondary) !important;
  font-size: 12.5px !important;
  font-weight: 600 !important;
  letter-spacing: 0.01em;
  border-bottom: 1px solid var(--fq-border) !important;
}

.clean-task-table .arco-table-th .arco-table-cell {
  padding: 13px 18px !important;
}

.clean-task-table .arco-table-td {
  background-color: var(--fq-surface) !important;
  border-bottom: 1px solid var(--fq-border-subtle) !important;
  transition: background-color 0.12s ease;
}

.clean-task-table .arco-table-tr:hover .arco-table-td {
  background-color: var(--fq-surface-muted) !important;
}

.clean-task-table .arco-table-td .arco-table-cell {
  padding: 18px 18px !important;
}

.clean-task-table .arco-table-th:first-child .arco-table-cell,
.clean-task-table .arco-table-td:first-child .arco-table-cell {
  padding-left: 28px !important;
}

.clean-task-table .arco-table-th:last-child .arco-table-cell,
.clean-task-table .arco-table-td:last-child .arco-table-cell {
  padding-right: 28px !important;
}

.clean-task-table .arco-table-pagination {
  padding: 16px 28px !important;
  margin-top: 0 !important;
  border-top: 1px solid var(--fq-border-subtle);
  background: var(--fq-surface);
}

/* Unified 2-line spacious typographic cell */
.t-cell {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
  min-width: 0;
  width: 100%;
}

.t-row1 {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 22px;
  min-width: 0;
  white-space: nowrap;
}

.t-row2 {
  display: flex;
  align-items: center;
  gap: 7px;
  height: 20px;
  min-width: 0;
  white-space: nowrap;
  font-size: 12.5px;
  color: var(--fq-ink-muted);
}

/* Col 1: Book Title & Quiet Metadata */
.t-id {
  font-family: "SF Mono", "JetBrains Mono", Menlo, monospace;
  font-size: 12.5px;
  color: var(--fq-ink-muted);
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

.t-title {
  font-size: 14.5px;
  font-weight: 600;
  color: var(--fq-ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.t-kind-pill {
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 7px;
  border-radius: 5px;
  font-size: 11.5px;
  font-weight: 500;
  flex-shrink: 0;
}

.t-kind-pill.short_story {
  background: rgba(124, 58, 237, 0.1);
  color: #7c3aed;
}

.t-kind-pill.import {
  background: rgba(14, 165, 233, 0.1);
  color: #0284c7;
}

body[arco-theme="dark"] .t-kind-pill.short_story { color: #a78bfa; background: rgba(167, 139, 250, 0.16); }
body[arco-theme="dark"] .t-kind-pill.import { color: #38bdf8; background: rgba(56, 189, 248, 0.16); }

.t-author {
  color: var(--fq-ink-secondary);
  flex-shrink: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 110px;
}

.t-bookid {
  font-family: "SF Mono", "JetBrains Mono", Menlo, monospace;
  font-size: 12px;
  color: var(--fq-ink-muted);
  cursor: pointer;
  font-variant-numeric: tabular-nums;
  transition: color 0.15s;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.t-bookid:hover {
  color: var(--fq-accent);
  text-decoration: underline;
}

.t-extlink {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  color: var(--fq-ink-muted);
  text-decoration: none;
  font-size: 12px;
  flex-shrink: 0;
}

.t-extlink:hover {
  color: var(--fq-accent);
}

/* Col 2: Clean Status Pill + Note */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 24px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 500;
  flex-shrink: 0;
}

.status-pill i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  display: inline-block;
}

.status-pill.done {
  background: rgba(16, 185, 129, 0.1);
  color: #059669;
}
.status-pill.done i { background: #10b981; }

.status-pill.collecting,
.status-pill.assigned {
  background: rgba(37, 99, 235, 0.1);
  color: #2563eb;
}
.status-pill.collecting i,
.status-pill.assigned i {
  background: #2563eb;
  animation: devPulse 1.3s infinite;
}

.status-pill.queued {
  background: rgba(245, 158, 11, 0.12);
  color: #b45309;
}
.status-pill.queued i { background: #f59e0b; }

.status-pill.failed {
  background: rgba(239, 68, 68, 0.1);
  color: #dc2626;
}
.status-pill.failed i { background: #ef4444; }

.status-pill.cancelled {
  background: var(--fq-surface-subtle);
  color: var(--fq-ink-secondary);
}
.status-pill.cancelled i { background: #94a3b8; }

body[arco-theme="dark"] .status-pill.done { color: #34d399; background: rgba(16, 185, 129, 0.16); }
body[arco-theme="dark"] .status-pill.collecting,
body[arco-theme="dark"] .status-pill.assigned { color: #60a5fa; background: rgba(59, 130, 246, 0.18); }
body[arco-theme="dark"] .status-pill.queued { color: #fbbf24; background: rgba(245, 158, 11, 0.18); }
body[arco-theme="dark"] .status-pill.failed { color: #f87171; background: rgba(239, 68, 68, 0.18); }

.stage-tag {
  font-size: 11.5px;
  padding: 0 7px;
  height: 20px;
  line-height: 20px;
  border-radius: 5px;
  background: rgba(245, 158, 11, 0.12);
  color: #b45309;
  font-weight: 500;
  flex-shrink: 0;
}

body[arco-theme="dark"] .stage-tag {
  color: #fbbf24;
  background: rgba(245, 158, 11, 0.18);
}

.t-subnote {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
  flex: 1;
}

.t-subnote.err {
  color: #dc2626;
}

body[arco-theme="dark"] .t-subnote.err {
  color: #f87171;
}

/* Col 3: Progress */
.t-prog-head {
  justify-content: space-between;
  font-variant-numeric: tabular-nums;
}

.t-prog-num {
  font-size: 13px;
  font-weight: 500;
  color: var(--fq-ink);
}

.t-prog-num.muted {
  color: var(--fq-ink-muted);
  font-weight: 400;
}

.t-prog-pct {
  font-size: 12px;
  color: var(--fq-ink-muted);
}

.t-prog-track {
  width: 100%;
  height: 6px;
  border-radius: 999px;
  background: var(--fq-surface-subtle);
  overflow: hidden;
}

.t-prog-fill {
  height: 100%;
  border-radius: 999px;
  background: #3b82f6;
  transition: width 0.35s ease;
}

.t-prog-fill.done {
  background: #10b981;
}

.t-prog-fill.failed {
  background: #ef4444;
}

/* Col 4: Device & Time */
.t-dev-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--fq-ink);
  overflow: hidden;
  text-overflow: ellipsis;
}

.t-dev-name.muted {
  color: var(--fq-ink-muted);
  font-weight: 400;
}

/* Col 5: Clean File Actions */
.file-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 30px;
  white-space: nowrap;
}

.btn-clean-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  height: 30px;
  padding: 0 11px;
  border-radius: 7px;
  border: 1px solid rgba(37, 99, 235, 0.24);
  background: var(--fq-accent-soft);
  color: var(--fq-accent);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  text-decoration: none;
  flex-shrink: 0;
}

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

.btn-clean-outline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  height: 30px;
  padding: 0 11px;
  border-radius: 7px;
  border: 1px solid var(--fq-border);
  background: var(--fq-surface);
  color: var(--fq-ink-secondary);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  text-decoration: none;
  flex-shrink: 0;
}

.btn-clean-outline:hover {
  border-color: var(--fq-border-strong);
  background: var(--fq-surface-subtle);
  color: var(--fq-ink);
}

.empty-dash {
  color: var(--fq-ink-muted);
  font-size: 14px;
  user-select: none;
}

.dl-doption {
  padding: 0 !important;
}

.dl-doption .arco-dropdown-option-content {
  display: block;
  width: 100%;
}

.dl-dropdown-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: 190px;
  height: 34px;
  padding: 0 12px;
  color: var(--fq-ink);
  text-decoration: none;
  font-size: 13px;
}

.dl-dropdown-ext {
  font-family: "SF Mono", Menlo, monospace;
  font-size: 11.5px;
  color: var(--fq-ink-muted);
}

/* Col 6: Row Operations (Strictly contained & aligned) */
.row-ops {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  height: 30px;
  white-space: nowrap;
}

.btn-op-text {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 30px;
  border-radius: 7px;
  border: 1px solid var(--fq-border);
  background: var(--fq-surface);
  color: var(--fq-ink-secondary);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.btn-op-text:hover {
  border-color: var(--fq-border-strong);
  background: var(--fq-surface-subtle);
  color: var(--fq-ink);
}

.btn-op-text.warn {
  color: #b45309;
  border-color: rgba(245, 158, 11, 0.3);
  background: rgba(245, 158, 11, 0.06);
}

.btn-op-text.warn:hover {
  background: rgba(245, 158, 11, 0.14);
}

body[arco-theme="dark"] .btn-op-text.warn {
  color: #fbbf24;
}

.btn-op-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 30px;
  border-radius: 7px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--fq-ink-muted);
  font-size: 15px;
  cursor: pointer;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.btn-op-icon:hover {
  color: #dc2626;
  background: rgba(239, 68, 68, 0.08);
  border-color: rgba(239, 68, 68, 0.2);
}

body[arco-theme="dark"] .btn-op-icon:hover {
  color: #f87171;
  background: rgba(239, 68, 68, 0.15);
}

/* ==========================================================================
   Device Pairing Modal & Reader Drawer
   ========================================================================== */
.pairing-intro {
  color: var(--fq-ink-secondary);
  font-size: 13px;
  line-height: 1.7;
  margin-bottom: 16px;
}

.pairing-target {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.pairing-target label {
  font-size: 12.5px;
  color: var(--fq-ink);
}

.pairing-target > span,
.pairing-target-note {
  color: var(--fq-ink-muted);
  font-size: 12px;
  line-height: 1.6;
}

.pairing-code-area {
  min-height: 284px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 12px;
  padding: 20px 0;
  text-align: center;
}

.pairing-code-area > strong {
  color: var(--fq-ink);
  font-size: 15px;
}

.pairing-code-area > span {
  color: var(--fq-ink-secondary);
  font-size: 12.5px;
  line-height: 1.65;
}

.pairing-qr-image {
  display: block;
  width: 240px;
  height: 240px;
  max-width: 100%;
  object-fit: contain;
  background: #fff;
  border-radius: 8px;
}

.pairing-countdown {
  font-size: 12.5px;
  color: var(--fq-ink-secondary);
  font-variant-numeric: tabular-nums;
}

.pairing-code-area .pairing-state-icon,
.pairing-code-area .pairing-success-icon {
  font-size: 44px;
  color: var(--fq-ink-muted);
}

.pairing-code-area .pairing-success-icon {
  color: #10b981;
}

.pairing-code-area .pairing-error,
.device-last-error {
  color: #dc2626;
  overflow-wrap: anywhere;
}

.device-last-error {
  font-size: 12px;
  line-height: 1.6;
}

.pairing-footer {
  display: flex;
  justify-content: center;
}

body[arco-theme="dark"] .pairing-code-area .pairing-error,
body[arco-theme="dark"] .device-last-error {
  color: #f87171;
}

.arco-drawer {
  max-width: 96vw;
}

/* ==========================================================================
   Task Detail Modal
   ========================================================================== */
.task-detail-modal-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.detail-header-card {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  background: var(--fq-surface-subtle);
  border: 1px solid var(--fq-border);
  border-radius: 10px;
}

.detail-header-main {
  min-width: 0;
  flex: 1;
}

.detail-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.detail-task-id {
  font-family: "SF Mono", monospace;
  font-size: 12px;
  font-weight: 600;
  color: var(--fq-ink-muted);
}

.detail-book-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--fq-ink);
}

.detail-author-row {
  font-size: 12.5px;
  color: var(--fq-ink-secondary);
  margin-top: 4px;
}

.detail-meta-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 14px;
  padding: 14px 16px;
  border-radius: 10px;
  background: var(--fq-surface-muted);
  border: 1px solid var(--fq-border);
}

.detail-meta-item {
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 12px;
  min-width: 0;
}

.detail-meta-label {
  color: var(--fq-ink-muted);
  font-size: 11.5px;
}

.detail-meta-val {
  color: var(--fq-ink);
  font-weight: 500;
  word-break: break-all;
}

.detail-meta-val.clickable {
  cursor: pointer;
  color: var(--fq-accent);
}

.detail-meta-val.clickable:hover {
  text-decoration: underline;
}

.detail-section-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--fq-ink);
  margin-top: 4px;
}

.detail-files-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.detail-file-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 8px;
  background: var(--fq-surface-subtle);
  border: 1px solid var(--fq-border);
}

.detail-file-info {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1;
}

.detail-file-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--fq-ink);
}

.detail-file-sub {
  font-size: 11.5px;
  color: var(--fq-ink-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.detail-file-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.detail-empty-files {
  padding: 20px;
  text-align: center;
  color: var(--fq-ink-muted);
  font-size: 12.5px;
  background: var(--fq-surface-muted);
  border: 1px dashed var(--fq-border);
  border-radius: 8px;
}

.reader-drawer-wrap {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

.reader-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--fq-border);
  background: var(--fq-surface);
  flex-wrap: wrap;
  flex-shrink: 0;
}

.reader-size-stepper {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.reader-size-stepper .arco-btn {
  border-radius: 7px !important;
  min-width: 32px;
  padding: 0 9px !important;
  height: 24px !important;
  line-height: 22px !important;
  font-size: 12px !important;
  font-weight: 500;
}

.reader-size-display {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  height: 24px;
  padding: 0 8px;
  border-radius: 7px;
  background: var(--fq-surface-subtle);
  border: 1px solid var(--fq-border);
  color: var(--fq-ink-secondary);
  font-size: 12px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  user-select: none;
}

.reader-canvas {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 40px 48px 76px;
}

.reader-canvas.sepia {
  background: #fbf6ec;
  color: #2b241c;
}

.reader-canvas.paper {
  background: #ffffff;
  color: #181b22;
}

.reader-canvas.night {
  background: #11151d;
  color: #cbd5e1;
}

.reader-canvas.serif {
  font-family: "Songti SC", "STSong", "Noto Serif SC", "Source Han Serif SC", Georgia, serif;
}

.reader-canvas.sans {
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
}

.reader-inner {
  max-width: 680px;
  margin: 0 auto;
}

.reader-book-head {
  margin-bottom: 26px;
  padding-bottom: 16px;
  border-bottom: 1px solid rgba(128, 128, 128, 0.2);
}

.reader-book-head h2 {
  margin: 0 0 6px;
  font-size: 23px;
  line-height: 1.35;
}

.reader-book-meta {
  font-size: 13px;
  opacity: 0.68;
}

.reader-para {
  margin: 0 0 1.05em;
  line-height: 1.9;
  text-indent: 2em;
  word-break: break-word;
}

.reader-chapter-heading {
  margin: 1.8em 0 0.9em;
  font-size: 1.2em;
  font-weight: 700;
  text-indent: 0;
}

.reader-divider {
  border: none;
  border-top: 1px dashed rgba(128, 128, 128, 0.25);
  margin: 1.5em 0;
}

/* ==========================================================================
   Responsive Breakpoints
   ========================================================================== */
@media (max-width: 1180px) {
  .top-nav-inner {
    padding: 12px 20px;
  }
  .console-main {
    padding: 22px 20px 64px;
    gap: 20px;
  }
}

@media (max-width: 1024px) {
  .kpi-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
  }
  .nav-subtitle,
  .nav-divider {
    display: none;
  }
}

@media (max-width: 680px) {
  .top-nav-inner {
    padding: 10px 14px;
  }
  .console-main {
    padding: 16px 12px 52px;
    gap: 16px;
  }
  .panel-card {
    padding: 18px 16px;
  }
  .table-card {
    padding: 0;
  }
  .table-card-header {
    padding: 16px;
  }
  .physical-device-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }
  .kpi-card:last-child {
    grid-column: span 2;
  }
  .reader-canvas {
    padding: 24px 18px 56px;
  }
}
