:root {
  color-scheme: light;
  --bg: #ffffff;
  --fg: #111214;
  --muted: #767a82;
  --border: #e5e6e8;
  --accent: #111214;
  --card-bg: #f5f5f6;
  --draft: #d64545;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Pretendard", sans-serif;
  background: var(--bg);
  color: var(--fg);
  line-height: 1.5;
}

a { color: inherit; }

.container {
  max-width: 1120px;
  margin: 0 auto;
  padding: 32px 24px 96px;
}

/* header */
header.site-header {
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 10;
}

.icon-btn.nav-toggle { display: none; }

.site-header-inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: 18px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: "Black Han Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", "Pretendard", sans-serif;
  font-size: 1.5rem;
  font-weight: 400;
  letter-spacing: 0.01em;
  color: var(--fg);
  text-decoration: none;
}

.logo-icon {
  width: 26px;
  height: 26px;
  border-radius: 6px;
}

.tabs { display: flex; gap: 22px; }

.tab {
  border: none;
  background: transparent;
  color: var(--muted);
  font-weight: 600;
  font-size: 0.95rem;
  padding: 4px 0;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: color 0.2s ease, border-color 0.2s ease;
  text-decoration: none;
}

.tab:hover { color: var(--fg); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }

.header-icons { display: flex; align-items: center; gap: 12px; }

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  border-radius: 999px;
  border: none;
  background: transparent;
  color: var(--fg);
  cursor: pointer;
  text-decoration: none;
}

.icon-btn svg { width: 18px; height: 18px; flex-shrink: 0; }

.icon-btn:hover { background: var(--card-bg); }

.member-widget { position: relative; }

.member-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 260px;
  max-width: calc(100vw - 32px);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
  z-index: 20;
}

.member-tabs { display: flex; gap: 8px; margin-bottom: 12px; }

.member-tab {
  flex: 1;
  border: none;
  background: var(--card-bg);
  color: var(--muted);
  font-weight: 600;
  font-size: 0.85rem;
  padding: 8px 0;
  border-radius: 8px;
  cursor: pointer;
}

