/* ============================================================
   PEDCAM — Screens and components
   ============================================================ */

/* The hidden attribute must win over component display rules (.alert, .field…). */
[hidden] { display: none !important; }

.screen { padding: 24px 28px 48px; max-width: 1400px; margin: 0 auto; }
@media (max-width: 700px) { .screen { padding: 16px; } }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.page-title { font-size: var(--fs-xl); font-weight: 800; letter-spacing: -.02em; margin: 0; color: var(--text); text-transform: uppercase; }
.page-sub { font-size: var(--fs-xs); color: var(--text-2); margin: 2px 0 0; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: var(--btn-h); padding: 0 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  font: 650 13px var(--font-ui); cursor: pointer; white-space: nowrap; text-decoration: none;
  transition: background .14s, border-color .14s, transform .1s;
}
.btn:hover { background: var(--surface-2); border-color: var(--border-strong); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: var(--primary-fg); }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn-accent { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-danger { color: var(--red); }
.btn-sm { height: var(--control-h-sm); padding: 0 10px; font-size: 12px; }
.btn-ghost { background: transparent; border-color: transparent; }

/* Cards */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); }
.card-pad { padding: 18px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.card-title { font-size: var(--fs-md); font-weight: 750; margin: 0; display: flex; align-items: center; gap: 8px; }
.card-title i { color: var(--primary); }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1100px) { .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid-3 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 700px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } }

/* KPI */
.kpi { padding: 14px 16px; position: relative; overflow: hidden; }
.kpi::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--primary); }
.kpi.k-accent::before { background: var(--accent); }
.kpi.k-navy::before { background: var(--navy); }
.kpi.k-green::before { background: var(--green); }
.kpi-label { font-size: var(--fs-3xs); font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--text-3); }
.kpi-value { font: 800 1.45rem var(--font-mono); color: var(--text); line-height: 1.25; margin-top: 2px; }
.kpi-sub { font-size: var(--fs-2xs); color: var(--text-2); }

/* Tables */
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: var(--fs-xs); }
.tbl th {
  text-align: left; padding: 9px 12px; background: var(--surface-2); color: var(--text-3);
  font-size: var(--fs-3xs); font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
  border-bottom: 1px solid var(--border); white-space: nowrap;
}
.tbl td { padding: 9px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; white-space: nowrap; }
.tbl tbody tr:hover { background: var(--surface-2); }
.tbl tr.clickable { cursor: pointer; }
.tbl .num, .tbl th.num { text-align: right; font-family: var(--font-mono); white-space: nowrap; }
.tbl tfoot td { font-weight: 800; background: var(--surface-2); border-top: 2px solid var(--primary); }
.tbl .muted { color: var(--text-3); }
.tbl-empty { text-align: center; color: var(--text-3); padding: 28px !important; }
.cell-main { font-weight: 650; color: var(--text); }
.cell-sub { font-size: var(--fs-3xs); color: var(--text-3); }

/* Badges */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 99px; font-size: var(--fs-3xs); font-weight: 700; white-space: nowrap; background: var(--surface-3); color: var(--text-2); }
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.b-green { background: var(--green-soft); color: var(--green); }
.badge.b-amber { background: var(--amber-soft); color: oklch(0.55 0.13 70); }
.badge.b-red { background: var(--red-soft); color: var(--red); }
.badge.b-blue { background: var(--primary-soft); color: var(--primary); }
.badge.b-indigo { background: var(--indigo-soft); color: var(--indigo); }
.badge.plain::before { display: none; }

