/* Fase 69C - Coerenza UX trasversale, filtri mobile compatti e branding web. */
:root {
  --ux-ops-max-width: 1600px;
  --ux-ops-radius-xl: 22px;
  --ux-ops-radius-lg: 18px;
  --ux-ops-radius-md: 13px;
  --ux-ops-border: #d7e0ec;
  --ux-ops-muted: #64748b;
  --ux-ops-title: #061423;
  --ux-ops-surface: #ffffff;
  --ux-ops-surface-soft: #f8fafc;
  --ux-ops-shadow: 0 10px 28px rgba(15, 34, 56, .07);
}

/* Branding globale: il logo configurato nei PDF diventa la stessa fonte della shell web. */
.shell-brand-link {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
  color: #fff;
}
.shell-brand-link:hover,
.shell-brand-link:focus-visible { color: #fff; }
.shell-brand-mark {
  position: relative;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 132px;
  height: 48px;
  padding: 5px 8px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 12px;
  background: rgba(255,255,255,.96);
}
.shell-brand-logo,
.shell-brand-logo-fallback {
  grid-area: 1 / 1;
  max-width: 100%;
  max-height: 100%;
}
.shell-brand-logo {
  display: block;
  width: auto;
  height: auto;
  object-fit: contain;
}
.shell-brand-logo-fallback {
  color: #0f62fe;
  font-size: 1.15rem;
  font-weight: 900;
  letter-spacing: -.04em;
}
.shell-brand-copy { min-width: 0; }
.shell-brand-copy h1 { margin: 0; font-size: clamp(1.25rem, 2vw, 1.8rem); line-height: 1.1; }
.shell-brand-copy p { margin: 4px 0 0; color: #d7e1ec; font-size: .82rem; line-height: 1.35; }

/* Un solo linguaggio visivo per Acquisti, Magazzino, Costi, Controlli e Catalogo. */
.ops-page,
.phase64-page,
.phase65-economic-page,
.phase66-quality,
.catalog-table-page {
  width: 100%;
  max-width: var(--ux-ops-max-width);
  margin-inline: auto;
  display: grid;
  gap: 18px;
}

.ops-page-head,
.phase64-hero,
.phase65-economic-head,
.phase66-page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 22px;
  margin: 0;
  padding: 22px 24px;
  border: 1px solid var(--ux-ops-border);
  border-radius: var(--ux-ops-radius-xl);
  background: linear-gradient(135deg, #ffffff 0%, #f5f9ff 100%);
  color: var(--ux-ops-title);
  box-shadow: var(--ux-ops-shadow);
}
.ops-page-head h2,
.phase64-hero h2,
.phase65-economic-head h2,
.phase66-page-head h2 {
  margin: 4px 0 7px;
  color: var(--ux-ops-title);
  font-size: clamp(1.55rem, 2.4vw, 2.25rem);
  line-height: 1.12;
}
.ops-page-head p,
.phase64-hero p,
.phase65-economic-head p,
.phase66-page-head .page-subtitle {
  max-width: 860px;
  margin: 0;
  color: #53657d;
  line-height: 1.5;
}
.phase64-eyebrow,
.phase65-eyebrow,
.phase66-eyebrow {
  display: block;
  color: #42617d;
  font-size: .74rem;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.ops-page-actions,
.phase64-actions,
.phase65-economic-actions,
.phase66-page-head .inline-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 9px;
  flex-wrap: wrap;
}

.ops-summary-grid,
.phase64-kpi-grid,
.phase65-kpi-grid,
.phase66-kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 12px;
}
.ops-summary-card,
.phase64-kpi-grid article,
.phase65-kpi,
.phase66-kpis .kpi {
  min-width: 0;
  min-height: 112px;
  padding: 15px 16px;
  border: 1px solid var(--ux-ops-border);
  border-radius: 17px;
  background: var(--ux-ops-surface);
  box-shadow: 0 7px 20px rgba(15, 34, 56, .05);
}
.ops-summary-card span,
.phase64-kpi-grid article > span,
.phase65-kpi > span,
.phase66-kpis .kpi > span {
  display: block;
  color: var(--ux-ops-muted);
  font-size: .74rem;
  font-weight: 900;
  letter-spacing: .045em;
  text-transform: uppercase;
}
.ops-summary-card strong,
.phase64-kpi-grid article > strong,
.phase65-kpi > strong,
.phase66-kpis .kpi > strong {
  display: block;
  margin-top: 7px;
  color: var(--ux-ops-title);
  font-size: 1.4rem;
  line-height: 1.12;
}
.ops-summary-card small,
.phase64-kpi-grid article > small,
.phase65-kpi > small,
.phase66-kpis .kpi > small {
  display: block;
  margin-top: 6px;
  color: var(--ux-ops-muted);
  line-height: 1.35;
}

.ops-card,
.phase64-panel,
.phase65-table-card,
.phase65-comparison-card,
.phase66-table-card,
.phase66-filters,
.catalog-table-card,
.catalog-list-filter {
  border: 1px solid var(--ux-ops-border);
  border-radius: var(--ux-ops-radius-lg);
  background: var(--ux-ops-surface);
  box-shadow: var(--ux-ops-shadow);
}
.ops-card,
.phase64-panel,
.phase66-table-card { padding: 18px; }

.ops-card-head,
.phase64-panel-head,
.phase65-table-summary,
.phase66-results-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}
.ops-card-head h3,
.phase64-panel-head h3,
.phase66-results-head h3 {
  margin: 0;
  color: var(--ux-ops-title);
  font-size: 1.08rem;
}
.ops-card-head p,
.phase64-panel-head p,
.phase66-results-head p {
  margin: 4px 0 0;
  color: var(--ux-ops-muted);
  line-height: 1.45;
}

