/* ============================================================
   디자인 시스템 — Modern Light (D-051)
   색/간격/라운드/그림자를 토큰으로 정의하고, 테마 파일(/static/themes/*.css)이
   토큰을 재정의한다 (D-014). 컴포넌트는 토큰만 참조 → 테마 교체로 전체가 바뀐다.
   ============================================================ */
:root {
  /* 표면/배경 — 화이트 캔버스 (D-063) */
  --c-bg: #ffffff;
  --c-surface: #ffffff;
  --c-surface-2: #f6f5f2;   /* 따뜻한 미묘 채움(thead, chip, 입력 배경) */
  /* 텍스트 */
  --c-text: #212121;        /* ink — 본문/링크 */
  --c-muted: #93939f;
  --c-ink: #17171c;         /* 니어블랙 — 강조/헤더 글자 */
  /* 경계 — 헤어라인 */
  --c-border: #d9d9dd;
  --c-border-light: #e5e7eb;
  /* 헤더 */
  --c-header: #ffffff;
  --c-header-text: #212121;
  /* 강조 — 니어블랙 주조 */
  --c-primary: #17171c;
  --c-primary-dark: #2c2c34;
  --c-primary-soft: #f3f3f5;
  --c-on-primary: #ffffff;   /* primary 채움 위 글자색 (테마가 재정의) */
  --c-admin-band: #17171c;   /* 관리자 헤더 밴드 — 테마 무관 다크 유지 */
  --c-danger: #b30000;
  --c-danger-dark: #8f0000;
  --c-success: #003c33;
  /* 브랜드 액센트 (장식 표면 금지, 강조에만) */
  --c-coral: #ff7759;
  --c-coral-soft: #ffad9b;
  --c-coral-bg: #fff7f4;
  --c-blue: #1863dc;        /* 에디토리얼 링크/페이지네이션 강조 */
  --c-green: #003c33;       /* 딥그린 밴드 */
  --c-navy: #071829;
  --c-stone: #eeece7;
  --c-pale-green: #edfce9;
  --c-form-focus: #9b60aa;  /* 입력 포커스 보라 */
  /* 보조(레거시 호환) */
  --c-thead: var(--c-surface-2);
  --c-btn: var(--c-surface);
  --c-btn-border: #d9d9dd;
  /* 폰트 (D-063) — 한글은 Pretendard/시스템 폴백 */
  --font-display: "Space Grotesk", "Pretendard", "Apple SD Gothic Neo", system-ui, sans-serif;
  --font-body: "Inter", "Pretendard", "Apple SD Gothic Neo", "Malgun Gothic", system-ui, sans-serif;
  --font-mono: "Space Mono", ui-monospace, "SF Mono", Menlo, monospace;
  /* 형태 — 라운드 스케일 */
  --radius-xs: 4px;
  --radius-sm: 8px;
  --radius: 16px;
  --radius-lg: 22px;
  --radius-pill: 999px;
  /* 깊이 — 플랫(보더 기반). 드롭다운/모달만 미묘한 리프트 유지 */
  --shadow-sm: none;
  --shadow: none;
  --shadow-lg: 0 8px 30px rgba(17,23,41,.10);
  --ring: 0 0 0 3px rgba(76,110,230,.30);
  --ring-input: 0 0 0 3px rgba(155,96,170,.18);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; } /* 클래스 규칙(.btn 등)이 UA 기본을 덮는 문제 방지 */
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--c-text);
  background: var(--c-bg);
  line-height: 1.6;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
a { color: var(--c-text); text-decoration: none; transition: color .15s ease; }
a:hover { color: var(--c-muted); text-decoration: none; }
:focus-visible { outline: none; box-shadow: var(--ring); border-radius: 6px; }
/* 풀폭 셸: 본문/헤더/푸터가 화면을 꽉 채우되, 큰 화면에선 가장자리에 붙지 않게 반응형 좌우 여백 */
.container { max-width: none; margin: 0 auto; padding: 0 clamp(16px, 4vw, 48px); }

/* ── 헤더 ─────────────────────────────── */
.site-header {
  background: var(--c-header); /* color-mix 미지원 폴백 */
  background: color-mix(in srgb, var(--c-header) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--c-border);
  position: sticky; top: 0; z-index: 50;
}
.header-inner { display: flex; align-items: center; gap: 20px; height: 60px; }
.logo { color: var(--c-ink); font-family: var(--font-display); font-size: 22px; font-weight: 500; letter-spacing: -.02em; }
.logo:hover { text-decoration: none; opacity: .85; }
.nav { display: flex; align-items: center; }
.nav a { color: var(--c-header-text); margin-left: 14px; font-size: 14px; font-weight: 500; }
.nav a:hover { color: var(--c-primary); text-decoration: none; }
.nav .nick { color: var(--c-text); font-weight: 600; }
.main-menu { flex: 1; display: flex; align-items: center; }
.main-menu a { margin-left: 0; margin-right: 16px; }
.nav-search input {
  width: 150px; padding: 7px 12px; font-size: 13px; border: 1px solid var(--c-border);
  border-radius: var(--radius-pill); background: var(--c-surface-2); color: var(--c-text);
  transition: box-shadow .15s ease, width .2s ease;
}
.nav-search input:focus { width: 200px; border-color: var(--c-form-focus); box-shadow: var(--ring-input); outline: none; }
.nav-search input::placeholder { color: var(--c-muted); }
.badge-n {
  background: var(--c-danger); color: #fff; font-size: 11px; font-weight: 700;
  border-radius: var(--radius-pill); padding: 1px 6px; margin-left: 3px; vertical-align: top;
}
/* 햄버거 토글은 데스크톱에서 숨김 (D-054) */
.nav-toggle { display: none; }
.nav-burger { display: none; }

