/* 공통 관리 화면 스타일 (core)
   색은 모두 :root 토큰으로 정의하고, 어두운 테마는 [data-theme="dark"]에서 다시 정의한다.
   (data-theme은 theme-init.js가 저장값 또는 OS 설정으로 정한다) */

:root {
  --bg: #f4f5f8;
  --surface: #ffffff;
  --surface-2: #f8f9fb;
  --surface-hover: #f1f3f7;
  --border: #e2e5eb;
  --border-strong: #cdd2db;
  --text: #1c2333;
  --muted: #5b6577;
  --subtle: #8a93a5;
  /* 대표 색은 --primary 하나만 정한다(base.html이 SiteConfig.primary로 덮어씀). 나머지는 여기서 계산 */
  --primary: #4b57d1;
  --primary-hover: color-mix(in srgb, var(--primary) 84%, #000);
  --primary-soft: color-mix(in srgb, var(--primary) 11%, #fff);
  --primary-text: #ffffff;
  --focus: color-mix(in srgb, var(--primary) 35%, transparent);
  --danger: #c93a3a;

  --sidebar-bg: #161b2e;
  --sidebar-text: #b9bfd0;
  --sidebar-muted: #6f7790;
  --sidebar-hover: rgba(255, 255, 255, 0.06);
  --sidebar-active-bg: color-mix(in srgb, var(--primary) 24%, transparent);
  --sidebar-active: #ffffff;
  --sidebar-active-icon: color-mix(in srgb, var(--primary) 45%, #fff);

  --green: #1d8a57;  --green-bg: #e5f5ec;
  --blue: #2a63c9;   --blue-bg: #e7effc;
  --amber: #a7680f;  --amber-bg: #fcf1dc;
  --red: #c13636;    --red-bg: #fce8e8;
  --gray: #5b6577;   --gray-bg: #eef0f4;
  --violet: #6e45cc; --violet-bg: #f0eafc;

  --radius: 10px;
  --radius-sm: 7px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.05), 0 1px 3px rgba(16, 24, 40, 0.07);
  --shadow-lg: 0 10px 30px rgba(16, 24, 40, 0.14);
  --sidebar-w: 232px;
  --topbar-h: 60px;
  /* 글꼴은 fonts.css에서 이 서버의 파일로 불러온다. 뒤쪽은 불러오기 전·실패 때 쓰는 시스템 글꼴 */
  --font: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, system-ui, "Apple SD Gothic Neo",
    "Malgun Gothic", "Noto Sans KR", "Segoe UI", sans-serif;
  color-scheme: light;  /* 날짜·체크박스 같은 브라우저 기본 부품도 밝은 테마로 */
  /* 차트 계열 색 (순서 고정 — 색약 구분 검증을 통과한 순서. 바꾸면 dataviz 검증을 다시 돌린다) */
  --series-1: #2a78d6; --series-2: #eb6834; --series-3: #1baf7a; --series-4: #eda100;
  --series-5: #e87ba4; --series-6: #008300; --series-7: #6250d6; --series-8: #e34948;
  --mono: "JetBrains Mono Variable", "JetBrains Mono", ui-monospace, "SFMono-Regular", Consolas, "D2Coding", monospace;
}

:root[data-theme="dark"] {
  --bg: #0e121d;
  --surface: #161b29;
  --surface-2: #1b2131;
  --surface-hover: #212839;
  --border: #283044;
  --border-strong: #364059;
  --text: #e4e7ef;
  --muted: #a1a9bb;
  --subtle: #758096;
  --primary: #7d87f2;
  --primary-hover: color-mix(in srgb, var(--primary) 82%, #fff);
  --primary-soft: color-mix(in srgb, var(--primary) 18%, #161b29);
  --primary-text: #0e121d;
  --focus: color-mix(in srgb, var(--primary) 40%, transparent);
  --danger: #f07171;

  --sidebar-bg: #0a0d16;
  --sidebar-text: #aab1c4;
  --sidebar-muted: #5f6880;

  --green: #5fd09a;  --green-bg: rgba(95, 208, 154, 0.13);
  --blue: #7fa9f5;   --blue-bg: rgba(127, 169, 245, 0.14);
  --amber: #f0b660;  --amber-bg: rgba(240, 182, 96, 0.14);
  --red: #f28383;    --red-bg: rgba(242, 131, 131, 0.14);
  --gray: #a1a9bb;   --gray-bg: rgba(161, 169, 187, 0.12);
  --violet: #b59cf5; --violet-bg: rgba(181, 156, 245, 0.14);

  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.45);
  color-scheme: dark;
  --series-1: #3987e5; --series-2: #d95926; --series-3: #199e70; --series-4: #c98500;
  --series-5: #d55181; --series-6: #008300; --series-7: #9085e9; --series-8: #e66767;
}

/* ─── 기본 ───────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  word-break: keep-all;          /* 한글은 낱말 단위로 줄바꿈 */
  overflow-wrap: break-word;
}
h1, h2, h3 { margin: 0; line-height: 1.3; letter-spacing: -0.02em; }
p { margin: 0; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
img, svg { display: block; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

.icon { width: 18px; height: 18px; flex-shrink: 0; }
.mono { font-family: var(--mono); font-size: 12.5px; letter-spacing: -0.01em; }
.prewrap { white-space: pre-wrap; overflow-wrap: anywhere; }
.nowrap { white-space: nowrap; }
.subtle { color: var(--muted); }
small { color: var(--subtle); font-size: 12px; }
kbd.hint-key {
  font-family: var(--mono); font-size: 11px; color: var(--subtle);
  border: 1px solid var(--border); border-radius: 4px; padding: 0 5px; line-height: 18px;
}

/* ─── 앱 틀 ──────────────────────────────────────── */
.shell { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  padding: 14px 12px;
  z-index: 40;
}
.brand {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 10px 18px;
  color: #fff; font-weight: 700; font-size: 16px; letter-spacing: -0.01em;
}
.brand:hover { text-decoration: none; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-link {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: var(--sidebar-text);
  font-weight: 500;
}
.nav-link:hover { background: var(--sidebar-hover); color: #fff; text-decoration: none; }
.nav-link.is-active { background: var(--sidebar-active-bg); color: var(--sidebar-active); }
.nav-link.is-active .icon { color: var(--sidebar-active-icon); }
.sidebar-foot { margin-top: auto; padding: 12px 10px 2px; font-size: 12px; color: var(--sidebar-muted); }
.sidebar-backdrop { display: none; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  position: sticky; top: 0; z-index: 30;
  height: var(--topbar-h);
  display: flex; align-items: center; gap: 12px;
  padding: 0 24px;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(8px);
  border-bottom: 1px solid var(--border);
}
.global-search {
  flex: 1; max-width: 520px;
  display: flex; align-items: center; gap: 8px;
  padding: 0 10px 0 12px; height: 38px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--subtle);
}
.global-search:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px var(--focus); }
.global-search input { flex: 1; min-width: 0; border: 0; background: transparent; outline: none; color: var(--text); }
.topbar-spacer { flex: 1; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px;
  border: 1px solid transparent; border-radius: var(--radius-sm);
  background: transparent; color: var(--muted); cursor: pointer;
}
.icon-btn:hover { background: var(--surface-hover); color: var(--text); }
.show-dark { display: none; }
:root[data-theme="dark"] .show-dark { display: block; }
:root[data-theme="dark"] .show-light { display: none; }
.only-mobile { display: none; }

.user-menu { position: relative; }
.user-menu summary {
  list-style: none; cursor: pointer;
  display: flex; align-items: center; gap: 8px;
  padding: 4px 8px 4px 4px; border-radius: 999px;
  color: var(--muted);
}
.user-menu summary::-webkit-details-marker { display: none; }
.user-menu summary:hover { background: var(--surface-hover); }
.avatar {
  width: 30px; height: 30px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--primary-soft); color: var(--primary); font-weight: 700; font-size: 13px;
}
.user-name { color: var(--text); font-weight: 500; }
.user-menu .menu {
  position: absolute; right: 0; top: calc(100% + 6px);
  min-width: 210px; padding: 6px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
}
.menu-head { display: flex; flex-direction: column; padding: 8px 10px 10px; border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.menu-head span { font-size: 12px; color: var(--subtle); }
.menu a, .menu button {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 8px 10px; border: 0; border-radius: 6px;
  background: none; color: var(--text); text-align: left; cursor: pointer;
}
.menu a:hover, .menu button:hover { background: var(--surface-hover); text-decoration: none; }
.menu .icon { color: var(--muted); width: 16px; height: 16px; }

/* 모든 페이지는 화면 가로 전체를 쓴다 (최대 너비 제한 없음) */
.content { padding: 24px 28px 64px; width: 100%; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head h1 { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; }
.page-head .subtle { margin-top: 4px; }
.page-actions { display: flex; gap: 8px; }

/* ─── 경로 표시 · 툴팁 · 로딩 ─────────────────────── */
.crumbs { margin-bottom: 10px; }
.crumbs ol { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 2px; font-size: 13px; }
.crumbs li { display: inline-flex; align-items: center; color: var(--muted); }
.crumbs li + li::before { content: "›"; margin: 0 6px; color: var(--subtle); }
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--primary); }
.crumbs [aria-current] { color: var(--text); font-weight: 500; }

[data-tip] { position: relative; }
[data-tip]::after {
  content: attr(data-tip); position: absolute; z-index: 70; pointer-events: none;
  left: 50%; bottom: calc(100% + 8px); transform: translate(-50%, 4px);
  padding: 5px 9px; border-radius: 6px; white-space: nowrap;
  background: #1c2333; color: #fff; font-size: 12px; font-weight: 500; line-height: 1.4;
  opacity: 0; transition: opacity 0.12s, transform 0.12s;
}
:root[data-theme="dark"] [data-tip]::after { background: #e4e7ef; color: #0e121d; }
[data-tip]:hover::after, [data-tip]:focus-visible::after { opacity: 1; transform: translate(-50%, 0); transition-delay: 0.25s; }
[data-tip][data-tip-pos="bottom"]::after { bottom: auto; top: calc(100% + 8px); transform: translate(-50%, -4px); }
[data-tip][data-tip-pos="bottom"]:hover::after, [data-tip][data-tip-pos="bottom"]:focus-visible::after { transform: translate(-50%, 0); }
[data-tip][data-tip-pos="left"]::after { left: auto; right: calc(100% + 8px); bottom: 50%; transform: translate(4px, 50%); }
[data-tip][data-tip-pos="left"]:hover::after, [data-tip][data-tip-pos="left"]:focus-visible::after { transform: translate(0, 50%); }

.page-loading {
  position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 90; pointer-events: none;
  background: linear-gradient(90deg, transparent, var(--primary), transparent);
  background-size: 40% 100%; background-repeat: no-repeat;
  opacity: 0; transition: opacity 0.15s;
}
.page-loading.is-active { opacity: 1; animation: loading-bar 1.1s ease-in-out infinite; transition-delay: 0.15s; }
@keyframes loading-bar { from { background-position: -40% 0; } to { background-position: 140% 0; } }
.btn.is-busy { pointer-events: none; opacity: 0.75; }
.btn.is-busy::before {
  content: ""; width: 14px; height: 14px; border-radius: 50%; flex-shrink: 0;
  border: 2px solid currentColor; border-right-color: transparent; animation: spin 0.7s linear infinite;
}
.btn.is-busy > .icon { display: none; }

/* ─── 카드 / 그리드 ──────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 20px;
  margin-bottom: 18px;
}
.card-flush { padding: 0; overflow: hidden; }
.card-attention { border-color: var(--amber); box-shadow: 0 0 0 3px var(--amber-bg); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.card-head h2 { font-size: 15px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.card-head h2 .icon { color: var(--muted); }
.link-more { display: inline-flex; align-items: center; gap: 2px; font-size: 13px; }
.link-more .icon { width: 15px; height: 15px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.grid-2 > .card { margin-bottom: 0; }
.grid-2 { margin-bottom: 18px; }
.grid-side { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 18px; align-items: start; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat-card {
  display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto auto; column-gap: 12px;
  align-content: start;
  padding: 16px 18px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); color: var(--text);
  transition: border-color 0.15s, transform 0.15s;
}
.stat-card:hover { border-color: var(--border-strong); text-decoration: none; transform: translateY(-1px); }
.stat-icon {
  grid-row: 1 / span 3; width: 40px; height: 40px; border-radius: 10px;
  display: inline-flex; align-items: center; justify-content: center;
}
.stat-label { font-size: 13px; color: var(--muted); }
.stat-value { font-size: 24px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.25; font-variant-numeric: tabular-nums; }
.stat-sub { font-size: 12px; color: var(--subtle); }

/* ─── 목록 ───────────────────────────────────────── */
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-top: 1px solid var(--border); }
.list li:first-child { border-top: 0; padding-top: 2px; }
.list-main { display: flex; flex-direction: column; min-width: 0; }
.list-title { font-weight: 500; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: flex; align-items: center; }
a.list-title:hover { color: var(--primary); }
.list-sub { font-size: 12px; color: var(--subtle); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ─── 표 ─────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 11px 14px; text-align: left; vertical-align: middle; border-bottom: 1px solid var(--border); }
/* 좁은 화면에서 칸이 찌그러지지 않게 줄바꿈 없이 가로 스크롤한다. 긴 글은 .cell-wide만 줄바꿈 */
.table td { white-space: nowrap; }
.table td.cell-wide { white-space: normal; }
.table thead th {
  background: var(--surface-2);
  font-size: 12px; font-weight: 600; color: var(--muted);
  white-space: nowrap;
}
.table tbody tr:hover { background: var(--surface-hover); }
.table tbody tr:last-child td { border-bottom: 0; }
.table th.num, .table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.table th.num a { justify-content: flex-end; }
.card:not(.card-flush) .table th:first-child, .card:not(.card-flush) .table td:first-child { padding-left: 0; }

th.sortable a { display: inline-flex; align-items: center; gap: 4px; color: inherit; }
th.sortable a:hover { color: var(--text); text-decoration: none; }
.sort-ind .icon { width: 13px; height: 13px; opacity: 0.45; }
th.is-sorted { color: var(--primary); }
th.is-sorted .sort-ind .icon { opacity: 1; }

.cell-main { font-weight: 500; display: flex; align-items: center; }
.row-link { color: var(--text); }
.row-link:hover { color: var(--primary); }
.cell-sub { font-size: 12px; color: var(--subtle); }
.cell-wide { min-width: 260px; }
@media (max-width: 560px) { .cell-wide { min-width: 220px; } }
.cell-clip { max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.link-ext { display: inline-flex; align-items: center; gap: 3px; max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.link-ext .icon { width: 12px; height: 12px; }
.empty-row td { padding: 0; }
.empty-row:hover { background: none !important; }
.actions-col { text-align: right !important; white-space: nowrap; }
.row-actions { display: inline-flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }

.swatch {
  display: inline-block; width: 9px; height: 9px; border-radius: 50%;
  background: var(--swatch, var(--gray)); margin-right: 7px; flex-shrink: 0;
}
.chip {
  display: inline-block; padding: 1px 8px; margin: 2px 4px 2px 0;
  font-size: 12px; color: var(--muted); background: var(--gray-bg); border-radius: 999px;
}

/* ─── 툴바 (검색·필터) ───────────────────────────── */
.toolbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  padding: 12px 14px; border-bottom: 1px solid var(--border);
}
.card:not(.card-flush) > .toolbar { padding: 0 0 12px; margin-bottom: 4px; }
.search-field {
  display: flex; align-items: center; gap: 8px;
  flex: 1 1 240px; max-width: 360px; height: 36px; padding: 0 10px;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  color: var(--subtle);
}
.search-field:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px var(--focus); }
.search-field input { flex: 1; min-width: 0; border: 0; outline: none; background: transparent; color: var(--text); }
.toolbar select { height: 36px; }
select.is-set { border-color: var(--primary); color: var(--primary); background-color: var(--primary-soft); }
.toolbar-end { margin-left: auto; display: flex; gap: 6px; }

/* 기간 필터 */
.date-range {
  display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 4px 0 10px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface); color: var(--subtle);
}
.date-range.is-set { border-color: var(--primary); background: var(--primary-soft); }
.date-range .icon { width: 16px; height: 16px; }
.date-range-label { font-size: 13px; color: var(--muted); white-space: nowrap; }
.date-range input[type="date"] { height: 28px; width: 132px; padding: 0 6px; border: 0; background: transparent; }
.date-range input[type="date"]:focus { box-shadow: none; }
.date-range select { height: 28px; border: 0; background: transparent; color: var(--muted); padding-right: 22px; }
.date-range-sep { color: var(--subtle); }

/* 표 보기 메뉴 (열·줄 간격) */
.col-hidden { display: none !important; }
.table.density-compact th, .table.density-compact td { padding-top: 6px; padding-bottom: 6px; }
.table.density-compact .cell-sub { display: none; }
.table.density-comfy th, .table.density-comfy td { padding-top: 16px; padding-bottom: 16px; }
.view-menu { position: relative; }
.view-menu summary { list-style: none; }
.view-menu summary::-webkit-details-marker { display: none; }
.view-menu summary.is-set { border-color: var(--primary); color: var(--primary); background: var(--primary-soft); }
.view-panel {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 20; width: 230px; padding: 10px 12px 12px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg);
}
.view-title { font-size: 12px; font-weight: 600; color: var(--subtle); margin: 4px 0 6px; }
.view-cols { display: flex; flex-direction: column; gap: 6px; max-height: 260px; overflow-y: auto; margin-bottom: 10px; }
.view-cols .check { font-weight: 400; font-size: 13px; }
.view-cols input:disabled + span { color: var(--subtle); }
.seg { display: flex; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); overflow: hidden; margin-bottom: 10px; }
.seg button { flex: 1; height: 30px; border: 0; background: var(--surface); color: var(--muted); cursor: pointer; font-size: 13px; }
.seg button + button { border-left: 1px solid var(--border-strong); }
.seg button.is-active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.btn-block-sm { width: 100%; justify-content: center; }
.seg-inline { margin: 0; }
.seg-inline a { display: inline-flex; align-items: center; height: 34px; padding: 0 14px; color: var(--muted); font-size: 13px; background: var(--surface); }
.seg-inline a + a { border-left: 1px solid var(--border-strong); }
.seg-inline a:hover { text-decoration: none; color: var(--text); }
.seg-inline a.is-active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }

