table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 15px;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.card table {
  border: none;
  border-radius: 0;
  box-shadow: none;
}

thead th {
  text-align: left;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  line-height: 1.4;
  color: var(--color-text-muted);
  background: var(--color-bg-subtle);
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--color-border);
}

th:first-child,
td:first-child {
  padding-left: var(--space-5);
}

th:last-child,
td:last-child {
  padding-right: var(--space-5);
}

tbody td {
  padding: var(--space-4);
  border-bottom: 1px solid var(--color-border);
  vertical-align: middle;
}

tbody tr:last-child td {
  border-bottom: none;
}

tbody tr:hover td {
  background: var(--color-bg-subtle);
}

table a {
  font-weight: 500;
}

th.cell-num,
td.cell-num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  width: 1%;
}

td.cell-nowrap {
  white-space: nowrap;
}

td.cell-strong {
  min-width: 180px;
  font-weight: 500;
}

td.cell-wrap {
  overflow-wrap: break-word;
}

td.cell-muted {
  color: var(--color-text-muted);
}

th.cell-right,
td.cell-right {
  text-align: right;
}

.table-actions {
  display: flex;
  gap: var(--space-2);
  align-items: center;
  justify-content: flex-end;
}

.table-empty td {
  text-align: center;
  color: var(--color-text-muted);
  padding: var(--space-7) var(--space-4);
}

.table-scroll {
  overflow-x: auto;
}

.file-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.file-list a {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: 14px;
}

.file-list svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

@media (max-width: 720px) {
  table,
  thead,
  tbody,
  th,
  td,
  tr {
    display: block;
  }

  table {
    border-radius: var(--radius-lg);
  }

  thead tr {
    display: none;
  }

  tbody tr {
    border-bottom: 1px solid var(--color-border);
    padding: var(--space-4) var(--space-5);
  }

  tbody tr:last-child {
    border-bottom: none;
  }

  tbody tr:hover td {
    background: none;
  }

  tbody td,
  tbody td:first-child,
  tbody td:last-child {
    border: none;
    padding: var(--space-1) 0;
  }

  td.cell-num {
    text-align: left;
    width: auto;
  }

  /* A compact card: the name on top, then "label  value" lines - the
     label in a narrow column on the left, not a line of its own. */
  tbody tr {
    position: relative;
  }

  tbody td[data-label] {
    position: relative;
    min-height: 28px;
    padding-left: 96px;
  }

  tbody td[data-label]::before {
    content: attr(data-label);
    position: absolute;
    top: 6px;
    left: 0;
    width: 88px;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--color-text-faint);
  }

  tbody td.cell-strong,
  tbody td.cell-strong[data-label] {
    padding-left: 0;
    padding-bottom: var(--space-2);
    padding-right: 40px;
    font-size: 16px;
    font-weight: 700;
  }

  tbody td.cell-strong::before {
    display: none;
  }

  /* The row's checkbox sits in its top-right corner. */
  tbody td.cell-check {
    position: absolute;
    top: var(--space-4);
    right: var(--space-5);
    padding: 0;
  }

  /* No buttons for this row - no empty "Akcje" line either. */
  tbody td.cell-actions:not(:has(button, a, form)) {
    display: none;
  }

  tbody td.cell-actions[data-label] {
    padding-left: 0;
  }

  tbody td.cell-actions::before {
    display: none;
  }

  td.cell-right {
    text-align: left;
  }

  .table-actions {
    justify-content: flex-start;
    padding-top: var(--space-2);
  }

  .table-empty td {
    padding: var(--space-6) 0;
  }

  td.cell-strong {
    width: 100%;
  }
}

td.cell-actions {
  width: 1%;
  white-space: nowrap;
}

@media (max-width: 720px) {
  td.cell-actions {
    width: auto;
    white-space: normal;
  }
}

/* Row checkboxes and the bulk actions bar (requests_bulk.js) */
th.cell-check,
td.cell-check {
  width: 1%;
  padding-right: 0;
}

.cell-check input {
  display: block;
  margin: 0;
}

.bulk-bar {
  position: sticky;
  bottom: var(--space-4);
  z-index: 20;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2) var(--space-4);
  width: fit-content;
  max-width: 100%;
  margin: var(--space-4) auto 0;
  padding: var(--space-2) var(--space-2) var(--space-2) var(--space-4);
  border-radius: var(--radius-lg);
  background: var(--color-black);
  color: #fff;
  font-size: 14px;
  box-shadow: 0 12px 32px rgb(11 11 12 / 25%);
}

.bulk-bar[hidden] {
  display: none;
}

.bulk-bar__check {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--color-primary);
}

.bulk-bar__count {
  font-weight: 600;
  white-space: nowrap;
}

.bulk-bar__link {
  padding: 0;
  border: 0;
  background: none;
  color: #fff;
  font: inherit;
  font-weight: 500;
  text-decoration: underline;
  text-decoration-color: rgb(255 255 255 / 40%);
  text-underline-offset: 3px;
  cursor: pointer;
}

.bulk-bar__link:hover {
  text-decoration-color: #fff;
}

.bulk-bar__link[hidden] {
  display: none;
}

.bulk-bar__delete {
  margin-left: var(--space-2);
}

/* Phones have no table header: its "select the page" checkbox moves here.
   (.table-scroll > : stronger than forms.css' label:has(> checkbox).) */
.table-scroll > .select-page-mobile {
  display: none;
}

@media (max-width: 720px) {
  .table-scroll > .select-page-mobile {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    margin: 0 0 var(--space-3);
    padding: 0 var(--space-5);
    font-size: 14px;
    font-weight: 500;
    color: var(--color-text-muted);
  }

  .select-page-mobile input {
    margin: 0;
  }
}

/* Phones: the bulk bar in two tidy rows across the screen -
   [☑] Zaznaczono: 20 ........ [Usuń]
   Zaznacz wszystkie (145)     Odznacz */
@media (max-width: 720px) {
  .bulk-bar {
    display: grid;
    grid-template-columns: auto 1fr auto;
    grid-template-areas:
      "check count delete"
      "all all clear";
    align-items: center;
    gap: var(--space-3) var(--space-3);
    width: 100%;
    padding: var(--space-3) var(--space-3) var(--space-3) var(--space-4);
  }

  .bulk-bar__check {
    grid-area: check;
  }

  .bulk-bar__count {
    grid-area: count;
  }

  .bulk-bar__delete {
    grid-area: delete;
    margin-left: 0;
  }

  /* One line across the bar above the second row. */
  .bulk-bar::before {
    content: "";
    grid-column: 1 / -1;
    grid-row: 2;
    align-self: start;
    border-top: 1px solid rgb(255 255 255 / 15%);
  }

  .bulk-bar [data-bulk-everything],
  .bulk-bar [data-bulk-clear] {
    padding-top: var(--space-3);
  }

  .bulk-bar [data-bulk-everything] {
    grid-area: all;
    justify-self: start;
  }

  .bulk-bar [data-bulk-clear] {
    grid-area: clear;
    justify-self: end;
  }
}

/* A file the sender sent back - an earlier, wrong version: greyed and
   crossed out, after the current ones (apps/documents/models.rejected_last). */
.file-list .file-link--rejected a {
  color: var(--color-text-faint);
  text-decoration: line-through;
}

.file-list .file-link--rejected svg {
  opacity: 0.6;
}

.file-status {
  margin-left: var(--space-1);
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--color-neutral-bg);
  color: var(--color-text-muted);
  font-size: 11px;
  font-weight: 700;
}
