/* Pages (B6): home, lists, login, errors, and the pre-B6 page styles (forms, tables, panels, files, budget) moved
   onto tokens.css. Shell is in shell.css, reusable parts in components.css. Form detail/edit and panels get
   their paya look in B7; here they only follow the new colours. */

/* =====================================================================================================
   home (paya 01 / 30 / 40)
   ===================================================================================================== */
.home { display: flex; flex-direction: column; gap: var(--s4); }
.home-head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--s2); flex-wrap: wrap; padding: 0 var(--s1); }
.home-head h1 { font-size: var(--fs-xl); font-weight: 800; line-height: 36px; color: var(--text-strong); }
.home-head h1 .name { color: var(--accent); }
.home-head .chips { gap: var(--s2); }
.hero {
  position: relative; overflow: hidden; display: flex; align-items: center; gap: 20px; min-height: 168px; padding: 20px var(--s5);
  border-radius: var(--radius-hero); background: var(--hero-bg); color: #ffffff; isolation: isolate;
}
.hero::before, .hero::after { content: ""; position: absolute; z-index: -1; border-radius: 50%; pointer-events: none; }
.hero::before { inset-inline-end: -59px; bottom: -255px; width: 359px; height: 282px; border: 1px solid #ffffff1c; }
.hero::after { inset-inline-end: -117px; bottom: -315px; width: 473px; height: 381px; border: 1px solid #ffffff12; }
.hero .stars { position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background-image: radial-gradient(1px 1px at 88% 18%, #ffffff8c, transparent), radial-gradient(1px 1px at 70% 70%, #ffffffb3, transparent),
    radial-gradient(1px 1px at 48% 30%, #ffffffc4, transparent), radial-gradient(1px 1px at 34% 82%, #ffffffc8, transparent),
    radial-gradient(1px 1px at 20% 22%, #ffffff9b, transparent), radial-gradient(1px 1px at 12% 60%, #ffffff52, transparent),
    radial-gradient(1px 1px at 60% 88%, #ffffff29, transparent), radial-gradient(1px 1px at 80% 50%, #ffffff31, transparent),
    radial-gradient(1px 1px at 28% 12%, #ffffff69, transparent); }
.hero-art { flex: none; display: grid; place-items: center; width: 104px; height: 104px; margin: 12px; border-radius: 50%; color: #ffffff; background: radial-gradient(circle at 35% 30%, #ffffff40, #ffffff12 60%, transparent 70%); box-shadow: inset 0 0 0 1px #ffffff26; }
.hero-art .ico { width: 48px; height: 48px; stroke-width: 1.5; }
.hero-body { position: relative; flex: 1; display: flex; flex-direction: column; gap: var(--s1); min-width: 0; }
.hero-kicker { display: flex; align-items: center; gap: 6px; font-size: var(--fs-xs); line-height: 16px; opacity: .8; }
.hero-kicker .ico { width: 16px; height: 16px; }
.hero-count { font-size: var(--fs-2xl); font-weight: 900; line-height: 36px; }
.hero-count small { margin-inline-start: 6px; font-size: var(--fs-md); font-weight: 700; line-height: 24px; opacity: .9; }
.hero-note { line-height: 20px; opacity: .85; }
.hero-actions { display: flex; gap: var(--s2); margin-top: var(--s2); }
.home .search { height: 32px; }
.group { display: flex; flex-direction: column; gap: var(--s3); }
.group-head { display: flex; align-items: center; gap: var(--s2); padding: 0 var(--s1); font-size: var(--fs); font-weight: 800; line-height: 20px; color: var(--text-strong); margin: 0; }
.group-head .sq { width: 10px; height: 10px; border-radius: var(--radius-tag); background: var(--g); flex: none; }
.group-head .n { font-size: var(--fs-xs); font-weight: 600; line-height: 16px; color: var(--text-subtle); }
.group-head .line { flex: 1; height: 1px; background: var(--border-hairline); }
.module-grid { display: grid; gap: var(--s3); grid-template-columns: repeat(3, minmax(0, 1fr)); }
.module-card {
  position: relative; display: flex; flex-direction: column; gap: var(--s3); padding: var(--s4); background: var(--surface);
  border: 1px solid var(--border-hairline); border-radius: var(--radius-card); transition: transform var(--dur) var(--ease), border-color var(--dur);
}
.module-card::before { content: ""; position: absolute; top: 0; inset-inline: 1px; height: 3px; background: linear-gradient(to right, transparent, var(--g), transparent); opacity: 0; transition: opacity var(--dur); }
.module-card:hover { transform: translateY(-2px); border-color: var(--border-hairline-strong); }
.module-card:hover::before { opacity: 1; }
.mc-top { display: flex; align-items: center; gap: var(--s3); }
.mc-icon { width: 44px; height: 44px; display: grid; place-items: center; flex: none; border-radius: var(--radius-card); color: var(--g); background: color-mix(in srgb, var(--g) 12%, transparent); }
.mc-icon .ico { width: 20px; height: 20px; }
.mc-title { font-size: var(--fs-md); font-weight: 800; line-height: 28px; color: var(--text-strong); margin: 0; }
.mc-title a { color: inherit; text-decoration: none; }
.mc-title a::after { content: ""; position: absolute; inset: 0; border-radius: var(--radius-card); }
.mc-desc { margin: 0; color: var(--text-muted); line-height: 24px; }
.mc-foot { position: relative; z-index: 1; display: flex; align-items: center; justify-content: space-between; gap: var(--s2); }
.mc-add { display: inline-flex; align-items: center; gap: var(--s1); padding: 4px 12px; border-radius: var(--radius-pill); color: var(--g); background: color-mix(in srgb, var(--g) 12%, transparent); font-size: var(--fs-xs); font-weight: 700; line-height: 16px; text-decoration: none; }
.mc-add .ico { width: 16px; height: 16px; }
.mc-add:hover { text-decoration: none; filter: brightness(1.15); }
.mc-list { font-size: var(--fs-xs); line-height: 16px; color: var(--link); }
.mc-add.off { visibility: hidden; }
.home .alert { margin: 0; }

@media (max-width: 1023.98px) {
  .home-head h1 { font-size: 20px; }
  .home-head .meta-chip { font-size: 10px; line-height: 14px; }
  .hero { min-height: 0; padding: var(--s4); gap: var(--s3); border-radius: 20px; flex-direction: row-reverse; }
  .hero-count { font-size: 28px; }
  .hero-count small { font-size: var(--fs); line-height: 21px; }
  .hero-kicker { font-size: 10px; }
  .hero-note { font-size: var(--fs-xs); line-height: 17px; }
  .home .pill-chip { font-size: 10px; line-height: 13px; }
  .group-head { font-size: var(--fs-xs); }
  .module-grid { grid-template-columns: minmax(0, 1fr); gap: var(--s2); }
  .module-card { flex-direction: row; align-items: center; padding: var(--s3); }
  .module-card .mc-top { flex: 1; min-width: 0; }
  .mc-icon { width: 40px; height: 40px; border-radius: 12px; }
  .mc-title { font-size: var(--fs); }
  .mc-desc { display: none; }
  .mc-text .mc-sub { display: block; font-size: 10px; line-height: 13px; color: var(--text-muted); }
  .mc-list { display: none; }
  .mc-add { width: 36px; height: 36px; padding: 0; justify-content: center; }
  .mc-add span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
}
@media (min-width: 1024px) { .mc-text .mc-sub { display: none; } }
@media (min-width: 1024px) and (max-width: 1279.98px) { .module-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* =====================================================================================================
   lists (paya 06 / 12): page bar + filter card + table, one partial (templates/_list_table.html)
   ===================================================================================================== */
.list-page { display: flex; flex-direction: column; gap: var(--s4); }
.list-page .page-body { display: flex; flex-direction: column; gap: var(--s4); }
.list-table { position: relative; background: var(--surface); border: 1px solid var(--border-table); border-radius: var(--radius-table) var(--radius-table) 8px 8px; overflow-x: auto; }
.list-table table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: var(--fs); }
.list-table th { position: relative; text-align: start; padding: var(--s4); background: var(--th-bg); color: var(--text-head); font-weight: 700; white-space: nowrap; border-bottom: 1px solid var(--row-line); }
.list-table th:first-child { border-start-start-radius: var(--radius-table); }
.list-table th:last-child { border-start-end-radius: var(--radius-table); }
.list-table th + th::before { content: ""; position: absolute; inset-inline-start: 0; top: 50%; width: 1px; height: 1.6em; transform: translateY(-50%); background: var(--border-hairline-soft); }
.list-table th[aria-sort] { background: var(--th-sorted); }
.list-table td { padding: var(--s4); border-bottom: 1px solid var(--row-line); vertical-align: middle; color: var(--text-body); }
.list-table tbody tr:last-child td { border-bottom: 0; }
.list-table tbody tr:hover > td { background: var(--surface-hover); }
.list-table a.row-link, .data-table a.row-link { color: var(--text-strong); font-weight: 500; text-decoration: none; }
.list-table a.row-link:hover, .data-table a.row-link:hover { color: var(--accent); }
.list-table .c-view a { color: var(--link); }
.list-table .muted { font-size: var(--fs-xs); }
.list-table .c-num { width: 1%; white-space: nowrap; color: var(--text-body); }
.panel-sort { display: inline-flex; align-items: center; gap: var(--s1); color: inherit; text-decoration: none; }
.panel-sort:hover { color: var(--text-strong); text-decoration: none; }
.panel-sort .ico { width: 12px; height: 12px; color: var(--sort-icon); }
.panel-inactive td { color: var(--text-subtle); }
.panel-default td { color: var(--text-subtle); font-style: italic; }
.panel-current td { font-weight: 700; }
.panel-unapproved td { background: var(--warn-bg); }
tr.unread td { font-weight: 700; color: var(--text-strong); }
tr.overdue td { color: var(--err); }
/* row actions menu (⋮) */
.dots { position: relative; display: inline-block; }
.dots > summary { list-style: none; width: 32px; height: 32px; display: grid; place-items: center; border-radius: var(--radius-button); color: var(--text-muted); cursor: pointer; }
.dots > summary::-webkit-details-marker { display: none; }
.dots > summary:hover, .dots[open] > summary { background: var(--surface-hover); color: var(--text-strong); }
.dots > summary .ico { width: 18px; height: 18px; }
.dots-menu { position: absolute; inset-inline-end: 0; top: 34px; z-index: 20; min-width: 160px; padding: 4px; background: var(--surface-raised); border-radius: 8px; box-shadow: var(--shadow-pop); }
.dots-menu form { margin: 0; }
.dots-menu a, .dots-menu button { display: flex; width: 100%; min-height: 32px; align-items: center; padding: 5px 12px; background: none; border: 0; border-radius: 4px; color: var(--text-body); text-decoration: none; cursor: pointer; text-align: start; white-space: nowrap; }
.dots-menu a:hover, .dots-menu button:hover { background: var(--surface-hover); text-decoration: none; }
.dots-menu .danger { color: var(--danger-icon); }
.dots-menu .inline-form { display: grid; gap: var(--s2); padding: var(--s2); border-bottom: 1px solid var(--separator); }
.dots-menu .inline-form input { width: 100%; height: var(--control-h); padding: 0 11px; border: 1px solid var(--border-input); border-radius: var(--radius-button); background: var(--surface); }
.list-skeleton { display: grid; gap: var(--s3); }
.list-skeleton[hidden] { display: none; }
.list-skeleton .skeleton { height: 56px; }
.filters-body { display: grid; gap: var(--s3); grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); align-items: end; }
.filters-body .field label { margin: 0 0 var(--s1); font-size: var(--fs-xs); line-height: 16px; color: var(--text-muted); font-weight: 400; }
.filters-act { display: flex; gap: var(--s2); align-items: center; grid-column: 1 / -1; }
.panel-bulk { display: flex; flex-wrap: wrap; gap: var(--s2); align-items: center; }
.list-table .c-check { width: 44px; }
.list-table .c-check input, .list-table input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--primary); }
.stat-cards { display: flex; flex-wrap: wrap; gap: var(--s3); }
.stat-card { display: grid; gap: var(--s1); padding: var(--s3) var(--s4); min-width: 200px; }
.stat-card .stat-title { color: var(--text-muted); font-size: var(--fs-xs); }
.stat-card .stat-value { font-size: var(--fs-lg); font-weight: 800; color: var(--text-strong); }

.filter-toggle { display: none; }
@media (max-width: 1023.98px) {
  .filter-toggle:not([hidden]) { display: inline-flex; align-self: flex-start; }
  .filter-toggle:not([hidden]) + .filter-bar:not(.open) { display: none; }
  .cartable .page-head { align-items: flex-start; }
  .list-table tr.row-detail { display: block; margin-top: calc(-1 * var(--s3)); border-top: 0; border-radius: 0 0 var(--radius-card) var(--radius-card); }
  .list-table tr.row-detail[hidden] { display: none; }
  .list-table tr.row-detail > td { padding: 0; background: transparent; }
  .list-table td.c-expand { display: none; }
}

/* below 1024px a list row becomes a card (same markup), as paya 31_cartable_mobile */
@media (max-width: 1023.98px) {
  .list-table { background: transparent; border: 0; overflow: visible; }
  .list-table table, .list-table tbody { display: block; }
  .list-table thead { display: none; }
  .list-table td.c-num { display: none; }
  .list-table tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s3); position: relative; margin-bottom: var(--s3); padding: var(--s4); background: var(--surface); border: 1px solid var(--border-hairline); border-radius: var(--radius-card); }
  .list-table tbody tr:hover > td { background: transparent; }
  .list-table td { display: block; padding: 0; border: 0; min-width: 0; font-size: var(--fs-xs); color: var(--text-body); }
  .list-table td[data-label]::before { content: attr(data-label); display: block; margin-bottom: 2px; color: var(--text-muted); font-size: var(--fs-xs); }
  .list-table td.c-title { grid-column: 1 / -1; font-size: var(--fs); font-weight: 700; padding-inline-end: 40px; }
  .list-table td.c-title::before, .list-table td.c-act::before, .list-table td.c-view::before { content: none; }
  .list-table td.c-act { position: absolute; top: var(--s3); inset-inline-end: var(--s3); z-index: 2; }
  .list-table td.c-view { grid-column: 1 / -1; text-align: center; padding-top: var(--s2); border-top: 1px solid var(--separator); }
  .list-table .row-title::after { content: ""; position: absolute; inset: 0; border-radius: var(--radius-card); }
  .list-table td.c-status { grid-column: 1 / -1; display: flex; gap: var(--s2); flex-wrap: wrap; }
  .list-table td.c-status::before { content: none; }
}

/* =====================================================================================================
   login / errors (same card on the page background)
   ===================================================================================================== */
.login { min-height: 100vh; display: grid; place-items: center; padding: var(--s4); background: var(--bg-layout); }
.login .card { width: 100%; max-width: 400px; padding: var(--s6) var(--s5); text-align: center; border-radius: var(--radius-card); }
.login .card img { width: 56px; height: 56px; border-radius: 12px; }
.login h1 { margin-top: var(--s3); font-size: var(--fs-xl); }
.login form { text-align: start; display: grid; gap: var(--s4); margin-top: var(--s5); }
.login .field input { height: 40px; }
.login .btn { width: 100%; height: 40px; font-size: var(--fs-md); }
.login-theme { position: fixed; top: 16px; inset-inline-end: 16px; }
.demo-users { margin-top: var(--s5); text-align: start; }
.demo-users h2 { font-size: var(--fs-md); margin: 0 0 var(--s1); }
.demo-users table { width: 100%; border-collapse: collapse; font-size: var(--fs-xs); }
.demo-users th, .demo-users td { padding: var(--s1) var(--s2); border-bottom: 1px solid var(--row-line); text-align: start; }
.demo-users th { background: var(--th-bg); color: var(--text-head); }
.login .card:has(.demo-users) { max-width: 560px; }
.error-page { padding-top: var(--s7); }
.error-code { margin: var(--s2) 0 0; font-size: 56px; font-weight: 900; line-height: 1; color: var(--accent); }
.error-page h1, .error-card h1 { margin: var(--s2) 0; font-size: var(--fs-lg); }
.error-actions { display: flex; flex-wrap: wrap; gap: var(--s2); justify-content: center; margin-top: var(--s4); }
.error-card .error-actions .btn { width: auto; }
.public-page { padding: 0; }
.public-share h1 { margin-bottom: var(--s3); }

/* =====================================================================================================
   form pages (detail / edit; paya look in B7, colours only here)
   ===================================================================================================== */
label { display: block; }
.meta-line { margin: 0 0 var(--s4); }
.fields { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--s4); }
.fields > * { min-width: 0; }
.approval-block { display: grid; gap: var(--s4); padding-top: var(--s4); border-top: 1px dashed var(--border-hairline-strong); }
.approval-block [hidden] { display: none; }
.form-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--s4); }
.form-layout > *, .sec, .sec-body, .rtable { min-width: 0; }
.form-main { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--s4); align-content: start; }
.rail { display: flex; gap: var(--s2); overflow-x: auto; padding: var(--s2) 0; scroll-snap-type: x proximity; position: sticky; top: 72px; z-index: 20; background: var(--bg-layout); scrollbar-width: thin; }
.rail a { display: flex; align-items: center; gap: var(--s2); padding: 0 var(--s3); height: var(--control-h); border-radius: var(--radius-pill); background: var(--surface); border: 1px solid var(--border-hairline); text-decoration: none; white-space: nowrap; color: var(--text-body); scroll-snap-align: center; flex: none; }
.rail a:hover { border-color: var(--border-hairline-strong); text-decoration: none; }
.rail a[aria-current="true"] { background: var(--inverse); color: var(--text-on-inverse); border-color: transparent; }
.node { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; font-weight: 700; background: var(--select-bg); color: var(--text-body); flex: none; }
.node .ico { width: 12px; height: 12px; stroke-width: 3; }
.node.ok { background: var(--rag-green); color: #ffffff; }
.node.warn { background: var(--rag-amber); color: #3a2200; }
.node.review { background: var(--review); color: #ffffff; }
.sec { padding: 0; overflow: visible; scroll-margin-top: 130px; }
.sec-head { display: flex; align-items: center; gap: var(--s3); padding: var(--s3) var(--s4); background: var(--surface-muted); border-bottom: 1px solid var(--border-hairline); flex-wrap: wrap; border-radius: var(--radius-card) var(--radius-card) 0 0; }
.sec-head h2 { font-size: var(--fs-md); flex: 1; min-width: 160px; margin: 0; }
.sec-no { color: var(--text-subtle); margin-inline-end: 2px; }
.sec-sub { display: grid; gap: var(--s2); padding: var(--s3) var(--s4) 0; }
.sec-sub .alert { margin: 0; }
.sign-line { display: flex; align-items: center; gap: var(--s3); flex-wrap: wrap; font-size: var(--fs); }
.sec-body { padding: var(--s4); display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--s4); }
.sec.readonly .sec-head { background: var(--surface-side); }
.sec.inactive { opacity: .6; }
.ro-note { display: flex; align-items: center; gap: var(--s2); }
.ro-note .ico { width: 16px; height: 16px; }
.kv { display: grid; grid-template-columns: minmax(110px, 220px) minmax(0, 1fr); gap: var(--s2) var(--s4); margin: 0; }
.kv dt { color: var(--text-muted); }
.kv dd { margin: 0; min-height: 1.4em; overflow-wrap: anywhere; color: var(--text-body); }
.kv.computed dd { font-weight: 700; color: var(--text-strong); }
.section-actions { display: flex; flex-wrap: wrap; gap: var(--s4); padding-top: var(--s4); border-top: 1px dashed var(--border-hairline-strong); }
.section-actions form { display: flex; flex-wrap: wrap; gap: var(--s2); align-items: center; }
.section-actions label { font-weight: 500; color: var(--text-body); }
.section-actions select, .section-actions input[type=text] { width: auto; }
.delete-zone { margin-top: var(--s2); }
.savebar { position: sticky; bottom: calc(var(--nav-h) + 24px); z-index: 25; display: flex; gap: var(--s3); align-items: center; justify-content: space-between; padding: var(--s3) var(--s4); background: var(--surface-raised); border-radius: var(--radius-card); box-shadow: var(--shadow-pop); }
.savebar .dirty { color: var(--rag-amber); font-weight: 700; }
.inline-check { display: flex; gap: var(--s3); align-items: center; min-height: var(--control-h); }
.inline-check label { margin: 0; font-weight: 500; color: var(--text-body); }

/* repeating table: one markup, cards below 1024px, real table above */
.rtable { border: 1px solid var(--border-table); border-radius: var(--radius-table); margin: 0; padding: 0; overflow: hidden; background: var(--surface); }
.rt-title { display: flex; justify-content: space-between; align-items: center; gap: var(--s3); padding: var(--s2) var(--s4); background: var(--th-bg); font-weight: 700; color: var(--text-head); min-height: 44px; width: 100%; }
fieldset.rtable > legend.rt-title { float: none; display: flex; }
.rtable-view { border: 1px solid var(--border-table); border-radius: var(--radius-table); overflow: hidden; background: var(--surface); }
.rt-add { padding: var(--s3) var(--s4); border-top: 1px solid var(--row-line); }
.rt-n { width: 24px; height: 24px; border-radius: 50%; background: var(--accent-tint); color: var(--accent); display: inline-grid; place-items: center; font-weight: 700; font-size: var(--fs-xs); }
.rt-del { width: 32px; height: 32px; border-radius: var(--radius-button); border: 0; background: transparent; color: var(--danger-icon); cursor: pointer; display: grid; place-items: center; }
.rt-del:hover { background: var(--danger-tint); }
.rtable-grid { width: 100%; border-collapse: collapse; font-size: var(--fs); }
.rtable-grid th { text-align: start; padding: var(--s2) var(--s3); background: var(--th-bg); color: var(--text-head); font-size: var(--fs-xs); font-weight: 700; border-bottom: 1px solid var(--row-line); white-space: nowrap; position: relative; }
.rtable-grid td { padding: var(--s2) var(--s3); border-top: 1px solid var(--row-line); vertical-align: top; }
.rtable-grid tr[hidden] { display: none; }
.rtable-grid td.rt-no, .rtable-grid th.rt-no { width: 52px; text-align: center; }
.rtable-grid td.rt-act, .rtable-grid th.rt-act { width: 56px; text-align: center; }
.rtable-grid td > input:not([type=checkbox]), .rtable-grid td > textarea { min-width: 150px; }
.rtable-grid td > select { min-width: 96px; }
.rtable-grid td > .lookup { min-width: 190px; }
.calc { background: var(--accent-tint); border-radius: var(--radius-button); padding: 4px 11px; min-height: var(--control-h); font-weight: 700; color: var(--text-strong); display: flex; align-items: center; min-width: 110px; }
.rtable-grid.view td { color: var(--text-body); vertical-align: middle; }
.rtable-grid td[colspan] { text-align: center; padding: var(--s5); color: var(--text-muted); }
@media (max-width: 1023.98px) {
  .rtable .table-wrap, .rtable-view .table-wrap { overflow: visible; }
  .rtable-grid, .rtable-grid tbody { display: block; }
  .rtable-grid thead { display: none; }
  .rtable-grid tr.rt-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s3); padding: var(--s4); border-top: 1px solid var(--row-line); position: relative; }
  .rtable-grid tbody tr.rt-row:first-child { border-top: 0; }
  .rtable-grid tr.rt-row[hidden] { display: none; }
  .rtable-grid td { display: block; padding: 0; border: 0; min-width: 0; grid-column: 1 / -1; }
  .rtable-grid td[data-label]::before { content: attr(data-label); display: block; margin-bottom: 2px; font-size: var(--fs-xs); color: var(--text-muted); }
  .rtable-grid td.rt-no { grid-column: 1; width: auto; text-align: start; }
  .rtable-grid td.rt-act { position: absolute; top: var(--s2); inset-inline-end: var(--s2); width: auto; }
  .rtable-grid td > input:not([type=checkbox]), .rtable-grid td > select, .rtable-grid td > textarea, .rtable-grid td > .lookup { min-width: 0; }
  .rtable-grid td.rt-computed { grid-column: auto; }
  .rtable-grid.view tr.rt-empty { display: block; padding: var(--s4); }
}

