/* ================= وضعیت معلم‌ها و کادر — مرکز حضور و گزارش =================
   صفحهٔ بازطراحی‌شده با سربرگ برنددار، شاخص‌های زنده، ثبت روزانه،
   تقویم ماهانه، گزارش دوره‌ای و گزارش تدریس. رنگ‌ها از توکن‌های
   app.css می‌آیند تا حالت شب بدون بازنویسی کار کند. */

.tch-page { display: flex; flex-direction: column; gap: 14px; }

/* ---------- سربرگ ---------- */
.tch-hero {
  position: relative; overflow: hidden;
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: wrap;
  padding: 20px 22px; border-radius: var(--radius-xl);
  background:
    radial-gradient(520px 210px at 90% -45%, rgba(245, 158, 11, .38), transparent 70%),
    radial-gradient(430px 230px at 6% 135%, rgba(16, 185, 129, .30), transparent 70%),
    var(--grad-brand);
  color: #fff; box-shadow: var(--shadow-md);
}
.tch-hero::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background-image: radial-gradient(rgba(255, 255, 255, .13) 1px, transparent 1px);
  background-size: 22px 22px; opacity: .5;
}
.tch-hero-main { display: flex; align-items: center; gap: 14px; min-width: 0; position: relative; z-index: 1; }
.tch-hero-ic {
  width: 54px; height: 54px; flex: 0 0 auto; display: grid; place-items: center;
  border-radius: 17px; background: rgba(255, 255, 255, .14);
  border: 1px solid rgba(255, 255, 255, .24);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .22);
}
.tch-hero-title { margin: 0 0 4px; font-size: var(--fs-xl); font-weight: 800; letter-spacing: -.2px; }
.tch-hero-sub { margin: 0; font-size: var(--fs-sm); color: rgba(255, 255, 255, .84); max-width: 680px; line-height: 1.8; }
.tch-hero-actions { display: flex; gap: 7px; flex-wrap: wrap; position: relative; z-index: 1; }
.tch-hero-actions .btn {
  background: rgba(255, 255, 255, .10); border-color: rgba(255, 255, 255, .28);
  color: #fff; backdrop-filter: blur(4px);
}
.tch-hero-actions .btn:hover { background: rgba(255, 255, 255, .20); border-color: rgba(255, 255, 255, .46); }
.tch-hero-actions .btn.accent { background: var(--gold); border-color: var(--gold); color: #17252d; font-weight: 800; }
.tch-hero-actions .btn.accent:hover { background: #fbbf24; }

/* ---------- شاخص‌ها ---------- */
.tch-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(154px, 1fr)); gap: 10px; }
.tch-kpi {
  position: relative; overflow: hidden; text-align: right;
  display: grid; grid-template-columns: 32px 1fr; grid-template-rows: auto auto;
  gap: 0 9px; align-items: center; padding: 11px 13px; cursor: pointer;
  background: var(--paper); color: var(--ink);
  border: 1px solid var(--line); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs); font-family: inherit;
  transition: transform var(--dur) var(--ease), box-shadow var(--dur), border-color var(--dur);
}
.tch-kpi::before {
  content: ''; position: absolute; inset-inline-start: 0; top: 0; bottom: 0; width: 4px;
  background: var(--line); border-radius: 0 4px 4px 0;
}
.tch-kpi:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--side-2); }
.tch-kpi:focus-visible { outline: 3px solid var(--ring); outline-offset: 2px; }
.tch-kpi.is-active { border-color: var(--accent-2); box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent-2) 22%, transparent); }
.tch-kpi-ic { grid-row: 1 / 3; display: grid; place-items: center; color: var(--side-2); }
.tch-kpi b { font-size: var(--fs-2xl); line-height: 1.05; font-weight: 800; color: var(--side); font-variant-numeric: tabular-nums; }
.tch-kpi-l { font-size: var(--fs-xs); color: var(--muted); font-weight: 600; }
.tch-kpi.is-zero { opacity: .72; }
.tch-kpi.is-zero b { color: var(--muted); }
.tch-kpi.tone-good::before { background: var(--good); }
.tch-kpi.tone-good b { color: var(--good); }
.tch-kpi.tone-warn::before { background: var(--warn); }
.tch-kpi.tone-warn b { color: var(--warn); }
.tch-kpi.tone-bad::before { background: var(--bad); }
.tch-kpi.tone-bad b { color: var(--bad); }
.tch-kpi.tone-info::before { background: var(--info); }
.tch-kpi.tone-info b { color: var(--info); }
.tch-kpi.tone-heart::before { background: #a21caf; }
.tch-kpi.tone-heart b { color: #a21caf; }

/* ---------- تب‌ها ---------- */
.tch-tabs {
  display: flex; gap: 8px; flex-wrap: wrap; align-items: stretch; padding: 4px;
  background: color-mix(in srgb, var(--paper) 65%, transparent);
  border: 1px solid var(--line); border-radius: var(--radius-lg);
}
.tch-tab {
  flex: 1 1 130px; min-width: 124px;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 12px; font-size: var(--fs-sm); font-weight: 700;
  border-radius: var(--radius-md); border: 1px solid transparent;
  background: transparent; color: var(--ink); font-family: inherit; cursor: pointer;
  transition: background var(--dur-fast), color var(--dur-fast), box-shadow var(--dur-fast);
}
.tch-tab:hover { background: var(--paper); border-color: var(--line); }
.tch-tab.active { background: var(--grad-brand); color: #fff; box-shadow: 0 4px 14px rgba(13, 59, 52, .28); }
.tch-tab-n {
  min-width: 21px; padding: 1px 7px; border-radius: var(--radius-full);
  font-size: var(--fs-2xs); font-weight: 800;
  background: color-mix(in srgb, currentColor 14%, transparent);
}
.tch-tab.active .tch-tab-n { background: rgba(255, 255, 255, .22); }

/* ---------- پنل و کارت ---------- */
.tch-panel { animation: tchPanelIn var(--dur-base) var(--ease-out) both; }
@keyframes tchPanelIn { from { opacity: 0; transform: translateY(5px); } }
.tch-card { padding: 18px; border-radius: var(--radius-lg); }
.tch-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.tch-card-title { margin: 0; font-size: var(--fs-lg); font-weight: 800; }
.tch-card-sub { margin: 3px 0 0; font-size: var(--fs-xs); color: var(--muted); line-height: 1.7; }
.tch-card-tools { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.tch-count {
  font-size: var(--fs-xs); font-weight: 700; color: var(--muted);
  background: var(--surface-2); border: 1px solid var(--line);
  padding: 4px 10px; border-radius: var(--radius-full);
}
.tch-loading { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 34px 12px; color: var(--muted); font-weight: 600; }
.tch-loading .ic { animation: tchSpin 1.1s linear infinite; }
@keyframes tchSpin { to { transform: rotate(360deg); } }
.tch-mini-empty {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  flex-wrap: wrap; padding: 26px 14px; color: var(--muted);
  border: 1px dashed var(--line); border-radius: var(--radius-lg);
  background: color-mix(in srgb, var(--surface-2) 45%, transparent); text-align: center;
}

/* ---------- نوار روز ---------- */
.tch-daybar {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 12px; flex-wrap: wrap; padding-bottom: 12px;
  border-bottom: 1px solid var(--line); margin-bottom: 12px;
}
.tch-daynav { display: flex; align-items: flex-end; gap: 6px; flex-wrap: wrap; }
.tch-datefield { margin: 0; min-width: 136px; }
.tch-datefield input { min-height: 38px; font-variant-numeric: tabular-nums; }
.tch-daymeta { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.tch-daymeta-main { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; font-size: var(--fs-sm); }
.tch-daymeta-main strong { font-size: var(--fs-md); color: var(--side); }
.tch-wd { font-size: var(--fs-xs); color: var(--muted); }
.tch-badge {
  font-size: var(--fs-2xs); font-weight: 700; padding: 2px 9px;
  border-radius: var(--radius-full); border: 1px solid transparent;
}
.tch-badge.tone-bad { color: var(--bad); background: color-mix(in srgb, var(--bad) 10%, var(--paper)); border-color: color-mix(in srgb, var(--bad) 30%, var(--line)); }
.tch-badge.tone-muted { color: var(--muted); background: var(--surface-2); border-color: var(--line); }
.tch-occ { display: flex; gap: 4px; flex-wrap: wrap; }
.tch-occ span {
  font-size: var(--fs-2xs); color: var(--muted);
  background: var(--surface-2); border: 1px solid var(--line);
  padding: 1px 8px; border-radius: var(--radius-full);
}
.tch-dayactions { display: flex; gap: 6px; flex-wrap: wrap; }
.tch-notice {
  display: flex; align-items: center; gap: 7px; margin-bottom: 12px;
  padding: 9px 12px; border-radius: var(--radius-md); font-size: var(--fs-xs); font-weight: 600;
}
.tch-notice.tone-bad {
  color: var(--bad); background: color-mix(in srgb, var(--bad) 8%, var(--paper));
  border: 1px solid color-mix(in srgb, var(--bad) 26%, var(--line));
}

/* ---------- نوار ابزار ---------- */
.tch-toolbar {
  display: grid; grid-template-columns: minmax(200px, 1.7fr) repeat(2, minmax(126px, 1fr)) auto;
  gap: 9px; align-items: end;
}
.tch-toolbar .field { margin: 0; min-width: 0; }
.tch-toolbar .field label { font-size: var(--fs-2xs); font-weight: 700; color: var(--muted); }
.tch-toolbar .btn { min-height: 38px; }
.tch-toolbar-btns { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.tch-search { position: relative; }
.tch-search input { padding-inline-start: 34px; }
.tch-search .tch-search-ic {
  position: absolute; inset-inline-start: 10px; bottom: 11px;
  color: var(--muted); pointer-events: none; display: grid; place-items: center;
}

/* ---------- چیپ‌های فیلتر ---------- */
.tch-chips { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 11px; }
.tch-chips-l { font-size: var(--fs-xs); color: var(--muted); font-weight: 600; }
.tch-chip {
  cursor: pointer; font-family: inherit; font-size: var(--fs-xs); font-weight: 700;
  padding: 5px 11px; border-radius: var(--radius-full);
  border: 1px solid var(--line); background: var(--paper); color: var(--ink);
  transition: background var(--dur-fast), border-color var(--dur-fast), color var(--dur-fast);
}
.tch-chip:hover { border-color: var(--accent-2); color: var(--accent-2); }
.tch-chip.active { background: var(--accent-2); border-color: var(--accent-2); color: #fff; }
.tch-chip-n { opacity: .8; font-weight: 600; margin-inline-start: 2px; }

/* ---------- سر فهرست روزانه ---------- */
.tch-listhead {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; flex-wrap: wrap; margin: 14px 0 8px;
}
.tch-listhead strong { font-size: var(--fs-md); }
.tch-hint { display: inline-flex; align-items: center; gap: 4px; font-size: var(--fs-2xs); color: var(--muted); }
.tch-tip {
  display: flex; align-items: flex-start; gap: 5px; margin: 10px 0 0;
  font-size: var(--fs-2xs); color: var(--muted); line-height: 1.8;
}

/* ---------- ردیف روزانه ---------- */
.tch-list { display: flex; flex-direction: column; gap: 7px; }
.tch-dayrow {
  position: relative; display: grid;
  grid-template-columns: minmax(170px, 1.05fr) minmax(286px, 1.3fr) minmax(220px, 1.5fr) auto;
  gap: 10px; align-items: center;
  padding: 10px 12px; background: var(--paper);
  border: 1px solid var(--line); border-radius: var(--radius-md);
  transition: border-color var(--dur-fast), box-shadow var(--dur-fast), background var(--dur-fast);
}
.tch-dayrow:hover { border-color: color-mix(in srgb, var(--side-2) 42%, var(--line)); box-shadow: var(--shadow-xs); }
.tch-dayrow.is-dirty {
  border-color: color-mix(in srgb, var(--warn) 50%, var(--line));
  background: color-mix(in srgb, var(--warn) 4%, var(--paper));
}
.tch-dayrow.is-dirty::before {
  content: ''; position: absolute; inset-inline-start: 0; top: 8px; bottom: 8px; width: 3px;
  border-radius: 0 3px 3px 0; background: var(--warn);
}
.tch-person { display: flex; align-items: center; gap: 9px; min-width: 0; }
.tch-person-main { min-width: 0; display: flex; flex-direction: column; }
.tch-person-main strong { font-size: var(--fs-sm); line-height: 1.55; color: var(--ink); }
.tch-person-main span { font-size: var(--fs-2xs); color: var(--muted); line-height: 1.55; }
.tch-person-sm .tch-person-main strong { font-size: var(--fs-xs); }
.tch-avatar {
  width: 36px; height: 36px; flex: 0 0 auto; display: grid; place-items: center;
  border-radius: 50%; font-size: var(--fs-xs); font-weight: 800; color: #fff;
  background: var(--side-2); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .16);
  user-select: none;
}
.tch-avatar.tone-good { background: var(--good); }
.tch-avatar.tone-warn { background: var(--warn); }
.tch-avatar.tone-bad { background: var(--bad); }
.tch-avatar.tone-info { background: var(--info); }
.tch-avatar.tone-heart { background: #a21caf; }
.tch-dirty-dot {
  align-self: flex-start; margin-top: 2px; font-style: normal;
  font-size: var(--fs-3xs); font-weight: 700; color: var(--warn);
  background: color-mix(in srgb, var(--warn) 12%, transparent);
  border-radius: var(--radius-full); padding: 0 6px;
}

/* ---------- دکمه‌های وضعیت ---------- */
.tch-seg {
  display: flex; flex-wrap: wrap; gap: 3px; padding: 3px;
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: var(--radius-md);
}
.tch-stbtn {
  flex: 1 1 auto; min-width: 54px; padding: 5px 7px;
  font-family: inherit; font-size: var(--fs-2xs); font-weight: 700;
  border-radius: 7px; border: 1px solid transparent;
  background: transparent; color: var(--muted); cursor: pointer;
  transition: background var(--dur-fast), color var(--dur-fast), box-shadow var(--dur-fast);
  white-space: nowrap;
}
.tch-stbtn:hover { background: var(--paper); color: var(--ink); }
.tch-stbtn.sel { background: var(--paper); color: var(--side); box-shadow: var(--shadow-xs); }
.tch-stbtn.sel[data-tone="good"] { color: var(--good); }
.tch-stbtn.sel[data-tone="warn"] { color: var(--warn); }
.tch-stbtn.sel[data-tone="bad"] { color: var(--bad); }
.tch-stbtn.sel[data-tone="info"] { color: var(--info); }
.tch-stbtn.sel[data-tone="heart"] { color: #a21caf; }
.tch-stbtn.sel[data-tone="good"] { box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--good) 40%, transparent), var(--shadow-xs); }
.tch-stbtn.sel[data-tone="warn"] { box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--warn) 42%, transparent), var(--shadow-xs); }
.tch-stbtn.sel[data-tone="bad"] { box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--bad) 40%, transparent), var(--shadow-xs); }
.tch-stbtn.sel[data-tone="info"] { box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--info) 40%, transparent), var(--shadow-xs); }
.tch-stbtn.sel[data-tone="heart"] { box-shadow: inset 0 0 0 1.5px color-mix(in srgb, #a21caf 40%, transparent), var(--shadow-xs); }

/* ---------- جزئیات ردیف ---------- */
.tch-detail { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; min-width: 0; }
.tch-mini { display: flex; flex-direction: column; gap: 2px; min-width: 84px; }
.tch-mini > span { font-size: var(--fs-3xs); color: var(--muted); font-weight: 700; }
.tch-mini input {
  min-height: 31px; font-size: var(--fs-xs); padding: 4px 8px;
  border: 1.5px solid var(--line); border-radius: var(--radius-sm);
  background: var(--paper); color: var(--ink); outline: none;
  transition: border-color var(--dur-fast), box-shadow var(--dur-fast);
}
.tch-mini input:focus { border-color: var(--accent-2); box-shadow: 0 0 0 3px var(--ring); }
[data-theme="dark"] .tch-mini input { background: var(--surface-2); }
.tch-note { flex: 1 1 190px; min-width: 130px; max-width: 340px; }
.tch-time { width: 78px; text-align: center; font-variant-numeric: tabular-nums; }
.tch-calc { font-size: var(--fs-2xs); font-weight: 700; color: var(--muted); }
.tch-calc.tone-warn { color: var(--warn); }
.tch-calc.tone-info { color: var(--info); }
.tch-rowactions { display: flex; align-items: center; gap: 3px; }
.tch-icon-btn {
  width: 30px; height: 30px; display: inline-grid; place-items: center;
  border: 1px solid transparent; border-radius: 8px;
  background: transparent; color: var(--muted); cursor: pointer; font-family: inherit;
  transition: background var(--dur-fast), color var(--dur-fast), border-color var(--dur-fast);
}
.tch-icon-btn:hover { background: var(--surface-2); border-color: var(--line); color: var(--side-2); }
.tch-icon-btn.danger:hover { background: color-mix(in srgb, var(--bad) 10%, var(--paper)); border-color: color-mix(in srgb, var(--bad) 35%, var(--line)); color: var(--bad); }

/* ---------- نوار ذخیره ---------- */
.tch-savebar {
  position: sticky; bottom: 8px; z-index: 5;
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; flex-wrap: wrap; margin-top: 12px; padding: 9px 12px;
  border: 1px solid var(--line); border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: blur(9px); box-shadow: var(--shadow-xs);
  transition: border-color var(--dur-fast), box-shadow var(--dur-fast), background var(--dur-fast);
}
.tch-savebar.is-dirty {
  border-color: color-mix(in srgb, var(--warn) 55%, var(--line));
  box-shadow: 0 8px 26px color-mix(in srgb, var(--warn) 16%, transparent);
}
.tch-savebar-txt { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-xs); font-weight: 700; color: var(--muted); }
.tch-savebar.is-dirty .tch-savebar-txt { color: var(--warn); }
.tch-savebar-btns { display: flex; align-items: center; gap: 6px; }
.tch-savebar .btn[disabled] { opacity: .55; cursor: default; }

/* ---------- تقویم ماه ---------- */
.tch-monthbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap; padding-bottom: 12px;
  border-bottom: 1px solid var(--line); margin-bottom: 12px;
}
.tch-monthnav { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.tch-monthtitle { font-size: var(--fs-lg); font-weight: 800; color: var(--side); min-width: 118px; text-align: center; }
.tch-monthsummary { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.tch-sum {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: var(--fs-2xs); font-weight: 600; color: var(--muted);
  background: var(--surface-2); border: 1px solid var(--line);
  padding: 4px 9px; border-radius: var(--radius-full);
}
.tch-sum b { font-weight: 800; }
.tch-sum.tone-warn b, .tch-sum.tone-warn .ic { color: var(--warn); }
.tch-sum.tone-bad b, .tch-sum.tone-bad .ic { color: var(--bad); }
.tch-sum.tone-info b, .tch-sum.tone-info .ic { color: var(--info); }
.tch-monthactions { display: flex; align-items: center; gap: 6px; }
.tch-toolbar-month { grid-template-columns: minmax(190px, 1.5fr) minmax(130px, 1fr) auto; }
.tch-legend { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.tch-leg { display: inline-flex; align-items: center; gap: 4px; font-size: var(--fs-2xs); color: var(--muted); }
.tch-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; background: var(--line); }
.tch-dot.tone-good { background: var(--good); }
.tch-dot.tone-warn { background: var(--warn); }
.tch-dot.tone-bad { background: var(--bad); }
.tch-dot.tone-info { background: var(--info); }
.tch-dot.tone-heart { background: #a21caf; }

.tch-matrixwrap {
  position: relative; margin-top: 12px; overflow: auto; max-height: 68vh;
  border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--paper);
}
.tch-matrix { width: max-content; min-width: 100%; border-collapse: separate; border-spacing: 0; font-size: var(--fs-2xs); }
.tch-matrix thead th {
  position: sticky; top: 0; z-index: 3; background: var(--bg);
  padding: 5px 2px; border-bottom: 1px solid var(--line); font-weight: 700; color: var(--muted);
  min-width: 27px;
}
[data-theme="dark"] .tch-matrix thead th { background: var(--surface-2); }
.tch-matrix thead th.tch-m-name { inset-inline-start: 0; z-index: 4; min-width: 176px; text-align: start; padding-inline: 10px; }
.tch-matrix .tch-m-name {
  position: sticky; inset-inline-start: 0; z-index: 2;
  min-width: 176px; max-width: 176px; background: var(--paper);
  border-inline-end: 1px solid var(--line); text-align: start; padding: 5px 8px;
}
[data-theme="dark"] .tch-matrix .tch-m-name { background: var(--surface-2); }
.tch-matrix td { border-bottom: 1px solid var(--line); }
.tch-matrix tbody tr:last-child td { border-bottom: 0; }
.tch-m-wd { display: block; font-size: var(--fs-3xs); opacity: .7; }
.tch-m-dn { display: block; font-weight: 800; color: var(--ink); }
.tch-m-day.is-weekend, .tch-m-cell.is-weekend { background: color-mix(in srgb, var(--surface-2) 62%, transparent); }
.tch-m-day.is-holiday, .tch-m-cell.is-holiday { background: color-mix(in srgb, var(--bad) 7%, var(--paper)); }
.tch-m-day.is-today, .tch-m-cell.is-today { box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--accent-2) 55%, transparent); }
.tch-m-cell { text-align: center; padding: 2px; }
.tch-cell {
  width: 23px; height: 23px; display: inline-grid; place-items: center;
  border: 1px solid transparent; border-radius: 6px; cursor: pointer;
  font-family: inherit; font-size: var(--fs-3xs); font-weight: 800;
  background: transparent; color: var(--muted);
  transition: transform var(--dur-fast), box-shadow var(--dur-fast), background var(--dur-fast);
}
.tch-cell:hover { transform: scale(1.14); box-shadow: var(--shadow-xs); border-color: var(--line); }
.tch-cell.is-present { color: var(--muted); }
.tch-cell.tone-warn { background: color-mix(in srgb, var(--warn) 18%, var(--paper)); color: var(--warn); }
.tch-cell.tone-bad { background: color-mix(in srgb, var(--bad) 17%, var(--paper)); color: var(--bad); }
.tch-cell.tone-info { background: color-mix(in srgb, var(--info) 15%, var(--paper)); color: var(--info); }
.tch-cell.tone-heart { background: color-mix(in srgb, #a21caf 14%, var(--paper)); color: #a21caf; }
.tch-cell.tone-good { background: color-mix(in srgb, var(--good) 14%, var(--paper)); color: var(--good); }
.tch-dot-faint { width: 4px; height: 4px; border-radius: 50%; background: var(--line); display: inline-block; }
.tch-m-sum { text-align: center; min-width: 42px; font-weight: 700; color: var(--muted); }
.tch-sum-mini { font-size: var(--fs-3xs); font-weight: 800; padding: 1px 6px; border-radius: var(--radius-full); background: var(--surface-2); }
.tch-sum-mini.tone-warn { color: var(--warn); background: color-mix(in srgb, var(--warn) 10%, var(--paper)); }
.tch-sum-mini.tone-good { color: var(--good); background: color-mix(in srgb, var(--good) 10%, var(--paper)); }
.tch-matrix tfoot td { border-top: 1px solid var(--line); border-bottom: 0; background: var(--surface-2); }
.tch-matrix tfoot .tch-m-name { background: var(--surface-2); font-weight: 700; color: var(--muted); font-size: var(--fs-3xs); }
.tch-m-total { font-size: var(--fs-3xs); font-weight: 800; color: var(--muted); }

/* ---------- گزارش دوره‌ای ---------- */
.tch-toolbar-period { grid-template-columns: repeat(2, minmax(130px, 1fr)) auto; }
.tch-period-sum { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; margin-top: 12px; }
.tch-period-sum span {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: var(--fs-2xs); font-weight: 600; color: var(--muted);
  background: var(--surface-2); border: 1px solid var(--line);
  padding: 4px 9px; border-radius: var(--radius-full);
}
.tch-period-sum .tone-warn { color: var(--warn); }
.tch-period-sum .tone-bad { color: var(--bad); }
.tch-period-sum .tone-info { color: var(--info); }
.tch-tablewrap {
  position: relative; margin-top: 12px; max-height: 62vh; overflow: auto;
  border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--paper);
}
.tch-table { width: 100%; min-width: 760px; margin: 0; border-collapse: separate; border-spacing: 0; font-size: var(--fs-sm); }
.tch-table thead th {
  position: sticky; top: 0; z-index: 2; background: var(--bg);
  font-size: var(--fs-2xs); font-weight: 700; color: var(--muted);
  text-align: center; border-bottom: 1px solid var(--line); padding: 8px 9px; white-space: nowrap;
}
[data-theme="dark"] .tch-table thead th { background: var(--surface-2); }
.tch-table thead th:first-child { text-align: start; }
.tch-table tbody td { border-bottom: 1px solid var(--line); padding: 7px 9px; text-align: center; vertical-align: middle; }
.tch-table tbody td:first-child { text-align: start; }
.tch-table tbody tr:last-child td { border-bottom: 0; }
.tch-table tbody tr:hover td { background: var(--surface-2); }
.tch-period-row { cursor: pointer; }
.tch-table .muted { color: var(--muted); }
.tch-table .tone-warn { color: var(--warn); font-weight: 700; }
.tch-table .tone-bad { color: var(--bad); font-weight: 700; }
.tch-table .tone-info { color: var(--info); font-weight: 700; }
.tch-th-sort {
  display: inline-flex; align-items: center; gap: 3px;
  border: 0; background: transparent; color: inherit; font: inherit;
  font-weight: 700; cursor: pointer; padding: 0;
}
.tch-th-sort:hover { color: var(--accent-2); }
.tch-sort-ic { opacity: .45; font-size: var(--fs-3xs); }
.tch-th-sort.sorted .tch-sort-ic { opacity: 1; color: var(--accent); }
.tch-bar { width: 96px; height: 7px; margin: 0 auto; background: var(--surface-2); border-radius: var(--radius-full); overflow: hidden; }
.tch-bar i { display: block; height: 100%; border-radius: var(--radius-full); background: var(--grad-gold); }
.tch-pill {
  display: inline-block; font-size: var(--fs-2xs); font-weight: 700;
  padding: 2px 9px; border-radius: var(--radius-full);
  background: var(--surface-2); color: var(--muted);
}
.tch-pill.tone-good { color: var(--good); background: color-mix(in srgb, var(--good) 10%, var(--paper)); }
.tch-pill.tone-warn { color: var(--warn); background: color-mix(in srgb, var(--warn) 11%, var(--paper)); }
.tch-pill.tone-bad { color: var(--bad); background: color-mix(in srgb, var(--bad) 10%, var(--paper)); }
.tch-pill.tone-info { color: var(--info); background: color-mix(in srgb, var(--info) 10%, var(--paper)); }
.tch-pill.tone-heart { color: #a21caf; background: color-mix(in srgb, #a21caf 10%, var(--paper)); }

/* ---------- گزارش تدریس ---------- */
.tch-trform {
  padding: 12px; margin-bottom: 12px;
  border: 1px solid var(--line); border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--surface-2) 52%, transparent);
}
.tch-toolbar-tr { grid-template-columns: minmax(200px, 1.5fr) repeat(4, minmax(112px, 1fr)) auto; }
.tch-tr-list { display: flex; flex-direction: column; gap: 8px; }
.tch-tr-card {
  position: relative; padding: 12px 14px;
  background: var(--paper); border: 1px solid var(--line);
  border-radius: var(--radius-md); box-shadow: var(--shadow-xs);
  transition: border-color var(--dur-fast), box-shadow var(--dur-fast), transform var(--dur-fast);
}
.tch-tr-card:hover { border-color: color-mix(in srgb, var(--side-2) 40%, var(--line)); box-shadow: var(--shadow-sm); transform: translateY(-1px); }
.tch-tr-card::before {
  content: ''; position: absolute; inset-inline-start: 0; top: 10px; bottom: 10px; width: 3px;
  border-radius: 0 3px 3px 0; background: linear-gradient(var(--accent-2), var(--gold));
}
.tch-tr-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.tch-tr-actions { display: flex; align-items: center; gap: 2px; }
.tch-tr-text { margin: 8px 0 6px; font-size: var(--fs-sm); line-height: 1.9; color: var(--ink); white-space: pre-wrap; }
.tch-tr-date { font-size: var(--fs-3xs); color: var(--muted); font-variant-numeric: tabular-nums; }

