/* Home dashboard: the app launcher, the "Today" strip, the "This week"
   digest widget, stale-data notes and the done/dismiss row controls. */

/* Dashboard header: greeting left, actions right. */
.home-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--sp-5);
  flex-wrap: wrap;
  margin-bottom: var(--sp-4);
}
.home-header h1 { font-size: var(--fs-xl); margin-bottom: var(--sp-0); }
.home-header p { color: var(--text-muted); font-size: var(--fs-sm); }
.home-header > div:last-child { margin: 0; }

/* ---------- App launcher (home) ---------- */
/* Framed blocks (launcher, today strip) get a hairline top accent so the page
   has structure, and a surface background so trailing empty cells in the
   last row do not read as broken tiles. The launcher and strip rise in with
   a small stagger (motion rules in base.css). */
.launcher {
  display: grid;
  /* One bordered block of rows rather than a field of floating boxes: the
     app list is a list, so it reads like one and fits on a screen. */
  grid-template-columns: repeat(auto-fit, minmax(255px, 1fr));
  gap: 0;
  border: 1px solid var(--border);
  border-top: 2px solid var(--accent);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
  animation-delay: 0.06s;
}
/* No icon column: the emoji are gone. Stats sit beside the label, so they
   must never crowd it out. */
.app-card {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: var(--sp-3);
  text-align: left;
  padding: var(--sp-2) var(--sp-3);
  background: var(--surface);
  border: 0;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  font: inherit;
  color: var(--text);
}
.app-card:hover { background: var(--accent-soft); }
.app-card:last-child { border-right: 0; }
.app-icon { font-size: var(--fs-body); line-height: 1; }
.app-card .app-icon { display: none; }
.app-title { font-size: var(--fs-md); font-weight: 600; }
.app-card .app-title { color: var(--text); }
.app-card:hover .app-title { color: var(--accent); }
/* Descriptions belong on the page itself, not repeated 16 times on the
   dashboard — they were most of the clutter. */
.app-desc { display: none; }
.app-stat {
  margin: 0;
  max-width: 62%;
  font-size: var(--fs-2xs);
  font-weight: 600;
  color: var(--text-muted);
  background: none;
  padding: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/* ---------- Home "Today" dashboard strip ---------- */
/* Grids: stop stretching to fill a row and leaving blank cells. As many of
   the "at a glance" cards fit per row as comfortably can (never forced below
   230px, or titles get truncated to nothing); a short card in that row still
   won't stretch to match a tall one (align-items: start). */
.today-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  align-items: start;
  gap: 0;
  margin-bottom: var(--sp-4);
  border: 1px solid var(--border);
  border-top: 2px solid var(--accent);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
  animation-delay: 0.02s;
}
/* Second "At a glance" row: two wide cards (career fair + current classes). */
.today-strip-secondary { grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr)); align-items: stretch; }
/* The primary strip (Focus now / Next quiz-test / Due this week) packs its
   cards into two flex columns by weight in js/home.js instead of relying on
   this grid — a CSS grid row forces every card in it to reserve the tallest
   row-mate's height, which is exactly the dead-space bug this replaced. */
.today-strip-primary {
  display: flex;
  align-items: stretch;
}
.today-strip-col {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}
.today-strip-col:not(:last-child) { border-right: 1px solid var(--border); }
.today-strip-primary .today-card { border-right: 0; }
.today-strip-primary .today-card:not(:last-child) { border-bottom: 1px solid var(--border); }
.today-card {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: var(--sp-2);
  text-align: left;
  padding: var(--sp-3);
  background: var(--surface);
  border: 0;
  border-right: 1px solid var(--border);
  cursor: pointer;
  font: inherit;
  color: var(--text);
}
.today-card:hover { background: var(--surface-2); }
/* Second strip (fair + current classes, F-09): the columns wrap to one on a
   narrow main, so a right border would double the strip's own edge. Each card
   draws its divider on its left and top instead, pulled 1px outside its cell:
   on the first column or row that line falls under the strip's overflow clip,
   elsewhere it is the divider between two cards. */
