/* =====================================================
   학생 태블릿 표면 (.surface-app-wide)
   스토리보드는 학생의 기본 디바이스를 태블릿 가로로 잡는다(ST-07 "기본 디바이스").
   그래서 넓은 화면은 폰 레이아웃을 가운데 정렬한 '큰 폰'이 아니라 제 몫의 표면이다.

   이 파일은 .surface-app-wide 안에서만 동작한다 — 720px 미만은 아예 이 클래스가
   붙지 않으므로 모바일 레이아웃은 한 줄도 건드리지 않는다.
   ===================================================== */

.surface-app-wide { background: var(--paper-dim); }
.surface-app-wide .frame.tablet {
  width: 100%; height: 100%;
  border: none; border-radius: 0; box-shadow: none;
  flex-direction: row; display: flex;
}

/* ---------- 좌측 레일 (하단 탭바를 세운 것) ---------- */
.a-rail {
  width: 96px; flex-shrink: 0; background: #fff;
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 4px;
  /* 위·아래 안전영역(상태바·작업표시줄)만큼 더 비운다 */
  padding: calc(14px + var(--sa-top)) 10px calc(14px + var(--sa-bottom));
  padding-left: calc(10px + var(--sa-left));
}
.a-rail-mark {
  height: 34px; display: flex; align-items: center; justify-content: center;
  color: var(--ink); margin-bottom: 10px;
}
.a-rail-mark .sym { width: 26px; height: 19px; }

.ar-item {
  position: relative; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 5px;
  padding: 12px 4px; border-radius: 14px;
  color: var(--ink-25); font-size: 10.5px; font-weight: 700;
  transition: background .14s, color .14s;
}
.ar-item .mi { font-size: 19px; line-height: 1; }
.ar-item.on { color: var(--ink); background: var(--paper-dim); }
.ar-item.on::after {
  content: ''; position: absolute; left: 6px; top: 50%; transform: translateY(-50%) rotate(45deg);
  width: 4px; height: 4px; border-radius: 1px; background: var(--lime-deep);
}
.ar-item:not(.on):hover { color: var(--ink-70); background: var(--paper-dim); }
.ar-item .mn-badge { position: absolute; top: 7px; right: 12px; }

/* ---------- 본문 ---------- */
.a-main { flex: 1; min-width: 0; display: flex; flex-direction: column; background: var(--paper); }
/* 상단바(.a-top)를 뺀 화면(상담 등) — 본문의 흰 머리(채팅·상대 정보)가 곧 상단이다.
   상태바(안전영역)만큼만 비워 그 위에 겹치지 않게 한다. */
.a-main.notop { padding-top: var(--sa-top); }
/* 그때는 본문 여백도 없앤다 — 채팅 머리가 가장자리(상단바 자리)에 딱 붙어야 한다.
   (.a-body.fill 은 기본 .a-body 의 20/26 여백을 물려받으므로 여기서 0 으로 덮는다) */
.a-main.notop .a-body.fill { padding: 0 0 var(--sa-bottom); }
/* 채팅 머리 높이를 다른 메뉴의 상단바(.a-top 62px)와 맞춘다 */
.a-main.notop .ibx { --ch-head-h: 62px; }
/* 상단바가 곧 채팅 머리이므로 위쪽 모서리는 각지게 둔다(라운드 제거) */
.surface-app-wide .frame.tablet, .a-main.notop,
.a-main.notop .a-body.fill, .a-main.notop .ibx-side, .a-main.notop .ibx-main,
.a-main.notop .ibx.in-frame { border-radius: 0; }
/* 채팅이 곧 화면이라 «카드 틀»의 테두리는 없앤다 — 꼭지점의 둥근 테두리가 사라진다 */
.a-main.notop .ibx.in-frame { border: none; }

