/* =========================================================
   Control Finques — Shell crític
   Este fitxer concentra l'esquelet visual del primer render perquè
   la base siga robusta sense JS, sense Pico remot i amb viewport mòbil.
========================================================= */

:root {
  --shell-gap: clamp(.75rem, 1vw + .5rem, 1rem);
  --shell-padding-inline: clamp(.8rem, 2vw, 1rem);
  --shell-safe-bottom: env(safe-area-inset-bottom, 0px);
}

html {
  color-scheme: dark;
  -webkit-text-size-adjust: 100%;
}

body {
  min-height: 100dvh;
  text-rendering: optimizeLegibility;
}

img,
svg,
video,
canvas {
  display: block;
  max-width: 100%;
  height: auto;
}

main.container {
  width: min(100%, 1200px);
}

.cf-topbar-wrap {
  position: sticky;
  top: 0;
  z-index: 1100;
  padding-top: max(.4rem, env(safe-area-inset-top, 0px));
  background: linear-gradient(180deg, rgba(15, 20, 26, .92), rgba(15, 20, 26, 0));
  backdrop-filter: blur(14px);
}

.cf-topbar {
  min-width: 0;
}

.cf-topbar ul {
  min-width: 0;
  flex-wrap: wrap;
}

.cf-nav-left,
.cf-nav-center,
.cf-nav-right {
  min-width: 0;
}

.cf-nav-right {
  row-gap: .4rem;
}

.cf-nav-right > li,
.cf-nav-center > li,
.cf-nav-left > li {
  min-width: 0;
}

.cf-nav-right a,
.cf-nav-right button,
.cf-nav-center a,
.cf-nav-left a {
  white-space: nowrap;
}

.cf-user-pill {
  max-width: 100%;
  overflow-wrap: anywhere;
}

.cf-soft-inline--topbar {
  width: 100%;
}

.cf-soft-inline--topbar button {
  width: 100%;
}

label {
  display: grid;
  gap: .35rem;
}

fieldset {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

input,
select,
textarea,
button {
  font: inherit;
}

.cf-card,
.cf-shell-panel,
.notice {
  overflow: clip;
}

.cf-inline-actions,
.cf-toolbar,
.cf-page-header,
.cf-page-header__aside,
.cf-parcella-header-actions {
  min-width: 0;
}

.cf-bottom-nav {
  display: none;
}

@media (max-width: 980px) {
  body.cf-has-bottom-nav main.container {
    padding-bottom: calc(76px + var(--shell-safe-bottom) + 1rem);
  }

  .cf-topbar {
    grid-template-columns: 1fr;
    align-items: stretch;
    gap: .45rem;
    padding: .7rem;
  }

  .cf-nav-left,
  .cf-nav-center,
  .cf-nav-right {
    justify-content: flex-start;
  }

  .cf-nav-left a,
  .cf-nav-center a,
  .cf-nav-right a,
  .cf-nav-right button {
    min-height: 44px;
  }

  .cf-nav-right {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
  }

  .cf-nav-right__user {
    grid-column: 1 / -1;
  }

  .cf-nav-right__sync,
  .cf-nav-right__install,
  .cf-nav-right__mode,
  .cf-nav-right__profile,
  .cf-nav-right__logout {
    min-width: 0;
  }

  .cf-page-header,
  .cf-page-header--parcelles {
    flex-direction: column;
    align-items: stretch;
  }

  .cf-page-header__aside {
    justify-items: stretch;
  }

  .cf-parcella-header-actions,
  .cf-inline-actions,
  .cf-toolbar {
    flex-wrap: wrap;
  }

  .cf-inline-actions > *,
  .cf-toolbar > * {
    min-width: min(100%, 15rem);
  }

  .cf-bottom-nav {
    display: grid;
  }
}

@media (max-width: 640px) {
  .container,
  main.container {
    padding-left: var(--shell-padding-inline);
    padding-right: var(--shell-padding-inline);
  }

  .cf-topbar-wrap {
    margin-bottom: .35rem;
  }

  .cf-topbar {
    border-radius: 18px;
  }

  .cf-nav-right {
    grid-template-columns: 1fr;
  }

  .cf-nav-right a,
  .cf-nav-right button,
  .cf-nav-center a,
  .cf-nav-left a {
    width: 100%;
    justify-content: center;
    text-align: center;
  }

  .cf-user-pill {
    justify-content: center;
  }
}

@media (min-width: 981px) {
  .cf-bottom-nav,
  .cf-app-shell-spacer {
    display: none !important;
  }
}