/* 질문창 — 밝음·어두움, 휴대폰 너비(≤700px)는 카드 하나씩 */
:root {
  --bg: #f6f7f9; --panel: #ffffff; --ink: #1d232b; --muted: #687384; --line: #dde2e8; --soft: #eef1f5;
  --accent: #2f6fed; --accent-ink: #ffffff; --sel: #e6efff; --sel-line: #2f6fed;
  --now: #d93a3a; --now-soft: #fde9e9; --soon: #e08a1e; --soon-soft: #fdf1e1; --later: #8a94a3; --later-soft: #eef0f3;
  --ok: #1f9d55; --ok-soft: #e3f5ea; --diff: #fff3c4; --rec: #7a4ddb; --rec-soft: #efe8fd;
  --radius: 12px; --shadow: 0 1px 2px rgba(0,0,0,.06), 0 2px 8px rgba(0,0,0,.04);
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12151a; --panel: #1b2027; --ink: #e5e9ef; --muted: #9aa5b4; --line: #2c333d; --soft: #232a33;
    --accent: #6b9bff; --accent-ink: #0d1117; --sel: #1f2c46; --sel-line: #6b9bff;
    --now: #ff6b6b; --now-soft: #3a1f22; --soon: #f0a54a; --soon-soft: #36291a; --later: #8b95a5; --later-soft: #262c34;
    --ok: #4cc785; --ok-soft: #1a3226; --diff: #4a3f12; --rec: #b195ff; --rec-soft: #2b2342;
    --shadow: none;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body { font: 15px/1.55 -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Pretendard", "Noto Sans KR", "Malgun Gothic", sans-serif; }
a { color: var(--accent); }
button { font: inherit; color: inherit; cursor: pointer; border: 1px solid var(--line); background: var(--panel); border-radius: 8px; padding: 6px 12px; }
button:disabled { cursor: not-allowed; opacity: .55; }
button.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
button.ghost { background: transparent; }
button.small { padding: 4px 10px; font-size: 13px; }
button:focus-visible, a:focus-visible, textarea:focus-visible, input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
textarea, input { font: inherit; color: var(--ink); background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; width: 100%; }
textarea { min-height: 80px; resize: vertical; }
code, .ref { font-family: var(--mono); font-size: 13px; }
.meta, small { color: var(--muted); font-size: 13px; }
.loading, .empty { color: var(--muted); padding: 40px 16px; text-align: center; }
#app { max-width: 980px; margin: 0 auto; padding: 0 16px 96px; }

/* 위 */
.top { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 0 8px; flex-wrap: wrap; }
.brand { font-weight: 700; font-size: 17px; }
.brand .home { color: var(--ink); text-decoration: none; }
.pname { color: var(--muted); font-weight: 500; margin-left: 6px; }
.tools { display: flex; align-items: center; gap: 8px; }
.who { color: var(--muted); font-size: 13px; }
.conn { width: 10px; height: 10px; border-radius: 50%; display: inline-block; background: var(--later); }
.conn.on { background: var(--ok); } .conn.connecting { background: var(--soon); } .conn.off { background: var(--now); }

.tabs { display: flex; gap: 8px; align-items: flex-end; border-bottom: 1px solid var(--line); margin-top: 6px; }
.tab { text-decoration: none; color: var(--muted); padding: 10px 16px; border-radius: 10px 10px 0 0; border: 1px solid transparent; border-bottom: none; position: relative; margin-bottom: -1px; }
.tab.big { font-size: 20px; font-weight: 700; }
.tab.big .num { font-size: 22px; margin-left: 4px; color: var(--now); }
.tab.small { font-size: 14px; margin-left: auto; }
.tab.on { color: var(--ink); background: var(--panel); border-color: var(--line); }
.tab .dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--accent); margin-left: 6px; vertical-align: super; }
.tab .ro { font-size: 11px; font-weight: 500; color: var(--muted); margin-left: 6px; border: 1px solid var(--line); border-radius: 6px; padding: 0 5px; }

.progress { padding: 12px 0 4px; }
.ptext { font-size: 14px; color: var(--muted); margin-bottom: 6px; }
.ptext b { color: var(--ink); }
.pbar { height: 8px; background: var(--soft); border-radius: 99px; overflow: hidden; display: flex; }
.pbar span { display: block; height: 100%; width: 0; transition: width .3s; }
.p-applied { background: var(--ok); } .p-answered { background: var(--accent); opacity: .7; }