.a-top {
  min-height: 62px; flex-shrink: 0; display: flex; align-items: center; gap: 16px;
  /* 상단 상태바(안전영역)만큼 위를 비운다 — 안 그러면 제목이 상태바에 겹친다 */
  padding: var(--sa-top) 26px 0;
  padding-right: calc(26px + var(--sa-right));
  border-bottom: 1px solid var(--line);
}
.a-head { min-width: 0; }
.a-title { font-size: 19px; font-weight: 800; letter-spacing: -.03em; }
.a-sub { font-size: 11px; color: var(--ink-45); font-weight: 600; margin-top: 1px; }
.a-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
/* 상단바로 올라온 컨트롤들은 앱바 안의 여백 규칙 대신 제 크기를 쓴다 */
.a-actions .seg { margin: 0; width: auto; }
.a-actions .seg button { padding: 7px 14px; white-space: nowrap; }
.a-actions .range-seg { margin: 0; }
.a-actions .acad-row { margin: 0; padding: 0; overflow: visible; }

.a-body {
  flex: 1; min-height: 0; overflow-y: auto;
  /* 하단은 작업표시줄(안전영역)만큼 더 비운다 — 안 그러면 스크롤 끝 내용이 그 아래로 깔린다 */
  padding: 20px 26px calc(28px + var(--sa-bottom));
  padding-right: calc(26px + var(--sa-right));
}

/* 2단 — 왼쪽이 주 작업, 오른쪽이 곁다리.
   큰 모니터에서 줄 길이가 늘어지지 않게 상한을 두고 가운데로 모은다. */
.a-cols {
  display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(300px, 1fr);
  gap: 22px; align-items: start; max-width: 1240px; margin: 0 auto;
  /* flex 컨테이너(관리자 .d-body) 안에서는 교차축 auto 마진이 stretch 를 이겨
     그리드가 내용 크기로 쪼그라든다. 폭을 명시해야 두 표면에서 같게 나온다. */
  width: 100%;
}
.a-cols.one { grid-template-columns: minmax(0, 1fr); max-width: 900px; }
/* 달력은 정사각 칸이라 폭이 커지면 세로도 같이 커진다 — 상한을 두고 목록에 더 준다 */
.a-cols.cal { grid-template-columns: minmax(0, 1fr) minmax(320px, 1.05fr); }
.a-cols.cal .a-col:first-child { max-width: 620px; }
.a-col { min-width: 0; }

/* 좁은 태블릿 세로(720–899)에서는 2단이 서로를 눌러 버린다 — 한 단으로 되돌린다 */
@media (max-width: 899px) {
  .a-cols { grid-template-columns: minmax(0, 1fr); }
  .a-col.side { display: contents; }
}

/* 태블릿에서 첫 블록 위 여백은 .a-body 가 이미 갖고 있다 */
.a-body > .a-cols > .a-col > .sec-label:first-child { margin-top: 0; }
.a-body .hero { margin-top: 0; }

/* 넓은 칸의 달력 — 칸이 커지는 만큼 글자도 키운다.
   폰 기준(10.5px)을 그대로 두면 큰 정사각형 안에 작은 숫자가 떠 있게 된다. */
.a-cols.cal .cal-mon { font-size: 17px; }
.a-cols.cal .cal-dw { font-size: 10px; padding: 6px 0; }
/* 폰에서는 정사각(aspect-ratio:1)이 맞지만, 폭이 넓어지면 칸이 74px 짜리 정사각이 되어
   달력만 500px 가까이 늘어진다. 넓은 칸에서는 높이를 따로 정한다. */
.a-cols.cal .cal-d {
  font-size: 13.5px; gap: 4px; border-radius: 12px;
  aspect-ratio: auto; min-height: 52px;
}
.a-cols.cal .cal-d .dots { height: 5px; }
.a-cols.cal .cal-d .dt { width: 5px; height: 5px; }
.a-cols.cal .cal-grid { gap: 4px; }

/* ---------- 지표 카드 · 차트 (ST-06) ---------- */
.a-col .ts-grid.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
/* 폰 기준 막대(15px)를 그대로 늘린 폭에 놓으면 그래프가 아니라 흩뿌린 점처럼 보인다.
   막대를 키우고 차트 자체의 폭에 상한을 둬 의도한 크기로 읽히게 한다. */