/* ── 모바일 헤더: 햄버거 패널 (D-054) ── */
@media (max-width: 720px) {
  .header-inner { flex-wrap: wrap; height: auto; min-height: 60px; gap: 0; }
  .logo { margin-right: auto; }
  .nav-burger {
    display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 5px;
    width: 42px; height: 42px; border-radius: 9px; cursor: pointer; margin-left: 10px;
  }
  .nav-burger:hover { background: var(--c-surface-2); }
  .nav-burger span { display: block; width: 22px; height: 2px; background: var(--c-header-text); border-radius: 2px; transition: transform .2s ease, opacity .2s ease; }
  /* 열림 시 ☰ → ✕ */
  .nav-toggle:checked ~ .nav-burger span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
  .nav-toggle:checked ~ .nav-burger span:nth-child(2) { opacity: 0; }
  .nav-toggle:checked ~ .nav-burger span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

  /* 접힘: 메뉴/검색/계정 숨김 → 토글 시 전체폭으로 펼침 */
  .main-menu, .nav-search, .account-nav { display: none; flex: 0 0 100%; width: 100%; }
  .nav-toggle:checked ~ .main-menu,
  .nav-toggle:checked ~ .nav-search,
  .nav-toggle:checked ~ .account-nav { display: flex; }
  .nav-search { order: 1; padding: 10px 0 4px; }
  .main-menu { order: 2; flex-direction: column; align-items: stretch; }
  .account-nav { order: 3; flex-direction: column; align-items: stretch; padding-bottom: 12px; border-top: 1px solid var(--c-border-light); }

  .nav-search input, .nav-search input:focus { width: 100%; }
  .main-menu a, .account-nav a { margin: 0; padding: 12px 4px; border-bottom: 1px solid var(--c-border-light); }
  .account-nav a:last-child { border-bottom: none; }

  /* 서브메뉴는 펼쳐서 인라인 표시(hover 불필요) */
  .main-menu .menu-item { display: block; position: static; margin: 0; }
  .main-menu .menu-item > a .caret { display: none; }
  .main-menu .submenu {
    display: block; position: static; min-width: auto; padding: 0 0 0 16px;
    background: transparent; border: none; box-shadow: none;
  }
  .main-menu .submenu::before { display: none; }
  .main-menu .submenu a { padding: 10px 4px; border-radius: 0; }
}

/* ── 본문 컨테이너 ───────────────────────── */
/* main 은 .container 와 같은 요소(<main class="container">)라 class가 element를 이긴다.
   위아래 여백/패딩만 main 한정으로 .container(0 auto / 0 18px)보다 우선 적용 — 헤더/네비/푸터는 .container 그대로 */
main.container {
  background: var(--c-surface); margin: 0 auto 5px; padding: 14px clamp(16px, 4vw, 48px);
  border: 1px solid var(--c-border-light); border-radius: 0;
  box-shadow: var(--shadow-sm); min-height: 60vh;
}
h1 { font-family: var(--font-display); font-size: clamp(30px, 4.4vw, 46px); font-weight: 500; letter-spacing: -.025em; line-height: 1.08; margin: 6px 0 20px; }
h2 { font-family: var(--font-display); font-size: clamp(21px, 2.6vw, 28px); font-weight: 500; letter-spacing: -.02em; line-height: 1.15; margin: 34px 0 12px; }
h3 { font-family: var(--font-display); font-weight: 500; letter-spacing: -.01em; }
.group-name { border-left: 3px solid var(--c-coral); padding-left: 12px; }

/* ── 테이블 ─────────────────────────────── */
.list-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.list-table th, .list-table td { padding: 11px 12px; border-bottom: 1px solid var(--c-border-light); text-align: left; }
.list-table thead th {
  background: transparent; font-weight: 400; color: var(--c-muted);
  font-family: var(--font-mono); font-size: 11.5px; text-transform: uppercase; letter-spacing: .08em;
  border-bottom: 1px solid var(--c-border);
}
.list-table thead th:first-child { border-top-left-radius: var(--radius-sm); }
.list-table thead th:last-child { border-top-right-radius: var(--radius-sm); }
.list-table tbody tr { transition: background .12s ease; }
.list-table tbody tr:hover { background: var(--c-surface-2); }
.list-table .num { text-align: center; width: 64px; }
.list-table .date, .date { color: var(--c-muted); white-space: nowrap; font-size: 13px; }
.strong { font-weight: 600; }
.empty { color: var(--c-muted); text-align: center; padding: 28px 0; }
.comment-count { color: var(--c-primary); font-size: 12px; margin-left: 4px; font-weight: 600; }
.minus { color: var(--c-danger); }
.has-file { font-size: 12px; }

.board-head { display: flex; justify-content: space-between; align-items: flex-start; }
.board-head .desc, .desc { color: var(--c-muted); margin: -2px 0 14px; font-size: 14px; }

