@charset "UTF-8";
:root {
  --bg: #0e0f12;
  --panel: rgba(22, 24, 29, 0.82);
  --panel-solid: #16181d;
  --panel-2: rgba(28, 31, 38, 0.78);
  --line: rgba(255, 255, 255, 0.08);
  --text: #e6e8ee;
  --muted: #aab2c2;
  --accent: #5ea0ff;
  --accent-2: #2b6cd6;
  --danger: #ff6b6b;
  --ok: #4ade80;
  --shadow: 0 8px 24px rgba(0,0,0,0.5);
  --bg-image: url('/static/%EB%91%90%EB%B0%94%EC%9D%B4_%EC%84%9C%EC%9A%B8%EC%95%84%EC%82%B0%EB%B3%91%EC%9B%90_%EC%8B%A4%EC%82%AC_202604281435.jpeg');
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Apple SD Gothic Neo", "Noto Sans KR", sans-serif;
  background: var(--bg) var(--bg-image) center center / cover no-repeat fixed;
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  position: relative;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background: linear-gradient(180deg, rgba(0,0,0,0.45), rgba(0,0,0,0.6));
  pointer-events: none;
  z-index: -1;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button {
  font: inherit;
  background: var(--accent-2);
  color: white;
  border: none;
  padding: 8px 14px;
  border-radius: 6px;
  cursor: pointer;
}
button:hover { background: var(--accent); }
button.ghost { background: transparent; color: var(--text); border: 1px solid var(--line); }
button.ghost:hover { background: var(--panel-2); }
button.danger { background: transparent; color: var(--danger); border: 1px solid var(--danger); }
button.danger:hover { background: var(--danger); color: white; }
input, select, textarea {
  font: inherit;
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 10px;
  width: 100%;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
label { display: block; margin-bottom: 12px; font-size: 13px; color: var(--muted); }
label input, label select { margin-top: 4px; }
.error { color: var(--danger); }
.muted { color: var(--muted); }

/* Auth */
body.auth { display: grid; place-items: center; }
.auth-box {
  background: var(--panel);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 32px;
  width: 100%;
  max-width: 360px;
  box-shadow: var(--shadow);
}
.auth-box h1 { margin: 0 0 20px; font-size: 22px; text-align: center; }
.auth-box button { width: 100%; padding: 10px; }

/* App layout */
.app-shell {
  display: grid;
  grid-template-rows: 48px 1fr;
  height: 100vh;
}
header.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  background: var(--panel);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  border-bottom: 1px solid var(--line);
}
.topbar .brand { font-weight: 600; }
.topbar .crumbs { color: var(--muted); flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar .crumbs span.sep { margin: 0 6px; opacity: 0.5; }
.topbar .crumbs a { color: var(--muted); }
.topbar .crumbs a:hover { color: var(--text); }
.topbar .user { color: var(--muted); }
.topbar .user b { color: var(--text); margin-right: 8px; }

.main {
  display: grid;
  grid-template-columns: 280px 1fr;
  min-height: 0;
}
aside.tree-pane {
  background: var(--panel);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  border-right: 1px solid var(--line);
  overflow: auto;
  padding: 8px;
}
main.content-pane { background: rgba(14, 15, 18, 0.55); }
.tree ul { list-style: none; margin: 0; padding-left: 16px; }
.tree > ul { padding-left: 4px; }
.tree li { user-select: none; }
.tree .node {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 6px;
  border-radius: 4px;
  cursor: pointer;
}
.tree .node:hover { background: var(--panel-2); }
.tree .node.active { background: var(--accent-2); color: white; }
.tree .twisty { width: 14px; display: inline-block; text-align: center; color: var(--muted); }
.tree .icon { width: 14px; display: inline-block; text-align: center; }
.tree .name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tree .badge { font-size: 10px; color: var(--muted); }
.tree .denied { opacity: 0.4; }

main.content-pane {
  overflow: auto;
  padding: 16px;
}
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}
.tile {
  background: var(--panel);
  backdrop-filter: blur(10px) saturate(140%);
  -webkit-backdrop-filter: blur(10px) saturate(140%);
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  cursor: pointer;
  transition: transform 0.1s, border-color 0.1s;
}
.tile:hover { border-color: var(--accent); transform: translateY(-2px); }
.tile .preview {
  position: relative;
  width: 100%;
  aspect-ratio: 16/10;
  background: var(--panel-2);
  overflow: hidden;
}
.tile .preview iframe {
  position: absolute;
  top: 0; left: 0;
  width: 1280px; height: 800px;
  transform: scale(calc(280 / 1280));
  transform-origin: top left;
  border: 0;
  pointer-events: none;
}
.tile .preview .placeholder {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  font-size: 32px; color: var(--muted);
}
.tile .meta {
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.tile .meta .title { flex: 1; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile .meta .tag {
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--accent-2);
  color: white;
}
.tile .meta .tag.md { background: #6b7280; }
.tile .actions {
  display: flex;
  gap: 6px;
  padding: 0 10px 10px;
}
.tile .actions button {
  flex: 1;
  padding: 6px;
  font-size: 12px;
}

.empty {
  text-align: center;
  color: var(--muted);
  padding: 60px 20px;
}

/* Markdown viewer */
.md-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.7);
  display: grid; place-items: center;
  z-index: 100;
}
.md-modal {
  width: min(900px, 92vw);
  height: 86vh;
  background: rgba(22, 24, 29, 0.92);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  border: 1px solid var(--line);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow);
}
.md-modal header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 12px;
}
.md-modal header .title { flex: 1; font-weight: 600; }
.md-body {
  flex: 1;
  overflow: auto;
  padding: 24px 32px;
  line-height: 1.7;
}
.md-body h1, .md-body h2, .md-body h3 { margin-top: 1.4em; }
.md-body code { background: var(--panel-2); padding: 2px 5px; border-radius: 4px; }
.md-body pre { background: var(--panel-2); padding: 12px; border-radius: 6px; overflow: auto; }
.md-body pre code { background: transparent; padding: 0; }
.md-body img { max-width: 100%; }
.md-body table { border-collapse: collapse; }
.md-body th, .md-body td { border: 1px solid var(--line); padding: 6px 10px; }
.md-body blockquote { border-left: 3px solid var(--accent); padding-left: 12px; color: var(--muted); margin-left: 0; }

