:root {
  --bg: #F6F7F9;
  --surface: #FFFFFF;
  --ink: #16181D;
  --ink-2: #3A404B;
  --muted: #5B6270;
  --line: #E3E6EB;
  --line-2: #CDD2DA;
  --row: #EEF0F3;
  --accent: #2557D6;
  --accent-ink: #FFFFFF;
  --accent-soft: #E8EDF8;
  --hero: #1F3A8A;
  --warn-bg: #FFF7E6;
  --warn-line: #F3DDB0;
  --warn-ink: #6B4A0E;
  --danger: #B42318;
  --ok: #1E7A43;
  --radius: 12px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Noto Sans KR', system-ui, -apple-system, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  word-break: keep-all;
  overflow-wrap: anywhere;
}
[hidden] { display: none !important; }
h1, h2, h3, p { margin: 0; }
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); font-size: 14px; }
.body-sm { font-size: 14px; }
.stack-6 { display: flex; flex-direction: column; gap: 6px; }
.stack-8 { display: flex; flex-direction: column; gap: 8px; }
.stack-10 { display: flex; flex-direction: column; gap: 10px; }
.stack-12 { display: flex; flex-direction: column; gap: 12px; }
.row-between { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; }

label { font-size: 14px; font-weight: 500; }
input, select, button { font: inherit; color: inherit; }
input:not([type=file]):not([type=search]):not([type=checkbox]):not([type=radio]), select {
  height: 48px; padding: 0 14px; border: 1px solid var(--line-2); border-radius: 10px;
  background: var(--surface); font-size: 16px; width: 100%;
}
input[type=file] { font-size: 14px; padding: 10px; border: 1px dashed var(--line-2); border-radius: 10px; background: var(--bg); width: 100%; }
input:focus-visible, select:focus-visible, button:focus-visible, a:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px; padding: 0 16px; border-radius: 10px; border: 1px solid transparent;
  font-size: 14px; font-weight: 700; cursor: pointer; text-decoration: none; white-space: nowrap;
}
.btn:disabled { opacity: .55; cursor: default; }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-dark { background: var(--ink); color: #fff; }
.btn-outline { background: var(--surface); border-color: var(--line-2); color: var(--ink); font-weight: 500; }
.btn-danger { background: var(--surface); border-color: #F1C4BF; color: var(--danger); font-weight: 500; }
.btn-block { width: 100%; height: 48px; font-size: 15px; }
.btn-sm { min-height: 40px; padding: 0 12px; font-size: 13px; }
.link { background: none; border: 0; padding: 10px 2px; color: var(--ink-2); font-size: 14px; text-decoration: underline; cursor: pointer; }
.link-strong { color: var(--accent); font-weight: 700; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; }
.pad { padding: 20px; }
.msg { font-size: 14px; padding: 10px 12px; border-radius: 10px; background: #FDECEA; color: var(--danger); }
.msg.ok { background: #E7F5EC; color: var(--ok); }
.hint { font-size: 14px; color: var(--muted); text-align: center; }

.boot { min-height: 100vh; display: flex; align-items: center; justify-content: center; color: var(--muted); }

/* ---------- 인증 ---------- */
.auth { min-height: 100vh; min-height: 100dvh; display: flex; flex-wrap: wrap; }
.auth-hero {
  flex: 1 1 380px; background: var(--hero); color: #fff;
  padding: clamp(28px, 5vw, 72px) clamp(20px, 5vw, 72px);
  display: flex; flex-direction: column; justify-content: space-between; gap: 32px;
}
.auth-hero h2 { font-size: clamp(24px, 3.4vw, 42px); line-height: 1.3; }
.auth-hero-body { display: flex; flex-direction: column; gap: 20px; }
.checks { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 10px; color: rgba(255,255,255,.9); font-size: 15px; }
.checks li { padding-left: 26px; position: relative; }
.checks li::before { content: ''; position: absolute; left: 2px; top: 5px; width: 12px; height: 7px; border-left: 2.4px solid #fff; border-bottom: 2.4px solid #fff; transform: rotate(-45deg); }
.auth-main { flex: 1 1 420px; display: flex; align-items: center; justify-content: center; padding: clamp(24px, 5vw, 72px) 16px; }
.auth-card { width: 100%; max-width: 420px; padding: clamp(22px, 4vw, 36px); display: flex; flex-direction: column; gap: 22px; }
.auth-card h1 { font-size: 26px; }
.code-input { text-align: center; font-size: 26px !important; letter-spacing: 10px; font-weight: 700; height: 60px !important; }

.brand { display: flex; align-items: center; gap: 10px; font-size: 16px; font-weight: 700; min-width: 0; }
.brand-mark { width: 36px; height: 36px; border-radius: 10px; background: rgba(255,255,255,.16); display: flex; align-items: center; justify-content: center; color: #fff; }
.brand-mark-solid { background: var(--accent); }

/* ---------- 승인 대기 ---------- */
.pending { min-height: 100vh; min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: 24px 16px; }
.pending-card { max-width: 440px; width: 100%; padding: 32px 24px; display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center; }
.pending-card h1 { font-size: 22px; }
.pending-icon { width: 56px; height: 56px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: flex; align-items: center; justify-content: center; }
.pending-icon svg { width: 28px; height: 28px; }

/* ---------- 자료실 ---------- */
.container { max-width: 1200px; margin: 0 auto; padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); }
@media (min-width: 720px) { .container { padding-left: 40px; padding-right: 40px; } }

.topbar { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.topbar-inner { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 60px; padding-top: 8px; padding-bottom: 8px; }
.user { display: flex; align-items: center; gap: 8px; min-width: 0; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-size: 13px; font-weight: 700; display: flex; align-items: center; justify-content: center; flex: none; }
.user-name { font-size: 14px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 140px; }
@media (max-width: 480px) {
  .user-name { display: none; }
  .js-logout span { display: none; }
  .js-logout { padding: 0 10px; }
}

.page { padding-top: clamp(20px, 3vw, 36px); padding-bottom: 56px; display: flex; flex-direction: column; gap: 24px; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; }
.page-title { font-size: clamp(24px, 3vw, 32px); }
.search { flex: 0 1 360px; width: 100%; height: 48px; padding: 0 14px; border: 1px solid var(--line-2); border-radius: 12px; background: var(--surface); display: flex; align-items: center; gap: 10px; color: var(--muted); font-weight: 400; }
.search input { flex: 1; min-width: 0; height: 100%; border: 0; outline: none; background: transparent; font-size: 16px; color: var(--ink); }
.search:focus-within { outline: 2px solid var(--accent); outline-offset: 1px; }
@media (max-width: 719px) { .search { flex-basis: 100%; } }

.layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 24px; align-items: start; }
.cats { display: flex; flex-direction: column; gap: 4px; position: sticky; top: 84px; }
.cat { min-height: 44px; padding: 0 14px; border-radius: 10px; border: 0; background: transparent; color: var(--ink-2); font-size: 14px; text-align: left; display: flex; align-items: center; justify-content: space-between; gap: 8px; cursor: pointer; }
.cat:hover { background: #EDEFF3; }
.cat[aria-pressed=true] { background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.cat .n { font-size: 12px; color: var(--muted); font-weight: 400; }
@media (max-width: 899px) {
  .layout { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .cats { position: static; flex-direction: row; overflow-x: auto; gap: 8px; margin: 0 -16px; padding: 0 16px 4px; scrollbar-width: none; }
  .cats::-webkit-scrollbar { display: none; }
  .cat { flex: none; border: 1px solid var(--line); background: var(--surface); border-radius: 22px; }
  .cat[aria-pressed=true] { border-color: transparent; }
}

.content { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.notice { padding: 12px 14px; border-radius: 12px; background: var(--warn-bg); border: 1px solid var(--warn-line); color: var(--warn-ink); font-size: 13px; display: flex; gap: 10px; align-items: flex-start; }
.notice svg { width: 16px; height: 16px; margin-top: 2px; }

.list { overflow: hidden; }
.list-head { padding: 12px 16px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; border-bottom: 1px solid var(--line); }
.list-head h2 { font-size: 15px; }
.sort { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); font-weight: 400; }
.sort select { height: 36px; width: auto; padding: 0 8px; font-size: 13px; border-radius: 8px; }
.empty { padding: 40px 16px; text-align: center; color: var(--muted); font-size: 14px; }

.file { padding: 14px 16px; border-bottom: 1px solid var(--row); display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; align-items: center; gap: 12px 14px; }
.file:last-child { border-bottom: 0; }
.ext { width: 44px; height: 44px; border-radius: 10px; background: #EEF2FB; color: var(--accent); font-size: 11px; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.file-main { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.file-name { font-size: 15px; font-weight: 500; }
.file-meta { font-size: 13px; color: var(--muted); }
.file-actions { display: flex; gap: 8px; }
@media (max-width: 599px) {
  .file { grid-template-columns: 44px minmax(0, 1fr); }
  .file-actions { grid-column: 1 / -1; }
  .file-actions .btn { flex: 1; }
}

/* ---------- 관리 ---------- */
.admin { display: flex; flex-direction: column; gap: 16px; padding-top: 16px; border-top: 1px solid var(--line); scroll-margin-top: 80px; }
.section-title { font-size: 20px; }
.admin-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr)); gap: 16px; }
.admin h3 { font-size: 16px; }
.member { padding: 14px 16px; border-bottom: 1px solid var(--row); display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; }
.member:last-child { border-bottom: 0; }
.member-main { flex: 1 1 220px; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.member-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-left: auto; }
.badge { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 11px; font-size: 12px; font-weight: 700; margin-left: 6px; vertical-align: middle; }
.badge-pending { background: var(--warn-bg); color: var(--warn-ink); }
.badge-approved { background: #E7F5EC; color: var(--ok); }
.badge-blocked { background: #FDECEA; color: var(--danger); }
.badge-admin { background: var(--accent-soft); color: var(--accent); }

/* ---------- 승인 대기 안내 ---------- */
.steps { list-style: none; margin: 4px 0 0; padding: 0; width: 100%; display: flex; flex-direction: column; gap: 10px; text-align: left; }
.steps li { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; color: var(--muted); }
.step-n { flex: none; width: 24px; height: 24px; border-radius: 50%; border: 1px solid var(--line-2); display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; }
.steps li.done .step-n { background: var(--ok); border-color: var(--ok); color: #fff; }
.steps li.now { color: var(--ink); }
.steps li.now .step-n { background: var(--accent); border-color: var(--accent); color: #fff; }
.perm-legend { width: 100%; padding: 12px 14px; border-radius: 10px; background: var(--bg); font-size: 13px; color: var(--ink-2); text-align: left; display: flex; flex-direction: column; gap: 4px; }
.perm-legend b { display: inline-block; min-width: 64px; color: var(--ink); }
.row-center { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }

/* ---------- 상단 ---------- */
.brand-link { color: inherit; text-decoration: none; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: #E5484D; }
@media (max-width: 480px) {
  #btn-members span:not(.dot) { display: none; }
  #me-role { display: none; }
}

/* ---------- 업로드 ---------- */
.h-sm { font-size: 15px; font-weight: 700; display: flex; align-items: baseline; gap: 8px; }
.upload { display: flex; flex-direction: column; gap: 12px; }
.upload-row, .adduser-row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; }
.grow { flex: 1 1 240px; min-width: 0; }
.cat-field { flex: 0 1 200px; min-width: 140px; }
@media (max-width: 599px) {
  .cat-field { flex: 1 1 100%; }
  .upload-row .btn, .adduser-row .btn { width: 100%; }
  .adduser-row .stack-6 { flex: 1 1 100%; }
}

/* ---------- 권한 관리 ---------- */
.back-link { display: inline-flex; align-items: center; gap: 2px; min-height: 36px; font-size: 14px; color: var(--ink-2); text-decoration: none; }
.back-link svg { width: 16px; height: 16px; }
.perm-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr)); gap: 12px; }
.perm-card { display: flex; align-items: center; gap: 12px; padding: 14px 16px; }
.perm-card p { font-size: 14px; color: var(--ink-2); }
.perm-tag { flex: none; display: inline-flex; align-items: center; justify-content: center; min-width: 44px; height: 26px; padding: 0 10px; border-radius: 13px; font-size: 12px; font-weight: 700; }
.perm-viewer { background: #EEF2FB; color: var(--accent); }
.perm-editor { background: #E7F5EC; color: var(--ok); }
.perm-master { background: #16181D; color: #fff; }
.count { display: inline-flex; min-width: 22px; height: 22px; padding: 0 7px; border-radius: 11px; background: var(--bg); color: var(--ink-2); font-size: 12px; align-items: center; justify-content: center; margin-left: 4px; }
.search-sm { flex: 0 1 260px; height: 40px; }
.search-sm input { font-size: 14px; }
@media (max-width: 599px) { .search-sm { flex-basis: 100%; } }

.seg { display: inline-flex; padding: 3px; border-radius: 10px; background: var(--bg); border: 1px solid var(--line); }
.seg button { min-height: 38px; min-width: 56px; padding: 0 12px; border: 0; border-radius: 8px; background: transparent; color: var(--ink-2); font-size: 13px; cursor: pointer; }
.seg button[aria-pressed=true] { background: var(--surface); color: var(--ink); font-weight: 700; box-shadow: 0 1px 2px rgba(22,24,29,.12); }
.member.is-blocked .member-main { opacity: .6; }
@media (max-width: 599px) {
  .member-actions { margin-left: 0; width: 100%; }
  .pending-actions .btn { flex: 1 1 calc(50% - 4px); }
}

/* ---------- 자료 수정 행 ---------- */
.file-edit { background: #FAFBFD; }
.edit-fields { display: flex; flex-wrap: wrap; gap: 10px; min-width: 0; }
.file-edit .msg { grid-column: 1 / -1; }
.file-edit input { height: 44px !important; font-size: 15px !important; }

/* ---------- 파일 뷰어 ---------- */
body.viewer-open { overflow: hidden; }
.viewer { position: fixed; inset: 0; z-index: 100; background: #2B2E35; display: flex; flex-direction: column; }
.viewer-bar {
  display: flex; align-items: center; gap: 8px; min-height: 56px;
  padding: max(6px, env(safe-area-inset-top)) max(8px, env(safe-area-inset-right)) 6px max(8px, env(safe-area-inset-left));
  background: #16181D; color: #fff;
}
.viewer-title { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.viewer-name { font-size: 14px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.viewer-info { font-size: 12px; color: #B8BEC9; }
.viewer-tools { display: flex; align-items: center; gap: 4px; }
.viewer-btn {
  min-width: 44px; height: 44px; padding: 0 10px; border: 0; border-radius: 10px; background: transparent; color: #fff;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; cursor: pointer; text-decoration: none; font-size: 13px; font-weight: 700;
}
.viewer-btn:hover { background: rgba(255,255,255,.1); }
.viewer-btn svg { width: 20px; height: 20px; }
.viewer-dl { background: var(--accent); }
.viewer-dl:hover { background: #1E48B5; }
.viewer-zoom-label { min-width: 44px; text-align: center; font-size: 12px; color: #D4D8DF; }
@media (max-width: 599px) {
  .viewer-dl span, .viewer-zoom-label { display: none; }
  .viewer-tools { gap: 0; }
}
.viewer-body { flex: 1; overflow: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; padding: 12px 8px max(24px, env(safe-area-inset-bottom)); }
.viewer-status { color: #E8EAEE; text-align: center; padding: 48px 16px; font-size: 14px; }
.viewer-error { color: #FFD7D2; }
.viewer-pages { --zoom: 1; width: calc(min(100%, 920px) * var(--zoom)); margin: 0 auto; display: flex; flex-direction: column; gap: 12px; }
.viewer-pages:has(.viewer-docx) { width: 100%; }
.viewer-page { background: #fff; box-shadow: 0 2px 10px rgba(0,0,0,.35); width: 100%; }
.viewer-canvas { display: block; width: 100%; height: 100%; }
.viewer-page-svg svg { display: block; width: 100%; height: auto; }
.viewer-page-img { background: transparent; box-shadow: none; }
.viewer-img { display: block; width: 100%; height: auto; }
.viewer-docx .docx-wrapper { background: transparent !important; padding: 0 !important; }
.viewer-docx section.docx { margin: 0 auto 12px !important; box-shadow: 0 2px 10px rgba(0,0,0,.35) !important; }

/* ---------- 실시간 표시 ---------- */
.live { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--muted); white-space: nowrap; }
.live i { width: 8px; height: 8px; border-radius: 50%; background: #B8BEC9; }
.live.on { color: var(--ok); }
.live.on i { background: #22A05B; box-shadow: 0 0 0 3px rgba(34,160,91,.18); }
@media (max-width: 480px) { .live span { display: none; } }

/* ---------- 드래그 앤 드롭 ---------- */
.drop-hint { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; color: var(--muted); padding: 10px 12px; border: 1px dashed var(--line-2); border-radius: 10px; background: var(--bg); }
.drop-hint svg { width: 16px; height: 16px; margin-top: 2px; }
@media (hover: none) { .drop-hint { display: none; } } /* 터치 기기는 드래그 업로드 없음 */
.drop-overlay { position: fixed; inset: 0; z-index: 90; display: none; align-items: center; justify-content: center; background: rgba(37,87,214,.12); padding: 16px; pointer-events: none; }
body.dragging .drop-overlay { display: flex; }
.drop-box { width: min(520px, 100%); padding: 40px 24px; border: 3px dashed var(--accent); border-radius: 18px; background: var(--surface); color: var(--ink); display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; }
.drop-box svg { width: 40px; height: 40px; color: var(--accent); }
.drop-box b { font-size: 18px; }
.drop-box span { font-size: 13px; color: var(--muted); }

/* ======================================================================
   폴더 탐색 · 선택 (v2)
   ====================================================================== */
.head-main { min-width: 0; }
.crumbs { display: flex; flex-wrap: nowrap; align-items: center; gap: 2px; overflow-x: auto; scrollbar-width: none; font-size: 13px; min-height: 28px; }
.crumbs::-webkit-scrollbar { display: none; }
.crumb { flex: none; color: var(--ink-2); text-decoration: none; padding: 4px 6px; border-radius: 6px; white-space: nowrap; }
.crumb:hover { background: #EDEFF3; }
.crumb[aria-current=page] { color: var(--ink); font-weight: 700; }
.crumb-sep { flex: none; color: #9AA1AD; display: inline-flex; }
.crumb-sep svg { width: 14px; height: 14px; }

/* 트리 */
@media (min-width: 900px) { .layout { grid-template-columns: 240px minmax(0, 1fr); } }
.tree { position: sticky; top: 76px; max-height: calc(100vh - 96px); overflow: auto; padding: 8px 6px; display: flex; flex-direction: column; gap: 1px; }
.tree-row { display: flex; align-items: center; gap: 2px; border-radius: 8px; }
.tree-row.is-here { background: var(--accent-soft); }
.tree-row.is-here .tree-link { color: var(--accent); font-weight: 700; }
.tree-caret, .tree-caret-sp { flex: none; width: 24px; height: 32px; }
.tree-caret { border: 0; background: transparent; color: var(--muted); display: inline-flex; align-items: center; justify-content: center; border-radius: 6px; cursor: pointer; padding: 0; }
.tree-caret svg { width: 14px; height: 14px; transition: transform .15s; }
.tree-caret.open svg { transform: rotate(90deg); }
.tree-caret:hover { background: #EDEFF3; }
.tree-link { flex: 1; min-width: 0; min-height: 36px; display: flex; align-items: center; gap: 8px; padding: 0 8px 0 2px; color: var(--ink-2); text-decoration: none; font-size: 14px; border-radius: 8px; }
.tree-link svg { width: 16px; height: 16px; color: #C08A1E; }
.tree-link span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tree-link:hover { color: var(--ink); }
@media (max-width: 899px) { .tree { display: none; } } /* 모바일: 경로 표시 + 폴더 행으로 탐색 */

/* 목록 행 */
.list { min-height: 240px; }
.list-head { gap: 8px 12px; }
.list-head h2 { flex: 1; min-width: 0; }
.check-all, .item-check { flex: none; width: 44px; height: 44px; display: inline-flex; align-items: center; justify-content: center; margin: -10px -6px -10px -12px; cursor: pointer; }
.check-all input, .item-check input { width: 18px; height: 18px; accent-color: var(--accent); cursor: pointer; }
.item { position: relative; padding: 10px 16px; border-bottom: 1px solid var(--row); display: grid; grid-template-columns: 32px 44px minmax(0, 1fr) auto; align-items: center; gap: 10px 12px; user-select: none; -webkit-user-select: none; }
.item:last-child { border-bottom: 0; }
.item .item-check { margin: -10px -6px; }
.item:hover { background: #FAFBFD; }
.item.selected { background: #EAF0FD; box-shadow: inset 3px 0 0 var(--accent); }
.item-folder .file-name { color: var(--ink); text-decoration: none; font-weight: 700; }
a.item-open { cursor: pointer; }
a.item-open:hover { text-decoration: underline; }
.ext-folder { background: #FFF4DB; color: #B07510; }
.ext-folder svg { width: 22px; height: 22px; }
.item.file-edit { background: #FAFBFD; grid-template-columns: 32px 44px minmax(0, 1fr) auto; }
.item.file-edit .msg { grid-column: 1 / -1; }
.edit-fields input { width: 100%; height: 44px !important; font-size: 15px !important; }
@media (max-width: 599px) {
  .item, .item.file-edit { grid-template-columns: 32px 40px minmax(0, 1fr); }
  .item .file-actions { grid-column: 1 / -1; flex-wrap: wrap; }
  .item .file-actions .btn { flex: 1 1 auto; }
  .ext { width: 40px; height: 40px; }
}
@media (max-width: 380px) { .btn-text { display: none; } }

/* 선택 도구 막대 */
.selbar { position: sticky; top: 68px; z-index: 5; padding: 10px 12px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; border-color: #BFD0F7; background: #F3F7FF; box-shadow: 0 4px 14px rgba(22,24,29,.08); }
.sel-count { font-size: 13px; font-weight: 700; color: var(--ink); flex: 1 1 220px; min-width: 0; }
.sel-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.sel-edit { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.sel-edit select { height: 40px; width: auto; max-width: 220px; font-size: 13px; padding: 0 8px; }
.selbar .msg { flex: 1 1 100%; }
@media (max-width: 599px) {
  .selbar { top: 60px; }
  .sel-actions, .sel-edit { width: 100%; }
  .sel-actions .btn, .sel-edit select { flex: 1 1 auto; max-width: none; }
}
.sel-hint { font-size: 12px; color: var(--muted); padding: 0 4px; }
@media (pointer: coarse) { .sel-hint { display: none; } }

/* 마우스 영역 선택 상자 (viselect) */
.marquee { background: rgba(37,87,214,.12); border: 1px solid rgba(37,87,214,.7); border-radius: 4px; }
body.selecting, body.selecting * { user-select: none !important; -webkit-user-select: none !important; cursor: crosshair; }

/* 인증 · 비밀번호 */
.auth-links { display: flex; flex-direction: column; gap: 0; }
.pw-card { margin-top: 16px; display: flex; flex-direction: column; gap: 12px; }
@media (max-width: 599px) { #btn-pw-panel span { display: none; } }

/* ---------- 드래그 이동 ---------- */
.drag-handle[draggable=true] { cursor: grab; }
.drop-target { outline: 2px dashed var(--accent) !important; outline-offset: -2px; background: #E3ECFF !important; border-radius: 8px; }
body.moving .item:not(.item-folder) { opacity: .55; }
.drag-ghost { position: fixed; top: -100px; left: -100px; display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 10px; background: var(--ink); color: #fff; font-size: 13px; font-weight: 700; }
.drag-ghost svg { width: 16px; height: 16px; }
.item { -webkit-touch-callout: none; }

/* ---------- 오른쪽 클릭 / 길게 누르기 메뉴 ---------- */
.ctx { position: fixed; z-index: 120; min-width: 220px; max-width: min(340px, calc(100vw - 16px)); max-height: min(70vh, 520px); overflow: auto; padding: 6px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 32px rgba(22,24,29,.18); display: flex; flex-direction: column; }
.ctx-title { padding: 8px 10px 6px; font-size: 12px; color: var(--muted); font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ctx-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 40px; padding: 0 10px; border: 0; border-radius: 8px; background: transparent; color: var(--ink); font-size: 14px; text-align: left; cursor: pointer; }
.ctx-item span:first-child { overflow: hidden; text-overflow: ellipsis; }
.ctx-item:hover, .ctx-item:focus-visible { background: var(--accent-soft); outline: none; }
.ctx-item:disabled { color: #9AA1AD; cursor: default; background: transparent; }
.ctx-item.danger { color: var(--danger); }
.ctx-item.danger:hover { background: #FDECEA; }
.ctx-item.sub::after { content: '›'; color: var(--muted); font-size: 18px; }
.ctx-hint { flex: none; font-size: 12px; color: var(--muted); }
.ctx-sep { height: 1px; margin: 4px 6px; background: var(--line); }
.ctx-sheet { left: 0 !important; right: 0; bottom: 0; top: auto !important; max-width: none; width: 100%; border-radius: 16px 16px 0 0; padding: 8px 8px max(12px, env(safe-area-inset-bottom)); max-height: 75vh; }
.ctx-sheet .ctx-item { min-height: 48px; font-size: 15px; }
.ctx-cancel { justify-content: center; margin-top: 4px; background: var(--bg); font-weight: 700; }
body.menu-open .item { -webkit-user-select: none; }

.req { color: var(--danger); font-weight: 500; font-size: 12px; }
.user-name { font-weight: 700; color: var(--ink); }
.touch-hint { display: none; font-size: 12px; color: var(--muted); padding: 0 4px; }
@media (pointer: coarse) {
  .touch-hint { display: block; }
  .item .row-edit { display: none; } /* 터치: 이름 변경·삭제는 길게 누르기 메뉴로 */
}

/* 비밀번호 보이기 버튼 */
.pw-wrap { position: relative; display: flex; }
.pw-wrap input { padding-right: 52px !important; }
.pw-eye { position: absolute; right: 2px; top: 50%; transform: translateY(-50%); width: 44px; height: 44px; border: 0; background: transparent; font-size: 20px; line-height: 1; cursor: pointer; border-radius: 8px; }
.pw-eye:hover { background: var(--bg); }
