:root {
  /* studycore.kr 브랜드 톤 — 딥 네이비 + 틸 강조, 웜 페이퍼 */
  --bg: #f4f2ee;            /* 웜 페이퍼 */
  --card: #ffffff;
  --ink: #191919;
  --ink-soft: #6b7178;
  --line: #e3e0da;          /* 웜 보더 */
  --primary: #103050;       /* 딥 네이비(브랜드 주색) */
  --primary-soft: #e8eef4;
  --accent: #57adb1;        /* 틸(브랜드 강조) */
  --study: #3d8f94;         /* 학습 강조(딥 틸 — 텍스트 대비) */
  --study-soft: #e4eef0;
  --nocheck: #d97706;       /* 임시·경고(앰버) */
  --weekend: #b0794f;       /* 주말(차분한 테라코타) */
  --good: #1f8a5b;
  --bad: #dc2626;
  --neutral-bar: #b9c2cc;   /* 중립 차트 막대(슬레이트) */
  --fill: #f5f3ef;          /* 카드 내부 옅은 면 */
  --track: #ece8e2;         /* 차트 트랙 */
  --radius: 12px;
  --shadow: 0 1px 3px rgba(16, 48, 80, .06), 0 1px 2px rgba(16, 48, 80, .04);
  --card-border: 1px solid var(--line);
  /* 본사와 동일한 폰트 페어링 */
  --font-sans: "Noto Sans KR", "Pretendard", -apple-system, BlinkMacSystemFont, "Segoe UI", "Malgun Gothic", "Apple SD Gothic Neo", sans-serif;
  --font-serif: "Noto Serif KR", "Nanum Myeongjo", serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
}
button { font-family: inherit; cursor: pointer; }

/* ===== 버튼·인터랙션 피드백 (눌림 / 호버 / 포커스 / 처리중) ===== */
button, .btn-primary, .btn-ghost, .nav-arrow, .demo-chip, .modal-close,
.cal-cell.clickable, summary, select, a {
  -webkit-tap-highlight-color: transparent;
  transition: transform .08s ease, filter .15s, background-color .15s,
    border-color .15s, box-shadow .15s, opacity .15s, color .15s;
}
/* 눌림: 살짝 가라앉는 느낌(모바일 탭 포함) */
button:active, .demo-chip:active, .modal-close:active,
.cal-cell.clickable:active { transform: scale(.96); }
.btn-primary:active:not(:disabled) { transform: scale(.98); filter: brightness(.92); }
.nav-arrow:not(:disabled):active { transform: scale(.9); }
/* 호버(데스크탑) */
.btn-primary:hover:not(:disabled) { filter: brightness(1.06); }
.btn-ghost:hover { background: var(--fill); border-color: var(--ink-soft); color: var(--ink); }
.nav-arrow:not(:disabled):hover { border-color: var(--primary); color: var(--primary); background: var(--primary-soft); }
.demo-chip:hover { border-color: var(--primary); }
.modal-close:hover { background: var(--track); color: var(--ink); }
/* 비활성: 눌러도 안 먹는 상태를 분명히 */
.btn-primary:disabled { opacity: .55; cursor: default; }
button:disabled { cursor: default; }
/* 키보드 포커스 링(접근성) */
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible,
summary:focus-visible, .cal-cell.clickable:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}
/* 달력 셀: 탭하면 강조 */
.cal-cell.clickable:active { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary-soft) inset; }
/* 처리 중(.is-busy): 텍스트 숨기고 스피너 — 로그인 등 비동기 버튼용 */
.btn-primary.is-busy { color: transparent !important; pointer-events: none; position: relative; }
.btn-primary.is-busy::after {
  content: ""; position: absolute; top: 50%; left: 50%; width: 16px; height: 16px;
  margin: -8px 0 0 -8px; border: 2px solid rgba(255, 255, 255, .45); border-top-color: #fff;
  border-radius: 50%; animation: btnspin .6s linear infinite;
}
@keyframes btnspin { to { transform: rotate(360deg); } }

