/* The summary view: stat tiles, recently-submitted list, the "at a
   glance" home panel, the completed-task KPI dashboard, and the
   keyboard-shortcuts modal.

   Part of the split style sheet — see index.html for the link order. */
/* ---------- Summary view ---------- */
.summary-view {
  grid-column: 1 / -1;
  max-width: 1100px;
  width: 100%;
}

.summary-card {
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-card);
  padding: 28px;
  max-width: 560px;
  box-shadow: var(--shadow-md);
}

.summary-setup-grid { grid-template-columns: 1fr 1fr 1fr 1fr; }

.summary-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.summary-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.summary-row-picker {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-muted);
}

.summary-row-picker input {
  width: 76px;
  padding: 8px 10px;
  font-size: 13px;
}

.summary-table-wrap {
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-card);
  overflow-x: auto;
  box-shadow: var(--shadow-md);
}

.summary-table {
  border-collapse: collapse;
  width: 100%;
  min-width: max-content;
}

.summary-table th {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-muted);
  text-align: left;
  padding: 12px 16px;
  border-bottom: 1px solid var(--rule-strong);
  background: color-mix(in srgb, var(--surface-2) 70%, transparent);
  white-space: nowrap;
}

.summary-table td {
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
  padding: 16px;
  white-space: nowrap;
}

.summary-empty { color: var(--ink-muted); font-weight: 400; }

/* ---------- Summary sheet: a bento grid of frosted stat tiles ---------- */
.sum-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(148px, 1fr)); gap: 12px; margin-top: 6px; }
.sum-tile {
  position: relative; overflow: hidden; padding: 16px 17px 15px; border-radius: 14px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--surface) 78%, transparent), color-mix(in srgb, var(--surface-2) 60%, transparent));
  border: 1px solid var(--glass-border);
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}
.sum-tile::after {
  content: ""; position: absolute; left: 17px; right: 45%; bottom: 0; height: 2px; border-radius: 2px;
  background: linear-gradient(90deg, var(--accent), transparent); opacity: 0.55;
}
.sum-tile:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: color-mix(in srgb, var(--accent) 30%, transparent); }
.sum-tile-val { font-family: var(--font-mono); font-size: 26px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.05; color: var(--ink); overflow-wrap: anywhere; }
.sum-tile.is-text .sum-tile-val { font-family: var(--font-body); font-size: 16px; font-weight: 700; letter-spacing: -0.01em; }
.sum-tile-label { margin-top: 8px; font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--ink-muted); }

.sum-table-toggle { margin-top: 18px; display: inline-flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 600;
  padding: 7px 12px; border-radius: var(--radius-sm); cursor: pointer; color: var(--ink-soft);
  background: color-mix(in srgb, var(--surface-2) 70%, transparent); border: 1px solid var(--glass-border); transition: var(--transition); }
.sum-table-toggle:hover { color: var(--accent-strong); border-color: color-mix(in srgb, var(--accent) 40%, transparent); }
.sum-table-toggle .ic { width: 14px; height: 14px; }
.sum-table-collapse { margin-top: 12px; }

/* ---------- Recently submitted (history + unsubmit) ---------- */
.history-section { margin-top: 32px; max-width: 720px; }

.history-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  margin-bottom: 8px;
  border-radius: var(--radius-md);
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-sm);
}

.history-main { min-width: 0; }
.history-title {
  font-size: 13.5px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.history-item .history-unsubmit { flex-shrink: 0; }
.history-actions { display: flex; gap: 8px; flex-shrink: 0; }

/* ---------- Reclaiming a submission the sheet didn't get ----------
   The row opens into a panel with one tab per field. Its job is to answer
   "did my writing actually land" before anything is written anywhere. */

.history-item.is-open {
  background: var(--surface);
  border-color: var(--accent);
  margin-bottom: 0;
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}
.history-reveal.is-open { border-color: var(--accent); color: var(--accent); }

.reveal-panel {
  border: 1px solid var(--accent);
  border-top: none;
  border-bottom-left-radius: var(--radius-md);
  border-bottom-right-radius: var(--radius-md);
  background: var(--surface);
  padding: 0 14px 14px;
  margin-bottom: 8px;
}

.reveal-tabs {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--rule);
  margin-bottom: 14px;
  overflow-x: auto;
}
.reveal-tab {
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  padding: 9px 14px;
  border: none;
  border-bottom: 2px solid transparent;
  background: none;
  color: var(--ink-muted);
  cursor: pointer;
  white-space: nowrap;
}
.reveal-tab:hover { color: var(--ink); }
.reveal-tab[aria-selected="true"] { color: var(--accent); border-bottom-color: var(--accent); }
.reveal-tab:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

