/* =========================================================
   Memory v2.1 — 디자인 시스템
   - 흰색 기본 / 시스템 설정에 따른 다크
   - 브랜드 #113EAD, 작성 영역만 연한 배경 + 테두리
   - 모든 기능 버튼 = 동일 높이(--ctl). PC 36 / 태블릿 40 / 모바일 44
   - 화면 = 고정 높이 셸(100dvh) + 패널이 가장자리에 붙는 dock 레이아웃
   반응형: 모바일 ≤767 · 태블릿 768~1023 · PC ≥1024
   ========================================================= */
:root {
  --bg: #ffffff;
  --surface: #ffffff;
  --surface-2: #f7f8fa;
  --surface-hover: #f2f4f7;
  --border: #e4e7ec;
  --border-strong: #d0d5dd;
  --line: #f0f2f5;          /* 아주 옅은 구분선 (표 행 등 꼭 필요한 곳만) */
  --text: #1b1f24;
  --muted: #667085;
  --primary: #113ead;
  --primary-hover: #0e3492;
  --primary-active: #0a276e;
  --accent: #113ead;
  --primary-soft: rgba(17, 62, 173, .08);
  --primary-soft-2: rgba(17, 62, 173, .15);
  --ring: 0 0 0 3px rgba(17, 62, 173, .28);
  --danger: #d92d20;
  --danger-soft: rgba(217, 45, 32, .08);
  --ok: #067647;
  --warn: #b54708;
  --star: #f5a524;
  --canvas-outside: #ffffff;   /* 그림판 바깥도 흰색 (문서는 그림자로 구분) */
  --radius: 10px;
  --ctl: 36px;            /* 모든 버튼/입력 높이 */
  --ico: 18px;
  --gap: 8px;
  --pad: 20px;
  --sidebar: 200px;
  --topbar: 48px;
  --list-w: 320px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow-lg: 0 12px 32px rgba(16, 24, 40, .16);
  --seg-notes: #113ead; --seg-files: #3e7bfa; --seg-drawings: #7a5af8; --seg-trash: #98a2b3;
  color-scheme: light;
}
/* 화면 모드 (프로필에서 선택): 시스템 = <html> 에 data-theme 없음, 흰색 = light, 블랙 = dark
   다크도 바탕·패널을 한 색으로 통일 (영역 이질감 없음) */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111317; --surface: #111317; --surface-2: #1a1d23; --surface-hover: #1d2128;
    --border: #2a2f38; --border-strong: #3a414d; --line: #1e2229; --text: #e6e8ec; --muted: #98a2b3;
    --primary: #113ead; --primary-hover: #1d4ed8; --primary-active: #0e3492; --accent: #7b9cf5;
    --primary-soft: rgba(123, 156, 245, .10); --primary-soft-2: rgba(123, 156, 245, .20);
    --ring: 0 0 0 3px rgba(123, 156, 245, .35);
    --danger: #f97066; --danger-soft: rgba(249, 112, 102, .12); --ok: #47cd89; --warn: #fdb022;
    --canvas-outside: #111317; --shadow: 0 1px 2px rgba(0, 0, 0, .4); --shadow-lg: 0 12px 32px rgba(0, 0, 0, .55);
    --seg-notes: #7b9cf5; --seg-drawings: #9b8afb; --seg-trash: #667085;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
    --bg: #111317; --surface: #111317; --surface-2: #1a1d23; --surface-hover: #1d2128;
    --border: #2a2f38; --border-strong: #3a414d; --line: #1e2229; --text: #e6e8ec; --muted: #98a2b3;
    --primary: #113ead; --primary-hover: #1d4ed8; --primary-active: #0e3492; --accent: #7b9cf5;
    --primary-soft: rgba(123, 156, 245, .10); --primary-soft-2: rgba(123, 156, 245, .20);
    --ring: 0 0 0 3px rgba(123, 156, 245, .35);
    --danger: #f97066; --danger-soft: rgba(249, 112, 102, .12); --ok: #47cd89; --warn: #fdb022;
    --canvas-outside: #111317; --shadow: 0 1px 2px rgba(0, 0, 0, .4); --shadow-lg: 0 12px 32px rgba(0, 0, 0, .55);
    --seg-notes: #7b9cf5; --seg-drawings: #9b8afb; --seg-trash: #667085;
    color-scheme: dark;
}
:root[data-theme="light"] { color-scheme: light; }
@media (min-width: 768px) and (max-width: 1023px) { :root { --ctl: 40px; --pad: 16px; --list-w: 280px; } }
@media (max-width: 767px) { :root { --ctl: 44px; --ico: 20px; --pad: 12px; --topbar: 48px; } }
@media (pointer: coarse) and (min-width: 1024px) { :root { --ctl: 40px; } }

* { box-sizing: border-box; }
html, body { margin: 0; }
html { background: var(--bg); }
/* PC·태블릿: 화면 고정 셸(내부 스크롤). 모바일은 문서 자체가 스크롤 → Safari/Chrome 상·하단 바도 바탕색과 같은 색 */
@media (min-width: 768px) { html, body { height: 100%; overflow: hidden; overscroll-behavior: none; } }
html:has(body.focus), body.focus { height: 100%; overflow: hidden; overscroll-behavior: none; }   /* 그림판 */
html:has(body.login-body), body.login-body { overscroll-behavior: none; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", sans-serif;
  background: var(--bg); color: var(--text); font-size: 15px; line-height: 1.5;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.3rem; margin: 0 0 14px; letter-spacing: -.01em; }
h2 { font-size: 1rem; margin: 0 0 10px; }
h3 { font-size: .92rem; margin: 16px 0 8px; }
.muted { color: var(--muted); }
.small { font-size: .84rem; }
.center { text-align: center; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .82rem; word-break: break-all; }
.nowrap { white-space: nowrap; }
.spacer { flex: 1; }
.error-text { color: var(--danger); }
.ok-text { color: var(--ok); }
[hidden] { display: none !important; }
:focus-visible { outline: none; box-shadow: var(--ring); border-radius: 6px; }
.mt-12 { margin-top: 12px; } .mt-16 { margin-top: 16px; } .mb-14 { margin-bottom: 14px; } .minw-140 { min-width: 140px; }

