/* 포탈 앱 셸 — 하단 탭바 · 홈 대시보드 · '전체' 탭 · 화면 전환 (2026-11-03 운영자: 포탈이 앱스럽지 않다).
   portal/base.html 에서만 싣는다. 외부 설문·스터디룸 공개 화면도 portal.css 를 쓰므로 그쪽에 섞지 말 것. */

html { -webkit-text-size-adjust: 100%; }
body { -webkit-tap-highlight-color: transparent; }

/* ===== 화면 전환 — 같은 출처 이동에서 새 화면이 살짝 떠오른다 (iOS 18.2+ / Chrome 126+, 나머지는 그냥 이동) ===== */
@view-transition { navigation: auto; }

::view-transition-old(root) { animation: ap-vt-out 0.16s ease both; }
::view-transition-new(root) { animation: ap-vt-in 0.24s cubic-bezier(0.2, 0.7, 0.2, 1) both; }

@keyframes ap-vt-out { to { opacity: 0; } }
@keyframes ap-vt-in { from { opacity: 0; transform: translateY(10px); } }

/* 탭바·헤더는 화면이 바뀌어도 제자리에 — 전환에서 따로 떼어 둔다 */
.pt-tabbar { view-transition-name: ap-tabbar; }
.ap-header { view-transition-name: ap-header; }
::view-transition-old(ap-tabbar), ::view-transition-new(ap-tabbar),
::view-transition-old(ap-header), ::view-transition-new(ap-header) { animation: none; }

@media (prefers-reduced-motion: reduce) {
  ::view-transition-old(root), ::view-transition-new(root) { animation: none; }
}

/* 누르는 순간의 반응 — 손가락 아래가 살짝 눌린다 */
.ap-press, .pt-action-lab, .pt-action-setup, .pt-btn, .pt-tab {
  transition: transform 0.12s ease, background 0.15s ease, border-color 0.15s ease, opacity 0.15s ease;
}
.ap-press:active, .pt-action-lab:active, .pt-action-setup:active, .pt-btn:active { transform: scale(0.98); }

