/* MobileHub — 모바일 우선 다크 UI
   아이폰 PWA 기준: 세이프에어리어 대응, 입력 폰트 16px(자동 확대 방지) */

:root {
  --bg:      #0b1013;
  --surface: #18232b;    /* 카드 배경 — 한 단계 밝게 (08-28 사용자 요청) */
  --surface2:#22303a;
  --line:    #26343d;
  --text:    #e6edf1;
  --muted:   #8fa3b0;
  --accent:  #2dd4bf;
  --accent-d:#0f766e;
  --warn:    #fbbf24;
  --err:     #f87171;
  /* 내 말풍선 — 다크에서 채도를 낮춘다. 대화 화면의 절반을 차지하는 면이라
     밝고 쨍하면 눈이 피로하고 에이전트 답변(정보)이 묻힌다 */
  --me-bg:   #123f3d;
  --me-text: #d6f2ee;
  --me-line: #1d5d59;
  --bar-bg:  rgba(15,25,31,.92);   /* 헤더/입력창 반투명 배경 — 테마 연동 */
  --bar-bg2: rgba(15,25,31,.95);
  /* 대화창 배경 — 색감 있는 중간 톤 + 빛망울(bokeh).
     ★순흑/순백을 피한다: 검은 이미지도 흰 이미지도 배경에 묻히지 않게 */
  --chat-grad:
    radial-gradient(58% 42% at 12% 8%,  rgba(45,212,191,.13), transparent 70%),
    radial-gradient(52% 38% at 88% 34%, rgba(99,140,255,.11), transparent 72%),
    radial-gradient(60% 45% at 30% 92%, rgba(168,85,247,.09), transparent 74%),
    linear-gradient(168deg, #1b2a33 0%, #21323c 48%, #1c2b34 100%);
  /* 상대(에이전트·멤버) 말풍선 — 바탕보다 확실히 밝게. 09-17: 바탕을 한 단계 올리면서
     말풍선도 같이 올려 "바탕 < 말풍선 < 내 말풍선(청록)" 3단이 되게 */
  --bubble:  #2c3b46;
  --radius:  12px;
  --content: 720px;      /* 본문 최대 폭 — 화면이 커지면 아래 미디어쿼리가 넓힌다 */
  --chat-fs: 15px;       /* ★대화 본문 전용 크기 — 설정에서 이것"만" 키운다.
                            UI 크롬(제목·라벨·버튼)은 밀도 유지를 위해 고정 */
  color-scheme: dark;    /* 네이티브 컨트롤(입력창·스크롤바) 테마 — 아래 라이트에서 뒤집음 */
}

/* ── 라이트 모드 — 따뜻한 종이 위의 잉크 ── */
:root[data-theme="light"] {
  --bg:      #f6f5f1;
  --surface: #ffffff;
  --surface2:#efede7;
  --line:    #e2dfd7;
  --text:    #22262a;
  --muted:   #71787f;
  --accent:  #0d9488;
  --accent-d:#0f766e;
  --warn:    #b45309;
  --err:     #dc2626;
  --me-bg:   #d7ede9;
  --me-text: #0b3f39;
  --me-line: #b3d9d2;
  --bar-bg:  rgba(238,240,236,.92);
  --bar-bg2: rgba(242,243,239,.95);
  /* 라이트도 순백을 피하고 살짝 톤다운 — 흰 배경 이미지가 떠 보이도록 */
  --chat-grad:
    radial-gradient(58% 42% at 12% 8%,  rgba(13,148,136,.13), transparent 70%),
    radial-gradient(52% 38% at 88% 34%, rgba(99,140,255,.10), transparent 72%),
    radial-gradient(60% 45% at 30% 92%, rgba(217,119,187,.09), transparent 74%),
    linear-gradient(168deg, #e2e5e0 0%, #dce2e0 48%, #e0dfd8 100%);
  --bubble:  #ffffff;
  color-scheme: light;
}

/* 대화 페이지 배경 — viewport 에 고정된 그라데이션 (스크롤과 무관) */
body.chat-page {
  background: var(--chat-grad);
  background-attachment: fixed;
}

/* ── 대화 배경 그림 (2026-09-24) ─────────────────────────────────────────
   그림 위에 **반투명 막**을 한 겹 덮는다. 안 덮으면 밝은 그림(밝기 180~221)
   위에서 다크 테마의 밝은 글자가, 어두운 그림(20~35) 위에서 라이트 테마의
   어두운 글자가 묻힌다. 막 색은 테마가, 진하기는 그림 밝기가 정한다 —
   계산은 app.js 의 veilFor() 가 하고 여기엔 결과(--veil)만 들어온다.
   ★두 겹(막, 그림)이지만 background-attachment 는 위 규칙의 fixed 를 함께 받는다. */
body.chat-page.has-bg {
  background-image: linear-gradient(var(--veil), var(--veil)), var(--bg-img);
  background-size: cover;
  background-position: center center;
  background-repeat: no-repeat;
}
/* 말풍선 **밖**에 그냥 놓이는 글자들(시각·시스템 안내·이름표)은 배경 그림의
   밝은 얼룩을 그대로 만난다. 막만으로는 국소 대비가 모자라 그림자를 깐다. */
:root            { --on-bg-shadow: 0 1px 3px rgba(0,0,0,.60); }
:root[data-theme="light"] { --on-bg-shadow: 0 1px 3px rgba(255,255,255,.80); }
/* 라이트 테마의 보조 글자(#71787f)는 **평평한 배경에서도** 명암비 3.3 으로 빠듯하다.
   그림이 깔리면 그 아래로 내려가므로, 배경을 켠 화면에서만 한 단계 진하게 쓴다.
   (배경이 없을 때의 기존 화면은 그대로 둔다 — 눈에 익은 톤을 건드리지 않으려고) */
:root[data-theme="light"] body.chat-page.has-bg { --muted: #4f575e; }
body.chat-page.has-bg .msg-row .ts,
body.chat-page.has-bg .msg.status,
body.chat-page.has-bg .msg-row .col .who { text-shadow: var(--on-bg-shadow); }

/* 본문과 같은 축으로 정렬하기 위한 공통 좌우 여백 */
.wrap, header.bar, .chat, .composer {
  padding-left:  max(16px, calc((100% - var(--content)) / 2));
  padding-right: max(16px, calc((100% - var(--content)) / 2));
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0; padding: 0;
  background: var(--bg); color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Pretendard", "Apple SD Gothic Neo",
               "Malgun Gothic", system-ui, sans-serif;
  font-size: 16px; line-height: 1.55;
  overscroll-behavior-y: none;
}

/* ── 레이아웃 ───────────────────────────────────────────── */
.wrap {
  padding-top: calc(env(safe-area-inset-top) + 14px);
  padding-bottom: calc(env(safe-area-inset-bottom) + 20px);
}

header.bar {
  position: sticky; top: 0; z-index: 20;
  background: var(--bar-bg);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
  padding-top: calc(env(safe-area-inset-top) + 10px);
  padding-bottom: 10px;
  display: flex; align-items: center; gap: 12px;
}
header.bar h1 { font-size: 17px; margin: 0; font-weight: 650; letter-spacing: -.01em; }
header.bar .spacer { flex: 1; }

/* 회사 로고 — 타이틀(좌측 정렬)의 반대편 상단 구석 */
.es-logo { height: 14px; width: auto; opacity: .92; align-self: center; }
.es-logo.home { height: 20px; margin-top: 14px; }

a.back {
  color: var(--muted); text-decoration: none;
  font-size: 34px;                 /* ← 뒤로가기 — 잘 보이게 2배 가까이 */
  line-height: .8;                 /* 글리프만 키우고 헤더 높이는 안 키움 */
  padding: 0 8px 4px 2px; margin-left: -4px;
  align-self: center;
}
a.back:active { color: var(--text); }

/* 연결 상태 점등 — SDS MCP 인디케이터처럼 */
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%;
       margin-right: 5px; vertical-align: 0; background: #22c55e;
       box-shadow: 0 0 6px rgba(34,197,94,.55); }
.dot.bad { background: var(--err); box-shadow: 0 0 6px rgba(248,113,113,.55); }
.dot.wait { background: #8a8f98; box-shadow: none; }   /* 연결 확인 중 */

/* ── 카드 ───────────────────────────────────────────────── */
.card {
  display: block; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 13px 14px; margin-bottom: 10px;
  color: inherit; text-decoration: none;
}
.card:active { background: var(--surface2); }
.card h2 { margin: 0 0 4px; font-size: 17px; font-weight: 650; }
.card p  { margin: 0; color: var(--muted); font-size: 14px; }
.card .ico { font-size: 26px; margin-bottom: 8px; display: block; }

/* ── 버튼·입력 ──────────────────────────────────────────── */
button, .btn {
  font: inherit; font-size: 15px; font-weight: 600;
  border: 1px solid var(--line); background: var(--surface2); color: var(--text);
  border-radius: 11px; padding: 11px 16px; cursor: pointer;
  min-height: 44px;                      /* 터치 타깃 */
}
button:active { opacity: .7; }
button.primary { background: var(--accent); border-color: var(--accent); color: #04211d; }
button.ghost   { background: transparent; }
button.danger  { color: var(--err); }
button:disabled { opacity: .4; }

input, textarea, select {
  font: inherit; font-size: 16px;        /* ★16px 미만이면 iOS가 확대함 */
  width: 100%; background: var(--surface); color: var(--text);
  border: 1px solid var(--line); border-radius: 11px; padding: 12px 14px;
}
textarea { resize: none; line-height: 1.5; }
input:focus, textarea:focus, select:focus { outline: 2px solid var(--accent-d); outline-offset: -1px; }
label.fld { display: block; margin-bottom: 12px; }
label.fld span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }

.row { display: flex; gap: 8px; align-items: center; }
.row > * { flex: 1; }
.row .shrink { flex: 0 0 auto; }

/* ── 크루 보드 (홈) ──────────────────────────────────────
   목적지를 이모지 박스 나열이 아니라 "누가 어디서 근무 중인가" 명부로.
   행 좌측의 시안 인디케이터가 활성 상태를 속삭인다. */
.board {
  background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden;
}
.board a.row {
  display: flex; align-items: center; gap: 12px;
  padding: 15px 16px;
  color: inherit; text-decoration: none;
  border-bottom: 1px solid var(--line);
  position: relative;
}
.board a.row:last-child { border-bottom: none; }
.board a.row::before {                       /* 좌측 인디케이터 — 평소엔 침묵 */
  content: ''; position: absolute; left: 0; top: 12px; bottom: 12px;
  width: 2px; border-radius: 2px; background: transparent;
  transition: background .15s;
}
.board a.row:active { background: var(--surface2); }
.board a.row:active::before { background: var(--accent); }
.row .r-main { min-width: 0; flex: 1; }
.row .r-title { font-weight: 650; font-size: 16px; letter-spacing: -.01em; }
.row .r-sub { color: var(--muted); font-size: 13px; margin-top: 3px; }
.row .crew { color: var(--accent); font-weight: 600; }   /* 담당 크루 */
.row .chev { color: var(--muted); opacity: .45; font-size: 20px; line-height: 1; }

/* 섹션 라벨 — 소리 낮춘 자간 라벨 (박스 제목 대신) */
.sec {
  font-size: 11px; font-weight: 650; letter-spacing: .14em;
  color: var(--muted); margin: 20px 2px 8px;
}

/* ── 홈 타일 그리드 — 기능이 늘어도 칸만 추가 ──────────────
   콤팩트 2열, 각 타일에 배지 슬롯 내장. */
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.tile {
  position: relative; display: block;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 12px;
  color: inherit; text-decoration: none;
  min-height: 76px;
}
.tile:active { background: var(--surface2); }
/* 타일 글씨는 '대화 글자 크기' 설정과 연동 (기본 15/12.5px — 종전보다 +1).
   버전·연결 상태줄은 고정 소형 유지 (index 인라인 11px) */
.tile .t-name { font-weight: 650; font-size: var(--chat-fs); letter-spacing: -.01em; }
.tile .t-sub  { color: var(--muted); font-size: calc(var(--chat-fs) - 2.5px);
                margin-top: 4px; line-height: 1.45; }
.tile .t-sub .crew { color: var(--accent); font-weight: 600; }
.tile .badge {
  position: absolute; top: 9px; right: 9px;
  min-width: 18px; padding: 1px 6px; font-size: 11px;
}
.tile.wide { grid-column: 1 / -1; min-height: 0; }

/* ── 헤더 톱니 + 설정 팝업 (전 페이지 공용 — app.js 가 생성) ── */
.gear {
  background: transparent; border: none; min-height: 40px;
  padding: 6px 8px; font-size: 19px; color: var(--muted); cursor: pointer;
}
.gear:active { color: var(--text); }
#mh-set-ov {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,.5); backdrop-filter: blur(2px);
  display: flex; align-items: flex-end; justify-content: center;
}
#mh-set {
  width: 100%; max-width: 480px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 16px 16px 0 0;
  padding: 6px 16px calc(env(safe-area-inset-bottom) + 14px);
  max-height: 82vh; overflow-y: auto;
}
#mh-set .s-head {
  display: flex; align-items: center; padding: 8px 0 4px;
}
#mh-set .s-head b { font-size: 15px; }
#mh-set .s-row {                       /* 한 줄 = 한 설정 (라벨 좌 · 컨트롤 우) */
  display: flex; align-items: center; gap: 10px;
  padding: 10px 0; border-bottom: 1px solid var(--line);
  font-size: 13.5px;
}
#mh-set .s-row:last-child { border-bottom: none; }
#mh-set .s-row .s-label { flex: 1; min-width: 0; }
#mh-set .s-row .s-label small { display: block; color: var(--muted); font-size: 11.5px; margin-top: 1px; }
#mh-set .s-row select { width: auto; font-size: 13.5px; padding: 7px 10px; }
#mh-set .s-row button { min-height: 36px; padding: 7px 12px; font-size: 13px; }
#mh-set .seg {                          /* 세그먼트 토글 (테마) */
  display: flex; border: 1px solid var(--line); border-radius: 9px; overflow: hidden;
}
#mh-set .seg button {
  border: none; border-radius: 0; min-height: 34px; padding: 6px 14px;
  font-size: 13px; background: transparent;
}
#mh-set .seg button.on { background: var(--accent); color: #04211d; }
:root[data-theme="light"] #mh-set .seg button.on { color: #fff; }
#mh-set input[type=range] { padding: 0; accent-color: var(--accent); height: 30px; width: 130px; }

