/* Bloomward — the right-hand sheet (js/ui/panels.js): dashboard and colony panels. */

:root { --side-w: calc(384px + (var(--ui-scale) - 1) * 320px); }

/* the patch's goals, on the dashboard */
.dash-goals { margin: 4px 0 16px; padding: 10px 0 4px; border-top: 1px solid var(--rule-soft); border-bottom: 1px solid var(--rule-soft); }
.dash-goals h3 { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; font-size: var(--fs-m) !important; margin: 0 0 6px !important; }
.dash-goals .goals { list-style: none; margin: 0; padding: 0; font-size: var(--fs-s); }
.dash-goals li { display: grid; grid-template-columns: 1.3em 1fr auto; gap: 6px; align-items: baseline; padding: 3px 0; color: var(--ink-2); }
.dash-goals .g-mark { color: var(--ink-3); text-align: center; }
.dash-goals .g-met .g-mark { color: var(--moss); font-weight: 600; }
.dash-goals .g-met .g-text { color: var(--ink); }
.dash-goals .g-missed .g-mark, .dash-goals .g-missed .g-note { color: var(--rust); }
.dash-goals .g-note { font-size: var(--fs-xs); color: var(--ink-3); font-style: italic; font-family: var(--serif); }

#side.side { position: fixed; top: 14px; right: 14px; bottom: 14px; width: var(--side-w); z-index: 20; display: flex; flex-direction: column;
  transform: translateX(calc(100% + 30px)); opacity: 0; pointer-events: none; visibility: hidden;
  transition: transform var(--t-med) var(--ease), opacity var(--t-med) var(--ease), visibility 0s linear var(--t-med);
  --spark-ink: var(--ink-2); --spark-soft: var(--rule); }
#side.side.open { transform: none; opacity: 1; pointer-events: auto; visibility: visible; transition-delay: 0s; }
@media (max-width: 900px) { :root { --side-w: min(384px, calc(100vw - 28px)); } }

.pn-top { display: flex; align-items: flex-end; gap: 6px; padding: 8px 8px 0 18px; border-bottom: 1px solid var(--rule); }
.pn-tabs { flex: 1; min-width: 0; border-bottom: 0; gap: 16px; overflow-x: auto; scrollbar-width: none; }
.pn-tabs button { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; font-size: var(--fs-s); padding: 9px 0 8px; }
.pn-tabs button svg { width: 15px; height: 15px; opacity: .8; }
.pn-tabs button.dead { text-decoration: line-through; text-decoration-thickness: 1px; }
.pn-close { padding: 4px; margin-bottom: 4px; border-radius: 50%; line-height: 0; color: var(--ink-2); }
.pn-close svg { width: 16px; height: 16px; }
.pn-body { flex: 1; min-height: 0; padding: 16px 20px 28px; outline: none; }
.pn-empty { color: var(--ink-3); font-style: italic; font-family: var(--serif); }
.sheet h3 { font-size: var(--fs-m); font-family: var(--serif); letter-spacing: .01em; }
.sheet .hint { font-size: var(--fs-xs); color: var(--ink-3); line-height: 1.45; }
canvas.spark { display: block; width: 64px; height: 18px; }

/* ---------- dashboard ---------- */
.dash-head { padding-bottom: 6px; }
.dash-score { display: flex; align-items: baseline; gap: 8px; margin: 4px 0 2px; }
.dash-num { font-family: var(--serif); font-size: calc(46px * var(--ui-scale)); line-height: 1; color: var(--ink); }
.dash-of { font-size: var(--fs-xs); color: var(--ink-3); }
.dash-word { font-family: var(--serif); font-style: italic; color: var(--ink-2); font-size: var(--fs-m); flex: 1; }
.dash-score canvas.spark.wide { width: 96px; height: 28px; align-self: center; }
.dash-note { font-size: var(--fs-xs); line-height: 1.5 !important; margin: 6px 0 12px; }
.dash-note strong { font-weight: 600; color: var(--ink); }