/* lookup */
.lookup { position: relative; }
.lookup-box { display: flex; gap: var(--s2); align-items: center; flex-wrap: wrap; }
.lookup-box .lookup-text { flex: 1 1 140px; min-width: 0; }
.lookup-clear { width: 32px; height: 32px; border: 0; background: none; font-size: 20px; cursor: pointer; color: var(--text-subtle); border-radius: var(--radius-button); }
.lookup-clear:hover { background: var(--surface-hover); color: var(--text-strong); }
.lookup-results { list-style: none; margin: 4px 0 0; padding: 4px; position: absolute; z-index: 40; inset-inline: 0; max-height: 260px; overflow: auto; background: var(--surface-raised); border-radius: 8px; box-shadow: var(--shadow-pop); }
.lookup-results[hidden] { display: none; }
.lookup-results li { padding: 5px 12px; min-height: 32px; cursor: pointer; border-radius: 4px; }
.lookup-results li:hover, .lookup-results li:focus { background: var(--accent-tint); outline: 0; }
.lookup-results li.none { color: var(--text-subtle); cursor: default; background: none; }
.lookup-add { display: flex; flex-wrap: wrap; gap: var(--s2); align-items: center; margin-top: var(--s2); padding: var(--s3); background: var(--surface-muted); border: 1px dashed var(--border-hairline-strong); border-radius: var(--radius-button); }
.lookup-add[hidden] { display: none; }
.lookup-add input { flex: 1 1 160px; min-width: 0; }
.lookup-add-error { color: var(--err); font-size: var(--fs-xs); }
.lookup-similar { flex: 1 1 100%; list-style: none; margin: 0; padding: 4px; border-radius: 8px; background: var(--surface-raised); }
.lookup-similar[hidden] { display: none; }
.lookup-similar li { padding: 5px 12px; cursor: pointer; border-radius: 4px; }
.lookup-similar li:hover { background: var(--accent-tint); }

