:root {
    --bg: #f2f2f7;
    --card: #ffffff;
    --card-2: #f9f9fb;
    --text: #000000;
    --text-sub: #8e8e93;
    --separator: rgba(60,60,67,0.18);
    --accent: #007aff;
    --danger: #ff3b30;
    --success: #34c759;
    --warning: #ff9500;
    --purple: #af52de;
    --radius: 12px;
    --radius-lg: 16px;
    --shadow: 0 1px 3px rgba(0,0,0,0.06);
}
@media (prefers-color-scheme: dark) {
    :root {
        --bg: #000000;
        --card: #1c1c1e;
        --card-2: #2c2c2e;
        --text: #ffffff;
        --text-sub: #8e8e93;
        --separator: rgba(84,84,88,0.65);
        --accent: #0a84ff;
        --danger: #ff453a;
        --success: #30d158;
        --warning: #ff9f0a;
        --purple: #bf5af2;
        --shadow: none;
    }
}
* { margin:0; padding:0; box-sizing:border-box; -webkit-tap-highlight-color: transparent; }
html, body {
    min-height: 100vh;
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC",
                 "Helvetica Neue", "Segoe UI", Roboto, sans-serif;
    font-size: 17px;
    line-height: 1.4;
    -webkit-font-smoothing: antialiased;
    overscroll-behavior-y: none;
    background: var(--bg);
    overflow-x: hidden;
}
body::before, body::after, .bg-orb { display: none; }
.container {
    position: relative;
    z-index: 2;
    max-width: 640px;
    margin: 0 auto;
    padding: 0 16px calc(110px + env(safe-area-inset-bottom));
}
.page-head { padding-top: 20px; }
.large-title {
    font-size: 34px;
    font-weight: 700;
    letter-spacing: -0.4px;
    padding: 6px 4px 4px;
    color: var(--text);
    background: none;
    -webkit-text-fill-color: currentColor;
}
.page-sub {
    color: var(--text-sub);
    font-size: 13px;
    padding: 0 6px 6px;
}
.glass {
    background: var(--card);
    border: none;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden;
}
.glass::before { display: none; }
.section { margin-top: 22px; }
.section-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-sub);
    letter-spacing: 0.4px;
    padding: 6px 6px 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    text-transform: uppercase;
}
.section-title .count {
    font-weight: 500;
    opacity: 0.85;
    text-transform: none;
}
.filter-row {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding: 4px 0 8px;
}
.filter-row::-webkit-scrollbar { display: none; }
.chip {
    flex-shrink: 0;
    padding: 8px 14px;
    border-radius: 100px;
    background: var(--card);
    color: var(--text-sub);
    font-size: 14px;
    text-decoration: none;
    white-space: nowrap;
    font-weight: 500;
    border: 1px solid var(--separator);
    transition: all .2s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 36px;
    box-shadow: var(--shadow);
}
.chip .cnt { font-size: 11px; opacity: 0.7; }
.chip.active {
    background: var(--accent);
    color: #fff;
    box-shadow: none;
    border-color: var(--accent);
}

/* ==================== 统计卡 ==================== */
.stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-top: 8px;
}
.stat {
    background: var(--card);
    border: none;
    border-radius: var(--radius);
    padding: 16px 8px;
    text-align: center;
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden;
}
.stat::before { display: none; }
.stat .num {
    font-size: 26px;
    font-weight: 700;
    letter-spacing: -0.5px;
    color: var(--accent);
    background: none;
    -webkit-text-fill-color: currentColor;
    position: relative;
}
.stat .label {
    font-size: 12px;
    color: var(--text-sub);
    margin-top: 4px;
    position: relative;
}