/* Admin */
.admin-shell {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px;
}
.admin-shell h1 { margin-top: 0; }
.card {
  background: var(--panel);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 16px;
}
.card h2 { margin: 0 0 12px; font-size: 16px; }
table.users {
  width: 100%;
  border-collapse: collapse;
}
table.users th, table.users td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
table.users th { color: var(--muted); font-weight: 500; font-size: 12px; }
.perm-list { display: flex; flex-wrap: wrap; gap: 4px; margin: 0; padding: 0; list-style: none; }
.perm-list li {
  background: var(--panel-2);
  border: 1px solid var(--line);
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.perm-list li button {
  background: transparent;
  color: var(--muted);
  padding: 0 2px;
  font-size: 14px;
  line-height: 1;
}
.perm-list li button:hover { color: var(--danger); }
.row-actions { display: flex; gap: 6px; }
.row-actions button { padding: 4px 8px; font-size: 12px; }
form.inline { display: grid; grid-template-columns: repeat(4, 1fr) auto; gap: 8px; align-items: end; }
form.inline label { margin: 0; }

/* Folder picker modal */
.picker-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.7); display: grid; place-items: center; z-index: 200; }
.picker {
  width: min(560px, 92vw);
  max-height: 80vh;
  background: rgba(22, 24, 29, 0.92);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  border: 1px solid var(--line);
  border-radius: 10px;
  display: flex;
  flex-direction: column;
}
.picker header { padding: 12px 16px; border-bottom: 1px solid var(--line); font-weight: 600; }
.picker .crumbs { padding: 8px 16px; border-bottom: 1px solid var(--line); color: var(--muted); }
.picker .crumbs a { color: var(--accent); cursor: pointer; }
.picker ul { list-style: none; margin: 0; padding: 8px; overflow: auto; flex: 1; }
.picker li {
  padding: 6px 10px;
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.picker li:hover { background: var(--panel-2); }
.picker footer { padding: 12px 16px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 8px; }
