/* Mobile workspace: shared navigation, registers and field-entry surfaces.
   Desktop and public mapping keep their existing layout. */
.mobile-navigation { display: none; }
@media screen and (max-width: 991.98px) {
  body:has(.mobile-navigation) {
    --mobile-canvas: #f2f5f4;
    --mobile-surface: #fff;
    --mobile-ink: #172f29;
    --mobile-muted: #52665f;
    --mobile-line: #dce5e0;
    --mobile-accent: #176348;
    --mobile-tint: #e7f2eb;
    background: var(--mobile-canvas);
    font-size: 1rem;
  }
  [data-bs-theme='dark'] body:has(.mobile-navigation) {
    --mobile-canvas: #101c19;
    --mobile-surface: #192a24;
    --mobile-ink: #edf5ef;
    --mobile-muted: #afc3b7;
    --mobile-line: #354a3f;
    --mobile-accent: #9cddba;
    --mobile-tint: #264537;
  }
  .mobile-navigation {
    position: fixed; inset: auto 0 0; z-index: 1030;
    display: flex; justify-content: space-around; gap: 2px;
    padding: 8px max(8px, env(safe-area-inset-right)) calc(8px + env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
    background: var(--mobile-surface); border-top: 1px solid var(--mobile-line);
    box-shadow: 0 -4px 20px rgb(16 40 28 / 5%);
  }
  .mobile-navigation-item {
    display: flex; flex: 1; flex-direction: column; align-items: center; justify-content: center;
    gap: 5px; min-width: 0; min-height: 52px; padding: 6px 2px;
    border: 0; border-radius: 12px; background: transparent;
    color: var(--mobile-muted); text-decoration: none; font: inherit; font-size: .75rem; font-weight: 600;
  }
  .mobile-navigation-item i { font-size: 1.125rem; }
  .mobile-navigation-item.is-current { color: var(--mobile-accent); background: var(--mobile-tint); }
  .mobile-navigation-item:hover { color: var(--mobile-accent); }
  .mobile-navigation-item:focus-visible { outline: 2px solid var(--mobile-accent); outline-offset: -2px; }
  .app-sidebar ~ main.page-shell { padding-bottom: calc(100px + env(safe-area-inset-bottom)) !important; }
  .app-header.app-header--workspace { position: sticky; top: 0; z-index: 1020; background: var(--mobile-surface); }
  .workspace-topbar { min-height: 72px; padding: 10px 16px; gap: 12px; }
  .workspace-eyebrow { font-size: .75rem; letter-spacing: .08em; color: var(--mobile-muted); }
  .workspace-title { font-size: 1rem; color: var(--mobile-ink); }
  .sidebar-toggle { width: 44px; height: 44px; border-radius: 12px; border-color: var(--mobile-line); }
  .app-account-menu .nav-user-btn { min-height: 44px; }
  .app-sidebar { --bs-offcanvas-width: min(340px, 90vw); background: #163629 !important; }
  .sidebar-caption, .sidebar-brand .brand-sub { font-size: .75rem; }
  .sidebar-link, .sidebar-sublink { min-height: 46px; font-size: .9375rem; }
  .sidebar-footer { color: #c3d9cb; }
  .app-sidebar ~ .page-shell { color: var(--mobile-ink); }
  .app-sidebar ~ .page-shell :is(.btn, .nav-link) { min-height: 44px; }
  .app-sidebar ~ .page-shell .btn { align-content: center; font-size: .875rem; border-radius: 10px; }
  .app-sidebar ~ .page-shell :is(.form-control, .form-select) { min-height: 48px; font-size: 1rem; border-radius: 10px; }
  .app-sidebar ~ .page-shell :is(.form-label, .form-text, .operations-form-hint, .operations-required-hint) { font-size: .875rem; }
  .app-sidebar ~ .page-shell :is(input, select, textarea, button, a) { scroll-margin-block: 90px; }
  .app-sidebar ~ .page-shell :is(.page-title, .page-subtitle) { overflow-wrap: anywhere; }
  .app-sidebar ~ .page-shell .page-title { font-size: 1.625rem; line-height: 1.2; letter-spacing: -.035em; }
  .app-sidebar ~ .page-shell .page-subtitle { font-size: .875rem; line-height: 1.6; }
  .app-sidebar ~ .page-shell :is(.surface-card, .kpi-card) { background: var(--mobile-surface); border-color: var(--mobile-line); box-shadow: none; border-radius: 16px; }
  .app-sidebar ~ .page-shell .dashboard-intro { padding: 4px 0 16px; border: 0; border-radius: 0; background: transparent; box-shadow: none; }
  .app-sidebar ~ .page-shell .dashboard-intro::before,
  .app-sidebar ~ .page-shell .dashboard-intro::after { display: none; }
  .operations-tabs { flex-wrap: nowrap; overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: thin; }
  .operations-tabs a { white-space: nowrap; flex-shrink: 0; min-height: 44px; }
  .app-sidebar ~ .page-shell .hero-stats { display: flex; flex-wrap: wrap; gap: 8px; }
  .app-sidebar ~ .page-shell .hero-stat { font-size: .875rem; padding: 8px 10px; background: var(--mobile-surface); border: 1px solid var(--mobile-line); border-radius: 8px; }
  .app-sidebar ~ .page-shell .module-head { align-items: stretch !important; gap: 16px !important; }
  .app-sidebar ~ .page-shell .module-head > div { min-width: 0; }
  .app-sidebar ~ .page-shell .module-head > div:last-child { width: 100%; }
  .app-sidebar ~ .page-shell .module-head > div:last-child > .btn-primary { order: -1; flex: 1 0 100%; }
  .global-dashboard { display: flex; flex-direction: column; }
  .global-dashboard > .dashboard-intro { order: -3; }
  .global-dashboard > .global-quick-actions { order: -2; }
  .global-dashboard .global-quick-actions { padding: 16px; background: #173e2e; color: #fff; border: 0; border-radius: 16px; }
  .global-quick-actions > div { display: grid !important; grid-template-columns: repeat(2, minmax(0, 1fr)); width: 100%; }
  .global-quick-actions .btn { display: flex; align-items: center; text-align: left; padding: 12px; color: #fff; background: #244f3d; border-color: #426550; }
  .global-quick-actions .btn:hover { background: #326449; }
  .global-dashboard .dashboard-kpi-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); margin: 0 0 20px; gap: 12px; }
  .global-dashboard .dashboard-kpi-grid > * { width: auto; padding: 0; margin: 0; min-width: 0; }
  .global-dashboard .kpi-card { padding: 16px; }
  .global-dashboard .kpi-value { font-size: 2rem; }
  .global-dashboard .kpi-label, .global-kpi-detail, .global-kpi-link { font-size: .875rem; }
  .global-module-grid { grid-template-columns: 1fr; }
  .global-module-links a { min-height: 48px; }
  .global-section-heading { flex-direction: column; align-items: flex-start; gap: 8px; }
  .app-sidebar ~ .page-shell :is(.module-form-card, .infrastructure-record-card) { padding: 18px; }
  .operations-form-section legend { font-size: 1rem; }
  .operations-form-hint { margin-left: 0; line-height: 1.6; }
  .operations-form-actions { gap: 10px; }
  .operations-form-actions > .btn { flex: 1 1 100%; }
  .operations-form-actions > .btn-primary { order: -1; }
  .infrastructure-record-grid { grid-template-columns: 1fr; gap: 24px; }
  .infrastructure-record-geometry { border-left: 0; padding-left: 0; }
}
@media screen and (max-width: 767.98px) {
  .app-sidebar ~ .page-shell [data-register] { padding: 14px; }
  .register-toolbar { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; }
  .register-toolbar .register-search { grid-column: 1 / -1; }
  .register-toolbar .register-status { min-width: 0; }
  .register-result-count { font-size: .875rem; }
  .app-sidebar ~ .page-shell [data-register] .table-responsive:has(.mobile-record-table) { overflow: visible; }
  .app-sidebar ~ .page-shell table.mobile-record-table { display: block; min-width: 0 !important; width: 100%; }
  .mobile-record-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .mobile-record-table tbody { display: grid; gap: 14px; }
  .mobile-record-table tbody > tr { display: grid; grid-template-columns: minmax(0, 1fr); border: 1px solid var(--mobile-line); border-radius: 14px; overflow: hidden; background: var(--mobile-surface); padding: 4px 14px; }
  .app-sidebar ~ .page-shell .mobile-record-table tbody > tr > td {
    display: block; min-width: 0; max-width: none; width: auto; padding: 10px 0;
    border: 0; border-bottom: 1px solid var(--mobile-line); background: transparent;
    white-space: normal; overflow-wrap: anywhere; text-align: left !important; font-size: .9375rem;
  }
  .mobile-record-table td[data-mobile-label]::before { content: attr(data-mobile-label); display: block; margin-bottom: 4px; color: var(--mobile-muted); font-weight: 500; font-size: .75rem; }
  .mobile-record-table tbody > tr > td:first-child { font-size: 1rem; font-weight: 600; }
  .mobile-record-table tbody > tr > td:last-child { border-bottom: 0; }
  .mobile-record-table .register-record-title { min-width: 0; max-width: none; font-size: .875rem; }
  .mobile-record-table .table-actions { flex-wrap: wrap; justify-content: flex-start; gap: 8px; }
  .mobile-record-table .ui-badge { font-size: .8125rem; white-space: normal; }
  [data-register]:has(.mobile-record-table) .infrastructure-register-scroll-hint { display: none; }
}
@media screen and (max-width: 374.98px) {
  .global-dashboard .dashboard-kpi-grid, .global-quick-actions > div { grid-template-columns: 1fr; }
  .mobile-navigation-item { font-size: .75rem; }
}
@media print { .mobile-navigation { display: none !important; } }