/* ---------- 아이콘 ---------- */
.ico { width: var(--ico); height: var(--ico); flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ico .dot { fill: currentColor; stroke: none; }
.ico.filled { fill: currentColor; }

/* ---------- 버튼: 모든 기능 버튼 동일 높이 ---------- */
.btn, .ibtn, .icon-btn, .tool-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: var(--ctl); min-height: var(--ctl); padding: 0 14px; border-radius: 8px;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  font: inherit; font-size: .9rem; font-weight: 600; cursor: pointer; white-space: nowrap; text-decoration: none !important;
  transition: background-color .15s, border-color .15s, color .15s, box-shadow .15s, transform .05s; user-select: none;
}
.ibtn, .icon-btn, .tool-btn { width: var(--ctl); min-width: var(--ctl); padding: 0; }
.ibtn.with-label { width: auto; padding: 0 12px 0 10px; }
.icon-btn { border-color: transparent; background: transparent; }
.btn:hover, .ibtn:hover, .tool-btn:hover { border-color: var(--accent); color: var(--accent); background: var(--primary-soft); }
.icon-btn:hover { background: var(--surface-hover); }
.btn:active, .ibtn:active, .icon-btn:active, .tool-btn:active { transform: translateY(1px); background: var(--primary-soft-2); }
.btn:focus-visible, .ibtn:focus-visible { box-shadow: var(--ring); }
.btn:disabled, .ibtn:disabled, .tool-btn:disabled { opacity: .4; cursor: not-allowed; transform: none; }
.btn.primary, .ibtn.primary, .tool-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover, .ibtn.primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); color: #fff; box-shadow: 0 2px 8px rgba(17, 62, 173, .3); }
.btn.primary:active, .ibtn.primary:active { background: var(--primary-active); border-color: var(--primary-active); box-shadow: inset 0 2px 4px rgba(0, 0, 0, .22); }
.btn.danger, .ibtn.danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, var(--border)); }
.btn.danger:hover, .ibtn.danger:hover { background: var(--danger-soft); color: var(--danger); border-color: var(--danger); }
.btn.ghost, .ibtn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover, .ibtn.ghost:hover { background: var(--surface-hover); color: var(--text); border-color: transparent; }
.btn.on, .ibtn.on { background: var(--primary-soft-2); border-color: var(--accent); color: var(--accent); }
.ibtn.star-on { color: var(--star); border-color: color-mix(in srgb, var(--star) 50%, var(--border)); background: color-mix(in srgb, var(--star) 12%, transparent); }
.btn.block { width: 100%; }
.btn.small { font-size: .86rem; }   /* 높이는 동일, 글자만 작게 */
.show-mobile, .dock { display: none !important; }
.fab { position: fixed; right: 16px; bottom: calc(var(--dock-h, 58px) + env(safe-area-inset-bottom) + 16px); width: 56px; height: 56px; border-radius: 50%; background: var(--primary); color: #fff !important; box-shadow: 0 6px 18px rgba(17, 62, 173, .35); z-index: 61; align-items: center; justify-content: center; text-decoration: none !important; }
.fab .ico { width: 26px; height: 26px; }
.btn-row { display: flex; gap: var(--gap); flex-wrap: wrap; align-items: center; }

/* ---------- 입력 (버튼과 같은 높이) ---------- */
.input, select.input {
  width: 100%; height: var(--ctl); padding: 0 12px; border: 1px solid var(--border-strong); border-radius: 8px;
  background: var(--surface); color: var(--text); font: inherit; font-size: .95rem; transition: border-color .15s, box-shadow .15s;
}
textarea.input { height: auto; padding: 8px 12px; }
.input:hover { border-color: var(--muted); }
.input:focus, .write-area:focus-within { outline: none; border-color: var(--primary); box-shadow: var(--ring); }
.small-input { font-size: .88rem; }
.label { display: block; margin: 12px 0 4px; font-size: .85rem; color: var(--muted); font-weight: 500; }
.hint { font-size: .8rem; color: var(--muted); margin-top: 4px; }
.check { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; user-select: none; min-height: 32px; }
.check input { width: 18px; height: 18px; accent-color: var(--primary); }
.form-error { color: var(--danger); margin: 8px 0; font-size: .9rem; }
.form-ok { color: var(--ok); margin: 8px 0; font-size: .9rem; }
.form-ok:empty, .form-error:empty { margin: 0; }

/* ---------- 앱 셸 (dock) ---------- */
.app { height: 100vh; height: 100dvh; display: flex; flex-direction: column; }
.topbar {
  flex: none; display: flex; align-items: center; gap: 6px; height: var(--topbar); padding: 0 8px;
  background: var(--surface); z-index: 50;
}
.brand { font-weight: 800; font-size: 1.08rem; letter-spacing: -.02em; color: var(--text); text-decoration: none !important; padding: 0 4px; }
.brand::before { content: "▌"; color: var(--primary); margin-right: 2px; }
.topbar-title { font-weight: 600; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .92rem; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.session-chip { font-size: .78rem; color: var(--warn); padding: 1px 8px; border: 1px solid currentColor; border-radius: 99px; white-space: nowrap; }
.user-btn { height: var(--ctl); display: inline-flex; align-items: center; gap: 6px; padding: 0 8px 0 4px; border: 1px solid transparent; border-radius: 99px; background: transparent; color: var(--text); font: inherit; font-size: .88rem; cursor: pointer; }
.user-btn:hover { background: var(--surface-hover); }
.avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--primary); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: .85rem; }

.layout { flex: 1; min-height: 0; display: flex; position: relative; }
body.menu-top .layout { flex-direction: column; }
.main { flex: 1; min-width: 0; min-height: 0; overflow: auto; padding: var(--pad); overscroll-behavior: contain; }
.main.full { padding: 0; overflow: hidden; display: flex; flex-direction: column; }
.page { max-width: 1320px; margin: 0 auto; }
.page.narrow { max-width: 880px; }
.page.wide { max-width: none; }