/* Forms */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 14px; }
.form-grid .full { grid-column: 1 / -1; }
@media (max-width: 700px) { .form-grid { grid-template-columns: 1fr; } }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field > label, .field-label { font-size: var(--fs-2xs); font-weight: 700; color: var(--text-2); }
.field .hint { font-size: var(--fs-3xs); color: var(--text-3); }
.input, .select, textarea.input {
  width: 100%; height: var(--control-h); padding: 0 11px; line-height: normal; box-sizing: border-box;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text); font: 500 14px var(--font-ui);
}
textarea.input { height: auto; min-height: 70px; padding: 9px 11px; resize: vertical; }
.input.mono { font-family: var(--font-mono); }
.input:focus, .select:focus { outline: none; border-color: var(--primary); box-shadow: var(--ring); }
.input:disabled, .select:disabled { background: var(--surface-2); color: var(--text-3); }
.field.has-error .input, .field.has-error .select { border-color: var(--red); }
.field-error { font-size: var(--fs-3xs); color: var(--red); font-weight: 600; }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: var(--fs-xs); font-weight: 600; cursor: pointer; user-select: none; }
.check input { width: 16px; height: 16px; accent-color: var(--primary); }
.check-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 6px 12px; padding: 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); max-height: 220px; overflow: auto; }
.toggle-group { display: inline-grid; grid-auto-flow: column; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); overflow: hidden; }
.toggle-group { height: var(--control-h); }
.toggle-group button { height: 100%; border: none; background: var(--surface); color: var(--text-2); font: 650 13px var(--font-ui); padding: 0 12px; cursor: pointer; white-space: nowrap; }
.toggle-sides, .toggle-shot { display: grid; grid-auto-columns: 1fr; width: 100%; }
.toggle-sides button, .toggle-shot button { overflow: hidden; text-overflow: ellipsis; }
.toggle-group button.active { background: var(--primary); color: var(--primary-fg); }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.toolbar .input, .toolbar .select { width: auto; min-width: 150px; }

/* Dialog */
dialog.modal { border: none; border-radius: var(--radius-lg); padding: 0; width: min(680px, calc(100vw - 32px)); max-height: calc(100vh - 48px); background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg); }
dialog.modal::backdrop { background: rgba(15, 23, 42, .45); backdrop-filter: blur(2px); }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.modal-head h3 { margin: 0; font-size: var(--fs-lg); }
.modal-body { padding: 18px 20px; overflow: auto; max-height: calc(100vh - 190px); }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--border); background: var(--surface-2); }

/* Alerts & toast */
.alert { padding: 10px 14px; border-radius: var(--radius-sm); font-size: var(--fs-xs); font-weight: 600; display: flex; gap: 8px; align-items: flex-start; }
.alert-warn { background: var(--amber-soft); color: oklch(0.5 0.12 70); }
.alert-error { background: var(--red-soft); color: var(--red); }
.alert-info { background: var(--primary-soft); color: var(--primary); }
.alert ul { margin: 0; padding-left: 18px; }
.toast-host { position: fixed; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 100; }
.toast { background: var(--text); color: var(--surface); padding: 10px 14px; border-radius: var(--radius-sm); font-size: var(--fs-xs); font-weight: 650; box-shadow: var(--shadow-lg); animation: screen-in .25s; max-width: 360px; }
.toast.t-error { background: var(--red); color: #fff; }

/* Job editor */
.job-layout { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(320px, 1fr); gap: 16px; align-items: start; }
/* Long option texts (format presets) must not widen the form column. */
.job-layout > *, .job-layout .card, .form-grid > .field { min-width: 0; }
.select { max-width: 100%; text-overflow: ellipsis; }
@media (max-width: 1200px) { .job-layout { grid-template-columns: 1fr; } }
.sticky { position: sticky; top: 16px; }
.ink-grid td { padding: 6px 12px; }
.ink-grid .input { height: 32px; width: 92px; text-align: right; font-family: var(--font-mono); }
.ink-grid .input.on { border-color: var(--primary); background: var(--primary-softer); font-weight: 700; }
.swatch { width: 12px; height: 12px; border-radius: 3px; display: inline-block; box-shadow: 0 0 0 1px rgba(0,0,0,.15); flex-shrink: 0; }
.ink-name { display: flex; align-items: center; gap: 8px; }
.side-summary { display: flex; gap: 14px; flex-wrap: wrap; font-size: var(--fs-2xs); color: var(--text-2); padding: 10px 18px; border-top: 1px solid var(--border); }
.side-summary b { font-family: var(--font-mono); color: var(--text); }
.side-summary .over { color: var(--red); }
.calc-list { display: grid; grid-template-columns: 1fr auto; gap: 7px 12px; font-size: var(--fs-xs); }
.calc-list dt { color: var(--text-2); }
.calc-list dd { margin: 0; text-align: right; font-family: var(--font-mono); font-weight: 650; }
.calc-list .total { font-size: var(--fs-md); color: var(--accent); font-weight: 800; }
.calc-list hr { grid-column: 1 / -1; border: none; border-top: 1px solid var(--border); margin: 4px 0; }
.clicks-big { font: 800 2rem var(--font-mono); color: var(--primary); line-height: 1; }
.bar { height: 8px; border-radius: 99px; background: var(--surface-3); overflow: hidden; display: flex; }
.bar span { display: block; height: 100%; }

/* Login */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; background:
  radial-gradient(circle at 10% 10%, var(--primary-soft) 0, transparent 40%),
  radial-gradient(circle at 90% 90%, var(--accent-soft) 0, transparent 40%), var(--bg); }
