/* ============================================================
   念念 Web — 扩展模块样式
   设置子面板 · 数据迁移 · 备份导出 · 媒体库 · 全局搜索 · 通知 · 雷达图 · 专题页
   （沿用 tokens.css 的色彩 / 圆角 / 阴影系统）
   ============================================================ */

/* ===== 通用：开关 / 字段行 / 大弹窗 ===== */
.nn-switch { width: 42px; height: 24px; border-radius: 999px; background: var(--surface-3); border: 1px solid var(--border); position: relative; flex: none; transition: background .18s, border-color .18s; cursor: pointer; padding: 0; }
.nn-switch::after { content: ''; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: var(--surface); box-shadow: var(--shadow-sm); transition: transform .18s; }
.nn-switch.on { background: var(--accent); border-color: transparent; }
.nn-switch.on::after { transform: translateX(18px); background: #fff; }

.nn-field { display: flex; flex-direction: column; gap: 7px; }
.nn-field > label { font-size: 13px; font-weight: 500; color: var(--text-2); }
.nn-field .hint { font-size: 12px; color: var(--text-faint); line-height: 1.5; }
.nn-field textarea.nn-input { height: auto; padding: 10px 13px; line-height: 1.6; resize: vertical; }

.nn-modal-wide { width: 760px; max-width: 96vw; max-height: 92vh; background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); display: flex; flex-direction: column; overflow: hidden; }
.nn-modal-h { display: flex; align-items: center; gap: 12px; padding: 16px 22px; border-bottom: 1px solid var(--border); flex: none; }
.nn-modal-h h2 { font-size: 17px; font-weight: 600; margin: 0; }
.nn-modal-h .sub { font-size: 12.5px; color: var(--text-3); }
.nn-modal-scroll { flex: 1; overflow-y: auto; padding: 22px; }
.nn-modal-foot { display: flex; align-items: center; gap: 10px; padding: 14px 22px; border-top: 1px solid var(--border); flex: none; }

/* ===== 设置：返回式子面板 ===== */
.set-back { display: inline-flex; align-items: center; gap: 7px; font-size: 13.5px; color: var(--text-3); background: none; border: none; padding: 0; margin-bottom: 16px; }
.set-back:hover { color: var(--accent-deep); }
.set-detail-h { margin-bottom: 22px; }
.set-detail-h h1 { font-size: 23px; font-weight: 600; margin: 0; letter-spacing: -.01em; }
.set-detail-h p { margin: 6px 0 0; color: var(--text-3); font-size: 13.5px; max-width: 60ch; }
.set-detail-card { padding: 22px 24px; }
.set-detail-card + .set-detail-card { margin-top: 16px; }
.set-card-title { font-size: 14px; font-weight: 600; margin: 0 0 4px; display: flex; align-items: center; gap: 9px; }
.set-card-desc { font-size: 12.5px; color: var(--text-3); margin: 0 0 18px; line-height: 1.6; }
.set-form { display: flex; flex-direction: column; gap: 16px; max-width: 420px; }
.set-form .nn-input { height: 42px; }

/* 带开关的行（菜单配置 / 安全开关） */
.set-toggle-row { display: flex; align-items: center; gap: 14px; padding: 14px 0; }
.set-toggle-row + .set-toggle-row { border-top: 1px solid var(--border); }
.set-toggle-row .tx { flex: 1; min-width: 0; }
.set-toggle-row .tx .t { font-size: 14px; font-weight: 500; }
.set-toggle-row .tx .d { font-size: 12.5px; color: var(--text-3); margin-top: 2px; }
.set-toggle-row .mod-ic { width: 34px; height: 34px; border-radius: var(--radius-sm); background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; flex: none; }

/* 段落分段控件（菜单间距等） */
.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 3px; gap: 3px; }
.seg button { border: none; background: transparent; color: var(--text-3); font: inherit; font-size: 13px; padding: 6px 14px; border-radius: calc(var(--radius-sm) - 2px); transition: all .14s; }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); font-weight: 500; }