/* ─── 페이지네이션 ───────────────────────────────── */
.pager {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px;
  padding: 12px 14px; border-top: 1px solid var(--border);
  color: var(--muted); font-size: 13px;
}
.pager-info strong { color: var(--text); }
.pager-nav { display: flex; align-items: center; gap: 3px; }
.pg {
  min-width: 32px; height: 32px; padding: 0 6px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 6px; color: var(--text); font-variant-numeric: tabular-nums;
}
.pg .icon { width: 16px; height: 16px; }
.pg:hover { background: var(--surface-hover); text-decoration: none; }
.pg.is-current { background: var(--primary); color: var(--primary-text); font-weight: 600; }
.pg.is-disabled { pointer-events: none; opacity: 0.35; }
.pg-gap { padding: 0 4px; color: var(--subtle); }
.pager-jump { display: flex; align-items: center; gap: 6px; }
.pager-jump input { width: 64px; height: 32px; }

/* ─── 탭 ─────────────────────────────────────────── */
.tabs {
  display: flex; gap: 2px; overflow-x: auto;
  margin-bottom: 16px; border-bottom: 1px solid var(--border);
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 10px 14px; margin-bottom: -1px;
  border: 0; border-bottom: 2px solid transparent; background: none;
  color: var(--muted); font-weight: 500; white-space: nowrap; cursor: pointer;
}
.tab .icon { width: 16px; height: 16px; }
.tab:hover { color: var(--text); text-decoration: none; }
.tab.is-active { color: var(--primary); border-bottom-color: var(--primary); }
.tab-count {
  font-size: 11px; font-weight: 600; padding: 0 7px; border-radius: 999px;
  background: var(--gray-bg); color: var(--muted); line-height: 18px;
}
.tab.is-active .tab-count { background: var(--primary-soft); color: var(--primary); }

