:root {
  --bg: #f2f4f8;
  --card: #ffffff;
  --line: #e6e9ef;
  --line-strong: #d8dde6;
  --text: #111827;
  --muted: #6b7280;
  --muted-2: #9aa3b2;
  --accent: #2563eb;
  --accent-soft: #dbeafe;
  --green: #16915a;
  --green-soft: #e7f7ef;
  --red: #d92d20;
  --red-soft: #fef0ee;
  --orange: #f59e0b;
  --orange-soft: #fef4e2;
  --purple: #7c3aed;
  --purple-soft: #f1eafe;
  --radius: 18px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", sans-serif;
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); }

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.topbar-inner {
  max-width: 1480px;
  margin: 0 auto;
  padding: 12px clamp(12px, 2vw, 28px) 8px;
  display: flex;
  align-items: center;
  gap: 18px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--text);
  min-width: 0;
}

.logo {
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  border-radius: 13px;
  background: linear-gradient(135deg, #2563eb, #4f8df7);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 16px;
  letter-spacing: -0.6px;
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.28);
}

.brand-copy strong { display: block; font-size: 18px; letter-spacing: -0.3px; }
.brand-copy small { display: block; color: var(--muted); font-size: 12px; margin-top: 1px; }

.topmeta { margin-left: auto; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.meta-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 999px;
  padding: 5px 11px;
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}

.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); }
.dot.red { background: var(--red); }
.dot.orange { background: var(--orange); }

.who { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; }
.who form { margin: 0; }

.mainnav { max-width: 1480px; margin: 0 auto; padding: 0 clamp(12px, 2vw, 28px) 10px; }
.nav-inner {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 3px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 5px;
  width: max-content;
  max-width: 100%;
  overflow: visible;
  position: relative;
  z-index: 30;
}
.nav-inner a {
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 13px;
  color: var(--muted);
  text-decoration: none;
  white-space: nowrap;
}
.nav-inner a:hover { background: var(--bg); color: var(--text); }
.nav-inner a.active { background: var(--accent); color: #fff; font-weight: 600; }

details.menu { position: relative; }
details.menu summary {
  list-style: none;
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 13px;
  color: var(--muted);
  cursor: pointer;
  white-space: nowrap;
}
details.menu summary::-webkit-details-marker { display: none; }
details.menu summary:hover { background: var(--bg); color: var(--text); }
details.menu[open] summary { background: var(--bg); color: var(--text); }
.menu-list {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 180px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 12px 30px rgba(16, 24, 40, 0.12);
  padding: 6px;
  display: grid;
  gap: 2px;
  z-index: 50;
}
.menu-list a {
  padding: 8px 10px;
  border-radius: 9px;
  font-size: 13px;
  color: var(--text);
  text-decoration: none;
}
.menu-list a:hover { background: var(--bg); }

main {
  width: 100%;
  max-width: 1480px;
  margin: 22px auto 36px;
  padding: 0 clamp(12px, 2vw, 28px);
}

h1 { font-size: 22px; margin: 0 0 4px; letter-spacing: -0.45px; }
h2 { font-size: 17px; margin: 0 0 12px; letter-spacing: -0.25px; }
p { margin: 0 0 10px; }

.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin: 2px 0 14px; }
.page-head .muted { font-size: 12px; }
.headline { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 12px; }
.headline h1 { margin-bottom: 3px; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px 22px;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
  margin-bottom: 16px;
}

.muted { color: var(--muted); }
.muted-2 { color: var(--muted-2); }
.small { font-size: 12px; }
.ok { color: var(--green); }
.error { color: var(--red); }
.warn { color: var(--orange); }
.pos { color: var(--green); }
.neg { color: var(--red); }

