/* 모아에디터 원격 제어 (휴대폰 화면). 사이트와 같은 어두운 바탕·글자·강조색 */
:root {
  --ground: #0C1017;
  --surface: #131925;
  --surface-2: #1A2232;
  --line: #263044;
  --text: #F2F4F7;
  --muted: #98A2B3;
  --faint: #667085;
  --accent: #3B7BFF;
  --accent-ink: #FFFFFF;
  --ok: #32B87A;
  --warn: #F5A524;
  --bad: #F0526B;
  --rank-ceo: #7c5cff;
  --rank-manager: #2f6bff;
  --rank-worker: #2e9e6b;
  --rank-intern: #d9822b;
  --radius: 14px;
  --font: "Pretendard Variable", Pretendard, "IBM Plex Sans KR", -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Noto Sans KR", system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--ground);
  color: var(--text);
  font: 15px/1.5 var(--font);
  font-feature-settings: "ss06" 1;
  -webkit-text-size-adjust: 100%;
  overscroll-behavior-y: none;
}
button, textarea, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.noscript { padding: 24px; }

#app { display: flex; flex-direction: column; height: 100dvh; overflow: hidden; }
.app {
  display: flex;
  flex-direction: column;
  width: 100%;
  min-width: 0;
  height: 100%;
  max-width: 720px;
  margin: 0 auto;
}

/* ── 머리 ── */
.top {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  border-bottom: 1px solid var(--line);
  background: var(--ground);
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; letter-spacing: -0.01em; }
.brand-mark { width: 22px; height: 22px; border-radius: 6px; background: var(--accent); display: grid; place-items: center; font-size: 12px; color: #fff; }
.spacer { flex: 1; }
.pc-pick {
  display: flex; align-items: center; gap: 8px;
  min-width: 0; max-width: 60vw;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
}
.pc-pick span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dot { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--faint); }
.dot.on { background: var(--ok); }
.dot.wait { background: var(--warn); }
.dot.run { background: var(--accent); }
.dot.bad { background: var(--bad); }
.icon-btn { border: 0; background: transparent; padding: 6px; border-radius: 8px; color: var(--muted); }
.icon-btn:active { background: var(--surface-2); }

