/* ShopWatt Jobs skin: Tessera by KreativSpace, applied over Pico's structure.
 * Tokens come verbatim from tessera-tokens.css; nothing here hardcodes a colour, font, shadow or radius.
 * Pico's variables are remapped to the tokens first, then the Tessera component recipes are applied to the
 * markup the app already uses (article cards, tables, forms, dialogs, the drop zone). */

:root, :root[data-theme="light"], :root:not([data-theme]), :root[data-theme="dark"] {
  --pico-font-family: var(--app-font-family);
  --pico-font-size: 100%;
  --pico-line-height: 1.5;
  --pico-border-radius: var(--radius-md);
  --pico-background-color: var(--bg);
  --pico-color: var(--ink);
  --pico-h1-color: var(--ink); --pico-h2-color: var(--ink); --pico-h3-color: var(--ink); --pico-h4-color: var(--ink); --pico-h5-color: var(--ink); --pico-h6-color: var(--ink);
  --pico-muted-color: var(--ink-mute);
  --pico-muted-border-color: var(--border-soft);
  --pico-primary: var(--accent);
  --pico-primary-background: var(--accent);
  --pico-primary-border: var(--accent);
  --pico-primary-hover: var(--accent-hi);
  --pico-primary-hover-background: var(--accent-hi);
  --pico-primary-hover-border: var(--accent-hi);
  --pico-primary-underline: var(--accent-soft);
  --pico-primary-hover-underline: var(--accent);
  --pico-primary-focus: var(--accent-soft);
  --pico-primary-inverse: #fff;
  --pico-secondary: var(--ink-dim);
  --pico-secondary-background: var(--panel-tint);
  --pico-secondary-border: var(--border);
  --pico-secondary-hover: var(--ink);
  --pico-secondary-hover-background: var(--panel-hi);
  --pico-secondary-hover-border: var(--ink-subtle);
  --pico-secondary-inverse: var(--ink);
  --pico-secondary-focus: var(--accent-soft);
  --pico-card-background-color: var(--panel);
  --pico-card-border-color: var(--border);
  --pico-card-sectioning-background-color: var(--panel-tint);
  --pico-card-box-shadow: var(--shadow-soft);
  --pico-form-element-background-color: var(--panel);
  --pico-form-element-border-color: var(--border);
  --pico-form-element-color: var(--ink);
  --pico-form-element-placeholder-color: var(--ink-mute);
  --pico-form-element-active-border-color: var(--accent);
  --pico-form-element-focus-color: var(--accent-soft);
  --pico-form-element-disabled-background-color: var(--panel-tint);
  --pico-mark-background-color: var(--warn-soft);
  --pico-mark-color: var(--warn-soft-ink);
  --pico-ins-color: var(--ok);
  --pico-del-color: var(--err);
  --pico-table-border-color: var(--border-soft);
  --pico-table-row-stripped-background-color: var(--panel-tint);
  --pico-modal-overlay-background-color: rgba(25, 21, 18, 0.45);
  --pico-code-background-color: var(--panel-tint);
  --pico-code-color: var(--ink-dim);
  --pico-blockquote-border-color: var(--border);
  --pico-contrast: var(--ink);
  --pico-contrast-background: var(--ink);
  --pico-contrast-inverse: var(--panel);
}

html, body { background: var(--bg); color: var(--ink); font-family: var(--app-font-family); }
body { font-size: 14px; }
select, option, input, textarea, button { font-family: inherit; }

/* Wordmark and navigation */
nav.container { padding-top: .9rem; padding-bottom: .4rem; }
nav .wordmark { font-family: var(--font-display); font-size: 26px; font-weight: 600; letter-spacing: -0.005em; color: var(--ink); text-decoration: none; line-height: 1; }
nav .wordmark:hover { color: var(--accent); }
nav .eyebrow { display: block; font-family: var(--font-mono); font-size: 10px; letter-spacing: .18em; text-transform: uppercase; color: var(--ink-mute); margin-top: 4px; }
nav ul li a:not(.wordmark) { font-size: 13px; font-weight: 500; color: var(--ink-dim); }
nav ul li a:not(.wordmark):hover { color: var(--accent-ink); }
nav ul li a.active { color: var(--accent-ink); font-weight: 600; }