/* 两步验证 */
.twofa-grid { display: grid; grid-template-columns: 168px 1fr; gap: 26px; align-items: start; }
.qr-box { width: 168px; height: 168px; border-radius: var(--radius); border: 1px solid var(--border); background: #fff; display: grid; place-items: center; padding: 12px; }
.qr-box svg { width: 100%; height: 100%; }
.twofa-secret { font-family: var(--font-num); font-variant-numeric: tabular-nums; letter-spacing: .14em; font-size: 14px; background: var(--surface-2); border: 1px dashed var(--border-strong); border-radius: var(--radius-sm); padding: 9px 12px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.recovery-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-top: 4px; }
.recovery-code { font-family: var(--font-num); font-variant-numeric: tabular-nums; letter-spacing: .08em; font-size: 13.5px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 9px 12px; color: var(--text-2); text-align: center; }

/* 登录会话 */
.session-row { display: flex; align-items: center; gap: 14px; padding: 15px 4px; }
.session-row + .session-row { border-top: 1px solid var(--border); }
.session-ic { width: 40px; height: 40px; border-radius: var(--radius-sm); background: var(--surface-2); color: var(--text-2); display: grid; place-items: center; flex: none; }
.session-row .meta { flex: 1; min-width: 0; }
.session-row .meta .t { font-size: 14px; font-weight: 500; display: flex; align-items: center; gap: 8px; }
.session-row .meta .d { font-size: 12.5px; color: var(--text-3); margin-top: 2px; }
.session-cur { font-size: 11px; font-weight: 600; color: var(--success); background: color-mix(in oklch, var(--success) 14%, transparent); padding: 2px 8px; border-radius: 999px; }

/* ===== 数据迁移 / 导入向导 ===== */
.wiz-steps { display: flex; align-items: center; gap: 0; padding: 4px 0 22px; }
.wiz-step { display: flex; align-items: center; gap: 9px; font-size: 13px; color: var(--text-faint); }
.wiz-step .num { width: 26px; height: 26px; border-radius: 50%; border: 1.5px solid var(--border-strong); display: grid; place-items: center; font-size: 12.5px; font-weight: 600; flex: none; transition: all .2s; }
.wiz-step.active { color: var(--text); }
.wiz-step.active .num { border-color: var(--accent); background: var(--accent); color: #fff; }
.wiz-step.done .num { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-deep); }
.wiz-line { flex: 1; height: 1.5px; background: var(--border); margin: 0 12px; min-width: 24px; }
.wiz-line.done { background: var(--accent); }

.dropzone { border: 1.5px dashed var(--border-strong); border-radius: var(--radius); padding: 48px 30px; text-align: center; transition: all .18s; cursor: pointer; background: var(--surface-2); }
.dropzone:hover, .dropzone.drag { border-color: var(--accent); background: var(--accent-soft); }
.dropzone .dz-ic { width: 56px; height: 56px; border-radius: 16px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; margin: 0 auto 16px; }
.dropzone h3 { font-size: 16px; font-weight: 600; margin: 0 0 6px; }
.dropzone p { font-size: 13px; color: var(--text-3); margin: 0; }
.dz-file { display: flex; align-items: center; gap: 13px; padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); }
.dz-file .fic { width: 40px; height: 40px; border-radius: var(--radius-sm); background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; flex: none; }

.mig-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.mig-cell { border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; }
.mig-cell .n { font-size: 26px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.mig-cell .l { font-size: 12.5px; color: var(--text-3); margin-top: 3px; display: flex; align-items: center; gap: 6px; }
.mig-cell.warn { border-color: color-mix(in oklch, var(--warn) 45%, transparent); background: color-mix(in oklch, var(--warn) 8%, transparent); }
.mig-cell.warn .n { color: oklch(0.55 0.13 75); }
.mig-note { display: flex; gap: 9px; align-items: flex-start; font-size: 13px; line-height: 1.6; color: var(--text-2); background: var(--accent-soft); border-radius: var(--radius-sm); padding: 12px 14px; margin-top: 16px; }

.mig-progress { height: 8px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.mig-progress-fill { height: 100%; background: var(--accent); border-radius: 999px; transition: width .3s ease; }
.mig-log { font-family: var(--font-num); font-size: 12.5px; color: var(--text-3); display: flex; flex-direction: column; gap: 5px; margin-top: 16px; max-height: 160px; overflow-y: auto; }
.mig-log .ok { color: var(--success); }

.mig-result { display: flex; gap: 14px; }
.mig-res-cell { flex: 1; border-radius: var(--radius); padding: 18px; text-align: center; }
.mig-res-cell.ok { background: color-mix(in oklch, var(--success) 12%, transparent); }
.mig-res-cell.fail { background: var(--danger-soft); }
.mig-res-cell .n { font-size: 30px; font-weight: 700; font-variant-numeric: tabular-nums; }
.mig-res-cell.ok .n { color: var(--success); }
.mig-res-cell.fail .n { color: var(--danger); }
.mig-res-cell .l { font-size: 13px; color: var(--text-2); margin-top: 4px; }
.mig-fail-list { margin-top: 18px; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.mig-fail-row { display: flex; align-items: center; gap: 10px; padding: 11px 16px; font-size: 13px; }
.mig-fail-row + .mig-fail-row { border-top: 1px solid var(--border); }
.mig-fail-row .code { font-family: var(--font-num); font-size: 11.5px; color: var(--danger); background: var(--danger-soft); padding: 2px 7px; border-radius: 5px; flex: none; }

/* ===== 备份导出 ===== */
.backup-opt { display: flex; align-items: center; gap: 14px; padding: 16px 18px; border: 1px solid var(--border); border-radius: var(--radius); transition: border-color .14s, background .14s; cursor: pointer; text-align: left; width: 100%; background: var(--surface); }
.backup-opt:hover { border-color: var(--accent); background: var(--accent-soft); }
.backup-opt + .backup-opt { margin-top: 10px; }
.backup-opt .bic { width: 42px; height: 42px; border-radius: var(--radius-sm); background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; flex: none; }
.backup-opt .meta { flex: 1; min-width: 0; }
.backup-opt .meta .t { font-size: 14.5px; font-weight: 600; }
.backup-opt .meta .d { font-size: 12.5px; color: var(--text-3); margin-top: 2px; }
.backup-hist { margin-top: 8px; }
.backup-hist-row { display: flex; align-items: center; gap: 12px; padding: 11px 4px; font-size: 13px; }
.backup-hist-row + .backup-hist-row { border-top: 1px solid var(--border); }
.backup-hist-row .tnum { color: var(--text-3); }

/* ===== 媒体资源库 ===== */
.media-toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; flex-wrap: wrap; }
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 14px; }
.media-card { border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border); background: var(--surface); cursor: pointer; transition: transform .14s, box-shadow .14s, border-color .14s; }
.media-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--border-strong); }
.media-card.sel { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-ring); }
.media-thumb { aspect-ratio: 4 / 3; position: relative; display: grid; place-items: center; background:
  repeating-linear-gradient(45deg, var(--surface-2), var(--surface-2) 9px, var(--surface-3) 9px, var(--surface-3) 18px); }
