/* Llenguatge visual de brand-reference.png: fons gel, blau marí, càpsules i línia fina. */
* {
  box-sizing: border-box;
}
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
body {
  margin: 0;
  font: 400 var(--text-sm) / 1.5 var(--font);
  color: var(--text);
  background: var(--ice);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}
button,
a,
input,
select,
textarea {
  outline-offset: 3px;
}
*:focus-visible {
  outline: 3px solid var(--sky);
}
a {
  color: var(--blue);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}
button {
  cursor: pointer;
}
button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}
img {
  max-width: 100%;
}
h1,
h2,
h3,
p {
  margin-top: 0;
}
h1 {
  font-size: var(--text-xl);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.08;
  margin-bottom: 12px;
}
h2 {
  font-size: var(--text-lg);
  font-weight: 500;
  letter-spacing: -0.01em;
  line-height: 1.3;
  margin-bottom: 0;
}
h3 {
  font-size: var(--text-md);
  font-weight: 500;
  margin-bottom: 6px;
}
small {
  font-size: var(--text-xs);
  color: var(--muted);
  display: block;
}
p {
  line-height: 1.6;
}
strong {
  font-weight: 500;
}
code {
  font-size: 0.92em;
  background: var(--mist-50);
  border-radius: 6px;
  padding: 1px 6px;
}
.muted {
  color: var(--muted);
  font-size: 13px;
}

/* Tipografia de marca. En majúscules espaiades, el punt volat de «l·l» ha de ser un caràcter normal, com a la referència. */
.eyebrow,
.descriptor,
.footer-descriptor,
th,
.chart-toolbar .field > span,
.radio-group legend {
  font-feature-settings: "locl" 0;
}
.eyebrow {
  font-size: var(--text-xs);
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--cornflower);
  margin-bottom: 14px;
}
.descriptor {
  font-size: 17px;
  line-height: 1.8;
  letter-spacing: var(--tracking-descriptor);
  text-transform: uppercase;
  color: var(--cornflower);
  margin: 0;
}
.descriptor span {
  display: block;
}
.brand-message span {
  margin: 0 0.3em;
  color: var(--cornflower);
}
.brand-message {
  font-size: 25px;
  font-weight: 400;
  line-height: 1.32;
  letter-spacing: -0.005em;
  color: var(--slate);
  margin: 0;
}

/* Botons */
.button {
  border: 1px solid var(--mist);
  border-radius: var(--pill);
  padding: 0 22px;
  min-height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--navy);
  background: var(--white);
  transition:
    background var(--transition),
    border-color var(--transition),
    color var(--transition);
  white-space: nowrap;
}
.button:hover {
  background: var(--sky-50);
  border-color: var(--sky-200);
}
.button svg {
  width: 18px;
  height: 18px;
}
.button.primary {
  background: var(--navy);
  border-color: var(--navy);
  color: var(--white);
}
.button.primary:hover {
  background: var(--navy-hover);
  border-color: var(--navy-hover);
}
.button.text {
  background: transparent;
  border-color: transparent;
  min-height: 36px;
  padding: 0 12px;
  color: var(--blue);
  font-size: 13px;
}
.button.text:hover {
  background: var(--sky-50);
}
.button.danger-text {
  color: var(--danger);
}
.button.danger-text:hover {
  background: var(--danger-bg);
}
.button.icon-button {
  border-color: transparent;
  background: transparent;
  width: 44px;
  min-height: 44px;
  padding: 0;
  font-size: 24px;
  font-weight: 400;
}
.button.icon-button:hover {
  background: var(--sky-50);
}

