/* availability-grid.css — "tansinh tg-v1" (9 Oct 2026)
   Styles for the time-grid availability page. Everything is prefixed tg-, or
   scoped under .tg-on for the four legacy classes the grid reuses
   (.av-block-body, .av-student-sub, .av-ttkb-lock, .av-action-trigger).
   Loaded AFTER availability-legacy.css. */

:root {
  --tg-ink: #1f2937;
  --tg-muted: #6b7280;
  --tg-faint: #9ca3af;
  --tg-line: #e5e7eb;
  --tg-line-soft: #eef0f3;
  --tg-page: #f3f4f6;
  --tg-std-bg: #eef3ff;  --tg-std-bd: #c7d7fe;  --tg-std-ink: #1e3a8a;
  --tg-sub-bg: #f3e8ff;  --tg-sub-bd: #d8b4fe;  --tg-sub-ink: #5b21b6;
  --tg-mk-bg:  #ecfdf5;  --tg-mk-bd:  #a7f3d0;  --tg-mk-ink:  #065f46;
  --tg-tr-bg:  #e0f2fe;  --tg-tr-bd:  #7dd3fc;  --tg-tr-ink:  #075985;
  --tg-abs-bg: #f3f4f6;  --tg-abs-bd: #d1d5db;  --tg-abs-ink: #9ca3af;
  --tg-now: #dc2626;
}

/* ---------- page frame ---------- */
.av-app .app-main.tg-main { max-width: 1480px; padding: 16px 16px 40px; }
.tg-hidden { display: none !important; }

/* ---------- toolbar ---------- */
.tg-toolbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px;
  margin: 0 0 12px; padding-left: 36px;
}
.tg-datenav { display: flex; align-items: center; gap: 6px; }
.tg-datelabel { font-size: 1rem; font-weight: 700; color: var(--tg-ink); white-space: nowrap; min-width: 170px; }
.tg-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-left: auto; }