/* ===== 웹 헤더 — 애플식 얇은 띠 (앱 안에서는 base.html 이 그리지 않는다) ===== */
.ap-header {
  position: sticky;
  top: 0;
  z-index: 900;
  height: calc(48px + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) 16px 0;
  background: rgba(22, 46, 35, 0.92);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  backdrop-filter: saturate(180%) blur(16px);
}
.ap-brand { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; }
.ap-brand .pt-mark { height: 18px; color: #fbfbfa; transform: none; }

/* ===== 하단 탭바 ===== */
.pt-tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 950;
  padding-bottom: env(safe-area-inset-bottom);
  background: rgba(251, 251, 250, 0.88);
  -webkit-backdrop-filter: saturate(180%) blur(18px);
  backdrop-filter: saturate(180%) blur(18px);
  border-top: 1px solid rgba(22, 46, 35, 0.1);
}
.pt-tabbar-in {
  display: flex;
  max-width: 480px;
  margin: 0 auto;
  height: 56px;
}
.pt-tab {
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: #8a948e;
  text-decoration: none;
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: -0.01em;
}
.pt-tab .pt-ico { width: 24px; height: 24px; }
.pt-tab.is-active { color: #162E23; font-weight: 700; }
.pt-tab.is-active .pt-ico { stroke-width: 2.2; }
.pt-tab:active { opacity: 0.6; }

/* 탭바가 있는 화면은 본문 끝이 탭바에 가리지 않게 */
body:has(.pt-tabbar) .pt-main { padding-bottom: calc(96px + env(safe-area-inset-bottom)); }

/* 탭바보다 위에 떠야 하는 것 — 모달(1100)·토스트(1000)는 이미 높다 */

/* ===== 공통 아이콘 ===== */
.pt-ico { display: block; width: 22px; height: 22px; flex: none; }

/* ===== 세부 화면 머리 — 뒤로 + 큰 제목 ===== */
.pt-back {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  height: 34px;
  margin: -6px 0 4px -8px;
  padding: 0 8px 0 2px;
  border-radius: 5px;
  color: #2a5440;
  font-size: 15px;
  font-weight: 500;
  text-decoration: none;
}
.pt-back .pt-ico { width: 22px; height: 22px; stroke-width: 2.2; }
.pt-back:active { background: rgba(22, 46, 35, 0.06); }

.pt-title--page {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.25;
  margin: 2px 0 16px;
}
.pt-title--page .pt-mark { display: none; }

/* ===== 홈 대시보드 ===== */
.ap-kicker {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: #5d6b64;
  margin-bottom: 10px;
}
.ap-kicker .pt-mark { height: 14px; color: #5d6b64; transform: none; }

.ap-switch {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  margin: 0 -16px 14px;
  padding: 0 16px;
  scrollbar-width: none;
}
.ap-switch::-webkit-scrollbar { display: none; }
.ap-switch-chip {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 32px;
  padding: 0 14px;
  border: 1px solid #e6e8e7;
  border-radius: 6px;
  background: #fff;
  color: #2a5440;
  font-size: 13.5px;
  font-weight: 600;
  text-decoration: none;
}
.ap-switch-chip.is-on { background: #162E23; border-color: #162E23; color: #fbfbfa; }

.ap-hero { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 10px; margin-bottom: 18px; }
.ap-hero-name { font-size: 28px; font-weight: 700; letter-spacing: -0.025em; line-height: 1.2; }
.ap-hero-meta { flex-basis: 100%; font-size: 13px; color: #5d6b64; }

/* 홈 맨 위 카드들 사이 간격 */
/* 앱 배너는 홈 맨 꼭대기 — 이름 위 */
.ap-kicker ~ .pt-app-band, .pt-app-band:first-child { margin-top: 0; }
.ap-hero ~ .pt-action-setup { margin-bottom: 12px; }
.pt-action-setup { display: flex; }

/* 오늘 카드 — 홈의 유일한 그라데이션 강조 */
.ap-today {
  position: relative;
  display: block;
  padding: 18px 44px 18px 18px;
  margin-bottom: 12px;
  border-radius: 6px;
  background: linear-gradient(160deg, #162E23, #1f4434);
  color: #fbfbfa;
  text-decoration: none;
  box-shadow: 0 4px 12px rgba(22, 46, 35, 0.08);
}
.ap-today-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.ap-today-date { font-size: 12.5px; font-weight: 600; color: rgba(251, 251, 250, 0.72); }
.ap-today-pill {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  background: rgba(251, 251, 250, 0.14);
  color: #fbfbfa;
}
.ap-today-pill--in::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  margin-right: 6px;
  background: #6fd39b;
  box-shadow: 0 0 0 3px rgba(111, 211, 155, 0.25);
}
.ap-today-pill--out { background: rgba(240, 196, 120, 0.22); color: #f6dcae; }
.ap-today-pill--off { background: rgba(251, 251, 250, 0.1); color: rgba(251, 251, 250, 0.7); }
.ap-today-sub { font-size: 12px; color: rgba(251, 251, 250, 0.6); margin-bottom: 2px; }
.ap-today-main {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.02em;
  font-feature-settings: "tnum";
}
.ap-today-main span { font-size: 16px; font-weight: 600; margin-left: 4px; color: rgba(251, 251, 250, 0.85); }
.ap-today-main--quiet { font-size: 17px; font-weight: 600; color: rgba(251, 251, 250, 0.85); }
.ap-today-plans { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }
.ap-today-plan {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 8px;
  border-radius: 4px;
  font-size: 11.5px;
  font-weight: 600;
  font-feature-settings: "tnum";
  background: rgba(251, 251, 250, 0.08);
  color: rgba(251, 251, 250, 0.72);
}
.ap-today-plan.is-next { background: #fbfbfa; color: #162E23; }
.ap-today-go { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); color: rgba(251, 251, 250, 0.55); }

/* 이번 달 아웃카운트 한 줄 */
.ap-stat {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 8px 12px;
  padding: 14px 16px;
  margin-bottom: 8px;
  border: 1px solid #e6e8e7;
  border-radius: 6px;
  background: #fff;
  color: #162E23;
  text-decoration: none;
}
.ap-stat-label { font-size: 13px; font-weight: 600; color: #5d6b64; }
.ap-stat-value { font-size: 17px; font-weight: 700; font-feature-settings: "tnum"; }
.ap-stat-value small { font-size: 12px; font-weight: 500; color: #8a948e; }
.ap-stat-bar { grid-column: 1 / -1; height: 4px; border-radius: 2px; background: #eef2f0; overflow: hidden; }
.ap-stat-bar span { display: block; height: 100%; background: #2a5440; }
.ap-stat.is-high .ap-stat-bar span { background: #b0503e; }
.ap-stat.is-high .ap-stat-value { color: #8c2f2f; }

/* 코칭랩 — 이번 주 신청 현황 요약 (상태 칩 · 세션 날짜 · 남은 자리) */
.ap-lab {
  position: relative;
  display: block;
  padding: 14px 40px 14px 16px;
  margin-bottom: 8px;
  border: 1px solid #e6e8e7;
  border-radius: 6px;
  background: #fff;
  color: #162E23;
  text-decoration: none;
}
.ap-lab-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.ap-lab-label { font-size: 13px; font-weight: 600; color: #5d6b64; }
.ap-lab-chip {
  display: inline-flex; align-items: center; justify-content: center;
  height: 22px; padding: 0 9px; border-radius: 999px;
  font-size: 11.5px; font-weight: 600;
  background: #eef2f0; color: #5d6b64;
}
.ap-lab.is-applied .ap-lab-chip { background: #162E23; color: #fbfbfa; }
.ap-lab.is-open .ap-lab-chip { background: #dfece4; color: #1f4434; }
.ap-lab.is-full .ap-lab-chip { background: #f4e6e3; color: #8c2f2f; }
.ap-lab-main { margin-top: 6px; font-size: 17px; font-weight: 700; letter-spacing: -0.01em; font-feature-settings: "tnum"; }
.ap-lab-sub { margin-top: 2px; font-size: 13px; color: #4a5a52; font-feature-settings: "tnum"; }
.ap-lab-sub b { font-weight: 700; color: #162E23; }
.ap-lab-days { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.ap-lab-day {
  font-size: 12px; font-weight: 600; padding: 3px 8px; border-radius: 4px;
  background: #dfece4; color: #1f4434; font-feature-settings: "tnum";
}
.ap-lab-day.is-off { background: #eef2f0; color: #8a948e; }
.ap-lab-foot { margin-top: 8px; padding-top: 8px; border-top: 1px solid #eef2f0; font-size: 11.5px; color: #8a948e; }
.ap-lab-go { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); color: #a3aca7; }

/* 등록 안내 할 일 — 미완료 학부모에게만, 학생 머리 바로 아래 (2026-11-03 운영자: 더 부각).
   강조는 따뜻한 바탕 + 아이콘 칸 + 진녹 버튼으로. 왼쪽 굵은 띠는 운영자가 싫어한다 — 넣지 말 것.
   그라데이션은 오늘 카드 하나뿐. */
.ap-setup {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 0 0 14px;
  padding: 16px;
  background: #fdf7ed;
  border: 1px solid #efd7ad;
  border-radius: 6px;
  box-shadow: 0 2px 10px rgba(150, 106, 34, 0.08);
  color: #162E23;
  text-decoration: none;
}
.ap-setup-head { display: flex; align-items: center; gap: 12px; }
.ap-setup-icon {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 6px;
  background: #f5e2bd;
  color: #9a6a1f;
}
.ap-setup-icon svg { position: static; }
.ap-setup-heading { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ap-setup-badge {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: #a8721f;
}
.ap-setup-title {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.35;
}
.ap-setup-sub {
  font-size: 13px;
  line-height: 1.5;
  color: #7a5a2c;
}
.ap-setup-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  align-self: stretch;
  height: 42px;
  border-radius: 5px;
  background: #162E23;
  color: #fff;
  font-size: 14.5px;
  font-weight: 600;
}
.ap-setup-btn span { font-size: 18px; line-height: 1; }

/* 묶음 라벨 — 홈 바로가기 */
.pt-main > .pt-action-group-label { margin: 22px 2px 8px; }
.pt-main > .pt-action-lab { margin-bottom: 8px; }

/* 바로가기 타일 — 아이콘 위 · 이름 아래 */
.ap-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.ap-grid:empty { display: none; }
.pt-tile.ap-tile {
  flex-direction: column;
  gap: 8px;
  height: auto;
  min-height: 92px;
  padding: 14px 8px 12px;
  background: #fff;
  text-align: center;
  line-height: 1.3;
  word-break: keep-all;
}
.ap-tile-ico {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 6px;
  background: #eef3f0;
  color: #2a5440;
}
.ap-tile-label { font-size: 12.5px; font-weight: 600; }

/* ===== '전체' 탭 — 묶음별 목록 ===== */
.ap-list-label {
  font-size: 12px;
  font-weight: 600;
  color: #8a948e;
  margin: 22px 4px 8px;
}
.ap-list {
  border: 1px solid #e6e8e7;
  border-radius: 6px;
  background: #fff;
  overflow: hidden;
}
.ap-row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 52px;
  padding: 0 12px 0 14px;
  color: #162E23;
  text-decoration: none;
  font-size: 15px;
  font-weight: 500;
}
.ap-row + .ap-row { border-top: 1px solid #eef0ef; }
.ap-row:active { background: #f3f6f4; transform: none; }
.ap-row-ico {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 6px;
  background: #eef3f0;
  color: #2a5440;
}
.ap-row-ico .pt-ico { width: 19px; height: 19px; }
.ap-row-label { flex: 1; min-width: 0; }
.ap-row-value { font-size: 14px; color: #5d6b64; font-feature-settings: "tnum"; }
.ap-row-go { color: #b4bcb8; }
.ap-row-go .pt-ico { width: 18px; height: 18px; }
.ap-row--danger { color: #8c2f2f; }
.ap-row--danger .ap-row-ico { background: #f9ecec; color: #8c2f2f; }
.ap-list + .ap-list-label { margin-top: 26px; }

/* ===== 펼친 폴더블·패드(≥769) — 2026-11-15 운영자: 펼친 듀오 밸런스 =====
   480px 기둥이면 펼친 화면(약 880~1100px)의 절반이 비어 폰 화면을 띄워 놓은 것처럼 보였다.
   본문·탭바·토스트를 640px 로 넓히고 홈 바로가기는 네 칸. portal.css 는 외부 설문·스터디룸
   공개 화면이 함께 쓰므로 여기(포탈 base 만 싣는 파일)에 둔다. */
@media (min-width: 769px) {
  .pt-main { max-width: 640px; }
  .pt-tabbar-in { max-width: 640px; }
  .pt-message--success { max-width: 608px; }
  .ap-grid { grid-template-columns: repeat(4, 1fr); }
  .rp-kpi-row { grid-template-columns: repeat(4, 1fr); }
}
