/* Trang «Hôm nay» — PLAN-dot-10 · biến CSS only */
body:has(#v-today:not([hidden])) .page-head { display: none; }

#today-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr); /* không để dòng thời gian (min-width 640) đẩy rộng cả trang */
  gap: 16px;
  min-width: 0;
}
#today-body > * { min-width: 0; }
#today-body > .card { margin: 0; }

/* —— Đầu trang —— */
.td-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.td-head-main {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  min-width: 0;
  flex: 1 1 280px;
}
.td-greet-ico {
  width: 44px; height: 44px;
  border-radius: var(--r);
  display: grid; place-items: center;
  flex: none;
  background: color-mix(in srgb, var(--accent) 14%, var(--surface));
  color: var(--accent-text);
}
.td-greet-ico svg {
  width: 24px; height: 24px;
  fill: none; stroke: currentColor; stroke-width: 1.8;
  stroke-linecap: round; stroke-linejoin: round;
}
.td-greet-copy { min-width: 0; display: grid; gap: 4px; }
.td-greet-copy h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  color: var(--text-strong);
  line-height: 1.3;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.td-greet-sub {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px;
  font-size: 13px; color: var(--text-muted); line-height: 1.45;
}
.td-greet-sub .td-cal {
  display: inline-flex; align-items: center; gap: 6px;
}
.td-greet-sub .td-cal svg {
  width: 14px; height: 14px;
  fill: none; stroke: currentColor; stroke-width: 1.8;
  stroke-linecap: round; stroke-linejoin: round;
}
.td-chip {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.td-chip.open { color: var(--green); }
.td-chip.upcoming { color: var(--amber); }
.td-chip.todo { color: var(--red); }
.td-head-act { flex: none; }

.td-job-banner {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 10px 14px;
  border-radius: var(--r);
  border: 1px solid color-mix(in srgb, var(--accent) 28%, var(--border));
  background: color-mix(in srgb, var(--accent) 8%, var(--surface));
  font-size: 13px; color: var(--text);
}
.td-job-banner b { color: var(--text-strong); font-weight: 600; }

/* —— Lịch / dòng thời gian —— */
.td-tl-card { padding: 16px 20px 20px; }
.td-sec-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap; margin-bottom: 12px;
}
.td-sec-title {
  display: inline-flex; align-items: center; gap: 10px;
  font-size: 17px; font-weight: 700; color: var(--text-strong);
}
.td-sec-ico {
  width: 32px; height: 32px;
  border-radius: var(--r-sm);
  display: grid; place-items: center;
  flex: none;
}
.td-sec-ico svg {
  width: 18px; height: 18px;
  fill: none; stroke: currentColor; stroke-width: 1.8;
  stroke-linecap: round; stroke-linejoin: round;
}
.td-sec-ico.accent {
  background: color-mix(in srgb, var(--accent) 14%, var(--surface));
  color: var(--accent-text);
}
.td-sec-ico.red {
  background: color-mix(in srgb, var(--red) 14%, var(--surface));
  color: var(--red);
}
.td-legend {
  display: inline-flex; flex-wrap: wrap; gap: 10px 14px;
  font-size: 12px; color: var(--text-muted);
}
.td-legend i {
  display: inline-block; width: 10px; height: 10px;
  border-radius: 3px; margin-right: 6px; vertical-align: -1px;
  border: 1px solid transparent;
}
.td-legend .lg-open {
  background: color-mix(in srgb, var(--green) 35%, var(--surface));
  border-color: color-mix(in srgb, var(--green) 45%, var(--border));
}
.td-legend .lg-up {
  background: color-mix(in srgb, var(--amber) 35%, var(--surface));
  border-color: color-mix(in srgb, var(--amber) 45%, var(--border));
}
.td-legend .lg-closed {
  background: color-mix(in srgb, var(--text-faint) 28%, var(--surface));
  border-color: var(--border);
}