/* Estructura: barra lateral. Capçalera i peu fixos; només les opcions fan desplaçament. */
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar);
  background: var(--white);
  border-right: 1px solid var(--mist);
  display: flex;
  flex-direction: column;
  padding: 28px 20px 14px;
  z-index: var(--z-nav);
  overflow: hidden;
}
.sidebar-head {
  flex: none;
  padding-bottom: 20px;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--mist);
}
.sidebar-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  margin: 0 -8px;
  padding: 0 8px;
}
/* Símbol gran i wordmark més petit, en una sola línia. */
.brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 0 10px;
  margin-bottom: 22px;
}
.brand-mark {
  width: 44px;
  height: auto;
}
.brand-wordmark {
  width: 84px;
  height: auto;
  margin-top: 4px;
}
.brand:hover {
  text-decoration: none;
}
.farm-switch {
  position: relative;
}
.farm-switch summary {
  display: flex;
  align-items: center;
  gap: 12px;
  list-style: none;
  cursor: pointer;
  background: var(--ice);
  border: 1px solid var(--mist);
  border-radius: 20px;
  padding: 10px 12px;
  transition: border-color var(--transition);
}
.farm-switch summary::-webkit-details-marker {
  display: none;
}
.farm-switch summary:hover,
.farm-switch[open] summary {
  border-color: var(--sky);
}
.farm-name {
  flex: 1;
  min-width: 0;
}
.farm-switch strong {
  font-size: var(--text-sm);
  display: block;
}
.farm-switch small {
  display: block;
  font-size: 11.5px;
  line-height: 1.4;
  margin-top: 2px;
  color: var(--muted);
}
.farm-switch summary > svg {
  width: 18px;
  height: 18px;
  flex: none;
  color: var(--navy);
  transition: transform var(--transition);
}
.farm-switch[open] summary > svg {
  transform: rotate(180deg);
}
.farm-menu {
  position: absolute;
  z-index: 2;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  list-style: none;
  margin: 0;
  padding: 6px;
  background: var(--white);
  border: 1px solid var(--mist);
  border-radius: 18px;
  box-shadow: 0 12px 32px #111e381f;
}
.farm-menu button {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
  background: none;
  border: 0;
  border-radius: 12px;
  padding: 10px 12px;
  font: inherit;
  color: var(--slate);
  cursor: pointer;
}
.farm-menu button:hover {
  background: var(--sky-50);
}
.farm-menu button > span {
  flex: 1;
  min-width: 0;
}
.farm-menu svg {
  width: 18px;
  height: 18px;
  color: var(--navy);
}
.farm-icon {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--white);
  border: 1px solid var(--mist);
  color: var(--navy);
  flex-shrink: 0;
}
.sidebar nav a {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 16px;
  margin: 3px 0;
  min-height: 46px;
  color: var(--slate);
  font-size: var(--text-sm);
  border-radius: var(--pill);
  transition:
    background var(--transition),
    color var(--transition);
}
.sidebar nav a svg {
  width: 22px;
  height: 22px;
  color: var(--navy);
}
.sidebar nav a:hover {
  text-decoration: none;
  background: var(--sky-50);
}
.sidebar nav a[aria-current] {
  background: var(--navy);
  color: var(--white);
  font-weight: 500;
}
.sidebar nav a[aria-current] svg {
  color: var(--white);
}
.sidebar-bottom {
  flex: none;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  border-top: 1px solid var(--mist);
  padding: 10px 2px 0 4px;
  line-height: 1.25;
}
.sidebar-bottom strong {
  font-size: 12.5px;
  display: block;
}
.sidebar-bottom small {
  font-size: 11px;
  color: var(--muted);
}
.sidebar-bottom .icon-button {
  margin-left: auto;
  width: 34px;
  min-height: 34px;
}
.sidebar-bottom .icon-button svg {
  width: 18px;
  height: 18px;
}
.user-avatar {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  background: var(--sky-100);
  border-radius: 50%;
  color: var(--navy);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.04em;
  flex-shrink: 0;
}

/* Estructura: contingut */
/* La pàgina ocupa com a mínim l’alçada de la pantalla i el peu queda sempre a baix. */
main {
  margin-left: var(--sidebar);
  padding: 0 44px;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}
#page {
  flex: 1 0 auto;
}
/* En monitors molt amples, el contingut es limita i queda centrat. */
main > * {
  width: 100%;
  max-width: 1768px;
  margin-left: auto;
  margin-right: auto;
}
/* Barra superior: només al mòbil, per obrir el menú. */
.topbar {
  display: none;
}
/* Capçalera: títol a l’esquerra, accions a la dreta de tot. */
.page-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px 24px;
  margin: 36px 0 28px;
}
.page-header h1 {
  margin: 0;
}
.page-header .actions {
  margin-left: auto;
}
.actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.login-art {
  position: relative;
  width: 100%;
  aspect-ratio: 558 / 652;
  justify-self: end;
}
.login-art img {
  display: block;
  width: 100%;
  height: auto;
}

/* Indicadors i targetes */
.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 20px;
  margin: 8px 0 24px;
}
.metric {
  background: var(--white);
  border: 1px solid var(--mist);
  border-radius: var(--radius);
  padding: 24px 24px 22px;
  min-width: 0;
}
.metric > svg {
  display: block;
  width: 30px;
  height: 30px;
  color: var(--navy);
  margin-bottom: 20px;
}
.metric > span {
  font-size: var(--text-sm);
  color: var(--slate);
  display: block;
}
.metric > strong {
  font-size: 38px;
  font-weight: 500;
  letter-spacing: -0.03em;
  display: block;
  line-height: 1.15;
  margin: 8px 0 8px;
  font-variant-numeric: tabular-nums;
}
.metric em {
  font-size: 15px;
  font-style: normal;
  color: var(--muted);
  letter-spacing: 0;
  font-weight: 400;
  margin-left: 6px;
}
.metric small {
  font-size: 12.5px;
  line-height: 1.5;
}
.card {
  background: var(--white);
  border: 1px solid var(--mist);
  border-radius: var(--radius);
  padding: 28px;
  margin-bottom: 24px;
  min-width: 0;
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}
.card-header a {
  font-size: 13px;
  font-weight: 500;
}
/* Subapartat dins d’una targeta (p. ex. els tancs d’una explotació). */
.subsection {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}
.subsection-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}
.subsection-header h3 {
  margin: 0;
}
.two-column {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
  column-gap: 24px;
}

