/* --- phone / narrow screen --------------------------------------------- */
@media (max-width: 900px) {
  .only-mobile { display: initial !important; }
  /* touch targets at least 44 px, checkboxes 24 px */
  input[type=text], input[type=search], select, .btn, .years input { min-height: 44px; height: 44px; }
  /* iOS zooms the page in when a focused field's text is under 16 px */
  input, select, textarea { font-size: 16px; }
  input[type=checkbox] { width: 24px; height: 24px; }
  .checks label, label.inline, .facet { min-height: 44px; align-items: center; }
  .icon-btn, .combo-clear { width: 44px; height: 44px; }
  .combo-clear { top: 0; right: 0; }
  .chip { height: 36px; }
  .chip button { width: 32px; height: 32px; }
  .pager button { min-width: 44px; height: 44px; }
  .pager select { height: 44px; }
  .copy { min-height: 44px; padding: 0 var(--s3); }
  .pkd-actions .btn-link, #clearFilters, .btn-link { min-height: 44px; display: inline-flex; align-items: center; }
  .ids { grid-template-columns: repeat(3, 1fr) !important; gap: var(--s1); }
  .ids div { padding: var(--s1) var(--s2); }
  .ids button { font-size: 12px; min-height: 32px; }
  .tabs button { padding: var(--s3) var(--s2); }
  .topbar { padding: 0 var(--s4); gap: var(--s2); }
  .topnav a { padding: 0 var(--s2); }
  .status-btn .status-txt { display: none; }
  /* just the dot (its colour is the state); the pill's background made a big pale circle */
  .status-btn, .status-btn.warn { width: 44px; height: 44px; justify-content: center; padding: 0; background: none; }
  .status-btn .dot { width: 10px; height: 10px; }
  .status-btn.warn .dot { background: var(--warn); }
  .topbar .menu-pop { position: fixed; top: calc(var(--topbar) + 4px); left: var(--s4); right: var(--s4); width: auto; }
  .admin-table tbody tr { display: flex; flex-direction: column; gap: var(--s1); }
  .account-btn { min-height: 44px; }
  .account-btn .caret { display: none; }
  #btnSignIn { padding: 0 var(--s2); font-size: 12px; }
  .menu-item { min-height: 44px; }
  .reports-page { padding: var(--s4); }
  .brand { font-size: 14px; white-space: nowrap; }
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 35; top: 0; left: 0; bottom: 0; width: min(88vw, 360px); height: 100vh; transform: translateX(-105%);
    transition: transform .2s; box-shadow: var(--shadow-3); }
  .sidebar.open { transform: none; }
  .sidebar-head { display: flex !important; justify-content: space-between; align-items: center; }
  .main { padding: var(--s4); }
  .fab-filters { position: fixed; z-index: 15; left: 50%; bottom: var(--s4); transform: translateX(-50%); box-shadow: var(--shadow-3); min-height: 44px; padding: 0 var(--s5); }
  .toolbar { gap: var(--s3); }
  .tablewrap { max-height: none; overflow: visible; border: 0; background: none; }
  table, tbody { display: block; }
  thead { display: none; }
  tbody tr { display: grid; grid-template-columns: 32px minmax(0, 1fr) auto; gap: 2px var(--s2); padding: var(--s3); margin-bottom: var(--s2);
    background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg); }
  tbody tr td, tbody tr:nth-child(even) td { border: 0; padding: 0; background: none; position: static; box-shadow: none; }
  tbody tr td.sel { grid-row: span 3; }
  tbody tr td[data-col=name] { grid-column: 2 / -1; }
  tbody tr td[data-label]:not([data-col=name]) { grid-column: 2 / -1; display: flex; justify-content: space-between; gap: var(--s2); text-align: right; }
  tbody tr td[data-label]:not([data-col=name])::before { content: attr(data-label); color: var(--muted); font-size: 12px; text-align: left; }
  tbody tr td.mob-hide { display: none !important; }
  td.link { max-width: none; }
  .firm { max-width: none; }
  .city { display: inline; }
  tbody tr td.sel { padding: 0 !important; width: auto; min-width: 0; max-width: none; }
  .sticky-2 { box-shadow: none !important; }
  /* on the company card show only filled-in fields */
  tbody tr td[data-label]:not([data-col=name]):has(> .empty-val:only-child) { display: none; }
  td.num { white-space: normal; }
  .sub { overflow-wrap: anywhere; }
  tbody tr td { min-width: 0; }
  .detail { top: 0; width: 100vw; z-index: 40; }
  .pager .info { margin-left: 0; width: 100%; }
  .import-item { flex-direction: column; align-items: start; }
  .footnote { padding-bottom: 64px; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
@media (max-width: 600px) {
  /* label above, the value with its buttons below: four columns did not fit and cut "Zgłoś" off */
  .contact-row { grid-template-columns: minmax(0, 1fr) auto auto; row-gap: 0; }
  .contact-row .lbl { grid-column: 1 / -1; }
  /* dense links in result cards: at least 24 px to tap (WCAG 2.5.8) without spreading the rows */
  tbody tr td a, .firm-name, .detail a { display: inline-block; padding-block: 3px; }
  .detail .contact-row a { padding-block: 6px; }
  .sidebar summary, .report-btn, .ids button { min-height: 44px; }
  .sidebar summary { display: flex; align-items: center; }
}
@media (max-width: 420px) {
  .topbar { padding: 0 var(--s3); gap: var(--s1); }
  .topnav a { padding: 0 6px; }
  .brand-full { display: none; }
  .brand-short { display: inline-grid; place-items: center; height: 32px; padding: 0 8px; border-radius: 99px; background: var(--accent);
    color: var(--on-accent); font-size: 12px; letter-spacing: .04em; }
  /* the admin's three tabs with their counts need the brand's room ("Firmy" leads to the same page);
     and whatever is left, the tabs scroll instead of pushing the account button off screen */
  .topbar:has(#navReports:not([hidden])) .brand { display: none; }
  .topnav { min-width: 0; overflow-x: auto; scrollbar-width: none; }
  .topnav::-webkit-scrollbar { display: none; }
  .topnav a { flex: none; margin-bottom: 0; }  /* a scroll box would clip the -1 px and halve the 2 px underline */
}
