* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; font: 14px/1.5 "Malgun Gothic", "맑은 고딕", sans-serif; color: #1f2937; background: #f3f5f8; }
a { color: inherit; }
.spacer { flex: 1; }
.btn { display: inline-block; padding: 6px 12px; border: 1px solid #c9d1dc; border-radius: 4px; background: #fff;
       cursor: pointer; font: inherit; text-decoration: none; white-space: nowrap; }
.btn:hover { background: #eef2f7; }
.btn.primary { background: #1e3a6e; border-color: #1e3a6e; color: #fff; }
.btn.primary:hover { background: #274a8a; }
.btn.danger { color: #b42318; border-color: #f0b4ae; }
.btn.sm { padding: 2px 8px; font-size: 12px; }
.btn:disabled { opacity: .45; cursor: default; }
input, select { padding: 6px 8px; border: 1px solid #c9d1dc; border-radius: 4px; font: inherit; }

.top { display: flex; align-items: center; gap: 8px; height: 50px; padding: 0 16px; background: #1e3a6e; color: #fff; }
.top .btn { background: transparent; color: #fff; border-color: rgba(255,255,255,.4); }
.top .btn:hover { background: rgba(255,255,255,.12); }
.logo { font-weight: bold; font-size: 16px; }
.who { opacity: .85; margin-right: 6px; }

.wrap { display: flex; height: calc(100vh - 50px); }
.side { width: 220px; background: #fff; border-right: 1px solid #dde3ea; overflow: auto; }
.side-title { padding: 12px 14px 6px; font-size: 12px; color: #6b7280; }
.side ul { list-style: none; margin: 0; padding: 0; }
.side li { padding: 8px 14px; cursor: pointer; }
.side li:hover { background: #eef2f7; }
.side li.on { background: #e1e9f5; font-weight: bold; color: #1e3a6e; }
.side li small { display: block; color: #6b7280; font-weight: normal; font-size: 11px; }

.main { flex: 1; padding: 12px 16px; overflow: auto; position: relative; }
.toolbar { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; flex-wrap: wrap; }
.crumbs { font-size: 15px; }
.crumbs a { cursor: pointer; color: #1e3a6e; text-decoration: none; }
.crumbs a:hover { text-decoration: underline; }
.crumbs .sep { color: #9ca3af; margin: 0 4px; }
.search { width: 200px; }
.status { color: #6b7280; font-size: 13px; }

table.list { width: 100%; border-collapse: collapse; background: #fff; border: 1px solid #dde3ea; }
table.list th { text-align: left; font-weight: normal; color: #6b7280; background: #f8fafc; border-bottom: 1px solid #dde3ea; padding: 7px 8px; }
table.list td { padding: 6px 8px; border-bottom: 1px solid #eef1f5; }
table.list tr:hover td { background: #f6f9fd; }
table.list tr.sel td { background: #e8f0fc; }
table.list .r { text-align: right; }
table.list .ck { width: 32px; }
.name { cursor: pointer; }
.name:hover { text-decoration: underline; }
.ico { display: inline-block; width: 18px; text-align: center; margin-right: 6px; }
.folder .ico { color: #d39a1b; }
.empty { padding: 40px; text-align: center; color: #9ca3af; background: #fff; border: 1px dashed #c9d1dc; margin-top: 8px; }
.drop-mask { position: absolute; inset: 0; background: rgba(30,58,110,.08); border: 3px dashed #1e3a6e;
             display: flex; align-items: center; justify-content: center; font-size: 18px; color: #1e3a6e; pointer-events: none; }

.up-panel { position: fixed; right: 16px; bottom: 16px; width: 420px; max-height: 50vh; background: #fff;
            border: 1px solid #c9d1dc; border-radius: 6px; box-shadow: 0 6px 24px rgba(0,0,0,.15); display: flex; flex-direction: column; }
.up-head { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-bottom: 1px solid #eef1f5; }
.up-list { overflow: auto; padding: 4px 12px 8px; }
.up-item { padding: 5px 0; border-bottom: 1px solid #f1f3f6; font-size: 13px; }
.up-item .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar { height: 5px; background: #eef1f5; border-radius: 3px; overflow: hidden; margin-top: 3px; }
.bar i { display: block; height: 100%; width: 0; background: #1e3a6e; }
.up-item.done .bar i { background: #16a34a; }
.up-item.fail .bar i { background: #b42318; }
.up-item .st { font-size: 12px; color: #6b7280; }

.login-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.login-box { width: 320px; background: #fff; padding: 28px; border-radius: 8px; border: 1px solid #dde3ea; display: flex; flex-direction: column; gap: 12px; }
.login-box h1 { margin: 0 0 6px; font-size: 20px; color: #1e3a6e; }
.login-box label, .card label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: #4b5563; }
.msg.err { background: #fdecea; color: #b42318; padding: 8px 10px; border-radius: 4px; font-size: 13px; }

.admin { padding: 16px; }
.tabs { display: flex; gap: 4px; margin-bottom: 12px; }
.tab { padding: 8px 16px; border: 1px solid #c9d1dc; background: #fff; cursor: pointer; border-radius: 4px; font: inherit; }
.tab.on { background: #1e3a6e; color: #fff; border-color: #1e3a6e; }
.cols { display: flex; gap: 16px; align-items: flex-start; }
.col { flex: 1; min-width: 0; }
.card { background: #fff; border: 1px solid #dde3ea; border-radius: 6px; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.card h3, .card h4 { margin: 0; }
.row { display: flex; gap: 16px; align-items: center; }
.ck-label { flex-direction: row !important; align-items: center; gap: 6px !important; }
.hint { color: #6b7280; font-size: 12px; margin: 0; }
table.perm td, table.perm th { text-align: center; }
table.perm td:first-child, table.perm th:first-child { text-align: left; }
tr.clickable { cursor: pointer; }
.tag { display: inline-block; padding: 0 6px; border-radius: 3px; font-size: 12px; background: #eef2f7; }
.tag.admin { background: #e1e9f5; color: #1e3a6e; }
.tag.off { background: #fdecea; color: #b42318; }
.fail-row td { color: #b42318; }

/* 왼쪽 폴더 트리 */
.side { width: 260px; }
.tree, .tree ul { list-style: none; margin: 0; padding: 0; }
.tree ul { padding-left: 14px; }
.tree .node { display: flex; align-items: center; gap: 2px; padding: 4px 8px; cursor: pointer; white-space: nowrap; border-radius: 3px; margin: 0 4px; }
.tree .node:hover { background: #eef2f7; }
.tree .node.on { background: #e1e9f5; font-weight: bold; color: #1e3a6e; }
.tree .tg { display: inline-block; width: 16px; text-align: center; color: #6b7280; font-size: 11px; }
.tree .nm::before { content: "\1F4C1"; margin-right: 5px; font-weight: normal; }
.tree > li > .node .nm::before { content: "\1F5C4"; }
.perm-tag { font-size: 12px; color: #1e3a6e; background: #e1e9f5; padding: 2px 8px; border-radius: 3px; }

/* 관리자: 권한 규칙 */
table.rules td, table.rules th { text-align: center; }
table.rules td:first-child, table.rules th:first-child { text-align: left; }
.path-btn { min-width: 180px; text-align: left; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px; border: 1px solid #c9d1dc; border-radius: 14px; background: #fff; font-size: 13px; }
.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,.35); display: flex; align-items: center; justify-content: center; z-index: 50; }
.modal { background: #fff; width: 420px; max-height: 80vh; display: flex; flex-direction: column; border-radius: 6px; }
.modal-head { padding: 10px 14px; border-bottom: 1px solid #eef1f5; font-weight: bold; }
.modal-body { padding: 8px; overflow: auto; flex: 1; min-height: 240px; }
.modal-foot { padding: 10px 14px; border-top: 1px solid #eef1f5; display: flex; gap: 6px; align-items: center; }
.eff { margin-top: 6px; font-size: 13px; }
.side .tree li { padding: 0; }
.side .tree li:hover { background: none; }
@media (max-width: 720px) {
  .wrap { flex-direction: column; height: auto; }
  .side { width: auto; max-height: 34vh; border-right: 0; border-bottom: 1px solid #dde3ea; }
  .main { overflow: visible; }
  .cols { flex-direction: column; }
  .up-panel { left: 8px; right: 8px; width: auto; }
}
.card label.chip { flex-direction: row; align-items: center; gap: 4px; color: #1f2937; }