/* ---------- مودال ویرایش وضعیت ---------- */
.tch-editstatus { display: flex; flex-wrap: wrap; gap: 4px; padding: 4px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-md); }
.tch-editstatus .tch-stbtn { flex: 1 1 auto; min-width: 72px; padding: 7px 9px; font-size: var(--fs-xs); }
.tch-editgrid { display: flex; align-items: flex-end; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.tch-editpart { display: flex; align-items: flex-end; gap: 8px; flex-wrap: wrap; }
.tch-editpart[hidden] { display: none; }

/* ---------- مودال مرخصی چندروزه ---------- */
.tch-range-people { margin-top: 12px; border: 1px solid var(--line); border-radius: var(--radius-md); overflow: hidden; }
.tch-range-head { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; padding: 8px 10px; background: var(--surface-2); border-bottom: 1px solid var(--line); }
.tch-range-head strong { margin-inline-end: auto; font-size: var(--fs-sm); }
.tch-range-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(178px, 1fr)); gap: 2px; padding: 6px; max-height: 260px; overflow: auto; }
.tch-check { display: flex; align-items: center; gap: 7px; padding: 6px 8px; border-radius: 7px; cursor: pointer; font-size: var(--fs-xs); }
.tch-check:hover { background: var(--surface-2); }
.tch-check input { width: 15px; height: 15px; accent-color: var(--accent-2); cursor: pointer; }
.tch-check span { display: flex; flex-direction: column; min-width: 0; }
.tch-check strong { font-weight: 700; }
.tch-check small { color: var(--muted); font-size: var(--fs-3xs); }