.login-card { width: min(400px, 100%); padding: 28px; }
.login-logo img { display: block; width: 100%; max-width: 280px; height: auto; margin: 0 auto 10px; }
.login-card .tag { text-align: center; color: var(--text-3); font-size: var(--fs-2xs); margin-bottom: 20px; }
html:not(.auth) body { overflow: auto; }

.skeleton { color: var(--text-3); padding: 40px; text-align: center; }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; }

@media print {
  .sidebar, .shell-topbar, .page-actions, .toolbar, .btn, .toast-host { display: none !important; }
  .app { display: block; height: auto; }
  html, body, .app-main, .app-screen { overflow: visible !important; height: auto !important; }
  .card { box-shadow: none; break-inside: avoid; }
}

/* ============================================================
   Jobs & reports (unified view)
   ============================================================ */
.jobs-filters { align-items: center; }
.jobs-filters .filter-search { min-width: 220px; flex: 1 1 220px; }
.jobs-filters .filter-press { min-width: 220px; }
.jobs-filters .filter-date { width: 160px; min-width: 0; }
.jobs-filters .filter-group { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.jobs-filters .filter-label { font-size: var(--fs-2xs); font-weight: 700; color: var(--text-2); }
.jobs-filters .btn-filter-reset { color: var(--text-2); }
.jobs-kpis { margin-bottom: 16px; }
.alert-missing-prices { margin-bottom: 14px; }

.jobs-groups { margin-bottom: 16px; }
.jobs-groups > summary { cursor: pointer; list-style: none; }
.jobs-groups > summary::-webkit-details-marker { display: none; }
.jobs-groups > summary::after { content: '\F282'; font-family: bootstrap-icons; color: var(--text-3); transition: transform .2s; }
.jobs-groups[open] > summary::after { transform: rotate(180deg); }
.jobs-groups:not([open]) > summary { border-bottom: none; }
.jobs-groups-body { padding: 14px 18px; }

.jobs-table .col-toggle { width: 34px; padding-right: 0; }
.col-select { width: 34px; padding-right: 0 !important; }
.col-select input { width: 16px; height: 16px; accent-color: var(--primary); cursor: pointer; vertical-align: middle; }
.jobs-table tr.job-row.is-selected, .trash-table tr.is-selected { background: var(--primary-softer); }
/* Favourite star before the job name. */
.fav-toggle { border: 0; background: none; padding: 0 5px 0 0; cursor: pointer; color: var(--text-3); font-size: 13px; line-height: 1; vertical-align: -1px; }
.fav-toggle:hover, .fav-toggle.is-fav { color: var(--amber); }
.btn-filter-fav.active { background: var(--amber-soft); border-color: var(--amber); color: var(--text); }
.btn-filter-fav.active i { color: var(--amber); }
/* Batch bar: appears when jobs are selected. */
.batch-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; padding: 8px 12px;
  background: var(--primary-soft); border: 1px solid var(--primary-border); border-radius: var(--radius); }
