/* Avilo Furniture — Reports, team D2. Phone first: tables become stacked cards below 600px; age groups are rows of
   5 big tappable numbers. Age colours come from the shell's .agedot.a0 … a4. */
.rep-filters{display:flex;flex-wrap:wrap;gap:8px;align-items:center;margin:0 0 12px}
.rep-sel{display:inline-flex;align-items:center;gap:6px;min-height:44px;padding:0 12px;border:1.5px solid var(--line);border-radius:var(--r-pill);background:var(--surface);color:var(--ink-2);font-size:14px;font-weight:600;flex:1;min-width:0}
.rep-sel select{border:0;background:none;font:inherit;color:inherit;min-height:42px;flex:1;min-width:0;padding:0}
.rep-sel select:focus{outline:none}
.rep-sel:focus-within{border-color:var(--ink)}
@media (min-width:640px){.rep-sel{flex:0 1 320px}}
.rep-csv{flex:none}
.rep-ranges{width:100%;margin:0 -16px;padding:2px 16px 4px}
.rep-dates{display:grid;grid-template-columns:1fr 1fr;gap:0 10px;width:100%}
.rep-dates .field{margin-bottom:6px}
.rep-meta{margin:0 0 12px}
.rep-hint{margin:8px 0 0}

.rep-tiles{display:grid;grid-template-columns:repeat(auto-fit,minmax(104px,1fr));gap:8px;margin:0 0 6px}
.rep-tile{background:var(--surface);border:1px solid var(--line-2);border-radius:var(--r);padding:12px 12px 10px;box-shadow:var(--shadow-1)}
.rep-tile b{display:block;font:800 24px/1.1 var(--font-head);word-break:break-word}
.rep-tile span{display:block;font-size:12px;color:var(--muted);margin-top:4px}
.rep-tile.green b{color:var(--ok)}.rep-tile.amber b{color:#B45309}.rep-tile.red b{color:var(--danger)}
:root[data-theme="dark"] .rep-tile.amber b{color:#FCD34D}

/* Age groups: the 5 totals */
.rep-legend{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:6px;margin:2px 0 4px}
.rep-bucket{display:flex;flex-direction:column;align-items:center;gap:3px;min-height:68px;padding:8px 4px;border:1.5px solid var(--line);border-radius:var(--r-sm);background:var(--surface);color:var(--ink);cursor:pointer}
.rep-bucket b{font:800 20px/1 var(--font-head)}
.rep-bucket span{font-size:10.5px;color:var(--muted);text-align:center;line-height:1.15}
.rep-bucket.on{border-color:var(--ink);background:var(--accent-soft)}
.rep-bucket[disabled]{opacity:.55;cursor:default}

/* One aging row: name + numbers, then a strip of the 5 groups (each a ≥44px button) */
.rep-arow{margin:0 0 8px;border:1px solid var(--line-2);border-radius:var(--r-sm);background:var(--surface);box-shadow:var(--shadow-1);overflow:hidden}
.rep-arow.sub{margin-left:12px;box-shadow:none;background:var(--surface-2)}
.rep-arow-h{display:block;width:100%;min-height:48px;padding:10px 12px 6px;border:0;background:none;text-align:left;font:inherit;color:inherit;cursor:pointer}
.rep-arow-h b{display:block;font-size:15px}
.rep-arow-h small{display:block;font-size:12.5px;color:var(--muted);margin-top:1px}
.rep-arow-h.on{background:var(--accent-soft)}
.rep-strip{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:4px;padding:0 8px 8px}
.rep-seg{display:flex;align-items:center;justify-content:center;gap:5px;min-height:44px;padding:0 4px;border:1.5px solid var(--line-2);border-radius:10px;background:var(--surface);color:var(--ink);font:inherit;cursor:pointer}
.rep-arow.sub .rep-seg{background:var(--surface)}
.rep-seg b{font:800 16px/1 var(--font-head)}
.rep-seg.zero{color:var(--muted);cursor:default}
.rep-seg.zero .agedot{opacity:.35}
.rep-seg.zero b{font-weight:600}
.rep-seg.on{border-color:var(--ink);background:var(--accent-soft)}
.rep-seg:not(.zero):hover{border-color:var(--ink-2)}
.rep-strip-head{padding:0 9px 4px}
.rep-strip-head span{font-size:10.5px;font-weight:700;color:var(--muted);text-align:center;letter-spacing:.02em}
.rep-floors{margin:-2px 0 10px}
.rep-floors summary{cursor:pointer;font-weight:600;font-size:14px;min-height:44px;display:flex;align-items:center;padding:0 4px;color:var(--ink-2)}
.rep-listhead{display:flex;align-items:center;gap:10px;justify-content:space-between}
.rep-listhead h4{margin:0}
.rep-listhead .btn{min-height:44px;padding:6px 12px}
#repAgeList .rep-list{margin-top:10px}
#repAgeList{scroll-margin-top:70px}

.rep-hold{color:#B45309;font-weight:600}
:root[data-theme="dark"] .rep-hold{color:#FCD34D}

.rep-tablewrap{overflow-x:auto;-webkit-overflow-scrolling:touch;margin:0 -16px;padding:0 16px}
.rep-table{width:100%;border-collapse:collapse;font-size:14px;background:var(--surface);border-radius:var(--r-sm);overflow:hidden}
.rep-table th{text-align:left;font-size:11.5px;letter-spacing:.06em;text-transform:uppercase;color:var(--muted);padding:9px 10px;border-bottom:1px solid var(--line);white-space:nowrap;background:var(--surface-2)}
.rep-table td{padding:10px;border-bottom:1px solid var(--line-2);vertical-align:top}
.rep-table .num{text-align:right;white-space:nowrap;font-variant-numeric:tabular-nums}
.rep-table tbody tr:last-child td{border-bottom:0}
@media (max-width:599px){
  .rep-table,.rep-table tbody,.rep-table tr,.rep-table td{display:block}
  .rep-table thead{display:none}
  .rep-table tr{border:1px solid var(--line-2);border-radius:var(--r-sm);margin:0 0 8px;padding:6px 0;box-shadow:var(--shadow-1)}
  .rep-table td{display:flex;justify-content:space-between;gap:12px;padding:5px 12px;border:0;text-align:right}
  .rep-table td.num{text-align:right}
  .rep-table td::before{content:attr(data-h);color:var(--muted);font-size:12.5px;text-align:left;flex:none}
  .rep-table td:first-child{font-size:15px;padding-bottom:6px;border-bottom:1px solid var(--line-2);margin-bottom:4px;text-align:left}
  .rep-table td:first-child::before{display:none}
}
.rep-cols{display:grid;grid-template-columns:minmax(0,1fr);gap:0 20px}
@media (min-width:760px){.rep-cols{grid-template-columns:minmax(0,1fr) minmax(0,1fr)}}
.rep-note{margin:0 0 10px}

.rep-list{display:flex;flex-direction:column;gap:6px}
.rep-item{display:flex;align-items:center;gap:12px;width:100%;min-height:64px;padding:10px 12px;border:1px solid var(--line-2);border-radius:var(--r-sm);background:var(--surface);text-align:left;font:inherit;color:inherit;cursor:pointer;box-shadow:var(--shadow-1)}
.rep-item:hover{background:var(--surface-2)}
.rep-item .ph{flex:none;width:56px;height:56px;border-radius:var(--r-xs);overflow:hidden;background:var(--surface-2);display:grid;place-items:center;color:var(--muted)}
.rep-item .ph img{width:100%;height:100%;object-fit:cover}
.rep-item .grow{flex:1;min-width:0}
.rep-item .grow b{display:block;font-size:15px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.rep-item .grow small{display:block;font-size:12.5px;color:var(--muted);margin-top:1px;line-height:1.35}
.rep-item .grow small .agedot{margin-right:5px}
.rep-item-right{flex:none;text-align:right;display:flex;flex-direction:column;align-items:flex-end;gap:2px;max-width:40%}
.rep-code{font:800 18px/1 var(--font-head)}
.rep-item-right small{font-size:12px;color:var(--muted)}

/* "N days old" badge on product cards (over 90 days, people who see reports): the bucket's dot + day count, in the
   same 5-group colours as the report legend and the shell's .agedot (a3 = 91–180 red, a4 = over 180 dark red).
   The badge carries the dot, so the shell's bare dot is hidden on that card. */
.badge.rep-age{gap:5px}
.badge.rep-age .agedot{width:8px;height:8px;box-shadow:none;flex:none}
.badge.rep-age.a3{background:#FEE2E2;color:#B91C1C}
.badge.rep-age.a4{background:#7F1D1D;color:#fff}
.badge.rep-age.a4 .agedot{box-shadow:0 0 0 1.5px #fff}
:root[data-theme="dark"] .badge.rep-age.a3{background:#3A1A17;color:#FCA5A5}
:root[data-theme="dark"] .badge.rep-age.a4{background:#5B1414;color:#FECACA}
@media (prefers-color-scheme:dark){
  :root:not([data-theme="light"]) .badge.rep-age.a3{background:#3A1A17;color:#FCA5A5}
  :root:not([data-theme="light"]) .badge.rep-age.a4{background:#5B1414;color:#FECACA}
}
.card .body:has(.rep-age)>.agedot{display:none}
.rep-more{margin:12px 0 4px}

/* R15-1 #17: the table header row stays on screen while scrolling (the table scrolls inside its own box) */
@media (min-width:600px){
  .rep-tablewrap{max-height:70vh;overflow:auto}
  .rep-table thead th{position:sticky;top:0;z-index:2}
  /* R15 (user test fix): overflow:hidden made the TABLE the sticky header's scroll box, so the header scrolled away inside
     .rep-tablewrap. overflow:clip keeps the rounded corners but is not a scroll box; visible where clip is unknown. */
  .rep-table{overflow:visible}
  @supports (overflow:clip){ .rep-table{overflow:clip} }
}
.rep-whole{min-height:44px}
.rep-filters .rep-whole{margin-top:4px}

/* r32 M15 (Order to dispatch — Ritika's Dispatched report): small words under a tick (the job's day under Order punch, the Ready
   backlog "Ready 12 days" amber over 7 / red over 30, "Ready since: not known (old sheet)", a QC problem), the grey
   "No total yet" payment badge, "–" for a step the piece never needs. Plain colours only (the desk PC runs Chrome 109). */
.rep-cellsub,.rep-since{display:block;font-size:11.5px;line-height:1.3;color:var(--muted);margin-top:2px;white-space:nowrap}
.rep-since.amber{color:#B45309}
.rep-since.red{color:var(--danger)}
:root[data-theme="dark"] .rep-since.amber{color:#FCD34D}
@media (prefers-color-scheme:dark){ :root:not([data-theme="light"]) .rep-since.amber{color:#FCD34D} }
.rep-plan .badge.gray{background:var(--surface-2);color:var(--muted)}
.rep-nonneed{opacity:.55}
.rep-pmode .chip{flex:none}
@media (max-width:599px){ .rep-table td .rep-cellsub,.rep-table td .rep-since{text-align:right} }