/* Headings */
h2 { font-family: var(--font-display); font-size: 30px; font-weight: 600; letter-spacing: -0.005em; margin-bottom: .6rem; }
h2 small, h2 .muted { font-family: var(--font-body); font-size: 14px; font-weight: 400; letter-spacing: 0; }
h3 { font-family: var(--font-display); font-size: 22px; font-weight: 600; }
h4, h5 { font-family: var(--font-body); font-size: 15px; font-weight: 600; margin-bottom: .5rem; }
h4 small { font-weight: 400; }

/* Cards */
article { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-soft); transition: box-shadow .18s; }
article.machine.running { box-shadow: var(--shadow), inset 0 0 0 1px var(--accent-softer); border-left: 4px solid var(--accent); }
article header { font-size: 15px; }
article header small { color: var(--ink-mute); font-weight: 400; }

/* Buttons: primary = terracotta, outline/secondary = ghost */
button, [role="button"], input[type="submit"] { font-size: 13px; font-weight: 600; border-radius: var(--radius-md); padding: 10px 18px; }
button:not(.outline):not(.secondary), [role="button"]:not(.outline):not(.secondary) { background: var(--accent); border-color: var(--accent); color: #fff; box-shadow: var(--shadow-press); transition: background .15s, transform .1s, box-shadow .15s; }
button:not(.outline):not(.secondary):hover { background: var(--accent-hi); border-color: var(--accent-hi); }
button:active { transform: scale(0.98); }
button.outline, button.secondary, [role="button"].outline, [role="button"].secondary { background: var(--panel-tint); border: 1px solid var(--border); color: var(--ink); font-weight: 500; box-shadow: none; }
button.outline:hover, button.secondary:hover { background: var(--panel-hi); border-color: var(--ink-subtle); color: var(--ink); }
button.secondary.outline { color: var(--ink-dim); }

/* Fields */
label { font-size: 12.5px; font-weight: 500; color: var(--ink); }
input, select, textarea { border-radius: var(--radius-sm); font-size: 13px; padding: 7px 9px; height: auto; margin-bottom: .75rem; }
input[type="number"] { font-family: var(--font-mono); text-align: right; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
details summary { font-size: 13px; font-weight: 500; color: var(--ink-dim); }
details summary:hover { color: var(--accent-ink); }

/* Tables */
table { font-size: 13px; }
thead th { font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-mute); font-weight: 500; border-bottom: 1px solid var(--border); }
table.compact td, table.compact th { padding: .4rem .55rem; }
tbody tr:hover { background: var(--panel-tint); }
.num, .live, td.num, th.num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
tfoot td, tr th.num { font-family: var(--font-mono); }

/* Pills for statuses */
.pill { display: inline-flex; align-items: center; padding: 2px 9px; border-radius: 999px; font-size: 11px; font-weight: 500; white-space: nowrap; background: var(--panel-tint); color: var(--ink-dim); border: 1px solid var(--border-soft); }
.pill-running { background: var(--accent-soft); color: var(--accent-ink); border-color: transparent; }
a.pill { text-decoration: none; }
a.pill:hover { text-decoration: underline; text-underline-offset: 2px; }
.pill-finished, .pill-done, .pill-delivered, .pill-active { background: var(--ok-soft-bg); color: var(--ok); border-color: transparent; }
.pill-failed, .pill-aborted, .pill-down { background: var(--err-soft-bg); color: var(--err-soft-ink); border-color: var(--err-soft-border); }
.pill-auto_stopped, .pill-quoted { background: var(--warn-soft); color: var(--warn-soft-ink); border-color: transparent; }
.inuse { color: var(--ok); font-weight: 600; }
mark { border-radius: 4px; padding: 1px 6px; font-size: .85em; border: 1px solid var(--warn); }

/* Machine cards */
.cards { gap: 1rem; }
article.machine { padding: 1rem 1.1rem; }
article.machine header { padding: 0 0 .5rem; margin: 0 0 .5rem; border-bottom: 1px solid var(--border-soft); background: transparent; }
article.machine header strong { font-family: var(--font-display); font-size: 20px; font-weight: 600; letter-spacing: -0.005em; }
/* The card header is a 2x2 grid: name top-left, in-use chip top-right, wattage bottom-left and a
 * running print's progress pill bottom-right. The live span (swapped by HTMX every 10 s) is
 * display: contents, so the chips it contains take the grid cells directly. */
article.machine header { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "name status" "draw pill"; align-items: center; column-gap: .75rem; row-gap: .35rem; }
article.machine header > span:first-child { grid-area: name; min-width: 0; }
article.machine .live { display: contents; font-size: 13px; color: var(--ink-dim); }
article.machine .live .status { grid-area: status; justify-self: end; }
article.machine .live .draw { grid-area: draw; }
article.machine .live .progress { grid-area: pill; justify-self: end; }
.status { font-family: var(--font-mono); font-size: 12px; font-weight: 600; white-space: nowrap; }
.status.on { color: var(--ink-dim); font-weight: 500; }
.status.off { color: var(--ink-mute); font-weight: 500; }
/* Progress pill: a track with the percentage, and a gradient fill that clips to the same label so the
 * text stays readable on both halves. --p is the percentage, set inline. */
.progress { position: relative; display: inline-block; width: 92px; height: 18px; border-radius: 999px; overflow: hidden; background: var(--accent-softer); border: 1px solid var(--accent-soft); vertical-align: middle; flex: 0 0 auto; }
.progress-track, .progress-fill { position: absolute; top: 0; bottom: 0; left: 0; }
.progress-track { right: 0; color: var(--accent-ink); }
.progress-fill { width: var(--p, 0%); min-width: 6px; overflow: hidden; border-radius: 999px; background: linear-gradient(90deg, var(--accent), var(--accent-hi)); color: #fff; /* same as the primary button's text */ transition: width .6s ease; }
.progress-label { position: absolute; top: 0; bottom: 0; left: 0; width: 90px; display: flex; align-items: center; justify-content: center; font-family: var(--font-mono); font-size: 11px; font-weight: 600; letter-spacing: .02em; font-variant-numeric: tabular-nums; white-space: nowrap; }
article.machine form { margin: 0; }
article.machine .grid { gap: .5rem; }
/* Cards are flex columns so the action row sits at the bottom of every card in a row, with the
 * edit link on the left and the buttons on the right: Stop is never next to what you meant to click. */
article.machine { display: flex; flex-direction: column; }
article.machine form.start { display: flex; flex-direction: column; flex: 1; }
article.machine .card-actions { margin: auto 0 0; padding: .75rem 0 0; border-top: 1px solid var(--border-soft); background: transparent; display: flex; justify-content: space-between; align-items: center; gap: .75rem; }
article.machine .card-actions .buttons { display: flex; gap: .5rem; }
article.machine .card-actions form { margin: 0; }
article.machine .card-actions button { width: auto; margin: 0; padding: 8px 16px; }
article.machine .card-actions .edit-link { font-size: 12.5px; font-weight: 500; color: var(--ink-dim); }
article.machine .card-actions .edit-link:hover { color: var(--accent-ink); }

/* Job page: the summary line is a flex row (a form cannot live inside a <p>), with the inline customer
 * assign/change form and the status select on it. */
.job-summary { display: flex; flex-wrap: wrap; align-items: center; gap: .2rem .45rem; margin: 0 0 1rem; }
.job-summary form.inline, .job-summary form.inline select { margin: 0; }
form.customer-set { display: inline-flex; align-items: center; gap: .3rem; margin: 0 .2rem; vertical-align: middle; }
form.customer-set input { width: 13rem; margin: 0; padding: .1rem .5rem; font-size: 13px; height: auto; }
form.customer-set button { width: auto; margin: 0; padding: .1rem .6rem; font-size: 12px; }
details.job-edit { margin: 0 0 1.2rem; }
details.job-edit summary { font-size: 13px; font-weight: 500; color: var(--ink-dim); cursor: pointer; width: max-content; }
details.job-edit summary:hover { color: var(--accent-ink); }
details.job-edit form { margin: .6rem 0 0; padding: .9rem 1rem; background: var(--panel-tint); border: 1px solid var(--border-soft); border-radius: var(--radius-md); }
details.job-edit .grid { gap: .6rem; }
details.job-edit button { width: auto; padding: 8px 18px; margin: 0; }
p.job-notes { white-space: pre-line; }
/* Machine card: attach a job to a run that has none, without leaving the card. */
form.attach-job { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; margin: 0 0 .7rem; }
form.attach-job select { flex: 1 1 12rem; margin: 0; padding: .3rem .6rem; font-size: 13px; height: auto; }
form.attach-job button { width: auto; margin: 0; padding: .3rem .8rem; font-size: 12.5px; }
form.attach-job .new-job { flex-basis: 100%; display: grid; grid-template-columns: 1fr 1fr; gap: .4rem; }
form.attach-job .new-job[hidden] { display: none; }
form.attach-job .new-job input { margin: 0; padding: .3rem .6rem; font-size: 13px; height: auto; }
/* Power day view: the draw line, run bands, candidate stretches, and the add-runs form. */
.day-nav { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.day-nav a { font-family: var(--font-mono); font-size: 12px; letter-spacing: .08em; text-transform: uppercase; }
.chart path.area { fill: var(--accent); opacity: .16; }
.chart path.line { fill: none; stroke: var(--accent); stroke-width: 1.4; stroke-linejoin: round; }
.chart path.area, .chart path.line { pointer-events: none; }
.chart rect.band-run { fill: var(--accent-soft); opacity: .55; }
.chart rect.band-cand { fill: var(--warn-soft); opacity: .8; stroke: var(--warn); stroke-width: 1; stroke-dasharray: 4 3; cursor: pointer; }
.chart rect.band-cand.picked { stroke: var(--accent); fill: var(--accent-soft); }
.chart line.now { stroke: var(--ink-subtle); stroke-dasharray: 2 3; }
.chart text.band-label { font-size: 10px; fill: var(--ink-dim); }
.legend { display: flex; gap: 1rem; font-size: 12px; color: var(--ink-dim); margin: .3rem 0 .8rem; }
.legend i { display: inline-block; width: 14px; height: 10px; vertical-align: -1px; margin-right: 5px; border-radius: 2px; }
.legend i.run { background: var(--accent-soft); }
.legend i.cand { background: var(--warn-soft); border: 1px dashed var(--warn); }
table.cands td.pick { width: 2rem; }
table.cands input[type=checkbox] { margin: 0; }
form.add-runs { margin: .8rem 0 0; padding: .9rem 1rem; background: var(--panel-tint); border: 1px solid var(--border-soft); border-radius: var(--radius-md); }
form.add-runs .grid { gap: .6rem; }
form.add-runs fieldset { margin: 0 0 .6rem; padding: 0; border: 0; }
form.add-runs fieldset label { display: inline-flex; align-items: center; gap: .35rem; margin: 0 1rem 0 0; font-size: 13px; }
form.add-runs button { width: auto; padding: 8px 18px; margin: 0; }
form.add-runs .new-job[hidden] { display: none; }
form.add-runs .custom { font-size: 13px; color: var(--ink-dim); }
form.add-runs .custom input { width: auto; display: inline-block; margin: 0 .3rem; padding: .2rem .5rem; font-size: 13px; height: auto; }
/* Files: thumbnails, drop zone, browser */
.thumb { background: var(--sheet-paper); border: 1px solid var(--border-soft); border-radius: var(--radius-sm); }
.thumb-placeholder { background: linear-gradient(135deg, var(--thumb-grad-start), var(--thumb-grad-end)); color: var(--panel); font-family: var(--font-mono); font-size: 12px; letter-spacing: .12em; border-radius: var(--radius-sm); }
.dropzone { border: 2px dashed var(--border); border-radius: var(--radius-lg); background: var(--panel-tint); color: var(--ink-dim); font-size: 13px; padding: 1.2rem 1rem; }
.dropzone strong { color: var(--ink); }
.dropzone.over { border-color: var(--accent); background: var(--accent-softer); color: var(--accent-ink); }
#nas-browser table { margin-bottom: .5rem; }
#nas-browser a svg { vertical-align: -3px; margin-right: 4px; stroke: var(--accent); }

/* Dialog */
dialog { background: rgba(25, 21, 18, 0.35); backdrop-filter: blur(2px); }
dialog article { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); padding: 1.4rem 1.6rem; }
dialog article header { background: transparent; border-bottom: 1px solid var(--border-soft); padding: 0 0 .6rem; margin: 0 0 .8rem; }
dialog article header strong { font-family: var(--font-display); font-size: 24px; font-weight: 600; letter-spacing: -0.005em; }
dialog article footer { background: transparent; border-top: 1px solid var(--border-soft); padding: .8rem 0 0; margin: .8rem 0 0; display: flex; gap: .5rem; justify-content: flex-end; }
dialog article footer button, dialog article footer [role="button"] { width: auto; margin: 0; }

/* Dashboard: stat blocks, draw bars, period tabs, the history chart */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .75rem; margin-bottom: 1.1rem; }
.stat { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-soft); padding: .75rem 1rem .65rem; }
.stat .eyebrow { display: block; font-family: var(--font-mono); font-size: 10px; letter-spacing: .18em; text-transform: uppercase; color: var(--ink-mute); margin-bottom: 2px; }
.stat .value { display: block; font-family: var(--font-display); font-size: 30px; font-weight: 600; letter-spacing: -0.005em; line-height: 1.15; color: var(--ink); font-variant-numeric: tabular-nums; }
.stat .value small { font-family: var(--font-mono); font-size: 11px; letter-spacing: .08em; color: var(--ink-mute); }
.section-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; flex-wrap: wrap; margin-top: .4rem; }
.section-head h3 { margin-bottom: .4rem; }
table.draw, table.ranking { margin-bottom: 1.2rem; }
td.bar, th.bar { width: 30%; }
td.rank { color: var(--ink-mute); width: 2.2em; }
.bar-track { height: 10px; background: var(--panel-tint); border: 1px solid var(--border-soft); border-radius: 999px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 999px; background: var(--accent); transition: width .5s ease; }
tr.offline td, tr.offline td strong { color: var(--ink-subtle); }
.swatch { display: inline-block; width: 10px; height: 10px; border-radius: 3px; vertical-align: -1px; margin-right: 7px; }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: .4rem; }
.tabs a { font-family: var(--font-mono); font-size: 11px; letter-spacing: .12em; text-transform: uppercase; font-weight: 500; padding: 4px 11px; border-radius: 999px; border: 1px solid var(--border-soft); background: var(--panel-tint); color: var(--ink-dim); text-decoration: none; }
.tabs a:hover { color: var(--accent-ink); border-color: var(--border); }
.tabs a.active { background: var(--accent-soft); color: var(--accent-ink); border-color: transparent; }
.tabs a .count { opacity: .6; margin-left: 4px; }
.section-head h2 { margin-bottom: .6rem; }
.chart { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-soft); padding: .6rem .6rem .2rem; margin-bottom: 1rem; }
.chart svg { width: 100%; height: auto; display: block; }
.chart text { font-family: var(--font-mono); font-size: 11px; fill: var(--ink-mute); }
.chart text.unit { letter-spacing: .12em; text-transform: uppercase; font-size: 10px; }
.chart line.grid { stroke: var(--border-soft); stroke-width: 1; }
.chart rect { transition: opacity .15s; }
.chart rect:hover { opacity: .8; }
.scroll-x { overflow-x: auto; }
/* Camera tiles on the dashboard */
.cams { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 1rem; margin-bottom: 1.2rem; }
figure.cam { margin: 0; background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-soft); overflow: hidden; position: relative; }
figure.cam img { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; background: var(--viewport-bg); }
figure.cam .cam-off { display: none; aspect-ratio: 16 / 9; flex-direction: column; align-items: center; justify-content: center; gap: 4px; background: var(--viewport-bg); color: var(--ink-subtle); font-family: var(--font-mono); font-size: 11px; letter-spacing: .12em; text-transform: uppercase; }
figure.cam.off img { display: none; }
figure.cam.off .cam-off { display: flex; }
figure.cam figcaption { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; padding: .55rem .9rem; font-size: 13px; }
/* The tile's state sits in the picture's top-left corner, opposite the full-screen button: the progress
 * pill while printing, else the printer's state word on the same glass as that button. */
