/* timetable: the Constructor («Нарисовать неделю»), the hub («Пришли расписание») and their sheets. Solid content only
   (no glass), theme tokens only; the subject colours are the Week's own .tint-N; the "please check" warmth is
   snap_week's. Rows ≥ 44 pt, 320 px wide works, reduced motion: no slide. */

.tt, .tt-sheet { --tt-warn: #b25000; --tt-warn-bg: rgb(255 149 0 / 0.16); }
:root[data-scheme="dark"] .tt, :root[data-scheme="dark"] .tt-sheet { --tt-warn: #ffb340; --tt-warn-bg: rgb(255 159 10 / 0.2); }

.tt { padding-bottom: 12px; }
.tt .tt-lead { padding: 4px 4px 8px; }
.tt .tt-lead h2 { margin: 0; font-size: 22px; line-height: 1.25; font-weight: 700; overflow-wrap: anywhere; }
.tt .tt-lead p { margin: 6px 0 0; font-size: 15px; line-height: 1.4; color: var(--subtitle); overflow-wrap: anywhere; }
.tt .tt-lead .tt-term { color: var(--text); font-weight: 600; font-size: 14px; font-variant-numeric: tabular-nums; }
.tt .tt-term-change { margin-top: 2px; padding: 6px 0; min-height: 44px; }
.tt .tt-note, .tt-sheet .tt-note { margin: 8px 4px 0; font-size: 13px; line-height: 1.4; color: var(--hint); overflow-wrap: anywhere; }
.tt .tt-note:empty, .tt-sheet .tt-note:empty { display: none; }
.tt .tt-warn, .tt-sheet .tt-warn { margin: 10px 4px 0; font-size: 14px; line-height: 1.4; color: var(--tt-warn); overflow-wrap: anywhere; }
.tt .tt-label, .tt-sheet .tt-label {
  margin: 14px 4px 6px; font-size: 13px; font-weight: 600; color: var(--section-header, var(--hint));
  text-transform: uppercase; letter-spacing: .02em;
}
.tt .tt-seg { margin: 10px 0 0; }
.tt .tt-seg.grow { flex: 1; min-width: 0; margin: 0; }

/* ---------- the steps ---------- */

/* Equal steps while they fit; a long word («Qo'ng'iroqlar» at 320 px) takes the room it needs, never «Qo'ng'iro…». */
.tt .tt-steps { display: flex; gap: 4px; margin: 2px 0 10px; }
.tt .tt-steps[hidden] { display: none; }
.tt .tt-step {
  position: relative; flex: 1 1 0; min-width: max-content; min-height: 44px; display: flex; flex-direction: column;
  align-items: center;
  justify-content: center; gap: 2px; padding: 4px 2px; border: 0; border-radius: 12px; background: none;
  color: var(--hint); font: inherit; cursor: pointer;
}
.tt .tt-step::before {
  content: ''; position: absolute; left: 6px; right: 6px; top: 2px; height: 3px; border-radius: 2px;
  background: rgb(var(--text-rgb) / 0.1);
}
.tt .tt-step.done::before { background: rgb(var(--accent-rgb) / 0.45); }
.tt .tt-step.on::before { background: var(--accent); }
.tt .tt-step.on { color: var(--text); }
.tt .tt-step:disabled { cursor: default; opacity: .55; }
.tt .tt-step-n { display: none; }
.tt .tt-step-t { max-width: 100%; font-size: 12px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- bells ---------- */

.tt .tt-bells .group-body { padding: 0; }
.tt .tt-bell { display: flex; align-items: center; gap: 6px; min-height: 52px; padding: 4px 14px; }
.tt .tt-bell.bad .tt-time { color: var(--tt-warn); box-shadow: inset 0 0 0 1.5px var(--tt-warn); }
.tt .tt-bell-n { width: 36px; flex: none; font-weight: 700; font-variant-numeric: tabular-nums; }
.tt .tt-dash { color: var(--hint); }
.tt .tt-bell-days { margin-left: auto; font-size: 12px; color: var(--hint); }
.tt .tt-time {
  min-width: 72px; min-height: 40px; padding: 0 10px; border: 0; border-radius: 10px; font: inherit; font-size: 17px;
  font-weight: 600; font-variant-numeric: tabular-nums; background: rgb(var(--text-rgb) / 0.06); color: var(--text); cursor: pointer;
}
.tt .tt-row-actions { display: flex; flex-wrap: wrap; gap: 4px 8px; margin-top: 4px; }
.tt-sheet .tt-timebox { display: flex; flex-direction: column; gap: 14px; padding: 4px 0 8px; }
.tt-sheet .tt-wheels { display: flex; align-items: center; justify-content: center; gap: 8px; font-size: 22px; font-weight: 700; }
.tt-sheet .tt-wheel {
  min-width: 92px; min-height: 48px; padding: 0 12px; border: 0; border-radius: 12px; font: inherit; font-size: 24px;
  font-weight: 600; font-variant-numeric: tabular-nums; text-align: center; text-align-last: center;
  background: rgb(var(--text-rgb) / 0.06); color: var(--text); -webkit-appearance: none; appearance: none;
}
.tt-sheet .tt-field, .tt .tt-field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--hint); }
.tt-sheet .tt-input, .tt-sheet .tt-typed, .tt .tt-input {
  width: 100%; min-height: 44px; padding: 0 12px; border: 1px solid rgb(var(--text-rgb) / 0.12); border-radius: 12px;
  background: var(--bg); color: var(--text); font: inherit; font-size: 17px; box-sizing: border-box;
}
.tt-sheet .tt-typed { font-variant-numeric: tabular-nums; }
.tt-sheet .tt-input:focus, .tt .tt-input:focus, .tt-sheet .tt-typed:focus { outline: 2px solid var(--accent); outline-offset: 0; }

/* ---------- subjects ---------- */

.tt .tt-dot, .tt-sheet .tt-dot {
  flex: none; width: 14px; height: 14px; margin-right: 12px; border-radius: 50%; background: rgb(var(--tint-rgb));
}
.tt .tt-dot.sm, .tt-sheet .tt-dot.sm { width: 10px; height: 10px; margin-right: 0; }
.tt-sheet .tt-subject { display: flex; flex-direction: column; }
.tt-sheet .tt-colors { display: flex; flex-wrap: wrap; gap: 8px; }
.tt-sheet .tt-color {
  position: relative; width: 34px; height: 34px; border: 0; border-radius: 50%; background: rgb(var(--tint-rgb)); cursor: pointer;
}
.tt-sheet .tt-color::after { content: ''; position: absolute; inset: -4px; }
.tt-sheet .tt-color.on { box-shadow: 0 0 0 3px var(--bg2), 0 0 0 5px rgb(var(--tint-rgb)); }
.tt .tt-chips, .tt-sheet .tt-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.tt-sheet .tt-kinds { display: flex; flex-direction: column; gap: 10px; }
.tt-sheet .tt-kind { display: flex; flex-direction: column; gap: 6px; }
.tt-sheet .tt-kind-t { font-size: 14px; font-weight: 600; }
.tt-sheet .tt-kind-f { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 8px; }

/* ---------- drawing: the mini week, the day, the brush ---------- */

.tt .tt-mini-host { margin: 0 0 8px; }
.tt .tt-mini {
  display: grid; grid-template-columns: repeat(var(--cols, 6), minmax(0, 1fr)); gap: 4px; padding: 6px;
  border-radius: 14px; background: var(--bg2);
}
.tt .tt-mini-day {
  display: flex; flex-direction: column; align-items: stretch; gap: 4px; min-width: 0; min-height: 44px; padding: 4px 3px;
  border: 0; border-radius: 10px; background: none; color: var(--text); font: inherit; cursor: pointer;
}
.tt .tt-mini-day.on { background: rgb(var(--accent-rgb) / 0.12); }
.tt .tt-mini-wd { font-size: 11px; font-weight: 700; color: var(--hint); text-transform: uppercase; text-align: center; }
.tt .tt-mini-day.on .tt-mini-wd { color: var(--accent); }
.tt .tt-mini-bars { display: grid; grid-template-rows: repeat(var(--rows, 4), 5px); gap: 2px; }
.tt .tt-mini-slot { display: flex; gap: 1px; min-width: 0; border-radius: 2px; background: rgb(var(--text-rgb) / 0.06); }
.tt .tt-mini-slot i { flex: 1; border-radius: 2px; background: rgb(var(--tint-rgb)); }
.tt .tt-mini-slot i.par { opacity: .55; }

.tt .tt-daybar { display: flex; align-items: center; gap: 8px; margin: 6px 0 6px; }
.tt .tt-day-title { flex: 1; margin: 0; text-align: center; font-size: 19px; font-weight: 700; }
.tt .tt-nav {
  display: grid; place-items: center; width: 44px; height: 44px; border: 0; border-radius: 22px;
  background: rgb(var(--text-rgb) / 0.06); color: var(--accent); cursor: pointer;
}
.tt .tt-nav .ico { width: 22px; height: 22px; stroke-width: 2.2; }
/* The day scrolls vertically like any page (a plain swipe is the browser's); a stroke starts only after a finger
 * rests on a row (builder.js HOLD_MS), and then its touchmoves are cancelled so the page stays put under it. */
.tt .tt-day {
  display: flex; flex-direction: column; gap: 4px; padding: 6px; border-radius: 16px; background: var(--bg2);
  touch-action: pan-y; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
}
.tt .tt-slot.held { box-shadow: inset 0 0 0 2px var(--accent); transition: box-shadow .12s ease; }
.tt .tt-brush.stroking .tt-brush-row { display: none; }
.tt .tt-day.in-next { animation: tt-in-next .24s cubic-bezier(.2, .9, .3, 1) both; }
.tt .tt-day.in-prev { animation: tt-in-prev .24s cubic-bezier(.2, .9, .3, 1) both; }
@keyframes tt-in-next { from { transform: translateX(24px); opacity: 0; } }
@keyframes tt-in-prev { from { transform: translateX(-24px); opacity: 0; } }
.tt .tt-row { display: flex; align-items: stretch; gap: 6px; min-height: 52px; }
.tt .tt-row-n {
  flex: none; width: 52px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  touch-action: pan-y;
}
.tt .tt-row-n b { font-size: 14px; font-weight: 700; }
.tt .tt-row-n span { font-size: 10.5px; color: var(--hint); font-variant-numeric: tabular-nums; }
.tt .tt-slot {
  flex: 1; min-width: 0; display: flex; gap: 4px; align-items: stretch; padding: 0; border: 0; border-radius: 12px;
  background: rgb(var(--bg-rgb) / 0.6); color: var(--text); font: inherit; text-align: left; cursor: pointer;
}
.tt .tt-slot:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.tt .tt-empty { display: flex; align-items: center; padding: 0 12px; font-size: 13px; color: var(--hint); }
.tt .tt-cell {
  position: relative; flex: 1; min-width: 0; display: flex; align-items: center; gap: 4px; padding: 4px 0 4px 8px;
  border-left: 3px solid rgb(var(--tint-rgb)); border-radius: 10px; background: rgb(var(--tint-rgb) / 0.16);
}
.tt .tt-cell.par { background: repeating-linear-gradient(-45deg, rgb(var(--tint-rgb) / 0.2) 0 6px, rgb(var(--tint-rgb) / 0.08) 6px 12px); }
.tt .tt-cell.doubt { box-shadow: inset 0 0 0 1.5px var(--tt-warn); background-color: var(--tt-warn-bg); }
.tt .tt-cell-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.tt .tt-cell-name { font-size: 14px; font-weight: 600; line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tt .tt-cell-sub { font-size: 11.5px; color: var(--subtitle); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tt .tt-par {
  flex: none; display: grid; place-items: center; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 6px;
  font-size: 11px; font-weight: 800; background: rgb(var(--tint-rgb) / 0.3); color: var(--text);
}
.tt .tt-cell-more {
  flex: none; display: grid; place-items: center; width: 36px; align-self: stretch; border: 0; border-radius: 10px;
  background: none; color: var(--hint); cursor: pointer; touch-action: manipulation;
}
.tt .tt-cell-more .ico { width: 18px; height: 18px; }
.tt .tt-tools { justify-content: space-between; gap: 4px; flex-wrap: wrap; }
.tt .tt-tools .btn { padding: 0 4px; font-size: 14px; white-space: nowrap; }
.tt .tt-tools .tt-picker { font-size: 14px; padding: 0 10px; }
.tt .tt-brush .seg-item { padding: 0 4px; font-size: 13px; }
.tt .tt-picker { flex: none; max-width: 46%; }
.tt .tt-picker span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tt .tt-picker .ico { width: 16px; height: 16px; opacity: .7; }
.tt .tt-picker.fixed { cursor: default; opacity: 1; color: var(--text); }
.tt .tt-brush {
  position: sticky; bottom: calc(var(--cap-h, 0px) + 8px); z-index: 2; margin: 12px 0 0; padding: 8px 10px 10px;
  border-radius: 16px; background: var(--bg2);
  box-shadow: 0 0 0 1px rgb(var(--text-rgb) / 0.06), 0 6px 24px rgb(0 0 0 / 0.12);
}

.tt .tt-scroll { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding: 2px 2px 4px; margin: 0 -2px; }
.tt .tt-scroll::-webkit-scrollbar { display: none; }
.tt .tt-sub-chip { flex: none; }
.tt .tt-sub-chip.on { background: rgb(var(--tint-rgb) / 0.28); box-shadow: inset 0 0 0 2px rgb(var(--tint-rgb)); color: var(--text); }
.tt .tt-brush-row { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.tt .tt-brush-row .chip { flex: none; }
.tt .tt-csv {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin: 0 0 10px;
  padding: 10px 12px; border-radius: 14px; background: var(--tt-warn-bg);
}
.tt .tt-csv p { margin: 0; font-size: 14px; line-height: 1.35; }

/* ---------- the real week (the Week tab's own grid) ---------- */

.tt .tt-grid-host { margin-top: 10px; }
.tt .tt-grid .wk-lesson { cursor: default; position: relative; }
.tt .tt-grid .wk-lesson.par {
  background: repeating-linear-gradient(-45deg, rgb(var(--tint-rgb) / 0.22) 0 5px, rgb(var(--tint-rgb) / 0.1) 5px 10px);
}
.tt .tt-grid .wk-lesson.doubt { box-shadow: inset 0 0 0 1.5px var(--tt-warn); }
.tt .tt-grid .tt-par { position: absolute; top: 2px; right: 2px; min-width: 14px; height: 14px; font-size: 9px; padding: 0 2px; }
.tt .tt-publish { margin: 14px 0 0; padding: 12px 14px; border-radius: 14px; background: var(--bg2); }
.tt .tt-publish-line { margin: 0; font-size: 16px; font-weight: 600; font-variant-numeric: tabular-nums; }
.tt .tt-change { margin: 6px 0 0; font-size: 14px; line-height: 1.35; color: var(--subtitle); overflow-wrap: anywhere; }
.tt .tt-field-row { padding: 6px 14px; }
.tt .tt-switch { display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 6px 14px; cursor: pointer; }
.tt .tt-switch input {
  flex: none; width: 51px; height: 31px; margin: 0; border-radius: 16px; cursor: pointer;
  -webkit-appearance: none; appearance: none; background-color: rgb(var(--text-rgb) / 0.16);
  background-image: radial-gradient(circle at 15.5px 50%, #fff 12.5px, transparent 13.5px); background-repeat: no-repeat;
  transition: background-color .2s ease, background-position .2s ease;
}
.tt .tt-switch input:checked { background-color: #34c759; background-position: 20px 0; }
.tt .tt-switch input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { .tt .tt-switch input { transition: none; } }

/* ---------- done ---------- */

.tt .tt-done { text-align: center; padding: 28px 12px 8px; }
.tt .tt-done.small { padding: 16px 8px 4px; }
.tt .tt-done-ico {
  width: 64px; height: 64px; margin: 0 auto 14px; display: grid; place-items: center; border-radius: 50%;
  background: rgb(var(--accent-rgb) / 0.14); color: var(--accent);
}
.tt .tt-done-ico .ico { width: 32px; height: 32px; stroke-width: 2.2; }
.tt .tt-done-title { margin: 0; font-size: 22px; line-height: 1.25; font-weight: 700; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.tt .tt-done p { margin: 8px auto 0; max-width: 34ch; font-size: 15px; line-height: 1.4; color: var(--subtitle); }

/* ---------- the hub ---------- */

.tt .tt-hero { text-align: center; padding: 12px 8px 4px; }
.tt .tt-hero-ico {
  width: 64px; height: 64px; margin: 4px auto 12px; display: grid; place-items: center; border-radius: 50%;
  color: var(--accent); background: rgb(var(--accent-rgb) / 0.12);
}
.tt .tt-hero-ico .ico { width: 32px; height: 32px; }
.tt .tt-hero-title { margin: 0; font-size: 22px; line-height: 1.25; font-weight: 700; overflow-wrap: anywhere; }
.tt .tt-hero-body { margin: 8px 0 0; font-size: 15px; line-height: 1.4; color: var(--subtitle); overflow-wrap: anywhere; }
.tt .tt-buttons { display: flex; flex-direction: column; gap: 10px; margin: 18px 0 0; }
.tt .tt-buttons .btn { width: 100%; }
.tt .tt-status { display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 0; margin: 10px 0 0; }
.tt .tt-status p { margin: 0; font-size: 14px; color: var(--subtitle); }
.tt .tt-status .tt-warn { margin: 0; text-align: center; }
.tt .tt-spinner {
  width: 18px; height: 18px; border-radius: 50%; border: 2px solid rgb(var(--accent-rgb) / 0.25); border-top-color: var(--accent);
  animation: tt-spin .8s linear infinite;
}
@keyframes tt-spin { to { transform: rotate(360deg); } }
.tt-sheet .tt-facts { margin: 0 0 8px; font-size: 15px; line-height: 1.4; color: var(--subtitle); overflow-wrap: anywhere; }
.tt-sheet .tt-doubt-line { margin: 0 0 8px; font-size: 14px; color: var(--tt-warn); }
.tt-sheet .tt-cellbox { display: flex; flex-direction: column; gap: 12px; }

@media (prefers-reduced-motion: reduce) {
  .tt .tt-day.in-next, .tt .tt-day.in-prev { animation: none; }
  .tt .tt-spinner { animation-duration: 2.4s; }
}
@media (prefers-contrast: more) {
  .tt .tt-slot, .tt .tt-mini, .tt .tt-day { box-shadow: inset 0 0 0 1px var(--text); }
}
@media (max-width: 359px) {
  /* the eight colours stay one row at 320 px (never seven and a lonely eighth) */
  .tt-sheet .tt-colors { flex-wrap: nowrap; justify-content: space-between; gap: 4px; }
  .tt-sheet .tt-color { width: 30px; height: 30px; flex: none; }
  /* the brush keeps three rows at 320 px in every language («Har hafta», «Bekor qilish · Nusxa olish… · Hammasi») */
  .tt .tt-brush .seg-item { padding: 0 2px; }
  .tt .tt-tools { gap: 2px; }
  .tt .tt-tools .btn { font-size: 13px; padding: 0 2px; }
  .tt .tt-tools .tt-picker { font-size: 13px; padding: 0 6px; }
  .tt .tt-row-n { width: 44px; }
  .tt .tt-cell-name { font-size: 13px; }
  .tt .tt-step-t { font-size: 11px; }
}