/* Etiquetes d’estat */
.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  background: var(--mist-50);
  color: var(--slate);
  border-radius: var(--pill);
  padding: 2px 11px;
  font-size: var(--text-xs);
  font-weight: 500;
  line-height: 1.3;
  white-space: nowrap;
}
.badge.warning {
  background: var(--warning-bg);
  color: var(--warning);
}
.badge.danger {
  background: var(--danger-bg);
  color: var(--danger);
}
.badge.success {
  background: var(--success-bg);
  color: var(--success);
}
/* Moviments de llet: tipus amb color propi i litres en verd (entrada) o vermell (sortida). */
.move-type {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 2px 11px;
  border-radius: var(--pill);
  font-size: var(--text-xs);
  border: 1px solid transparent;
  white-space: nowrap;
}
.move-munyida {
  background: var(--white);
  border-color: var(--mist);
  color: var(--slate);
}
.move-venda {
  background: var(--sky-100);
  color: var(--navy);
}
.move-transferencia {
  background: var(--mist-50);
  color: var(--slate);
}
.move-correccio {
  background: var(--warning-bg);
  color: var(--warning);
}
.move-litres {
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.move-litres.in {
  color: var(--success);
}
.move-litres.out {
  color: var(--danger);
}
.badges {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* Taules */
.table-wrap {
  overflow: auto;
  width: 100%;
}
table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-variant-numeric: tabular-nums;
}
th {
  padding: 10px 9px;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 500;
  color: var(--muted);
  border-bottom: 1px solid var(--mist);
  vertical-align: bottom;
}
td {
  padding: 14px 9px;
  border-bottom: 1px solid var(--line);
  font-size: 13.5px;
}
td:first-child {
  min-width: 9.5em;
}
td[data-label=""] {
  white-space: nowrap;
}
td .button.text {
  min-height: 30px;
  padding: 0 8px;
  font-size: 12.5px;
}
td small {
  font-size: 11.5px;
  margin-top: 2px;
}
tbody tr:last-child td {
  border-bottom: 0;
}
tbody tr:hover {
  background: var(--sky-50);
}
.animal-link {
  font-weight: 500;
}
.animal-link small {
  font-weight: 400;
}

/* Llistes del dia a dia */
.case-row {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  border-bottom: 1px solid var(--line);
  padding: 16px 0;
  color: var(--text);
}
.case-row:first-child {
  padding-top: 0;
}
.case-row:last-child {
  border: 0;
  padding-bottom: 0;
}
.case-row:hover {
  text-decoration: none;
}
.case-row:hover strong {
  color: var(--blue);
}
.case-row > div {
  flex: 1;
  min-width: 0;
}
.case-row strong {
  font-size: var(--text-md);
}
.case-row strong small {
  display: inline;
  font-size: 13px;
}
.case-row p {
  font-size: 13.5px;
  margin: 3px 0 4px;
  color: var(--slate);
}
.case-avatar {
  width: 34px;
  height: 46px;
  border-radius: var(--pill);
  background: var(--sky-100);
  color: var(--navy);
  display: grid;
  place-items: center;
  font-size: var(--text-md);
  font-weight: 500;
  flex-shrink: 0;
}
.tank {
  padding: 18px 0;
  border-bottom: 1px solid var(--line);
}
.tank:first-child {
  padding-top: 0;
}
.tank:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}
.tank > div:first-child {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.tank h3 {
  margin: 0;
}
/* Tanc horitzontal d’acer inoxidable que s’omple de llet de baix a dalt. */
.tank-vessel {
  --steel-edge: #8a939f;
  position: relative;
  padding: 10px 0 14px;
  margin: 14px 0 8px;
}
/* Boca d’home a la part superior. */
.tank-vessel::before {
  content: "";
  position: absolute;
  z-index: 1;
  top: 2px;
  left: 50%;
  width: 22%;
  max-width: 64px;
  height: 12px;
  transform: translateX(-50%);
  border: 2px solid var(--steel-edge);
  border-bottom: 0;
  border-radius: 8px 8px 0 0;
  background: linear-gradient(180deg, #f4f6f8, #c9d0d8);
}
.tank-body {
  position: relative;
  z-index: 2;
  height: 84px;
  border-radius: 42px;
  border: 2px solid var(--steel-edge);
  overflow: hidden;
  background: linear-gradient(
    180deg,
    #e3e7ec 0%,
    #c3cad3 24%,
    #a3acb8 58%,
    #b3bbc6 80%,
    #848d99 100%
  );
  box-shadow:
    inset 0 2px 0 #ffffffb3,
    inset 0 -6px 12px #6b748033;
}
/* La llet: blanca, amb la superfície lleugerament més clara. */
.tank-milk {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(180deg, #ffffff 0%, #fdfcf9 55%, #f1efe8 100%);
  border-top: 2px solid #ffffff;
  box-shadow:
    0 -2px 0 #7f8a99,
    0 -4px 8px #3d47554d;
  transition: height 0.6s ease;
}
/* Peu del tanc: litres a l’esquerra, valor en euros a la dreta. */
.tank-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px 16px;
}
/* Previsió: una dada per fila, etiqueta a l’esquerra i valor a la dreta. */
.tank-forecast {
  display: block;
  margin: 12px 0 0;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  font-size: var(--text-sm);
}
.tank-forecast > div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 3px 0;
}
.tank-forecast dt {
  color: var(--muted);
}
.tank-forecast dd {
  margin: 0;
  white-space: nowrap;
  font-weight: 500;
  color: var(--slate);
  font-variant-numeric: tabular-nums;
  text-align: right;
}
.tank-value {
  font-size: 18px;
  font-weight: 500;
  color: var(--slate);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.tank-volume {
  display: block;
  font-size: 26px;
  font-weight: 500;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.tank-volume small {
  display: inline;
  font-size: var(--text-sm);
  font-weight: 400;
  letter-spacing: 0;
}
/* Percentatge d’ocupació, centrat al tanc. */
.tank-litres {
  position: absolute;
  z-index: 3;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--navy);
  font-variant-numeric: tabular-nums;
  text-shadow:
    0 0 6px #ffffffe6,
    0 1px 0 #ffffff;
}
/* Reflex metàl·lic i soldadures, per sobre de la llet. */
.tank-body::before {
  content: "";
  position: absolute;
  z-index: 1;
  left: 6%;
  right: 6%;
  top: 14%;
  height: 12%;
  border-radius: var(--pill);
  background: linear-gradient(90deg, #ffffff00, #ffffffa6 30%, #ffffff00);
  pointer-events: none;
}
.tank-body::after {
  content: "";
  position: absolute;
  z-index: 1;
  inset: 0;
  background:
    linear-gradient(var(--steel-edge), var(--steel-edge)) 30% 0 / 1px 100%
      no-repeat,
    linear-gradient(var(--steel-edge), var(--steel-edge)) 70% 0 / 1px 100%
      no-repeat;
  opacity: 0.45;
  pointer-events: none;
}
/* Potes del suport. */
.tank-legs::before,
.tank-legs::after {
  content: "";
  position: absolute;
  bottom: 2px;
  width: 8px;
  height: 14px;
  border-radius: 0 0 3px 3px;
  background: linear-gradient(90deg, #9ea7b2, #d6dce3, #9ea7b2);
  border: 1px solid var(--steel-edge);
  border-top: 0;
}
.tank-legs::before {
  left: 20%;
}
.tank-legs::after {
  right: 20%;
}
/* Les munyides necessiten tota l’amplada fins que hi caben totes les columnes. */
.two-column.records {
  grid-template-columns: minmax(0, 1fr);
}
@media (min-width: 1700px) {
  .two-column.records {
    grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr);
  }
}
.tank-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 28px 48px;
}
.tank-list .tank {
  padding: 0;
  border-bottom: 0;
}
.tank-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
  margin-bottom: 24px;
}
/* Capacitat total: targeta ampla; a l’escriptori, el tanc a l’esquerra i les dades a la dreta. */
.tank-total {
  background: var(--white);
  border: 1px solid var(--mist);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 24px;
}
.tank-total h3 {
  font-size: 18px;
}
@media (min-width: 900px) {
  .tank.tank-total {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
    grid-template-areas:
      "head head"
      "vessel info";
    column-gap: 40px;
    align-items: center;
  }
  .tank-total > div:first-child {
    grid-area: head;
  }
  .tank-total .tank-vessel {
    grid-area: vessel;
  }
  .tank-total .tank-body {
    height: 110px;
    border-radius: 55px;
  }
  .tank-total .tank-info {
    grid-area: info;
  }
}
.tank-grid .tank {
  background: var(--white);
  border: 1px solid var(--mist);
  border-radius: var(--radius);
  padding: 24px;
}

/* Gràfics: barres en forma de càpsula, com el símbol */
/* Sense separació fixa: l’amplada relativa de la barra separa les columnes, també amb 90 dies. */
.email-preview {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
}
.trend-chart {
  display: block;
  width: 100%;
  height: auto;
  min-height: 190px;
}
.trend-chart text {
  fill: var(--muted);
  font: 16px var(--font);
}
.trend-chart circle:focus {
  outline: 2px solid var(--navy);
}
.chart {
  height: 246px;
  display: flex;
  align-items: flex-end;
  padding-top: 40px;
}
.chart-column {
  flex: 1;
  min-width: 0;
  text-align: center;
  position: relative;
  border-radius: 12px;
  outline-offset: 2px;
}
.chart-track {
  height: 172px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  border-bottom: 1px solid var(--mist);
  background: repeating-linear-gradient(
    to top,
    transparent 0,
    transparent 42px,
    var(--line) 42px,
    var(--line) 43px
  );
}
.chart-track i {
  display: block;
  width: 62%;
  max-width: 44px;
  background: var(--sky);
  border-radius: var(--pill);
  transition: background var(--transition);
}
.chart-column:last-child .chart-track i {
  background: var(--blue);
}
.chart-column:hover .chart-track i,
.chart-column:focus .chart-track i {
  background: var(--blue);
}
.chart-column small {
  font-size: var(--text-xs);
  height: 20px;
  margin-top: 8px;
  white-space: nowrap;
}
.chart-tooltip {
  display: none;
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--navy);
  color: var(--white);
  padding: 7px 12px;
  border-radius: var(--pill);
  font-size: var(--text-xs);
  white-space: nowrap;
  z-index: 5;
}
.chart-column:hover .chart-tooltip,
.chart-column:focus .chart-tooltip {
  display: block;
}
.chart-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 14px 16px;
  margin: 20px 0 6px;
}
.chart-toolbar .field > span,
.radio-group legend {
  font-size: var(--text-2xs);
  font-weight: 400;
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
  color: var(--muted);
}
.chart-toolbar .field select {
  width: auto;
  min-width: 132px;
  min-height: 42px;
  border-radius: var(--pill);
  padding-left: 16px;
}
.radio-group {
  display: flex;
  flex-direction: column;
  gap: 7px;
  border: 0;
  margin: 0;
  padding: 0;
  min-width: 0;
}
.radio-group legend {
  float: left;
  padding: 0;
}
.segmented {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--mist);
  border-radius: var(--pill);
  background: var(--white);
}
.segmented label {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 16px;
  border-radius: var(--pill);
  color: var(--slate);
  font-size: 13px;
  cursor: pointer;
  transition:
    background var(--transition),
    color var(--transition);
}
.segmented label:hover {
  background: var(--sky-50);
}
.segmented input {
  position: absolute;
  inset: 0;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}