/* ─── 배지 / 톤 ─────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center;
  padding: 2px 9px; border-radius: 999px;
  font-size: 12px; font-weight: 600; white-space: nowrap; line-height: 18px;
}
.tone-green { color: var(--green); background: var(--green-bg); }
.tone-blue { color: var(--blue); background: var(--blue-bg); }
.tone-amber { color: var(--amber); background: var(--amber-bg); }
.tone-red { color: var(--red); background: var(--red-bg); }
.tone-gray { color: var(--gray); background: var(--gray-bg); }
.tone-violet { color: var(--violet); background: var(--violet-bg); }

/* ─── 폼 / 버튼 ──────────────────────────────────── */
input[type="text"], input[type="password"], input[type="email"], input[type="number"], input[type="search"],
input[type="date"], input[type="color"], select, textarea {
  height: 38px; padding: 0 11px;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  outline: none; min-width: 0;
}
.search-field input, .global-search input,
.search-field input:focus, .global-search input:focus { height: auto; padding: 0; border: 0; background: transparent; box-shadow: none; }
select { padding-right: 28px; cursor: pointer; }
input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--focus); }
input:disabled { background: var(--surface-2); color: var(--subtle); }
input[type="search"]::-webkit-search-cancel-button { cursor: pointer; }

.form { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span:first-child, .field > .field-label { font-size: 13px; font-weight: 600; color: var(--muted); }
.field input, .field select, .field textarea { width: 100%; }
input[type="color"] { width: 72px !important; padding: 3px 4px; cursor: pointer; }
input[type="date"]::-webkit-calendar-picker-indicator { cursor: pointer; opacity: 0.7; }
textarea { height: auto; min-height: 88px; padding: 9px 11px; line-height: 1.5; resize: vertical; }
.field-control { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.req { color: var(--danger); margin-left: 3px; font-weight: 700; }
.field.has-error input, .field.has-error select, .field.has-error textarea { border-color: var(--danger); }
.field.has-error input:focus, .field.has-error select:focus, .field.has-error textarea:focus {
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--danger) 25%, transparent);
}
.field-error { display: flex; align-items: flex-start; gap: 5px; margin: 0; font-size: 12.5px; color: var(--danger); }
.field-error .icon { width: 14px; height: 14px; margin-top: 2px; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-weight: 500; }
.check input { width: 16px; height: 16px; accent-color: var(--primary); }
.field-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 4px; }
.field-inline { flex-direction: row; align-items: center; justify-content: space-between; gap: 24px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.field-inline:first-of-type { padding-top: 0; }
.field-inline > .field-label { display: flex; flex-direction: column; gap: 2px; font-size: 14px; font-weight: 600; color: var(--text); }
.field-inline > .field-label small { font-weight: 400; }
.field-inline > .field-control { width: 220px; flex-shrink: 0; }
.field-inline > input, .field-inline > select { width: 220px; flex-shrink: 0; }
.form-settings { max-width: 760px; }
.input-with-btn { position: relative; display: block; }
.input-with-btn input { padding-right: 42px; }
.input-with-btn .icon-btn { position: absolute; right: 2px; top: 1px; }
[data-toggle-password] .when-shown, [data-toggle-password].is-shown .when-hidden { display: none; }
[data-toggle-password].is-shown .when-shown { display: block; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 36px; padding: 0 14px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text);
  font-weight: 600; white-space: nowrap; cursor: pointer;
}
.btn .icon { width: 16px; height: 16px; }
.btn:hover { background: var(--surface-hover); text-decoration: none; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: var(--primary-text); }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn-primary:disabled:hover { background: var(--primary); }
.btn-ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn-danger-ghost { color: var(--danger); }
.btn-sm { height: 30px; padding: 0 10px; font-size: 13px; }
.btn-block { width: 100%; height: 42px; }

.alert { display: flex; gap: 10px; align-items: flex-start; padding: 11px 13px; border-radius: var(--radius-sm); margin-bottom: 14px; font-size: 13px; }
.alert-error { color: var(--red); background: var(--red-bg); }
.alert-warn { color: var(--amber); background: var(--amber-bg); }

/* 태그 입력 */
.tags-input {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-height: 38px; padding: 4px 8px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface); cursor: text;
}
.tags-input:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px var(--focus); }
.field.has-error .tags-input, .tags-input.is-invalid { border-color: var(--danger); }
.tags-typer { flex: 1; min-width: 120px; height: 28px !important; padding: 0 !important; border: 0 !important; background: transparent !important; box-shadow: none !important; }
.tag-chip {
  display: inline-flex; align-items: center; gap: 2px; padding: 2px 4px 2px 9px;
  background: var(--primary-soft); color: var(--primary); border-radius: 999px; font-size: 13px; font-weight: 500;
}
.tag-x { border: 0; background: none; color: inherit; cursor: pointer; font-size: 15px; line-height: 1; padding: 0 4px; opacity: 0.7; }
.tag-x:hover { opacity: 1; }

/* ─── 빈 상태 ────────────────────────────────────── */
.empty { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 40px 16px; text-align: center; color: var(--muted); }
.empty .icon { width: 32px; height: 32px; color: var(--subtle); margin-bottom: 4px; }
.empty p { font-weight: 500; }

/* ─── 알림 토스트 ───────────────────────────────── */
.toasts { position: fixed; top: 72px; right: 20px; z-index: 60; display: flex; flex-direction: column; gap: 8px; max-width: min(440px, calc(100vw - 32px)); }
.toast {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 12px 12px 14px;
  background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--blue);
  border-radius: var(--radius-sm); box-shadow: var(--shadow-lg);
  animation: toast-in 0.2s ease-out;
}
.toast > .icon { margin-top: 1px; color: var(--blue); }
.toast span { flex: 1; word-break: keep-all; overflow-wrap: anywhere; }
.toast-success { border-left-color: var(--green); } .toast-success > .icon { color: var(--green); }
.toast-error { border-left-color: var(--red); } .toast-error > .icon { color: var(--red); }
.toast-warn { border-left-color: var(--amber); } .toast-warn > .icon { color: var(--amber); }
.toast-close { border: 0; background: none; color: var(--subtle); cursor: pointer; padding: 0; }
.toast-close .icon { width: 16px; height: 16px; }
.toast.is-leaving { opacity: 0; transform: translateX(16px); transition: 0.25s; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-6px); } }
.auth-page .toasts { position: static; max-width: none; margin-bottom: 14px; }
.auth-page .toast { box-shadow: none; }

