/* Topvisor-style project list and position matrix, dark palette. */

.page--flush { padding: 0; }
.surface--flush { padding: 0; overflow: hidden; }

.project-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.tv-search { position: relative; min-width: 230px; max-width: 280px; flex: 0 1 auto; }
.tv-search::before {
  position: absolute; z-index: 1; top: 9px; left: 11px;
  color: var(--text-3); content: "\2315"; font-size: 18px;
}
.tv-search input {
  height: 38px; padding-left: 34px; border-radius: 8px;
  background: var(--surface-2); font-size: 15px;
}
.tv-search--sm { max-width: 320px; flex: 1 1 240px; }

.tv-select {
  height: 38px; min-width: 150px; max-width: 220px; padding: 0 11px;
  border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface-2); color: var(--text); font-size: 15px;
}

.tv-toggle { position: relative; display: inline-flex; flex: none; cursor: pointer; }
/* Kept in the accessibility tree but clipped: an unconstrained absolutely
   positioned checkbox stretches to the containing block and widens the page. */
.tv-toggle input {
  position: absolute; inset: 0; width: 100%; height: 100%;
  margin: 0; opacity: 0; cursor: pointer;
}
.tv-toggle-track {
  display: inline-flex; width: 34px; height: 19px; align-items: center;
  padding: 2px; border-radius: 999px; background: #2a3646;
  transition: background var(--ease);
}
.tv-toggle-track i {
  width: 15px; height: 15px; border-radius: 50%; background: #7d8ea3;
  transition: transform var(--ease), background var(--ease);
}
.tv-toggle input:checked + .tv-toggle-track { background: var(--primary-soft); }
.tv-toggle input:checked + .tv-toggle-track i { background: var(--primary); transform: translateX(15px); }

/* Project rows */

.tv-table { border-collapse: collapse; }
.tv-table thead th {
  padding: 13px 10px; border-bottom: 1px solid var(--border);
  background: #0f151d; color: var(--text-2); font-size: 15px;
  font-weight: 600; text-align: center; vertical-align: middle;
}
.tv-table thead th.tv-cell-project { text-align: left; }

.tv-head-check {
  display: inline-flex; align-items: center; gap: 10px;
  color: var(--text-2); cursor: pointer; font-size: 15px;
}

.tv-row td {
  padding: 14px 10px; border-bottom: 1px solid var(--border-soft);
  background: var(--surface); text-align: center; vertical-align: middle;
}
.tv-row:hover td { background: var(--surface-2); }

.tv-row .tv-cell-project {
  position: relative; min-width: 330px; padding-left: 18px; text-align: left;
}

/* Folder accent stripe, matching the coloured bar in the reference. */
.tv-row .tv-cell-project::before {
  position: absolute; top: 8px; bottom: 8px; left: 6px; width: 3px;
  border-radius: 2px; background: var(--primary); content: "";
}
.tv-row--green .tv-cell-project::before { background: var(--success); }
.tv-row--orange .tv-cell-project::before { background: var(--warning); }
.tv-row--purple .tv-cell-project::before { background: var(--purple); }
.tv-row--red .tv-cell-project::before { background: var(--danger); }
.tv-row--teal .tv-cell-project::before { background: var(--info); }

.tv-project { display: flex; min-width: 0; flex-direction: column; gap: 4px; }
.tv-project-head { display: flex; min-width: 0; align-items: center; gap: 8px; }
.tv-folder { color: var(--warning); font-size: 17px; }

.tv-project-name {
  overflow: hidden; max-width: 300px; padding: 0; border: 0;
  background: transparent; color: var(--text); cursor: pointer;
  font: inherit; font-size: 17.5px; font-weight: 650;
  text-overflow: ellipsis; white-space: nowrap;
}
.tv-project-name:hover { color: var(--primary); }

.tv-dots {
  padding: 0 4px; border: 0; background: transparent; color: var(--text-3);
  cursor: pointer; font-size: 17px; opacity: 0; transition: opacity var(--ease);
}
.tv-row:hover .tv-dots { opacity: 1; }

.tv-project-url { display: flex; min-width: 0; align-items: center; gap: 6px; }

.tv-star {
  padding: 0; border: 0; background: transparent; color: #4a5a6e;
  cursor: pointer; font-size: 18px; line-height: 1;
  transition: color var(--ease), transform var(--ease);
}
.tv-star:hover { transform: scale(1.18); }
.tv-star.is-on { color: var(--warning); }

.tv-favicon { border-radius: 3px; flex: none; object-fit: contain; }

.tv-url {
  overflow: hidden; max-width: 280px; color: var(--text-3);
  font-size: 15px; text-overflow: ellipsis; white-space: nowrap;
}

.tv-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 3px; }
.tv-tag {
  padding: 2px 9px; border: 1px solid var(--border); border-radius: 999px;
  color: var(--text-2); font-size: 14px;
}
.tv-tool {
  width: 30px; height: 30px; padding: 0; border: 0; border-radius: 6px;
  background: transparent; color: #6b7d94; cursor: pointer; font-size: 17px;
  line-height: 1; transition: background var(--ease), color var(--ease);
}
.tv-tool:hover { background: var(--primary-soft); color: var(--primary); }

