:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface2: #f0f2f5;
  --ink: #14161a;
  --ink2: #3a3f47;
  --muted: #6b7280;
  --faint: #9aa1ab;
  --line: #e2e5ea;
  --line2: #cfd4dc;
  --accent: #14161a;
  --accent-ink: #ffffff;
  --code: #f1f3f6;
  --shadow: 0 1px 2px rgba(16, 20, 28, 0.05);
  --shadow-lg: 0 8px 24px rgba(16, 20, 28, 0.08);
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Inter, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  color-scheme: light;
}

html[data-theme="dark"] {
  --bg: #0e1014;
  --surface: #16191f;
  --surface2: #1d2128;
  --ink: #f1f3f6;
  --ink2: #c9ced6;
  --muted: #98a0ab;
  --faint: #6f7783;
  --line: #262b33;
  --line2: #363c46;
  --accent: #f1f3f6;
  --accent-ink: #101318;
  --code: #1b1f26;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.5);
  color-scheme: dark;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--ink); text-decoration: none; }
a:hover { color: var(--muted); }

.wrap { max-width: 1080px; margin: 0 auto; padding: 0 20px; }

/* ---------------------------------------------------------------- header */

.site-head {
  position: sticky;
  top: 0;
  z-index: 40;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: saturate(140%) blur(8px);
  border-bottom: 1px solid var(--line);
}
.head-inner {
  display: flex;
  align-items: center;
  gap: 24px;
  height: 60px;
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); }
.brand:hover { color: var(--ink); }
.brand-mark {
  width: 30px; height: 30px;
  border-radius: 8px;
  display: grid; place-items: center;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 700;
  font-size: 15px;
}
.brand-text { display: flex; align-items: baseline; gap: 7px; }
.brand-name { font-weight: 650; font-size: 15.5px; letter-spacing: -0.01em; }
.brand-sub {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--faint);
}
.mainnav { display: flex; align-items: center; gap: 4px; flex: 1; }
.mainnav a {
  padding: 6px 10px;
  border-radius: 7px;
  font-size: 14px;
  color: var(--muted);
}
.mainnav a:hover { color: var(--ink); background: var(--surface2); }
.head-actions { display: flex; align-items: center; gap: 10px; }
.head-link { font-size: 14px; color: var(--muted); }
.head-link:hover { color: var(--ink); }
.theme-btn {
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--line2);
  border-radius: 7px;
  padding: 5px 9px;
  cursor: pointer;
}
.theme-btn:hover { color: var(--ink); border-color: var(--ink); }

/* ---------------------------------------------------------------- content */

.content { padding: 36px 20px 64px; }

h1 {
  margin: 0 0 10px;
  font-size: clamp(28px, 4vw, 40px);
  line-height: 1.15;
  letter-spacing: -0.025em;
  font-weight: 700;
}
h2 { margin: 0 0 14px; font-size: 21px; font-weight: 650; letter-spacing: -0.015em; }
h3 { margin: 0 0 6px; font-size: 16.5px; font-weight: 600; }
p { margin: 0 0 14px; }

.subtitle { margin: 0 0 20px; color: var(--muted); font-size: 16px; max-width: 66ch; }
.lead { margin: 0 0 22px; color: var(--ink2); font-size: 17.5px; max-width: 62ch; }
.crumbs { margin: 0 0 14px; font-size: 13px; color: var(--faint); }
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--ink); text-decoration: underline; }

.hero {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 40px 36px;
  margin-bottom: 34px;
  box-shadow: var(--shadow);
}
.hero h1 { font-size: clamp(30px, 4.6vw, 44px); }
.kicker {
  display: inline-block;
  margin-bottom: 14px;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--surface2);
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.stats {
  display: flex;
  flex-wrap: wrap;
  gap: 22px;
  margin-top: 26px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  font-size: 13.5px;
  color: var(--muted);
}
.stats strong { font-size: 18px; color: var(--ink); font-weight: 650; margin-right: 4px; }

.section { margin-bottom: 34px; }
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}
.section-head h2 { margin: 0; }
.section-head a { font-size: 13.5px; color: var(--muted); }
.section-head a:hover { color: var(--ink); text-decoration: underline; }

/* ---------------------------------------------------------------- cards */

.cards {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}
.card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px 18px 14px;
  box-shadow: var(--shadow);
  transition: border-color 0.12s ease, box-shadow 0.12s ease, transform 0.12s ease;
}
.card:hover {
  border-color: var(--line2);
  box-shadow: var(--shadow-lg);
  transform: translateY(-1px);
}
.card-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.card h3 { margin: 0 0 6px; }
.card h3 a:hover { text-decoration: underline; }
.card p {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 14px;
  flex: 1;
}
.card-foot {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}
.tag {
  font-size: 10.5px;
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  background: var(--surface2);
  border-radius: 5px;
  padding: 2px 7px;
}
.meta { font-size: 12.5px; color: var(--faint); }
.empty {
  padding: 28px;
  text-align: center;
  color: var(--muted);
  background: var(--surface);
  border: 1px dashed var(--line2);
  border-radius: 12px;
}

/* ---------------------------------------------------------------- buttons */

.actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 22px 0; }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 16px;
  border-radius: 9px;
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 600;
  color: var(--accent-ink);
  background: var(--accent);
  border: 1px solid var(--accent);
  cursor: pointer;
  text-decoration: none;
}
.btn:hover { opacity: 0.88; color: var(--accent-ink); text-decoration: none; }
.btn-ghost {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--line2);
}
.btn-ghost:hover { background: var(--surface2); color: var(--ink); border-color: var(--ink); opacity: 1; }
.btn-small { padding: 6px 11px; font-size: 12.5px; border-radius: 7px; }

