/* Personal, the Goals tab (public/rooms/personal/goals.js): the week's entry in his day book. The headline, then the
   eight stats as the page's bars with the 28 days under them; the scoreboard and the ladder beside them on a wide
   window, under them on a narrow one; what the window cannot hold folds into one line of buttons. Materials are
   theme.css's and the glance pieces' (room-layout.css .rv-g-*); a folded part opens in a dialog (.pe-gd) drawn with the
   same rules, so each rule names both. */
.pe-goals {flex:1 0 auto;}
.pe-goals .pe-body {display:grid;grid-template-columns:minmax(0,1fr);gap:20px;align-items:center;}
.pe-goals .pe-main,.pe-goals .pe-side {display:flex;flex-direction:column;gap:20px;min-width:0;}
.pe-goals .pe-side:not(:has(> :not([hidden]))) {display:none;}
@container glance (min-width:720px) {
  .pe-goals .pe-body:has(.pe-side > :not([hidden])) {grid-template-columns:minmax(0,1fr) minmax(300px,1fr);gap:24px;}
}
@container glance (min-width:880px) {
  .pe-goals .pe-body:has(.pe-side > :not([hidden])) {grid-template-columns:minmax(0,1fr) minmax(340px,400px);gap:32px;}
  /* The scoreboard and ladder share the height of the stats and history. */
  .pe-goals .pe-board .pe-cell {min-height:76px;}
  .pe-goals .pe-ladder .pe-rung,.pe-goals .pe-ladder .pe-debt {min-height:50px;}
}

/* THE STATS: the glance bars, a row a stat and the whole row its button; the level in its own column, a locked stat's
   words in place of its bar and figure */
.pe-goals .pe-stats {grid-template-columns:max-content minmax(80px,1fr) max-content max-content 16px;column-gap:20px;row-gap:0;border-block:1px solid var(--line);}
.pe-goals .pe-stats > li {display:grid;grid-column:1 / -1;grid-template-columns:subgrid;}
.pe-goals .pe-stats > li + li {border-top:1px solid var(--line);}
.pe-goals .pe-st {grid-column:1 / -1;display:grid;grid-template-columns:subgrid;align-items:center;min-height:52px;margin:0;padding:0;border:0;background:none;color:var(--ink);font:inherit;text-align:left;cursor:pointer;}
.pe-goals .pe-st .rv-g-bl {min-height:0;color:var(--ink);font-size:var(--t-row);font-weight:var(--w-mid);}
.pe-goals .pe-st:hover .pe-sn {text-decoration:underline;text-underline-offset:3px;}
.pe-goals .pe-lv {display:none;}
.pe-goals .pe-lvw {color:var(--muted);font-size:var(--t-meta);white-space:nowrap;}
.pe-goals .pe-of {font-family:var(--body);font-size:var(--t-meta);color:var(--muted);}
.pe-goals .pe-lock {grid-column:2 / span 2;color:var(--muted);}
.pe-goals .pe-st .rv-chev {width:16px;height:16px;color:var(--muted);}

/* THE STRIP: a column a day, eight cells each, filled from the foot; weeks set apart; today ringed */
/* 3px each side: today's ring (1px, 2px off its column) stays inside the strip's own edge */
:is(.pe-goals,.pe-gd) .pe-strip {display:grid;column-gap:3px;row-gap:8px;padding-inline:3px;}
:is(.pe-goals,.pe-gd) .pe-day {grid-row:1;display:flex;flex-direction:column-reverse;gap:2px;border-radius:2px;}
:is(.pe-goals,.pe-gd) .pe-day i {display:block;height:8px;border-radius:1px;background:var(--bg2);}
:is(.pe-goals,.pe-gd) .pe-day i.on {background:var(--muted);}
:is(.pe-goals,.pe-gd) .pe-day.full i.on {background:var(--ink);}
/* on the dialog's raised sheet an empty cell takes the next tone up, so it still shows */
.pe-gd .pe-day i {background:var(--bg3);}
:is(.pe-goals,.pe-gd) .pe-day.today {outline:1px solid var(--line2);outline-offset:2px;}
:is(.pe-goals,.pe-gd) .pe-wl {grid-row:2;min-width:0;color:var(--muted);font-size:var(--t-meta);line-height:16px;white-space:nowrap;}
/* this week's few days: its date sits flush with the strip's right edge, never past it */
:is(.pe-goals,.pe-gd) .pe-wl:last-child {justify-self:end;}

