@font-face {
  font-family: 'Pretendard';
  src: url('/vendor/fonts/PretendardVariable.woff2') format('woff2-variations');
  font-weight: 45 920;
  font-display: swap;
}

:root {
  --bg: #f6f5f0;
  --surface: #ffffff;
  --surface-2: #f0efe8;
  --text: #22302a;
  --muted: #66736b;
  --border: #e1dfd6;
  --primary: #3f7d4e;
  --primary-strong: #2f6440;
  --primary-soft: #e3efe4;
  --on-primary: #ffffff;
  --warn-bg: #fff4dd;
  --warn-text: #7a5300;
  --error-bg: #fde8e6;
  --error-text: #9b2c22;
  --info-bg: #e8f1f8;
  --info-text: #234b6b;
  --danger: #b4392d;
  --shadow: 0 1px 2px rgba(30, 40, 30, .06), 0 2px 8px rgba(30, 40, 30, .05);
  --radius: 14px;
  --font: 'Pretendard', 'Apple SD Gothic Neo', 'Malgun Gothic', 'Noto Sans KR', system-ui, sans-serif;
  --fs: 16px;
  --nav-h: 68px;
  color-scheme: light;
}
:root[data-font="large"] { --fs: 18px; }
:root[data-font="xlarge"] { --fs: 20px; }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #151918; --surface: #1d2321; --surface-2: #242b29; --text: #e4ebe6; --muted: #9aa8a0; --border: #2f3835;
    --primary: #7cbf8b; --primary-strong: #96d1a3; --primary-soft: #23382a; --on-primary: #0f1a13;
    --warn-bg: #3a2f14; --warn-text: #f3d48c; --error-bg: #3d1f1c; --error-text: #f2aaa1; --info-bg: #1c2c39; --info-text: #a9cbe6;
    --danger: #ef8a7e; --shadow: 0 1px 2px rgba(0,0,0,.3); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #151918; --surface: #1d2321; --surface-2: #242b29; --text: #e4ebe6; --muted: #9aa8a0; --border: #2f3835;
  --primary: #7cbf8b; --primary-strong: #96d1a3; --primary-soft: #23382a; --on-primary: #0f1a13;
  --warn-bg: #3a2f14; --warn-text: #f3d48c; --error-bg: #3d1f1c; --error-text: #f2aaa1; --info-bg: #1c2c39; --info-text: #a9cbe6;
  --danger: #ef8a7e; --shadow: 0 1px 2px rgba(0,0,0,.3); color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { font-size: var(--fs); -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text); font-family: var(--font); line-height: 1.6;
  word-break: keep-all; overflow-wrap: anywhere; -webkit-tap-highlight-color: transparent;
}
h1, h2, h3, h4 { line-height: 1.35; margin: 0 0 .4em; }
h1 { font-size: 1.4rem; } h2 { font-size: 1.15rem; } h3 { font-size: 1.05rem; } h4 { font-size: 1rem; }
a { color: var(--primary-strong); }
img { max-width: 100%; }
code, kbd { font-family: ui-monospace, Consolas, monospace; font-size: .88em; background: var(--surface-2); padding: .1em .35em; border-radius: 5px; }
kbd { border: 1px solid var(--border); }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--primary) 60%, transparent); outline-offset: 2px; }
.sr-only { position: absolute !important; width: 1px !important; height: 1px !important; min-height: 0 !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0 0 0 0) !important; white-space: nowrap !important; border: 0 !important; }
.skip-link { position: absolute; left: -999px; top: 8px; z-index: 100; background: var(--surface); padding: 8px 12px; border-radius: 8px; }
.skip-link:focus { left: 8px; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.center { text-align: center; justify-content: center; }
.grow { flex: 1; min-width: 0; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
.row { display: flex; gap: 8px; align-items: center; margin: 8px 0; }
.row.wrap, .wrap { flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.danger-text { color: var(--danger); }
.boot { display: grid; place-items: center; min-height: 100vh; color: var(--muted); }

/* ───── 버튼 ───── */
.btn { position: relative;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 0 16px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text); border-radius: 12px;
  font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; white-space: nowrap; transition: background .15s, border-color .15s;
}
.btn:hover:not(:disabled) { border-color: var(--primary); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--primary); color: var(--on-primary); border-color: var(--primary); }
.btn.primary:hover:not(:disabled) { background: var(--primary-strong); }
.btn.danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--primary-strong); }
.btn.ghost:hover:not(:disabled) { background: var(--primary-soft); }
.btn.ghost.danger { color: var(--danger); background: transparent; }
.btn.small { min-height: 36px; padding: 0 12px; font-size: .9rem; }
.btn.tiny { min-height: 32px; padding: 0 10px; font-size: .82rem; border-radius: 9px; }
.btn.active { background: var(--primary-soft); border-color: var(--primary); }
.btn.block { width: 100%; }
.icon-btn {
  display: inline-grid; place-items: center; width: 44px; height: 44px; border: 0; border-radius: 12px;
  background: transparent; color: var(--text); cursor: pointer; font: inherit; font-size: 1.1rem;
}
.icon-btn:hover:not(:disabled) { background: var(--surface-2); }
.icon-btn:disabled { opacity: .35; }
.icon-btn.small { width: 34px; height: 34px; }
.icon-btn.danger { color: var(--danger); }
.link-btn { background: none; border: 0; color: var(--primary-strong); cursor: pointer; font: inherit; padding: 4px; text-decoration: underline; }
.icon { flex-shrink: 0; }