/* ==================== 快捷入口 ==================== */
.quick-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--separator);
    text-decoration: none;
    color: var(--text);
    transition: background .15s;
    -webkit-tap-highlight-color: transparent;
    position: relative;
    z-index: 1;
}
.quick-row:last-child { border-bottom: none; }
.quick-row:active { background: var(--card-2); }
.quick-row:hover  { background: var(--card-2); }
.quick-icon {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    line-height: 1;
    background: var(--card-2);
    border-radius: 10px;
    border: none;
}
.quick-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.quick-title {
    font-size: 16px;
    font-weight: 500;
    color: var(--text);
    line-height: 1.3;
}
.quick-sub {
    font-size: 12px;
    color: var(--text-sub);
    line-height: 1.35;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.quick-arrow {
    flex-shrink: 0;
    font-size: 20px;
    color: var(--text-sub);
    opacity: 0.5;
    line-height: 1;
}

/* ==================== 行列表 ==================== */
.row-item {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid var(--separator);
    gap: 10px;
    position: relative;
    z-index: 1;
}
.row-item:last-child { border-bottom: none; }
.row-item.row-flat { padding: 12px 16px; }
.row-main { flex: 1; min-width: 0; }
.row-name {
    font-size: 15px;
    font-weight: 400;
    color: var(--text);
    line-height: 1.35;
    word-break: break-all;
}
.row-meta {
    font-size: 12px;
    color: var(--text-sub);
    margin-top: 3px;
    line-height: 1.4;
}
.row-value {
    font-size: 14px;
    color: var(--text-sub);
    text-align: right;
    flex-shrink: 0;
    max-width: 55%;
    word-break: break-all;
}
.row-value .ok { color: var(--success); font-weight: 600; }
.row-value .bad { color: var(--danger); font-weight: 600; }
.row-ops {
    display: flex;
    gap: 4px;
    align-items: center;
    flex-shrink: 0;
}
.row-ops form { margin: 0; }

/* 复选框（文件列表 & 卡密列表共用） */
.row-item input[type="checkbox"],
.row-item .checkbox,
.row-item .file-check {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    accent-color: var(--accent);
    margin: 0;
    cursor: pointer;
    vertical-align: middle;
}

/* ==================== 表单 ==================== */
.form-row {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid var(--separator);
    gap: 10px;
    position: relative;
    z-index: 1;
}
.form-row:last-child { border-bottom: none; }
.form-row label {
    flex-shrink: 0;
    color: var(--text);
    font-size: 16px;
    min-width: 56px;
    font-weight: 400;
}
select, input[type="file"], input[type="password"], input[type="number"],
input[type="text"], input[type="search"], input[type="url"],
input[type="datetime-local"], textarea {
    flex: 1;
    width: 100%;
    padding: 11px 14px;
    background: var(--card-2);
    border: 1px solid var(--separator);
    border-radius: 10px;
    color: var(--text);
    font-size: 16px;
    outline: none;
    font-family: inherit;
    appearance: none;
    -webkit-appearance: none;
    transition: border-color .2s, box-shadow .2s;
    min-height: 44px;
}
input:focus, select:focus, textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(0,122,255,0.15);
}
textarea {
    resize: vertical;
    min-height: 130px;
    font-family: ui-monospace, "SF Mono", Menlo, monospace;
    font-size: 14px;
    line-height: 1.6;
}
select {
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238e8e93' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 34px;
}
input[type="file"]::file-selector-button,
input[type="file"]::-webkit-file-upload-button {
    background: var(--accent);
    color: #fff;
    border: none;
    padding: 8px 14px;
    border-radius: 8px;
    cursor: pointer;
    margin-right: 12px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
}

/* ==================== 按钮 ==================== */
.btn {
    display: block;
    width: 100%;
    padding: 15px;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 12px;
    font-size: 17px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    letter-spacing: 0.2px;
    box-shadow: none;
    transition: opacity .15s, transform .12s;
    position: relative;
    overflow: hidden;
    min-height: 50px;
}
.btn::before { display: none; }
.btn:active {
    transform: scale(0.98);
    opacity: 0.85;
}
.btn:disabled {
    opacity: .4;
    cursor: not-allowed;
    transform: none;
}
.btn-sm {
    width: auto;
    padding: 9px 16px;
    font-size: 14px;
    border-radius: 10px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    min-height: 40px;
    border: none;
    cursor: pointer;
    font-family: inherit;
    color: #fff;
    text-decoration: none;
}
.btn-ghost {
    background: var(--card-2);
    color: var(--accent);
    box-shadow: none;
    border: 1px solid var(--separator);
}
.btn-danger {
    background: var(--danger);
    box-shadow: none;
}
.btn-success {
    background: var(--success);
    box-shadow: none;
}
.btn-warning {
    background: var(--warning);
    box-shadow: none;
    color: #fff;
}
.mini-btn {
    border: 1px solid var(--separator);
    font-size: 12px;
    padding: 7px 11px;
    border-radius: 8px;
    cursor: pointer;
    font-family: inherit;
    white-space: nowrap;
    font-weight: 600;
    transition: transform .12s;
    min-height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: var(--text);
    background: var(--card-2);
}
.mini-btn:active { transform: scale(0.96); }
.mini-btn.free { background: rgba(52,199,89,0.15); color: var(--success); border-color: transparent; }
.mini-btn.vip { background: rgba(255,149,0,0.15); color: var(--warning); border-color: transparent; }
.mini-btn.danger { background: rgba(255,59,48,0.15); color: var(--danger); border-color: transparent; }
.mini-btn.accent { background: rgba(0,122,255,0.15); color: var(--accent); border-color: transparent; }
.mini-btn.warn { background: rgba(255,149,0,0.15); color: var(--warning); border-color: transparent; }