.surface-app-wide .wk-chart { height: 136px; max-width: 700px; margin: 0 auto; gap: 10px; }
.surface-app-wide .wk-bar { width: 26px; }
/* 홈의 «이번 주 학습»은 카드 폭을 다 쓴다 — 통계 화면의 «가운데 700px» 상한이 여기까지
   따라와 막대가 한가운데로 몰려 있었다. 좁은 칸에서는 상한이 필요 없고, 막대는 칸 수에
   맞춰 스스로 늘어난다(7일이면 일곱 칸이 나눠 갖는다). */
/* 아래 묶음(학원 소식 · 선생님) — 왼쪽 «내 문제집»과 어깨를 맞춘다.
   남는 높이는 소식 목록이 가져간다(카드가 늘어나 빈 자리가 생기지 않게). */
/* 아래 묶음 — 남는 높이는 «맨 끝»에 둔다(가운데 칸이 부풀지 않게) */
.surface-app-wide .a-bot-pair { display: flex; flex-direction: column; justify-content: flex-start; }
.surface-app-wide .a-bot-pair > * { flex: 0 0 auto; }
.surface-app-wide .a-bot-pair .notice { flex-shrink: 0; }
.surface-app-wide .a-bot-pair > .sec-label:first-child { margin-top: 33px; }

.surface-app-wide .a-top-pair .wk-chart { max-width: none; margin: 0; }
.surface-app-wide .a-top-pair .wk-bar { width: 100%; max-width: 34px; }
.surface-app-wide .wk-day { font-size: 10px; }

/* ---------- 목록 2열 (ST-02 오답·단어) ---------- */
.a-grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; align-items: start; }
@media (max-width: 1099px) { .a-grid2 { grid-template-columns: minmax(0, 1fr); } }

/* ---------- 상담 마스터-디테일 (PA-02) ----------
   폰은 목록 → 방으로 «이동»하지만, 태블릿은 둘을 나란히 두고 방만 갈아 끼운다.
   채팅은 각 칸이 따로 스크롤해야 해서 바깥 스크롤을 끄고 높이를 채운다. */
.a-body.fill {
  overflow: hidden; display: flex; min-height: 0;
  padding-bottom: calc(20px + var(--sa-bottom));
}
.a-body.fill > .a-cols { height: 100%; align-items: stretch; }
.a-cols.chat { grid-template-columns: minmax(260px, 1fr) minmax(0, 2fr); }
.a-cols.chat .a-col { min-height: 0; display: flex; flex-direction: column; }
.a-cols.chat .chat-list {
  flex: 1; min-height: 0; overflow-y: auto;
  border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--paper);
}
.a-cols.chat .chat-pane {
  flex: 1; min-height: 0; display: flex; flex-direction: column;
  border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; background: var(--paper);
}
.chat-pane-head {
  display: flex; align-items: center; gap: 10px; flex-shrink: 0;
  padding: 12px 16px; border-bottom: 1px solid var(--line);
}
.chat-pane .ch-room { flex: 1; min-height: 0; }
.chat-pane .ch-msgs { min-height: 0; }
/* 선택된 방 강조 — 폰에는 «선택»이라는 상태가 없어 태블릿에서만 필요하다.
   예전에는 배경 + 왼쪽 검은 표시선 두 가지로 알렸는데, 신호가 겹쳐 시끄러웠다.
   지금은 줄 전체를 색으로 채우는 한 가지로 말한다(css/app.css 의 .chl-row.on). */

/* ---------- 알림·더보기 동시 노출 (EX-01) ---------- */
.a-pane-t {
  font-size: 12px; font-weight: 800; color: var(--ink-70);
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin-bottom: 10px;
}

/* 태블릿에서는 시트 대신 여백이 넉넉하므로 카드가 눌리지 않게 최소 폭을 준다 */
.surface-app-wide .card { margin-top: 10px; }
/* 섹션 이름 위는 넉넉히 — 태블릿은 한 칸에 카드가 여럿 쌓이는 자리라, 18px 로는
   앞 카드에 붙어 «그 카드의 꼬리»처럼 읽힌다. 이름 앞에서 한 번 끊어 준다. */
.surface-app-wide .sec-label { margin-top: 33px; }
.surface-app-wide .a-col > .sec-label:first-child { margin-top: 0; }
