/* ============================================================
   원어민 영어교실 관리 시스템 - 디자인 시스템
   ============================================================ */
:root {
  --bg: #f4f6fb;
  --panel: #ffffff;
  --ink: #1a2233;
  --ink-2: #4a5568;
  --ink-3: #8a94a6;
  --line: #e4e9f2;
  --line-2: #eef2f8;
  --brand: #3355ff;
  --brand-2: #6a5cff;
  --brand-soft: #eef1ff;
  --ok: #10a37f;
  --ok-soft: #e6f7f2;
  --warn: #e8a33d;
  --warn-soft: #fdf3e3;
  --danger: #e5484d;
  --danger-soft: #fdecec;
  --info: #2f9bd8;
  --info-soft: #e8f4fc;
  --purple: #8b5cf6;
  --purple-soft: #f1ecfe;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 8px 24px rgba(16, 24, 40, .06);
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .06);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont,
               system-ui, "Segoe UI", Roboto, "Helvetica Neue", "Apple SD Gothic Neo",
               "Malgun Gothic", sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
h1, h2, h3, h4 { margin: 0; font-weight: 700; letter-spacing: -.02em; }
p { margin: 0; }

/* ---------- 레이아웃 ---------- */
.app { display: flex; min-height: 100vh; }

.sidebar {
  width: 232px;
  flex: 0 0 232px;
  background: #101828;
  color: #cbd5e1;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 40;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 18px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, .07);
}
.brand-mark {
  width: 36px; height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  display: grid; place-items: center;
  color: #fff; font-size: 16px;
  box-shadow: 0 4px 12px rgba(51, 85, 255, .35);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.25; }