.bar { display: flex; gap: 12px; align-items: center; padding: 10px 0; flex-wrap: wrap; position: sticky; top: 0; background: var(--bg); z-index: 5; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { border-radius: 99px; font-size: 14px; padding: 5px 12px; }
.chip span { color: var(--muted); margin-left: 2px; }
.chip.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.chip.on span { color: inherit; opacity: .8; }
#search { flex: 1; min-width: 180px; max-width: 360px; margin-left: auto; }
.newband { width: 100%; background: var(--accent); color: var(--accent-ink); border: none; border-radius: 10px; padding: 10px; margin: 4px 0 10px; font-weight: 600; cursor: pointer; text-align: center; }

/* 묶음 */
.group { margin: 10px 0 18px; }
.ghead { display: flex; align-items: center; gap: 10px; justify-content: space-between; border-bottom: 1px solid var(--line); padding-bottom: 6px; }
.gtoggle { border: none; background: none; font-size: 16px; font-weight: 700; padding: 6px 0; text-align: left; }
.gcount { font-weight: 400; color: var(--muted); font-size: 14px; }
.caret { display: inline-block; width: 14px; color: var(--muted); }
.u-now-t { color: var(--now); font-style: normal; font-weight: 600; }
.gbody { display: flex; flex-direction: column; gap: 12px; padding-top: 12px; }

/* 카드 */
.card { background: var(--panel); border: 1px solid var(--line); border-left: 5px solid var(--later); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); scroll-margin: 80px; }
.card.u-now { border-left-color: var(--now); } .card.u-soon { border-left-color: var(--soon); }
.card.focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.card.dim { opacity: .62; }
.card.dim:hover, .card.dim.focus { opacity: 1; }
.card.st-withdrawn { border-left-color: var(--line); opacity: .7; }
.chead { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 10px; }
.chead h3 { margin: 0; font-size: 17px; flex: 1 1 260px; }
.chead .fold { margin-left: auto; }
.urg { font-size: 12px; font-weight: 700; text-transform: uppercase; border-radius: 6px; padding: 1px 7px; color: #fff; background: var(--later); }
.u-now .urg { background: var(--now); } .u-soon .urg { background: var(--soon); }
.qid { font-family: var(--mono); font-size: 13px; color: var(--muted); text-decoration: none; }
.areatag, .tracktag { font-size: 12px; background: var(--soft); border-radius: 6px; padding: 1px 8px; color: var(--muted); }
.blocks { font-size: 12px; color: var(--now); }
.flag { display: block; width: 100%; text-align: left; margin-top: 8px; border: none; border-radius: 8px; padding: 6px 10px; font-size: 14px; font-weight: 600; }
.flag.reply { background: var(--sel); color: var(--accent); }
.flag.changed { background: var(--soon-soft); color: var(--soon); }
.diff { border: 1px dashed var(--line); border-radius: 8px; padding: 8px 10px; margin-top: 6px; font-size: 14px; }
.drow { display: grid; grid-template-columns: 90px 1fr 1fr; gap: 8px; padding: 6px 0; border-top: 1px solid var(--soft); }
.dold { text-decoration: line-through; color: var(--muted); } .dnew { background: var(--diff); border-radius: 4px; padding: 0 4px; }
.deps { background: var(--soft); border-radius: 8px; padding: 6px 10px; font-size: 14px; margin: 8px 0 0; }
.withdrawn { color: var(--muted); font-style: italic; }
.qtext { margin: 10px 0; font-size: 16px; }
.qtext ul, .odetail ul, .ctx ul { margin: 4px 0; padding-left: 20px; }
details { margin: 6px 0; font-size: 14px; }
details summary { cursor: pointer; color: var(--muted); }
details > div, details > ul { padding: 6px 0 0 12px; }
.refs ul { list-style: none; padding-left: 12px; margin: 4px 0; }
.ref { cursor: copy; background: var(--soft); border-radius: 4px; padding: 1px 6px; word-break: break-all; }

.opts { display: flex; flex-direction: column; gap: 8px; margin: 12px 0 8px; }
.opt { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left; min-height: 52px; padding: 10px 14px 10px 44px; position: relative; border-radius: 10px; border-width: 1.5px; width: 100%; }
.opt:hover:not(:disabled) { border-color: var(--accent); }
.opt .n { position: absolute; left: 12px; top: 11px; width: 22px; height: 22px; border-radius: 6px; background: var(--soft); color: var(--muted); font-size: 13px; display: flex; align-items: center; justify-content: center; font-weight: 700; }
.olabel { font-size: 16px; font-weight: 600; }
.odetail { font-size: 13px; color: var(--muted); }
.opt.rec { border-color: var(--rec); }
.opt.sel { background: var(--sel); border-color: var(--sel-line); }
.opt.sel .n { background: var(--accent); color: var(--accent-ink); }
.tag { font-size: 11px; font-weight: 700; border-radius: 5px; padding: 1px 6px; vertical-align: middle; }
.tag.rec { background: var(--rec-soft); color: var(--rec); }
.tag.sel { background: var(--accent); color: var(--accent-ink); }
.recwhy { font-size: 13px; color: var(--rec); }
.mini { border-collapse: collapse; font-size: 12px; margin-top: 6px; }
.mini th, .mini td { border: 1px solid var(--line); padding: 2px 6px; text-align: right; }
.mini th { color: var(--muted); font-weight: 500; text-align: left; }

/* 비교표 */
.cmp-wrap { overflow-x: auto; margin: 12px 0 8px; -webkit-overflow-scrolling: touch; }
.cmp { border-collapse: separate; border-spacing: 0; width: 100%; font-size: 14px; }
.cmp th, .cmp td { border-bottom: 1px solid var(--line); padding: 6px 10px; text-align: right; white-space: nowrap; }
.cmp thead th { vertical-align: top; text-align: left; white-space: normal; min-width: 120px; padding: 6px; }
.cmp tbody th { text-align: left; font-weight: 500; color: var(--muted); position: sticky; left: 0; background: var(--panel); }
.cmp tbody th .col { color: var(--ink); font-weight: 600; margin-left: 4px; }
.cmp .corner { color: var(--muted); font-weight: 500; vertical-align: bottom; min-width: 110px; }
.cmp .opt.col { min-height: 48px; padding: 8px 10px 8px 38px; }
.cmp .opt.col .n { top: 13px; left: 9px; }
.cmp thead th.sel .opt { background: var(--sel); border-color: var(--sel-line); }
.cmp thead th.rec .opt { border-color: var(--rec); }
.cmp tr.diff td { background: var(--diff); font-weight: 600; }
.cmp td.sel { outline: 2px solid var(--sel-line); outline-offset: -2px; }

.current { font-size: 14px; background: var(--soft); border-radius: 8px; padding: 6px 10px; margin: 8px 0 0; }
.applied { font-size: 14px; background: var(--ok-soft); color: var(--ok); border-radius: 8px; padding: 6px 10px; margin: 6px 0 0; }
.acts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; align-items: center; }
.acts .ro { font-size: 12px; color: var(--muted); }
.box { margin-top: 10px; display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.titems { list-style: none; margin: 0; padding: 0; width: 100%; display: flex; flex-direction: column; gap: 6px; }
.titems li { border-radius: 10px; padding: 6px 10px; background: var(--soft); max-width: 92%; }
.titems li.agent { background: var(--sel); align-self: flex-start; }
.titems li.human { align-self: flex-end; }

.card.collapsed { padding: 0; border-left-width: 5px; }
.oneline { width: 100%; text-align: left; border: none; background: none; padding: 10px 14px; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.oneline .arrow { color: var(--muted); }

/* 토스트·확인 */
#toasts { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 50; width: min(560px, calc(100% - 32px)); }
.toast { background: var(--ink); color: var(--bg); border-radius: 10px; padding: 10px 14px; display: flex; gap: 12px; align-items: center; justify-content: space-between; box-shadow: 0 4px 16px rgba(0,0,0,.2); }
.toast.err { background: var(--now); color: #fff; }
.toast button { background: transparent; color: inherit; border-color: currentColor; white-space: nowrap; }
#modal { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: flex; align-items: center; justify-content: center; z-index: 60; padding: 16px; }
#modal[hidden] { display: none; }
.mbox { background: var(--panel); border-radius: 14px; padding: 18px; width: min(560px, 100%); max-height: 85vh; overflow: auto; }
.mbox h2 { font-size: 17px; margin: 0 0 8px; }
.mbtns { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }
.bulklist { padding-left: 20px; font-size: 14px; max-height: 50vh; overflow: auto; }

/* 로그인·프로젝트 목록 */
.login-page { display: flex; min-height: 100vh; align-items: center; justify-content: center; padding: 16px; }
.login-box { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 24px; width: min(360px, 100%); display: flex; flex-direction: column; gap: 12px; }
.login-box h1 { margin: 0 0 6px; font-size: 22px; }
.login-box label { display: flex; flex-direction: column; gap: 4px; font-size: 14px; color: var(--muted); }
.login-box button { padding: 10px; }
.err { color: var(--now); min-height: 1em; margin: 0; font-size: 14px; }
.plist { padding: 40px 0; }
.plist li { margin: 8px 0; font-size: 17px; }

.mobilebar { display: none; }
.mnav, .mbulk { display: none; }

/* 휴대폰 */
@media (max-width: 700px) {
  #app { padding: 0 12px 88px; }
  .tab.big { font-size: 17px; padding: 8px 10px; }
  .tab.big .num { font-size: 19px; }
  .bar { gap: 8px; position: static; }
  .chip { padding: 6px 10px; font-size: 13px; }
  .cmp thead th { min-width: 96px; }
  .cmp .corner { min-width: 90px; }
  #search { max-width: none; min-width: 0; width: 100%; flex: 1 1 100%; margin-left: 0; }
  .mnav { display: flex; justify-content: space-between; align-items: center; font-size: 13px; color: var(--muted); margin: 6px 0; }
  .mbulk { display: block; width: 100%; margin-bottom: 8px; }
  .card { padding: 12px; }
  .opt { min-height: 56px; }
  .cmp .opt.col { min-height: 52px; }
  button.small { min-height: 40px; }
  .drow { grid-template-columns: 1fr; }
  .mobilebar { display: flex; gap: 8px; position: fixed; left: 0; right: 0; bottom: 0; padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); background: var(--panel); border-top: 1px solid var(--line); z-index: 20; }
  .mobilebar:empty { display: none; }
  .mobilebar button { flex: 1; min-height: 48px; font-weight: 600; }
  #toasts { bottom: 84px; }
}