/* THE SCOREBOARD: nine figures, three to a line on the ruled sheet; Leaks is a button */
:is(.pe-goals,.pe-gd) .pe-board {list-style:none;margin:0;padding:0;display:grid;grid-template-columns:repeat(3,minmax(0,1fr));column-gap:16px;border-block:1px solid var(--line);}
:is(.pe-goals,.pe-gd) .pe-board > li {display:flex;min-width:0;}
:is(.pe-goals,.pe-gd) .pe-board > li:nth-child(n+4) {border-top:1px solid var(--line);}
:is(.pe-goals,.pe-gd) .pe-cell {display:grid;grid-template-columns:minmax(0,1fr) auto;grid-template-areas:"k chev" "v chev";align-content:center;align-items:center;column-gap:4px;width:100%;min-height:64px;margin:0;padding:8px 0;border:0;background:none;color:var(--ink);font:inherit;text-align:left;}
:is(.pe-goals,.pe-gd) button.pe-cell {cursor:pointer;}
:is(.pe-goals,.pe-gd) .pe-k {grid-area:k;color:var(--muted);font-size:var(--t-meta);line-height:16px;overflow-wrap:anywhere;}
:is(.pe-goals,.pe-gd) .pe-v {grid-area:v;font-family:var(--mono);font-size:var(--t-head);line-height:24px;overflow-wrap:anywhere;}
:is(.pe-goals,.pe-gd) .pe-v small,:is(.pe-goals,.pe-gd) .pe-dv small {font-family:var(--body);font-size:var(--t-row);color:var(--muted);}
:is(.pe-goals,.pe-gd) .pe-cell .rv-chev {grid-area:chev;width:16px;height:16px;color:var(--muted);}
:is(.pe-goals,.pe-gd) button.pe-cell:hover .pe-k {color:var(--ink);text-decoration:underline;text-underline-offset:3px;}

/* THE LADDER: the top rung first, a rail through the rungs' dots; passed rungs filled, his rung in ink and bold */
:is(.pe-goals,.pe-gd) .pe-ladder {list-style:none;margin:0;padding:0;display:grid;grid-template-columns:12px max-content max-content minmax(0,1fr) auto;column-gap:12px;border-block:1px solid var(--line);}
:is(.pe-goals,.pe-gd) .pe-rung {position:relative;grid-column:1 / -1;display:grid;grid-template-columns:subgrid;align-items:center;min-height:44px;color:var(--muted);}
:is(.pe-goals,.pe-gd) .pe-rung + .pe-rung {border-top:1px solid var(--line);}
:is(.pe-goals,.pe-gd) .pe-rung:not(:last-child)::before {content:"";position:absolute;left:5.5px;top:50%;height:100%;width:1px;background:var(--line2);}
:is(.pe-goals,.pe-gd) .pe-dot {position:relative;z-index:1;width:12px;height:12px;border-radius:50%;background:var(--bg2);box-shadow:inset 0 0 0 1.5px var(--line2);}
.pe-gd .pe-dot {background:var(--bg2);}
:is(.pe-goals,.pe-gd) .pe-rung.is-past .pe-dot {background:var(--muted);box-shadow:none;}
:is(.pe-goals,.pe-gd) .pe-rung.is-on {color:var(--ink);font-weight:var(--w-strong);}
:is(.pe-goals,.pe-gd) .pe-rung.is-on .pe-dot {background:var(--ink);box-shadow:none;}
:is(.pe-goals,.pe-gd) .pe-amt {font-family:var(--mono);font-size:var(--t-row);text-align:right;color:var(--ink);}
:is(.pe-goals,.pe-gd) .pe-rl {grid-column:4 / -1;min-width:0;text-wrap:pretty;}
:is(.pe-goals,.pe-gd) .pe-debt {grid-column:1 / -1;display:grid;grid-template-columns:subgrid;align-items:center;min-height:44px;margin:0;padding:0;border:0;background:none;color:inherit;font:inherit;text-align:left;cursor:pointer;}
:is(.pe-goals,.pe-gd) .pe-rn {grid-column:2 / 5;}
:is(.pe-goals,.pe-gd) .pe-dv {display:inline-flex;align-items:center;gap:8px;font-family:var(--mono);font-size:var(--t-row);color:var(--ink);white-space:nowrap;}
:is(.pe-goals,.pe-gd) .pe-dv small {font-size:var(--t-meta);}
:is(.pe-goals,.pe-gd) .pe-dv .rv-chev {flex:none;width:16px;height:16px;color:var(--muted);}
:is(.pe-goals,.pe-gd) .pe-debt:hover .pe-rn {text-decoration:underline;text-underline-offset:3px;}