.media-thumb .ph-label { font-family: var(--font-num); font-size: 11px; color: var(--text-faint); letter-spacing: .06em; position: absolute; bottom: 8px; left: 0; right: 0; text-align: center; }
.media-thumb .ph-ic { color: var(--text-faint); opacity: .5; }
.media-check { position: absolute; top: 8px; left: 8px; width: 20px; height: 20px; border-radius: 5px; border: 1.5px solid var(--border-strong); background: oklch(1 0 0 / .8); display: grid; place-items: center; }
.media-card.sel .media-check { background: var(--accent); border-color: var(--accent); color: #fff; }
.media-meta { padding: 9px 11px; }
.media-meta .name { font-size: 12.5px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.media-meta .dim { font-size: 11px; color: var(--text-faint); margin-top: 2px; font-variant-numeric: tabular-nums; }
.media-up { aspect-ratio: 4 / 3; border: 1.5px dashed var(--border-strong); border-radius: var(--radius); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; color: var(--text-3); font-size: 12.5px; cursor: pointer; transition: all .15s; background: var(--surface-2); }
.media-up:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.media-detail-prev { aspect-ratio: 16 / 10; border-radius: var(--radius); background:
  repeating-linear-gradient(45deg, var(--surface-2), var(--surface-2) 11px, var(--surface-3) 11px, var(--surface-3) 22px); display: grid; place-items: center; color: var(--text-faint); margin-bottom: 18px; }
.media-kv { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; font-size: 13px; }
.media-kv + .media-kv { border-top: 1px solid var(--border); }
.media-kv .k { color: var(--text-3); }
.media-kv .v { font-weight: 500; font-variant-numeric: tabular-nums; }

/* ===== 全局搜索 ⌘K ===== */
.cmdk-mask { position: fixed; inset: 0; z-index: 200; background: oklch(0.2 0.02 235 / 0.4); display: flex; align-items: flex-start; justify-content: center; padding: 12vh 20px 20px; }
.cmdk { width: 620px; max-width: 96vw; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); overflow: hidden; display: flex; flex-direction: column; max-height: 70vh; }
@media (prefers-reduced-motion: no-preference) { .cmdk { animation: cmdkIn .16s ease; } }
@keyframes cmdkIn { from { transform: translateY(-10px); opacity: .6; } to { transform: none; opacity: 1; } }
.cmdk-input { display: flex; align-items: center; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--border); }
.cmdk-input input { flex: 1; border: none; background: none; outline: none; font-size: 16px; color: var(--text); }
.cmdk-input input::placeholder { color: var(--text-faint); }
.cmdk-input kbd { font-size: 11px; color: var(--text-faint); background: var(--surface-2); border: 1px solid var(--border); border-radius: 5px; padding: 2px 6px; }
.cmdk-results { flex: 1; overflow-y: auto; padding: 8px; }
.cmdk-group-label { font-size: 11px; font-weight: 600; letter-spacing: .04em; color: var(--text-faint); padding: 10px 12px 6px; text-transform: uppercase; }
.cmdk-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: var(--radius-sm); cursor: pointer; }
.cmdk-item.active { background: var(--accent-soft); }
.cmdk-item .cic { width: 32px; height: 32px; border-radius: var(--radius-sm); background: var(--surface-2); color: var(--text-2); display: grid; place-items: center; flex: none; }
.cmdk-item.active .cic { background: var(--surface); color: var(--accent); }
.cmdk-item .cbody { flex: 1; min-width: 0; }
.cmdk-item .ct { font-size: 14px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cmdk-item .cm { font-size: 12px; color: var(--text-3); margin-top: 1px; }
.cmdk-item mark { background: color-mix(in oklch, var(--accent) 24%, transparent); color: inherit; border-radius: 3px; padding: 0 1px; }
.cmdk-empty { padding: 50px 20px; text-align: center; color: var(--text-3); font-size: 14px; }
.cmdk-foot { display: flex; align-items: center; gap: 16px; padding: 9px 16px; border-top: 1px solid var(--border); font-size: 11.5px; color: var(--text-faint); }
.cmdk-foot .kb { display: inline-flex; align-items: center; gap: 5px; }
.cmdk-foot kbd { font-size: 11px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 4px; padding: 1px 5px; min-width: 18px; text-align: center; }

/* ===== 通知面板 ===== */
.notif-pop { position: absolute; right: 0; top: calc(100% + 8px); z-index: 60; width: 340px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); overflow: hidden; }
@media (prefers-reduced-motion: no-preference) { .notif-pop { animation: nnMenuIn .16s ease; } }
.notif-h { display: flex; align-items: center; justify-content: space-between; padding: 13px 16px; border-bottom: 1px solid var(--border); font-size: 14px; font-weight: 600; }
.notif-h button { font-size: 12px; color: var(--accent-deep); background: none; border: none; font-weight: 500; }
.notif-list { max-height: 360px; overflow-y: auto; }
.notif-item { display: flex; gap: 11px; padding: 13px 16px; }
.notif-item + .notif-item { border-top: 1px solid var(--border); }
.notif-item.unread { background: var(--accent-soft); }
.notif-item .nic { width: 32px; height: 32px; border-radius: var(--radius-sm); background: var(--surface-2); color: var(--text-2); display: grid; place-items: center; flex: none; }
.notif-item .nbody .t { font-size: 13.5px; line-height: 1.5; }
.notif-item .nbody .tm { font-size: 11.5px; color: var(--text-faint); margin-top: 3px; }
.notif-dot { position: absolute; top: 7px; right: 7px; width: 7px; height: 7px; border-radius: 50%; background: var(--danger); border: 1.5px solid var(--surface); }
.nn-tb-right .nn-new ~ button, .topbar-bell-wrap { position: relative; }