/* ── 상태 ───────────────────────────────────────────────── */
.pill {
  display: inline-block; font-size: 12px; font-weight: 600;
  padding: 3px 9px; border-radius: 999px;
  background: var(--surface2); color: var(--muted); border: 1px solid var(--line);
}
.pill.run  { color: var(--warn);   border-color: #4a3d16; }
.pill.done { color: var(--accent); border-color: var(--accent-d); }
.pill.err  { color: var(--err);    border-color: #4a2020; }

.muted { color: var(--muted); font-size: 13px; }

/* 미읽음 배지 (대화방) */
.badge { display: inline-block; min-width: 20px; text-align: center;
         background: #ef4444; color: #fff; border-radius: 999px;
         font-size: 12px; font-weight: 700; padding: 2px 7px; line-height: 1.4; }
.empty { text-align: center; color: var(--muted); padding: 48px 16px; font-size: 14px; }
.err-box {
  background: #2a1414; border: 1px solid #4a2020; color: #fca5a5;
  border-radius: 11px; padding: 12px 14px; font-size: 14px; margin-bottom: 12px;
  white-space: pre-wrap; word-break: break-word;
}

/* ── 채팅 ───────────────────────────────────────────────── */
.chat {
  display: flex; flex-direction: column; gap: 10px;
  padding-top: 14px; padding-bottom: 8px;
}
/* ── 메시지 행 ── 말풍선 + 시각을 한 줄로 묶는다.
   시각이 정렬 반대쪽에 붙고 그만큼 여백이 생겨 좌우 구분이 또렷해진다
   (에이전트 답변이 '공지'처럼 꽉 차 보이던 문제 해결). */
.msg-row { display: flex; align-items: flex-end; gap: 7px; }
.msg-row.mine { justify-content: flex-end; }
.msg-row .ts {
  font-size: 13px; color: var(--muted); opacity: .8; line-height: 1.25;
  white-space: pre; flex: 0 0 auto; padding-bottom: 3px;
  text-align: left;                                /* 상대 메시지: 말풍선이 왼쪽 */
}
.msg-row.mine .ts { text-align: right; }           /* 내 메시지: 말풍선이 오른쪽 */
.msg-row .msg { max-width: calc(100% - 62px); }   /* 시각 자리를 항상 확보 */

.msg { border-radius: var(--radius); padding: 10px 13px; font-size: var(--chat-fs);
       white-space: pre-wrap; word-break: break-word; overflow-wrap: anywhere; }
.msg.me  { background: var(--me-bg); color: var(--me-text); align-self: flex-end;
           border: 1px solid var(--me-line);
           max-width: calc(100% - 62px); border-bottom-right-radius: 4px; }
.msg.ai  { background: var(--surface); border: 1px solid var(--line);
           align-self: flex-start; max-width: calc(100% - 62px);
           border-bottom-left-radius: 4px; }
.msg.tool{ background: transparent; border: 1px dashed var(--line); color: var(--muted);
           font-size: 13px; font-family: ui-monospace, Menlo, Consolas, monospace;
           padding: 8px 12px; }
/* 길게 눌러 복사할 때 네이티브 선택 팝업이 끼어들지 않게 */
.msg { -webkit-touch-callout: none; }
.msg.status { background: transparent; color: var(--muted); font-size: 13px; padding: 2px 4px; }
.msg.error { background: #2a1414; border: 1px solid #4a2020; color: #fca5a5; }

.composer {
  position: sticky; bottom: 0; z-index: 20;
  background: var(--bar-bg2); backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
  padding-top: 10px; padding-bottom: calc(env(safe-area-inset-bottom) + 10px);
  display: flex; gap: 8px; align-items: flex-end;
}
.composer textarea { flex: 1; max-height: 140px; min-height: 44px; padding: 11px 14px; }
.composer button { flex: 0 0 auto; }

/* ── 회의록 뷰 ──────────────────────────────────────────── */
.doc { font-size: var(--chat-fs); line-height: 1.65; }
.doc h1 { font-size: 20px; margin: 0 0 4px; }
.doc h2 { font-size: 16px; margin: 22px 0 8px; color: var(--accent);
          border-bottom: 1px solid var(--line); padding-bottom: 5px; }
.doc table { width: 100%; border-collapse: collapse; font-size: 14px; margin: 8px 0; }
.doc th, .doc td { border: 1px solid var(--line); padding: 7px 9px; text-align: left; }
.doc th { background: var(--surface2); }
.doc ul { padding-left: 20px; margin: 8px 0; }
.doc li { margin-bottom: 5px; }
.doc code { background: var(--surface2); padding: 1px 5px; border-radius: 4px; font-size: 13px; }
.scroll-x { overflow-x: auto; }

.spin { display: inline-block; width: 13px; height: 13px; vertical-align: -1px;
        border: 2px solid var(--line); border-top-color: var(--accent);
        border-radius: 50%; animation: sp .8s linear infinite; }
@keyframes sp { to { transform: rotate(360deg); } }

/* 헤더의 '처리 중' 스피너 — 2배 크기, 단 헤더 높이는 안 키운다
   (pill 세로 패딩을 줄여 총높이를 h1 라인 안에 맞춤) */
header.bar .pill { padding: 1px 9px; display: inline-flex; align-items: center; gap: 6px; }
header.bar .pill .spin { width: 22px; height: 22px; border-width: 3px; vertical-align: 0; }

/* ── 아이패드·데스크톱 (적응형) ──────────────────────────
   폰은 위 기본값 그대로. 화면이 넓어지면 본문 폭을 키우고
   카드 목록을 2열로 돌린다. 가로 모드도 그대로 지원. */

.grid2 { display: grid; gap: 12px; }

@media (min-width: 760px) {
  :root { --content: 860px; }
  /* 고정 열 수도, auto-fill 도 쓰지 않는다 — 둘 다 항목이 열보다 적으면
     빈 칸이 남아 왼쪽으로 쏠려 보인다(실측). auto-fit 은 빈 트랙을 접어서
     남은 항목들이 폭을 채운다. */
  .grid2, #sessions, #list {
    display: grid; gap: 12px;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  }
  .grid2 > .card, #sessions > .card, #list > .card { margin-bottom: 0; }
  .card .ico { font-size: 30px; }
  /* 긴 줄은 읽기 힘들다 — 본문 폭과 별개로 가독 폭을 제한 */
  .msg.ai, .msg.error { max-width: 68ch; }
  .doc { max-width: 74ch; }
  .empty { grid-column: 1 / -1; }
}

@media (min-width: 1180px) {
  :root { --content: 1000px; }
}

/* ── Master-Detail 분할 (폴드 펼침·패드·데스크톱) ─────────
   800px 이상: 목록 pane(좌, 고정폭) + 상세 pane(우)를 **동시에** 띄운다.
   좁은 화면: .split 은 그냥 block — JS가 기존처럼 화면을 전환한다.
   pane 안에서는 .wrap 의 중앙정렬 패딩 공식이 pane 폭 기준으로 다시 계산되므로
   상세 본문이 자동으로 가독 폭에 맞는다 (별도 override 불필요). */
@media (min-width: 800px) {
  .split {
    display: grid;
    position: relative;                       /* 스플리터 오버레이 기준 */
    grid-template-columns: var(--pane-w, 340px) minmax(0, 1fr);
    align-items: start;
  }
  /* 드래그로 목록 pane 폭 조절 — app.js 가 .split 에 자동 삽입 */
  .pane-splitter {
    position: absolute; top: 0; bottom: 0;
    left: calc(var(--pane-w, 340px) - 6px);
    width: 14px;                              /* 터치 잡기 좋게 넓게 */
    cursor: col-resize; z-index: 10; touch-action: none;
  }
  .pane-splitter::after {
    content: ''; position: absolute; left: 6px; top: 0; bottom: 0; width: 2px;
  }
  .pane-splitter:hover::after, .pane-splitter.drag::after {
    background: var(--accent-d);
  }
  .split > .pane-list {
    position: sticky; top: 58px;              /* sticky 헤더 아래 */
    max-height: calc(100dvh - 58px);
    overflow-y: auto;
    border-right: 1px solid var(--line);
    min-height: calc(100dvh - 58px);
  }
  /* 목록 pane 안 카드는 1열 강제 (auto-fit 이 pane 폭에서 어차피 1열이지만 명시) */
  .pane-list #sessions, .pane-list #list { grid-template-columns: 1fr; }
  /* 선택된 항목 표시 — 상세와의 연결이 눈에 보여야 한다 */
  .card.sel { border-color: var(--accent-d); background: var(--surface2); }
  .card.sel h2 { color: var(--accent); }
  /* ★.empty 의 grid-column: 1/-1 (카드 그리드용)이 여기서도 먹어
     placeholder 가 2번째 행 전체 폭으로 밀려난다 — 우측 칸 1행에 고정 */
  .split > .pane-ph { grid-column: 2; grid-row: 1; padding-top: 120px; }
}

@media (max-width: 799px) { .pane-splitter { display: none; } }

/* 터치 기기(폰·패드)에서는 타깃을 키운다 — Android 가이드 48dp */
@media (pointer: coarse) {
  button, .btn { min-height: 48px; }
  a.back { padding: 8px 12px 10px; }
}

/* 트랙패드·마우스가 있는 기기에서만 호버 (터치에서는 잔상이 남는다) */
@media (hover: hover) and (pointer: fine) {
  .card:hover   { background: var(--surface2); border-color: #33454f; }
  button:hover  { border-color: #3a4c57; }
  button.primary:hover { filter: brightness(1.08); }
  .board a.row:hover { background: var(--surface2); }
  .board a.row:hover::before { background: var(--accent); }
}

/* web v54 — 업무 이어보기와 읽기 중심의 공통 화면 */
[hidden] { display: none !important; }
:root { --header-h: 69px; --nav-h: 64px; }
button, .btn, a.back, .gear { min-width: 48px; min-height: 48px; }
button:disabled { cursor: default; }
a:focus-visible, button:focus-visible, summary:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 3px;
}
header.bar { gap: 8px; }
header.bar h1 { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
header.bar .spacer { min-width: 0; }
header.bar .pill { flex: 0 0 auto; font-size: 11px; max-width: 30vw; overflow: hidden; }
a.back { display: inline-flex; align-items: center; justify-content: center; padding: 0; flex: 0 0 48px; margin: 0; }
.gear { flex: 0 0 48px; }
body.has-nav { padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom)); }
body.chat-open { padding-bottom: 0; }
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 25; display: flex; justify-content: center;
  background: var(--bar-bg2); border-top: 1px solid var(--line); backdrop-filter: blur(12px);
  padding: 4px 16px calc(4px + env(safe-area-inset-bottom));
}
.bottom-nav a { flex: 1; max-width: 180px; min-height: 56px; display: flex; justify-content: center; align-items: center;
  color: var(--muted); text-decoration: none; font-size: 14px; font-weight: 650; border-radius: 12px; }
.bottom-nav a[aria-current] { color: var(--accent); background: var(--surface); }
.chat-open .bottom-nav { display: none; }
.chat-open .split, .chat-open #chatView { min-height: calc(var(--view-h, 100dvh) - var(--header-h)); }
#chatView { display: flex; flex-direction: column; min-width: 0; }
#chatView .chat { flex: 1; min-width: 0; }
.composer { margin-top: auto; }
.composer textarea { min-width: 0; min-height: 48px; }
.chat-page .chips { flex-wrap: nowrap; overflow-x: auto; padding: 0 0 2px; }
.chat-page .chips button { min-height: 48px; flex: 0 0 auto; }
.recipient { color: var(--muted); font-size: 12px; padding: 0 2px; }
.chat-page .att-acts button { min-width: 48px; min-height: 48px; padding: 7px 8px; }
.chat-page #mh-lb .lb-x { width: 48px; height: 48px; }
.msg, .msg-row, .msg .body { min-width: 0; }
.msg .body.doc { white-space: normal; }
.msg .body.doc p { margin: 0 0 8px; }
.msg .body.doc p:last-child { margin-bottom: 0; }
.msg .body.doc table { font-size: inherit; }
.doc pre { white-space: pre; overflow: auto; max-width: 100%; padding: 12px; background: var(--surface2); border-radius: 8px; }
.doc pre code { white-space: pre; padding: 0; font-size: inherit; overflow-wrap: normal; word-break: normal; }
.scroll-x { max-width: 100%; }
.new-replies { position: fixed; right: 16px; bottom: calc(210px + env(safe-area-inset-bottom)); z-index: 22;
  color: var(--accent); background: var(--surface); border-color: var(--accent-d); border-radius: 24px; }
#mh-toast { position: fixed; left: 50%; bottom: calc(90px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  z-index: 1000; background: var(--surface2); color: var(--text); border: 1px solid var(--accent-d); border-radius: 12px;
  padding: 12px 16px; max-width: calc(100vw - 32px); width: max-content; font-size: 14px; pointer-events: none; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 20px 0 12px; }