.member-tab.active { background: var(--accent); color: #fff; }

.member-form:not([hidden]) { display: flex; flex-direction: column; gap: 8px; }

.member-form input[type="text"],
.member-form input[type="email"] {
  height: 38px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0 12px;
  font-size: 0.9rem;
  font-family: inherit;
}

.member-honeypot { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }

.member-submit {
  height: 38px;
  border: none;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
}

.member-msg { font-size: 0.8rem; color: var(--muted); margin: 4px 0 0; min-height: 1.2em; }

.member-welcome { font-weight: 600; margin-bottom: 12px; display: flex; align-items: center; gap: 6px; }

.rank-badge {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  overflow: hidden;
  flex-shrink: 0;
}

.rank-badge-master { background: linear-gradient(135deg, #f6d365, #b8860b); color: #4a2e00; box-shadow: 0 0 6px rgba(212, 175, 55, 0.7); }
.rank-badge-basic { background: linear-gradient(135deg, #cfd8e3, #8fa0b3); color: #33414f; }
.rank-badge-membership { background: linear-gradient(135deg, #7dd3fc, #6366f1); color: #fff; box-shadow: 0 0 6px rgba(99, 102, 241, 0.6); }
.rank-badge-sponsor { background: linear-gradient(135deg, #fda4af, #e11d48); color: #fff; box-shadow: 0 0 6px rgba(225, 29, 72, 0.6); }

.rank-badge-shine {
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, transparent 30%, rgba(255, 255, 255, 0.85) 50%, transparent 70%);
  background-size: 250% 250%;
  background-position: -100% -100%;
  animation: rank-shine 2.6s ease-in-out infinite;
}

@keyframes rank-shine {
  0% { background-position: -100% -100%; }
  50% { background-position: 200% 200%; }
  100% { background-position: 200% 200%; }
}

.category-title {
  font-size: 2.1rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 0 0 20px;
}

.sub-tabs {
  gap: 28px;
  margin-bottom: 32px;
}

.sub-tab {
  border: none;
  background: transparent;
  color: var(--muted);
  font-weight: 600;
  font-size: 0.98rem;
  padding: 0 0 10px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: color 0.2s ease, border-color 0.2s ease;
}

.sub-tab:hover { color: var(--fg); }
.sub-tab.active { color: var(--fg); border-bottom-color: var(--fg); }

.search-bar {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 24px 14px;
  align-items: center;
  gap: 10px;
}

.search-bar:not([hidden]) { display: flex; }
.sub-tabs:not([hidden]) { display: flex; }

.search-bar input {
  flex: 1;
  border: none;
  border-bottom: 1px solid var(--border);
  padding: 8px 2px;
  font-size: 1rem;
  background: transparent;
  color: var(--fg);
  margin: 0;
  border-radius: 0;
}

.search-bar input:focus { outline: none; border-bottom-color: var(--fg); }

.search-bar button {
  background: transparent;
  color: var(--muted);
  font-size: 1.3rem;
  padding: 0 6px;
  line-height: 1;
}

.hero-tabs { display: flex; gap: 18px; margin-bottom: 16px; }

.hero-tab {
  border: none;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
  font-size: 1.15rem;
  padding: 0;
  cursor: pointer;
}

.hero-tab.active { color: var(--fg); }

/* section titles */
.section-title {
  font-size: 1.15rem;
  font-weight: 800;
  margin: 0 0 16px;
}

.cat-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 6px;
}

.badge-draft {
  display: inline-block;
  background: var(--draft);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  margin-left: 6px;
  text-transform: none;
}

/* hero */
.hero {
  grid-template-columns: 1.6fr 1fr;
  gap: 56px;
  padding: 32px 0 40px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 40px;
}

.hero:not([hidden]) { display: grid; }

.popular-list { display: flex; flex-direction: column; gap: 22px; }

.popular-row {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 18px;
  text-decoration: none;
  color: inherit;
}

.popular-thumb {
  width: 180px;
  height: 120px;
  object-fit: cover;
  border-radius: 8px;
  background: var(--card-bg);
  transition: transform 0.35s ease;
}

.popular-thumb.placeholder { background: var(--card-bg); }

.popular-row:hover .popular-thumb { transform: scale(1.04); }

.popular-text h3 {
  font-size: 1.1rem;
  margin: 0 0 6px;
  line-height: 1.35;
  transition: color 0.2s ease;
}

.popular-row:hover .popular-text h3 { color: var(--accent); }

.popular-text .excerpt {
  color: var(--muted);
  font-size: 0.88rem;
  margin-bottom: 6px;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.popular-text .meta { color: var(--muted); font-size: 0.78rem; }

.today-title {
  font-size: 1.6rem;
  font-weight: 800;
  padding-bottom: 14px;
  border-bottom: 2px solid var(--fg);
  margin-bottom: 0;
}

.today-time {
  color: var(--muted);
  font-size: 0.8rem;
  text-align: right;
  margin: 10px 0 18px;
}

.trending-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 26px;
}

.trending-list li {
  transition: opacity 0.28s ease;
  opacity: 1;
}

.trending-list li a {
  display: flex;
  gap: 14px;
  align-items: baseline;
  text-decoration: none;
  color: inherit;
}

.trending-list .rank {
  font-weight: 800;
  color: var(--muted);
  font-size: 1.05rem;
  width: 18px;
  flex-shrink: 0;
}

.trending-list .rank-title {
  font-size: 1rem;
  line-height: 1.45;
}

.trending-list li a:hover .rank-title { text-decoration: underline; }

.trending-list li.is-active { opacity: 0; }

/* featured pair */
.featured-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
  margin-bottom: 32px;
  padding-bottom: 32px;
  border-bottom: 1px solid var(--border);
}

.featured-tile {
  display: block;
  text-decoration: none;
  color: inherit;
}

.featured-tile .cover {
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  border-radius: 10px;
  background: var(--card-bg);
  margin-bottom: 16px;
  transition: transform 0.35s ease;
}

.featured-tile .cover.placeholder { background: var(--card-bg); }

.featured-tile:hover .cover { transform: scale(1.03); }

.featured-tile h3 {
  font-size: 1.3rem;
  margin: 0 0 8px;
  line-height: 1.35;
  transition: color 0.2s ease;
}

.featured-tile:hover h3 { color: var(--accent); }

.featured-tile .excerpt {
  color: var(--muted);
  font-size: 0.95rem;
}

/* card grid */
.card-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 28px 24px;
}

.post-card {
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: inherit;
}

.post-card .cover {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 8px;
  background: var(--card-bg);
  margin-bottom: 10px;
  overflow: hidden;
  transition: transform 0.35s ease;
}

.post-card .cover.placeholder { background: var(--card-bg); }

.post-card:hover .cover { transform: scale(1.04); }

.post-card h3 {
  font-size: 0.98rem;
  margin: 0 0 6px;
  line-height: 1.35;
  transition: color 0.2s ease;
}

.post-card:hover h3 { color: var(--accent); }

.post-card .excerpt {
  color: var(--muted);
  font-size: 0.85rem;
  margin-bottom: 8px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.post-card .meta { color: var(--muted); font-size: 0.76rem; }

/* load more */
.load-more {
  width: 100%;
  margin-top: 32px;
  padding: 14px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--fg);
  font-weight: 600;
  cursor: pointer;
}

.load-more:not([hidden]) { display: block; }
.load-more:hover { background: var(--card-bg); }

/* footer */
.site-footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  text-align: center;
  padding: 40px 20px;
  border-top: 1px solid var(--border);
}

.footer-logo {
  color: var(--muted);
  font-family: "Black Han Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", "Pretendard", sans-serif;
  font-size: 1.1rem;
  letter-spacing: 0.01em;
}

.footer-icons { display: flex; gap: 12px; }
.footer-icons:empty { display: none; }

.footer-link { color: var(--muted); font-size: 0.82rem; text-decoration: none; }
.footer-link:hover { text-decoration: underline; }

.ad-slot { max-width: 1120px; margin: 0 auto; }
.ad-slot:empty { display: none; }

.related-posts { margin-top: 40px; padding-top: 32px; border-top: 1px solid var(--border); }
.related-posts h2 { font-size: 1.2rem; margin-bottom: 16px; }
.related-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }

@media (max-width: 720px) {
  .related-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 960px) {
  .hero { grid-template-columns: 1fr; gap: 32px; }
  .featured-pair { grid-template-columns: 1fr; }
  .card-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 640px) {
  .card-grid { grid-template-columns: 1fr; }
  .popular-row { grid-template-columns: 110px 1fr; }
  .popular-thumb { width: 110px; height: 80px; }

  .site-header-inner { flex-wrap: nowrap; }
  .nav-toggle:not([hidden]) { display: inline-flex; }

  .tabs {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    gap: 0;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    padding: 4px 24px 12px;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.06);
  }
  .tabs.open { display: flex; }
  .tabs .tab {
    width: 100%;
    text-align: left;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
  }
  .tabs .tab:last-child { border-bottom: none; }
}

/* post detail */
.back-link { display: inline-block; margin-bottom: 20px; color: var(--accent); text-decoration: none; font-weight: 600; }

/* reading progress bar */
.reading-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  width: 0%;
  background: var(--fg);
  z-index: 1000;
  transition: width 0.1s linear;
}

/* post layout */
.post-layout {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 40px;
  align-items: start;
}

.post-sidebar { position: sticky; top: 90px; }

.post-meta-box {
  border-top: 2px solid var(--fg);
  padding-top: 14px;
}

.post-meta-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}

