/* SICAM Consolidated Responsive Breakpoints (descending cascade order) */

@media (min-width: 769px) {
  #gacetaView.active-view {
    display: block;
    height: 100%;
    max-height: 100%;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 28px 36px 120px 36px;
    box-sizing: border-box;
  }
  #gacetaView.active-view .admin-container {
    display: block;
    max-width: 1400px;
    margin: 0 auto;
    padding-bottom: 60px;
  }
  #gacetaView.active-view .gaceta-main-card {
    display: block;
    width: 100%;
    margin-bottom: 40px;
  }
  #gacetaView.active-view .gaceta-table-wrap {
    width: 100%;
    max-height: none;
    overflow-x: auto;
    overflow-y: visible;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    background: var(--card-bg);
  }
  #gacetaView.active-view .gaceta-table-wrap.scroll-box {
    max-height: 650px;
    overflow-y: auto;
  }
  .gaceta-table-wrap table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
  }
  .gaceta-table-wrap table thead th {
    padding: 14px 18px;
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    border-bottom: 2px solid var(--border-color);
  }
  .gaceta-table-wrap table tbody td {
    padding: 13px 18px;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
  }
  .gaceta-table-wrap table tbody tr:last-child td {
    border-bottom: none;
  }
  .gaceta-table-wrap table tbody tr:hover {
    background: rgba(234, 88, 12, 0.05);
  }
  .gaceta-title-cell {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--slate-800);
    line-height: 1.45;
  }
  .gaceta-action-cell a {
    padding: 7px 16px;
    font-size: 12px;
    font-weight: 700;
    border-radius: 6px;
    white-space: nowrap;
  }
}

@media (max-width: 1100px) {
  .home-kml-comparison-grid {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  }
}

@media (max-width: 1080px) {
  .seprec-content-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  .seprec-ficha-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  header {
    height: auto;
    padding: 10px 14px;
    flex-wrap: wrap;
    gap: 8px;
  }
  .brand {
    font-size: 13px;
    width: 100%;
    text-align: center;
  }
  .nav {
    width: 100%;
    display: flex;
    justify-content: flex-start;
    overflow-x: auto;
    flex-wrap: nowrap;
    gap: 6px;
    padding-bottom: 4px;
    -webkit-overflow-scrolling: touch;
  }
  .nav button {
    flex: 0 0 auto;
    padding: 8px 12px;
    font-size: 11px;
    white-space: nowrap;
    text-align: center;
    border-radius: 6px;
  }

  #adminView { padding: 14px 10px; }
  .admin-grid { grid-template-columns: 1fr; gap: 16px; }
  .admin-card { padding: 16px; }
  .oidc-grid { grid-template-columns: 1fr; }
  .telemetry-grid { grid-template-columns: 1fr; }
  .oidc-btn-group { flex-direction: column; }
  .oidc-btn-group button { width: 100%; margin: 0; }

  #tableView { padding: 12px 10px; }
  .toolbar { flex-direction: column; align-items: stretch; gap: 10px; }
  .toolbar .search { width: 100%; min-width: 0; flex-direction: column; }
  .toolbar .search input { max-width: 100%; width: 100%; }
  .toolbar .search button { width: 100%; }
  .toolbar-actions { width: 100%; flex-direction: column; gap: 8px; }
  .toolbar-actions button { width: 100%; margin: 0; }
  .metrics { flex-direction: column; align-items: stretch; padding: 12px; gap: 10px; }
  .metric { border-right: none; border-bottom: 1px solid var(--border-color); padding: 8px 0; min-width: 0; }
  .metric:last-child { border-bottom: none; }

  .login-hero { display: none; }
  .login-form-wrapper {
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at center, var(--petrol-850) 0%, var(--petrol-950) 100%);
    padding: 20px;
  }
  .login-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    padding: 32px 24px;
    border-radius: 12px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(226, 232, 240, 0.8);
    max-width: 400px;
  }
  
  .panel {
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    max-height: 85vh;
    overflow-y: auto;
    border-radius: 20px 20px 0 0;
    transform: translateY(100%);
    z-index: 1005;
    box-shadow: 0 -10px 35px rgba(0,0,0,0.4);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  }
  .panel.drawer-open { transform: translateY(0); }
  .drawer-toggle { display: none; }
}

