/* === Reset & Base === */
* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; background: #f8fafc; color: #1e293b; }

/* === Layout === */
.container { max-width: 720px; margin: 0 auto; padding: 24px 16px; }
.container.wide { max-width: 780px; }

/* === Navigation === */
.nav { display: flex; align-items: center; gap: 12px; padding: 10px 16px; background: #fff; border-bottom: 1px solid #e2e8f0; position: sticky; top: 0; z-index: 50; }
.nav-right { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.nav-home { font-size: 18px; text-decoration: none; color: #64748b; padding: 4px 8px; border: 1px solid #e2e8f0; border-radius: 8px; }
.nav-icon { font-size: 20px; }
.nav-datepicker { padding: 6px 12px; border: 1px solid #e2e8f0; border-radius: 8px; font-size: 14px; color: #1e293b; background: #fff; cursor: pointer; width: 140px; }

/* === Header === */
.header { text-align: center; padding: 32px 0 24px; }
.header h1 { font-size: 28px; color: #0f172a; margin-bottom: 8px; }
.header .date { font-size: 15px; color: #64748b; }

/* === Stats === */
.stats { display: flex; justify-content: center; gap: 24px; margin: 20px 0 8px; }
.stat { text-align: center; padding: 12px 20px; background: #fff; border-radius: 12px; border: 1px solid #e2e8f0; min-width: 80px; }
.stat .num { font-size: 24px; font-weight: 700; }
.stat .label { font-size: 12px; color: #94a3b8; margin-top: 2px; }

/* === Cards === */
.card { border: 1px solid #e2e8f0; border-radius: 12px; padding: 20px; margin: 12px 0; background: #fff; transition: box-shadow 0.2s; }
.card:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.1); }
.card-title { font-size: 18px; font-weight: 600; color: #0f172a; margin-bottom: 8px; }
.card-meta { font-size: 13px; color: #94a3b8; margin-bottom: 10px; }
.card-tags { display: flex; gap: 6px; flex-wrap: wrap; }

/* === Footer === */
.footer { text-align: center; padding: 32px 0; color: #94a3b8; font-size: 13px; }

/* === Empty State === */
.empty { text-align: center; padding: 60px 20px; color: #94a3b8; }
.empty-icon { font-size: 48px; margin-bottom: 12px; }

/* === Toggle (view switch, language switch) === */
.toggle { display: inline-flex; border: 1px solid #e2e8f0; border-radius: 8px; overflow: hidden; font-size: 13px; }
.toggle-btn { padding: 5px 12px; cursor: pointer; background: #fff; border: none; color: #64748b; transition: all 0.2s; }
.toggle-btn.active { background: #1e293b; color: #fff; }
.toggle-btn:hover:not(.active) { background: #f1f5f9; }

/* === Filter Bar === */
.filter-bar { display: flex; justify-content: center; gap: 8px; margin: 16px 0; flex-wrap: wrap; }
.filter-btn { padding: 5px 14px; border-radius: 16px; border: 1px solid #e2e8f0; background: #fff; cursor: pointer; font-size: 13px; transition: all 0.2s; }
.filter-btn:hover, .filter-btn.active { background: #1e293b; color: #fff; border-color: #1e293b; }
.filter-btn .filter-count { font-size: 11px; color: #94a3b8; margin-left: 4px; }
.filter-btn.active .filter-count { color: #cbd5e1; }

/* === Tags === */
.tag { font-size: 12px; background: #f1f5f9; color: #475569; padding: 2px 10px; border-radius: 12px; }
.tag-editable { display: inline-block; cursor: pointer; border: 1px solid #e2e8f0; transition: all 0.2s; margin-right: 6px; }
.tag-editable:hover { border-color: #3b82f6; color: #3b82f6; }
.tag-editable.unset { color: #cbd5e1; border-style: dashed; }

/* === Buttons === */
.btn-ghost { background: none; border: 1px solid #d1d5db; border-radius: 8px; padding: 4px 10px; cursor: pointer; font-size: 13px; color: #94a3b8; transition: all 0.2s; }
.btn-ghost:hover { border-color: #3b82f6; color: #3b82f6; }
.btn-danger:hover { border-color: #ef4444; color: #ef4444; }
.btn-back { padding: 6px 14px; font-size: 14px; color: #64748b; }
.btn-action { background: none; border: 1px solid #d1d5db; border-radius: 8px; padding: 4px 8px; cursor: pointer; font-size: 16px; }

/* === Group Headers === */
.group-header { font-size: 18px; font-weight: 600; color: #0f172a; margin: 28px 0 12px; padding-bottom: 8px; border-bottom: 2px solid #e2e8f0; }
.group-header:first-child { margin-top: 8px; }
.group-header .group-count { font-size: 14px; color: #94a3b8; font-weight: 400; margin-left: 8px; }

/* === Markdown Content (shared by search summary & blog) === */
.md-content { font-size: 15px; line-height: 1.8; color: #334155; }
.md-content h1 { font-size: 26px; font-weight: 700; margin: 28px 0 16px; color: #0f172a; border-bottom: 2px solid #e2e8f0; padding-bottom: 8px; }
.md-content h2 { font-size: 20px; font-weight: 600; margin: 16px 0 8px; color: #0f172a; }
.md-content h3 { font-size: 16px; font-weight: 600; margin: 14px 0 6px; color: #1e293b; }
.md-content p { margin: 6px 0; }
.md-content ul, .md-content ol { margin: 6px 0 6px 20px; }
.md-content li { margin: 2px 0; }
.md-content code { background: #f1f5f9; padding: 1px 5px; border-radius: 4px; font-size: 13px; font-family: "SF Mono", Menlo, monospace; }
.md-content pre { background: #1e293b; color: #e2e8f0; padding: 14px; border-radius: 8px; overflow-x: auto; margin: 8px 0; }
.md-content pre code { background: none; padding: 0; color: inherit; font-size: 13px; }
.md-content blockquote { border-left: 3px solid #3b82f6; padding: 8px 16px; margin: 12px 0; background: #f8fafc; color: #64748b; }
.md-content table { border-collapse: collapse; width: 100%; margin: 8px 0; }
.md-content th, .md-content td { border: 1px solid #e2e8f0; padding: 6px 10px; text-align: left; font-size: 13px; }
.md-content th { background: #f8fafc; font-weight: 600; }
.md-content hr { border: none; border-top: 1px solid #e2e8f0; margin: 16px 0; }
.md-content a { color: #1d4ed8; text-decoration: none; border-bottom: 1px dashed #93c5fd; }
.md-content a:hover { border-bottom-style: solid; }
.md-content strong { color: #0f172a; }
.md-content details { margin: 8px 0; border: 1px solid #e2e8f0; border-radius: 8px; padding: 0; }
.md-content details summary { cursor: pointer; padding: 10px 14px; font-weight: 600; font-size: 14px; color: #1d4ed8; background: #f8fafc; border-radius: 8px; user-select: none; }
.md-content details summary:hover { background: #f1f5f9; }
.md-content details[open] summary { border-radius: 8px 8px 0 0; border-bottom: 1px solid #e2e8f0; }
.md-content details > :not(summary) { padding: 0 14px; }

/* === Sources (search) === */
.sources { border-top: 1px solid #f1f5f9; padding-top: 12px; }
.sources h4 { font-size: 13px; color: #94a3b8; margin-bottom: 8px; }
.source { margin-bottom: 10px; }
.source a { font-size: 14px; color: #1d4ed8; text-decoration: none; border-bottom: 1px dashed #93c5fd; }
.source a:hover { border-bottom-style: solid; }
.source .snippet { font-size: 13px; color: #64748b; margin-top: 2px; line-height: 1.5; }

/* === Modal === */
.modal-overlay { display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.3); z-index: 100; align-items: center; justify-content: center; }
.modal-overlay.show { display: flex; }
.modal { background: #fff; border-radius: 12px; padding: 24px; width: 360px; max-width: 90vw; box-shadow: 0 20px 60px rgba(0,0,0,0.15); }
.modal h3 { font-size: 16px; margin-bottom: 16px; color: #0f172a; }
.modal input { width: 100%; padding: 10px 14px; border: 1px solid #e2e8f0; border-radius: 8px; font-size: 14px; outline: none; margin-bottom: 12px; }
.modal input:focus { border-color: #3b82f6; }
.modal .chip-list { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.modal .chip { padding: 4px 12px; border-radius: 12px; background: #f1f5f9; color: #475569; cursor: pointer; font-size: 13px; border: 1px solid #e2e8f0; }
.modal .chip:hover { background: #1e293b; color: #fff; border-color: #1e293b; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; }
.modal-actions button { padding: 8px 16px; border-radius: 8px; border: 1px solid #e2e8f0; cursor: pointer; font-size: 14px; }
.modal-actions .btn-primary { background: #1e293b; color: #fff; border-color: #1e293b; }