.tv-cell-check { width: 142px; }
.tv-check {
  display: inline-flex; width: 46px; height: 46px; align-items: center;
  justify-content: center; border: 0; border-radius: 50%;
  background: var(--primary); color: #fff; cursor: pointer; font-size: 22px;
  transition: transform var(--ease), background var(--ease);
}
.tv-check:hover { background: var(--primary-strong); transform: rotate(45deg); }
.tv-check.is-running { animation: tv-spin 1.4s linear infinite; }
@keyframes tv-spin { to { transform: rotate(360deg); } }

.tv-cell-check small {
  display: block; margin-top: 6px; color: var(--text-2);
  font-size: 14.5px; line-height: 1.4;
}

.tv-num { width: 112px; color: var(--text); font-size: 22px; font-weight: 600; }
.tv-muted { color: var(--text-3); font-weight: 500; }

.tv-cell-move { width: 210px; }
.tv-move {
  display: inline-flex; min-width: 50px; align-items: center;
  justify-content: center; gap: 5px; font-size: 19px; font-weight: 600;
}
.tv-move i { font-size: 16px; font-style: normal; }
.tv-move--up i { color: var(--success); }
.tv-move--flat i { color: var(--text-3); }
.tv-move--down i { color: var(--danger); }

.tv-cell-tops { width: 234px; }
.tv-top {
  display: inline-flex; min-width: 58px; justify-content: center;
  padding-bottom: 6px; border-bottom: 3px solid transparent;
  font-size: 19px; font-weight: 600;
}
.tv-top--a { border-color: var(--primary); }
.tv-top--b { border-color: var(--success); }
.tv-top--c { border-color: var(--warning); }

/* TOP distribution strip above the matrix */

.tv-strip {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  margin-bottom: 12px; border: 1px solid var(--border);
  border-radius: var(--radius); background: var(--surface); overflow: hidden;
}
.tv-strip-cell { padding: 12px 14px; border-right: 1px solid var(--border-soft); }
.tv-strip-cell:last-child { border-right: 0; }
.tv-strip-label { display: block; color: var(--text-3); font-size: 13px; }
.tv-strip-label small { color: #56657a; }
.tv-strip-cell strong { display: block; margin-top: 3px; font-size: 21px; font-weight: 650; }
.tv-strip-cell--a strong { color: var(--success); }
.tv-strip-cell--b strong { color: var(--primary); }
.tv-strip-cell--c strong { color: var(--warning); }

.tv-panel {
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); overflow: hidden;
}
.tv-panel-bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 9px;
  padding: 10px 12px; border-bottom: 1px solid var(--border); background: #0f151d;
}
.tv-chip-button {
  height: 34px; padding: 0 12px; border: 1px solid var(--border);
  border-radius: 8px; background: var(--surface-2); color: var(--text);
  cursor: pointer; font-size: 14.5px;
}
.tv-chip-button:hover { border-color: var(--primary); color: var(--primary); }

/* Matrix table */

.tv-matrix { min-width: 900px; }
.tv-matrix thead th {
  padding: 9px 8px; border-right: 1px solid var(--border-soft);
  border-bottom: 1px solid var(--border); background: #0f151d;
  color: var(--text-3); font-size: 13px; font-weight: 600; white-space: nowrap;
}
.tv-matrix td {
  height: 44px; padding: 4px 8px; border-right: 1px solid var(--border-soft);
  border-bottom: 1px solid var(--border-soft); text-align: center;
}
.tv-matrix tbody tr:hover td { background: var(--surface-2); }

/* Beats the centred default of `.tv-matrix td`. */
.tv-matrix th.tv-kw-head,
.tv-matrix td.tv-kw-cell { min-width: 320px; max-width: 460px; text-align: left; }