.batch-count { font-weight: 700; font-size: var(--fs-sm); margin-right: auto; }
.trash-note { margin: 10px 2px 0; }
.trash-table .col-actions { width: 1%; }
.jobs-table .col-actions { width: 1%; }
.jobs-table tr.job-row { cursor: pointer; }
.jobs-table tr.job-row.is-open { background: var(--primary-softer); }
.row-toggle {
  width: 22px; height: 22px; font-size: 11px; border-radius: 50%; border: 1px solid var(--border);
  background: var(--surface); color: var(--text-2); cursor: pointer;
  display: inline-grid; place-items: center; transition: transform .2s, background .14s;
}
/* Bootstrap Icons sit on the text baseline (vertical-align: -.125em): center the glyph box instead. */
.row-toggle { padding: 0; line-height: 1; flex-shrink: 0; }
.row-toggle i { display: block; line-height: 1; }
.row-toggle i::before { display: block; vertical-align: 0; }
.row-toggle:hover { background: var(--primary-soft); color: var(--primary); }
.row-toggle[aria-expanded="true"] { transform: rotate(180deg); background: var(--primary-soft); color: var(--primary); }
.job-detail-row > td { background: var(--surface-2); padding: 0 !important; white-space: normal; }
/* Job detail: key figures on top, consumables table below; compact and aligned. */
/* 100cqi = width of the jobs card (container "jobs"): the panel never widens the table. */
.jobs-table tr.job-row.is-stale > td:first-child { box-shadow: inset 3px 0 0 var(--amber); }
/* Stale job: the code itself in amber, with the explanation on hover. */
.code-stale { color: var(--amber); font-weight: 700; cursor: help; text-decoration: underline dotted; text-underline-offset: 3px; }
/* The job name may wrap: a few pixels more must not turn the table into cards. */
.jobs-table td.col-name { white-space: normal; min-width: 160px; }
.jd-stale { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 6px 10px; border-radius: var(--radius-sm);
  background: var(--amber-soft); color: var(--text); font-size: var(--fs-xs); border: 1px solid var(--amber); }
.jd-stale > i { color: var(--amber); }
.jd-stale > span { flex: 1 1 260px; }
.job-detail { display: flex; flex-direction: column; gap: 8px; padding: 8px 10px 10px; width: 100cqi; box-sizing: border-box; }
.jd-summary { display: flex; flex-wrap: wrap; gap: 1px; background: var(--border);
  border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.jd-stat { flex: 1 0 auto; display: flex; flex-direction: column; gap: 1px; padding: 5px 10px; background: var(--surface); }
.jd-stat-label { font-size: var(--fs-3xs); font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--text-3); white-space: nowrap; }
.jd-stat-value { font: 700 var(--fs-sm) var(--font-mono); white-space: nowrap; }
.jd-stat-value small { font-size: var(--fs-3xs); font-weight: 500; color: var(--text-3); }
.jd-stat-total { background: var(--accent-soft); }
.jd-stat-total .jd-stat-value { color: var(--accent); font-size: var(--fs-md); font-weight: 800; }
.jd-table { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.tbl-job-detail { width: 100%; }
.tbl-job-detail th, .tbl-job-detail td { padding: 5px 10px; }
.tbl-job-detail tr.jd-group td { background: var(--surface-2); font-size: var(--fs-xs); padding-top: 6px; padding-bottom: 6px; }
.tbl-job-detail tr.jd-group td.jd-c-name { white-space: nowrap; }
.tbl-job-detail tr.jd-group td.num { font-weight: 700; }
.tbl-job-detail tr:not(.jd-group) > td.jd-c-name { padding-left: 20px; }
.tbl-job-detail .jd-c-cost { font-weight: 700; }
.tbl-job-detail tfoot td { border-top-width: 1px; }
.tbl-job-detail tfoot td.jd-c-cost { color: var(--accent); }
/* Drop secondary columns as the jobs card narrows (the table stacks as a last resort). */
@container jobs (max-width: 1080px) { .tbl-job-detail .jd-c-gsm { display: none !important; } }
@container jobs (max-width: 960px) { .tbl-job-detail .jd-c-share { display: none !important; } }
@container jobs (max-width: 900px) { .tbl-job-detail .jd-c-cov { display: none !important; } }
@container jobs (max-width: 780px) { .tbl-job-detail .jd-c-price { display: none !important; } }
@container jobs (max-width: 580px) { .tbl-job-detail .jd-c-weight { display: none !important; } }
@container jobs (max-width: 480px) {
  .tbl-job-detail .jd-c-use { display: none !important; }
  .tbl-job-detail th, .tbl-job-detail td { padding: 5px 8px; }
  .tbl-job-detail tr:not(.jd-group) > td.jd-c-name { padding-left: 14px; }
  .jd-stat { padding: 5px 8px; }
}
.tbl-compact td, .tbl-compact th { padding: 6px 10px; }
.tbl .wear-row td { background: var(--surface-2); }
.badge-oneshot { font-size: 10px; }

/* Job editor */
.field-label-hint { float: right; font-weight: 500; color: var(--primary); }
.shot-fixed { display: flex; align-items: center; gap: 8px; min-height: var(--control-h); }
.field-shot .hint, .field-sides .hint { max-width: 60ch; }

/* Prices */
.input-price { width: 112px; text-align: right; }
.input-param { width: 96px; text-align: right; }
.input-life { width: 112px; }
.input-rate { width: 84px; }
/* A parameter that differs from the catalog: the printshop's own value. */
.input-param.is-custom { border-color: var(--accent); background: var(--accent-soft); font-weight: 700; }
.tbl-prices .col-restore { width: 1%; }
.btn-restore { width: var(--control-h-sm); padding: 0; justify-content: center; }
.btn-restore:disabled { opacity: .35; cursor: default; }

/* ============================================================
   Job report (on screen). Print = report.php in a hidden frame.
   ============================================================ */
.report-kpis { margin-bottom: 14px; }
.report-warnings { margin-bottom: 14px; }
.report-grid { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 14px; margin-bottom: 14px; align-items: start; }
.report-grid > * { min-width: 0; }
@media (max-width: 1000px) { .report-grid { grid-template-columns: 1fr; } }
.report-card { box-shadow: none; }
.report-card .card-head { padding: 12px 16px; }
.report-breakdown, .report-weight { margin-bottom: 14px; }
.report-facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 18px; margin: 0; padding: 14px 16px; }
.report-facts dt { font-size: var(--fs-3xs); font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--text-3); }
.report-facts dd { margin: 2px 0 0; font-size: var(--fs-sm); font-weight: 650; overflow-wrap: anywhere; }
.report-notes { margin: 0; padding: 0 16px 14px; font-size: var(--fs-xs); color: var(--text-2); }
.report-cost-list { padding: 6px 16px 12px; }
.report-cost-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--border); }
.report-cost-name { display: flex; align-items: flex-start; gap: 9px; min-width: 0; font-size: var(--fs-sm); }
.report-cost-name .swatch { margin-top: 4px; flex-shrink: 0; }
.report-cost-val { text-align: right; font-family: var(--font-mono); font-size: var(--fs-sm); flex-shrink: 0; }
.report-cost-share { display: flex; align-items: center; justify-content: flex-end; gap: 6px; font-size: var(--fs-2xs); color: var(--text-2); margin-top: 3px; }
.report-cost-share .bar { width: 56px; height: 5px; }
.report-cost-total { display: flex; justify-content: space-between; align-items: baseline; padding-top: 12px; font-weight: 700; }
.report-cost-total b { font: 800 1.25rem var(--font-mono); color: var(--accent); }
.tbl-report tfoot td { font-weight: 800; border-top: 2px solid var(--border-strong); }
.tbl-report tfoot td.num:first-of-type { color: var(--accent); }
.report-weight-list { padding: 10px 16px 14px; display: grid; gap: 8px; }
.report-weight-row { display: grid; grid-template-columns: minmax(140px, 220px) 1fr auto; align-items: center; gap: 14px; font-size: var(--fs-xs); }
.report-weight-row .bar { height: 6px; }
.report-print-frame { position: fixed; width: 0; height: 0; border: 0; left: -9999px; top: 0; }

