:root {
  font-family: Inter, Pretendard, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #1f2937;
  background: #f4f6f8;
  line-height: 1.55;
}
* { box-sizing: border-box; }
body { margin: 0; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
.container { width: min(1180px, calc(100% - 32px)); margin: 0 auto; }
.topbar { background: #111827; color: #fff; }
.topbar-inner { min-height: 60px; display: flex; align-items: center; gap: 28px; }
.brand { font-size: 18px; font-weight: 800; }
.nav { margin-left: auto; display: flex; align-items: center; gap: 18px; }
.nav a, .link-button { color: #d1d5db; }
.nav a:hover, .link-button:hover { color: #fff; }
.link-button { border: 0; background: transparent; cursor: pointer; padding: 0; }
.page { padding: 30px 0 60px; }
.page-header { display: flex; justify-content: space-between; gap: 20px; align-items: flex-start; margin-bottom: 18px; }
h1 { margin: 0 0 6px; font-size: 30px; }
h2 { margin-top: 0; }
.muted { color: #6b7280; margin: 4px 0; }
.card { background: #fff; border: 1px solid #e5e7eb; border-radius: 12px; padding: 20px; box-shadow: 0 1px 2px rgb(0 0 0 / 0.03); }
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 38px; padding: 7px 13px; border: 1px solid #d1d5db; border-radius: 8px; background: #fff; color: 1f2937; cursor: pointer; -webkit-appearance:none; appearance: none; }
.btn:hover { background: #f9fafb; }
.btn-primary { background: #111827; color: #fff; border-color: #111827; }
.btn-primary:hover { background: #1f2937; }
.btn-danger { color: #b91c1c; border-color: #fecaca; }
.btn-danger:hover { background: #fef2f2; }
.btn-ghost { background: transparent; }
.btn-small { min-height: 32px; padding: 4px 9px; font-size: 13px; }
.button-group, .form-actions { display: flex; gap: 8px; }
.alert { border-radius: 8px; padding: 10px 13px; margin: 0 0 16px; }
.alert-error { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.stack { display: grid; gap: 14px; }
label { display: grid; gap: 6px; font-size: 14px; font-weight: 650; }
input, select, textarea { width: 100%; border: 1px solid #d1d5db; border-radius: 8px; padding: 9px 10px; background: #fff; color: #111827; }
input:focus, select:focus, textarea:focus { outline: 2px solid #d1d5db; border-color: #6b7280; }
.login-wrap { min-height: 70vh; display: grid; place-items: center; }
.login-card { width: min(430px, 100%); }
.filter-form { margin-bottom: 18px; }
.filter-grid { display: grid; grid-template-columns: 2fr repeat(3, 1fr) auto; gap: 12px; align-items: end; }
.filter-actions { display: flex; gap: 6px; }
.post-list { display: grid; gap: 10px; }
.post-row { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.post-row h2 { font-size: 19px; margin: 5px 0; }
.post-row h2 a:hover { text-decoration: underline; }
.breadcrumb { color: #4b5563; font-size: 13px; display: flex; gap: 6px; flex-wrap: wrap; }
.sep { color: #9ca3af; }
.meta { display: flex; gap: 14px; flex-wrap: wrap; color: #6b7280; font-size: 13px; }
.empty { text-align: center; padding: 50px 20px; }
.form-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }
.editor-toolbar { margin: 18px 0 8px; display: flex; gap: 6px; flex-wrap: wrap; }
.editor-split { display: grid; grid-template-columns: 1fr 1fr; border: 1px solid #d1d5db; border-radius: 10px; overflow: hidden; min-height: 620px; }
.editor-pane { min-width: 0; display: flex; flex-direction: column; }
.editor-pane + .editor-pane { border-left: 1px solid #d1d5db; }
.pane-title { padding: 8px 12px; background: #f9fafb; border-bottom: 1px solid #e5e7eb; font-size: 12px; font-weight: 700; color: #6b7280; }
.editor-pane textarea { flex: 1; resize: vertical; min-height: 570px; border: 0; border-radius: 0; padding: 16px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; line-height: 1.6; }
.preview-pane { overflow: auto; }
.preview-pane .markdown-body { padding: 16px 22px; }
.form-actions { margin-top: 16px; justify-content: flex-end; }
.markdown-card { padding: 32px min(5vw, 54px); }
.markdown-body { overflow-wrap: anywhere; }
.markdown-body h1, .markdown-body h2, .markdown-body h3 { margin-top: 1.6em; border-bottom: 1px solid #e5e7eb; padding-bottom: .25em; }
.markdown-body h1:first-child, .markdown-body h2:first-child { margin-top: 0; }
.markdown-body pre { overflow-x: auto; background: #111827; color: #f9fafb; padding: 14px; border-radius: 8px; }
.markdown-body code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; background: #f3f4f6; padding: .12em .32em; border-radius: 4px; }
.markdown-body pre code { background: transparent; padding: 0; }
.markdown-body blockquote { margin-left: 0; padding-left: 14px; border-left: 4px solid #d1d5db; color: #4b5563; }
.markdown-body table { width: 100%; border-collapse: collapse; }
.markdown-body th, .markdown-body td { border: 1px solid #d1d5db; padding: 7px 9px; }
.two-column { display: grid; grid-template-columns: minmax(280px, 360px) 1fr; gap: 18px; align-items: start; }
.category-tree { display: grid; gap: 8px; }
.category-node { border-left: 3px solid #e5e7eb; padding-left: 10px; }
.level-2 { margin-left: 24px; }
.level-3 { margin-left: 48px; }
.category-row { display: flex; gap: 8px; align-items: center; margin: 7px 0; }
.category-edit { display: flex; gap: 6px; flex: 1; }
.category-edit input:first-child { flex: 1; }
.parent-edit { width: 150px; }
.sort-input { width: 74px; }
@media (max-width: 900px) {
  .filter-grid { grid-template-columns: 1fr 1fr; }
  .editor-split { grid-template-columns: 1fr; }
  .editor-pane + .editor-pane { border-left: 0; border-top: 1px solid #d1d5db; }
  .two-column { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .container {
    width: min(100% - 20px, 1180px);
  }
  .topbar-inner {
    gap: 12px;
  }
  .nav {
    gap: 10px;
    font-size: 13px;
  }
  .page-header,
  .post-row {
    flex-direction: column;
    align-items: stretch;
  }
  .form-grid,
  .filter-grid {
    grid-template-columns: 1fr;
  }
  /* 검색 / 초기화 버튼 */
  .filter-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
  .filter-actions .btn {
    width: 100%;
  }
  .editor-split {
    min-height: auto;
  }
  .editor-pane textarea {
    min-height: 420px;
  }
}
.filter-actions button.btn-primary {
  background: #111827;
  border-color: #111827;
  color: #ffffff !important;
  -webkit-text-fill-color: #ffffff !important;
}

.filter-actions button.btn-primary .btn-label {
  display: inline-block;
  color: #ffffff !important;
  -webkit-text-fill-color: #ffffff !important;
  font-size: 14px;
  font-weight: 700;
  opacity: 1;
  visibility: visible;
}