.post-meta-row:last-child { border-bottom: none; }

.meta-label { color: var(--muted); font-size: 0.76rem; text-transform: uppercase; letter-spacing: 0.03em; }

.post-main h1 { font-size: 1.9rem; margin: 0 0 20px; line-height: 1.3; }
.post-main img.cover { width: 100%; border-radius: 12px; margin-bottom: 24px; }
.post-content img { max-width: 100%; border-radius: 8px; }
.post-content { font-size: 1.05rem; }

.post-content.layout-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}
.post-content.layout-gallery p { margin: 0; }
.post-content.layout-gallery img { width: 100%; height: 200px; object-fit: cover; margin: 0; }

.layout-download-box { margin: 24px 0; }
.btn-download {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 46px;
  padding: 0 24px;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  text-decoration: none;
}

.layout-copy-box {
  margin: 24px 0;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  background: var(--card-bg);
}
.layout-copy-text {
  white-space: pre-wrap;
  word-break: break-word;
  font-family: inherit;
  font-size: 0.95rem;
  margin: 0 0 12px;
}
.btn-copy {
  height: 40px;
  padding: 0 20px;
  border: none;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}

.post-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 28px; }
.post-tag {
  background: var(--card-bg);
  color: var(--muted);
  font-size: 0.85rem;
  padding: 6px 12px;
  border-radius: 999px;
}

