/* =========================================================
   PIONET GIS · Adaptación automática por dispositivo
   La clase/dataset se aplica desde device-profile.js.
   ========================================================= */

html[data-pionet-device="mobile"] {
  --pionet-mobile-edge: 10px;
}

html[data-pionet-device="mobile"],
html[data-pionet-device="mobile"] body {
  min-width: 0;
  width: 100%;
  overflow-x: hidden;
}

html[data-pionet-device="mobile"] .topbar {
  position: sticky;
  z-index: 1700;
  top: 0;
  min-height: 62px;
  padding: 8px 10px;
}

html[data-pionet-device="mobile"] .brand {
  min-width: 0;
}

html[data-pionet-device="mobile"] .brand-title {
  font-size: 14px;
}

html[data-pionet-device="mobile"] .brand-subtitle {
  display: none;
}

html[data-pionet-device="mobile"] .brand-mark,
html[data-pionet-device="mobile"] .brand-logo {
  width: 34px;
  height: 34px;
}

html[data-pionet-device="mobile"] .topbar-right {
  gap: 5px;
}

html[data-pionet-device="mobile"] .topbar-action {
  width: 38px;
  min-width: 38px;
  height: 38px;
  min-height: 38px;
  padding: 0;
  overflow: hidden;
  border-radius: 10px;
  font-size: 0;
}

html[data-pionet-device="mobile"] .topbar-action .material-symbols-outlined {
  margin: 0;
  font-size: 20px;
}

html[data-pionet-device="mobile"] .cloud-sync-chip {
  width: 34px;
  min-width: 34px;
  height: 34px;
  padding: 0;
  justify-content: center;
}

html[data-pionet-device="mobile"] .cloud-sync-chip span:last-child {
  display: none;
}

html[data-pionet-device="mobile"] .main {
  width: 100%;
  padding: 18px 10px 28px;
}

html[data-pionet-device="mobile"] .page-heading {
  align-items: stretch;
  flex-direction: column;
  gap: 12px;
}

html[data-pionet-device="mobile"] .summary-grid,
html[data-pionet-device="mobile"] .projects-grid {
  grid-template-columns: 1fr;
}

html[data-pionet-device="mobile"] .projects-grid {
  padding: 10px;
}

html[data-pionet-device="mobile"] .panel-toolbar {
  align-items: stretch;
  flex-direction: column;
}

html[data-pionet-device="mobile"] .search-wrap {
  max-width: none;
}

html[data-pionet-device="mobile"] .workspace-screen {
  min-height: calc(100dvh - 62px);
}

html[data-pionet-device="mobile"] .workspace-toolbar {
  height: auto;
  min-height: 52px;
  padding: 7px 8px;
  overflow-x: auto;
  gap: 7px;
}

html[data-pionet-device="mobile"] .workspace-toolbar > * {
  flex: 0 0 auto;
}

html[data-pionet-device="mobile"] .workspace-title {
  min-width: 150px;
}

html[data-pionet-device="mobile"] .workspace-title strong {
  font-size: 11px;
}

html[data-pionet-device="mobile"] .workspace-title span {
  font-size: 8px;
}

html[data-pionet-device="mobile"] .active-layer-chip {
  max-width: 150px;
}

html[data-pionet-device="mobile"] .workspace-body {
  display: flex;
  flex-direction: column;
  min-height: calc(100dvh - 114px);
}

html[data-pionet-device="mobile"] .map-stage {
  order: 1;
  min-height: 64dvh;
  height: 64dvh;
}

html[data-pionet-device="mobile"] .layers-sidebar {
  order: 2;
  max-height: 42dvh;
  border-top: 1px solid var(--gray-200);
  border-right: 0;
}

html[data-pionet-device="mobile"] .layers-heading {
  padding: 10px 12px;
}

html[data-pionet-device="mobile"] .layers-panel {
  padding: 8px;
}

html[data-pionet-device="mobile"] .element-radial-menu {
  position: fixed;
  z-index: 1900;
  left: 50% !important;
  right: auto !important;
  bottom: max(12px, env(safe-area-inset-bottom));
  top: auto !important;
  grid-template-columns: repeat(4, minmax(62px, 1fr));
  width: min(94vw, 420px);
  transform: translateX(-50%);
  border-radius: 18px;
}

html[data-pionet-device="mobile"] .element-radial-menu::after {
  display: none;
}

html[data-pionet-device="mobile"] .element-info-panel {
  position: fixed;
  z-index: 1850;
  top: auto;
  right: 8px;
  bottom: max(8px, env(safe-area-inset-bottom));
  left: 8px;
  width: auto;
  max-height: 68dvh;
  border-radius: 18px;
}

html[data-pionet-device="mobile"] .toast-stack {
  right: 8px;
  bottom: max(8px, env(safe-area-inset-bottom));
  left: 8px;
}