/* ─── 위/아래 이동 버튼 ─────────────────────────── */
.scroll-btns {
  position: fixed; right: 20px; bottom: 20px; z-index: 50;
  display: flex; flex-direction: column; gap: 6px;
  opacity: 0; pointer-events: none; transition: opacity 0.2s;
}
.scroll-btns.is-visible { opacity: 1; pointer-events: auto; }
.scroll-btns .icon-btn {
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--surface); border-color: var(--border); box-shadow: var(--shadow-lg); color: var(--text);
}
.scroll-btns .icon-btn:disabled { opacity: 0.35; cursor: default; }

/* ─── 로그인 / 오류 화면 ────────────────────────── */
.auth-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px 16px;
  background:
    radial-gradient(1200px 600px at 10% -10%, color-mix(in srgb, var(--primary) 16%, transparent), transparent 60%),
    radial-gradient(900px 500px at 110% 110%, color-mix(in srgb, var(--violet) 14%, transparent), transparent 60%),
    var(--bg);
}
.auth-card {
  width: 100%; max-width: 400px; padding: 32px 30px 26px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow-lg);
}
.auth-brand { display: flex; align-items: center; gap: 14px; margin-bottom: 24px; }
.auth-brand h1 { font-size: 20px; letter-spacing: -0.02em; }
.auth-brand p { color: var(--muted); font-size: 13px; }
.auth-foot { display: flex; align-items: center; justify-content: center; gap: 6px; margin-top: 18px; font-size: 12px; color: var(--subtle); }
.auth-foot .icon { width: 14px; height: 14px; }
.auth-theme { position: fixed; top: 16px; right: 16px; }
.error-card { text-align: center; }
.error-code { display: block; font-size: 56px; font-weight: 800; letter-spacing: -0.04em; color: var(--primary); line-height: 1.1; }
.error-card p { margin: 10px 0 22px; color: var(--muted); }
.error-actions { display: flex; gap: 8px; justify-content: center; }

/* ─── 일괄 선택 ───────────────────────────────────── */
.select-col { width: 44px; padding-right: 0 !important; }
.row-check { width: 16px; height: 16px; accent-color: var(--primary); cursor: pointer; vertical-align: middle; }
.table tbody tr.is-selected { background: var(--primary-soft); }
.bulk-bar {
  position: sticky; top: var(--topbar-h); z-index: 5;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px;
  padding: 10px 14px; background: var(--primary-soft); border-bottom: 1px solid var(--border);
}
.bulk-count strong { color: var(--primary); font-variant-numeric: tabular-nums; }
.bulk-actions { display: flex; flex-wrap: wrap; gap: 6px; }

/* ─── 상세 화면 ───────────────────────────────────── */
.detail-head { margin-bottom: 18px; }
.back-link { display: inline-flex; align-items: center; gap: 2px; font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.back-link .icon { width: 16px; height: 16px; }
.detail-title-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.detail-title h1 { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.detail-title .subtle { margin-top: 4px; }
.detail-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.detail-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 18px; align-items: start; }
.detail-aside { display: flex; flex-direction: column; gap: 18px; position: sticky; top: calc(var(--topbar-h) + 16px); }
.detail-aside > .card { margin-bottom: 0; }
.info-list { margin: 0; display: flex; flex-direction: column; }
.info-list > div { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 12px; padding: 9px 0; border-top: 1px solid var(--border); }
.info-list > div:first-child { border-top: 0; padding-top: 0; }
.info-list dt { color: var(--muted); font-size: 13px; }
.info-list dd { margin: 0; overflow-wrap: anywhere; }
.mini-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.mini-stat { padding: 10px 12px; border-radius: var(--radius-sm); background: var(--surface-2); }
.mini-stat span { display: block; font-size: 12px; color: var(--muted); }
.mini-stat strong { font-size: 18px; font-variant-numeric: tabular-nums; }
.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline::before { content: ""; position: absolute; left: 15px; top: 6px; bottom: 6px; width: 2px; background: var(--border); }
.timeline li { position: relative; display: flex; gap: 12px; padding: 6px 0 12px; }
.tl-dot { position: relative; z-index: 1; width: 32px; height: 32px; flex-shrink: 0; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; box-shadow: 0 0 0 3px var(--surface); }
.tl-dot .icon { width: 15px; height: 15px; }
.tl-title { font-weight: 500; }
.tl-sub { font-size: 12px; color: var(--subtle); }
@media (max-width: 1100px) {
  .detail-grid { grid-template-columns: minmax(0, 1fr); }
  .detail-aside { position: static; }
}

/* 오류 상세 */
.error-type { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-family: var(--mono); font-size: 13px; }
.error-message { margin: 6px 0 14px; color: var(--danger); overflow-wrap: anywhere; }
.code-block {
  margin: 0 0 12px; padding: 12px 14px; max-height: 420px; overflow: auto;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-family: var(--mono); font-size: 12px; line-height: 1.55; white-space: pre; word-break: normal;
}
.drawer .code-block { max-height: none; }

/* 역할·권한 */
.perm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 8px 18px; }
.perm-grid .check { font-weight: 400; align-items: flex-start; }
.perm-grid .check input { margin-top: 3px; }
.perm-grid small { display: block; }
.role-card { margin-bottom: 18px; }
.role-name { height: 32px !important; font-weight: 600; width: 180px; }
.inline-form select { height: 30px; font-size: 13px; }

/* 2단계 인증 */
.totp-card { max-width: 760px; }
.steps { margin: 0 0 18px; padding-left: 20px; color: var(--muted); }
.steps li { margin: 4px 0; }
.totp-grid { display: grid; grid-template-columns: auto 1fr; gap: 24px; align-items: start; }
.totp-qr { padding: 8px; background: #fff; border: 1px solid var(--border); border-radius: var(--radius); line-height: 0; }
.totp-qr svg { width: 200px; height: 200px; }
.secret-key { display: block; font-family: var(--mono); font-size: 15px; letter-spacing: 0.04em; padding: 10px 12px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); overflow-wrap: anywhere; user-select: all; }
.totp-grid .form { margin-top: 16px; }
.otp-input { font-family: var(--mono); font-size: 20px !important; letter-spacing: 0.25em; text-align: center; height: 46px !important; }
.recovery-codes { list-style: none; margin: 14px 0; padding: 14px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 24px; background: var(--surface-2); border-radius: var(--radius-sm); font-size: 15px; }
@media (max-width: 560px) { .totp-grid { grid-template-columns: 1fr; } .recovery-codes { grid-template-columns: 1fr; } }

/* ─── 모달 · 옆 패널 (<dialog>) ─────────────────── */
dialog { padding: 0; border: 0; background: transparent; color: var(--text); max-width: none; max-height: none; }
dialog::backdrop { background: rgba(10, 13, 22, 0.5); }
body:has(dialog[open]) { overflow: hidden; }
.modal-box {
  display: flex; flex-direction: column; max-height: calc(100vh - 48px);
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-lg);
}
.modal .modal-box { width: min(520px, calc(100vw - 32px)); }
.modal.modal-sm .modal-box { width: min(420px, calc(100vw - 32px)); }
.modal.modal-lg .modal-box { width: min(820px, calc(100vw - 32px)); }
/* 전체 화면: 넓은 표·편집기·미리보기용. 모바일에서는 화면 끝까지 */
.modal.modal-full { margin: 16px auto; }
.modal.modal-full .modal-box { width: calc(100vw - 32px); height: calc(100vh - 32px); max-height: none; }
.modal.modal-full .modal-body { flex: 1; }
@media (max-width: 640px) {
  .modal.modal-full { margin: 0; }
  .modal.modal-full .modal-box { width: 100vw; height: 100vh; border-radius: 0; }
}
.modal[open] { animation: modal-in 0.16s ease-out; }
@keyframes modal-in { from { opacity: 0; transform: translateY(8px) scale(0.98); } }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px 12px 20px; border-bottom: 1px solid var(--border); }
.modal-head h2 { font-size: 16px; font-weight: 700; }
.modal-body { padding: 18px 20px; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 20px 16px; }
.modal-body > .modal-foot { padding: 16px 0 0; margin-top: 4px; }
.confirm-body { display: flex; gap: 14px; padding-top: 22px; }
.confirm-body h2 { font-size: 16px; margin-bottom: 4px; }
.confirm-body p { color: var(--muted); white-space: pre-line; }
.confirm-icon { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; flex-shrink: 0; border-radius: 50%; background: var(--amber-bg); color: var(--amber); }

.drawer { margin: 0 0 0 auto; height: 100vh; max-height: 100vh; }
.drawer .modal-box { width: min(520px, 100vw); height: 100%; max-height: none; border-radius: 0; border-width: 0 0 0 1px; }
.drawer[open] { animation: drawer-in 0.2s ease-out; }
@keyframes drawer-in { from { transform: translateX(40px); opacity: 0; } }

