:root {
  --color-bg: #f6f7f9;
  --color-surface: #ffffff;
  --color-text: #1b1e26;
  --color-text-muted: #636a78;
  --color-accent: #6a5cff;
  --color-accent-dark: #4c3fe0;
  --color-border: #e1e4ea;
  --font-base: -apple-system, BlinkMacSystemFont, "Segoe UI", "Apple SD Gothic Neo", "Noto Sans KR", sans-serif;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: var(--font-base);
  color: var(--color-text);
  background: var(--color-bg);
}
a { color: var(--color-accent-dark); text-decoration: none; }

/* Login */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.login-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 14px;
  padding: 40px 36px;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 16px 40px rgba(0,0,0,0.07);
}
.login-card h1 { font-size: 1.3rem; margin: 0 0 6px; letter-spacing: -0.01em; }
.login-card .login-sub { color: var(--color-text-muted); font-size: 0.85rem; line-height: 1.55; margin: 0 0 26px; }
.form-row { margin-bottom: 16px; }
.form-row label { display: block; font-weight: 600; font-size: 0.85rem; margin-bottom: 6px; }
.form-row input {
  width: 100%;
  padding: 11px 13px;
  border: 1px solid var(--color-border);
  border-radius: 7px;
  font-size: 0.95rem;
  transition: border-color 0.15s ease;
}
.form-row input:focus { outline: none; border-color: var(--color-accent); }
.btn-primary {
  width: 100%;
  padding: 12px;
  background: var(--color-accent-dark);
  color: #fff;
  border: none;
  border-radius: 7px;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease;
}
.btn-primary:hover { background: var(--color-accent); }
.btn-primary:active { transform: scale(0.98); }
.login-footnote { margin-top: 18px; font-size: 0.78rem; color: var(--color-text-muted); text-align: center; }
.login-note {
  margin-top: 24px;
  padding: 12px 14px;
  background: var(--color-bg);
  border-radius: 8px;
  font-size: 0.78rem;
  line-height: 1.5;
  color: var(--color-text-muted);
}

/* Admin shell */
.admin-shell { display: flex; min-height: 100vh; }
.admin-sidebar {
  width: 220px;
  background: #1c1f1d;
  color: #fff;
  padding: 24px 16px;
  flex-shrink: 0;
}
.admin-sidebar .brand { font-weight: 800; font-size: 1.05rem; margin-bottom: 28px; display: block; color: #fff; letter-spacing: -0.01em; }
.admin-nav { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 3px; }
.admin-nav a {
  display: block;
  padding: 10px 12px;
  border-radius: 7px;
  color: rgba(255,255,255,0.75);
  font-size: 0.9rem;
  transition: background 0.15s ease, color 0.15s ease;
}
.admin-nav a:hover { background: rgba(255,255,255,0.08); color: #fff; }
.admin-nav a.active { background: var(--color-accent-dark); color: #fff; font-weight: 600; }
.admin-main { flex: 1; padding: 28px 36px; }
.admin-topbar { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 26px; gap: 16px; flex-wrap: wrap; }
.admin-topbar h1 { font-size: 1.4rem; margin: 0 0 4px; letter-spacing: -0.01em; }
.admin-topbar .admin-subtitle { display: block; font-size: 0.85rem; color: var(--color-text-muted); margin: 0; }
.admin-user { font-size: 0.85rem; color: var(--color-text-muted); white-space: nowrap; }

/* Stat cards */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 28px; }
.stat-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: 18px 20px;
  transition: box-shadow 0.15s ease;
}
.stat-card:hover { box-shadow: 0 8px 20px rgba(0,0,0,0.05); }
.stat-card span { display: block; font-size: 0.8rem; color: var(--color-text-muted); margin-bottom: 6px; }
.stat-card strong { font-size: 1.6rem; letter-spacing: -0.01em; }
.stat-card .delta { font-size: 0.78rem; font-weight: 600; }
.delta.up { color: #2f8f5b; }
.delta.down { color: #c1473f; }
.delta.flat { color: var(--color-text-muted); }

.chart-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 16px; margin-bottom: 28px; }
.chart-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: 20px;
}
.chart-card h2 { font-size: 1rem; margin: 0 0 4px; }
.chart-card .chart-note { font-size: 0.78rem; color: var(--color-text-muted); margin: 0 0 16px; }

.table-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: 20px;
  overflow-x: auto;
}
.table-card h2 { font-size: 1rem; margin: 0 0 4px; }
.table-card .table-note { font-size: 0.78rem; color: var(--color-text-muted); margin: 0 0 16px; }
table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
th, td { text-align: left; padding: 11px 12px; border-bottom: 1px solid var(--color-border); }
th { color: var(--color-text-muted); font-weight: 600; font-size: 0.76rem; text-transform: uppercase; letter-spacing: 0.04em; }
tbody tr { transition: background 0.12s ease; }
tbody tr:hover { background: var(--color-bg); }

/* Content management */
.toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.btn-small {
  padding: 8px 14px;
  background: var(--color-accent-dark);
  color: #fff;
  border: none;
  border-radius: 7px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease;
}
.btn-small:hover { background: var(--color-accent); }
.btn-ghost-small {
  padding: 6px 10px;
  background: transparent;
  border: 1px solid var(--color-border);
  border-radius: 7px;
  font-size: 0.78rem;
  cursor: pointer;
  transition: border-color 0.15s ease;
}
.btn-ghost-small:hover { border-color: var(--color-accent); color: var(--color-accent-dark); }
.status-pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
}
.status-pill.published { background: #e3f2e8; color: #2f8f5b; }
.status-pill.draft { background: #f3e9d4; color: #9a6b1f; }

@media (max-width: 900px) {
  .admin-sidebar { display: none; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .chart-grid { grid-template-columns: 1fr; }
  .admin-topbar { align-items: flex-start; flex-direction: column; }
}

/* Mobile line-wrap fix: Korean text wraps at word boundaries, not mid-syllable */
body { word-break: keep-all; overflow-wrap: break-word; }