.metrics { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--rule); }
.metric { border-bottom: 1px solid var(--rule-soft); }
.m-row { appearance: none; width: 100%; display: grid; grid-template-columns: minmax(0, 1fr) 54px 28px 64px 12px; align-items: center; gap: 10px; background: none; border: 0; padding: 9px 2px; cursor: pointer; text-align: left; color: var(--ink); }
.m-row:hover { background: linear-gradient(90deg, transparent, var(--paper-2) 12%, var(--paper-2) 88%, transparent); }
.m-name { font-size: var(--fs-s); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.metric.weakest .m-name::before { content: ""; display: inline-block; width: 5px; height: 5px; margin: 0 7px 1px 0; background: var(--rust); transform: rotate(45deg); }
.m-bar { height: 3px; background: var(--rule-soft); border-radius: 2px; position: relative; overflow: hidden; }
.m-bar i { position: absolute; left: 0; top: 0; bottom: 0; background: var(--ink-2); border-radius: 2px; }
.metric.weakest .m-bar i { background: var(--rust); }
.m-val { text-align: right; font-size: var(--fs-m); font-family: var(--serif); }
.m-row .chev { width: 12px; height: 12px; color: var(--ink-3); transition: transform var(--t-fast); }
.m-row[aria-expanded="true"] .chev { transform: rotate(90deg); }
.m-detail { padding: 2px 4px 14px; }
.m-what { font-size: var(--fs-xs); margin: 0 0 8px; font-style: italic; font-family: var(--serif); }
.facts { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 3px 12px; margin: 0 0 8px; font-size: var(--fs-xs); }
.facts dt { color: var(--ink-3); }
.facts dd { margin: 0; color: var(--ink); text-align: right; display: flex; align-items: center; justify-content: flex-end; gap: 8px; }
.facts .share { width: 60px; height: 3px; background: var(--rule-soft); border-radius: 2px; position: relative; overflow: hidden; }
.facts .share i { position: absolute; left: 0; top: 0; bottom: 0; background: var(--moss); }
.m-cause { font-size: var(--fs-s); color: var(--ink) !important; margin: 6px 0 8px; padding-left: 10px; border-left: 2px solid var(--sage); line-height: 1.5 !important; }
.m-years { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: var(--fs-xs); color: var(--ink-2); align-items: baseline; }
.m-years .kicker { margin-right: 2px; }
.m-years b { font-weight: 500; color: var(--ink-3); }

.dash-records, .dash-edge { margin-top: 20px; }
.dash-records h3, .dash-edge h3 { margin-bottom: 8px; }
table.records { width: 100%; border-collapse: collapse; font-size: var(--fs-xs); }
table.records th, table.records td { padding: 4px 2px; text-align: right; border-bottom: 1px solid var(--rule-soft); font-weight: 400; }
table.records thead th { color: var(--ink-3); font-size: 10px; letter-spacing: .04em; text-transform: uppercase; border-bottom-color: var(--rule); }
table.records tbody th { text-align: left; color: var(--ink-2); }
table.records td b { font-weight: 600; }

ul.log { list-style: none; margin: 0; padding: 0; font-size: var(--fs-s); }
ul.log li { padding: 6px 0; border-bottom: 1px solid var(--rule-soft); color: var(--ink-2); line-height: 1.45; }
ul.log li:last-child { border-bottom: 0; }
ul.log .when { display: inline-block; min-width: 4.8em; margin-right: 8px; font-size: var(--fs-xs); color: var(--ink-3); font-variant-numeric: tabular-nums; }
ul.log li.quiet { color: var(--ink-3); font-style: italic; font-family: var(--serif); }
.mine { display: inline-block; font-size: 9.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--ochre); border: 1px solid rgba(185, 137, 47, .55); border-radius: 999px; padding: 0 6px; margin-right: 6px; vertical-align: 1px; line-height: 15px; white-space: nowrap; }
ul.log li.mine-note { color: var(--ink); }
ul.log .times { font-size: var(--fs-xs); color: var(--ink-3); font-style: italic; font-family: var(--serif); }
.dash-edge .caption { margin: -4px 0 6px; font-size: var(--fs-xs); }

