/* ============================================================
   快速拨号 · 笔记本模块 /tools/dial
   独立的视图容器与样式，不侵入拨号页内联脚本的逻辑。
   数据存 localStorage（键 yicool_dial_notes_v1），支持 JSON 导入导出。
   断点：电脑 ≥1024 / 平板 768–1023 / 手机 <768
   ============================================================ */
:root {
    --nnb-bg: var(--bg-primary, #0d1117);
    --nnb-elev: var(--bg-secondary, #161b22);
    --nnb-hover: var(--bg-secondary, #1a2029);
    --nnb-input: var(--bg-primary, #1c2128);
    --nnb-border: var(--border-color, #262d37);
    --nnb-border-strong: var(--text-secondary, #39424e);
    --nnb-text: var(--text-primary, #e6edf3);
    --nnb-sub: var(--text-secondary, #8b949e);
    --nnb-dim: var(--text-secondary, #6e7681);
    --nnb-accent: var(--accent, #2f81f7);
    --nnb-accent-hover: var(--accent, #1f6feb);
    --nnb-accent-soft: rgba(47,129,247,.14);
    --nnb-danger: #f85149;
    --nnb-ok: #3fb950;
    --nnb-shadow: rgba(0,0,0,.35);
    --nnb-header-h: 53px;
    /* 长名别名：兼容源自 navi.css 的基础样式引用，避免弹窗/输入框背景透明 */
    --nnb-bg-elev: var(--nnb-elev);
    --nnb-bg-input: var(--nnb-input);
    --nnb-text-sub: var(--nnb-sub);
    --nnb-text-dim: var(--nnb-dim);
}
html[data-theme="light"] {
    --nnb-ok: #1a7f37;
}

/* 强制隐藏兜底：作者样式里的 display 会覆盖 hidden 属性 */
.nnb-view[hidden],
.nnb-layout[hidden],
.nnb-inline-editor[hidden],
.nnb-modal[hidden],
.nnb-modal-mask[hidden],
.nnb-empty[hidden],
.nnb-toast[hidden],
.nnb-cat-actions[hidden],
.nnb-item-actions[hidden],
.nnb-hint[hidden],
.nnb-cat-del[hidden],
.nnb-io-pane[hidden],
.nnb-storage-ops[hidden],
.nnb-drop-badge[hidden],
.nnb-drag-ghost[hidden],
.nnb-move-mask[hidden],
.nnb-move-menu[hidden] { display: none !important; }

/* ---------- 视图切换按钮高亮 ---------- */
.nnb-toggle.on {
    background: var(--nnb-accent-soft);
    border-color: var(--nnb-accent);
    color: var(--nnb-accent);
}

/* ---------- 视图容器 ---------- */
.nnb-view {
    padding-top: 18px;
    min-height: 60vh;
}
/* 笔记本打开时隐藏拨号搜索框与内容区（笔记视图有自己的搜索） */
body.nnb-open .sd-search,
body.nnb-open .sd-groups,
body.nnb-open #sd-grid,
body.nnb-open #sd-sync-tip,
body.nnb-open #sd-open-confirm { display: none !important; }
/* 笔记本打开时顶部标题栏与笔记视图之间不留空白 */
body.nnb-open .sd-top { margin-bottom: 0; }
body.nnb-open .nnb-view { padding-top: 0; }
body.nnb-open .speeddial-wrap { padding-bottom: 0; }

.nnb-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
}
.nnb-toolbar-title {
    font-size: 19px;
    font-weight: 700;
    letter-spacing: .3px;
    margin-right: 4px;
}
.nnb-toolbar-title .nnb-emoji { font-size: 20px; margin-right: 6px; }
.nnb-stat {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--nnb-sub);
    background: var(--nnb-elev);
    border: 1px solid var(--nnb-border);
    border-radius: 999px;
    padding: 4px 10px;
}
.nnb-stat b { color: var(--nnb-accent); font-size: 13px; }
.nnb-toolbar-spacer { flex: 1 1 auto; }

.nnb-search {
    position: relative;
    flex: 0 1 300px;
    min-width: 180px;
}
.nnb-search .nnb-input { padding-right: 34px; }
.nnb-search-clear {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    width: 24px;
    height: 24px;
    border: 0;
    background: transparent;
    color: var(--nnb-sub);
    font-size: 17px;
    cursor: pointer;
    border-radius: 6px;
    line-height: 1;
}
.nnb-search-clear:hover { background: var(--nnb-hover); color: var(--nnb-text); }

.nnb-select {
    height: 36px;
    padding: 0 10px;
    border-radius: 8px;
    border: 1px solid var(--nnb-border);
    background: var(--nnb-input);
    color: var(--nnb-text);
    font-size: 13px;
    outline: none;
    cursor: pointer;
}
.nnb-select:focus { border-color: var(--nnb-accent); }
.nnb-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 36px;
    padding: 0 14px;
    border-radius: 8px;
    border: 1px solid var(--nnb-border);
    background: var(--nnb-elev);
    color: var(--nnb-text);
    font-size: 13px;
    cursor: pointer;
    white-space: nowrap;
    transition: background .15s, border-color .15s;
}
.nnb-btn:hover { background: var(--nnb-hover); border-color: var(--nnb-border-strong); }
.nnb-btn-primary {
    background: var(--nnb-accent);
    border-color: var(--nnb-accent);
    color: #fff;
}
.nnb-btn-primary:hover { background: var(--nnb-accent-hover); border-color: var(--nnb-accent-hover); }
.nnb-btn-danger { color: var(--nnb-danger); }
.nnb-btn-danger:hover { background: rgba(248,81,73,.1); border-color: var(--nnb-danger); }
.nnb-btn-ghost { background: transparent; }
.nnb-btn:disabled { opacity: .5; cursor: not-allowed; }

/* ---------- 两栏布局 ---------- */
.nnb-layout {
    display: grid;
    grid-template-columns: 232px minmax(0, 1fr);
    gap: 16px;
    align-items: start;
}
.nnb-side {
    position: sticky;
    top: calc(var(--nnb-header-h) + 12px);
    background: var(--nnb-elev);
    border: 1px solid var(--nnb-border);
    border-radius: 12px;
    padding: 12px;
    max-height: calc(100vh - var(--nnb-header-h) - 40px);
    overflow-y: auto;
    scrollbar-width: thin;
}
.nnb-side-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
    padding: 0 2px;
}
.nnb-side-head h3 {
    margin: 0;
    font-size: 13px;
    font-weight: 600;
    color: var(--nnb-sub);
    text-transform: uppercase;
    letter-spacing: .6px;
}
.nnb-side-add {
    width: 26px;
    height: 26px;
    border-radius: 6px;
    border: 1px solid var(--nnb-border);
    background: var(--nnb-input);
    color: var(--nnb-accent);
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.nnb-side-add:hover { border-color: var(--nnb-accent); }

.nnb-cat-list { list-style: none; margin: 0; padding: 0; }
.nnb-cat-item {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 36px;
    padding: 6px 8px;
    margin-bottom: 3px;
    border-radius: 8px;
    cursor: pointer;
    color: var(--nnb-text);
    font-size: 13.5px;
    user-select: none;
    border: 1px solid transparent;
}
.nnb-cat-item:hover { background: var(--nnb-hover); }
.nnb-cat-item.is-active {
    background: var(--nnb-accent-soft);
    border-color: var(--nnb-accent);
    color: var(--nnb-accent);
    font-weight: 600;
}
.nnb-cat-item.is-dragging { opacity: .45; }
.nnb-cat-item.nv-drop-before { box-shadow: inset 0 2px 0 var(--nnb-accent); }
.nnb-cat-item.nv-drop-after { box-shadow: inset 0 -2px 0 var(--nnb-accent); }
/* 笔记卡片拖拽到分类：整侧栏都是投放区，最近分类吸附高亮 */
.nnb-item[draggable="true"] { cursor: grab; touch-action: manipulation; }
.nnb-item[draggable="true"]:active { cursor: grabbing; }
.nnb-item.is-dragging { opacity: .38; outline: 1px dashed var(--nnb-accent); }
.nnb-side.is-drop-active {
    border-color: var(--nnb-accent);
    box-shadow: 0 0 0 2px var(--nnb-accent-soft), 0 8px 30px var(--nnb-shadow);
}
.nnb-cat-item.nnb-drop-ok {
    background: var(--nnb-accent-soft);
    border-color: var(--nnb-accent);
    box-shadow: inset 0 0 0 2px var(--nnb-accent);
    transform: translateX(2px);
    font-weight: 600;
}
.nnb-cat-item.nnb-drop-ok .nnb-cat-count { color: var(--nnb-accent); background: var(--nnb-elev); }
.nnb-cat-ico { flex: 0 0 auto; font-size: 15px; width: 18px; text-align: center; }
.nnb-cat-name {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.nnb-cat-count {
    flex: 0 0 auto;
    font-size: 11px;
    color: var(--nnb-dim);
    background: var(--nnb-input);
    border-radius: 999px;
    padding: 1px 7px;
}
.nnb-cat-item.is-active .nnb-cat-count { color: var(--nnb-accent); background: var(--nnb-elev); }
.nnb-cat-actions { display: inline-flex; gap: 2px; flex: 0 0 auto; }
.nnb-cat-act {
    width: 24px;
    height: 24px;
    border: 0;
    background: transparent;
    color: var(--nnb-dim);
    border-radius: 5px;
    cursor: pointer;
    font-size: 12px;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.nnb-cat-act:hover { background: var(--nnb-hover); color: var(--nnb-text); }
.nnb-cat-act.del:hover { color: var(--nnb-danger); }
.nnb-grip { cursor: grab; color: var(--nnb-dim); font-size: 13px; }
.nnb-grip:active { cursor: grabbing; }

.nnb-side-tip {
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px dashed var(--nnb-border);
    font-size: 11.5px;
    line-height: 1.7;
    color: var(--nnb-dim);
}

/* ---------- 笔记列表 ---------- */
.nnb-main { min-width: 0; }
.nnb-list-head {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
    padding: 0 2px;
}
.nnb-list-head h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}
.nnb-list-head .nnb-count {
    font-size: 12px;
    color: var(--nnb-sub);
}
.nnb-list-head .nnb-toolbar-spacer { flex: 1; }

.nnb-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(268px, 1fr));
    gap: 12px;
    align-content: start;
}
.nnb-item {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 148px;
    padding: 14px;
    border-radius: 12px;
    border: 1px solid var(--nnb-border);
    background: var(--nnb-elev);
    cursor: pointer;
    transition: border-color .15s, transform .15s, box-shadow .15s;
    contain: layout style;
}
.nnb-item:hover {
    border-color: var(--nnb-accent);
    transform: translateY(-1px);
    box-shadow: 0 6px 18px var(--nnb-shadow);
}
.nnb-item.is-pinned { border-left: 3px solid var(--nnb-accent); }
.nnb-item-top {
    display: flex;
    align-items: flex-start;
    gap: 8px;
}
.nnb-item-title {
    flex: 1 1 auto;
    min-width: 0;
    font-size: 15px;
    font-weight: 600;
    line-height: 1.4;
    color: var(--nnb-text);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    word-break: break-word;
}
.nnb-item-pin { flex: 0 0 auto; color: var(--nnb-accent); font-size: 13px; }
.nnb-item-excerpt {
    flex: 1 1 auto;
    font-size: 12.5px;
    line-height: 1.7;
    color: var(--nnb-sub);
    white-space: pre-wrap;
    word-break: break-word;
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.nnb-item-empty { color: var(--nnb-dim); font-style: italic; }
.nnb-item-foot {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11.5px;
    color: var(--nnb-dim);
    border-top: 1px solid var(--nnb-border);
    padding-top: 8px;
}
.nnb-item-cat {
    background: var(--nnb-accent-soft);
    color: var(--nnb-accent);
    border-radius: 999px;
    padding: 2px 9px;
    font-size: 11px;
    max-width: 45%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.nnb-item-time { flex: 1 1 auto; }
.nnb-item-actions { display: inline-flex; gap: 4px; flex: 0 0 auto; }
.nnb-item-act {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    border: 1px solid transparent;
    background: transparent;
    color: var(--nnb-dim);
    cursor: pointer;
    font-size: 13px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.nnb-item-act:hover { background: var(--nnb-hover); color: var(--nnb-text); }
.nnb-item-act.del:hover { color: var(--nnb-danger); }

/* 分类徽章：点一下即可改分类，不必拖拽 */
.nnb-item-cat { border: 0; font: inherit; cursor: pointer; }
.nnb-item-cat:hover { filter: brightness(1.18); text-decoration: underline; }
.nnb-item-cat:focus-visible { outline: 2px solid var(--nnb-accent); outline-offset: 2px; }

/* 拖拽时跟随指针的目标提示 */
.nnb-drop-badge {
    position: fixed; z-index: 80; pointer-events: none;
    padding: 7px 12px; border-radius: 999px;
    background: var(--nnb-accent); color: #fff;
    font-size: 12.5px; font-weight: 600; white-space: nowrap;
    box-shadow: 0 8px 24px var(--nnb-shadow);
}
/* 触屏长按拾起后跟随手指的浮卡 */
.nnb-drag-ghost {
    position: fixed; z-index: 90; pointer-events: none;
    max-width: 220px; padding: 9px 13px; border-radius: 9px;
    background: var(--nnb-elev); color: var(--nnb-text);
    border: 1px solid var(--nnb-accent);
    box-shadow: 0 12px 32px var(--nnb-shadow);
    font-size: 13px; font-weight: 600;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
/* 快捷分类菜单 */
.nnb-move-mask { position: fixed; inset: 0; z-index: 72; background: rgba(0,0,0,.28); }
.nnb-move-menu {
    position: fixed; z-index: 73; min-width: 190px; max-height: min(70vh, 420px);
    overflow-y: auto; overscroll-behavior: contain;
    padding: 6px; border-radius: 12px;
    background: var(--nnb-elev); border: 1px solid var(--nnb-border);
    box-shadow: 0 16px 44px var(--nnb-shadow);
}
.nnb-move-t {
    padding: 7px 10px 9px; font-size: 11.5px; color: var(--nnb-sub);
    border-bottom: 1px solid var(--nnb-border); margin-bottom: 4px;
    max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.nnb-move-item {
    display: flex; align-items: center; width: 100%; min-height: 38px;
    padding: 8px 10px; border: 0; border-radius: 8px;
    background: transparent; color: var(--nnb-text);
    font-size: 13px; text-align: left; cursor: pointer;
}
.nnb-move-item:hover { background: var(--nnb-hover); }
.nnb-move-item.is-on { color: var(--nnb-accent); background: var(--nnb-accent-soft); font-weight: 600; }
.nnb-move-item:focus-visible { outline: 2px solid var(--nnb-accent); outline-offset: -2px; }

.nnb-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: 260px;
    border: 1px dashed var(--nnb-border);
    border-radius: 12px;
    color: var(--nnb-sub);
    font-size: 13.5px;
}
.nnb-empty .nnb-empty-ic { font-size: 40px; opacity: .6; }

/* ---------- 弹窗（复用 nv-modal 结构，加宽） ---------- */
.nnb-modal { width: min(720px, calc(100vw - 32px)); }
.nnb-modal.nnb-editor { width: min(760px, calc(100vw - 32px)); }
.nnb-modal-body { max-height: 66vh; overflow-y: auto; }
.nnb-editor .nnb-modal-body { max-height: 72vh; }
.nnb-modal-foot { flex-wrap: wrap; }
.nnb-hint {
    font-size: 12.5px;
    line-height: 1.7;
    color: var(--nnb-sub);
    background: var(--nnb-input);
    border: 1px solid var(--nnb-border);
    border-radius: 10px;
    padding: 9px 12px;
    margin-bottom: 14px;
}
.nnb-editor-area {
    width: 100%;
    min-height: 320px;
    resize: vertical;
    box-sizing: border-box;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 13.5px;
    line-height: 1.75;
    tab-size: 2;
}
.nnb-editor-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 14px;
    margin-top: 10px;
    font-size: 12px;
    color: var(--nnb-dim);
}
.nnb-editor-meta label { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.nnb-editor-meta .nnb-select { height: 30px; font-size: 12px; }
.nnb-save-state { color: var(--nnb-dim); }
.nnb-save-state.is-saved { color: var(--nnb-ok); }
.nnb-save-state.is-off { color: var(--nnb-sub); }

/* 分类管理弹窗 */
.nnb-catmgr-list { list-style: none; margin: 0 0 14px; padding: 0; }
.nnb-catmgr-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 6px;
    border-bottom: 1px solid var(--nnb-border);
}
.nnb-catmgr-row.is-dragging { opacity: .45; }
.nnb-catmgr-row.nv-drop-before { box-shadow: inset 0 2px 0 var(--nnb-accent); }
.nnb-catmgr-row.nv-drop-after { box-shadow: inset 0 -2px 0 var(--nnb-accent); }
.nnb-catmgr-row .nnb-cat-name { font-size: 13.5px; }
.nnb-mgr-name { flex: 1 1 auto; min-width: 0; height: 32px; font-size: 13px; }
.nnb-catmgr-new {
    display: flex;
    gap: 8px;
    align-items: center;
}
.nnb-catmgr-new .nnb-input { flex: 1 1 auto; }

/* 导入导出 */
.nnb-io-tabs { display: flex; gap: 8px; margin-bottom: 12px; }
.nnb-io-tab {
    flex: 1;
    height: 34px;
    border: 1px solid var(--nnb-border);
    background: var(--nnb-input);
    color: var(--nnb-sub);
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
}
.nnb-io-tab.is-active {
    border-color: var(--nnb-accent);
    color: var(--nnb-accent);
    background: var(--nnb-accent-soft);
}
.nnb-io-area {
    width: 100%;
    min-height: 220px;
    box-sizing: border-box;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 12px;
    line-height: 1.6;
}
.nnb-io-tip { font-size: 12px; color: var(--nnb-sub); line-height: 1.8; }

/* ---------- 导出笔记（TXT / Markdown / Word / PDF / 图片） ---------- */
/* 提高特异性：文件后段另有一条 .nnb-modal{width:420px} 基础规则 */
.nnb-modal.nnb-export-modal { width: min(560px, calc(100vw - 32px)); max-width: 100%; }
.nnb-exp-formats {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 8px;
}
.nnb-exp-fmt {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 3px; min-width: 0; min-height: 62px; padding: 8px 4px;
    border: 1px solid var(--nnb-border); border-radius: 10px;
    background: var(--nnb-input); color: var(--nnb-sub);
    cursor: pointer; transition: background .15s, border-color .15s, color .15s;
}
.nnb-exp-fmt:hover { background: var(--nnb-hover); border-color: var(--nnb-border-strong); color: var(--nnb-text); }
.nnb-exp-fmt b { font-size: 13px; line-height: 1.1; color: var(--nnb-text); }
.nnb-exp-fmt span { font-size: 11px; line-height: 1.2; white-space: nowrap; }
.nnb-exp-fmt.is-active {
    background: var(--nnb-accent-soft); border-color: var(--nnb-accent); color: var(--nnb-accent);
}
.nnb-exp-fmt.is-active b { color: var(--nnb-accent); }
.nnb-exp-opts { display: flex; flex-wrap: wrap; gap: 8px 20px; margin: 0 0 12px; }
.nnb-exp-opts label {
    display: inline-flex; align-items: center; gap: 6px; margin: 0;
    font-size: 13px; color: var(--nnb-text); cursor: pointer;
}
.nnb-exp-opts input[type="checkbox"] { accent-color: var(--nnb-accent); }
.nnb-exp-info {
    padding: 9px 12px; background: var(--nnb-input);
    border: 1px solid var(--nnb-border); border-radius: 8px;
}
.nnb-exp-info b { color: var(--nnb-accent); }

/* ---------- 页面内嵌编辑器（默认编辑样式） ---------- */
.nnb-inline-editor { margin-top: 2px; }
.nnb-modal.nnb-embed {
    position: static !important;
    transform: none !important;
    left: auto; top: auto;
    width: 100% !important;
    max-width: none !important;
    margin: 0;
    border-radius: 12px;
    box-shadow: none;
    z-index: auto;
    animation: none;
    overflow: visible;
}
.nnb-modal.nnb-embed .nnb-modal-body { max-height: none; overflow: visible; }
.nnb-modal.nnb-embed .nnb-editor-area { min-height: 46vh; }
.nnb-set-modal { width: min(460px, calc(100vw - 32px)); }
.nnb-storage-ops {
    display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
    margin: 0 0 12px; padding: 10px 12px;
    background: var(--nnb-input); border: 1px solid var(--nnb-border); border-radius: 10px;
}
.nnb-storage-ops .nnb-btn { height: 32px; font-size: 12px; }
.nnb-storage-ops .nnb-io-tip { flex: 1 1 180px; margin: 0; }

/* Toast */
.nnb-toast {
    position: fixed;
    left: 50%;
    bottom: calc(28px + env(safe-area-inset-bottom, 0px));
    transform: translateX(-50%);
    z-index: 120;
    background: var(--nnb-elev);
    color: var(--nnb-text);
    border: 1px solid var(--nnb-border-strong);
    border-radius: 10px;
    padding: 10px 18px;
    font-size: 13px;
    box-shadow: 0 8px 28px var(--nnb-shadow);
    max-width: calc(100vw - 32px);
    text-align: center;
}

/* ---------- 响应式 ---------- */
@media (max-width: 1023px) {
    .nnb-layout { grid-template-columns: 200px minmax(0, 1fr); gap: 12px; }
    .nnb-grid { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
}
@media (max-width: 767px) {
    .nnb-view { padding-top: 12px; }
    .nnb-toolbar-title { font-size: 17px; width: 100%; }
    .nnb-search { flex: 1 1 100%; }
    .nnb-toolbar .nnb-select { flex: 1 1 calc(50% - 4px); }
    .nnb-toolbar .nnb-btn { flex: 1 1 calc(50% - 4px); min-height: 40px; }
    /* 手机端保留笔记本按钮文字，避免误认 */
    .nnb-toolbar .nnb-btn-label { display: inline; }
    .nnb-toolbar .nnb-stat { flex: 0 0 auto; }
    .nnb-layout { display: block; }
    .nnb-side {
        position: static;
        max-height: none;
        margin-bottom: 14px;
        padding: 10px;
    }
    .nnb-cat-list { display: flex; flex-wrap: wrap; gap: 6px; }
    .nnb-cat-item {
        min-height: 40px;
        margin-bottom: 0;
        flex: 0 0 auto;
        padding: 6px 10px;
        border: 1px solid var(--nnb-border);
    }
    .nnb-cat-item.is-active { border-color: var(--nnb-accent); }
    .nnb-grip { display: none; }
    .nnb-side-tip { display: none; }
    .nnb-grid { grid-template-columns: 1fr; }
    .nnb-item { min-height: 130px; }
    /* 移动端弹窗底部抽屉 */
    .nnb-modal {
        width: 100% !important;
        max-width: 100%;
        max-height: 92vh;
        border-radius: 16px 16px 0 0;
        align-self: flex-end;
        padding-bottom: env(safe-area-inset-bottom, 0px);
    }
    .nnb-modal-mask { align-items: flex-end; }
    .nnb-editor-area { min-height: 40vh; font-size: 16px; }
    .nnb-input, .nnb-select { font-size: 16px; }
    .nnb-item-act { width: 34px; height: 34px; }
    .nnb-cat-act { width: 30px; height: 30px; }
    .nnb-btn { min-height: 44px; }
    .nnb-exp-formats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .nnb-exp-fmt { min-height: 58px; }
    .nnb-exp-opts label { min-height: 40px; }
    /* 手机端分类菜单贴底，触控更稳 */
    .nnb-move-menu {
        left: 12px !important; right: 12px !important; top: auto !important; bottom: 12px;
        max-height: 62vh; border-radius: 16px;
        padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px));
    }
    .nnb-move-item { min-height: 44px; font-size: 15px; }
    .nnb-item-cat { min-height: 26px; padding: 3px 9px; }
    .nnb-drop-badge { font-size: 13px; }
}
@media (max-width: 420px) {
    .nnb-toolbar-title .nnb-emoji { display: none; }
    .nnb-stat { font-size: 11px; }
    .nnb-grid { gap: 10px; }
}
@media (prefers-reduced-motion: reduce) {
    .nnb-item, .nnb-btn, .nnb-cat-item { transition: none; }
    .nnb-cat-item.nnb-drop-ok { transform: none; }
}


/* ---------------- 自包含基础样式（源自 navi.css，改前缀，dial 页未引入 navi.css） ---------------- */
.nnb-modal-mask {
    position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 60;
    animation: nnb-fade .15s ease;
}
.nnb-modal {
    position: fixed; top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 420px; max-width: 92vw;
    background: var(--nnb-bg-elev); border: 1px solid var(--nnb-border);
    border-radius: 14px;
    z-index: 70; box-shadow: 0 20px 60px var(--nnb-shadow);
    overflow: hidden;
    animation: nnb-pop .18s ease;
}
@keyframes nnb-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes nnb-pop { from { opacity: 0; transform: translate(-50%, -48%) scale(.97); } to { opacity: 1; transform: translate(-50%, -50%) scale(1); } }
.nnb-modal-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 18px; border-bottom: 1px solid var(--nnb-border);
}
.nnb-modal-head h3 { margin: 0; font-size: 16px; color: var(--nnb-text); }
/* 编辑窗口：删除 / 完成 / 保存 与标题同一行，右对齐 */
.nnb-head-actions { display: inline-flex; align-items: center; gap: 8px; margin-left: auto; }
.nnb-head-actions .nnb-btn { height: 32px; padding: 0 12px; font-size: 12.5px; }
@media (max-width: 480px) {
    .nnb-modal-head { flex-wrap: wrap; }
    .nnb-head-actions { order: 3; width: 100%; margin-left: 0; justify-content: flex-end; }
}
.nnb-modal-close { border: none; background: none; font-size: 24px; cursor: pointer; color: var(--nnb-text-dim); line-height: 1; padding: 4px; }
.nnb-modal-close:hover { color: var(--nnb-accent); }
.nnb-modal-body { padding: 16px 18px 4px; }
/* 添加/编辑弹窗提示条：区分「公共网址（所有访客可见）」与「本机自定义（仅自己可见）」 */
.nnb-modal-hint {
    margin: -4px 0 12px;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 12.5px;
    line-height: 1.5;
    background: var(--nnb-accent-soft);
    border: 1px dashed var(--nnb-accent);
    color: var(--nnb-accent);
}
.nnb-modal-foot {
    display: flex; justify-content: flex-end; gap: 10px;
    padding: 12px 18px 16px;
}
.nnb-field { margin-bottom: 14px; }
.nnb-field label { display: block; font-size: 12px; color: var(--nnb-text-sub); margin-bottom: 5px; }
/* 设置弹窗：单行（label 左 / 控件右） */
.nnb-field-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.nnb-field-row label { display: block; font-size: 13px; color: var(--nnb-text); margin: 0; }
.nnb-field-row .nnb-input { width: auto; min-width: 130px; flex: 0 0 auto; }
/* 开关（显示简介） */
.nnb-switch { position: relative; display: inline-flex; align-items: center; cursor: pointer; }
.nnb-switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.nnb-switch-track { width: 42px; height: 24px; border-radius: 999px; background: var(--nnb-border-strong); transition: background .15s; position: relative; display: inline-block; }
.nnb-switch-track::after { content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 3px rgba(0,0,0,.25); }
.nnb-switch input:checked + .nnb-switch-track { background: var(--nnb-accent); }
.nnb-switch input:checked + .nnb-switch-track::after { transform: translateX(18px); }
.nnb-switch input:focus-visible + .nnb-switch-track { box-shadow: 0 0 0 3px var(--nnb-accent-soft); }
.nnb-req { color: var(--nnb-danger); }
.nnb-opt { color: var(--nnb-text-dim); font-weight: 400; }
/* 名称由系统自动抓取回填时的轻提示样式 */
.nnb-input.nnb-autofilled { border-color: var(--nnb-accent); background: var(--nnb-accent-soft); }
/* 保存按钮抓取标题时的禁用态 */
.nnb-btn:disabled { opacity: .6; cursor: progress; }
.nnb-input {
    width: 100%; border: 1px solid var(--nnb-border-strong); border-radius: 8px;
    padding: 9px 11px; font-size: 14px; color: var(--nnb-text); background: var(--nnb-bg-input); outline: none;
    box-sizing: border-box;
    transition: border-color .12s, box-shadow .12s;
}
.nnb-input:focus { border-color: var(--nnb-accent); box-shadow: 0 0 0 3px var(--nnb-accent-soft); }
.nnb-input::placeholder { color: var(--nnb-text-dim); }
.nnb-input option { background: var(--nnb-bg-elev); color: var(--nnb-text); }
.nnb-btn-label { display: inline; }