figure.cam .cam-state { position: absolute; top: 8px; left: 8px; z-index: 2; display: inline-flex; align-items: center; }
figure.cam .cam-state .progress { box-shadow: var(--shadow-soft); }
figure.cam .cam-state .word { display: inline-flex; align-items: center; height: 20px; padding: 0 10px; border-radius: 999px; background: rgba(25, 21, 18, 0.55); border: 1px solid rgba(255, 255, 255, 0.18); color: #fff; font-family: var(--font-mono); font-size: 11px; letter-spacing: .04em; }
/* Hovering (or focusing) the file name in a caption shows the print's cover picture from HA. */
figure.cam figcaption .task { position: relative; min-width: 0; }
figure.cam figcaption .task.has-cover { cursor: help; }
figure.cam figcaption .task.has-cover small { text-decoration: underline dotted; text-underline-offset: 3px; text-decoration-color: var(--ink-subtle); }
figure.cam figcaption .cover-pop { display: none; position: absolute; left: 0; bottom: calc(100% + 10px); z-index: 3; width: 186px; padding: 5px; background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius-md); box-shadow: var(--shadow-soft); }
figure.cam figcaption .cover-pop img { display: block; width: 176px; max-width: none; height: 176px; aspect-ratio: auto; object-fit: contain; border-radius: var(--radius-sm); background: var(--panel-tint); }
figure.cam figcaption .task.has-cover:hover .cover-pop, figure.cam figcaption .task.has-cover:focus .cover-pop, figure.cam figcaption .task.has-cover:focus-within .cover-pop { display: block; }
figure.cam figcaption strong { font-family: var(--font-display); font-size: 18px; font-weight: 600; }
figure.cam figcaption .num { color: var(--ink-dim); }
button.cam-full { position: absolute; top: 8px; right: 8px; width: 30px; height: 30px; padding: 0; display: inline-flex; align-items: center; justify-content: center; border-radius: var(--radius-sm); background: rgba(25, 21, 18, 0.55); border: 1px solid rgba(255, 255, 255, 0.18); color: #fff; box-shadow: none; }
button.cam-full:hover { background: var(--accent); border-color: var(--accent); }
figure.cam-strip { position: relative; margin: 0 0 .7rem; border-radius: var(--radius-md); overflow: hidden; border: 1px solid var(--border-soft); background: var(--viewport-bg); }
figure.cam-strip img { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; }
figure.cam-strip.off { display: none; }
dialog.cam-viewer { background: var(--viewport-bg); padding: 0; border: 0; max-width: 100vw; max-height: 100vh; width: 100vw; height: 100vh; }
dialog.cam-viewer figure { margin: 0; width: 100%; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; }
dialog.cam-viewer img { max-width: 100vw; max-height: calc(100vh - 2.4rem); object-fit: contain; }
dialog.cam-viewer figcaption { color: var(--ink-subtle); font-family: var(--font-mono); font-size: 11px; letter-spacing: .12em; text-transform: uppercase; padding: .5rem; }
@media (max-width: 640px) {
  td.bar, th.bar { display: none; }
  .stat .value { font-size: 24px; }
}

/* The ledger: a spreadsheet look, gridlines both ways, frozen header and first columns, totals row */
.sheet-tools { display: flex; align-items: center; gap: 1rem; margin: .2rem 0 .6rem; }
.sheet-tools { flex-wrap: wrap; }
.sheet-tools input { max-width: 22rem; margin: 0; }
.sheet-filters { display: inline-flex; align-items: center; gap: .4rem; flex-wrap: wrap; margin: 0; }
.sheet-filters label { display: inline-flex; align-items: center; gap: .3rem; margin: 0; font-size: 12.5px; color: var(--ink-dim); }
.sheet-filters select, .sheet-filters input[type=date] { width: auto; margin: 0; padding: .15rem .5rem; font-size: 13px; height: auto; }
.sheet-filters select { padding-right: 1.8rem; }
.sheet-filters button { width: auto; margin: 0; padding: .15rem .7rem; font-size: 12px; }
.sheet-filters a { font-size: 12.5px; }
.sheet-wrap { border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--panel); box-shadow: var(--shadow-soft); max-height: 72vh; overflow: auto; margin-bottom: .6rem; }
table.sheet { border-collapse: separate; border-spacing: 0; font-size: 12.5px; width: max-content; min-width: 100%; margin: 0; }
table.sheet th, table.sheet td { border-right: 1px solid var(--border-soft); border-bottom: 1px solid var(--border-soft); padding: .3rem .55rem; white-space: nowrap; background: var(--panel); }
table.sheet thead th { position: sticky; top: 0; z-index: 3; background: var(--panel-tint); border-bottom: 1px solid var(--border); cursor: pointer; user-select: none; }
table.sheet thead th[data-dir="asc"]::after { content: " ▲"; color: var(--accent); } table.sheet thead th[data-dir="desc"]::after { content: " ▼"; color: var(--accent); }
table.sheet .gutter { position: sticky; left: 0; z-index: 2; width: 2.4em; text-align: right; color: var(--ink-subtle); background: var(--panel-tint); font-family: var(--font-mono); font-size: 11px; }
table.sheet thead th.gutter { z-index: 4; }
table.sheet td:nth-child(2), table.sheet th:nth-child(2) { position: sticky; left: 2.4em; z-index: 2; box-shadow: 1px 0 0 var(--border); }
table.sheet thead th:nth-child(2) { z-index: 4; }
table.sheet tbody tr:nth-child(even) td { background: var(--panel-tint); }
table.sheet tbody tr:hover td { background: var(--accent-softer); }
table.sheet td.int, table.sheet td.num1, table.sheet td.num3, table.sheet td.money, table.sheet td.hours, table.sheet td.pct, table.sheet th.int, table.sheet th.num1, table.sheet th.num3, table.sheet th.money, table.sheet th.hours, table.sheet th.pct { text-align: right; font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
table.sheet td.text.title-cell { max-width: 24rem; overflow: hidden; text-overflow: ellipsis; }
table.sheet td.sel { outline: 2px solid var(--accent); outline-offset: -2px; }
table.sheet tfoot td { position: sticky; bottom: 0; z-index: 3; background: var(--panel-tint); border-top: 2px solid var(--border); font-weight: 600; font-family: var(--font-mono); }
table.sheet tfoot td.gutter { z-index: 4; }
.tabs a.dl { border-style: dashed; }

/* Footer, misc */
footer.container { font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-subtle); padding-top: 1.5rem; }
a { color: var(--accent-ink); text-decoration-color: var(--accent-soft); }
a:hover { color: var(--accent); }
.muted { color: var(--ink-mute); }
hr { border-color: var(--border-soft); }