/* signature, file preview */
.sig-block { padding-top: var(--s4); border-top: 1px dashed var(--border-hairline-strong); display: grid; gap: var(--s3); }
.sigpad[hidden] { display: none; }
.sigpad-canvas { display: block; width: 100%; max-width: 560px; height: 180px; background: #ffffff; border: 1px dashed var(--border-input); border-radius: var(--radius-card); touch-action: none; cursor: crosshair; }
.sigpad-tools { display: flex; gap: var(--s3); align-items: center; flex-wrap: wrap; margin-top: var(--s2); }
.sig-img { display: block; max-height: 80px; max-width: 240px; border: 1px solid var(--border-hairline); border-radius: var(--radius-button); background: #ffffff; }
.sig-img.sig-current { max-height: 48px; max-width: 150px; }
.sig-note { margin: 0; }
.file-preview { display: inline-flex; align-items: center; gap: var(--s2); }
.file-thumb { display: block; max-height: 64px; max-width: 96px; border: 1px solid var(--border-hairline); border-radius: var(--radius-button); background: var(--surface); object-fit: cover; }
.file-ico { flex: none; }

/* print preview shell (form_print) */
.print-bar { position: sticky; top: 72px; z-index: 20; display: flex; flex-wrap: wrap; gap: var(--s3); align-items: center; justify-content: space-between; margin: 0 0 var(--s3); padding: var(--s3) var(--s4); background: var(--surface); border-radius: var(--radius-icon); }
.print-select { display: flex; gap: var(--s2); align-items: center; flex: 1 1 220px; }
.print-select label { margin: 0; font-weight: 500; white-space: nowrap; }
.print-select select { flex: 1; height: var(--control-h); padding: 0 11px; border: 1px solid var(--border-input); border-radius: var(--radius-button); background: var(--surface); color: var(--text-body); }
.pdf-viewer { display: flex; flex-direction: column; align-items: center; gap: var(--s4); padding: var(--s3); background: var(--surface-muted); border-radius: var(--radius-card); min-height: 60vh; }
.pdf-viewer > p { margin: auto; padding: var(--s6) var(--s4); text-align: center; }
.pdf-viewer[aria-busy="true"] > p::before { content: ""; display: block; width: 28px; height: 28px; margin: 0 auto var(--s3); border: 3px solid var(--border-hairline-strong); border-top-color: var(--primary); border-radius: 50%; animation: pdf-spin .8s linear infinite; }
.pdf-viewer .pdf-page { max-width: 100%; height: auto; background: #ffffff; box-shadow: 0 2px 12px #0000002e; }
@keyframes pdf-spin { to { transform: rotate(360deg); } }
@media (max-width: 640px) { .pdf-viewer { padding: var(--s2); } .print-bar .btn { flex: 1 1 100%; } }

@media (min-width: 700px) {
  .fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rtable-grid tr.rt-row { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (min-width: 1024px) {
  .savebar { bottom: var(--s4); }
}
@media (min-width: 1360px) {
  .fields { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .form-layout { grid-template-columns: 232px minmax(0, 1fr); align-items: start; gap: var(--s5); }
  .rail { top: 112px; flex-direction: column; overflow: visible; margin: 0; padding: 0; border: 0; background: transparent; }
  .rail a { border-radius: var(--radius-button); white-space: normal; height: auto; min-height: var(--control-h); padding-block: var(--s1); }
  .rail .rail-t { line-height: 1.5; }
  .sec { scroll-margin-top: 112px; }
}
.table-wrap, .rtable-grid th { position: relative; }

/* =====================================================================================================
   panels (company / project / supervisor): side menu + content card
   ===================================================================================================== */
/* B7 (paya 07): one card; the menu inside it on the right (icon + title, a hairline between), the page on the left
   with a header row (title + actions) over a hairline, then the body. */
.panel { display: grid; grid-template-columns: minmax(0, 1fr); background: var(--surface); border-radius: var(--radius-card); min-width: 0; }
.panel-nav { display: flex; flex-wrap: wrap; gap: var(--s1); align-items: center; padding: var(--s3); border-bottom: 1px solid var(--border-hairline); }
.panel-nav-head { display: flex; flex-direction: column; margin-inline-end: var(--s3); padding: 0 var(--s2); }
.panel-nav-head b { color: var(--text-strong); font-weight: 800; }
.panel-nav-head .muted { font-size: var(--fs-xs); }
.panel-nav-link { display: flex; align-items: center; gap: var(--s3); min-height: 36px; padding: 6px 12px; border-radius: var(--radius-icon); color: var(--text-body); text-decoration: none; font-size: 13px; }
.panel-nav-link .ico { width: 20px; height: 20px; flex: none; color: var(--text-muted); }
.panel-nav-link:hover { background: var(--surface-hover); text-decoration: none; }
.panel-nav-link[aria-current="page"] { color: var(--primary-soft); font-weight: 700; }
.panel-nav-link[aria-current="page"] .ico { color: var(--primary-soft); }
.panel-main { min-width: 0; display: flex; flex-direction: column; gap: var(--s4); padding: var(--s5); }
.panel-main .filter-card { background: var(--surface-muted); }
.panel-main > .page-head:first-child h1 { font-size: var(--fs-lg); font-weight: 700; }
.panel-main .card { background: var(--surface-muted); }
.panel-main .list-table { background: var(--surface); }
.panel-main:has(> .page-bar), .panel-main:has(> .page-body) { padding: 0; gap: 0; }
.panel-main > .page-bar, .panel-main:has(> .page-body) > .page-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); flex-wrap: wrap; margin: 0; min-height: 72px; padding: var(--s4) var(--s5); background: transparent; border-radius: 0; border-bottom: 1px solid var(--border-hairline); }
.panel-main > .page-bar h1, .panel-main:has(> .page-body) > .page-head h1 { font-size: var(--fs); font-weight: 800; line-height: 22px; color: var(--text-strong); }
.panel-main:has(> .page-body) > .page-head .crumbs { margin-bottom: 2px; }
.panel-main > .page-body { display: flex; flex-direction: column; gap: var(--s4); padding: var(--s5); background: transparent; border-radius: 0; }
.panel-actions { display: flex; gap: var(--s2); align-items: center; flex-wrap: wrap; }
.panel-form { display: grid; gap: var(--s4); padding: var(--s4); }
.panel-checks > div { display: grid; gap: var(--s3); }
.panel-checks > div > div > label { font-weight: 700; }
.panel-checks > div > div > div { display: grid; gap: var(--s1); grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); padding-block: var(--s2); }
.panel-checks label { display: flex; gap: var(--s2); align-items: center; font-weight: 400; }
.panel-history { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s3); }
.panel-history > li { padding: var(--s3) var(--s4); }
.panel-history-head { display: flex; flex-wrap: wrap; gap: var(--s3); align-items: baseline; }
.panel-changes { margin: var(--s2) 0 0; padding-inline-start: var(--s5); }
.panel-changes del { color: var(--err); }
.panel-changes ins { color: var(--ok); text-decoration: none; }
.panel-form textarea.print-code { width: 100%; direction: ltr; text-align: left; font-family: var(--font-mono); line-height: 1.5; tab-size: 2; white-space: pre; }
.panel-preview { display: grid; gap: var(--s3); padding: var(--s3); border: 1px solid var(--border-hairline); border-radius: var(--radius-card); }
.panel-preview h2 { margin: 0; font-size: var(--fs-md); }
.panel-preview-row { display: flex; flex-wrap: wrap; gap: var(--s3); align-items: end; }
.panel-diff { direction: ltr; text-align: left; font-family: var(--font-mono); background: var(--surface-muted); border: 1px solid var(--border-hairline); border-radius: var(--radius-button); padding: var(--s2); overflow-x: auto; white-space: pre; }
.panel-diff .add { background: var(--rag-green-bg); }
.panel-diff .del { background: var(--rag-red-bg); }
.panel-diff .same { color: var(--text-subtle); }
.panel-inline { display: inline; margin: 0; }
.panel-merge { display: grid; gap: var(--s3); padding: var(--s4); }
.panel-merge ul { margin: 0; padding-inline-start: var(--s5); }
.panel-bank-group { display: grid; gap: var(--s3); padding: var(--s4); margin-block-end: var(--s4); }
.panel-bank-group h2 { margin: 0; font-size: var(--fs-md); }
.panel-bank-checks { display: grid; gap: var(--s1); grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); padding-block: var(--s2); }
.panel-bank-checks label { display: flex; gap: var(--s2); align-items: center; font-weight: 400; }
.panel-logo { display: flex; align-items: center; gap: var(--s3); }
.panel-logo-img { max-width: 96px; max-height: 96px; object-fit: contain; border: 1px solid var(--border-hairline); border-radius: var(--radius-button); background: #ffffff; }
.panel-secret { display: grid; gap: var(--s3); padding: var(--s4); }
.panel-password { font-family: var(--font-mono); font-size: var(--fs-lg); letter-spacing: .08em; padding: var(--s1) var(--s3); background: var(--surface-muted); border: 1px solid var(--border-hairline); border-radius: var(--radius-button); user-select: all; }
.panel-matrix-types { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s2); grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
@media (min-width: 1024px) {
  .panel { grid-template-columns: 218px minmax(0, 1fr); }
  .panel-nav { flex-direction: column; align-items: stretch; flex-wrap: nowrap; gap: 2px; padding: var(--s4) var(--s3); border-bottom: 0; border-inline-end: 1px solid var(--border-hairline); }
  .panel-nav-head { margin: 0 0 var(--s2); padding: var(--s1) var(--s3) var(--s3); border-bottom: 1px solid var(--separator); }
}
@media (max-width: 1023.98px) {
  .panel-main { padding: var(--s4); }
  .panel-nav { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .panel-nav-link { white-space: nowrap; }
  .panel-nav-head { flex: none; white-space: nowrap; }
  .panel-main > .page-bar, .panel-main:has(> .page-body) > .page-head, .panel-main > .page-body { padding: var(--s4); }
  .panel-table td::before { content: attr(data-label); }
  .panel-table td.c-act::before { content: none; }
}

/* =====================================================================================================
   files (FM-2/3), budget (AS-2), budget report (PV2-18), letters (COR-5)
   ===================================================================================================== */
.drive-forms { display: grid; gap: var(--s4); margin-bottom: var(--s5); grid-template-columns: minmax(0, 1fr); }
.drive-form { display: grid; gap: var(--s3); align-content: start; }
.drive-access-table select { height: var(--control-h); }
@media (min-width: 1024px) { .drive-forms { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.share-bar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s3); margin: 0 0 var(--s3); }
.share-files { margin: 0 0 var(--s4); padding-inline-start: var(--s5); }
.share-part { border: 1px solid var(--border-hairline); border-radius: var(--radius-card); padding: var(--s3) var(--s4); margin: var(--s4) 0; }
.share-part legend { font-weight: 700; padding: 0 var(--s2); }
.share-result { display: grid; gap: var(--s3); justify-items: start; }
.share-link { word-break: break-all; user-select: all; }
.share-qr { width: 200px; height: 200px; background: #ffffff; padding: 8px; border-radius: var(--radius-button); }
.budget-scroll { overflow-x: auto; max-width: 100%; background: var(--surface); border: 1px solid var(--border-table); border-radius: var(--radius-table); margin-block: var(--s3); }
.budget-table { border-collapse: collapse; font-size: var(--fs); min-width: max-content; }
.budget-table th, .budget-table td { padding: var(--s2) var(--s3); border-top: 1px solid var(--row-line); white-space: nowrap; text-align: start; vertical-align: middle; }
.budget-table thead th { background: var(--th-bg); color: var(--text-head); font-weight: 700; border-top: 0; }
.budget-sticky { position: sticky; inset-inline-start: 0; background: var(--surface); z-index: 1; }
.budget-table thead .budget-sticky { background: var(--th-bg); }
.budget-input { width: 7.5rem; height: 28px; padding: 0 var(--s2); text-align: end; font-variant-numeric: tabular-nums; border: 1px solid var(--border-input); border-radius: 6px; background: var(--surface); color: var(--text-strong); }
.budget-input.invalid { border-color: var(--danger); }
.budget-total-col { font-weight: 700; }
.budget-sum th, .budget-sum td { background: var(--surface-muted); font-weight: 700; }
.br-indent { display: inline-block; }
.br-depth-1 { padding-inline-start: var(--s4); }
.br-depth-2 { padding-inline-start: var(--s6); }
.br-level-1 td { font-weight: 700; }
.br-over td.num { color: var(--err); }
.br-total th, .br-total td { font-weight: 700; border-top: 2px solid var(--border-hairline-strong); }
.formula-notes { font-size: var(--fs-xs); color: var(--text-muted); }
.ref-history { list-style: none; margin: 0; padding: 0; }
.ref-history > li { border-inline-start: 2px solid var(--border-hairline-strong); padding: var(--s2) var(--s3); margin: 0 0 var(--s2); }
.ref-history .ref-depth { display: inline-block; width: var(--s4); }
.ref-history .ref-rows { margin: var(--s1) 0 0; padding-inline-start: var(--s4); font-size: var(--fs-xs); }
.ref-history .ref-reply { color: var(--text-body); white-space: pre-wrap; }

/* inbox (kept for pages not yet on the table layout) */
.inbox-list { display: grid; gap: var(--s3); margin-bottom: var(--s5); }
.inbox-card { display: grid; gap: var(--s2); padding: var(--s4); position: relative; }
.inbox-card .ic-top { display: flex; justify-content: space-between; align-items: start; gap: var(--s3); flex-wrap: wrap; }
.inbox-card .ic-title { font-weight: 700; color: var(--text-strong); text-decoration: none; }
.inbox-card .ic-meta { font-size: var(--fs-xs); color: var(--text-muted); }
.inbox-card .ic-badges { display: flex; flex-wrap: wrap; gap: var(--s2); }
.hint { color: var(--text-muted); font-size: var(--fs-xs); margin: var(--s1) 0 var(--s3); }
.pg-title { display: flex; align-items: center; gap: var(--s2); margin: var(--s4) 0 var(--s2); font-size: var(--fs-md); }

/* group colours (home chips and module cards): --g */
.g-requests { --g: var(--group-requests); }
.g-field { --g: var(--group-field); }
.g-hse { --g: var(--group-hse); }
.g-proj { --g: var(--group-proj); }
.g-watch { --g: var(--group-watch); }

/* /ui/ component sheet (B6) */
.ui-sheet { display: grid; gap: var(--s5); }
.theme-island { display: flex; flex-direction: column; gap: var(--s4); padding: var(--s5); border-radius: var(--radius-card); background: var(--bg-layout); color: var(--text-body); border: 1px solid var(--border-hairline); }
.ui-h { margin: var(--s2) 0 0; color: var(--text-strong); }
.ui-form { margin-top: var(--s2); }

/* =====================================================================================================
   B7 form page (paya 09 / 32 / 11): title card, tabs, content + «روال تاییدات» side column, info cells
   ===================================================================================================== */
.form-page { display: flex; flex-direction: column; gap: var(--s4); }
.form-bar .title-row h1 { font-size: var(--fs); font-weight: 800; color: var(--text-strong); }
.form-bar .delete-zone { margin: 0; display: contents; }
.code-chip { display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 7px; border: 1px solid var(--border-input); border-radius: var(--radius-tag); background: var(--select-bg); color: var(--text-body); font-size: var(--fs-xs); white-space: nowrap; }
.form-detail { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--s4); align-items: start; }
.form-detail > .form-main { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--s4); align-content: start; }
.form-detail .tabs { margin-bottom: 0; }
.form-detail .tab { background: none; border: 0; cursor: pointer; font: inherit; font-weight: 700; }
.tab-panel { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--s4); min-width: 0; }
.tab-panel[hidden] { display: none; }
/* info cells: dashed inner card, 3 columns, icon box + small label + strong value */
.kv.info-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: var(--s4) var(--s5); padding: var(--s4); border: 1px dashed var(--border-hairline-strong); border-radius: var(--radius-input); background: var(--surface-muted); }
.kv.info-grid.wide { grid-template-columns: minmax(0, 1fr); }
.kv.info-grid > .fi { position: relative; display: grid; align-content: center; gap: 2px; min-height: 40px; padding-inline-start: 52px; min-width: 0; }
.kv.info-grid dt { color: var(--text-subtle); font-size: var(--fs); line-height: 22px; }
.kv.info-grid dd { margin: 0; color: var(--text-strong); font-weight: 700; font-size: 13px; line-height: 20px; overflow-wrap: anywhere; min-height: 0; }
.kv.info-grid.computed dd { font-weight: 800; }
.fi-ico { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: var(--radius-icon); background: var(--glass); color: var(--text-body); flex: none; }
.kv.info-grid .fi-ico { position: absolute; inset-inline-start: 0; top: 50%; transform: translateY(-50%); }
.fi-ico .ico { width: 22px; height: 22px; }
.form-detail .sec-head { background: transparent; border-bottom: 1px solid var(--separator); }
.form-detail .sec { background: var(--surface); border: 1px solid var(--border-hairline); }
.form-detail .sec-head h2 { font-size: var(--fs-md); font-weight: 800; }
/* «روال تاییدات» */
.approvals { padding: var(--s5) var(--s5) var(--s4); }
.approvals-h { display: flex; align-items: center; gap: var(--s3); margin: 0 0 var(--s5); font-size: var(--fs); font-weight: 500; color: var(--text-muted); }
.approvals-h::after { content: ""; flex: 1; height: 1px; background: var(--separator); }
.timeline { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s4); }
.tl-step { position: relative; display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: var(--s3); }
.tl-step:not(:last-child)::before { content: ""; position: absolute; inset-inline-start: 13px; top: 30px; bottom: calc(-1 * var(--s4)); width: 2px; background: var(--border-hairline); }
.tl-node { position: relative; z-index: 1; display: grid; place-items: center; width: 28px; height: 28px; border-radius: var(--radius-pill); background: var(--select-bg); color: var(--text-muted); font-size: var(--fs-xs); font-weight: 700; }
.tl-node .ico { width: 16px; height: 16px; }
.tl-step.done .tl-node { background: var(--rag-green-bg); color: var(--rag-green); }
.tl-step.filled .tl-node { background: var(--rag-amber-bg); color: var(--rag-amber); }
.tl-step.review .tl-node { background: var(--review-bg); color: var(--review); }
.tl-step.off { opacity: .55; }
.tl-card { display: grid; gap: var(--s2); padding: var(--s3) var(--s4); border: 1px solid var(--border-hairline); border-radius: var(--radius-card); min-width: 0; }
.tl-step.done .tl-card { border-color: var(--ok-line); }
.tl-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s2); flex-wrap: wrap; }
.tl-title { color: var(--text-strong); font-weight: 700; text-decoration: none; }
.tl-title:hover { color: var(--accent); text-decoration: none; }
.tl-sign { display: flex; align-items: center; justify-content: space-between; gap: var(--s2); flex-wrap: wrap; color: var(--text-muted); font-size: var(--fs-xs); }
.tl-who { display: inline-flex; align-items: center; gap: 6px; color: var(--text-body); font-size: var(--fs); }
.tl-who .ico { width: 18px; height: 18px; }
.tl-card .sig-img { max-width: 100%; max-height: 72px; object-fit: contain; justify-self: start; background: #ffffff; border-radius: var(--radius-icon); padding: 2px 6px; }
.tl-meta { color: var(--text-subtle); font-size: var(--fs-xs); }
/* «پیوست‌ها» */
.attach-list { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s3); grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.attach-list li { display: flex; align-items: center; gap: var(--s3); padding: var(--s3); border: 1px dashed var(--border-hairline-strong); border-radius: var(--radius-input); min-width: 0; }
.attach-list .al-body { display: grid; gap: 2px; min-width: 0; overflow-wrap: anywhere; }
.attach-list small { color: var(--text-subtle); }
.attach-list:has(li) ~ .attach-empty { display: none; }
/* chain panel inside its tab */
.chain-panel { display: grid; gap: var(--s4); min-width: 0; }
.chain-panel > h2.section-title { margin: 0; font-size: var(--fs-md); font-weight: 800; color: var(--text-strong); }
.chain-panel .section-title { margin: 0 0 var(--s2); }
.chain-forms { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s2); }
.chain-forms li { display: flex; align-items: center; gap: var(--s2); flex-wrap: wrap; padding: var(--s2) var(--s3); border: 1px solid var(--border-hairline); border-radius: var(--radius-button); }
@media (min-width: 1024px) {
  .form-detail { grid-template-columns: minmax(0, 1fr) 300px; }
  .approvals { position: sticky; top: 112px; max-height: calc(100vh - 136px); overflow-y: auto; }
  .form-layout:has(> .form-main:first-child) { grid-template-columns: minmax(0, 1fr) 232px; }
}
@media (max-width: 1023.98px) {
  .form-bar { align-items: flex-start; }
  .form-bar .toolbar { width: 100%; }
  .form-bar .toolbar .btn { flex: 1; justify-content: center; }
  .kv.info-grid { grid-template-columns: minmax(0, 1fr); }
  .form-layout > .rail { order: -1; }
}