/* THE FOLDS: one line of buttons, each opening a part the window could not hold */
.pe-goals .pe-folds {list-style:none;margin:0;padding:0;display:grid;grid-auto-flow:column;grid-auto-columns:minmax(0,1fr);border-block:1px solid var(--line);}
.pe-goals .pe-folds > li:not([hidden]) ~ li:not([hidden]) {border-left:1px solid var(--line);}
.pe-goals .pe-fold {display:flex;align-items:center;justify-content:space-between;gap:8px;width:100%;min-height:44px;margin:0;padding:0 8px;border:0;background:none;color:var(--ink);font:inherit;font-weight:var(--w-mid);text-align:left;cursor:pointer;}
.pe-goals .pe-fold .rv-chev {flex:none;width:16px;height:16px;color:var(--muted);}
@media (max-height:720px) {
  .pe-goals .pe-st {min-height:44px;}
  .pe-goals .pe-board .pe-cell {min-height:54px;}
}
.pe-goals .pe-fold:hover span {text-decoration:underline;text-underline-offset:3px;}

/* THE DIALOGS: the level stepper on its own line of the record, its failure beside it; a typed figure's form */
.pe-gd .pe-step {display:flex;align-items:center;justify-content:flex-end;gap:8px;}
.pe-gd .pe-step .btn {min-width:44px;padding:0;font-size:var(--t-room);line-height:1;}
.pe-gd .pe-lvn {min-width:28px;font-family:var(--mono);font-size:var(--t-room);line-height:28px;text-align:center;color:var(--ink);}
.pe-gd .pe-say:not(:empty) {color:var(--ink);}
.pe-gd .pe-facts {border-block:1px solid var(--line);}
.pe-gd .pe-fact {display:grid;grid-template-columns:minmax(72px,1fr) minmax(0,3fr);align-items:baseline;gap:12px;padding:12px 0;}
.pe-gd .pe-fact + .pe-fact {border-top:1px solid var(--line);}
.pe-gd .pe-fact > :last-child {text-align:right;overflow-wrap:anywhere;}
.pe-gd .pe-key {color:var(--muted);font-size:var(--t-meta);}
.pe-gd .pe-fact.pe-stepf {align-items:center;padding:4px 0;}
.pe-gd .pe-edit {display:grid;gap:16px;}

/* NOT READ: the one line and its next step */
.pe-goals .pe-none {display:flex;align-items:center;justify-content:space-between;gap:12px;}
.pe-goals .pe-none p {margin:0;color:var(--muted);}

@container glance (max-width:719px) {
  /* the bar keeps 96px whatever the figure: a wide one ("$12,400 of $13,000") breaks before its goal instead */
  .pe-goals .pe-stats {grid-template-columns:minmax(68px,max-content) minmax(32px,1fr) minmax(0,max-content) 16px;column-gap:12px;}
  .pe-goals .pe-st .rv-g-bv {white-space:normal;}
  .pe-goals .pe-of {display:inline-block;padding-left:.3em;white-space:nowrap;}
  .pe-goals .pe-st {min-height:44px;}
  .pe-goals .pe-st .rv-g-bl {flex-direction:column;align-items:flex-start;justify-content:center;}
  .pe-goals .pe-lv {display:block;color:var(--muted);font-size:var(--t-meta);line-height:16px;font-weight:var(--w-row);}
  .pe-goals .pe-lvw {display:none;}
  .pe-goals .pe-day i {height:5px;}
  .pe-goals .pe-strip {column-gap:2px;}
}