/* ───── 입력 ───── */
input, select, textarea { font: inherit; color: var(--text); }
input:not([type=checkbox]):not([type=radio]):not([type=color]), select, textarea {
  width: 100%; min-height: 44px; padding: 8px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface);
}
input[type=color] { width: 56px; height: 44px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); padding: 4px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 25%, transparent); }
.field { display: flex; flex-direction: column; gap: 4px; margin: 10px 0; }
.field > span { font-size: .88rem; color: var(--muted); font-weight: 600; }
.field.inline { margin: 4px 0; }
.field.inline input, .field.inline select { min-width: 9rem; }
.field-row { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.check { display: inline-flex; gap: 8px; align-items: center; min-height: 44px; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--primary); }

/* ───── 칩·태그 ───── */
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0; }
.chips.small-gap { gap: 4px; margin-top: 8px; }
.chip {
  --chip: var(--primary);
  display: inline-flex; align-items: center; gap: 5px; min-height: 36px; padding: 0 12px; border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--chip) 35%, var(--border)); background: var(--surface); color: var(--text);
  font: inherit; font-size: .9rem; cursor: pointer; white-space: nowrap;
}
span.chip { cursor: default; }
.chip.small { min-height: 28px; padding: 0 9px; font-size: .8rem; }
.chip.active { background: color-mix(in srgb, var(--chip) 18%, var(--surface)); border-color: var(--chip); font-weight: 700; }
.chip.all.active { background: var(--primary); color: var(--on-primary); border-color: var(--primary); }
.chip-dot { color: var(--chip); font-size: .85em; }
.chip-count { color: var(--muted); font-size: .8em; }
.chip.ghost { border-style: dashed; }
.tag { display: inline-block; color: var(--muted); font-size: .85rem; margin-right: 6px; }
.tag.removable { background: var(--surface-2); padding: 2px 4px 2px 10px; border-radius: 999px; color: var(--text); }
.tag.removable button { border: 0; background: none; color: var(--muted); cursor: pointer; width: 28px; height: 28px; font-size: 1.1rem; }
.pill { display: inline-block; font-size: .78rem; padding: 1px 9px; border-radius: 999px; background: var(--primary); color: var(--on-primary); font-weight: 700; }
.pill.soft { background: var(--surface-2); color: var(--muted); }
.pill.today { background: #e6a817; color: #2d2100; }
.pill.warn { background: var(--warn-bg); color: var(--warn-text); }

/* ───── 알림 ───── */
.alert { padding: 10px 14px; border-radius: 10px; margin: 8px 0; font-size: .92rem; }
.alert.warn { background: var(--warn-bg); color: var(--warn-text); }
.alert.error { background: var(--error-bg); color: var(--error-text); }
.alert.info { background: var(--info-bg); color: var(--info-text); }
.offline-banner {
  position: sticky; top: 0; z-index: 40; display: flex; gap: 8px; align-items: center; padding: 10px 16px;
  background: var(--warn-bg); color: var(--warn-text); font-size: .9rem; border-bottom: 1px solid var(--border);
}
.toasts { position: fixed; z-index: 90; left: 50%; transform: translateX(-50%); bottom: calc(var(--nav-h) + 16px + env(safe-area-inset-bottom)); display: grid; gap: 8px; width: min(560px, calc(100vw - 24px)); }
.desktop ~ .toasts, .shell.desktop + .toasts { bottom: 24px; }
.toast { display: flex; gap: 8px; align-items: center; padding: 10px 10px 10px 16px; border-radius: 12px; background: #24302a; color: #f2f6f3; box-shadow: 0 6px 24px rgba(0,0,0,.2); }
.toast span { flex: 1; }
.toast.error { background: #7d2a22; }
.toast.success { background: #2f6440; }
.toast.warn { background: #6d5212; }
.toast .icon-btn { color: inherit; }
.spinner { display: flex; gap: 10px; align-items: center; justify-content: center; padding: 32px; color: var(--muted); }
.spin { width: 18px; height: 18px; border: 2px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spin { animation-duration: 3s; } * { transition: none !important; } }

/* ───── 레이아웃 ───── */
.shell.mobile .main { padding: 12px 16px calc(var(--nav-h) + 24px + env(safe-area-inset-bottom)); }
.shell.desktop { display: grid; grid-template-columns: 280px minmax(0, 1fr); min-height: 100vh; }
.shell.desktop.editor-open { grid-template-columns: 280px minmax(0, 1fr) minmax(420px, 36vw); }
.shell.desktop .main { padding: 20px 28px 48px; min-width: 0; }
.shell.desktop .offline-banner { grid-column: 1 / -1; }

.sidebar { position: sticky; top: 0; height: 100vh; overflow-y: auto; padding: 18px 16px; border-right: 1px solid var(--border); background: var(--surface); display: flex; flex-direction: column; gap: 14px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.1rem; text-decoration: none; color: var(--text); }
.big-write kbd { background: rgba(255,255,255,.2); border-color: transparent; color: inherit; }
.side-nav { display: grid; gap: 2px; }
.side-nav .nav-item { flex-direction: row; justify-content: flex-start; gap: 12px; padding: 0 12px; min-height: 42px; font-size: .95rem; border-radius: 10px; }
.side-nav .nav-item.write { display: none; }
.side-cats { display: flex; flex-wrap: wrap; gap: 5px; }
.side-cats .section-label { width: 100%; }
.side-foot { margin-top: auto; font-size: .85rem; }

.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: grid; grid-template-columns: repeat(5, 1fr);
  height: calc(var(--nav-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
  background: color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter: blur(8px); border-top: 1px solid var(--border);
}
.nav-item {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: var(--muted);
  text-decoration: none; font-size: .75rem; font-weight: 600; background: none; border: 0; font-family: inherit; cursor: pointer;
}
.nav-item.active { color: var(--primary-strong); }
.nav-item.active:not(.write) { background: var(--primary-soft); }
.side-nav .nav-item.active { color: var(--primary-strong); }
.nav-item.write { color: var(--primary-strong); }
.write-circle { display: grid; place-items: center; width: 52px; height: 52px; margin-top: -18px; border-radius: 50%; background: var(--primary); color: var(--on-primary); box-shadow: 0 4px 14px color-mix(in srgb, var(--primary) 45%, transparent); }

/* ───── 날짜 이동 ───── */
.view-head { margin-bottom: 12px; }
.datenav { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 8px 10px; box-shadow: var(--shadow); }
.datenav-main { display: flex; align-items: center; gap: 4px; }
.date-pick { position: relative; flex: 1; display: flex; justify-content: center; align-items: center; min-height: 44px; cursor: pointer; border-radius: 10px; }
.date-pick:hover { background: var(--surface-2); }
.date-title { font-size: 1.35rem; font-weight: 800; letter-spacing: -.01em; }
.date-pick input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }
.date-pick input::-webkit-calendar-picker-indicator { position: absolute; inset: 0; width: 100%; height: 100%; cursor: pointer; }
.datenav-sub { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px; align-items: center; padding: 4px 4px 2px; }
.today-badge { font-size: .88rem; padding: 3px 10px; border-radius: 999px; }
.today-badge.is-today { background: var(--primary-soft); color: var(--primary-strong); }
.today-badge.not-today { background: var(--warn-bg); color: var(--warn-text); }
.jump { display: flex; gap: 4px; flex-wrap: wrap; }

.filterbar { margin-top: 10px; }
.filterbar .chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: thin; padding-bottom: 4px; }
.shell.desktop .filterbar .chips { flex-wrap: wrap; }
.filter-desc { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 6px 0 0; font-size: .88rem; color: var(--info-text); background: var(--info-bg); padding: 6px 12px; border-radius: 10px; }

/* ───── 연도 카드 ───── */
.year-grid { display: grid; gap: 14px; grid-template-columns: 1fr; }
.shell.desktop .year-grid { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); align-items: start; }
.year-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); min-width: 0; }
.year-card.base { border-color: color-mix(in srgb, var(--primary) 55%, var(--border)); border-width: 2px; }
.year-card.status-empty, .year-card.status-filtered_empty, .year-card.status-no_such_date { background: color-mix(in srgb, var(--surface) 70%, var(--bg)); box-shadow: none; }
.year-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; margin-bottom: 8px; }
.year-title { font-size: 1.15rem; margin: 0; }
.year-date { font-weight: 500; color: var(--muted); font-size: .92rem; margin-left: 4px; }
.year-sub { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-top: 2px; }
.count { font-size: .82rem; color: var(--muted); }
.empty-state { color: var(--muted); text-align: center; padding: 10px 0 4px; }
.empty-state p { margin: 2px 0; }
.entries { display: grid; gap: 12px; }
.entry { border-top: 1px solid var(--border); padding-top: 10px; }
.entries .entry:first-child { border-top: 0; padding-top: 0; }
.entry-head { display: flex; gap: 6px; align-items: center; }
.entry-title { margin: 0; font-size: 1.02rem; }
.fav, .fav-toggle.on { color: #d9a400; }
.meta-line { display: flex; gap: 10px; font-size: .88rem; color: var(--muted); margin: 2px 0; }
.entry-body.clamp { max-height: 9.6em; overflow: hidden; position: relative; }
.entry-body.clamp::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 2em; background: linear-gradient(transparent, var(--surface)); }
.entry-actions { display: flex; flex-wrap: wrap; gap: 2px; margin-top: 4px; margin-left: -10px; }
.scope-toggle { text-align: center; margin: 20px 0; }