/* ===== 统计：雷达图 ===== */
.radar-wrap { display: flex; align-items: center; gap: 24px; flex-wrap: wrap; }
.radar-legend { display: flex; flex-direction: column; gap: 9px; }
.radar-leg-row { display: flex; align-items: center; gap: 9px; font-size: 13px; }
.radar-leg-row .tnum { margin-left: auto; font-weight: 600; }

/* ===== 公开站点：专题页 ===== */
.site-topic-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; margin-top: 8px; }
.site-topic-card { border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; transition: transform .16s, box-shadow .16s; background: var(--surface); cursor: pointer; }
.site-topic-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.site-topic-cover { aspect-ratio: 16 / 7; position: relative; background: linear-gradient(135deg, var(--cv, var(--accent)) 0%, color-mix(in oklch, var(--cv, var(--accent)) 60%, #000 8%) 100%); display: flex; align-items: flex-end; padding: 18px 20px; }
.site-topic-cover h3 { color: #fff; font-size: 19px; margin: 0; font-weight: 600; }
.site-topic-body { padding: 16px 20px 20px; }
.site-topic-body p { font-size: 13.5px; color: var(--text-3); margin: 0 0 10px; line-height: 1.65; }
.site-topic-body .cnt { font-size: 12.5px; color: var(--text-faint); font-variant-numeric: tabular-nums; }
@media (max-width: 720px) { .site-topic-grid { grid-template-columns: 1fr; } }

@media (max-width: 760px) {
  .twofa-grid { grid-template-columns: 1fr; }
  .mig-grid { grid-template-columns: repeat(2, 1fr); }
}
