/* ==========================================================================
   PNLE-REVIEW — Tasks page
   Type chips, task table, calendar, Today's Goal, quote banner and the
   add/edit dialog. Calendar + tags come from components.css.
   ========================================================================== */

/* Fit-to-screen rows: top bar · filters · main · banner */
.main--tasks { --fit-rows: auto auto 1fr auto; }

/* ============================== Filters ============================== */
.tk-filters {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 4px;
}
.tk-filters .chips { margin-bottom: 0; }
.tk-filters .chip { display: inline-flex; align-items: center; gap: 6px; }
.tk-filters .chip:not(.is-active) { background: var(--card-solid); border-color: var(--card-border); }
.chip .icon { width: 13px; height: 13px; }
.chip__count {
  min-width: 18px;
  padding: 0 5px;
  font-size: 9.5px;
  font-weight: 600;
  line-height: 16px;
  text-align: center;
  color: var(--text-2);
  background: var(--subtle-2);
  border-radius: 999px;
}
.chip.is-active .chip__count { color: var(--primary-600); background: #fff; }
.tk-filters .btn .icon { width: 14px; height: 14px; }

/* ============================== Grid ============================== */
.tk-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.66fr) minmax(270px, 1fr);
  gap: 14px;
  min-height: 0;
}
.tk-side { display: grid; grid-template-rows: auto 1fr; gap: 14px; min-height: 0; }

/* ============================== Task table ============================== */
.tk-list { display: flex; flex-direction: column; padding: 14px 16px 10px; }
.tk-list .card__head { margin-bottom: 10px; }
.tk-list .card__title { font-size: 14px; }
.date-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: 6px;
  padding: 2px 8px;
  font-size: 10.5px;
  font-weight: 500;
  color: var(--primary-600);
  background: var(--primary-soft);
  border-radius: 999px;
}
.date-pill .icon { width: 11px; height: 11px; color: currentColor !important; }
.tk-toggle { display: inline-flex; align-items: center; gap: 7px; font-size: 11px; color: var(--text-2); cursor: pointer; }
.tk-toggle input { accent-color: var(--primary); }

.tk-table { width: 100%; border-collapse: collapse; font-size: 11.5px; }
.tk-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 0;
  text-align: left;
  font-weight: 500;
  background: var(--subtle);
}
.tk-table th:first-child { border-radius: 8px 0 0 8px; }
.tk-table th:last-child { border-radius: 0 8px 8px 0; }
.tk-table th button,
.tk-table th.tk-table__check {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  width: 100%;
  padding: 8px 10px;
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
}
.tk-table th .icon { width: 12px; height: 12px; }
.tk-table th button .icon { opacity: 0.45; transition: transform 0.15s ease; }
.tk-table th button:hover,
.tk-table th button.is-sorted { color: var(--text); }
.tk-table th button.is-sorted .icon { opacity: 1; color: var(--primary); }
.tk-table th button.is-asc .icon { transform: rotate(180deg); }

.tk-table td {
  padding: 9px 10px;
  color: var(--text);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.tk-table tbody tr:last-child td { border-bottom: 0; }
.tk-table tbody tr:hover td { background: var(--primary-softer); }
.tk-table__check { width: 36px; text-align: center; }
.tk-table__check .checkbox { margin: 0 auto; }
.tk-table__actions { width: 1%; }
.tk-table__actions .icon-btn { width: 26px; height: 26px; }
.tk-table__actions .icon { width: 14px; height: 14px; }

.tk-table__title { position: relative; width: 40%; max-width: 0; padding-left: 16px !important; }
.tk-table__title::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 4px;
  width: 3px;
  height: 20px;
  margin-top: -10px;
  border-radius: 2px;
}
.tk-row--study .tk-table__title::before { background: var(--teal); }
.tk-row--review .tk-table__title::before { background: var(--purple); }
.tk-row--exam .tk-table__title::before { background: var(--orange); }
.tk-row--assignment .tk-table__title::before { background: var(--blue); }
.tk-row--deadline .tk-table__title::before { background: var(--pink); }
.tk-title {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: left;
  font-size: 11.5px;
  color: var(--text);
}
.tk-title:hover { color: var(--primary-600); }
.tk-row.is-done td { color: var(--muted); }
.tk-row.is-done .tk-title { color: var(--muted); text-decoration: line-through; }

.tk-table__due { color: var(--text-2) !important; }
.tk-table__due.is-overdue { color: var(--pink) !important; }
.tk-table__due .icon { width: 12px; height: 12px; margin-right: 4px; vertical-align: -2px; }
.today-tag {
  margin-left: 4px;
  padding: 1px 6px;
  font-size: 9px;
  font-weight: 600;
  color: var(--primary-600);
  background: var(--primary-soft);
  border-radius: 4px;
}

