/* 아지트 — 먹색 사이드바 · 따뜻한 밝은 작업 화면 · 주황 포인트. 외부 폰트/CDN 없음. */
:root {
  --ink: #17191c;
  --ink-2: #202328;
  --ink-3: #2b2f35;
  --ink-line: #353a42;
  --ink-text: #ece8e1;
  --ink-mute: #a2a7ae;

  --paper: #f6f1e8;
  --paper-2: #fbf8f2;
  --card: #fffdf9;
  --line: #e2d9ca;
  --line-2: #d3c7b4;
  --text: #25221e;
  --mute: #6b6358;

  --accent: #c6580d;       /* 흰 글자 대비 4.5:1 이상 */
  --accent-hover: #a94a0a;
  --accent-bright: #f08a3a; /* 먹색 위 포인트 */
  --accent-soft: #fbe6d3;

  --ok: #2c7a4f;
  --ok-soft: #e0f0e5;
  --warn: #8a5a00;
  --warn-soft: #fbefd2;
  --err: #b3261e;
  --err-soft: #fbe3e0;
  --info: #2f5f9e;
  --info-soft: #e3ecf8;

  --radius: 10px;
  --focus: 0 0 0 3px rgba(240, 138, 58, .55);
  --font: "Pretendard", "Pretendard Variable", "Apple SD Gothic Neo", "Malgun Gothic", "맑은 고딕", "Noto Sans KR", system-ui, sans-serif;
  --mono: "D2Coding", "Cascadia Mono", Consolas, ui-monospace, monospace;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--text);
  font: 15px/1.6 var(--font);
  word-break: keep-all;
  overflow-wrap: anywhere;
  -webkit-text-size-adjust: 100%;
}
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; line-height: 1.3; }
p { margin: 0; }
pre { margin: 0; }