/* ── 방 ── */
.rooms {
  display: flex; gap: 8px;
  padding: 10px 16px;
  overflow-x: auto;
  scrollbar-width: none;
  border-bottom: 1px solid var(--line);
}
.rooms::-webkit-scrollbar { display: none; }
.room {
  display: flex; align-items: center; gap: 6px;
  flex: none;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  white-space: nowrap;
}
.room[aria-selected="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.room[aria-selected="true"] .dot { box-shadow: 0 0 0 2px var(--accent-ink); }
.room .badge { min-width: 18px; padding: 0 5px; border-radius: 9px; background: var(--bad); color: #fff; font-size: 11px; line-height: 18px; text-align: center; }

/* ── 띠 ── */
.band { padding: 8px 16px; font-size: 13px; border-bottom: 1px solid var(--line); display: flex; gap: 8px; align-items: center; }
.band.warn { background: color-mix(in srgb, var(--warn) 14%, var(--ground)); color: #FFD8A0; }
.band.bad { background: color-mix(in srgb, var(--bad) 14%, var(--ground)); color: #FFC2CC; }
.band.info { background: var(--surface); color: var(--muted); }
.band.now { background: var(--surface); color: var(--text); }
.band .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip { font-size: 11px; padding: 1px 7px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); white-space: nowrap; }

/* ── 메시지 ── */
.list { flex: 1; overflow-y: auto; padding: 12px 16px 20px; display: flex; flex-direction: column; gap: 12px; -webkit-overflow-scrolling: touch; }
.older { align-self: center; font-size: 12px; color: var(--faint); }
.empty { margin: auto; text-align: center; color: var(--muted); padding: 24px; max-width: 34ch; }
.empty h2 { color: var(--text); font-size: 18px; margin: 0 0 8px; }
.line { align-self: center; max-width: 92%; font-size: 12.5px; color: var(--muted); text-align: center; }
.line b { color: var(--text); font-weight: 600; }

.msg { display: flex; gap: 8px; align-items: flex-start; max-width: 100%; }
.msg.me { justify-content: flex-end; }
.face {
  width: 32px; height: 32px; border-radius: 50%; flex: none;
  display: grid; place-items: center;
  font-size: 11px; font-weight: 700; color: #fff;
  background: var(--surface-2);
}
.face.rk-ceo { background: var(--rank-ceo); }
.face.rk-manager { background: var(--rank-manager); }
.face.rk-worker { background: var(--rank-worker); }
.face.rk-intern { background: var(--rank-intern); }
.body { min-width: 0; max-width: calc(100% - 40px); display: flex; flex-direction: column; gap: 4px; }
.msg.me .body { align-items: flex-end; max-width: 86%; }
.meta { font-size: 12px; color: var(--faint); display: flex; gap: 6px; align-items: baseline; flex-wrap: wrap; }
.meta b { color: var(--muted); font-weight: 600; }
.kind { font-size: 11px; padding: 0 6px; border-radius: 6px; background: var(--surface-2); color: var(--muted); }
.bubble {
  padding: 9px 12px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--line);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.msg.me .bubble { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); border-bottom-right-radius: 4px; }
.msg.ai .bubble { border-top-left-radius: 4px; }
.note { font-size: 12px; color: var(--faint); }

.card { border: 1px solid var(--line); background: var(--surface); border-radius: var(--radius); padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.card.ask { border-color: color-mix(in srgb, var(--warn) 55%, var(--line)); }
.card h3 { margin: 0; font-size: 14px; }
.card p { margin: 0; }
.steps { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 4px; }
.steps li { overflow-wrap: anywhere; }
.steps .who { color: var(--faint); font-size: 12px; margin-left: 4px; }
/* 허락할 명령은 줄이지 않고 전부 보여 준다. 길면 칸 안에서 밀어 본다 */
.cmds { display: grid; gap: 6px; max-height: 45vh; overflow: auto; overscroll-behavior: contain; }
.cmd { margin: 0; font: 13px/1.45 var(--mono); background: #0A0E14; border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; white-space: pre-wrap; overflow-wrap: anywhere; }
.btns { display: flex; flex-wrap: wrap; gap: 8px; }
.btn {
  min-height: 40px; padding: 8px 14px;
  border-radius: 10px; border: 1px solid var(--line);
  background: var(--surface-2); color: var(--text);
  font-weight: 600;
}
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.danger { color: #FFC2CC; }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn.wide { width: 100%; }
.answered { font-size: 13px; color: var(--muted); }
.answered.ok { color: var(--ok); }
.answered.no { color: var(--bad); }
.revise { display: flex; flex-direction: column; gap: 8px; }
.parts { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.parts li { display: flex; gap: 8px; }
.parts .mark { flex: none; width: 18px; color: var(--ok); }
.parts .mark.no { color: var(--warn); }
.parts .t { font-weight: 600; }
.parts .s { color: var(--muted); font-size: 13.5px; white-space: pre-wrap; overflow-wrap: anywhere; }
details.files summary { cursor: pointer; color: var(--muted); font-size: 13px; }
details.files ul { margin: 6px 0 0; padding-left: 18px; font: 12.5px/1.5 var(--mono); color: var(--muted); overflow-wrap: anywhere; }
.exit { font-size: 12px; font-weight: 700; padding: 1px 8px; border-radius: 999px; }
.exit.done { background: color-mix(in srgb, var(--ok) 20%, transparent); color: var(--ok); }
.exit.blocked { background: color-mix(in srgb, var(--warn) 20%, transparent); color: var(--warn); }
.exit.cancelled, .exit.error { background: color-mix(in srgb, var(--bad) 20%, transparent); color: var(--bad); }

.queue { padding: 8px 16px 0; display: flex; flex-direction: column; gap: 6px; }
.queued { display: flex; gap: 8px; align-items: center; font-size: 13px; color: var(--muted); background: var(--surface); border: 1px dashed var(--line); border-radius: 10px; padding: 6px 10px; }
.queued span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── 입력 ── */
.composer { border-top: 1px solid var(--line); padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); background: var(--ground); display: flex; flex-direction: column; gap: 8px; }
.hint { font-size: 12px; color: var(--faint); display: flex; gap: 8px; align-items: center; }
.hint .grow { flex: 1; }
.row { display: flex; gap: 8px; align-items: flex-end; }
textarea {
  flex: 1; min-height: 44px; max-height: 40vh; resize: none;
  padding: 10px 12px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--surface); color: var(--text);
  line-height: 1.45;
}
textarea::placeholder { color: var(--faint); }
.send { min-width: 64px; min-height: 44px; }

/* ── 로그인·PC 고르기 ── */
.center { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 16px; padding: 24px 20px calc(24px + env(safe-area-inset-bottom)); }
.center h1 { margin: 0; font-size: 24px; letter-spacing: -0.02em; }
.center p { margin: 0; color: var(--muted); }
.fine { font-size: 12.5px; color: var(--faint); }
.fine a { color: var(--muted); }
.pcs { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.pcs button { width: 100%; text-align: left; display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); }
.pcs button[aria-current="true"] { border-color: var(--accent); }
.pcs .since { margin-left: auto; color: var(--faint); font-size: 12px; }
.field { display: flex; gap: 8px; }
.field input { flex: 1; min-height: 44px; padding: 8px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); }

.sheet-back { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.5); display: flex; align-items: flex-end; justify-content: center; z-index: 10; }
.sheet { width: 100%; max-width: 720px; background: var(--surface); border-radius: 16px 16px 0 0; padding: 16px 16px calc(16px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 12px; max-height: 80dvh; overflow: auto; }
.sheet h2 { margin: 0; font-size: 16px; }

.toast { position: fixed; left: 50%; bottom: calc(90px + env(safe-area-inset-bottom)); transform: translateX(-50%); max-width: calc(100% - 32px); background: #2A3347; color: var(--text); padding: 10px 14px; border-radius: 10px; font-size: 14px; box-shadow: 0 6px 24px rgba(0, 0, 0, 0.4); z-index: 20; }
.center a { color: var(--accent); }