/* The dot is the answer at a glance, before any text is read. */
.reveal-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  margin-left: 6px;
  vertical-align: 1px;
}
.dot-matches { background: var(--ok); }
.dot-empty, .dot-differs { background: var(--danger); }
.dot-unwritable { background: var(--gold); }

/* Colour alone can't carry the verdict — the dots are 6px, and a red/green pair
   is the single most common form of colour blindness. Every dot is followed by
   text a screen reader announces and a sighted user gets on hover. */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.reveal-verdict {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  line-height: 1.5;
  margin-bottom: 12px;
  border: 1px solid transparent;
}
.reveal-verdict .verdict-mark { font-family: var(--font-mono); font-weight: 700; flex-shrink: 0; }
.verdict-ok { background: var(--ok-soft); color: var(--ok); border-color: var(--ok); }
.verdict-bad { background: var(--danger-soft); color: var(--danger); border-color: var(--danger); }
.verdict-warn { background: var(--gold-soft); color: var(--gold); border-color: var(--gold); }

.reveal-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 720px) { .reveal-grid { grid-template-columns: 1fr; } }

.reveal-pane-title {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin-bottom: 6px;
}
.reveal-stored, .reveal-current {
  background: var(--surface-2);
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm);
  padding: 11px 13px;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.6;
  max-height: 200px;
  overflow-y: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.reveal-current.is-empty {
  background: var(--danger-soft);
  border-color: var(--danger);
  color: var(--danger);
  font-style: italic;
}

.reveal-actions {
  display: flex;
  gap: 8px;
  margin-top: 14px;
  align-items: center;
  flex-wrap: wrap;
}
.reveal-actions .hint { flex: 1 1 180px; margin: 0; }
.reveal-error:empty { display: none; }
.reveal-error { margin-top: 10px; }

/* An inline control that reads as part of the sentence around it, because it
   is: "…aren't shown above — show them". A button styled as a button would
   pull far more attention than a footnote deserves. */
.link-button {
  font: inherit;
  color: var(--accent);
  background: none;
  border: none;
  padding: 0;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}
.link-button:hover { color: var(--accent-strong); }
.link-button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 3px; }

.recover-more { margin-top: 14px; }
.recover-elsewhere { margin-top: 14px; padding-top: 4px; border-top: 1px dashed var(--rule); }

/* ---------- "At a glance" home panel ---------- */
.home-panel {
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-sm);
  margin-bottom: 16px;
  overflow: hidden;
  flex: none;
}

.home-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  padding: 12px 14px;
  background: transparent;
  border: none;
  cursor: pointer;
  text-align: left;
  color: var(--ink);
  transition: var(--transition);
}
.home-head:hover { background: color-mix(in srgb, var(--surface-2) 55%, transparent); }
.home-head-left { display: flex; align-items: center; gap: 8px; min-width: 0; flex-wrap: wrap; }
.home-head-ic.ic { width: 15px; height: 15px; color: var(--ink-muted); flex: none; }
.home-head-title { font-weight: 700; font-size: 13px; letter-spacing: -0.01em; }
.home-head-total {
  font-family: var(--font-mono);
  font-size: 12px; font-weight: 600;
  color: var(--accent-strong);
  background: var(--accent-soft);
  border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
  padding: 2px 8px; border-radius: 999px;
}
.home-chev.ic { width: 16px; height: 16px; color: var(--ink-muted); flex: none; transition: transform 0.25s ease; }
.home-panel[data-collapsed="false"] .home-chev.ic { transform: rotate(180deg); }

/* Inline type split: collapsed state only */
.home-inline { display: none; align-items: center; gap: 12px; flex-wrap: wrap; }
.home-panel[data-collapsed="true"] .home-inline { display: inline-flex; }
.home-inline-chip { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ink-soft); font-weight: 600; }

/* Body: expanded state only */
.home-body { display: none; padding: 2px 14px 14px; border-top: 1px solid var(--glass-border); }
.home-panel[data-collapsed="false"] .home-body { display: block; }
.home-lead { margin: 12px 0 14px; font-size: 13px; color: var(--ink-soft); }
.home-lead strong { color: var(--ink); font-family: var(--font-mono); }

.home-groups { display: flex; flex-direction: column; gap: 14px; }
.home-group-label {
  display: block; font-size: 10.5px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.07em; color: var(--ink-muted); margin-bottom: 8px;
}
.home-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.home-chip {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 7px 11px; border-radius: 999px;
  background: color-mix(in srgb, var(--surface-2) 70%, transparent);
  border: 1px solid var(--glass-border);
  cursor: pointer; transition: var(--transition); color: var(--ink);
}
.home-chip:hover { border-color: var(--accent); }
.home-chip-label { font-size: 12px; font-weight: 600; }
.home-chip-num { font-family: var(--font-mono); font-size: 12.5px; font-weight: 700; color: var(--ink-soft); }