/* B7 report KPI cards (paya 20..28): title, big number, status chip, progress bar, small note */
.kpi-grid, .stat-cards { display: grid; gap: var(--s4); grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.kpi-card, .stat-card { display: grid; gap: var(--s3); align-content: start; padding: var(--s4) var(--s5); background: var(--surface); border: 1px solid var(--border-hairline); border-radius: var(--radius-card); min-width: 0; }
.panel-main .stat-card.card { background: var(--surface); }
.kpi-title, .stat-card .stat-title { color: var(--text-body); font-size: 13px; font-weight: 700; }
.kpi-row { display: flex; align-items: center; justify-content: space-between; gap: var(--s2); flex-wrap: wrap; }
.kpi-value, .stat-card .stat-value { font-size: 22px; font-weight: 800; line-height: 1.3; color: var(--text-strong); overflow-wrap: anywhere; }
.kpi-bar { -webkit-appearance: none; appearance: none; width: 100%; height: 6px; border: 0; border-radius: var(--radius-pill); background: var(--select-bg); overflow: hidden; }
.kpi-bar::-webkit-progress-bar { background: var(--select-bg); border-radius: var(--radius-pill); }
.kpi-bar::-webkit-progress-value { background: var(--progress-done); border-radius: var(--radius-pill); }
.kpi-bar::-moz-progress-bar { background: var(--progress-done); border-radius: var(--radius-pill); }
.kpi-bar.over::-webkit-progress-value { background: var(--rag-red); }
.kpi-bar.over::-moz-progress-bar { background: var(--rag-red); }
.kpi-note { margin: 0; color: var(--text-subtle); font-size: var(--fs-xs); }