@media (max-width: 768px) {
  #homeView {
    padding: 14px 12px 30px 12px;
  }
  .home-container {
    gap: 16px;
  }
  .home-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  .home-header .home-user-menu {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 6px;
  }
  .home-hero-card {
    padding: 20px 14px;
    border-radius: 14px;
  }
  .home-hero-title {
    font-size: 21px;
    line-height: 1.25;
    margin-bottom: 8px;
  }
  .home-hero-subtitle {
    font-size: 12.5px;
    line-height: 1.45;
    margin-bottom: 16px;
  }
  .home-spotlight-box {
    flex-direction: column;
    padding: 10px;
    gap: 10px;
    width: 100%;
    box-sizing: border-box;
  }
  .home-spotlight-input {
    width: 100%;
    min-height: 42px;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 13.5px;
    box-sizing: border-box;
  }
  .home-spotlight-actions {
    display: flex;
    flex-direction: column;
    width: 100%;
    gap: 8px;
  }
  .home-spotlight-actions .btn-search-map {
    width: 100%;
    height: 42px;
    font-size: 13px;
    justify-content: center;
  }
  .home-spotlight-actions-sub {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    width: 100%;
  }
  .home-spotlight-actions-sub .btn-search-sub {
    width: 100%;
    height: 38px;
    font-size: 12px;
    justify-content: center;
  }
  .home-modules-section-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    margin-bottom: 12px;
  }
  .home-modules-section-header h2 {
    font-size: 18px;
  }
  .home-modules-section-header span {
    font-size: 11.5px;
  }
  .home-modules-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .home-module-card {
    padding: 18px 14px;
    border-radius: 12px;
  }
  .home-kml-comparison-grid {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
  .home-kml-comparison-grid .card-delta {
    grid-column: span 2;
  }
  .home-compare-card {
    padding: 12px 10px;
  }
  .home-compare-val {
    font-size: 18px;
  }
  #seprecView {
    padding: 12px 10px 90px 10px;
  }
  .seprec-view-container {
    gap: 14px;
  }
  .seprec-view-hero {
    padding: 16px 14px;
    border-radius: 14px;
  }
  .seprec-view-hero h1 {
    font-size: 20px;
    line-height: 1.25;
    margin-bottom: 6px;
  }
  .seprec-view-hero p {
    font-size: 12.5px;
    line-height: 1.45;
  }
  .seprec-view-header-actions {
    width: 100%;
    display: flex;
    gap: 8px;
    margin-top: 10px;
  }
  .seprec-view-header-actions button {
    flex: 1;
    justify-content: center;
    height: 36px;
    font-size: 11.5px;
  }
  .seprec-view-search-box {
    display: flex;
    flex-direction: column;
    background: rgba(255, 255, 255, 0.16);
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: 12px;
    padding: 8px;
    gap: 8px;
    margin-top: 14px;
  }
  .seprec-view-input {
    width: 100%;
    min-height: 44px;
    background: #ffffff;
    color: #0f172a;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 14.5px;
    font-weight: 600;
    box-sizing: border-box;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  }
  .seprec-view-input::placeholder {
    color: #64748b;
    font-weight: 500;
  }
  body.dark-mode .seprec-view-input {
    background: #1e293b;
    color: #f8fafc;
    border-color: #334155;
  }
  body.dark-mode .seprec-view-input::placeholder {
    color: #94a3b8;
  }
  .seprec-view-btn {
    width: 100%;
    height: 44px;
    padding: 0 16px;
    font-size: 13.5px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(13, 148, 136, 0.35);
  }
  .seprec-view-clear-btn {
    text-align: center;
    width: 100%;
    padding: 4px 0;
    font-size: 12px;
    color: #e2e8f0;
  }
  .seprec-type-chips-wrapper {
    gap: 6px;
    margin-top: 10px;
  }
  .seprec-type-chips-wrapper .seprec-chip-btn {
    font-size: 11px;
    padding: 5px 10px;
  }
  .seprec-chip-list {
    margin-top: 8px;
    gap: 6px;
  }
  .seprec-chip-list .seprec-chip-btn {
    font-size: 11px;
    padding: 4px 8px;
  }
  .seprec-company-card {
    padding: 14px;
  }
  .seprec-detail-card {
    padding: 14px;
  }
  .seprec-detail-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: 100%;
    gap: 8px;
    margin-top: 12px;
  }
  .seprec-detail-actions button {
    width: 100%;
    height: 38px;
    justify-content: center;
    font-size: 11px;
    padding: 4px 6px;
  }
  #gacetaView.active-view {
    display: block;
    padding: 12px 10px 90px 10px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    height: 100%;
  }
  #gacetaView .admin-container {
    padding: 0;
  }
  #gacetaView .admin-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
  #gacetaView .admin-header button {
    width: 100%;
  }
  .gaceta-table-wrap {
    max-height: none;
    overflow: visible;
    border: none;
    background: transparent;
  }
  .gaceta-table-wrap table {
    display: block;
    white-space: normal;
    width: 100%;
  }
  .gaceta-table-wrap thead {
    display: none;
  }
  .gaceta-table-wrap tbody {
    display: block;
    width: 100%;
  }
  .gaceta-table-wrap tr {
    display: flex;
    flex-direction: column;
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04);
    gap: 10px;
  }
  body.dark-mode .gaceta-table-wrap tr {
    background: #1e293b;
    border-color: #334155;
  }
  .gaceta-table-wrap td {
    display: block;
    padding: 0;
    border: none;
    white-space: normal;
  }
  .gaceta-num-cell {
    display: inline-block;
    background: #0284c7;
    color: #ffffff;
    font-size: 11px;
    font-weight: 800;
    padding: 4px 10px;
    border-radius: 6px;
    width: fit-content;
  }
  .gaceta-title-cell {
    font-size: 14px;
    font-weight: 700;
    color: var(--slate-900);
    line-height: 1.45;
    word-break: break-word;
  }
  body.dark-mode .gaceta-title-cell {
    color: #f1f5f9;
  }
  .gaceta-action-cell {
    margin-top: 6px;
    width: 100%;
  }
  .gaceta-action-cell a {
    width: 100%;
    justify-content: center;
    height: 44px;
    font-size: 13px;
    border-radius: 8px;
  }
  .map-coords-hud-footer {
    bottom: 68px;
    padding: 4px 10px;
    font-size: 10px;
    gap: 8px;
  }
  .coords-hud-right {
    display: none;
  }
  .mostrar-todo-selection-hud {
    top: 60px;
    padding: 4px 10px;
    font-size: 11px;
    gap: 6px;
    flex-wrap: wrap;
    justify-content: center;
  }
  .maplibregl-popup, .mapboxgl-popup {
    max-width: calc(100vw - 20px);
    width: calc(100vw - 20px);
    z-index: 100;
  }
  .maplibregl-popup-content, .mapboxgl-popup-content {
    max-width: 100%;
    width: 100%;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.5);
  }
  .earth-popup {
    min-width: 0;
    max-width: 100%;
    width: 100%;
    font-size: 10px;
  }
  .earth-popup-title-bar {
    padding: 6px 10px;
    font-size: 11.5px;
    line-height: 1.3;
  }
  .earth-popup-header {
    font-size: 10.5px;
    padding: 4px 8px;
  }
  .earth-popup-scroll {
    max-height: 55vh;
  }
  .earth-popup table {
    font-size: 10px;
  }
  .earth-popup td {
    padding: 3px 6px;
    font-size: 10px;
    line-height: 1.3;
  }
  .earth-popup td:first-child {
    width: 40%;
    font-size: 9.5px;
  }
  /* 1. Mobile Bottom Navigation Bar */
  .mobile-bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: calc(56px + env(safe-area-inset-bottom, 0px));
    padding-bottom: env(safe-area-inset-bottom, 0px);
    background: rgba(15, 23, 42, 0.96);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    z-index: 1000;
    justify-content: space-around;
    align-items: center;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.4);
  }
  .mb-nav-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: #94a3b8;
    padding: 6px 0;
    cursor: pointer;
    transition: all 0.2s ease;
    height: 100%;
    gap: 3px;
    -webkit-tap-highlight-color: transparent;
  }
  .mb-nav-btn.active {
    color: #38bdf8;
  }
  .mb-nav-btn.active .mb-nav-icon {
    transform: scale(1.15);
  }
  .mb-nav-icon {
    font-size: 19px;
    line-height: 1;
    transition: transform 0.2s;
  }
  .mb-nav-label {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.3px;
  }

  /* 2. Compact Header Bar */
  header#headerNav {
    height: 48px;
    padding: 0 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: nowrap;
  }
  header#headerNav .brand {
    font-size: 13px;
    width: auto;
    text-align: left;
    display: flex;
    align-items: center;
    gap: 8px;
  }
  header#headerNav .nav {
    display: none;
  }
  header#headerNav #userGreeting {
    display: none;
  }
  .header-back-home-btn {
    padding: 3px 8px;
    font-size: 11px;
    margin-left: 6px;
  }
  .user-display-name {
    max-width: 70px;
  }
  .user-profile-dropdown {
    width: calc(100vw - 28px);
    max-width: 290px;
    right: 0;
  }

  /* 3. Mobile Map View Full Height & Layout */
  #mapView.view {
    height: calc(100vh - 48px - 56px);
    position: relative;
    overflow: hidden;
  }
  #map {
    height: 100%;
    width: 100%;
  }

  /* 4. Floating Top Quick Search Bar */
  .mobile-map-search-bar {
    display: block;
    position: absolute;
    top: 10px;
    left: 10px;
    right: 10px;
    z-index: 35;
    pointer-events: auto;
  }
  .mobile-search-inner {
    display: flex;
    align-items: center;
    background: rgba(15, 23, 42, 0.94);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 26px;
    padding: 3px 4px 3px 12px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.5);
    gap: 6px;
    margin: 0;
  }
  .mobile-search-icon-btn {
    background: transparent;
    border: none;
    padding: 0;
    margin: 0;
    font-size: 15px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #38bdf8;
    line-height: 1;
  }
  .mobile-search-icon {
    font-size: 14px;
    color: #38bdf8;
  }
  #mobileMapSearchInput {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: #ffffff;
    font-size: 13px;
    font-weight: 600;
    padding: 6px 0;
  }
  #mobileMapSearchInput::placeholder {
    color: #94a3b8;
    font-weight: 500;
    font-size: 12px;
  }
  .mobile-search-clear-btn {
    background: transparent;
    border: none;
    color: #94a3b8;
    font-size: 13px;
    cursor: pointer;
    padding: 2px 6px;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  .mobile-search-clear-btn:hover {
    color: #ffffff;
  }
  #mobileSearchFilterBtn, .mobile-search-submit-btn {
    background: #0284c7;
    border: 1px solid rgba(255, 255, 255, 0.25);
    color: #ffffff;
    border-radius: 20px;
    padding: 6px 14px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 12px;
    font-weight: 700;
    flex-shrink: 0;
    letter-spacing: 0.3px;
    box-shadow: 0 2px 8px rgba(2, 132, 199, 0.4);
    transition: background 0.15s, transform 0.1s;
  }
  #mobileSearchFilterBtn:active, .mobile-search-submit-btn:active {
    transform: scale(0.96);
  }

  /* 5. Mobile Floating Action Dock (Right) */
  .mobile-map-dock {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: 66px;
    right: 10px;
    z-index: 35;
    gap: 7px;
    pointer-events: auto;
  }
  .dock-btn {
    background: rgba(15, 23, 42, 0.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #ffffff;
    border-radius: 12px;
    padding: 6px 4px;
    width: 44px;
    height: 46px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(0,0,0,0.4);
    transition: all 0.2s;
    gap: 2px;
    -webkit-tap-highlight-color: transparent;
  }
  .dock-btn:active {
    transform: scale(0.92);
  }
  .dock-btn.active {
    background: #0284c7;
    border-color: #38bdf8;
    box-shadow: 0 0 14px rgba(56, 189, 248, 0.6);
  }
  .dock-label {
    font-size: 8px;
    font-weight: 800;
    letter-spacing: 0.2px;
    color: #cbd5e1;
    line-height: 1;
  }

  /* 6. Mobile Map HUD & Compass Position */
  .map-hud {
    bottom: 68px;
    left: 10px;
    max-width: calc(100vw - 80px);
    flex-wrap: wrap;
    gap: 6px;
    z-index: 10;
  }
  .panel.drawer-open ~ .map-hud,
  .panel.active ~ .map-hud {
    display: none !important;
  }
  .map-zoom-badge {
    padding: 4px 10px;
    font-size: 11px;
    border-radius: 14px;
  }
  #poligonoHudSelectedCount {
    padding: 4px 10px;
    font-size: 11px;
    border-radius: 14px;
  }
  .rosa-nautica {
    display: none;
  }
  .drawer-toggle {
    display: none;
  }
  .floating-basemap-box {
    top: 56px;
    right: 8px;
    padding: 2px;
  }
  .panel.drawer-open ~ .floating-basemap-box,
  .panel.active ~ .floating-basemap-box {
    display: none !important;
  }
  .floating-basemap-btn {
    padding: 3px 7px;
    font-size: 10px;
  }

  /* 7. Mobile Polygon Designer Toolbar */
  #poligonoDesignerToolbar {
    top: 58px;
    left: 10px;
    right: 10px;
    width: auto;
    transform: none;
    border-radius: 16px;
    padding: 8px 12px;
    flex-wrap: wrap;
    gap: 8px;
  }
  #poligonoDesignerToolbar .poligono-divider {
    display: none;
  }
  #poligonoDesignerToolbar .poligono-actions-group {
    width: 100%;
    display: flex;
    justify-content: space-between;
    gap: 6px;
  }
  #btnPoligonoGuardar {
    flex: 1;
    height: 38px;
    justify-content: center;
    font-size: 12px;
  }

  /* 8. Mobile Bottom Sheet for Cell / Concession inspection */
  .mobile-bottom-sheet {
    display: flex;
    position: fixed;
    bottom: calc(56px + env(safe-area-inset-bottom, 0px));
    left: 0;
    right: 0;
    background: #ffffff;
    color: #0f172a;
    border-radius: 18px 18px 0 0;
    box-shadow: 0 -8px 30px rgba(0,0,0,0.4);
    z-index: 999;
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), max-height 0.3s ease;
    transform: translateY(115%);
    max-height: 72vh;
    overflow: hidden;
    flex-direction: column;
    border-top: 1px solid #e2e8f0;
  }
  .mobile-bottom-sheet.open {
    transform: translateY(0);
  }
  .mobile-bottom-sheet.expanded {
    max-height: 88vh;
  }
  .sheet-handle-bar {
    width: 100%;
    min-height: 0;
    background: transparent;
    border: none;
    border-radius: 0;
    padding: 8px 0 4px 0;
    display: flex;
    justify-content: center;
    cursor: pointer;
  }
  .sheet-drag-handle {
    width: 36px;
    height: 4px;
    background: #cbd5e1;
    border-radius: 2px;
  }
  .sheet-content {
    padding: 0 16px 14px 16px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
  }
  .sheet-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
  }
  .sheet-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.5px;
    margin-bottom: 3px;
  }
  .sheet-badge.franca {
    background: #dcfce7;
    color: #15803d;
    border: 1px solid #86efac;
  }
  .sheet-badge.ocupada {
    background: #fee2e2;
    color: #b91c1c;
    border: 1px solid #fca5a5;
  }
  .sheet-title {
    margin: 0;
    font-size: 14.5px;
    font-weight: 800;
    color: #0f172a;
    line-height: 1.25;
  }
  .sheet-close-btn {
    background: #f1f5f9;
    border: none;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #64748b;
    font-size: 12px;
    cursor: pointer;
  }
  .sheet-body {
    font-size: 12px;
    color: #334155;
    line-height: 1.4;
  }
  .sheet-meta-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 8px 10px;
    margin-bottom: 6px;
  }
  .sheet-meta-card-title {
    font-size: 10.5px;
    font-weight: 800;
    color: #475569;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 5px;
    display: flex;
    align-items: center;
    gap: 4px;
    border-bottom: 1px solid #e2e8f0;
    padding-bottom: 3px;
  }
  .sheet-meta-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 11.5px;
    line-height: 1.4;
  }
  .sheet-meta-table tr {
    border-bottom: 1px solid #edf2f7;
  }
  .sheet-meta-table tr:last-child {
    border-bottom: none;
  }
  .sheet-meta-table td {
    padding: 3px 4px;
    vertical-align: top;
  }
  .sheet-meta-table td.meta-label {
    color: #64748b;
    font-weight: 600;
    width: 40%;
  }
  .sheet-meta-table td.meta-val {
    color: #0f172a;
    font-weight: 700;
    word-break: break-word;
  }
  .sheet-actions {
    display: flex;
    gap: 6px;
    margin-top: 4px;
    flex-wrap: wrap;
  }
  .sheet-actions button {
    flex: 1;
    min-width: 100px;
    height: 36px;
    font-size: 11px;
    font-weight: 700;
    justify-content: center;
  }

  /* 9. Mobile Menu Drawer */
  .mobile-menu-drawer {
    display: flex;
    position: fixed;
    bottom: calc(56px + env(safe-area-inset-bottom, 0px));
    left: 0;
    right: 0;
    background: #0f172a;
    color: #ffffff;
    border-radius: 20px 20px 0 0;
    box-shadow: 0 -8px 32px rgba(0,0,0,0.55);
    z-index: 1001;
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    transform: translateY(115%);
    padding: 16px 18px 24px 18px;
    flex-direction: column;
    gap: 10px;
    border-top: 1px solid rgba(255,255,255,0.15);
  }
  .mobile-menu-drawer.open {
    transform: translateY(0);
  }
  .mobile-menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    color: #ffffff;
    font-weight: 700;
    font-size: 13.5px;
    cursor: pointer;
    text-align: left;
    width: 100%;
    -webkit-tap-highlight-color: transparent;
  }

  /* 10. Mobile Cards Layout for #tableView */
  #tableView {
    padding: 10px 10px 80px 10px;
  }
  .table-wrap {
    display: none;
  }
  .mobile-cards-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
  }
  .mobile-concession-card {
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 12px;
    padding: 12px 14px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    display: flex;
    flex-direction: column;
    gap: 6px;
  }
  .m-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
  }
  .m-card-code {
    font-family: monospace;
    font-weight: 800;
    font-size: 12px;
    color: var(--primary);
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    padding: 2px 7px;
    border-radius: 6px;
    cursor: pointer;
  }
  .m-card-type {
    font-size: 10px;
    font-weight: 700;
    color: #64748b;
    background: #f1f5f9;
    padding: 2px 6px;
    border-radius: 4px;
  }
  .m-card-title {
    font-size: 14.5px;
    font-weight: 800;
    color: #0f172a;
    line-height: 1.25;
  }
  .m-card-actor {
    font-size: 11.5px;
    color: #334155;
    font-weight: 600;
  }
  .m-card-location {
    font-size: 11px;
    color: #64748b;
  }
  .m-card-extension {
    font-size: 11.5px;
    color: #0f172a;
    background: #f8fafc;
    border: 1px solid #f1f5f9;
    padding: 3px 8px;
    border-radius: 6px;
  }
  .m-card-actions {
    display: flex;
    gap: 6px;
    margin-top: 4px;
  }

  /* 11. Modal Plano Catastral Mobile Stack */
  .plano-catastral-container {
    height: 100vh;
    max-height: 100vh;
    border-radius: 0;
  }
  .plano-catastral-body {
    flex-direction: column;
    overflow-y: auto;
  }
  #planoMapCanvas {
    height: 38vh;
    min-height: 240px;
    width: 100%;
  }
  .plano-catastral-sidebar {
    width: 100%;
    overflow-y: visible;
  }

  /* 12. Modal Reporte Plano Catastral Mobile Responsivo */
  .modal-reporte-plano {
    padding-bottom: calc(52px + env(safe-area-inset-bottom, 0px));
  }
  .reporte-top-bar {
    padding: 8px 10px;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }
  .reporte-top-bar-header {
    width: 100%;
  }
  .reporte-title-group {
    flex: 1;
    min-width: 0;
    gap: 8px;
  }
  .reporte-title-text {
    font-size: 11px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .reporte-sub-text {
    font-size: 9.5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .reporte-close-btn-mobile {
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #cbd5e1;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    font-size: 13px;
    cursor: pointer;
    flex-shrink: 0;
  }
  .reporte-fondo-selector {
    width: 100%;
    justify-content: space-between;
    padding: 2px 4px;
    box-sizing: border-box;
    gap: 4px;
  }
  .reporte-fondo-label {
    display: none;
  }
  .btn-txt-long {
    display: none;
  }
  .btn-txt-short {
    display: inline;
  }
  .reporte-toggle-btn {
    flex: 1;
    justify-content: center;
    padding: 5px 6px;
    font-size: 10.5px;
    gap: 4px;
  }
  .reporte-actions {
    display: none; /* En móviles se usa el dock flotante inferior */
  }
  .reporte-desk-workspace {
    padding: 10px 4px 72px 4px;
  }

  /* Dock Flotante Inferior Móvil para Acciones del Reporte */
  .reporte-mobile-dock {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: calc(52px + env(safe-area-inset-bottom, 0px));
    padding: 6px 10px env(safe-area-inset-bottom, 6px) 10px;
    background: rgba(15, 23, 42, 0.96);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-top: 1px solid rgba(255, 255, 255, 0.15);
    z-index: 100000;
    gap: 8px;
    align-items: center;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.5);
  }
  .reporte-mob-btn-pdf {
    flex: 2;
    height: 40px;
    background: linear-gradient(135deg, #10b981, #059669);
    border: none;
    border-radius: 10px;
    color: #ffffff;
    font-weight: 800;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    box-shadow: 0 2px 10px rgba(16, 185, 129, 0.4);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }
  .reporte-mob-btn-pdf:active {
    transform: scale(0.96);
  }
  .reporte-mob-btn-print {
    flex: 1.2;
    height: 40px;
    background: #0284c7;
    border: none;
    border-radius: 10px;
    color: #ffffff;
    font-weight: 700;
    font-size: 11.5px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }
  .reporte-mob-btn-print:active {
    transform: scale(0.96);
  }
  .reporte-mob-btn-edit {
    flex: 1;
    height: 40px;
    background: #334155;
    border: 1px solid #475569;
    border-radius: 10px;
    color: #cbd5e1;
    font-weight: 700;
    font-size: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }
  .reporte-mob-btn-edit:active {
    transform: scale(0.96);
  }
}

@media (max-width: 640px) {
  .seprec-ficha-table {
    display: block;
    width: 100%;
  }
  .seprec-ficha-table tbody {
    display: block;
    width: 100%;
  }
  .seprec-ficha-table tr {
    display: flex;
    flex-direction: column;
    padding: 8px 10px;
    border-bottom: 1px solid var(--border-color);
  }
  .seprec-ficha-table td {
    display: block;
    width: 100%;
    padding: 2px 0;
    border: none;
  }
  .seprec-ficha-table td:first-child {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--slate-500);
    font-weight: 700;
    margin-bottom: 2px;
  }
  .seprec-ficha-table td:last-child {
    font-size: 13.5px;
  }
  .seprec-slideover-panel,
  .ajam-slideover-panel {
    width: 100vw;
    max-width: 100vw;
    left: 0;
    right: 0;
    top: 0;
    bottom: 0;
    padding: 12px;
    border-radius: 0;
  }
  #seprecForm,
  #ajamForm {
    flex-direction: column;
    gap: 8px;
  }
  #seprecForm input,
  #ajamForm input {
    width: 100%;
  }
  #seprecSearchBtn {
    width: 100%;
  }
  .seprec-detail-grid {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  #seprecDetailView {
    padding: 10px;
  }
  .seprec-detail-card {
    padding: 12px;
  }
  .seprec-detail-table tr {
    display: flex;
    flex-direction: column;
    border-bottom: 1px solid var(--border-color);
    padding: 8px 0;
  }
  .seprec-detail-table td {
    width: 100%;
    padding: 2px 0;
    border: none;
  }
  .seprec-detail-table td:first-child {
    font-weight: 700;
    color: var(--slate-600);
    font-size: 12px;
  }

  /* Report Preview Modal Responsive */
  #reportPreviewModal .report-preview-card {
    width: calc(100vw - 14px);
    padding: 14px;
    max-height: 94vh;
  }
  .report-preview-header {
    align-items: flex-start;
  }
  .report-preview-actions {
    width: 100%;
    justify-content: flex-start;
  }
  .report-modo-group {
    flex: 1 1 auto;
    flex-wrap: wrap;
  }
  .report-scale-select {
    flex: 1 1 140px;
  }
  .report-accum-ficha-grid,
  .report-accum-sheet.is-vertical .report-accum-ficha-grid {
    grid-template-columns: 1fr;
    gap: 4px;
  }
  .report-accum-ticks-y {
    width: 54px;
  }
  .report-accum-ticks-x-inner {
    margin: 0 54px;
  }
  .report-accum-tick-x,
  .report-accum-tick-y {
    font-size: 8px;
  }
  #reportAccumMapWrap {
    aspect-ratio: 4 / 3;
    min-height: 280px;
    max-height: 390px;
  }
  .report-accum-sheet.is-vertical #reportAccumMapWrap {
    aspect-ratio: 39 / 50;
    min-height: 350px;
    max-height: 480px;
  }
}