.post-actions {
  display: flex;
  gap: 12px;
  margin-top: 28px;
  padding: 20px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.post-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--card-bg);
  color: var(--fg);
  border: none;
  border-radius: 999px;
  padding: 10px 18px;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
}

.post-action-btn.is-liked { background: #ffe1e1; color: #d64545; }
.post-action-btn:hover { opacity: 0.85; }

.post-comments { margin-top: 32px; }
.post-comments h2 { font-size: 1.2rem; margin-bottom: 16px; }
.post-comments input, .post-comments textarea { margin-bottom: 10px; }

.comment-list { margin-top: 20px; display: flex; flex-direction: column; gap: 16px; }
.comment-item { padding-bottom: 16px; border-bottom: 1px solid var(--border); }
.comment-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 6px; }
.comment-time { color: var(--muted); font-size: 0.78rem; }
.comment-body { font-size: 0.95rem; line-height: 1.5; white-space: pre-wrap; }

@media (max-width: 720px) {
  .post-layout { grid-template-columns: 1fr; }
  .post-sidebar { position: static; }
  .post-meta-box { display: flex; flex-wrap: wrap; gap: 16px; }
  .post-meta-row { border-bottom: none; padding: 0; flex: 1 1 auto; min-width: 80px; }
}

.empty { color: var(--muted); text-align: center; padding: 60px 0; grid-column: 1 / -1; }

/* admin */
.admin-box {
  max-width: 480px;
  margin: 80px auto;
  padding: 32px;
  border: 1px solid var(--border);
  border-radius: 12px;
}

.admin-box h1 { margin-top: 0; font-size: 1.3rem; }

input, textarea, select, button {
  font-family: inherit;
  font-size: 1rem;
}

input[type="text"], input[type="password"], textarea, select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card-bg);
  color: var(--fg);
  margin-bottom: 12px;
}

textarea { min-height: 260px; resize: vertical; font-family: monospace; }

button {
  padding: 10px 18px;
  border: none;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
}