.td-tl-scroll {
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  margin: 0 -4px;
  padding: 0 4px 4px;
}
.td-tl {
  position: relative;
  min-height: 64px;
  min-width: 640px;
}
.td-tl-hours {
  position: absolute; inset: 0;
  pointer-events: none;
}
.td-tl-hour {
  position: absolute; top: 0; bottom: 0;
  border-left: 1px solid var(--border-soft);
  color: var(--text-faint);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  padding-top: 2px;
  padding-left: 4px;
}
.td-tl-lanes {
  position: relative;
  padding-top: 22px;
  display: grid;
  gap: 6px;
}
.td-tl-lane {
  position: relative;
  height: 52px;
}
.td-block {
  position: absolute;
  top: 0; bottom: 0;
  min-width: 8px;
  border-radius: var(--r-sm);
  border: 1px solid transparent;
  padding: 6px 8px;
  display: grid;
  align-content: center;
  gap: 2px;
  cursor: pointer;
  overflow: hidden;
  text-align: left;
  font: inherit;
  color: var(--text-strong);
  background: var(--surface-2);
  transition: box-shadow 140ms ease, transform 140ms ease;
}
.td-block:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.td-block:hover { box-shadow: var(--shadow); }
.td-block.open {
  background: color-mix(in srgb, var(--green) 12%, var(--surface));
  border-color: color-mix(in srgb, var(--green) 32%, var(--border));
}
.td-block.upcoming {
  background: color-mix(in srgb, var(--amber) 12%, var(--surface));
  border-color: color-mix(in srgb, var(--amber) 32%, var(--border));
}
.td-block.closed {
  background: color-mix(in srgb, var(--text-faint) 10%, var(--surface));
  border-color: var(--border);
  color: var(--text-muted);
}
.td-block-r1 {
  display: flex; align-items: center; gap: 6px; min-width: 0;
  font-size: 12px; font-weight: 600;
}
.td-block-r1 svg {
  width: 14px; height: 14px; flex: none;
  fill: none; stroke: currentColor; stroke-width: 1.8;
  stroke-linecap: round; stroke-linejoin: round;
}
.td-block-r1 .td-bn {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0;
}
.td-block-r2 {
  font-size: 11px; color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.td-block.narrow .td-block-r1 .td-bn,
.td-block.narrow .td-block-r2 { display: none; }
.td-block.narrow { padding: 6px; place-items: center; }

.td-now {
  position: absolute;
  top: 18px; bottom: 0;
  width: 3px;
  background: var(--red);
  border-radius: 2px;
  z-index: 1;
  pointer-events: none;
}
.td-tl-lanes { z-index: 2; }
.td-block { z-index: 2; }
.td-now-lab {
  position: absolute;
  top: 0; left: 50%;
  transform: translate(-50%, 0);
  white-space: nowrap;
  font-size: 11px; font-weight: 700;
  color: var(--on-accent);
  background: var(--red);
  padding: 2px 8px;
  border-radius: var(--r-pill);
  font-variant-numeric: tabular-nums;
  z-index: 4;
  pointer-events: none;
}

.td-tl-empty {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  margin-top: 8px;
  font-size: 13px; color: var(--text-muted);
}
.td-tl-list { margin-top: 8px; }
.td-tl-list[hidden] { display: none !important; }
.td-tl-list table {
  width: 100%; border-collapse: collapse; font-size: 13px;
}
.td-tl-list th, .td-tl-list td {
  text-align: left; padding: 8px 6px;
  border-bottom: 1px solid var(--border-soft);
}
.td-tl-list th { color: var(--text-muted); font-weight: 600; font-size: 12px; }
.td-tl-list button.linkish {
  background: none; border: 0; padding: 0; font: inherit;
  color: var(--accent-text); cursor: pointer; text-align: left;
}
.td-tl-list button.linkish:focus-visible { outline: 2px solid var(--accent); }

/* —— Lưới 2 cột —— */
.td-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.62fr) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}
.td-col { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; min-width: 0; }
.td-col-todo { min-width: 0; }
/* Mọi lưới con một cột phải kẹp minmax(0,1fr): tên đề dài (nowrap) không được đẩy cột trái đè cột phải */
.td-col > *, .td-asg-list > *, .td-draft-list > *, .td-todo-list > * { min-width: 0; max-width: 100%; }

