/* ==========================================================================
   GELEX HUB — Today (enterprise) — redesign cân đối + week-strip chọn ngày
   Layout: head / week-strip / [main | side] / banner.
   Override today.css (Concept 4) — load SAU today.css.
   ========================================================================== */

/* Shell enterprise: grid cân đối */
.today-shell {
  max-width: var(--content-max);
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  grid-template-areas:
    "head   head"
    "week   week"
    "main   side"
    "banner banner";
  gap: 16px;
  padding: var(--content-pad-y) var(--content-pad-x) 120px;
  align-items: start;
}
@media (max-width: 960px) {
  .today-shell {
    grid-template-columns: 1fr;
    grid-template-areas: "head" "week" "main" "side" "banner";
  }
}

/* ---------- Header gọn enterprise ---------- */
.today-hero {
  grid-area: head;
  padding: 0;
  background: transparent;
  border: none;
  box-shadow: none;
  overflow: visible;
}
.th-greet { font-size: 22px; font-weight: 700; color: var(--text); letter-spacing: -0.01em; line-height: 1.2; }
.th-sub { font-size: 13px; color: var(--text-3); margin-top: 3px; }
.th-meta {
  margin-top: 10px;
  display: flex; flex-wrap: wrap; align-items: center; gap: 14px;
  font-size: 12.5px; color: var(--text-2);
}
.th-meta b { font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }
.th-meta .sep { width: 3px; height: 3px; border-radius: 50%; background: var(--text-3); opacity: 0.5; }
.th-meta .th-streak { color: #d97706; font-weight: 600; }
.th-meta .is-danger { color: var(--danger); font-weight: 600; }

/* Vòng tiến độ ngày (ring) bên phải hero */
.today-hero { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.th-hero-left { display: flex; flex-direction: column; min-width: 0; }
.th-ring { position: relative; flex: none; width: 64px; height: 64px; }
.th-ring-num {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 12.5px; font-weight: 700; color: var(--text);
  font-variant-numeric: tabular-nums;
}

/* Bloc "Nên làm trước" — gợi ý ưu tiên tự động */
.td-section-focus .td-section-head .td-section-label { color: var(--brand); }
.td-section-focus .td-section-head .td-section-icon { color: var(--brand); }
.td-section-focus .td-section-count { background: var(--brand-soft); color: var(--brand-dark); }
.dt-focus-reason {
  flex: none;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand-dark);
  white-space: nowrap;
}
.dt-task.is-overdue .dt-focus-reason { background: #fef2f2; color: var(--danger); }
@media (max-width: 720px) {
  .th-ring { width: 52px; height: 52px; }
  .th-ring svg { width: 52px; height: 52px; }
}

/* Ẩn week-peek CŨ (dùng week-strip mới bên dưới) */
.week-peek { display: none; }

/* ---------- Week-strip: 7 ngày chọn được (T2→CN) ---------- */
.today-weekstrip {
  grid-area: week;
  display: flex;
  gap: 6px;
  padding: 8px;
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
}
.ws-day {
  flex: 1;
  min-width: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 2px;
  padding: 8px 4px 7px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  cursor: pointer;
  transition: background var(--ease) 120ms, border-color var(--ease) 120ms;
  font: inherit;
}
.ws-day:hover { background: var(--surface-sunken); }
.ws-day-dow {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.02em;
}
.ws-day-num {
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.ws-day-count {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-3);
  min-height: 13px;
  display: flex; align-items: center;
}
.ws-day.is-today {
  background: var(--brand-soft);
  border-color: var(--brand-border);
}
.ws-day.is-today .ws-day-dow { color: var(--brand); }
.ws-day.is-today .ws-day-num { color: var(--brand); }
.ws-day.is-selected {
  background: var(--brand);
  border-color: var(--brand);
}
.ws-day.is-selected .ws-day-dow,
.ws-day.is-selected .ws-day-num,
.ws-day.is-selected .ws-day-count { color: #fff; }
.ws-day.has-tasks .ws-day-count { color: var(--text-2); }
.ws-day.has-tasks .ws-day-num::after {
  content: ""; display: inline-block;
  width: 4px; height: 4px; border-radius: 50%;
  background: var(--brand);
  margin-left: 4px; vertical-align: middle;
}
.ws-day.is-selected.has-tasks .ws-day-num::after { background: #fff; }
.ws-day.is-future .ws-day-num { color: var(--text-3); }
.ws-day.has-overdue .ws-day-count { color: var(--danger); }

/* ---------- Card đóng góp (trong cột side) ---------- */
.today-side {
  grid-area: side;
  display: flex; flex-direction: column;
  gap: 14px;
  min-width: 0;
}
.today-contrib {
  padding: 16px 18px 14px;
  border-radius: var(--radius);
  background: var(--surface-raised);
  border: 1px solid var(--border);
  color: var(--text);
  box-shadow: var(--shadow-card);
  overflow: visible;
}
.today-contrib::before { display: none; }
.tc-contrib-label { color: var(--text-3); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.tc-contrib-num { color: var(--brand); font-size: 30px; font-weight: 700; margin-top: 4px; line-height: 1.1; }
.tc-contrib-num small { color: var(--text-2); font-size: 13px; font-weight: 500; }
.tc-contrib-sub { color: var(--text-2); font-size: 12px; margin-top: 2px; }
.tc-contrib-note { color: var(--text-3); font-size: 11px; line-height: 1.5; margin-top: 8px; }
.tc-contrib-link {
  display: flex; align-items: center; gap: 4px;
  color: var(--brand);
  border-top: 1px solid var(--border);
  margin-top: 10px; padding-top: 10px;
  font-size: 12.5px; font-weight: 500;
  text-decoration: none;
}
.tc-contrib-link:hover { color: var(--brand-dark); }
.tc-contrib-link svg { width: 13px; height: 13px; color: var(--brand); }

/* ---------- Main list ---------- */
.today-main { grid-area: main; min-width: 0; display: flex; flex-direction: column; gap: 14px; }

/* Day header (title + progress) */
.td-day-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.td-day-title { display: flex; align-items: baseline; gap: 6px; }
.td-day-title h2 { font-size: 18px; font-weight: 700; color: var(--text); margin: 0; }
.td-day-date { font-size: 13px; color: var(--text-3); font-weight: 500; }
.td-day-progress {
  display: flex; align-items: center; gap: 8px;
  font-size: 11.5px;
}
.td-day-progress-label { color: var(--text-2); font-weight: 500; min-width: 50px; }
.td-day-progress-track {
  flex: none; width: 100px; height: 6px;
  background: var(--border); border-radius: 999px; overflow: hidden;
}
.td-day-progress-fill { display: block; height: 100%; background: var(--brand); border-radius: 999px; transition: width var(--ease) 250ms; }
.td-day-progress-pct { color: var(--text); font-weight: 700; font-variant-numeric: tabular-nums; min-width: 30px; text-align: right; }

/* Section groups */
.td-groups { display: flex; flex-direction: column; gap: 16px; }
.td-section { display: flex; flex-direction: column; gap: 4px; }
.td-section-head {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 2px 6px;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.td-section-icon { font-size: 13px; line-height: 1; }
.td-section-label { color: var(--text-2); }
.td-section-count {
  background: var(--surface-sunken); color: var(--text-3);
  padding: 1px 7px; border-radius: 999px;
  font-size: 10.5px; font-weight: 700; letter-spacing: 0;
}
.td-section-danger .td-section-label { color: var(--danger); }
.td-section-danger .td-section-icon { color: var(--danger); }
.td-section-danger .td-section-count { background: #fef2f2; color: var(--danger); }
.td-section-accent .td-section-label { color: var(--brand); }
.td-section-accent .td-section-icon { color: var(--brand); }
.td-section-accent .td-section-count { background: var(--brand-soft); color: var(--brand-dark); }
.td-section-muted .td-section-head { opacity: 0.6; }

/* Section list container (card) */
.td-section-list {
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

/* Empty state */
.td-empty {
  padding: 32px 16px;
  text-align: center;
  color: var(--text-3);
  font-size: 13px;
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.td-empty .emoji { font-size: 24px; display: block; margin-bottom: 6px; opacity: 0.6; }

/* ---------- Quick apps (sidebar phải) ---------- */
.td-quick-apps { display: flex; flex-direction: column; gap: 10px; }
.td-app-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}
.dock-item {
  aspect-ratio: 1;
  border-radius: 28%;          /* squircle mềm */
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  text-decoration: none;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.12), 0 1px 1px rgba(15, 23, 42, 0.06);
  transition: transform var(--ease) 140ms, box-shadow var(--ease) 140ms;
}
.dock-item svg { width: 44%; height: 44%; }
.dock-item:hover {
  transform: translateY(-2px) scale(1.05);
  box-shadow: 0 4px 10px rgba(15, 23, 42, 0.18);
}
.dock-item:active { transform: scale(0.96); }
/* Nhãn tên ứng dụng khi rê chuột.
   Thuộc tính title của trình duyệt trễ khoảng một giây mới hiện, nhìn lướt
   không kịp biết là ứng dụng gì — nhất là khi icon chỉ khác nhau ở màu.
   Tên thật dài tới 25 ký tự ("Ghi Nhận Công Việc - VHDN") nên nhãn cố định
   dưới icon ở lưới 4 cột sẽ bị cắt cụt vô dụng; vì vậy dùng nhãn nổi. */
.td-app { position: relative; }
.td-app-name {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  max-width: 150px;
  padding: 5px 8px;
  border-radius: 6px;
  background: var(--text);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.3;
  text-align: center;
  /* Cho xuống dòng thay vì kéo dài một hàng: hàng dài tràn ra ngoài mép phải
     màn hình sẽ bị cắt mất chữ. */
  white-space: normal;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--ease) 120ms;
}
/* Cột đầu và cột cuối neo theo mép thay vì căn giữa — căn giữa ở cột ngoài
   cùng đẩy nhãn ra khỏi vùng nhìn thấy. */
.td-app-grid .td-app:nth-child(4n + 1) .td-app-name { left: 0; transform: none; text-align: left; }
.td-app-grid .td-app:nth-child(4n) .td-app-name { left: auto; right: 0; transform: none; text-align: right; }
.td-app:hover .td-app-name,
.td-app:focus-visible .td-app-name { opacity: 1; }
/* Thiết bị cảm ứng KHÔNG có rê chuột: hiện thẳng tên dưới icon để người dùng
   điện thoại/máy tính bảng không mù thông tin y như trước. */
@media (hover: none) {
  .td-app-grid { row-gap: 22px; }
  .td-app-name {
    position: absolute;
    top: calc(100% + 3px);
    bottom: auto;
    left: 0; right: 0;
    transform: none;
    max-width: none;
    padding: 0;
    background: none;
    color: var(--text-3);
    font-size: 9.5px;
    font-weight: 600;
    text-align: center;
    opacity: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
}

.td-app-more {
  width: 100%;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-sunken);
  color: var(--text-3);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--ease) 120ms, color var(--ease) 120ms;
}
.td-app-more:hover { background: var(--brand-soft); color: var(--brand-dark); border-color: var(--brand-border); }

.today-card {
  padding: 16px 18px;
  border-radius: var(--radius);
  background: var(--surface-raised);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-card);
}
.tc-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin-bottom: 4px;
}
.tc-head h2 { font-size: 15px; font-weight: 700; color: var(--text); display: flex; align-items: baseline; gap: 6px; }
.tc-head .tc-date { font-size: 12px; color: var(--text-3); font-weight: 500; }
.tc-count {
  background: var(--surface-sunken);
  color: var(--text-2);
  font-size: 11px; font-weight: 600;
  padding: 2px 8px; border-radius: 999px;
}
.tc-overdue {
  background: #fef2f2; color: var(--danger);
  border-radius: var(--radius-xs);
  font-size: 12px; font-weight: 500;
  padding: 7px 10px; margin: 8px 0;
  display: flex; align-items: center; gap: 6px;
}
.tc-day-progress {
  display: flex; align-items: center; gap: 8px;
  margin: 10px 0 4px;
  font-size: 11.5px;
}
.tc-day-progress-label { color: var(--text-2); font-weight: 500; min-width: 60px; }
.tc-day-progress-track {
  flex: 1; height: 5px;
  background: var(--border);
  border-radius: 999px; overflow: hidden;
}
.tc-day-progress-fill { display: block; height: 100%; background: var(--brand); border-radius: 999px; transition: width var(--ease) 250ms; }
.tc-day-progress-pct { color: var(--text); font-weight: 700; font-variant-numeric: tabular-nums; min-width: 32px; text-align: right; }

.tc-section-head {
  display: flex; align-items: center; gap: 6px;
  color: var(--text-3);
  font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.04em;
  margin: 14px 0 6px;
}
.tc-section-head .tc-section-badge {
  background: #fef2f2; color: var(--danger);
  padding: 1px 7px; border-radius: 999px;
  font-size: 10.5px; letter-spacing: 0;
}
.tc-section-head .tc-section-badge.muted {
  background: var(--surface-sunken); color: var(--text-3);
}

/* Task row trong today → enterprise */
.dt-task {
  display: flex; align-items: center; gap: 10px;
  height: 38px;
  padding: 0 8px;
  border-radius: var(--radius-xs);
  border: none;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0;
  cursor: pointer;
  transition: background var(--ease) 100ms;
}
.tc-list > .dt-task:last-child { border-bottom: none; }
.dt-task:hover { background: var(--surface-sunken); }
.dt-check {
  width: 16px; height: 16px;
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius-xs);
  background: transparent;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex: none;
  transition: background var(--ease) 120ms, border-color var(--ease) 120ms;
}
.dt-check:hover { border-color: var(--brand); }
.dt-task.is-done .dt-check { background: var(--brand); border-color: var(--brand); }
.dt-check svg { width: 11px; height: 11px; color: #fff; }
.dt-prio { width: 7px; height: 7px; border-radius: 50%; flex: none; }
.dt-title {
  flex: 1; min-width: 0;
  font-size: 13px; color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.dt-task.is-done .dt-title { text-decoration: line-through; color: var(--text-3); }
.dt-task.is-overdue { background: #fef2f2; }
.dt-task.is-overdue .dt-title { color: var(--danger); }
.dt-task.is-overdue:hover { background: #fee2e2; }
.dt-due { font-size: 11px; color: var(--text-3); flex: none; font-variant-numeric: tabular-nums; }
.dt-task.is-overdue .dt-due { color: var(--danger); font-weight: 600; }

.tc-empty {
  padding: 24px 12px; text-align: center;
  color: var(--text-3); font-size: 13px;
}
.tc-empty .emoji { font-size: 24px; display: block; margin-bottom: 6px; opacity: 0.6; }

/* ---------- Recognition list (side card) ---------- */
.today-card.mini { padding: 14px 16px; }
.recog-list { display: flex; flex-direction: column; }
.recog-row {
  display: flex; align-items: center; gap: 9px;
  padding: 7px 2px;
  border-bottom: 1px solid var(--border);
}
.recog-row:last-child { border-bottom: none; }
.recog-avatar {
  width: 26px; height: 26px;
  border-radius: 50%;
  background: linear-gradient(145deg, var(--brand), var(--brand-dark));
  color: #fff;
  font-size: 11px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex: none;
}
.recog-body { flex: 1; min-width: 0; font-size: 12.5px; color: var(--text); }
.recog-body b { font-weight: 600; }
.recog-meta { font-size: 11px; color: var(--text-3); margin-top: 1px; }
.recog-points {
  color: var(--brand); font-weight: 700; font-size: 13px;
  font-variant-numeric: tabular-nums; flex: none;
}
.recog-empty { padding: 16px 4px; color: var(--text-3); font-size: 12.5px; text-align: center; }

/* ---------- Banner Y Tưởng ---------- */
.today-banner-area { grid-area: banner; }
.today-ytuong-banner {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px;
  border-radius: var(--radius);
  background: var(--surface-raised);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-card);
  text-decoration: none;
  color: var(--text);
  transition: border-color var(--ease) 120ms, box-shadow var(--ease) 120ms;
}
.today-ytuong-banner:hover { border-color: var(--brand-border); box-shadow: var(--shadow-card-hover); }
.today-ytuong-banner .yt-icon {
  width: 32px; height: 32px;
  background: var(--brand-soft); color: var(--brand);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; font-weight: 700;
  flex: none;
}
.today-ytuong-banner .yt-text { flex: 1; min-width: 0; }
.today-ytuong-banner .yt-text b { font-size: 13px; font-weight: 600; color: var(--text); display: block; }
.today-ytuong-banner .yt-text small { font-size: 11.5px; color: var(--text-3); }
.today-ytuong-arrow { color: var(--text-3); font-size: 16px; flex: none; }

/* ---------- Onboarding enterprise ---------- */
.today-onboard {
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
}
.onboard-btn { border-radius: var(--radius-sm); }

/* ---------- Mobile ---------- */
@media (max-width: 720px) {
  .today-shell { padding: 14px 14px 110px; gap: 12px; }
  .th-greet { font-size: 19px; }
  .today-weekstrip { gap: 4px; padding: 6px; overflow-x: auto; }
  .ws-day { min-width: 48px; padding: 6px 2px 5px; }
  .ws-day-num { font-size: 15px; }
  .ws-day-dow { font-size: 9.5px; }
}

/* "Xem tất cả … ở Công việc" — hiện khi nhóm bị cắt bớt. Trước đây danh sách
   cắt còn 6 dòng mà số đếm vẫn ghi 6, nên phần việc còn lại biến mất không dấu
   vết và không có đường nào đi tới màn Công việc. */
.td-section-more {
  display: block;
  width: 100%;
  margin-top: 4px;
  padding: 7px 10px;
  border: 1px dashed var(--border, #e2e8f0);
  border-radius: 8px;
  background: none;
  color: var(--muted, #64748b);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.td-section-more:hover {
  border-color: var(--brand, #d8232a);
  border-style: solid;
  color: var(--brand, #d8232a);
  background: var(--surface-2, #f8fafc);
}