:focus-visible { outline: none; box-shadow: var(--focus); }
.sr-only { position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip { position: absolute; left: 8px; top: -60px; z-index: 100; background: var(--accent); color: #fff; padding: 8px 12px; border-radius: 8px; }
.skip:focus { top: 8px; }
.spacer { flex: 1 1 auto; }
.muted { color: var(--mute); }
.small { font-size: 13px; }

/* ---------- 레이아웃 ---------- */
.app {
  display: grid;
  grid-template-columns: 272px minmax(0, 1fr) minmax(360px, 420px);
  height: 100vh;
  height: 100dvh;
}

/* ---------- 사이드바 ---------- */
.side {
  background: var(--ink);
  color: var(--ink-text);
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow-y: auto;
  padding: 16px 14px calc(16px + env(safe-area-inset-bottom));
  gap: 18px;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark {
  width: 36px; height: 36px; border-radius: 10px;
  display: grid; place-items: center;
  background: var(--accent-bright); color: var(--ink); font-weight: 800; font-size: 17px;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.25; flex: 1; min-width: 0; }
.brand-text strong { font-size: 17px; letter-spacing: -.01em; }
.brand-text span { font-size: 12px; color: var(--ink-mute); }
.side h2 { font-size: 12px; font-weight: 700; letter-spacing: .06em; color: var(--ink-mute); }
.side-sec { display: flex; flex-direction: column; gap: 8px; }
.side-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.side-mute { color: var(--ink-mute); font-size: 13px; }
.side-err { color: #ffb4a8; font-size: 13px; }

.ghost-btn {
  background: transparent; color: var(--ink-text);
  border: 1px solid var(--ink-line); border-radius: 8px;
  padding: 4px 10px; font-size: 13px; cursor: pointer; min-height: 32px;
}
.ghost-btn:hover:not(:disabled) { border-color: var(--accent-bright); color: #fff; }
.ghost-btn:disabled { opacity: .6; cursor: progress; }

.conn-card { background: var(--ink-2); border: 1px solid var(--ink-line); border-radius: 10px; padding: 9px 11px; }
.conn-row { display: flex; align-items: center; gap: 8px; }
.conn-row strong { font-size: 14px; }
.conn-state { margin-left: auto; font-size: 12px; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--ink-mute); flex: none; }
.is-ok .dot { background: #4cc17f; }
.is-ok .conn-state { color: #8fdcad; }
.is-bad .dot { background: #f06a5a; }
.is-bad .conn-state { color: #ffb4a8; }
.conn-meta { font-size: 12px; color: var(--ink-mute); margin-top: 3px; }
.conn-err { font-size: 12px; color: #ffcfc7; margin-top: 3px; }

.live { font-size: 12px; padding-left: 16px; position: relative; color: var(--ink-mute); }
.live::before { content: ""; position: absolute; left: 2px; top: .55em; width: 7px; height: 7px; border-radius: 50%; background: var(--ink-mute); }
.live-ok::before { background: #4cc17f; }
.live-wait::before { background: #e8b44c; }
.live-bad { color: #ffcfc7; }
.live-bad::before { background: #f06a5a; }

.side-projects { flex: 1; }
.proj-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.proj-item {
  width: 100%; display: flex; align-items: center; gap: 8px;
  background: transparent; border: 0; border-radius: 8px;
  padding: 8px 10px; text-align: left; cursor: pointer; color: var(--ink-text); min-height: 40px;
}
.proj-item:hover { background: var(--ink-3); }
.proj-item.is-current { background: var(--ink-3); box-shadow: inset 3px 0 0 var(--accent-bright); color: #fff; font-weight: 600; }
.proj-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pill-warn { background: var(--accent-bright); color: var(--ink); border-radius: 999px; padding: 0 8px; font-size: 12px; font-weight: 700; flex: none; }

.proj-form { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; }
.proj-form label { font-size: 12px; color: var(--ink-mute); }
.proj-form-row { display: flex; gap: 6px; }
.proj-form input {
  flex: 1; min-width: 0; background: var(--ink-2); border: 1px solid var(--ink-line);
  color: var(--ink-text); border-radius: 8px; padding: 7px 10px; min-height: 38px;
}
.proj-form input::placeholder { color: #7d838b; }
.proj-form input[aria-invalid="true"] { border-color: #f06a5a; }
.proj-form button {
  background: var(--accent-bright); color: var(--ink); border: 0; border-radius: 8px;
  padding: 0 14px; font-weight: 700; cursor: pointer; min-height: 38px;
}
.proj-form button:disabled { opacity: .6; }
.side .field-err { color: #ffb4a8; }
.side .field-err:empty { display: none; }

/* ---------- 대화 ---------- */
.chat { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--paper); }
.chat-head {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 18px; border-bottom: 1px solid var(--line); background: var(--paper-2);
}
.chat-title { flex: 1; min-width: 0; }
.chat-title h1 { font-size: 18px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-title p { font-size: 13px; color: var(--mute); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-title p.warn { color: var(--warn); font-weight: 600; }
.icon-btn {
  width: 38px; height: 38px; flex: none; border-radius: 8px; border: 1px solid var(--line-2);
  background: var(--card); cursor: pointer; font-size: 17px; line-height: 1;
}
.side .icon-btn { background: var(--ink-2); border-color: var(--ink-line); color: var(--ink-text); }
.head-btn {
  flex: none; border: 1px solid var(--line-2); background: var(--card); border-radius: 8px;
  padding: 0 12px; min-height: 38px; cursor: pointer; font-weight: 600;
}
.open-side, .open-panel, .drawer-close { display: none; }

.banners { display: flex; flex-direction: column; gap: 6px; padding: 0 18px; }
.banners:not(:empty) { padding-top: 10px; }
.banner {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 8px 12px; border-radius: 8px; font-size: 14px;
}
.banner span { flex: 1 1 200px; }
.banner button { border: 1px solid currentColor; background: transparent; border-radius: 6px; padding: 2px 10px; cursor: pointer; min-height: 32px; }
.banner-err { background: var(--err-soft); color: var(--err); }
.banner-warn { background: var(--warn-soft); color: var(--warn); }

.msgs {
  flex: 1 1 auto; min-height: 0; overflow-y: auto;
  padding: 18px; display: flex; flex-direction: column; gap: 12px;
}
.loading { color: var(--mute); padding: 20px 0; }
.empty { margin: auto; max-width: 460px; text-align: center; display: flex; flex-direction: column; gap: 8px; align-items: center; padding: 24px 8px; color: var(--mute); }
.empty h2 { color: var(--text); font-size: 18px; margin-bottom: 4px; }

.msg { max-width: min(760px, 92%); display: flex; flex-direction: column; gap: 4px; }
.msg-head { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--mute); }
.msg-who { font-weight: 700; color: var(--text); }
.msg-text {
  white-space: pre-wrap; padding: 10px 14px; border-radius: 12px;
  background: var(--card); border: 1px solid var(--line);
}
.msg-user { align-self: flex-end; }
.msg-user .msg-head { justify-content: flex-end; }
.msg-user .msg-text { background: var(--accent-soft); border-color: #efc7a3; }
.msg-system { align-self: center; max-width: min(680px, 100%); }
.msg-system .msg-text { background: transparent; border-style: dashed; border-color: var(--line-2); font-size: 14px; color: #4b443b; }
.msg-state-failed .msg-text, .msg-state-error .msg-text { border-color: var(--err); background: var(--err-soft); }
.msg-atts { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; font-size: 12px; }
.msg-user .msg-atts { justify-content: flex-end; }
.msg-atts li { background: var(--paper-2); border: 1px solid var(--line); border-radius: 6px; padding: 1px 8px; }
.msg-pending .msg-text { border-style: dashed; color: #4b443b; min-height: 2.6em; }
.msg-pending .msg-text:empty::after { content: "…"; color: var(--mute); }
.typing { color: var(--accent); font-weight: 600; }
.delta-note { font-size: 12px; color: var(--mute); }

.link-btn {
  background: none; border: 0; padding: 2px 0; color: var(--accent); cursor: pointer;
  text-decoration: underline; text-underline-offset: 3px; text-align: left; font-weight: 600;
}
.link-btn:hover { color: var(--accent-hover); }
.msg .link-btn { font-size: 13px; align-self: flex-start; }
.msg-user .link-btn { align-self: flex-end; }

/* ---------- 입력창 ---------- */
.composer {
  border-top: 1px solid var(--line); background: var(--paper-2);
  padding: 10px 18px calc(10px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: 8px;
}
#composerTop:empty { display: none; }
#composerTop { display: flex; flex-direction: column; gap: 6px; }
.composer textarea {
  width: 100%; resize: none; min-height: 52px; max-height: 40vh; max-height: 40dvh; overflow-y: auto;
  border: 1px solid var(--line-2); border-radius: 10px; background: var(--card);
  padding: 10px 12px; line-height: 1.55;
}
.composer textarea:focus-visible { border-color: var(--accent); }
.composer textarea[aria-invalid="true"] { border-color: var(--err); }
.composer textarea:disabled { background: var(--paper); }
.composer-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.composer-note { flex: 1 1 160px; min-width: 0; font-size: 12px; color: var(--mute); }
.attach-btn {
  display: inline-flex; align-items: center; gap: 4px; cursor: pointer;
  border: 1px solid var(--line-2); background: var(--card); border-radius: 8px; padding: 0 12px; min-height: 40px; font-weight: 600;
}
.attach-btn:focus-within { box-shadow: var(--focus); }
.attach-btn.is-disabled { opacity: .5; cursor: not-allowed; }
.composer .field-err:empty { display: none; }

.parent-note { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px; background: var(--info-soft); color: var(--info); border-radius: 8px; padding: 6px 10px; font-size: 13px; }
.parent-goal { font-weight: 600; flex: 1 1 120px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.parent-note .link-btn { color: var(--info); }

.att-list { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.att {
  display: flex; align-items: center; flex-wrap: wrap; gap: 6px; max-width: 100%;
  border: 1px solid var(--line-2); background: var(--card); border-radius: 8px; padding: 3px 4px 3px 10px; font-size: 13px;
}
.att-name { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.att-meta { color: var(--mute); font-size: 12px; }
.att-error { border-color: var(--err); background: var(--err-soft); }
.att-err { color: var(--err); font-size: 12px; flex-basis: 100%; }
.att-x { border: 0; background: transparent; cursor: pointer; width: 28px; height: 28px; border-radius: 6px; }
.att-x:hover:not(:disabled) { background: var(--paper); }

/* ---------- 버튼 ---------- */
.main-btn, .sub-btn, .ghost-dark, .danger-btn {
  border-radius: 8px; padding: 0 14px; min-height: 40px; cursor: pointer; font-weight: 700; border: 1px solid transparent;
}
.main-btn { background: var(--accent); color: #fff; }
.main-btn:hover:not(:disabled) { background: var(--accent-hover); }
.sub-btn { background: var(--ink); color: #fff; }
.sub-btn:hover:not(:disabled) { background: var(--ink-3); }
.ghost-dark { background: var(--card); border-color: var(--line-2); color: var(--text); font-weight: 600; }
.ghost-dark:hover:not(:disabled) { border-color: var(--accent); }
.danger-btn { background: var(--card); color: var(--err); border-color: var(--err); }
.danger-btn:hover:not(:disabled) { background: var(--err-soft); }
.main-btn:disabled, .sub-btn:disabled, .ghost-dark:disabled, .danger-btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }

/* ---------- 패널 ---------- */
.panel { border-left: 1px solid var(--line); background: var(--paper-2); display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.panel-head { display: flex; align-items: center; gap: 8px; padding: 10px 14px 0; border-bottom: 1px solid var(--line); }
.tabs { display: flex; gap: 2px; flex: 1; min-width: 0; }
.tab {
  display: inline-flex; align-items: center; gap: 6px;
  background: none; border: 0; border-bottom: 3px solid transparent;
  padding: 8px 12px 9px; cursor: pointer; font-weight: 600; color: var(--mute); min-height: 42px;
}
.tab.is-active { color: var(--text); border-bottom-color: var(--accent); }
.tab-count { background: var(--ink); color: #fff; border-radius: 999px; font-size: 11px; padding: 0 7px; min-width: 20px; text-align: center; }
.tab-count.warn { background: var(--accent); }
.panel-body { flex: 1; min-height: 0; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 12px; }
.panel-empty { color: var(--mute); padding: 12px 4px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.card.is-editing { border-color: var(--accent); }
.card-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.card-head h3 { font-size: 15px; }
.card-desc { font-size: 13px; color: var(--mute); }
.notice { background: var(--paper); border-radius: 8px; padding: 8px 10px; font-size: 13px; color: #4b443b; }
.notice-warn { background: var(--warn-soft); color: var(--warn); }
.error-box { background: var(--err-soft); color: var(--err); border-radius: 8px; padding: 8px 10px; font-size: 13px; white-space: pre-wrap; }
.bind-name { font-weight: 700; }
.bind-sum { font-size: 13px; color: var(--mute); }

.badge { font-size: 12px; font-weight: 700; border-radius: 999px; padding: 1px 9px; background: var(--paper); color: var(--mute); border: 1px solid var(--line); white-space: nowrap; }
.badge-ok, .st-completed { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.badge-warn, .st-waiting_approval, .st-waiting_quota, .st-waiting_auth, .st-paused { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.st-running, .st-reconciling { background: var(--info-soft); color: var(--info); border-color: transparent; }
.st-failed { background: var(--err-soft); color: var(--err); border-color: transparent; }
.st-cancelled { background: var(--paper); color: var(--mute); }
.badge-mute, .st-queued, .st-pending { background: var(--paper); color: var(--mute); }

/* 담당 편집 */
.binding-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 10px; }
.field { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.field label { font-size: 12px; font-weight: 700; color: #4b443b; }
.field input, .field select {
  width: 100%; min-width: 0; min-height: 38px; border: 1px solid var(--line-2); border-radius: 8px;
  background: #fff; padding: 6px 9px;
}
.field select:disabled { background: var(--paper); color: var(--mute); }
.field.has-err input, .field.has-err select { border-color: var(--err); }
.field-hint { font-size: 12px; color: var(--mute); }
.field-err { font-size: 13px; color: var(--err); font-weight: 600; }

.team-list, .stage-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.team-row { border: 1px solid var(--line); border-radius: 8px; padding: 10px; display: flex; flex-direction: column; gap: 8px; background: var(--paper-2); }
.row-head { display: flex; align-items: center; gap: 6px; min-width: 0; }
.row-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.num { flex: none; width: 22px; height: 22px; border-radius: 50%; background: var(--ink); color: #fff; font-size: 12px; display: grid; place-items: center; font-weight: 700; }
.icon-sm { flex: none; width: 32px; height: 32px; border-radius: 6px; border: 1px solid var(--line-2); background: #fff; cursor: pointer; }
.icon-sm:disabled { opacity: .35; cursor: not-allowed; }
.icon-sm.danger { color: var(--err); }

/* 작업 */
.job-goal { white-space: pre-wrap; font-weight: 600; display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden; }
.job-progress { font-size: 12px; color: var(--mute); }
.job.flash { box-shadow: 0 0 0 3px var(--accent-bright); }
.stage { border-left: 3px solid var(--line-2); padding: 2px 0 2px 10px; display: flex; flex-direction: column; gap: 5px; }
.stage-running { border-left-color: var(--info); }
.stage-completed { border-left-color: var(--ok); }
.stage-failed { border-left-color: var(--err); }
.stage-paused { border-left-color: var(--warn); }
.stage-edit { display: flex; flex-direction: column; gap: 8px; background: var(--paper-2); border: 1px solid var(--accent); border-radius: 8px; padding: 10px; }
.output summary { cursor: pointer; font-size: 13px; font-weight: 600; color: var(--accent); padding: 2px 0; }
.output pre, pre.delta, .approval-desc {
  white-space: pre-wrap; font: 13px/1.5 var(--mono); background: var(--paper); border: 1px solid var(--line);
  border-radius: 8px; padding: 8px 10px; max-height: 360px; overflow: auto;
}
pre.delta { border-style: dashed; color: #4b443b; max-height: 160px; }
.question-box { background: var(--info-soft); color: var(--info); border-radius: 8px; padding: 8px 10px; font-size: 14px; }
.question-box p { white-space: pre-wrap; color: var(--text); margin-top: 2px; }
.resume-box { display: flex; flex-direction: column; gap: 5px; background: var(--paper-2); border: 1px solid var(--line-2); border-radius: 8px; padding: 10px; }
.resume-box label { font-size: 13px; font-weight: 700; color: #4b443b; }
.resume-box textarea {
  width: 100%; min-width: 0; min-height: 60px; max-height: 40vh; resize: vertical;
  border: 1px solid var(--line-2); border-radius: 8px; background: #fff; padding: 8px 10px; line-height: 1.5;
}
.resume-box textarea:focus-visible { border-color: var(--accent); }
.resume-box .btn-row { justify-content: flex-end; }
.file-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; font-size: 14px; }
.file-list li { display: flex; gap: 8px; align-items: baseline; justify-content: space-between; border-top: 1px solid var(--line); padding-top: 4px; }
.file-list a { color: var(--accent); font-family: var(--mono); font-size: 13px; min-width: 0; overflow-wrap: anywhere; }

.approval.is-pending { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent-soft); }
.approval .link-btn span { display: inline-block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }

.toast {
  position: fixed; left: 50%; top: calc(14px + env(safe-area-inset-top)); transform: translate(-50%, -20px);
  background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 10px; font-size: 14px;
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 60; max-width: calc(100% - 32px);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.scrim { position: fixed; inset: 0; background: rgba(15, 16, 18, .45); z-index: 25; }
.scrim[hidden] { display: none; }

/* ---------- 중간 폭: 패널을 서랍으로 ---------- */
@media (max-width: 1199px) {
  .app { grid-template-columns: 260px minmax(0, 1fr); }
  .open-panel { display: inline-block; }
  .panel {
    position: fixed; top: 0; right: 0; bottom: 0; width: min(440px, 100%); z-index: 30;
    transform: translateX(100%); visibility: hidden;
    transition: transform .22s ease, visibility 0s linear .22s;
    box-shadow: -12px 0 30px rgba(0, 0, 0, .15);
  }
  body.panel-open .panel { transform: none; visibility: visible; transition: transform .22s ease, visibility 0s; }
  .panel .drawer-close { display: inline-block; }
  .panel-head { padding-bottom: 0; }
}

/* ---------- 휴대폰: 대화 우선 ---------- */
@media (max-width: 859px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .open-side { display: inline-block; }
  .side {
    position: fixed; top: 0; left: 0; bottom: 0; width: min(310px, 88%); z-index: 30;
    transform: translateX(-100%); visibility: hidden;
    transition: transform .22s ease, visibility 0s linear .22s;
  }
  body.side-open .side { transform: none; visibility: visible; transition: transform .22s ease, visibility 0s; }
  .side .drawer-close { display: inline-block; }
  .chat-head { padding: 8px 10px; gap: 8px; }
  .chat-title h1 { font-size: 16px; }
  .banners { padding: 0 10px; }
  .msgs { padding: 12px 10px; }
  .msg { max-width: 100%; }
  .composer { padding: 8px 10px calc(8px + env(safe-area-inset-bottom)); }
  .composer-note { order: 5; flex-basis: 100%; }
  .composer-bar .sub-btn { flex: 1 1 auto; }
  .composer-bar .main-btn, .composer-bar .sub-btn, .composer-bar .attach-btn { padding: 0 10px; font-size: 14px; }
  .binding-grid { grid-template-columns: minmax(0, 1fr); }
  .panel-body { padding: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; scroll-behavior: auto !important; }
}

/* ---------- 원격: 로그인·기기 등록 화면 ---------- */
body.auth-mode .app { display: none; }
.auth-screen {
  min-height: 100vh; min-height: 100dvh; display: flex; align-items: flex-start; justify-content: center;
  padding: max(24px, env(safe-area-inset-top)) 16px 32px; background: var(--paper);
}
.auth-screen[hidden] { display: none; }
.auth-card {
  width: min(440px, 100%); margin-top: 6vh; background: var(--card); border: 1px solid var(--line);
  border-radius: 14px; padding: 22px 20px; display: flex; flex-direction: column; gap: 12px;
}
.auth-brand { display: flex; align-items: center; gap: 10px; font-size: 17px; }
.auth-card h1 { font-size: 20px; }
.auth-sub { color: var(--mute); font-size: 14px; }
.auth-form { display: flex; flex-direction: column; gap: 6px; }
.auth-form label { font-size: 13px; font-weight: 700; color: #4b443b; margin-top: 4px; }
.auth-form input {
  width: 100%; min-width: 0; min-height: 44px; border: 1px solid var(--line-2); border-radius: 8px; background: #fff; padding: 8px 10px;
}
.auth-form input:disabled { background: var(--paper); color: var(--mute); }
.auth-form .main-btn { margin-top: 8px; }
.main-btn.wide { width: 100%; min-height: 46px; }
.ceremony-box { background: var(--info-soft); color: var(--info); border-radius: 8px; padding: 10px; display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.ceremony-box p { color: var(--text); }
.ceremony-id { font-family: var(--mono); font-size: 13px; background: #fff; border: 1px solid var(--line-2); border-radius: 6px; padding: 6px 8px; overflow-wrap: anywhere; user-select: all; color: var(--text); }
.small-btn { min-height: 34px; padding: 0 10px; font-size: 13px; align-self: flex-start; }

/* ---------- 대화상자(알림함·설정·재로그인) ---------- */
.dlg {
  border: 1px solid var(--line); border-radius: 14px; padding: 0; width: min(520px, calc(100vw - 24px));
  max-height: min(86vh, 760px); background: var(--card); color: var(--text); box-shadow: 0 20px 60px rgba(0, 0, 0, .25);
}
.dlg-narrow { width: min(420px, calc(100vw - 24px)); }
.dlg::backdrop { background: rgba(15, 16, 18, .5); }
.dlg[open] { display: flex; flex-direction: column; }
.dlg-head { display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.dlg-head h2 { flex: 1; font-size: 17px; }
.dlg-body { padding: 14px; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; min-height: 0; }
.dlg-body h2 { font-size: 18px; }

.bell { position: relative; font-size: 16px; }
.bell[hidden] { display: none; }
.bell-count {
  position: absolute; top: -6px; right: -6px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 999px;
  background: var(--accent); color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center;
}
.side-set { margin-left: auto; }

.notif-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.notif-item {
  width: 100%; display: flex; align-items: center; gap: 10px; text-align: left; cursor: pointer;
  background: var(--paper-2); border: 1px solid var(--line); border-radius: 10px; padding: 10px; min-height: 52px;
}
.notif-item:hover { border-color: var(--accent); }
.notif-dot { width: 9px; height: 9px; border-radius: 50%; background: transparent; flex: none; }
.notif-item.unread { background: #fff; }
.notif-item.unread .notif-dot { background: var(--accent); }
.notif-item.unread strong { color: var(--text); }
.notif-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.notif-proj { font-size: 13px; color: var(--mute); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.set-sec { display: flex; flex-direction: column; gap: 8px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.set-sec:last-child { border-bottom: 0; }
.set-sec h3 { font-size: 15px; }
.kv { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 4px 12px; margin: 0; font-size: 14px; }
.kv dt { color: var(--mute); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.device-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.device-list li { display: flex; align-items: center; gap: 10px; border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; }
.device-list li.is-revoked { background: var(--paper); border-style: dashed; }
.device-list li.is-revoked strong { color: var(--mute); text-decoration: line-through; }
.mono { font-family: var(--mono); }
.device-main { flex: 1; min-width: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.device-main .muted { flex-basis: 100%; }
.inline-form { display: flex; gap: 8px; flex-wrap: wrap; }
.inline-form input { flex: 1 1 180px; min-width: 0; min-height: 40px; border: 1px solid var(--line-2); border-radius: 8px; padding: 6px 10px; background: #fff; }
.link-as-btn { display: inline-flex; align-items: center; text-decoration: none; }
.banner-net { background: var(--info-soft); color: var(--info); }

@media (max-width: 859px) {
  .dlg { width: calc(100vw - 16px); max-height: calc(100dvh - 24px); }
  .auth-card { margin-top: 2vh; padding: 18px 14px; }
}

/* ---------- 팀 업무(핵심 작업) ---------- */
.core-grid { display: grid; grid-template-columns: minmax(0, 8rem) minmax(0, 1fr); gap: 8px; }
.dep-box { border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; margin: 8px 0; min-width: 0; }
.dep-opt { display: inline-flex; align-items: center; gap: 6px; margin: 2px 12px 2px 0; overflow-wrap: anywhere; }
.core-preview ol { margin: 4px 0 0; padding-left: 20px; }
.core-timeline { list-style: none; display: flex; flex-wrap: wrap; gap: 4px 6px; margin: 6px 0; padding: 0; }
.core-timeline li { font-size: 12px; border: 1px solid var(--line); border-radius: 999px; padding: 1px 9px; background: var(--paper); }
.core-timeline li + li::before { content: "→ "; color: var(--mute); }
.core-group { margin-top: 10px; }
.core-group h4 { margin: 0 0 4px; font-size: 13px; }
.core-list ul { margin: 2px 0 6px; padding-left: 20px; }
.core-list li, .core-review li { overflow-wrap: anywhere; }
.core-review { border-left: 3px solid var(--line-2); padding-left: 8px; margin: 6px 0; }
.core-review p, .report-summary { white-space: pre-wrap; overflow-wrap: anywhere; }
.core-st-running, .core-st-revising { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.core-st-question, .core-st-revise_req, .core-st-failed { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
@media (max-width: 480px) { .core-grid { grid-template-columns: minmax(0, 1fr); } }

/* ---------- Claude 잔여 한도(연결 상태 영역, 어두운 사이드바) ---------- */
.usage-box { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--ink-line); font-size: 12px; color: var(--ink-text); min-width: 0; }
.usage-title { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.usage-refresh { font-size: 12px; padding: 2px 10px; }
.usage-list { list-style: none; margin: 6px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.usage-head { display: flex; gap: 6px; align-items: baseline; flex-wrap: wrap; }
.usage-label { font-weight: 700; }
.usage-val { margin-left: auto; }
.usage-tag { font-size: 11px; border: 1px solid var(--ink-line); border-radius: 999px; padding: 0 7px; color: var(--ink-mute); }
.usage-bar { height: 6px; border-radius: 999px; background: var(--ink-3); overflow: hidden; margin-top: 3px; }
.usage-fill { display: block; height: 100%; background: var(--accent-bright); border-radius: 999px; }
.usage-row.is-low .usage-fill { background: #ff8f7d; }
.usage-row.usage-expired .usage-val, .usage-row.usage-unknown .usage-val { color: var(--ink-mute); }
.usage-note { font-size: 12px; color: var(--ink-mute); margin-top: 3px; }
.usage-link { display: inline-block; margin-top: 6px; font-size: 12px; color: var(--accent-bright); }
.usage-fill.w0 { width: 0%; }
.usage-fill.w5 { width: 5%; }
.usage-fill.w10 { width: 10%; }
.usage-fill.w15 { width: 15%; }
.usage-fill.w20 { width: 20%; }
.usage-fill.w25 { width: 25%; }
.usage-fill.w30 { width: 30%; }
.usage-fill.w35 { width: 35%; }
.usage-fill.w40 { width: 40%; }
.usage-fill.w45 { width: 45%; }
.usage-fill.w50 { width: 50%; }
.usage-fill.w55 { width: 55%; }
.usage-fill.w60 { width: 60%; }
.usage-fill.w65 { width: 65%; }
.usage-fill.w70 { width: 70%; }
.usage-fill.w75 { width: 75%; }
.usage-fill.w80 { width: 80%; }
.usage-fill.w85 { width: 85%; }
.usage-fill.w90 { width: 90%; }
.usage-fill.w95 { width: 95%; }
.usage-fill.w100 { width: 100%; }

/* ---------- 시작 안내 · 조정 담당/PD ---------- */
body.guide-mode .app { display: none; }
body.auth-mode .guide-screen { display: none; }
.guide-card { width: min(520px, 100%); }
.guide-choice { display: flex; flex-direction: column; gap: 8px; }
.guide-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.guide-opt {
  display: flex; flex-direction: column; gap: 2px; align-items: flex-start; text-align: left; width: 100%; min-height: 56px;
  padding: 10px 12px; border: 1px solid var(--line-2); border-radius: 10px; background: #fff; cursor: pointer; overflow-wrap: anywhere;
}
.guide-opt:hover:not(:disabled) { border-color: var(--accent); }
.guide-opt.is-on { border-color: var(--accent); background: var(--accent-soft); }
.guide-opt:disabled { opacity: .6; cursor: default; }
.guide-opt span { font-size: 13px; color: var(--mute); }
.guide-mute { font-size: 13px; color: var(--mute); }
.guide-step-label { font-size: 13px; font-weight: 700; color: #4b443b; margin-top: 4px; }
.guide-path { font-size: 13px; color: var(--mute); overflow-wrap: anywhere; }
.guide-suggest { font-size: 13px; }
.guide-chips, .role-btns { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-btn {
  min-height: 40px; padding: 0 12px; border: 1px solid var(--line-2); border-radius: 999px; background: #fff; cursor: pointer;
  font-size: 14px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.chip-btn.is-on { border-color: var(--accent); background: var(--accent-soft); font-weight: 700; }
.chip-btn:disabled { opacity: .6; cursor: default; }
.guide-check { font-size: 14px; display: flex; align-items: center; gap: 6px; }
.guide-sum h2 { font-size: 14px; margin: 6px 0 2px; }
.guide-sum ul { margin: 0; padding-left: 18px; font-size: 14px; }
.guide-src { color: var(--mute); font-size: 12px; }
.role-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; padding: 8px 14px; border-bottom: 1px solid var(--line); background: var(--card); font-size: 13px; }
.role-bar[hidden] { display: none; }
.role-now { color: var(--mute); }
.role-now strong { color: var(--text); }
.role-bar .chip-btn { min-height: 34px; font-size: 13px; }
/* “보내기” 글자가 두 줄로 갈라지지 않게 */
.composer-bar .main-btn, .composer-bar .sub-btn { white-space: nowrap; }
.composer-bar .main-btn { flex: 0 0 auto; }
@media (max-width: 480px) { .composer-bar .sub-btn { white-space: normal; } }

/* ---------- 팀 라인업 · 대화 복사 ---------- */
.chat-tools { display: flex; flex-wrap: wrap; gap: 4px 14px; padding: 4px 14px; border-bottom: 1px solid var(--line); background: var(--card); font-size: 13px; }
.dlg-wide { width: min(760px, calc(100vw - 16px)); max-height: calc(100dvh - 16px); }
.tp-h { font-size: 15px; margin-top: 4px; }
.tp-members { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.tp-member { border: 1px solid var(--line-2); border-left: 4px solid var(--accent); border-radius: 10px; padding: 10px; display: flex; flex-direction: column; gap: 8px; background: var(--card); min-width: 0; }
.tp-member.tp-aux { border-left-color: #8a8175; }
.tp-member.tp-review { border-left-color: #2f6f4f; }
.tp-member.tp-report { border-left-color: #2b5a8c; }
.tp-member.has-issue { border-color: #b3261e; }
.tp-member-head { display: flex; align-items: flex-end; gap: 8px; }
.tp-no { font-weight: 800; font-size: 13px; color: var(--mute); min-width: 1.4em; padding-bottom: 8px; }
.tp-kind { flex: 1; }
.tp-del { padding-bottom: 8px; white-space: nowrap; }
.tp-member textarea, #lineupBody > .field textarea, .copy-text { width: 100%; font: inherit; border: 1px solid var(--line-2); border-radius: 8px; padding: 7px 9px; background: #fff; color: var(--text); resize: vertical; min-width: 0; }
.tp-detail { border: 1px dashed var(--line-2); border-radius: 8px; padding: 6px 9px; }
.tp-detail[open] { display: flex; flex-direction: column; gap: 8px; }
.tp-detail summary { cursor: pointer; font-size: 13px; font-weight: 700; color: #4b443b; overflow-wrap: anywhere; }
.tp-label { font-size: 12px; font-weight: 700; color: #4b443b; }
.tp-checks { display: flex; flex-wrap: wrap; gap: 4px 14px; }
.tp-check { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; }
.tp-order { margin: 0; padding-left: 20px; font-size: 13px; display: flex; flex-direction: column; gap: 2px; overflow-wrap: anywhere; }
.tp-note { border: 1px solid var(--line-2); border-radius: 8px; padding: 8px 10px; background: var(--paper); font-size: 13px; display: flex; flex-direction: column; gap: 6px; }
.tp-note ul, .tp-note ol, .tp-issues ul { margin: 0; padding-left: 18px; }
.tp-issues { margin: 0; border: 1px solid #b3261e; border-radius: 8px; padding: 7px 10px 7px 26px; color: #8c1d18; font-size: 13px; background: #fff5f4; }
div.tp-issues { padding-left: 10px; }
.tp-confirm { border: 2px solid var(--accent); border-radius: 10px; padding: 10px; display: flex; flex-direction: column; gap: 8px; }
.tp-actions { justify-content: flex-end; flex-wrap: wrap; }
.tp-adjust { flex-wrap: wrap; }
.copy-text { min-height: 180px; font-size: 13px; }
@media (max-width: 480px) {
  .dlg-wide { width: calc(100vw - 8px); max-height: calc(100dvh - 8px); }
  .tp-actions > button { flex: 1 1 100%; }
  .chat-tools { padding: 4px 10px; }
}

/* 대화 조정 제안(적용 전 확인) */
.tp-proposal { border: 2px solid var(--accent); border-radius: 10px; padding: 10px; display: flex; flex-direction: column; gap: 6px; background: var(--card); }
.tp-proposal h3 { font-size: 15px; }
.tp-prop-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.tp-prop-list li { border: 1px solid var(--line-2); border-radius: 8px; padding: 7px 9px; min-width: 0; }
.tp-prop-list li.is-off { opacity: .6; }
.tp-diff { margin: 6px 0 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 2px; font-size: 13px; }
.tp-diff dt { font-weight: 700; color: #4b443b; margin-top: 4px; }
.tp-diff dd { margin: 0; overflow-wrap: anywhere; }
.tp-before { text-decoration: line-through; color: var(--mute); }
.tp-after { font-weight: 700; }