.tv-matrix .sticky-col {
  position: sticky; left: 0; z-index: 4; background: var(--surface);
}
.tv-matrix thead .sticky-col { z-index: 6; background: #0f151d; }
.tv-matrix tbody tr:hover .sticky-col { background: var(--surface-2); }
.tv-kw { display: flex; min-width: 0; align-items: center; gap: 8px; }
.tv-kw-copy { display: flex; min-width: 0; flex: 1; flex-direction: column; }
.tv-kw-copy strong { overflow: hidden; font-size: 14.5px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.tv-kw-copy small { overflow: hidden; color: var(--text-3); font-size: 12.5px; text-overflow: ellipsis; white-space: nowrap; }

.tv-kw-actions { display: flex; gap: 3px; opacity: 0; transition: opacity var(--ease); }
.tv-matrix tbody tr:hover .tv-kw-actions { opacity: 1; }
.tv-kw-action {
  width: 24px; height: 24px; padding: 0; border: 0; border-radius: 6px;
  background: var(--surface-3); color: var(--text-2); cursor: pointer;
  font-size: 13.5px; line-height: 1;
}
.tv-kw-action:hover { background: var(--primary-soft); color: var(--primary); }
.tv-kw-action--danger:hover { background: var(--danger-soft); color: var(--danger); }
.tv-kw-action.is-busy { animation: tv-spin 1s linear infinite; pointer-events: none; }

.tv-date-head strong { display: block; font-size: 13px; }
.tv-date-head small { color: #56657a; font-size: 12px; font-weight: 500; }
.tv-cell-empty { color: #3f4c5e; }
.tv-row-actions, .tv-row-actions-head { width: 40px; }

/* Date range modal */

/* The three month grid can outgrow short viewports, so the card scrolls
   internally and the action panel stays reachable. */
.modal-card--dates {
  display: flex;
  width: min(1080px, 96vw);
  max-width: none;
  max-height: 92vh;
  flex-direction: column;
}
.tv-dates-body {
  display: grid; gap: 18px; grid-template-columns: minmax(0, 1fr) 226px;
  min-height: 0; padding: 20px 24px 24px; overflow-y: auto;
}
.tv-dates-main { min-width: 0; }
.tv-presets {
  display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 14px; padding: 4px;
  border: 1px solid var(--border-soft); border-radius: 9px; background: #0f151d;
}
.tv-preset {
  padding: 7px 13px; border: 0; border-radius: 6px; background: transparent;
  color: var(--text-2); cursor: pointer; font-size: 14px;
}
.tv-preset:hover { color: var(--text); }
.tv-preset.is-active { background: var(--surface-3); color: var(--text); }

.tv-calendar-nav { display: flex; justify-content: space-between; margin-bottom: 4px; }
.tv-calendars { display: grid; gap: 20px; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.tv-month { min-width: 0; }
.tv-month-head { margin-bottom: 8px; color: var(--text); font-size: 14.5px; font-weight: 600; text-align: center; text-transform: capitalize; }
.tv-weekdays, .tv-days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.tv-weekdays span { color: var(--text-3); font-size: 12.5px; text-align: center; }
.tv-day {
  position: relative; height: 30px; border: 0; border-radius: 6px;
  background: transparent; color: var(--text-2); cursor: pointer; font-size: 13.5px;
}
.tv-day:hover { background: var(--surface-3); color: var(--text); }
.tv-day--empty { pointer-events: none; }
.tv-day.is-in-range { background: var(--primary-soft); color: var(--text); }
.tv-day.is-edge { background: var(--primary); color: #fff; font-weight: 650; }
.tv-day-dot {
  position: absolute; bottom: 3px; left: 50%; width: 4px; height: 4px;
  border-radius: 50%; background: var(--info); transform: translateX(-50%);
}
.tv-day.is-edge .tv-day-dot { background: #fff; }

.tv-dates-legend { display: flex; gap: 18px; margin-top: 16px; color: var(--text-3); font-size: 13px; }
.tv-dates-legend span { display: inline-flex; align-items: center; gap: 6px; }
.tv-legend-dot { width: 6px; height: 6px; border-radius: 50%; }
.tv-legend-dot--check { background: var(--info); }
.tv-legend-dot--change { background: var(--danger); }

.tv-dates-side {
  position: sticky; top: 0; align-self: start;
  display: flex; flex-direction: column; gap: 12px;
  padding-left: 18px; border-left: 1px solid var(--border-soft);
}

@media (max-width: 1080px) {
  .tv-dates-body { grid-template-columns: minmax(0, 1fr); }
  .tv-calendars { grid-template-columns: minmax(0, 1fr); }
  .tv-dates-side { padding-left: 0; border-left: 0; }
}

/* Background refreshes reuse the view; replaying the entry fade made the
   screen flash while a run was in progress. */
.no-page-anim .page { animation: none; }

/* Folder / tag / accent controls in the project form */

.tv-accents { display: flex; gap: 8px; }

.tv-accent {
  width: 28px;
  height: 28px;
  border: 2px solid transparent;
  border-radius: 50%;
  cursor: pointer;
  transition: transform var(--ease), border-color var(--ease);
}

.tv-accent:hover { transform: scale(1.12); }
.tv-accent.is-active { border-color: var(--text); }
.tv-accent--blue { background: var(--primary); }
.tv-accent--green { background: var(--success); }
.tv-accent--orange { background: var(--warning); }
.tv-accent--purple { background: var(--purple); }
.tv-accent--red { background: var(--danger); }
.tv-accent--teal { background: var(--info); }

.tv-tag-input {
  display: flex;
  min-height: 44px;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #0e141c;
}

.tv-tag-input:focus-within { border-color: var(--primary); }
.tv-tag-chips { display: contents; }

.tv-tag-input input {
  min-width: 180px;
  min-height: 30px;
  flex: 1;
  padding: 0;
  border: 0;
  background: transparent;
}

.tv-tag-input input:focus { box-shadow: none; outline: none; }

.tv-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 6px 3px 10px;
  border: 1px solid rgba(79, 140, 255, 0.35);
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--text);
  font-size: 13px;
}

.tv-chip button {
  padding: 0 2px;
  border: 0;
  background: transparent;
  color: var(--text-2);
  cursor: pointer;
  font-size: 15px;
  line-height: 1;
}

.tv-chip button:hover { color: var(--danger); }