/* ---------- مودال گزارش جامع ---------- */
.tch-toolbar-report { grid-template-columns: repeat(2, minmax(120px, 1fr)) auto; }
.tch-report-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.tch-report-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(104px, 1fr)); gap: 6px; margin-bottom: 10px; }
.tch-ministat {
  padding: 8px 10px; text-align: center;
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: var(--radius-md);
}
.tch-ministat b { display: block; font-size: var(--fs-lg); font-weight: 800; color: var(--side); font-variant-numeric: tabular-nums; }
.tch-ministat span { font-size: var(--fs-3xs); color: var(--muted); }
.tch-ministat.tone-warn b { color: var(--warn); }
.tch-ministat.tone-bad b { color: var(--bad); }
.tch-ministat.tone-info b { color: var(--info); }
.tch-ministat.tone-heart b { color: #a21caf; }
.tch-ministat.tone-good b { color: var(--good); }

/* ---------- واکنش‌گرایی ---------- */
@media (max-width: 1180px) {
  .tch-toolbar-tr { grid-template-columns: repeat(3, minmax(130px, 1fr)); }
  .tch-toolbar-tr .tch-search { grid-column: 1 / -1; }
}
@media (max-width: 980px) {
  .tch-dayrow { grid-template-columns: minmax(0, 1fr) auto; }
  .tch-person { grid-column: 1 / 2; }
  .tch-seg { grid-column: 1 / -1; }
  .tch-detail { grid-column: 1 / -1; }
  .tch-rowactions { grid-column: 2 / 3; grid-row: 1 / 2; justify-content: flex-end; }
  .tch-toolbar, .tch-toolbar-month, .tch-toolbar-period, .tch-toolbar-report { grid-template-columns: 1fr 1fr; }
  .tch-toolbar .tch-search { grid-column: 1 / -1; }
  .tch-legend { justify-content: flex-start; }
  .tch-monthsummary { order: 3; width: 100%; }
}
@media (max-width: 620px) {
  .tch-hero { padding: 16px 15px; }
  .tch-hero-title { font-size: var(--fs-lg); }
  .tch-hero-sub { font-size: var(--fs-xs); }
  .tch-hero-actions { width: 100%; }
  .tch-hero-actions .btn { flex: 1 1 auto; justify-content: center; }
  .tch-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tch-toolbar, .tch-toolbar-month, .tch-toolbar-period, .tch-toolbar-report, .tch-toolbar-tr { grid-template-columns: 1fr; }
  .tch-daybar { align-items: stretch; }
  .tch-daynav { width: 100%; }
  .tch-datefield { flex: 1 1 120px; }
  .tch-daymeta { width: 100%; }
  .tch-dayactions { width: 100%; }
  .tch-dayactions .btn { flex: 1 1 auto; }
  .tch-monthnav { width: 100%; justify-content: center; }
  .tch-matrix .tch-m-name { min-width: 132px; max-width: 132px; }
  .tch-matrix thead th.tch-m-name { min-width: 132px; }
  .tch-savebar { position: static; }
  .tch-savebar-btns { width: 100%; }
  .tch-savebar-btns .btn { flex: 1 1 auto; justify-content: center; }
}
@media (prefers-reduced-motion: reduce) {
  .tch-panel, .tch-kpi, .tch-dayrow, .tch-tr-card, .tch-cell, .tch-loading .ic { animation: none !important; transition: none !important; }
}
