:root {
  --touch-min: 44px;
  --bottom-nav-height: 76px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --mobile-edge: clamp(.72rem, 3vw, 1rem);
  --mobile-card-radius: 22px;
}

html[data-display-mode="field"] {
  color-scheme: light;
  --bg: #f7fbff;
  --panel: #ffffff;
  --border: rgba(10, 26, 47, 0.18);
  --text: #09131f;
  --muted: #334155;
  --accent: #005fcc;
  --accent2: rgba(0, 95, 204, 0.12);
  --nav-surface: rgba(255,255,255,.94);
  --toast-surface: rgba(255,255,255,.96);
  --control-surface: #ffffff;
  --control-surface-hover: #eef5ff;
  --control-text: #09131f;
  --control-border-strong: rgba(10, 26, 47, 0.14);
  --input-surface: #ffffff;
  --input-surface-strong: #ffffff;
  --form-color-scheme: light;
  --shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
}

html[data-display-mode="field"] body {
  background:
    radial-gradient(circle at top left, rgba(0, 95, 204, 0.10), transparent 34%),
    linear-gradient(180deg, #f7fbff 0%, #f1f7ff 48%, #ffffff 100%);
}

html[data-display-mode="field"] .cf-topbar-wrap {
  position: sticky;
  top: 0;
  z-index: 1250;
  padding-top: calc(var(--safe-top) + 6px);
  background: linear-gradient(180deg, rgba(247, 251, 255, 0.96), rgba(247, 251, 255, 0));
  backdrop-filter: blur(18px);
}

html[data-display-mode="field"] .cf-topbar {
  border-radius: 24px;
  border: 1px solid rgba(10, 26, 47, 0.10);
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.08);
}

.cf-brand-link {
  letter-spacing: .01em;
}

html[data-display-mode="field"] .cf-page-header,
html[data-display-mode="field"] .cf-plan-card,
html[data-display-mode="field"] .cf-map-shell,
html[data-display-mode="field"] .registres-container,
html[data-display-mode="field"] .cf-reg-side,
html[data-display-mode="field"] .cf-reg-map-wrap,
html[data-display-mode="field"] .cf-touch-card,
html[data-display-mode="field"] .cf-mobile-card {
  border-radius: var(--mobile-card-radius);
  border-color: rgba(10, 26, 47, 0.10);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.08);
}

.cf-page-header {
  gap: .85rem;
}

html[data-display-mode="field"] .cf-detail-hero,
html[data-display-mode="field"] .cf-jornada-hero {
  background:
    radial-gradient(circle at top right, rgba(0, 95, 204, 0.10), transparent 36%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(245, 250, 255, 0.96));
}

html[data-display-mode="field"] .cf-kpi-card {
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(237, 246, 255, 0.94));
  border: 1px solid rgba(0, 95, 204, 0.10);
}

.cf-inline-actions {
  gap: .55rem;
}

.cf-inline-actions > * {
  min-width: 0;
}

.cf-detail-map-card .cf-toolbar,
.cf-detail-map-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .55rem;
}

.cf-detail-map-card .cf-toolbar > *,
.cf-detail-map-actions > * {
  flex: 1 1 160px;
}

.cf-map,
#regmap {
  border-radius: 20px;
}

html[data-display-mode="field"] .cf-bottom-nav {
  gap: .3rem;
  padding-top: .65rem;
  box-shadow: 0 -12px 28px rgba(15, 23, 42, 0.08);
}

.cf-bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1200;
  display: none;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: .35rem;
  padding: .55rem .65rem calc(.55rem + var(--safe-bottom));
  border-top: 1px solid var(--border);
  background: var(--nav-surface);
  backdrop-filter: blur(14px);
}

.cf-bottom-nav a {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .2rem;
  min-height: 64px;
  color: var(--muted);
  border-radius: 16px;
  font-size: .74rem;
  font-weight: 600;
  padding: .45rem .2rem;
  min-width: 0;
}

.cf-bottom-nav a.is-active {
  color: var(--text);
  background: linear-gradient(180deg, rgba(0, 95, 204, 0.12), rgba(14, 165, 233, 0.18));
  border: 1px solid rgba(14,165,233,.34);
  transform: translateY(-1px);
}