/* What's actually selected. These chips filtered the list from the moment they
   existed but never showed which one was on, so a panel reading "12 tasks" over
   a list of 2 gave no clue where the missing ten went. */
.home-chip[aria-pressed="true"] {
  background: var(--accent-soft);
  border-color: color-mix(in srgb, var(--accent) 45%, transparent);
  color: var(--accent-strong);
}
.home-chip[aria-pressed="true"] .home-chip-num { color: var(--accent-strong); }
/* "All" isn't a status, so it doesn't get a status colour next to it. */
.home-chip-all .home-dot { display: none; }

.home-sheets { display: flex; flex-direction: column; gap: 4px; }
.home-sheet {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 7px 10px; border-radius: var(--radius-sm);
  background: transparent; border: 1px solid transparent; cursor: pointer;
  transition: var(--transition); color: var(--ink); width: 100%; text-align: left;
}
.home-sheet:hover { background: color-mix(in srgb, var(--surface-2) 60%, transparent); border-color: var(--glass-border); }
.home-sheet-name { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.home-sheet-num { font-family: var(--font-mono); font-size: 13px; font-weight: 700; color: var(--ink-soft); flex: none; }
.home-src-dot { width: 9px; height: 9px; border-radius: 3px; flex: none; }
.home-src-dot-plain { background: var(--ink-muted); }

/* "All sheets" leads the list and is the way back out of a single-sheet view,
   so it reads as a heading rather than as another sheet. */
.home-sheet-all { margin-bottom: 2px; padding-bottom: 9px; border-bottom: 1px solid var(--glass-border); border-radius: 0; }
.home-sheet-all:hover { border-bottom-color: var(--glass-border); }
.home-sheet-all .home-sheet-name { font-weight: 600; color: var(--ink-soft); }
.home-sheet-all .home-src-dot { display: none; }

.home-sheet[aria-pressed="true"] {
  background: var(--accent-soft);
  border-color: color-mix(in srgb, var(--accent) 35%, transparent);
}
.home-sheet[aria-pressed="true"] .home-sheet-name,
.home-sheet[aria-pressed="true"] .home-sheet-num { color: var(--accent-strong); }

/* "All sheets" is the resting state, so it marks itself in text alone. A
   full-width filled bar sitting there by default reads as "something is
   filtered" — which is the confusion this whole panel is meant to end. */
.home-sheet-all[aria-pressed="true"] { background: transparent; border-color: transparent; }
.home-sheet-all[aria-pressed="true"]:hover { background: color-mix(in srgb, var(--surface-2) 60%, transparent); }

/* Shared type dots (home panel + KPI breakdowns) */
.home-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ink-muted); flex: none; display: inline-block; }
.home-dot.t-assigned { background: var(--accent-strong); }
.home-dot.t-update { background: var(--gold); }

/* ---------- Completed-task KPI dashboard (frosted + restrained accent) ---------- */
.kpi-dash {
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-md);
  padding: 24px 26px;
  margin-bottom: 28px;
}
.kpi-dash-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.kpi-title { margin: 0; font-size: 17px; font-weight: 700; letter-spacing: -0.01em; }
.kpi-sub { font-size: 12.5px; color: var(--ink-muted); margin-top: 3px; }
.kpi-badge {
  display: inline-flex; align-items: center; gap: 7px; flex: none;
  font-size: 11px; font-weight: 600; color: var(--ink-soft);
  padding: 5px 11px; border-radius: 999px; border: 1px solid var(--glass-border);
  background: color-mix(in srgb, var(--surface-2) 60%, transparent);
}
.kpi-badge b { font-family: var(--font-mono); color: var(--ink); }
.kpi-grp { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-muted); margin: 0; }

.kpi-empty { display: flex; align-items: center; gap: 10px; margin: 0; color: var(--ink-muted); font-size: 14px; }
.kpi-empty .ic { width: 16px; height: 16px; flex: none; }

/* Stat tiles: numbers are the hero; accent is only a thin gradient underline,
   with a soft glow reserved for the lead (This week) tile. */
