* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: #f5f7fa;
    color: #1e293b;
    line-height: 1.5;
    padding: 20px;
}

.container {
    max-width: 700px;
    margin: 0 auto;
    background: #ffffff;
    border-radius: 20px;
    padding: 28px 24px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.05);
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}
header h1 { font-size: 1.8rem; font-weight: 600; }

/* 通用按钮 */
.btn-primary {
    background: #4f46e5; color: #fff; border: none;
    padding: 10px 20px; border-radius: 10px; font-size: 0.9rem;
    font-weight: 500; cursor: pointer; transition: 0.2s;
}
.btn-primary:hover { background: #4338ca; }

.btn-small {
    background: #f1f5f9; color: #334155; border: 1px solid #e2e8f0;
    padding: 6px 14px; border-radius: 8px; font-size: 0.85rem; cursor: pointer;
}
.btn-small:hover { background: #e2e8f0; }

.btn-full { width: 100%; justify-content: center; margin-top: 12px; }

/* 筛选区 */
.filter-box {
    display: flex; align-items: center; flex-wrap: wrap; gap: 10px;
    margin-bottom: 20px; padding: 12px 14px;
    background: #f8fafc; border-radius: 12px; border: 1px solid #eef2f6;
}
.filter-label { font-size: 0.9rem; font-weight: 500; color: #475569; }
.filter-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.filter-btn {
    background: #fff; border: 1px solid #cbd5e1; color: #475569;
    padding: 5px 12px; border-radius: 20px; font-size: 0.8rem; cursor: pointer;
    transition: 0.2s;
}
.filter-btn.active { background: #4f46e5; color: #fff; border-color: #4f46e5; }
.filter-btn:hover:not(.active) { background: #f1f5f9; }

.archived-toggle { margin-left: auto; font-size: 0.9rem; color: #475569; cursor: pointer; display: flex; align-items: center; gap: 6px; }
.archived-toggle input { accent-color: #4f46e5; }

/* 批量操作栏 */
.batch-bar {
    display: flex; align-items: center; gap: 10px; padding: 10px 14px;
    background: #f8fafc; border-radius: 12px; border: 1px solid #eef2f6;
    margin-bottom: 16px; font-size: 0.9rem; color: #475569;
}
.batch-bar select {
    padding: 5px 10px; border-radius: 8px; border: 1px solid #e2e8f0;
    background: #fff; font-size: 0.85rem; color: #334155; outline: none;
}

/* ========== 记录卡片（左滑核心） ========== */
.records-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.record {
    overflow: hidden;
    border-radius: 14px;
    background: #fff;
    border: 1px solid #eef2f6;
    transition: box-shadow 0.2s;
}
.record:hover { box-shadow: 0 2px 12px rgba(0,0,0,0.04); }

.record-inner {
    display: flex;
    width: 150%;
    transform: translateX(0);
    transition: transform 0.3s ease;
}

.record-main {
    flex: 0 0 66.666%;
    display: flex;
    align-items: flex-start;
    padding: 14px 16px;
    gap: 12px;
    background: #fff;
}

.record-checkbox {
    flex-shrink: 0;
    margin-top: 2px;
    transform: scale(1.1);
    accent-color: #4f46e5;
}

.record-body { flex: 1; min-width: 0; }

.content {
    font-size: 0.9rem;
    line-height: 1.5;
    word-break: break-word;
    white-space: pre-wrap;
    margin-bottom: 8px;
    color: #1e293b;
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    font-size: 0.78rem;
    color: #94a3b8;
}

.tag-badge {
    background: #eef2ff;
    color: #4f46e5;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
}

.time-text { white-space: nowrap; }

.top-indicator {
    background: #fef3c7;
    color: #92400e;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
}

.record-actions {
    flex: 0 0 33.333%;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
    padding: 10px 8px;
    background: #f8fafc;
    border-left: 1px solid #f1f5f9;
    align-content: center;
}

.record-actions .btn-icon {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 10px 6px;
    font-size: 0.72rem;
    color: #334155;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    cursor: pointer;
    transition: 0.2s;
    white-space: nowrap;
    font-weight: 500;
}
.record-actions .btn-icon:hover {
    background: #f1f5f9;
    color: #0f172a;
}

.record.show-actions .record-inner {
    transform: translateX(-33.333%);
}

.empty {
    text-align: center; padding: 40px 20px;
    color: #94a3b8; font-size: 1rem;
}

/* ===== 模态框（新增/编辑） ===== */
.modal {
    display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(15,23,42,0.4); backdrop-filter: blur(4px);
    align-items: center; justify-content: center; z-index: 1000;
}
.modal-content {
    background: #fff; padding: 28px 30px; border-radius: 18px;
    width: 90%; max-width: 500px; box-shadow: 0 20px 40px rgba(0,0,0,0.1);
    position: relative; animation: modalIn 0.25s ease;
}
@keyframes modalIn {
    from { opacity: 0; transform: translateY(12px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}
.close {
    position: absolute; top: 14px; right: 18px; font-size: 1.4rem;
    color: #94a3b8; cursor: pointer;
}
.close:hover { color: #334155; }
.modal h2 { margin-bottom: 18px; font-size: 1.4rem; font-weight: 600; }

textarea {
    width: 100%; padding: 12px; border: 1px solid #e2e8f0; border-radius: 10px;
    font-size: 0.9rem; resize: vertical; font-family: inherit;
    background: #fafbfc;
}
textarea:focus { outline: none; border-color: #4f46e5; background: #fff; }

.tag-select { margin: 14px 0; }
.tag-select label { display: block; font-size: 0.9rem; color: #475569; margin-bottom: 8px; }
.checkbox-group { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.checkbox-item {
    display: flex; align-items: center; gap: 6px; background: #f8fafc;
    border: 1px solid #e2e8f0; padding: 5px 12px; border-radius: 20px;
    font-size: 0.85rem; color: #475569; cursor: pointer;
}
.checkbox-item:hover { border-color: #cbd5e1; }
.checkbox-item input { accent-color: #4f46e5; margin: 0; }

#newTag {
    width: 100%; padding: 10px 12px; border: 1px solid #e2e8f0; border-radius: 10px;
    font-size: 0.85rem; background: #fafbfc;
}
#newTag:focus { outline: none; border-color: #4f46e5; background: #fff; }

/* ===== 二次确认弹窗 ===== */
.confirm-modal {
    display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(15,23,42,0.4); backdrop-filter: blur(4px);
    align-items: center; justify-content: center; z-index: 1100;  /* 比普通模态框高 */
}
.confirm-dialog {
    background: #fff; padding: 28px 30px; border-radius: 18px;
    width: 90%; max-width: 380px; text-align: center;
    box-shadow: 0 20px 40px rgba(0,0,0,0.1);
    animation: modalIn 0.25s ease;
}
.confirm-dialog p {
    font-size: 1rem; color: #334155; margin-bottom: 20px;
}
.confirm-actions {
    display: flex; gap: 12px; justify-content: center;
}
.confirm-actions button {
    padding: 10px 20px; border-radius: 10px; font-size: 0.9rem;
    font-weight: 500; cursor: pointer; border: none; transition: 0.2s;
}
.btn-cancel {
    background: #f1f5f9; color: #334155; border: 1px solid #e2e8f0 !important;
}
.btn-cancel:hover { background: #e2e8f0; }
.btn-danger {
    background: #ef4444; color: #fff;
}
.btn-danger:hover { background: #dc2626; }

/* Toast */
.toast {
    position: fixed; top: 24px; left: 50%; transform: translateX(-50%);
    padding: 12px 28px; border-radius: 30px; font-size: 0.9rem; font-weight: 500;
    z-index: 9999; opacity: 0; transition: opacity 0.3s; pointer-events: none;
    color: #fff; box-shadow: 0 8px 20px rgba(0,0,0,0.1);
}
.toast-visible { opacity: 1; }
.toast-success { background: #10b981; }
.toast-error   { background: #ef4444; }
.toast-warning { background: #f59e0b; color: #1e293b; }
.toast-info    { background: #3b82f6; }

.btn-primary:disabled, .btn-small:disabled, .filter-btn:disabled {
    opacity: 0.6; cursor: not-allowed;
}

/* 移动端适配 */
@media (max-width: 600px) {
    body { padding: 10px; }
    .container { padding: 20px 16px; border-radius: 14px; }
    .filter-box { flex-direction: column; align-items: flex-start; }
    .archived-toggle { margin-left: 0; margin-top: 4px; }
    .confirm-dialog { padding: 24px 20px; }
}