/* 메뉴 */
.nav { background: var(--surface); }
.nav a {
  display: flex; align-items: center; height: var(--ctl); padding: 0 12px; border-radius: 8px; color: var(--text);
  text-decoration: none; font-weight: 700; transition: background-color .15s, color .15s; white-space: nowrap;
}
.nav a::before { content: "▌"; color: var(--border-strong); margin-right: 6px; transition: color .15s; }
.nav a:hover { background: var(--surface-hover); }
.nav a:hover::before { color: var(--accent); }
.nav a.active { background: var(--primary-soft); color: var(--accent); }
.nav a.active::before { color: var(--primary); }
.nav-foot { margin-top: auto; padding-top: 12px; display: flex; flex-direction: column; gap: 8px; }

/* PC: 좌측 dock 메뉴 (접기 = 폭 0 으로 부드럽게) */
body.menu-left .nav {
  flex: none; width: var(--sidebar);
  display: flex; flex-direction: column; gap: 2px; padding: 10px; overflow-y: auto;
  transition: width .2s ease, padding .2s ease, border-color .2s;
}
body.menu-left.menu-collapsed .nav { width: 0; padding: 10px 0; overflow: hidden; }
/* PC: 상단 메뉴 */
body.menu-top .nav { flex: none; display: flex; gap: 4px; padding: 6px 10px; overflow-x: auto; }
body.menu-top .nav a { padding: 0 14px; }
body.menu-top .nav-foot { display: none; }
body.menu-top.menu-collapsed .nav { display: none; }
.scrim { display: none; }

/* 포커스 모드 (손글씨 편집): 상단바·메뉴 숨김 → 그리기 공간 최대 */
body.focus .topbar, body.focus .nav { display: none !important; }

/* ---------- 카드 / 표 / 공통 ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 14px; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.card-head h2 { margin: 0; }
.danger-zone { border-color: color-mix(in srgb, var(--danger) 35%, var(--border)); }
.simple-list { list-style: none; margin: 0; padding: 0; }
.simple-list li { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.simple-list li:last-child { border-bottom: 0; }
.kv { display: grid; grid-template-columns: 140px 1fr; gap: 6px 12px; margin: 0 0 12px; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; }
.bar { height: 8px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 99px; overflow: hidden; margin: 6px 0 4px; display: flex; }
.bar-fill { height: 100%; width: 0; background: var(--primary); transition: width .2s; }
.bar-fill.danger { background: var(--danger); }
.seg-notes { background: var(--seg-notes); } .seg-files { background: var(--seg-files); }
.seg-drawings { background: var(--seg-drawings); } .seg-trash { background: var(--seg-trash); }
.legend { display: flex; flex-wrap: wrap; gap: 2px 12px; font-size: .8rem; color: var(--muted); }
.legend i { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 5px; vertical-align: middle; }
.badge { display: inline-flex; align-items: center; padding: 1px 8px; border-radius: 99px; font-size: .76rem; font-weight: 600; border: 1px solid transparent; white-space: nowrap; }
.badge.ok { background: color-mix(in srgb, var(--ok) 14%, transparent); color: var(--ok); }
.badge.off { background: var(--surface-2); color: var(--muted); border-color: var(--border); }
.badge.warn { background: color-mix(in srgb, var(--warn) 14%, transparent); color: var(--warn); }
.badge.danger { background: var(--danger-soft); color: var(--danger); }
.badge.pri { background: var(--primary-soft); color: var(--accent); }
.tag-type { display: inline-block; min-width: 44px; text-align: center; font-size: .74rem; font-weight: 700; padding: 1px 6px; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--border); color: var(--muted); }
.tag-type.note { color: var(--seg-notes); } .tag-type.file { color: var(--seg-files); } .tag-type.drawing { color: var(--seg-drawings); }

.tabs { display: flex; gap: 2px; overflow-x: auto; margin-bottom: 14px; }
.tab { border: 0; background: transparent; height: var(--ctl); padding: 0 14px; cursor: pointer; color: var(--muted); font: inherit; font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; transition: color .15s, border-color .15s; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--accent); border-bottom-color: var(--primary); }
/* 세그먼트(필터) — 버튼과 같은 높이 */
.pills { display: flex; gap: 2px; padding: 2px; background: var(--surface); border: 1px solid var(--border); border-radius: 9px; overflow-x: auto; flex: none; }
.pill { height: calc(var(--ctl) - 6px); border: 0; background: transparent; padding: 0 12px; border-radius: 7px; cursor: pointer; color: var(--muted); font: inherit; font-size: .88rem; font-weight: 600; white-space: nowrap; transition: all .15s; }
.pill:hover { color: var(--text); }
.pill.active { background: var(--primary-soft); color: var(--accent); }
.pill.icon-pill { width: calc(var(--ctl) + 4px); padding: 0; display: inline-flex; align-items: center; justify-content: center; }
.pill.icon-pill.active .ico.star-ico { color: var(--star); }
.pills-center { justify-content: center; margin: 0 auto; width: fit-content; max-width: 100%; }

