:root {
  --bg: #f6f8fc; --panel: #ffffff; --text: #1f2430; --muted: #6b7385; --line: #e3e7ef;
  --accent: #1a73e8; --accent-soft: #e3eefd; --danger: #d93025; --hover: #eef2f8; --shadow: 0 8px 30px rgba(20,30,60,.18);
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #14171d; --panel: #1d2129; --text: #e6e9ef; --muted: #98a1b3; --line: #2c323d;
    --accent: #7fb0ff; --accent-soft: #24344f; --danger: #ff7b72; --hover: #262c37; --shadow: 0 8px 30px rgba(0,0,0,.5); }
}
* { box-sizing: border-box; }
html, body, #root { height: 100%; margin: 0; }
body { font-family: "Pretendard", "Malgun Gothic", "Apple SD Gothic Neo", system-ui, sans-serif; font-size: 14px;
  background: var(--bg); color: var(--text); }
a { color: var(--accent); text-decoration: none; }
h1, h2, h3, p { margin: 0; }
button, input, select { font: inherit; color: inherit; }

.btn { border: 1px solid var(--line); background: var(--panel); padding: 8px 14px; border-radius: 8px; cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--hover); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
@media (prefers-color-scheme: dark) { .btn.primary { color: #0b1220; } }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.small { padding: 4px 10px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: default; }
.icon-btn { border: 0; background: transparent; cursor: pointer; padding: 6px 9px; border-radius: 50%; font-size: 15px; color: var(--muted); }
.icon-btn:hover { background: var(--hover); color: var(--text); }
input[type=text], input[type=password], input[type=search], select, input:not([type]) {
  border: 1px solid var(--line); background: var(--panel); border-radius: 8px; padding: 9px 11px; width: 100%; outline: none; }
input:focus, select:focus { border-color: var(--accent); }
input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; }

/* 로그인 / 공개 페이지 카드 */
.center { min-height: 100%; display: flex; align-items: center; justify-content: center; padding: 24px 16px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 28px; width: 100%; max-width: 400px; box-shadow: var(--shadow); }
.card.wide { max-width: 720px; }
.card h1 { font-size: 20px; margin-bottom: 6px; }
.card .sub { color: var(--muted); margin-bottom: 18px; line-height: 1.5; }
.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 5px; }
.field small { display: block; color: var(--muted); margin-top: 4px; font-size: 12px; }
.card .btn.primary { width: 100%; padding: 10px; }
.msg-err { color: var(--danger); margin: 0 0 12px; min-height: 1em; }

/* 앱 레이아웃 */
.app { display: grid; grid-template-columns: 232px 1fr; grid-template-rows: 58px 1fr; height: 100%; }
.topbar { grid-column: 1 / 3; display: flex; align-items: center; gap: 14px; padding: 0 18px; border-bottom: 1px solid var(--line); background: var(--panel); }
.logo { font-weight: 700; font-size: 17px; white-space: nowrap; color: var(--text); }
.topbar .search { flex: 1; max-width: 560px; }
.topbar .spacer { flex: 1; }
.user { color: var(--muted); white-space: nowrap; }
.side { padding: 14px 10px; overflow: auto; border-right: 1px solid var(--line); display: flex; flex-direction: column; gap: 4px; }
.side .new { display: flex; gap: 6px; margin-bottom: 10px; flex-wrap: wrap; }
.side .new .btn { flex: 1; }
.nav { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 22px; color: var(--text); cursor: pointer; }
.nav:hover { background: var(--hover); }
.nav.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.badge { margin-left: auto; background: var(--danger); color: #fff; border-radius: 10px; font-size: 11px; padding: 1px 7px; }
.quota { margin-top: auto; padding: 12px; color: var(--muted); font-size: 12px; }
.bar { height: 5px; background: var(--line); border-radius: 3px; margin: 6px 0; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--accent); }
.main { overflow: auto; padding: 14px 20px 80px; position: relative; }
.main.drag::after { content: "여기에 놓아 업로드"; position: absolute; inset: 8px; border: 2px dashed var(--accent); border-radius: 14px;
  background: var(--accent-soft); opacity: .93; display: flex; align-items: center; justify-content: center; font-size: 18px; color: var(--accent); pointer-events: none; }