.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { background: color-mix(in srgb, var(--danger) 85%, #000); border-color: transparent; }

/* 불러오는 중 */
.loading { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 40px 16px; color: var(--muted); }
.spinner {
  width: 18px; height: 18px; border-radius: 50%; flex-shrink: 0;
  border: 2px solid var(--border-strong); border-top-color: var(--primary);
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── 차트 ─────────────────────────────────────────── */
.chart { margin: 0; }
.chart-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.chart-title { font-weight: 600; font-size: 14px; }
.chart-canvas { position: relative; width: 100%; }
.chart-table { margin-top: 12px; max-height: 360px; overflow-y: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.card > .chart + .chart { margin-top: 28px; }
.chart + .table-wrap { margin-top: 18px; }

/* ─── 명령 팔레트 ─────────────────────────────────── */
.palette { margin-top: 12vh; }
.palette .modal-box { width: min(600px, calc(100vw - 32px)); max-height: 70vh; overflow: hidden; }
.palette-search { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--border); color: var(--subtle); }
.palette-search input { flex: 1; height: 30px; padding: 0; border: 0; background: transparent; font-size: 16px; color: var(--text); box-shadow: none !important; }
.palette-list { list-style: none; margin: 0; padding: 6px; overflow-y: auto; flex: 1; }
.palette-group { padding: 10px 10px 4px; font-size: 12px; font-weight: 600; color: var(--subtle); }
.palette-item { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 8px; cursor: pointer; }
.palette-item .icon { color: var(--muted); }
.palette-item.is-active { background: var(--primary-soft); color: var(--primary); }
.palette-item.is-active .icon { color: var(--primary); }
.palette-empty { padding: 24px 10px; text-align: center; color: var(--muted); }
.palette-foot { display: flex; gap: 16px; padding: 10px 16px; border-top: 1px solid var(--border); font-size: 12px; color: var(--subtle); }
.palette-foot kbd { margin: 0 2px; }
@media (max-width: 560px) { .palette-foot { display: none; } }

/* ─── UI 견본 (/ui) ─────────────────────────────── */
.ui-layout { display: grid; grid-template-columns: 170px minmax(0, 1fr); gap: 20px; align-items: start; }
.ui-toc { position: sticky; top: calc(var(--topbar-h) + 16px); display: flex; flex-direction: column; gap: 2px; }
.ui-toc a { padding: 6px 10px; border-radius: 6px; color: var(--muted); font-size: 13px; }
.ui-toc a:hover { background: var(--surface-hover); color: var(--text); text-decoration: none; }
.ui-sections > .card { scroll-margin-top: calc(var(--topbar-h) + 16px); }
.ui-demo { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 12px 0; }
.ui-narrow { max-width: 360px; }
.ui-flush { margin-bottom: 0; }
.ui-pad { padding: 16px 20px 0; }
.ui-pad:last-child { padding-bottom: 16px; }
.ui-swatch { width: 22px; height: 22px; border-radius: 6px; border: 1px solid var(--border); }
.ui-box { border: 1px dashed var(--border-strong); border-radius: var(--radius-sm); }
.ui-toast-demo { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 8px; }
.ui-toast-demo .toast { box-shadow: none; animation: none; }
.ui-type > * + * { margin-top: 8px; }
.ui-h2 { font-size: 15px; }
.ui-code { margin-top: 14px; border-top: 1px solid var(--border); padding-top: 10px; }
.ui-code summary { display: inline-flex; align-items: center; gap: 4px; cursor: pointer; color: var(--muted); font-size: 13px; font-weight: 600; list-style: none; }
.ui-code summary::-webkit-details-marker { display: none; }
.ui-code summary .icon { width: 15px; height: 15px; transition: transform 0.15s; }
.ui-code[open] summary .icon { transform: rotate(90deg); }
.ui-code pre {
  margin: 10px 0 0; padding: 14px 16px; overflow-x: auto;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-family: var(--mono); font-size: 12.5px; line-height: 1.6; white-space: pre; word-break: normal;
}
.icon-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 6px; }
.icon-cell {
  display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 14px 6px 10px;
  border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text);
}
.icon-cell .icon { width: 22px; height: 22px; }
.icon-cell .mono { font-size: 11px; color: var(--muted); text-align: center; }
@media (max-width: 900px) {
  .ui-layout { grid-template-columns: minmax(0, 1fr); }
  .ui-toc { position: static; flex-direction: row; flex-wrap: wrap; }
}

/* ─── 반응형 ─────────────────────────────────────── */
@media (max-width: 1100px) {
  .grid-side { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 900px) {
  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0;
    transform: translateX(-100%); transition: transform 0.22s ease;
    box-shadow: var(--shadow-lg);
  }
  body.sidebar-open .sidebar { transform: none; }
  body.sidebar-open .sidebar-backdrop { display: block; position: fixed; inset: 0; z-index: 35; background: rgba(10, 13, 22, 0.45); }
  .only-mobile { display: inline-flex; }
  .topbar { padding: 0 12px; }
  .content { padding: 18px 16px 72px; }
  .grid-2 { grid-template-columns: minmax(0, 1fr); }
  .user-name, .user-menu summary > .icon, .hint-key { display: none; }
  .field-inline { flex-direction: column; align-items: stretch; gap: 8px; }
  .field-inline > .field-control, .field-inline > input, .field-inline > select { width: 100%; }
}
@media (max-width: 560px) {
  .search-field { max-width: none; flex-basis: 100%; }
  .toolbar select { flex: 1 1 40%; }
  .pager { justify-content: center; }
  .pager-info { width: 100%; text-align: center; }
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .stat-card { grid-template-columns: 1fr; padding: 14px; }
  .stat-icon { grid-row: auto; width: 32px; height: 32px; margin-bottom: 8px; }
  .stat-icon .icon { width: 16px; height: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ─── 화면 설정: 사용자 강조색·글자 크기 (theme-init.js) ─────────
   선택자를 [data-theme]까지 붙여 base.html의 사이트 기본색(<style>)보다 우선하게 한다 */
:root[data-accent][data-theme] { --primary: var(--accent-light); --primary-text: var(--accent-on); }
:root[data-accent][data-theme="dark"] { --primary: var(--accent-dark); --primary-text: #0e121d; }
:root[data-font="sm"] { zoom: 0.93; }
:root[data-font="lg"] { zoom: 1.08; }
:root[data-font="xl"] { zoom: 1.16; }

.prefs { display: flex; flex-direction: column; gap: 18px; }
.prefs h3 { margin: 0 0 8px; font-size: 13px; font-weight: 600; color: var(--muted); }
.prefs .seg { margin: 0; }
.prefs .seg button { height: 34px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.prefs .seg .icon { width: 15px; height: 15px; }
.accent-list { display: flex; flex-wrap: wrap; gap: 8px; }
.accent-swatch {
  position: relative; width: 34px; height: 34px; border-radius: 50%; padding: 0; cursor: pointer;
  border: 2px solid var(--surface); background: var(--swatch, var(--surface-hover));
  box-shadow: 0 0 0 1px var(--border-strong); display: inline-flex; align-items: center; justify-content: center;
}
.accent-swatch span { font-size: 10.5px; font-weight: 700; color: #fff; }
.accent-swatch.is-active { box-shadow: 0 0 0 2px var(--text); }
.accent-swatch:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }
.accent-custom { background: conic-gradient(#ef4444, #f59e0b, #22c55e, #06b6d4, #6366f1, #d946ef, #ef4444); color: #fff; }
.accent-custom .icon { width: 16px; height: 16px; filter: drop-shadow(0 0 1px #0008); }
.accent-custom input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }

/* ─── 단계 표시 (.steps — [data-steps]가 자동으로 그림, 직접 써도 됨) ─── */
.steps { display: flex; gap: 6px; margin: 0 0 18px; padding: 0; list-style: none; counter-reset: none; }
.steps li { flex: 1; display: flex; align-items: center; gap: 8px; min-width: 0; padding-bottom: 10px; border-bottom: 2px solid var(--border); color: var(--subtle); font-size: 13px; }
.steps .step-no {
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
  width: 22px; height: 22px; border-radius: 50%; font-size: 12px; font-weight: 700;
  background: var(--surface-hover); color: var(--muted);
}
.steps .step-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.steps li.is-current { color: var(--text); font-weight: 600; border-bottom-color: var(--primary); }
.steps li.is-current .step-no { background: var(--primary); color: var(--primary-text); }
.steps li.is-done { color: var(--muted); border-bottom-color: color-mix(in srgb, var(--primary) 45%, var(--border)); }
.steps li.is-done .step-no { background: var(--primary-soft); color: var(--primary); }
.step-actions { display: flex; justify-content: space-between; gap: 8px; margin-top: 8px; }
.step-actions .spacer, .field-row .spacer { flex: 1; }

/* ─── 입력 부품: 스위치·슬라이더·구간·라디오·증감·검색 선택 ─────────── */
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 500; position: relative; }
.switch input { position: absolute; opacity: 0; width: 38px !important; height: 22px; margin: 0; cursor: pointer; }
.switch-track {
  position: relative; flex-shrink: 0; width: 38px; height: 22px; border-radius: 999px;
  background: var(--border-strong); transition: background 0.15s;
}
.switch-track::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25); transition: transform 0.15s;
}
.switch input:checked + .switch-track { background: var(--primary); }
.switch input:checked + .switch-track::after { transform: translateX(16px); }
.switch input:focus-visible + .switch-track { outline: 2px solid var(--primary); outline-offset: 2px; }
.switch input:disabled + .switch-track { opacity: 0.5; }

input[type="range"] {
  -webkit-appearance: none; appearance: none; width: 100%; height: 22px; margin: 0;
  background: transparent; cursor: pointer; box-shadow: none !important;
}
input[type="range"]::-webkit-slider-runnable-track { height: 6px; border-radius: 999px; background: var(--track, var(--border-strong)); }
input[type="range"]::-moz-range-track { height: 6px; border-radius: 999px; background: var(--track, var(--border-strong)); }
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 18px; height: 18px; margin-top: -6px; border-radius: 50%;
  background: var(--surface); border: 2px solid var(--primary); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}
input[type="range"]::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: var(--surface); border: 2px solid var(--primary); }
input[type="range"]:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 4px var(--focus); }
.range { display: flex; align-items: center; gap: 12px; }
.range input { --track: linear-gradient(to right, var(--primary) var(--pct, 50%), var(--border-strong) var(--pct, 50%)); }
.range-value { min-width: 44px; padding: 3px 8px; border-radius: var(--radius-sm); background: var(--surface-2); font-variant-numeric: tabular-nums; font-weight: 600; text-align: center; font-size: 13px; }
.range-pair-track { position: relative; height: 22px; }
.range-pair-track::before, .range-pair-track::after {
  content: ""; position: absolute; top: 8px; height: 6px; border-radius: 999px; pointer-events: none;
}
.range-pair-track::before { left: 0; right: 0; background: var(--border-strong); }
.range-pair-track::after { left: var(--lo, 0%); right: calc(100% - var(--hi, 100%)); background: var(--primary); }
.range-pair-track input { position: absolute; inset: 0; pointer-events: none; --track: transparent; }
.range-pair-track input::-webkit-slider-thumb { pointer-events: auto; position: relative; z-index: 2; }
.range-pair-track input::-moz-range-thumb { pointer-events: auto; }
.range-pair-values { display: flex; align-items: center; gap: 8px; margin-top: 6px; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.range-pair-values output { padding: 2px 8px; border-radius: var(--radius-sm); background: var(--surface-2); color: var(--text); font-weight: 600; }

.radio-list { display: flex; flex-direction: column; gap: 8px; }
.radio-list label { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.radio-list input { width: 16px !important; height: 16px; accent-color: var(--primary); }
.seg-radio { display: inline-flex; flex-wrap: wrap; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); overflow: hidden; align-self: flex-start; }
.seg-radio label { position: relative; cursor: pointer; }
.seg-radio label + label { border-left: 1px solid var(--border-strong); }
.seg-radio input { position: absolute; opacity: 0; width: 1px !important; height: 1px; }
.seg-radio span { display: inline-flex; align-items: center; height: 34px; padding: 0 14px; font-size: 13px; color: var(--muted); background: var(--surface); }
.seg-radio label:hover span { color: var(--text); }
.seg-radio input:checked + span { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.seg-radio input:focus-visible + span { outline: 2px solid var(--primary); outline-offset: -2px; }
.field.has-error .seg-radio { border-color: var(--danger); }

.stepper { display: inline-flex; align-items: stretch; align-self: flex-start; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); overflow: hidden; background: var(--surface); }
.stepper .icon-btn { border-radius: 0; height: 36px; width: 36px; }
.stepper input[type="number"] { width: 72px !important; border: 0; border-radius: 0; text-align: center; box-shadow: none !important; -moz-appearance: textfield; }
.stepper input::-webkit-inner-spin-button, .stepper input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.stepper:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px var(--focus); }
.field.has-error .stepper { border-color: var(--danger); }

.combo { position: relative; }
.combo-native { position: absolute !important; width: 1px !important; height: 1px; opacity: 0; pointer-events: none; }
.combo-box {
  display: flex; flex-wrap: wrap; align-items: center; gap: 4px; min-height: 36px; padding: 3px 30px 3px 6px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface); cursor: text; position: relative;
}
.combo.is-open .combo-box, .combo-box:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px var(--focus); }
.field.has-error .combo-box { border-color: var(--danger); }
.combo-chips { display: contents; }
.combo-chip { display: inline-flex; align-items: center; gap: 2px; height: 26px; padding: 0 4px 0 9px; border-radius: 999px; background: var(--primary-soft); color: var(--primary); font-size: 12.5px; font-weight: 600; }
.combo-chip button { border: 0; background: transparent; color: inherit; cursor: pointer; width: 20px; height: 20px; border-radius: 50%; font-size: 15px; line-height: 1; }
.combo-chip button:hover { background: color-mix(in srgb, var(--primary) 18%, transparent); }
.combo .combo-input { flex: 1; min-width: 80px; height: 28px !important; border: 0 !important; padding: 0 4px !important; box-shadow: none !important; background: transparent; }
.combo-caret { position: absolute; right: 11px; top: 50%; width: 7px; height: 7px; margin-top: -5px; border: solid var(--subtle); border-width: 0 1.5px 1.5px 0; transform: rotate(45deg); pointer-events: none; }
.combo-list {
  position: absolute; z-index: 30; left: 0; right: 0; top: calc(100% + 4px); max-height: 240px; overflow-y: auto;
  margin: 0; padding: 4px; list-style: none; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); box-shadow: var(--shadow-lg);
}
.combo-list li[role="option"] { display: flex; align-items: center; justify-content: space-between; padding: 7px 10px; border-radius: 6px; cursor: pointer; font-size: 13.5px; }
.combo-list li[role="option"].is-active { background: var(--surface-hover); }
.combo-list li[aria-selected="true"] { color: var(--primary); font-weight: 600; }
.combo-list li[aria-selected="true"]::after { content: "✓"; }
.combo-empty { padding: 8px 10px; color: var(--subtle); font-size: 13px; }

