/* Quests · the week board (wave 1, balanced-board). Registered on every page (quests.weekly): it styles Today's week
   section, the board's This week plate and card lines, the parent dashboard's This week panel and the targets editor.
   Workshop: a steel plate; subject names on black label tape as drawer labels; 12px tape rows whose yellow blade
   fills notch by notch toward the red goal tab (ui.tape(row=true), luminary.css). Studio: the same markup as a card of
   stock held up by a marigold strip of washi, kraft tags with a dot in the subject's swatch, marigold value strips
   (world-studio.css). The office (parent panel) is ruled rows, ink and one blue. Tokens only; no new motion. */

/* ------------------------------------------------------------------ the week board (kid: Today and /quests) */
.q-week {
  container: week / inline-size;
  display: grid; gap: 14px; min-width: 0; padding: 18px;
  border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface);
}
.q-week-head { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 4px 12px; }
.q-week-title { display: flex; align-items: center; font: 700 var(--step-1)/1.25 var(--font-body); }
.q-week-dates { font: 500 .85rem var(--font-mono); color: var(--ink-3); font-variant-numeric: tabular-nums; }

.q-week-meters { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px 18px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@container week (min-width: 640px) { .q-week-meters.is-core { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@container week (min-width: 440px) { .q-week-meters.is-logged { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
/* each meter stands on its row's floor: a label that wraps at 320px ("Social studies" and its 0/1) never lifts its
   track out of line with its neighbour's */
.q-week-meter { min-width: 0; display: grid; align-content: end; }
/* the drawer label: the subject's name on black label tape */
.q-week .tape-name {
  display: inline-flex; align-items: center; max-width: 100%; padding: 2px 7px 3px; border-radius: var(--r-sm);
  background: var(--label-tape); color: var(--label-ink); font: 500 .72rem/1.4 var(--font-mono); letter-spacing: .06em; text-transform: uppercase;
  overflow-wrap: anywhere;
}
/* paused: nothing at this level yet, so it isn't required. A dashed track (not yet) and a Pencil Gray note */
.tape.is-paused .tape-label > span:first-child { display: inline-flex; }
.tape.is-paused .tape-track { height: 12px; border-radius: var(--r-sm); background: transparent; border: 1.5px dashed var(--field-line); }
.tape.is-paused .tape-row-note { flex-basis: auto; margin-left: auto; text-align: right; }
.q-week .is-paused .tape-label > span:first-child {
  padding: 2px 7px 3px; border-radius: var(--r-sm); background: var(--label-tape); color: var(--label-ink);
  font: 500 .72rem/1.4 var(--font-mono); letter-spacing: .06em; text-transform: uppercase; opacity: .7;
}

/* between the quest meters and the logged ones: a dimension line |---- LOGGED ----| */
.q-week-rule { display: flex; align-items: center; gap: 10px; margin: 0; color: var(--ink-3); font: 500 .74rem/1.4 var(--font-mono); letter-spacing: .08em; text-transform: uppercase; }
.q-week-rule > span { display: inline-flex; align-items: center; }
.q-week-rule::before, .q-week-rule::after {
  content: ""; flex: 1 1 0; height: 9px;
  background: linear-gradient(var(--ink-3), var(--ink-3)) center / 100% 1px no-repeat;
}
.q-week-rule::before { background: linear-gradient(var(--ink-3), var(--ink-3)) left center / 1px 9px no-repeat, linear-gradient(var(--ink-3), var(--ink-3)) center / 100% 1px no-repeat; }
.q-week-rule::after { background: linear-gradient(var(--ink-3), var(--ink-3)) right center / 1px 9px no-repeat, linear-gradient(var(--ink-3), var(--ink-3)) center / 100% 1px no-repeat; }

/* the goal line: a red goal tab (the tape's own), or once every meter is full, the lumens that came in */
.q-week-goal { display: flex; align-items: center; gap: 10px; margin: 0; color: var(--ink-2); }
.q-week-goal .num { font-family: var(--font-mono); color: var(--ink); font-weight: 500; }
.q-week-tab { flex: none; width: 6px; height: 16px; border-radius: 1px; background: var(--red); }
.q-week-goal > .icon { flex: none; color: var(--ink-3); }
.q-week-goal.is-full { color: var(--ink); font-weight: 700; }
.q-week-goal.is-full > .icon { color: var(--warn); }
.q-week-goal.is-full .pill .num { color: inherit; }
.q-week-sub { display: flex; align-items: center; gap: 8px; margin: 0; color: var(--ink-3); font-size: .92rem; }
.q-week-sub .icon { flex: none; width: 1.05em; height: 1.05em; }
.q-week-sub .num { font-family: var(--font-mono); color: var(--ink-2); }

/* Log it: a disclosure (works with no JS), radio chips, "something else", and this week's logs */
.q-week-log { border-top: 1px dashed var(--line); padding-top: 6px; }
.q-week-log-sum {
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 6px; margin-left: -6px; border-radius: var(--r);
  color: var(--blue); font-weight: 700; cursor: pointer; list-style: none;
}
.q-week-log-sum::-webkit-details-marker { display: none; }
.q-week-log-sum:hover { background: var(--surface-2); }
.q-week-log-n { color: var(--ink-3); font-weight: 400; font-size: .9rem; }
.q-week-log-n .num { font-family: var(--font-mono); }
.q-week-chev { width: 18px; height: 18px; transition: rotate .2s cubic-bezier(.16, 1, .3, 1); }
.q-week-log[open] .q-week-chev { rotate: 180deg; }
.q-week-log-body { padding-top: 8px; }
.q-week-form fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
.q-week-form legend { padding: 0; margin-bottom: 6px; font-weight: 700; }
.q-week .chip { position: relative; }
.q-week-group .chips { gap: 6px; }
.q-week-group .chip { font-weight: 400; text-align: left; }
.q-week-group .chip:has(input:checked) { font-weight: 700; }
.q-week-other-row { display: flex; flex-wrap: wrap; gap: 8px; }
.q-week-other-row select { flex: 0 1 11rem; min-width: 0; }
.q-week-other-row input { flex: 1 1 12rem; min-width: 0; }
.q-week-error { display: flex; align-items: flex-start; gap: 8px; margin: 0; padding: 10px 12px; border-radius: var(--r); background: var(--warn-soft); color: var(--ink); }
.q-week-error > .icon { flex: none; margin-top: 2px; color: var(--warn); }
.q-week-logged { display: grid; gap: 4px; }
.q-week-logged-h { font: 700 1rem/1.3 var(--font-body); }
.q-week-logs { list-style: none; margin: 0; padding: 0; }
.q-week-logs li { display: grid; grid-template-columns: 3.2em minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 6px 0; border-top: 1px dashed var(--line); }
.q-week-logs li:last-child { border-bottom: 1px dashed var(--line); }
.q-week-log-day { font: 500 .85rem var(--font-mono); color: var(--ink-3); }
.q-week-log-what { display: grid; }
.q-week-log-what strong { overflow-wrap: anywhere; }
.q-week-log-subj { color: var(--ink-3); font-size: .85rem; }

/* Today keeps it compact under the day meter, tighter still on a phone so the note and the wall stay close */
.today-section .q-week { gap: 12px; padding: 16px; }
@media (max-width: 480px) {
  .today-section .q-week { gap: 10px; padding: 14px; }
  .today-section .q-week-meters { gap: 10px 14px; }
  .today-section .q-week-goal { font-size: .95rem; }
}

/* ------------------------------------------------------------------ the board's cards: subject meter and the reason it fits */
.q-order-week { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; margin-top: 8px; color: var(--ink-2); font-size: .9rem; }
.q-order-week .num { font-family: var(--font-mono); color: var(--ink); }
.q-order-notches { display: inline-flex; gap: 3px; }
.q-order-notches i { display: block; width: 14px; height: 8px; border-radius: 1px; border: 1.5px solid var(--outline); }
.q-order-notches i.is-on { background: var(--paint); border-color: var(--paint); }
.q-order-because { display: flex; align-items: center; gap: 6px; margin-top: 6px; color: var(--ink); font-weight: 700; font-size: .92rem; }
.q-order-because .icon { flex: none; width: 1.05em; height: 1.05em; color: var(--ink-2); }
/* the nudged card's why line (board.Offer.why: a subject nudge's kid words), one card at most: calm ink, no alarm */
.q-order-why { display: flex; align-items: flex-start; gap: 6px; margin-top: 6px; color: var(--ink-2); font-size: .92rem; line-height: 1.4; }
.q-order-why .icon { flex: none; width: 1.05em; height: 1.05em; margin-top: .15em; color: var(--ink-3); }
.q-order-why span { min-width: 0; overflow-wrap: anywhere; }

/* ------------------------------------------------------------------ the parent panel (office: ruled rows) */
.q-wk-office { min-width: 0; }
.q-wk-sum { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; color: var(--ink-2); }
.q-wk-sum .num { font: 500 .9rem var(--font-mono); color: var(--ink); }
.q-wk-rows, .q-wk-logs { list-style: none; margin: 0; padding: 0; }
.q-wk-row { display: grid; grid-template-columns: minmax(7.5em, 1fr) minmax(0, 1.6fr) auto; gap: 4px 12px; align-items: center; padding: 8px 0; border-top: 1px solid var(--line); }
.q-wk-row:last-child { border-bottom: 1px solid var(--line); }
.q-wk-name { font-weight: 700; }
.q-wk-count { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 4px 8px; }
.q-wk-count .num { font-family: var(--font-mono); }
.q-wk-last, .q-wk-note { color: var(--ink-3); font-size: .85rem; }
.q-wk-row.is-paused .q-wk-note, .q-wk-row.is-off .q-wk-note { grid-column: 2 / -1; }
.q-wk-row.is-off .q-wk-name, .q-wk-row.is-paused .q-wk-name { color: var(--ink-2); font-weight: 400; }
.q-wk-h { font: 700 1rem/1.3 var(--font-body); display: flex; align-items: center; }
.q-wk-logs li { display: grid; grid-template-columns: 3.2em minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 6px 0; border-top: 1px solid var(--line); }
.q-wk-logs li:last-child { border-bottom: 1px solid var(--line); }
.q-wk-day { font: 500 .85rem var(--font-mono); color: var(--ink-3); }
.q-wk-logs strong { overflow-wrap: anywhere; }
.q-wk-foot { display: grid; gap: 8px; justify-items: start; }
.q-wk-bonus { color: var(--ink-2); }
.q-wk-bonus .num { font-family: var(--font-mono); color: var(--ink); }
.q-wk-reverse { display: grid; gap: 6px; justify-items: start; }
.q-wk-change { display: inline-flex; align-items: center; }
.q-wk-change .tip { margin-left: 10px; }
@media (max-width: 520px) {
  .q-wk-row { grid-template-columns: minmax(0, 1fr) auto; }
  .q-wk-last { grid-column: 1 / -1; }
}

/* ------------------------------------------------------------------ the targets editor (Quest settings) */
.q-targets-group { display: grid; gap: 6px; }
.q-targets-h { font: 500 .76rem/1.4 var(--font-mono); letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); }
.q-targets-grid { display: grid; gap: 10px 16px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 150px), 1fr)); }
.q-target { display: grid; grid-template-columns: minmax(0, 1fr) 4.5rem; grid-template-rows: auto auto; gap: 0 10px; align-items: center; }
.q-target-name { font-weight: 700; }
.q-target input { grid-row: 1 / span 2; grid-column: 2; width: 100%; font-family: var(--font-mono); text-align: center; }
.q-target .subtle { grid-column: 1; }

/* ------------------------------------------------------------------ studio: a card on the cork, held by marigold washi */
[data-world="studio"] .q-week {
  position: relative; margin-top: 10px; padding-top: 26px;
  border: 1px solid var(--card-edge); border-radius: var(--r-sm); background: var(--card);
  box-shadow: inset 0 4px 0 var(--swatch-marigold), var(--shadow-hung);
}
[data-world="studio"] .q-week::before {
  content: ""; position: absolute; top: -8px; left: 50%; translate: -50% 0; width: min(40%, 76px); height: 18px;
  background: var(--swatch-marigold); clip-path: var(--washi);
}
[data-world="studio"] .today-section .q-week { padding-top: 24px; }
@media (max-width: 480px) { [data-world="studio"] .today-section .q-week { padding-top: 22px; } }
/* each meter's label is a kraft tag with a dot in its subject's swatch (the logged subjects are stone) */
[data-world="studio"] .q-week-meter { --hue: var(--swatch-stone); }
[data-world="studio"] .q-week-meter[data-hue="cornflower"] { --hue: var(--swatch-cornflower); }
[data-world="studio"] .q-week-meter[data-hue="plum"] { --hue: var(--swatch-plum); }
[data-world="studio"] .q-week-meter[data-hue="fern"] { --hue: var(--swatch-fern); }
[data-world="studio"] .q-week-meter[data-hue="teal"] { --hue: var(--swatch-teal); }
[data-world="studio"] .q-week .tape-name,
[data-world="studio"] .q-week .is-paused .tape-label > span:first-child {
  gap: 6px; padding: 2px 8px 3px; background: var(--kraft); color: var(--ink);
  font: 700 .76rem/1.4 var(--font-body); letter-spacing: 0; text-transform: none;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--card-edge) 35%, transparent);
}
[data-world="studio"] .q-week .tape-name::before,
[data-world="studio"] .q-week .is-paused .tape-label > span:first-child::before {
  content: ""; flex: none; width: 10px; height: 10px; border-radius: 50%; background: var(--hue);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--ink) 30%, transparent);
}
[data-world="studio"] .q-week .is-paused .tape-label > span:first-child { display: inline-flex; align-items: center; }
[data-world="studio"] .tape.is-paused .tape-track { background: transparent; border: 1.5px dashed var(--field-line); }
/* the dimension line becomes a stitched seam, the goal tab the strip's own ink tick */
[data-world="studio"] .q-week-rule::before, [data-world="studio"] .q-week-rule::after {
  height: 0; background: none; border-top: 1.5px dashed color-mix(in srgb, var(--card-edge) 45%, transparent);
}
[data-world="studio"] .q-week-tab { width: 2px; height: 18px; background: var(--ink); }
[data-world="studio"] .q-week-log, [data-world="studio"] .q-week-logs li { border-color: color-mix(in srgb, var(--card-edge) 35%, transparent); }
/* quest cards carry their subject's swatch: the washi strip holding each one up, and its week notches */
[data-world="studio"] .q-order[data-hue="cornflower"] { --hue: var(--swatch-cornflower); }
[data-world="studio"] .q-order[data-hue="plum"] { --hue: var(--swatch-plum); }
[data-world="studio"] .q-order[data-hue="fern"] { --hue: var(--swatch-fern); }
[data-world="studio"] .q-order[data-hue="teal"] { --hue: var(--swatch-teal); }
[data-world="studio"] .q-order[data-hue="marigold"] { --hue: var(--swatch-marigold); }
[data-world="studio"] .q-order[data-hue="stone"] { --hue: var(--swatch-stone); }
[data-world="studio"] .q-order-notches i { border-color: var(--card-edge); border-radius: 50%; width: 10px; height: 10px; }
[data-world="studio"] .q-order-notches i.is-on { background: var(--hue); border-color: var(--hue); }