.segmented label:has(input:checked) {
  background: var(--navy);
  color: var(--white);
}
.segmented label:has(input:focus-visible) {
  outline: 3px solid var(--sky);
  outline-offset: 2px;
}

/* Formularis */
.field {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin: 0;
  font-size: 13px;
  color: var(--slate);
}
.field > span {
  font-weight: 500;
}
.field input,
.field select,
.field textarea,
.compact input,
.compact select {
  border: 1px solid var(--mist);
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  min-height: 46px;
  background-color: var(--white);
  color: var(--text);
  font-size: var(--text-sm);
  width: 100%;
  min-width: 0;
  transition:
    border-color var(--transition),
    box-shadow var(--transition);
}
.field select,
.compact select {
  appearance: none;
  padding-right: 40px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23111e38' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 16px;
}
.field input:hover,
.field select:hover,
.field textarea:hover {
  border-color: #c8cedb;
}
.field input:focus-visible,
.field select:focus-visible,
.field textarea:focus-visible,
.compact input:focus-visible,
.compact select:focus-visible {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 4px var(--sky-100);
}
.field textarea {
  min-height: 96px;
  resize: vertical;
}
.field input:disabled,
.compact input:disabled,
.compact select:disabled {
  background-color: var(--mist-50);
  color: #8a8ca6;
}
.field small {
  font-size: var(--text-xs);
}
.field input[type="checkbox"],
input[type="checkbox"] {
  width: 20px;
  height: 20px;
  min-height: 20px;
  accent-color: var(--navy);
}
input[type="file"] {
  padding: 9px 12px;
}
.filters {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  background: var(--ice);
  border: 1px solid var(--line);
  padding: 18px;
  border-radius: 20px;
  margin-bottom: 20px;
}
.filters .field {
  flex: 1;
  min-width: 140px;
}
.summary-strip {
  display: flex;
  gap: 26px;
  flex-wrap: wrap;
  padding: 14px 0;
  color: var(--muted);
  font-size: 13.5px;
}
.summary-strip strong {
  color: var(--navy);
}
.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 20px;
  font-size: 13px;
  color: var(--muted);
}
.pagination > div {
  display: flex;
  align-items: center;
  gap: 10px;
}
.pagination .button {
  min-height: 40px;
  padding: 0 16px;
  font-size: 13px;
}

