/* ============================================================
   WOW Studio CRM — Teacher portal styles (Phase 4)
   Mobile-first, 360px+. Loads after tokens.css + components.css and
   reuses .m-topbar / .m-body / .m-tabbar / .m-card / .att-btn from the
   Phase 1 mobile shell. On screens 900px and wider the app is shown
   inside a phone frame next to a prototype-controls panel.
   ============================================================ */
html, body { height: 100%; }
body.t-body { margin: 0; background: var(--bg-app); }
.t-app { display: flex; flex-direction: column; height: 100vh; height: 100dvh; background: var(--bg-app); position: relative; overflow: hidden; }
.min0 { min-width: 0; }
.t-app .mono { font-family: var(--font-mono); font-size: var(--text-xs); }
.t-app .age { color: var(--color-danger-700); font-weight: var(--weight-medium); }
.t-app .badge.sm { height: 18px; font-size: 11px; padding: 0 6px; }

/* ---------- Top bar ---------- */
.t-app .m-topbar { padding: 0 var(--space-2) 0 var(--space-3); gap: var(--space-2); }
.t-left { display: flex; align-items: center; gap: var(--space-2); min-width: 0; flex: 1; }
.t-back { width: 36px; height: 36px; flex: none; display: grid; place-items: center; border-radius: 50%; color: #fff; margin-left: -6px; }
.t-back:hover { background: rgba(255,255,255,0.1); text-decoration: none; }
.t-back .icon { width: 22px; height: 22px; }
.t-title { font-size: var(--text-md); font-weight: var(--weight-semibold); line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.t-app .m-topbar .branch { display: flex; align-items: center; gap: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.t-branch { display: inline-flex; align-items: center; gap: 2px; background: rgba(255,255,255,0.14); color: #fff; border: 0; border-radius: var(--radius-full); padding: 1px 6px 1px 8px; font: inherit; font-size: var(--text-xs); cursor: pointer; }
.t-branch .icon { width: 14px; height: 14px; }
.t-right { display: flex; align-items: center; gap: 2px; flex: none; }
.t-iconbtn { position: relative; width: 40px; height: 40px; display: grid; place-items: center; border-radius: 50%; color: #fff; background: transparent; border: 0; cursor: pointer; }
.t-iconbtn:hover { background: rgba(255,255,255,0.1); text-decoration: none; }
.t-iconbtn .icon { width: 22px; height: 22px; }
.t-iconbtn .dot { position: absolute; top: 8px; right: 9px; width: 9px; height: 9px; border-radius: 50%; background: var(--color-accent-500); border: 2px solid var(--color-primary-900); }
.t-avatar { width: 32px; height: 32px; margin: 0 4px; border-radius: 50%; background: rgba(255,255,255,0.18); color: #fff; display: grid; place-items: center; font-size: 11px; font-weight: var(--weight-semibold); border: 0; cursor: pointer; font-family: inherit; }

/* ---------- Body + tab bar ---------- */
.t-app .m-body { padding-bottom: var(--space-8); }
.t-app .m-tabbar { padding-bottom: env(safe-area-inset-bottom); }
.m-tabbar a.m-tab { text-decoration: none; }
.m-tab:hover { color: var(--text-primary); }
.m-tab.active:hover { color: var(--color-primary-600); }

/* ---------- Sections and list rows ---------- */
.t-section { margin-bottom: var(--space-5); }
.t-section-h { display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-3); margin: 0 2px var(--space-2); font-size: var(--text-xs); font-weight: var(--weight-semibold); text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); }
.t-section-h a, .t-section-h .sub { font-weight: var(--weight-medium); text-transform: none; letter-spacing: 0; }
.m-card.flush { padding: 0; }
.m-row { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-3) var(--space-4); min-height: 56px; border-bottom: 1px solid var(--border-default); color: inherit; }
.m-row:last-child { border-bottom: 0; }
a.m-row:hover { text-decoration: none; background: var(--bg-subtle); }
a.m-row:active { background: var(--color-gray-100); }
.m-row .grow { flex: 1; min-width: 0; }
.m-row .t { font-weight: var(--weight-medium); line-height: 1.3; }
.m-row .s { font-size: var(--text-xs); color: var(--text-muted); margin-top: 2px; line-height: 1.35; }
.m-row .chev { width: 18px; height: 18px; color: var(--color-gray-400); flex: none; }
.m-row .right { flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.t-time { width: 46px; flex: none; font-variant-numeric: tabular-nums; font-size: var(--text-sm); font-weight: var(--weight-semibold); line-height: 1.25; }
.t-time .end { display: block; font-size: 11px; font-weight: var(--weight-regular); color: var(--text-muted); }
.t-bar { width: 4px; align-self: stretch; min-height: 32px; border-radius: 2px; background: var(--c, var(--color-gray-300)); flex: none; }
.t-bar.ballet { --c: #B5468A; }
.t-bar.jazz { --c: var(--color-accent-500); }
.t-bar.piano { --c: var(--color-info-500); }
.t-bar.contemporary { --c: #2A9D8F; }
.t-bar.hiphop { --c: var(--color-primary-500); }
.t-bar.vocal { --c: #D9640B; }
.t-bar.violin { --c: #6C7A1F; }
.t-bar.trial { --c: var(--color-accent-700); }
.t-bar.makeup { --c: var(--color-success-500); }
.m-row.cancelled .t { text-decoration: line-through; color: var(--text-muted); }
.t-empty { padding: var(--space-4); font-size: var(--text-sm); color: var(--text-muted); text-align: center; }
.t-credit { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: var(--radius-full); background: var(--color-primary-50); color: var(--color-primary-700); font-weight: var(--weight-semibold); font-variant-numeric: tabular-nums; font-size: var(--text-xs); white-space: nowrap; }
.t-credit.zero { background: var(--bg-subtle); color: var(--text-muted); font-weight: var(--weight-medium); }
.t-foot-note { font-size: var(--text-xs); color: var(--text-muted); text-align: center; margin: var(--space-4) var(--space-2) 0; line-height: 1.5; }

/* ---------- Schedule ---------- */
.t-week-nav { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); margin-bottom: var(--space-3); }
.t-week-nav .range { font-size: var(--text-sm); font-weight: var(--weight-semibold); font-variant-numeric: tabular-nums; }
.t-week-nav .btn-icon { width: 40px; height: 40px; }
.t-day { margin-bottom: var(--space-4); }
.t-day-h { display: flex; align-items: center; gap: var(--space-2); padding: 0 2px var(--space-2); }
.t-day-h .d { display: flex; align-items: baseline; gap: 6px; font-variant-numeric: tabular-nums; }
.t-day-h .dow { font-size: var(--text-xs); text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); font-weight: var(--weight-semibold); }
.t-day-h .date { font-size: var(--text-sm); font-weight: var(--weight-semibold); }
.t-day-h.today .dow, .t-day-h.today .date { color: var(--color-primary-600); }
.t-day-h .today-pill { font-size: 10px; font-weight: var(--weight-semibold); background: var(--color-primary-600); color: #fff; border-radius: var(--radius-full); padding: 1px 7px; text-transform: uppercase; letter-spacing: 0.05em; }
.t-day-h .note { margin-left: auto; font-size: var(--text-xs); color: var(--color-warning-700); background: var(--color-warning-50); border-radius: var(--radius-full); padding: 2px 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 55%; }
.t-day-h .note.break { color: var(--text-muted); background: var(--bg-subtle); }
.t-day .m-card.empty-day { padding: var(--space-2) var(--space-4); font-size: var(--text-xs); color: var(--text-muted); border-style: dashed; }

/* ---------- Attendance ---------- */
.t-seg { display: grid; grid-template-columns: repeat(3, 1fr); width: 100%; margin-bottom: var(--space-4); }
.t-seg button { padding: 8px 4px; min-height: 40px; }
.t-att-row { display: flex; flex-direction: column; gap: var(--space-2); padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--border-default); }
.t-att-row:last-child { border-bottom: 0; }
.t-att-row .who { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); min-height: 24px; }
.t-att-row .who .name { font-weight: var(--weight-medium); }
.t-att-row .who .meta { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.t-app .att-btn { min-height: 44px; }
.t-app .att-btns.two { grid-template-columns: 1fr 1fr; }
.att-btn:disabled { opacity: 0.55; cursor: not-allowed; }
.t-absent-extra { background: var(--bg-subtle); border-radius: var(--radius-md); padding: var(--space-2) var(--space-3); display: flex; flex-direction: column; gap: var(--space-2); font-size: var(--text-xs); }
.t-absent-extra .check { font-size: var(--text-xs); align-items: flex-start; line-height: 1.4; }
.t-absent-extra .check input { margin-top: 1px; flex: none; }
.t-absent-extra .input { height: 36px; font-size: var(--text-xs); width: 100%; }
.t-summary { display: flex; gap: var(--space-2); flex-wrap: wrap; font-size: var(--text-xs); color: var(--text-secondary); align-items: center; }
.m-actionbar { position: sticky; bottom: 0; padding: var(--space-3) 0 0; margin-top: var(--space-3); background: linear-gradient(to bottom, rgba(248,248,250,0), var(--bg-app) 40%); }
.m-actionbar .btn { width: 100%; min-height: 48px; font-size: var(--text-md); }
.m-actionbar .hint { text-align: center; font-size: var(--text-xs); color: var(--text-muted); margin-top: 6px; line-height: 1.4; }
.t-kv { display: grid; grid-template-columns: 104px 1fr; gap: var(--space-2) var(--space-3); font-size: var(--text-sm); margin: 0; }
.t-kv dt { color: var(--text-muted); }
.t-kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.t-app .timeline li { padding-bottom: var(--space-3); }

/* ---------- Notes ---------- */
.t-note-form { display: flex; flex-direction: column; gap: var(--space-2); margin-top: var(--space-2); }
.t-note-form .textarea { min-height: 72px; width: 100%; }
.t-note-form .row { display: flex; gap: var(--space-2); justify-content: flex-end; }

/* ---------- Students ---------- */
.t-search { position: relative; margin-bottom: var(--space-3); }
.t-search .icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--text-muted); pointer-events: none; }
.t-search .input { width: 100%; padding-left: 36px; height: 44px; }
.t-chips { display: flex; gap: var(--space-2); overflow-x: auto; padding: 2px 2px 6px; margin: 0 -2px var(--space-3); scrollbar-width: none; }
.t-chips::-webkit-scrollbar { display: none; }
.t-chip { flex: none; height: 34px; padding: 0 14px; border-radius: var(--radius-full); border: 1px solid var(--border-strong); background: var(--bg-surface); font: inherit; font-size: var(--text-sm); font-weight: var(--weight-medium); color: var(--text-secondary); cursor: pointer; }
.t-chip.active { background: var(--color-primary-600); border-color: var(--color-primary-600); color: #fff; }
.t-phone { font-family: var(--font-mono); font-size: var(--text-xs); color: var(--text-secondary); white-space: nowrap; }
.t-hidden { display: inline-flex; align-items: center; gap: 4px; font-size: var(--text-xs); color: var(--text-muted); }
.t-hidden .icon { width: 14px; height: 14px; }

/* ---------- Salary ---------- */
.t-hero { display: block; background: var(--color-primary-900); color: #fff; border-radius: var(--radius-lg); padding: var(--space-4); margin-bottom: var(--space-4); }
a.t-hero:hover { text-decoration: none; background: var(--color-primary-800); }
.t-hero .lbl { font-size: var(--text-xs); color: rgba(255,255,255,0.75); display: flex; justify-content: space-between; align-items: center; gap: var(--space-2); }
.t-hero .amt { font-size: 30px; font-weight: var(--weight-semibold); font-variant-numeric: tabular-nums; letter-spacing: -0.01em; margin: 6px 0 2px; }
.t-hero .sub { font-size: var(--text-xs); color: rgba(255,255,255,0.75); line-height: 1.4; }
.t-hero .badge { background: rgba(255,255,255,0.12); border-color: transparent; color: #fff; }
.t-steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; font-size: var(--text-sm); }
.t-steps li { display: flex; gap: var(--space-3); align-items: flex-start; color: var(--text-muted); }
.t-steps .n { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--color-gray-300); display: grid; place-items: center; font-size: 11px; font-weight: var(--weight-semibold); flex: none; }
.t-steps li.done { color: var(--color-success-700); }
.t-steps li.done .n { background: var(--color-success-500); border-color: var(--color-success-500); color: #fff; }
.t-steps li.current { color: var(--text-primary); font-weight: var(--weight-medium); }
.t-steps li.current .n { border-color: var(--color-primary-600); color: var(--color-primary-700); }
.t-steps li.rejected { color: var(--color-danger-700); }
.t-steps li.rejected .n { border-color: var(--color-danger-500); color: var(--color-danger-700); }
.t-steps .when { display: block; font-size: var(--text-xs); color: var(--text-muted); font-weight: var(--weight-regular); }
.t-group-h { display: flex; justify-content: space-between; gap: var(--space-2); padding: var(--space-3) var(--space-4); background: var(--bg-subtle); border-bottom: 1px solid var(--border-default); border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
.t-group-h .t { font-weight: var(--weight-semibold); font-size: var(--text-sm); }
.t-group-h .r { font-size: var(--text-xs); color: var(--text-muted); margin-top: 2px; }
.t-line { display: grid; grid-template-columns: 1fr auto; gap: 2px var(--space-3); padding: var(--space-2) var(--space-4); border-bottom: 1px dashed var(--border-default); font-size: var(--text-sm); align-items: start; }
.t-line:last-child { border-bottom: 0; }
.t-line .dt { font-variant-numeric: tabular-nums; font-weight: var(--weight-medium); }
.t-line .s { grid-column: 1; font-size: var(--text-xs); color: var(--text-muted); display: flex; flex-wrap: wrap; gap: 4px 6px; align-items: center; }
.t-line .amt { grid-column: 2; grid-row: 1 / span 2; text-align: right; font-variant-numeric: tabular-nums; align-self: center; white-space: nowrap; }
.t-line.muted .dt, .t-line.muted .amt { color: var(--text-muted); }
.t-line.sub { background: var(--bg-subtle); border-bottom: 0; font-weight: var(--weight-semibold); border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
.t-totals .t-line.net { font-size: var(--text-md); font-weight: var(--weight-semibold); border-top: 2px solid var(--border-strong); border-bottom: 0; }

/* ---------- Bottom sheet ---------- */
.t-sheet { position: absolute; inset: 0; background: rgba(23,23,27,0.45); display: flex; align-items: flex-end; z-index: 60; }
.t-sheet .panel { width: 100%; background: var(--bg-surface); border-radius: 20px 20px 0 0; padding: var(--space-2) var(--space-4) calc(var(--space-6) + env(safe-area-inset-bottom)); max-height: 80%; overflow-y: auto; box-shadow: var(--shadow-lg); box-sizing: border-box; }
.t-sheet .handle { width: 36px; height: 4px; border-radius: 2px; background: var(--color-gray-300); margin: 4px auto var(--space-3); }
.t-sheet h3 { font-size: var(--text-md); margin: 0 0 var(--space-2); }
.t-opt { display: flex; align-items: center; gap: var(--space-3); min-height: 52px; padding: var(--space-2) 2px; border: 0; border-bottom: 1px solid var(--border-default); font-size: var(--text-sm); width: 100%; background: none; font-family: inherit; text-align: left; cursor: pointer; color: var(--text-primary); box-sizing: border-box; }
.t-opt:last-child { border-bottom: 0; }
a.t-opt:hover { text-decoration: none; }
.t-opt .grow { flex: 1; }
.t-opt .s { display: block; font-size: var(--text-xs); color: var(--text-muted); font-weight: var(--weight-regular); }
.t-opt.active { color: var(--color-primary-700); font-weight: var(--weight-semibold); }
.t-opt .icon { width: 18px; height: 18px; color: var(--color-primary-600); flex: none; }

/* ---------- Toasts inside the phone ---------- */
.t-body .toast-stack { left: 50%; right: auto; bottom: 84px; transform: translateX(-50%); width: min(340px, calc(100vw - 32px)); }

/* ---------- Wide screens: phone frame + prototype controls ---------- */
.t-side { display: none; }
@media (min-width: 900px) {
  body.t-body { display: flex; justify-content: center; align-items: flex-start; gap: 40px; padding: 32px 24px; min-height: 100vh; box-sizing: border-box; background: #E3E3E8; }
  .t-app { width: 390px; height: 820px; flex: none; border: 10px solid var(--color-gray-900); border-radius: 40px; box-shadow: var(--shadow-lg); }
  .t-body .toast-stack { bottom: 130px; transform: translateX(calc(-50% - 170px)); }
  .t-side { display: block; width: 300px; background: var(--bg-surface); border: 1px solid var(--border-default); border-radius: var(--radius-lg); padding: var(--space-4) var(--space-5); font-size: var(--text-sm); position: sticky; top: 32px; }
  .t-side h4 { font-size: var(--text-xs); text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted); margin: var(--space-5) 0 var(--space-2); }
  .t-side h4:first-child { margin-top: 0; }
  .t-side p { margin: 0 0 var(--space-3); }
  .t-side .field { margin-bottom: var(--space-3); }
  .t-side .select { width: 100%; }
  .t-side .toggle { margin-bottom: 4px; }
  .t-side ul { list-style: none; margin: 0; padding: 0; }
  .t-side li { padding: 3px 0; }
  .t-side li.cur a { font-weight: var(--weight-semibold); }
  .t-side .clock { font-size: var(--text-xs); color: var(--text-muted); margin: var(--space-3) 0; font-variant-numeric: tabular-nums; }
}
