/* Generic resets that components rely on. App-specific rules stay in the app. */
* {
  box-sizing: border-box;
}
html {
  background: var(--ground);
}
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  background: var(--ground);
  scrollbar-color: var(--scroll-thumb) transparent;
}
button,
input,
select {
  font: inherit;
}
button,
input:not([type="checkbox"], [type="radio"]),
select {
  min-height: 44px;
}
button {
  color: inherit;
  cursor: pointer;
}
button:disabled {
  opacity: 0.45;
  cursor: default;
}
a {
  text-underline-offset: 3px;
  color: inherit;
}
/* Focus outlines are removed on purpose (product decision 2026-11-20). */
:focus,
:focus-visible,
*:focus,
*:focus-visible,
.leaflet-interactive:focus,
.leaflet-container:focus {
  outline: none;
}
::selection {
  background: color-mix(in srgb, var(--accent) 35%, transparent);
}
svg {
  display: block;
}
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-thumb {
  background: var(--scroll-thumb);
  border-radius: 6px;
}
input,
progress {
  accent-color: var(--accent);
}
.muted {
  color: var(--muted);
}
/* Switch: Mantine paints the track and thumb from a JS-resolved shade, which is near-white on a
   white thumb in dark. Off is an outlined track with a --faint thumb; on is the ink fill with a
   paper thumb. */
.mantine-Switch-track {
  border: 1.5px solid var(--faint);
  background: var(--surface-solid);
}
.mantine-Switch-thumb {
  border: 0;
  background: var(--faint);
}
.mantine-Switch-input:checked + .mantine-Switch-track {
  border-color: var(--primary-fill);
  background: var(--primary-fill);
}
.mantine-Switch-input:checked + .mantine-Switch-track .mantine-Switch-thumb {
  background: var(--on-primary);
}

/* Stacked tables: at phone width a `table.table-stack` shows each row as a card of label/value
   lines. Every body cell carries `data-label` with its column name; a cell without one spans the
   card (row titles, actions). Wide numeric tables scroll in `TableScroll` instead. */
@media (max-width: 720px) {
  table.table-stack,
  table.table-stack tbody,
  table.table-stack tr,
  table.table-stack td,
  table.table-stack th[scope="row"] {
    display: block;
    width: 100%;
  }
  table.table-stack thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
  }
  table.table-stack tr {
    padding: 10px 0;
    border-bottom: 1px solid var(--line);
  }
  table.table-stack :is(td, th[scope="row"]) {
    border: 0;
    padding: 3px 0;
    text-align: left;
    overflow-wrap: anywhere;
  }
  table.table-stack td[data-label] {
    display: grid;
    grid-template-columns: minmax(96px, 38%) 1fr;
    gap: 12px;
  }
  table.table-stack td[data-label]::before {
    content: attr(data-label);
    color: var(--muted);
  }
}

/* Touch: Mantine controls (inputs, selects and pickers rendered as inputs, close buttons, menu
   items, combobox options, switch rows) are at least 44 px at compact width; inputs keep 16 px
   text on phones so iOS does not zoom. */
@media (max-width: 1024px) {
  .mantine-Input-input.mantine-Input-input {
    height: auto;
    min-height: 44px;
  }
  .mantine-CloseButton-root.mantine-CloseButton-root {
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
  }
  .mantine-Switch-input.mantine-Switch-input {
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
  }
  .mantine-Checkbox-root {
    min-height: 44px;
    display: flex;
    align-items: center;
  }
  .mantine-Checkbox-body,
  .mantine-Checkbox-label {
    min-height: 44px;
    align-items: center;
  }
  .mantine-Menu-item,
  .mantine-Combobox-option,
  .mantine-Select-option {
    min-height: 44px;
    display: flex;
    align-items: center;
  }
  .mantine-Switch-root {
    min-height: 44px;
    min-width: 44px;
    display: flex;
    align-items: center;
  }
  .mantine-Switch-body {
    min-height: 44px;
    align-items: center;
  }
  .mantine-Switch-label {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
  }
}
@media (max-width: 720px) {
  .mantine-Input-input.mantine-Input-input {
    font-size: 16px;
  }
}
