/* Stable column widths for the main administrative list tables.
   Loaded after page-specific table styles so content cannot resize columns.
   Column visibility/pinning keeps working because hidden cells are excluded. */

@media (min-width: 768px) {
  table.families-table,
  table.volunteers-table,
  table.visits-table,
  table.institutions-table {
    width: max-content !important;
    min-width: 100% !important;
    max-width: none !important;
    table-layout: fixed !important;
  }

  table.families-table > :not(caption) > * > *,
  table.volunteers-table > :not(caption) > * > *,
  table.visits-table > :not(caption) > * > *,
  table.institutions-table > :not(caption) > * > * {
    box-sizing: border-box;
    white-space: normal !important;
    overflow-wrap: anywhere !important;
    word-break: normal !important;
  }

  table.families-table input,
  table.families-table select,
  table.volunteers-table input,
  table.volunteers-table select,
  table.visits-table input,
  table.visits-table select,
  table.institutions-table input,
  table.institutions-table select {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
  }

  /* Rodziny */
  table.families-table tr > [data-table-column-original="1"]  { width: 11rem !important; min-width: 11rem !important; max-width: 11rem !important; }
  table.families-table tr > [data-table-column-original="2"]  { width: 15rem !important; min-width: 15rem !important; max-width: 15rem !important; }
  table.families-table tr > [data-table-column-original="3"]  { width: 13rem !important; min-width: 13rem !important; max-width: 13rem !important; }
  table.families-table tr > [data-table-column-original="4"]  { width: 9rem !important;  min-width: 9rem !important;  max-width: 9rem !important; }
  table.families-table tr > [data-table-column-original="5"]  { width: 11rem !important; min-width: 11rem !important; max-width: 11rem !important; }
  table.families-table tr > [data-table-column-original="6"]  { width: 20rem !important; min-width: 20rem !important; max-width: 20rem !important; }
  table.families-table tr > [data-table-column-original="7"]  { width: 12rem !important; min-width: 12rem !important; max-width: 12rem !important; }
  table.families-table tr > [data-table-column-original="8"]  { width: 10rem !important; min-width: 10rem !important; max-width: 10rem !important; }
  table.families-table tr > [data-table-column-original="9"]  { width: 11rem !important; min-width: 11rem !important; max-width: 11rem !important; }
  table.families-table tr > [data-table-column-original="10"] { width: 13rem !important; min-width: 13rem !important; max-width: 13rem !important; }
  table.families-table tr > [data-table-column-original="11"] { width: 16rem !important; min-width: 16rem !important; max-width: 16rem !important; }
  table.families-table tr > [data-table-column-original="12"] { width: 16rem !important; min-width: 16rem !important; max-width: 16rem !important; }
  table.families-table tr > [data-table-column-original="13"] { width: 12rem !important; min-width: 12rem !important; max-width: 12rem !important; }
  table.families-table tr > [data-table-column-original="14"] { width: 14rem !important; min-width: 14rem !important; max-width: 14rem !important; }
  table.families-table tr > [data-table-column-original="15"] { width: 24rem !important; min-width: 24rem !important; max-width: 24rem !important; }
  table.families-table tr > [data-table-column-original="16"] { width: 11rem !important; min-width: 11rem !important; max-width: 11rem !important; }
  table.families-table tr > [data-table-column-original="17"] { width: 11rem !important; min-width: 11rem !important; max-width: 11rem !important; }
  table.families-table tr > [data-table-column-original="18"] { width: 10rem !important; min-width: 10rem !important; max-width: 10rem !important; }

  /* Kolumna Akcje: te same zasady szerokości w głównych listach.
     Wizyty zachowują się tak samo jak Wolontariusze: szerokość automatyczna,
     minimum na czytelne sterowanie i wspólny limit 203 px. */
  table.families-table tr > .table-action-cell,
  table.visits-table tr > .table-action-cell,
  table.institutions-table tr > .table-action-cell {
    width: auto !important;
    min-width: 60px !important;
    max-width: 203px !important;
  }

  /* Wolontariusze: dodatkowe pola mają stałą szerokość bazową 12rem. */
  table.volunteers-table [data-volunteer-column] {
    width: 12rem !important;
    min-width: 12rem !important;
    max-width: 12rem !important;
  }
  table.volunteers-table [data-volunteer-column="name"]         { width: 15rem !important; min-width: 15rem !important; max-width: 15rem !important; }
  table.volunteers-table [data-volunteer-column="region"]       { width: 16rem !important; min-width: 16rem !important; max-width: 16rem !important; }
  table.volunteers-table [data-volunteer-column="gender"]       { width: 9rem !important;  min-width: 9rem !important;  max-width: 9rem !important; }
  table.volunteers-table [data-volunteer-column="experience"]   { width: 14rem !important; min-width: 14rem !important; max-width: 14rem !important; }
  table.volunteers-table [data-volunteer-column="active"]       { width: 10rem !important; min-width: 10rem !important; max-width: 10rem !important; }
  table.volunteers-table [data-volunteer-column="availability"] { width: 14rem !important; min-width: 14rem !important; max-width: 14rem !important; }
  table.volunteers-table [data-volunteer-column="independent"]  { width: 11rem !important; min-width: 11rem !important; max-width: 11rem !important; }
  table.volunteers-table [data-volunteer-column="assignments"]  { width: 11rem !important; min-width: 11rem !important; max-width: 11rem !important; }
  table.volunteers-table [data-volunteer-column="phone"]        { width: 11rem !important; min-width: 11rem !important; max-width: 11rem !important; }
  table.volunteers-table [data-volunteer-column="email"]        { width: 17rem !important; min-width: 17rem !important; max-width: 17rem !important; }
  table.volunteers-table [data-volunteer-column="actions"]      { width: auto !important; min-width: 60px !important; max-width: 203px !important; }

  /* Wizyty */
  table.visits-table tr > [data-table-column-original="1"]  { width: 5rem !important;  min-width: 5rem !important;  max-width: 5rem !important; }
  table.visits-table tr > [data-table-column-original="2"]  { width: 10rem !important; min-width: 10rem !important; max-width: 10rem !important; }
  table.visits-table tr > [data-table-column-original="3"]  { width: 12rem !important; min-width: 12rem !important; max-width: 12rem !important; }
  table.visits-table tr > [data-table-column-original="4"]  { width: 9rem !important;  min-width: 9rem !important;  max-width: 9rem !important; }
  table.visits-table tr > [data-table-column-original="5"]  { width: 14rem !important; min-width: 14rem !important; max-width: 14rem !important; }
  table.visits-table tr > [data-table-column-original="6"]  { width: 9rem !important;  min-width: 9rem !important;  max-width: 9rem !important; }
  table.visits-table tr > [data-table-column-original="7"]  { width: 11rem !important; min-width: 11rem !important; max-width: 11rem !important; }
  table.visits-table tr > [data-table-column-original="8"]  { width: 10rem !important; min-width: 10rem !important; max-width: 10rem !important; }
  table.visits-table tr > [data-table-column-original="9"]  { width: 9rem !important;  min-width: 9rem !important;  max-width: 9rem !important; }
  table.visits-table tr > [data-table-column-original="10"] { width: 10rem !important; min-width: 10rem !important; max-width: 10rem !important; }
  table.visits-table tr > [data-table-column-original="11"] { width: 11rem !important; min-width: 11rem !important; max-width: 11rem !important; }
  table.visits-table tr > [data-table-column-original="12"] { width: 16rem !important; min-width: 16rem !important; max-width: 16rem !important; }
  table.visits-table tr > [data-table-column-original="13"] { width: 16rem !important; min-width: 16rem !important; max-width: 16rem !important; }
  table.visits-table tr > [data-table-column-original="14"] { width: 10rem !important; min-width: 10rem !important; max-width: 10rem !important; }

  /* Instytucje */
  table.institutions-table tr > [data-table-column-original="1"]  { width: 16rem !important; min-width: 16rem !important; max-width: 16rem !important; }
  table.institutions-table tr > [data-table-column-original="2"]  { width: 20rem !important; min-width: 20rem !important; max-width: 20rem !important; }
  table.institutions-table tr > [data-table-column-original="3"]  { width: 11rem !important; min-width: 11rem !important; max-width: 11rem !important; }
  table.institutions-table tr > [data-table-column-original="4"]  { width: 12rem !important; min-width: 12rem !important; max-width: 12rem !important; }
  table.institutions-table tr > [data-table-column-original="5"]  { width: 16rem !important; min-width: 16rem !important; max-width: 16rem !important; }
  table.institutions-table tr > [data-table-column-original="6"]  { width: 20rem !important; min-width: 20rem !important; max-width: 20rem !important; }
  table.institutions-table tr > [data-table-column-original="7"]  { width: 6rem !important;  min-width: 6rem !important;  max-width: 6rem !important; }
  table.institutions-table tr > [data-table-column-original="8"]  { width: 9rem !important;  min-width: 9rem !important;  max-width: 9rem !important; }
  table.institutions-table tr > [data-table-column-original="9"]  { width: 12rem !important; min-width: 12rem !important; max-width: 12rem !important; }
  table.institutions-table tr > [data-table-column-original="10"] { width: 11rem !important; min-width: 11rem !important; max-width: 11rem !important; }
  table.institutions-table tr > [data-table-column-original="11"] { width: 11rem !important; min-width: 11rem !important; max-width: 11rem !important; }
  table.institutions-table tr > [data-table-column-original="12"] { width: 10rem !important; min-width: 10rem !important; max-width: 10rem !important; }

  table.families-table td[colspan],
  table.volunteers-table td[colspan],
  table.visits-table td[colspan],
  table.institutions-table td[colspan] {
    width: auto !important;
    min-width: 0 !important;
    max-width: none !important;
  }
}