/* ── 탭/칩 ──────────────────────────────── */
.cat-tabs { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.cat { padding: 6px 15px; border: 1px solid var(--c-coral-soft); border-radius: var(--radius-sm); font-size: 14px; color: var(--c-coral); background: var(--c-coral-bg); transition: all .15s ease; }
.cat.current { background: var(--c-coral); color: #2a0e06; border-color: var(--c-coral); }
.cat:hover { text-decoration: none; border-color: var(--c-coral); color: var(--c-coral); }
.cat.current:hover { background: var(--c-coral); color: #2a0e06; }
.cat-badge {
  display: inline-block; background: var(--c-surface-2); border: 1px solid var(--c-border);
  color: var(--c-muted); font-size: 11px; padding: 2px 8px; border-radius: var(--radius-pill); margin-right: 4px;
}

.search-form { display: flex; gap: 7px; justify-content: flex-end; margin-bottom: 12px; }
.search-form input { padding: 8px 12px; border: 1px solid var(--c-border); border-radius: var(--radius-sm); background: var(--c-surface); color: var(--c-text); }
.search-form input:focus { box-shadow: var(--ring-input); outline: none; border-color: var(--c-form-focus); }

/* ── 버튼 ───────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 18px; font-size: 14px; font-weight: 500; cursor: pointer; line-height: 1.2;
  font-family: var(--font-body);
  background: var(--c-surface); color: var(--c-ink); border: 1px solid var(--c-border);
  border-radius: var(--radius-pill); transition: all .15s ease;
}
.btn:hover { text-decoration: none; border-color: var(--c-ink); color: var(--c-ink); }
.btn-primary { background: var(--c-primary); border-color: var(--c-primary); color: var(--c-on-primary); }
.btn-primary:hover { background: var(--c-primary-dark); border-color: var(--c-primary-dark); color: var(--c-on-primary); }
.btn-danger { background: transparent; border-color: var(--c-danger); color: var(--c-danger); }
.btn-danger:hover { background: var(--c-danger); border-color: var(--c-danger); color: #fff; }
.btn-sm { padding: 6px 13px; font-size: 13px; }
.btn-block { width: 100%; }
.link-btn { background: none; border: none; color: var(--c-danger); cursor: pointer; font-size: 13px; padding: 0; }

/* ── 페이지네이션 ───────────────────────── */
.pagination { margin-top: 18px; text-align: center; }
.page { display: inline-flex; align-items: center; justify-content: center; min-width: 38px; height: 38px; padding: 0 8px; margin: 0 2px; border: 1px solid var(--c-border); border-radius: var(--radius-pill); font-size: 14px; background: var(--c-surface); color: var(--c-ink); }
.page:hover { border-color: var(--c-ink); color: var(--c-ink); text-decoration: none; }
.page.current { background: var(--c-primary); color: var(--c-on-primary); border-color: var(--c-primary); }

/* ── 글 본문 ────────────────────────────── */
.post-meta { color: var(--c-muted); font-size: 13px; border-bottom: 1px solid var(--c-border-light); padding-bottom: 12px; }
.post-meta span { margin-right: 12px; }
.post-content { padding: 22px 2px; word-break: break-word; min-height: 120px; font-size: 15.5px; line-height: 1.8; }
.post-content img { max-width: 100%; height: auto; border-radius: var(--radius-sm); }
.post-content h1 { font-size: 25px; margin: 24px 0 10px; border-bottom: 1px solid var(--c-border-light); padding-bottom: 6px; }
.post-content h2 { font-size: 21px; margin: 22px 0 8px; border-bottom: 1px solid var(--c-border-light); padding-bottom: 4px; }
.post-content h3 { font-size: 18px; margin: 18px 0 6px; }
.post-content h4, .post-content h5, .post-content h6 { font-size: 15px; margin: 12px 0 4px; }
.post-content table { border-collapse: collapse; margin: 14px 0; width: auto; max-width: 100%; }
.post-content th, .post-content td { border: 1px solid var(--c-border); padding: 8px 13px; }
.post-content thead th { background: var(--c-surface-2); font-weight: 600; }
.post-content pre {
  background: #0f172a; color: #e2e8f0; border: 1px solid #1e293b; border-radius: var(--radius-sm);
  padding: 14px 16px; overflow-x: auto; font-size: 13px; line-height: 1.55; margin: 14px 0;
}
.post-content code {
  background: var(--c-surface-2); border-radius: 5px; padding: 2px 6px;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 0.9em;
}
.post-content pre code { background: none; border: none; padding: 0; color: inherit; }
.post-content blockquote {
  margin: 14px 0; padding: 6px 16px; border-left: 4px solid var(--c-primary);
  background: var(--c-primary-soft); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; color: var(--c-text);
}
.post-content ul, .post-content ol { padding-left: 26px; margin: 8px 0; }
.post-content hr { border: none; border-top: 1px solid var(--c-border-light); margin: 18px 0; }
.post-content p { margin: 10px 0; }
.post-actions { display: flex; gap: 8px; margin: 8px 0 22px; }
.breadcrumb { font-size: 13px; color: var(--c-muted); }
.breadcrumb a { color: var(--c-muted); }
.breadcrumb a:hover { color: var(--c-primary); }

.attachments { border-top: 1px solid var(--c-border-light); padding: 12px 2px; font-size: 14px; }
.attachments ul { margin: 6px 0 0; padding-left: 18px; }

/* ── 댓글 ───────────────────────────────── */
.comments { border-top: 1px solid var(--c-border); padding-top: 12px; margin-top: 8px; }
.comment { border-bottom: 1px solid var(--c-border-light); padding: 12px 4px; position: relative; }
.reply-arrow { position: absolute; left: -16px; top: 12px; color: var(--c-muted); }
.comment-meta { font-size: 13px; color: var(--c-muted); display: flex; gap: 10px; align-items: center; }
.reply-link { font-size: 12px; }
.comment-content { white-space: pre-wrap; word-break: break-word; margin-top: 4px; }
.comment-form textarea { width: 100%; margin: 12px 0 8px; }
.replying { font-size: 13px; color: var(--c-muted); margin: 12px 0 0; }
.inline { display: inline; }

/* ── 갤러리 ─────────────────────────────── */
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; margin-top: 10px; }
.gallery-card { border: 1px solid var(--c-border-light); border-radius: var(--radius); overflow: hidden; color: var(--c-text); background: var(--c-surface); box-shadow: var(--shadow-sm); transition: transform .18s ease, box-shadow .18s ease; }
.gallery-card:hover { text-decoration: none; border-color: var(--c-ink); }
.gallery-thumb { height: 150px; background: var(--c-surface-2); display: flex; align-items: center; justify-content: center; }
.gallery-thumb img { width: 100%; height: 100%; object-fit: cover; }
.no-thumb { color: var(--c-muted); font-size: 13px; }
.gallery-body { padding: 12px 14px; }
.gallery-title { font-size: 14px; font-weight: 600; }
.gallery-meta { font-size: 12px; color: var(--c-muted); margin-top: 4px; }

/* ── 알림 ───────────────────────────────── */
.notif-list { display: flex; flex-direction: column; }
.notif-item {
  display: flex; justify-content: space-between; gap: 12px; padding: 14px 12px;
  border-bottom: 1px solid var(--c-border-light); color: var(--c-text); border-radius: var(--radius-sm);
}
.notif-item:hover { background: var(--c-surface-2); text-decoration: none; }
.notif-item.unread { font-weight: 600; }
.notif-item.unread .notif-msg::before { content: "●"; color: var(--c-primary); font-size: 9px; margin-right: 6px; vertical-align: middle; }

/* ── 폼 ─────────────────────────────────── */
.form label { display: block; margin-bottom: 14px; font-size: 14px; font-weight: 600; }
.form input[type="text"], .form input[type="password"], .form input[type="email"], .form input[type="number"],
.form textarea, .form select, .admin-search input, .role-head input, .role-head select {
  display: block; width: 100%; margin-top: 5px; padding: 10px 12px; font-size: 14px;
  border: 1px solid var(--c-border); border-radius: var(--radius-sm); font-family: inherit;
  background: var(--c-surface); color: var(--c-text); transition: border-color .15s ease, box-shadow .15s ease;
}
.form input:focus, .form textarea:focus, .form select:focus, input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--c-form-focus); box-shadow: var(--ring-input);
}
.form input:disabled { background: var(--c-surface-2); color: var(--c-muted); }
.form textarea { resize: vertical; }
.form-actions { display: flex; gap: 8px; }
.form .checkbox { font-weight: 400; display: flex; align-items: center; gap: 7px; }
.form .checkbox input { width: auto; display: inline; margin: 0; }
.file-label input[type="file"] { margin-top: 6px; display: block; }

