:root { --g: #1f5f3f; --g2: #2f7d4f; --soft: #e8f2ec; --ink: #1d2320; --muted: #7a847e; --line: #e1e6e3; --bg: #f4f6f5; --red: #c0392b; }
* { box-sizing: border-box; }
body.admin {
  margin: 0; font-family: "Pretendard Variable", Pretendard, -apple-system, "Malgun Gothic", sans-serif;
  color: var(--ink); background: var(--bg); line-height: 1.55; word-break: keep-all; display: flex; min-height: 100vh;
}
a { color: var(--g2); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.6rem; margin: 0 0 8px; letter-spacing: -.02em; }
h1 small { font-size: .95rem; color: var(--muted); font-weight: 500; margin-left: 6px; }
h2 { font-size: 1.15rem; margin: 0 0 12px; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }

.a-side { width: 230px; flex-shrink: 0; background: #16201b; color: #cfd8d3; display: flex; flex-direction: column; padding: 20px 14px; position: sticky; top: 0; height: 100vh; }
.a-logo { display: flex; align-items: center; gap: 10px; color: #fff; font-weight: 800; font-size: 1.1rem; margin: 0 8px 24px; }
.a-logo:hover { text-decoration: none; }
.a-side nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.a-side nav a { color: #cfd8d3; padding: 10px 12px; border-radius: 8px; font-weight: 600; }
.a-side nav a:hover { background: #22302a; text-decoration: none; }
.a-side nav a.on { background: var(--g2); color: #fff; }
.a-user { display: flex; flex-direction: column; gap: 6px; font-size: .88rem; border-top: 1px solid #2a3832; padding: 14px 8px 0; }
.a-user span { color: #fff; font-weight: 700; }
.a-user a { color: #9fb3a8; }

.a-main { flex: 1; min-width: 0; padding: 32px 36px 60px; max-width: 1200px; }
.a-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }

.a-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 4px; padding: 10px 18px; border-radius: 8px;
  border: 1px solid var(--line); background: #fff; color: var(--ink); font: inherit; font-weight: 700; cursor: pointer; white-space: nowrap;
}
.a-btn:hover { text-decoration: none; border-color: #b9c6bf; }
.a-btn.primary { background: var(--g); color: #fff; border-color: var(--g); }
.a-btn.primary:hover { background: #174a31; }
.a-btn.ghost { background: transparent; }
.a-btn.danger { color: var(--red); border-color: #efc7c2; background: #fff; }
.a-btn.danger:hover { background: #fdf0ee; }
.a-btn.sm { padding: 6px 12px; font-size: .85rem; }
.a-btn.wide { width: 100%; padding: 13px; font-size: 1rem; }

.alert { padding: 12px 16px; border-radius: 10px; margin-bottom: 18px; font-weight: 600; background: var(--soft); color: var(--g); border: 1px solid #cbe3d3; }
.alert.err { background: #fdf0ee; color: var(--red); border-color: #f1cdc8; }

.panel { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 22px; margin-bottom: 20px; }
.narrow-panel { max-width: 640px; margin-top: 24px; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin: 22px 0; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 20px; }
.stat p { margin: 0; color: var(--muted); font-weight: 600; }
.stat strong { display: block; font-size: 2.2rem; margin: 4px 0 6px; }
.stat div { font-size: .9rem; }
.simple-list { list-style: none; margin: 0; padding: 0; }
.simple-list li { display: flex; justify-content: space-between; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.simple-list li:last-child { border-bottom: 0; }
.simple-list span { color: var(--muted); font-size: .85rem; white-space: nowrap; }

.toolbar { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.toolbar select, .toolbar input { padding: 9px 12px; border: 1px solid var(--line); border-radius: 8px; font: inherit; background: #fff; }

.table-wrap { overflow-x: auto; background: #fff; border: 1px solid var(--line); border-radius: 14px; }
.a-table { width: 100%; border-collapse: collapse; font-size: .93rem; }
.a-table th { text-align: left; font-size: .82rem; color: var(--muted); font-weight: 700; padding: 12px 14px; border-bottom: 1px solid var(--line); background: #fafbfa; white-space: nowrap; }
.a-table td { padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.a-table tr:last-child td { border-bottom: 0; }
.a-table td.empty { text-align: center; color: var(--muted); padding: 40px; }
.t-thumb img, .no-img { width: 56px; height: 44px; object-fit: cover; border-radius: 6px; display: block; background: #e7ece9; }
.t-title { font-weight: 700; color: var(--ink); }
.t-act { white-space: nowrap; text-align: right; }
.t-act form { display: inline; }
.tag { display: inline-block; font-size: .75rem; padding: 2px 8px; border-radius: 999px; background: #eceff0; color: var(--muted); font-weight: 700; }
.tag.on { background: var(--soft); color: var(--g); }
.tag.star { background: #fff4d6; color: #a06d00; }
.swatch { display: inline-block; width: 28px; height: 28px; border-radius: 8px; vertical-align: middle; }

.a-form { max-width: 880px; }
.a-form > .panel { max-width: none; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 20px; }
.field { margin-bottom: 18px; }
.field > label { display: block; font-weight: 700; margin-bottom: 6px; font-size: .93rem; }
.field input:not([type=checkbox]):not([type=radio]):not([type=file]):not([type=color]), .field select, .field textarea {
  width: 100%; padding: 11px 13px; border: 1px solid #d3dbd6; border-radius: 9px; font: inherit; background: #fff; color: var(--ink);
}
.field input:focus, .field select:focus, .field textarea:focus { outline: 2px solid color-mix(in srgb, var(--g2) 40%, transparent); border-color: var(--g2); }
.field textarea { resize: vertical; line-height: 1.6; }
.field input[type=color] { width: 70px; height: 44px; border: 1px solid #d3dbd6; border-radius: 9px; padding: 3px; background: #fff; }
.help { color: var(--muted); font-size: .83rem; margin: 6px 0 0; }
.help code { background: #eef2ef; padding: 1px 6px; border-radius: 4px; font-size: .82rem; color: var(--ink); }
.check { display: inline-flex; align-items: center; gap: 6px; font-weight: 500; margin-right: 18px; cursor: pointer; font-size: .92rem; }
.checks { display: flex; flex-wrap: wrap; gap: 8px; }
.thumb-row { display: flex; align-items: center; gap: 14px; margin-bottom: 10px; }
.thumb-row img { width: 140px; height: 105px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); }
.dropzone {
  display: flex; align-items: center; gap: 18px; padding: 18px; border: 2px dashed #c5d0ca; border-radius: 12px;
  background: #fafcfb; cursor: pointer; transition: border-color .15s, background .15s; min-height: 110px; outline: none;
}
.dropzone:hover, .dropzone:focus { border-color: var(--g2); background: var(--soft); }
.dropzone.drag { border-color: var(--g2); background: #dcefe3; }
.dropzone.changed { border-style: solid; border-color: var(--g2); }
.dz-preview { width: 140px; height: 105px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); background: #fff; flex-shrink: 0; }
.dz-text { display: flex; flex-direction: column; gap: 4px; }
.dz-text strong { color: var(--g); }
.dz-text span { color: var(--muted); font-size: .9rem; }
.dz-text em { font-style: normal; font-size: .85rem; color: var(--g2); font-weight: 600; }
.dz-text em:empty { display: none; }
kbd { background: #fff; border: 1px solid #cfd8d3; border-bottom-width: 2px; border-radius: 4px; padding: 0 5px; font-size: .8rem; font-family: inherit; }
.dz-remove { margin-top: 8px; }
/* 글쓰기(워드프레스식) 화면 */
.post-edit { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 24px; align-items: start; }
.post-title {
  width: 100%; font: inherit; font-size: 1.6rem; font-weight: 800; padding: 14px 16px; border: 1px solid #d3dbd6;
  border-radius: 10px; background: #fff; margin-bottom: 14px; letter-spacing: -.02em;
}
.post-title:focus { outline: 2px solid color-mix(in srgb, var(--g2) 40%, transparent); border-color: var(--g2); }
.editor-wrap { background: #fff; border-radius: 10px; }
.editor-wrap .ql-toolbar.ql-snow {
  position: sticky; top: 0; z-index: 5; background: #fafbfa; border: 1px solid #d3dbd6; border-radius: 10px 10px 0 0;
  font-family: inherit; padding: 10px;
}
.editor-wrap .ql-container.ql-snow { border: 1px solid #d3dbd6; border-top: 0; border-radius: 0 0 10px 10px; font-family: inherit; font-size: 1.05rem; }
.editor-wrap .ql-editor { min-height: 460px; line-height: 1.8; padding: 22px 26px; }
.editor-wrap .ql-editor img { max-width: 100%; height: auto; border-radius: 8px; margin: 8px 0; }
.editor-wrap .ql-editor h2 { font-size: 1.5rem; margin: 1em 0 .4em; }
.editor-wrap .ql-editor h3 { font-size: 1.25rem; margin: 1em 0 .4em; }
.editor-wrap .ql-editor.ql-blank::before { font-style: normal; color: #9aa59f; left: 26px; right: 26px; }
.editor-wrap .ql-snow .ql-picker.ql-header .ql-picker-label::before,
.editor-wrap .ql-snow .ql-picker.ql-header .ql-picker-item::before { content: '본문'; }
.editor-wrap .ql-snow .ql-picker.ql-header .ql-picker-label[data-value="2"]::before,
.editor-wrap .ql-snow .ql-picker.ql-header .ql-picker-item[data-value="2"]::before { content: '큰 제목'; }
.editor-wrap .ql-snow .ql-picker.ql-header .ql-picker-label[data-value="3"]::before,
.editor-wrap .ql-snow .ql-picker.ql-header .ql-picker-item[data-value="3"]::before { content: '소제목'; }
.editor-wrap .ql-snow .ql-tooltip::before { content: '링크:'; }
.editor-wrap .ql-snow .ql-tooltip a.ql-action::after { content: '수정'; }
.editor-wrap .ql-snow .ql-tooltip a.ql-remove::before { content: '삭제'; }
.editor-wrap .ql-snow .ql-tooltip.ql-editing a.ql-action::after { content: '저장'; }
.editor-status { min-height: 1.4em; margin: 8px 0 0; font-weight: 600; color: var(--g2); font-size: .9rem; }
.editor-status.err { color: var(--red); }
.gallery-panel { margin-top: 20px; }
.gallery-panel summary { cursor: pointer; font-weight: 700; margin-bottom: 4px; }
.gallery-panel[open] summary { margin-bottom: 14px; }
.post-side { position: sticky; top: 16px; }
.post-side .panel { padding: 18px; margin-bottom: 16px; }
.post-side h2 { font-size: 1rem; margin-bottom: 12px; }
.post-side .field { margin-bottom: 12px; }
.cover-pick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.cover-pick label { position: relative; cursor: pointer; }
.cover-pick input { position: absolute; opacity: 0; }
.cover-pick img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 6px; border: 3px solid transparent; }
.cover-pick input:checked + img { border-color: var(--g2); }
.cover-pick input:focus-visible + img { outline: 2px solid var(--g); }
@media (max-width: 1000px) {
  .post-edit { grid-template-columns: 1fr; }
  .post-side { position: static; }
  .editor-wrap .ql-editor { min-height: 320px; padding: 16px; }
}
.form-actions { display: flex; gap: 10px; margin-top: 8px; }
.danger-zone { margin-top: 36px; padding-top: 20px; border-top: 1px dashed #d8dfdb; max-width: 880px; }
.danger-text { color: var(--red); }
input.mini { width: 64px !important; padding: 6px 8px !important; border: 1px solid #d3dbd6; border-radius: 6px; font: inherit; }

.img-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.img-item { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 8px; display: flex; flex-direction: column; gap: 6px; }
.img-item img { width: 100%; aspect-ratio: 4/3; object-fit: cover; border-radius: 6px; }
.img-item .check { margin: 0; font-size: .85rem; }

.cat-list { display: flex; flex-direction: column; gap: 8px; margin: 14px 0; }
.cat-row { display: flex; gap: 6px; align-items: center; }
.cat-form { display: flex; gap: 6px; align-items: center; flex: 1; min-width: 0; }
.cat-form input[name=name] { flex: 1; min-width: 0; padding: 7px 10px; border: 1px solid #d3dbd6; border-radius: 6px; font: inherit; }
.cat-add { display: flex; gap: 6px; padding-top: 14px; border-top: 1px solid var(--line); }
.cat-add input { flex: 1; padding: 8px 10px; border: 1px solid #d3dbd6; border-radius: 6px; font: inherit; }
.inline-form { display: flex; gap: 6px; }
.inline-form input { padding: 6px 10px; border: 1px solid #d3dbd6; border-radius: 6px; font: inherit; width: 150px; }

.login-box { max-width: 380px; margin: 10vh auto 0; background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 32px; }
.login-box h1 { display: flex; align-items: center; gap: 10px; font-size: 1.25rem; margin-bottom: 22px; }
.back-link { text-align: center; margin: 18px 0 0; font-size: .9rem; }

@media (max-width: 900px) {
  body.admin { flex-direction: column; }
  .a-side { width: auto; height: auto; position: static; padding: 12px; }
  .a-logo { margin: 0 4px 10px; }
  .a-side nav { flex-direction: row; flex-wrap: wrap; gap: 4px; }
  .a-side nav a { padding: 7px 10px; font-size: .88rem; }
  .a-user { flex-direction: row; flex-wrap: wrap; gap: 14px; margin-top: 10px; padding-top: 10px; }
  .a-main { padding: 20px 16px 50px; }
  .two-col, .grid-2, .stat-grid { grid-template-columns: 1fr; }
  .cat-row { flex-wrap: wrap; }
}