.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; font-size: 18px; min-height: 40px; }
.crumbs a { color: var(--text); padding: 4px 8px; border-radius: 8px; cursor: pointer; }
.crumbs a:hover { background: var(--hover); }
.crumbs span { color: var(--muted); }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; min-height: 44px; margin: 6px 0; }
.toolbar .count { color: var(--muted); margin-right: 6px; }
.view-title { font-size: 18px; min-height: 40px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.hint { color: var(--muted); line-height: 1.6; margin: 4px 0 12px; }

table.files { width: 100%; border-collapse: collapse; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
table.files th { text-align: left; font-weight: 500; color: var(--muted); font-size: 13px; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; user-select: none; }
table.files th.sort { cursor: pointer; }
table.files td { padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.files tr:last-child td { border-bottom: 0; }
table.files tbody tr:hover { background: var(--hover); }
table.files tr.sel { background: var(--accent-soft); }
td.chk, th.chk { width: 36px; }
td.name { max-width: 0; width: 60%; }
.name-cell { display: flex; align-items: center; gap: 10px; min-width: 0; }
.name-cell .ico { font-size: 19px; flex: none; }
.name-cell .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); cursor: pointer; }
.name-cell .nm:hover { text-decoration: underline; }
.name-cell .loc { color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tag { font-size: 11px; background: var(--accent-soft); color: var(--accent); border-radius: 6px; padding: 1px 6px; flex: none; }
td.num, td.date { color: var(--muted); white-space: nowrap; }
td.act { white-space: nowrap; text-align: right; }
td.act .btn { margin-left: 4px; }
.empty { text-align: center; color: var(--muted); padding: 60px 20px; line-height: 1.8; }
.empty .big { font-size: 44px; }

.menu { position: fixed; z-index: 60; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); padding: 6px; min-width: 170px; }
.menu div { padding: 8px 12px; border-radius: 6px; cursor: pointer; }
.menu div:hover { background: var(--hover); }
.menu div.danger { color: var(--danger); }

.modal-back { position: fixed; inset: 0; background: rgba(10,15,30,.45); z-index: 80; display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal { background: var(--panel); border-radius: 14px; width: 100%; max-width: 460px; max-height: 90vh; display: flex; flex-direction: column; box-shadow: var(--shadow); }
.modal.wide { max-width: 900px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px 6px 20px; }
.modal-head h3 { font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.modal-body { padding: 10px 20px; overflow: auto; line-height: 1.6; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 20px 16px; }
.linkbox { display: flex; gap: 8px; margin: 10px 0; }
.preview { text-align: center; }
.preview img, .preview video { max-width: 100%; max-height: 70vh; border-radius: 8px; }
.preview audio { width: 100%; }
.preview pre { text-align: left; white-space: pre-wrap; word-break: break-all; max-height: 65vh; overflow: auto; background: var(--bg); padding: 12px; border-radius: 8px; font-size: 13px; margin: 0; }
.picker { border: 1px solid var(--line); border-radius: 10px; max-height: 300px; overflow: auto; }
.picker div { padding: 8px 12px; cursor: pointer; }
.picker div:hover { background: var(--hover); }
.picker-path { margin-bottom: 8px; color: var(--muted); word-break: break-all; }

#toasts { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 100; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast { background: #2b303b; color: #fff; padding: 10px 18px; border-radius: 10px; box-shadow: var(--shadow); max-width: 90vw; }
.toast.err { background: var(--danger); }

.upbox { position: fixed; right: 18px; bottom: 18px; width: 340px; max-width: calc(100vw - 36px); background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); z-index: 50; }
.upbox-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 8px 10px 14px; font-weight: 600; }
.upbox-list { max-height: 240px; overflow: auto; border-top: 1px solid var(--line); }
.up { padding: 8px 14px; font-size: 13px; }
.up .row { display: flex; gap: 8px; }
.up .row b { flex: 1; font-weight: 400; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.up .row span { color: var(--muted); white-space: nowrap; }
.up.err .row span { color: var(--danger); }

.drop { border: 2px dashed var(--line); border-radius: 12px; padding: 28px 16px; text-align: center; color: var(--muted); cursor: pointer; margin-bottom: 14px; line-height: 1.7; }
.drop.drag, .drop:hover { border-color: var(--accent); color: var(--accent); }
.plain-list { border: 1px solid var(--line); border-radius: 10px; margin-bottom: 14px; }
.plain-list .up { border-bottom: 1px solid var(--line); }
.plain-list .up:last-child { border-bottom: 0; }

@media (max-width: 760px) {
  .app { grid-template-columns: 1fr; grid-template-rows: 54px auto 1fr; }
  .topbar { grid-column: 1; padding: 0 10px; gap: 8px; }
  .logo span, .user { display: none; }
  .side { flex-direction: row; border-right: 0; border-bottom: 1px solid var(--line); padding: 8px; overflow-x: auto; align-items: center; }
  .side .new { margin: 0; flex-wrap: nowrap; }
  .nav { white-space: nowrap; padding: 7px 10px; }
  .quota { display: none; }
  .main { padding: 10px 10px 90px; }
  td.date, th.date { display: none; }
  td.name { width: auto; }
}