/* ============================================================
   Responsive tables
   1. The jobs table drops secondary columns as its container narrows.
   2. Any table that still does not fit gets .is-stacked on its .table-wrap
      (app.js fitTable): each row becomes a card, each cell "LABEL ..... value".
   ============================================================ */
.jobs-table-wrap { container: jobs / inline-size; }
@container jobs (max-width: 1330px) {
  .jobs-table .col-click-cost { display: none; }
  .jobs-table .btn-report { font-size: 0; gap: 0; width: var(--control-h-sm); padding: 0; justify-content: center; }
  .jobs-table .btn-report i { font-size: 14px; }
}
@container jobs (max-width: 1140px) { .jobs-table .col-mode, .jobs-table .col-clicks { display: none; } }
@container jobs (max-width: 940px) { .jobs-table .col-press, .jobs-table .col-date { display: none; } }

.table-wrap.is-stacked { overflow-x: visible; }
.table-wrap.is-stacked > table { display: block; width: 100%; min-width: 0; }
.table-wrap.is-stacked > table > thead { display: none; }
.table-wrap.is-stacked > table > tbody,
.table-wrap.is-stacked > table > tfoot { display: block; width: 100%; }
.table-wrap.is-stacked > table > * > tr { display: block; padding: 10px 14px; border-bottom: 1px solid var(--border); }
.table-wrap.is-stacked > table > tfoot > tr { background: var(--surface-2); border-top: 2px solid var(--primary); }
.table-wrap.is-stacked > table > * > tr > td {
  display: block; position: relative; width: auto; padding: 4px 0 4px 42%; border: 0; background: none;
  text-align: right; white-space: normal; overflow-wrap: anywhere; min-height: 26px;
}
.table-wrap.is-stacked > table > * > tr > td::before {
  content: attr(data-label); position: absolute; left: 0; top: 5px; width: 40%;
  text-align: left; white-space: normal; font: 700 var(--fs-3xs) var(--font-ui); letter-spacing: .06em; text-transform: uppercase; color: var(--text-3);
}
/* Cells without a header (names, actions, detail panels) take the whole card width. */
.table-wrap.is-stacked > table > * > tr > td[data-label=""] { padding-left: 0; text-align: left; }
.table-wrap.is-stacked > table > * > tr > td[data-label=""]::before { display: none; }
.table-wrap.is-stacked > table > * > tr > td:first-child { font-weight: 650; }
.table-wrap.is-stacked > table > * > tr > td:empty { display: none; }
.table-wrap.is-stacked .input { max-width: 100%; }
.table-wrap.is-stacked .row-actions { justify-content: flex-end; }
.table-wrap.is-stacked .ink-name { justify-content: flex-end; }
.table-wrap.is-stacked > table > * > tr > td:first-child .ink-name,
.table-wrap.is-stacked > table > * > tr > td[data-label=""] .ink-name { justify-content: flex-start; }

