/* My lessons (tutor_history.py, static/board/tutor-history.js): the list sheet, the Continue offer and the toast on both
   designs; the home section on the new design (#u2, reusing its shelf / card / sheet classes); the top-bar button and the
   Continue chip on the old design. Only on the page with TUTOR_HISTORY=1. */
.th-vh { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
#thSheet[hidden], #thOffer[hidden], #thToast[hidden], .th-sheet [hidden], #thChip[hidden], #thShelf [hidden] { display: none !important; }
.th-ic { width: 20px; height: 20px; flex: none; }

/* ---------------------------------------------------------------- the sheet (old design: its own look; new design: u-sheet) */
.th-back { position: fixed; inset: 0; z-index: 85; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(17, 24, 39, .45); }
.th-sheet { width: min(520px, 100%); max-height: min(760px, calc(100dvh - 32px)); overflow: auto; background: #fff; color: #1f2937; border-radius: 18px; box-shadow: 0 18px 48px rgba(17, 24, 39, .18); font-family: var(--ui); }
.th-head { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; gap: 8px; padding: 10px 8px 6px 20px; background: #fff; }
.th-head h2 { flex: 1; margin: 0; font: 700 20px var(--ui); }
.th-x { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; border: 0; border-radius: 12px; background: transparent; color: #1f2937; cursor: pointer; }
.th-x:hover { background: #eef0f3; }
.th-x .ic, .th-rm .ic, .th-ox .ic { width: 20px; height: 20px; }
.th-body { padding: 0 20px 18px; }
.th-list { list-style: none; margin: 0; padding: 0; }
.th-row { display: flex; align-items: center; gap: 4px; border-bottom: 1px solid #eef0f3; }
.th-row:last-child { border-bottom: 0; }
.th-open { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; min-height: 64px; padding: 8px 4px; border: 0; border-radius: 12px; background: none; color: inherit; text-align: left; font: inherit; cursor: pointer; }
.th-open:hover { background: #f5f6f8; }
.th-txt { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.th-txt b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 600 15px/1.3 var(--ui); }
.th-st { font: 600 13px var(--ui); color: #1d4ed8; }
.th-st.done { color: #15803d; }
.th-txt small { font: 500 12px var(--ui); color: #6b7280; }
.th-rm { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; border: 0; border-radius: 12px; background: none; color: #6b7280; cursor: pointer; }
.th-rm:hover { background: #fef2f2; color: #b91c1c; }
.th-pic { position: relative; flex: none; display: block; width: 88px; aspect-ratio: 16 / 9; border-radius: 8px; overflow: hidden; background: #f1f2ee; }
.th-pic img { width: 100%; height: 100%; object-fit: cover; display: block; }
.th-pic.none { background: linear-gradient(135deg, #eef2ff, #f1f2ee); }
.th-bar { position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: rgba(17, 24, 39, .25); }
.th-bar::after { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: calc(var(--p, 0) * 100%); background: #2563eb; }
.th-empty { margin: 8px 0 14px; color: #4b5563; font: 400 14px/1.5 var(--ui); }
.th-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-top: 10px; padding-top: 10px; border-top: 1px solid #eef0f3; }
.th-privacy { margin: 0; flex: 1 1 200px; color: #4b5563; font: 500 13px/1.4 var(--ui); }
.th-privacy::before { content: "🔒 "; }
.th-clear { min-height: 44px; padding: 0 14px; border: 1px solid #d1d5db; border-radius: 12px; background: #fff; color: #b91c1c; font: 600 14px var(--ui); cursor: pointer; }
.th-clear.armed { background: #b91c1c; border-color: #b91c1c; color: #fff; }
.th-slot:empty { display: none; }
.th-slot { margin: 4px 0 10px; }
.th-sheet :focus-visible, .th-offer :focus-visible, #thToast :focus-visible, .th-chip:focus-visible, #thTab:focus-visible { outline: 3px solid #2563eb; outline-offset: 2px; }

/* ---------------------------------------------------------------- "You stopped at step 8 of 15. Continue ✕" + the toast */
.th-offer { position: fixed; left: 50%; top: 76px; z-index: 60; transform: translateX(-50%); display: flex; align-items: center; gap: 8px; max-width: calc(100vw - 32px); padding: 6px 6px 6px 16px; border-radius: 14px; background: #111827; color: #fff; font: 500 14px var(--ui); box-shadow: 0 10px 30px rgba(17, 24, 39, .25); }
.th-otxt { min-width: 0; }
.th-ogo { flex: none; min-height: 40px; padding: 0 14px; border: 0; border-radius: 10px; background: #2563eb; color: #fff; font: 600 14px var(--ui); cursor: pointer; }
.th-ox { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border: 0; border-radius: 10px; background: transparent; color: #e5e7eb; cursor: pointer; }
#thToast { position: fixed; left: 50%; bottom: 24px; z-index: 95; transform: translateX(-50%); max-width: calc(100vw - 32px); padding: 12px 16px; border-radius: 12px; background: #111827; color: #fff; font: 500 14px var(--ui); box-shadow: 0 18px 48px rgba(17, 24, 39, .18); display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
#thToast button { min-height: 36px; padding: 0 10px; border: 1px solid #4b5563; border-radius: 8px; background: transparent; color: #fff; font: 600 14px var(--ui); cursor: pointer; }

/* ---------------------------------------------------------------- old design: top-bar button, Continue chip */
#thTab { font: 600 14px var(--ui); padding: 9px 14px; border-radius: 10px; border: 1px solid #374151; background: #1f2937; color: #fff; cursor: pointer; white-space: nowrap; }
#thTab:hover { border-color: var(--brand); }
.chips .th-chip { display: inline-block; flex: none; max-width: 100%; overflow: hidden; text-overflow: ellipsis; font: 600 13px var(--ui); padding: 7px 12px; border-radius: 999px; border: 1px solid #93c5fd; background: #eff6ff; color: #1d4ed8; text-decoration: none; white-space: nowrap; }
.chips .th-chip:hover { border-color: #2563eb; }
.chips .th-allchip { display: none; cursor: pointer; }
#thCtl { display: none; }
@media (max-width: 640px) {
  #thTab { display: none; }  /* (the phone top bar is full: the "My lessons" chip instead) */
  .chips .th-allchip { display: inline-block; }
  body.inlesson #thCtl { display: inline-block; }
  .chips .th-chip { max-width: 82vw; }
  body:not(#u2) .th-offer { top: auto; bottom: 120px; }
}

/* ---------------------------------------------------------------- new design: the home section (u-shelf, u-cards, u-card) */
#u2 .th-shelf { margin-top: 32px; }
#u2 .th-shelf + .u-shelf { margin-top: 28px; }
#u2 .th-shelf .u-shelfh .u-link { min-height: 44px; }
#u2 .th-cont { display: flex; align-items: center; gap: 14px; width: 100%; margin: 0 0 18px; padding: 12px; border: 1px solid var(--line); border-radius: var(--r2); background: var(--surface); color: inherit; text-align: left; font: inherit; cursor: pointer; box-shadow: var(--shadow); }
#u2 .th-cont:hover { border-color: #9ca3af; }
#u2 .th-cont .th-pic { width: 160px; border-radius: var(--r1); }
#u2 .th-ct { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
#u2 .th-kick { font: 600 var(--t12) var(--ui); color: var(--brand-ink); text-transform: uppercase; letter-spacing: .04em; }
#u2 .th-ct b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 700 var(--t20)/1.25 var(--ui); }
#u2 .th-ct .th-st { color: var(--muted); font-weight: 500; font-size: var(--t14); }
#u2 .th-go { flex: none; pointer-events: none; }
#u2 .th-card .th-pic { width: auto; border-radius: 0; }
#u2 .th-card small.th-st { margin-top: 4px; color: var(--brand-ink); font-weight: 600; }
#u2 .th-card small.th-st.done { color: var(--ok); }
#u2 .th-shelf .th-privacy { margin: 10px 0 0; color: var(--muted); font-size: var(--t14); }
#u2 .th-shelf .th-privacy .u-link { min-height: 32px; }
#u2 .th-slothome:empty { display: none; }
#u2 #thMenuBtn .th-ic { color: inherit; }
#u2 .th-sheet .th-open:hover { background: #f3f4f6; }
#u2 .th-offer { top: calc(var(--headh) + 12px); }
@media (max-width: 719px) {
  #u2 .th-shelf { margin-top: 22px; }
  #u2 .th-cont { gap: 10px; padding: 10px; }
  #u2 .th-cont .th-pic { width: 96px; }
  #u2 .th-ct b { font-size: var(--t16); }
  #u2 .th-go { display: none; }
  .th-back { align-items: flex-end; padding: 0; }
  .th-sheet { width: 100%; max-height: 88dvh; border-radius: 18px 18px 0 0; padding-bottom: env(safe-area-inset-bottom); }
  .th-pic { width: 72px; }
  #u2 #thToast { bottom: 88px; }
}
@media (max-width: 640px) {
  .th-back { align-items: flex-end; padding: 0; }
  .th-sheet { width: 100%; max-height: 88dvh; border-radius: 18px 18px 0 0; padding-bottom: env(safe-area-inset-bottom); }
}
