:root {
  --ink: #000000;
  --sub: #555555;
  --line: #e3e3e3;
  --soft: #f3f3f3;
  --panel: #fafafa;
  --wait: #1a56c4; --wait-bg: #eaf1fd;
  --done: #333333; --done-bg: #efefef;
  --fail: #a3360a; --fail-bg: #fdeee6;
  --posting: #5b3fa8; --posting-bg: #f0ecfb;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: 'Noto Sans KR', system-ui, sans-serif; font-size: 15px; color: var(--ink); background: #fff; -webkit-font-smoothing: antialiased; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--wait); }
:focus-visible { outline: 2px solid #000; outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
svg { flex-shrink: 0; }

/* ── 로그인 ── */
.auth { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; background: var(--panel); }
.auth-card { width: 100%; max-width: 380px; background: #fff; border: 1px solid var(--line); border-radius: 20px; padding: 32px; display: flex; flex-direction: column; gap: 16px; }
.auth-card h1 { margin: 0; font-size: 22px; }
.auth-card p { margin: 0; color: var(--sub); line-height: 1.6; font-size: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 13px; font-weight: 700; }
.field small { color: var(--sub); font-size: 12px; line-height: 1.5; }
.input { border: 1px solid #c9c9c9; border-radius: 10px; padding: 10px 12px; min-height: 44px; background: #fff; width: 100%; }
.btn { border: none; border-radius: 10px; padding: 10px 18px; min-height: 44px; font-weight: 700; background: #000; color: #fff; }
.btn:disabled { background: #e6e6e6; color: #6b6b6b; cursor: default; }
.btn.ghost { background: #fff; color: #000; border: 1px solid #c9c9c9; font-weight: 500; }
.btn.sm { min-height: 34px; padding: 6px 12px; font-size: 13px; border-radius: 8px; }
.err { color: var(--fail); font-size: 13px; min-height: 18px; }

/* ── 레이아웃 ── */
.shell { display: flex; min-height: 100vh; }
.side { width: 264px; flex-shrink: 0; border-right: 1px solid var(--line); display: flex; flex-direction: column; gap: 20px; padding: 24px 16px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px; font-weight: 700; font-size: 16px; }
.logo { width: 32px; height: 32px; border-radius: 9px; background: #000; color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; }
.side-head { display: flex; justify-content: space-between; align-items: baseline; padding: 0 8px; font-size: 13px; color: var(--sub); }
.side-head b { color: var(--sub); }
.acc-list { display: flex; flex-direction: column; gap: 4px; }
.acc { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 12px; border: none; border-radius: 12px; background: transparent; text-align: left; min-height: 44px; }
.acc:hover { background: var(--soft); }
.acc.on { background: #ececec; }
.acc .meta { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.acc .name { font-weight: 700; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acc .stat { font-size: 12px; color: var(--sub); }
.av { border-radius: 50%; color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; flex-shrink: 0; object-fit: cover; }
.connect { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px dashed #bdbdbd; border-radius: 12px; background: #fff; font-size: 14px; color: #333; min-height: 44px; }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; }
.run { border: 1px solid var(--line); border-radius: 14px; padding: 14px; display: flex; flex-direction: column; gap: 8px; }
.run-top { display: flex; justify-content: space-between; align-items: center; font-weight: 700; font-size: 14px; }
.run p { margin: 0; font-size: 12px; color: var(--sub); line-height: 1.5; }
.switch { width: 46px; height: 28px; border-radius: 999px; border: none; padding: 3px; display: flex; background: #c9c9c9; justify-content: flex-start; }
.switch[aria-checked="true"] { background: #000; justify-content: flex-end; }
.switch span { width: 22px; height: 22px; border-radius: 50%; background: #fff; display: block; }
.linkbtn { border: none; background: transparent; display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; color: #333; font-size: 14px; min-height: 44px; }
.linkbtn:hover { background: var(--soft); }

.main { flex-grow: 1; min-width: 0; display: flex; justify-content: center; border-right: 1px solid var(--line); }
.feed-wrap { width: 100%; max-width: 640px; display: flex; flex-direction: column; }
.feed-head { padding: 24px 24px 0; display: flex; flex-direction: column; gap: 16px; position: sticky; top: 0; background: #fff; z-index: 2; }
.who { display: flex; align-items: center; gap: 12px; }
.who h2 { margin: 0; font-size: 20px; }
.who p { margin: 2px 0 0; font-size: 13px; color: var(--sub); }
.tabs { display: flex; border-bottom: 1px solid var(--line); }
.tab { flex-grow: 1; padding: 12px 0; border: none; background: transparent; color: var(--sub); border-bottom: 2px solid transparent; min-height: 44px; }
.tab.on { font-weight: 700; color: #000; border-bottom-color: #000; }
.empty { padding: 64px 24px; text-align: center; color: var(--sub); line-height: 1.7; }

.post { padding: 18px 24px; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; }
.row { display: flex; gap: 12px; }
.rail { display: flex; flex-direction: column; align-items: center; width: 36px; flex-shrink: 0; }
.rail .line { width: 2px; flex-grow: 1; background: #d9d9d9; margin-top: 6px; border-radius: 1px; }
.pbody { flex-grow: 1; min-width: 0; display: flex; flex-direction: column; gap: 8px; padding-bottom: 10px; }
.ptop { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ptop .u { font-weight: 700; }
.ptop .t { font-size: 13px; color: var(--sub); }
.badge { font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 999px; }
.b-wait { color: var(--wait); background: var(--wait-bg); }
.b-done { color: var(--done); background: var(--done-bg); }
.b-fail, .b-reply_fail { color: var(--fail); background: var(--fail-bg); }
.b-posting { color: var(--posting); background: var(--posting-bg); }
.actions { margin-left: auto; display: flex; gap: 6px; align-items: center; }
.icon-btn { border: none; background: transparent; color: var(--sub); padding: 6px; min-width: 34px; min-height: 34px; border-radius: 8px; display: flex; align-items: center; justify-content: center; }
.icon-btn:hover { background: var(--soft); color: #000; }
.text { line-height: 1.6; white-space: pre-wrap; word-break: break-word; }
.imgs { display: flex; gap: 8px; overflow: hidden; }
.imgs .im { width: 132px; height: 132px; border-radius: 12px; background: #eee; object-fit: cover; flex-shrink: 0; }
.imgs video.im { background: #111; }
.imgs .more { width: 132px; height: 132px; border-radius: 12px; background: #e6e6e6; display: flex; align-items: center; justify-content: center; font-weight: 700; color: var(--sub); flex-shrink: 0; }
.reply-row { display: flex; gap: 12px; }
.reply-row .rail { justify-content: flex-start; }
.reply-row .lbl { font-size: 13px; color: var(--sub); }
.reply-row .text { font-size: 14px; word-break: break-all; }
.errbox { font-size: 13px; color: var(--fail); background: var(--fail-bg); border-radius: 10px; padding: 8px 12px; line-height: 1.5; }

/* ── 오른쪽: 글쓰기 + 일정 ── */
.aside { width: 440px; flex-shrink: 0; display: flex; flex-direction: column; gap: 20px; padding: 24px; background: var(--panel); position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.card { background: #fff; border: 1px solid var(--line); border-radius: 18px; }
.c-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 18px; border-bottom: 1px solid var(--line); }
.c-head b { font-size: 16px; }
.c-head .plain { border: none; background: transparent; padding: 6px 0; min-height: 34px; min-width: 40px; text-align: left; }
.c-body { padding: 18px; display: flex; flex-direction: column; }
.ta { border: none; resize: none; padding: 0; background: transparent; line-height: 1.6; width: 100%; min-height: 72px; }
.ta:focus-visible { outline: none; }
.count { font-size: 12px; color: var(--sub); text-align: right; }
.count.over { color: var(--fail); font-weight: 700; }
.thumbs { display: flex; gap: 8px; flex-wrap: wrap; }
.thumb { position: relative; width: 76px; height: 76px; border-radius: 10px; overflow: hidden; background: #eee; }
.thumb img, .thumb video { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb .vlabel { position: absolute; left: 4px; top: 4px; font-size: 11px; background: rgba(0,0,0,.75); color: #fff; border-radius: 6px; padding: 1px 5px; }
.thumb .rm { position: absolute; top: 4px; right: 4px; width: 24px; height: 24px; border-radius: 50%; border: none; background: rgba(0,0,0,.75); color: #fff; font-size: 14px; line-height: 1; padding: 0; }
.thumb .n { position: absolute; left: 4px; bottom: 4px; font-size: 11px; background: rgba(0,0,0,.75); color: #fff; border-radius: 6px; padding: 1px 5px; }
.tools { display: flex; gap: 6px; align-items: center; color: var(--sub); font-size: 13px; }
.drop { outline: 2px dashed #000; outline-offset: -6px; border-radius: 18px; }
.addline { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.addline label { font-size: 13px; color: var(--sub); }
.mini { border: 1px solid #c9c9c9; background: #fff; border-radius: 8px; padding: 4px 10px; font-size: 12px; min-height: 30px; }
.c-repeat { display: flex; align-items: center; gap: 8px; padding: 12px 18px 0; border-top: 1px solid var(--line); flex-wrap: wrap; }
.c-repeat .lbl { font-size: 14px; font-weight: 700; margin-right: 2px; }
.c-repeat .rp { display: inline-flex; align-items: center; gap: 5px; border: 1px solid #c9c9c9; background: #fff; border-radius: 999px; padding: 6px 12px; font-size: 13px; min-height: 34px; }
.c-repeat .rp.on { background: #000; color: #fff; border-color: #000; font-weight: 700; }
.c-repeat .hint { font-size: 12px; color: var(--sub); width: 100%; min-height: 0; }
.c-repeat .hint:empty { display: none; }
.b-repeat { color: #0f6b4f; background: #e6f4ee; display: inline-flex; align-items: center; gap: 4px; }
.c-foot { display: flex; align-items: center; gap: 10px; padding: 12px 18px; flex-wrap: wrap; }
.c-foot label { font-size: 14px; font-weight: 700; }
.c-foot input { border: 1px solid #c9c9c9; border-radius: 8px; padding: 6px 8px; min-height: 38px; }
.c-foot .hint { font-size: 12px; color: var(--sub); flex-grow: 1; }
.sched { padding: 18px; display: flex; flex-direction: column; gap: 14px; }
.sched-top { display: flex; justify-content: space-between; align-items: center; }
.sched-top b { font-size: 15px; }
.sched-top span { font-size: 12px; color: var(--sub); }
.opts { display: flex; gap: 8px; }
.opt { flex-grow: 1; padding: 10px; border-radius: 10px; border: 1px solid #c9c9c9; background: #fff; font-size: 13px; min-height: 40px; }
.opt.on { background: #000; color: #fff; border-color: #000; font-weight: 700; }
.start { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.start select { border: 1px solid #c9c9c9; border-radius: 8px; padding: 6px 8px; min-height: 36px; background: #fff; }
.slots { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.slot { text-align: center; padding: 8px 0; border-radius: 8px; font-size: 13px; background: var(--soft); color: var(--sub); }
.slot.s-wait, .slot.s-posting { background: #000; color: #fff; font-weight: 700; }
.slot.s-done { background: #d9d9d9; color: #222; font-weight: 700; }
.slot.s-fail, .slot.s-reply_fail { background: var(--fail-bg); color: var(--fail); font-weight: 700; }
.sched p { margin: 0; font-size: 12px; color: var(--sub); line-height: 1.5; }

/* ── 모달 ── */
.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,.35); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 50; }
.modal { background: #fff; border-radius: 20px; width: 100%; max-width: 520px; max-height: 90vh; overflow-y: auto; }
.modal .c-body { gap: 16px; }
.copy { display: flex; gap: 6px; }
.check { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; }
.check input { width: 20px; height: 20px; margin-top: 2px; accent-color: #000; flex-shrink: 0; }
.check span { display: flex; flex-direction: column; gap: 2px; font-size: 14px; }
.check small { color: var(--sub); font-size: 12px; line-height: 1.5; }
.copy code { flex-grow: 1; background: var(--soft); border-radius: 8px; padding: 10px; font-size: 12px; word-break: break-all; }

#toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: #000; color: #fff; padding: 12px 18px; border-radius: 12px; font-size: 14px; opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 100; max-width: calc(100% - 32px); }
#toast.show { opacity: 1; }

/* ── 휴대폰 ── */
.mtop, .mnav, .fab, .aside-close { display: none; }
@media (max-width: 1000px) {
  .shell { flex-direction: column; }
  .side, .aside { display: none; }
  .main { border-right: none; padding-bottom: 88px; }
  .mtop { display: flex; flex-direction: column; gap: 10px; padding: 16px 16px 8px; position: sticky; top: 0; background: #fff; z-index: 3; }
  .mtop-row { display: flex; justify-content: space-between; align-items: center; }
  .mtop-row b { font-size: 20px; }
  .chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
  .chip { display: flex; align-items: center; gap: 8px; padding: 5px 12px 5px 5px; border-radius: 999px; border: 1px solid #c9c9c9; background: #fff; font-size: 13px; min-height: 40px; flex-shrink: 0; white-space: nowrap; }
  .chip.on { background: #000; color: #fff; border-color: #000; font-weight: 700; }
  .chip.add { padding: 5px 12px; border-style: dashed; }
  .pill { display: flex; align-items: center; gap: 6px; font-size: 12px; background: var(--soft); padding: 6px 10px; border-radius: 999px; border: none; min-height: 32px; }
  .pill .dot { width: 8px; height: 8px; border-radius: 50%; background: #9a9a9a; }
  .pill.on .dot { background: var(--wait); }
  .feed-head { position: static; padding: 8px 16px 0; }
  .feed-head .who { display: none; }
  .post { padding: 16px; }
  .imgs .im, .imgs .more { width: 96px; height: 96px; }
  .aside.open ~ .fab { display: none; }
  .fab { display: flex; position: fixed; right: 18px; bottom: 92px; width: 56px; height: 56px; border-radius: 18px; background: #000; color: #fff; border: none; align-items: center; justify-content: center; z-index: 5; }
  .mnav { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); position: fixed; left: 0; right: 0; bottom: 0; height: calc(72px + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom); background: #fff; border-top: 1px solid var(--line); z-index: 5; }
  .mnav button { border: none; background: transparent; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; font-size: 11px; color: var(--sub); }
  .mnav button.on { color: #000; font-weight: 700; }
  .aside.open { display: flex; position: fixed; top: 0; left: 0; right: 0; bottom: calc(72px + env(safe-area-inset-bottom)); width: auto; height: auto; z-index: 40; padding: 12px 12px 32px; gap: 16px; }
  .aside-close { display: flex; justify-content: space-between; align-items: center; padding: 4px 4px 0; }
  .aside-close b { font-size: 18px; }
  .modal-bg { align-items: flex-end; padding: 0; }
  .modal { border-radius: 20px 20px 0 0; max-height: 92vh; }
}
@media (min-width: 1001px) { .aside-close { display: none; } }

/* ── 순서 바꾸기 ── */
.thumb { cursor: grab; }
.thumb .mv { position: absolute; bottom: 4px; right: 4px; display: flex; gap: 2px; }
.thumb .mv button { width: 22px; height: 22px; border-radius: 6px; border: none; background: rgba(0,0,0,.75); color: #fff; font-size: 15px; line-height: 1; padding: 0; }
.thumb .mv button:disabled { opacity: .3; }
/* ── 내 정보, 사용자 관리 ── */
.me { display: flex; flex-direction: column; padding: 0 12px; }
.me-name { font-weight: 700; font-size: 14px; }
.me-id { font-size: 12px; color: var(--sub); }
.sec { font-weight: 700; font-size: 15px; display: flex; gap: 8px; align-items: baseline; }
.sec span { font-weight: 400; font-size: 12px; color: var(--sub); }
.hr { border: none; border-top: 1px solid var(--line); width: 100%; margin: 4px 0; }
.sub { color: var(--sub); font-size: 12px; }
.urow { display: flex; gap: 10px; align-items: center; justify-content: space-between; flex-wrap: wrap; padding: 10px 0; border-bottom: 1px solid var(--line); }
.uinfo { min-width: 0; flex: 1 1 220px; line-height: 1.6; }
.uacts { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.ugrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 600px) { .ugrid { grid-template-columns: minmax(0, 1fr); } }

/* 관리자: 지인 계정 묶음 */
.owner-head{font-size:12px;font-weight:700;color:var(--sub);padding:14px 10px 4px;display:flex;gap:6px;align-items:baseline;flex-wrap:wrap}
.owner-head span{font-weight:400}
.owner-head em{font-style:normal;font-weight:600;color:var(--fail);margin-left:auto}
.chip small{font-size:11px;color:var(--sub);margin-left:2px}
.chip.on small{color:inherit;opacity:.75}
.owner-tag{display:inline-block;font-size:12px;font-weight:600;color:var(--sub);background:var(--soft,#f2f2f2);border-radius:999px;padding:2px 8px;margin-left:8px;vertical-align:middle}
.notebox { font-size: 13px; color: var(--wait); background: var(--wait-bg); border-radius: 10px; padding: 8px 12px; line-height: 1.5; margin-top: 8px; }

/* 사진·영상 저장 */
.mwrap { position: relative; flex-shrink: 0; }
.mwrap .dl { position: absolute; top: 6px; left: 6px; width: 30px; height: 30px; border-radius: 999px; display: flex; align-items: center; justify-content: center; background: rgba(0,0,0,.55); color: #fff; text-decoration: none; }
.mwrap .dl:hover, .mwrap .dl:focus-visible { background: rgba(0,0,0,.8); }
.imgs .im.gone { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; font-size: 13px; font-weight: 700; color: var(--sub); text-align: center; background: var(--soft); }
.imgs .im.gone small { font-size: 11px; font-weight: 400; line-height: 1.4; }

/* 주제(토픽) */
.uline { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.topic-in { display: inline-flex; align-items: center; gap: 4px; color: var(--sub); font-size: 14px; }
.topic-in input { border: 0; background: transparent; font: inherit; color: var(--ink); padding: 2px 0; min-width: 0; width: 160px; outline: none; border-bottom: 1px dashed var(--line); }
.topic-in input:focus { border-bottom-color: var(--ink); }
.topic-in input::placeholder { color: #9a9a9a; }
.topic-in.reply { display: flex; margin: 4px 0 2px; }
.topic-in.reply input { width: 100%; font-size: 13px; }
.tp { font-size: 13px; font-weight: 600; color: var(--sub); }

/* 글 바꾸기 */
.ai-btn { margin-left: 4px; white-space: nowrap; flex-shrink: 0; }
.ai-card { border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; margin-top: 10px; }
.ai-card .text { white-space: pre-wrap; line-height: 1.6; font-size: 15px; margin: 6px 0 10px; }
.ai-head { display: flex; justify-content: space-between; align-items: baseline; }
.ai-acts { display: flex; gap: 8px; justify-content: flex-end; }

/* 다른 계정 연결 안내 */
.linkbtn.sm { font-size: 12px; color: var(--sub); padding: 6px 4px; justify-content: center; width: 100%; }
.steps { margin: 0; padding-left: 20px; line-height: 1.7; font-size: 14px; }
.steps li { margin-bottom: 6px; }
.ai-card.recipe { background: var(--panel); border-style: dashed; }
.warn { color: var(--fail); }

/* 이어지는 댓글 */
.more-reply { margin-top: 10px; padding-top: 8px; border-top: 1px dashed var(--line); }
.add-reply { margin-top: 8px; }