.ops-filter-card,
.filter-card,
.phase64-filter-card,
.phase65-filter-card,
.phase66-filters,
.catalog-list-filter {
  border: 1px solid var(--ux-ops-border);
  border-radius: 17px;
  background: var(--ux-ops-surface);
  box-shadow: 0 7px 20px rgba(15, 34, 56, .05);
}
.ops-filter-card,
.filter-card,
.phase64-filter-card,
.phase65-filter-card,
.phase66-filters { padding: 16px; }

.filter-grid,
.phase64-filter-grid,
.phase65-filter-grid,
.phase66-filter-grid {
  gap: 12px;
}
.filter-grid label,
.phase64-filter-grid label,
.phase65-filter-grid label,
.phase66-filter-grid label,
.filter-field label {
  color: #334155;
  font-size: .78rem;
  font-weight: 800;
}
.filter-grid input,
.filter-grid select,
.phase64-filter-grid input,
.phase64-filter-grid select,
.phase65-filter-grid input,
.phase65-filter-grid select,
.phase66-filter-grid input,
.phase66-filter-grid select {
  min-height: 44px;
  border-color: #cbd5e1;
  border-radius: 11px;
}
.filter-actions,
.phase66-filter-actions,
.phase65-filter-card .actions {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
}

.ops-table-wrap,
.phase64-table-wrap,
.phase65-table-wrap,
.phase66-table-wrap,
.catalog-table-scroll {
  max-width: 100%;
  overflow: auto;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  background: #fff;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-inline: contain;
}
.ops-table-wrap table,
.phase64-table-wrap table,
.phase65-table,
.phase66-table,
.catalog-list-table {
  border-collapse: separate;
  border-spacing: 0;
}
.ops-table-wrap th,
.phase64-table-wrap th,
.phase65-table th,
.phase66-table th,
.catalog-list-table th {
  position: sticky;
  top: 0;
  z-index: 3;
  background: #eef4f8;
  color: #24384e;
  font-size: .72rem;
  font-weight: 900;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.ops-table-wrap th,
.ops-table-wrap td,
.phase64-table-wrap th,
.phase64-table-wrap td,
.phase65-table th,
.phase65-table td,
.phase66-table th,
.phase66-table td,
.catalog-list-table th,
.catalog-list-table td {
  padding: 11px 12px;
  border-bottom: 1px solid #e8edf4;
  vertical-align: top;
}
.ops-empty,
.phase64-empty,
.phase65-empty,
.phase66-empty {
  padding: 26px !important;
  text-align: center !important;
  color: var(--ux-ops-muted) !important;
  background: var(--ux-ops-surface-soft);
  border-radius: 12px;
}

.phase64-pagination,
.phase65-pagination,
.phase66-pagination,
.catalog-pagination,
.pagination-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  flex-wrap: wrap;
}
.phase64-pagination span,
.phase65-pagination span,
.phase66-pagination span,
.catalog-pagination-copy,
.pagination-copy {
  color: #475569;
  font-weight: 800;
}

