/* ========================================================
   교사 전용 화면 (Figma 리디자인 토큰 기반, 모바일 우선)
   ======================================================== */

[hidden] { display: none !important; }

.teacher-body { background: var(--bg-app); min-height: 100vh; }

/* ---------- 로그인 ---------- */
.t-login { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1.5rem; }
.t-login-card {
  width: 100%; max-width: 400px; background: var(--bg-surface); border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl); padding: 2rem 1.75rem; box-shadow: var(--shadow-lg); text-align: center;
}
.t-logo {
  width: 56px; height: 56px; margin: 0 auto 1rem; border-radius: 18px; display: flex; align-items: center; justify-content: center;
  background: var(--primary-soft); color: var(--primary); font-weight: 800; font-size: 1.15rem;
}
.t-login h1 { font-size: 1.6rem; margin-bottom: .35rem; }
.t-sub { color: var(--text-secondary); font-size: .88rem; margin-bottom: 1.25rem; }
.t-login form { text-align: left; }
.t-label { display: block; font-size: .8rem; font-weight: 600; color: var(--text-secondary); margin: .9rem 0 .4rem; }
.t-full { width: 100%; padding: .95rem; font-size: 1rem; margin-top: 1rem; }
.t-link { display: inline-block; margin-top: 1.25rem; font-size: .85rem; color: var(--text-muted); }
.t-msg { display: none; margin-top: .85rem; padding: .65rem .8rem; border-radius: var(--radius-md); font-size: .85rem; }
.t-msg.err { display: block; background: var(--danger-soft); color: var(--danger); }
.t-msg.ok { display: block; background: var(--success-soft); color: var(--success); }

.t-main { max-width: 980px; margin: 0 auto; padding: 1.25rem; }
.t-tab { display: none; }
.t-tab.active { display: block; }
.t-h2 { font-size: 1.05rem; margin: 1.25rem 0 .7rem; }
.t-h2 small { display: block; font-size: .75rem; font-weight: 500; color: var(--text-muted); margin-top: .15rem; }

/* ---------- 출석 ---------- */
.t-session-row { display: flex; gap: .5rem; }
.t-session-row select { flex: 1; min-width: 0; }
.t-kpis { display: grid; grid-template-columns: repeat(5, 1fr); gap: .5rem; margin: .9rem 0; }
.t-kpi {
  background: var(--bg-surface); border: 1px solid var(--border-subtle); border-radius: var(--radius-md);
  padding: .6rem .4rem; text-align: center; display: flex; flex-direction: column; gap: .15rem;
}
.t-kpi span { font-size: .68rem; color: var(--text-muted); font-weight: 600; }
.t-kpi strong { font-size: 1.35rem; font-family: var(--font-heading); }
.t-kpi.ok strong { color: var(--success); }
.t-kpi.warn strong { color: var(--warning); }
.t-kpi.bad strong { color: var(--danger); }
.t-rate { background: var(--bg-surface); border: 1px solid var(--border-subtle); border-radius: var(--radius-md); padding: .8rem 1rem; }
.t-rate-top { display: flex; justify-content: space-between; align-items: baseline; font-size: .85rem; color: var(--text-secondary); margin-bottom: .5rem; }
.t-rate-top strong { font-size: 1.4rem; color: var(--primary); }
.t-track { height: 10px; background: var(--bg-elevated); border-radius: 999px; overflow: hidden; }
.t-bar { height: 100%; width: 0; background: var(--primary); border-radius: 999px; transition: width .4s; }