.link-btn {
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  font-size: 14px;
  color: var(--muted);
  cursor: pointer;
}
.link-btn:hover { color: var(--ink); text-decoration: underline; }

/* ---------------------------------------------------------------- prose */

.prose { max-width: 72ch; font-size: 15.5px; }
.prose h2 { margin: 34px 0 12px; }
.prose h3 { margin: 22px 0 8px; }
.prose ul, .prose ol { margin: 0 0 16px; padding-left: 22px; }
.prose li { margin: 5px 0; }
.prose code, .mono {
  font-family: var(--mono);
  font-size: 0.88em;
  background: var(--code);
  border-radius: 4px;
  padding: 0.12em 0.35em;
}
.prose pre {
  background: var(--code);
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 14px 16px;
  overflow: auto;
  font-size: 13px;
}
.note { color: var(--muted); font-size: 14px; margin-top: 18px; }
.hint { font-size: 12px; color: var(--faint); }

/* ---------------------------------------------------------------- tables */

.table-wrap { overflow-x: auto; }
table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0 24px;
  font-size: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
}
th {
  text-align: left;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  background: var(--surface2);
  padding: 9px 12px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: var(--surface2); }

/* ---------------------------------------------------------------- forms */

.form {
  max-width: 480px;
  display: flex;
  flex-direction: column;
  gap: 15px;
  margin: 22px 0;
  padding: 22px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
}
.form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink2);
}
.form input, .form select, .form textarea {
  width: 100%;
  font-family: var(--sans);
  font-size: 14.5px;
  font-weight: 400;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line2);
  border-radius: 8px;
  padding: 9px 11px;
}
.form textarea { resize: vertical; min-height: 72px; }
.form input:focus, .form select:focus, .form textarea:focus {
  outline: none;
  border-color: var(--ink);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--ink) 12%, transparent);
}
.form .btn { align-self: flex-start; }

.inline { display: inline-flex; gap: 6px; align-items: center; margin: 0; }
.inline input {
  font-family: var(--sans);
  font-size: 12.5px;
  padding: 5px 8px;
  border: 1px solid var(--line2);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink);
  max-width: 150px;
}
.inline select {
  font-family: var(--sans);
  font-size: 12.5px;
  padding: 5px 6px;
  border: 1px solid var(--line2);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink);
}

/* ---------------------------------------------------------------- notices */

.flash {
  padding: 11px 14px;
  border-radius: 9px;
  font-size: 14px;
  margin: 0 0 20px;
  border: 1px solid var(--line2);
  background: var(--surface);
}
.flash.ok { border-color: #b7e4c7; background: #f0fbf4; color: #14532d; }
html[data-theme="dark"] .flash.ok { border-color: #1f5137; background: #10241a; color: #a7e3bf; }
.flash.err { border-color: #f3c2c2; background: #fdf2f2; color: #7f1d1d; }
html[data-theme="dark"] .flash.err { border-color: #5b2020; background: #241414; color: #f3b6b6; }

.status {
  display: inline-block;
  font-size: 11px;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--surface2);
  color: var(--muted);
  border: 1px solid var(--line);
}
.status.approved { background: #eaf7ef; color: #146c43; border-color: #bfe6cf; }
html[data-theme="dark"] .status.approved { background: #12281c; color: #8fdcb0; border-color: #1f5137; }
.status.rejected { background: #fdf2f2; color: #9b1c1c; border-color: #f3c2c2; }
html[data-theme="dark"] .status.rejected { background: #241414; color: #f0aaaa; border-color: #5b2020; }
.status.pending { background: #fff8e6; color: #8a5a00; border-color: #f0dca8; }
html[data-theme="dark"] .status.pending { background: #241f10; color: #e8c98a; border-color: #4d3d17; }

.post-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin: 14px 0 0;
  font-size: 13px;
  color: var(--faint);
}

/* ---------------------------------------------------------------- footer */

.site-foot { border-top: 1px solid var(--line); background: var(--surface); margin-top: 20px; }
.foot-inner {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 24px;
  justify-content: space-between;
  padding-top: 22px;
  padding-bottom: 26px;
  font-size: 13px;
  color: var(--muted);
}
.foot-links { display: flex; flex-wrap: wrap; gap: 16px; }
.foot-links a { color: var(--muted); }
.foot-links a:hover { color: var(--ink); text-decoration: underline; }

/* ---------------------------------------------------------------- responsive */

@media (max-width: 900px) {
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hero { padding: 30px 24px; }
  .head-inner { gap: 12px; }
  .brand-sub { display: none; }
}
@media (max-width: 760px) {
  .head-inner { height: auto; padding: 10px 0; flex-wrap: wrap; }
  .mainnav { order: 3; flex-basis: 100%; overflow-x: auto; padding-bottom: 2px; }
  .mainnav a { white-space: nowrap; }
  .head-actions { margin-left: auto; }
  .content { padding: 24px 16px 48px; }
}
@media (max-width: 560px) {
  .cards { grid-template-columns: 1fr; }
  .theme-btn { display: none; }
  .hero { padding: 24px 18px; border-radius: 12px; }
  .stats { gap: 14px; font-size: 13px; }
  .form { padding: 16px; }
}

@media print {
  body { background: #fff; color: #000; }
  .site-head, .site-foot, .theme-btn, .actions { display: none; }
  .content { padding: 0; }
}