/* Pestanyes */
.tabs {
  display: flex;
  width: fit-content;
  max-width: 100%;
  gap: 2px;
  overflow: auto;
  margin: 28px 0 22px;
  padding: 4px;
  border: 1px solid var(--mist);
  border-radius: var(--pill);
  background: var(--white);
}
.tabs .button {
  border: 0;
  background: transparent;
  color: var(--slate);
  min-height: 40px;
  padding: 0 20px;
}
.tabs .button:hover {
  background: var(--sky-50);
}
.tabs .selected,
.tabs .selected:hover {
  background: var(--navy);
  color: var(--white);
}

/* Fitxes i detalls */
.profile-banner {
  display: flex;
  align-items: center;
  gap: 20px;
  background: var(--white);
  border: 1px solid var(--mist);
  border-radius: var(--radius);
  padding: 24px 28px;
  margin-bottom: 24px;
}
.profile-banner .badges {
  margin-left: auto;
}
.profile-banner p {
  font-size: 13.5px;
  margin: 4px 0 0;
  color: var(--muted);
}
.profile-banner h2 {
  font-size: 22px;
}
.profile-banner h2 small {
  display: inline;
  font-size: 15px;
  font-weight: 400;
}
.monogram {
  width: 52px;
  height: 76px;
  background: var(--navy);
  border-radius: var(--pill);
  display: grid;
  place-items: center;
  font-size: 26px;
  font-weight: 500;
  color: var(--white);
  flex-shrink: 0;
}
.back {
  display: inline-block;
  margin-top: 28px;
  font-size: var(--text-sm);
  font-weight: 500;
}
.back + .page-header {
  margin-top: 18px;
}
.timeline article {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 24px;
  padding: 22px 0;
  border-bottom: 1px solid var(--line);
}
.timeline article:first-child {
  padding-top: 4px;
}
.timeline article:last-child {
  border: 0;
}
.timeline time {
  font-size: 13px;
  color: var(--blue);
  font-weight: 500;
}
.timeline p {
  white-space: pre-line;
  font-size: var(--text-sm);
  color: var(--slate);
  margin-bottom: 6px;
}
.timeline small {
  font-size: var(--text-xs);
}
.timeline a {
  font-size: 13px;
  display: inline-block;
  margin-top: 8px;
}
.alert {
  padding: 14px 18px;
  border: 1px solid var(--mist);
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  line-height: 1.65;
}
.alert.info {
  background: var(--sky-50);
  color: #3d5590;
  border-color: var(--sky-100);
}
.alert.error,
.error-text {
  color: var(--danger);
}
.alert.error {
  background: var(--danger-bg);
  border-color: #f6d4da;
}
.alert p:last-child {
  margin-bottom: 0;
}
.detail-line {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 24px;
}
.detail-line span {
  font-size: 13.5px;
}
.stack {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  margin: 20px 0;
}
.case-image {
  max-width: 100%;
  max-height: 300px;
  border-radius: var(--radius-sm);
  object-fit: contain;
}
.bull-list {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}
.bull-list a {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 20px 22px;
  background: var(--ice);
  border: 1px solid var(--line);
  border-radius: 20px;
  min-width: 230px;
  color: var(--text);
}
.bull-list a:hover {
  text-decoration: none;
  border-color: var(--sky-200);
  background: var(--sky-50);
}
.bull-list span {
  color: var(--slate);
}
.bull-list small {
  color: var(--blue);
  font-weight: 500;
}
dl {
  display: grid;
  grid-template-columns: 150px 1fr;
  gap: 14px;
  font-size: var(--text-sm);
}
dt {
  color: var(--muted);
}
dd {
  margin: 0;
  white-space: pre-line;
}
.empty {
  text-align: center;
  padding: 36px;
  color: var(--muted);
}
.empty svg {
  width: 34px;
  height: 34px;
  color: var(--sky);
  margin-bottom: 12px;
}
.empty h3 {
  color: var(--text);
}
.loading {
  padding: 80px 20px;
  text-align: center;
  color: var(--muted);
}