.table-wrap { overflow: auto; }
.table { width: 100%; border-collapse: collapse; background: var(--surface); }
.table th, .table td { text-align: left; padding: 8px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table th { font-weight: 600; font-size: .82rem; color: var(--muted); user-select: none; background: var(--surface); position: sticky; top: 0; z-index: 1; }
.table th.sortable { cursor: pointer; }
.table th.sortable:hover { color: var(--accent); }
.table tbody tr { transition: background-color .1s; }
.table tbody tr:hover { background: var(--surface-hover); }
.table tr.selected { background: var(--primary-soft); }
.table td .btn + .btn, .table td .ibtn + .ibtn { margin-left: 6px; }
.log-box { max-height: 520px; overflow: auto; }

/* 토스트 / 모달 / 팝업메뉴 */
#toasts { position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); z-index: 1000; display: flex; flex-direction: column; gap: 8px; width: min(92vw, 420px); pointer-events: none; }
.toast { display: flex; align-items: center; gap: 10px; background: #1f2937; color: #fff; padding: 10px 14px; border-radius: 10px; box-shadow: var(--shadow-lg); transition: opacity .4s; font-size: .9rem; pointer-events: auto; }
.toast span { flex: 1; }
.toast-act { border: 0; background: transparent; color: #9db7ff; font: inherit; font-weight: 700; cursor: pointer; padding: 4px 6px; }
.toast-error { background: var(--danger); }
.toast-error .toast-act { color: #fff; }
.toast-success { background: #067647; }
.toast.hide { opacity: 0; }
.overlay { position: fixed; inset: 0; background: rgba(16, 24, 40, .5); display: flex; align-items: center; justify-content: center; z-index: 900; padding: 16px; }
.modal { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; width: min(100%, 480px); max-height: 90vh; overflow: auto; padding: 20px; box-shadow: var(--shadow-lg); overscroll-behavior: contain; }
.modal.wide { width: min(100%, 780px); }
.modal h3 { margin: 0 0 12px; font-size: 1.05rem; word-break: break-all; }
.modal-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.preview-img { max-width: 100%; max-height: 70vh; display: block; margin: 0 auto; }
.modal:has(.preview-img) { width: min(100%, 960px); }
/* 이동할 폴더 선택 (v2.8.4): 큰 행 목록 */
.folder-pick { margin-top: 10px; max-height: min(60vh, 520px); min-height: 180px; overflow: auto; border: 1px solid var(--border); border-radius: 10px; overscroll-behavior: contain; }
.folder-row { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 46px; padding: 8px 12px; border: 0; border-bottom: 1px solid var(--line); background: transparent; color: var(--text); font: inherit; font-size: .98rem; text-align: left; cursor: pointer; }
.folder-row:last-child { border-bottom: 0; }
.folder-row:hover { background: var(--primary-soft); }
.folder-row.sel { background: var(--primary-soft-2); color: var(--accent); font-weight: 600; }
.folder-row[disabled] { opacity: .5; cursor: default; background: transparent; }
.folder-row .folder-ico { width: 20px; height: 20px; flex: none; color: var(--accent); }
.folder-row .folder-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.folder-picked { margin-top: 10px; min-height: 1.3em; word-break: break-all; }
.folder-empty { padding: 16px; text-align: center; }
.banner { padding: 8px 12px; border-radius: 8px; font-size: .88rem; background: color-mix(in srgb, var(--warn) 12%, transparent); color: var(--warn); border: 1px solid color-mix(in srgb, var(--warn) 35%, transparent); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.popmenu { position: fixed; z-index: 950; min-width: 190px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow-lg); padding: 4px; }
.popitem { width: 100%; height: var(--ctl); display: flex; align-items: center; gap: 10px; border: 0; background: transparent; color: var(--text); font: inherit; font-size: .92rem; padding: 0 12px; border-radius: 7px; cursor: pointer; text-align: left; }
.popitem:hover { background: var(--primary-soft); color: var(--accent); }
.popitem.danger { color: var(--danger); }
.popitem.danger:hover { background: var(--danger-soft); }
.boot-fail { position: fixed; left: 50%; top: 80px; transform: translateX(-50%); z-index: 2000; width: min(92vw, 420px); background: var(--surface); border: 1px solid var(--danger); border-radius: 12px; padding: 18px; box-shadow: var(--shadow-lg); text-align: center; }
.boot-fail p { margin: 0 0 12px; }

/* ---------- 로그인 (모바일에서 화면 끌림 방지: 고정 컨테이너) ---------- */
.login-body { min-height: 100vh; min-height: 100dvh; overflow-x: hidden; touch-action: pan-y; display: flex; padding: 16px; padding-top: max(16px, env(safe-area-inset-top)); background: var(--bg); box-sizing: border-box; }
.login-ver { margin-top: 18px; text-align: center; font-size: .76rem; color: var(--muted); letter-spacing: .02em; }
.pw-wrap { position: relative; }
.pw-wrap .input { padding-right: 48px; }
.pw-eye { position: absolute; right: 2px; top: 50%; transform: translateY(-50%); width: var(--ctl); height: var(--ctl); border: 0; background: transparent; color: var(--muted); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; border-radius: 8px; padding: 0; }
.pw-eye:hover { color: var(--accent); }
.remember { margin-top: 10px; font-size: .9rem; color: var(--muted); }
.login-opts { display: flex; flex-wrap: wrap; gap: 0 18px; }
.login-card { width: 100%; max-width: 380px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 26px; box-shadow: var(--shadow-lg); margin: auto; }
.login-card h1 { margin-bottom: 2px; font-size: 1.55rem; }
.login-card { position: relative; }
.lang-sel { position: absolute; top: 16px; right: 16px; width: auto; height: 32px; min-height: 32px; padding: 0 8px; font-size: .85rem; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); }
html.i18n-wait body { visibility: hidden; }
.login-card h1::before { content: "▌"; color: var(--primary); }
.login-card .btn { margin-top: 8px; }
.login-alt { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 6px; text-align: center; }

/* ---------- 홈 (통합 검색) ---------- */
.home { max-width: 1000px; margin: 0 auto; }
.home-hero { padding: 24px 0 4px; text-align: center; }
.home-hero h1 { font-size: 1.5rem; margin-bottom: 4px; }
.search-box { position: relative; margin: 14px 0 10px; }
.search-box input {
  width: 100%; height: 52px; padding: 0 18px 0 46px; font: inherit; font-size: 1.05rem;
  border: 1.5px solid var(--border-strong); border-radius: 14px; background: var(--surface); color: var(--text);
  transition: border-color .15s, box-shadow .15s, background-color .15s;
}
.search-box input:focus { outline: none; border-color: var(--primary); box-shadow: var(--ring); background: var(--surface); }
.search-box .ico { position: absolute; left: 15px; top: 50%; transform: translateY(-50%); color: var(--muted); width: 20px; height: 20px; }
.search-kbd { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); font-size: .75rem; color: var(--muted); border: 1px solid var(--border); border-radius: 6px; padding: 1px 6px; }
.home-actions { display: flex; justify-content: center; gap: var(--gap); flex-wrap: wrap; margin: 12px 0 6px; }
.result-group { margin-top: 16px; }
.result-group h2 { font-size: .84rem; color: var(--muted); display: flex; justify-content: space-between; align-items: center; }
.result-list { list-style: none; margin: 0; padding: 0; overflow: hidden; background: var(--surface); }
.result-list li + li { border-top: 1px solid var(--line); }
.result-item { display: flex; gap: 12px; align-items: center; padding: 11px 10px; border-radius: 10px; color: var(--text); text-decoration: none !important; transition: background-color .1s; }
.result-item:hover, .result-item.kb { background: var(--primary-soft); }
.result-main { flex: 1; min-width: 0; }
.result-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: flex; align-items: center; gap: 4px; }
.result-sub { font-size: .84rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.result-sub mark, .result-title mark { background: color-mix(in srgb, var(--primary) 18%, transparent); color: inherit; border-radius: 3px; padding: 0 1px; }
.result-time { font-size: .8rem; color: var(--muted); white-space: nowrap; }
.mini-ico { width: 14px; height: 14px; }
.mini-ico.pin { color: var(--accent); }
.mini-ico.star { color: var(--star); }

/* ---------- 노트 (dock: 목록 | 편집기) — 선 없이 여백으로 구분 ---------- */
.notes-layout { flex: 1; min-height: 0; display: grid; grid-template-columns: var(--list-w) minmax(0, 1fr); }
.note-list-pane { min-height: 0; min-width: 0; background: var(--surface); display: flex; flex-direction: column; }
.pane-head { flex: none; display: flex; gap: 6px; padding: 10px 10px 6px; }
.pane-head .input { flex: 1; min-width: 0; }
.pane-sub { flex: none; display: flex; gap: 6px; align-items: center; padding: 0 10px 8px; }
.pane-sub .pills { flex: none; }
.pane-sub select { flex: 1; width: auto; min-width: 0; }
.linklike { border: 0; background: none; color: var(--accent); font: inherit; font-size: .8rem; cursor: pointer; padding: 0; }
.note-list { list-style: none; margin: 0; padding: 0 6px 12px; overflow-y: auto; flex: 1; min-height: 0; overscroll-behavior: contain; }
.note-item { position: relative; overflow: hidden; touch-action: pan-y; border-radius: 10px; margin-bottom: 2px; }
.note-row { position: relative; z-index: 1; display: flex; align-items: stretch; background: var(--surface); transition: transform .18s ease, background-color .12s; border-radius: 10px; }
.note-item.swiping .note-row { transition: none; }
.note-item.active .note-row { background: color-mix(in srgb, var(--primary) 8%, var(--surface)); }
.note-row:hover { background: var(--surface-hover); }
.note-item.active .note-row:hover { background: color-mix(in srgb, var(--primary) 12%, var(--surface)); }
.note-row a { flex: 1; min-width: 0; display: block; padding: 9px 10px 9px 2px; color: var(--text); text-decoration: none; }
.ni-top { display: flex; align-items: center; gap: 6px; }
.note-item-title { flex: 1; min-width: 0; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ni-marks { display: inline-flex; gap: 2px; flex: none; }
.ni-date { flex: none; font-size: .76rem; color: var(--muted); }
.note-item-snippet { font-size: .86rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ni-tags { font-size: .76rem; color: var(--accent); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ni-hover { display: none; align-items: center; gap: 2px; padding-right: 6px; }
.ni-hover .ibtn { border-color: transparent; background: transparent; }
.ni-hover .ibtn:hover { background: var(--primary-soft); }
@media (hover: hover) and (min-width: 768px) { .note-row:hover .ni-hover { display: flex; } .note-row:hover .ni-date { display: none; } }
.note-actions { position: absolute; inset: 0 0 0 auto; display: flex; z-index: 0; visibility: hidden; }
.note-item.swiping .note-actions, .note-item.open .note-actions { visibility: visible; }
.note-actions button { width: 72px; border: 0; color: #fff; font: inherit; font-size: .8rem; font-weight: 600; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; cursor: pointer; }
.note-actions .act-pin { background: var(--primary); }
.note-actions .act-del { background: var(--danger); }
.note-item.dragging .note-row { box-shadow: var(--shadow-lg); background: var(--surface); }
.drag-handle { width: 22px; flex: 0 0 22px; display: flex; align-items: center; justify-content: center; color: var(--border-strong); cursor: grab; touch-action: none; user-select: none; opacity: .6; }
.drag-handle .ico { width: 16px; height: 16px; }
.drag-handle:hover { color: var(--accent); opacity: 1; }
.drag-handle.disabled { visibility: hidden; }
.empty { padding: 24px; text-align: center; }
.note-editor-pane { min-width: 0; min-height: 0; display: flex; flex-direction: column; background: var(--bg); }
.empty-state { margin: auto; padding: 40px; text-align: center; }
.note-editor { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.editor-toolbar { flex: none; display: flex; align-items: center; gap: 6px; padding: 8px var(--pad) 4px; }
.save-status { font-size: .82rem; white-space: nowrap; }
.back-btn { display: none; }
.note-editor > .banner { margin: 0 var(--pad) 6px; }
/* 제목(첫 줄)·본문이 같은 흰 바탕에서 함께 스크롤 */
.note-scroll { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
.note-doc { max-width: 920px; margin: 0 auto; padding: 8px 28px 24px; display: flex; flex-direction: column; min-height: 100%; }
.note-title { display: block; width: 100%; border: 0; background: transparent; color: var(--text); font: inherit; font-size: 1.7rem; line-height: 1.3; font-weight: 700; letter-spacing: -.02em; padding: 6px 0 8px; resize: none; overflow: hidden; }
.note-title::placeholder { color: var(--border-strong); }
.note-title:focus { outline: none; }
/* 글자 크기: --note-scale (노트 화면의 '가' 메뉴, 기기별로 기억) */
.note-doc { --note-scale: 1; }
.note-doc.fs-90 { --note-scale: .9; } .note-doc.fs-115 { --note-scale: 1.15; } .note-doc.fs-130 { --note-scale: 1.3; } .note-doc.fs-150 { --note-scale: 1.5; }
.note-editable { flex: 1; min-height: 240px; padding: 2px 0 30px; font-size: calc(1.02rem * var(--note-scale)); line-height: 1.75; white-space: pre-wrap; overflow-wrap: anywhere; outline: none; position: relative; color: var(--text); cursor: text; -webkit-user-select: text; user-select: text; }
.note-editable .nt-title { font-size: calc(1.7rem * var(--note-scale)); line-height: 1.45; font-weight: 700; letter-spacing: -.02em; }
.md-view .md-title { font-size: calc(1.7rem * var(--note-scale)); margin: 0 0 .5em; }
.note-editable.is-empty::before { font-size: calc(1.7rem * var(--note-scale)); font-weight: 700; }
.note-editable.is-empty::before { content: attr(data-ph); color: var(--border-strong); position: absolute; left: 0; top: 2px; right: 0; pointer-events: none; white-space: normal; }
/* 태그: 본문 아래(같이 스크롤) 칩 + 수정 시각 */
.note-tagbar { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 28px; padding: 12px 0 4px; }
.tag-ico { width: 16px; height: 16px; color: var(--muted); flex: none; }
/* 그룹 (v2.8): 태그 줄 앞, 고르거나 새로 입력 */
.group-field { display: inline-flex; align-items: center; gap: 6px; padding-right: 10px; margin-right: 2px; border-right: 1px solid var(--line, var(--border)); }
.group-input { width: 9em; max-width: 40vw; height: 30px; border: 0; border-bottom: 1px dashed var(--border); background: transparent; color: var(--text); font: inherit; font-size: .9rem; outline: none; padding: 0 4px; }
.group-input:focus { border-bottom-color: var(--accent); }
.group-input::placeholder { color: var(--muted); }
.ni-group { display: inline-flex; align-items: center; gap: 3px; margin-right: 8px; color: var(--muted); font-weight: 600; }
.ni-group .mini-ico { width: 12px; height: 12px; }
.group-sel { max-width: 46%; }
.tag-chips { flex: 1; min-width: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.tag-chip { display: inline-flex; align-items: center; gap: 2px; height: 28px; padding: 0 4px 0 10px; border-radius: 99px; background: var(--primary-soft); color: var(--accent); font-size: .86rem; font-weight: 600; }
.tag-x { width: 22px; height: 22px; border: 0; background: transparent; color: inherit; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; cursor: pointer; padding: 0; opacity: .7; }
.tag-x:hover { background: var(--primary-soft-2); opacity: 1; }
.tag-x .ico { width: 14px; height: 14px; }
.tag-input { flex: 1; min-width: 90px; height: 30px; border: 0; background: transparent; color: var(--text); font: inherit; font-size: .9rem; outline: none; padding: 0 4px; }
.note-stamp { flex: none; font-size: .78rem; color: var(--muted); white-space: nowrap; }
.lock-screen { margin: auto; width: min(100%, 380px); padding: 32px 20px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.lock-screen h2 { font-size: 1.15rem; margin: 6px 0 0; word-break: break-all; }
.lock-big { width: 48px; height: 48px; color: var(--accent); }
.lock-form { display: flex; gap: 8px; width: 100%; margin-top: 10px; }
.lock-form .input { flex: 1; min-width: 0; }
.mini-ico.lock { color: var(--muted); }
/* 마크다운 미리보기 (안전한 DOM 렌더링) */
.md-view { flex: 1; min-height: 240px; padding: 2px 0 30px; font-size: calc(1.02rem * var(--note-scale)); line-height: 1.75; overflow-wrap: anywhere; cursor: text; }
.md-view > :first-child { margin-top: 0; }
.md-view h1, .md-view h2, .md-view h3, .md-view h4 { margin: 1.1em 0 .45em; line-height: 1.3; }
.md-view h1 { font-size: 1.5em; } .md-view h2 { font-size: 1.28em; } .md-view h3 { font-size: 1.1em; } .md-view h4, .md-view h5, .md-view h6 { font-size: 1em; }
.md-view p { margin: 0 0 .8em; }
.md-view ul, .md-view ol { margin: 0 0 .8em; padding-left: 1.4em; }
.md-view li.task { list-style: none; margin-left: -1.3em; }
.md-view li.task input { margin-right: 6px; accent-color: var(--primary); vertical-align: -2px; }
.md-view blockquote { margin: 0 0 .8em; padding: 2px 0 2px 14px; border-left: 3px solid var(--border-strong); color: var(--muted); }
.md-view code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .88em; background: var(--surface-2); border-radius: 5px; padding: 1px 5px; }
.md-view pre { background: var(--surface-2); border-radius: 8px; padding: 10px 12px; overflow-x: auto; margin: 0 0 .8em; }
.md-view pre code { background: none; padding: 0; white-space: pre; }
.md-view hr { border: 0; border-top: 1px solid var(--border); margin: 1.2em 0; }
.md-view table { border-collapse: collapse; margin: 0 0 .8em; display: block; overflow-x: auto; }
.md-view th, .md-view td { border: 1px solid var(--border); padding: 4px 10px; }
.md-view a { color: var(--accent); text-decoration: underline; }
.note-link { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }
.note-link:hover { background: var(--primary-soft); border-radius: 3px; }
.note-link::after { content: "↗"; font-size: .75em; margin-left: 1px; text-decoration: none; display: inline-block; }

/* ---------- 파일 (dock: 도구줄 + 큰 목록) ---------- */
.files-page { flex: 1; min-height: 0; display: flex; flex-direction: column; padding: 12px var(--pad) 10px; gap: 8px; }
.files-head { flex: none; display: flex; flex-direction: column; gap: 8px; }
.breadcrumb { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; font-size: .98rem; font-weight: 600; min-height: 28px; }
.breadcrumb .sep { color: var(--muted); font-weight: 400; }
.crumb-up { display: inline-flex; color: var(--text); margin-right: 4px; }
.toolbar { display: flex; flex-wrap: wrap; gap: var(--gap); align-items: center; }
.toolbar .input { flex: 1; min-width: 160px; width: auto; }
.inline-h { margin: 0; font-size: 1.1rem; }
.selbar { flex: none; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 6px 10px; border-radius: 10px; background: var(--primary-soft); border: 1px solid var(--primary-soft-2); }
.selbar strong { color: var(--accent); }
.file-area { position: relative; flex: 1; min-height: 240px; display: flex; flex-direction: column; background: var(--surface); border: 0; border-radius: var(--radius); overflow: hidden; }
.file-area .table-wrap { flex: 1; min-height: 0; }
.drop-overlay { position: absolute; inset: 0; z-index: 5; display: none; align-items: center; justify-content: center; flex-direction: column; gap: 8px; background: color-mix(in srgb, var(--primary) 10%, var(--surface)); border: 2px dashed var(--primary); border-radius: var(--radius); color: var(--accent); font-weight: 700; font-size: 1.05rem; pointer-events: none; }
.drop-overlay .ico { width: 40px; height: 40px; }
.file-area.dragover .drop-overlay { display: flex; }
.empty-drop { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 40px 16px; color: var(--muted); text-align: center; }
.empty-drop > .ico { width: 48px; height: 48px; color: var(--border-strong); }
.files-table td { height: 46px; }
.files-table .col-chk { width: 44px; text-align: center; }
.files-table .col-name { word-break: break-all; }
.files-table .col-size { white-space: nowrap; width: 100px; text-align: right; }
.files-table .col-mtime { white-space: nowrap; width: 150px; }
.files-table .col-act { width: 52px; text-align: right; }
.fcell { display: flex; align-items: center; gap: 10px; min-width: 0; }
.fcell .ico { width: 22px; height: 22px; color: var(--muted); }
.fcell .ico.is-dir { color: var(--accent); }
.fname { color: var(--text); font-weight: 500; }
.fname:hover { color: var(--accent); }
.fsub { display: none; font-size: .78rem; color: var(--muted); }
.ftype { display: none; }
.upload-queue { flex: none; display: flex; flex-direction: column; gap: 6px; max-height: 160px; overflow: auto; }
.upload-queue:empty { display: none; }
.queue-row { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; }
.queue-row.ok .bar-fill { background: var(--ok); }
.queue-row.fail { border-color: var(--danger); color: var(--danger); }
.files-foot { flex: none; display: flex; align-items: center; gap: 12px; font-size: .8rem; color: var(--muted); }
.files-foot .storage-slot { flex: 0 1 380px; min-width: 0; }
.files-foot .storage .bar { margin: 2px 0; }
.files-foot .legend { display: none; }

/* ---------- 손글씨 ---------- */
.drawing-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.drawing-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; transition: border-color .15s, box-shadow .15s; }
.drawing-card:hover { border-color: var(--accent); box-shadow: var(--shadow); }
.drawing-card.pinned { border-color: var(--primary); }
.drawing-card .thumb { display: block; position: relative; aspect-ratio: 4 / 3; min-height: 0; overflow: hidden; background: #fff; border-bottom: 1px solid var(--line); }
/* 페이지 수·그림 크기와 관계없이 카드 높이 동일. 여러 페이지는 첫 페이지(위쪽) 기준으로 보여줌 */
.drawing-card .thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: top center; }
.drawing-card-body { padding: 8px 10px; display: flex; align-items: center; gap: 6px; }
.dc-text { flex: 1; min-width: 0; }
.drawing-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: flex; align-items: center; gap: 4px; }
.card-actions { display: flex; gap: 2px; }

.draw-editor { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.draw-toolbar { flex: none; display: flex; flex-wrap: nowrap; gap: 6px; align-items: center; padding: 6px 8px; background: var(--surface); overflow-x: auto; scrollbar-width: thin; }
.tb-group { display: flex; align-items: center; gap: 4px; flex: none; }
.tb-sep { width: 1px; height: 24px; background: var(--line); flex: none; margin: 0 2px; }
.title-input { width: 200px; min-width: 80px; flex: 0 1 200px; border-color: transparent; background: transparent; font-weight: 600; }
.title-input:hover { border-color: var(--line); }
.title-input:focus { background: var(--surface); }
.title-input::placeholder { color: var(--muted); font-weight: 500; }
.tb-title { min-width: 0; flex: 0 1 auto; }
.ibtn.tool.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.block-range { flex: 1; width: auto; }
.color-input { width: var(--ctl); height: var(--ctl); padding: 3px; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--surface); cursor: pointer; flex: none; }
.swatches { display: flex; gap: 3px; }
.swatch { width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--border-strong); cursor: pointer; padding: 0; transition: transform .1s; flex: none; }
.swatch:hover { transform: scale(1.12); }
.size-input { width: 96px; accent-color: var(--primary); }
.size-label { min-width: 22px; text-align: right; font-size: .82rem; font-variant-numeric: tabular-nums; }
.zoom-label { width: auto !important; min-width: 58px !important; padding: 0 6px !important; font-variant-numeric: tabular-nums; font-size: .84rem !important; }
.canvas-viewport { flex: 1; min-height: 0; position: relative; background: var(--canvas-outside); overflow: hidden; touch-action: none; }
.canvas-viewport canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.canvas-viewport .ink { cursor: crosshair; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.canvas-viewport .ink[data-tool="eraser"] { cursor: cell; }
.canvas-viewport .ink[data-tool="hand"], .canvas-viewport .ink.panning { cursor: grab; }
.canvas-hint { position: absolute; left: 10px; bottom: 8px; font-size: .78rem; color: var(--muted); background: var(--surface); border: 1px solid var(--border); padding: 2px 8px; border-radius: 6px; pointer-events: none; opacity: .92; }

/* ---------- 관리자 ---------- */
.label-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.perm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; margin: 6px 0; }
.setting-row { display: grid; grid-template-columns: 1fr 240px; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.setting-row:last-child { border-bottom: 0; }
.setting-sec h3 { margin: 18px 0 2px; font-size: .95rem; color: var(--accent); }
.table.words td:first-child { width: 48%; word-break: break-word; }
.table.words .input { min-height: 34px; height: 34px; }
.unit-input { display: flex; gap: 6px; align-items: center; }
.unit-input .input { flex: 1; }

/* =========================================================
   태블릿 (768~1023): 메뉴는 Drawer, 목록 폭 축소
   ========================================================= */
@media (max-width: 1023px) {
  body .nav, body.menu-top .nav, body.menu-left .nav, body.menu-left.menu-collapsed .nav {
    position: fixed; left: 0; top: 0; bottom: 0; z-index: 100; height: 100%; width: 260px;
    display: flex; flex-direction: column; gap: 2px; padding: 14px 10px; padding-top: calc(14px + env(safe-area-inset-top));
    border-right: 1px solid var(--border); border-bottom: 0; overflow-y: auto;
    transform: translateX(-105%); transition: transform .22s ease; box-shadow: var(--shadow-lg);
  }
  body .nav.open { transform: none; }
  body.menu-top .nav-foot { display: flex; }
  .nav a { padding: 0 12px; }
  .scrim.show { display: block; position: fixed; inset: 0; background: rgba(0, 0, 0, .35); z-index: 90; }
  .hide-tablet { display: none !important; }
  .swatches { display: none; }
}

/* =========================================================
   모바일 (≤767)
   ========================================================= */
@media (max-width: 767px) {
  :root { --dock-h: 58px; }
  body { font-size: 16px; }
  .hide-mobile { display: none !important; }
  .show-mobile { display: inline-flex !important; }

  /* ── 앱 셸: 상단바 없음 · 문서 스크롤 · 하단 Dock (Safari/Chrome 바와 같은 흰 바탕) ── */
  .topbar, .nav, .scrim { display: none !important; }
  body:not(.focus) .app { height: auto; min-height: 100dvh; display: block; }
  body:not(.focus) .layout { display: block; }
  body:not(.focus) .main { display: block; overflow: visible; min-height: 100dvh; padding: calc(12px + env(safe-area-inset-top)) 12px calc(var(--dock-h) + env(safe-area-inset-bottom) + 24px); }
  body:not(.focus) .main.full { padding-top: 0; padding-left: 0; padding-right: 0; }
  body.detail:not(.focus) .main { padding-bottom: calc(env(safe-area-inset-bottom) + 24px); }
  .dock { display: flex !important; position: fixed; left: 0; right: 0; bottom: 0; z-index: 60; background: var(--surface); padding: 2px 4px env(safe-area-inset-bottom); box-shadow: 0 -1px 0 var(--line); }
  body.detail .dock, body.focus .dock { display: none !important; }
  .dock-item { flex: 1; min-width: 0; height: var(--dock-h); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; border: 0; background: transparent; color: var(--muted); font: inherit; font-size: .7rem; font-weight: 600; text-decoration: none !important; cursor: pointer; padding: 0; }
  .dock-item .ico { width: 24px; height: 24px; }
  .dock-item.active { color: var(--accent); }
  .dock-label { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .dock-avatar { width: 24px; height: 24px; border-radius: 50%; background: var(--primary); color: #fff; font-size: .74rem; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
  body:not(.detail):not(.focus) #toasts { bottom: calc(var(--dock-h) + env(safe-area-inset-bottom) + 12px); }
  .sticky-head { position: sticky; top: 0; z-index: 20; background: var(--surface); padding-top: env(safe-area-inset-top); }

  /* 노트: 목록·편집기 모두 문서 스크롤, 머리줄 1~2줄만 고정 */
  .notes-layout, .note-list-pane, .note-editor-pane, .note-editor { display: block; }
  .note-list { overflow: visible; }
  .editor-toolbar { position: sticky; top: 0; z-index: 20; background: var(--surface); padding: calc(6px + env(safe-area-inset-top)) 10px 6px; }
  .note-scroll { overflow: visible; }
  .note-doc { min-height: 0; }

  /* 파일: 머리줄 고정, 목록은 문서 스크롤 */
  .files-page { display: block; padding: 0 10px; }
  .files-head { position: sticky; top: 0; z-index: 20; background: var(--surface); padding: calc(8px + env(safe-area-inset-top)) 0 8px; }
  .breadcrumb:empty, .breadcrumb:not(:has(a:not(.hide-mobile))) { display: none; }
  .files-toolbar .input { min-width: 0; }
  .file-area { display: block; min-height: 50vh; overflow: visible; }
  .file-area .table-wrap { overflow: visible; }
  .table th { position: static; }
  .user-btn .uname { display: none; }
  .input { font-size: 16px; }            /* iOS 확대 방지 */
  .ibtn.with-label { width: var(--ctl); padding: 0; }
  .ibtn.with-label .lbl { display: none; }
  .search-box input { font-size: 16px; height: 48px; }
  .search-kbd { display: none; }
  .home-hero { padding-top: 6px; }
  .home-hero h1 { font-size: 1.2rem; }

  .notes-layout { grid-template-columns: minmax(0, 1fr); }
  .notes-layout.show-editor .note-list-pane { display: none; }
  .notes-layout:not(.show-editor) .note-editor-pane { display: none; }
  .back-btn { display: inline-flex; }
  .note-doc { padding: 4px 16px 20px; }
  .note-editable .nt-title, .note-editable.is-empty::before, .md-view .md-title { font-size: calc(1.45rem * var(--note-scale)); }
  .note-editable, .md-view { font-size: calc(1.04rem * var(--note-scale)); }
  .note-list { padding: 0 4px 12px; }
  .note-item-title { font-size: 1.02rem; }
  .note-item-snippet { font-size: .9rem; }

  .files-page { padding: 8px 10px; }
  .files-table .col-mtime, .files-table .col-size { display: none; }
  .fsub { display: block; }
  .files-foot .storage-slot { flex: 1; }
  .files-foot > span:first-child { display: none; }

  .kv { grid-template-columns: 110px 1fr; }
  .setting-row { grid-template-columns: 1fr; }
  /* iPhone Safari(iOS 26)는 상태표시줄 아래 일정 높이를 흐림 처리 → 도구 막대를 그 아래로 (v2.7) */
  .draw-toolbar { --ctl: 40px; gap: 4px; padding: 4px 6px; padding-top: calc(18px + env(safe-area-inset-top)); }
  .draw-toolbar .tb-group { gap: 4px; }
  .draw-toolbar .tb-sep { display: none; }
  /* 모바일 그림판: 제목은 도구 아래 한 줄 (회색 '제목 입력' 안내) */
  .draw-toolbar { flex-wrap: wrap; row-gap: 2px; }
  .draw-toolbar .tb-title { display: contents; }
  .draw-toolbar .title-input { order: 99; flex: 1 1 100%; width: 100%; height: 34px; min-height: 34px; padding: 0 8px; font-size: 16px; }
  .login-card { border: 0; box-shadow: none; padding: 20px 6px; }
  .modal-actions { flex-direction: column-reverse; }
  .modal-actions .btn { width: 100%; }
  .drawing-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
}