.brand-text strong { color: #fff; font-size: 14px; font-weight: 700; }
.brand-text span { font-size: 10.5px; color: #7d8aa0; letter-spacing: .02em; }

.nav { padding: 12px 10px; display: flex; flex-direction: column; gap: 2px; flex: 1; overflow-y: auto; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 13.5px;
  font-weight: 500;
  color: #98a5ba;
  transition: background .15s, color .15s;
}
.nav-item i { width: 16px; text-align: center; font-size: 13.5px; }
.nav-item:hover { background: rgba(255, 255, 255, .06); color: #e2e8f0; }
.nav-item.is-active {
  background: linear-gradient(135deg, rgba(51, 85, 255, .9), rgba(106, 92, 255, .8));
  color: #fff;
  box-shadow: 0 4px 12px rgba(51, 85, 255, .28);
}

.sidebar-foot {
  padding: 14px 16px 18px;
  border-top: 1px solid rgba(255, 255, 255, .07);
}
.today-chip { display: flex; align-items: center; gap: 9px; color: #cbd5e1; }
.today-chip i { color: #7d8aa0; }
.today-label { font-size: 10px; color: #7d8aa0; display: block; letter-spacing: .06em; }
.today-chip strong { font-size: 12.5px; color: #e2e8f0; font-weight: 600; }
.clock {
  margin-top: 8px;
  font-size: 19px;
  font-weight: 700;
  color: #fff;
  font-variant-numeric: tabular-nums;
  letter-spacing: .02em;
}

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  background: rgba(255, 255, 255, .86);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  padding: 14px 24px;
  display: flex;
  align-items: center;
  gap: 14px;
  position: sticky; top: 0; z-index: 30;
}
.topbar-title { flex: 1; min-width: 0; }
.topbar-title h1 { font-size: 18px; }
.topbar-sub { font-size: 12px; color: var(--ink-3); margin-top: 1px; }
.topbar-right { display: flex; align-items: center; gap: 8px; }

.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 11px;
  border-radius: 999px;
  background: var(--line-2);
  color: var(--ink-2);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.pill b { color: var(--ink); font-weight: 700; }
.pill-live { background: var(--ok-soft); color: #0b7a5f; }
.pill-live .dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 0 0 rgba(16, 163, 127, .6);
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(16, 163, 127, .55); }
  70% { box-shadow: 0 0 0 7px rgba(16, 163, 127, 0); }
  100% { box-shadow: 0 0 0 0 rgba(16, 163, 127, 0); }
}
.pill-warn { background: var(--danger-soft); color: #b3262a; }
.pill-warn b { color: #b3262a; }

.content { padding: 20px 24px 40px; flex: 1; }

/* ---------- 카드 / 패널 ---------- */
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.card-head {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line-2);
}
.card-head h3 { font-size: 14.5px; }
.card-head .sub { font-size: 11.5px; color: var(--ink-3); font-weight: 500; }
.card-head .spacer { flex: 1; }
.card-body { padding: 16px 18px; }
.card-body.tight { padding: 0; }

.section { display: flex; flex-direction: column; gap: 16px; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.dash-top { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.dash-mid { display: grid; grid-template-columns: minmax(0, 1.62fr) minmax(0, 1fr); gap: 16px; }
.dash-bot { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.35fr); gap: 16px; }

/* ---------- KPI ---------- */
.kpi {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
  transition: transform .16s, box-shadow .16s;
}
.kpi:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.kpi::after {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: var(--brand);
}
.kpi.k-ok::after { background: var(--ok); }
.kpi.k-warn::after { background: var(--warn); }
.kpi.k-danger::after { background: var(--danger); }
.kpi.k-purple::after { background: var(--purple); }
.kpi.k-info::after { background: var(--info); }

.kpi-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.kpi-label { font-size: 12px; color: var(--ink-3); font-weight: 600; }
.kpi-icon {
  width: 32px; height: 32px; border-radius: 9px;
  display: grid; place-items: center; font-size: 13px;
  background: var(--brand-soft); color: var(--brand);
}
.kpi.k-ok .kpi-icon { background: var(--ok-soft); color: var(--ok); }
.kpi.k-warn .kpi-icon { background: var(--warn-soft); color: #a9741d; }
.kpi.k-danger .kpi-icon { background: var(--danger-soft); color: var(--danger); }
.kpi.k-purple .kpi-icon { background: var(--purple-soft); color: var(--purple); }
.kpi.k-info .kpi-icon { background: var(--info-soft); color: var(--info); }

.kpi-value {
  font-size: 30px; font-weight: 800; letter-spacing: -.03em;
  margin-top: 8px; line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.kpi-value small { font-size: 14px; font-weight: 600; color: var(--ink-3); margin-left: 3px; }
.kpi-foot { margin-top: 7px; font-size: 11.5px; color: var(--ink-3); display: flex; align-items: center; gap: 5px; }
.kpi-foot .up { color: var(--ok); font-weight: 700; }
.kpi-foot .down { color: var(--danger); font-weight: 700; }

.mini-bars { display: flex; gap: 3px; margin-top: 10px; height: 26px; align-items: flex-end; }
.mini-bars span {
  flex: 1; background: var(--brand-soft); border-radius: 3px; min-height: 3px;
  transition: background .15s;
}
.mini-bars span.on { background: var(--brand); }

/* ---------- 배지 ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 8px; border-radius: 6px;
  font-size: 11px; font-weight: 700; white-space: nowrap;
  background: var(--line-2); color: var(--ink-2);
}
.badge.ok { background: var(--ok-soft); color: #0b7a5f; }
.badge.warn { background: var(--warn-soft); color: #a9741d; }
.badge.danger { background: var(--danger-soft); color: #b3262a; }
.badge.info { background: var(--info-soft); color: #1c6f9e; }
.badge.brand { background: var(--brand-soft); color: #2a44cc; }
.badge.purple { background: var(--purple-soft); color: #6d3fd4; }
/* 보강 수업 표시 — 출결 시트의 '보강' 행을 그대로 시각화 */
.badge.makeup { background: #fff1d6; color: #a5620a; border: 1px solid #f2cf92; }
tr.row-makeup > td { background: #fffaf0; }
tr.row-note > td {
  background: #fbfbfd; color: var(--muted); font-size: 12px;
  border-top: none; padding-top: 4px; padding-bottom: 8px;
}
tr.row-note i { color: #a5620a; margin-right: 5px; }
.badge.gray { background: #f1f3f7; color: #6b7686; }

/* ---------- 버튼 / 입력 ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px; border-radius: 9px;
  border: 1px solid var(--line);
  background: #fff; color: var(--ink-2);
  font-size: 13px; font-weight: 600;
  transition: all .15s;
}
.btn:hover { background: #f8fafc; border-color: #d3dae6; color: var(--ink); }
.btn-primary {
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  border-color: transparent; color: #fff;
  box-shadow: 0 2px 8px rgba(51, 85, 255, .28);
}
.btn-primary:hover { filter: brightness(1.06); color: #fff; }
.btn-danger {
  background: linear-gradient(135deg, var(--danger), #c9353a);
  border-color: transparent; color: #fff;
  box-shadow: 0 2px 8px rgba(229, 72, 77, .28);
}
.btn-danger:hover { filter: brightness(1.06); color: #fff; }
.btn-ok {
  background: linear-gradient(135deg, var(--ok), #0e8a6c);
  border-color: transparent; color: #fff;
  box-shadow: 0 2px 8px rgba(16, 163, 127, .26);
}
.btn-ok:hover { filter: brightness(1.06); color: #fff; }
.btn-sm { padding: 6px 10px; font-size: 12px; border-radius: 8px; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--ink-3); }
.btn-ghost:hover { background: var(--line-2); color: var(--ink); }
.icon-btn {
  width: 34px; height: 34px; border-radius: 9px;
  border: 1px solid var(--line); background: #fff;
  display: grid; place-items: center; color: var(--ink-2);
}
.icon-btn:hover { background: #f8fafc; }

.field { display: flex; flex-direction: column; gap: 5px; }
.field label { font-size: 11.5px; font-weight: 700; color: var(--ink-2); }
.field label .req { color: var(--danger); }
input[type="text"], input[type="date"], input[type="number"], input[type="time"],
input[type="email"], select, textarea {
  width: 100%;
  padding: 8px 11px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  font-size: 13px;
  font-family: inherit;
  color: var(--ink);
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(51, 85, 255, .12);
}
textarea { resize: vertical; min-height: 68px; }
select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%238a94a6' d='M6 8.5L1.5 4h9z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 11px center; padding-right: 30px; }

.toolbar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.toolbar .grow { flex: 1; min-width: 160px; }
.search-wrap { position: relative; }
.search-wrap i {
  position: absolute; left: 11px; top: 50%; transform: translateY(-50%);
  color: var(--ink-3); font-size: 12px;
}
.search-wrap input { padding-left: 32px; }

/* ---------- 테이블 ---------- */
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
table.tbl th {
  text-align: left; padding: 10px 14px;
  background: #fafbfd;
  border-bottom: 1px solid var(--line);
  font-size: 11.5px; font-weight: 700; color: var(--ink-2);
  white-space: nowrap;
  position: sticky; top: 0;
}
table.tbl td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--line-2);
  vertical-align: middle;
}
table.tbl tbody tr:hover { background: #fbfcfe; }
table.tbl tbody tr:last-child td { border-bottom: none; }
.td-strong { font-weight: 700; color: var(--ink); }
.td-sub { font-size: 11.5px; color: var(--ink-3); }
.num { font-variant-numeric: tabular-nums; text-align: right; }
.center { text-align: center; }
.row-link { cursor: pointer; }

/* ---------- 실시간 관제 ---------- */
.monitor-list { display: flex; flex-direction: column; }
.monitor-row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--line-2);
}
.monitor-row:last-child { border-bottom: none; }
.monitor-row:hover { background: #fbfcfe; }
.avatar {
  width: 38px; height: 38px; border-radius: 50%;
  display: grid; place-items: center;
  font-size: 13px; font-weight: 700; color: #fff;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  flex: 0 0 38px;
  position: relative;
}
.avatar.av-2 { background: linear-gradient(135deg, #10a37f, #0e8a6c); }
.avatar.av-3 { background: linear-gradient(135deg, #e8a33d, #d18a1e); }
.avatar.av-4 { background: linear-gradient(135deg, #8b5cf6, #6d3fd4); }
.avatar.av-5 { background: linear-gradient(135deg, #2f9bd8, #1f7cad); }
.avatar.av-6 { background: linear-gradient(135deg, #e5484d, #c9353a); }
.avatar .status-dot {
  position: absolute; right: -1px; bottom: -1px;
  width: 11px; height: 11px; border-radius: 50%;
  border: 2px solid #fff;
  background: var(--ink-3);
}
.avatar .status-dot.active { background: var(--ok); }
.avatar .status-dot.alert { background: var(--danger); }
.avatar .status-dot.done { background: var(--info); }

.monitor-main { flex: 1; min-width: 0; }
.monitor-name { font-weight: 700; font-size: 13.5px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.monitor-meta { font-size: 11.5px; color: var(--ink-3); margin-top: 1px; }
.monitor-flow { display: flex; align-items: center; gap: 6px; margin-top: 5px; flex-wrap: wrap; }
.flow-item {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11px; padding: 2px 7px; border-radius: 5px;
  background: var(--line-2); color: var(--ink-2);
  font-variant-numeric: tabular-nums;
}
.flow-item.now { background: var(--ok-soft); color: #0b7a5f; font-weight: 700; }
.flow-item.done { background: var(--info-soft); color: #1c6f9e; }
.flow-item.miss { background: var(--danger-soft); color: #b3262a; font-weight: 700; }
.flow-arrow { color: #cbd5e1; font-size: 9px; }
.monitor-right { text-align: right; flex: 0 0 auto; }
.monitor-pct { font-size: 18px; font-weight: 800; font-variant-numeric: tabular-nums; }
.monitor-pct small { font-size: 11px; color: var(--ink-3); font-weight: 600; }
.progress-mini {
  width: 62px; height: 5px; border-radius: 3px; background: var(--line);
  margin-top: 5px; overflow: hidden;
}
.progress-mini span { display: block; height: 100%; background: var(--ok); border-radius: 3px; }

/* ---------- 타임 테이블 ---------- */
.timeline { position: relative; padding-left: 6px; }
.tl-item {
  display: flex; gap: 12px; padding: 11px 18px 11px 14px;
  border-bottom: 1px solid var(--line-2);
  align-items: flex-start;
}
.tl-item:last-child { border-bottom: none; }
.tl-item:hover { background: #fbfcfe; }
.tl-time {
  flex: 0 0 76px; font-variant-numeric: tabular-nums;
  font-weight: 700; font-size: 13px; color: var(--ink);
  padding-top: 1px;
}
.tl-time .dur { display: block; font-size: 10.5px; font-weight: 600; color: var(--ink-3); }
.tl-bar { flex: 0 0 3px; align-self: stretch; border-radius: 3px; background: var(--brand); min-height: 34px; }
.tl-bar.ok { background: var(--ok); }
.tl-bar.warn { background: var(--warn); }
.tl-bar.danger { background: var(--danger); }
.tl-bar.info { background: var(--info); }
.tl-bar.gray { background: #cbd5e1; }
.tl-body { flex: 1; min-width: 0; }
.tl-title { font-weight: 700; font-size: 13.5px; display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.tl-sub { font-size: 11.5px; color: var(--ink-3); margin-top: 2px; }
.tl-actions { display: flex; align-items: center; gap: 5px; flex: 0 0 auto; }

/* ---------- 오늘의 업무 체크리스트 ---------- */
.task-list { display: flex; flex-direction: column; }
.task-row {
  display: flex; align-items: flex-start; gap: 11px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--line-2);
  cursor: pointer;
  transition: background .15s;
}
.task-row:last-child { border-bottom: none; }
.task-row:hover { background: #fbfcfe; }
.task-row.is-done { opacity: .55; }
.task-row.is-done .task-title { text-decoration: line-through; }
.check {
  flex: 0 0 20px; width: 20px; height: 20px; margin-top: 1px;
  border-radius: 6px; border: 2px solid #cdd6e4;
  display: grid; place-items: center;
  font-size: 11px; color: transparent;
  transition: all .15s;
  background: #fff;
}
.task-row.is-done .check {
  background: var(--ok); border-color: var(--ok); color: #fff;
}
.task-body { flex: 1; min-width: 0; }
.task-title { font-size: 13.5px; font-weight: 600; display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.task-desc { font-size: 11.5px; color: var(--ink-3); margin-top: 3px; line-height: 1.45; }
.task-foot { display: flex; align-items: center; gap: 8px; margin-top: 6px; font-size: 11px; color: var(--ink-3); }
.progress-bar {
  height: 8px; border-radius: 5px; background: var(--line); overflow: hidden;
}
.progress-bar span {
  display: block; height: 100%; border-radius: 5px;
  background: linear-gradient(90deg, var(--ok), #34c79c);
  transition: width .3s;
}
.task-summary { display: flex; align-items: center; gap: 12px; }
.task-summary .pct { font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; }

/* ---------- 주간 배정 매트릭스 ---------- */
.matrix-wrap { overflow: auto; max-height: 620px; }
table.matrix {
  border-collapse: separate; border-spacing: 0;
  font-size: 12.5px; width: 100%;
  min-width: 900px;
}
table.matrix th, table.matrix td {
  border-right: 1px solid var(--line-2);
  border-bottom: 1px solid var(--line-2);
  padding: 8px 10px;
  vertical-align: top;
}
table.matrix thead th {
  position: sticky; top: 0; z-index: 3;
  background: #fafbfd; color: var(--ink-2);
  font-size: 11.5px; font-weight: 700; text-align: left;
  white-space: nowrap;
}
table.matrix thead th.dow-col { text-align: center; min-width: 150px; }
table.matrix th.time-col {
  position: sticky; left: 0; z-index: 2;
  background: #fafbfd; min-width: 88px;
  font-variant-numeric: tabular-nums;
  font-weight: 700; font-size: 11.5px; color: var(--ink-2);
}
table.matrix thead th.time-col { z-index: 4; }
.mx-cell { display: flex; flex-direction: column; gap: 4px; min-height: 34px; }
.mx-item {
  border-radius: 7px; padding: 5px 8px;
  background: var(--brand-soft);
  border-left: 3px solid var(--brand);
  font-size: 11.5px; line-height: 1.35;
}
.mx-item.empty { background: #fafbfd; border-left-color: transparent; }
.mx-item .mx-inst { font-weight: 700; color: #23306b; }
.mx-item .mx-ins { color: #4a5568; display: flex; align-items: center; gap: 4px; }
.mx-item .mx-flag { font-size: 10px; color: var(--ink-3); }
.mx-item.tone-2 { background: var(--ok-soft); border-left-color: var(--ok); }
.mx-item.tone-3 { background: var(--warn-soft); border-left-color: var(--warn); }
.mx-item.tone-4 { background: var(--purple-soft); border-left-color: var(--purple); }
.mx-item.tone-5 { background: var(--info-soft); border-left-color: var(--info); }
.mx-item.tone-6 { background: var(--danger-soft); border-left-color: var(--danger); }

/* 요일 컬럼 더 (오늘 강조) */
.dow-today { background: var(--brand-soft) !important; color: #2a44cc !important; }

/* ---------- 강사 카드 ---------- */
.ins-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(310px, 1fr)); gap: 14px; }
.ins-card {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 15px 16px; box-shadow: var(--shadow-sm);
  cursor: pointer; transition: transform .16s, box-shadow .16s, border-color .16s;
  display: flex; flex-direction: column; gap: 11px;
}
.ins-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: #d5ddf0; }
.ins-head { display: flex; gap: 11px; align-items: center; }
.ins-avatar {
  width: 46px; height: 46px; border-radius: 12px; flex: 0 0 46px;
  display: grid; place-items: center; font-size: 16px; font-weight: 800; color: #fff;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
}
.ins-avatar.av-2 { background: linear-gradient(135deg, #10a37f, #0e8a6c); }
.ins-avatar.av-3 { background: linear-gradient(135deg, #e8a33d, #d18a1e); }
.ins-avatar.av-4 { background: linear-gradient(135deg, #8b5cf6, #6d3fd4); }
.ins-avatar.av-5 { background: linear-gradient(135deg, #2f9bd8, #1f7cad); }
.ins-avatar.av-6 { background: linear-gradient(135deg, #e5484d, #c9353a); }
.ins-name { font-size: 14.5px; font-weight: 700; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.ins-name-sub { font-size: 11px; color: var(--ink-3); font-weight: 500; }
.ins-facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 10px; }
.fact { font-size: 11.5px; color: var(--ink-2); display: flex; align-items: center; gap: 5px; min-width: 0; }
.fact i { color: var(--ink-3); width: 12px; font-size: 11px; flex: 0 0 12px; }
.fact span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ins-tags { display: flex; flex-wrap: wrap; gap: 5px; }
.ins-foot {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; padding-top: 10px; border-top: 1px dashed var(--line);
  font-size: 11.5px; color: var(--ink-3);
}
.degree-chip { display: inline-flex; align-items: center; gap: 5px; font-weight: 700; }
.degree-chip.yes { color: #0b7a5f; }
.degree-chip.no { color: #b3262a; }

/* ---------- 기관 카드 ---------- */
.inst-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.inst-card {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 15px 16px; box-shadow: var(--shadow-sm); cursor: pointer;
  transition: transform .16s, box-shadow .16s, border-color .16s;
  display: flex; flex-direction: column; gap: 10px;
}
.inst-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: #d5ddf0; }
.inst-top { display: flex; align-items: flex-start; gap: 10px; }
.inst-icon {
  width: 42px; height: 42px; border-radius: 11px; flex: 0 0 42px;
  display: grid; place-items: center; font-size: 16px;
  background: var(--brand-soft); color: var(--brand);
}
.inst-icon.t-유치원 { background: var(--purple-soft); color: var(--purple); }
.inst-icon.t-초등학교 { background: var(--info-soft); color: var(--info); }
.inst-icon.t-문화센터 { background: var(--warn-soft); color: #a9741d; }
.inst-name { font-size: 14.5px; font-weight: 700; }
.inst-loc { font-size: 11.5px; color: var(--ink-3); margin-top: 1px; }
.inst-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; text-align: center; }
.inst-stat { background: #fafbfd; border-radius: 9px; padding: 8px 4px; }
.inst-stat b { display: block; font-size: 16px; font-weight: 800; font-variant-numeric: tabular-nums; }
.inst-stat span { font-size: 10.5px; color: var(--ink-3); font-weight: 600; }

/* ---------- 필드 리스트 (상세) ---------- */
.dl { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 22px; }
.dl-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.dl-row { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.dl-key { font-size: 11px; color: var(--ink-3); font-weight: 700; letter-spacing: .01em; }
.dl-val { font-size: 13px; font-weight: 600; color: var(--ink); word-break: break-word; }
.dl-val.muted { color: var(--ink-3); font-weight: 500; }

.career { display: flex; flex-direction: column; gap: 0; }
.career-item {
  display: flex; gap: 11px; padding: 10px 0;
  border-bottom: 1px dashed var(--line);
}
.career-item:last-child { border-bottom: none; }
.career-dot {
  flex: 0 0 9px; width: 9px; height: 9px; border-radius: 50%;
  background: var(--brand); margin-top: 5px;
}
.career-period { font-size: 11px; color: var(--ink-3); font-weight: 700; font-variant-numeric: tabular-nums; }
.career-org { font-size: 13px; font-weight: 700; }
.career-role { font-size: 11.5px; color: var(--ink-2); }

/* ---------- 소통 기록 ---------- */
.comm-list { display: flex; flex-direction: column; }
.comm-row {
  display: flex; gap: 12px; padding: 13px 18px;
  border-bottom: 1px solid var(--line-2); align-items: flex-start;
}
.comm-row:last-child { border-bottom: none; }
.comm-row:hover { background: #fbfcfe; }
.comm-ico {
  flex: 0 0 34px; width: 34px; height: 34px; border-radius: 9px;
  display: grid; place-items: center; font-size: 13px;
  background: var(--line-2); color: var(--ink-2);
}
.comm-ico.ch-전화 { background: var(--info-soft); color: var(--info); }
.comm-ico.ch-문자 { background: var(--ok-soft); color: var(--ok); }
.comm-ico.ch-카카오톡 { background: var(--warn-soft); color: #a9741d; }
.comm-ico.ch-이메일 { background: var(--purple-soft); color: var(--purple); }
.comm-ico.ch-방문 { background: var(--brand-soft); color: var(--brand); }
.comm-ico.ch-대면 { background: var(--brand-soft); color: var(--brand); }
.comm-body { flex: 1; min-width: 0; }
.comm-top { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.comm-topic { font-size: 13.5px; font-weight: 700; }
.comm-text { font-size: 12.5px; color: var(--ink-2); margin-top: 3px; line-height: 1.5; }
.comm-follow {
  margin-top: 7px; font-size: 11.5px; padding: 6px 9px; border-radius: 7px;
  background: var(--warn-soft); color: #8a5c14;
  display: flex; align-items: center; gap: 6px;
}
.comm-follow.done { background: var(--ok-soft); color: #0b7a5f; }
.comm-when { font-size: 11px; color: var(--ink-3); flex: 0 0 auto; text-align: right; }

/* ---------- 이슈 ---------- */
.issue-sev { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 700; }
.issue-sev.high { color: #b3262a; }
.issue-sev.medium { color: #a9741d; }
.issue-sev.low { color: #6b7686; }
.dot-sev { width: 7px; height: 7px; border-radius: 50%; }
.dot-sev.high { background: var(--danger); }
.dot-sev.medium { background: var(--warn); }
.dot-sev.low { background: #a9b3c2; }

/* ---------- 차트 ---------- */
.chart-box { position: relative; height: 260px; }
.chart-box.sm { height: 200px; }
.chart-box.lg { height: 300px; }
.legend { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; font-size: 11.5px; color: var(--ink-2); }
.legend i { width: 9px; height: 9px; border-radius: 3px; display: inline-block; margin-right: 5px; }

.stat-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 1px; background: var(--line-2); }
.stat-strip .ss { background: #fff; padding: 13px 16px; }
.stat-strip .ss b { display: block; font-size: 20px; font-weight: 800; font-variant-numeric: tabular-nums; }
.stat-strip .ss span { font-size: 11px; color: var(--ink-3); font-weight: 600; }
/* 기관 상세 — '우리 수강 인원' 강조 (원 전체 원생 수가 아님을 드러냄) */
.stat-strip .ss.ss-key { background: #f4f7ff; }
.stat-strip .ss.ss-key b { color: #3355ff; }

/* ---------- 학급 구성 ---------- */
.class-groups { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; }
.class-group { border: 1px solid var(--line); border-radius: 11px; padding: 12px 14px; background: #fff; }
.cg-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 9px; }
.cg-age { font-size: 14px; font-weight: 800; color: var(--ink); }
.cg-meta { font-size: 11.5px; color: var(--ink-3); font-weight: 600; white-space: nowrap; }
.cg-meta b { color: #3355ff; font-variant-numeric: tabular-nums; }
.cg-classes { display: flex; flex-wrap: wrap; gap: 5px; }
.cg-chip {
  font-size: 11.5px; font-weight: 600; padding: 3px 9px; border-radius: 999px;
  background: #f1f4fb; color: #48506b; border: 1px solid #e2e7f5;
}
tr.row-total > td {
  background: #fafbfd; font-weight: 800; border-top: 2px solid var(--line);
  font-variant-numeric: tabular-nums;
}

/* ----------  ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); padding: 0 18px; overflow-x: auto; }
.tab {
  padding: 11px 14px; font-size: 13px; font-weight: 600; color: var(--ink-3);
  border-bottom: 2px solid transparent; white-space: nowrap;
  background: none; border-top: none; border-left: none; border-right: none;
  transition: color .15s, border-color .15s;
}
.tab:hover { color: var(--ink); }
.tab.is-active { color: var(--brand); border-bottom-color: var(--brand); }
.tab-body { padding: 16px 18px; }
.tab-pane { display: none; }
.tab-pane.is-active { display: block; }

/* ---------- 모달 ---------- */
.modal-mask {
  position: fixed; inset: 0; background: rgba(16, 24, 40, .45);
  backdrop-filter: blur(2px);
  display: none; align-items: flex-start; justify-content: center;
  z-index: 100; padding: 36px 16px; overflow-y: auto;
}
.modal-mask.is-open { display: flex; }
.modal {
  background: #fff; border-radius: 16px; width: 100%; max-width: 720px;
  box-shadow: 0 24px 60px rgba(16, 24, 40, .28);
  animation: pop .18s ease-out;
}
.modal.wide { max-width: 980px; }
.modal.narrow { max-width: 520px; }
@keyframes pop {
  from { opacity: 0; transform: translateY(-10px) scale(.98); }
  to { opacity: 1; transform: none; }
}
.modal-head {
  display: flex; align-items: center; gap: 10px;
  padding: 16px 20px; border-bottom: 1px solid var(--line-2);
}
.modal-head h3 { font-size: 16px; flex: 1; }
.modal-head .sub { font-size: 11.5px; color: var(--ink-3); font-weight: 500; }
.modal-body { padding: 18px 20px; max-height: calc(100vh - 220px); overflow-y: auto; }
.modal-foot {
  display: flex; align-items: center; gap: 8px;
  padding: 14px 20px; border-top: 1px solid var(--line-2); background: #fafbfd;
  border-radius: 0 0 16px 16px;
}
.modal-foot .spacer { flex: 1; }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px; }
.form-grid .span-2 { grid-column: span 2; }
.form-sec {
  font-size: 11.5px; font-weight: 800; color: var(--brand);
  letter-spacing: .04em; text-transform: uppercase;
  margin: 4px 0 2px; grid-column: span 2;
  padding-bottom: 6px; border-bottom: 1px solid var(--line-2);
}
.check-row { display: flex; align-items: center; gap: 8px; }
.check-row input[type="checkbox"] {
  width: 16px; height: 16px; accent-color: var(--brand); cursor: pointer;
}
.check-row label { font-size: 12.5px; font-weight: 600; color: var(--ink-2); cursor: pointer; }

/* ---------- toast ---------- */
.toast-wrap {
  position: fixed; right: 20px; bottom: 20px; z-index: 200;
  display: flex; flex-direction: column; gap: 8px; align-items: flex-end;
}
.toast {
  background: #101828; color: #fff;
  padding: 11px 16px; border-radius: 10px;
  font-size: 13px; font-weight: 600;
  box-shadow: 0 10px 30px rgba(16, 24, 40, .3);
  display: flex; align-items: center; gap: 9px;
  animation: slideIn .2s ease-out;
  max-width: 360px;
}
.toast.ok i { color: #34c79c; }
.toast.err i { color: #ff7a7d; }
@keyframes slideIn {
  from { opacity: 0; transform: translateX(16px); }
  to { opacity: 1; transform: none; }
}

/* ---------- 상태 ---------- */
.empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 8px; padding: 44px 20px; color: var(--ink-3); text-align: center;
}
.empty i { font-size: 26px; color: #cdd6e4; }
.empty p { font-size: 13px; font-weight: 600; }
.empty small { font-size: 11.5px; }

.skeleton {
  background: linear-gradient(90deg, #f1f4f9 25%, #e8edf5 37%, #f1f4f9 63%);
  background-size: 400% 100%;
  animation: shimmer 1.3s ease-in-out infinite;
  border-radius: 8px;
}
@keyframes shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

.loading-line { padding: 30px; text-align: center; color: var(--ink-3); font-size: 13px; }

/* ---------- 유틸 ---------- */
.flex { display: flex; }
.ac { align-items: center; }
.jb { justify-content: space-between; }
.je { justify-content: flex-end; }
.gap-4 { gap: 4px; } .gap-6 { gap: 6px; } .gap-8 { gap: 8px; } .gap-10 { gap: 10px; } .gap-12 { gap: 12px; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.mt-0 { margin-top: 0; } .mt-6 { margin-top: 6px; } .mt-10 { margin-top: 10px; } .mt-14 { margin-top: 14px; }
.mb-0 { margin-bottom: 0; } .mb-10 { margin-bottom: 10px; } .mb-14 { margin-bottom: 14px; }
.txt-sm { font-size: 11.5px; color: var(--ink-3); }
.txt-mid { font-size: 12.5px; color: var(--ink-2); }
.strong { font-weight: 700; }
.muted { color: var(--ink-3); }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.only-mobile { display: none; }
.hidden { display: none !important; }
.clickable { cursor: pointer; }
.divider { height: 1px; background: var(--line-2); margin: 14px 0; }

.flag { font-size: 13px; line-height: 1; }
.loc-pill {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11px; color: var(--ink-2); font-weight: 600;
}

/* ---------- 다음 수업 카드 (대시보드) ---------- */
.next-card { border: 1px solid #dfe5f5; box-shadow: 0 1px 2px rgba(51,85,255,.06), 0 10px 28px rgba(51,85,255,.08); }
.next-body {
  padding: 16px 18px; display: flex; flex-wrap: wrap;
  align-items: center; gap: 14px;
}
.next-body > * { min-width: 0; }

.next-flag {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--brand-soft), #f6f4ff);
  border: 1px solid #e0e5ff; flex: 0 0 auto;
}
.next-flag.next-ongoing { background: linear-gradient(135deg, var(--ok-soft), #e9fbf5); border-color: #c8ecdf; }
.next-flag.next-ended   { background: linear-gradient(135deg, #f5f7fb, #eef2f8); border-color: var(--line); }
.next-flag .nf-badge {
  width: 42px; height: 42px; border-radius: 12px; flex: 0 0 42px;
  display: grid; place-items: center; font-size: 17px; color: #fff;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
}
.next-flag.next-ongoing .nf-badge { background: linear-gradient(135deg, var(--ok), #0e8a6c); }
.next-flag.next-ended .nf-badge { background: linear-gradient(135deg, #9aa5b8, #7d8a9e); }
.next-flag .nf-text { min-width: 0; }
.next-flag .nf-label { font-size: 11.5px; font-weight: 700; color: var(--ink-3); }
.next-flag .nf-time {
  font-size: 21px; font-weight: 800; font-variant-numeric: tabular-nums;
  letter-spacing: -.3px; color: var(--ink); white-space: nowrap;
}
.next-flag .nf-time small { font-size: 12px; font-weight: 600; color: var(--ink-3); margin-left: 3px; }

.next-org {
  display: flex; align-items: flex-start; gap: 10px;
  flex: 1 1 240px; padding-right: 14px;
  border-right: 1px dashed var(--line);
}
.next-org .no-ico {
  width: 36px; height: 36px; border-radius: 10px; flex: 0 0 36px;
  display: grid; place-items: center; font-size: 14px;
  background: var(--warn-soft); color: var(--warn);
}
.next-org .no-name { font-size: 16px; font-weight: 800; letter-spacing: -.3px; line-height: 1.3; }
.next-org .no-meta { font-size: 11.5px; color: var(--ink-3); font-weight: 600; margin-top: 2px; }

.next-who { display: flex; flex-wrap: wrap; gap: 10px; flex: 1 1 340px; }
.next-person {
  display: flex; align-items: center; gap: 9px;
  padding: 9px 13px; border-radius: var(--radius-sm);
  background: #fbfcfe; border: 1px solid var(--line-2);
  flex: 1 1 160px; min-width: 0;
}
.next-person .np-role {
  font-size: 10.5px; font-weight: 700; color: var(--ink-3);
  letter-spacing: .3px;
}
.next-person .np-name {
  font-size: 13.5px; font-weight: 700; margin-top: 1px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.next-person .np-sub { font-size: 11px; color: var(--ink-3); margin-top: 1px; }
.next-person.np-empty { opacity: .65; }
.next-person.np-assist { background: var(--purple-soft); border-color: #e2d8fd; }

.next-chips { display: flex; flex-wrap: wrap; gap: 6px; flex: 1 1 100%; }

/* ---------- 지금 수업 중 (여러 원 동시 진행) ---------- */
.next-body.now-mode {
  display: block; padding: 14px 18px 16px;
}
.now-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; flex-wrap: wrap; margin-bottom: 11px;
}
.now-count {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 13px; font-weight: 700; color: #0e8a6c;
}
.now-count i { font-size: 12px; }
.now-count b { font-size: 17px; font-variant-numeric: tabular-nums; }

.now-grid {
  display: grid; gap: 10px;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
}
.now-card {
  border: 1px solid #c8ecdf; border-radius: var(--radius-sm);
  background: linear-gradient(160deg, #f2fbf8, #fbfdfe);
  padding: 12px 14px; min-width: 0;
  display: flex; flex-direction: column; gap: 9px;
}
.now-top {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; flex-wrap: wrap;
}
.now-time {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 15px; font-weight: 800; color: var(--ink);
  font-variant-numeric: tabular-nums; letter-spacing: -.2px;
}
.now-time i { font-size: 11px; color: var(--ok); }
.now-left {
  font-size: 11px; font-weight: 700; color: #0e8a6c;
  background: #dff6ee; border-radius: 999px; padding: 3px 9px;
  white-space: nowrap;
}
.now-org { display: flex; align-items: flex-start; gap: 9px; min-width: 0; }
.now-org .no-ico {
  width: 32px; height: 32px; border-radius: 9px; flex: 0 0 32px;
  display: grid; place-items: center; font-size: 13px;
  background: var(--warn-soft); color: var(--warn);
}
.now-org-txt { min-width: 0; }
.now-org .no-name { font-size: 14.5px; font-weight: 800; letter-spacing: -.3px; line-height: 1.3; }
.now-org .no-meta { font-size: 11px; color: var(--ink-3); font-weight: 600; margin-top: 2px; }

.now-who { display: flex; gap: 8px; flex-wrap: wrap; }
.now-person {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 11px; border-radius: var(--radius-sm);
  background: #fff; border: 1px solid var(--line-2);
  flex: 1 1 150px; min-width: 0;
}
.now-person .np-role { font-size: 10px; font-weight: 700; color: var(--ink-3); letter-spacing: .3px; }
.now-person .np-name {
  font-size: 12.5px; font-weight: 700; margin-top: 1px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.now-person .np-sub { font-size: 10.5px; color: var(--ink-3); margin-top: 1px; }
.now-person.np-empty { opacity: .65; }
.now-person.np-assist { background: var(--purple-soft); border-color: #e2d8fd; }

.now-chips { display: flex; flex-wrap: wrap; gap: 6px; }

@media (max-width: 860px) {
  .next-org { border-right: none; border-bottom: 1px dashed var(--line); padding: 0 0 12px; }
}

@media (max-width: 1280px) {
  .dash-top { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-6 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 1080px) {
  .dash-mid, .dash-bot { grid-template-columns: minmax(0, 1fr); }
  .grid-3, .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .sidebar {
    position: fixed; left: 0; top: 0;
    transform: translateX(-100%);
    transition: transform .22s ease;
    box-shadow: 4px 0 30px rgba(16, 24, 40, .3);
  }
  .sidebar.is-open { transform: none; }
  .only-mobile { display: grid; }
  .content { padding: 16px; }
  .topbar { padding: 12px 16px; }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .form-grid .span-2 { grid-column: span 1; }
  .dl, .dl-3 { grid-template-columns: minmax(0, 1fr); }
  .topbar-right .pill:not(.pill-live) { display: none; }
}
@media (max-width: 620px) {
  .dash-top { grid-template-columns: minmax(0, 1fr); }
  .grid-2, .grid-3, .grid-4, .grid-6 { grid-template-columns: minmax(0, 1fr); }
  .kpi-value { font-size: 26px; }
  .inst-stats { grid-template-columns: repeat(3, 1fr); }
}

@media print {
  .sidebar, .topbar-right, .tl-actions, .icon-btn { display: none; }
  .content { padding: 0; }
}