/* —— Thẻ bài —— */
.td-asg {
  display: grid; gap: 10px 16px;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  padding: 14px 18px;
  border-radius: var(--r);
  border: 1px solid var(--border);
  background: var(--surface);
  border-left: 4px solid var(--border-strong);
  position: relative;
}
.td-asg.open { border-left-color: var(--green); }
.td-asg.upcoming { border-left-color: var(--amber); }
.td-asg-top {
  grid-column: 1 / -1;
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 10px;
}
.td-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px;
  border-radius: var(--r-pill);
  font-size: 12px; font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.td-pill.open {
  color: var(--green);
  background: color-mix(in srgb, var(--green) 12%, var(--surface));
}
.td-pill.upcoming {
  color: var(--amber);
  background: color-mix(in srgb, var(--amber) 12%, var(--surface));
}
.td-pill.soon { color: var(--amber); }
.td-pill.urgent, .td-pill.over { color: var(--red); }
.td-asg-meta {
  font-size: 12px; color: var(--text-muted);
  text-align: right; white-space: nowrap;
}
.td-asg-body {
  display: flex; align-items: center; gap: 14px; min-width: 0;
}
.td-asg-donut { flex: none; width: 56px; height: 56px; position: relative; display: grid; place-items: center; }
.td-asg-donut svg { grid-area: 1 / 1; }
.td-donut-n { grid-area: 1 / 1; font-size: 15px; font-weight: 700; color: var(--text-strong); font-variant-numeric: tabular-nums; }
.td-asg-donut svg { width: 56px; height: 56px; }
.td-asg-info { min-width: 0; flex: 1; display: grid; grid-template-columns: minmax(0, 1fr); gap: 4px; }
.td-asg-info b {
  font-size: 15px; font-weight: 700; color: var(--text-strong);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.td-asg-info .mute {
  font-size: 13px; color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}
.td-away-warn {
  color: var(--amber); font-weight: 600; font-size: 13px;
}
.td-asg-acts {
  grid-column: 2;
  display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end;
}
.td-asg-list { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
@media (max-width: 767px) {
  .td-asg { grid-template-columns: minmax(0, 1fr); }
  .td-asg-acts { grid-column: 1; }
}
.td-asg-acts .btn-sm { min-height: 36px; }
.td-when-range {
  font-size: 13px; color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

/* —— Cần xử lý —— */
.td-todo-card { padding: 16px 18px; }
.td-todo-count {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 22px; height: 22px; padding: 0 7px;
  border-radius: var(--r-pill);
  background: var(--red); color: var(--on-accent);
  font-size: 12px; font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.td-todo-list { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0; margin-top: 4px; }
.td-todo-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  width: 100%;
  padding: 12px 4px;
  border: 0;
  border-bottom: 1px solid var(--border-soft);
  background: none;
  font: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
  border-radius: var(--r-sm);
}
.td-todo-row:last-child { border-bottom: 0; }
.td-todo-row:hover { background: var(--surface-hover); }
.td-todo-row:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.td-todo-ico {
  width: 36px; height: 36px;
  border-radius: var(--r-sm);
  display: grid; place-items: center;
  flex: none;
}
.td-todo-ico svg {
  width: 18px; height: 18px;
  fill: none; stroke: currentColor; stroke-width: 1.8;
  stroke-linecap: round; stroke-linejoin: round;
}
.td-todo-ico.resume {
  background: color-mix(in srgb, var(--amber) 14%, var(--surface));
  color: var(--amber);
}
.td-todo-ico.essay {
  background: color-mix(in srgb, var(--accent) 14%, var(--surface));
  color: var(--accent-text);
}
.td-todo-ico.scan {
  background: color-mix(in srgb, var(--red) 14%, var(--surface));
  color: var(--red);
}
.td-todo-ico.return {
  background: color-mix(in srgb, var(--green) 14%, var(--surface));
  color: var(--green);
}
.td-todo-main { min-width: 0; display: grid; gap: 2px; }
.td-todo-main b {
  font-size: 14px; font-weight: 600; color: var(--text-strong);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.td-todo-main span {
  font-size: 12px; color: var(--text-muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.td-todo-arrow {
  color: var(--text-faint);
  width: 18px; height: 18px;
  fill: none; stroke: currentColor; stroke-width: 1.8;
  stroke-linecap: round; stroke-linejoin: round;
}
.td-todo-empty {
  display: flex; align-items: center; gap: 10px;
  padding: 16px 4px;
  color: var(--text-muted); font-size: 14px;
}
.td-todo-empty .ok-ico {
  width: 36px; height: 36px;
  border-radius: var(--r-sm);
  display: grid; place-items: center;
  background: color-mix(in srgb, var(--green) 14%, var(--surface));
  color: var(--green);
}
.td-todo-empty .ok-ico svg {
  width: 18px; height: 18px;
  fill: none; stroke: currentColor; stroke-width: 1.8;
  stroke-linecap: round; stroke-linejoin: round;
}

/* —— Đề gần đây —— */
.td-draft-list { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0; }
.td-draft-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-soft);
}
.td-draft-row:last-child { border-bottom: 0; padding-bottom: 0; }
.td-draft-row:first-child { padding-top: 0; }
.td-draft-ico {
  width: 36px; height: 36px; min-width: 0; flex: none;
  border-radius: var(--r-sm);
  display: grid; place-items: center;
}
.td-draft-ico svg {
  width: 18px; height: 18px;
  fill: none; stroke: currentColor; stroke-width: 1.8;
  stroke-linecap: round; stroke-linejoin: round;
}
.td-draft-ico.exam {
  background: color-mix(in srgb, var(--accent) 14%, var(--surface));
  color: var(--accent-text);
}
.td-draft-ico.mtx {
  background: color-mix(in srgb, var(--accent) 8%, color-mix(in srgb, var(--red) 8%, var(--surface)));
  color: color-mix(in srgb, var(--accent) 55%, var(--red));
}
.td-draft-main { min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 2px; }
.td-draft-main b {
  font-size: 14px; font-weight: 600; color: var(--text-strong);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.td-draft-main span {
  font-size: 12px; color: var(--text-muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* —— Skeleton —— */
.td-skel { display: grid; gap: 16px; }
.td-skel-head,
.td-skel-tl,
.td-skel-card {
  border-radius: var(--r);
  border: 1px solid var(--border-soft);
  background: linear-gradient(90deg, var(--surface-2), var(--surface-hover), var(--surface-2));
  background-size: 200% 100%;
  animation: td-shimmer 1.2s ease-in-out infinite;
}
.td-skel-head { height: 64px; }
.td-skel-tl { height: 128px; }
.td-skel-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.62fr) minmax(0, 1fr);
  gap: 16px;
}
.td-skel-card { height: 108px; }
@keyframes td-shimmer {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}
@media (prefers-reduced-motion: reduce) {
  .td-skel-head, .td-skel-tl, .td-skel-card { animation: none; }
  .td-block { transition: none; }
}

/* —— Trống giáo viên mới —— */
.td-welcome {
  display: grid; gap: 8px; place-items: center;
  text-align: center; padding: 32px 20px;
}
.td-welcome b { font-size: 16px; color: var(--text-strong); }
.td-welcome span { font-size: 14px; color: var(--text-muted); max-width: 36ch; }

/* Mobile / tablet: 1 cột — chào → todo → thẻ → TL → đề */
@media (max-width: 1023px) {
  .td-grid {
    display: flex;
    flex-direction: column;
    gap: 16px;
  }
  .td-col-main { order: 2; }
  .td-col-todo { order: 1; }
  .td-tl-wrap { order: 3; }
  .td-drafts-wrap { order: 4; }
  .td-skel-grid { grid-template-columns: 1fr; }
  .td-tl { min-width: 560px; }
}
@media (max-width: 767px) {
  .td-tl-card { padding: 14px 14px 16px; }
  .td-asg { padding: 14px; }
  .td-asg-acts .btn-sm {
    flex: 1 1 auto; min-height: 44px; justify-content: center;
  }
  .td-greet-copy h2 { white-space: normal; }
  .td-head-act { width: 100%; }
  .td-head-act .btn-primary { width: 100%; min-height: 44px; justify-content: center; }
}