.today-strip-secondary > .today-card {
  min-width: 0;
  border-right: 0;
  border-left: 1px solid var(--border);
  border-top: 1px solid var(--border);
  margin: -1px 0 0 -1px;
}
.today-fair { min-width: 0; }
.today-title { font-size: var(--fs-xs); font-weight: 700; color: var(--text-muted); }
.today-list { display: flex; flex-direction: column; gap: var(--sp-2); }
.today-item {
  display: flex;
  flex-wrap: wrap;
  /* Title, chip and badge share one centre line (issue #16 F-57). */
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-2);
}
/* These cards are narrower than a full-width list — the shared .class-chip's
   140px cap still crowds out the title here, so clip it tighter. */
.today-item .class-chip { max-width: 110px; }
.today-item-title {
  font-size: var(--fs-md);
  font-weight: 600;
  min-width: 0;
  /* Below about 12 characters the chip and badge wrap under the title
     instead of squeezing it to nothing (issue #16 item 4). */
  flex: 1 1 12ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.today-empty { font-size: var(--fs-sm); color: var(--text-muted); }

/* ---------- "This week" digest widget (home) ---------- */
.digest-widget {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: var(--sp-4);
  margin-bottom: var(--sp-6);
  cursor: pointer;
  transition: transform 0.08s ease, border-color 0.08s ease;
}
.digest-widget:hover { transform: translateY(-1px); }
.digest-widget.loading { opacity: 0.6; }
.digest-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  margin-bottom: var(--sp-2);
}
.digest-title { font-size: var(--fs-md); font-weight: 700; }
.digest-refresh { padding: var(--sp-1) var(--sp-2); }
.digest-text { font-size: var(--fs-md); line-height: var(--lh); color: var(--text); max-width: var(--measure); }
.digest-list { display: flex; flex-direction: column; gap: var(--sp-2); margin-top: var(--sp-3); }
.digest-item {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding-top: var(--sp-2);
  border-top: 1px solid var(--border);
}
.digest-item-title {
  font-size: var(--fs-md);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  flex: 1;
}
.digest-sub {
  font-size: var(--fs-xs);
  color: var(--text-muted);
  /* A long course name must not take the title's room (F-10). */
  flex-shrink: 1;
  min-width: 0;
  max-width: 40%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.digest-sub:last-child { flex-shrink: 0; }
@media (max-width: 560px) {
  .digest-item { flex-wrap: wrap; row-gap: 0; }
  .digest-item-title { flex: 1 1 100%; }
}

/* "These numbers are frozen" — shown when Canvas can't refresh. */
.stale-note {
  margin-top: var(--sp-3);
  padding-top: var(--sp-2);
  border-top: 1px solid var(--border);
  font-size: var(--fs-2xs);
  line-height: var(--lh);
  color: var(--text-muted);
  cursor: pointer;
}
.stale-note:hover { color: var(--text); }
.stale-note.broken { color: var(--danger); font-weight: 600; }

.today-item { position: relative; }
.today-done {
  border: none;
  background: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: var(--fs-xs);
  padding: var(--sp-0) var(--sp-1);
  border-radius: 6px;
  /* A 24px hit area (issue #16 F-27); the glyph stays the same size. */
  min-width: 24px;
  min-height: 24px;
  opacity: 0;
  flex-shrink: 0;
}
.today-item:hover .today-done { opacity: 0.7; }
.today-done:hover { opacity: 1 !important; color: var(--success); background: var(--surface-2); }
.today-class { cursor: pointer; }
.today-class:hover .today-item-title { color: var(--accent); }
.hw-done { margin-left: var(--sp-1); }
.list-item:hover .hw-done { opacity: 0.65; }
.hw-done:hover { color: var(--success) !important; }

/* Layout fixes (issue #16 item 4)
   761px and up the sidebar comes back and .main loses about 230px, so a
   viewport query no longer says how wide the page column is. These follow
   .main's own width (container "main", the .main rule in css/base.css). */
@container main (max-width: 620px) {
  .today-strip-primary { flex-direction: column; }
  .today-strip-primary .today-strip-col:not(:last-child) {
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }
}
