/* Teacher Dashboard */
.teacher-page { --base-size: 16px; }
.t-badge { font-family: var(--font); font-size: .55em; background: var(--primary); color: #fff; border-radius: 999px; padding: .15em .7em; margin-left: 6px; font-weight: 700; }
.t-main { max-width: 1500px; }
.t-gate { max-width: 560px; margin: 8vh auto; text-align: center; background: #fff; border: 2px solid var(--line); border-radius: 24px; padding: 32px; box-shadow: var(--shadow); }
.t-gate .hero-snake { font-size: 4em; }
.t-gate h1 { font-size: 2.2em; }
.t-err { color: var(--bad-ink); font-weight: 700; }

.t-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin: 8px 0 16px; }
.t-head h1 { font-size: 2.2em; margin: 0; }
.t-head p { margin: 2px 0 0; }
.t-head-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.t-head-actions .btn-google { flex-direction: row; }

.t-classes { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.t-class { font: inherit; font-weight: 700; background: #fff; border: 2px solid var(--line); border-radius: 999px; padding: .4em 1em; cursor: pointer; color: var(--ink); }
.t-class span { background: #f3eee3; border-radius: 999px; padding: 0 .55em; margin-left: 4px; font-size: .85em; }
.t-class.on { background: var(--primary); border-color: var(--primary); color: #fff; }
.t-class.on span { background: rgba(255,255,255,.25); }
.t-class-bar { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; background: #fff; border: 2px solid var(--line); border-radius: 14px; padding: 10px 14px; margin-bottom: 14px; }
.t-class-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.t-tiles { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; margin-bottom: 22px; }
.t-tiles .stat-value small { font-size: .55em; color: var(--muted); font-weight: 400; }
.stat-alert { border-color: #ffa8a8; background: #fff5f5; }

.t-topics { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; margin-bottom: 24px; }
.t-topic { background: #fff; border: 2px solid var(--line); border-left: 6px solid var(--tc); border-radius: 14px; padding: 10px 12px; }
.t-topic-name { font-weight: 700; }
.t-topic-meta { font-size: .8em; color: var(--muted); }

.t-table-bar { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.t-table-bar .section-title { margin: 0; }
.t-table-tools { display: flex; gap: 8px; align-items: center; }
.t-table-tools input { font: inherit; padding: .45em .8em; border: 2px solid var(--line); border-radius: 12px; min-width: 240px; background: #fff; }
.t-table-wrap { background: #fff; border: 2px solid var(--line); border-radius: 18px; overflow: auto; box-shadow: var(--shadow); }
.t-table { width: 100%; border-collapse: collapse; font-size: .95em; }
.t-table th { position: sticky; top: 0; background: #f8f5ee; text-align: left; border-bottom: 2px solid var(--line); padding: 0; white-space: nowrap; }
.t-table th .sort { font: inherit; font-weight: 700; background: none; border: 0; padding: 10px 12px; cursor: pointer; color: var(--muted); width: 100%; text-align: left; }
.t-table th .sort.on { color: var(--primary); }
.t-table td { padding: 9px 12px; border-bottom: 1px solid #f0ebe0; white-space: nowrap; }
.t-table tbody tr[data-i] { cursor: pointer; }
.t-table tbody tr[data-i]:hover, .t-table tbody tr[data-i]:focus { background: #f6f3ff; outline: none; }
.t-table tr.is-stuck td:first-child { box-shadow: inset 5px 0 0 #fa5252; }
.t-name b { display: block; }
.t-name small { color: var(--muted); }
.t-prog { display: flex; align-items: center; gap: 8px; min-width: 130px; }
.t-prog .bar { flex: 1; margin: 0; }
.t-tries { font-size: .8em; background: #f1f3f5; border-radius: 999px; padding: .05em .5em; color: var(--muted); }
.t-tries.hot { background: #ffe3e3; color: #c92a2a; font-weight: 700; }
.t-notjoined td { color: var(--muted); background: #fcfbf8; }
.t-empty { background: #fff; border: 2px dashed var(--line); border-radius: 18px; padding: 30px; text-align: center; color: var(--muted); }

/* student detail */
.modal.modal-wide { width: min(980px, 100%); }
.t-detail-top { display: flex; justify-content: space-between; gap: 12px; }
.t-detail-top h2 { margin: 0; font-size: 1.8em; }
.t-detail-stats { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; margin: 14px 0; }
.t-detail-stats div { background: #f8f5ee; border-radius: 14px; padding: 10px; text-align: center; }
.t-detail-stats b { display: block; font-family: var(--display); font-size: 1.6em; }
.t-detail-stats span { font-size: .8em; color: var(--muted); }
.t-detail h3 { margin: 16px 0 8px; font-size: 1.15em; }
.t-days { display: grid; grid-template-columns: repeat(14, 1fr); gap: 6px; }
.t-day { text-align: center; }
.t-day-bar { height: 60px; background: #f3eee3; border-radius: 8px; display: flex; align-items: flex-end; overflow: hidden; }
.t-day-bar span { display: block; width: 100%; background: var(--primary); border-radius: 8px 8px 0 0; }
.t-day-n { font-size: .8em; font-weight: 700; min-height: 1.2em; }
.t-day-l { font-size: .75em; color: var(--muted); }
.t-legend { font-family: var(--font); font-size: .7em; font-weight: 400; margin-left: 8px; }
.t-legend .c { display: inline-block; width: 14px; height: 14px; vertical-align: -2px; margin: 0 3px 0 10px; border-radius: 4px; }
.t-grid { display: flex; flex-direction: column; gap: 6px; }
.t-grid-row { display: grid; grid-template-columns: 170px 1fr; align-items: center; gap: 8px; }
.t-grid-name { font-weight: 700; font-size: .9em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.t-grid-cells { display: grid; grid-template-columns: repeat(15, 1fr); gap: 4px; }
.t-grid .c { font: inherit; font-size: .75em; font-weight: 700; aspect-ratio: 1; min-width: 0; border-radius: 6px; border: 2px solid #e9e4d8; background: #faf8f3; color: #a9a294; cursor: pointer; padding: 0; }
.c-typed { background: #d0ebff !important; border-color: #74c0fc !important; color: #1864ab !important; }
.c-coded { background: #ffe066 !important; border-color: #f5b400 !important; color: #5c4400 !important; }
.c-tried { background: #fff5f5 !important; border-color: #ff8787 !important; color: #c92a2a !important; }
.t-legend .c-typed, .t-legend .c-coded, .t-legend .c-tried { border: 2px solid; }
.t-grid .c.sel { outline: 3px solid var(--primary); outline-offset: 1px; }
.t-level-info { margin-top: 14px; background: #f8f5ee; border-radius: 14px; padding: 12px 14px; }
.t-level-info h4 { margin: 0 0 6px; font-family: var(--display); font-size: 1.1em; }
.t-li-stats { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-bottom: 8px; font-size: .92em; }
.t-code { max-height: 260px; overflow: auto; }

/* import */
.t-import h2 { display: flex; align-items: center; gap: 10px; }
.g-list { display: flex; flex-direction: column; gap: 6px; max-height: 50vh; overflow: auto; margin: 10px 0 16px; }
.g-item { display: flex; gap: 10px; align-items: center; background: #f8f5ee; border-radius: 12px; padding: 10px 12px; cursor: pointer; }
.g-item input { width: 20px; height: 20px; }
.modal textarea { width: 100%; font-family: var(--mono); font-size: .9em; padding: .6em .8em; border: 2px solid var(--line); border-radius: 12px; background: #fffdf9; resize: vertical; }

@media (max-width: 1000px) {
  .t-tiles { grid-template-columns: repeat(2, 1fr); }
  .t-detail-stats { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 600px) {
  .t-tiles { grid-template-columns: 1fr; }
  .t-grid-row { grid-template-columns: 1fr; }
  .t-table-tools input { min-width: 0; width: 100%; }
  .t-table-tools { width: 100%; }
  .t-days { gap: 3px; }
}

/* invites, teachers, class codes */
.t-joincode { margin-top: 4px; font-size: .95em; }
.t-joincode b { font-family: var(--mono); font-size: 1.15em; letter-spacing: .12em; background: #fff3bf; border-radius: 8px; padding: .05em .4em; }
.t-sub { margin: 18px 0 6px; font-size: 1.1em; }
.t-invites { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.t-invites li { display: flex; justify-content: space-between; align-items: center; gap: 10px; background: #f8f5ee; border-radius: 12px; padding: 8px 12px; flex-wrap: wrap; }
.t-inv-actions { display: flex; gap: 6px; }
.t-invite-box { display: flex; gap: 8px; margin-top: 12px; }
.t-invite-box input { flex: 1; min-width: 0; font: inherit; font-family: var(--mono); font-size: .85em; padding: .5em .7em; border: 2px solid var(--primary); border-radius: 10px; background: #f6f3ff; }

.t-placements { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; background: #fff9db; border-radius: 12px; padding: 8px 12px; font-size: .92em; }
.t-placements span { background: #fff; border-radius: 999px; padding: .1em .6em; border: 2px solid #e9e4d8; }
.t-placements span.ok { border-color: #69db7c; }