.md p { margin: .3em 0; }
.md ul, .md ol { margin: .3em 0; padding-left: 1.4em; }
.md ul.checklist { list-style: none; padding-left: .2em; }
.md li.task input { margin-right: .3em; vertical-align: -1px; }
.md h2, .md h3, .md h4 { margin: .6em 0 .2em; font-size: 1.02rem; }
.md blockquote { margin: .4em 0; padding: .2em .8em; border-left: 3px solid var(--primary); color: var(--muted); }

.thumbs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; margin-top: 8px; }
.thumb { position: relative; padding: 0; border: 0; border-radius: 8px; overflow: hidden; background: var(--surface-2); aspect-ratio: 1; cursor: zoom-in; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb-more { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(0,0,0,.45); color: #fff; font-weight: 800; }
.thumb.big { aspect-ratio: auto; width: 100%; }
.thumb.big img { height: auto; object-fit: contain; }

/* ───── 모달 ───── */
.modal-backdrop { position: fixed; inset: 0; z-index: 80; background: rgba(15, 20, 17, .45); display: grid; place-items: center; padding: 12px; }
.modal { background: var(--surface); border-radius: 18px; width: min(560px, 100%); max-height: calc(100vh - 24px); display: flex; flex-direction: column; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.modal.wide { width: min(980px, 100%); }
.modal:focus { outline: none; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 12px 4px 20px; }
.modal-head h2 { margin: 0; }
.modal-body { padding: 4px 20px 16px; overflow-y: auto; }
.modal-foot { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; padding: 12px 20px; border-top: 1px solid var(--border); }
.confirm-msg p { margin: .4em 0; }
@media (max-width: 600px) {
  .modal-backdrop { padding: 0; place-items: end stretch; }
  .modal, .modal.wide { width: 100%; max-height: 92vh; border-radius: 18px 18px 0 0; }
  .modal-foot { padding-bottom: calc(12px + env(safe-area-inset-bottom)); }
  .modal-foot .btn { flex: 1; }
}
.lightbox { margin: 0; text-align: center; }
.lightbox img { max-height: 70vh; border-radius: 8px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 12px; }
.tabs button { border: 0; background: none; font: inherit; padding: 10px 14px; cursor: pointer; color: var(--muted); border-bottom: 3px solid transparent; min-height: 44px; }
.tabs button.active { color: var(--text); border-bottom-color: var(--primary); font-weight: 700; }
.detail-photos { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); margin: 12px 0; }
.detail-photos figure { margin: 0; }
.detail-photos figcaption { font-size: .85rem; color: var(--muted); }
.revisions { display: grid; gap: 12px; }
@media (min-width: 760px) { .revisions { grid-template-columns: 280px 1fr; } }
.rev-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 4px; }
.rev-item { width: 100%; text-align: left; border: 1px solid var(--border); background: var(--surface); border-radius: 10px; padding: 8px 12px; cursor: pointer; font: inherit; color: inherit; display: grid; }
.rev-item.active { border-color: var(--primary); background: var(--primary-soft); }
.rev-view { border: 1px solid var(--border); border-radius: 12px; padding: 12px 16px; }

/* ───── 편집기 ───── */
.editor { background: var(--surface); display: flex; flex-direction: column; min-width: 0; }
.editor.fullscreen { position: fixed; inset: 0; z-index: 50; }
.editor.panel { position: sticky; top: 0; height: 100vh; border-left: 1px solid var(--border); box-shadow: -4px 0 16px rgba(0,0,0,.04); }
.editor-head { display: flex; align-items: center; gap: 8px; padding: 8px 12px; padding-top: max(8px, env(safe-area-inset-top)); border-bottom: 1px solid var(--border); }
.editor-title { flex: 1; min-width: 0; }
.editor-title h2 { margin: 0; font-size: 1.05rem; }
.save-status { font-size: .78rem; color: var(--muted); display: flex; gap: 4px; align-items: center; }
.save-status.s-dirty { color: var(--warn-text); }
.save-status.s-offline, .save-status.s-error { color: var(--danger); font-weight: 700; }
.editor-body { flex: 1; overflow-y: auto; padding: 8px 16px calc(40px + env(safe-area-inset-bottom)); }
.date-row { align-items: center; }
.date-row .field { flex: 0 1 12rem; }
.date-explain { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.title-input { font-size: 1.15rem !important; font-weight: 700; border-color: transparent !important; background: var(--surface-2) !important; }
.body-editor { border: 1px solid var(--border); border-radius: 12px; overflow: hidden; margin: 10px 0; }
.toolbar { display: flex; align-items: center; gap: 2px; padding: 4px 6px; border-bottom: 1px solid var(--border); background: var(--surface-2); overflow-x: auto; }
.body-input { border: 0 !important; border-radius: 0 !important; resize: vertical; min-height: 12rem; line-height: 1.7; box-shadow: none !important; }
.shell.desktop .body-input { min-height: 22rem; }
.body-preview { padding: 10px 14px; min-height: 12rem; }
.section-label { font-size: .9rem; color: var(--muted); margin: 14px 0 4px; font-weight: 700; }
.tag-input { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; border: 1px solid var(--border); border-radius: 10px; padding: 4px 8px; background: var(--surface); }
.tag-input input { border: 0 !important; flex: 1; min-width: 8rem; box-shadow: none !important; padding: 4px !important; }
.pick-row { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; margin: 6px 0; }
.pick-label { font-size: .85rem; color: var(--muted); width: 3rem; }
details.optional, details.reference { margin: 12px 0; border: 1px solid var(--border); border-radius: 12px; padding: 4px 12px; }
details summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; gap: 6px; font-weight: 600; color: var(--muted); }
.ref-year h4 { margin: 10px 0 4px; font-size: .92rem; color: var(--primary-strong); }
.ref-entry { background: var(--surface-2); border-radius: 10px; padding: 8px 12px; margin-bottom: 6px; font-size: .92rem; }
.photos { margin: 10px 0; }
.photo-list { list-style: none; padding: 0; margin: 8px 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.photo-item { border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: var(--surface-2); display: flex; flex-direction: column; }
.photo-item img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; }
.photo-item .caption { border: 0 !important; border-radius: 0 !important; font-size: .85rem; min-height: 38px !important; }
.photo-tools { display: flex; justify-content: space-between; }
.photo-item.uploading progress { width: 100%; height: 8px; accent-color: var(--primary); }
.upload-err { font-size: .78rem; color: var(--danger); padding: 4px 6px; }
.drop-hint { border: 2px dashed var(--primary); border-radius: 12px; padding: 24px; text-align: center; color: var(--primary-strong); background: var(--primary-soft); }
.editor-foot { margin-top: 20px; border-top: 1px solid var(--border); padding-top: 10px; }
.conflict-grid { display: grid; gap: 12px; }
@media (min-width: 760px) { .conflict-grid { grid-template-columns: 1fr 1fr; } }
.conflict-col { border: 1px solid var(--border); border-radius: 12px; padding: 10px 14px; }
.conflict-col dl { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; font-size: .88rem; margin: 6px 0; }
.conflict-col dt { color: var(--muted); }
.conflict-col dd { margin: 0; }
.conflict-body { min-height: 10rem; font-size: .9rem; }

/* ───── 달력 ───── */
.month-grid { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 8px; box-shadow: var(--shadow); }
.mg-row { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.mg-row.head span { text-align: center; font-size: .8rem; color: var(--muted); padding: 4px 0; }
.mg-row + .mg-row { margin-top: 4px; }
.mg-cell { position: relative; aspect-ratio: 1; min-height: 44px; border: 1px solid transparent; border-radius: 10px; background: none; cursor: pointer; font: inherit; color: var(--text); display: flex; flex-direction: column; align-items: center; justify-content: flex-start; padding-top: 6px; }
.mg-cell:hover { background: var(--surface-2); }
.mg-cell.out { color: var(--muted); opacity: .55; }
.mg-cell.sun .mg-num, .mg-row.head .sun { color: #c0453a; }
.mg-cell.sat .mg-num, .mg-row.head .sat { color: #3a6fc0; }
.mg-cell.today { border-color: #e6a817; }
.mg-cell.selected { background: var(--primary-soft); border-color: var(--primary); }
.mg-cell.has { font-weight: 700; }
.mg-count { margin-top: auto; margin-bottom: 6px; font-size: .75rem; min-width: 22px; padding: 0 6px; border-radius: 999px; background: var(--primary); color: var(--on-primary); }
.mg-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--primary); margin-top: 2px; }
.month-grid.small { padding: 4px; box-shadow: none; }
.month-grid.small .mg-cell { min-height: 0; aspect-ratio: 1; padding-top: 2px; font-size: .8rem; border-radius: 7px; }
.month-grid.small .mg-row { gap: 1px; }
.mini-title { font-weight: 700; font-size: .92rem; }
.calendar-view .month-grid { max-width: 820px; margin: 0 auto; }

/* ───── 검색 ───── */
.search-box { display: flex; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 0 12px; }
.search-box input { border: 0 !important; box-shadow: none !important; font-size: 1.05rem; }
.search-filters { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: flex-end; margin: 8px 0; }
.result-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.result { display: flex; gap: 10px; align-items: flex-start; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; }
.result > input[type=checkbox] { width: 20px; height: 20px; margin-top: 4px; accent-color: var(--primary); }
.result-title { font-weight: 700; margin-top: 4px; }
.result-snippet { margin: 4px 0; color: var(--muted); font-size: .92rem; }
mark { background: #ffe58a; color: #2a2100; border-radius: 3px; padding: 0 2px; }
.table { width: 100%; border-collapse: collapse; font-size: .9rem; margin: 8px 0; }
.table th, .table td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--border); vertical-align: top; }
.table tr.muted td { color: var(--muted); }

/* ───── 페이지·설정 ───── */
.page { max-width: 860px; margin: 0 auto; }
.page-head { display: flex; align-items: center; gap: 8px; justify-content: space-between; margin-bottom: 10px; }
.page-head h1 { flex: 1; margin: 0; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 18px; margin: 12px 0; box-shadow: var(--shadow); }
.settings-nav { display: grid; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.settings-item { display: flex; justify-content: space-between; align-items: center; min-height: 56px; padding: 0 18px; border: 0; border-bottom: 1px solid var(--border); background: none; font: inherit; color: inherit; cursor: pointer; text-align: left; }
.settings-item:last-child { border-bottom: 0; }
.settings-item:hover { background: var(--surface-2); }
.cat-list { list-style: none; padding: 0; margin: 8px 0; display: grid; gap: 4px; }
.cat-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; padding: 6px 0; border-bottom: 1px solid var(--border); }
.backup-list { list-style: none; padding: 0; display: grid; gap: 6px; }
.backup-list li { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; border: 1px solid var(--border); border-radius: 10px; padding: 8px 12px; }
.backup-list .grow { display: flex; flex-direction: column; }
.export-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 8px; margin: 10px 0; }
.export-grid .btn { flex-direction: column; min-height: 64px; white-space: normal; text-align: center; gap: 0; }
.stat-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; margin: 8px 0; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 10px 14px; display: flex; flex-direction: column; }
.stat span { font-size: .82rem; color: var(--muted); }
.stat b { font-size: 1.4rem; }
.stat b.small { font-size: 1rem; }
.bars { display: grid; gap: 6px; }
.bar-row { display: grid; grid-template-columns: 7.5rem 1fr 3rem; gap: 8px; align-items: center; font-size: .9rem; }
.bar-track { height: 12px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.bar-fill { display: block; height: 100%; background: var(--primary); border-radius: 999px; min-width: 2px; }
.bar-value { text-align: right; }
.pw-form { max-width: 420px; }

/* ───── 로그인 ───── */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.auth-card { width: min(420px, 100%); background: var(--surface); border: 1px solid var(--border); border-radius: 20px; padding: 28px 24px; box-shadow: var(--shadow); text-align: center; }
.auth-card .field, .auth-card .check { text-align: left; }
.auth-card h1 { margin-top: 8px; }
.auth-card .btn { margin-top: 10px; }

@media (max-width: 420px) {
  .date-title { font-size: 1.2rem; }
  .jump .btn.tiny { padding: 0 8px; }
}
@media print {
  .sidebar, .bottom-nav, .editor, .entry-actions, .datenav, .filterbar, .scope-toggle { display: none !important; }
  .shell.desktop { display: block; }
  .year-card { break-inside: avoid; box-shadow: none; }
}
.date-title { white-space: nowrap; }
@media (max-width: 480px) {
  .calendar-view .datenav-main { gap: 0; }
  .calendar-view .datenav-main .icon-btn { width: 36px; }
  .calendar-view .date-title { font-size: 1.1rem; }
}
