/* RCH v0.21.3 — shell mobile unificata Territory + Office. */

/* Palette icone mutuata dal menu Office. */
body.rch-territory-v1 [data-rch-mobile-nav-key="territory"] .rch-inline-icon,
body.rch-office-v1 [data-rch-mobile-nav-key="territory"] .rch-inline-icon { color: #8ea8ff; }
body.rch-territory-v1 [data-rch-mobile-nav-key="overview"] .rch-inline-icon,
body.rch-office-v1 [data-rch-mobile-nav-key="overview"] .rch-inline-icon { color: #59a8ff; }
body.rch-territory-v1 [data-rch-mobile-nav-key="activities"] .rch-inline-icon,
body.rch-office-v1 [data-rch-mobile-nav-key="activities"] .rch-inline-icon { color: #44d6a6; }
body.rch-territory-v1 [data-rch-mobile-nav-key="events"] .rch-inline-icon,
body.rch-office-v1 [data-rch-mobile-nav-key="events"] .rch-inline-icon { color: #ff83c8; }
body.rch-territory-v1 [data-rch-mobile-nav-key="calendar"] .rch-inline-icon,
body.rch-office-v1 [data-rch-mobile-nav-key="calendar"] .rch-inline-icon { color: #72c7ff; }
body.rch-territory-v1 [data-rch-mobile-nav-key="inbox"] .rch-inline-icon,
body.rch-office-v1 [data-rch-mobile-nav-key="inbox"] .rch-inline-icon { color: #a993ff; }
body.rch-territory-v1 [data-rch-mobile-nav-key="tasks"] .rch-inline-icon,
body.rch-office-v1 [data-rch-mobile-nav-key="tasks"] .rch-inline-icon { color: #7ce0a6; }
body.rch-territory-v1 [data-rch-mobile-nav-key="fieldwork"] .rch-inline-icon,
body.rch-office-v1 [data-rch-mobile-nav-key="fieldwork"] .rch-inline-icon,
body.rch-territory-v1 [data-rch-mobile-nav-key="timer"] .rch-inline-icon,
body.rch-office-v1 [data-rch-mobile-nav-key="timer"] .rch-inline-icon { color: #ffc76d; }
body.rch-territory-v1 [data-rch-mobile-nav-key="signals"] .rch-inline-icon,
body.rch-office-v1 [data-rch-mobile-nav-key="signals"] .rch-inline-icon { color: #ff8d78; }
body.rch-territory-v1 [data-rch-mobile-nav-key="permits"] .rch-inline-icon,
body.rch-office-v1 [data-rch-mobile-nav-key="permits"] .rch-inline-icon { color: #79d7f2; }
body.rch-territory-v1 [data-rch-mobile-nav-key="assignments"] .rch-inline-icon,
body.rch-office-v1 [data-rch-mobile-nav-key="assignments"] .rch-inline-icon { color: #b993ff; }
body.rch-territory-v1 [data-rch-mobile-nav-key="core"] .rch-inline-icon,
body.rch-office-v1 [data-rch-mobile-nav-key="core"] .rch-inline-icon { color: #e08cff; }
body.rch-territory-v1 [data-rch-mobile-nav-key="audit"] .rch-inline-icon,
body.rch-office-v1 [data-rch-mobile-nav-key="audit"] .rch-inline-icon,
body.rch-territory-v1 [data-rch-mobile-nav-key="report"] .rch-inline-icon { color: #b5c8df; }
body.rch-office-v1 [data-rch-mobile-nav-key="accounts"] .rch-inline-icon { color: #c69aff; }
body.rch-office-v1 [data-rch-mobile-nav-key="archive"] .rch-inline-icon { color: #ef8cff; }
body.rch-territory-v1 [data-rch-mobile-nav-key="logout"] .rch-inline-icon,
body.rch-office-v1 [data-rch-mobile-nav-key="logout"] .rch-inline-icon { color: #ff8d9f; }

body.rch-office-v1 .rch-office-mobile-nav-drawer,
body.rch-office-v1 .rch-office-mobile-nav-backdrop {
  display: none;
}

@media (max-width: 72rem) {
  body.rch-office-v1.rch-office-mobile-nav-open,
  body.rch-territory-v1.rch-territory-nav-open {
    overflow: hidden !important;
  }

  body.rch-territory-v1 .territory-nav-drawer.rch-unified-mobile-drawer {
    z-index: 10040 !important;
    width: min(20rem, 88vw) !important;
    height: 100dvh !important;
    max-height: 100dvh !important;
    padding: calc(0.9rem + env(safe-area-inset-top, 0px)) 0.8rem calc(0.9rem + env(safe-area-inset-bottom, 0px)) !important;
    gap: 0.7rem !important;
    border: 0 !important;
    border-radius: 0 !important;
    color: #dce9f8 !important;
    background: radial-gradient(circle at 25% 0%, rgba(26,119,255,.23), transparent 22rem), linear-gradient(180deg,#082a55,#061b38 58%,#04162e) !important;
    box-shadow: 0.9rem 0 2.3rem rgba(5,24,51,.3) !important;
  }

  body.rch-territory-v1 .territory-nav-backdrop:not([hidden]),
  body.rch-office-v1 .rch-office-mobile-nav-backdrop:not([hidden]) {
    position: fixed !important;
    z-index: 10030 !important;
    inset: 0 !important;
    display: block !important;
    background: rgba(3,16,34,.42) !important;
    backdrop-filter: blur(4px) !important;
    -webkit-backdrop-filter: blur(4px) !important;
  }

  body.rch-territory-v1 .territory-nav-brand img {
    width: 2.8rem !important;
    height: 2.8rem !important;
    border-radius: 0.75rem !important;
  }

  body.rch-territory-v1 .territory-nav-brand strong { font-size: 1rem !important; }
  body.rch-territory-v1 .territory-nav-brand small { font-size: 0.66rem !important; color: #a9bdd6 !important; }

  body.rch-territory-v1 .territory-nav-close {
    width: 2.75rem !important;
    height: 2.75rem !important;
    min-width: 2.75rem !important;
    display: inline-grid !important;
    place-items: center !important;
    border: 1px solid rgba(139,177,222,.2) !important;
    border-radius: 0.8rem !important;
    color: #e4eef9 !important;
    background: rgba(255,255,255,.06) !important;
  }

  body.rch-territory-v1 .territory-nav-list {
    min-height: 0 !important;
    overflow-y: auto !important;
    overscroll-behavior: contain;
    gap: 0.18rem !important;
    padding-right: 0.2rem !important;
  }

  body.rch-territory-v1 .territory-nav-section-label {
    margin: 0.2rem 0 0.15rem !important;
    padding: 0 0.55rem !important;
    color: #73b3ff !important;
    font-size: 0.64rem !important;
    font-weight: 900 !important;
    letter-spacing: 0.14em !important;
    text-transform: uppercase !important;
  }

  body.rch-territory-v1 .territory-nav-item {
    min-height: 3.05rem !important;
    grid-template-columns: 1.35rem minmax(0,1fr) !important;
    align-items: center !important;
    gap: 0.7rem !important;
    padding: 0 0.75rem !important;
    border: 1px solid transparent !important;
    border-radius: 0.82rem !important;
    color: #aec1da !important;
    background: transparent !important;
    font-size: 0.81rem !important;
    font-weight: 760 !important;
    line-height: 1.15 !important;
  }

  body.rch-territory-v1 .territory-nav-item:hover,
  body.rch-territory-v1 .territory-nav-item.active {
    color: #fff !important;
    border-color: rgba(69,145,255,.34) !important;
    background: linear-gradient(90deg,rgba(20,124,255,.28),rgba(75,86,203,.13)) !important;
    box-shadow: inset 0.22rem 0 0 #2387ff !important;
  }

  body.rch-territory-v1 .territory-nav-item .rch-inline-icon {
    width: 1.18rem !important;
    height: 1.18rem !important;
    display: inline-flex !important;
    filter: drop-shadow(0 .18rem .32rem rgba(0,0,0,.18));
  }

  body.rch-office-v1 .rch-office-mobile-nav-drawer {
    position: fixed !important;
    z-index: 10040 !important;
    inset: 0 auto 0 0 !important;
    width: min(20rem, 88vw) !important;
    height: 100dvh !important;
    max-height: 100dvh !important;
    display: grid !important;
    grid-template-rows: auto auto minmax(0,1fr) auto !important;
    gap: 0.55rem !important;
    padding: calc(0.9rem + env(safe-area-inset-top, 0px)) 0.8rem calc(0.9rem + env(safe-area-inset-bottom, 0px)) !important;
    overflow: hidden !important;
    color: #dce9f8 !important;
    background: radial-gradient(circle at 25% 0%, rgba(26,119,255,.23), transparent 22rem), linear-gradient(180deg,#082a55,#061b38 58%,#04162e) !important;
    box-shadow: 0.9rem 0 2.3rem rgba(5,24,51,.3) !important;
    transform: translateX(-103%) !important;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
    transition: transform 190ms ease, opacity 150ms ease, visibility 150ms ease !important;
  }

  body.rch-office-v1.rch-office-mobile-nav-open .rch-office-mobile-nav-drawer,
  body.rch-office-v1 .rch-office-mobile-nav-drawer[aria-hidden="false"] {
    transform: translateX(0) !important;
    visibility: visible !important;
    opacity: 1 !important;
    pointer-events: auto !important;
  }

  body.rch-office-v1 .rch-office-mobile-nav-header {
    min-width: 0 !important;
    min-height: 3.6rem !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 0.75rem !important;
    position: relative !important;
    z-index: 2 !important;
  }

  body.rch-office-v1 .rch-office-mobile-nav-brand {
    min-width: 0 !important;
    display: flex !important;
    align-items: center !important;
    gap: 0.7rem !important;
  }

  body.rch-office-v1 .rch-office-mobile-nav-logo {
    width: 2.8rem !important;
    height: 2.8rem !important;
    flex: 0 0 auto !important;
    border-radius: 0.75rem !important;
    box-shadow: 0 .6rem 1.5rem rgba(0,108,255,.26) !important;
    background: url('/assets/brand/rch-os-icon-512.png') center/cover no-repeat !important;
  }

  body.rch-office-v1 .rch-office-mobile-nav-brand span {
    min-width: 0 !important;
    display: grid !important;
    gap: 0.12rem !important;
  }

  body.rch-office-v1 .rch-office-mobile-nav-brand strong {
    color: #fff !important;
    font-size: 1rem !important;
    line-height: 1.05 !important;
  }

  body.rch-office-v1 .rch-office-mobile-nav-brand small {
    overflow: hidden !important;
    color: #a9bdd6 !important;
    font-size: 0.66rem !important;
    line-height: 1.15 !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
  }

  body.rch-office-v1 .rch-office-mobile-nav-close {
    width: 2.75rem !important;
    height: 2.75rem !important;
    min-width: 2.75rem !important;
    display: inline-grid !important;
    place-items: center !important;
    flex: 0 0 auto !important;
    padding: 0 !important;
    border: 1px solid rgba(139,177,222,.2) !important;
    border-radius: 0.8rem !important;
    color: #e4eef9 !important;
    background: rgba(255,255,255,.06) !important;
  }

  body.rch-office-v1 .rch-office-mobile-nav-close svg { width: 1.35rem !important; height: 1.35rem !important; }

  body.rch-office-v1 .rch-office-mobile-nav-section-label {
    padding: 0 0.55rem !important;
    color: #73b3ff !important;
    font-size: 0.64rem !important;
    font-weight: 900 !important;
    letter-spacing: 0.14em !important;
    text-transform: uppercase !important;
  }

  body.rch-office-v1 .rch-office-mobile-nav-list {
    min-height: 0 !important;
    display: grid !important;
    align-content: start !important;
    gap: 0.18rem !important;
    padding-right: 0.2rem !important;
    overflow-y: auto !important;
    overscroll-behavior: contain !important;
    scrollbar-width: thin !important;
    scrollbar-color: #6685a9 transparent !important;
  }

  body.rch-office-v1 .rch-office-mobile-nav-item,
  body.rch-office-v1 .rch-office-mobile-footer-item {
    width: 100% !important;
    min-width: 0 !important;
    min-height: 3.05rem !important;
    display: grid !important;
    grid-template-columns: 1.35rem minmax(0,1fr) auto !important;
    align-items: center !important;
    gap: 0.7rem !important;
    padding: 0 0.75rem !important;
    margin: 0 !important;
    border: 1px solid transparent !important;
    border-radius: 0.82rem !important;
    color: #aec1da !important;
    background: transparent !important;
    box-shadow: none !important;
    font: inherit !important;
    font-size: 0.81rem !important;
    font-weight: 760 !important;
    line-height: 1.15 !important;
    text-align: left !important;
    text-decoration: none !important;
    transform: none !important;
  }

  body.rch-office-v1 .rch-office-mobile-footer-item {
    min-height: 2.85rem !important;
    border-color: rgba(149,184,225,.18) !important;
    background: rgba(255,255,255,.035) !important;
  }

  body.rch-office-v1 .rch-office-mobile-nav-item:hover,
  body.rch-office-v1 .rch-office-mobile-nav-item:focus-visible,
  body.rch-office-v1 .rch-office-mobile-footer-item:hover,
  body.rch-office-v1 .rch-office-mobile-footer-item:focus-visible {
    color: #fff !important;
    border-color: rgba(69,145,255,.34) !important;
    background: linear-gradient(90deg,rgba(20,124,255,.28),rgba(75,86,203,.13)) !important;
    outline: none !important;
  }

  body.rch-office-v1 .rch-mobile-nav-label {
    min-width: 0 !important;
    overflow: hidden !important;
    color: inherit !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
  }

  body.rch-office-v1 .rch-mobile-nav-count {
    min-width: 1.55rem !important;
    min-height: 1.55rem !important;
    display: inline-grid !important;
    place-items: center !important;
    padding: 0 0.38rem !important;
    border-radius: 999px !important;
    color: #d3e0f0 !important;
    background: rgba(255,255,255,.08) !important;
    font-size: 0.62rem !important;
    line-height: 1 !important;
  }

  body.rch-office-v1 .rch-office-mobile-nav-item .rch-inline-icon,
  body.rch-office-v1 .rch-office-mobile-footer-item .rch-inline-icon {
    width: 1.18rem !important;
    height: 1.18rem !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    filter: drop-shadow(0 .18rem .32rem rgba(0,0,0,.18));
  }

  body.rch-office-v1 .rch-office-mobile-nav-item .rch-inline-icon svg,
  body.rch-office-v1 .rch-office-mobile-footer-item .rch-inline-icon svg {
    width: 100% !important;
    height: 100% !important;
  }

  body.rch-office-v1 .rch-office-mobile-nav-footer {
    min-width: 0 !important;
    display: grid !important;
    gap: 0.38rem !important;
    padding-top: 0.6rem !important;
    border-top: 1px solid rgba(139,177,222,.14) !important;
  }

  body.rch-office-v1 .rch-office-mobile-admin-commands {
    display: grid !important;
    gap: 0.38rem !important;
    padding-bottom: 0.15rem !important;
  }

  body.rch-office-v1 .rch-office-mobile-admin-commands[hidden] { display: none !important; }
}

@media (max-width: 47.99rem) {
  body.rch-office-v1 .mobile-timer-fab { display: none !important; }

  body.rch-office-v1 .office-topbar {
    min-height: 0 !important;
    display: block !important;
    padding: calc(0.55rem + env(safe-area-inset-top, 0px)) 0.7rem 0.65rem !important;
    border-bottom: 1px solid #dce6f2 !important;
  }

  body.rch-office-v1 .office-topbar > div:first-child { display: none !important; }

  body.rch-office-v1 .topbar-actions {
    width: 100% !important;
    display: grid !important;
    grid-template-columns: 2.8rem minmax(0,1fr) 2.8rem !important;
    grid-template-areas: "menu scope refresh" "timer timer territory" !important;
    gap: 0.48rem !important;
    align-items: stretch !important;
    justify-content: stretch !important;
    overflow: visible !important;
  }

  body.rch-office-v1 .scope-control {
    grid-area: scope !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
    min-height: 2.8rem !important;
    height: 2.8rem !important;
    grid-template-columns: auto minmax(0,1fr) !important;
    gap: 0.35rem !important;
    padding: 0 0.45rem 0 0.7rem !important;
    border-radius: 0.8rem !important;
  }

  body.rch-office-v1 .scope-control span { display: block !important; font-size: 0.52rem !important; letter-spacing: 0.08em !important; }
  body.rch-office-v1 .scope-control select { min-width: 0 !important; width: 100% !important; min-height: 2.35rem !important; padding-inline: 0.2rem !important; font-size: 0.72rem !important; }

  body.rch-office-v1 #mobileMenuBtn { grid-area: menu !important; }
  body.rch-office-v1 #refreshBtn,
  body.rch-office-v1 #refreshBtn.refresh-button { grid-area: refresh !important; }

  body.rch-office-v1 #mobileMenuBtn,
  body.rch-office-v1 #refreshBtn,
  body.rch-office-v1 #refreshBtn.refresh-button,
  body.rch-office-v1 .office-territory-link {
    width: 2.8rem !important;
    min-width: 2.8rem !important;
    max-width: 2.8rem !important;
    height: 2.8rem !important;
    min-height: 2.8rem !important;
    padding: 0 !important;
    justify-content: center !important;
    border-radius: 0.8rem !important;
  }

  body.rch-office-v1 .office-timer-link {
    grid-area: timer !important;
    min-width: 0 !important;
    min-height: 2.8rem !important;
    height: 2.8rem !important;
    padding: 0 0.8rem !important;
    justify-content: center !important;
    border-radius: 0.8rem !important;
  }

  body.rch-office-v1 .office-territory-link { grid-area: territory !important; }
  body.rch-office-v1 .office-timer-link .rch-button-label { display: inline !important; font-size: 0.72rem !important; }
  body.rch-office-v1 .office-territory-link .rch-button-label,
  body.rch-office-v1 #mobileMenuBtn .rch-button-label,
  body.rch-office-v1 #refreshBtn .rch-button-label { display: none !important; }

  body.rch-office-v1 .topbar-actions .status-chip,
  body.rch-office-v1 .topbar-actions .user-chip,
  body.rch-office-v1 #realtimeStatus,
  body.rch-office-v1 #dataLoadStatus,
  body.rch-office-v1 #currentUserLabel { display: none !important; }

  body.rch-office-v1 .office-content { padding: 0.7rem !important; }

  body.rch-office-v1 #view-permits .section-intro {
    gap: 0.8rem !important;
    padding: 1.05rem !important;
    border-radius: 1.05rem !important;
  }

  body.rch-office-v1 #view-permits .section-intro .eyebrow { margin-bottom: 0.35rem !important; font-size: 0.58rem !important; }
  body.rch-office-v1 #view-permits .section-intro h2 { margin: 0 !important; font-size: 1.35rem !important; line-height: 1.08 !important; }

  body.rch-office-v1 #view-permits .section-intro p:not(.eyebrow) {
    margin: 0.55rem 0 0 !important;
    display: -webkit-box !important;
    overflow: hidden !important;
    -webkit-box-orient: vertical !important;
    -webkit-line-clamp: 2 !important;
    color: #6c7b91 !important;
    font-size: 0.82rem !important;
    line-height: 1.45 !important;
  }

  body.rch-office-v1 #createPermitBtn {
    width: 100% !important;
    min-height: 2.95rem !important;
    justify-content: center !important;
    border-radius: 0.85rem !important;
    font-size: 0.85rem !important;
  }

  body.rch-office-v1 .table-toolbar.panel { padding: 0.75rem !important; }
  body.rch-office-v1 #view-permits .toolbar-main { grid-template-columns: minmax(0,1fr) minmax(0,1fr) !important; }
  body.rch-office-v1 #view-permits .toolbar-main > :first-child { grid-column: 1 / -1 !important; }
}