.hero {
  background: #f7faff;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 22px 26px;
  margin-bottom: 16px;
  box-shadow: 0 4px 14px rgba(16, 24, 40, 0.05);
}
.hero .pill-dark { background: var(--accent-soft); color: var(--accent); }
.hero small { color: var(--muted); font-size: 12px; display: block; }
.hero strong { display: block; font-size: 32px; line-height: 1.15; letter-spacing: -1px; margin: 4px 0 2px; }
.hero em { font-style: normal; color: var(--muted); font-size: 12px; }
.hero-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 20px; margin-top: 16px; }
.hero .bar { background: #e9eef8; }
.hero .bar i { background: var(--accent); }

.pill { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 999px; font-size: 11px; font-weight: 600; background: var(--accent-soft); color: var(--accent); }
.pill.green { background: var(--green-soft); color: var(--green); }
.pill.orange { background: var(--orange-soft); color: #b45309; }
.pill.red { background: var(--red-soft); color: var(--red); }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; margin: 12px 0 0; }
.kpis + .kpis { margin-top: 12px; }
.kpis + .card, .kpis + .grid2 { margin-top: 12px; }
.kpi {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px 16px 14px;
  background: #fbfcfe;
  text-decoration: none;
  color: inherit;
  display: block;
}
a.kpi:hover { border-color: #bcd0f7; background: #fff; }
.kpi span { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12px; margin-bottom: 4px; }
.kpi strong { display: block; font-size: 28px; letter-spacing: -0.8px; line-height: 1.2; }
.kpi em { display: block; font-style: normal; font-size: 12px; color: var(--muted); margin-top: 4px; }

.delta { display: inline-flex; align-items: center; gap: 3px; font-size: 12px; font-weight: 600; color: var(--green); background: var(--green-soft); border-radius: 8px; padding: 2px 7px; }
.delta.neg { color: var(--red); background: var(--red-soft); }

.bar { height: 22px; border-radius: 999px; background: #edf0f5; overflow: hidden; }
.bar i { display: block; height: 100%; max-width: 100%; background: var(--accent); border-radius: 999px; }
.bar i.green { background: var(--green); }
.bar i.orange { background: var(--orange); }
.bar i.red { background: var(--red); }
.bar i.purple { background: var(--purple); }

.ranklist { display: grid; gap: 12px; margin-top: 8px; }
.ranklist .bar { height: 22px; }
.rankrow { display: grid; grid-template-columns: minmax(96px, 150px) 1fr auto; gap: 12px; align-items: center; }
.rankname { font-size: 13px; font-weight: 600; display: flex; align-items: center; gap: 8px; min-width: 0; }
.rankname .sq { width: 26px; height: 26px; border-radius: 8px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; font-size: 11px; font-weight: 700; flex: 0 0 26px; }
.rankval { text-align: right; font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }
.ranksub { grid-column: 2 / 4; font-size: 11px; color: var(--muted); margin-top: -4px; }

.quicklinks { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin-top: 4px; }
.qlink {
  display: block;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
  text-decoration: none;
  color: var(--text);
  background: #fbfcfe;
}
.qlink strong { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; font-size: 14px; }
.qlink span { color: var(--muted); font-size: 12px; }
.qlink:hover { border-color: #bcd0f7; background: #fff; }

button, button[type="submit"], a.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: var(--accent);
  color: #fff;
  border: 1px solid var(--accent);
  border-radius: 10px;
  padding: 8px 14px;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}
button:hover, a.button:hover { filter: brightness(0.96); }
button.secondary, a.button.secondary { background: #fff; color: var(--text); border-color: var(--line-strong); }
a.button.primary { background: var(--accent); color: #fff; border-color: var(--accent); }
button.link { background: none; border: 0; color: var(--accent); padding: 0; font: inherit; font-size: 12px; cursor: pointer; }

input, select, textarea {
  font: inherit;
  font-size: 13px;
  color: var(--text);
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  padding: 8px 11px;
}
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(37, 99, 235, 0.18); border-color: var(--accent); }
input.num { text-align: right; font-variant-numeric: tabular-nums; }
label { font-size: 13px; }
label.check { display: inline-flex; align-items: center; gap: 6px; }

.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.row.tight { gap: 6px; }
.row.tight input, .row.tight select { padding: 6px 9px; }
.stack { display: flex; flex-direction: column; gap: 12px; margin-top: 12px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: var(--muted); font-weight: 600; font-size: 12px; background: #fafbfd; }
tbody tr:hover td { background: #fbfcfe; }
table .num { text-align: right; font-variant-numeric: tabular-nums; }
tr.total td { background: #f7f9fc; font-weight: 700; }
tr.newrow td { background: #f5f9ff; }
tr.changed td { background: #fffaf0; }
.tablewrap { overflow-x: auto; margin-top: 10px; border-radius: 12px; }
table.inventory td, table.inventory th { white-space: nowrap; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }

.badge { display: inline-flex; align-items: center; border-radius: 999px; padding: 3px 9px; font-size: 11px; font-weight: 600; background: #f1f3f7; color: #374151; white-space: nowrap; }
.badge.bad { background: var(--red-soft); color: var(--red); }
.badge.warn { background: var(--orange-soft); color: #b45309; }
.badge.ok { background: var(--green-soft); color: var(--green); }
.badge.muted { background: #eef1f5; color: #6b7280; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0 4px; }
.chip { padding: 5px 12px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); text-decoration: none; font-size: 12px; background: #fff; }
.chip em { font-style: normal; color: var(--text); margin-left: 4px; }
.chip.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.chip.active em { color: #fff; }

.tabs { display: flex; gap: 6px; margin: 4px 0 10px; flex-wrap: wrap; }
.tabs a { padding: 6px 14px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); text-decoration: none; font-size: 13px; background: #fff; }
.tabs a.active { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }

.chart { width: 100%; height: 200px; margin-top: 8px; }
.chart rect { fill: #93b4f5; }
.chart rect:hover { fill: var(--accent); }
.chart .axis { stroke: var(--line); stroke-width: 1; }
.chart-labels { position: relative; height: 16px; }
.chart-labels span { position: absolute; transform: translateX(-50%); font-size: 10px; color: var(--muted); }

.spark { width: 120px; height: 24px; display: block; }
.spark polyline { fill: none; stroke: #93b4f5; stroke-width: 1.6; }

.wh span { display: inline-block; margin-right: 8px; font-size: 12px; color: var(--muted); }
.msg { border-radius: 10px; padding: 8px 12px; background: #f5f7fa; font-size: 13px; }

.center { display: grid; place-items: center; min-height: 80vh; }
.narrow { max-width: 380px; width: 100%; }
.login { width: 100%; display: flex; flex-direction: column; gap: 12px; }
.login h1 { margin: 0; }
.login p { margin: 0; }

.kv { display: grid; grid-template-columns: 140px 1fr; gap: 8px 16px; margin: 10px 0 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }

.site-foot {
  max-width: 1480px;
  margin: 0 auto;
  padding: 6px clamp(12px, 2vw, 28px) 28px;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  color: var(--muted-2);
  font-size: 11px;
}

@media (max-width: 860px) {
  .topbar-inner { flex-wrap: wrap; gap: 10px; }
  .topmeta { order: 3; margin-left: 0; width: 100%; }
  .brand-copy small { display: none; }
  .grid2 { grid-template-columns: 1fr; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hero strong { font-size: 26px; }
  .rankrow { grid-template-columns: 1fr auto; }
  .ranksub { grid-column: 1 / 3; }
}

.nav-inner details.menu summary.active { background: var(--accent); color: #fff; font-weight: 600; }

.teamgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; }
.person { border: 1px solid var(--line); border-radius: 16px; padding: 16px; background: #fbfcfe; }
.person .top { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.person .nums { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 8px 0 10px; }
.person .nums small { display: block; color: var(--muted); font-size: 11px; }
.person .nums b { font-size: 16px; letter-spacing: -0.3px; }

.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; }
.cal .dow { font-size: 11px; color: var(--muted); text-align: center; padding: 2px 0; }
.cal .day { min-height: 96px; border: 1px solid var(--line); border-radius: 12px; padding: 8px 9px; background: #fff; }
.cal .day.empty { background: transparent; border: 0; }
.cal .day .dn { font-size: 11px; color: var(--muted); display: flex; justify-content: space-between; gap: 6px; }
.cal .day .amt { font-weight: 700; font-size: 13px; margin-top: 6px; letter-spacing: -0.3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal .day .who { font-size: 11px; color: var(--muted); margin-top: 1px; }
.cal .day.hot { border-color: #c9d9f8; background: #f7faff; }
@media (max-width: 860px) {
  .cal .day { min-height: 66px; padding: 6px; }
  .cal .day .amt { font-size: 11px; margin-top: 3px; }
  .cal .day .who { display: none; }
}

.chart.combo { height: auto; max-height: none; }
.chart .gl { stroke: #eef1f6; stroke-width: 1; }
.chart .ylab { fill: #9aa3b2; font-size: 11px; text-anchor: end; }
.chart .xlab { fill: #9aa3b2; font-size: 11px; text-anchor: middle; }
.chart .blab { fill: #64748b; font-size: 10px; text-anchor: middle; }
.chart .trendline { fill: none; stroke: #94a3b8; stroke-width: 2; stroke-dasharray: 5 4; }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.legend .sw { display: inline-block; width: 10px; height: 10px; border-radius: 3px; background: #93b4f5; margin-right: 5px; vertical-align: -1px; }
.legend .sw.line { background: transparent; border-top: 2px dashed #94a3b8; border-radius: 0; height: 0; width: 14px; vertical-align: 3px; }
.minibar { display: inline-flex; align-items: center; gap: 8px; }
.minibar .bar { width: 90px; height: 12px; }

.kpis.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.kpis.four .kpi { min-height: 268px; display: flex; flex-direction: column; }
.kpis.four .kpi .bar { margin-top: 8px; }
.kpis.four .kpi .gauge { margin-top: auto; }
.mixrow { display: grid; grid-template-columns: 88px minmax(0, 1fr) 46px; gap: 10px; align-items: center; font-size: 13px; }
.mixrow .bar { width: 100%; height: 22px; }
.mixrow b { font-variant-numeric: tabular-nums; font-size: 13px; }
.mixrow span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 13px; font-weight: 600; }
@media (max-width: 1100px) { .kpis.four { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .kpis.four { grid-template-columns: 1fr; } }

.gauge { display: block; width: 100%; max-width: 240px; margin: 10px auto 0; }
.gauge-track { fill: none; stroke: #e9eef8; stroke-width: 22; stroke-linecap: round; }
.gauge-fill { fill: none; stroke: var(--accent); stroke-width: 22; stroke-linecap: round; }
.gauge-knob { fill: #fff; stroke: var(--accent); stroke-width: 4; }
.gauge-pct { font-size: 29px; font-weight: 800; fill: var(--text); text-anchor: middle; letter-spacing: -0.6px; }
.gauge-sub { font-size: 12px; fill: var(--muted); text-anchor: middle; }

.bar i.gray { background: #94a3b8; }

.stdline { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-top: 6px; flex-wrap: wrap; }

.wchart { width: 100%; height: auto; margin-top: 8px; }
.wchart rect { fill: #dbe7ff; }
.wchart rect.now { fill: var(--accent); }
.wchart text { fill: var(--muted); font-size: 9px; text-anchor: middle; }
.chart.mini { height: auto; max-height: 220px; margin-top: 8px; }
.chart.mini rect { fill: #bcd2f7; }
.chart rect.est { fill: #cddcf2; }

.report-shot { width: 100%; height: auto; display: block; margin-top: 12px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }

/* 파일 포털 */
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; font-size: 13px; margin: 2px 0 14px; }
.crumbs a { color: var(--muted); text-decoration: none; padding: 4px 8px; border-radius: 8px; }
.crumbs a:hover { background: var(--bg); color: var(--text); }
.crumbs .sep { color: var(--muted-2); }
.crumb-now { padding: 4px 8px; font-weight: 600; color: var(--text); }
.file-toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.file-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(178px, 1fr)); gap: 12px; align-items: stretch; }
.file-card {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  height: 100%;
  text-decoration: none;
  color: inherit;
}
a.file-card:hover, .file-card:hover { border-color: #bcd0f7; box-shadow: 0 6px 18px rgba(16, 24, 40, 0.07); }
.file-card .thumb {
  display: grid;
  place-items: center;
  aspect-ratio: 4 / 3;
  border-radius: 12px;
  background: #f5f7fa;
  overflow: hidden;
  text-decoration: none;
  color: var(--muted);
  font-weight: 700;
}
.file-card .thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.file-card .thumb .ext { font-size: 18px; letter-spacing: -0.3px; }
.folder-thumb { background: #fff7e6 !important; color: #b45309 !important; font-size: 15px !important; }
.file-name {
  font-weight: 600;
  font-size: 13px;
  line-height: 1.35;
  min-height: 2.7em;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  word-break: break-all;
}
.file-meta { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-actions { display: flex; gap: 6px; margin-top: auto; padding-top: 2px; width: 100%; flex-wrap: nowrap; }
.file-actions .button { flex: 1 1 0; padding: 6px 10px; font-size: 12px; white-space: nowrap; }

/* 파일 포털 레이아웃: 폴더 트리 + 목록/카드 + 상세 드로어 */
.files-head { padding: 16px 18px 18px; }
.files-layout { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 18px; align-items: start; }
.file-side {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fbfcfe;
  padding: 12px;
  position: sticky;
  top: 100px;
  max-height: calc(100vh - 130px);
  overflow: auto;
}
.side-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0 4px 8px;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
}
.tree-root {
  display: block;
  padding: 7px 8px;
  border-radius: 8px;
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
  font-size: 13px;
}
.tree-root:hover { background: var(--bg); }
.tree-root.active { background: var(--accent-soft); color: var(--accent); }
.tree-list, .tree-children { list-style: none; margin: 0; padding: 0; }
.tree-children { padding-left: 14px; }
.tree-row { display: flex; align-items: center; gap: 2px; border-radius: 8px; padding: 2px 4px; cursor: pointer; }
.tree-row:hover { background: var(--bg); }
.tree-row.active { background: var(--accent-soft); }
.tree-row.active .tree-name { color: var(--accent); font-weight: 600; }
.tree-toggle {
  width: 20px;
  min-width: 20px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--muted-2);
  font-size: 11px;
  cursor: pointer;
  filter: none;
}
.tree-toggle:hover { color: var(--text); filter: none; }
.tree-name {
  flex: 1;
  min-width: 0;
  padding: 4px 2px;
  color: var(--text);
  text-decoration: none;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tree-error { padding: 4px 8px; }
.side-note { margin: 12px 4px 0; padding-top: 10px; border-top: 1px solid var(--line); }

.file-main { min-width: 0; position: relative; min-height: 240px; }
.file-main.is-loading { pointer-events: none; }
.file-main.is-loading::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  background: rgba(251, 252, 254, 0.82);
  border-radius: 10px;
}
.file-main.is-loading::after {
  content: attr(data-loading);
  position: absolute;
  top: 42%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 3;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 8px 24px rgba(20, 32, 60, 0.08);
}
.lazy-thumb { background: var(--bg); }
.file-main-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.file-main-head .crumbs { margin: 0; }
.file-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 10px 0 12px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 10px;
}
.file-tools input[name="q"] { min-width: 160px; }
.toolbar-spacer { flex: 1; }
.up { font-size: 12px; color: var(--muted); text-decoration: none; }
.up:hover { color: var(--text); }
.view-toggle { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 10px; overflow: hidden; }
.view-toggle a { padding: 6px 12px; color: var(--muted); font-size: 12px; text-decoration: none; }
.view-toggle a:hover { background: var(--bg); color: var(--text); }
.view-toggle a.active { background: var(--accent); color: #fff; font-weight: 600; }

.file-table th, .file-table td { padding: 8px; }
.name-cell { display: flex; align-items: center; gap: 10px; min-width: 220px; }
.row-thumb {
  width: 42px;
  height: 34px;
  flex: 0 0 42px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 8px;
  background: #f5f7fa;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  text-decoration: none;
}
.row-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.name-wrap { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.row-name {
  max-width: 420px;
  overflow: hidden;
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.row-name:hover { color: var(--accent); }
.folder-ico {
  display: inline-block;
  margin-right: 6px;
  padding: 2px 7px;
  border-radius: 6px;
  background: #fff7e6;
  color: #b45309;
  font-size: 11px;
  font-weight: 700;
}
.row-actions { text-align: right; white-space: nowrap; vertical-align: middle; }
.row-actions-inner { display: flex; justify-content: flex-end; align-items: center; gap: 4px; white-space: nowrap; }
.row-actions .button { padding: 5px 9px; font-size: 11px; white-space: nowrap; }
.file-row.note-level-1, .file-card.note-level-1 {
  --note-accent: #e6a700;
  --note-bg: #fffaf0;
  --note-hover: #fff4d6;
  --note-text: #8a5a00;
}
.file-row.note-level-2, .file-card.note-level-2 {
  --note-accent: #f28c00;
  --note-bg: #fff5e6;
  --note-hover: #ffead0;
  --note-text: #b45309;
}
.file-row.note-level-3, .file-card.note-level-3 {
  --note-accent: #d92d20;
  --note-bg: #fff1f0;
  --note-hover: #ffe4e2;
  --note-text: #b42318;
}
.file-row.has-note { background: var(--note-bg); }
.file-row.has-note td:first-child { box-shadow: inset 4px 0 0 var(--note-accent); }
.file-row.has-note:hover { background: var(--note-hover); }
.file-card.has-note { border-color: var(--note-accent); background: var(--note-bg); box-shadow: inset 4px 0 0 var(--note-accent), 0 1px 2px rgba(16, 24, 40, 0.06); }
.memo-button.has-note { border-color: var(--note-accent); background: var(--note-hover); color: var(--note-text); }
.ellipsis { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.drawer-backdrop { position: fixed; inset: 0; z-index: 85; background: rgba(16, 24, 40, 0.35); }
.drawer-backdrop[hidden], .drawer[hidden] { display: none !important; }
.drawer {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 90;
  width: min(430px, 100vw);
  height: 100vh;
  height: 100dvh;
  padding: 20px;
  overflow: auto;
  background: #fff;
  border-left: 1px solid var(--line);
  box-shadow: -12px 0 30px rgba(16, 24, 40, 0.16);
}
.drawer-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.drawer-head h2 { margin: 0; font-size: 17px; word-break: break-all; }
.drawer-preview {
  aspect-ratio: 4 / 3;
  display: grid;
  place-items: center;
  overflow: hidden;
  margin: 8px 0 14px;
  border-radius: 12px;
  background: #f5f7fa;
}
.drawer-preview img { display: block; width: 100%; height: 100%; object-fit: contain; background: #fff; }
.drawer-preview .ext { color: var(--muted); font-size: 28px; font-weight: 800; letter-spacing: -0.5px; }
.drawer .kv { grid-template-columns: 64px 1fr; }
.drawer [hidden] { display: none !important; }
body.drawer-open { overflow: hidden; }
body.memo-open { overflow: hidden; }
.memo-backdrop { z-index: 95; }
.memo-drawer { z-index: 100; width: min(480px, 100vw); }
.memo-path { margin: 4px 0 0; word-break: break-all; }
.memo-list { margin: 14px 0; border-top: 1px solid var(--line); }
.memo-note { padding: 12px 0; border-bottom: 1px solid var(--line); }
.memo-note-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.memo-note-author { font-size: 12px; font-weight: 700; }
.memo-note-time { font-size: 11px; color: var(--muted); }
.memo-note-body { white-space: pre-wrap; word-break: break-word; font-size: 13px; line-height: 1.55; }
.memo-note-delete { padding: 0; border: 0; background: none; color: var(--muted); font-size: 11px; cursor: pointer; }
.memo-note-delete:hover { color: #b42318; }
.memo-empty { padding: 18px 0; color: var(--muted); font-size: 13px; }
.memo-form { padding-top: 10px; }
.memo-form textarea {
  width: 100%;
  min-height: 96px;
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: #fff;
  color: var(--text);
  font: inherit;
  font-size: 13px;
  line-height: 1.5;
  resize: vertical;
}
.memo-form textarea:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
.memo-form-actions { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.rename-box {
  margin-top: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fbfcfe;
}
.rename-box label { display: block; margin-bottom: 6px; }
.rename-box input[type="text"] {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: #fff;
  color: var(--text);
  font: inherit;
  font-size: 13px;
}
.rename-box input[type="text"]:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
.rename-box .row { margin-top: 8px; align-items: center; flex-wrap: wrap; }

@media (max-width: 980px) {
  .files-layout { grid-template-columns: 1fr; }
  .file-side { position: static; max-height: 260px; }
  .file-table .ellipsis { max-width: 160px; }
  .row-name { max-width: 220px; }
}

