/* Teacher portal — dedicated mobile-first redesign. Separate from app.css (the
   admin desktop shell) so this can be styled boldly for a phone-only audience
   without touching admin layout. Reuses the navy/gold brand tokens. */
:root {
  --brand-800: #0F2C59;
  --brand-900: #0A1F40;
  --accent: #1D4ED8;
  --gold: #E0A82E;
  --present: #16A34A; --present-soft: #DCFCE7;
  --absent: #DC2626;  --absent-soft: #FEE2E2;
  --late: #F59E0B;    --late-soft: #FEF3C7;
  --bg: #F3F5FA;
  --surface: #FFFFFF;
  --border: #E6EAF2;
  --text: #0F172A;
  --text-2: #64748B;
  --radius: 18px;
  --shadow: 0 4px 18px rgba(15, 44, 89, .08);
  --shadow-lg: 0 10px 30px rgba(15, 44, 89, .14);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { background: var(--bg); overflow-x: hidden; }
body.teacher-app {
  margin: 0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--text); font-size: 15px; line-height: 1.5;
}
.icon { display: inline-block; vertical-align: middle; }
a { color: inherit; text-decoration: none; }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: translateY(0); } }
@keyframes pop { 0% { transform: scale(.85); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }

/* ---------- Auth (login / change pin) ---------- */
.t-auth { min-height: 100vh; display: flex; flex-direction: column; }
.t-auth-top {
  background: radial-gradient(120% 140% at 20% -10%, #1c3f78 0%, var(--brand-800) 45%, var(--brand-900) 100%);
  color: #fff; padding: 56px 28px 64px; border-radius: 0 0 36px 36px; position: relative; overflow: hidden;
}
.t-auth-top::after {
  content: ""; position: absolute; right: -40px; top: -40px; width: 180px; height: 180px; border-radius: 50%;
  background: rgba(224, 168, 46, .18);
}
.t-auth-top::before {
  content: ""; position: absolute; left: -30px; bottom: -60px; width: 140px; height: 140px; border-radius: 50%;
  background: rgba(255,255,255,.06);
}
.t-mark { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 18px; position: relative; z-index: 1; }
.t-mark .dot { width: 11px; height: 11px; border-radius: 50%; background: var(--gold); }
.t-auth-top h1 { font-size: 24px; margin: 22px 0 4px; position: relative; z-index: 1; }
.t-auth-top p { margin: 0; color: rgba(255,255,255,.72); font-size: 14px; position: relative; z-index: 1; }
.t-auth-card { background: var(--surface); margin: -36px 16px 0; border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 26px 22px; position: relative; z-index: 2; animation: rise .4s ease both; flex: 1; }

.t-field { margin-bottom: 16px; }
.t-field label { display: block; font-size: 13px; font-weight: 700; margin-bottom: 7px; color: var(--text-2); }
.t-field input, .t-field select, .t-field textarea {
  width: 100%; min-height: 48px; padding: 12px 16px; border: 1.5px solid var(--border); border-radius: 14px;
  font-size: 16px; font-family: inherit; background: var(--bg); color: var(--text);
}
.t-field input:focus, .t-field select:focus, .t-field textarea:focus { outline: none; border-color: var(--accent); background: #fff; box-shadow: 0 0 0 4px rgba(29,78,216,.1); }

.t-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; width: 100%;
  background: linear-gradient(135deg, var(--brand-800), var(--brand-900)); color: #fff; border: none; min-height: 50px;
  padding: 13px 18px; border-radius: 14px; font-size: 16px; font-weight: 700; cursor: pointer;
  box-shadow: 0 8px 18px rgba(15,44,89,.25); transition: transform .15s ease;
}
.t-btn:active { transform: scale(.98); }
.t-btn.secondary { background: var(--bg); color: var(--text); box-shadow: none; border: 1.5px solid var(--border); }
.t-btn.danger { background: linear-gradient(135deg, var(--absent), #b91c1c); }
.t-msg { padding: 12px 15px; border-radius: 12px; margin-bottom: 16px; font-size: 14px; font-weight: 600; }
.t-msg.error { background: var(--absent-soft); color: var(--absent); }
.t-msg.ok { background: var(--present-soft); color: var(--present); }

/* ---------- Shell / home ---------- */
.t-wrap { max-width: 480px; margin: 0 auto; min-height: 100vh; padding: 0 0 100px; position: relative; }
@media (min-width: 640px) { body.teacher-app { display: flex; justify-content: center; } .t-wrap { background: var(--bg); } }

.t-hero {
  background: radial-gradient(130% 160% at 15% -20%, #1c3f78 0%, var(--brand-800) 50%, var(--brand-900) 100%);
  color: #fff; padding: 24px 18px 34px; border-radius: 0 0 28px 28px; position: relative; overflow: hidden;
}
.t-hero::after { content: ""; position: absolute; right: -30px; top: -30px; width: 140px; height: 140px; border-radius: 50%; background: rgba(224,168,46,.16); }
.t-hero-top { display: flex; align-items: center; justify-content: space-between; position: relative; z-index: 1; }
.t-hero-person { display: flex; align-items: center; gap: 12px; }
.t-avatar {
  width: 46px; height: 46px; border-radius: 50%; background: linear-gradient(135deg, var(--gold), #c98f1d);
  color: var(--brand-900); display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 16px; flex-shrink: 0;
}
.t-avatar.sm { width: 34px; height: 34px; font-size: 12px; background: var(--brand-800); color: #fff; }
.t-hero-greet { color: var(--gold); font-size: 12px; font-weight: 700; margin-bottom: 1px; }
.t-hero-name { font-weight: 800; font-size: 17px; }
.t-iconbtn {
  width: 40px; height: 40px; border-radius: 50%; background: rgba(255,255,255,.12); color: #fff;
  display: flex; align-items: center; justify-content: center; border: 1px solid rgba(255,255,255,.18); flex-shrink: 0;
}

.t-ring-row { display: flex; align-items: center; gap: 18px; margin-top: 22px; position: relative; z-index: 1; }
.t-ring { position: relative; width: 108px; height: 108px; flex-shrink: 0; }
.ring-svg circle { transition: stroke-dashoffset .6s ease; }
.t-ring-label { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.t-ring-label strong { font-size: 22px; font-weight: 800; line-height: 1; }
.t-ring-label span { font-size: 10px; color: rgba(255,255,255,.65); margin-top: 3px; font-weight: 600; }
.t-ring-side { flex: 1; min-width: 0; }
.t-ring-headline { font-weight: 800; font-size: 15px; }
.t-ring-sub { color: rgba(255,255,255,.65); font-size: 12px; margin-top: 2px; }
.t-ring-chips { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.t-ring-chips span { background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.16); border-radius: 99px; padding: 5px 11px; font-size: 11px; color: rgba(255,255,255,.85); }
.t-ring-chips strong { color: #fff; }

.t-section { padding: 18px 16px 6px; }
.t-section h2 { font-size: 12.5px; margin: 6px 0 12px; color: var(--text-2); font-weight: 800; text-transform: uppercase; letter-spacing: .05em; }

.t-class-card {
  background: var(--surface); border-radius: 16px; box-shadow: var(--shadow); padding: 16px; margin-bottom: 12px;
  display: flex; align-items: center; gap: 14px; animation: rise .32s ease both; border: 1px solid var(--border);
}
.t-class-icon { width: 46px; height: 46px; border-radius: 13px; background: #E8EEFC; color: var(--accent); display: flex; align-items: center; justify-content: center; flex-shrink: 0; font-size: 18px; font-weight: 800; }
.t-class-arrow { color: var(--border); flex-shrink: 0; }
.t-class-body { flex: 1; min-width: 0; }
.t-class-name { font-weight: 800; font-size: 15.5px; }
.t-class-sub { color: var(--text-2); font-size: 12.5px; margin-top: 2px; }
.t-progress-track { height: 5px; border-radius: 99px; background: var(--border); margin-top: 8px; overflow: hidden; }
.t-progress-fill { height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--accent), var(--gold)); transition: width .3s ease; }
.t-chip-done { display: inline-flex; align-items: center; gap: 4px; background: var(--present-soft); color: var(--present); font-size: 11px; font-weight: 800; padding: 5px 10px; border-radius: 99px; white-space: nowrap; flex-shrink: 0; }

.t-empty { text-align: center; padding: 48px 20px; color: var(--text-2); }
.t-empty .icon { color: var(--border); margin-bottom: 10px; }

/* Quick-action tiles (home screen shortcuts) */
.t-tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.t-tile { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 14px 8px; text-align: center; box-shadow: var(--shadow); animation: rise .3s ease both; }
.t-tile-icon { width: 38px; height: 38px; border-radius: 12px; margin: 0 auto 8px; display: flex; align-items: center; justify-content: center; }
.t-tile-icon.blue { background: #E8EEFC; color: var(--accent); }
.t-tile-icon.gold { background: #FBEEC9; color: #7A5B0A; }
.t-tile-icon.green { background: var(--present-soft); color: var(--present); }
.t-tile span { font-size: 11.5px; font-weight: 700; color: var(--text); }

/* ---------- Attendance-taking screen ---------- */
.t-topline {
  display: flex; align-items: center; gap: 12px; padding: 16px; background: var(--surface);
  border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 10;
}
.t-topline .t-title { font-weight: 800; font-size: 15.5px; }
.t-topline .t-sub { color: var(--text-2); font-size: 12px; margin-top: 1px; }
.t-topline-progress { margin-left: auto; text-align: right; font-size: 12px; font-weight: 800; color: var(--accent); }

.t-roster-row {
  background: var(--surface); border-radius: 15px; border: 1px solid var(--border); padding: 12px 14px; margin: 0 16px 10px;
  display: flex; align-items: center; gap: 12px; animation: rise .22s ease both;
}
.t-roster-name { flex: 1; font-weight: 700; font-size: 14.5px; min-width: 0; }
.t-roster-row .t-flag { color: var(--text-2); flex-shrink: 0; padding: 4px; }
.t-seg { display: flex; background: var(--bg); border-radius: 99px; padding: 3px; gap: 2px; flex-shrink: 0; }
.t-seg label { cursor: pointer; }
.t-seg input { display: none; }
.t-seg span { display: flex; align-items: center; justify-content: center; width: 42px; height: 42px; border-radius: 99px; color: var(--text-2); transition: background .15s ease, color .15s ease; }
.t-seg input:checked + span.present { background: var(--present); color: #fff; animation: pop .18s ease; }
.t-seg input:checked + span.late { background: var(--late); color: #fff; animation: pop .18s ease; }
.t-seg input:checked + span.absent { background: var(--absent); color: #fff; animation: pop .18s ease; }

.t-submit-bar { position: fixed; bottom: 78px; left: 0; right: 0; background: var(--surface); border-top: 1px solid var(--border); padding: 12px 16px; display: flex; justify-content: center; z-index: 20; box-shadow: 0 -4px 16px rgba(15,23,42,.06); border-radius: 14px; margin: 0 10px; max-width: 460px; left: 50%; transform: translateX(-50%); width: calc(100% - 20px); }
.t-submit-bar .inner { width: 100%; max-width: 480px; }

/* ---------- Incident report ---------- */
.t-chip-group { display: flex; flex-wrap: wrap; gap: 8px; }
.t-chip-pick { position: relative; }
.t-chip-pick input { position: absolute; opacity: 0; }
.t-chip-pick span {
  display: inline-flex; align-items: center; padding: 10px 15px; border-radius: 99px; border: 1.5px solid var(--border);
  font-size: 13.5px; font-weight: 700; color: var(--text-2); background: var(--surface);
}
.t-chip-pick input:checked + span { border-color: var(--accent); background: #E8EEFC; color: var(--accent); }
.t-chip-pick.sev-low input:checked + span { border-color: var(--text-2); background: var(--bg); color: var(--text); }
.t-chip-pick.sev-medium input:checked + span { border-color: var(--late); background: var(--late-soft); color: #92620a; }
.t-chip-pick.sev-high input:checked + span { border-color: var(--absent); background: var(--absent-soft); color: var(--absent); }

.t-incident-card { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 14px 16px; margin: 0 16px 10px; box-shadow: var(--shadow); animation: rise .25s ease both; }
.t-incident-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.t-badge { font-size: 11px; font-weight: 800; padding: 4px 10px; border-radius: 99px; white-space: nowrap; }
.t-badge.new { background: var(--absent-soft); color: var(--absent); }
.t-badge.reviewing { background: var(--late-soft); color: #92620a; }
.t-badge.action_taken { background: #E8EEFC; color: var(--accent); }
.t-badge.closed { background: var(--present-soft); color: var(--present); }

/* ---------- Tabbar ---------- */
.t-tabbar {
  position: fixed; bottom: 14px; left: 50%; transform: translateX(-50%); width: calc(100% - 32px); max-width: 448px;
  background: var(--brand-800); border-radius: 20px; display: flex; z-index: 30; box-shadow: var(--shadow-lg);
  padding: 6px; padding-bottom: calc(6px + env(safe-area-inset-bottom));
}
.t-tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 0; border-radius: 15px; color: rgba(255,255,255,.55); font-size: 10px; font-weight: 700; white-space: nowrap; }
.t-tabbar a.active { background: rgba(255,255,255,.12); color: var(--gold); }

.t-pill-link { display: inline-flex; align-items: center; padding: 9px 14px; border-radius: 99px; border: 1.5px solid var(--border); font-size: 13px; font-weight: 700; color: var(--text-2); background: var(--surface); }
.t-pill-link.active { border-color: var(--accent); background: #E8EEFC; color: var(--accent); }

.t-fab {
  position: fixed; right: 18px; bottom: 90px; width: 56px; height: 56px; border-radius: 50%;
  background: linear-gradient(135deg, var(--gold), #c98f1d); color: var(--brand-900); display: flex;
  align-items: center; justify-content: center; box-shadow: 0 10px 24px rgba(224,168,46,.4); z-index: 25;
}
.t-fab:active { transform: scale(.94); }