/* ---------- colony panel ---------- */
.col-head .kicker { margin-bottom: 2px; }
.col-head h2 { font-size: var(--fs-xl); }
.col-sp { font-size: var(--fs-s); color: var(--ink-2); margin-top: 2px; }
.col-sp i { font-family: var(--serif); }
.col-state { font-family: var(--serif); font-style: italic; margin: 8px 0 4px !important; color: var(--ink) !important; }
.col-status { margin-top: 6px; }
dl.stats { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0; margin: 0; font-size: var(--fs-s); }
dl.stats dt, dl.stats dd { padding: 4px 0; border-bottom: 1px solid var(--rule-soft); }
dl.stats dt { color: var(--ink-3); }
dl.stats dd { margin: 0; padding-left: 14px; text-align: right; color: var(--ink); }
dl.stats dd.warn { color: var(--rust); }
dl.stats dd.warn::before { content: "▲ "; font-size: 8px; vertical-align: 2px; }
.col-sparks { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin: 12px 0 4px; }
.col-sparks figure { margin: 0; }
.col-sparks figcaption { font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.col-sparks canvas.spark { width: 100%; height: 24px; margin: 3px 0 1px; }
.col-sparks .cs-v { font-size: var(--fs-xs); color: var(--ink-2); }
.col-rules, .col-log, .ctl { margin-top: 20px; }
.col-rules h3, .col-log h3, .ctl h3 { padding-top: 12px; border-top: 1px solid var(--rule); margin-bottom: 6px; }
ul.rules { list-style: none; margin: 0; padding: 0; font-size: var(--fs-s); }
ul.rules li { padding: 5px 0 5px 12px; color: var(--ink-3); line-height: 1.45; position: relative; }
ul.rules li::before { content: ""; position: absolute; left: 0; top: 12px; width: 5px; height: 5px; border-radius: 50%; border: 1px solid var(--ink-3); }
ul.rules li.active { color: var(--ink); }
ul.rules li.active::before { background: var(--ink-2); border-color: var(--ink-2); }
ul.rules li.cond { font-family: var(--serif); font-style: italic; }
ul.rules li.warn::before { background: var(--rust); border-color: var(--rust); border-radius: 0; transform: rotate(45deg); }

.ctl-note { font-size: var(--fs-xs); margin: 0 0 6px !important; color: var(--ink-3) !important; }
.ctl .field { margin: 8px 0 10px; gap: 0 12px; }
.ctl .field label { color: var(--ink); line-height: 1.35; }
.ctl .field.rng { grid-template-columns: minmax(0, 1fr) auto auto; margin: 4px 0 8px; }
.ctl .field.rng > label { grid-column: 1; grid-row: 1; }
.ctl .field.rng > .now { grid-column: 2; grid-row: 1; font-size: var(--fs-xs); color: var(--ink-3); font-style: italic; font-family: var(--serif); }
.ctl .field.rng > output { grid-column: 3; grid-row: 1; min-width: 3.4em; }
.ctl .field.rng > input[type="range"] { grid-column: 1 / -1; grid-row: 2; }
.ctl .field.rng > .hint { grid-column: 1 / -1; margin-top: -2px; }
.ctl .field .hint { margin-top: 1px; }
.ctl .field.thr { grid-template-columns: minmax(0, 1fr) auto; }
.thr-in { display: inline-flex; align-items: baseline; gap: 4px; }
.thr-in input[type="number"] { width: 5.2em; background: transparent; }
.thr-in .unit { font-size: var(--fs-s); color: var(--ink-2); min-width: 1.4em; }
.field .hint.alt:empty, .field .hint.msg:empty { display: none; }
.field .hint.msg { color: var(--rust); }
.field.tog .seg { grid-column: 1 / -1; margin-top: 4px; justify-self: start; }
.field.tog .seg button { font-size: var(--fs-xs); }
.focus-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; }
.pool { font-size: var(--fs-s); color: var(--ink-2); display: inline-flex; align-items: center; gap: 8px; }
.pool .dots { display: inline-flex; gap: 4px; }
.pool .dots i { width: 8px; height: 8px; border-radius: 50%; border: 1px solid var(--ink-2); }
.pool .dots i.on { background: var(--ink-2); }
.focus-desc { margin: 6px 0 0; }
ul.items { list-style: none; margin: 4px 0 8px; padding: 0; font-size: var(--fs-s); }
ul.items li { display: flex; align-items: center; gap: 8px; padding: 5px 0; border-bottom: 1px solid var(--rule-soft); color: var(--ink-2); }
ul.items li .it { flex: 1; min-width: 0; }
ul.items li b { font-weight: 500; color: var(--ink); }
ul.items li.quiet { color: var(--ink-3); font-style: italic; font-family: var(--serif); border-bottom: 0; }
.zmark { width: 12px; height: 12px; border-radius: 50%; flex: none; border: 1.3px solid var(--ink-2); }
.zmark.prefer { background: var(--sage); border-color: var(--moss); }
.zmark.avoid { background: repeating-linear-gradient(45deg, var(--rust) 0 1.5px, transparent 1.5px 3.5px); border-color: var(--rust); }
.zmark.investigate { border-style: dashed; border-color: var(--sky); }
.bmark { width: 12px; height: 8px; border-radius: 50% 50% 40% 40%; border: 1.3px solid var(--ochre); flex: none; }
.bmark.done { background: var(--ochre); }
.btn-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.btn-row .btn, .btn.small { display: inline-flex; align-items: center; gap: 4px; }
.btn svg { width: 13px; height: 13px; }