.kpi-tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 24px; }
.kpi-tile {
  position: relative; overflow: hidden; padding: 17px 18px 16px; border-radius: 14px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--surface) 78%, transparent), color-mix(in srgb, var(--surface-2) 62%, transparent));
  border: 1px solid var(--glass-border);
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}
.kpi-tile::after {
  content: ""; position: absolute; left: 18px; right: 42%; bottom: 0; height: 2px; border-radius: 2px;
  background: linear-gradient(90deg, var(--accent), transparent); opacity: 0.5;
}
.kpi-tile.lead::after { right: 18px; opacity: 0.85; }
.kpi-tile.lead::before {
  content: ""; position: absolute; width: 120px; height: 120px; right: -42px; top: -52px; border-radius: 50%;
  background: radial-gradient(circle, color-mix(in srgb, var(--accent) 32%, transparent), transparent 70%);
  opacity: 0.55; pointer-events: none;
}
.kpi-tile:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: color-mix(in srgb, var(--accent) 30%, transparent); }
.kpi-num { position: relative; font-family: var(--font-mono); font-size: 30px; font-weight: 700; letter-spacing: -0.02em; line-height: 1; color: var(--ink); }
.kpi-label { position: relative; margin-top: 8px; font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--ink-muted); }
.kpi-delta { position: relative; margin-top: 6px; font-size: 11px; font-weight: 600; color: var(--accent-strong); }
.kpi-delta.flat { color: var(--ink-muted); }

/* Weekly trend: a gradient area sparkline (accent stays a whisper) */
.kpi-trend { margin-bottom: 24px; }
.kpi-trend-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 8px; }
.kpi-spark { position: relative; }
.kpi-spark-svg { display: block; width: 100%; height: 92px; overflow: visible; }
.kpi-spark-dot {
  position: absolute; left: 100%; width: 9px; height: 9px; margin-left: -5px; border-radius: 50%;
  background: var(--accent); transform: translateY(-50%);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 16%, transparent);
}
.kpi-spark-x { display: flex; justify-content: space-between; margin-top: 8px; }
.kpi-spark-x span { font-size: 9.5px; color: var(--ink-muted); }
.kpi-spark-empty { padding: 20px 0; margin: 0; }

.kpi-breakdowns { display: grid; grid-template-columns: 1fr 1fr; gap: 26px; }
.kpi-brows { display: flex; flex-direction: column; gap: 12px; margin-top: 12px; }
.kpi-brow { display: grid; grid-template-columns: minmax(70px, 120px) 1fr auto; align-items: center; gap: 12px; }
.kpi-brow-label { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--ink-soft); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kdot { width: 7px; height: 7px; border-radius: 50%; flex: none; background: var(--accent); box-shadow: 0 0 8px color-mix(in srgb, var(--accent) 45%, transparent); }
.kdot.two { background: color-mix(in srgb, var(--accent) 45%, var(--ink-muted)); box-shadow: none; }
.kpi-brow-track { height: 6px; border-radius: 999px; background: color-mix(in srgb, var(--ink) 8%, transparent); overflow: hidden; }
.kpi-brow-fill { display: block; height: 100%; border-radius: 999px; transform-origin: left center; background: linear-gradient(90deg, color-mix(in srgb, var(--accent) 45%, transparent), var(--accent)); }
.kpi-brow-fill.two { background: linear-gradient(90deg, color-mix(in srgb, var(--accent) 18%, transparent), color-mix(in srgb, var(--accent) 52%, var(--ink-muted))); }
.kpi-brow-count { font-family: var(--font-mono); font-size: 13px; font-weight: 700; color: var(--ink); }

.summary-section { margin-top: 4px; }

@media (max-width: 720px) {
  .kpi-tiles { grid-template-columns: repeat(2, 1fr); }
  .kpi-breakdowns { grid-template-columns: 1fr; gap: 18px; }
  .kpi-brow { grid-template-columns: minmax(56px, 96px) 1fr auto; }
}

/* Entrance for the home panel; JS handles the richer summary-tab motion.
   Both are disabled under reduced-motion. */
@keyframes homeIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.home-panel { animation: homeIn 0.45s ease both; }
@media (prefers-reduced-motion: reduce) {
  .home-panel { animation: none; }
  .kpi-tile { transition: none; }
}

/* ---------- Keyboard shortcuts modal ---------- */
.shortcuts-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 8px;
}

.shortcuts-table td {
  padding: 9px 4px;
  border-bottom: 1px solid var(--rule);
  font-size: 13px;
  color: var(--ink-soft);
}

.shortcuts-table td:first-child { white-space: nowrap; padding-right: 18px; }

kbd {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink);
  background: var(--surface-2);
  border: 1px solid var(--rule-strong);
  border-bottom-width: 2px;
  border-radius: 5px;
  padding: 2px 6px;
}