.view { display: none; max-width: 600px; margin: 0 auto; padding: 0 16px 48px; }
.view.active { display: block; }

/* ===== 로그인 ===== */
#view-login { display: none; min-height: 100vh; }
#view-login.active { display: flex; align-items: center; }
.login-card {
  background: var(--card); width: 100%; border-radius: var(--radius);
  box-shadow: var(--shadow); border: var(--card-border); padding: 32px 24px; margin: 24px auto; max-width: 420px;
}
.brand { text-align: center; margin-bottom: 24px; }
.brand-mark { font-size: 40px; }
.brand-mark img { width: 56px; height: 56px; display: inline-block; vertical-align: middle; }
.brand h1 { font-family: var(--font-serif); font-weight: 600; font-size: 22px; letter-spacing: -.01em; margin: 10px 0 4px; }
.brand-sub { color: var(--ink-soft); font-size: 14px; margin: 0; }
#login-form label { display: block; margin-bottom: 14px; }
#login-form label span { display: block; font-size: 13px; color: var(--ink-soft); margin-bottom: 6px; }
#login-form input {
  width: 100%; padding: 13px 14px; border: 1.5px solid var(--line);
  border-radius: 10px; font-size: 16px; outline: none; transition: border-color .15s;
}
#login-form input:focus { border-color: var(--primary); }
.btn-primary {
  width: 100%; padding: 14px; border: none; border-radius: 10px;
  background: var(--primary); color: #fff; font-size: 16px; font-weight: 600;
  margin-top: 6px; transition: filter .15s;
}
.btn-primary:hover { filter: brightness(1.06); }
.btn-primary.wide { margin-top: 18px; }
.login-error { color: var(--bad); font-size: 13px; text-align: center; margin: 12px 0 0; }

/* 원장 로그인 입구 */
.admin-entry { text-align: center; margin: 20px 0 0; padding-top: 14px; border-top: 1px solid var(--line); }
.admin-entry a { color: var(--ink-soft); font-size: 13px; text-decoration: none; }
.admin-entry a:hover { color: var(--primary); text-decoration: underline; }

.demo-box { margin-top: 22px; border-top: 1px dashed var(--line); padding-top: 14px; }
.demo-box summary { cursor: pointer; color: var(--ink-soft); font-size: 13px; }
.demo-hint { font-size: 12px; color: var(--ink-soft); margin: 8px 0; }
.demo-list { display: flex; flex-wrap: wrap; gap: 6px; max-height: 180px; overflow: auto; }
.demo-chip {
  border: 1px solid var(--line); background: var(--fill); border-radius: 999px;
  padding: 5px 10px; font-size: 12px; color: var(--ink);
}
.demo-chip b { color: var(--primary); }

/* ===== 공통 상단바 ===== */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 0 10px; gap: 12px;
}
.student-name { font-size: 19px; font-weight: 700; }
.student-meta { font-size: 12px; color: var(--ink-soft); margin-top: 2px; }
.topbar-title { font-size: 16px; font-weight: 700; }
.btn-ghost {
  border: 1px solid var(--line); background: var(--card); color: var(--ink-soft);
  padding: 8px 12px; border-radius: 9px; font-size: 13px;
}

/* ===== 월 네비 ===== */
.month-nav { display: flex; align-items: center; justify-content: center; gap: 16px; margin: 6px 0 16px; }
.month-nav h2 { font-size: 17px; margin: 0; min-width: 130px; text-align: center; }
.nav-arrow {
  width: 36px; height: 36px; border-radius: 9px; border: 1px solid var(--line);
  background: var(--card); font-size: 20px; color: var(--ink); line-height: 1;
}
.nav-arrow:disabled { opacity: .3; cursor: default; }