/* Diàlegs */
dialog {
  border: 0;
  border-radius: 28px;
  width: 860px;
  max-width: calc(100vw - 32px);
  max-height: calc(100vh - 32px);
  padding: 0;
  color: var(--text);
  background: var(--white);
  box-shadow: 0 30px 90px -24px #111e3866;
  scrollbar-width: thin;
  scrollbar-color: var(--mist) transparent;
  overscroll-behavior: contain;
}
dialog::backdrop {
  background: #111e3866;
  backdrop-filter: blur(4px);
}
.modal-header,
.modal-footer {
  padding: 20px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
}
.modal-header h2 {
  font-size: 21px;
}
.modal-footer {
  border-bottom: 0;
  border-top: 1px solid var(--line);
  justify-content: flex-end;
  background: var(--ice);
  position: sticky;
  bottom: 0;
}
.modal-header {
  position: sticky;
  top: 0;
  background: var(--white);
  z-index: 2;
}
.modal-content {
  padding: 26px 28px;
}
.modal-content h3 {
  margin-top: 4px;
}
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin-bottom: 24px;
}
.form-grid .wide {
  grid-column: 1/-1;
}
.checkbox-field {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-direction: row;
}
#form-error {
  margin: 0 28px 15px;
  color: var(--danger);
  font-size: 13px;
}
.participant-list {
  border: 1px solid var(--mist);
  border-radius: 20px;
  max-height: 340px;
  overflow: auto;
}
.participant-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1fr;
  gap: 12px;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
}
.participant-row:last-child {
  border-bottom: 0;
}
.participant-row > label:first-child {
  display: flex;
  gap: 10px;
  align-items: center;
}
.participant-row strong {
  font-size: 13.5px;
}
.participant-row strong small {
  display: inline;
}
.compact {
  font-size: var(--text-2xs);
  color: var(--muted);
}
.compact span {
  display: block;
  margin-bottom: 4px;
}
.compact input,
.compact select {
  min-height: 38px;
  padding: 6px 10px;
  font-size: 13px;
  border-radius: 12px;
}
.compact select {
  padding-right: 32px;
  background-position: right 10px center;
}