button.secondary { background: var(--card-bg); color: var(--fg); border: 1px solid var(--border); }
button.danger { background: #d64545; }

button:disabled { opacity: 0.5; cursor: not-allowed; }

.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.error-msg { color: #ff8080; margin-bottom: 12px; }
.field-label { font-size: 0.85rem; color: var(--muted); margin-bottom: 4px; display: block; }
img.thumb-preview { max-width: 160px; border-radius: 8px; margin-bottom: 10px; }

/* CMS shell */
.cms-layout { min-height: 100vh; }
.cms-layout:not([hidden]) { display: flex; }

.cms-sidebar {
  width: 220px;
  flex-shrink: 0;
  border-right: 1px solid var(--border);
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.cms-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: "Black Han Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", "Pretendard", sans-serif;
  font-size: 1.2rem;
  letter-spacing: 0.01em;
  margin-bottom: 20px;
  padding: 0 4px;
}

.cms-nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }

.cms-nav-item {
  text-align: left;
  padding: 10px 12px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: var(--muted);
  font-weight: 600;
  cursor: pointer;
  font-size: 0.92rem;
}

.cms-nav-item:hover { background: var(--card-bg); color: var(--fg); }
.cms-nav-item.active { background: var(--fg); color: var(--bg); }
.cms-site-link {
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  width: 100%;
  margin-top: auto;
}
.cms-logout { margin-top: 12px; width: 100%; }

.cms-main { flex: 1; padding: 32px 40px 80px; max-width: 900px; }
.cms-panel-title { font-size: 1.4rem; font-weight: 800; margin: 0 0 24px; }

.cms-hint { color: var(--muted); font-size: 0.9rem; margin-bottom: 12px; line-height: 1.6; }
.cms-hint code { background: var(--card-bg); padding: 2px 6px; border-radius: 4px; font-size: 0.85em; }

.cms-code-sample {
  background: var(--card-bg);
  padding: 14px 16px;
  border-radius: 8px;
  font-size: 0.8rem;
  overflow-x: auto;
  white-space: pre;
  margin: 0 0 14px;
  font-family: monospace;
}

.cms-status { color: var(--muted); font-size: 0.85rem; }

.cms-log {
  margin-top: 14px;
  font-size: 0.85rem;
  color: var(--muted);
  max-height: 220px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
}
.cms-log:empty { display: none; }

.cms-table { width: 100%; border-collapse: collapse; }
.cms-table th, .cms-table td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--border); font-size: 0.9rem; }
.cms-table th { color: var(--muted); font-weight: 600; font-size: 0.76rem; text-transform: uppercase; letter-spacing: 0.03em; }
.cms-table tbody tr:hover td { background: var(--card-bg); cursor: pointer; }
.cms-table td.cms-actions { white-space: nowrap; }
.cms-checkbox-cell { width: 36px; }

.cms-checkbox {
  width: 20px;
  height: 20px;
  cursor: pointer;
  accent-color: var(--fg);
}

.cms-pager {
  display: flex;
  gap: 6px;
  margin-top: 20px;
  justify-content: center;
}

.cms-page-btn {
  min-width: 36px;
  height: 36px;
  padding: 0 8px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--fg);
  font-weight: 600;
  cursor: pointer;
}

.cms-page-btn:hover { background: var(--card-bg); }
.cms-page-btn.active { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.cms-page-btn:disabled { opacity: 0.4; cursor: not-allowed; }

.cms-draft-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 16px;
  margin-bottom: 16px;
  font-size: 0.9rem;
}
.cms-draft-banner .btn { height: 32px; padding: 0 12px; font-size: 0.8rem; }

/* dashboard */
.cms-panel-title-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; }
.cms-panel-title-row .cms-panel-title { margin-bottom: 0; }

.cms-stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

.cms-stat-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px;
}

.cms-stat-label { color: var(--muted); font-size: 0.8rem; margin-bottom: 6px; }
.cms-stat-value { font-size: 1.6rem; font-weight: 800; }

.cms-log-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}
.cms-log-row:last-child { border-bottom: none; }

@media (max-width: 700px) {
  .cms-stat-grid { grid-template-columns: repeat(2, 1fr); }
}

/* quill editor */
.quill-editor { background: var(--card-bg); border-radius: 8px; margin-bottom: 12px; }
.ql-toolbar.ql-snow { border-color: var(--border); border-radius: 8px 8px 0 0; }
.ql-container.ql-snow { border-color: var(--border); border-radius: 0 0 8px 8px; min-height: 260px; font-size: 1rem; }