.prio {
  display: inline-block;
  padding: 3px 11px;
  font-size: 10px;
  font-weight: 600;
  border-radius: 999px;
}
.prio--high { color: var(--pink); background: var(--tone-pink); }
.prio--medium { color: #c4741a; background: var(--tint-peach); }
.prio--low { color: var(--text-2); background: var(--subtle-2); }

.status {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-width: 86px;
  justify-content: center;
  padding: 4px 10px;
  font-size: 10.5px;
  font-weight: 500;
  border-radius: 7px;
  transition: box-shadow 0.15s ease;
}
.status:hover { box-shadow: 0 0 0 1.5px var(--primary); }
.status .icon { width: 12px; height: 12px; }
.status--todo { color: var(--text-2); background: var(--subtle-2); }
.status--progress { color: var(--primary-600); background: var(--tone-blue); }
.status--done { color: #24835b; background: var(--tone-green); }

.tk-table__empty { padding: 36px 0 !important; text-align: center; color: var(--muted) !important; white-space: normal !important; }
.tk-table__empty .icon { display: block; width: 24px; height: 24px; margin: 0 auto 8px; color: var(--orange); }

/* ============================== Calendar + goal ============================== */
.tk-calendar { padding: 16px 16px 12px; }

.goal { display: flex; flex-direction: column; padding: 14px 16px 14px; }
.goal .card__title { font-size: 14px; }
.goal__sparkle { width: 18px; height: 18px; color: var(--primary); }
.goal__text { font-size: 13px; font-weight: 500; line-height: 1.55; color: var(--text); }
.goal__progress { display: flex; align-items: center; gap: 12px; margin-top: 14px; }
.goal__progress .bar { flex: 1; height: 9px; }
.goal__progress .bar__fill { transition: width 0.4s ease; }
.goal__progress span { font-size: 12px; font-weight: 600; color: var(--text-2); }
.goal__steps { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; padding-right: 50px; }
.goal__steps label { display: flex; align-items: center; gap: 9px; font-size: 11.5px; color: var(--text-2); cursor: pointer; }
.goal__steps label.is-done { color: var(--muted); text-decoration: line-through; }
.goal__flower { position: absolute; right: -10px; bottom: -8px; width: 76px; transform: rotate(-35deg); pointer-events: none; }

/* ============================== Banner ============================== */
.tk-banner {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 66px;
  padding: 10px 120px;
  overflow: hidden;
  text-align: center;
  background: linear-gradient(90deg, var(--tint-blue), var(--card) 50%, var(--tint-purple));
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}
.tk-banner p { font-size: 13px; color: var(--text-2); }
.tk-banner .note-heart { display: inline-block; vertical-align: middle; margin-left: 4px; }
.tk-banner__flowers { position: absolute; pointer-events: none; }
.tk-banner__flowers--left { left: 6px; bottom: -14px; width: 120px; }
.tk-banner__flowers--right { right: 0; bottom: -10px; width: 90px; transform: scaleX(-1) rotate(-10deg); }

/* ============================== Dialog ============================== */
.modal--task { width: min(500px, calc(100vw - 32px)); }
.task-form { display: flex; flex-direction: column; gap: 14px; }
.task-form .modal__actions { margin-top: 6px; }
.task-form__spacer { flex: 1; }
.task-form__delete { color: var(--red) !important; }
.task-form .btn .icon { width: 14px; height: 14px; }

/* ============================== Breakpoints ============================== */
@media (max-width: 1024px) {
  .tk-grid { grid-template-columns: minmax(0, 1fr); }
  .tk-side { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-rows: none; }
  .tk-filters { flex-wrap: wrap; }
}
@media (max-width: 720px) {
  .tk-side { grid-template-columns: minmax(0, 1fr); }
  .tk-table th:nth-child(3), .tk-table td:nth-child(3),
  .tk-table th:nth-child(5), .tk-table td:nth-child(5) { display: none; }
  .tk-banner { padding: 12px 16px 50px; }
  .form-row { grid-template-columns: minmax(0, 1fr); }
}

/* Today's goal: progress counted from today's activity */
.goal-auto {
  margin-left: 6px;
  padding: 1px 7px;
  font-size: 10px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--primary-600);
  background: var(--primary-soft);
  border-radius: 999px;
}

/* Select & delete */
.tk-head-tools { display: flex; align-items: center; gap: 12px; }
.goal .card__head .btn--select { position: relative; z-index: 1; }
.goal__pick { display: flex; align-items: center; gap: 8px; padding: 3px 6px; font-size: 11.5px; color: var(--text-2); border-radius: 8px; cursor: pointer; }
.goal__pick:hover { background: var(--primary-softer); }
.goal .select-bar { margin: 12px 50px 0 0; flex-wrap: wrap; gap: 8px; }
.goal__add { position: relative; z-index: 1; display: flex; gap: 8px; margin-top: 12px; padding-right: 50px; }
.goal__add input {
  flex: 1;
  min-width: 0;
  height: 32px;
  padding: 0 10px;
  font: inherit;
  font-size: 11.5px;
  color: var(--text);
  background: var(--card-solid);
  border: 1px solid var(--card-border);
  border-radius: 8px;
  outline: 0;
}
.goal__add input:focus { border-color: var(--primary); box-shadow: var(--focus); }
.goal__add .btn { gap: 5px; height: 32px; padding: 0 12px; font-size: 11.5px; }
.goal__add .btn .icon { width: 13px; height: 13px; }

/* Phones: give the task name room (status shows as the row's colour bar + checkbox) */
@media (max-width: 480px) {
  .tk-list .card__head { flex-wrap: wrap; gap: 8px; }
  .tk-head-tools { width: 100%; justify-content: space-between; }
  .tk-table th:nth-child(6), .tk-table td:nth-child(6) { display: none; }
  .tk-table td, .tk-table th { padding-left: 6px; padding-right: 6px; }
  .tk-table__title { width: auto; white-space: normal; }
  .tk-title { white-space: normal; text-align: left; }
  .goal .select-bar, .goal__steps, .goal__add { margin-right: 0; padding-right: 0; }
}
