/* NOWY — Strumenti di tesoreria (pagamenti, estratti conto): stili condivisi.
   Richiede nowy-core.css e strumenti.css. */

.ts-samples{ display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2) var(--space-3); }
.ts-samples__label{ font-size: var(--text-small); color: var(--color-fg-2); margin-right: var(--space-1); }
.ts-sample{
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 36px; padding: 0 14px;
  border: 1px solid var(--color-border); border-radius: var(--radius-full);
  background: var(--color-surface);
  font-size: var(--text-small); color: var(--color-fg-2);
  transition: border-color var(--dur-base) var(--ease-standard), color var(--dur-base) var(--ease-standard);
}
.ts-sample:hover{ border-color: var(--color-fg-3); color: var(--color-fg); }
.ts-sample:focus-visible{ box-shadow: var(--ring); }
.ts-sample::before{ content: ""; width: 7px; height: 7px; border-radius: 50%; background: #1F8A55; flex: none; }
.ts-sample--bad::before{ background: #C2341F; }
.ts-loader.is-loaded .dropzone{ padding-block: var(--space-6); }
.ts-loader.is-loaded .dropzone__hint{ display: none; }

/* elenco file */
.ts-listwrap{ max-height: 380px; overflow-y: auto; }
.ts-file{ max-width: 300px; overflow-wrap: anywhere; font-weight: var(--weight-medium); }
.ts-list tr.is-current td{ background: var(--brand-50); }
.ts-list tbody tr{ cursor: pointer; }
.ts-list .btn--sm{ --btn-h: 34px; --btn-px: 14px; }
.ts-muted{ color: var(--color-fg-3); }

/* intestazione del dettaglio */
.ts-detail{ scroll-margin-top: calc(var(--nav-h) + 12px); }
.ts-head{ display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: var(--space-4) var(--space-8); margin-bottom: var(--space-6); }
.ts-head__title{ font-size: var(--text-h2); line-height: 1.15; letter-spacing: var(--tracking-heading); font-weight: var(--weight-medium); overflow-wrap: anywhere; }
.ts-head__title:focus{ outline: none; }
.ts-head__sub{ margin-top: var(--space-2); color: var(--color-fg-2); font-size: var(--text-small); }
.ts-verdict{ display: inline-flex; align-items: center; gap: 10px; padding: 10px 16px; border-radius: var(--radius-md); font-size: var(--text-small); font-weight: var(--weight-medium); }
.ts-verdict svg{ width: 18px; height: 18px; flex: none; }
.ts-verdict--ok{ background: #E7F5EE; color: #0F5532; }
.ts-verdict--warn{ background: #FEF3E2; color: #6B3A00; }
.ts-verdict--err{ background: #FDECEA; color: #7A170F; }

/* KPI */
.ts-kpis{ display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 1px; background: var(--color-border); border: 1px solid var(--color-border); border-radius: var(--radius-md); overflow: hidden; margin-bottom: var(--space-6); }
.ts-kpi{ display: grid; gap: 4px; align-content: start; padding: var(--space-4) var(--space-5); background: var(--color-surface); min-width: 0; }
.ts-kpi__label{ font-family: var(--font-mono); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--color-fg-3); }
.ts-kpi__value{ font-size: var(--text-h3); line-height: 1.2; font-weight: var(--weight-medium); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.ts-kpi__value.is-mono{ font-family: var(--font-mono); font-size: 15px; letter-spacing: 0; }
.ts-kpi__note{ font-size: var(--text-caption); color: var(--color-fg-3); overflow-wrap: anywhere; }
.ts-kpi--err .ts-kpi__value, .ts-kpi--warn .ts-kpi__value, .ts-kpi--ok .ts-kpi__value{ font-size: 1.05rem; }
.ts-kpi--err .ts-kpi__value{ color: #A41F15; }
.ts-kpi--warn .ts-kpi__value{ color: #8A4B00; }
.ts-kpi--ok .ts-kpi__value{ color: #146B3E; }

/* barra filtri / ricerca */
.ts-bar{ display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-3); margin-bottom: var(--space-4); }
.ts-search{ min-width: min(320px, 100%); }
.ts-search .input{ height: 42px; }
.ts-tabs{ margin-bottom: var(--space-5); }
.tab[aria-pressed="true"]{ background: var(--color-primary); color: var(--color-on-primary); }
.tab[aria-pressed="true"] .ts-muted{ color: inherit; opacity: .7; }

/* rilievi */
.ts-findings{ list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-2); }
.ts-f{ border: 1px solid var(--color-border); border-radius: var(--radius-md); background: var(--color-surface); min-width: 0; }
.ts-f > summary{
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  cursor: pointer; list-style: none;
}
.ts-f > summary::-webkit-details-marker{ display: none; }
.ts-f > summary:focus-visible{ box-shadow: var(--ring); border-radius: var(--radius-md); }
.ts-f__title{ font-weight: var(--weight-medium); line-height: 1.35; }
.ts-f__meta{ display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 2px; font-size: var(--text-caption); color: var(--color-fg-3); }
.ts-f__count{ font-family: var(--font-mono); font-size: 12px; color: var(--color-fg-3); white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; }
.ts-f__count svg{ width: 16px; height: 16px; transition: transform var(--dur-base) var(--ease-out); }
.ts-f[open] .ts-f__count svg{ transform: rotate(180deg); }
.ts-f__body{ display: grid; gap: var(--space-3); padding: 0 var(--space-4) var(--space-4); }
.ts-f__body p{ margin: 0; font-size: var(--text-small); line-height: 1.6; color: var(--color-fg-2); max-width: 90ch; }
.ts-f__fix{ padding: var(--space-3) var(--space-4); background: var(--color-bg); border-radius: var(--radius-sm); }
.ts-f__fix strong{ color: var(--color-fg); font-weight: var(--weight-semibold); }
.ts-f--err{ border-left: 3px solid #C2341F; }
.ts-f--warn{ border-left: 3px solid #D98A12; }
.ts-f--info{ border-left: 3px solid var(--brand-300); }
.ts-f--ok{ border-left: 3px solid #1F8A55; }
.ts-occ{ font-size: 12.5px; }
.ts-occ td, .ts-occ th{ padding: 6px 10px; }
.ts-occ .t-mono{ font-size: 12px; word-break: break-all; }
.ts-occwrap{ max-height: 260px; overflow: auto; }
.ts-empty{ padding: var(--space-6); text-align: center; color: var(--color-fg-3); font-size: var(--text-small); }

/* tabelle dati */
.ts-tablewrap{ max-height: 640px; overflow: auto; }
.ts-table td{ vertical-align: top; }
.ts-table .ts-rmt{ min-width: 220px; max-width: 420px; color: var(--color-fg-2); }
.ts-table .ts-name{ min-width: 160px; max-width: 260px; font-weight: var(--weight-medium); }
.ts-table .t-mono{ font-size: 12px; white-space: nowrap; }
.ts-table tbody tr.is-flag{ cursor: pointer; }
.ts-table tbody tr.is-open td{ background: var(--brand-50); }
.ts-table tr.ts-sub td{ background: var(--color-bg); padding-top: 4px; }
.ts-sub ul{ margin: 0; padding-left: 0; list-style: none; display: grid; gap: 4px; font-size: var(--text-small); color: var(--color-fg-2); }
.ts-pos{ color: #146B3E; }
.ts-neg{ color: var(--color-fg); }
.ts-more{ margin-top: var(--space-3); }

/* quadratura saldi */
.ts-recon{ display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); align-items: stretch; gap: var(--space-2); margin-bottom: var(--space-6); }
.ts-recon__cell{ display: grid; gap: 4px; align-content: start; padding: var(--space-4); border-radius: var(--radius-md); background: var(--color-bg); min-width: 0; }
.ts-recon__cell .ts-kpi__value{ font-size: 1.15rem; }
.ts-recon__op{ font-family: var(--font-mono); color: var(--color-fg-3); margin-right: 4px; }
.ts-recon__cell--res{ background: #E7F5EE; }
.ts-recon__cell--res.is-bad{ background: #FDECEA; }
@media (max-width: 899px){ .ts-recon{ grid-template-columns: repeat(2, minmax(0, 1fr)); } .ts-recon__cell--res{ grid-column: 1 / -1; } }

/* elenco controlli (come funziona) */
.ts-rules{ margin-top: var(--space-8); border: 1px solid var(--color-border-strong); border-radius: var(--radius-md); }
.ts-rules > summary{ padding: var(--space-4) var(--space-5); cursor: pointer; font-weight: var(--weight-medium); }
.ts-rules > summary:focus-visible{ box-shadow: var(--ring); border-radius: var(--radius-md); }
.ts-rules .table-wrap{ border: 0; border-top: 1px solid var(--color-border); border-radius: 0 0 var(--radius-md) var(--radius-md); }

@media (max-width: 639px){
  .ts-head__title{ font-size: var(--text-h3); }
  .ts-f > summary{ grid-template-columns: auto minmax(0, 1fr); }
  .ts-f__count{ grid-column: 2; }
  .ts-kpis{ grid-template-columns: 1fr; }
  .ts-kpi{ grid-template-columns: minmax(0, 1fr); padding: var(--space-3) var(--space-4); }
  .ts-kpi__value{ font-size: 1.1rem; }
  .ts-recon{ grid-template-columns: 1fr; }
  .ts-recon__cell{ padding: var(--space-3) var(--space-4); }
  .ts-tabs .tab, .ts-bar .tabs .tab{ flex: 1 1 0; padding: 0 8px; min-width: 0; }
  .ts-bar .tabs, .ts-tabs{ flex-wrap: nowrap; }
  .ts-table td{ white-space: normal; }
}
@media print{
  .ts-loader, .ts-bar, .ts-tabs, .ts-list .btn{ display: none !important; }
  .ts-f{ break-inside: avoid; }
  .ts-tablewrap, .ts-occwrap, .ts-listwrap{ max-height: none !important; overflow: visible !important; }
}