.ops-section-nav {
  display: flex;
  gap: 7px;
  padding: 7px;
  border: 1px solid var(--ux-ops-border);
  border-radius: 15px;
  background: #fff;
  box-shadow: 0 6px 18px rgba(15,34,56,.05);
}
.ops-section-nav a {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 9px 12px;
  border-radius: 10px;
  color: #334155;
  font-weight: 800;
  white-space: nowrap;
}
.ops-section-nav a:hover,
.ops-section-nav a:focus-visible { background: #eef5ff; color: #17263a; }
.ops-section-nav a.is-active { background: #0f62fe; color: #fff; }

/* Pannello filtri mobile generato dal controller globale. Senza JS i filtri restano visibili. */
.ux-filter-toggle { display: none; }
.ux-filter-body { display: contents; }
.ux-filter-toggle-copy { display: grid; gap: 2px; text-align: left; }
.ux-filter-toggle-copy strong { color: #17263a; }
.ux-filter-toggle-copy small { color: var(--ux-ops-muted); font-weight: 700; }
.ux-filter-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 28px;
  padding: 0 8px;
  border-radius: 999px;
  background: #dbeafe;
  color: #1d4ed8;
  font-size: .78rem;
  font-weight: 900;
}
.ux-filter-chevron { margin-left: auto; transition: transform .16s ease; }
.ux-filter-form.ux-filter-expanded .ux-filter-chevron { transform: rotate(180deg); }

@media (max-width: 980px) {
  .ops-page-head,
  .phase64-hero,
  .phase65-economic-head,
  .phase66-page-head { flex-direction: column; }
  .ops-page-actions,
  .phase64-actions,
  .phase65-economic-actions,
  .phase66-page-head .inline-actions { width: 100%; justify-content: flex-start; }
}

@media (max-width: 760px) {
  .shell-brand-link { gap: 10px; }
  .shell-brand-mark { width: 104px; height: 40px; padding: 4px 6px; }
  .shell-brand-copy p { display: none; }

  .ops-page,
  .phase64-page,
  .phase65-economic-page,
  .phase66-quality,
  .catalog-table-page { gap: 13px; }

  .ops-page-head,
  .phase64-hero,
  .phase65-economic-head,
  .phase66-page-head {
    padding: 17px;
    border-radius: 17px;
  }
  .ops-page-actions > .btn,
  .ops-page-actions > form,
  .ops-page-actions > details,
  .phase64-actions > .btn,
  .phase64-actions > form,
  .phase65-economic-actions > .btn,
  .phase66-page-head .inline-actions > .btn {
    flex: 1 1 100%;
    width: 100%;
    text-align: center;
  }

  .ops-summary-grid,
  .phase64-kpi-grid,
  .phase65-kpi-grid,
  .phase66-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
  .ops-summary-card,
  .phase64-kpi-grid article,
  .phase65-kpi,
  .phase66-kpis .kpi { min-height: 96px; padding: 12px; }

  .ops-section-nav {
    overflow-x: auto;
    flex-wrap: nowrap;
    scroll-snap-type: x proximity;
    -webkit-overflow-scrolling: touch;
  }
  .ops-section-nav a { flex: 0 0 auto; scroll-snap-align: start; }

  body.ux-filters-ready .ux-filter-form {
    display: block !important;
    min-width: 0;
  }
  body.ux-filters-ready .ux-filter-form > .ux-filter-toggle {
    width: 100%;
    min-height: 54px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 12px;
    background: #f8fafc;
    color: #17263a;
    cursor: pointer;
    touch-action: manipulation;
  }
  body.ux-filters-ready .ux-filter-form > .ux-filter-body { display: none !important; }
  body.ux-filters-ready .ux-filter-form.ux-filter-expanded > .ux-filter-body {
    display: grid !important;
    gap: 12px;
    padding-top: 12px;
  }
  body.ux-filters-ready .ux-filter-form.ux-filter-expanded > .ux-filter-toggle {
    border-color: #93b4f5;
    background: #eef5ff;
  }
  body.ux-filters-ready .ux-filter-form .filter-grid,
  body.ux-filters-ready .ux-filter-form .phase64-filter-grid,
  body.ux-filters-ready .ux-filter-form .phase65-filter-grid,
  body.ux-filters-ready .ux-filter-form .phase66-filter-grid {
    grid-template-columns: minmax(0, 1fr) !important;
  }
  body.ux-filters-ready .ux-filter-form .filter-actions,
  body.ux-filters-ready .ux-filter-form .phase64-actions,
  body.ux-filters-ready .ux-filter-form .phase66-filter-actions,
  body.ux-filters-ready .ux-filter-form .actions {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
  }
  body.ux-filters-ready .ux-filter-form .filter-actions .btn,
  body.ux-filters-ready .ux-filter-form .phase64-actions .btn,
  body.ux-filters-ready .ux-filter-form .phase66-filter-actions .btn,
  body.ux-filters-ready .ux-filter-form .actions .btn {
    width: 100%;
    min-height: 48px;
    text-align: center;
  }

  .ops-card,
  .phase64-panel,
  .phase66-table-card { padding: 13px; border-radius: 14px; }
  .ops-card-head,
  .phase64-panel-head,
  .phase65-table-summary,
  .phase66-results-head { flex-direction: column; align-items: stretch; }

  .phase64-pagination .btn,
  .phase65-pagination .btn,
  .phase66-pagination .btn,
  .catalog-pagination .btn,
  .pagination-bar .btn { flex: 1 1 calc(50% - 9px); text-align: center; }
}

@media (max-width: 480px) {
  .ops-summary-grid,
  .phase64-kpi-grid,
  .phase65-kpi-grid,
  .phase66-kpis { grid-template-columns: minmax(0, 1fr); }
  .phase64-pagination .btn,
  .phase65-pagination .btn,
  .phase66-pagination .btn,
  .catalog-pagination .btn,
  .pagination-bar .btn { flex-basis: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .ux-filter-chevron { transition: none; }
}
