:root {
  color-scheme: light;
  --bg: #f7f9fc;
  --surface: #ffffff;
  --surface-strong: #eef3fb;
  --text: #182033;
  --muted: #65708a;
  --border: #d9e1ee;
  --primary: #0f4c9a;
  --accent: #d9272e;
  --focus: #ffd447;
  --shadow: 0 18px 45px rgba(15, 76, 154, 0.12);
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #101522;
  --surface: #182033;
  --surface-strong: #202a42;
  --text: #f4f7fb;
  --muted: #b5c0d4;
  --border: #33415f;
  --primary: #6ea8ff;
  --accent: #ff7378;
  --focus: #ffe075;
  --shadow: 0 18px 45px rgba(0, 0, 0, 0.24);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", Arial, sans-serif;
  line-height: 1.6;
}
a { color: inherit; }
img { max-width: 100%; }
button, input, textarea { font: inherit; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 14px clamp(18px, 4vw, 56px);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(16px);
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 220px;
  font-weight: 800;
  text-decoration: none;
}
.brand-logo { width: 42px; height: 42px; object-fit: contain; }
.brand span {
  display: -webkit-box;
  overflow: hidden;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  line-height: 1.25;
}
.main-nav { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.main-nav a, .admin-nav a, .admin-nav button, .theme-toggle, .nav-toggle {
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  padding: 9px 11px;
  text-decoration: none;
  white-space: nowrap;
}
.main-nav a:hover, .main-nav a.active, .admin-nav a:hover, .admin-nav a.active {
  background: var(--surface-strong);
  color: var(--primary);
}
.theme-toggle, .nav-toggle { border-color: var(--border); color: var(--text); }
.nav-toggle { display: none; }

main { min-height: 68vh; }
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 28px;
  align-items: center;
  padding: clamp(48px, 8vw, 92px) clamp(18px, 6vw, 72px);
  background:
    linear-gradient(135deg, rgba(15, 76, 154, 0.14), transparent 45%),
    linear-gradient(315deg, rgba(217, 39, 46, 0.14), transparent 45%);
}
.hero-content { max-width: 820px; }
.eyebrow { margin: 0 0 8px; color: var(--accent); font-weight: 800; letter-spacing: 0; }
h1, h2, h3, p { overflow-wrap: anywhere; }
h1 { margin: 0; font-size: clamp(2.1rem, 5vw, 4.8rem); line-height: 1.12; }
h2 { margin: 0 0 10px; font-size: 1.35rem; }
.hero p:not(.eyebrow), .page-title p { max-width: 680px; color: var(--muted); font-size: 1.08rem; }
.hero-actions, .section-heading, .search-form { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.button, .danger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  border: 1px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 800;
  padding: 10px 16px;
  text-decoration: none;
}
.button.primary { background: var(--primary); color: #fff; }
.button.secondary { background: var(--surface); border-color: var(--border); color: var(--primary); }
.button.full { width: 100%; }
.danger { background: var(--accent); color: #fff; }

.hero-panel, .stats-grid article, .section-grid article, .content-block, .form-card, .admin-section {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}
.hero-panel { display: grid; gap: 8px; padding: 26px; }
.hero-panel span, .stats-grid span { color: var(--muted); font-weight: 700; }
.hero-panel strong, .stats-grid strong { color: var(--primary); font-size: 2.7rem; line-height: 1; }
.section-grid, .stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
  padding: 38px clamp(18px, 6vw, 72px);
}
.section-grid article, .stats-grid article { padding: 22px; }
.page { width: min(1120px, calc(100% - 32px)); margin: 0 auto; padding: 42px 0 64px; }
.page.narrow { width: min(720px, calc(100% - 32px)); }
.page-title { margin-bottom: 24px; }
.content-block, .form-card, .admin-section { padding: clamp(18px, 4vw, 28px); }
.content-block + .content-block, .admin-section + .admin-section { margin-top: 20px; }
.content-block h2:not(:first-child) { margin-top: 28px; }
.center { text-align: center; }
.form-card { display: grid; gap: 16px; }
label { display: grid; gap: 7px; font-weight: 800; }
input, textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  padding: 12px 13px;
}
textarea { resize: vertical; }
.check { display: flex; align-items: center; gap: 8px; }
.check input { width: auto; }
.notice {
  border-left: 4px solid var(--accent);
  background: var(--surface-strong);
  padding: 12px 14px;
}
.notice.error { color: var(--accent); }
.notice p { margin: 4px 0 0; }
.recent-list { display: grid; gap: 10px; padding: 0; list-style: none; }
.recent-list li { display: flex; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--border); padding: 10px 0; }

.admin-page { width: min(1280px, calc(100% - 32px)); }
.admin-nav { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 24px; }
.admin-nav button { border-color: var(--border); }
.section-heading { justify-content: space-between; margin-bottom: 12px; }
.search-form { margin-bottom: 14px; }
.search-form input { max-width: 360px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 820px; }
th, td { border-bottom: 1px solid var(--border); padding: 10px; text-align: left; vertical-align: top; }
th { color: var(--primary); }
td.wide { min-width: 240px; white-space: pre-wrap; }
.logo-preview {
  display: grid;
  place-items: center;
  min-height: 160px;
  border: 1px dashed var(--border);
  border-radius: 8px;
  background: var(--surface-strong);
  margin-bottom: 16px;
}
.logo-preview img { max-height: 120px; }
.site-footer {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 28px clamp(18px, 4vw, 56px);
  border-top: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
}
.site-footer p { margin: 6px 0 0; }
.footer-meta { display: grid; gap: 5px; text-align: right; }

@media (max-width: 960px) {
  .site-header { flex-wrap: wrap; }
  .nav-toggle { display: inline-flex; margin-left: auto; }
  .main-nav { display: none; width: 100%; flex-direction: column; align-items: stretch; margin-left: 0; }
  .main-nav.open { display: flex; }
  .theme-toggle { margin-left: 0; }
  .hero { grid-template-columns: 1fr; }
  .section-grid, .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .brand { min-width: 0; max-width: calc(100% - 90px); }
  h1 { font-size: 2.1rem; }
  .section-grid, .stats-grid { grid-template-columns: 1fr; }
  .recent-list li, .site-footer { display: grid; }
  .footer-meta { text-align: left; }
  .admin-nav button { width: 100%; }
}
@media (prefers-reduced-motion: no-preference) {
  .hero-content, .hero-panel, .section-grid article, .form-card, .content-block {
    animation: rise 420ms ease both;
  }
  @keyframes rise {
    from { opacity: 0; transform: translateY(14px); }
    to { opacity: 1; transform: translateY(0); }
  }
}
