/* 형제섬농원 관리자 — the site's palette, set as a quiet work tool */
:root {
  --ink: #1c2630; --ink-2: #2b3846; --muted: #5b6875;
  --ember: #e2603a; --ember-d: #c9502d; --apricot: #f2a86b;
  --mist: #e4ecea; --paper: #f6f8f7; --card: #fff; --pine: #3f5e46;
  --line: rgba(28, 38, 48, .14); --danger: #b3261e;
  --display: 'Hahmlet', 'Noto Serif KR', serif;
  --body: 'IBM Plex Sans KR', 'Apple SD Gothic Neo', sans-serif;
  --mono: 'IBM Plex Mono', 'IBM Plex Sans KR', sans-serif;
  --top: 60px; --side: 220px;
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 400 15px/1.6 var(--body); word-break: keep-all; -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; }
img { display: block; max-width: 100%; }
:focus-visible { outline: 2px solid var(--ember); outline-offset: 2px; }
[hidden] { display: none !important; }

.brand { margin: 0; display: flex; flex-direction: column; line-height: 1.05; }
.brand b { font: 600 20px var(--display); letter-spacing: -.02em; }
.brand small { font: 500 10px var(--mono); letter-spacing: .2em; color: var(--ember); margin-top: 4px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; padding: 0 18px; border-radius: 8px; border: 1px solid var(--line); background: var(--card); cursor: pointer; font-weight: 500; text-decoration: none; white-space: nowrap; }
.btn:hover { border-color: var(--ink); }
.btn-fill { background: var(--ember); border-color: var(--ember); color: #fff; }
.btn-fill:hover { background: var(--ember-d); border-color: var(--ember-d); }
.btn-danger { color: var(--danger); }
.btn-danger:hover { border-color: var(--danger); }
.btn-sm { min-height: 34px; padding: 0 12px; font-size: 14px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ---------- login ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background: linear-gradient(170deg, var(--paper) 0%, #fcefe4 100%); }
.login-card { width: min(420px, 100%); background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 36px 28px; }
.login-card h1 { font: 500 26px/1.3 var(--display); margin: 28px 0 8px; }
.login-card p { color: var(--muted); margin: 0 0 24px; }
.login-card .btn { width: 100%; }
.msg { min-height: 1.6em; margin: 14px 0 0 !important; color: var(--danger) !important; font-size: 14px; }

/* ---------- shell ---------- */
.top { position: fixed; inset: 0 0 auto; height: var(--top); z-index: 20; display: flex; align-items: center; gap: 16px; padding: 0 20px; background: var(--ink); color: #fff; }
.top .brand small { color: var(--apricot); }
.top-link { margin-left: auto; background: none; border: 0; color: rgba(255,255,255,.85); font-size: 14px; text-decoration: none; cursor: pointer; padding: 8px; }
.top-link + .top-link { margin-left: 0; }
.top-link:hover { color: #fff; }
.nav-toggle { display: none; background: none; border: 0; width: 40px; height: 40px; cursor: pointer; padding: 0; }
.nav-toggle span { display: block; width: 20px; height: 1.5px; background: #fff; margin: 5px auto; }

.side { position: fixed; top: var(--top); bottom: 0; left: 0; width: var(--side); overflow-y: auto; padding: 16px 10px; border-right: 1px solid var(--line); background: var(--card); z-index: 15; }
.side a { display: flex; justify-content: space-between; align-items: center; padding: 10px 12px; border-radius: 8px; text-decoration: none; font-weight: 500; color: var(--ink-2); }
.side a:hover { background: var(--mist); }
.side a[aria-current] { background: var(--ink); color: #fff; }
.side a small { font: 400 12px var(--mono); opacity: .6; }
.side hr { border: 0; border-top: 1px solid var(--line); margin: 12px 4px; }
.main { margin-left: var(--side); padding: calc(var(--top) + 28px) clamp(16px, 4vw, 40px) 80px; max-width: calc(var(--side) + 980px); outline: none; }

@media (max-width: 860px) {
  .nav-toggle { display: block; }
  .side { transform: translateX(-100%); transition: transform .25s; width: min(280px, 85vw); box-shadow: 0 10px 40px rgba(0,0,0,.2); }
  body.nav-open .side { transform: none; }
  .main { margin-left: 0; }
  .top { padding: 0 12px; gap: 8px; }
}

/* ---------- page head ---------- */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 20px; margin-bottom: 24px; }
.page-head h1 { font: 500 clamp(24px, 3vw, 30px)/1.25 var(--display); margin: 0; }
.page-head p { margin: 4px 0 0; color: var(--muted); }
.back { display: inline-block; margin-bottom: 10px; font-size: 14px; color: var(--muted); text-decoration: none; background: none; border: 0; padding: 0; cursor: pointer; }
.back:hover { color: var(--ink); }

/* ---------- list ---------- */
.list { list-style: none; margin: 0; padding: 0; background: var(--card); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.list li { display: grid; grid-template-columns: 64px 1fr auto; gap: 16px; align-items: center; padding: 12px 16px; border-top: 1px solid var(--line); }
.list li:first-child { border-top: 0; }
.list .thumb { width: 64px; height: 48px; border-radius: 6px; object-fit: cover; background: var(--mist); }
.list .t { font-weight: 600; }
.list .s { font-size: 13.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list .acts { display: flex; gap: 6px; }
.list .info { min-width: 0; }
.badge { display: inline-block; margin-left: 8px; padding: 1px 8px; border-radius: 99px; font: 500 11.5px var(--body); vertical-align: 2px; background: var(--mist); color: var(--ink-2); }
.badge.draft { background: #fdeee9; color: var(--ember-d); }
.empty { padding: 48px 16px; text-align: center; color: var(--muted); background: var(--card); border: 1px dashed var(--line); border-radius: 12px; }
@media (max-width: 560px) {
  .list li { grid-template-columns: 52px 1fr; }
  .list .thumb { width: 52px; height: 40px; }
  .list .acts { grid-column: 1 / -1; justify-content: flex-end; }
}

/* ---------- form ---------- */
.form { display: grid; gap: 20px; }
fieldset { margin: 0; padding: 22px 20px 24px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); display: grid; gap: 18px; grid-template-columns: repeat(2, minmax(0, 1fr)); min-width: 0; }
legend { font: 500 17px var(--display); padding: 0 6px; margin-left: -6px; }
.f { display: grid; gap: 6px; min-width: 0; align-content: start; }
.f.wide { grid-column: 1 / -1; }
.f label, .f .lbl { font-weight: 600; font-size: 14px; }
.f .hint { font-size: 13px; color: var(--muted); margin: 0; }
.f input, .f select, .f textarea { width: 100%; border: 1px solid var(--line); border-radius: 8px; background: var(--paper); padding: 10px 12px; }
.f input:focus, .f select:focus, .f textarea:focus { outline: none; border-color: var(--ember); background: #fff; box-shadow: 0 0 0 3px rgba(226,96,58,.15); }
.f textarea { min-height: 96px; resize: vertical; line-height: 1.6; }
.f textarea.tall { min-height: 180px; }
.f input[type=color] { padding: 4px; height: 42px; width: 80px; }
.f .row-c { display: flex; gap: 8px; align-items: center; }
@media (max-width: 640px) { fieldset { grid-template-columns: 1fr; padding: 18px 14px; } }

.rows { display: grid; gap: 8px; }
.rows .r { display: grid; grid-template-columns: var(--cols) 40px; gap: 8px; }
.rows .r button { border: 1px solid var(--line); background: var(--paper); border-radius: 8px; cursor: pointer; }

.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(136px, 1fr)); gap: 10px; }
.ph { position: relative; aspect-ratio: 4 / 3; border-radius: 8px; overflow: hidden; background: var(--mist); }
.ph img { width: 100%; height: 100%; object-fit: cover; }
.ph .tools { position: absolute; inset: auto 0 0; display: flex; justify-content: space-between; padding: 4px; background: linear-gradient(transparent, rgba(0,0,0,.55)); }
.ph .tools button { width: 30px; height: 30px; border: 0; border-radius: 6px; background: rgba(255,255,255,.9); cursor: pointer; font-size: 14px; line-height: 1; }
.ph .tools button:disabled { opacity: .35; }
.ph .tools .mid { display: flex; gap: 4px; }
.head-acts { display: flex; flex-wrap: wrap; gap: 8px; }
.ph .first { position: absolute; top: 6px; left: 6px; padding: 1px 7px; border-radius: 99px; background: var(--ember); color: #fff; font-size: 11.5px; font-weight: 600; }
.ph.busy { display: grid; place-items: center; font-size: 13px; color: var(--muted); text-align: center; padding: 8px; }
.ph.busy.err { color: var(--danger); }
.add-ph { aspect-ratio: 4 / 3; border: 1.5px dashed var(--line); border-radius: 8px; display: grid; place-items: center; cursor: pointer; color: var(--muted); font-weight: 500; text-align: center; background: var(--paper); }
.add-ph:hover, .add-ph.drag { border-color: var(--ember); color: var(--ember); }
.add-ph input { position: absolute; width: 1px; height: 1px; opacity: 0; }

.bar { position: sticky; bottom: 0; z-index: 5; display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; padding: 14px 0; margin-top: 4px; background: linear-gradient(transparent, var(--paper) 30%); }

/* ---------- import ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 22px 20px; }
.card h2 { font: 500 18px var(--display); margin: 0 0 8px; }
.card p { margin: 0 0 12px; color: var(--ink-2); }
.progress { height: 10px; border-radius: 99px; background: var(--mist); overflow: hidden; margin: 18px 0 10px; }
.progress i { display: block; height: 100%; width: 0; background: var(--ember); transition: width .3s; }
.log { margin-top: 12px; max-height: 280px; overflow: auto; font: 400 13px/1.6 var(--mono); background: var(--paper); border-radius: 8px; padding: 10px 12px; white-space: pre-wrap; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none; z-index: 60; padding: 12px 18px; border-radius: 10px; background: var(--ink); color: #fff; font-weight: 500; transition: opacity .25s, transform .25s; max-width: calc(100% - 32px); }
.toast.on { opacity: 1; transform: translate(-50%, 0); }
.toast.err { background: var(--danger); }
.loading-line { color: var(--muted); padding: 24px 0; }
.ph .swap { position: absolute; top: 6px; right: 6px; padding: 3px 9px; border-radius: 99px; background: rgba(255,255,255,.92); font-size: 12.5px; font-weight: 600; cursor: pointer; }
.ph .swap:hover, .ph .swap:focus-within { background: var(--ember); color: #fff; }
.ph .swap input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.check { display: flex; align-items: center; gap: 10px; min-height: 42px; font-weight: 400 !important; cursor: pointer; }
.check input { width: 20px !important; height: 20px; accent-color: var(--ember); }
