/* FileQ — Figma 시안 "FileQ 화면 설계" 토큰 기반 */
:root {
  --navy: #1E3A5F; --navy-dk: #172D4A; --bg: #F4F6F8; --white: #FFFFFF; --border: #D9DEE4;
  --text: #1F2933; --muted: #6B7A8C; --subtle: #9AA5B1;
  --green: #1F8A4C; --green-bg: #E6F4EC; --blue: #2563EB; --blue-bg: #E8F0FE;
  --gray: #5B6775; --gray-bg: #EEF1F4; --red: #C0392B; --red-bg: #FCEBEA;
  --amber: #B7791F; --amber-bg: #FFF4DD; --pdf-bg: #525659; --black: #0B0D10;
  --radius: 8px; --radius-sm: 6px; --topbar-h: 56px; --comments-w: 360px;
  --font: "Pretendard", "Noto Sans KR", "Malgun Gothic", "Apple SD Gothic Neo", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body { font-family: var(--font); font-size: 14px; color: var(--text); background: var(--bg); line-height: 1.5; -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; }
code { font-family: Consolas, "Courier New", monospace; font-size: 12px; background: var(--gray-bg); padding: 1px 4px; border-radius: 4px; }
[hidden] { display: none !important; }

/* 타이포 */
.h-page { font-size: 22px; font-weight: 700; margin: 0; line-height: 1.3; }
.h-title { font-size: 20px; font-weight: 700; margin: 0; }
.h-section { font-size: 15px; font-weight: 500; margin: 0 0 4px; }
.h-item { font-size: 16px; font-weight: 500; }
.muted { color: var(--muted); margin: 0; }
.subtle { color: var(--subtle); margin: 0; }
.small { font-size: 12px; }
.strong { font-weight: 500; }
.hint { font-size: 12px; color: var(--subtle); margin: 0; }
.center { text-align: center; }
.text-red { color: var(--red); } .text-green { color: var(--green); } .text-navy { color: var(--navy); } .text-subtle { color: var(--subtle); }
.spacer { flex: 1; }
.inline { display: inline; margin: 0; }
.inline-icon { display: inline-flex; align-items: center; gap: 6px; }
.icon { vertical-align: middle; flex-shrink: 0; }

/* 레이아웃 */
.layout-app { display: flex; flex-direction: column; min-height: 100%; }
.main-app { flex: 1; }
.container { max-width: 1200px; margin: 0 auto; padding: 24px 24px 40px; }
.container-wide { max-width: 1280px; }
.page-head { display: flex; align-items: center; gap: 12px; margin: 8px 0 20px; flex-wrap: wrap; }
.page-head > div:first-child { flex: 1; min-width: 240px; }
.crumb { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); font-size: 13px; }
.crumb:hover { color: var(--navy); }
.cols { display: flex; gap: 20px; align-items: flex-start; }
.col-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 20px; }
.col-side { width: 380px; flex-shrink: 0; display: flex; flex-direction: column; gap: 20px; }
@media (max-width: 1024px) { .cols { flex-direction: column; } .col-side { width: 100%; } }

/* 상단바 */
.topbar { height: var(--topbar-h); background: var(--white); border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 16px; padding: 0 24px; position: sticky; top: 0; z-index: 20; }
.logo { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; color: var(--navy); font-size: 18px; }
.logo-mark { width: 28px; height: 28px; border-radius: 6px; background: var(--navy); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-size: 14px; }
.logo-lg { font-size: 26px; } .logo-lg .logo-mark { width: 44px; height: 44px; border-radius: 8px; font-size: 22px; }
.admin-tag { background: var(--navy); color: #fff; font-size: 11px; font-weight: 500; padding: 2px 8px; border-radius: 4px; }
.tabs { display: flex; align-self: stretch; }
.tab { display: inline-flex; align-items: center; padding: 0 14px; color: var(--muted); border-bottom: 2px solid transparent; }
.tab.active { color: var(--navy); font-weight: 500; border-bottom-color: var(--navy); }
.user-chip { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--navy); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 500; flex-shrink: 0; }
.icon-btn { background: none; border: 0; color: var(--muted); padding: 6px; border-radius: 6px; display: inline-flex; align-items: center; }
.icon-btn:hover { background: var(--gray-bg); color: var(--text); }
.icon-btn.text-navy { color: var(--navy); } .icon-btn.text-red { color: var(--red); }