/* Avisos */
#toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: var(--z-toast);
  background: var(--navy);
  color: var(--white);
  border-radius: var(--pill);
  padding: 13px 24px;
  box-shadow: var(--shadow);
  display: none;
  max-width: 90vw;
}
#toast.visible {
  display: block;
}
#toast.error {
  background: var(--danger);
}

/* Peu */
footer {
  display: flex;
  align-items: center;
  gap: 18px;
  color: var(--muted);
  font-size: var(--text-xs);
  padding: 26px 0 30px;
  margin-top: 8px;
  border-top: 1px solid var(--mist);
}
.footer-wordmark {
  width: 56px;
  height: auto;
}
.footer-descriptor {
  font-size: var(--text-2xs);
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--cornflower);
}
.footer-copy {
  margin-left: auto;
  white-space: nowrap;
}
.menu-toggle,
.nav-backdrop {
  display: none;
}

/* Inici de sessió: la composició de brand-reference.png */
.login-layout {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(400px, 1fr);
  background: var(--ice);
}
/* Columna centrada: imatge, wordmark amb descriptor, lema i icones a tot l’ample. */
.login-brand {
  /* Mides lligades també a l’alçada: a l’escriptori tot ha de cabre sense desplaçament. */
  --wordmark: clamp(150px, min(17vw, 26vh), 300px);
  --art: clamp(150px, min(20vw, 36vh), 340px);
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: calc(var(--wordmark) * 0.14);
  padding: clamp(24px, 6vh, 64px) 7%;
}
.login-brand > * {
  width: min(100%, 620px);
}
/* Escriptori: imatge a l’esquerra; wordmark i descriptor apilats a la dreta. */
.login-hero {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: calc(var(--wordmark) * 0.22);
}
.login-hero > .login-art {
  flex: none;
  width: var(--art);
}
.login-identity {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: calc(var(--wordmark) * 0.06);
}
.login-wordmark {
  display: block;
  flex: none;
  width: var(--wordmark);
}
.login-brand .descriptor {
  font-size: max(11px, calc(var(--wordmark) * 0.0548));
  line-height: 1.9;
}
.login-brand .brand-message {
  font-size: max(18px, calc(var(--wordmark) * 0.085));
  text-align: center;
}
.brand-icons {
  list-style: none;
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 0;
  margin: 0;
}
.brand-icons li {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: calc(var(--wordmark) * 0.04);
  font-size: max(13px, calc(var(--wordmark) * 0.055));
  color: var(--navy);
}
.brand-icons svg {
  width: calc(var(--wordmark) * 0.13);
  height: calc(var(--wordmark) * 0.13);
  color: var(--navy);
}
.login-panel {
  display: grid;
  place-items: center;
  padding: 40px;
  background: var(--white);
  border-left: 1px solid var(--mist);
}
.login-panel form {
  width: 100%;
  max-width: 360px;
}
.login-panel h2 {
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin-bottom: 8px;
}
.login-panel form > p {
  color: var(--muted);
}
.login-panel .field {
  margin: 20px 0;
}
.login-panel .primary {
  width: 100%;
  justify-content: space-between;
  padding: 0 24px;
}
.login-panel > form > small {
  margin-top: 24px;
  text-align: center;
}