.ui-sub { margin: 10px 0 0; padding-top: 14px; border-top: 1px solid var(--border); font-size: 14px; font-weight: 700; }

/* ─── 필터 확장: 여러 개 고르기·숫자 범위·저장된 필터·적용된 조건 칩 ─────────── */
.filter-multi, .saved-filters { position: relative; }
.filter-multi > summary {
  display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 28px 0 11px; list-style: none; cursor: pointer;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface); white-space: nowrap; position: relative;
}
.filter-multi > summary::-webkit-details-marker, .saved-filters > summary::-webkit-details-marker { display: none; }
.filter-multi > summary::after {
  content: ""; position: absolute; right: 11px; top: 50%; width: 6px; height: 6px; margin-top: -5px;
  border: solid var(--subtle); border-width: 0 1.5px 1.5px 0; transform: rotate(45deg);
}
.filter-multi.is-set > summary { border-color: var(--primary); color: var(--primary); background: var(--primary-soft); }
.saved-filters > summary { list-style: none; }
.filter-menu {
  position: absolute; z-index: 30; top: calc(100% + 4px); left: 0; min-width: 200px; max-height: 320px; overflow-y: auto;
  display: flex; flex-direction: column; gap: 2px; padding: 8px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); box-shadow: var(--shadow-lg);
}
.filter-menu > .check { padding: 6px 8px; border-radius: 6px; font-weight: 400; }
.filter-menu > .check:hover { background: var(--surface-hover); }
.filter-menu-foot { display: flex; justify-content: space-between; gap: 6px; padding-top: 8px; margin-top: 4px; border-top: 1px solid var(--border); }
.saved-menu { min-width: 260px; }
.saved-menu .subtle { padding: 6px 8px; margin: 0; }
.saved-row { display: flex; align-items: center; gap: 4px; border-radius: 6px; }
.saved-row:hover { background: var(--surface-hover); }
.saved-row a { flex: 1; display: flex; align-items: center; gap: 8px; padding: 7px 8px; color: var(--text); min-width: 0; }
.saved-row a span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.saved-row a .icon { width: 15px; height: 15px; color: var(--subtle); }
.saved-row .icon-btn { width: 28px; height: 28px; }
.saved-new { display: flex; gap: 6px; padding-top: 8px; margin-top: 4px; border-top: 1px solid var(--border); }
.saved-new input { flex: 1; height: 32px; }
.num-range {
  display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 4px 0 11px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface);
}
.num-range.is-set { border-color: var(--primary); background: var(--primary-soft); }
.num-range-label { font-size: 13px; color: var(--muted); white-space: nowrap; }
.num-range input[type="number"] { width: 84px; height: 28px; border: 0; background: transparent; box-shadow: none !important; padding: 0 6px; }
.num-range-unit { font-size: 13px; color: var(--muted); padding-right: 6px; }
.filter-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 10px 14px; border-bottom: 1px solid var(--border); }
.card:not(.card-flush) > .filter-chips { padding: 0 0 12px; margin-bottom: 4px; }
.filter-chip {
  display: inline-flex; align-items: center; gap: 4px; height: 28px; padding: 0 6px 0 11px; border-radius: 999px;
  background: var(--primary-soft); color: var(--primary); font-size: 12.5px; font-weight: 600;
}
.filter-chip .icon { width: 14px; height: 14px; opacity: 0.7; }
.filter-chip:hover { text-decoration: none; background: color-mix(in srgb, var(--primary) 20%, var(--surface)); }
.filter-chip:hover .icon { opacity: 1; }
.filter-chips-clear { display: inline-flex; align-items: center; gap: 4px; margin-left: 4px; font-size: 12.5px; color: var(--muted); }
.filter-chips-clear .icon { width: 13px; height: 13px; }