/* ==================== 标签 ==================== */
.tag {
    display: inline-block;
    font-size: 10px;
    padding: 2px 8px;
    border-radius: 100px;
    margin-left: 4px;
    margin-right: 2px;
    font-weight: 600;
    vertical-align: middle;
    border: none;
    line-height: 1.5;
}
.tag:first-child { margin-left: 0; }
.tag-free { background: rgba(52,199,89,0.15); color: var(--success); }
.tag-vip { background: rgba(255,149,0,0.15); color: var(--warning); }
.tag-desc { background: rgba(0,122,255,0.15); color: var(--accent); }
.tag-link { background: rgba(175,82,222,0.15); color: var(--purple); }

/* ==================== 空状态 ==================== */
.empty {
    text-align: center;
    padding: 36px 20px;
    color: var(--text-sub);
    font-size: 14px;
}
.empty a { color: var(--accent); text-decoration: none; font-weight: 600; }

/* ==================== 消息 ==================== */
.msg {
    padding: 14px 18px;
    border-radius: 12px;
    margin-top: 16px;
    font-size: 14px;
    text-align: center;
    font-weight: 500;
    border: none;
    box-shadow: none;
    animation: msgIn .3s cubic-bezier(0.4, 0, 0.2, 1);
}
@keyframes msgIn {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}
.msg.success { background: rgba(52,199,89,0.15); color: var(--success); }
.msg.error { background: rgba(255,59,48,0.15); color: var(--danger); }

/* ==================== 上传进度 ==================== */
.upload-progress {
    display: none;
    margin-top: 12px;
    padding: 14px 16px;
    background: var(--card);
    border: 1px solid var(--separator);
    border-radius: 12px;
    box-shadow: none;
}
.upload-progress.open { display: block; }
.upload-progress .label {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    color: var(--text-sub);
    margin-bottom: 10px;
    font-weight: 500;
}
.upload-progress .bar {
    height: 6px;
    background: var(--separator);
    border-radius: 100px;
    overflow: hidden;
    position: relative;
}
.upload-progress .bar > i {
    display: block;
    height: 100%;
    width: 0%;
    background: var(--accent);
    border-radius: 100px;
    transition: width .25s;
    box-shadow: none;
}
.upload-progress .status {
    margin-top: 10px;
    font-size: 12px;
    color: var(--text-sub);
    word-break: break-word;
}

/* ==================== 登录页 ==================== */
.login-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    position: relative;
    z-index: 2;
}
.login-card {
    width: 100%;
    max-width: 380px;
    background: var(--card);
    border: none;
    border-radius: 20px;
    padding: 40px 28px 28px;
    text-align: center;
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden;
}
.login-card::before { display: none; }
.login-icon {
    font-size: 52px;
    margin-bottom: 14px;
    display: inline-block;
    filter: none;
    position: relative;
}
.login-title {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 28px;
    position: relative;
    letter-spacing: -0.3px;
}
.login-card input { margin-bottom: 14px; position: relative; }
.login-error {
    color: var(--danger);
    font-size: 14px;
    margin-bottom: 12px;
    position: relative;
}

/* ==================== 批量操作条 ==================== */
.batch-wrap { position: relative; }
.batch-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: var(--card);
    border-top: 1px solid var(--separator);
    position: sticky;
    bottom: 0;
    z-index: 5;
    flex-wrap: wrap;
}
.batch-bar .batch-info {
    font-size: 12px;
    color: var(--text-sub);
    margin-right: auto;
    font-weight: 500;
}
.batch-bar .batch-info b {
    color: var(--accent);
    font-size: 14px;
    margin: 0 2px;
}

/* ==================== 弹窗 ==================== */
.modal-mask {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    z-index: 200;
    opacity: 0;
    transition: opacity .25s;
}
.modal-mask.open { display: flex; opacity: 1; }
.modal {
    width: 100%;
    max-width: 400px;
    background: var(--card);
    border: none;
    border-radius: 16px;
    padding: 22px;
    max-height: 80vh;
    overflow: auto;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    animation: modalIn .3s cubic-bezier(0.4, 0, 0.2, 1);
}
@keyframes modalIn {
    from { opacity: 0; transform: scale(0.96) translateY(10px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}
.modal h3 { font-size: 18px; font-weight: 700; margin-bottom: 16px; }
.modal .modal-sub { color: var(--text-sub); font-size: 12px; margin-bottom: 12px; }
.modal .modal-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-sub);
    margin: 10px 0 6px;
}
.modal .actions { display: flex; gap: 10px; margin-top: 18px; }
.modal .actions .btn-sm {
    flex: 1;
    padding: 12px;
    text-align: center;
    font-size: 15px;
}
.modal .form-row { padding: 10px 0; border: none; }
.modal .form-row label { min-width: 64px; font-size: 14px; }
.modal .form-row input { padding: 10px 12px; font-size: 14px; }