.section-head h2 { margin: 0; font-size: 17px; }
.section-head a { min-height: 48px; display: inline-flex; align-items: center; color: var(--muted); font-size: 13px; text-decoration: none; }
.home-head { display: flex; align-items: center; gap: 16px; margin: 4px 0 16px; }
.home-head > div { flex: 1; min-width: 0; }
.home-head img { width: 76px; height: auto; }
.home-head h1 { font-size: 20px; margin: 0; letter-spacing: -.02em; }
.home-head #status { margin: 2px 0 0; font-size: 12px; }
.recent-room { display: flex; align-items: center; gap: 12px; padding: 16px; }
.recent-room > div { min-width: 0; flex: 1; }
.recent-room h2 { font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.recent-room p { font-size: 13px; }
.pc-entry { margin-top: 16px; padding: 16px; }
#todayBody { gap: 8px !important; }
#todayBody a { min-height: 48px; display: inline-flex; align-items: center; gap: 6px; color: var(--text); text-decoration: none; padding: 4px 8px; }
#todayBody b { color: var(--accent); }
.filter-tabs { display: flex; gap: 4px; margin: 8px 0 12px; overflow-x: auto; }
.filter-tabs button { font-size: 13px; padding: 8px 10px; border: 0; background: transparent; white-space: nowrap; }
.filter-tabs button.on { background: var(--surface2); color: var(--accent); }
.list-card { display: flex; align-items: center; padding: 4px 8px 4px 4px; gap: 4px; }
.list-card .item-main { min-width: 0; flex: 1; padding: 12px 8px; text-align: left; border: 0; font-weight: 400; }
.list-card .item-main h2 { font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-card .item-main p { font-size: 12px; overflow-wrap: anywhere; }
.list-card .item-more { flex: 0 0 48px; padding: 4px; border: 0; font-size: 22px; }
#sessionSearch { margin-bottom: 12px; }
.mh-sheet { width: calc(100% - 24px); max-width: 520px; max-height: 88dvh; margin: auto auto 0;
  background: var(--surface); color: var(--text); border: 1px solid var(--line); border-radius: 16px 16px 0 0;
  padding: 16px 16px calc(16px + env(safe-area-inset-bottom)); overflow-y: auto; }
.mh-sheet::backdrop { background: rgba(0,0,0,.6); }
.sheet-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.sheet-head h2 { flex: 1; font-size: 18px; margin: 0; overflow-wrap: anywhere; }
.menu-actions { display: grid; gap: 8px; }
.menu-actions button { text-align: left; }
.selected-file { overflow-wrap: anywhere; font-size: 14px; }
#pickBtn { margin-bottom: 16px; }
#removeFile { margin: 0 0 12px; }
.actions-primary { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.actions-primary button { flex: 1; }
summary { min-height: 48px; cursor: pointer; padding: 12px 0; font-size: 14px; color: var(--muted); }
.more-actions { border-top: 1px solid var(--line); }
#mh-set .s-row button, #mh-set .seg button, #mh-set .s-row select, #mh-set input[type=range] { min-height: 48px; }
#mh-set .s-row { flex-wrap: wrap; }
#mh-set .s-row .s-label { min-width: 90px; }
#mh-set input[type=range] { max-width: 110px; }
@media (min-width: 800px) {
  .split > .pane-list { top: var(--header-h); max-height: calc(100dvh - var(--header-h) - var(--nav-h)); min-height: 0; }
  .chat-open .split > .pane-list { max-height: calc(var(--view-h,100dvh) - var(--header-h)); }
  .split { grid-template-columns: minmax(240px, min(var(--pane-w,340px),45%)) minmax(0,1fr); }
  .pane-splitter { left: calc(min(var(--pane-w,340px),45%) - 6px); }
  .mh-sheet { margin: auto; border-radius: 16px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; } }

#todayCard { margin-top: 16px; padding: 8px 12px; }
#todayCard h2 { display: none; }

/* web v55 — 에이전트 답변 서식: 사용자 기본 크기 + 0/2/4px. */
.msg.agent, .msg.ai {
  --reply-key: #2dd4bf;
  --reply-warning: #fbbf24;
  --reply-success: #86efac;
  --reply-info: #93c5fd;
}
:root[data-theme="light"] .msg.agent, :root[data-theme="light"] .msg.ai {
  --reply-key: #0f766e;
  --reply-warning: #92400e;
  --reply-success: #166534;
  --reply-info: #1d4ed8;
}
:is(.msg.agent, .msg.ai) .body.doc { font-size: var(--chat-fs); font-weight: 400; }
:is(.msg.agent, .msg.ai) .body.doc :is(h1,h2,h3,h4,h5,h6) {
  color: var(--text); font-weight: 700; line-height: 1.4;
  margin: 16px 0 8px; padding: 0; border: 0; letter-spacing: -.01em;
  font-size: calc(var(--chat-fs) + 2px);
}
:is(.msg.agent, .msg.ai) .body.doc h1 { font-size: calc(var(--chat-fs) + 4px); }
:is(.msg.agent, .msg.ai) .body.doc > :first-child { margin-top: 0; }
:is(.msg.agent, .msg.ai) .body.doc strong { font-weight: 700; }
:is(.msg.agent, .msg.ai) .body.doc :is(table,code) { font-size: 1em; }
:is(.msg.agent, .msg.ai) .body.doc .reply-tone-key { color: var(--reply-key); }
:is(.msg.agent, .msg.ai) .body.doc .reply-tone-warning { color: var(--reply-warning); }
:is(.msg.agent, .msg.ai) .body.doc .reply-tone-success { color: var(--reply-success); }
:is(.msg.agent, .msg.ai) .body.doc .reply-tone-info { color: var(--reply-info); }

/* web v56 — 더 큰 EYESCREAM 로고와 바로 보이는 시작 메뉴. */
.home-wrap {
  padding-top: calc(env(safe-area-inset-top) + 24px);
  padding-left: max(20px, calc((100% - var(--content)) / 2));
  padding-right: max(20px, calc((100% - var(--content)) / 2));
}
.home-wrap .home-head {
  display: grid; grid-template-columns: minmax(0,1fr) 48px;
  align-items: center; gap: 16px; margin: 0 0 32px;
}
.home-wrap .home-head img { width: 152px; height: auto; grid-column: 1; grid-row: 1; }
.home-wrap .home-head .gear { grid-column: 2; grid-row: 1; }
.home-wrap .home-head .home-brand { grid-column: 1 / -1; grid-row: 2; }
.home-wrap .home-head h1 { font-size: 22px; line-height: 1.35; font-weight: 700; }
.home-wrap .home-head #status { margin-top: 8px; overflow-wrap: anywhere; }
.home-wrap .section-head { margin: 0 0 16px; }
.home-wrap .tiles { gap: 16px; }
.home-wrap .tile { padding: 16px; min-height: 88px; }
.home-wrap .pc-entry { margin-top: 16px; }
.home-wrap .home-recent { margin-top: 32px; }
.home-wrap #recentRooms { display: grid; gap: 16px; }
.home-wrap .recent-room { margin: 0; }
.home-wrap #todayCard { margin-top: 24px; }

/* web v57 — 로고와 이름을 나란히, 복사는 말풍선에서 확인. */
.home-wrap .home-head {
  grid-template-columns: 152px minmax(0,1fr) 48px;
  column-gap: 8px; row-gap: 12px;
}
.home-wrap .home-head .home-brand { grid-column: 2; grid-row: 1; }
.home-wrap .home-head .gear { grid-column: 3; grid-row: 1; }
.home-wrap .home-head h1 { font-size: 18px; line-height: 1.25; }
.home-wrap .home-head h1 span { display: block; white-space: nowrap; }
.home-wrap .home-head #status { grid-column: 1 / -1; grid-row: 2; margin: 0; }
.msg.copy-confirmed { outline: 2px solid var(--accent); outline-offset: 2px; }
.mh-sr-only {
  position: fixed; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0;
}
@media (min-width: 600px) {
  .home-wrap .home-head h1 { font-size: 22px; }
  .home-wrap .home-head h1 span { display: inline; }
}

/* web v58 — 기존 로고의 70%, 영문 이름은 한 줄. */
.home-wrap .home-head { grid-template-columns: 106.4px minmax(0,1fr); column-gap: 12px; row-gap: 8px; }
.home-wrap .home-head img { width: 106.4px; }
.home-wrap .home-head h1 { font-size: 16px; white-space: nowrap; }
.home-wrap .home-head .gear { grid-column: 2; grid-row: 2; justify-self: end; }
.home-wrap .home-head #status { max-width: calc(100% - 64px); }
@media (min-width: 380px) { .home-wrap .home-head h1 { font-size: 18px; } }
@media (min-width: 600px) { .home-wrap .home-head h1 { font-size: 22px; } }
@media (max-width: 359px) { .home-wrap .home-head h1 { font-size: 14px; } }