/* ── 인증/알림 박스 ─────────────────────── */
.auth-box { max-width: 420px; margin: 28px auto; }
.auth-alt { font-size: 13px; color: var(--c-muted); text-align: center; }
.error { background: #fef2f2; color: var(--c-danger-dark); padding: 12px 16px; border-radius: var(--radius-sm); font-size: 14px; border: 1px solid #fecaca; }
.success { background: #f0fdf4; color: #15803d; padding: 12px 16px; border-radius: var(--radius-sm); font-size: 14px; border: 1px solid #bbf7d0; }

.profile-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 36px; }
.level-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 0 16px; }
@media (max-width: 760px) { .profile-grid { grid-template-columns: 1fr; } }

/* ── 관리자 ─────────────────────────────── */
.admin-nav { display: flex; gap: 8px; margin-bottom: 22px; flex-wrap: wrap; padding: 12px; background: var(--c-surface-2); border-radius: var(--radius); }
.admin-nav .btn { box-shadow: none; }
.stats { display: flex; gap: 16px; flex-wrap: wrap; }
.stat { flex: 1; min-width: 130px; background: var(--c-surface); border: 1px solid var(--c-border-light); border-radius: var(--radius); text-align: center; padding: 22px 0; box-shadow: var(--shadow-sm); }
.stat-num { font-family: var(--font-display); font-size: 34px; font-weight: 400; letter-spacing: -.03em; color: var(--c-ink); }
.stat-label { color: var(--c-muted); font-size: 13px; }
.badge { background: var(--c-pale-green); color: var(--c-green); font-size: 11px; font-weight: 500; font-family: var(--font-mono); letter-spacing: .04em; padding: 3px 10px; border-radius: var(--radius-pill); }
.actions form { margin: 0; }
.actions { white-space: nowrap; }

