/* ===================== 我的小记 - 样式 ===================== */
:root {
    --primary: #f59e0b;
    --primary-deep: #d97706;
    --bg: #faf6f0;
    --card: #ffffff;
    --text: #3f3428;
    --muted: #9a8f80;
    --line: #f0e7da;
    --danger: #ef4444;
    --success: #10b981;
    --radius: 14px;
    --shadow: 0 2px 10px rgba(180, 150, 100, 0.10);
}

* { box-sizing: border-box; }

body {
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
        "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    margin: 0;
    padding-bottom: 86px;
    -webkit-tap-highlight-color: transparent;
}

a { color: var(--primary-deep); text-decoration: none; }
.muted { color: var(--muted); font-size: 0.85rem; }
.hidden { display: none !important; }
.mt-2 { margin-top: 0.5rem; }

/* ---------- 顶部导航 ---------- */
.top-nav {
    position: sticky; top: 0; z-index: 50;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--line);
}
.nav-inner {
    max-width: 520px; margin: 0 auto;
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 14px;
}
.brand { font-weight: 700; font-size: 1.05rem; color: var(--text); }
.plan-pill {
    font-size: 0.72rem; padding: 4px 10px; border-radius: 999px;
    background: #f4ede2; color: #8b7d6a; font-weight: 600;
}
.plan-pill.vip { background: linear-gradient(135deg, #fbbf24, #f59e0b); color: #fff; }

.app-container { max-width: 520px; margin: 0 auto; padding: 12px 14px; }
.page-title { font-weight: 700; margin: 6px 0 14px; font-size: 1.1rem; }

.flash-container { max-width: 520px; margin: 0 auto; position: relative; z-index: 60; }
.flash-container .alert { font-size: 0.9rem; border-radius: 12px; }

/* ---------- 底部导航 ---------- */
.bottom-nav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
    max-width: 520px; margin: 0 auto;
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(10px);
    border-top: 1px solid var(--line);
    display: flex; justify-content: space-around;
    padding: 5px 4px calc(5px + env(safe-area-inset-bottom));
}
.bn-item {
    flex: 1; display: flex; flex-direction: column; align-items: center; gap: 1px;
    font-size: 0.66rem; color: #a89b88; padding: 4px 0; border-radius: 10px;
}
.bn-item span { font-size: 1.15rem; line-height: 1.2; }
.bn-item.active { color: var(--primary-deep); font-weight: 700; background: #fff7e8; }

/* ---------- 快捷记录 ---------- */
.capture-card {
    background: var(--card); border-radius: var(--radius);
    box-shadow: var(--shadow); padding: 12px; margin-bottom: 14px;
    border: 1px solid var(--line);
}
.capture-card textarea {
    width: 100%; border: none; outline: none; resize: none;
    font-size: 1rem; line-height: 1.55; background: transparent; color: var(--text);
    min-height: 52px; font-family: inherit;
}
.capture-card textarea::placeholder { color: #c9bcab; }
.capture-bar { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.capture-tags {
    flex: 1; display: flex; gap: 6px; overflow-x: auto;
    scrollbar-width: none; padding: 2px 0;
}
.capture-tags::-webkit-scrollbar { display: none; }
.chip {
    flex-shrink: 0; border: 1px solid var(--line); background: #fff;
    color: #8b7d6a; font-size: 0.78rem; padding: 4px 10px;
    border-radius: 999px; cursor: pointer; transition: all 0.15s;
}
.chip i { font-style: normal; opacity: 0.55; font-size: 0.72rem; }
.chip.active {
    background: #fff3dc; border-color: var(--primary);
    color: var(--primary-deep); font-weight: 700;
}
.btn-save {
    flex-shrink: 0; border: none; cursor: pointer;
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    color: #fff; font-weight: 700; font-size: 0.9rem;
    padding: 8px 18px; border-radius: 10px;
    box-shadow: 0 3px 8px rgba(245, 158, 11, 0.35);
}
.btn-save:disabled { opacity: 0.5; }

/* ---------- 筛选 ---------- */
.list-head { margin-bottom: 10px; }
.tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 8px; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
    flex-shrink: 0; border: none; background: transparent; cursor: pointer;
    color: #8b7d6a; font-size: 0.85rem; padding: 6px 12px; border-radius: 999px;
    display: inline-flex; align-items: center; gap: 4px;
}
.tab i {
    font-style: normal; font-size: 0.7rem; background: #f0e7da;
    padding: 0 6px; border-radius: 999px; color: #8b7d6a;
}
.tab.active { background: #fff; box-shadow: var(--shadow); color: var(--text); font-weight: 700; }
.tab.active i { background: #fff3dc; color: var(--primary-deep); }

.search-row input {
    width: 100%; border: 1px solid var(--line); background: #fff;
    border-radius: 10px; padding: 8px 12px; font-size: 0.9rem;
    outline: none; color: var(--text);
}
.search-row input:focus { border-color: #f5c76e; }

.tag-filter { display: flex; gap: 6px; overflow-x: auto; padding: 8px 0 2px; scrollbar-width: none; }
.tag-filter::-webkit-scrollbar { display: none; }

/* ---------- 笔记卡片 ---------- */
.note-list { display: flex; flex-direction: column; gap: 10px; }
.note-card {
    background: var(--card); border-radius: var(--radius);
    box-shadow: var(--shadow); padding: 12px 14px;
    border-left: 4px solid transparent;
}
.note-card.status-inbox { border-left-color: #93c5fd; }
.note-card.status-doing { border-left-color: #fbbf24; }
.note-card.status-done { border-left-color: #6ee7b7; }
.note-card.pinned { box-shadow: 0 3px 14px rgba(245, 158, 11, 0.22); }

.note-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.status-btn {
    border: none; cursor: pointer; font-size: 0.72rem; font-weight: 700;
    padding: 3px 10px; border-radius: 999px;
}
.status-btn.s-inbox { background: #eff6ff; color: #2563eb; }
.status-btn.s-doing { background: #fff7ed; color: #c2410c; }
.status-btn.s-done { background: #ecfdf5; color: #059669; }
.note-time { font-size: 0.72rem; color: var(--muted); }

.note-content {
    font-size: 0.95rem; line-height: 1.6; white-space: pre-wrap;
    word-break: break-word; margin: 2px 0 8px;
}
.note-card.status-done .note-content { color: #a89b88; text-decoration: none; }

.note-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.note-tags { display: flex; gap: 6px; flex-wrap: wrap; }
.tag-chip {
    font-size: 0.72rem; background: #f7f2e8; color: #8b7d6a;
    padding: 2px 8px; border-radius: 999px;
}
.remind-badge {
    font-size: 0.72rem; background: #fff3dc; color: var(--primary-deep);
    padding: 2px 8px; border-radius: 999px; font-weight: 600;
}
.note-actions { display: flex; gap: 2px; }
.note-actions button {
    border: none; background: transparent; cursor: pointer;
    font-size: 0.95rem; padding: 4px 6px; border-radius: 8px; opacity: 0.55;
}
.note-actions button:hover { background: #f7f2e8; opacity: 1; }
.note-actions button.on { opacity: 1; }

.remind-panel {
    display: flex; gap: 6px; align-items: center; flex-wrap: wrap;
    margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--line);
}
.remind-panel input {
    border: 1px solid var(--line); border-radius: 8px;
    padding: 5px 8px; font-size: 0.82rem; color: var(--text);
}

.edit-box textarea {
    width: 100%; border: 1px solid var(--line); border-radius: 10px;
    padding: 8px 10px; font-size: 0.95rem; line-height: 1.55;
    font-family: inherit; resize: vertical; color: var(--text); outline: none;
    min-height: 70px;
}
.edit-box textarea:focus { border-color: #f5c76e; }
.edit-bar { display: flex; gap: 6px; align-items: center; margin-top: 6px; flex-wrap: wrap; }
.edit-bar select {
    border: 1px solid var(--line); border-radius: 8px; padding: 5px 8px;
    font-size: 0.82rem; color: var(--text); background: #fff; flex: 1;
    max-width: 160px;
}

.empty-tip {
    text-align: center; color: #c9bcab; font-size: 0.9rem;
    padding: 42px 0;
}

/* ---------- 通用按钮 ---------- */
.btn-mini {
    border: 1px solid var(--line); background: #fff; color: #8b7d6a;
    font-size: 0.78rem; padding: 4px 10px; border-radius: 8px; cursor: pointer;
}
.btn-mini:hover { border-color: #e3d5c0; color: var(--text); }
.btn-mini.danger { color: var(--danger); border-color: #fecaca; }
.btn-link { font-size: 0.85rem; font-weight: 600; }
.inline-form { display: inline-block; }

/* ---------- 卡片区块 ---------- */
.card {
    background: var(--card); border-radius: var(--radius);
    box-shadow: var(--shadow); border: 1px solid var(--line);
    padding: 14px; margin-bottom: 12px;
}
.card h6 { font-weight: 700; margin-bottom: 10px; font-size: 0.95rem; }

/* ---------- 登录 / 注册 ---------- */
.auth-card {
    background: var(--card); border-radius: 20px; box-shadow: var(--shadow);
    padding: 34px 24px 26px; text-align: center;
    margin-top: 9vh; border: 1px solid var(--line);
}
.auth-logo { font-size: 2.6rem; }
.auth-card h3 { font-weight: 800; margin: 10px 0 2px; }
.auth-card form { display: flex; flex-direction: column; gap: 10px; margin-top: 8px; }
.auth-card input {
    border: 1px solid var(--line); border-radius: 10px;
    padding: 11px 14px; font-size: 0.95rem; outline: none; color: var(--text);
}
.auth-card input:focus { border-color: #f5c76e; }
.btn-primary-full {
    border: none; cursor: pointer; margin-top: 4px;
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    color: #fff; font-weight: 700; font-size: 0.98rem;
    padding: 11px; border-radius: 10px;
    box-shadow: 0 4px 10px rgba(245, 158, 11, 0.35);
}
.auth-switch { margin-top: 16px; font-size: 0.85rem; color: var(--muted); }

/* ---------- 设置 ---------- */
.settings-form .form-row {
    display: flex; align-items: center; gap: 10px; margin-bottom: 8px;
}
.form-row span { width: 96px; flex-shrink: 0; font-size: 0.85rem; color: #8b7d6a; }
.form-row input {
    flex: 1; border: 1px solid var(--line); border-radius: 8px;
    padding: 8px 10px; font-size: 0.88rem; outline: none; color: var(--text);
}
.form-row input:focus { border-color: #f5c76e; }
.lock-tag {
    font-size: 0.68rem; background: #fff3dc; color: var(--primary-deep);
    padding: 2px 8px; border-radius: 999px; margin-left: 4px;
}
.howto { margin-top: 12px; font-size: 0.82rem; color: #8b7d6a; }
.howto summary { cursor: pointer; color: var(--primary-deep); }
.howto ol { margin: 8px 0 0; padding-left: 20px; line-height: 1.7; }

.tag-manage { display: flex; flex-direction: column; gap: 8px; }
.tag-item { display: flex; align-items: center; gap: 6px; }
.tag-form { display: flex; align-items: center; gap: 6px; flex: 1; }
.tag-form input {
    border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px;
    font-size: 0.85rem; color: var(--text); outline: none; min-width: 0;
}
.tag-form input:focus { border-color: #f5c76e; }
.tag-icon-input { width: 44px; text-align: center; }
.tag-form input[name="name"] { flex: 1; }
.tag-count { font-size: 0.72rem; color: var(--muted); flex-shrink: 0; }
.tag-form.add { margin-top: 4px; padding-top: 10px; border-top: 1px dashed var(--line); }
.export-row { display: flex; gap: 8px; }

/* ---------- VIP 页 ---------- */
.vip-status-card {
    background: var(--card); border-radius: var(--radius);
    box-shadow: var(--shadow); border: 1px solid var(--line);
    padding: 22px 16px; text-align: center; margin-bottom: 14px;
}
.vip-status-card.is-vip {
    background: linear-gradient(160deg, #fff8e6, #fff);
    border-color: #f5d48a;
}
.vip-status-card .big { font-size: 2.2rem; }
.vip-status-card h4 { font-weight: 800; margin: 8px 0 4px; }
.vip-status-card p { color: #8b7d6a; font-size: 0.85rem; margin: 0; }

.plans { display: flex; gap: 8px; margin-bottom: 14px; }
.plan-card {
    flex: 1; background: var(--card); border: 1px solid var(--line);
    border-radius: var(--radius); padding: 14px 6px; text-align: center;
    position: relative; box-shadow: var(--shadow);
}
.plan-card.hot { border-color: #f5c76e; background: #fffaf0; }
.plan-hot-tag {
    position: absolute; top: -9px; left: 50%; transform: translateX(-50%);
    background: linear-gradient(135deg, #fbbf24, #f59e0b); color: #fff;
    font-size: 0.62rem; padding: 2px 8px; border-radius: 999px; white-space: nowrap;
}
.plan-name { font-size: 0.82rem; color: #8b7d6a; }
.plan-price { font-size: 1.3rem; font-weight: 800; color: var(--primary-deep); margin: 4px 0 2px; }
.plan-days { font-size: 0.72rem; color: var(--muted); }

.activate-form { display: flex; gap: 8px; }
.activate-form input {
    flex: 1; border: 1px solid var(--line); border-radius: 10px;
    padding: 9px 12px; font-size: 0.9rem; outline: none; color: var(--text);
    text-transform: uppercase;
}
.activate-form input:focus { border-color: #f5c76e; }
.hint { font-size: 0.78rem; color: var(--muted); margin: 10px 0 0; line-height: 1.65; }

.benefit-table { width: 100%; font-size: 0.82rem; border-collapse: collapse; }
.benefit-table th, .benefit-table td {
    padding: 8px 6px; border-bottom: 1px solid var(--line); text-align: center;
}
.benefit-table td:first-child, .benefit-table th:first-child { text-align: left; color: #8b7d6a; }
.benefit-table .vip-col { color: var(--primary-deep); }
.benefit-table .yes { color: var(--success); font-weight: 700; }
.benefit-table .no { color: #d5c9b8; }

/* ---------- 统计 ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 14px; }
.stat-cell {
    background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
    box-shadow: var(--shadow); padding: 14px 6px; text-align: center;
    display: flex; flex-direction: column; gap: 2px;
}
.stat-cell b { font-size: 1.25rem; color: var(--primary-deep); }
.stat-cell span { font-size: 0.72rem; color: var(--muted); }
.stat-cell.wide { grid-column: span 3; }

.chart-card .bars { display: flex; align-items: flex-end; gap: 3px; height: 110px; }
.bar-wrap { flex: 1; height: 100%; display: flex; align-items: flex-end; }
.bar {
    width: 100%; min-height: 2px; border-radius: 3px 3px 0 0;
    background: linear-gradient(180deg, #fbbf24, #f59e0b);
}
.bars-labels { display: flex; justify-content: space-between; font-size: 0.7rem; color: var(--muted); margin-top: 6px; }

/* ---------- 管理后台 ---------- */
.admin-links { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.admin-link-card {
    background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
    box-shadow: var(--shadow); padding: 14px; display: flex;
    justify-content: space-between; align-items: center; color: var(--text);
}
.admin-link-card span { font-size: 0.78rem; color: var(--muted); }

.user-row, .code-row {
    background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
    box-shadow: var(--shadow); padding: 12px 14px; margin-bottom: 8px;
    display: flex; justify-content: space-between; align-items: center; gap: 10px;
}
.user-row.banned { opacity: 0.55; }
.user-name { font-size: 0.92rem; }
.badge-admin, .badge-ban {
    font-size: 0.66rem; padding: 2px 7px; border-radius: 999px; margin-left: 4px;
}
.badge-admin { background: #eff6ff; color: #2563eb; }
.badge-ban { background: #fef2f2; color: var(--danger); }
.vip-text { font-size: 0.78rem; color: var(--primary-deep); margin-top: 2px; }
.user-actions { display: flex; flex-direction: column; gap: 6px; flex-shrink: 0; }

.code-tabs { margin-bottom: 12px; }
.code-tabs .tab { text-decoration: none; }
.code-main { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.code-main code {
    font-size: 0.85rem; background: #f7f2e8; padding: 3px 8px;
    border-radius: 6px; color: #6b5d4a; font-weight: 700; letter-spacing: 0.4px;
}
.plan-tag { font-size: 0.7rem; color: var(--muted); }
.status-tag { font-size: 0.7rem; padding: 2px 8px; border-radius: 999px; }
.status-tag.unused { background: #ecfdf5; color: #059669; }
.status-tag.used { background: #f0e7da; color: #8b7d6a; }
.status-tag.disabled { background: #fef2f2; color: var(--danger); }
.code-side { font-size: 0.74rem; flex-shrink: 0; }

/* ---------- Toast ---------- */
.toast-msg {
    position: fixed; left: 50%; bottom: 110px; transform: translateX(-50%) translateY(8px);
    background: rgba(63, 52, 40, 0.92); color: #fff; font-size: 0.85rem;
    padding: 9px 18px; border-radius: 999px; opacity: 0; pointer-events: none;
    transition: all 0.25s; z-index: 200; max-width: 80vw; text-align: center;
}
.toast-msg.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- 分享弹窗 ---------- */
.modal-mask {
    position: fixed; inset: 0; background: rgba(50, 40, 28, 0.5);
    display: flex; align-items: center; justify-content: center;
    padding: 16px; z-index: 120;
}
.share-panel {
    background: #fff; border-radius: 18px; padding: 14px;
    max-width: 420px; width: 100%; max-height: 92vh; overflow-y: auto;
    text-align: center;
}
.share-panel canvas { width: 100%; border-radius: 12px; border: 1px solid var(--line); }
.share-actions { display: flex; gap: 8px; justify-content: center; margin-top: 12px; }
.share-hint { font-size: 0.72rem; color: var(--muted); margin: 8px 0 0; }

/* ---------- 界面模式切换 ---------- */
.brand { flex-shrink: 0; }
.nav-right { display: flex; align-items: center; gap: 6px; flex-shrink: 0; margin-left: auto; }
.view-switch {
    display: none; font-size: 0.7rem; color: #8b7d6a;
    border: 1px solid var(--line); border-radius: 999px;
    padding: 4px 9px; white-space: nowrap;
}
html.view-desktop .view-switch.to-mobile { display: inline-block; }
html.view-mobile .view-switch.to-desktop { display: inline-block; }

/* 顶部横向导航（仅电脑版显示） */
.nav-links { display: none; }
html.view-desktop .nav-inner { flex-wrap: wrap; row-gap: 6px; }
html.view-desktop .nav-links {
    display: flex; gap: 16px; flex: 1 1 auto; min-width: 0;
    margin-left: 20px; flex-wrap: wrap; row-gap: 2px;
}
.nav-links a {
    font-size: 0.9rem; color: #8b7d6a; padding: 4px 0;
    border-bottom: 2px solid transparent; white-space: nowrap;
}
/* 窄窗口下：导航链接独占一行，避免挤压重叠 */
@media (max-width: 900px) {
    html.view-desktop .nav-links { flex-basis: 100%; margin-left: 0; }
}
.nav-links a.active { color: var(--primary-deep); font-weight: 700; border-bottom-color: var(--primary); }

/* ---------- 电脑版布局 ---------- */
html.view-desktop body { padding-bottom: 40px; }
html.view-desktop .bottom-nav { display: none; }
html.view-desktop .nav-inner { max-width: 1080px; padding: 10px 22px; }
html.view-desktop .flash-container { max-width: 1080px; }
html.view-desktop .app-container { max-width: 1080px; padding: 20px 22px; }

html.view-desktop .capture-card textarea { min-height: 60px; font-size: 1.05rem; }
html.view-desktop .capture-tags { flex-wrap: wrap; overflow: visible; }
html.view-desktop .tag-filter { flex-wrap: wrap; overflow: visible; }

html.view-desktop .list-head { display: grid; grid-template-columns: 1fr 300px; column-gap: 14px; }
html.view-desktop .tabs { grid-column: 1; grid-row: 1; align-self: center; overflow: visible; flex-wrap: wrap; }
html.view-desktop .search-row { grid-column: 2; grid-row: 1; }
html.view-desktop .tag-filter { grid-column: 1 / -1; grid-row: 2; }

html.view-desktop .note-list {
    display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px; align-items: start;
}
html.view-desktop .empty-tip { grid-column: 1 / -1; }

html.view-desktop .auth-card { max-width: 420px; margin: 10vh auto 0; }
html.view-desktop .stat-grid { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
html.view-desktop .stat-cell.wide { grid-column: auto; }
html.view-desktop .plans { max-width: 720px; margin-left: auto; margin-right: auto; }
html.view-desktop .vip-status-card { max-width: 720px; margin-left: auto; margin-right: auto; }

/* ---------- 语音输入按钮 ---------- */
.btn-voice {
    flex-shrink: 0; border: 1px solid var(--line); background: #fff;
    color: #8b7d6a; font-size: 1rem; line-height: 1;
    padding: 7px 11px; border-radius: 10px; cursor: pointer;
}
.btn-voice:hover { border-color: #e3d5c0; }
.btn-voice.recording {
    border-color: #fca5a5; background: #fef2f2;
    animation: voice-pulse 1.2s infinite;
}
@keyframes voice-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.35); }
    50% { box-shadow: 0 0 0 7px rgba(239, 68, 68, 0); }
}