.t-tools { margin-top: .9rem; display: flex; flex-direction: column; gap: .6rem; }
.t-chips { display: flex; gap: .4rem; overflow-x: auto; padding-bottom: .15rem; }
.t-chip {
  flex: 0 0 auto; border: 1px solid var(--border-subtle); background: var(--bg-surface); color: var(--text-secondary);
  border-radius: 999px; padding: .35rem .8rem; font-size: .8rem; font-weight: 600; cursor: pointer; font-family: inherit;
}
.t-chip.active { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.t-bulk { display: flex; gap: .5rem; margin: .8rem 0; }
.t-bulk .btn { flex: 1; font-size: .8rem; padding: .6rem .5rem; }

.t-list { list-style: none; display: flex; flex-direction: column; gap: .5rem; padding: 0; margin: 0; }
.t-student {
  background: var(--bg-surface); border: 1px solid var(--border-subtle); border-radius: var(--radius-md);
  padding: .75rem .9rem; display: flex; align-items: center; gap: .75rem; justify-content: space-between; flex-wrap: wrap;
}
.t-student-info { min-width: 0; flex: 1 1 140px; }
.t-student-name { font-weight: 700; display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; }
.t-student-meta { font-size: .75rem; color: var(--text-muted); margin-top: .1rem; }
.t-pill { font-size: .68rem; font-weight: 700; padding: .12rem .55rem; border-radius: 999px; background: var(--bg-elevated); color: var(--text-muted); }
.t-pill.PRESENT { background: var(--success-soft); color: var(--success); }
.t-pill.LATE { background: var(--warning-soft); color: var(--warning); }
.t-pill.ABSENT { background: var(--danger-soft); color: var(--danger); }
.t-actions { display: flex; gap: .3rem; }
.t-act {
  border: 1px solid var(--border-subtle); background: var(--bg-surface); color: var(--text-secondary); border-radius: var(--radius-sm);
  padding: .45rem .7rem; font-size: .8rem; font-weight: 700; cursor: pointer; font-family: inherit; min-width: 48px;
}
.t-act:hover { background: var(--bg-elevated); }
.t-act.on.PRESENT { background: var(--success); border-color: var(--success); color: #fff; }
.t-act.on.LATE { background: var(--warning); border-color: var(--warning); color: #fff; }
.t-act.on.ABSENT { background: var(--danger); border-color: var(--danger); color: #fff; }
.t-empty { text-align: center; color: var(--text-muted); font-size: .88rem; padding: 2rem 1rem; background: var(--bg-surface); border: 1px dashed var(--border-subtle); border-radius: var(--radius-md); }

/* ---------- 현황 ---------- */
.t-trend {
  background: var(--bg-surface); border: 1px solid var(--border-subtle); border-radius: var(--radius-md);
  padding: 1rem; display: flex; align-items: flex-end; gap: .5rem; height: 200px;
}
.t-trend-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: .3rem; min-width: 0; }
.t-trend-bar { width: 100%; max-width: 36px; background: var(--primary); border-radius: 6px 6px 0 0; min-height: 3px; }
.t-trend-col em { font-style: normal; font-size: .7rem; font-weight: 700; color: var(--text-secondary); }
.t-trend-col span { font-size: .65rem; color: var(--text-muted); }

/* ---------- 돌봄 / 공통 카드 ---------- */
.t-card { background: var(--bg-surface); border: 1px solid var(--border-subtle); border-radius: var(--radius-lg); padding: 1rem; }
.t-form { display: flex; flex-direction: column; gap: .6rem; }
.t-form textarea { resize: vertical; }
.t-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
.t-care-item { background: var(--bg-surface); border: 1px solid var(--border-subtle); border-radius: var(--radius-md); padding: .8rem .9rem; }
.t-care-top { display: flex; justify-content: space-between; align-items: center; gap: .5rem; }
.t-care-notes { margin: .4rem 0; font-size: .85rem; color: var(--text-secondary); white-space: pre-wrap; word-break: keep-all; }
.t-care-meta { font-size: .72rem; color: var(--text-muted); }
.t-care-item select { margin-top: .5rem; font-size: .8rem; padding: .4rem .6rem; }

/* ---------- 바로가기 ---------- */
.t-links { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: .75rem; }
.t-link-card {
  display: flex; flex-direction: column; gap: .25rem; background: var(--bg-surface); border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg); padding: 1rem; color: var(--text-main); text-decoration: none;
}
.t-link-card:hover { border-color: var(--primary); box-shadow: var(--border-glow); }
.t-link-card strong { font-size: 1rem; }
.t-link-card span { font-size: .8rem; color: var(--text-muted); }

/* ---------- 하단 내비 / 모달 ---------- */
.t-modal { position: fixed; inset: 0; z-index: 100; background: var(--bg-overlay); display: flex; align-items: center; justify-content: center; padding: 1rem; }
.t-modal-card { width: 100%; max-width: 400px; background: var(--bg-surface); border-radius: var(--radius-xl); padding: 1.5rem; display: flex; flex-direction: column; gap: .6rem; box-shadow: var(--shadow-xl); }
.t-modal-card h2 { font-size: 1.2rem; }
.t-modal-actions { display: flex; justify-content: flex-end; gap: .5rem; margin-top: .5rem; }

@media (max-width: 420px) {
  .t-kpi strong { font-size: 1.15rem; }
  .t-actions .t-act { padding: .45rem .55rem; min-width: 42px; }
}

/* ---------- 사이드바 레이아웃 ---------- */
.t-shell { display: flex; min-height: 100vh; }
.t-side {
  width: 288px; flex: 0 0 288px; background: var(--bg-surface); border-right: 1px solid var(--border-subtle);
  display: flex; flex-direction: column; padding: 1.25rem 1.1rem; gap: 1rem; position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.t-brand { display: flex; align-items: center; gap: .8rem; padding: .25rem .25rem .5rem; }
.t-brand-logo { width: 48px; height: 48px; border-radius: 14px; background: var(--primary); display: flex; align-items: center; justify-content: center; flex: 0 0 48px; }
.t-brand-logo svg { width: 28px; height: 28px; fill: none; stroke: #fff; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.t-brand-txt { display: flex; flex-direction: column; min-width: 0; }
.t-brand-txt strong { font-size: 1.02rem; font-weight: 800; }
.t-brand-txt span { font-size: .8rem; color: var(--text-muted); }
.t-urgent {
  display: flex; align-items: center; justify-content: center; gap: .5rem; width: 100%; border: none; cursor: pointer; font-family: inherit;
  background: var(--danger); color: #fff; font-weight: 700; font-size: .95rem; padding: .85rem; border-radius: var(--radius-md);
  box-shadow: 0 6px 14px rgba(225, 29, 72, .25);
}
.t-urgent svg { width: 18px; height: 18px; }
.t-urgent:hover { filter: brightness(.95); }
.t-nav { display: flex; flex-direction: column; gap: .3rem; }
.t-nav-btn {
  display: flex; align-items: center; gap: .8rem; width: 100%; border: none; background: none; cursor: pointer; font-family: inherit;
  padding: .8rem .9rem; border-radius: var(--radius-md); color: var(--text-secondary); font-size: .92rem; font-weight: 600; text-align: left;
}
.t-nav-btn svg { width: 22px; height: 22px; flex: 0 0 22px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; opacity: .75; }
.t-nav-btn span { flex: 1; min-width: 0; }
.t-nav-btn:hover { background: var(--bg-elevated); }
.t-nav-btn.active { background: var(--primary); color: #fff; box-shadow: 0 6px 14px rgba(37, 99, 235, .28); }
.t-nav-btn.active svg { opacity: 1; }
.t-dot { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 8px; background: var(--text-muted); }
.t-dot.alert { background: #F43F5E; }
.t-dot.live { background: rgba(255, 255, 255, .75); }
.t-dot.ok { background: var(--success); }
.t-dot.err { background: var(--danger); }
.t-badge { font-style: normal; font-size: .72rem; font-weight: 700; padding: .15rem .55rem; border-radius: 999px; background: var(--bg-elevated); color: var(--text-secondary); }
.t-nav-btn.active .t-badge { background: rgba(255, 255, 255, .22); color: #fff; }
.t-side-foot { margin-top: auto; border-top: 1px solid var(--border-subtle); padding-top: .9rem; display: flex; flex-direction: column; gap: .6rem; }
.t-status { display: flex; align-items: center; gap: .55rem; background: var(--bg-app); border-radius: var(--radius-md); padding: .7rem .8rem; font-size: .8rem; font-weight: 700; }
.t-status em { margin-left: auto; font-style: normal; font-size: .72rem; font-weight: 700; color: var(--success); background: var(--success-soft); border-radius: 6px; padding: .15rem .5rem; }
.t-status em.err { color: var(--danger); background: var(--danger-soft); }

.t-content { flex: 1; min-width: 0; }
.t-top {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: .9rem; padding: .9rem 1.25rem;
  background: var(--bg-surface); border-bottom: 1px solid var(--border-subtle);
}
.t-menu { display: none; border: 1px solid var(--border-subtle); background: var(--bg-surface); border-radius: var(--radius-md); width: 42px; height: 42px; cursor: pointer; }
.t-menu svg { width: 22px; height: 22px; fill: none; stroke: var(--text-main); stroke-width: 2; stroke-linecap: round; }
.t-top-title { flex: 1; min-width: 0; }
.t-top-title span { font-size: .78rem; color: var(--text-muted); font-weight: 600; }
.t-top-title h1 { font-size: 1.35rem; line-height: 1.25; }
.t-top-user { display: flex; flex-direction: column; text-align: right; font-size: .78rem; color: var(--text-muted); }
.t-top-user strong { font-size: .88rem; color: var(--text-main); }

.t-scrim { position: fixed; inset: 0; background: var(--bg-overlay); z-index: 40; }

/* ---------- 신규 섹션 ---------- */
.t-class-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: .8rem; }
.t-class-card { background: var(--bg-surface); border: 1px solid var(--border-subtle); border-radius: var(--radius-lg); padding: 1rem; }
.t-class-card h3 { display: flex; justify-content: space-between; align-items: baseline; font-size: 1.05rem; margin-bottom: .6rem; }
.t-class-card h3 span { font-size: .78rem; color: var(--text-muted); font-weight: 600; }
.t-class-card ul { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: .35rem; }
.t-class-card li { font-size: .8rem; padding: .25rem .6rem; border-radius: 999px; background: var(--bg-app); color: var(--text-secondary); border: 1px solid var(--border-subtle); }

.t-event { background: var(--bg-surface); border: 1px solid var(--border-subtle); border-radius: var(--radius-md); padding: .8rem .9rem; }
.t-event-top { display: flex; justify-content: space-between; gap: .5rem; align-items: center; }
.t-event p { font-size: .8rem; color: var(--text-muted); margin-top: .25rem; }
.t-school { background: var(--bg-surface); border: 1px solid var(--border-subtle); border-radius: var(--radius-md); }
.t-school > summary { list-style: none; cursor: pointer; padding: .8rem .9rem; display: flex; justify-content: space-between; gap: .5rem; font-weight: 700; }
.t-school > summary::-webkit-details-marker { display: none; }
.t-school > summary small { color: var(--text-muted); font-weight: 600; }
.t-school ul { list-style: none; padding: 0 .9rem .8rem; display: flex; flex-direction: column; gap: .4rem; }
.t-school li { display: flex; justify-content: space-between; gap: .6rem; font-size: .82rem; border-top: 1px solid var(--border-subtle); padding-top: .4rem; }
.t-school li span { color: var(--text-muted); white-space: nowrap; }

.t-report-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: .8rem; }
.t-report h3 { font-size: 1.15rem; margin-bottom: .2rem; }
.t-report .t-sub { margin-bottom: 1rem; }
.t-report table { width: 100%; border-collapse: collapse; margin: .5rem 0 1rem; font-size: .88rem; }
.t-report th, .t-report td { border-bottom: 1px solid var(--border-subtle); padding: .5rem .4rem; text-align: left; }
.t-report th { color: var(--text-muted); font-size: .75rem; }
.t-report h4 { margin: 1rem 0 .3rem; font-size: .95rem; }

.t-settings { display: flex; flex-direction: column; gap: .6rem; }
.t-settings > div { display: flex; justify-content: space-between; font-size: .9rem; }
.t-settings span { color: var(--text-muted); }
.t-settings .t-set-actions { gap: .5rem; justify-content: flex-start; margin-top: .4rem; }

@media (max-width: 900px) {
  .t-side { position: fixed; left: 0; top: 0; bottom: 0; z-index: 50; transform: translateX(-102%); transition: transform .25s; width: min(300px, 86vw); box-shadow: var(--shadow-xl); }
  .t-side.open { transform: none; }
  .t-menu { display: flex; align-items: center; justify-content: center; }
  .t-top { padding: .75rem 1rem; }
  .t-top-user { display: none; }
  .t-main { padding: 1rem; }
}

@media print {
  .t-side, .t-top, .t-report-head button, .t-scrim { display: none !important; }
  .t-tab { display: none !important; }
  #tab-report { display: block !important; }
  .t-card { border: none; }
}
