:root {
  --ink: #1f2b33;
  --muted: #65727c;
  --line: #e3e7ea;
  --line-strong: #cfd6da;
  --bg: #ffffff;
  --panel: #f5f6f7;
  --surface: #ffffff;
  --accent: #0085c3;
  --accent-dark: #006d9f;
  --accent-soft: #e6f4fb;
  --deep: #142747;
  --danger: #b3261e;
  --danger-soft: #fdecea;
  --ok: #1d7a58;
  --ok-soft: #e4f5ee;
  --warn: #8a5a00;
  --warn-soft: #fbf1dc;
  --radius: 4px;
  --rail: 72px;
  --nav: 216px;
  --row-line: #eef1f2;
}
[data-theme="dark"] {
  --ink: #e4e8eb;
  --muted: #9aa7b1;
  --line: #2d3741;
  --line-strong: #3b4752;
  --bg: #161b20;
  --panel: #20272e;
  --surface: #1b2127;
  --accent: #2ea7df;
  --accent-dark: #5fc0ec;
  --accent-soft: #1b3343;
  --ok: #5cc79b;
  --ok-soft: #173a2c;
  --danger: #ef8177;
  --danger-soft: #42201e;
  --warn: #e0b45c;
  --warn-soft: #3d3118;
  --row-line: #262f38;
}
[data-theme="dark"] .viewer-body { background: #101417; }
[data-theme="dark"] .rail-link, [data-theme="dark"] .admin-nav a.nav-link { color: #c6ced4; }
[data-theme="dark"] .badge.mute { background: #2d3741; }
[data-theme="dark"] .terms-body { background: #20272e; }
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 14px/1.45 "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", Arial, "Malgun Gothic", sans-serif;
}
a { color: var(--accent-dark); }
h1 { font-size: 20px; line-height: 1.3; margin: 0 0 4px; font-weight: 600; }
h2 { font-size: 15px; margin: 0 0 12px; font-weight: 600; }
p { margin: 0 0 12px; }
code { font: 13px Consolas, Menlo, monospace; overflow-wrap: anywhere; }
svg.icon { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
[hidden] { display: none !important; }

/* 앱 뼈대 */
.app { display: flex; min-height: 100vh; }
.app-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.rail { width: var(--rail); flex: none; border-right: 1px solid var(--line); background: var(--bg); display: flex; flex-direction: column; align-items: center; padding: 14px 0; gap: 6px; position: sticky; top: 0; height: 100vh; }
.rail-badge { width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; margin-bottom: 14px; }
.rail-badge img { width: 44px; height: auto; display: block; }
.rail-link { width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; color: #4d5a63; border-radius: 4px; }
.rail-link:hover { background: var(--panel); }
.rail-link.active { color: var(--accent); background: var(--accent-soft); }

.topbar { min-height: 64px; flex: none; display: flex; align-items: center; gap: 14px; padding: 0 24px; border-bottom: 1px solid var(--line); background: var(--bg); }
.topbar a { text-decoration: none; }
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 16px; color: var(--muted); min-width: 0; overflow-wrap: anywhere; }
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--ink); }
.crumbs .sep { color: #9aa5ad; }
.crumbs .here { color: var(--ink); font-weight: 600; }
.spacer { flex: 1; }
.who { display: flex; align-items: center; gap: 8px; color: var(--ink); font-size: 13px; white-space: nowrap; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: #e8e8f5; color: #4a4a78; display: inline-flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 600; }
.link-button { background: none; border: 1px solid var(--line-strong); color: var(--ink); padding: 5px 10px; border-radius: var(--radius); font: inherit; font-size: 13px; cursor: pointer; white-space: nowrap; }
.link-button:hover { background: var(--panel); }
.inline-form { display: inline; margin: 0; }

/* 문서 화면 */
.doc-toolbar { display: flex; justify-content: flex-end; gap: 10px; padding: 20px 24px 12px; }
.search-box { position: relative; width: min(460px, 100%); }
.search-box > svg { position: absolute; left: 12px; top: 10px; width: 18px; height: 18px; color: var(--muted); }
.search-box input[type=text] { padding: 8px 12px 8px 38px; }
.doc-layout { display: flex; gap: 24px; padding: 0 24px 24px; align-items: flex-start; min-width: 0; }
.tree-panel { width: 320px; flex: none; }
.panel-head { background: var(--panel); padding: 11px 16px; font-weight: 600; border-radius: var(--radius); margin-bottom: 6px; }
.quick { list-style: none; margin: 0 0 8px; padding: 0; }
.quick a { display: flex; align-items: center; gap: 10px; padding: 8px 16px; color: var(--ink); text-decoration: none; border-radius: var(--radius); }
.quick a:hover { background: var(--panel); }
.quick a.active { background: var(--accent-soft); }
.tree { border-top: 1px solid var(--line); padding-top: 8px; max-height: calc(100vh - 300px); overflow: auto; }
.tree-root { display: flex; align-items: center; gap: 10px; padding: 7px 10px; color: var(--ink); text-decoration: none; border-radius: var(--radius); font-weight: 600; }
.tree-root:hover { background: var(--panel); }
.tree-root.active { background: var(--accent-soft); }
.project-mark img { width: 24px; height: auto; display: block; }
.project-mark { width: 24px; height: 24px; color: #fff; font-size: 11px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; flex: none; }
.tree details > summary { list-style: none; }
.tree details > summary::-webkit-details-marker { display: none; }
.tree-row { display: flex; align-items: center; gap: 6px; padding: 6px 8px; border-radius: var(--radius); cursor: pointer; min-width: 0; }
.tree-row:hover { background: var(--panel); }
.tree-row.active { background: var(--accent-soft); }
.tree-row a { display: flex; align-items: center; gap: 8px; color: var(--ink); text-decoration: none; min-width: 0; flex: 1; }
.tree-row .label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tree-index { color: var(--muted); font-size: 12px; flex: none; }
.chevron { width: 16px !important; height: 16px !important; flex: none; color: var(--muted); transition: transform .12s; }
details[open] > summary .chevron { transform: rotate(90deg); }
.no-chevron { width: 16px; flex: none; }
.tree-children { margin-left: 14px; }
.folder-icon { color: var(--accent); }

.doc-main { flex: 1; min-width: 0; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 13px; color: var(--ink); font-weight: 600; padding: 11px 14px; background: var(--panel); white-space: nowrap; }
th:first-child { border-radius: var(--radius) 0 0 var(--radius); }
th:last-child { border-radius: 0 var(--radius) var(--radius) 0; }
td { padding: 11px 14px; border-bottom: 1px solid var(--row-line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }
.wrap-any { overflow-wrap: anywhere; }
.subtle { color: var(--muted); font-size: 13px; }
.doc-table tbody tr:hover { background: #fafbfb; }
.row-index { color: var(--ink); white-space: nowrap; width: 72px; font-variant-numeric: tabular-nums; }
.row-link { display: flex; align-items: center; gap: 12px; color: var(--ink); text-decoration: none; min-width: 0; }
.row-link:hover .name { color: var(--accent-dark); text-decoration: underline; }
.row-link .name { overflow-wrap: anywhere; }
.pdf-icon { color: #d6453d; }
.row-size { color: var(--muted); font-size: 12px; white-space: nowrap; line-height: 1.35; }
.row-size span { display: block; }
.back-row a { display: inline-flex; align-items: center; gap: 8px; color: var(--ink); text-decoration: none; }
.back-row svg { transform: rotate(180deg); width: 14px; height: 14px; }
.empty { color: var(--muted); padding: 40px 8px; text-align: center; }

.doc-page { width: 100%; }
.doc-page > .alert { margin: 16px 24px 0; }
.doc-filter { display: flex; flex: 1; justify-content: flex-end; flex-wrap: wrap; gap: 10px; align-items: center; min-width: 0; }
.doc-filter select { width: 130px; }
.doc-toolbar > a.secondary { white-space: nowrap; }
.tree-admin { border-top: 0; padding-top: 0; max-height: calc(100vh - 150px); }
.row-path { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }

.doc-toolbar { justify-content: flex-start; align-items: center; }
.doc-wrap { overflow: visible; }
.doc-table th { padding: 14px; }
.doc-table td { border-bottom: 0; padding: 10px 14px; }
.doc-table tbody tr:hover { background: var(--panel); }
.row-icon { width: 44px; padding-right: 0 !important; }
.row-actions { width: 44px; text-align: right; }
.hide-size .c-size, .hide-added .c-added, .hide-viewed .c-viewed, .hide-notes .c-notes { display: none; }
.icon-summary { list-style: none; cursor: pointer; display: inline-flex; padding: 4px; border-radius: 4px; color: var(--muted); }
.icon-summary::-webkit-details-marker { display: none; }
.icon-summary:hover { background: var(--line); }
summary.secondary { display: inline-block; padding: 7px 12px; background: var(--surface); color: var(--ink); border: 1px solid var(--line-strong); border-radius: var(--radius); list-style: none; cursor: pointer; white-space: nowrap; }
summary.secondary:hover { background: var(--panel); }
summary.secondary::-webkit-details-marker { display: none; }
.menu-wrap { position: relative; display: inline-block; }
.menu { position: absolute; right: 0; top: 100%; z-index: 20; min-width: 220px; background: var(--surface); border: 1px solid var(--line); border-radius: 4px; box-shadow: 0 6px 20px rgba(0,0,0,.16); padding: 6px 0; text-align: left; font-weight: 400; }
.menu a, .menu button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 14px; background: none; border: 0; color: var(--ink); font: inherit; text-align: left; text-decoration: none; cursor: pointer; }
.menu a:hover, .menu button:hover { background: var(--panel); }
.menu form { margin: 0; }
.menu svg.icon { width: 18px; height: 18px; color: var(--muted); }
.menu-form { padding: 12px 14px; min-width: 240px; }
.menu-form .check { margin-bottom: 8px; }
.menu-empty { display: block; padding: 8px 14px; }
.panel-head { display: flex; align-items: center; gap: 4px; }
.panel-head .icon-button { color: var(--muted); background: none; border: 0; padding: 2px; cursor: pointer; display: inline-flex; border-radius: 4px; }
.panel-head .icon-button:hover { background: var(--line); }
.panel-head svg.icon { width: 16px; height: 16px; }
.doc-layout.panel-hidden .tree-panel { display: none; }
.search-box .filter-menu { position: absolute; right: 6px; top: 6px; }
.search-box input[type=text] { padding-right: 40px; }
.star-on { color: #e5a100; fill: #e5a100; width: 14px !important; height: 14px !important; }
.note-count { display: inline-flex; gap: 4px; align-items: center; color: var(--muted); text-decoration: none; font-size: 12px; }
.note-count svg.icon { width: 14px; height: 14px; }
.note-body { white-space: pre-wrap; }
.folder-icon { fill: var(--accent-soft); }
.with-icon { display: inline-flex !important; align-items: center; gap: 8px; }
.center { text-align: center; margin-top: 8px; box-sizing: border-box; }
.topbar .icon-button { color: var(--muted); background: none; border: 0; padding: 6px; border-radius: 4px; cursor: pointer; display: inline-flex; }
.topbar .icon-button:hover { background: var(--panel); }
.tree-row { padding: 8px; }
.quick a { padding: 9px 16px; }
.readonly { padding: 8px 0; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; }
.tabs a { padding: 10px 14px; color: var(--muted); text-decoration: none; white-space: nowrap; border-bottom: 2px solid transparent; }
.tabs a.active { color: var(--ink); border-color: var(--accent); font-weight: 600; }
.bar { display: block; width: 100%; height: 12px; border-radius: 3px; }
.bar-track { fill: var(--line); }
.bar-fill { fill: var(--accent); }
.bar-active { fill: #4fb68f; }
.bar-invited { fill: #9db2f2; }
.bar-disabled { fill: #aab3ba; }
.legend { display: flex; flex-wrap: wrap; gap: 16px; margin-bottom: 10px; font-size: 13px; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; }
.bar-active-dot { background: #4fb68f; }
.bar-invited-dot { background: #9db2f2; }
.bar-disabled-dot { background: #aab3ba; }
.group-bar { display: grid; grid-template-columns: minmax(120px, 240px) 1fr 130px; gap: 14px; align-items: center; padding: 7px 0; }
.top-files { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; }
.top-file { display: flex; gap: 10px; padding: 12px; border: 1px solid var(--line); border-radius: 4px; color: var(--ink); text-decoration: none; }
.top-file:hover { background: var(--panel); }
.top-file.active { border-color: var(--accent); background: var(--accent-soft); }
.top-file b { display: block; font-weight: 600; }
.notes-panel { width: 300px; flex: none; background: var(--bg); border-left: 1px solid var(--line); padding: 16px; overflow-y: auto; }
.note-item { border-top: 1px solid var(--line); margin-top: 12px; padding-top: 10px; }
.note-item .link-button { margin-top: 6px; padding: 3px 8px; }
.pages.fit-width { max-width: none; }
.pages.fit-height .page-image { width: auto; height: calc(100vh - 100px); max-width: 100%; }
.pages.two-up { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; max-width: none; }

.qa-head { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 8px; }
.qa-answer { background: var(--panel); border-radius: 4px; padding: 12px; margin-top: 8px; }
.top-gap { margin-top: 8px; }
.progress-row { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.filter-left { justify-content: flex-start; }
.org-users > summary { display: flex; align-items: center; gap: 6px; list-style: none; cursor: pointer; }
.org-users > summary::-webkit-details-marker { display: none; }
.member-list { list-style: none; margin: 8px 0 0 22px; padding: 0; }
.member-list li { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 5px 0; }
.row-snippet { color: var(--muted); font-size: 12px; margin-top: 4px; }
.row-hits { font-size: 12px; margin-top: 2px; color: var(--muted); }
.row-hits a { margin-left: 6px; }
.viewer-search input[type=text] { width: 200px; padding: 5px 10px; }
.hide-labels .c-labels { display: none; }

.admin-table { overflow: visible; }
.mobile-only { display: none; }
.stack-buttons { display: flex; flex-direction: column; gap: 6px; }
.menu .stack-buttons button { justify-content: center; text-align: center; }
.menu .stack-buttons button.secondary { border: 1px solid var(--line-strong); padding: 7px 12px; }
.menu .stack-buttons button.danger { border: 1px solid var(--danger); color: var(--danger); padding: 7px 12px; }

/* 일반 내용 */
.page { max-width: 1240px; width: 100%; padding: 24px; }
.reading { max-width: 860px; width: 100%; padding: 24px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin-bottom: 16px; }
.page-head { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
label { display: block; font-size: 13px; font-weight: 600; margin: 0 0 4px; }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=number], select, textarea {
  width: 100%; padding: 8px 10px; font: inherit; color: inherit; background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius); min-width: 0;
}
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible, a:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
textarea { min-height: 200px; }
textarea.short { min-height: 96px; }
.field { margin-bottom: 14px; }
.check { display: flex; gap: 8px; align-items: flex-start; font-weight: 400; font-size: 14px; }
.check input { margin-top: 3px; accent-color: var(--accent); }
.code-input { letter-spacing: 4px; font-size: 18px !important; text-align: center; }
button.primary, a.primary { display: inline-block; padding: 8px 16px; background: var(--accent); color: #fff; border: 0; border-radius: var(--radius); font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; }
button.primary:hover, a.primary:hover { background: var(--accent-dark); }
button.secondary, a.secondary { display: inline-block; padding: 7px 12px; background: var(--surface); color: var(--ink); border: 1px solid var(--line-strong); border-radius: var(--radius); font: inherit; cursor: pointer; text-decoration: none; }
button.secondary:hover, a.secondary:hover { background: var(--panel); }
button.danger { padding: 6px 12px; background: var(--surface); color: var(--danger); border: 1px solid var(--danger); border-radius: var(--radius); font: inherit; cursor: pointer; }
button.danger:hover { background: var(--danger-soft); }
.full { width: 100%; }
.alert { padding: 10px 12px; border-radius: var(--radius); margin-bottom: 14px; }
.alert.error { background: var(--danger-soft); color: var(--danger); }
.alert.ok { background: var(--ok-soft); color: var(--ok); }
.alert.info { background: var(--accent-soft); color: #0b5479; }
.badge { display: inline-block; padding: 2px 10px; border-radius: 12px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.bad { background: var(--danger-soft); color: var(--danger); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.mute { background: #e9edf1; color: var(--muted); }
.grid-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(190px, 100%), 1fr)); gap: 12px; align-items: end; }
.grid-form .field { margin: 0; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.stat b { display: block; font-size: 24px; font-weight: 600; font-variant-numeric: tabular-nums; }
.stat span { font-size: 13px; color: var(--muted); }
.pager { display: flex; gap: 8px; margin-top: 12px; }
.section-gap { margin-top: 20px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
td.wrap-any { min-width: 150px; }
.terms-body { white-space: pre-wrap; max-height: 46vh; overflow-y: auto; padding: 14px; border: 1px solid var(--line); border-radius: var(--radius); background: #fbfcfc; margin-bottom: 14px; }
.qr { text-align: center; margin: 12px 0; }
.qr svg { max-width: 200px; width: 100%; height: auto; background: #fff; }
.secret { display: block; padding: 8px; background: var(--panel); border-radius: var(--radius); text-align: center; margin-bottom: 14px; }

/* 로그인 화면 */
.auth-body {
  min-height: 100vh; background-color: var(--deep); background-attachment: fixed;
  background-image:
    radial-gradient(circle at -6% 108%, #1c3359 0 36vw, transparent 36.1vw),
    radial-gradient(circle at 108% -12%, #1a3054 0 32vw, transparent 32.1vw),
    radial-gradient(circle at 80% 124%, #182d4f 0 24vw, transparent 24.1vw);
}
.auth-top { display: flex; justify-content: center; padding: 8vh 16px 22px; }
.auth-brand { display: block; line-height: 0; }
.auth-brand img { width: 270px; max-width: 76vw; height: auto; }
.auth-body .inline-form { position: fixed; left: 24px; bottom: 20px; }
.auth-body .link-button { color: #fff; border-color: rgba(255,255,255,.4); }
.auth-body .link-button:hover { background: rgba(255,255,255,.1); }
.narrow { max-width: 440px; width: 100%; margin: 0 auto 72px; padding: 0 16px; }
.auth-body .card { border: 0; border-radius: 6px; padding: 32px; box-shadow: 0 10px 34px rgba(0,0,0,.28); }
.auth-body .card h1 { margin-bottom: 8px; }
.auth-note { color: rgba(255,255,255,.72) !important; margin-top: 14px; text-align: center; }

/* 관리 화면 */
.admin-nav { width: var(--nav); flex: none; border-right: 1px solid var(--line); padding: 14px 10px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.admin-brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 16px; color: var(--ink); font-weight: 600; text-decoration: none; }
.brand-chip { width: 36px; height: 36px; display: inline-flex; align-items: center; justify-content: center; flex: none; }
.brand-chip img { width: 36px; height: auto; display: block; }
.admin-nav a.nav-link { display: flex; align-items: center; gap: 12px; padding: 9px 10px; color: #3f4b54; text-decoration: none; border-radius: var(--radius); }
.admin-nav a.nav-link:hover { background: var(--panel); }
.admin-nav a.nav-link.active { background: var(--accent-soft); color: var(--accent-dark); font-weight: 600; }
.split { display: flex; gap: 24px; align-items: flex-start; }
.split-side { width: 280px; flex: none; }
.split-main { flex: 1; min-width: 0; }
.group-list { list-style: none; margin: 0; padding: 0; }
.group-list a { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 9px 12px; color: var(--ink); text-decoration: none; border-radius: var(--radius); }
.group-list a:hover { background: var(--panel); }
.group-list a.active { background: var(--accent-soft); font-weight: 600; }
.depth-1 { padding-left: 32px !important; } .depth-2 { padding-left: 50px !important; } .depth-3 { padding-left: 68px !important; }
.depth-4 { padding-left: 86px !important; } .depth-5 { padding-left: 104px !important; } .depth-6 { padding-left: 122px !important; }
.grant-form { display: flex; gap: 6px; align-items: center; justify-content: flex-end; }
.grant-form input[type=date] { width: 150px; padding: 5px 8px; }
.grant-form button { padding: 5px 10px; }

/* 뷰어 */
.viewer-body { background: #eef0f2; overflow: hidden; }
.viewer-bar { height: 56px; display: flex; align-items: center; gap: 14px; padding: 0 18px; background: var(--bg); border-bottom: 1px solid var(--line); }
.viewer-bar a, .icon-button { color: #4d5a63; background: none; border: 0; padding: 6px; border-radius: var(--radius); cursor: pointer; display: inline-flex; }
.viewer-bar a:hover, .icon-button:hover { background: var(--panel); }
.viewer-title { display: flex; align-items: center; gap: 8px; min-width: 0; font-weight: 600; }
.viewer-title .text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.viewer-status { padding: 8px 16px; background: var(--warn-soft); color: var(--warn); }
.viewer-body-grid { display: flex; height: calc(100vh - 56px); }
.thumbs { width: 196px; flex: none; background: var(--bg); border-right: 1px solid var(--line); overflow-y: auto; padding: 14px; position: relative; }
.thumb { display: block; margin: 0 auto 12px; border: 2px solid var(--line); border-radius: 3px; cursor: pointer; background: #fff; padding: 0; width: 132px; }
.thumb:hover { border-color: var(--line-strong); }
.thumb.active { border-color: var(--accent); }
.thumb img { display: block; width: 100%; height: auto; aspect-ratio: auto 210 / 297; }
.thumb-number { display: block; text-align: right; font-size: 11px; color: var(--muted); padding: 2px 4px; }
.page-scroll { flex: 1; min-width: 0; overflow: auto; }
.pages { margin: 0 auto; padding: 16px 12px 88px; max-width: 900px; }
.pages.zoom-1 { max-width: 620px; }
.pages.zoom-3 { max-width: 1200px; }
.pages.zoom-4 { max-width: 1600px; }
.page-image { display: block; width: 100%; height: auto; aspect-ratio: auto 210 / 297; margin: 0 auto 14px; background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,.15); user-select: none; -webkit-user-drag: none; }
.page-image.page-failed { min-height: 240px; outline: 2px dashed #e0b45c; outline-offset: -8px; }
.pages.rotate-90 .page-image { transform: rotate(90deg); margin: 18% auto; }
.pages.rotate-180 .page-image { transform: rotate(180deg); }
.pages.rotate-270 .page-image { transform: rotate(270deg); margin: 18% auto; }
.viewer-tools { position: fixed; bottom: 18px; left: calc(50% + 98px); transform: translateX(-50%); display: flex; align-items: center; gap: 4px; background: #3c4247; color: #fff; padding: 5px 8px; border-radius: 6px; z-index: 5; }
.viewer-tools button { background: none; color: #fff; border: 0; border-radius: 4px; width: 32px; height: 30px; font: inherit; font-size: 16px; cursor: pointer; }
.viewer-tools button:hover { background: #565c62; }
.page-jump { display: flex; align-items: center; gap: 6px; margin: 0 6px 0 2px; }
.page-jump label { margin: 0; font-weight: 400; font-size: 13px; color: #fff; }
.page-jump input { width: 62px; padding: 2px 6px; background: #54595e; color: #fff; border: 0; border-radius: 3px; text-align: center; font: inherit; }
.page-jump span { font-size: 13px; white-space: nowrap; }
.tools-sep { width: 1px; height: 20px; background: #6b7176; margin: 0 4px; }

@media print { .pages, .viewer-bar, .thumbs, .viewer-tools, .viewer-status { display: none; } }

/* 태블릿 이하 */
@media (max-width: 960px) {
  .tree-panel { display: none; }
  .admin-nav { width: 62px; padding: 14px 6px; }
  .admin-nav .nav-text, .admin-brand .nav-text { display: none; }
  .admin-nav a.nav-link { justify-content: center; }
  .admin-brand { justify-content: center; padding: 4px 0 16px; }
  .split { flex-direction: column; }
  .split-side, .split-main { width: 100%; }
}
/* 휴대폰 */
@media (max-width: 600px) {
  .app { flex-direction: column; }
  .rail { flex-direction: row; width: 100%; height: 52px; position: static; padding: 6px 12px; border-right: 0; border-bottom: 1px solid var(--line); }
  .rail-badge { margin: 0 8px 0 0; width: 36px; height: 36px; }
  .rail-link { width: 40px; height: 40px; }
  .admin-nav { width: 100%; height: auto; position: static; display: flex; overflow-x: auto; gap: 2px; padding: 6px 8px; border-right: 0; border-bottom: 1px solid var(--line); }
  .admin-brand { padding: 4px 8px; flex: none; }
  .admin-nav a.nav-link { flex: none; padding: 8px; }
  .topbar { min-height: 52px; flex-wrap: wrap; padding: 8px 16px; gap: 8px; }
  .crumbs { font-size: 14px; flex: 1 1 100%; }
  .topbar .spacer { display: block; }
  .who .name-text { display: none; }
  .doc-toolbar { padding: 12px 16px 8px; flex-wrap: wrap; }
  .doc-filter { flex-basis: 100%; }
  .doc-filter .search-box { flex-basis: 100%; }
  .doc-layout { padding: 0 16px 16px; }
  .col-added, .c-viewed, .c-notes, .c-labels { display: none; }
  .mobile-only { display: block !important; }
  .admin-table th:nth-child(2), .admin-table td:nth-child(2), .admin-table th:nth-child(4), .admin-table td:nth-child(4), .admin-table th:nth-child(5), .admin-table td:nth-child(5) { display: none; }
  .admin-table a.secondary { padding: 5px 8px; font-size: 12px; }
  .viewer-search { display: none; }
  .row-icon { width: 30px; padding: 9px 0 9px 4px !important; }
  .group-bar { grid-template-columns: 1fr; gap: 4px; }
  .notes-panel { position: fixed; inset: 50px 0 0 auto; z-index: 6; width: min(300px, 90vw); }
  th, td { padding: 9px 8px; }
  .row-index { width: 54px; font-size: 12px; }
  .page, .reading { padding: 16px; }
  .card { padding: 16px; }
  .thumbs, #toggle-thumbs { display: none; }
  .viewer-tools { left: 50%; bottom: 10px; }
  .viewer-bar { padding: 0 10px; height: 50px; }
  .viewer-body-grid { height: calc(100vh - 50px); }
  .auth-top { padding: 28px 16px 16px; }
  .auth-body .card { padding: 22px; }
  .auth-body .inline-form { position: static; display: block; text-align: center; margin-top: 8px; }
  .grant-form { flex-wrap: wrap; justify-content: flex-start; }
}