html[data-pionet-device="mobile"] .toast {
  min-width: 0;
  max-width: none;
  width: 100%;
}

html[data-pionet-device="mobile"] .ftth-editor-backdrop {
  padding: 0;
}

html[data-pionet-device="mobile"] .ftth-editor-modal {
  width: 100vw;
  height: 100dvh;
  max-width: 100vw;
  max-height: 100dvh;
  border-radius: 0;
}

html[data-pionet-device="mobile"] .ftth-editor-header {
  min-height: 66px;
  padding: 9px 12px;
}

html[data-pionet-device="mobile"] .ftth-editor-header h2,
html[data-pionet-device="mobile"] .ftth-editor-header strong {
  font-size: 15px;
}

html[data-pionet-device="mobile"] .ftth-editor-stats {
  display: none;
}

html[data-pionet-device="mobile"] .ftth-editor-toolbar {
  min-height: 46px;
  padding: 6px 8px;
}

html[data-pionet-device="mobile"] .ftth-toolbar-label {
  display: none;
}

html[data-pionet-device="mobile"] .ftth-diagram-body {
  display: flex;
  flex-direction: column;
  height: auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
}

html[data-pionet-device="mobile"] .ftth-workspace {
  order: 1;
  flex: 0 0 auto;
  min-height: auto;
  padding: 10px;
  overflow: visible;
}

html[data-pionet-device="mobile"] .ftth-cable-panel {
  order: 2;
  flex: 0 0 auto;
  min-height: auto;
  max-height: none;
  padding: 10px;
  overflow: visible;
  border-top: 1px solid var(--gray-200);
  border-right: 0;
}

html[data-pionet-device="mobile"] .ftth-inspector {
  order: 3;
  flex: 0 0 auto;
  min-height: auto;
  max-height: none;
  padding: 10px;
  overflow: visible;
  border-top: 1px solid var(--gray-200);
  border-left: 0;
}

html[data-pionet-device="mobile"] .ftth-workspace-heading {
  align-items: flex-start;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 9px;
}

html[data-pionet-device="mobile"] .ftth-workspace-heading strong {
  font-size: 12px;
}

html[data-pionet-device="mobile"] .ftth-workspace-heading b {
  margin-top: 0;
}

html[data-pionet-device="mobile"] .pionet-direct-shell {
  min-width: 0;
  width: 100%;
  border-width: 3px;
  border-radius: 15px;
}

html[data-pionet-device="mobile"] .pionet-direct-flow {
  display: flex;
  flex-direction: column;
  padding: 7px;
}

html[data-pionet-device="mobile"] .pionet-direct-source,
html[data-pionet-device="mobile"] .pionet-direct-optical,
html[data-pionet-device="mobile"] .pionet-direct-destinations {
  width: 100%;
  padding: 8px;
}

html[data-pionet-device="mobile"] .pionet-direct-source {
  order: 1;
}

html[data-pionet-device="mobile"] .pionet-direct-optical {
  order: 2;
}

html[data-pionet-device="mobile"] .pionet-direct-destinations {
  order: 3;
}

html[data-pionet-device="mobile"] .pionet-direct-strands {
  grid-template-columns: 1fr;
}

html[data-pionet-device="mobile"] .ftth-port-menu {
  position: fixed !important;
  z-index: 2200;
  top: auto !important;
  right: 8px !important;
  bottom: max(8px, env(safe-area-inset-bottom)) !important;
  left: 8px !important;
  width: auto;
  max-height: 72dvh;
  overflow-y: auto;
  border-radius: 18px;
}

html[data-pionet-device="mobile"] .ftth-port-menu > div {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

html[data-pionet-device="mobile"] .ftth-port-menu button {
  min-height: 44px;
  font-size: 9px;
}

html[data-pionet-device="mobile"] .modal {
  width: calc(100vw - 16px);
  max-width: none;
  max-height: calc(100dvh - 16px);
}

html[data-pionet-device="mobile"] .login-layout {
  grid-template-columns: 1fr;
  min-height: 100dvh;
}

html[data-pionet-device="mobile"] .login-story {
  display: none;
}

html[data-pionet-device="mobile"] .login-card-wrap {
  min-height: 100dvh;
  padding: 18px 12px;
}

html[data-pionet-device="mobile"] .login-card {
  width: min(100%, 440px);
}

/* Tablet mantiene más información pero reduce laterales. */
html[data-pionet-device="tablet"] .workspace-body {
  grid-template-columns: 230px minmax(0, 1fr);
}

html[data-pionet-device="tablet"] .ftth-diagram-body {
  grid-template-columns: 240px minmax(480px, 1fr);
}

html[data-pionet-device="tablet"] .ftth-inspector {
  position: absolute;
  z-index: 12;
  right: 0;
  top: 0;
  bottom: 0;
  width: 300px;
  box-shadow: -12px 0 32px rgba(7,28,51,.16);
}