/* ─── 슬라이더(캐러셀) ─────────────────────────────── */
.carousel { position: relative; --gap: 14px; --per: var(--per-max, 1); }
.carousel-track {
  display: flex; gap: var(--gap); overflow-x: auto; scroll-snap-type: x mandatory; scroll-behavior: smooth;
  scrollbar-width: none; border-radius: 12px; outline-offset: 3px;
}
.carousel-track::-webkit-scrollbar { display: none; }
.carousel-track > .slide {
  flex: 0 0 calc((100% - var(--gap) * (var(--per) - 1)) / var(--per)); scroll-snap-align: start; min-width: 0;
}
@media (max-width: 900px) { .carousel { --per: min(var(--per-max, 1), 2); } }
@media (max-width: 600px) { .carousel { --per: 1; } }
@media (prefers-reduced-motion: reduce) { .carousel-track { scroll-behavior: auto; } }
.carousel-btn {
  position: absolute; top: calc(50% - 22px); width: 38px; height: 38px; border-radius: 50%; display: inline-flex;
  align-items: center; justify-content: center; cursor: pointer; z-index: 2;
  border: 1px solid var(--border); background: color-mix(in srgb, var(--surface) 92%, transparent); color: var(--text); box-shadow: var(--shadow);
}
.carousel-btn:hover { background: var(--surface); }
.carousel-btn:disabled { opacity: 0; pointer-events: none; }
.carousel > .carousel-prev { left: 10px; }
.carousel > .carousel-next { right: 10px; }
.carousel-foot .carousel-btn { position: static; width: 30px; height: 30px; box-shadow: none; }
.carousel-foot .carousel-btn .icon { width: 16px; height: 16px; }
.carousel-foot .carousel-btn:disabled { opacity: 0.35; }
.carousel-foot { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 10px; min-height: 28px; }
.carousel-dots { display: flex; gap: 6px; }
.carousel-dots button { width: 8px; height: 8px; padding: 0; border: 0; border-radius: 999px; background: var(--border-strong); cursor: pointer; transition: width 0.2s; }
.carousel-dots button[aria-current="true"] { width: 22px; background: var(--primary); }
.carousel-play { width: 28px; height: 28px; }
.carousel-play .icon { width: 14px; height: 14px; }
.carousel-play .when-paused, .carousel.is-paused .carousel-play .when-playing { display: none; }
.carousel.is-paused .carousel-play .when-paused { display: block; }
.carousel.is-single .carousel-btn, .carousel.is-single .carousel-foot { display: none; }
/* 견본·기본 슬라이드 모양 */
.slide-banner {
  display: flex; flex-direction: column; justify-content: flex-end; gap: 6px; min-height: 220px; padding: 26px 64px;
  border-radius: 12px; color: #fff; background: var(--slide-bg, linear-gradient(135deg, #4b57d1, #8b5cf6));
}
.slide-banner h3 { margin: 0; font-size: 22px; font-weight: 700; }
.slide-banner p { margin: 0; opacity: 0.9; }
.slide-card { height: 100%; padding: 18px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); }
.slide-card h4 { margin: 8px 0 4px; font-size: 15px; }

/* ─── 파일 올리기·목록 ─────────────────────────────── */
.uploader { display: flex; flex-direction: column; gap: 10px; }
.dropzone {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  min-height: 112px; padding: 18px; text-align: center; cursor: pointer;
  border: 1.5px dashed var(--border-strong); border-radius: 12px; background: var(--surface-2); transition: border-color 0.15s, background 0.15s;
}
.dropzone:hover, .dropzone.is-over { border-color: var(--primary); background: var(--primary-soft); }
.dropzone.is-warn { border-color: var(--amber); }
.dropzone:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px var(--focus); }
.dropzone strong { font-size: 14px; }
.dropzone small { color: var(--subtle); }
.dropzone-icon { display: inline-flex; width: 38px; height: 38px; align-items: center; justify-content: center; border-radius: 50%; background: var(--surface); color: var(--primary); margin-bottom: 4px; }
.dropzone-input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100% !important; }
.upload-list, .file-list { display: flex; flex-direction: column; gap: 6px; margin: 0; padding: 0; list-style: none; }
.upload-list:empty { display: none; }
.upload-item, .file-list li { display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 10px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
.upload-item.is-error { border-color: color-mix(in srgb, var(--danger) 50%, var(--border)); }
.upload-item.is-error small { color: var(--danger); }
.upload-thumb {
  flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px;
  border-radius: 8px; background: var(--surface-2); color: var(--muted); overflow: hidden;
}
.upload-thumb img { width: 100%; height: 100%; object-fit: cover; }
.upload-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.upload-main a { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); font-weight: 500; }
.upload-main a[href]:hover { color: var(--primary); }
.upload-main small { color: var(--subtle); }
.upload-progress { display: block; height: 4px; border-radius: 999px; background: var(--surface-hover); overflow: hidden; }
.upload-progress span { display: block; width: 0; height: 100%; background: var(--primary); transition: width 0.15s; }
.file-cell { display: flex; align-items: center; gap: 10px; }
.file-cell .upload-thumb { width: 36px; height: 36px; }
.tab-note { margin: 0 0 12px; }
.ui-sub-top { margin-top: 0; padding-top: 0; border-top: 0; margin-bottom: 10px; }