/* ===== 연도별 월 그래프 (달력 상단) ===== */
.year-chart { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); border: var(--card-border); padding: 16px 14px 12px; margin-bottom: 14px; }
.year-chart[style*="display: none"] { display: none; }
.yc-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 18px; }
.yc-title { font-size: 14px; font-weight: 700; }
.yc-title .sub { font-size: 11px; color: var(--ink-soft); font-weight: 400; margin-left: 4px; }
.yc-toggle { display: inline-flex; background: var(--track); border-radius: 8px; padding: 2px; flex: none; }
.yc-toggle button { border: 0; background: transparent; color: var(--ink-soft); font-size: 12px; font-weight: 600; padding: 5px 11px; border-radius: 6px; }
.yc-toggle button.on { background: var(--primary); color: #fff; box-shadow: 0 1px 2px rgba(16, 48, 80, .18); }
.yc-bars { position: relative; display: flex; align-items: flex-end; gap: 4px; height: 132px; border-bottom: 1px solid var(--line); padding-bottom: 1px; }
.yc-cell { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; min-width: 0; }
.yc-cell.has { cursor: pointer; }
.yc-bar { position: relative; width: 100%; max-width: 22px; background: var(--study); border-radius: 4px 4px 0 0; min-height: 2px; transition: height .35s, background .15s; }
.yc-cell.empty .yc-bar { background: #e2ddd5; max-width: 12px; }
.yc-cell.current .yc-bar { background: var(--primary); }
.yc-cell.has:hover .yc-bar { filter: brightness(1.08); }
.yc-val { position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%); margin-bottom: 4px; font-size: 10px; font-weight: 600; font-family: var(--font-mono); color: var(--ink-soft); white-space: nowrap; letter-spacing: -.3px; pointer-events: none; }
.yc-cell.current .yc-val { color: var(--primary); font-weight: 700; }
.yc-avg { position: absolute; left: 0; right: 0; height: 0; border-top: 1px dashed var(--ink-soft); pointer-events: none; z-index: 2; opacity: .65; }
.yc-avg-tag { position: absolute; right: 0; top: -8px; font-size: 9px; color: var(--ink-soft); background: var(--card); padding: 0 4px; }
.yc-x { display: flex; gap: 4px; margin-top: 5px; }
.yc-x .xl { flex: 1; text-align: center; font-size: 10px; color: var(--ink-soft); font-family: var(--font-mono); min-width: 0; }
.yc-x .xl.cur { color: var(--primary); font-weight: 700; }
.yc-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.yc-legend { font-size: 11px; color: var(--ink-soft); display: flex; gap: 12px; }
.yc-legend i { display: inline-block; width: 9px; height: 9px; border-radius: 2px; vertical-align: -1px; margin-right: 4px; }
.yc-hint { font-size: 11px; color: var(--accent); }

/* ===== 데이터 상태 배너 ===== */
.data-status {
  display: flex; gap: 8px; align-items: flex-start; font-size: 12.5px; line-height: 1.45;
  border-radius: 10px; padding: 11px 13px; margin-bottom: 12px;
}
.data-status[hidden] { display: none; }
.data-status .ds-ic { flex: none; }
.data-status .ds-tx b { font-weight: 700; }
.data-status.warn { background: #fdf4e6; color: #92500a; border: 1px solid #f5d9a8; }
.data-status.ok { background: var(--primary-soft); color: #0f3a5c; border: 1px solid #cfe0ea; }

/* ===== 요약 카드 ===== */
.summary-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 16px; }
.scard {
  background: var(--card); border-radius: var(--radius); padding: 14px;
  box-shadow: var(--shadow); border: var(--card-border);
}
.scard .label { font-size: 12px; color: var(--ink-soft); }
.scard .value { font-size: 22px; font-weight: 700; margin-top: 4px; font-feature-settings: "tnum"; }
.scard .value small { font-size: 13px; font-weight: 600; color: var(--ink-soft); }
.scard .sub { font-size: 12px; color: var(--ink-soft); margin-top: 3px; }
.scard.accent { background: linear-gradient(135deg, #103050, #1a4070); color: #fff; border-color: transparent; }
.scard.accent .label, .scard.accent .sub { color: rgba(255,255,255,.85); }
.scard.accent .prov-split {
  margin-top: 5px; font-size: 11px; font-weight: 600; line-height: 1.3;
  background: rgba(255,255,255,.18); border-radius: 7px; padding: 3px 7px; display: inline-block;
}
.delta { font-size: 12px; font-weight: 700; }
.delta.up { color: var(--good); }
.delta.down { color: var(--bad); }
.delta.flat { color: var(--ink-soft); }
.scard.accent .delta.up { color: #bfe6ea; }
.scard.accent .delta.down { color: #fecaca; }

/* ===== 범례 ===== */
.cal-legend { display: flex; flex-wrap: wrap; gap: 12px; font-size: 12px; color: var(--ink-soft); margin-bottom: 8px; }
.cal-legend span { display: inline-flex; align-items: center; gap: 4px; }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.dot-study { background: var(--study); }
.dot-nocheck { background: var(--nocheck); }
.dot-absent { background: #c2ccc6; }
.chip-weekend { background: #f6ede6; color: var(--weekend); padding: 1px 6px; border-radius: 6px; font-size: 11px; }

/* ===== 달력 ===== */
.calendar { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); border: var(--card-border); padding: 10px; }
.empty-data { text-align: center; color: var(--ink-soft); padding: 40px 16px; line-height: 1.7; font-size: 15px; }
.empty-data small { font-size: 13px; opacity: .85; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-dow { text-align: center; font-size: 11px; color: var(--ink-soft); padding: 6px 0; font-weight: 600; }
.cal-dow.sun { color: var(--weekend); }
.cal-dow.sat { color: var(--accent); }
.cal-cell {
  aspect-ratio: 1 / 1; border-radius: 9px; padding: 4px; display: flex;
  flex-direction: column; align-items: center; justify-content: flex-start;
  border: 1px solid transparent; background: var(--fill); position: relative; overflow: hidden;
}
.cal-cell.empty { background: transparent; }
.cal-cell.weekend { background: #faf5f0; }
.cal-cell.clickable { cursor: pointer; }
.cal-cell.clickable:hover { border-color: var(--primary); }
.cal-cell.studied { background: var(--study-soft); }
.cal-cell.nocheck { background: #fdf3e3; }
.cal-cell .daynum { font-size: 11px; color: var(--ink-soft); align-self: flex-start; line-height: 1; }
.cal-cell.weekend .daynum { color: var(--weekend); }
.cal-cell .time { font-family: var(--font-mono); font-size: 12px; font-weight: 700; margin-top: auto; margin-bottom: 2px; color: var(--study); letter-spacing: -.02em; }
.cal-cell.nocheck .time { color: var(--nocheck); font-size: 10px; }
.cal-cell .badge { position: absolute; top: 3px; right: 4px; font-size: 9px; }
.cal-cell.today { box-shadow: 0 0 0 2px var(--primary) inset; }

/* ===== 반 평균 비교 (중립 톤) ===== */
.class-compare { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); border: var(--card-border); padding: 16px; margin-top: 16px; }
.cc-title { font-size: 13px; color: var(--ink-soft); margin-bottom: 14px; }
.cc-row { margin-bottom: 18px; }
.cc-row:last-child { margin-bottom: 0; }
.cc-label { font-size: 13px; margin-bottom: 8px; }
.cc-name { color: var(--ink); font-weight: 600; }
/* 듀얼 바 — 나 / 반평균을 같은 기준으로 나란히 비교 */
.cc-duo-row { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.cc-duo-name { flex: 0 0 52px; font-size: 11px; color: var(--ink-soft); }
.cc-duo-track { flex: 1; height: 16px; background: var(--track); border-radius: 6px; overflow: hidden; }
.cc-duo-bar { height: 100%; border-radius: 6px; min-width: 2px; transition: width .45s ease; }
.cc-duo-row.avg .cc-duo-bar { background: var(--neutral-bar); }
.cc-over .cc-duo-row.me .cc-duo-bar { background: var(--good); }
.cc-under .cc-duo-row.me .cc-duo-bar { background: var(--neutral-bar); }
.cc-near .cc-duo-row.me .cc-duo-bar { background: var(--accent); }
.cc-duo-val { flex: 0 0 auto; min-width: 50px; text-align: right; font-size: 12px; font-family: var(--font-mono); }
.cc-duo-row.me .cc-duo-val { color: var(--primary); font-weight: 700; }
.cc-duo-row.avg .cc-duo-val { color: var(--ink-soft); }
.cc-duo-row.top .cc-duo-bar { background: var(--accent); }
.cc-duo-row.top .cc-duo-val { color: var(--accent); font-weight: 600; }
.cc-foot { margin-top: 4px; padding-left: 60px; }
.cc-badge { display: inline-block; font-size: 11px; font-weight: 600; padding: 2px 9px; border-radius: 999px; white-space: nowrap; }
.cc-badge .cc-ico { font-size: 9px; margin-right: 2px; }
.cc-over .cc-badge { background: rgba(31, 138, 91, .12); color: var(--good); }
.cc-under .cc-badge { background: rgba(217, 119, 6, .12); color: var(--nocheck); }
.cc-near .cc-badge { background: var(--track); color: var(--ink-soft); }
.cc-avg-label { font-size: 11px; color: var(--ink-soft); margin-top: 4px; }

/* ===== 월간 상세 ===== */
.monthly-body > section { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); border: var(--card-border); padding: 18px 16px; margin-bottom: 14px; }
.monthly-body h3 { font-size: 15px; margin: 0 0 14px; }
.mb-sub { font-size: 12px; color: var(--ink-soft); font-weight: 400; }

/* 이번 달 한눈에 보기 */
.insights { background: linear-gradient(135deg, #eef3f6, #fff) !important; }
.insight-list { display: flex; flex-direction: column; gap: 8px; }
.insight { display: flex; gap: 10px; align-items: flex-start; font-size: 13.5px; line-height: 1.5; background: var(--fill); border-radius: 10px; padding: 10px 12px; }
.insight .i-ic { flex: none; font-size: 15px; line-height: 1.4; }
.insight .i-tx b { color: var(--primary); font-weight: 700; }

/* 막대 추이 차트 */
.bars { position: relative; display: flex; align-items: flex-end; gap: 3px; height: 150px; margin-top: 30px; border-bottom: 1px solid var(--line); padding-bottom: 2px; }
.bar-wrap { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; min-width: 0; }
.bar { position: relative; width: 100%; max-width: 14px; background: var(--study); border-radius: 3px 3px 0 0; min-height: 1px; transition: height .4s; }
.bar.weekend { background: var(--weekend); }
.bar.nocheck { background: var(--nocheck); }
.bar.zero { background: #d6ddd9; }
.bar.peak { background: var(--primary); }
/* 막대 위 수치 — 모든 막대에 세로로 상시 표시(좁은 막대 폭에서도 안 겹침) */
.bar-val { position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%); margin-bottom: 3px; writing-mode: vertical-rl; text-orientation: mixed; font-size: 8px; line-height: 1; letter-spacing: -.4px; font-family: var(--font-mono); color: var(--ink-soft); white-space: nowrap; pointer-events: none; }
.bar.peak .bar-val { color: var(--primary); font-weight: 700; }
.bar.weekend .bar-val { color: var(--weekend); }
.bar.nocheck .bar-val { color: var(--nocheck); }
/* 학습일 평균 가로 점선 */
.bar-avg { position: absolute; left: 0; right: 0; height: 0; border-top: 1px dashed var(--ink-soft); pointer-events: none; z-index: 2; }
.bar-avg-tag { position: absolute; right: 0; top: -8px; font-size: 9px; color: var(--ink-soft); background: var(--card); padding: 0 4px; border-radius: 3px; }
.bar-x { display: flex; gap: 3px; margin-top: 4px; }
.bar-x .bx { flex: 1; text-align: center; font-size: 8px; color: var(--ink-soft); min-width: 0; font-family: var(--font-mono); }

/* 요일 패턴 */
.dow-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; text-align: center; }
.dow-cell .dn { font-size: 12px; color: var(--ink-soft); }
.dow-cell .db { background: var(--track); border-radius: 8px; margin-top: 6px; display: flex; align-items: flex-end; height: 90px; }
.dow-cell .dbf { width: 100%; background: var(--primary); border-radius: 8px; min-height: 2px; }
.dow-cell.we .dbf { background: var(--weekend); }
.dow-cell .dv { font-size: 11px; margin-top: 4px; font-weight: 600; }

/* 평일/주말 비교 */
.ww { display: flex; gap: 14px; }
.ww-item { flex: 1; text-align: center; padding: 14px; border-radius: 10px; background: var(--fill); }
.ww-item .wl { font-size: 13px; color: var(--ink-soft); }
.ww-item .wv { font-size: 22px; font-weight: 700; margin-top: 6px; }
.ww-item.weekday .wv { color: var(--primary); }
.ww-item.weekend .wv { color: var(--weekend); }

/* 입실 시간대 */
.hours { position: relative; display: flex; align-items: flex-end; gap: 2px; height: 90px; margin-top: 20px; }
.hours .hb { flex: 1; background: var(--study-soft); border-radius: 2px 2px 0 0; min-height: 1px; position: relative; }
.hours .hb.peak { background: var(--primary); }
/* 시간대별 입실 횟수 — 모든 막대 위에 세로로 상시 표시("N회"라 가로로는 좁아 겹침) */
.hb-val { position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%); margin-bottom: 2px; writing-mode: vertical-rl; text-orientation: mixed; font-size: 8px; line-height: 1; letter-spacing: -.3px; font-family: var(--font-mono); color: var(--ink-soft); white-space: nowrap; pointer-events: none; }
.hours .hb.peak .hb-val { color: var(--primary); font-weight: 700; }
.hours-x { display: flex; gap: 2px; margin-top: 3px; }
.hours-x .hx { flex: 1; text-align: center; font-size: 8px; color: var(--ink-soft); }

.kv { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.kv:last-child { border-bottom: none; }
.kv .k { color: var(--ink-soft); }
.kv .v { font-weight: 600; }

/* ===== 일자 상세 모달 ===== */
.modal { position: fixed; inset: 0; z-index: 50; display: flex; align-items: flex-end; justify-content: center; }
.modal[hidden] { display: none; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(15,18,28,.45); }
.modal-card {
  position: relative; background: var(--card); width: 100%; max-width: 560px;
  border-radius: 18px 18px 0 0; padding: 22px 18px 28px; max-height: 88vh; overflow: auto;
  animation: slideUp .22s ease; box-shadow: 0 -4px 24px rgba(0,0,0,.12);
}
@media (min-width: 600px) { .modal { align-items: center; } .modal-card { border-radius: 16px; } }
@keyframes slideUp { from { transform: translateY(24px); opacity: .6; } to { transform: none; opacity: 1; } }
.modal-close { position: absolute; top: 14px; right: 14px; border: none; background: var(--fill); width: 30px; height: 30px; border-radius: 50%; font-size: 14px; color: var(--ink-soft); }
.dm-date { font-size: 18px; font-weight: 700; }
.dm-dow { font-size: 13px; color: var(--ink-soft); margin-left: 6px; }
.dm-hero { display: flex; gap: 10px; margin: 16px 0; }
.dm-hero .h { flex: 1; background: var(--fill); border-radius: 10px; padding: 12px; text-align: center; }
.dm-hero .h .hl { font-size: 11px; color: var(--ink-soft); }
.dm-hero .h .hv { font-size: 18px; font-weight: 700; margin-top: 4px; }
.dm-hero .h.net .hv { color: var(--primary); }
.dm-badge { display: inline-block; background: #fdf3e3; color: var(--nocheck); font-size: 12px; padding: 4px 10px; border-radius: 8px; margin: 4px 0 8px; }
.dm-badge.ok { background: var(--primary-soft); color: var(--good); }
.session { border: 1px solid var(--line); border-radius: 10px; padding: 12px; margin-top: 10px; }
.session .s-head { display: flex; justify-content: space-between; align-items: center; font-weight: 600; }
.session .s-time { font-size: 15px; }
.session .s-net { color: var(--primary); font-size: 13px; }
.session .s-meta { font-size: 12px; color: var(--ink-soft); margin-top: 6px; display: flex; gap: 12px; flex-wrap: wrap; }
.session .s-reason { font-size: 12px; margin-top: 6px; }
.session.warn { border-color: #f5d9a8; background: #fdf8ef; }
.timeline { height: 8px; background: var(--track); border-radius: 5px; margin-top: 10px; position: relative; overflow: hidden; }
.timeline .seg { position: absolute; top: 0; bottom: 0; background: var(--study); border-radius: 5px; }
.tl-axis { display: flex; justify-content: space-between; font-size: 10px; color: var(--ink-soft); margin-top: 3px; font-family: var(--font-mono); }
.empty-note { color: var(--ink-soft); font-size: 13px; text-align: center; padding: 24px 0; }

/* ===== 넓은 화면: 전체 화면 균형 레이아웃 ===== */
@media (min-width: 760px) {
  .view { max-width: 720px; }
  .summary-grid { grid-template-columns: repeat(4, 1fr); }
  /* PC: 막대 간격이 충분하므로 차트 수치를 가로로 표시 */
  .bar-val, .hb-val { writing-mode: horizontal-tb; font-size: 9px; letter-spacing: 0; }
}
@media (min-width: 1040px) {
  .view { max-width: 1000px; padding-bottom: 56px; }

  /* 달력 화면: 왼쪽 달력 | 오른쪽에 요약 카드(1열) + 반평균 */
  #view-calendar.active {
    display: grid; column-gap: 22px; align-items: start;
    grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr);
    grid-template-areas:
      "bar     bar"
      "nav     nav"
      "year    year"
      "status  status"
      "legend  legend"
      "cal     summary"
      "cal     compare"
      "monthly monthly";
  }
  #view-calendar.active > .topbar { grid-area: bar; }
  #view-calendar.active > .month-nav { grid-area: nav; }
  #view-calendar.active > .year-chart { grid-area: year; }
  #view-calendar.active > #data-status { grid-area: status; }
  #view-calendar.active > .cal-legend { grid-area: legend; }
  #view-calendar.active > .calendar { grid-area: cal; align-self: stretch; }
  #view-calendar.active > .summary-grid { grid-area: summary; grid-template-columns: 1fr; }
  #view-calendar.active > .class-compare { grid-area: compare; margin-top: 12px; }
  #view-calendar.active > #btn-monthly { grid-area: monthly; }
  .cal-cell .time { font-size: 13px; }

  /* 월간 상세: 1단(세로 단일 컬럼) */
  .monthly-body { display: block; }
  .monthly-body > section { margin-bottom: 14px; }
}

/* 관리자 컨텍스트 바 (미리보기 / 일반 관리자 세션 공용) */
.admin-bar { display:flex; align-items:center; gap:8px; flex-wrap:wrap;
  background:#fef3c7; border-bottom:2px solid #f59e0b; color:#7c2d12;
  padding:8px 14px; font-size:13px; position:sticky; top:0; z-index:50; }
.admin-bar .pv-tag { background:#b45309; color:#fff; border-radius:4px;
  padding:2px 8px; font-weight:700; font-size:12px; }
.admin-bar .pv-txt { font-weight:500; }
.admin-bar .pv-admin-btn { margin-left:auto; flex-shrink:0;
  background:#7c2d12; color:#fff; border:0; border-radius:6px;
  padding:6px 12px; font-size:13px; font-weight:600; cursor:pointer; }
.admin-bar .pv-admin-btn:hover { background:#601f0c; }
body.preview-mode #btn-logout { display:none; }