/* Adaptació */
@media (min-width: 1550px) {
  main {
    padding: 0 56px;
  }
  .two-column {
    grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr);
  }
}
@media (max-width: 1180px) {
  .login-layout {
    grid-template-columns: minmax(0, 1.2fr) minmax(380px, 1fr);
  }
  .login-brand {
    padding-inline: 5%;
  }
}
@media (max-width: 1100px) {
  :root {
    --sidebar: 236px;
  }
  main {
    padding: 0 28px;
  }
  .sidebar {
    padding: 24px 16px 16px;
  }
  .metric {
    padding: 20px;
  }
  .metric > strong {
    font-size: 32px;
  }
  .metrics {
    gap: 14px;
  }
  .two-column {
    grid-template-columns: 1fr;
  }
  .actions {
    justify-content: end;
  }
  .profile-banner {
    flex-wrap: wrap;
  }
}
@media (max-width: 900px) {
  .metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 800px) {
  :root {
    --sidebar: 268px;
  }
  .sidebar {
    transform: translateX(-100%);
    transition: transform var(--transition);
  }
  .nav-open .sidebar {
    transform: translateX(0);
  }
  .nav-open .nav-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 19;
    background: #111e3855;
    border: 0;
  }
  .menu-toggle {
    display: inline-flex;
  }
  main {
    margin: 0;
    padding: 0 20px;
  }
  .topbar {
    display: flex;
    align-items: center;
    height: 60px;
    border-bottom: 1px solid var(--mist);
  }
  .page-header {
    margin-top: 28px;
  }
  .brand-message {
    font-size: 22px;
  }
  .descriptor {
    font-size: 15px;
  }
  .login-layout {
    grid-template-columns: 1fr;
  }
  .login-brand {
    --wordmark: 140px;
    --art: 160px;
    gap: 20px;
    padding: 48px 24px 32px;
  }
  /* Mòbil: un element sota l’altre. */
  .login-hero {
    flex-direction: column;
    gap: 20px;
  }
  .login-identity {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 10px 16px;
  }
  .login-brand .descriptor {
    letter-spacing: 0.22em;
  }
  .login-brand .brand-message {
    font-size: clamp(14px, 4.3vw, 20px);
  }
  .brand-icons li {
    font-size: 13px;
    gap: 8px;
  }
  .brand-icons svg {
    width: 30px;
    height: 30px;
  }
  .login-panel {
    padding: 36px 24px 44px;
    border-left: 0;
    border-top: 1px solid var(--mist);
  }
  .participant-row {
    grid-template-columns: 1fr 1fr;
  }
  .profile-banner .badges {
    margin-left: 0;
  }
  .tank-grid {
    grid-template-columns: 1fr 1fr;
  }
}
@media (max-width: 640px) {
 /* Mòbil: la imatge es manté,
 petita {
    grid-template-columns: minmax(0, 1fr) minmax(0, 120px);
    grid-template-rows: auto;
    padding: 30px 0 28px;
    grid-template-areas:
      "greeting art"
      "brand    brand"
      "actions  actions";
    column-gap: 16px;
  }
}
@media (max-width: 600px) {
  main {
    padding: 0 16px;
  }
  .page-header {
    gap: 12px 16px;
  }
  h1 {
    font-size: 32px;
  }
  .brand-message {
    font-size: 21px;
  }
  .descriptor {
    font-size: 13.5px;
    letter-spacing: 0.32em;
  }
  .actions {
    justify-content: start;
  }
  .card {
    padding: 20px;
  }
  .card-header {
    flex-wrap: wrap;
  }
  .metrics {
    gap: 10px;
  }
  .metric {
    padding: 16px;
    border-radius: 20px;
  }
  .metric > svg {
    width: 26px;
    height: 26px;
    margin-bottom: 14px;
  }
  .metric > span {
    font-size: 13px;
  }
  .metric > strong {
    font-size: 27px;
  }
  .metric small {
    font-size: 11.5px;
  }
  .table-wrap {
    overflow: visible;
  }
  table,
  tbody,
  tr,
  td {
    display: block;
  }
  thead {
    display: none;
  }
  tbody tr {
    padding: 12px 0;
    border-bottom: 1px solid var(--line);
  }
  tbody tr:last-child {
    border-bottom: 0;
  }
  tbody tr:hover {
    background: transparent;
  }
  td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
    text-align: right;
    border: 0;
    padding: 6px 0;
    min-width: 0;
    flex-wrap: wrap;
  }
  td:before {
    content: attr(data-label);
    font-size: var(--text-2xs);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
    text-align: left;
    margin-right: auto;
  }
  td[data-label=""]:before {
    display: none;
  }
  td[data-label=""] {
    justify-content: end;
  }
  td small {
    width: auto;
  }
  td .animal-link {
    text-align: right;
  }
  td .button {
    min-height: 44px;
  }
  .filters {
    padding: 14px;
    gap: 10px;
  }
  .filters .field {
    min-width: 120px;
  }
  .summary-strip {
    gap: 12px;
    font-size: 13px;
  }
  .pagination {
    flex-direction: column;
    align-items: start;
  }
  .pagination > div {
    width: 100%;
    justify-content: space-between;
  }
  .pagination .button {
    padding: 0 12px;
  }
  .tabs .button {
    padding: 0 14px;
  }
  .profile-banner {
    padding: 18px;
    gap: 14px;
  }
  .timeline article {
    grid-template-columns: 100px 1fr;
    gap: 12px;
  }
  .timeline time {
    font-size: 12px;
  }
  .timeline p {
    font-size: 13px;
  }
  .form-grid {
    grid-template-columns: 1fr;
    gap: 15px;
  }
  .modal-content {
    padding: 18px;
  }
  .modal-header,
  .modal-footer {
    padding: 15px 18px;
  }
  .tank-grid {
    grid-template-columns: 1fr;
  }
  .participant-row {
    grid-template-columns: 1fr 1fr;
  }
  .chart-toolbar {
    gap: 12px;
  }
  .chart-toolbar .field select {
    min-width: 0;
  }
  .chart-tooltip {
    white-space: normal;
    min-width: 100px;
    border-radius: 12px;
  }
  .chart-column small {
    font-size: 10px;
  }
  footer {
    flex-wrap: wrap;
    gap: 10px 14px;
  }
  .footer-copy {
    margin-left: 0;
    width: 100%;
  }
  dl {
    grid-template-columns: 110px 1fr;
  }
  .detail-line {
    flex-wrap: wrap;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
  }
}

@media (min-width: 1051px) {
  .sales-trends {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }
}
@media (max-width: 600px) {
  .trend-chart text {
    font-size: 20px;
  }
}