.cf-bottom-nav__icon {
  font-size: 1.1rem;
  line-height: 1;
}

.cf-bottom-nav__label {
  display: block;
  width: 100%;
  line-height: .98;
  text-align: center;
  white-space: normal;
  text-wrap: balance;
  overflow-wrap: anywhere;
}

button,
[type="submit"],
a[role="button"],
input,
select,
textarea {
  min-height: var(--touch-min);
}

.cf-touch-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--mobile-card-radius);
  padding: 1rem;
  box-shadow: var(--shadow);
}

.cf-order-card,
.cf-parcella-card,
.cf-order-mini-card {
  gap: .78rem;
}

.cf-incident-report-flow {
  display: grid;
  gap: .8rem;
}

.cf-toast {
  border-radius: 16px;
  border: 1px solid var(--border);
  padding: .85rem 1rem;
  background: var(--toast-surface);
  color: var(--text);
  box-shadow: 0 10px 24px rgba(0,0,0,.22);
}

html[data-display-mode="field"] .cf-bottom-nav {
  box-shadow: 0 -10px 28px rgba(15, 23, 42, 0.08);
}

html[data-display-mode="field"] .cf-toast {
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.12);
}

@media (max-width: 720px) {
  .cf-mobile-secondary-copy {
    display: none;
  }
}

.cf-toast--success {
  border-color: rgba(16,185,129,.35);
}

.cf-toast--error {
  border-color: rgba(228,87,86,.35);
}

button.is-loading,
button[aria-busy="true"] {
  pointer-events: none;
  opacity: .74;
}

button.is-loading::after,
button[aria-busy="true"]::after {
  content: "";
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid currentColor;
  border-right-color: transparent;
  display: inline-block;
  animation: cf-spin .7s linear infinite;
}

@keyframes cf-spin {
  to { transform: rotate(360deg); }
}

.cf-order-card {
  display: grid;
  gap: .7rem;
}

.cf-order-card__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: .65rem;
}

.cf-order-card__head h4 {
  margin: 0;
}

.cf-order-meta {
  display: grid;
  gap: .22rem;
}

.cf-order-meta p {
  margin: 0;
}

.cf-app-shell-spacer {
  display: none;
}

@media (max-width: 980px) {
  main.container {
    padding-left: var(--mobile-edge);
    padding-right: var(--mobile-edge);
  }

  .cf-nav-right__user,
  .cf-nav-right__logout {
    display: none;
  }

  .cf-detail-kpis,
  .cf-jornada-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .cf-toast-region {
    position: fixed;
    right: 12px;
    left: 12px;
    bottom: calc(var(--bottom-nav-height) + var(--safe-bottom) + 12px);
    display: grid;
    gap: .45rem;
    z-index: 1500;
    pointer-events: none;
  }

  body.cf-has-bottom-nav main.container {
    padding-bottom: calc(var(--bottom-nav-height) + var(--safe-bottom) + 16px);
  }

  .container {
    padding-left: var(--mobile-edge);
    padding-right: var(--mobile-edge);
  }

  .cf-app-shell-spacer {
    display: block;
    height: calc(var(--bottom-nav-height) + var(--safe-bottom));
  }

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

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

  .cf-detail-shell,
  .cf-split,
  .cf-plan-grid {
    grid-template-columns: 1fr;
  }

  .cf-map {
    height: 48vh;
  }
}

@media (max-width: 420px) {
  :root {
    --bottom-nav-height: 82px;
  }

  .cf-bottom-nav {
    gap: .2rem;
    padding-left: .45rem;
    padding-right: .45rem;
  }

  .cf-bottom-nav a {
    min-height: 60px;
    font-size: .68rem;
    padding: .28rem .12rem;
    border-radius: 14px;
  }

  .cf-bottom-nav__icon {
    font-size: 1rem;
  }

  .cf-detail-kpis,
  .cf-jornada-kpis {
    grid-template-columns: 1fr 1fr;
  }

  .cf-page-header,
  .cf-plan-card,
  .cf-map-shell,
  .registres-container,
  .cf-reg-side,
  .cf-reg-map-wrap,
  .cf-touch-card,
  .cf-mobile-card {
    border-radius: 18px;
  }
}