/* revisions */
.cms-revisions:not([hidden]) { display: block; margin-top: 24px; }
.cms-revision-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
  gap: 12px;
}

/* media library */
.cms-media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 16px;
}

.cms-media-item {
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  position: relative;
}

.cms-media-item img, .cms-media-item video { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; background: #000; }
.cms-media-item-actions { padding: 8px; display: flex; gap: 6px; }
.cms-media-item-actions .btn { flex: 1; height: 32px; padding: 0 8px; font-size: 0.76rem; }

.cms-media-item-check {
  position: absolute;
  top: 8px;
  left: 8px;
  width: 22px;
  height: 22px;
  z-index: 2;
  cursor: pointer;
  accent-color: var(--fg);
}

.cms-media-type-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 2;
  background: rgba(0,0,0,0.6);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
}

.cms-media-tabs { display: flex; gap: 4px; }

.cms-media-tab {
  border: none;
  background: transparent;
  color: var(--muted);
  font-weight: 600;
  font-size: 0.88rem;
  padding: 8px 14px;
  border-radius: 999px;
  cursor: pointer;
}

.cms-media-tab:hover { background: var(--card-bg); }
.cms-media-tab.active { background: var(--fg); color: var(--bg); }

/* menu management */
.menu-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 16px;
  overflow: hidden;
}

.menu-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
}

.menu-row-top { background: var(--card-bg); }
.menu-row-sub { border-top: 1px solid var(--border); padding-left: 30px; }

.menu-name { flex: 1; font-size: 0.95rem; }
.menu-row-top .menu-name { font-weight: 700; font-size: 1rem; }

.menu-move-group { display: flex; gap: 4px; flex-shrink: 0; }
.menu-move-group .btn { height: 30px; width: 30px; padding: 0; font-size: 0.75rem; }

.menu-actions { display: flex; gap: 8px; flex-shrink: 0; }
.menu-actions .btn { height: 34px; padding: 0 14px; font-size: 0.82rem; }

.menu-sub-list { display: flex; flex-direction: column; }
.menu-empty { padding: 10px 14px 14px 30px; color: var(--muted); font-size: 0.85rem; }

/* consistent CMS buttons */
.btn {
  height: 42px;
  padding: 0 20px;
  border-radius: 8px;
  border: none;
  font-weight: 600;
  font-size: 0.92rem;
  cursor: pointer;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-secondary { background: var(--card-bg); color: var(--fg); border: 1px solid var(--border); }
.btn-danger { background: #d64545; color: #fff; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

@media (max-width: 860px) {
  .cms-layout:not([hidden]) { flex-direction: column; }
  .cms-sidebar {
    width: 100%;
    height: auto;
    position: sticky;
    top: 0;
    z-index: 20;
    background: var(--bg);
    flex-direction: row;
    align-items: center;
    padding: 10px 12px;
    gap: 10px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .cms-logo { margin-bottom: 0; white-space: nowrap; flex-shrink: 0; }
  .cms-nav { flex-direction: row; flex: none; gap: 6px; }
  .cms-nav-item { white-space: nowrap; flex-shrink: 0; }
  .cms-logout { margin-top: 0; width: auto; white-space: nowrap; flex-shrink: 0; }
  .cms-main { padding: 16px; max-width: 100%; }
  .cms-panel-title-row { flex-wrap: wrap; gap: 10px; }
  .cms-stat-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .cms-table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; white-space: nowrap; }
  .cms-media-grid { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 10px; }
}

@media (max-width: 480px) {
  .cms-main { padding: 12px; }
  .admin-box { margin: 40px 16px; padding: 24px; max-width: none; }
  .cms-stat-grid { grid-template-columns: 1fr 1fr; }
}
img.thumb-preview:not([hidden]) { display: block; }