/* ─── 시청각 자료: 갤러리·크게 보기·플레이어 ─────────────────── */
.gallery { display: grid; grid-template-columns: repeat(var(--cols, 4), minmax(0, 1fr)); gap: 10px; }
@media (max-width: 900px) { .gallery { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 560px) { .gallery { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.gallery-item {
  position: relative; display: block; aspect-ratio: 4 / 3; overflow: hidden; border-radius: 10px;
  background: var(--surface-2); border: 1px solid var(--border);
}
.gallery-item img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.25s; }
.gallery-item:hover img { transform: scale(1.04); }
.gallery-item:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.gallery-ph { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; height: 100%; padding: 8px; color: var(--muted); text-align: center; }
.gallery-ph .icon { width: 28px; height: 28px; }
.gallery-ph small { font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.gallery-play {
  position: absolute; left: 50%; top: 50%; width: 46px; height: 46px; margin: -23px 0 0 -23px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center; background: rgba(0, 0, 0, 0.55); color: #fff;
}
.gallery-play .icon { width: 20px; height: 20px; margin-left: 2px; fill: currentColor; }

.lightbox { width: 100vw; height: 100vh; max-width: none; max-height: none; margin: 0; background: rgba(8, 10, 16, 0.94); color: #fff; }
.lightbox::backdrop { background: transparent; }
.lightbox[open] { display: flex; flex-direction: column; animation: modal-in 0.16s ease-out; }
.lightbox-stage { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; padding: 8px 64px 16px; overflow: hidden; }
.lightbox-stage img, .lightbox-stage video { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 6px; box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5); }
.lightbox-stage img { cursor: zoom-in; }
.lightbox-stage.is-zoomed { overflow: auto; align-items: flex-start; justify-content: flex-start; }
.lightbox-stage.is-zoomed img { max-width: none; max-height: none; cursor: zoom-out; margin: auto; }
.lightbox-bar { order: -1; display: flex; align-items: center; gap: 6px; padding: 10px 14px; }
.lightbox-bar .icon-btn { color: #fff; }
.lightbox-bar .icon-btn:hover { background: rgba(255, 255, 255, 0.12); }
.lightbox-count { font-variant-numeric: tabular-nums; color: rgba(255, 255, 255, 0.7); font-size: 13px; min-width: 48px; }
.lightbox-caption { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.lightbox-nav {
  position: absolute; top: 50%; width: 46px; height: 46px; margin-top: -23px; border-radius: 50%; border: 0; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; background: rgba(255, 255, 255, 0.12); color: #fff;
}
.lightbox-nav:hover { background: rgba(255, 255, 255, 0.22); }
.lightbox-prev { left: 12px; }
.lightbox-next { right: 12px; }
.lightbox.is-single .lightbox-nav { display: none; }
@media (max-width: 600px) { .lightbox-stage { padding: 4px 4px 12px; } .lightbox-nav { top: auto; bottom: 18px; } }

.media-video { margin: 0; }
.media-video video { display: block; width: 100%; max-height: 70vh; border-radius: 10px; background: #000; }
.media-video figcaption { display: flex; justify-content: space-between; gap: 10px; margin-top: 8px; font-size: 13px; color: var(--muted); }
.audio-player {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface);
}
.audio-play {
  flex-shrink: 0; width: 40px; height: 40px; border-radius: 50%; border: 0; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; background: var(--primary); color: var(--primary-text);
}
.audio-play .icon { width: 18px; height: 18px; fill: currentColor; }
.audio-play .when-playing, .audio-player.is-playing .audio-play .when-paused { display: none; }
.audio-player.is-playing .audio-play .when-playing { display: block; }
.audio-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.audio-title { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; }
.audio-title span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.audio-time { color: var(--subtle); font-variant-numeric: tabular-nums; white-space: nowrap; }
.audio-main input[type="range"] { --track: linear-gradient(to right, var(--primary) var(--pct, 0%), var(--border-strong) var(--pct, 0%)); height: 16px; }
.audio-rate { min-width: 46px; font-variant-numeric: tabular-nums; }
[data-audio-mute] .when-muted, .audio-player.is-muted [data-audio-mute] .when-sound { display: none; }
.audio-player.is-muted [data-audio-mute] .when-muted { display: block; }
.media-stack { display: flex; flex-direction: column; gap: 10px; }

/* ─── 드롭다운·팝오버 ─────────────────────────────── */
.dropdown { position: relative; display: inline-block; }
.dropdown > summary { list-style: none; }
.dropdown > summary::-webkit-details-marker { display: none; }
.dropdown-menu, .popover-body {
  position: absolute; z-index: 40; top: calc(100% + 4px); min-width: 190px; padding: 6px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); box-shadow: var(--shadow-lg);
}
.dropdown-start > .dropdown-menu, .dropdown-start > .popover-body { left: 0; }
.dropdown-end > .dropdown-menu, .dropdown-end > .popover-body { right: 0; }
.dropdown-menu { display: flex; flex-direction: column; }
.dropdown-menu > a, .dropdown-menu > button, .dropdown-menu form > button {
  display: flex; align-items: center; gap: 9px; width: 100%; padding: 8px 10px; border: 0; border-radius: 6px;
  background: transparent; color: var(--text); font-size: 13.5px; text-align: left; cursor: pointer; white-space: nowrap;
}
.dropdown-menu .icon { width: 16px; height: 16px; color: var(--muted); }
.dropdown-menu > a:hover, .dropdown-menu > button:hover, .dropdown-menu form > button:hover,
.dropdown-menu > a:focus-visible, .dropdown-menu > button:focus-visible { background: var(--surface-hover); text-decoration: none; outline: none; }
.dropdown-menu .is-danger, .dropdown-menu .is-danger .icon { color: var(--danger); }
.dropdown-menu hr { margin: 5px 2px; border: 0; border-top: 1px solid var(--border); }
.dropdown-menu .menu-label { padding: 6px 10px 2px; font-size: 11.5px; font-weight: 600; color: var(--subtle); }
.popover-body { width: 280px; padding: 12px 14px; font-size: 13.5px; line-height: 1.55; color: var(--muted); }
.popover-title { display: block; margin-bottom: 4px; color: var(--text); font-size: 14px; }

/* ─── 아코디언 ─────────────────────────────────────── */
.accordion { border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
.accordion + .accordion { margin-top: 8px; }
.accordion > summary { display: flex; align-items: center; gap: 10px; padding: 13px 16px; list-style: none; cursor: pointer; font-weight: 600; }
.accordion > summary::-webkit-details-marker { display: none; }
.accordion > summary .icon { margin-left: auto; color: var(--subtle); transition: transform 0.2s; }
.accordion[open] > summary .icon { transform: rotate(180deg); }
.accordion > summary:hover { background: var(--surface-hover); border-radius: 10px; }
.accordion-sub { font-weight: 400; font-size: 13px; color: var(--subtle); }
.accordion-body { padding: 0 16px 14px; color: var(--muted); line-height: 1.6; }

/* ─── 진행 막대·원형 ─────────────────────────────── */
.progress-wrap { display: flex; flex-direction: column; gap: 6px; }
.progress-head { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); }
.progress-num { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--text); }
.progress { --bar: var(--primary); height: 8px; border-radius: 999px; background: var(--surface-hover); overflow: hidden; }
.progress > span { display: block; height: 100%; border-radius: inherit; background: var(--bar); transition: width 0.3s; }
.progress-green { --bar: var(--green); } .progress-amber { --bar: var(--amber); } .progress-red { --bar: var(--danger); }
.progress.is-indeterminate > span { animation: progress-slide 1.3s ease-in-out infinite; }
@keyframes progress-slide { from { transform: translateX(-100%); } to { transform: translateX(260%); } }
.ring { --ring: var(--primary); position: relative; display: inline-flex; flex-direction: column; align-items: center; gap: 6px; }
.ring svg { width: var(--size); height: var(--size); transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 9; }
.ring-bg { stroke: var(--surface-hover); }
.ring-fg { stroke: var(--ring); stroke-linecap: round; transition: stroke-dashoffset 0.4s; }
.ring-green { --ring: var(--green); } .ring-amber { --ring: var(--amber); } .ring-red { --ring: var(--danger); }
.ring-num { position: absolute; top: calc(var(--size) / 2); transform: translateY(-50%); font-weight: 700; font-size: calc(var(--size) / 4.6); font-variant-numeric: tabular-nums; }
.ring-label { font-size: 13px; color: var(--muted); }
@media (prefers-reduced-motion: reduce) { .progress.is-indeterminate > span { animation-duration: 3s; } }

/* ─── 아바타 ─────────────────────────────────────── */
.avatar-x {
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; overflow: hidden;
  width: 32px; height: 32px; border-radius: 50%; font-size: 13px; font-weight: 700; color: #fff; background: var(--av, var(--series-1));
}
.avatar-x img { width: 100%; height: 100%; object-fit: cover; }
.avatar-sm { width: 26px; height: 26px; font-size: 11px; }
.avatar-lg { width: 48px; height: 48px; font-size: 18px; }
.avatar-c1 { --av: var(--series-1); } .avatar-c2 { --av: var(--series-2); } .avatar-c3 { --av: var(--series-3); } .avatar-c4 { --av: var(--series-4); }
.avatar-c5 { --av: var(--series-5); } .avatar-c6 { --av: var(--series-6); } .avatar-c7 { --av: var(--series-7); } .avatar-c8 { --av: var(--series-8); }
.avatar-group { display: inline-flex; align-items: center; }
.avatar-group .avatar-x { box-shadow: 0 0 0 2px var(--surface); }
.avatar-group .avatar-x + .avatar-x { margin-left: -8px; }
.avatar-more { background: var(--surface-hover); color: var(--muted); }

/* ─── 스켈레톤 ─────────────────────────────────────── */
.skeleton-wrap { display: flex; flex-direction: column; gap: 10px; }
.skeleton {
  display: block; border-radius: 6px;
  background: linear-gradient(90deg, var(--surface-hover) 25%, color-mix(in srgb, var(--surface-hover) 40%, var(--surface)) 50%, var(--surface-hover) 75%);
  background-size: 200% 100%; animation: skeleton-shine 1.4s ease-in-out infinite;
}
@keyframes skeleton-shine { from { background-position: 200% 0; } to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .skeleton { animation: none; } }
.sk-line { height: 12px; }
.sk-circle { width: 40px; height: 40px; border-radius: 50%; flex-shrink: 0; }
.sk-block { height: 120px; border-radius: 10px; }
.sk-row { display: flex; align-items: center; gap: 12px; }
.sk-col { flex: 1; display: flex; flex-direction: column; gap: 8px; }
.sk-table .sk-line { flex: 1; }
.sk-table .sk-line:first-child { flex: 2.5; }
.ui-gap-top { margin-top: 16px; }

/* 세로로 쌓기·복사 줄·번호 목록 (연동 안내 등) */
.stack > * + * { margin-top: 12px; }
.stack > .modal-foot { margin-top: 18px; }
.copy-row { display: flex; gap: 8px; align-items: center; }
.copy-row input { flex: 1; min-width: 0; }
.steps-text { margin: 0; padding-left: 20px; display: grid; gap: 6px; }
.spinner-sm { width: 12px; height: 12px; border-width: 2px; }
.badge .spinner { margin-right: 5px; vertical-align: -1px; }
.card-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 14px; }
.card-actions form { margin: 0; }
.small { font-size: 12px; }
.sync-card .subtle.small { margin-top: 10px; margin-bottom: 0; }