.tg-ibtn, .tg-btn {
  height: 34px; border: 1px solid var(--tg-line); border-radius: 10px; background: #fff;
  color: var(--tg-muted); cursor: pointer; font-family: inherit; font-size: 0.82rem; font-weight: 600;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; transition: all 0.15s;
}
.tg-ibtn { width: 34px; }
.tg-btn { padding: 0 12px; }
.tg-ibtn:hover, .tg-btn:hover { border-color: var(--primary); color: var(--primary); background: #f0f6ff; }

.tg-seg { display: inline-flex; border: 1px solid var(--tg-line); border-radius: 10px; overflow: hidden; background: #fff; }
.tg-seg button, .tg-seg .av-viewmode-btn {
  border: 0; background: transparent; padding: 0 12px; height: 32px; margin: 0; border-radius: 0;
  font-family: inherit; font-size: 0.8rem; font-weight: 600; color: var(--tg-muted); cursor: pointer; box-shadow: none;
}
.tg-seg button + button, .tg-seg .av-viewmode-btn + .av-viewmode-btn { border-left: 1px solid var(--tg-line); }
.tg-seg button.active, .tg-seg .av-viewmode-btn.active { background: var(--primary); color: #fff; }

/* admin-only controls (the legacy .av-admin-only sets display:grid, so this page uses its own class) */
.tg-adm { display: none !important; }
body.av-role-admin .tg-adm, body.av-role-super_admin .tg-adm { display: inline-flex !important; }

/* ---------- teacher picker ---------- */
.tg-pick { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.tg-chip {
  display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px;
  border: 1px solid var(--tg-line); border-radius: 999px; background: #fff; color: var(--tg-muted);
  font-family: inherit; font-size: 0.8rem; font-weight: 600; cursor: pointer; white-space: nowrap;
}
.tg-chip:hover { border-color: var(--primary); color: var(--primary); }
.tg-chip.on { background: var(--primary); border-color: var(--primary); color: #fff; }
.tg-chip-sel { cursor: default; }
.tg-chip-x { border: 0; background: transparent; color: inherit; cursor: pointer; padding: 0 0 0 4px; font-size: 0.8rem; opacity: 0.8; }
.tg-chip-x:hover { opacity: 1; }
.tg-solo { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; color: var(--tg-ink); font-size: 0.9rem; }
.tg-solo i { color: var(--primary); }

.tg-searchwrap { position: relative; display: inline-flex; align-items: center; }
.tg-searchwrap > i { position: absolute; left: 10px; font-size: 0.75rem; color: var(--tg-faint); pointer-events: none; }
.tg-search {
  height: 32px; width: 190px; padding: 0 10px 0 28px; border: 1px solid var(--tg-line); border-radius: 999px;
  font-family: inherit; font-size: 0.8rem; color: var(--tg-ink); background: #fff; outline: none;
}
.tg-search:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.12); }
.tg-dd {
  position: absolute; top: 36px; left: 0; min-width: 240px; max-height: 320px; overflow: auto;
  background: #fff; border: 1px solid var(--tg-line); border-radius: 12px; box-shadow: 0 10px 28px rgba(16, 24, 40, 0.12);
  display: none; z-index: 60; padding: 4px;
}
.tg-dd.open { display: block; }
.tg-dd-item {
  display: flex; flex-direction: column; align-items: flex-start; width: 100%; border: 0; background: transparent;
  padding: 7px 10px; border-radius: 8px; font-family: inherit; font-size: 0.82rem; font-weight: 600; color: var(--tg-ink); cursor: pointer; text-align: left;
}
.tg-dd-item small { font-weight: 400; color: var(--tg-faint); font-size: 0.72rem; }
.tg-dd-item:hover { background: #f0f6ff; color: var(--primary); }
.tg-dd-none { padding: 10px; font-size: 0.8rem; color: var(--tg-faint); }

/* ---------- layout: grid + panel ---------- */
.tg-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 16px; align-items: start; }
.tg-gridwrap {
  max-height: calc(100vh - 150px); min-height: 240px; overflow: auto; background: #fff;
  border: 1px solid var(--tg-line); border-radius: 12px;
}
.tg-calendar.tg-legacy { padding: 12px; }

.tg-grid { display: block; min-width: 100%; }
.tg-head {
  display: grid; position: sticky; top: 0; z-index: 7; background: #fff;
  border-bottom: 1px solid var(--tg-line);
}
.tg-gutter-head { position: sticky; left: 0; z-index: 8; background: #fff; border-right: 1px solid var(--tg-line); }
.tg-colhead { position: relative; padding: 8px 8px 8px 10px; border-left: 1px solid var(--tg-line-soft); min-width: 0; }
.tg-colhead.tg-today { background: #f0f6ff; }
.tg-colname {
  display: block; width: 100%; text-align: left; border: 0; background: transparent; padding: 0; margin: 0 0 2px;
  font-family: inherit; font-size: 0.88rem; font-weight: 700; color: var(--tg-ink); cursor: pointer;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
button.tg-colname:hover { color: var(--primary); }
.tg-colname-off { cursor: default; color: var(--tg-muted); }
.tg-colday { display: flex; align-items: baseline; gap: 6px; cursor: default; }
.tg-colday span { font-size: 0.75rem; font-weight: 600; color: var(--tg-muted); }
.tg-colday b { font-size: 1.05rem; font-weight: 700; }
.tg-today .tg-colday b { color: var(--primary); }
.tg-colmeta { font-size: 0.72rem; color: var(--tg-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tg-colstat { display: flex; justify-content: space-between; gap: 6px; font-size: 0.72rem; color: var(--tg-muted); margin-top: 3px; }
.tg-free-ok { color: #047857; font-weight: 600; }
.tg-free-none { color: var(--tg-faint); }
.tg-bar { height: 4px; background: var(--tg-line); border-radius: 2px; margin-top: 4px; overflow: hidden; }
.tg-bar div { height: 100%; background: var(--primary); border-radius: 2px; }
.tg-colavail { font-size: 0.7rem; color: #0f766e; margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tg-add {
  position: absolute; top: 6px; right: 6px; width: 24px; height: 24px; border-radius: 8px;
  border: 1px solid var(--tg-line); background: #fff; color: var(--tg-muted); cursor: pointer; font-size: 0.7rem;
  display: none; align-items: center; justify-content: center;
}
body.av-role-admin .tg-add, body.av-role-super_admin .tg-add { display: inline-flex; }
.tg-add:hover { border-color: var(--primary); color: var(--primary); background: #f0f6ff; }
.tg-colhead-narrow { padding: 8px 4px; text-align: center; }
.tg-colhead-narrow .tg-colday { flex-direction: column; align-items: center; gap: 0; }

.tg-body {
  display: grid; position: relative;
  background-color: var(--tg-page);
  background-image: linear-gradient(to bottom, var(--tg-line) 1px, transparent 1px);
}
.tg-gutter { position: sticky; left: 0; z-index: 6; background: #fff; border-right: 1px solid var(--tg-line); }
.tg-hour {
  position: absolute; right: 6px; margin-top: 3px; font-size: 0.68rem; color: var(--tg-faint);
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
.tg-col { position: relative; border-left: 1px solid var(--tg-line-soft); min-width: 0; }
.tg-col.tg-today { box-shadow: inset 2px 0 0 0 rgba(13, 110, 253, 0.25); }
.tg-col-off { background: repeating-linear-gradient(135deg, #f3f4f6 0 8px, #eceef2 8px 16px); }
.tg-col-narrow { background: #f3f4f6; }
.tg-vlabel {
  position: absolute; top: 14px; left: 50%; transform: translateX(-50%) rotate(180deg);
  writing-mode: vertical-rl; font-size: 0.68rem; color: var(--tg-faint); white-space: nowrap;
}

/* the shift area: white, hour lines carried through */
.tg-on .av-block-body {
  position: absolute; left: 0; right: 0; flex: none; margin: 0; padding: 0; min-height: 0;
  background-color: #fff;
  background-image: linear-gradient(to bottom, var(--tg-line-soft) 1px, transparent 1px);
  border-top: 1px solid var(--tg-line); border-bottom: 1px solid var(--tg-line);
}
.tg-on .av-block-body.av-drop-refused { outline: 2px dashed #fca5a5; outline-offset: -2px; border-radius: 0; }
.tg-on .av-block-body.av-drop-at-end { box-shadow: inset 0 -3px 0 0 var(--primary); }

/* a student block */
.tg-on .av-student-sub.tg-blk {
  position: absolute; left: 3px; right: 3px; min-height: 0; margin: 0; z-index: 2;
  display: block; padding: 2px 6px; border-radius: 6px; overflow: hidden;
  font-size: 0.74rem; line-height: 1.25; cursor: grab;
  background: var(--tg-std-bg); border: 1px solid var(--tg-std-bd); color: var(--tg-std-ink);
  transition: box-shadow 0.12s;
}
.tg-on .av-student-sub.tg-blk:hover { background: var(--tg-std-bg); box-shadow: 0 2px 8px rgba(16, 24, 40, 0.12); z-index: 3; overflow: visible; }
.tg-on .av-student-sub.tg-sub { background: var(--tg-sub-bg); border-color: var(--tg-sub-bd); color: var(--tg-sub-ink); }
.tg-on .av-student-sub.tg-sub:hover { background: var(--tg-sub-bg); }
.tg-on .av-student-sub.tg-mk { background: var(--tg-mk-bg); border-color: var(--tg-mk-bd); color: var(--tg-mk-ink); }
.tg-on .av-student-sub.tg-mk:hover { background: var(--tg-mk-bg); }
.tg-on .av-student-sub.tg-tr { background: var(--tg-tr-bg); border-color: var(--tg-tr-bd); color: var(--tg-tr-ink); }
.tg-on .av-student-sub.tg-tr:hover { background: var(--tg-tr-bg); }
.tg-on .av-student-sub.tg-absent {
  background: var(--tg-abs-bg); border: 1px dashed var(--tg-abs-bd); color: var(--tg-abs-ink);
  cursor: default; left: 30%; z-index: 1;
}
.tg-on .av-student-sub.tg-absent:hover { background: var(--tg-abs-bg); }
.tg-on .av-student-sub.tg-absent .tg-blk-name { text-decoration: line-through; }
.tg-on .av-student-sub.tg-locked { border-style: solid; border-width: 1px 1px 1px 3px; }

.tg-blk-main { display: flex; align-items: center; gap: 4px; flex-wrap: nowrap; min-width: 0; white-space: nowrap; overflow: hidden; }
.tg-blk-name { font-weight: 700; overflow: hidden; text-overflow: ellipsis; }
.tg-blk-mins { color: inherit; opacity: 0.8; }
.tg-blk-sub { font-size: 0.68rem; opacity: 0.85; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.tg-orig { opacity: 0.7; }
.tg-lv {
  display: inline-block; font-size: 0.62rem; font-weight: 700; padding: 0 4px; border-radius: 3px;
  background: rgba(255, 255, 255, 0.7); border: 1px solid rgba(0, 0, 0, 0.08); color: inherit; line-height: 1.5; flex: none;
}
.tg-tag {
  display: inline-block; font-size: 0.62rem; font-weight: 600; padding: 0 6px; border-radius: 999px; line-height: 1.6;
  white-space: nowrap; flex: none;
}
.tg-tag-sub { background: #ede9fe; color: #5b21b6; }
.tg-tag-mk { background: #d1fae5; color: #065f46; }
.tg-tag-tr { background: #dbeafe; color: #1d4ed8; }
.tg-tag-abs { background: #e5e7eb; color: #6b7280; }
.tg-tag-late { background: #fef3c7; color: #92400e; margin-left: 4px; }
.tg-tag-off { background: #fef3c7; color: #92400e; }

/* the lock and gear inside a block: shown on hover, always on touch */
.tg-blk-tools { position: absolute; top: 2px; right: 2px; display: flex; gap: 2px; opacity: 0; transition: opacity 0.12s; }
.tg-on .av-student-sub.tg-blk:hover .tg-blk-tools { opacity: 1; }
.tg-on .av-student-sub .tg-tool,
.tg-on .av-student-sub .av-ttkb-lock,
.tg-on .av-student-sub .av-action-trigger {
  position: static; width: 20px; height: 20px; border-radius: 6px; border: 1px solid rgba(0, 0, 0, 0.12);
  background: rgba(255, 255, 255, 0.95); color: var(--tg-muted); font-size: 0.6rem; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; padding: 0; margin: 0; opacity: 1; transform: none;
}
.tg-on .av-student-sub .av-ttkb-lock.av-locked { background: #eff6ff; border-color: #93c5fd; color: #2563eb; }
.tg-on .av-student-sub .tg-tool:hover,
.tg-on .av-student-sub .av-ttkb-lock:hover,
.tg-on .av-student-sub .av-action-trigger:hover { background: #dbeafe; color: #1d4ed8; transform: none; }
.tg-tool-x { color: #b91c1c !important; }
@media (hover: none) { .tg-blk-tools { opacity: 1; } }

/* drag states (same classes availability.js toggles) */
.tg-on .av-student-sub.av-dragging { opacity: 0.35; transform: none; box-shadow: none; }
.tg-on .av-student-sub.av-drag-over-top { box-shadow: 0 -3px 0 0 var(--primary); }
.tg-on .av-student-sub.av-drag-over-bottom { box-shadow: 0 3px 0 0 var(--primary); }

/* free time inside a shift */
.tg-free {
  position: absolute; left: 3px; right: 3px; border: 1px dashed var(--tg-abs-bd); border-radius: 6px;
  color: var(--tg-faint); font-size: 0.68rem; display: flex; align-items: center; justify-content: center;
  pointer-events: none; z-index: 1;
}

/* ghost blocks in an off teacher's column */
.tg-ghost {
  position: absolute; left: 3px; right: 3px; z-index: 2; padding: 3px 6px; border-radius: 6px; overflow: visible;
  background: #fff; border: 1px dashed #d1d5db; color: var(--tg-muted); font-size: 0.74rem; line-height: 1.25;
}
.tg-ghost-done { border-style: solid; border-color: #a7f3d0; background: #f0fdf4; color: #065f46; }
.tg-ghost-act { display: flex; align-items: center; gap: 4px; margin-top: 2px; }
.tg-ghost .tg-tool { width: 18px; height: 18px; border-radius: 5px; border: 1px solid rgba(0,0,0,0.12); background: #fff; color: var(--tg-muted); font-size: 0.55rem; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; padding: 0; }
.tg-assign {
  display: inline-flex; align-items: center; height: 22px; padding: 0 9px; margin-top: 2px; border-radius: 6px;
  border: 1px solid #fcd34d; background: #fffbeb; color: #92400e; font-family: inherit; font-size: 0.68rem; font-weight: 700; cursor: pointer;
}
.tg-assign:hover { background: #fef3c7; }
.tg-done { display: inline-flex; align-items: center; gap: 4px; font-size: 0.68rem; font-weight: 700; color: #047857; white-space: nowrap; }

/* now line */
.tg-now { position: absolute; left: 0; right: 0; border-top: 2px solid var(--tg-now); z-index: 5; pointer-events: none; }
.tg-body > .tg-now { left: 48px; }
.tg-now span {
  position: absolute; left: 0; top: -9px; transform: translateX(calc(-100% - 4px));
  font-size: 0.66rem; font-weight: 700; color: var(--tg-now); background: #fff; padding: 0 3px; border-radius: 3px;
  font-variant-numeric: tabular-nums;
}
.tg-col > .tg-now span { transform: none; left: 2px; }

/* legend + empty state */
.tg-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; padding: 8px 12px; font-size: 0.72rem; color: var(--tg-muted); border-top: 1px solid var(--tg-line); background: #fff; }
.tg-legend span { display: inline-flex; align-items: center; gap: 5px; }
.tg-sw { width: 11px; height: 11px; border-radius: 3px; display: inline-block; border: 1px solid transparent; }
.tg-sw-std { background: var(--tg-std-bg); border-color: var(--tg-std-bd); }
.tg-sw-sub { background: var(--tg-sub-bg); border-color: var(--tg-sub-bd); }
.tg-sw-mk { background: var(--tg-mk-bg); border-color: var(--tg-mk-bd); }
.tg-sw-tr { background: var(--tg-tr-bg); border-color: var(--tg-tr-bd); }
.tg-sw-abs { background: var(--tg-abs-bg); border: 1px dashed var(--tg-abs-bd); }
.tg-sw-free { background: #fff; border: 1px dashed var(--tg-abs-bd); }
.tg-sw-now { background: var(--tg-now); height: 2px; border-radius: 1px; align-self: center; }
.tg-empty { padding: 48px 20px; text-align: center; color: var(--tg-muted); font-size: 0.9rem; }
.tg-empty i { display: block; font-size: 2rem; color: #d1d5db; margin-bottom: 10px; }

/* ---------- side panel ---------- */
.tg-panel { position: sticky; top: 12px; max-height: calc(100vh - 24px); overflow: auto; display: flex; flex-direction: column; gap: 12px; }
.tg-sec { background: #fff; border: 1px solid var(--tg-line); border-radius: 12px; overflow: hidden; }
.tg-panel-teacher .tg-adm-sec { display: none !important; }
.tg-sec-head { display: flex; align-items: center; gap: 8px; padding: 10px 12px; font-size: 0.82rem; font-weight: 700; color: var(--tg-ink); }
.tg-sec-head i { font-size: 0.8rem; }
.tg-sec-title { flex: 1; }
.tg-sec-extra { font-size: 0.7rem; font-weight: 600; opacity: 0.8; }
.tg-count { font-size: 0.72rem; font-weight: 700; padding: 1px 8px; border-radius: 999px; background: rgba(0, 0, 0, 0.06); }
.tg-sec-danger { background: #fef2f2; color: #991b1b; }
.tg-sec-warn { background: #fffbeb; color: #92400e; }
.tg-sec-success { background: #ecfdf5; color: #065f46; }
.tg-sec-ok { background: #ecfdf5; color: #065f46; }
.tg-sec-plain { background: #f8fafc; color: var(--tg-ink); border-bottom: 1px solid var(--tg-line); }
.tg-group { padding: 6px 12px; font-size: 0.72rem; color: var(--tg-muted); background: #f8fafc; border-top: 1px solid var(--tg-line); }
.tg-group b { color: var(--tg-ink); }
.tg-row { display: flex; align-items: center; gap: 8px; padding: 7px 12px; border-top: 1px solid var(--tg-line-soft); font-size: 0.78rem; color: var(--tg-ink); flex-wrap: wrap; }
.tg-row-done { background: #f0fdf4; }
.tg-row-name { flex: 1 1 110px; min-width: 0; font-weight: 600; display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.tg-row-name .tg-lv { background: #f3f4f6; }
.tg-row-sub { font-size: 0.68rem; font-weight: 400; color: var(--tg-faint); }
.tg-row-time { font-size: 0.74rem; color: var(--tg-muted); font-variant-numeric: tabular-nums; }
.tg-row-mins { font-size: 0.72rem; font-weight: 600; color: var(--tg-muted); font-variant-numeric: tabular-nums; }
.tg-row-note { font-size: 0.68rem; color: var(--tg-faint); flex-basis: 100%; }
.tg-row-bad { color: #dc2626; }
.tg-row .tg-tool { width: 18px; height: 18px; border-radius: 5px; border: 1px solid rgba(0,0,0,0.12); background: #fff; color: var(--tg-muted); font-size: 0.55rem; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; padding: 0; }
.tg-row .tg-assign { margin-top: 0; }

/* roster */
.tg-roswrap { position: relative; display: flex; align-items: center; padding: 8px 12px; border-bottom: 1px solid var(--tg-line-soft); }
.tg-roswrap > i { position: absolute; left: 22px; font-size: 0.72rem; color: var(--tg-faint); pointer-events: none; }
.tg-roswrap .tg-search { width: 100%; border-radius: 8px; }
.tg-ros { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; gap: 8px; align-items: center; padding: 8px 12px; border-top: 1px solid var(--tg-line-soft); }
.tg-av { width: 28px; height: 28px; border-radius: 50%; background: #e0e7ff; color: #3730a3; font-size: 0.68rem; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
.tg-ros-main { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.tg-ros-name { font-size: 0.8rem; font-weight: 600; color: var(--tg-ink); display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.tg-ros-name .tg-lv { background: #f3f4f6; }
.tg-ros-days { display: flex; flex-wrap: wrap; gap: 3px; }
.tg-dc { font-size: 0.66rem; padding: 0 5px; border-radius: 4px; background: #f3f4f6; border: 1px solid var(--tg-line); color: var(--tg-muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.tg-ros-brk { grid-column: 2 / -1; font-size: 0.68rem; color: var(--tg-muted); }
.tg-ros-none { color: var(--tg-faint); }
.tg-ros-empty { padding: 14px 12px; font-size: 0.8rem; color: var(--tg-faint); font-style: italic; }

/* ---------- small screens ---------- */
@media (max-width: 900px) {
  .tg-layout { grid-template-columns: 1fr; }
  .tg-panel { position: static; max-height: none; }
  .tg-gridwrap { max-height: 70vh; }
  .tg-tools { margin-left: 0; }
  .tg-search { width: 150px; }
}
@media (max-width: 600px) {
  .av-app .app-main.tg-main { padding: 12px 8px 32px; }
  .tg-datelabel { font-size: 0.9rem; min-width: 0; }
  .tg-toolbar { padding-left: 36px; }
}
@media (prefers-reduced-motion: reduce) {
  .tg-ibtn, .tg-btn, .tg-blk-tools, .tg-on .av-student-sub.tg-blk { transition: none; }
}
.tg-chip:focus-visible, .tg-ibtn:focus-visible, .tg-btn:focus-visible, .tg-colname:focus-visible, .tg-assign:focus-visible,
.tg-on .av-student-sub[draggable]:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

/* === tansinh tg-v3 BEGIN (9 Oct 2026): no time axis; each teacher's column is a list ===
   Overrides only, so deleting this block gives back the tg-v1 look.
   ".tg-calendar.tg-on .av-block-body" is deliberate: availability-legacy.css has
   ".av-student-sub:not(.av-substitute):not(.av-makeup-cal):not(.av-transfer-cal)"
   (four classes, with border !important), which beat tg-v1's card rules: it gave
   every card 6px of top and bottom padding and painted every card white. */

/* the grid: no hour column, no hour lines, as tall as its content */
.tg-calendar.tg-on .tg-body.tg-flow { height: auto; background-image: none; background-color: var(--tg-page); }
.tg-calendar.tg-on .tg-flow > .tg-col { display: flex; flex-direction: column; gap: 10px; padding: 8px 6px 14px; min-height: 140px; }
.tg-calendar.tg-on .tg-flow > .tg-col.tg-today { box-shadow: inset 0 0 0 9999px rgba(13, 110, 253, 0.035); }

/* one shift: a white box headed by its hours */
.tg-calendar.tg-on .tg-flow .av-block-body.tg-shift {
  position: relative; top: auto; left: auto; right: auto; height: auto;
  display: flex; flex-direction: column; gap: 5px; padding: 6px;
  background: #fff; background-image: none; border: 1px solid var(--tg-line); border-radius: 10px;
}
.tg-calendar.tg-on .tg-flow .av-block-body.tg-shift::before {
  content: attr(data-shift); padding: 0 2px; font-size: 0.7rem; font-weight: 600;
  color: var(--tg-muted); font-variant-numeric: tabular-nums;
}
.tg-calendar.tg-on .tg-flow .av-block-body.av-drop-refused { outline-offset: 2px; border-radius: 10px; }
.tg-flow-empty { padding: 6px 4px; font-size: 0.72rem; color: var(--tg-faint); }

/* a student: as tall as it needs, name wraps instead of being cut */
.tg-calendar.tg-on .tg-flow .av-student-sub.tg-blk {
  position: relative; top: auto; left: auto; right: auto; height: auto; min-height: 0; z-index: 1;
  padding: 5px 8px; border-radius: 8px; line-height: 1.3; overflow: visible;
  background: var(--tg-std-bg); color: var(--tg-std-ink); border: 1px solid var(--tg-std-bd) !important;
}
.tg-calendar.tg-on .tg-flow .av-student-sub.tg-sub { background: var(--tg-sub-bg); color: var(--tg-sub-ink); border-color: var(--tg-sub-bd) !important; }
.tg-calendar.tg-on .tg-flow .av-student-sub.tg-mk { background: var(--tg-mk-bg); color: var(--tg-mk-ink); border-color: var(--tg-mk-bd) !important; }
.tg-calendar.tg-on .tg-flow .av-student-sub.tg-tr { background: var(--tg-tr-bg); color: var(--tg-tr-ink); border-color: var(--tg-tr-bd) !important; }
.tg-calendar.tg-on .tg-flow .av-student-sub.tg-absent { background: var(--tg-abs-bg); color: var(--tg-abs-ink); border: 1px dashed var(--tg-abs-bd) !important; }
.tg-calendar.tg-on .tg-flow .av-student-sub.tg-locked { border-left-width: 3px !important; }

.tg-calendar.tg-on .tg-flow .tg-blk .tg-blk-main { display: block; white-space: normal; overflow: visible; }
.tg-calendar.tg-on .tg-flow .tg-blk .tg-blk-name { font-weight: 700; overflow-wrap: anywhere; }
.tg-calendar.tg-on .tg-flow .tg-blk .tg-blk-when { margin-top: 1px; font-size: 0.7rem; opacity: 0.85; font-variant-numeric: tabular-nums; }
.tg-calendar.tg-on .tg-flow .tg-blk .tg-blk-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.tg-calendar.tg-on .tg-flow .tg-blk .tg-tag-late { margin-left: 0; }

/* free time: one quiet row */
.tg-calendar.tg-on .tg-flow .tg-free {
  position: static; height: auto; display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 0 6px;
  padding: 3px 8px; border: 1px dashed var(--tg-line); border-radius: 8px; background: transparent;
  color: #9aa1ab; font-size: 0.68rem;
}
.tg-calendar.tg-on .tg-flow .tg-free b { font-weight: 600; white-space: nowrap; }
.tg-calendar.tg-on .tg-flow .tg-free span { white-space: nowrap; font-variant-numeric: tabular-nums; }

/* now: the lesson or gap in progress, or a thin line between two items */
.tg-calendar.tg-on .tg-flow .av-student-sub.tg-blk.tg-current { border-left: 3px solid var(--tg-now) !important; }
.tg-calendar.tg-on .tg-flow .tg-blk.tg-current .tg-blk-when::after { content: ' · đang học'; color: var(--tg-now); font-weight: 700; }
.tg-calendar.tg-on .tg-flow .tg-free.tg-current b::after { content: ' · bây giờ'; color: var(--tg-now); }
.tg-calendar.tg-on .tg-flow .tg-nowmark { position: relative; height: 0; margin: 5px 0; border-top: 2px solid var(--tg-now); }
.tg-calendar.tg-on .tg-flow .tg-nowmark span {
  position: absolute; left: 0; top: -9px; padding: 0 4px; border-radius: 3px; background: #fff;
  font-size: 0.66rem; font-weight: 700; color: var(--tg-now); font-variant-numeric: tabular-nums;
}

/* a teacher who is off: the students who need a substitute, in time order */
.tg-calendar.tg-on .tg-flow .tg-ghost { position: relative; top: auto; left: auto; right: auto; height: auto; }

/* a day with no shift in week view */
.tg-calendar.tg-on .tg-flow > .tg-col.tg-col-narrow { padding: 0; }
/* === tansinh tg-v3 END === */

/* === tansinh tg-v4 BEGIN (9 Oct 2026): the sidebar, and polish === */

/* chips wrap inside the card instead of spilling out of it */
.tg-calendar.tg-on .tg-flow .tg-blk .tg-blk-tags > .tg-lv,
.tg-calendar.tg-on .tg-flow .tg-blk .tg-blk-tags > .tg-tag {
  flex: 0 1 auto; min-width: 0; white-space: normal; overflow-wrap: anywhere; line-height: 1.45; padding: 1px 6px;
}

/* the column heading: the whole name on up to two lines, clear of the + button */
.tg-calendar.tg-on .tg-colhead:not(.tg-colhead-narrow) { padding-right: 34px; }
.tg-calendar.tg-on .tg-colname:not(.tg-colday) {
  white-space: normal; line-height: 1.2; overflow: hidden;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}

/* the sidebar: the existing dark menu, with the two teacher lists inside it */
.tg-sb { flex: 1 1 auto; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; padding: 4px 0 8px; border-top: 1px solid #334155; margin-top: 8px; }
.tg-sb-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 16px 5px; font-size: 0.72rem; font-weight: 700; color: #94a3b8; }
.tg-sb-count { font-size: 0.68rem; font-weight: 700; padding: 0 7px; border-radius: 999px; background: #334155; color: #cbd5e1; }
.tg-sb-list { display: flex; flex-direction: column; }
.tg-sb-row {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px; width: 100%; padding: 7px 16px 7px 13px;
  border: 0; border-left: 3px solid transparent; background: transparent; color: #cbd5e1;
  font-family: inherit; font-size: 0.8rem; text-align: left; cursor: pointer;
}
.tg-sb-row:hover { background: #334155; color: #fff; }
.tg-sb-row.on { background: #1e3a5f; color: #fff; border-left-color: #60a5fa; }
.tg-sb-row:focus-visible { outline: 2px solid #60a5fa; outline-offset: -2px; }
.tg-sb-static { cursor: default; }
.tg-sb-static:hover { background: transparent; color: #cbd5e1; }
.tg-sb-all { margin: 4px 0 2px; }
.tg-sb-name { font-weight: 600; display: flex; align-items: center; gap: 6px; }
.tg-sb-name i { font-size: 0.75rem; color: #94a3b8; }
.tg-sb-row.on .tg-sb-name i { color: #93c5fd; }
.tg-sb-sub { font-size: 0.68rem; line-height: 1.3; color: #94a3b8; font-variant-numeric: tabular-nums; }
.tg-sb-row.on .tg-sb-sub { color: #bfdbfe; }
.tg-sb-dot { width: 7px; height: 7px; border-radius: 50%; background: #34d399; display: inline-block; flex: none; }
.tg-sb-search { position: relative; padding: 2px 16px 6px; }
.tg-sb-search i { position: absolute; left: 26px; top: 50%; transform: translateY(-60%); font-size: 0.7rem; color: #64748b; pointer-events: none; }
.tg-sb-search input {
  width: 100%; box-sizing: border-box; height: 30px; padding: 0 8px 0 26px; border-radius: 8px;
  border: 1px solid #334155; background: #0f172a; color: #e2e8f0; font: inherit; font-size: 0.78rem; outline: none;
}
.tg-sb-search input:focus { border-color: #60a5fa; }
.tg-sb-empty { padding: 6px 16px; font-size: 0.74rem; color: #64748b; font-style: italic; }

/* wide screens: the menu stays open as a real sidebar, and the page moves over */
@media (min-width: 1100px) {
  body.tg-sb-on { padding-left: 250px; }
  body.tg-sb-on .sidebar-nav { transform: none; width: 250px; box-shadow: none; }
  body.tg-sb-on .sidebar-toggle, body.tg-sb-on .sidebar-overlay { display: none; }
  body.tg-sb-on .tg-toolbar { padding-left: 0; }
  body.tg-sb-on .tg-searchwrap { display: none; }     /* the sidebar has the search now */
}
/* === tansinh tg-v4 END === */

/* === tansinh tg-v5 BEGIN (9 Oct 2026): a redesigned sidebar, and the sections as one pane === */
/* ---- the sidebar ---- */
#sidebarNav.tg-sbx {
  width: 264px; padding: 0; background: linear-gradient(180deg, #0f172a 0%, #111b2e 55%, #0f172a 100%);
  border-right: 1px solid rgba(148, 163, 184, 0.12); color: #cbd5e1; font-family: Inter, system-ui, sans-serif;
}
#sidebarNav.tg-sbx .sidebar-brand {
  display: flex; align-items: center; gap: 10px; margin: 0; padding: 18px 18px 16px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.12); color: #f8fafc; font-size: 1rem; letter-spacing: 1.5px;
}
#sidebarNav.tg-sbx .sidebar-brand::before {
  content: "\f274"; font-family: "Font Awesome 6 Free"; font-weight: 900; font-size: 0.9rem; letter-spacing: 0;
  display: grid; place-items: center; width: 32px; height: 32px; border-radius: 10px; color: #fff;
  background: linear-gradient(135deg, #3b82f6, #6366f1); box-shadow: 0 4px 14px rgba(59, 130, 246, 0.35);
}
#sidebarNav.tg-sbx .sidebar-link {
  margin: 1px 10px; padding: 8px 12px; border-radius: 10px; font-size: 0.82rem; color: #94a3b8;
}
#sidebarNav.tg-sbx .sidebar-brand + .sidebar-link { margin-top: 10px; }
#sidebarNav.tg-sbx .sidebar-link:hover { background: rgba(148, 163, 184, 0.1); color: #e2e8f0; }
#sidebarNav.tg-sbx .sidebar-link.active { background: rgba(96, 165, 250, 0.14); color: #93c5fd; font-weight: 600; }
#sidebarNav.tg-sbx #sidebarLogout { margin: 6px 10px 12px; border-top: 1px solid rgba(148, 163, 184, 0.12); border-radius: 0 0 10px 10px; padding-top: 12px; }

.tg-sb-label {
  padding: 16px 20px 6px; font-size: 0.66rem; font-weight: 700; letter-spacing: 1.2px; text-transform: uppercase; color: #64748b;
}

/* ---- Điều phối: the sections ---- */
.tg-sbp { flex: none; display: flex; flex-direction: column; gap: 2px; padding-bottom: 4px; }
.tg-sbp-item {
  display: flex; align-items: center; gap: 10px; margin: 0 10px; padding: 7px 10px; border: 0; border-radius: 12px;
  background: transparent; color: #e2e8f0; font: inherit; text-align: left; cursor: pointer; position: relative;
  transition: background 0.15s;
}
.tg-sbp-item:hover { background: rgba(148, 163, 184, 0.1); }
.tg-sbp-item.on { background: rgba(96, 165, 250, 0.16); box-shadow: inset 0 0 0 1px rgba(96, 165, 250, 0.35); }
.tg-sbp-item.on::before { content: ""; position: absolute; left: -10px; top: 10px; bottom: 10px; width: 3px; border-radius: 0 3px 3px 0; background: #60a5fa; }
.tg-sbp-item:focus-visible { outline: 2px solid #60a5fa; outline-offset: 1px; }
.tg-sbp-ic { flex: none; display: grid; place-items: center; width: 32px; height: 32px; border-radius: 10px; font-size: 0.85rem; }
.tg-sbp-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.tg-sbp-title { font-size: 0.82rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tg-sbp-sub { font-size: 0.68rem; color: #94a3b8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tg-sbp-bar { height: 3px; border-radius: 3px; background: rgba(148, 163, 184, 0.18); overflow: hidden; margin-top: 2px; }
.tg-sbp-bar i { display: block; height: 100%; border-radius: 3px; }
.tg-sbp-n { flex: none; min-width: 22px; height: 20px; padding: 0 6px; border-radius: 999px; display: grid; place-items: center; font-size: 0.7rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.tg-sbp-ok { flex: none; display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; font-size: 0.6rem; background: rgba(52, 211, 153, 0.18); color: #6ee7b7; }

.tg-sbp-item.tone-r .tg-sbp-ic { background: rgba(248, 113, 113, 0.16); color: #fca5a5; }
.tg-sbp-item.tone-r .tg-sbp-n { background: #ef4444; color: #fff; }
.tg-sbp-item.tone-w .tg-sbp-ic { background: rgba(251, 191, 36, 0.15); color: #fcd34d; }
.tg-sbp-item.tone-w .tg-sbp-n { background: #f59e0b; color: #1f2937; }
.tg-sbp-item.tone-w .tg-sbp-bar i { background: #f59e0b; }
.tg-sbp-item.tone-ok .tg-sbp-ic { background: rgba(52, 211, 153, 0.14); color: #6ee7b7; }
.tg-sbp-item.tone-ok .tg-sbp-bar i { background: #34d399; }
.tg-sbp-item.tone-plain .tg-sbp-ic { background: rgba(96, 165, 250, 0.16); color: #93c5fd; }
.tg-sbp-item.tone-plain .tg-sbp-n { background: #334155; color: #e2e8f0; }
.tg-sbp-item.is-empty { color: #94a3b8; }
.tg-sbp-item.is-empty .tg-sbp-ic { background: rgba(148, 163, 184, 0.08); color: #64748b; }
.tg-sbp-item.is-empty .tg-sbp-sub { color: #64748b; }

/* ---- Giáo viên: the tg-v4 lists, restyled ---- */
#sidebarNav.tg-sbx .tg-sb { border-top: 1px solid rgba(148, 163, 184, 0.12); margin-top: 6px; padding: 0 0 10px; scrollbar-width: thin; scrollbar-color: #334155 transparent; }
#sidebarNav.tg-sbx .tg-sb::-webkit-scrollbar { width: 8px; }
#sidebarNav.tg-sbx .tg-sb::-webkit-scrollbar-thumb { background: #334155; border-radius: 8px; border: 2px solid #0f172a; }
#sidebarNav.tg-sbx .tg-sb::-webkit-scrollbar-track { background: transparent; }
#sidebarNav.tg-sbx .tg-sb-head {
  width: calc(100% - 20px); margin: 6px 10px 2px; padding: 6px 10px; border: 0; border-radius: 8px; background: transparent;
  font: inherit; font-size: 0.72rem; font-weight: 700; color: #94a3b8; cursor: pointer; justify-content: flex-start;
}
#sidebarNav.tg-sbx .tg-sb-head:hover { background: rgba(148, 163, 184, 0.08); color: #e2e8f0; }
#sidebarNav.tg-sbx .tg-sb-head span:first-of-type { flex: 1; text-align: left; }
#sidebarNav.tg-sbx .tg-sb-head > i { font-size: 0.6rem; width: 12px; transition: transform 0.15s; }
#sidebarNav.tg-sbx .tg-sb-head.shut > i { transform: rotate(-90deg); }
#sidebarNav.tg-sbx .tg-sb-count { background: rgba(148, 163, 184, 0.16); color: #cbd5e1; }

#sidebarNav.tg-sbx .tg-sb-row {
  flex-direction: row; align-items: center; gap: 10px; width: calc(100% - 20px); margin: 1px 10px; padding: 6px 10px;
  border: 0; border-radius: 10px; color: #e2e8f0;
}
#sidebarNav.tg-sbx .tg-sb-row:hover { background: rgba(148, 163, 184, 0.1); color: #fff; }
#sidebarNav.tg-sbx .tg-sb-row.on { background: rgba(96, 165, 250, 0.18); box-shadow: inset 0 0 0 1px rgba(96, 165, 250, 0.4); color: #fff; }
#sidebarNav.tg-sbx .tg-sb-static:hover { background: transparent; color: #e2e8f0; }
#sidebarNav.tg-sbx .tg-sb-row.tg-sb-compact { padding: 4px 10px; }
#sidebarNav.tg-sbx .tg-sb-row.is-off .tg-sb-name { color: #94a3b8; }
#sidebarNav.tg-sbx .tg-sb-all { margin: 2px 10px 4px; }
.tg-sb-av {
  flex: none; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%;
  font-size: 0.62rem; font-weight: 700; color: #fff; letter-spacing: 0.3px;
}
.tg-sb-compact .tg-sb-av { width: 24px; height: 24px; font-size: 0.56rem; }
.tg-sb-av-all { background: rgba(96, 165, 250, 0.18); color: #93c5fd; font-size: 0.75rem; border-radius: 9px; }
.tg-sb-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
#sidebarNav.tg-sbx .tg-sb-name { font-size: 0.8rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; gap: 6px; }
#sidebarNav.tg-sbx .tg-sb-sub { font-size: 0.67rem; color: #94a3b8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#sidebarNav.tg-sbx .tg-sb-row.on .tg-sb-sub { color: #bfdbfe; }
#sidebarNav.tg-sbx .tg-sb-search { padding: 4px 10px 6px; }
#sidebarNav.tg-sbx .tg-sb-search i { left: 22px; }
#sidebarNav.tg-sbx .tg-sb-search input { height: 32px; border-radius: 10px; border-color: rgba(148, 163, 184, 0.2); background: rgba(15, 23, 42, 0.7); padding-left: 30px; }
#sidebarNav.tg-sbx .tg-sb-search input:focus { border-color: #60a5fa; box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.18); }
#sidebarNav.tg-sbx .tg-sb-empty { padding: 6px 20px; }

/* ---- the pane: one section at a time ---- */
.tg-layout { grid-template-columns: minmax(0, 1fr); }
body.tg-pane-on .tg-layout { grid-template-columns: minmax(0, 1fr) 360px; }
body:not(.tg-pane-on) #tgPanel { display: none; }
#tgPanel {
  position: sticky; top: 12px; display: flex; flex-direction: column; gap: 0; overflow: hidden;
  max-height: calc(100vh - 150px); min-height: 260px; background: #fff; border: 1px solid var(--tg-line);
  border-radius: 16px; box-shadow: 0 10px 30px -18px rgba(15, 23, 42, 0.35);
}
.tg-pane-bar { flex: none; display: flex; align-items: center; gap: 4px; padding: 6px; background: #f8fafc; border-bottom: 1px solid var(--tg-line); }
.tg-pane-tab {
  display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 9px; border: 0; border-radius: 9px;
  background: transparent; color: var(--tg-muted); font: inherit; font-size: 0.74rem; font-weight: 600; cursor: pointer;
}
.tg-pane-tab:hover { background: #eef2f7; color: var(--tg-ink); }
.tg-pane-tab.on { background: #fff; color: var(--tg-ink); box-shadow: 0 1px 3px rgba(15, 23, 42, 0.12), 0 0 0 1px var(--tg-line); }
.tg-pane-tab .tg-pane-tl { display: none; }
.tg-pane-tab.on .tg-pane-tl { display: inline; }
.tg-pane-n { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; display: inline-grid; place-items: center; font-size: 0.66rem; font-weight: 700; background: #e2e8f0; color: #334155; }
.tg-pane-tab.tone-r .tg-pane-n { background: #ef4444; color: #fff; }
.tg-pane-tab.tone-w .tg-pane-n { background: #f59e0b; color: #1f2937; }
.tg-pane-tab.tone-r i { color: #dc2626; }
.tg-pane-tab.tone-w i { color: #d97706; }
.tg-pane-tab.tone-ok i { color: #059669; }
.tg-pane-tab.tone-mute { opacity: 0.55; }
.tg-pane-gap { flex: 1; }
.tg-pane-x { width: 30px; height: 30px; border: 0; border-radius: 9px; background: transparent; color: var(--tg-muted); cursor: pointer; font-size: 0.85rem; }
.tg-pane-x:hover { background: #fee2e2; color: #b91c1c; }
.tg-pane-body { flex: 1; min-height: 0; overflow: auto; overscroll-behavior: contain; }
#tgPaneBody .tg-sec { border: 0; border-radius: 0; overflow: visible; }
#tgPaneBody .tg-sec.tg-pane-off { display: none !important; }
#tgPaneBody .tg-sec-head { position: sticky; top: 0; z-index: 2; padding: 12px 14px; font-size: 0.86rem; border-bottom: 1px solid rgba(15, 23, 42, 0.06); }
#tgPaneBody .tg-group { position: sticky; top: 43px; z-index: 1; }
.tg-pane-empty { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 48px 20px; text-align: center; color: var(--tg-faint); }
.tg-pane-empty[hidden] { display: none; }
.tg-pane-empty i { font-size: 1.5rem; color: #cbd5e1; margin-bottom: 4px; }
.tg-pane-empty b { color: var(--tg-muted); font-size: 0.85rem; }
.tg-pane-empty span { font-size: 0.78rem; }

@media (min-width: 1100px) {
  body.tg-sb-on { padding-left: 264px; }
  body.tg-sb-on #sidebarNav.tg-sbx { width: 264px; }
}
@media (max-width: 1099px) {                          /* drawer mode: keep the logo clear of the ☰ button */
  #sidebarNav.tg-sbx .sidebar-brand { padding-left: 56px; }
}
@media (max-width: 1280px) {
  body.tg-pane-on .tg-layout { grid-template-columns: minmax(0, 1fr) 320px; }
}
@media (max-width: 900px) {
  body.tg-pane-on .tg-layout { grid-template-columns: 1fr; }
  #tgPanel { position: static; max-height: none; }
  .tg-pane-body { overflow: visible; }
}
/* === tansinh tg-v5 END === */

/* === tansinh tg-v7 BEGIN (9 Oct 2026): the wide day board ===
   Overrides on top of tg-v3. Columns are 230px, the header carries a day strip,
   cards are two lines, free time is a thin dashed line, empty teachers fold. */

/* the board scrolls sideways a whole column at a time */
.tg-gridwrap { scroll-snap-type: x proximity; scroll-padding-left: 12px; max-height: calc(100vh - 140px); }
.tg-calendar.tg-on .tg-flow > .tg-col { scroll-snap-align: start; }
.tg-calendar.tg-on .tg-head .tg-colhead { scroll-snap-align: start; }

/* ---------- the column header ---------- */
.tg-calendar.tg-on .tg-head .tg-colhead { padding: 10px 10px 8px; }
.tg-hrow { display: flex; align-items: center; gap: 8px; min-width: 0; }
.tg-hrow .tg-colname { flex: 1 1 auto; margin: 0; font-size: 0.9rem; }
.tg-hrow .tg-colday { flex: 1 1 auto; }
.tg-hav {
  flex: none; width: 30px; height: 30px; border-radius: 50%; color: #fff; font-size: 0.68rem; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center; letter-spacing: 0.02em;
}
.tg-calendar.tg-on .tg-colhead .tg-add { position: static; margin-left: auto; width: 26px; height: 26px; }
.tg-hchips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 7px; }
.tg-hchip {
  display: inline-flex; align-items: center; gap: 4px; padding: 0 7px; height: 20px; border-radius: 6px;
  background: #f3f4f6; color: var(--tg-muted); font-size: 0.7rem; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap;
}
.tg-hchip-avail { background: #ecfdf5; color: #047857; }
.tg-hchip-avail i { font-size: 0.65rem; }
.tg-calendar.tg-on .tg-colhead .tg-colstat { margin-top: 5px; font-size: 0.72rem; }

/* the day strip */
.tg-strip { position: relative; height: 8px; margin-top: 8px; border-radius: 4px; background: #eef0f3; overflow: visible; }
.tg-strip i { position: absolute; top: 0; height: 100%; border-radius: 3px; }
.tg-strip-shift { background: #cfe1ff; }
.tg-strip-les { background: var(--primary); }
.tg-strip-abs { background: #c7cbd3; }
.tg-strip-now { width: 2px !important; margin-left: -1px; top: -3px !important; height: 14px !important; background: var(--tg-now); border-radius: 1px; z-index: 2; }
.tg-strip-now[hidden] { display: none; }
.tg-strip-hrs { display: flex; justify-content: space-between; margin-top: 3px; font-size: 0.62rem; color: var(--tg-faint); font-variant-numeric: tabular-nums; }
.tg-colhead.tg-today .tg-strip { background: #e3ecfb; }

/* ---------- the shift box ---------- */
.tg-calendar.tg-on .tg-flow .av-block-body.tg-shift { padding: 8px; gap: 6px; }
.tg-calendar.tg-on .tg-flow .av-block-body.tg-shift::before { font-size: 0.74rem; color: var(--tg-ink); padding: 0 2px 2px; }
.tg-calendar.tg-on .tg-flow .av-block-body.tg-shift::after {
  content: attr(data-count); position: absolute; top: 8px; right: 10px;
  font-size: 0.68rem; font-weight: 600; color: var(--tg-faint); font-variant-numeric: tabular-nums;
}
.tg-calendar.tg-on .tg-flow .av-block-body.tg-shift[data-count=""]::after { content: none; }

/* ---------- a card: name and time on one line, chips below ---------- */
.tg-calendar.tg-on .tg-flow .av-student-sub.tg-blk { padding: 6px 8px 6px 9px; border-radius: 9px; }
.tg-calendar.tg-on .tg-flow .tg-blk .tg-blk-main { display: flex; align-items: flex-start; gap: 6px; white-space: normal; overflow: visible; }
.tg-calendar.tg-on .tg-flow .tg-blk .tg-blk-name {
  flex: 1 1 auto; min-width: 0; font-size: 0.78rem; line-height: 1.25; overflow-wrap: anywhere;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.tg-calendar.tg-on .tg-flow .tg-blk .tg-blk-when { flex: none; margin: 0; padding-top: 1px; font-size: 0.7rem; opacity: 0.85; white-space: nowrap; }
.tg-calendar.tg-on .tg-flow .tg-blk .tg-blk-tags { margin-top: 4px; gap: 4px; }
.tg-calendar.tg-on .tg-flow .tg-blk .tg-blk-tags:empty { display: none; }
.tg-calendar.tg-on .tg-flow .tg-blk .tg-tag { font-size: 0.64rem; line-height: 1.7; }
.tg-calendar.tg-on .tg-flow .tg-blk .tg-tag-orig { background: rgba(255, 255, 255, 0.75); border: 1px solid rgba(0, 0, 0, 0.08); color: inherit; cursor: help; }
.tg-calendar.tg-on .tg-flow .tg-blk .tg-lv { line-height: 1.7; }

/* now: a chip in the tag row, not words after the time */
.tg-calendar.tg-on .tg-flow .tg-blk.tg-current .tg-blk-when::after { content: none; }
.tg-calendar.tg-on .tg-flow .tg-blk.tg-current .tg-blk-tags { display: flex; }
.tg-calendar.tg-on .tg-flow .tg-blk.tg-current .tg-blk-tags::before {
  content: 'đang dạy'; display: inline-block; font-size: 0.64rem; font-weight: 700; padding: 0 6px; border-radius: 999px; line-height: 1.7;
  background: var(--tg-now); color: #fff; white-space: nowrap;
}

/* the lock and gear sit where the time is, and show on hover in its place */
.tg-calendar.tg-on .tg-flow .tg-blk .tg-blk-tools { top: 4px; right: 5px; }
@media (hover: hover) {
  .tg-calendar.tg-on .tg-flow .av-student-sub.tg-blk:hover .tg-blk-when { visibility: hidden; }
}
@media (hover: none) {
  .tg-calendar.tg-on .tg-flow .tg-blk .tg-blk-tools { position: static; justify-content: flex-end; margin-top: 4px; }
  .tg-calendar.tg-on .tg-flow .tg-blk .tg-blk-tools:empty { display: none; }
}

/* ---------- free time: a thin dashed line, hours on the right ---------- */
.tg-calendar.tg-on .tg-flow .tg-free {
  padding: 2px 6px; border: 0; border-top: 1px dashed #d4d8de; border-radius: 0; margin: 2px 2px 0;
  font-size: 0.66rem; color: #a2a8b2; justify-content: flex-start; gap: 0 8px;
}
.tg-calendar.tg-on .tg-flow .tg-free b { font-weight: 600; color: #8e959f; }
.tg-calendar.tg-on .tg-flow .tg-free span { margin-left: auto; }
.tg-calendar.tg-on .tg-flow .tg-free.tg-current { border-top-color: var(--tg-now); color: var(--tg-now); }
.tg-calendar.tg-on .tg-flow .tg-free.tg-current b { color: var(--tg-now); }

/* ---------- a folded column: a teacher with nobody that day ---------- */
.tg-calendar.tg-on .tg-head .tg-colhead-fold {
  padding: 10px 0 8px; display: flex; flex-direction: column; align-items: center; gap: 8px; cursor: pointer; background: #f8fafc;
}
.tg-calendar.tg-on .tg-head .tg-colhead-fold:hover { background: #eef4ff; }
.tg-colhead-fold .tg-hav { width: 26px; height: 26px; font-size: 0.62rem; }
.tg-fold-name {
  writing-mode: vertical-rl; transform: rotate(180deg); font-size: 0.74rem; font-weight: 700; color: var(--tg-muted);
  max-height: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.tg-calendar.tg-on .tg-flow > .tg-col.tg-col-fold { padding: 0; min-height: 140px; background: #f8fafc; cursor: pointer; }
.tg-calendar.tg-on .tg-flow > .tg-col.tg-col-fold:hover { background: #eef4ff; }
.tg-col-fold .tg-vlabel { top: 12px; font-size: 0.66rem; }

/* the toolbar search comes back beside the sidebar's own: it scrolls the board to a teacher */
body.tg-sb-on .tg-searchwrap { display: inline-flex; }
body.tg-sb-on .tg-search { width: 200px; }

/* ---------- the two controls beside the refresh button ---------- */
.tg-boardtools { display: inline-flex; align-items: center; gap: 8px; }
.tg-boardtools.tg-hidden { display: none; }
.tg-foldbtn { display: inline-flex; align-items: center; gap: 6px; }
.tg-foldbtn.active { background: #e8f0ff; border-color: #bfd4ff; color: var(--primary); }
.tg-foldbtn i { font-size: 0.72rem; }

/* ---------- a quiet reload, and the flash when the search lands on a column ---------- */
.tg-ibtn.is-busy i { animation: tg-spin 0.9s linear infinite; }
@keyframes tg-spin { to { transform: rotate(360deg); } }
@keyframes tg-flash-anim { 0% { box-shadow: inset 0 0 0 2px var(--primary), 0 0 0 4px rgba(13, 110, 253, 0.18); } 100% { box-shadow: inset 0 0 0 2px transparent, 0 0 0 0 transparent; } }
.tg-calendar.tg-on .tg-colhead.tg-flash, .tg-calendar.tg-on .tg-flow > .tg-col.tg-flash { animation: tg-flash-anim 1.8s ease-out 1; }
.tg-toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 12px); z-index: 90;
  padding: 10px 14px; border-radius: 10px; background: #111827; color: #fff; font-size: 0.8rem;
  opacity: 0; pointer-events: none; transition: opacity 0.2s, transform 0.2s; box-shadow: 0 10px 28px rgba(16, 24, 40, 0.25);
}
.tg-toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 900px) {
  .tg-boardtools { order: 5; }
  .tg-boardtools .tg-foldbtn span { display: none; }
  .tg-gridwrap { max-height: 72vh; }
}
@media (prefers-reduced-motion: reduce) {
  .tg-ibtn.is-busy i { animation: none; opacity: 0.5; }
  .tg-calendar.tg-on .tg-colhead.tg-flash, .tg-calendar.tg-on .tg-flow > .tg-col.tg-flash { animation: none; box-shadow: inset 0 0 0 2px var(--primary); }
  .tg-toast { transition: none; }
}
/* === tansinh tg-v7 END === */

/* === tansinh tg-v7b BEGIN (9 Oct 2026): the sticky header must paint beyond its own box ===
   .tg-head is only as wide as the scroll box, but its grid tracks run on past it, so to
   the right of the box the header had no background and scrolled-under cards showed
   through. Each column header now paints its own white and its own bottom line, and
   each body column its own page colour, so the board looks the same at every scroll. */
.tg-calendar.tg-on .tg-head { border-bottom: 0; }
.tg-calendar.tg-on .tg-head .tg-colhead { border-bottom: 1px solid var(--tg-line); }
.tg-calendar.tg-on .tg-head .tg-colhead:not(.tg-today):not(.tg-colhead-fold) { background: #fff; }
.tg-calendar.tg-on .tg-flow > .tg-col:not(.tg-col-off):not(.tg-col-fold) { background-color: var(--tg-page); }
/* === tansinh tg-v7b END === */

/* === tansinh tg-v7c BEGIN (9 Oct 2026): lanes ===
   Every teacher is one white panel, 300px wide, with a 16px gap of page colour to the
   next and a band of the teacher's colour across its top. Shifts are grey bands inside
   the panel; cards are white with a colour rail on the left edge that says what kind
   of lesson it is; the lock and gear sit at the end of the chip row. The grid itself
   is now as wide as its columns, so the sticky header covers the gaps too. */

/* the board */
.tg-gridwrap { background: var(--tg-page); border: 0; border-radius: 0; padding: 4px 0 14px; scroll-padding-left: 16px; }
.tg-calendar.tg-on .tg-grid { width: max-content; min-width: 100%; }
.tg-calendar.tg-on .tg-head, .tg-calendar.tg-on .tg-body.tg-flow { column-gap: 16px; padding: 0 4px; background: var(--tg-page); }
.tg-calendar.tg-on .tg-head { border-bottom: 0; }
.tg-calendar.tg-on .tg-body.tg-flow { align-items: start; }
.tg-calendar.tg-on .tg-legend { position: sticky; left: 0; width: max-content; max-width: 100%; margin-top: 10px; border: 0; background: transparent; }
.tg-calendar.tg-on .tg-sw-std { background: #fff; border-color: var(--tg-line); box-shadow: inset 3px 0 0 #378add; }
.tg-calendar.tg-on .tg-sw-sub { background: #fff; border-color: var(--tg-line); box-shadow: inset 3px 0 0 #7f77dd; }
.tg-calendar.tg-on .tg-sw-mk { background: #fff; border-color: var(--tg-line); box-shadow: inset 3px 0 0 #639922; }
.tg-calendar.tg-on .tg-sw-tr { background: #fff; border-color: var(--tg-line); box-shadow: inset 3px 0 0 #1d9e75; }

/* the lane header */
.tg-calendar.tg-on .tg-head .tg-colhead {
  position: relative; background: #fff; border: 1px solid var(--tg-line); border-radius: 12px 12px 0 0;
  padding: 15px 14px 10px; overflow: hidden;
}
.tg-calendar.tg-on .tg-head .tg-colhead.tg-today { background: #f0f6ff; }
.tg-calendar.tg-on .tg-head .tg-colhead-fold { padding: 16px 0 10px; }
.tg-calendar.tg-on .tg-head .tg-colhead-narrow { padding: 15px 4px 10px; background: #f8fafc; }
.tg-band { position: absolute; left: 0; top: 0; right: 0; height: 5px; }
.tg-calendar.tg-on .tg-colhead .tg-hrow .tg-colname { font-size: 0.92rem; }

/* the lane body */
.tg-calendar.tg-on .tg-flow > .tg-col {
  background: #fff; border: 1px solid var(--tg-line); border-top: 0; border-radius: 0 0 12px 12px;
  padding: 0 0 12px; gap: 0; min-height: 120px;
}
.tg-calendar.tg-on .tg-flow > .tg-col.tg-today { box-shadow: none; }
.tg-calendar.tg-on .tg-flow > .tg-col.tg-col-off { background: repeating-linear-gradient(135deg, #fafbfc 0 8px, #f1f3f6 8px 16px); }
.tg-calendar.tg-on .tg-flow > .tg-col.tg-col-narrow { background: #f8fafc; }
.tg-calendar.tg-on .tg-flow > .tg-col.tg-col-fold { background: #f8fafc; }

/* a shift: a grey band with its hours, the count at the right */
.tg-calendar.tg-on .tg-flow .av-block-body.tg-shift { border: 0; border-radius: 0; padding: 0 0 6px; gap: 0; background: #fff; }
.tg-calendar.tg-on .tg-flow .av-block-body.tg-shift::before {
  display: block; padding: 7px 56px 7px 12px; margin: 0; background: var(--tg-page);
  border-top: 1px solid var(--tg-line); border-bottom: 1px solid var(--tg-line);
  font-size: 0.76rem; font-weight: 600; color: var(--tg-ink);
}
.tg-calendar.tg-on .tg-flow .av-block-body.tg-shift:first-child::before { border-top: 0; }
.tg-calendar.tg-on .tg-flow .av-block-body.tg-shift::after { top: 7px; right: 12px; font-size: 0.7rem; }
.tg-calendar.tg-on .tg-flow .av-block-body.av-drop-refused { outline-offset: -2px; border-radius: 0; }
.tg-calendar.tg-on .tg-flow .tg-flow-empty { padding: 8px 12px 2px; }

/* a card: white, a rail on the left, name and time on one line while they fit */
.tg-calendar.tg-on .tg-flow .av-student-sub.tg-blk {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 8px; align-items: end;
  margin: 8px 10px 0; padding: 7px 10px 7px 14px; border-radius: 8px; overflow: visible;
  background: #fff; color: var(--tg-ink); border: 1px solid var(--tg-line) !important;
}
.tg-calendar.tg-on .tg-flow .av-student-sub.tg-blk::before {
  content: ''; position: absolute; left: -1px; top: -1px; bottom: -1px; width: 5px; border-radius: 8px 0 0 8px; background: #378add;
}
.tg-calendar.tg-on .tg-flow .av-student-sub.tg-sub::before { background: #7f77dd; }
.tg-calendar.tg-on .tg-flow .av-student-sub.tg-mk::before { background: #639922; }
.tg-calendar.tg-on .tg-flow .av-student-sub.tg-tr::before { background: #1d9e75; }
.tg-calendar.tg-on .tg-flow .av-student-sub.tg-absent { background: #fafbfc; color: var(--tg-faint); border: 1px dashed var(--tg-abs-bd) !important; }
.tg-calendar.tg-on .tg-flow .av-student-sub.tg-absent::before { background: #c7cbd3; }
.tg-calendar.tg-on .tg-flow .av-student-sub.tg-locked { border-left-width: 1px !important; }
.tg-calendar.tg-on .tg-flow .av-student-sub.tg-locked::before { width: 8px; }
.tg-calendar.tg-on .tg-flow .av-student-sub.tg-blk.tg-current { border: 1px solid var(--tg-line) !important; }
.tg-calendar.tg-on .tg-flow .av-student-sub.tg-blk.tg-current::before { background: var(--tg-now); }
.tg-calendar.tg-on .tg-flow .av-student-sub.tg-blk:hover { box-shadow: 0 2px 10px rgba(16, 24, 40, 0.1); }

.tg-calendar.tg-on .tg-flow .tg-blk .tg-blk-main { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; overflow: visible; }
.tg-calendar.tg-on .tg-flow .tg-blk .tg-blk-name { flex: 1 1 auto; font-size: 0.8rem; color: var(--tg-ink); }
.tg-calendar.tg-on .tg-flow .tg-blk .tg-blk-when { margin-left: auto; padding: 0; font-size: 0.7rem; color: var(--tg-muted); opacity: 1; }
.tg-calendar.tg-on .tg-flow .tg-blk.tg-absent .tg-blk-name { color: var(--tg-faint); }
.tg-calendar.tg-on .tg-flow .tg-blk .tg-blk-tags { grid-column: 1; margin-top: 4px; }
.tg-calendar.tg-on .tg-flow .tg-blk .tg-blk-tools { grid-column: 2; grid-row: 2; position: static; align-self: end; justify-self: end; margin-top: 4px; }
.tg-calendar.tg-on .tg-flow .tg-blk .tg-tag { background: var(--tg-page); color: var(--tg-muted); }
.tg-calendar.tg-on .tg-flow .tg-blk .tg-tag-sub { background: #eeedfe; color: #3c3489; }
.tg-calendar.tg-on .tg-flow .tg-blk .tg-tag-mk { background: #eaf3de; color: #27500a; }
.tg-calendar.tg-on .tg-flow .tg-blk .tg-tag-tr { background: #e1f5ee; color: #085041; }
.tg-calendar.tg-on .tg-flow .tg-blk .tg-tag-late { background: #faeeda; color: #633806; }
.tg-calendar.tg-on .tg-flow .tg-blk .tg-tag-abs { background: #f1efe8; color: #5f5e5a; }
.tg-calendar.tg-on .tg-flow .tg-blk .tg-tag-orig { background: var(--tg-page); border: 0; color: var(--tg-muted); }
.tg-calendar.tg-on .tg-flow .tg-blk .tg-lv { background: var(--tg-page); border-color: transparent; color: var(--tg-muted); }
.tg-calendar.tg-on .tg-flow .tg-blk.tg-current .tg-blk-tags::before { background: #fcebeb; color: #791f1f; }
@media (hover: hover) {
  .tg-calendar.tg-on .tg-flow .av-student-sub.tg-blk:hover .tg-blk-when { visibility: visible; }
}

/* free time and the now line follow the card margins */
.tg-calendar.tg-on .tg-flow .tg-free { margin: 8px 12px 0; padding: 5px 0 0; border-top: 1px dashed var(--tg-line); }
.tg-calendar.tg-on .tg-flow .tg-nowmark { margin: 6px 12px; }

/* the ghosts of an off teacher's students */
.tg-calendar.tg-on .tg-flow .tg-ghost { margin: 8px 10px 0; border-radius: 8px; padding: 7px 10px; background: #fff; }
.tg-calendar.tg-on .tg-flow .tg-ghost-done { background: #f0fdf4; }

@media (max-width: 600px) {
  .tg-calendar.tg-on .tg-head, .tg-calendar.tg-on .tg-body.tg-flow { column-gap: 10px; }
}
/* === tansinh tg-v7c END === */

/* === tansinh tg-v8 BEGIN (9 Oct 2026): one "Sửa" button, the student sheet, the drag bar === */

/* the card: one pill on hover, a tint while the pointer is on it, a ring while its sheet is open */
.tg-calendar.tg-on .tg-flow .av-student-sub.tg-blk:hover { background: #f8faff; border-color: #85b7eb !important; box-shadow: none; }
.tg-calendar.tg-on .tg-flow .av-student-sub.tg-blk.tg-editing { border-color: #378add !important; box-shadow: 0 0 0 3px #e6f1fb; }
.tg-calendar.tg-on .tg-flow .tg-blk .tg-blk-tools { opacity: 0; transition: opacity 0.12s; }
.tg-calendar.tg-on .tg-flow .av-student-sub.tg-blk:hover .tg-blk-tools,
.tg-calendar.tg-on .tg-flow .av-student-sub.tg-blk:focus-within .tg-blk-tools,
.tg-calendar.tg-on .tg-flow .av-student-sub.tg-blk.tg-editing .tg-blk-tools { opacity: 1; }
.tg-calendar.tg-on .tg-flow .tg-blk .tg-edit {
  display: inline-flex; align-items: center; gap: 5px; height: 26px; padding: 0 10px 0 8px; border-radius: 999px;
  border: 0; background: #111827; color: #fff; font-family: inherit; font-size: 0.7rem; font-weight: 600; cursor: pointer;
  width: auto; margin: 0; opacity: 1; transform: none;
}
.tg-calendar.tg-on .tg-flow .tg-blk .tg-edit:hover { background: #1f2937; color: #fff; transform: none; }
.tg-calendar.tg-on .tg-flow .tg-blk .tg-edit i { font-size: 0.68rem; }
.tg-calendar.tg-on .tg-flow .tg-blk .tg-tag-lock { background: #e6f1fb; color: #0c447c; }
.tg-calendar.tg-on .tg-flow .tg-blk .tg-tag-lock i { font-size: 0.58rem; margin-right: 2px; }
@media (hover: none) { .tg-calendar.tg-on .tg-flow .tg-blk .tg-blk-tools { opacity: 1; } }

/* ---------- the sheet ---------- */
.tg-sheet-ov { position: fixed; inset: 0; z-index: 998; background: rgba(15, 23, 42, 0.28); }
.tg-sheet {
  position: fixed; top: 0; right: 0; bottom: 0; width: 420px; max-width: 100vw; z-index: 999;
  display: flex; flex-direction: column; background: #fff; box-shadow: -12px 0 40px rgba(15, 23, 42, 0.18);
  font-family: inherit; color: var(--tg-ink); animation: tg-sheet-in 0.18s ease-out;
}
@keyframes tg-sheet-in { from { transform: translateX(24px); opacity: 0; } to { transform: none; opacity: 1; } }
.tg-sh-hd { background: #111827; color: #fff; padding: 14px 16px 12px; flex: none; }
.tg-sh-top { display: flex; align-items: flex-start; gap: 10px; }
.tg-sh-ttl { flex: 1; min-width: 0; }
.tg-sh-name { font-size: 1.02rem; font-weight: 700; line-height: 1.25; overflow-wrap: anywhere; }
.tg-sh-sub { font-size: 0.74rem; color: #9ca3af; margin-top: 2px; }
.tg-sh-x {
  flex: none; width: 32px; height: 32px; border-radius: 9px; border: 1px solid #374151; background: transparent; color: #d1d5db;
  cursor: pointer; font-size: 0.9rem; display: inline-flex; align-items: center; justify-content: center;
}
.tg-sh-x:hover { background: #1f2937; color: #fff; }
.tg-sh-chips { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 9px; }
.tg-sh-chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px; background: #1f2937; color: #d1d5db; font-size: 0.7rem; font-variant-numeric: tabular-nums; }
.tg-sh-chip i { font-size: 0.62rem; }
.tg-sh-chip-lock { background: #1e3a8a; color: #dbeafe; }
.tg-sh-chip-late { background: #78350f; color: #fef3c7; }
.tg-sh-chip-abs { background: #374151; color: #e5e7eb; }

.tg-sh-tabs { display: flex; padding: 0 8px; border-bottom: 1px solid var(--tg-line); flex: none; }
.tg-sh-tabs button {
  border: 0; background: transparent; padding: 11px 10px; font-family: inherit; font-size: 0.8rem; font-weight: 600; color: var(--tg-muted);
  cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tg-sh-tabs button.on { color: var(--tg-ink); border-bottom-color: var(--primary); }
.tg-sh-tabs button:hover { color: var(--tg-ink); }
.tg-sh-tabs .tg-sh-tab-hist { margin-left: auto; }

.tg-sh-body { flex: 1 1 auto; overflow: auto; padding: 14px 16px; }
.tg-sh-body > section[hidden] { display: none; }
.tg-sh-lab { font-size: 0.72rem; color: var(--tg-muted); margin-bottom: 6px; }
.tg-sh-small { font-size: 0.7rem; color: var(--tg-faint); margin-top: 6px; }
.tg-sh-note { font-size: 0.74rem; color: #92400e; background: #fef3c7; border-radius: 8px; padding: 7px 10px; margin: 10px 0 0; }
.tg-sh-msg { font-size: 0.76rem; color: #991b1b; background: #fef2f2; border: 1px solid #fecaca; border-radius: 8px; padding: 8px 10px; margin-top: 10px; }
.tg-sh-msg[hidden] { display: none; }

/* the shift strip */
.tg-sh-strip { position: relative; height: 28px; border-radius: 6px; background: var(--tg-page); overflow: hidden; }
.tg-sh-les { position: absolute; top: 5px; bottom: 5px; border-radius: 4px; background: #b5d4f4; }
.tg-sh-les.abs { background: #d1d5db; }
.tg-sh-les.me { top: 3px; bottom: 3px; background: #378add; }
.tg-sh-les.me.pend { background: #fff; border: 2px dashed #378add; box-sizing: border-box; }
.tg-sh-now { position: absolute; top: 0; bottom: 0; width: 2px; margin-left: -1px; background: var(--tg-now); }
.tg-sh-hrs { display: flex; justify-content: space-between; font-size: 0.66rem; color: var(--tg-faint); margin-top: 3px; font-variant-numeric: tabular-nums; }

/* the time with steps */
.tg-sh-step { display: flex; align-items: center; gap: 6px; margin-top: 14px; }
.tg-sh-pill {
  display: inline-flex; align-items: center; justify-content: center; min-width: 40px; height: 32px; padding: 0 10px; border-radius: 8px;
  border: 1px solid var(--tg-line); background: #fff; color: var(--tg-ink); font-family: inherit; font-size: 0.8rem; font-weight: 600; cursor: pointer;
  font-variant-numeric: tabular-nums;
}
.tg-sh-pill:hover { border-color: var(--primary); color: var(--primary); background: #f0f6ff; }
.tg-sh-pill.on { background: var(--primary); border-color: var(--primary); color: #fff; }
.tg-sh-pill:disabled { opacity: 0.4; cursor: default; }
.tg-sh-pill.tg-sh-ico { min-width: 30px; height: 28px; padding: 0; }
.tg-sh-big { flex: 1; text-align: center; min-width: 0; }
.tg-sh-timein {
  width: 150px; max-width: 100%; border: 0; background: transparent; font-family: inherit; font-size: 1.55rem; font-weight: 700; letter-spacing: -0.02em;
  color: var(--tg-ink); text-align: center; padding: 0; cursor: pointer; font-variant-numeric: tabular-nums;
}
.tg-sh-timein::-webkit-calendar-picker-indicator { opacity: 0.4; width: 16px; height: 16px; margin-left: 6px; cursor: pointer; }
.tg-sh-big.changed .tg-sh-timein { color: var(--primary); }
.tg-sh-save { display: flex; gap: 8px; margin-top: 10px; }
.tg-sh-btn {
  display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 13px; border-radius: 9px; border: 1px solid var(--tg-line);
  background: #fff; color: var(--tg-ink); font-family: inherit; font-size: 0.8rem; font-weight: 600; cursor: pointer;
}
.tg-sh-btn:hover { border-color: var(--primary); color: var(--primary); }
.tg-sh-btn:disabled { opacity: 0.4; cursor: default; }
.tg-sh-primary { background: var(--primary); border-color: var(--primary); color: #fff; flex: 1; justify-content: center; }
.tg-sh-primary:hover { background: #0b5ed7; color: #fff; }

/* the lock row */
.tg-sh-lock { display: flex; align-items: center; gap: 12px; margin-top: 14px; padding: 12px 14px; border: 1px solid var(--tg-line); border-radius: 10px; }
.tg-sh-lock-txt { flex: 1; min-width: 0; font-size: 0.8rem; }
.tg-sh-lock-txt b { display: block; font-weight: 700; }
.tg-sh-lock-txt span { display: block; font-size: 0.72rem; color: var(--tg-muted); margin-top: 1px; }
.tg-sw { flex: none; width: 38px; height: 22px; border-radius: 999px; border: 0; background: #cbd5e1; position: relative; cursor: pointer; padding: 0; transition: background 0.15s; }
.tg-sw i { position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: left 0.15s; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2); }
.tg-sw.on { background: var(--primary); }
.tg-sw.on i { left: 18px; }
.tg-sw:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.tg-sh-link-btn { border: 0; background: transparent; color: var(--primary); font-family: inherit; font-size: 0.76rem; font-weight: 600; cursor: pointer; padding: 4px 6px; white-space: nowrap; }
.tg-sh-link-btn:hover { text-decoration: underline; }

/* late */
.tg-sh-now-late { font-size: 0.8rem; color: #92400e; background: #fef3c7; border-radius: 8px; padding: 8px 10px; margin-bottom: 10px; display: flex; align-items: center; gap: 6px; }
.tg-sh-now-late .tg-sh-link-btn { margin-left: auto; color: #92400e; }
.tg-sh-pills { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.tg-sh-custom { display: inline-flex; align-items: center; gap: 6px; margin-left: auto; }
.tg-sh-num { width: 70px; height: 32px; border: 1px solid var(--tg-line); border-radius: 8px; padding: 0 8px; font-family: inherit; font-size: 0.8rem; }
.tg-sh-num:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.12); }

/* order */
.tg-sh-list { border: 1px solid var(--tg-line); border-radius: 10px; overflow: hidden; }
.tg-sh-row { display: flex; align-items: center; gap: 8px; padding: 8px 10px; font-size: 0.8rem; border-top: 1px solid var(--tg-line-soft); min-height: 38px; }
.tg-sh-row:first-child { border-top: 0; }
.tg-sh-row.me { background: #e6f1fb; color: #0c447c; font-weight: 600; }
.tg-sh-row.abs .tg-sh-rname { color: var(--tg-faint); text-decoration: line-through; }
.tg-sh-ord { flex: none; width: 18px; color: var(--tg-faint); font-variant-numeric: tabular-nums; }
.tg-sh-rname { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tg-sh-rtime { flex: none; color: var(--tg-muted); font-variant-numeric: tabular-nums; font-weight: 400; }
.tg-sh-arrows { display: inline-flex; gap: 4px; }
.tg-sh-ends { margin-top: 10px; }
.tg-sh-link { justify-content: space-between; border: 1px solid var(--tg-line); border-radius: 10px; margin-bottom: 12px; }
.tg-sh-link a { font-size: 0.74rem; color: var(--primary); text-decoration: none; }
.tg-sh-link a:hover { text-decoration: underline; }
.tg-sheet .av-history-list { max-height: none; overflow: visible; }

/* the footer: scope, saved, undo */
.tg-sh-ft { flex: none; display: flex; align-items: center; gap: 10px; padding: 10px 16px; border-top: 1px solid var(--tg-line); background: #f8fafc; }
.tg-sh-scope button { height: 30px; padding: 0 11px; font-size: 0.76rem; }
.tg-sh-scope button.active { background: #111827; color: #fff; }
.tg-sh-status { margin-left: auto; font-size: 0.74rem; color: #166534; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.tg-sh-undo { border: 0; background: transparent; color: var(--primary); font-family: inherit; font-size: 0.78rem; font-weight: 700; cursor: pointer; white-space: nowrap; }
.tg-sh-undo[hidden] { display: none; }

/* the bar after a drag */
.tg-bar {
  position: fixed; left: 50%; bottom: 22px; transform: translate(-50%, 12px); z-index: 97; display: flex; align-items: center; gap: 8px;
  padding: 8px 10px 8px 14px; border-radius: 12px; background: #111827; color: #fff; font-size: 0.8rem; box-shadow: 0 12px 32px rgba(15, 23, 42, 0.3);
  opacity: 0; pointer-events: none; transition: opacity 0.18s, transform 0.18s; max-width: calc(100vw - 24px);
}
.tg-bar.show { opacity: 1; pointer-events: auto; transform: translate(-50%, 0); }
.tg-bar-txt { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tg-bar-txt i { color: #86efac; margin-right: 4px; }
.tg-bar-btn { height: 30px; padding: 0 11px; border-radius: 8px; border: 1px solid #374151; background: transparent; color: #fff; font-family: inherit; font-size: 0.76rem; font-weight: 600; cursor: pointer; white-space: nowrap; }
.tg-bar-btn:hover { background: #1f2937; }
.tg-bar-btn.primary { background: var(--primary); border-color: var(--primary); }
.tg-bar-x { border: 0; background: transparent; color: #9ca3af; cursor: pointer; font-size: 0.85rem; padding: 0 4px; }

@media (max-width: 700px) {
  .tg-sheet { top: auto; left: 0; right: 0; width: auto; max-height: 90vh; border-radius: 16px 16px 0 0; animation-name: tg-sheet-up; }
  @keyframes tg-sheet-up { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
  .tg-sh-tabs button { padding: 11px 8px; font-size: 0.76rem; }
  .tg-sh-custom { margin-left: 0; }
  .tg-sh-status { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .tg-sheet { animation: none; }
  .tg-bar { transition: none; }
  .tg-sw, .tg-sw i { transition: none; }
}
/* === tansinh tg-v8 END === */
/* === tansinh boot-in v1 BEGIN (9 Oct 2026): look signed-in from the first paint === */
/* The <head> adds html.ts-boot-in when a saved session exists, and one line after the menu markup
   adds tg-sbx and tg-sb-on at once — so the menu is open and styled before the data arrives. */
html.ts-boot-in #loginCard { display: none; }
html.ts-boot-in body { place-items: start center; padding-top: 40px; }
html.ts-boot-in .sidebar-nav { transition: none; }
@view-transition { navigation: auto; }
#sidebarNav { view-transition-name: ts-sidebar; }
::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation-duration: 0.18s; }
@media (prefers-reduced-motion: reduce) {
  ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; }
}
/* === tansinh boot-in v1 END === */
/* === tansinh tg-v9 BEGIN (9 Oct 2026): the pane tucks away while you scroll through teachers === */
@media (min-width: 901px) {
  .tg-layout { transition: grid-template-columns 0.22s ease, column-gap 0.22s ease; }
  #tgPanel { transition: opacity 0.18s ease, visibility 0.18s; }
  body.tg-pane-on.tg-pane-tuck .tg-layout { grid-template-columns: minmax(0, 1fr) 0px; column-gap: 0; }
  body.tg-pane-on.tg-pane-tuck #tgPanel { opacity: 0; visibility: hidden; pointer-events: none; min-width: 0; }
  /* the sidebar still marks the open section, as an outline: one click shows it again */
  body.tg-pane-tuck #tgSbPanes .tg-sbp-item.on { background: transparent; box-shadow: inset 0 0 0 1px rgba(96, 165, 250, 0.45); }
}
@media (prefers-reduced-motion: reduce) {
  .tg-layout, #tgPanel { transition: none; }
}
/* === tansinh tg-v9 END === */
/* === tansinh tg-v10 BEGIN (10 Oct 2026): the mini-map pill at the board's bottom-right === */
/* compact (tg-v10b): small at rest, the bar widens while the mouse is over it or it has focus */
.tg-boardbox { position: relative; min-width: 0; }
.tg-mm {
  position: absolute; right: 14px; bottom: 20px; z-index: 9; display: flex; align-items: center; gap: 0; padding: 2px;
  border-radius: 999px; background: #fff; border: 1px solid var(--tg-line); box-shadow: 0 6px 14px -10px rgba(15, 23, 42, 0.45);
}
.tg-mm[hidden] { display: none; }
.tg-mm-btn {
  width: 22px; height: 22px; border: 0; border-radius: 50%; background: transparent; color: #475569; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; font-size: 0.66rem; padding: 0;
}
.tg-mm-btn:hover { background: #eef2f7; color: #0f172a; }
.tg-mm-track {
  position: relative; width: 72px; height: 10px; border-radius: 999px; background: #eef2f7; cursor: grab; margin: 0 2px;
  touch-action: none; user-select: none; overflow: hidden; outline: none; transition: width 0.18s ease;
}
.tg-mm:hover .tg-mm-track, .tg-mm:focus-within .tg-mm-track { width: 132px; }
.tg-mm-track:focus-visible { box-shadow: 0 0 0 2px #93c5fd; }
.tg-mm-track.drag { cursor: grabbing; }
.tg-mm-seg { position: absolute; top: 3px; height: 4px; border-radius: 1.5px; box-sizing: border-box; }
.tg-mm-seg.off { background: #fff; border: 1px solid #94a3b8; }
.tg-mm-seg.fold { top: 4px; height: 2px; }
.tg-mm-win { position: absolute; top: 1px; bottom: 1px; border-radius: 999px; border: 1.5px solid #1e40af; background: rgba(96, 165, 250, 0.26); box-sizing: border-box; pointer-events: none; }
@media (hover: none) { .tg-mm-track { width: 96px; } }
@media (max-width: 900px) { .tg-mm { right: 10px; bottom: 18px; } }
@media print { .tg-mm { display: none; } }
/* === tansinh tg-v10 END === */
