/*
 * planner-grid.css — the Planner grid (ROADMAP #53, 2026-10-03; planner-grid.js). Loaded after hud.css, reuses its
 * toolbar, filter, bulk-bar, pill, status-icon and progress-bar styles. The colour rule (2026-10-03): the type's colour
 * only on the Type word, tag colours only on the tag pills, a state colour only on one word (Held, Snoozed, Overdue,
 * Done, Running) — and every colour has a word beside it.
 */

/* In the Planner the grid is everything: the HUD panels (Daily Goals, Task Queue with the Random Task Picker, Later
   today) step aside — the mission is the header's line, the Random Task Picker the line under it. */
body.is-paused .hud-grid { display: none; }
body.is-paused .jump-bar:empty { display: none; }

/* ---- the one-line Random Task Picker in the header ---- */
.site-header-inner { grid-template-areas: "pause top" "pause add" "mission mission" "random random" "jump jump"; }
@media (max-width: 640px) {
  .site-header-inner { grid-template-areas: "pause top" "add add" "mission mission" "random random" "jump jump"; }
}
.hdr-random {
  grid-area: random; display: none; align-items: center; gap: 10px; min-width: 0;
  padding: 0 12px; font-size: 0.78rem; color: var(--muted); white-space: nowrap; overflow: hidden;
}
body.is-paused .hdr-random { display: flex; }
.hr-label { font-size: 0.66rem; text-transform: uppercase; letter-spacing: 0.08em; flex: 0 0 auto; }
a.hr-tpl { color: var(--text); text-decoration: none; flex: 0 1 auto; overflow: hidden; text-overflow: ellipsis; }
a.hr-tpl:hover { text-decoration: underline; text-underline-offset: 3px; }
.hr-pools { display: flex; gap: 12px; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.hr-pool { display: inline-flex; align-items: center; gap: 5px; color: var(--text); }
.hr-pool.is-empty { color: var(--muted); }
.hr-sw { width: 0.7em; height: 0.7em; border-radius: 2px; flex: 0 0 auto; }
.hr-pool.is-empty .hr-sw { opacity: 0.35; }
.hr-break, .hr-full { color: var(--text); }
@media (max-width: 640px) { body.hdr-compact .hdr-random { display: none; } }

/* ---- the grid ---- */
.plg {
  background: var(--panel); border: 1px solid #46242A; border-radius: 12px;
  padding: 14px 16px; margin-bottom: 18px; min-width: 0;
}

/* View pills: several can be on at once; All toggles every view. */
.plg-pills { display: flex; flex-wrap: wrap; gap: 6px; min-width: 0; margin-bottom: 10px; }
.plg-pill {
  display: inline-flex; align-items: center; gap: 6px;
  background: none; border: 1px solid var(--panel-border); color: var(--muted);
  border-radius: 999px; padding: 5px 14px; font-size: 0.82rem; font-family: inherit; cursor: pointer;
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
}
.plg-pill:hover { color: var(--text); }
.plg-pill.on { border-color: var(--accent); color: var(--accent); background: rgba(242, 183, 5, 0.1); }
.plg-pill.on::before { content: "\2713"; font-size: 0.75em; }
.plg-pill-n { font-size: 0.72rem; color: var(--muted); }
.plg-pill.on .plg-pill-n { color: inherit; opacity: 0.8; }
.plg-pill.attention .plg-pill-n { color: var(--text); background: rgba(255, 255, 255, 0.12); border-radius: 999px; padding: 0 6px; }
@media (max-width: 640px) {
  .plg-pills { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .plg-pill { flex: 0 0 auto; }
}

.plg-toolbar .pl-btn .ico { width: 1em; height: 1em; }
.plg-facet-tools { display: inline-flex; align-items: center; gap: 10px; text-transform: none; letter-spacing: 0; }

/* The table. On a wide screen it isn't its own scroller, so the header row can stick under the page header;
   narrower, it scrolls sideways (phone cards come in slice 6). */
.plg-scroll { min-width: 0; }
@media (max-width: 1000px) { .plg-scroll { overflow-x: auto; } }
.plg-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.plg-table th {
  text-align: left; font-weight: 500; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--muted); border-bottom: 1px solid var(--panel-border); padding: 0; white-space: nowrap;
  background: var(--panel);
}
@media (min-width: 1001px) { .plg-table thead th { position: sticky; top: var(--header-h, 0px); z-index: 5; } }
.plg-table th button {
  background: none; border: none; color: inherit; font: inherit; text-transform: inherit; letter-spacing: inherit;
  padding: 8px 10px; cursor: pointer; width: 100%; text-align: left;
}
.plg-table th button:hover { color: var(--text); }
.plg-table th.sorted button { color: var(--accent); }
.plg-table td { padding: 8px 10px; border-bottom: 1px solid var(--panel-border); vertical-align: top; }
.plg-row:hover td { background: rgba(255, 255, 255, 0.025); }
.plg-row.is-quiet .plg-name { color: var(--muted); }

.plg-col-name { min-width: 14em; }
.plg-col-when { min-width: 12em; }
.plg-col-status, .plg-col-section, .plg-col-type, .plg-col-duration, .plg-col-weight, .plg-col-added,
.plg-col-last_done, .plg-col-archived { white-space: nowrap; }
.plg-col-actions { width: 1%; white-space: nowrap; }

.plg-name { font-weight: 500; overflow-wrap: anywhere; }
.plg-sub { font-size: 0.75rem; white-space: nowrap; }
.plg-status { display: inline-flex; align-items: center; gap: 6px; }
.plg-st-word { --sched-color: var(--text); font-size: 0.8rem; }
.plg-st-done { --sched-color: var(--done); }
.plg-st-running { --sched-color: var(--ok); font-weight: 600; }
.plg-st-muted { --sched-color: var(--muted); }
.plg-type { color: var(--sched-color, var(--muted)); font-weight: 500; font-size: 0.8rem; }
.plg-section { color: var(--muted); font-size: 0.8rem; }
.plg-col-when { font-size: 0.8rem; color: var(--muted); }
.plg-col-when .sched-line { font-weight: 500; }
.plg-rule { color: var(--muted); font-size: 0.75rem; }
.plg-reason { color: var(--muted); }
.plg-tags { display: flex; flex-wrap: wrap; gap: 4px; }

/* A Daily Goal's progress in its When cell: a small bar, then the counts. */
.plg-goal { display: inline-flex; align-items: center; gap: 8px; }
.plg-goal .dg-bar { width: 72px; height: 6px; flex: 0 0 auto; }

/* Section dividers ("All tasks · 47"), the Timeline's buckets, the sub-dividers under "In other views", empty notes. */
.plg-div td { padding: 0; border-bottom: 1px solid var(--panel-border); }
.plg-sec td { padding-top: 10px; }
.plg-sec-line { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 14px; padding-right: 6px; }
.plg-sec-btn {
  display: flex; align-items: center; gap: 10px; padding: 8px 6px; background: none; border: none;
  color: var(--text); font: inherit; font-size: 1rem; font-weight: 600; text-align: left; cursor: pointer;
}
.plg-bucket .plg-sec-btn { font-size: 0.8rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); padding-left: 22px; }
.plg-sec-btn .chev {
  width: 0; height: 0; flex-shrink: 0;
  border-left: 6px solid transparent; border-right: 6px solid transparent; border-top: 7px solid var(--muted);
  transition: transform 0.15s ease;
}
.plg-div.collapsed .chev { transform: rotate(-90deg); }
.plg-sec-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.plg-sec-acts { display: inline-flex; gap: 6px; margin-left: auto; }
.pl-btn.plg-sec-act { padding: 3px 10px; font-size: 0.72rem; }
.plg-bucket .pl-btn.plg-sec-act { margin-left: auto; }
.plg-bar { display: inline-flex; align-items: center; gap: 8px; font-size: 0.75rem; color: var(--muted); }
.plg-bar .dg-bar { width: 140px; height: 7px; }
.dg-bar-done { background: var(--type-daily_goal); }
.plg-others td { padding: 16px 6px 6px; font-size: 0.95rem; font-weight: 600; color: var(--accent); border-top: 2px solid var(--panel-border); }
.plg-sub td { padding: 6px 6px 4px 18px; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.plg-empty td { padding: 10px 6px; }

/* Queue rows: a grip to drag (only while the queue shows its real order — no sort, search or filter). */
.plg-grip {
  display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; margin: -2px 6px -2px -4px;
  vertical-align: middle; color: var(--muted); cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none;
}
.plg-grip * { pointer-events: none; }
.plg-qrow.dragging td { background: rgba(242, 183, 5, 0.08); }
.plg-qrow.dragging .plg-grip { cursor: grabbing; color: var(--accent); }

/* Row actions: icon + label when wide, icon only when narrow (the label stays as the tooltip). */
.plg-acts { display: flex; gap: 4px; justify-content: flex-end; }
.plg-act {
  display: inline-flex; align-items: center; gap: 5px; height: 30px; padding: 0 9px;
  background: none; border: 1px solid var(--panel-border); color: var(--muted); border-radius: 6px;
  font-family: inherit; font-size: 0.75rem; cursor: pointer; white-space: nowrap;
}
.plg-act:hover:not(:disabled) { color: var(--text); border-color: #3A4356; }
.plg-act:disabled { opacity: 0.4; cursor: not-allowed; }
.plg-act .ico { width: 1.05em; height: 1.05em; }
.plg-act-done { color: var(--ok); border-color: rgba(73, 192, 140, 0.45); }
.plg-act-done:hover:not(:disabled) { color: var(--ok); border-color: var(--ok); }
.plg-more { padding: 0 7px; }
@media (max-width: 1400px) { .plg-act:not(.plg-act-done) .lbl { display: none; } .plg-act:not(.plg-act-done) { padding: 0 8px; } }
@media (max-width: 1000px) { .plg-act .lbl { display: none; } .plg-act { padding: 0 8px; } }

/* Select mode: the checkbox column. */
.plg-check { width: 1%; padding: 0 4px 0 6px !important; vertical-align: middle !important; }
.plg-table th.plg-check { padding: 8px 4px 8px 10px; }
.plg-check input { width: 1.05rem; height: 1.05rem; accent-color: var(--accent); cursor: pointer; }
td.plg-check { touch-action: none; user-select: none; -webkit-user-select: none; cursor: pointer; }
.plg-cant { color: var(--muted); font-size: 0.72rem; }

/* Floating menus (row ⋯, Columns). */
.plg-menu {
  position: fixed; z-index: 1000; min-width: 190px; max-width: min(92vw, 320px);
  display: flex; flex-direction: column; padding: 4px;
  background: var(--panel); border: 1px solid var(--panel-border); border-radius: 8px;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.5);
}
.plg-menu > button {
  display: flex; align-items: center; gap: 8px; background: none; border: none; color: var(--text);
  text-align: left; padding: 8px 10px; font-size: 0.82rem; font-family: inherit; border-radius: 4px; cursor: pointer;
}
.plg-menu > button:hover, .plg-menu > button:focus-visible { background: rgba(255, 255, 255, 0.06); outline: none; }
.plg-menu > button.danger { color: var(--err); }
.plg-menu-head {
  font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted);
  padding: 6px 10px 6px; border-bottom: 1px solid var(--panel-border); margin-bottom: 4px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.plg-cols { display: flex; flex-direction: column; padding: 2px 0 6px; }
.plg-col-opt { display: flex; align-items: center; gap: 8px; padding: 6px 10px; font-size: 0.82rem; color: var(--text); cursor: pointer; }
.plg-col-opt input { accent-color: var(--accent); }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
