/* Planning screens: what-if test bar, week ahead, externals list, day templates.
   Own file so these screens can change without touching app.css. Same layers and tokens as app.css. */
@layer views {

  /* what-if: a test of the day, clearly not the real thing */
  .wibar {
    background: #eef5ff; border: 2px dashed var(--blue); border-radius: var(--radius); padding: 14px 18px;
    display: grid; gap: 12px;
  }
  .wihead { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 20px; }
  .wihead h2 { margin: 0; color: var(--blue); }
  .wihead p { margin: 2px 0 0; color: var(--muted); }
  .wibtns { display: flex; gap: 8px; flex-wrap: wrap; }
  .wihelp { margin: 0; color: var(--ink); max-width: 70ch; }
  .wicmp { border-collapse: collapse; width: 100%; max-width: 560px; font-variant-numeric: tabular-nums; background: var(--bg); border-radius: 8px; overflow: hidden; }
  .wicmp th, .wicmp td { padding: 6px 12px; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; }
  .wicmp thead th { font-size: 12px; color: var(--muted); font-weight: 600; }
  .wicmp th[scope=row] { text-align: left; font-weight: 500; white-space: normal; }
  .wicmp tbody tr:last-child > * { border-bottom: 0; }
  .wicmp td:last-child { width: 9.5em; }
  .wicmp .arr { display: inline-block; width: 1em; font-size: 11px; }
  .wicmp tr.worse td:last-child { color: var(--red); }
  .wicmp tr.better td:last-child { color: var(--green); }
  .dayactions .wibtn { border-style: dashed; border-color: var(--blue); color: var(--blue); }

  /* week ahead: one card per day; subgrid keeps every row lined up across the cards */
  .datebar .wkswitch { margin: 0 0 0 auto; }
  .datebar .tabs { margin-bottom: 0; }
  .wksum { margin-bottom: 14px; }
  .wksum h1 { font-size: clamp(19px, 2.2vw, 24px); }
  .wkcols { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 150px), 1fr)); gap: 12px; }
  .wkday {
    display: grid; grid-row: span 6; grid-template-rows: subgrid; gap: 8px; align-content: start;
    background: var(--bg); border: 1px solid var(--line); border-top: 5px solid var(--green); border-radius: var(--radius); box-shadow: var(--shadow); padding: 12px 10px;
    min-width: 0;
  }
  .wkday.short { border-top-color: var(--red); }
  .wkday.norule { border-top-color: var(--red); }
  .wkday header { display: flex; justify-content: space-between; align-items: center; gap: 6px; min-width: 0; }
  .wkday header b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .wkday p { margin: 0; }
  .wkstatus { font-weight: 650; font-size: 17px; }
  .wkday.short .wkstatus, .wkday.norule .wkstatus { color: var(--red); }
  .wkday.ok .wkstatus { color: var(--green); }
  .wkgroups { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; font-size: 13.5px; }
  .wkgroups li { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 5px; min-width: 0; }
  .wkgroups .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--gc); }
  .wkgroups .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .wkgroups .bad { color: var(--red); font-weight: 600; white-space: nowrap; font-variant-numeric: tabular-nums; }
  .wkgroups .ok, .wkkollen .ok { color: var(--green); }
  .wkkollen .ext { color: var(--ext); font-weight: 600; }
  .wkkollen .bad { color: var(--red); font-weight: 600; }
  .wkfacts { color: var(--muted); }
  .wkday > button { justify-self: stretch; align-self: end; }

  /* the school's own externals */
  .poollist { list-style: none; margin: 8px 0 12px; padding: 0; display: grid; gap: 0; }
  .poollist li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
  .poollist li:first-child { border-top: 1px solid var(--line); }
  .poollist .pmain { display: grid; gap: 2px; min-width: 0; }
  .poollist .pbtns { display: flex; gap: 6px; flex: none; }
  .poolcard > button { width: auto; justify-self: start; align-self: flex-start; }
  .poolnote { margin: 4px 0 0; display: flex; flex-wrap: wrap; gap: 4px 6px; }
  .poolav td { padding: 4px 6px 4px 0; }
  .poolav label.check { display: flex; gap: 8px; align-items: center; font-weight: 500; white-space: nowrap; }

  /* day templates */
  .tplmodal { display: grid; gap: 12px; }
  .tplmodal h2, .tplmodal p { margin: 0; }
  .tplmodal section, .tplsave { display: grid; gap: 8px; border-top: 1px solid var(--line); padding-top: 12px; }
  .tplmodal .poollist { margin: 0; }
  .tplmodal .poollist li:first-child { border-top: 0; }
  .tplmodal section > button, .tplsave > button { justify-self: start; }
  .tplsave label.check { display: flex; gap: 8px; align-items: center; font-weight: 500; }

  @media (max-width: 760px) {
    .tplmodal .poollist li { flex-wrap: wrap; }
    .datebar:has(.tabs) { flex-wrap: wrap; }
    .datebar .tabs { width: auto; flex-wrap: nowrap; min-width: 0; }
    .datebar .tabs button { flex: 1 1 0; }
    .datebar .wkswitch { margin-left: 0; flex: 1 1 100%; order: 9; }
    .datebar .wklen { flex: 1 1 100%; order: 8; }
    .datebar .wkrange { flex: 1; justify-content: center; white-space: nowrap; }
    .wibar { padding: 12px; }
    .wibtns { width: 100%; }
    .wibtns button { flex: 1 1 0; }
    .wicmp th, .wicmp td { padding: 6px 8px; }
    .wicmp td:last-child { width: auto; }
  }
  @media print { .wibar { display: none !important; } }
}