/* Jobs as cards: code + name on top, the row itself opens the detail. */
.table-wrap.is-stacked > .jobs-table > tbody > tr > td.col-toggle { display: none; }
.table-wrap.is-stacked > .jobs-table > tbody > tr.job-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; column-gap: 10px; }
.table-wrap.is-stacked > .jobs-table > tbody > tr.job-row > td { grid-column: 1 / -1; }
.table-wrap.is-stacked > .jobs-table > tbody > tr.job-row > td.col-select { grid-column: 1; grid-row: 1; padding: 0; align-self: center; }
.table-wrap.is-stacked > .jobs-table > tbody > tr.job-row > td.col-select::before { display: none; }
.table-wrap.is-stacked > .jobs-table > tbody > tr.job-row > td.col-code { grid-column: 2; grid-row: 1; padding-left: 0; text-align: left; color: var(--primary); }
.table-wrap.is-stacked > .jobs-table > tbody > tr.job-row > td.col-code::before { display: none; }
.table-wrap.is-stacked > .jobs-table > tbody > tr.job-row > td.col-actions { grid-column: 3; grid-row: 1; padding: 0; }
.table-wrap.is-stacked > .jobs-table > tbody > tr.job-row > td.col-name { padding-left: 0; text-align: left; }
.table-wrap.is-stacked > .jobs-table > tbody > tr.job-row > td.col-name::before { display: none; }
.table-wrap.is-stacked > .jobs-table .col-press, .table-wrap.is-stacked > .jobs-table .col-mode,
.table-wrap.is-stacked > .jobs-table .col-clicks, .table-wrap.is-stacked > .jobs-table .col-date,
.table-wrap.is-stacked > .jobs-table .col-click-cost { display: block; }
.table-wrap.is-stacked > .jobs-table > tbody > tr.job-detail-row { padding: 0; }
.table-wrap.is-stacked > .jobs-table > tbody > tr.job-detail-row > td { padding: 0; }
/* The first column names the row: in a card it is the title, without its label. */
.table-wrap.is-stacked > table > * > tr > td:first-child { padding-left: 0; text-align: left; }
.table-wrap.is-stacked > table > * > tr > td:first-child::before { display: none; }

/* Segmented toggles (price tabs, sides, shot mode) wrap instead of overflowing. */
.toggle-group { max-width: 100%; }
@media (max-width: 700px) {
  .toggle-group { display: flex; flex-wrap: wrap; height: auto; }
  .toggle-group button { flex: 1 1 auto; height: var(--control-h); }
}

/* Phones: KPIs two per row, tighter. */
@media (max-width: 700px) {
  .grid-4.jobs-kpis, .grid-4.report-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .jobs-kpis .kpi, .report-kpis .kpi { padding: 10px 12px; }
  .jobs-kpis .kpi-value, .report-kpis .kpi-value { font-size: 1.05rem; overflow-wrap: anywhere; }
}