/* 다크 푸터 밴드 (D-063) — 테마 무관 고정 니어블랙 */
.site-footer { background: #17171c; color: #b9b9c2; font-size: 13px; text-align: center; padding: 40px 0; margin-top: 56px; }
.site-footer a { color: #e7e7ee; }
.site-footer a:hover { color: #fff; }

/* AI 묶음 작성기 소스 카드 (D-064) */
.compose-src { border: 1px solid var(--c-border-light); border-radius: var(--radius-sm); padding: 14px; margin-bottom: 12px; background: var(--c-surface); }
.compose-src-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.compose-src textarea { width: 100%; margin-top: 6px; padding: 9px 11px; border: 1px solid var(--c-border); border-radius: var(--radius-sm); font-family: inherit; font-size: 14px; background: var(--c-surface); color: var(--c-text); }
.compose-src .src-summary { background: var(--c-surface-2); }
.compose-src .src-cite { font-size: 12px; color: var(--c-blue); margin-left: 4px; }
.src-results { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.compose-presets { display: flex; gap: 16px; flex-wrap: wrap; }
.compose-presets label { display: flex; align-items: center; gap: 6px; }
.compose-presets select { width: auto; }
/* AI 보조 인라인 바 (D-064) — 에디터 위 "AI 글쓰기" 열기 버튼 */
.ai-bar { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin: 6px 0 2px; }
.ai-bar .ai-open { border-color: var(--c-coral); color: var(--c-coral); }

/* AI 글쓰기 레이어 팝업 (D-064) — 드래그 이동 + 닫기 */
.ai-modal {
  position: fixed; left: 50%; top: 12vh; transform: translateX(-50%);
  width: 460px; max-width: calc(100vw - 24px); z-index: 1200;
  background: var(--c-surface, #fff); color: var(--c-text, #17171c);
  border: 1px solid var(--c-border, #e3e3e6); border-radius: 10px;
  box-shadow: 0 18px 50px rgba(0,0,0,.22);
}
.ai-modal[hidden] { display: none; }
.ai-modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 12px; border-bottom: 1px solid var(--c-border, #e3e3e6);
  cursor: move; user-select: none;
}
.ai-modal-title { font-weight: 600; font-size: 14px; }
.ai-modal-close {
  border: none; background: none; cursor: pointer; font-size: 16px;
  line-height: 1; color: var(--c-muted, #777); padding: 2px 6px; border-radius: 6px;
}
.ai-modal-close:hover { background: var(--c-bg, #f4f4f5); color: var(--c-text, #17171c); }
.ai-modal-body { padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.ai-presets { display: flex; flex-wrap: wrap; gap: 6px; }
.ai-preset {
  font-size: 12px; padding: 3px 9px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--c-border, #e3e3e6); background: var(--c-bg, #f4f4f5); color: var(--c-text, #17171c);
}
.ai-preset:hover { border-color: var(--c-coral); color: var(--c-coral); }
.ai-modal .ai-prompt, .ai-modal .ai-result { width: 100%; resize: vertical; font: inherit; }
.ai-modal .ai-result { background: var(--c-bg, #f8f8f9); }
.ai-ctx { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--c-muted, #555); }
.ai-ctx input { width: auto; margin: 0; }
.ai-gen-row { display: flex; align-items: center; gap: 10px; }
.ai-msg { font-size: 12px; color: var(--c-muted, #777); }
.ai-apply { display: flex; flex-wrap: wrap; gap: 6px; }

/* 상단 공지 바 (D-063) — 검정 스트립, 닫기 가능 */
.announce { background: #000; color: #fff; font-family: var(--font-mono); font-size: 12px; letter-spacing: .04em; text-align: center; padding: 9px 40px; position: relative; }
.announce a { color: #fff; text-decoration: underline; text-underline-offset: 3px; }
.announce a:hover { color: #fff; opacity: .8; }
.announce-close { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); background: none; border: none; color: #fff; font-size: 18px; line-height: 1; cursor: pointer; opacity: .7; }
.announce-close:hover { opacity: 1; }

/* 모노 kicker 라벨 + 에디토리얼 밴드 (D-063) */
.mono-label { font-family: var(--font-mono); font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--c-muted); }
.kicker { margin-bottom: 10px; }
.band { border-radius: var(--radius-lg); padding: clamp(32px, 5vw, 56px); color: #fff; margin: 36px 0; }
.band.green { background: var(--c-green); }
.band.navy { background: var(--c-navy); }
.band h2 { font-family: var(--font-display); font-weight: 500; color: #fff; font-size: clamp(24px, 3.4vw, 40px); letter-spacing: -.02em; line-height: 1.08; margin: 8px 0 12px; }
.band p { color: #cfe8e2; max-width: 54ch; margin: 0 0 22px; }
.band .mono-label { color: var(--c-coral-soft); }
/* 다크 표면 위 버튼: 흰색 pill */
.btn-on-dark { background: #fff; color: var(--c-ink); border-color: #fff; }
.btn-on-dark:hover { background: #eee; color: var(--c-ink); border-color: #eee; }

.avatar { width: 24px; height: 24px; border-radius: 50%; object-fit: cover; vertical-align: middle; margin-right: 5px; }
.avatar-lg { width: 76px; height: 76px; border-radius: 50%; object-fit: cover; box-shadow: var(--shadow-sm); }
.avatar-row { display: flex; align-items: center; gap: 14px; margin-bottom: 8px; }

.vote-bar { display: flex; gap: 8px; align-items: center; margin: 4px 0 16px; flex-wrap: wrap; }
.like-count { color: var(--c-primary); font-size: 12px; margin-left: 4px; }
.notice-row { background: var(--c-primary-soft); }

.report-box summary, .report-box-sm summary { cursor: pointer; }
.report-box-sm { display: inline; font-size: 12px; color: var(--c-muted); }
.report-box-sm .report-form { display: inline; }
.report-box-sm input[type="text"] { width: 140px; padding: 4px 8px; font-size: 12px; border: 1px solid var(--c-border); border-radius: 6px; background: var(--c-surface); color: var(--c-text); }
.report-form { margin-top: 6px; }
.report-form input[type="text"] { display: inline-block; width: 280px; max-width: 60vw; }

.message-item { padding: 14px 10px; border-bottom: 1px solid var(--c-border-light); }
.message-item.unread { background: var(--c-primary-soft); }
.message-meta { font-size: 13px; color: var(--c-muted); display: flex; gap: 10px; align-items: center; }
.form-checks { margin-bottom: 12px; }
.faq-item { border-bottom: 1px solid var(--c-border-light); padding: 12px 4px; }
.faq-item summary { cursor: pointer; font-weight: 600; }
.move-form select { padding: 6px 10px; font-size: 13px; width: auto; }
.reply-arrow-inline { color: var(--c-muted); }
mark { background: #fef08a; padding: 0 3px; border-radius: 3px; }

.banner-row { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.banner-row img { max-height: 90px; border-radius: var(--radius-sm); box-shadow: var(--shadow-sm); }
.poll-box { border: 1px solid var(--c-border-light); border-radius: var(--radius); padding: 8px 18px 14px; margin: 18px 0; background: var(--c-surface-2); }
.poll-item { display: flex; align-items: center; gap: 10px; margin: 8px 0; font-size: 14px; }
.poll-item > span:first-child { min-width: 120px; }
.poll-bar-bg { flex: 1; background: var(--c-border-light); border-radius: var(--radius-pill); height: 16px; overflow: hidden; }
.poll-bar { background: var(--c-primary); height: 100%; border-radius: var(--radius-pill); }
.popup-layer { position: fixed; inset: 0; background: rgba(15,23,42,.5); z-index: 100; align-items: center; justify-content: center; }
.popup-inner { background: var(--c-surface); color: var(--c-text); border-radius: var(--radius); max-width: 480px; width: 90%; max-height: 80vh; overflow-y: auto; padding: 24px; box-shadow: var(--shadow-lg); }

/* ── 블로그 스킨 (D-037) ───────────────────────────── */
.blog-layout { display: grid; grid-template-columns: 1fr 250px; gap: 32px; align-items: start; }
.blog-main { min-width: 0; }
.blog-card { display: flex; gap: 18px; padding: 20px 0; border-bottom: 1px solid var(--c-border-light); }
.blog-card .blog-cover { flex: 0 0 210px; }
.blog-card .blog-cover img { width: 210px; height: 140px; object-fit: cover; border-radius: var(--radius); display: block; box-shadow: var(--shadow-sm); }
.blog-card-body { min-width: 0; }
.blog-card-title { margin: 0 0 8px; font-size: 1.35rem; line-height: 1.35; font-weight: 700; }
.blog-card-title a { color: var(--c-text); text-decoration: none; }
.blog-card-title a:hover { color: var(--c-primary); }
.blog-excerpt { margin: 0 0 10px; color: var(--c-muted); line-height: 1.6; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.blog-card-meta { font-size: 0.85rem; color: var(--c-muted); }
.blog-sidebar .tag-cloud { background: var(--c-surface); border: 1px solid var(--c-border-light); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow-sm); }
.blog-sidebar .tag-cloud h3 { margin: 0 0 12px; font-size: 1rem; }
.tag-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.tag-chip { display: inline-flex; align-items: center; gap: 4px; padding: 5px 12px; border-radius: var(--radius-sm); background: var(--c-coral-bg); border: 1px solid var(--c-coral-soft); color: var(--c-coral); font-size: 0.85rem; text-decoration: none; transition: all .15s ease; }
.tag-chip:hover { background: var(--c-coral); color: #2a0e06; border-color: var(--c-coral); }
.tag-chip .tag-count { color: var(--c-coral-soft); font-size: 0.78rem; }
.tag-chip:hover .tag-count { color: #2a0e06; }
.tag-filter { color: var(--c-muted); margin-bottom: 16px; }
.post-tags { display: flex; flex-wrap: wrap; gap: 8px; margin: 20px 0; }
.post-nav { display: flex; justify-content: space-between; gap: 12px; margin: 30px 0; padding-top: 18px; border-top: 1px solid var(--c-border); font-size: 0.95rem; }
.post-nav a { color: var(--c-primary); text-decoration: none; }
.post-nav-next { text-align: right; margin-left: auto; }
.related { margin: 30px 0; }
.related h3 { margin: 0 0 14px; }
.related-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 16px; }
.related-card { text-decoration: none; color: var(--c-text); }
.related-card img { width: 100%; height: 105px; object-fit: cover; border-radius: var(--radius-sm); display: block; margin-bottom: 6px; box-shadow: var(--shadow-sm); }
.related-title { font-size: 0.9rem; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
@media (max-width: 720px) {
  .blog-layout { grid-template-columns: 1fr; }
  .blog-card { flex-direction: column; }
  .blog-card .blog-cover, .blog-card .blog-cover img { width: 100%; flex-basis: auto; }
}

/* ── 위키 (D-038) ───────────────────────────── */
.wiki-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; border-bottom: 1px solid var(--c-border); padding-bottom: 14px; }
.wiki-title { margin: 0; }
.wiki-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.wiki-actions form.inline { margin: 0; }
.wiki-content { line-height: 1.85; font-size: 15.5px; }
.wiki-content a.wiki-link { color: var(--c-primary); text-decoration: none; border-bottom: 1px solid color-mix(in srgb, var(--c-primary) 40%, transparent); }
.wiki-content a.wiki-link:hover { border-bottom-color: var(--c-primary); }
.wiki-content a.wiki-link.new { color: var(--c-danger); border-bottom-color: color-mix(in srgb, var(--c-danger) 45%, transparent); }
.wiki-meta { color: var(--c-muted); font-size: 0.85rem; margin: 18px 0; }
.wiki-backlinks { margin-top: 24px; padding: 16px 18px; background: var(--c-surface-2); border: 1px solid var(--c-border-light); border-radius: var(--radius); }
.wiki-backlinks h3 { margin: 0 0 8px; font-size: 0.95rem; }
.wiki-backlinks ul { margin: 0; padding-left: 18px; }
.wiki-layout { display: grid; grid-template-columns: 1fr 290px; gap: 32px; align-items: start; }
.wiki-all { background: var(--c-surface); border: 1px solid var(--c-border-light); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow-sm); }
.wiki-all h2 { font-size: 1rem; margin: 0 0 10px; }
.wiki-page-list { margin: 0; padding-left: 18px; max-height: 70vh; overflow: auto; }
.wiki-page-list li { margin: 5px 0; }
.wiki-tools { display: flex; gap: 10px 16px; flex-wrap: wrap; align-items: center; }
/* ── 에러 페이지 (404/500/503 등) ── */
.error-page { max-width: 560px; margin: 12vh auto; padding: 0 24px; text-align: center; }
.error-code { font-family: var(--font-display); font-size: 96px; font-weight: 400; line-height: 1; letter-spacing: -.04em; color: var(--c-ink); }
.error-title { font-family: var(--font-display); font-size: 24px; font-weight: 500; margin: 12px 0 6px; }
.error-msg { color: var(--c-muted); margin: 0 0 22px; }
.error-actions { display: flex; gap: 8px; justify-content: center; }

/* 재사용 검색 바 (위키/상점 등 공개 검색 입력) */
.wiki-search, .search-bar { display: flex; gap: 8px; }
.wiki-search input, .search-bar input { width: 220px; max-width: 100%; padding: 8px 12px; font-size: 14px; border: 1px solid var(--c-border); border-radius: var(--radius-sm); background: var(--c-surface); color: var(--c-text); }
.wiki-search input:focus, .search-bar input:focus { outline: none; border-color: var(--c-form-focus); box-shadow: var(--ring-input); }
.rev-badge { font-size: 0.7em; color: var(--c-muted); vertical-align: middle; }
@media (max-width: 720px) { .wiki-layout { grid-template-columns: 1fr; } }

/* ── 관리자 목록 공통: 검색 + 페이지네이션 (D-043) ── */
.admin-search { display: flex; gap: 8px; align-items: center; margin: 14px 0; flex-wrap: wrap; }
.admin-search input[type="text"] { min-width: 220px; width: auto; margin-top: 0; }
.admin-search select { width: auto; margin-top: 0; }
.pager { display: flex; gap: 6px; align-items: center; justify-content: center; margin: 18px 0; flex-wrap: wrap; }
.pager-info { color: var(--c-muted); font-size: 13px; padding: 0 8px; }
.pager .page-num { min-width: 34px; text-align: center; }
.pager .page-num.active { background: var(--c-primary); border-color: var(--c-primary); color: var(--c-on-primary); cursor: default; pointer-events: none; }

/* ── .form 밖의 입력 요소 외형 일반화 (D-053) ──
   테이블 인라인 편집(groups/menus/posts/shop_orders)·WAF 폼(.form-block)·admin-search의 select 등.
   width는 강제하지 않아 인라인 셀(택배사/송장/순서 등 inline 폭)을 깨지 않는다. 체크박스는 제외. */
.list-table input[type="text"], .list-table input[type="number"], .list-table input[type="email"], .list-table select,
.admin-search select,
.form-block input[type="text"], .form-block input[type="number"], .form-block input[type="email"], .form-block select, .form-block textarea {
  padding: 7px 10px; font-size: 14px; font-family: inherit; line-height: 1.3; vertical-align: middle;
  border: 1px solid var(--c-border); border-radius: var(--radius-sm);
  background: var(--c-surface); color: var(--c-text); max-width: 100%;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.list-table input[type="text"]:focus, .list-table input[type="number"]:focus, .list-table input[type="email"]:focus, .list-table select:focus,
.admin-search select:focus,
.form-block input:focus, .form-block select:focus, .form-block textarea:focus {
  outline: none; border-color: var(--c-form-focus); box-shadow: var(--ring-input);
}
/* WAF 등 .form 아닌 블록 폼 레이아웃 */
.form-block .field { margin-bottom: 14px; }
.form-block .field > label { display: block; margin-bottom: 5px; font-size: 14px; font-weight: 600; }
.form-block .field > label small { font-weight: 400; color: var(--c-muted); }
.form-block input[type="text"] { width: 100%; max-width: 480px; }

/* ── 그룹/권한 관리 (D-048) ── */
.role-card { border: 1px solid var(--c-border-light); border-radius: var(--radius); padding: 16px; margin-bottom: 14px; background: var(--c-surface); box-shadow: var(--shadow-sm); }
.role-head { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.role-head input { display: inline-block; width: auto; margin-top: 0; vertical-align: middle; }
.role-head label { display: inline-flex; align-items: center; gap: 6px; }
.cap-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 4px 14px; margin: 8px 0; }
.role-actions { display: flex; gap: 8px; margin-top: 8px; }

/* ── 자동 등업 (D-058) ── */
.inline-rule { display: inline-flex; gap: 6px; align-items: center; margin: 0 4px 0 0; }
.inline-rule input, .inline-rule select { margin-top: 0; }
ul.promo-progress { list-style: none; padding: 0; margin: 8px 0; }
ul.promo-progress li { padding: 6px 10px; margin-bottom: 4px; border-radius: var(--radius); background: var(--c-surface); border: 1px solid var(--c-border-light); }
ul.promo-progress li.met { border-color: var(--c-primary); background: color-mix(in srgb, var(--c-primary) 8%, var(--c-surface)); }

/* ── 트리(드롭다운) 메뉴 (D-050) ── */
.main-menu .menu-item { position: relative; display: inline-block; margin-right: 16px; }
.main-menu .menu-item > a { margin: 0; }
.main-menu .menu-item .caret { font-size: 10px; opacity: .7; }
.main-menu .submenu {
  display: none; position: absolute; top: calc(100% + 6px); left: 0; min-width: 168px;
  background: var(--c-surface); border: 1px solid var(--c-border-light); border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg); padding: 6px; z-index: 200;
}
/* 상위 메뉴와 서브메뉴 사이 6px 틈을 투명 브릿지로 메워 hover 끊김 방지 */
.main-menu .submenu::before { content: ""; position: absolute; left: 0; right: 0; top: -8px; height: 8px; }
.main-menu .submenu a { display: block; margin: 0; padding: 8px 12px; color: var(--c-text); white-space: nowrap; border-radius: 7px; }
.main-menu .submenu a:hover { background: var(--c-surface-2); color: var(--c-primary); }
.main-menu .menu-item.has-sub:hover .submenu,
.main-menu .menu-item.has-sub:focus-within .submenu { display: block; }

/* 관리 메뉴 트리 행 (D-050) */
.list-table tr.menu-child td { background: var(--c-surface-2); }
/* 메뉴 순서 칸: ↑/↓ 버튼 + 숫자 입력을 한 줄로(.num의 width:64px 줄바꿈 방지) */
.list-table td.menu-order { white-space: nowrap; }
.list-table td.menu-order form { margin: 0; }
.list-table td.menu-order .btn-sm { padding: 4px 9px; }
.list-table td.menu-order input[type="number"] { width: 48px; margin-top: 0; vertical-align: middle; }
.muted { color: var(--c-muted); }

/* ── 관리자 헤더(브랜드 + 카테고리 드롭다운 메뉴 + 계정) 한 줄 통합 (D-052) ── */
.admin-header { background: var(--c-admin-band); color: #fff; position: sticky; top: 0; z-index: 60; }
.admin-header-inner { display: flex; align-items: center; gap: 16px; min-height: 56px; flex-wrap: wrap; }
.admin-brand { color: #fff; font-family: var(--font-display); font-weight: 500; font-size: 19px; letter-spacing: -.02em; white-space: nowrap; }
.admin-brand span { font-weight: 500; font-size: 12px; opacity: .7; margin-left: 2px; }
.admin-brand:hover { color: #fff; text-decoration: none; opacity: .92; }

/* 카테고리 드롭다운 메뉴바 (.admin-menu — messages.html의 .admin-nav와 분리) */
.admin-menu { display: flex; align-items: center; gap: 2px; flex: 1; flex-wrap: wrap; }
.admin-menu-item { position: relative; }
.admin-menu-item > a, .admin-menu-label {
  display: inline-block; color: #fff; font-size: 14px; font-weight: 500; line-height: 1.2;
  padding: 7px 11px; border-radius: 8px; cursor: pointer; white-space: nowrap;
  transition: background .12s ease;
}
.admin-menu-item > a:hover, .admin-menu-label:hover,
.admin-menu-item.has-drop:hover .admin-menu-label,
.admin-menu-item.has-drop:focus-within .admin-menu-label { background: rgba(255,255,255,.16); color: #fff; text-decoration: none; }
.admin-menu-label .caret { font-size: 9px; opacity: .8; margin-left: 2px; }
.admin-drop {
  display: none; position: absolute; top: calc(100% + 8px); left: 0; min-width: 168px;
  background: var(--c-surface); border: 1px solid var(--c-border-light); border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg); padding: 6px; z-index: 200;
}
.admin-drop::before { content: ""; position: absolute; left: 0; right: 0; top: -10px; height: 10px; }
.admin-drop a { display: block; padding: 8px 12px; color: var(--c-text); font-size: 13.5px; border-radius: 7px; white-space: nowrap; }
.admin-drop a:hover { background: var(--c-surface-2); color: var(--c-primary); text-decoration: none; }
.admin-menu-item.has-drop:hover .admin-drop,
.admin-menu-item.has-drop:focus-within .admin-drop { display: block; }

.admin-top { display: flex; align-items: center; gap: 14px; font-size: 13.5px; white-space: nowrap; margin-left: auto; }
.admin-top a { color: #fff; opacity: .85; }
.admin-top a:hover { color: #fff; opacity: 1; text-decoration: none; }
.admin-who { color: #fff; font-weight: 600; }