/* 버튼 */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 36px; padding: 0 16px; border-radius: var(--radius-sm); border: 1px solid transparent; font-weight: 500; font-size: 14px; white-space: nowrap; }
.btn-primary { background: var(--navy); color: #fff; } .btn-primary:hover { background: var(--navy-dk); }
.btn-secondary { background: #fff; color: var(--text); border-color: var(--border); } .btn-secondary:hover { background: var(--gray-bg); }
.btn-danger { background: var(--red); color: #fff; } .btn-danger:hover { background: #a93226; }
.btn-ghost { background: transparent; color: var(--navy); } .btn-ghost:hover { background: var(--gray-bg); }
.btn-disabled { background: var(--gray-bg); color: var(--subtle); cursor: not-allowed; }
.btn-sm { height: 32px; padding: 0 12px; font-size: 13px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .6; cursor: not-allowed; }
.btn-link { background: none; border: 0; padding: 0; color: inherit; display: inline-flex; align-items: center; gap: 4px; }

/* 폼 */
.field { display: flex; flex-direction: column; gap: 6px; border: 0; padding: 0; margin: 0; min-width: 0; }
.label { font-size: 13px; font-weight: 500; color: var(--muted); }
.input { width: 100%; height: 40px; padding: 0 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: #fff; font: inherit; color: var(--text); }
.input:focus { outline: 2px solid rgba(30,58,95,.25); border-color: var(--navy); }
.input-error { border-color: var(--red); }
.textarea { height: auto; padding: 10px 12px; resize: vertical; min-height: 80px; }
.select { height: 32px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: #fff; font: inherit; font-size: 13px; color: var(--muted); padding: 0 8px; max-width: 320px; }
.input-group { display: flex; gap: 8px; align-items: center; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.search { position: relative; display: inline-flex; align-items: center; }
.search .input { height: 36px; padding-left: 34px; width: 260px; font-size: 13px; }
.search-icon { position: absolute; left: 12px; color: var(--subtle); display: inline-flex; }
.radio { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; }
.radio input { margin-top: 3px; accent-color: var(--navy); }
.radio strong { display: block; font-weight: 400; } .radio input:checked + span strong { font-weight: 500; }
.radio small { display: block; color: var(--muted); font-size: 12px; }
.radio-row { display: flex; gap: 24px; }
.radio-inline { display: inline-flex; gap: 8px; align-items: center; } .radio-inline input { accent-color: var(--navy); }
.checkbox { display: inline-flex; gap: 10px; align-items: center; cursor: pointer; } .checkbox input { accent-color: var(--navy); width: 16px; height: 16px; }

/* 토글 */
.toggle { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.toggle input { position: absolute; opacity: 0; width: 0; height: 0; }
.toggle-track { width: 40px; height: 22px; border-radius: 11px; background: #C5CDD6; position: relative; transition: background .15s; flex-shrink: 0; }
.toggle-track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: left .15s; }
.toggle input:checked + .toggle-track { background: var(--navy); } .toggle input:checked + .toggle-track::after { left: 20px; }
.toggle input:disabled + .toggle-track { opacity: .5; cursor: not-allowed; }
.toggle-text { font-size: 12px; color: var(--muted); } .toggle input:checked ~ .toggle-text { color: var(--green); }

/* 카드·표 */
.card { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); }
.section { padding: 24px; display: flex; flex-direction: column; gap: 16px; }
.section-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; } .section-head > div:first-child { flex: 1; }
.section-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.table-card { overflow: hidden; }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 12px; font-weight: 500; color: var(--muted); background: var(--gray-bg); padding: 0 16px; height: 40px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: 0 16px; height: 52px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: #FAFBFC; }
.table .actions { text-align: right; white-space: nowrap; } .table .actions .btn, .table .actions .icon-btn { margin-left: 4px; }
.w-icon { width: 52px; } .w-size { width: 100px; } .w-date { width: 130px; } .w-count { width: 80px; } .w-dl { width: 90px; } .w-action { width: 90px; }
.w-badge { width: 130px; } .w-badge-s { width: 90px; } .w-name { width: 140px; } .w-name-s { width: 110px; } .w-login { width: 150px; } .w-toggle { width: 130px; }
.w-action-2 { width: 220px; } .w-action-3 { width: 130px; }
.file-link { color: var(--text); } .file-link:hover { color: var(--navy); text-decoration: underline; }
.file-icon { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 6px; color: #fff; font-size: 10px; font-weight: 700; background: #8A94A6; letter-spacing: .2px; flex-shrink: 0; }
.file-icon-pdf { background: #D64541; } .file-icon-video { background: #7C3AED; } .file-icon-image { background: #0E7490; } .file-icon-doc { background: #2B6CB0; }
.file-icon-sheet { background: #1F8A4C; } .file-icon-slide { background: #C05621; } .file-icon-archive { background: #6B7A8C; }
.badge { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 10px; font-size: 12px; font-weight: 500; white-space: nowrap; }
.badge-assigned { background: var(--gray-bg); color: var(--gray); } .badge-allusers { background: var(--blue-bg); color: var(--blue); } .badge-public { background: var(--green-bg); color: var(--green); }
.pill { display: inline-flex; padding: 2px 8px; border-radius: 10px; font-size: 12px; font-weight: 500; background: var(--gray-bg); color: var(--gray); } .pill-admin { background: var(--navy); color: #fff; }
.empty-state { padding: 48px 24px; text-align: center; }
.project-list { display: flex; flex-direction: column; gap: 12px; }
.project-row { display: flex; align-items: center; gap: 12px; padding: 16px 20px; transition: border-color .15s, box-shadow .15s; }
.project-row:hover { border-color: var(--navy); box-shadow: 0 2px 8px rgba(30,58,95,.08); }
.project-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.project-title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.project-meta { display: flex; align-items: center; gap: 24px; font-size: 13px; }

/* 알림 */
.alert { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: var(--radius-sm); font-size: 13px; }
.alert-error { background: var(--red-bg); color: var(--red); } .alert-error .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--red); flex-shrink: 0; }
.alert-info { background: var(--gray-bg); color: var(--muted); }
.alert-warn { background: var(--amber-bg); color: var(--amber); align-items: flex-start; text-align: left; }
.alert-success { background: var(--green-bg); color: var(--green); margin-bottom: 16px; }
.toast { position: fixed; left: 50%; bottom: 32px; transform: translateX(-50%) translateY(20px); background: #1F2933; color: #fff; padding: 10px 16px; border-radius: 8px; font-size: 13px; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 100; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.tooltip-host { position: relative; } .tooltip { position: absolute; top: calc(100% + 6px); right: 0; background: #1F2933; color: #fff; font-size: 12px; font-weight: 400; padding: 6px 10px; border-radius: 6px; white-space: nowrap; opacity: 0; pointer-events: none; transition: opacity .15s; }
.tooltip-host:hover .tooltip, .tooltip-host:focus .tooltip { opacity: 1; }

/* 로그인 */
.layout-bare { display: flex; flex-direction: column; min-height: 100%; }
.main-bare { flex: 1; display: flex; }
.login-wrap { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 24px; padding: 40px 16px; position: relative; }
.login-card { width: 100%; max-width: 400px; padding: 32px; display: flex; flex-direction: column; gap: 20px; border-radius: 12px; box-shadow: 0 4px 16px rgba(0,0,0,.06); }
.login-footer { position: absolute; bottom: 24px; }

/* 에러 */
.error-wrap { flex: 1; display: flex; align-items: center; justify-content: center; padding: 40px 16px; min-height: calc(100vh - var(--topbar-h)); }
.error-card { width: 100%; max-width: 440px; padding: 40px; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 12px; border-radius: 12px; }
.error-icon { width: 56px; height: 56px; border-radius: 50%; background: var(--red-bg); color: var(--red); display: inline-flex; align-items: center; justify-content: center; }

/* 뷰어 */
.layout-viewer { height: 100%; overflow: hidden; }
.main-viewer { height: 100%; display: flex; flex-direction: column; }
.viewer-top { position: static; gap: 12px; padding: 0 20px 0 16px; flex-shrink: 0; }
.crumb-btn { padding: 6px 10px 6px 6px; border-radius: 6px; } .crumb-btn:hover { background: var(--gray-bg); }
.crumb-text { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-title { display: inline-flex; align-items: center; gap: 8px; min-width: 0; }
.file-name { font-size: 15px; font-weight: 500; max-width: 360px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.viewer-body { flex: 1; display: flex; min-height: 0; position: relative; }
.viewer-pane { flex: 1; min-width: 0; display: flex; align-items: center; justify-content: center; background: var(--bg); overflow: auto; }
.viewer-pane-pdf { background: var(--pdf-bg); } .viewer-pane-video { background: var(--black); } .viewer-pane-image { background: #1A1F26; }
.pdf-frame { width: 100%; height: 100%; border: 0; }
.video-wrap { width: 100%; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 24px; }
.video-wrap video { width: 100%; max-width: 1280px; max-height: 100%; aspect-ratio: 16 / 9; background: #1A1F26; outline: none; }
.video-fallback { padding: 24px 32px; text-align: center; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.image-wrap { width: 100%; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 24px; overflow: auto; }
.image-wrap img { max-width: 100%; max-height: calc(100% - 32px); object-fit: contain; cursor: zoom-in; box-shadow: 0 2px 12px rgba(0,0,0,.35); }
.image-wrap.natural { justify-content: flex-start; } .image-wrap.natural img { max-width: none; max-height: none; cursor: zoom-out; }
.image-hint { color: #6B7A8C; }
.no-preview { width: 100%; max-width: 480px; padding: 40px; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 16px; border-radius: 12px; }
.no-preview .file-icon { width: 72px; height: 72px; font-size: 14px; }
.meta-row { display: flex; gap: 16px; flex-wrap: wrap; justify-content: center; font-size: 13px; }
.comments-pane { width: var(--comments-w); flex-shrink: 0; background: #fff; border-left: 1px solid var(--border); display: flex; flex-direction: column; min-height: 0; }
.comments-head { height: 48px; display: flex; align-items: center; gap: 8px; padding: 0 16px; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.comments-list { flex: 1; overflow-y: auto; padding: 8px 0; }
.comments-empty { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 48px 24px; text-align: center; }
.empty-circle { width: 48px; height: 48px; border-radius: 50%; background: var(--gray-bg); color: var(--subtle); display: inline-flex; align-items: center; justify-content: center; }
.empty-circle .icon { width: 22px; height: 22px; }
.comment { padding: 12px 16px; border-bottom: 1px solid var(--border); display: flex; flex-direction: column; gap: 8px; }
.comment-head { display: flex; align-items: center; gap: 10px; }
.comment-who { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.comment-name { font-size: 13px; font-weight: 500; }
.comment-actions { display: inline-flex; gap: 2px; }
.comment-body { margin: 0; white-space: pre-wrap; word-break: break-word; line-height: 22px; }
.comment-edit { width: 100%; }
.comments-foot { border-top: 1px solid var(--border); padding: 16px; flex-shrink: 0; }
.comment-form { display: flex; flex-direction: column; gap: 8px; }
.comment-form-row { display: flex; align-items: center; gap: 8px; }
.comment-cta { background: var(--gray-bg); border-radius: 8px; padding: 16px; display: flex; flex-direction: column; align-items: center; gap: 10px; color: var(--muted); }
.comments-fab { display: none; }
@media (max-width: 1024px) {
  .viewer-body { flex-direction: column; }
  .comments-pane { position: absolute; inset: auto 0 0 0; height: 60%; border-left: 0; border-top: 1px solid var(--border); box-shadow: 0 -4px 16px rgba(0,0,0,.12); transform: translateY(100%); transition: transform .2s; width: 100%; }
  .comments-pane.open { transform: translateY(0); }
  .comments-fab { display: inline-flex; position: absolute; right: 16px; bottom: 16px; align-items: center; gap: 6px; height: 40px; padding: 0 16px; border-radius: 20px; background: var(--navy); color: #fff; border: 0; box-shadow: 0 4px 12px rgba(0,0,0,.25); z-index: 5; }
  .file-name { max-width: 160px; } .crumb-text { max-width: 100px; } .file-switcher { display: none; }
  .viewer-top { gap: 8px; padding: 0 12px; } .viewer-top .user-text { display: none; }
}

/* 관리: 업로드 */
.dropzone { border: 1.5px dashed rgba(30,58,95,.5); border-radius: 8px; background: #F7F9FB; padding: 20px; display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; color: var(--navy); transition: background .15s, border-color .15s; }
.dropzone.drag { background: var(--blue-bg); border-color: var(--navy); }
.dropzone p { margin: 0; }
.upload-progress { background: var(--blue-bg); border-radius: 6px; padding: 12px 16px; display: flex; flex-direction: column; gap: 8px; }
.upload-row { display: flex; align-items: center; gap: 10px; }
.progress { height: 6px; background: #CFDCF5; border-radius: 3px; overflow: hidden; }
.progress-bar { height: 100%; width: 0; background: var(--blue); transition: width .1s; }
.section-disabled { opacity: .55; } .section-disabled .member-row { cursor: not-allowed; }
.member-list { border: 1px solid var(--border); border-radius: 6px; overflow: hidden; max-height: 360px; overflow-y: auto; }
.member-row { display: flex; align-items: center; gap: 10px; padding: 0 12px; height: 44px; border-bottom: 1px solid var(--border); cursor: pointer; }
.member-row:last-child { border-bottom: 0; } .member-row:hover { background: #FAFBFC; }
.member-row.inactive .strong { color: var(--subtle); }
.member-row input { accent-color: var(--navy); width: 16px; height: 16px; }
.member-text { display: flex; flex-direction: column; line-height: 1.3; }
.link-box { display: flex; align-items: center; gap: 8px; background: var(--gray-bg); border-radius: 6px; padding: 4px 4px 4px 12px; }
.link-text { flex: 1; font-size: 12px; word-break: break-all; }

/* 모달 */
.modal-backdrop { position: fixed; inset: 0; background: rgba(11,18,32,.45); display: flex; align-items: center; justify-content: center; z-index: 50; padding: 16px; }
.modal { width: 100%; max-width: 520px; background: #fff; border-radius: 12px; box-shadow: 0 12px 40px rgba(0,0,0,.25); display: flex; flex-direction: column; overflow: hidden; }
.modal-head { display: flex; align-items: center; gap: 8px; padding: 18px 20px 18px 24px; border-bottom: 1px solid var(--border); }
.modal-head .h-title { font-size: 17px; }
.modal-body { padding: 24px; display: flex; flex-direction: column; gap: 16px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 24px; background: #F7F9FB; }