/* ==================== 提示 Toast ==================== */
.copy-toast {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    background: rgba(0,0,0,0.8);
    color: #fff;
    padding: 12px 22px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    z-index: 9999;
    pointer-events: none;
    opacity: 0;
    transition: opacity .2s, transform .2s;
}
.copy-toast.show {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

/* ==================== 底部导航 ==================== */
.bottom-nav-wrap {
    position: fixed;
    left: 0;
    right: 0;
    bottom: calc(12px + env(safe-area-inset-bottom));
    display: flex;
    justify-content: center;
    z-index: 100;
    pointer-events: none;
    padding: 0 16px;
}
.bottom-nav {
    pointer-events: auto;
    display: flex;
    gap: 4px;
    padding: 6px;
    background: var(--card);
    border: 1px solid var(--separator);
    border-radius: 100px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    max-width: 560px;
    width: 100%;
    position: relative;
    overflow: hidden;
}
.bottom-nav::before { display: none; }
.bottom-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: var(--text-sub);
    font-size: 10px;
    padding: 9px 4px;
    gap: 2px;
    cursor: pointer;
    border-radius: 100px;
    transition: all .3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    z-index: 1;
    min-height: 54px;
    min-width: 0;
}
.bottom-nav-item.active {
    background: var(--accent);
    color: #fff;
    box-shadow: none;
}
.bottom-nav-item .icon {
    font-size: 20px;
    line-height: 1;
    transition: transform .3s;
}
.bottom-nav-item.active .icon { transform: scale(1.1); }
.bottom-nav-item .label {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

/* ==================== 卡密行 ==================== */
.kami-list {
    max-height: 62vh;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
}
.kami-row {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid var(--separator);
    font-size: 12px;
    gap: 10px;
    transition: background .15s;
}
.kami-row:hover { background: var(--card-2); }
.kami-row:last-child { border-bottom: none; }
.kami-row .checkbox {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    accent-color: var(--accent);
}
.kami-row .body { flex: 1; min-width: 0; }
.kami-row .code {
    font-family: ui-monospace, "SF Mono", Menlo, monospace;
    font-size: 13px;
    color: var(--text);
    word-break: break-all;
    font-weight: 600;
    cursor: pointer;
    transition: color .15s;
    letter-spacing: 0.2px;
}
.kami-row .code.copied { color: var(--success); }
.kami-row .meta {
    color: var(--text-sub);
    font-size: 11px;
    margin-top: 4px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}
.kami-row .meta .dot {
    display: inline-block;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    margin-right: 4px;
    vertical-align: middle;
    box-shadow: none;
}
.dot.on { background: var(--success); color: var(--success); }
.dot.off { background: var(--text-sub); color: var(--text-sub); }
.dot.danger { background: var(--danger); color: var(--danger); }
.kami-row .ops { display: flex; gap: 4px; flex-shrink: 0; }
.kami-row .ops button {
    border: 1px solid var(--separator);
    background: var(--card-2);
    color: var(--text);
    font-size: 11px;
    padding: 6px 10px;
    border-radius: 8px;
    cursor: pointer;
    font-family: inherit;
    font-weight: 600;
    transition: transform .12s;
    min-height: 30px;
}
.kami-row .ops button:active { transform: scale(0.94); }
.kami-row .ops button.danger { color: var(--danger); }
.kami-row .ops button.reset { color: var(--warning); }
.kami-row .ops button.toggle { color: var(--accent); }
.kami-empty {
    padding: 28px;
    color: var(--text-sub);
    font-size: 13px;
    text-align: center;
}
.kami-search-row {
    padding: 10px 16px;
    border-bottom: 1px solid var(--separator);
}

/* ==================== 提示块 ==================== */
.hint-box {
    padding: 14px 18px 18px;
    color: var(--text-sub);
    font-size: 12px;
    line-height: 1.6;
}
.hint-box code {
    background: var(--card-2);
    padding: 1px 6px;
    border-radius: 6px;
    font-family: ui-monospace, "SF Mono", Menlo, monospace;
    font-size: 12px;
}
.note-list { display: flex; flex-direction: column; gap: 14px; }
.note-item {
    font-size: 13px;
    color: var(--text-sub);
    line-height: 1.6;
}
.note-item b {
    display: block;
    color: var(--text);
    font-size: 14px;
    margin-bottom: 3px;
    font-weight: 600;
}
.note-item code {
    background: var(--card-2);
    padding: 1px 6px;
    border-radius: 6px;
    font-family: ui-monospace, "SF Mono", Menlo, monospace;
    font-size: 12px;
    color: var(--text);
}

/* ==================== 滚动条 ==================== */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
    background: rgba(120,120,128,0.3);
    border-radius: 100px;
}

@media (prefers-reduced-motion: reduce) {
    .bottom-nav-item, .btn, .mini-btn { transition: none; }
}