/* Estilos del layout principal del Visor3D.
   Separados de index.html para mantener el HTML liviano sin cambiar selectores ni lógica. */

@media (max-width: 1100px), (pointer: coarse) and (max-width: 1400px) {
      .view-cube {
        width: 64px !important;
        height: 64px !important;
        top: 0 !important;
        right: 0 !important;
      }
      #viewCubeCanvas {
        width: 64px !important;
        height: 64px !important;
      }

      .mobile-panel-buttons {
        position: absolute !important;
        top: 6px !important;
        left: 6px !important;
        right: auto !important;
        transform: none !important;
        justify-content: flex-start !important;
        align-items: center !important;
        gap: 4px !important;
        max-width: calc(100% - 74px) !important;
        width: auto !important;
        overflow-x: auto !important;
        overflow-y: hidden !important;
        padding: 2px !important;
        z-index: 14 !important;
        scrollbar-width: none;
      }
      .mobile-panel-buttons::-webkit-scrollbar {
        display: none;
      }
      .mobile-panel-button {
        min-height: 24px !important;
        height: 24px !important;
        min-width: 0 !important;
        padding: 0 7px !important;
        border-radius: 10px !important;
        font-size: 10px !important;
        line-height: 1 !important;
        white-space: nowrap !important;
        box-shadow: 0 4px 12px rgba(2, 6, 23, 0.22) !important;
      }
    }

    .app.clash-panel-visible {
      display: grid !important;
      grid-template-columns: var(--sidebar-width, 330px) 10px minmax(0, 1fr) 10px var(--properties-width, 360px) 10px var(--clash-width, 430px) !important;
      grid-template-rows: minmax(0, 1fr) !important;
    }
    .app.sidebar-collapsed.clash-panel-visible {
      grid-template-columns: 52px 0 minmax(0, 1fr) 10px var(--properties-width, 360px) 10px var(--clash-width, 430px) !important;
    }
    .app.clash-panel-visible > .sidebar { grid-column: 1 !important; grid-row: 1 !important; }
    .app.clash-panel-visible > #columnSplitter { grid-column: 2 !important; grid-row: 1 !important; }
    .app.clash-panel-visible > .viewer-column { grid-column: 3 !important; grid-row: 1 !important; min-width: 0 !important; }
    .app.clash-panel-visible > #propertiesSplitter { grid-column: 4 !important; grid-row: 1 !important; }
    .app.clash-panel-visible > .properties-column { grid-column: 5 !important; grid-row: 1 !important; min-width: 0 !important; }
    .app.clash-panel-visible > #clashSplitter { grid-column: 6 !important; grid-row: 1 !important; display: block !important; }
    .app.clash-panel-visible > #clashPanel {
      grid-column: 7 !important;
      grid-row: 1 !important;
      display: block !important;
      position: relative !important;
      inset: auto !important;
      width: var(--clash-width, 430px) !important;
      height: auto !important;
      min-width: 0 !important;
      max-width: var(--clash-width, 430px) !important;
      min-height: 0 !important;
      z-index: 2 !important;
      overflow: hidden !important;
    }
    .app:not(.clash-panel-visible) > #clashPanel,
    .app:not(.clash-panel-visible) > #clashSplitter { display: none !important; }

    /* Panel Obras independiente sin tocar la lógica de carga del visor. */
    .app.works-panel-visible:not(.clash-panel-visible) {
      display: grid !important;
      grid-template-columns: var(--sidebar-width, 330px) 10px minmax(0, 1fr) 10px var(--properties-width, 360px) 10px var(--works-width, 720px) !important;
      grid-template-rows: minmax(0, 1fr) !important;
    }
    .app.sidebar-collapsed.works-panel-visible:not(.clash-panel-visible) {
      grid-template-columns: 52px 0 minmax(0, 1fr) 10px var(--properties-width, 360px) 10px var(--works-width, 720px) !important;
    }
    .app.works-panel-visible:not(.clash-panel-visible) > .sidebar { grid-column: 1 !important; grid-row: 1 !important; }
    .app.works-panel-visible:not(.clash-panel-visible) > #columnSplitter { grid-column: 2 !important; grid-row: 1 !important; }
    .app.works-panel-visible:not(.clash-panel-visible) > .viewer-column { grid-column: 3 !important; grid-row: 1 !important; min-width: 0 !important; }
    .app.works-panel-visible:not(.clash-panel-visible) > #propertiesSplitter { grid-column: 4 !important; grid-row: 1 !important; }
    .app.works-panel-visible:not(.clash-panel-visible) > .properties-column { grid-column: 5 !important; grid-row: 1 !important; min-width: 0 !important; }
    .app.works-panel-visible:not(.clash-panel-visible) > #worksSplitter { grid-column: 6 !important; grid-row: 1 !important; display: block !important; }
    .app.works-panel-visible:not(.clash-panel-visible) > #worksPanel { grid-column: 7 !important; grid-row: 1 !important; display: block !important; }
    .app.clash-panel-visible.works-panel-visible {
      grid-template-columns: var(--sidebar-width, 330px) 10px minmax(0, 1fr) 10px var(--properties-width, 360px) 10px var(--clash-width, 430px) 10px var(--works-width, 720px) !important;
    }
    .app.sidebar-collapsed.clash-panel-visible.works-panel-visible {
      grid-template-columns: 52px 0 minmax(0, 1fr) 10px var(--properties-width, 360px) 10px var(--clash-width, 430px) 10px var(--works-width, 720px) !important;
    }
    .app.clash-panel-visible.works-panel-visible > #worksSplitter { grid-column: 8 !important; grid-row: 1 !important; display: block !important; }
    .app.clash-panel-visible.works-panel-visible > #worksPanel { grid-column: 9 !important; grid-row: 1 !important; display: block !important; }
    .app.works-panel-visible > #worksPanel {
      position: relative !important;
      inset: auto !important;
      width: var(--works-width, 720px) !important;
      max-width: var(--works-width, 720px) !important;
      height: auto !important;
      min-width: 0 !important;
      min-height: 0 !important;
      z-index: 2 !important;
      overflow: hidden !important;
    }
    .app:not(.works-panel-visible) > #worksPanel,
    .app:not(.works-panel-visible) > #worksSplitter { display: none !important; }
    .works-splitter {
      cursor: col-resize !important;
      pointer-events: auto !important;
      touch-action: none;
      z-index: 12;
      background: rgba(51,65,85,0.85);
    }
    .works-splitter.dragging { background: #38bdf8; }
    .works-column {
      min-width: 0;
      min-height: 0;
      background: #0f172a;
      color: #f8fafc;
      display: none;
      overflow: hidden;
    }
    .works-panel {
      height: 100%;
      border-radius: 0;
      border: 0 !important;
      box-shadow: none !important;
      background: #0f172a;
      color: #f8fafc;
      display: flex;
      flex-direction: column;
      gap: 10px;
      overflow: hidden;
      padding: 10px;
      min-height: 0;
    }
    .works-placeholder {
      border: 1px solid rgba(255,255,255,0.10);
      border-radius: 10px;
      background: rgba(30,41,59,0.82);
      padding: 12px;
      color: #cbd5e1;
      font-size: 13px;
      line-height: 1.45;
    }
    .works-section {
      border: 1px solid rgba(148,163,184,0.28);
      border-radius: 10px;
      background: rgba(15,23,42,0.88);
      overflow: hidden;
      flex: 0 0 auto;
      min-height: 0;
      display: flex;
      flex-direction: column;
    }
    .works-section:not(.collapsed) {
      flex: 1 1 auto;
      min-height: 0;
    }
    .works-section.collapsed {
      flex: 0 0 auto;
    }
    .works-section-toggle {
      width: 100%;
      height: 34px;
      border: 0;
      border-bottom: 1px solid rgba(148,163,184,0.24);
      background: rgba(30,41,59,0.95);
      color: #f8fafc;
      font-weight: 800;
      font-size: 13px;
      display: flex;
      align-items: center;
      gap: 6px;
      padding: 0 10px;
      cursor: pointer;
      text-align: left;
    }
    .works-section-toggle:hover { background: rgba(51,65,85,0.95); }
    .works-section-toggle .works-partidas-summary { margin-left: auto; }
    .works-section-caret { display: inline-block; transform: rotate(90deg); transition: transform 0.16s ease; }
    .works-section.collapsed .works-section-caret { transform: rotate(0deg); }
    .works-section.collapsed .works-section-body { display: none; }
    .works-section.collapsed .works-section-toggle { border-bottom: 0; }
    .works-section-body {
      padding: 10px;
      overflow-x: auto;
      overflow-y: visible;
      min-width: 0;
      box-sizing: border-box;
    }
    .works-section:not(.collapsed) > .works-section-body {
      flex: 1 1 auto;
      min-height: 0;
      overflow: hidden;
    }
    #worksConfigSection:not(.collapsed) > .works-section-body {
      display: flex;
      flex-direction: column;
      min-height: 0;
      overflow-y: auto;
    }
    #worksConfigSection:not(.collapsed) .works-config-grid {
      flex: 0 0 auto;
    }
    #worksPartidasSection:not(.collapsed) > .works-section-body {
      display: flex;
      flex-direction: column;
      min-height: 0;
      overflow: hidden;
    }
    #worksPartidasSection:not(.collapsed) .works-partidas-panel {
      flex: 1 1 auto;
      min-height: 0;
      display: flex;
      flex-direction: column;
    }
    #worksPartidasSection:not(.collapsed) .works-partidas-table-wrap {
      flex: 1 1 auto;
      max-height: none;
      min-height: 0;
    }
    .works-config-grid {
      display: grid;
      grid-template-columns: minmax(360px, 65fr) minmax(220px, 35fr);
      gap: 10px;
      align-items: start;
      min-width: 620px;
      width: max(100%, 620px);
    }
    .works-config-left,
    .works-config-right {
      min-width: 0;
      display: flex;
      flex-direction: column;
      gap: 8px;
      overflow: hidden;
      align-self: start;
    }
    .works-field-block {
      display: grid;
      /* Textos mas pegados al listbox: se reduce la columna de etiqueta. */
      grid-template-columns: 108px minmax(210px, 1fr);
      gap: 4px;
      align-items: start;
      min-width: 330px;
    }
    .works-field-label {
      display: flex;
      flex-direction: column;
      gap: 4px;
      min-width: 0;
      color: #bfdbfe;
      font-size: 12px;
      font-weight: 700;
    }
    .works-input {
      min-width: 0;
      width: 100%;
      height: 30px;
      border-radius: 6px;
      border: 1px solid rgba(148,163,184,0.42);
      background: #0f172a;
      color: #e5f2ff;
      padding: 0 8px;
      font-size: 12px;
      outline: none;
    }
    .works-input:focus { border-color: #38bdf8; box-shadow: 0 0 0 1px rgba(56,189,248,0.25); }
    .works-assigned-list {
      position: relative;
      min-width: 0;
      height: 92px;
      max-height: 92px;
      overflow-y: auto;
      border: 1px solid rgba(148,163,184,0.32);
      border-radius: 6px;
      background: rgba(2,6,23,0.45);
      padding: 4px;
      display: flex;
      flex-direction: column;
      gap: 4px;
    }
    .works-assigned-list.works-single-list {
      height: 38px;
      max-height: 38px;
      overflow-y: hidden;
    }
    .works-assigned-list.active { border-color: #38bdf8; box-shadow: 0 0 0 1px rgba(56,189,248,0.25); }
    .works-assigned-list.relation-warning {
      border-color: rgba(245,158,11,0.88);
      box-shadow: 0 0 0 1px rgba(245,158,11,0.22);
    }
    .works-assigned-list.relation-warning::after {
      content: "⚠";
      position: absolute;
      top: 3px;
      right: 6px;
      z-index: 3;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      width: 18px;
      height: 18px;
      border-radius: 50%;
      background: rgba(245,158,11,0.95);
      color: #111827;
      font-size: 12px;
      font-weight: 900;
      pointer-events: none;
    }
    .works-assigned-empty {
      color: #94a3b8;
      font-size: 11px;
      padding: 5px;
    }
    .works-assigned-item {
      display: grid;
      grid-template-columns: minmax(0, 1fr) 22px;
      gap: 4px;
      align-items: center;
      border-radius: 5px;
      background: rgba(30,41,59,0.95);
      border: 1px solid rgba(148,163,184,0.22);
      color: #f8fafc;
      min-height: 24px;
      padding-left: 7px;
      font-size: 12px;
    }
    .works-assigned-name {
      overflow: hidden;
      white-space: nowrap;
      text-overflow: ellipsis;
    }
    .works-remove-button {
      width: 22px;
      height: 22px;
      border: 0;
      border-left: 1px solid rgba(255,255,255,0.08);
      border-radius: 0 4px 4px 0;
      background: rgba(127,29,29,0.75);
      color: #fecaca;
      cursor: pointer;
      font-weight: 900;
      line-height: 1;
    }
    .works-remove-button:hover { background: #dc2626; color: #fff; }
    .works-parameter-search { margin-bottom: 6px; }
    .works-parameter-list {
      /* La lista de parámetros no debe crecer hasta ocupar todo el bloque.
         Debe mantenerse a una altura prudente, similar a la zona de configuración
         de partidas, y usar scroll interno cuando existan más parámetros. */
      flex: 0 0 auto;
      height: 360px;
      max-height: 360px;
      min-height: 160px;
      overflow-y: auto;
      border: 1px solid rgba(148,163,184,0.32);
      border-radius: 6px;
      background: rgba(2,6,23,0.45);
      padding: 4px;
    }
    .works-parameter-item {
      padding: 6px 7px;
      border-radius: 5px;
      color: #e2e8f0;
      font-size: 12px;
      cursor: pointer;
      overflow: hidden;
      white-space: nowrap;
      text-overflow: ellipsis;
    }
    .works-parameter-item:hover { background: rgba(14,165,233,0.26); color: #fff; }
    .works-config-help {
      color: #93c5fd;
      font-size: 11px;
      line-height: 1.35;
      margin-top: 4px;
    }
    .works-relation-status {
      margin-top: 2px;
      min-width: 320px;
      border-radius: 6px;
      padding: 7px 8px;
      background: rgba(15,23,42,0.82);
      border: 1px solid rgba(148,163,184,0.22);
      color: #cbd5e1;
      font-size: 12px;
      line-height: 1.35;
    }
    .works-relation-status.warning {
      border-color: rgba(245,158,11,0.75);
      color: #fde68a;
      background: rgba(120,53,15,0.32);
    }
    .works-relation-status.ok {
      border-color: rgba(34,197,94,0.52);
      color: #bbf7d0;
      background: rgba(20,83,45,0.25);
    }

    .works-summary-panel {
      margin-top: 10px;
      display: flex;
      flex-direction: column;
      gap: 10px;
      min-width: 620px;
      width: max(100%, 620px);
    }
    .works-summary-cards {
      display: grid;
      grid-template-columns: repeat(3, minmax(150px, 1fr));
      gap: 8px;
    }
    .works-summary-card {
      border: 1px solid rgba(148,163,184,0.26);
      border-radius: 8px;
      background: rgba(15,23,42,0.72);
      padding: 9px;
      min-width: 0;
    }
    .works-summary-card-title {
      color: #bfdbfe;
      font-size: 11px;
      font-weight: 800;
      margin-bottom: 5px;
      overflow: hidden;
      white-space: nowrap;
      text-overflow: ellipsis;
    }
    .works-summary-card-value {
      color: #f8fafc;
      font-size: 20px;
      font-weight: 900;
      line-height: 1.1;
    }
    .works-summary-card-detail {
      margin-top: 4px;
      color: #94a3b8;
      font-size: 11px;
      line-height: 1.25;
    }
    .works-summary-progress {
      width: 100%;
      height: 7px;
      margin-top: 7px;
      border-radius: 999px;
      background: rgba(51,65,85,0.88);
      overflow: hidden;
    }
    .works-summary-progress-fill {
      height: 100%;
      width: 0%;
      border-radius: 999px;
      background: #22c55e;
    }
    .works-summary-progress-fill.warning { background: #f97316; }
    .works-summary-progress-fill.danger { background: #ef4444; }
    .works-summary-table-wrap {
      max-height: 300px;
      overflow: auto;
      border: 1px solid rgba(148,163,184,0.24);
      border-radius: 8px;
      background: rgba(2,6,23,0.28);
    }
    .works-summary-table {
      width: 100%;
      min-width: 760px;
      border-collapse: collapse;
      table-layout: fixed;
      color: #e5e7eb;
      font-size: 12px;
    }
    .works-summary-table th {
      position: sticky;
      top: 0;
      z-index: 2;
      background: #1e293b;
      color: #bfdbfe;
      height: 28px;
      padding: 5px 7px;
      border-bottom: 1px solid rgba(148,163,184,0.26);
      text-align: left;
      white-space: nowrap;
    }
    .works-summary-table td {
      padding: 6px 7px;
      border-bottom: 1px solid rgba(148,163,184,0.14);
      overflow: hidden;
      white-space: nowrap;
      text-overflow: ellipsis;
      vertical-align: middle;
    }
    .works-summary-table th:nth-child(1),
    .works-summary-table td:nth-child(1) { width: 125px; }
    .works-summary-table th:nth-child(2),
    .works-summary-table td:nth-child(2) { width: auto; min-width: 220px; }
    .works-summary-table th:nth-child(3),
    .works-summary-table td:nth-child(3),
    .works-summary-table th:nth-child(4),
    .works-summary-table td:nth-child(4),
    .works-summary-table th:nth-child(5),
    .works-summary-table td:nth-child(5),
    .works-summary-table th:nth-child(6),
    .works-summary-table td:nth-child(6) { width: 82px; text-align: right; }
    .works-summary-table th:nth-child(7),
    .works-summary-table td:nth-child(7) { width: 88px; text-align: center; }
    .works-summary-status {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      min-width: 72px;
      height: 22px;
      border-radius: 999px;
      color: #fff;
      font-size: 11px;
      font-weight: 800;
      padding: 0 8px;
    }
    .works-summary-status.done { background: #16a34a; }
    .works-summary-status.progress { background: #f97316; }
    .works-summary-status.pending { background: #64748b; }
    .works-summary-empty {
      color: #94a3b8;
      font-size: 12px;
      padding: 10px;
      border: 1px dashed rgba(148,163,184,0.32);
      border-radius: 8px;
      background: rgba(15,23,42,0.42);
    }
    @media (max-width: 720px) {
      .works-summary-panel { min-width: 0; width: 100%; }
      .works-summary-cards { grid-template-columns: 1fr; }
      .works-summary-table { min-width: 700px; }
    }

    .works-partidas-panel {
      margin-top: 10px;
      width: 100%;
      min-width: 0;
      box-sizing: border-box;
      border: 1px solid rgba(148,163,184,0.28);
      border-radius: 8px;
      background: rgba(2,6,23,0.30);
      overflow: hidden;
    }
    #worksPartidasSection .works-partidas-panel {
      margin-top: 0;
    }
    .works-measurement-rules-panel {
      margin-top: 10px;
      width: 100%;
      min-width: 0;
      box-sizing: border-box;
      border: 1px solid rgba(148,163,184,0.28);
      border-radius: 8px;
      background: rgba(2,6,23,0.30);
      overflow: hidden;
    }
    .works-rule-header {
      min-height: 32px;
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 10px;
      padding: 7px 9px;
      border-bottom: 1px solid rgba(148,163,184,0.22);
      background: rgba(30,41,59,0.72);
      color: #f8fafc;
      font-size: 12px;
      font-weight: 800;
    }
    .works-rule-toggle {
      display: inline-flex;
      align-items: center;
      gap: 6px;
      color: #cbd5e1;
      font-size: 11px;
      font-weight: 700;
      white-space: nowrap;
      cursor: pointer;
    }
    .works-rule-toggle input {
      width: 14px;
      height: 14px;
      accent-color: #38bdf8;
    }
    .works-rule-fields {
      display: grid;
      grid-template-columns: repeat(3, minmax(0, 1fr));
      gap: 8px;
      padding: 9px;
      border-bottom: 1px solid rgba(148,163,184,0.18);
      background: rgba(15,23,42,0.36);
    }
    .works-rule-field {
      display: grid;
      gap: 5px;
      min-width: 0;
      color: #cbd5e1;
      font-size: 11px;
      font-weight: 700;
    }
    .works-rule-select {
      width: 100%;
      min-width: 0;
    }
    .works-steel-coeff-scroll {
      width: 100%;
      max-height: clamp(180px, 32vh, 320px);
      overflow-y: auto;
      overflow-x: hidden;
      overscroll-behavior: contain;
      scrollbar-gutter: stable;
      -webkit-overflow-scrolling: touch;
    }
    .works-steel-coeff-table {
      width: 100%;
      border-collapse: collapse;
      table-layout: fixed;
      color: #e5e7eb;
      font-size: 11px;
    }
    .works-steel-coeff-table th,
    .works-steel-coeff-table td {
      padding: 6px 8px;
      border-bottom: 1px solid rgba(148,163,184,0.16);
      text-align: left;
      vertical-align: middle;
    }
    .works-steel-coeff-table th {
      position: sticky;
      top: 0;
      z-index: 1;
      color: #bfdbfe;
      background: rgba(15,23,42,0.98);
      font-weight: 800;
    }
    .works-coeff-input {
      width: 100%;
      min-width: 0;
      height: 26px;
      font-size: 11px;
    }
    .works-partidas-toolbar {
      min-height: 32px;
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 8px;
      padding: 7px 9px;
      border-bottom: 1px solid rgba(148,163,184,0.22);
      background: rgba(30,41,59,0.72);
      color: #f8fafc;
      font-size: 12px;
      font-weight: 800;
    }
    .works-partidas-summary {
      color: #cbd5e1;
      font-size: 11px;
      font-weight: 700;
      text-align: right;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }
    .works-partidas-search-row {
      display: flex;
      align-items: center;
      gap: 6px;
      padding: 7px 9px;
      border-bottom: 1px solid rgba(148,163,184,0.18);
      background: rgba(15,23,42,0.42);
      min-width: 0;
    }
    .works-partidas-search-icon {
      flex: 0 0 auto;
      color: #94a3b8;
      font-size: 15px;
      line-height: 1;
      font-weight: 800;
    }
    .works-partidas-search-input {
      flex: 1 1 auto;
      min-width: 0;
      height: 28px;
      border: 1px solid rgba(148,163,184,0.28);
      border-radius: 6px;
      background: rgba(15,23,42,0.92);
      color: #e5e7eb;
      padding: 0 9px;
      font-size: 12px;
      outline: none;
    }
    .works-partidas-search-input:focus {
      border-color: #38bdf8;
      box-shadow: 0 0 0 1px rgba(56,189,248,0.25);
    }
    .works-partidas-table-wrap {
      width: 100%;
      max-height: 372px;
      overflow: auto;
      min-width: 0;
      box-sizing: border-box;
    }
    .works-partidas-table {
      width: 100%;
      min-width: 760px;
      table-layout: fixed;
      border-collapse: collapse;
      color: #e5e7eb;
      font-size: 12px;
    }
    .works-partidas-table th {
      position: sticky;
      top: 0;
      z-index: 2;
      background: #1e293b;
      color: #bfdbfe;
      text-align: left;
      padding: 7px 8px;
      border-bottom: 1px solid rgba(148,163,184,0.34);
      white-space: nowrap;
    }
    .works-partidas-table td {
      padding: 6px 8px;
      border-bottom: 1px solid rgba(148,163,184,0.16);
      vertical-align: middle;
    }
    .works-partidas-table th:nth-child(1),
    .works-partidas-table td:nth-child(1) { width: 240px; }
    .works-partidas-table th:nth-child(2),
    .works-partidas-table td:nth-child(2) { width: auto; min-width: 210px; }
    .works-partidas-table th:nth-child(3),
    .works-partidas-table td:nth-child(3) { width: 70px; text-align: center; }
    .works-partidas-table th:nth-child(4),
    .works-partidas-table td:nth-child(4) { width: 105px; text-align: right; }
    .works-partidas-table th:nth-child(5),
    .works-partidas-table td:nth-child(5) { width: 56px; text-align: center; }
    .works-partidas-table tr:hover td {
      background: rgba(14,165,233,0.10);
    }
    .works-partida-code-cell {
      display: flex;
      align-items: center;
      gap: 4px;
      min-width: max-content;
      white-space: nowrap;
      overflow: visible;
    }
    .works-partida-indent {
      flex: 0 0 auto;
      width: calc(var(--works-level, 0) * 14px);
    }
    .works-partida-toggle {
      width: 18px;
      height: 18px;
      border: 0;
      border-radius: 4px;
      background: rgba(51,65,85,0.95);
      color: #dbeafe;
      cursor: pointer;
      display: grid;
      place-items: center;
      font-size: 10px;
      line-height: 1;
      padding: 0;
    }
    .works-partida-toggle:hover { background: #0ea5e9; color: #fff; }
    .works-partida-toggle.placeholder {
      visibility: hidden;
      pointer-events: none;
    }
    .works-partida-code-text {
      flex: 0 0 auto;
      min-width: max-content;
      overflow: visible;
      text-overflow: clip;
      white-space: nowrap;
      font-weight: 800;
      color: #f8fafc;
    }
    .works-partida-parent td {
      background: rgba(15,23,42,0.48);
      font-weight: 700;
    }
    .works-partida-quantity {
      text-align: right;
      font-variant-numeric: tabular-nums;
      white-space: nowrap;
    }
    .works-partida-group-row td,
    .works-partida-group-row .works-partida-code-text {
      color: #94a3b8;
    }
    .works-partida-group-row td {
      background: rgba(15,23,42,0.34);
    }
    .works-partida-unassigned td,
    .works-partida-unassigned .works-partida-code-text {
      color: #fde68a;
      font-style: italic;
    }
    .works-partidas-table tr.selected td {
      background: rgba(14,165,233,0.20) !important;
      box-shadow: inset 3px 0 0 #38bdf8;
    }
    .works-partida-report-cell {
      text-align: center;
      width: 52px;
    }
    .works-partida-report-check {
      width: 15px;
      height: 15px;
      cursor: pointer;
      accent-color: #0ea5e9;
    }
    .works-partida-report-check:disabled {
      cursor: default;
      opacity: 0.35;
    }

    .works-partidas-empty {
      color: #94a3b8;
      font-size: 12px;
      padding: 12px;
      line-height: 1.45;
    }
    @media (max-width: 900px) {
      .works-config-grid {
        grid-template-columns: minmax(0, 1fr);
        min-width: 0;
        width: 100%;
      }
      .works-field-block {
        grid-template-columns: minmax(0, 1fr);
        min-width: 0;
      }
      .works-relation-status,
  
    .works-summary-panel {
      margin-top: 10px;
      display: flex;
      flex-direction: column;
      gap: 10px;
      min-width: 620px;
      width: max(100%, 620px);
    }
    .works-summary-cards {
      display: grid;
      grid-template-columns: repeat(3, minmax(150px, 1fr));
      gap: 8px;
    }
    .works-summary-card {
      border: 1px solid rgba(148,163,184,0.26);
      border-radius: 8px;
      background: rgba(15,23,42,0.72);
      padding: 9px;
      min-width: 0;
    }
    .works-summary-card-title {
      color: #bfdbfe;
      font-size: 11px;
      font-weight: 800;
      margin-bottom: 5px;
      overflow: hidden;
      white-space: nowrap;
      text-overflow: ellipsis;
    }
    .works-summary-card-value {
      color: #f8fafc;
      font-size: 20px;
      font-weight: 900;
      line-height: 1.1;
    }
    .works-summary-card-detail {
      margin-top: 4px;
      color: #94a3b8;
      font-size: 11px;
      line-height: 1.25;
    }
    .works-summary-progress {
      width: 100%;
      height: 7px;
      margin-top: 7px;
      border-radius: 999px;
      background: rgba(51,65,85,0.88);
      overflow: hidden;
    }
    .works-summary-progress-fill {
      height: 100%;
      width: 0%;
      border-radius: 999px;
      background: #22c55e;
    }
    .works-summary-progress-fill.warning { background: #f97316; }
    .works-summary-progress-fill.danger { background: #ef4444; }
    .works-summary-table-wrap {
      max-height: 300px;
      overflow: auto;
      border: 1px solid rgba(148,163,184,0.24);
      border-radius: 8px;
      background: rgba(2,6,23,0.28);
    }
    .works-summary-table {
      width: 100%;
      min-width: 760px;
      border-collapse: collapse;
      table-layout: fixed;
      color: #e5e7eb;
      font-size: 12px;
    }
    .works-summary-table th {
      position: sticky;
      top: 0;
      z-index: 2;
      background: #1e293b;
      color: #bfdbfe;
      height: 28px;
      padding: 5px 7px;
      border-bottom: 1px solid rgba(148,163,184,0.26);
      text-align: left;
      white-space: nowrap;
    }
    .works-summary-table td {
      padding: 6px 7px;
      border-bottom: 1px solid rgba(148,163,184,0.14);
      overflow: hidden;
      white-space: nowrap;
      text-overflow: ellipsis;
      vertical-align: middle;
    }
    .works-summary-table th:nth-child(1),
    .works-summary-table td:nth-child(1) { width: 125px; }
    .works-summary-table th:nth-child(2),
    .works-summary-table td:nth-child(2) { width: auto; min-width: 220px; }
    .works-summary-table th:nth-child(3),
    .works-summary-table td:nth-child(3),
    .works-summary-table th:nth-child(4),
    .works-summary-table td:nth-child(4),
    .works-summary-table th:nth-child(5),
    .works-summary-table td:nth-child(5),
    .works-summary-table th:nth-child(6),
    .works-summary-table td:nth-child(6) { width: 82px; text-align: right; }
    .works-summary-table th:nth-child(7),
    .works-summary-table td:nth-child(7) { width: 88px; text-align: center; }
    .works-summary-status {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      min-width: 72px;
      height: 22px;
      border-radius: 999px;
      color: #fff;
      font-size: 11px;
      font-weight: 800;
      padding: 0 8px;
    }
    .works-summary-status.done { background: #16a34a; }
    .works-summary-status.progress { background: #f97316; }
    .works-summary-status.pending { background: #64748b; }
    .works-summary-empty {
      color: #94a3b8;
      font-size: 12px;
      padding: 10px;
      border: 1px dashed rgba(148,163,184,0.32);
      border-radius: 8px;
      background: rgba(15,23,42,0.42);
    }
    @media (max-width: 720px) {
      .works-summary-panel { min-width: 0; width: 100%; }
      .works-summary-cards { grid-template-columns: 1fr; }
      .works-summary-table { min-width: 700px; }
    }

    .works-partidas-panel { min-width: 0; }
      .works-parameter-list { height: 260px; max-height: 260px; min-height: 160px; }
    }

    .clash-column {
      min-width: 0;
      min-height: 0;
      background: #0f172a;
      color: #f8fafc;
      display: none;
      overflow: hidden;
    }
    .clash-column.hidden,
    .clash-splitter.hidden { display: none !important; }
    .clash-splitter {
      cursor: col-resize !important;
      pointer-events: auto !important;
      touch-action: none;
      z-index: 12;
      background: rgba(51,65,85,0.85);
    }
    .clash-splitter.dragging { background: #38bdf8; }
    .clash-panel {
      height: 100%;
      border-radius: 0;
      border: 0 !important;
      box-shadow: none !important;
      background: #0f172a;
      color: #f8fafc;
      display: flex;
      flex-direction: column;
      align-items: stretch;
      gap: 8px;
      overflow: hidden;
      padding: 10px;
    }
    .clash-panel * { min-width: 0; box-sizing: border-box; }
    .clash-panel,
    .clash-section,
    .clash-section-body,
    .clash-groups,
    .clash-group,
    .clash-controls,
    .clash-row {
      max-width: 100%;
      min-width: 0;
    }
    .clash-row {
      min-height: 0;
      overflow: hidden;
      border: 1px solid rgba(255,255,255,0.10);
      background: rgba(15,23,42,0.86);
      border-radius: 9px;
      padding: 8px;
      display: grid;
      gap: 8px;
    }
    .clash-row h2,
    .clash-row h3 {
      margin: 0;
      font-size: 13px;
      color: #e0f2fe;
    }
    .clash-config-row {
      grid-template-rows: minmax(0, 1fr) auto;
      align-content: stretch;
    }
    .clash-groups {
      min-height: 0;
      height: 100%;
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 8px;
    }
    .clash-group {
      min-width: 0;
      min-height: 0;
      display: grid;
      grid-template-rows: auto auto minmax(120px, 185px) minmax(0, 1fr);
      gap: 6px;
      align-content: stretch;
    }
    .clash-project-search {
      width: 100%;
      min-width: 0;
    }
    .clash-tree {
      min-height: 0;
      overflow: auto;
      max-height: 185px;
      border-radius: 7px;
      background: rgba(255,255,255,0.06);
      padding: 5px;
    }
    .clash-tree-row {
      display: grid;
      grid-template-columns: 18px auto 1fr auto;
      align-items: center;
      gap: 6px;
      padding: 5px 6px;
      border-radius: 7px;
      font-size: 12px;
      color: #e5e7eb;
    }
    .clash-tree-row.parent { font-weight: 700; background: rgba(255,255,255,0.08); }
    .clash-tree-row:hover { background: rgba(14,165,233,0.18); }
    .clash-tree-name {
      min-width: 0;
      overflow: hidden;
      white-space: nowrap;
      text-overflow: ellipsis;
    }
    .clash-group-filters {
      display: grid;
      gap: 6px;
      align-content: start;
    }
    .clash-group-filters h4 {
      margin: 0;
      font-size: 12px;
      color: #e0f2fe;
    }
    .clash-group-filter-controls {
      display: grid;
      grid-template-columns: 18px minmax(0, 1fr) auto;
      align-items: center;
      gap: 5px;
    }
    .clash-filter-icon {
      width: 18px;
      text-align: center;
      color: #7dd3fc;
      font-size: 12px;
      font-weight: 700;
    }
    .clash-group-filter-controls input {
      min-width: 0;
      height: 28px;
      border-radius: 7px;
      border: 1px solid rgba(255,255,255,0.16);
      background: #1e293b;
      color: #f8fafc;
      padding: 0 8px;
      outline: none;
    }
    .clash-group-filter-controls .small-button {
      min-width: 108px;
      height: 28px;
      padding: 0 10px;
      font-size: 12px;
    }
    .clash-group-filters-list {
      min-height: 64px;
      max-height: 116px;
      overflow: auto;
      border-radius: 7px;
      border: 1px solid rgba(255,255,255,0.10);
      background: rgba(2,6,23,0.38);
      padding: 5px;
      display: grid;
      align-content: start;
      gap: 4px;
    }
    .clash-filter-chip {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 6px;
      border: 1px solid rgba(56,189,248,0.30);
      background: rgba(14,165,233,0.12);
      color: #e0f2fe;
      border-radius: 7px;
      padding: 4px 6px;
      font-size: 11px;
      font-weight: 700;
    }
    .clash-filter-chip span {
      min-width: 0;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }
    .clash-filter-remove {
      width: 18px;
      height: 18px;
      border: 0;
      border-radius: 50%;
      background: rgba(239,68,68,0.90);
      color: #ffffff;
      cursor: pointer;
      line-height: 1;
      font-size: 12px;
      font-weight: 800;
    }
    .clash-controls {
      display: grid;
      grid-template-columns: minmax(80px, 0.8fr) minmax(120px, 1fr) auto;
      gap: 6px;
      align-items: end;
      margin-top: 4px;
    }
    .clash-field {
      display: grid;
      gap: 3px;
      font-size: 11px;
      color: #94a3b8;
    }
    .clash-field input {
      width: 100%;
      height: 30px;
      border: 1px solid rgba(255,255,255,0.16);
      border-radius: 7px;
      background: #1e293b;
      color: #f8fafc;
      padding: 0 8px;
      outline: none;
    }
    .clash-list {
      min-height: 0;
      overflow: auto;
      display: grid;
      align-content: start;
      gap: 5px;
    }
    .clash-item {
      border: 1px solid rgba(255,255,255,0.09);
      background: rgba(255,255,255,0.06);
      color: #e5e7eb;
      border-radius: 8px;
      padding: 7px 8px;
      font-size: 12px;
      cursor: pointer;
    }
    .clash-item:hover,
    .clash-item.active {
      border-color: #38bdf8;
      background: rgba(14,165,233,0.20);
    }
    .clash-item strong { display: block; color: #ffffff; margin-bottom: 2px; }
    .clash-item small { color: #94a3b8; }
    .clash-empty { color: #94a3b8; font-size: 12px; padding: 8px; }
    .clash-header-line {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 8px;
    }
    .clash-section {
      flex: 0 0 auto;
      min-height: 0;
      display: flex;
      flex-direction: column;
      overflow: hidden;
      border: 1px solid rgba(255,255,255,0.10);
      background: rgba(15,23,42,0.86);
      border-radius: 9px;
    }
    .clash-section:not(.collapsed) {
      flex: 1 1 0;
      min-height: 0;
    }
    #clashElementsSection:not(.collapsed) {
      flex: 1.15 1 0;
      min-height: 300px;
    }
    #clashInterferencesSection:not(.collapsed) {
      flex: 1 1 0;
      min-height: 260px;
    }
    .clash-panel.clash-interferences-collapsed #clashElementsSection:not(.collapsed),
    .clash-panel.clash-elements-collapsed #clashInterferencesSection:not(.collapsed) {
      flex: 1 1 auto;
      min-height: 0;
    }
    .clash-section.collapsed {
      flex: 0 0 auto;
    }
    .clash-section.collapsed .clash-section-body {
      display: none !important;
    }
    .clash-section-toggle {
      width: 100%;
      border: 0;
      border-bottom: 1px solid rgba(255,255,255,0.10);
      background: rgba(30,41,59,0.92);
      color: #e0f2fe;
      padding: 8px 10px;
      display: flex;
      align-items: center;
      justify-content: flex-start;
      gap: 8px;
      cursor: pointer;
      font-size: 13px;
      font-weight: 700;
      text-align: left;
    }
    .clash-section-toggle:hover { background: rgba(14,165,233,0.18); }
    .clash-section.collapsed .clash-section-toggle { border-bottom: 0; }
    .clash-panel.clash-elements-collapsed,
    .clash-panel.clash-interferences-collapsed { align-items: stretch; }
    .clash-section-title {
      min-width: 0;
      display: flex;
      align-items: center;
      gap: 7px;
      overflow: hidden;
      white-space: nowrap;
      text-overflow: ellipsis;
    }
    .clash-section-title small { color: #bae6fd; font-weight: 700; }
    .clash-section-caret {
      font-size: 12px;
      color: #ffffff;
      transition: transform 0.16s ease;
      transform: rotate(90deg);
    }
    .clash-section.collapsed .clash-section-caret { transform: rotate(0deg); }
    .clash-section-body {
      min-height: 0;
      padding: 8px;
      display: grid;
      gap: 8px;
      overflow: auto;
      align-content: start;
    }
    .clash-section:not(.collapsed) > .clash-section-body {
      flex: 1 1 auto;
      min-height: 0;
      overflow: hidden;
      align-content: stretch;
    }
    #clashElementsSection:not(.collapsed) .clash-section-body {
      overflow: hidden;
    }
    #clashElementsSection:not(.collapsed) .clash-config-row {
      grid-template-rows: minmax(0, 1fr) auto;
      align-content: stretch;
    }
    #clashElementsSection:not(.collapsed) .clash-groups {
      min-height: 0;
      height: 100%;
    }
    #clashElementsSection:not(.collapsed) .clash-group {
      grid-template-rows: auto auto minmax(150px, 1fr) auto;
      min-height: 0;
    }
    #clashElementsSection:not(.collapsed) .clash-tree {
      height: 100%;
      max-height: none;
      min-height: 150px;
    }
    #clashElementsSection:not(.collapsed) .clash-group-mode-section {
      flex: 0 0 auto;
      height: auto;
      max-height: 440px;
    }
    #clashElementsSection:not(.collapsed) .clash-filter-section .gi-filter-list {
      flex: 0 0 var(--clash-filter-list-height, 217px);
      height: var(--clash-filter-list-height, 217px);
      min-height: 217px;
      max-height: 310px;
    }
    .clash-interferences-body {
      grid-template-rows: auto minmax(220px, 1fr);
      min-height: 0;
    }
    .clash-evaluations-row {
      align-self: start;
      display: grid;
      grid-template-rows: auto minmax(0, auto);
    }
    .clash-evaluations-row .clash-list {
      max-height: 255px;
      overflow-y: auto;
    }
    .clash-results-row {
      min-height: 0;
      display: grid;
      grid-template-rows: auto auto minmax(0, 1fr);
    }
    .clash-evaluation-item {
      display: grid;
      grid-template-columns: minmax(0, 1fr) 26px;
      gap: 6px;
      align-items: center;
    }
    .clash-item-main {
      min-width: 0;
      overflow: hidden;
    }
    .clash-delete-button {
      width: 28px;
      height: 28px;
      border: 1px solid rgba(248,113,113,0.5);
      background: rgba(127,29,29,0.72);
      color: #ffffff;
      border-radius: 6px;
      cursor: pointer;
      font-weight: 800;
      line-height: 1;
    }
    .clash-delete-button:hover { background: #dc2626; }

    .clash-results-titlebar {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 8px;
      min-width: 0;
    }
    .clash-results-titlebar h3 {
      min-width: 0;
      overflow: hidden;
      white-space: nowrap;
      text-overflow: ellipsis;
    }
    .clash-results-search-row {
      display: grid;
      grid-template-columns: 20px minmax(0, 1fr);
      align-items: center;
      gap: 5px;
      min-width: 0;
    }
    .clash-results-search-row .gi-search-icon {
      display: grid;
      place-items: center;
      color: #7dd3fc;
    }
    .clash-results-search-row .gi-input {
      width: 100%;
      min-width: 0;
    }
    .clash-report-actions {
      display: flex;
      align-items: center;
      justify-content: flex-end;
      gap: 5px;
      flex: 0 0 auto;
    }
    .clash-report-button {
      height: 25px;
      border: 1px solid rgba(34,197,94,0.55);
      border-radius: 6px;
      background: #16a34a;
      color: #ffffff;
      font-size: 11px;
      font-weight: 800;
      padding: 0 8px;
      cursor: pointer;
      white-space: nowrap;
    }
    .clash-report-button:hover {
      background: #15803d;
    }

    .clash-results-table {
      min-height: 0;
      display: grid;
      grid-template-rows: auto minmax(0, 1fr);
      gap: 5px;
    }
    .clash-results-head,
    .clash-result-row {
      display: grid;
      grid-template-columns: minmax(0, 1fr) 118px;
      gap: 7px;
      align-items: stretch;
    }
    .clash-results-head {
      color: #bae6fd;
      font-size: 11px;
      font-weight: 700;
      padding: 0 2px;
      align-items: center;
    }
    .clash-results-body {
      min-height: 0;
      overflow: auto;
      display: grid;
      align-content: start;
      gap: 5px;
    }
    .clash-result-main {
      min-width: 0;
      border: 1px solid rgba(255,255,255,0.09);
      background: rgba(255,255,255,0.06);
      color: #e5e7eb;
      border-radius: 8px;
      padding: 7px 8px;
      font-size: 12px;
      cursor: pointer;
      text-align: left;
    }
    .clash-result-main:hover,
    .clash-result-row.active .clash-result-main {
      border-color: #38bdf8;
      background: rgba(14,165,233,0.20);
    }
    .clash-result-main strong { display: block; color: #ffffff; margin-bottom: 2px; }
    .clash-result-main small { color: #94a3b8; }
    .clash-status-select,
    .clash-status-filter {
      width: 100%;
      border-radius: 7px;
      border: 1px solid rgba(255,255,255,0.16);
      outline: none;
      font-size: 12px;
      font-weight: 700;
      padding: 0 6px;
      color: #ffffff;
      cursor: pointer;
    }
    .clash-status-select { height: 100%; min-height: 42px; }
    .clash-status-filter { height: 28px; background: #334155; }
    .clash-status-abierto { background: #dc2626; }
    .clash-status-revisado { background: #f97316; }
    .clash-status-resuelto { background: #16a34a; }
    .clash-filter-section {
      min-height: 0;
      max-height: none;
      height: 100%;
      margin-top: 4px;
      display: flex;
      flex-direction: column;
      overflow: hidden;
    }
    .clash-filter-section .gi-section-header {
      flex: 0 0 22px;
      height: 22px;
      line-height: 22px;
      text-align: left;
    }
    .clash-filter-section .gi-filter-toolbar {
      padding: 4px;
      overflow-x: visible;
    }
    .clash-filter-toolbar-actions {
      display: flex;
      align-items: center;
      justify-content: flex-end;
      gap: 4px;
      white-space: nowrap;
    }
    .clash-filter-toolbar-actions .gi-button {
      padding-left: 7px;
      padding-right: 7px;
    }
    .clash-filter-toolbar-actions .gi-button.hidden {
      display: none !important;
    }
    .clash-filter-section .gi-filter-list {
      min-height: 32px;
      max-height: none;
      flex: 1 1 auto;
      overflow-y: auto;
    }
    .clash-filter-section,
    .clash-filter-section .gi-filter-toolbar,
    .clash-filter-section .gi-filter-list {
      min-width: 0;
      max-width: 100%;
      overflow-x: auto;
    }
    .clash-filter-section .gi-filter-list {
      overflow-y: auto;
    }
    .clash-filter-section .gi-filter-row.exclude-mode {
      grid-template-columns: 24px 42px minmax(110px, 1fr) 92px minmax(80px, 0.7fr) 24px;
      min-width: 390px;
      max-width: 100%;
    }
    .clash-filter-section .gi-filter-row.include-mode {
      grid-template-columns: 24px 42px minmax(110px, 1fr) 92px minmax(80px, 0.7fr) 24px;
      min-width: 390px;
      max-width: 100%;
    }
    .clash-filter-section .clash-filter-group-start {
      background: rgba(139, 92, 246, 0.09);
      box-shadow: inset 0 2px 0 rgba(167, 139, 250, 0.85);
    }
    .clash-filter-section .clash-filter-logic {
      width: 42px;
      font-weight: 800;
      color: #e9d5ff;
    }
    .clash-filter-section .gi-filter-drag-handle {
      width: 24px;
      min-width: 24px;
    }
    .clash-filter-section .gi-select,
    .clash-filter-section .gi-input {
      min-width: 0;
    }
    .clash-group-mode-section {
      min-width: 0;
      min-height: 0;
      margin-top: 4px;
      display: grid;
      grid-template-rows: auto minmax(0, auto);
      gap: 5px;
      overflow: hidden;
    }
    .clash-mode-row {
      display: grid;
      grid-template-columns: auto minmax(0, 1fr);
      align-items: center;
      gap: 8px;
      min-width: 0;
      color: #dbeafe;
      font-size: 11px;
      font-weight: 700;
    }
    .clash-mode-select {
      width: 100%;
      min-width: 0;
      height: 27px;
    }
    .clash-mode-panel {
      min-width: 0;
      min-height: 0;
      max-height: 218px;
    }
    .clash-filter-section.clash-mode-panel {
      height: auto;
      max-height: none;
    }
    .clash-mode-panel.hidden {
      display: none !important;
    }
    .clash-mode-title {
      cursor: default;
      padding: 0 7px;
    }
    .clash-category-panel {
      display: grid;
      grid-template-rows: auto minmax(60px, 1fr);
      gap: 4px;
      overflow: hidden;
    }
    .clash-category-search-row {
      min-width: 0;
    }
    .clash-category-search-row .gi-input {
      width: 100%;
      min-width: 0;
    }
    .clash-category-tree {
      min-width: 0;
      min-height: 60px;
      max-height: 175px;
      overflow: auto;
      border: 1px solid rgba(148, 163, 184, 0.22);
      border-radius: 5px;
      background: rgba(2, 8, 23, 0.28);
      padding: 3px;
    }
    .clash-category-tree.empty {
      display: grid;
      place-items: center;
      color: #94a3b8;
      font-size: 11px;
    }
    .clash-category-tree .tree-parent,
    .clash-category-tree .tree-child {
      display: grid;
      grid-template-columns: 18px 18px minmax(0, 1fr) auto;
      align-items: center;
      gap: 3px;
      width: 100%;
      min-width: 0;
      min-height: 25px;
      padding: 2px 4px;
      border-radius: 4px;
      color: #e2e8f0;
      font-size: 11px;
      cursor: pointer;
    }
    .clash-category-tree .tree-child {
      padding-left: 21px;
    }
    .clash-category-tree .tree-parent:hover,
    .clash-category-tree .tree-child:hover {
      background: rgba(56, 189, 248, 0.12);
    }
    .clash-category-tree .tree-name {
      min-width: 0;
      overflow: hidden;
      white-space: nowrap;
      text-overflow: ellipsis;
    }
    .clash-category-tree .tree-count {
      color: #94a3b8;
      justify-self: end;
      font-size: 10px;
    }
    .clash-category-tree .tree-expander {
      width: 18px;
      height: 18px;
      padding: 0;
      border: 0;
      background: transparent;
      color: #7dd3fc;
      cursor: pointer;
    }
    .clash-category-tree .tree-expander:disabled {
      cursor: default;
    }
    .clash-category-tree .category-root {
      background: rgba(30, 64, 175, 0.18);
      font-weight: 800;
    }
    .clash-category-tree .category-root-children {
      display: grid;
      gap: 1px;
    }
    .clash-filter-panel {
      min-height: 0;
      border-top: 1px solid rgba(255,255,255,0.10);
      padding-top: 7px;
      display: grid;
      gap: 6px;
    }
    .clash-filter-title {
      display: flex;
      align-items: center;
      justify-content: space-between;
      color: #dbeafe;
      font-size: 12px;
      font-weight: 700;
    }
    .clash-filter-form {
      display: grid;
      grid-template-columns: minmax(0, 1fr) 92px minmax(0, 1fr);
      gap: 5px;
    }
    .clash-filter-form input,
    .clash-filter-form select {
      min-width: 0;
      height: 27px;
      border: 1px solid rgba(255,255,255,0.16);
      border-radius: 6px;
      background: #1e293b;
      color: #f8fafc;
      padding: 0 7px;
      outline: none;
      font-size: 11px;
    }
    .clash-filter-add-button {
      height: 28px;
      border: 0;
      border-radius: 6px;
      background: #0b84d8;
      color: #ffffff;
      font-weight: 700;
      cursor: pointer;
      font-size: 11px;
    }
    .clash-filter-list {
      min-height: 30px;
      max-height: 105px;
      overflow: auto;
      border: 1px solid rgba(255,255,255,0.08);
      border-radius: 7px;
      background: rgba(15,23,42,0.54);
      padding: 5px;
      display: grid;
      align-content: start;
      gap: 4px;
    }
    .clash-filter-empty {
      color: #94a3b8;
      font-size: 11px;
    }
    .clash-filter-row {
      display: grid;
      grid-template-columns: minmax(0, 1fr) 22px;
      align-items: center;
      gap: 5px;
      padding: 4px 5px;
      border-radius: 6px;
      background: rgba(255,255,255,0.06);
      color: #e5e7eb;
      font-size: 11px;
    }
    .clash-filter-row span {
      min-width: 0;
      overflow: hidden;
      white-space: nowrap;
      text-overflow: ellipsis;
    }
    .clash-filter-remove {
      width: 21px;
      height: 21px;
      border: 1px solid rgba(248,113,113,0.5);
      border-radius: 5px;
      background: rgba(127,29,29,0.72);
      color: #fff;
      font-weight: 800;
      cursor: pointer;
      line-height: 1;
    }


    /* Cuando Proyectos se desactiva desde el botón superior, se oculta toda la columna izquierda.
       Esto evita que quede una franja/panel vacío cuando el contenido ya está oculto. */
    .app:not(.mobile-sidebar-open) > .sidebar,
    .app:not(.mobile-sidebar-open) > #columnSplitter { display: none !important; }

    .app:not(.mobile-sidebar-open):not(.clash-panel-visible):not(.works-panel-visible) {
      grid-template-columns: 0 0 minmax(0, 1fr) 10px var(--properties-width, 360px) !important;
    }
    .app:not(.mobile-sidebar-open):not(.clash-panel-visible):not(.works-panel-visible):not(.mobile-properties-open) {
      grid-template-columns: 0 0 minmax(0, 1fr) 0 0 !important;
    }
    .app:not(.mobile-sidebar-open).clash-panel-visible:not(.works-panel-visible) {
      grid-template-columns: 0 0 minmax(0, 1fr) 10px var(--properties-width, 360px) 10px var(--clash-width, 430px) !important;
    }
    .app:not(.mobile-sidebar-open).clash-panel-visible:not(.works-panel-visible):not(.mobile-properties-open) {
      grid-template-columns: 0 0 minmax(0, 1fr) 0 0 10px var(--clash-width, 430px) !important;
    }
    .app:not(.mobile-sidebar-open).works-panel-visible:not(.clash-panel-visible) {
      grid-template-columns: 0 0 minmax(0, 1fr) 10px var(--properties-width, 360px) 10px var(--works-width, 720px) !important;
    }
    .app:not(.mobile-sidebar-open).works-panel-visible:not(.clash-panel-visible):not(.mobile-properties-open) {
      grid-template-columns: 0 0 minmax(0, 1fr) 0 0 10px var(--works-width, 720px) !important;
    }
    .app:not(.mobile-sidebar-open).clash-panel-visible.works-panel-visible {
      grid-template-columns: 0 0 minmax(0, 1fr) 10px var(--properties-width, 360px) 10px var(--clash-width, 430px) 10px var(--works-width, 720px) !important;
    }
    .app:not(.mobile-sidebar-open).clash-panel-visible.works-panel-visible:not(.mobile-properties-open) {
      grid-template-columns: 0 0 minmax(0, 1fr) 0 0 10px var(--clash-width, 430px) 10px var(--works-width, 720px) !important;
    }

    /* Cuando Propiedades se desactiva, se oculta toda su columna, no sólo el contenido. */
    .app:not(.mobile-properties-open) > .properties-column,
    .app:not(.mobile-properties-open) > #propertiesSplitter { display: none !important; }
    .app.clash-panel-visible:not(.works-panel-visible):not(.mobile-properties-open) {
      grid-template-columns: var(--sidebar-width, 330px) 10px minmax(0, 1fr) 0 0 10px var(--clash-width, 430px) !important;
    }
    .app.sidebar-collapsed.clash-panel-visible:not(.works-panel-visible):not(.mobile-properties-open) {
      grid-template-columns: 52px 0 minmax(0, 1fr) 0 0 10px var(--clash-width, 430px) !important;
    }
    .app.works-panel-visible:not(.clash-panel-visible):not(.mobile-properties-open) {
      grid-template-columns: var(--sidebar-width, 330px) 10px minmax(0, 1fr) 0 0 10px var(--works-width, 720px) !important;
    }
    .app.sidebar-collapsed.works-panel-visible:not(.clash-panel-visible):not(.mobile-properties-open) {
      grid-template-columns: 52px 0 minmax(0, 1fr) 0 0 10px var(--works-width, 720px) !important;
    }
    .app.clash-panel-visible.works-panel-visible:not(.mobile-properties-open) {
      grid-template-columns: var(--sidebar-width, 330px) 10px minmax(0, 1fr) 0 0 10px var(--clash-width, 430px) 10px var(--works-width, 720px) !important;
    }
    .app.sidebar-collapsed.clash-panel-visible.works-panel-visible:not(.mobile-properties-open) {
      grid-template-columns: 52px 0 minmax(0, 1fr) 0 0 10px var(--clash-width, 430px) 10px var(--works-width, 720px) !important;
    }

    .properties-header .small-button.active,
    .mobile-panel-button.active,
    .mobile-panel-button[aria-expanded="true"] {
      background: #0066cc !important;
      color: #ffffff !important;
      border-color: #bfdbfe !important;
      box-shadow: 0 0 0 2px rgba(147, 197, 253, 0.55), 0 8px 22px rgba(2, 6, 23, 0.30) !important;
    }
    @media (max-width: 1100px) {
      .app,
      .app.clash-panel-visible,
      .app.sidebar-collapsed.clash-panel-visible {
        display: flex !important;
        flex-direction: column !important;
        height: calc(100vh - 58px) !important;
        max-height: calc(100vh - 58px) !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
        align-content: stretch !important;
        gap: 0 !important;
      }

      .column-splitter,
      .viewer-row-splitter,
      .mass-column-splitter,
      .clash-splitter,
      .works-splitter {
        display: none !important;
      }

      .app > .sidebar {
        order: 1 !important;
        width: 100% !important;
        max-width: 100% !important;
        max-height: 260px !important;
        overflow: auto !important;
        flex: 0 0 auto !important;
        position: relative !important;
        inset: auto !important;
      }
      .app:not(.mobile-sidebar-open) > .sidebar { display: none !important; }
      .app.mobile-sidebar-open > .sidebar { display: block !important; }

      .app > .properties-column {
        order: 2 !important;
        width: 100% !important;
        max-width: 100% !important;
        max-height: 230px !important;
        overflow: auto !important;
        flex: 0 0 auto !important;
        position: relative !important;
        inset: auto !important;
      }
      .app:not(.mobile-properties-open) > .properties-column { display: none !important; }
      .app.mobile-properties-open > .properties-column { display: block !important; }

      .app > .viewer-column,
      .app.clash-panel-visible > .viewer-column {
        order: 3 !important;
        width: 100% !important;
        max-width: 100% !important;
        min-height: 0 !important;
        flex: 0 0 auto !important;
        display: flex !important;
        flex-direction: column !important;
        position: relative !important;
        inset: auto !important;
      }
      .viewer-pane {
        height: min(54vh, 360px) !important;
        min-height: 260px !important;
        flex: 0 0 auto !important;
      }
      .app:not(.mobile-data-open) #massInfoPanel { display: none !important; }
      .app.mobile-data-open #massInfoPanel {
        display: grid !important;
        max-height: 280px !important;
        overflow: auto !important;
        flex: 0 0 auto !important;
      }

      .app.clash-panel-visible > #clashPanel {
        order: 4 !important;
        display: block !important;
        position: relative !important;
        inset: auto !important;
        width: 100% !important;
        max-width: 100% !important;
        height: auto !important;
        max-height: 340px !important;
        flex: 0 0 auto !important;
        z-index: 3 !important;
        box-shadow: none !important;
        border-top: 1px solid rgba(255,255,255,0.10) !important;
        overflow: auto !important;
      }
      .app:not(.clash-panel-visible) > #clashPanel { display: none !important; }
      .app.works-panel-visible > #worksPanel {
        order: 5 !important;
        display: block !important;
        position: relative !important;
        inset: auto !important;
        width: 100% !important;
        max-width: 100% !important;
        height: auto !important;
        max-height: 320px !important;
        flex: 0 0 auto !important;
        overflow: auto !important;
      }
      .app:not(.works-panel-visible) > #worksPanel,
    .app:not(.works-panel-visible) > #worksSplitter { display: none !important; }
    }


    .app.mobile-stacked-layout,
    .app.mobile-stacked-layout.clash-panel-visible,
    .app.mobile-stacked-layout.works-panel-visible,
    .app.mobile-stacked-layout.clash-panel-visible.works-panel-visible,
    .app.mobile-stacked-layout.sidebar-collapsed.clash-panel-visible,
    .app.mobile-stacked-layout.sidebar-collapsed.works-panel-visible,
    .app.mobile-stacked-layout.sidebar-collapsed.clash-panel-visible.works-panel-visible {
      display: flex !important;
      flex-direction: column !important;
      height: calc(100vh - 58px) !important;
      max-height: calc(100vh - 58px) !important;
      overflow-y: auto !important;
      overflow-x: hidden !important;
      align-content: stretch !important;
      gap: 0 !important;
    }
    .app.mobile-stacked-layout > .column-splitter,
    .app.mobile-stacked-layout > .viewer-column > .viewer-row-splitter,
    .app.mobile-stacked-layout .mass-column-splitter,
    .app.mobile-stacked-layout > .clash-splitter,
    .app.mobile-stacked-layout > .works-splitter {
      display: none !important;
    }
    .app.mobile-stacked-layout > .sidebar {
      order: 1 !important;
      width: 100% !important;
      max-width: 100% !important;
      max-height: 260px !important;
      overflow: auto !important;
      flex: 0 0 auto !important;
      position: relative !important;
      inset: auto !important;
    }
    .app.mobile-stacked-layout:not(.mobile-sidebar-open) > .sidebar { display: none !important; }
    .app.mobile-stacked-layout.mobile-sidebar-open > .sidebar { display: block !important; }

    .app.mobile-stacked-layout > .properties-column {
      order: 2 !important;
      width: 100% !important;
      max-width: 100% !important;
      max-height: 230px !important;
      overflow: auto !important;
      flex: 0 0 auto !important;
      position: relative !important;
      inset: auto !important;
      display: block !important;
    }
    .app.mobile-stacked-layout:not(.mobile-properties-open) > .properties-column { display: none !important; }
    .app.mobile-stacked-layout.mobile-properties-open > .properties-column { display: block !important; }

    .app.mobile-stacked-layout > .viewer-column,
    .app.mobile-stacked-layout.clash-panel-visible > .viewer-column {
      order: 3 !important;
      width: 100% !important;
      max-width: 100% !important;
      min-height: 0 !important;
      flex: 0 0 auto !important;
      display: flex !important;
      flex-direction: column !important;
      position: relative !important;
      inset: auto !important;
    }
    .app.mobile-stacked-layout .viewer-pane {
      height: min(54vh, 360px) !important;
      min-height: 260px !important;
      flex: 0 0 auto !important;
      order: 1 !important;
    }
    .app.mobile-stacked-layout #massInfoPanel {
      order: 2 !important;
      width: 100% !important;
      max-width: 100% !important;
      max-height: 280px !important;
      overflow: auto !important;
      flex: 0 0 auto !important;
    }
    .app.mobile-stacked-layout:not(.mobile-data-open) #massInfoPanel { display: none !important; }
    .app.mobile-stacked-layout.mobile-data-open #massInfoPanel { display: grid !important; }

    .app.mobile-stacked-layout.clash-panel-visible > #clashPanel {
      order: 4 !important;
      display: block !important;
      position: relative !important;
      inset: auto !important;
      width: 100% !important;
      max-width: 100% !important;
      height: auto !important;
      max-height: 340px !important;
      flex: 0 0 auto !important;
      z-index: 3 !important;
      box-shadow: none !important;
      border-top: 1px solid rgba(255,255,255,0.10) !important;
      overflow: auto !important;
    }
    .app.mobile-stacked-layout:not(.clash-panel-visible) > #clashPanel { display: none !important; }

    .app.mobile-stacked-layout.works-panel-visible > #worksPanel {
      order: 5 !important;
      display: block !important;
      position: relative !important;
      inset: auto !important;
      width: 100% !important;
      max-width: 100% !important;
      height: auto !important;
      max-height: 320px !important;
      flex: 0 0 auto !important;
      overflow: auto !important;
    }
    .app.mobile-stacked-layout:not(.works-panel-visible) > #worksPanel { display: none !important; }
    .app.mobile-stacked-layout.works-panel-visible > #worksPanel .works-panel {
      height: auto !important;
      min-height: 0 !important;
      max-height: none !important;
      overflow: visible !important;
    }

    .app.mobile-stacked-layout.clash-panel-visible > #clashPanel .clash-panel {
      height: auto !important;
      min-height: 0 !important;
      max-height: none !important;
      overflow: visible !important;
    }
    .app.mobile-stacked-layout.clash-panel-visible > #clashPanel .clash-section {
      flex: 0 0 auto !important;
      overflow: visible !important;
    }


    /* El panel de progreso debe capturar eventos para que Cancelar no atraviese al visor. */
    .loading-panel {
      pointer-events: auto !important;
      z-index: 9999 !important;
    }
    .loading-card {
      pointer-events: auto !important;
      position: relative;
      z-index: 10000 !important;
    }

    .loading-cancel-button {
      align-self: center;
      min-width: 110px;
      height: 30px;
      margin-top: 8px;
      border: 1px solid rgba(248,113,113,0.55);
      border-radius: 7px;
      background: #dc2626;
      color: #ffffff;
      font-size: 12px;
      font-weight: 800;
      cursor: pointer;
    }
    .loading-cancel-button:hover { background: #b91c1c; }
    .loading-cancel-button:disabled {
      opacity: 0.65;
      cursor: default;
    }
    .loading-cancel-button.hidden { display: none !important; }




    /* Resumen General de Obra: pastel interactivo por meses */
    .works-month-summary-panel {
      display: flex;
      flex-direction: column;
      gap: 12px;
      min-width: 0;
      width: 100%;
      min-height: 0;
      flex: 1 1 auto;
    }
    #worksSummarySection:not(.collapsed) {
      flex: 1 1 auto;
      min-height: 0;
      display: flex;
      flex-direction: column;
    }
    #worksSummarySection:not(.collapsed) > .works-section-body {
      flex: 1 1 auto;
      min-height: 0;
      display: flex;
      flex-direction: column;
    }
    #worksSummaryContent {
      flex: 1 1 auto;
      min-height: 0;
      display: flex;
      flex-direction: column;
    }
    .works-month-summary-header {
      display: flex;
      align-items: flex-start;
      justify-content: space-between;
      gap: 10px;
      padding: 8px 10px;
      border: 1px solid rgba(148,163,184,0.22);
      border-radius: 8px;
      background: rgba(15,23,42,0.72);
    }
    .works-month-summary-title {
      font-size: 14px;
      font-weight: 800;
      color: #f8fafc;
    }
    .works-month-summary-detail {
      font-size: 11px;
      color: #93c5fd;
      text-align: right;
    }
    .works-month-summary-main {
      display: grid;
      grid-template-columns: minmax(280px, 1fr) minmax(280px, 0.85fr);
      gap: 12px;
      align-items: stretch;
      min-width: 0;
      width: 100%;
    }
    .works-month-pie-card {
      width: 100%;
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 6px;
      padding: 8px;
      border: 1px solid rgba(148,163,184,0.22);
      border-radius: 10px;
      background: linear-gradient(180deg, rgba(30,41,59,0.82), rgba(15,23,42,0.76));
      overflow: hidden;
    }
    .works-month-pie {
      width: min(100%, 390px);
      height: auto;
      min-height: 270px;
      display: block;
      overflow: visible;
    }
    .works-month-pie-slice {
      cursor: pointer;
      stroke: rgba(2,6,23,0.72);
      stroke-width: 1.2px;
      transition: transform 0.14s ease, opacity 0.14s ease, stroke-width 0.14s ease;
    }
    .works-month-pie-slice:not(.selected) {
      opacity: 0.78;
    }
    .works-month-pie-slice.selected {
      opacity: 1;
      stroke: #ffffff;
      stroke-width: 3px;
      filter: drop-shadow(0 0 8px rgba(255,255,255,0.28));
    }
    .works-month-pie-label {
      pointer-events: auto;
      cursor: pointer;
      fill: #ffffff;
      font-size: 11px;
      font-weight: 800;
      paint-order: stroke;
      stroke: rgba(2,6,23,0.82);
      stroke-width: 3px;
      stroke-linejoin: round;
    }
    .works-month-pie-label tspan {
      pointer-events: none;
    }
    .works-month-pie-leader {
      stroke: rgba(226,232,240,0.72);
      stroke-width: 1px;
      fill: none;
      pointer-events: none;
    }
    .works-month-pie-help {
      font-size: 11px;
      line-height: 1.35;
      color: #bfdbfe;
      text-align: center;
      max-width: 360px;
    }
    .works-month-controls-panel {
      min-width: 0;
      display: flex;
      flex-direction: column;
      gap: 8px;
      padding: 8px;
      border: 1px solid rgba(148,163,184,0.22);
      border-radius: 10px;
      background: linear-gradient(180deg, rgba(30,41,59,0.82), rgba(15,23,42,0.76));
      overflow: hidden;
    }
    .works-month-controls-title {
      color: #f8fafc;
      font-size: 13px;
      font-weight: 800;
    }
    .works-month-controls-table {
      width: 100%;
      border-collapse: collapse;
      table-layout: fixed;
      font-size: 11px;
    }
    .works-month-controls-table th,
    .works-month-controls-table td {
      border-bottom: 1px solid rgba(148,163,184,0.16);
      padding: 6px 5px;
      color: #e5f3ff;
      vertical-align: middle;
    }
    .works-month-controls-table th {
      background: rgba(15,23,42,0.78);
      color: #bfdbfe;
      font-weight: 800;
      text-align: left;
    }
    .works-month-controls-table tr.selected td {
      background: rgba(14,165,233,0.16);
    }
    .works-month-controls-table th:nth-child(1),
    .works-month-controls-table td:nth-child(1) { width: 34%; }
    .works-month-controls-table th:nth-child(2),
    .works-month-controls-table td:nth-child(2) { width: 54px; text-align: center; }
    .works-month-controls-table th:nth-child(3),
    .works-month-controls-table td:nth-child(3) { width: auto; }
    .works-month-controls-table th:nth-child(4),
    .works-month-controls-table td:nth-child(4) { width: 42px; text-align: center; }
    .works-month-control-name {
      cursor: pointer;
      min-width: 0;
    }
    .works-month-control-name strong,
    .works-month-control-name small {
      display: block;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }
    .works-month-control-name small {
      margin-top: 2px;
      color: #93c5fd;
      font-size: 10px;
      font-weight: 700;
    }
    .works-month-color-button {
      width: 28px;
      height: 26px;
      padding: 0;
      border: 2px solid rgba(226,232,240,0.76);
      border-radius: 6px;
      background: #5da3f6;
      cursor: pointer;
      box-shadow: inset 0 0 0 1px rgba(2,6,23,0.45);
    }
    .works-month-color-button:hover,
    .works-month-color-button:focus-visible {
      outline: 2px solid #ffffff;
      outline-offset: 2px;
    }
    .works-month-color-cell {
      position: relative;
      text-align: center;
    }
    .works-month-color-palette-popover {
      position: fixed;
      z-index: 2147483000;
      display: flex;
      flex-direction: column;
      gap: 8px;
      padding: 10px;
      border: 1px solid rgba(148,163,184,0.48);
      border-radius: 10px;
      background: rgba(15,23,42,0.98);
      box-shadow: 0 14px 34px rgba(2,6,23,0.55);
      min-width: 232px;
    }
    .works-month-color-palette-title {
      color: #bfdbfe;
      font-size: 11px;
      font-weight: 800;
      letter-spacing: 0.02em;
    }
    .works-month-color-palette-grid {
      display: grid;
      grid-template-columns: repeat(5, 28px);
      gap: 6px;
      align-items: center;
    }
    .works-month-color-swatch {
      width: 28px;
      height: 28px;
      padding: 0;
      border: 1px solid rgba(226,232,240,0.7);
      border-radius: 5px;
      cursor: pointer;
      box-shadow: 0 0 0 1px rgba(2,6,23,0.34);
    }
    .works-month-color-swatch:hover,
    .works-month-color-swatch:focus-visible {
      outline: 2px solid #ffffff;
      outline-offset: 2px;
    }
    .works-month-color-swatch.active {
      outline: 3px solid #ffffff;
      outline-offset: 2px;
      box-shadow: 0 0 0 2px rgba(56,189,248,0.55), 0 0 16px rgba(255,255,255,0.24);
    }
    .works-month-custom-color-row {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 8px;
      padding-top: 6px;
      border-top: 1px solid rgba(148,163,184,0.24);
      color: #bfdbfe;
      font-size: 11px;
      font-weight: 700;
    }
    .works-month-custom-color {
      width: 36px;
      height: 28px;
      padding: 0;
      border: 1px solid rgba(148,163,184,0.45);
      border-radius: 6px;
      background: #0f172a;
      cursor: pointer;
    }
    .works-month-color-preview-row {
      display: flex;
      align-items: center;
      gap: 8px;
      padding: 7px;
      border: 1px solid rgba(148,163,184,0.24);
      border-radius: 8px;
      background: rgba(2,6,23,0.28);
    }
    .works-month-color-preview-chip {
      flex: 0 0 auto;
      width: 32px;
      height: 32px;
      border: 2px solid rgba(226,232,240,0.82);
      border-radius: 7px;
      box-shadow: inset 0 0 0 1px rgba(2,6,23,0.45);
    }
    .works-month-color-preview-values {
      display: flex;
      min-width: 0;
      flex-direction: column;
      gap: 2px;
      color: #bfdbfe;
      font-size: 11px;
      line-height: 1.2;
    }
    .works-month-color-preview-values strong {
      color: #f8fafc;
      font-size: 12px;
      letter-spacing: 0.03em;
    }
    .works-month-color-actions {
      display: flex;
      justify-content: flex-end;
      gap: 6px;
      padding-top: 2px;
    }
    .works-month-color-accept {
      min-height: 24px;
      padding: 3px 10px;
      border: 1px solid rgba(56,189,248,0.62);
      border-radius: 6px;
      background: linear-gradient(180deg, rgba(14,165,233,0.96), rgba(2,132,199,0.92));
      color: #ffffff;
      font-size: 11px;
      font-weight: 800;
      cursor: pointer;
    }
    .works-month-color-accept:hover,
    .works-month-color-accept:focus-visible {
      outline: 2px solid rgba(255,255,255,0.88);
      outline-offset: 2px;
    }
    .works-month-transparency-cell {
      display: flex;
      align-items: center;
      gap: 2px;
      min-width: 0;
    }
    .works-month-transparency-slider {
      width: 100%;
      min-width: 72px;
      accent-color: #0ea5e9;
    }
    .works-month-transparency-value {
      min-width: 24px;
      text-align: right;
      color: #bfdbfe;
      font-size: 10px;
      font-weight: 700;
    }
    .works-month-visible-cell input {
      width: 15px;
      height: 15px;
      accent-color: #0ea5e9;
      cursor: pointer;
    }
    @media (max-width: 900px) {
      .works-month-summary-main {
        grid-template-columns: 1fr;
      }
    }
    .works-month-details {
      border: 1px solid rgba(148,163,184,0.22);
      border-radius: 10px;
      background: rgba(15,23,42,0.72);
      overflow: hidden;
      min-width: 0;
      display: flex;
      flex-direction: column;
      flex: 1 1 auto;
      min-height: 0;
    }
    .works-month-details-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 10px;
      padding: 8px 10px;
      border-bottom: 1px solid rgba(148,163,184,0.24);
      background: rgba(30,41,59,0.82);
      color: #e0f2fe;
      font-size: 12px;
    }
    .works-month-details-header span {
      color: #bfdbfe;
      font-size: 11px;
      white-space: nowrap;
    }
    .works-month-details-title-wrap {
      display: flex;
      align-items: center;
      gap: 8px;
      min-width: 0;
    }
    .works-month-details-title-wrap strong {
      min-width: 0;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }
    .works-month-details-clear-selection {
      border: 1px solid rgba(56,189,248,0.55);
      border-radius: 7px;
      background: rgba(14,165,233,0.16);
      color: #e0f2fe;
      font-size: 10px;
      font-weight: 800;
      line-height: 1;
      padding: 4px 7px;
      white-space: nowrap;
      cursor: pointer;
    }
    .works-month-details-clear-selection:hover:not(:disabled) {
      background: rgba(14,165,233,0.32);
      border-color: rgba(125,211,252,0.9);
    }
    .works-month-details-clear-selection:disabled {
      opacity: 0.45;
      cursor: default;
    }
    .works-month-details-table-wrap {
      max-height: clamp(320px, 46vh, 680px);
      overflow: auto;
      flex: 1 1 auto;
      min-height: 260px;
    }
    .works-month-details-table {
      width: 100%;
      user-select: none;
      min-width: 720px;
      border-collapse: collapse;
      table-layout: fixed;
      font-size: 12px;
      user-select: none;
      -webkit-user-select: none;
    }
    .works-month-details-table th,
    .works-month-details-table td {
      border-bottom: 1px solid rgba(148,163,184,0.16);
      padding: 7px 8px;
      color: #e5f3ff;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }
    .works-month-details-table th {
      position: sticky;
      top: 0;
      z-index: 1;
      background: #1e293b;
      color: #bfdbfe;
      font-weight: 800;
      text-align: left;
    }
    .works-month-details-table tbody tr {
      cursor: pointer;
    }
    .works-month-details-table tbody tr:hover {
      background: rgba(14,165,233,0.16);
    }
    .works-month-details-table tbody tr.selected {
      background: rgba(14,165,233,0.28);
      box-shadow: inset 3px 0 0 #38bdf8;
    }
    .works-month-details-table th:nth-child(1),
    .works-month-details-table td:nth-child(1) { width: 140px; }
    .works-month-details-table th:nth-child(2),
    .works-month-details-table td:nth-child(2) { width: auto; }
    .works-month-details-table th:nth-child(3),
    .works-month-details-table td:nth-child(3) { width: 80px; text-align: center; }
    .works-month-details-table th:nth-child(4),
    .works-month-details-table td:nth-child(4) { width: 120px; text-align: right; }


    .top-left-actions {
      display: flex;
      align-items: center;
      gap: 18px;
      min-width: 0;
      position: relative;
      z-index: 2147483200;
    }

    .top-header {
      position: relative;
      z-index: 2147483100;
      overflow: visible;
    }

    .general-settings-wrapper {
      position: relative;
      display: inline-flex;
      align-items: center;
      flex: 0 0 auto;
      z-index: 2147483201;
    }

    .general-settings-button {
      width: 36px;
      height: 34px;
      border-radius: 10px;
      border: 1px solid rgba(148, 163, 184, 0.55);
      background: linear-gradient(180deg, rgba(30,41,59,0.98), rgba(15,23,42,0.96));
      color: #e2e8f0;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      font-size: 18px;
      line-height: 1;
      cursor: pointer;
      box-shadow: 0 8px 20px rgba(15, 23, 42, 0.26);
      transition: transform 0.15s ease, background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
      user-select: none;
    }

    .general-settings-button:hover,
    .general-settings-button.active {
      background: linear-gradient(180deg, #1d4ed8 0%, #0f172a 100%);
      border-color: rgba(147, 197, 253, 0.92);
      color: #ffffff;
      transform: translateY(-1px);
      box-shadow: 0 10px 24px rgba(37, 99, 235, 0.34);
    }

    .general-settings-panel {
      position: absolute;
      top: calc(100% + 10px);
      left: 0;
      width: min(560px, calc(100vw - 24px));
      max-height: min(78vh, 720px);
      padding: 14px;
      border-radius: 16px;
      border: 1px solid rgba(148, 163, 184, 0.28);
      background: rgba(15, 23, 42, 0.98);
      box-shadow: 0 24px 54px rgba(2, 6, 23, 0.46);
      z-index: 2147483202;
      color: #e2e8f0;
      overflow: auto;
    }

    .general-settings-panel.hidden {
      display: none !important;
    }

    .general-settings-header {
      position: sticky;
      top: -14px;
      z-index: 2147483203;
      display: grid;
      grid-template-columns: minmax(0, 1fr) auto;
      align-items: start;
      gap: 12px;
      margin: -14px -14px 12px;
      padding: 14px;
      border-bottom: 1px solid rgba(148, 163, 184, 0.18);
      border-radius: 16px 16px 0 0;
      background: rgba(15, 23, 42, 0.99);
      backdrop-filter: blur(8px);
    }

    .general-settings-title {
      display: flex;
      flex-direction: column;
      gap: 3px;
      min-width: 0;
    }

    .general-settings-title strong {
      font-size: 14px;
      color: #ffffff;
    }

    .general-settings-title span {
      font-size: 11px;
      color: #94a3b8;
      line-height: 1.35;
    }

    .general-settings-section {
      display: grid;
      gap: 10px;
      padding: 12px 0;
      border-top: 1px solid rgba(148, 163, 184, 0.18);
    }

    .general-settings-section:first-of-type {
      border-top: 0;
      padding-top: 0;
    }

    .general-settings-section-title {
      font-size: 12px;
      font-weight: 900;
      color: #bfdbfe;
      text-transform: uppercase;
      letter-spacing: 0.04em;
    }

    .general-settings-row {
      display: grid;
      grid-template-columns: minmax(120px, 1fr) auto;
      align-items: center;
      gap: 10px;
      font-size: 12px;
      color: #cbd5e1;
    }

    .general-settings-row input[type="color"] {
      width: 44px;
      height: 32px;
      border: 1px solid rgba(148, 163, 184, 0.38);
      border-radius: 8px;
      background: #0f172a;
      padding: 2px;
      cursor: pointer;
    }

    .general-settings-row select {
      min-width: 210px;
      height: 32px;
      border-radius: 8px;
      border: 1px solid rgba(148, 163, 184, 0.28);
      background: rgba(2, 6, 23, 0.72);
      color: #e2e8f0;
      font-size: 12px;
      font-weight: 800;
      padding: 0 8px;
      outline: none;
    }

    .general-settings-row input[type="checkbox"] {
      width: 18px;
      height: 18px;
      accent-color: #0b7de3;
      justify-self: end;
      cursor: pointer;
    }

    .general-settings-row.is-disabled {
      opacity: 0.48;
    }

    .general-settings-row.is-disabled span {
      color: #64748b;
    }

    .general-settings-row select:disabled,
    .general-settings-row input:disabled {
      cursor: not-allowed;
      color: #64748b;
      border-color: rgba(100, 116, 139, 0.22);
      background: rgba(15, 23, 42, 0.46);
      filter: grayscale(0.35);
    }

    .general-settings-note {
      margin: -2px 0 0;
      color: #94a3b8;
      font-size: 11px;
      line-height: 1.35;
    }

    .general-settings-range-wrap {
      display: grid;
      grid-template-columns: 1fr 46px;
      align-items: center;
      gap: 8px;
      min-width: 190px;
    }

    .general-settings-range-wrap input[type="range"] {
      width: 100%;
    }

    .general-settings-range-wrap span {
      text-align: right;
      color: #e2e8f0;
      font-weight: 800;
      font-size: 12px;
    }

    .general-settings-colors-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 10px;
    }

    .general-settings-color-list {
      display: grid;
      grid-template-columns: repeat(2, minmax(0, 1fr));
      gap: 8px;
      max-height: 260px;
      overflow: auto;
      padding-right: 4px;
    }

    .general-settings-color-row {
      display: grid;
      grid-template-columns: 34px minmax(96px, 1fr) 28px 28px 28px;
      align-items: center;
      gap: 6px;
      padding: 6px;
      border: 1px solid rgba(148, 163, 184, 0.16);
      border-radius: 10px;
      background: rgba(30, 41, 59, 0.62);
    }

    .general-settings-color-input {
      width: 30px !important;
      height: 28px !important;
      border-radius: 7px !important;
    }

    .general-settings-hex-input {
      width: 100%;
      min-width: 0;
      height: 28px;
      border-radius: 8px;
      border: 1px solid rgba(148, 163, 184, 0.28);
      background: rgba(2, 6, 23, 0.54);
      color: #e2e8f0;
      font-size: 11px;
      font-weight: 800;
      padding: 0 7px;
      text-transform: uppercase;
    }

    .general-settings-mini-button,
    .general-settings-secondary,
    .general-settings-accept {
      border: 1px solid rgba(148, 163, 184, 0.28);
      background: rgba(51, 65, 85, 0.9);
      color: #e2e8f0;
      border-radius: 8px;
      cursor: pointer;
      font-weight: 900;
    }

    .general-settings-mini-button {
      width: 28px;
      height: 26px;
      line-height: 1;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      padding: 0;
    }

    .general-settings-mini-button:hover,
    .general-settings-secondary:hover {
      background: #334155;
      color: #ffffff;
    }

    .general-settings-mini-button.danger:hover {
      background: #dc2626;
      border-color: #ef4444;
    }

    .general-settings-secondary,
    .general-settings-accept {
      min-height: 30px;
      padding: 0 12px;
      font-size: 12px;
    }

    .general-settings-actions {
      display: flex;
      justify-content: flex-end;
      align-items: center;
      gap: 8px;
      flex-wrap: nowrap;
      white-space: nowrap;
    }

    .general-settings-accept {
      background: linear-gradient(180deg, #0b7de3 0%, #005eb8 100%);
      color: #ffffff;
      border-color: rgba(96, 165, 250, 0.75);
      box-shadow: 0 8px 20px rgba(0, 102, 204, 0.25);
    }

    .general-settings-accept:hover {
      background: linear-gradient(180deg, #148cf5 0%, #0066cc 100%);
      border-color: rgba(147, 197, 253, 0.95);
    }

    @media (max-width: 760px) {
      .top-left-actions {
        gap: 8px;
      }
      .general-settings-panel {
        left: -72px;
        width: min(480px, calc(100vw - 18px));
      }
      .general-settings-header {
        grid-template-columns: 1fr;
      }
      .general-settings-actions {
        justify-content: flex-start;
      }
      .general-settings-color-list {
        grid-template-columns: 1fr;
      }
    }

    .fullscreen-toggle-button {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      min-height: 34px;
      padding: 0 14px;
      border-radius: 10px;
      border: 1px solid rgba(148, 163, 184, 0.85);
      background: linear-gradient(180deg, #1f2937 0%, #111827 100%);
      color: #ffffff;
      font-weight: 800;
      font-size: 13px;
      line-height: 1;
      letter-spacing: 0.1px;
      cursor: pointer;
      box-shadow: 0 8px 20px rgba(15, 23, 42, 0.32);
      transition: transform 0.15s ease, background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
      white-space: nowrap;
      user-select: none;
    }

    .fullscreen-toggle-button:hover {
      background: linear-gradient(180deg, #273449 0%, #182235 100%);
      border-color: rgba(203, 213, 225, 0.95);
      box-shadow: 0 10px 24px rgba(15, 23, 42, 0.4);
      transform: translateY(-1px);
    }

    .fullscreen-toggle-button:active {
      transform: translateY(0);
      box-shadow: 0 4px 12px rgba(15, 23, 42, 0.28);
    }

    .fullscreen-toggle-button:focus-visible {
      outline: 2px solid #93c5fd;
      outline-offset: 3px;
    }

    .fullscreen-toggle-button.is-fullscreen {
      background: linear-gradient(180deg, #0b7de3 0%, #005eb8 100%);
      border-color: rgba(96, 165, 250, 0.75);
      box-shadow: 0 8px 20px rgba(0, 102, 204, 0.28);
    }

    .fullscreen-toggle-button.is-fullscreen:hover {
      background: linear-gradient(180deg, #148cf5 0%, #0066cc 100%);
      border-color: rgba(147, 197, 253, 0.95);
      box-shadow: 0 10px 24px rgba(0, 102, 204, 0.36);
    }

    .fullscreen-toggle-button.is-fullscreen:active {
      box-shadow: 0 4px 12px rgba(0, 102, 204, 0.25);
    }

    html.viewer-pseudo-fullscreen-root,
    body.viewer-pseudo-fullscreen {
      overflow: hidden !important;
    }

    body.viewer-pseudo-fullscreen .app-shell {
      position: fixed !important;
      inset: 0 !important;
      width: 100vw !important;
      height: 100dvh !important;
      z-index: 999999 !important;
    }

    @media (max-width: 640px), (pointer: coarse) and (max-width: 767px) {
      .fullscreen-toggle-button {
        display: none !important;
      }
    }


    /* v36: modo móvil estable para evitar pantallas negras al mostrar/ocultar Proyectos y Propiedades. */
    @media (max-width: 1100px), (pointer: coarse) and (max-width: 1400px) {
      html,
      body,
      .app-shell {
        min-height: 100dvh !important;
        height: 100dvh !important;
        overflow: hidden !important;
        overscroll-behavior: none !important;
        background: #0f172a !important;
      }

      .app.mobile-stacked-layout,
      .app.mobile-stacked-layout.sidebar-collapsed,
      .app.mobile-stacked-layout.clash-panel-visible,
      .app.mobile-stacked-layout.works-panel-visible,
      .app.mobile-stacked-layout.clash-panel-visible.works-panel-visible,
      .app.mobile-stacked-layout.sidebar-collapsed.clash-panel-visible,
      .app.mobile-stacked-layout.sidebar-collapsed.works-panel-visible,
      .app.mobile-stacked-layout.sidebar-collapsed.clash-panel-visible.works-panel-visible,
      .app.mobile-stacked-layout.mobile-sidebar-open,
      .app.mobile-stacked-layout.mobile-properties-open,
      .app.mobile-stacked-layout.mobile-data-open,
      .app.mobile-stacked-layout.mobile-sidebar-open.mobile-properties-open {
        display: flex !important;
        flex-direction: column !important;
        align-items: stretch !important;
        justify-content: flex-start !important;
        width: 100% !important;
        height: calc(100dvh - 58px) !important;
        max-height: calc(100dvh - 58px) !important;
        min-height: 0 !important;
        overflow-x: hidden !important;
        overflow-y: auto !important;
        gap: 0 !important;
        grid-template-columns: none !important;
        grid-template-rows: none !important;
        background: #0f172a !important;
        -webkit-overflow-scrolling: touch !important;
      }

      body.viewer-pseudo-fullscreen .app.mobile-stacked-layout,
      :fullscreen .app.mobile-stacked-layout,
      :-webkit-full-screen .app.mobile-stacked-layout {
        height: 100dvh !important;
        max-height: 100dvh !important;
      }

      .app.mobile-stacked-layout > .column-splitter,
      .app.mobile-stacked-layout > .properties-splitter,
      .app.mobile-stacked-layout > .clash-splitter,
      .app.mobile-stacked-layout > .works-splitter,
      .app.mobile-stacked-layout > .viewer-column > .viewer-row-splitter,
      .app.mobile-stacked-layout .mass-column-splitter {
        display: none !important;
      }

      .app.mobile-stacked-layout > .sidebar,
      .app.mobile-stacked-layout > .properties-column,
      .app.mobile-stacked-layout > .viewer-column,
      .app.mobile-stacked-layout > #clashPanel,
      .app.mobile-stacked-layout > #worksPanel {
        position: relative !important;
        inset: auto !important;
        transform: none !important;
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        box-sizing: border-box !important;
        flex-shrink: 0 !important;
      }

      .app.mobile-stacked-layout:not(.mobile-sidebar-open) > .sidebar,
      .app.mobile-stacked-layout:not(.mobile-properties-open) > .properties-column,
      .app.mobile-stacked-layout:not(.mobile-data-open) #massInfoPanel,
      .app.mobile-stacked-layout:not(.clash-panel-visible) > #clashPanel,
      .app.mobile-stacked-layout:not(.works-panel-visible) > #worksPanel {
        display: none !important;
        pointer-events: none !important;
      }

      .app.mobile-stacked-layout.mobile-sidebar-open > .sidebar {
        order: 1 !important;
        display: grid !important;
        height: min(58dvh, 520px) !important;
        max-height: min(58dvh, 520px) !important;
        min-height: 230px !important;
        overflow: auto !important;
        z-index: 4 !important;
        background: #0f172a !important;
        -webkit-overflow-scrolling: touch !important;
      }

      .app.mobile-stacked-layout.mobile-properties-open > .properties-column {
        order: 2 !important;
        display: block !important;
        height: min(50dvh, 520px) !important;
        max-height: min(50dvh, 520px) !important;
        min-height: 180px !important;
        overflow: hidden !important;
        z-index: 4 !important;
        background: #0f172a !important;
      }

      .app.mobile-stacked-layout > .viewer-column,
      .app.mobile-stacked-layout.clash-panel-visible > .viewer-column,
      .app.mobile-stacked-layout.works-panel-visible > .viewer-column,
      .app.mobile-stacked-layout.clash-panel-visible.works-panel-visible > .viewer-column {
        order: 3 !important;
        display: flex !important;
        flex-direction: column !important;
        min-height: 340px !important;
        height: auto !important;
        flex: 0 0 auto !important;
        overflow: visible !important;
        z-index: 1 !important;
        background: #ffffff !important;
      }

      .app.mobile-stacked-layout .viewer-card {
        position: relative !important;
        display: block !important;
        width: 100% !important;
        height: clamp(340px, 58dvh, 620px) !important;
        min-height: 340px !important;
        max-height: none !important;
        flex: 0 0 auto !important;
        overflow: hidden !important;
        border-radius: 0 !important;
        background: #ffffff !important;
      }

      .app.mobile-stacked-layout #viewerCanvas {
        display: block !important;
        width: 100% !important;
        height: 100% !important;
        min-width: 0 !important;
        min-height: 0 !important;
        touch-action: none !important;
      }

      .app.mobile-stacked-layout.mobile-data-open #massInfoPanel {
        order: 2 !important;
        display: grid !important;
        height: min(48dvh, 520px) !important;
        max-height: min(48dvh, 520px) !important;
        min-height: 240px !important;
        overflow: auto !important;
        flex: 0 0 auto !important;
        -webkit-overflow-scrolling: touch !important;
      }

      .app.mobile-stacked-layout.clash-panel-visible > #clashPanel {
        order: 4 !important;
        display: block !important;
        height: min(62dvh, 620px) !important;
        max-height: min(62dvh, 620px) !important;
        min-height: 260px !important;
        overflow: auto !important;
        z-index: 4 !important;
        background: #0f172a !important;
        -webkit-overflow-scrolling: touch !important;
      }

      .app.mobile-stacked-layout.works-panel-visible > #worksPanel {
        order: 5 !important;
        display: block !important;
        height: min(74dvh, 640px) !important;
        max-height: min(74dvh, 640px) !important;
        min-height: 360px !important;
        overflow: auto !important;
        z-index: 4 !important;
        background: #0f172a !important;
        -webkit-overflow-scrolling: touch !important;
      }

      .app.mobile-stacked-layout.works-panel-visible > #worksPanel .works-panel {
        height: auto !important;
        min-height: 100% !important;
        max-height: none !important;
        overflow: visible !important;
      }

      .works-rule-fields {
        grid-template-columns: 1fr;
      }
    }


/* v26 - cabecera con acceso central a la guía y tipografía uniforme */
.top-header {
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, Cantarell, "Noto Sans", Helvetica, Arial, sans-serif;
  min-height: 68px;
  padding: 0 16px;
  gap: 16px;
}

.top-left-actions,
.top-actions {
  font-family: inherit;
}

.top-center-guide {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  z-index: 2147483150;
  pointer-events: auto;
}

.header-guide-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: .55rem .9rem;
  border-radius: 10px;
  border: 1px solid rgba(79, 163, 255, 0.34);
  background: color-mix(in oklab, #4fa3ff 18%, transparent);
  color: #ffffff;
  font-family: inherit;
  font-weight: 700;
  font-size: 1.02rem;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.32);
  transition: background-color .2s ease, color .2s ease, border-color .2s ease, transform .18s ease, box-shadow .2s ease;
}

.header-guide-link:hover,
.header-guide-link:focus-visible {
  background: color-mix(in oklab, #4fa3ff 28%, transparent);
  border-color: rgba(147, 197, 253, 0.78);
  color: #ffffff;
  transform: translateY(-1px);
  outline: none;
  box-shadow: 0 14px 28px rgba(15, 23, 42, 0.38);
}

.fullscreen-toggle-button,
.upload-button,
.header-upload,
.header-status {
  font-family: inherit;
}

.fullscreen-toggle-button,
.header-upload {
  font-weight: 700;
  font-size: 1.02rem;
  min-height: 38px;
  padding: .55rem .9rem;
  border-radius: 10px;
  line-height: 1;
}

.header-status {
  font-size: .95rem;
  font-weight: 600;
  color: #cbd5e1;
}

@media (max-width: 980px) {
  .top-header {
    flex-wrap: wrap;
    min-height: 104px;
    justify-content: center;
    padding-block: 8px;
  }

  .top-left-actions,
  .top-actions {
    flex: 1 1 100%;
    justify-content: center;
  }

  .top-center-guide {
    position: static;
    transform: none;
    order: 2;
    flex: 0 0 auto;
  }
}

@media (max-width: 620px) {
  .fullscreen-toggle-button,
  .header-upload,
  .header-guide-link {
    font-size: .92rem;
    min-height: 34px;
    padding: .48rem .72rem;
  }

  .header-status {
    max-width: 90vw;
    font-size: .82rem;
  }
}


/* v27 - botón Guía de Uso con estilo de Cargar Proyecto */
.header-guide-link {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  min-height: 38px !important;
  padding: 9px 13px !important;
  border-radius: 8px !important;
  border: 1px solid #0052a3 !important;
  background: var(--accent, #0066cc) !important;
  color: #ffffff !important;
  font-family: inherit !important;
  font-weight: 700 !important;
  font-size: 1rem !important;
  line-height: 1 !important;
  text-decoration: none !important;
  white-space: nowrap !important;
  cursor: pointer !important;
  box-shadow: none !important;
  transition: 0.2s ease !important;
}

.header-guide-link:hover,
.header-guide-link:focus-visible {
  background: #0052a3 !important;
  border-color: #0052a3 !important;
  color: #ffffff !important;
  transform: none !important;
  outline: none !important;
  box-shadow: none !important;
}

/* v38 - Corrección móvil: visor ocupa todo el espacio disponible y ningún botón se oculta */
@media (max-width: 1100px), (pointer: coarse) and (max-width: 1400px) {
  html,
  body {
    width: 100% !important;
    height: 100dvh !important;
    min-height: 100dvh !important;
    overflow: hidden !important;
  }

  .app-shell {
    display: grid !important;
    grid-template-rows: auto minmax(0, 1fr) !important;
    width: 100% !important;
    height: 100dvh !important;
    min-height: 100dvh !important;
    max-height: 100dvh !important;
    overflow: hidden !important;
  }

  .top-header {
    grid-row: 1 !important;
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    align-items: center !important;
    justify-items: stretch !important;
    gap: 5px !important;
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    padding: 5px 8px !important;
    overflow: visible !important;
  }

  .top-left-actions,
  .top-actions {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex-wrap: wrap !important;
    width: 100% !important;
    min-width: 0 !important;
    gap: 6px !important;
  }

  .top-left-actions { order: 1 !important; }
  .top-center-guide {
    order: 2 !important;
    position: static !important;
    left: auto !important;
    top: auto !important;
    transform: none !important;
    justify-self: center !important;
    display: inline-flex !important;
  }
  .top-actions { order: 3 !important; }

  .top-brand img {
    height: 28px !important;
    max-width: min(42vw, 160px) !important;
    object-fit: contain !important;
  }

  .general-settings-button,
  .fullscreen-toggle-button,
  .header-upload,
  .header-guide-link {
    display: inline-flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    min-height: 30px !important;
    height: 30px !important;
    padding: 0 9px !important;
    font-size: 11px !important;
    line-height: 1 !important;
    white-space: nowrap !important;
    flex: 0 0 auto !important;
  }

  .general-settings-button {
    width: 32px !important;
    min-width: 32px !important;
    padding: 0 !important;
    font-size: 16px !important;
  }

  .header-status {
    flex: 1 1 100% !important;
    max-width: calc(100vw - 18px) !important;
    font-size: 10px !important;
    line-height: 1.2 !important;
    text-align: center !important;
    white-space: nowrap !important;
  }

  .app.mobile-stacked-layout,
  .app.mobile-stacked-layout.sidebar-collapsed,
  .app.mobile-stacked-layout.clash-panel-visible,
  .app.mobile-stacked-layout.works-panel-visible,
  .app.mobile-stacked-layout.clash-panel-visible.works-panel-visible,
  .app.mobile-stacked-layout.sidebar-collapsed.clash-panel-visible,
  .app.mobile-stacked-layout.sidebar-collapsed.works-panel-visible,
  .app.mobile-stacked-layout.sidebar-collapsed.clash-panel-visible.works-panel-visible,
  .app.mobile-stacked-layout.mobile-sidebar-open,
  .app.mobile-stacked-layout.mobile-properties-open,
  .app.mobile-stacked-layout.mobile-data-open,
  .app.mobile-stacked-layout.mobile-sidebar-open.mobile-properties-open {
    grid-row: 2 !important;
    height: 100% !important;
    max-height: 100% !important;
    min-height: 0 !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
  }

  body.viewer-pseudo-fullscreen .app-shell {
    grid-template-rows: auto minmax(0, 1fr) !important;
  }

  body.viewer-pseudo-fullscreen .app.mobile-stacked-layout,
  :fullscreen .app.mobile-stacked-layout,
  :-webkit-full-screen .app.mobile-stacked-layout {
    height: 100% !important;
    max-height: 100% !important;
  }

  .app.mobile-stacked-layout:not(.mobile-sidebar-open):not(.mobile-properties-open):not(.mobile-data-open):not(.clash-panel-visible):not(.works-panel-visible) {
    overflow: hidden !important;
  }

  .app.mobile-stacked-layout:not(.mobile-sidebar-open):not(.mobile-properties-open):not(.mobile-data-open):not(.clash-panel-visible):not(.works-panel-visible) > .viewer-column {
    order: 1 !important;
    flex: 1 1 auto !important;
    height: 100% !important;
    min-height: 0 !important;
    max-height: none !important;
    overflow: hidden !important;
  }

  .app.mobile-stacked-layout:not(.mobile-sidebar-open):not(.mobile-properties-open):not(.mobile-data-open):not(.clash-panel-visible):not(.works-panel-visible) .viewer-card {
    height: 100% !important;
    min-height: 0 !important;
    max-height: none !important;
    flex: 1 1 auto !important;
  }

  .app.mobile-stacked-layout:not(.mobile-sidebar-open):not(.mobile-properties-open):not(.mobile-data-open):not(.clash-panel-visible):not(.works-panel-visible) #viewerCanvas {
    height: 100% !important;
  }

  .app.mobile-stacked-layout.mobile-sidebar-open > .sidebar,
  .app.mobile-stacked-layout.mobile-properties-open > .properties-column,
  .app.mobile-stacked-layout.mobile-data-open #massInfoPanel,
  .app.mobile-stacked-layout.clash-panel-visible > #clashPanel,
  .app.mobile-stacked-layout.works-panel-visible > #worksPanel {
    flex: 0 0 auto !important;
  }

  .app.mobile-stacked-layout.mobile-sidebar-open > .sidebar {
    height: min(42dvh, 430px) !important;
    max-height: min(42dvh, 430px) !important;
    min-height: 185px !important;
  }

  .app.mobile-stacked-layout.mobile-properties-open > .properties-column {
    height: min(38dvh, 390px) !important;
    max-height: min(38dvh, 390px) !important;
    min-height: 165px !important;
  }

  .app.mobile-stacked-layout.mobile-data-open #massInfoPanel {
    height: min(44dvh, 460px) !important;
    max-height: min(44dvh, 460px) !important;
    min-height: 210px !important;
  }

  .app.mobile-stacked-layout.clash-panel-visible > #clashPanel {
    height: min(52dvh, 520px) !important;
    max-height: min(52dvh, 520px) !important;
    min-height: 230px !important;
  }

  .app.mobile-stacked-layout.works-panel-visible > #worksPanel {
    height: min(56dvh, 560px) !important;
    max-height: min(56dvh, 560px) !important;
    min-height: 260px !important;
  }

  .app.mobile-stacked-layout:not(:not(.mobile-sidebar-open):not(.mobile-properties-open):not(.mobile-data-open):not(.clash-panel-visible):not(.works-panel-visible)) > .viewer-column {
    min-height: 300px !important;
    height: auto !important;
  }

  .app.mobile-stacked-layout:not(:not(.mobile-sidebar-open):not(.mobile-properties-open):not(.mobile-data-open):not(.clash-panel-visible):not(.works-panel-visible)) .viewer-card {
    height: clamp(300px, 50dvh, 560px) !important;
    min-height: 300px !important;
  }

  .mobile-panel-buttons {
    position: absolute !important;
    top: max(8px, env(safe-area-inset-top)) !important;
    left: 8px !important;
    right: 72px !important;
    width: auto !important;
    max-width: none !important;
    display: flex !important;
    flex-wrap: wrap !important;
    align-items: flex-start !important;
    justify-content: flex-start !important;
    gap: 4px !important;
    padding: 0 !important;
    overflow: visible !important;
    z-index: 80 !important;
    pointer-events: auto !important;
  }

  .mobile-panel-button {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    height: 24px !important;
    min-height: 24px !important;
    min-width: 0 !important;
    max-width: 100% !important;
    padding: 0 7px !important;
    font-size: 10px !important;
    line-height: 1 !important;
    flex: 0 0 auto !important;
  }

  .view-cube {
    top: 8px !important;
    right: 8px !important;
    z-index: 70 !important;
  }

  .viewer-actions.floating-actions,
  .floating-actions {
    left: 8px !important;
    right: 8px !important;
    bottom: 8px !important;
    top: auto !important;
    transform: none !important;
    width: auto !important;
    max-width: none !important;
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: wrap !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 4px !important;
    padding: 4px !important;
    overflow: visible !important;
    border-radius: 12px !important;
    z-index: 75 !important;
  }

  .viewer-actions button,
  .viewer-actions button.measure-mini-button {
    display: inline-grid !important;
    place-items: center !important;
    width: 28px !important;
    height: 28px !important;
    min-width: 28px !important;
    min-height: 28px !important;
    padding: 0 !important;
    flex: 0 0 auto !important;
  }

  .viewer-actions .tool-icon {
    width: 17px !important;
    height: 17px !important;
  }
}

@media (max-width: 380px), (pointer: coarse) and (max-width: 380px) {
  .mobile-panel-buttons {
    right: 66px !important;
    gap: 3px !important;
  }

  .mobile-panel-button {
    height: 22px !important;
    min-height: 22px !important;
    padding: 0 5px !important;
    font-size: 9px !important;
  }

  .viewer-actions button,
  .viewer-actions button.measure-mini-button {
    width: 26px !important;
    height: 26px !important;
    min-width: 26px !important;
    min-height: 26px !important;
  }

  .fullscreen-toggle-button,
  .header-upload,
  .header-guide-link {
    padding: 0 7px !important;
    font-size: 10px !important;
  }
}

/* v38b - Compatibilidad móvil sin depender de selectores :not() complejos */
@media (max-width: 1100px), (pointer: coarse) and (max-width: 1400px) {
  .app.mobile-stacked-layout.mobile-sidebar-open > .viewer-column,
  .app.mobile-stacked-layout.mobile-properties-open > .viewer-column,
  .app.mobile-stacked-layout.mobile-data-open > .viewer-column,
  .app.mobile-stacked-layout.clash-panel-visible > .viewer-column,
  .app.mobile-stacked-layout.works-panel-visible > .viewer-column {
    min-height: 300px !important;
    height: auto !important;
    flex: 0 0 auto !important;
    overflow: visible !important;
  }

  .app.mobile-stacked-layout.mobile-sidebar-open .viewer-card,
  .app.mobile-stacked-layout.mobile-properties-open .viewer-card,
  .app.mobile-stacked-layout.mobile-data-open .viewer-card,
  .app.mobile-stacked-layout.clash-panel-visible .viewer-card,
  .app.mobile-stacked-layout.works-panel-visible .viewer-card {
    height: clamp(300px, 50dvh, 560px) !important;
    min-height: 300px !important;
    max-height: none !important;
    flex: 0 0 auto !important;
  }
}

/* ===== Panel 2D - láminas exportadas desde Revit ===== */
.plans-toggle-button.active,
.mobile-panel-button.active#mobilePlansPanelButton {
  background: rgba(255, 255, 255, 0.18);
  border-color: rgba(255, 255, 255, 0.75);
}

.plans-drawer {
  position: fixed;
  top: 58px;
  right: 14px;
  bottom: 14px;
  width: min(920px, calc(100vw - 28px));
  z-index: 80;
  display: block;
  background: rgba(10, 16, 25, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 14px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.38);
  overflow: hidden;
}

.plans-drawer.hidden {
  display: none !important;
}

.plans-panel {
  height: 100%;
  display: grid;
  grid-template-rows: auto 1fr;
  background: transparent;
  border: 0;
  min-height: 0;
}

.plans-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  color: #ffffff;
}

.plans-header h2 {
  margin: 0;
  font-size: 18px;
  line-height: 1.15;
}

.plans-status {
  display: block;
  margin-top: 3px;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.68);
}

.plans-close-button {
  width: 30px;
  height: 30px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
}

.plans-close-button:hover {
  background: rgba(255, 255, 255, 0.16);
}

.plans-body {
  min-height: 0;
  display: grid;
  grid-template-columns: 290px 1fr;
  gap: 0;
}

.plans-list-wrap {
  min-height: 0;
  display: grid;
  grid-template-rows: auto 1fr;
  border-right: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(0, 0, 0, 0.18);
}

.plans-search-row {
  margin: 10px;
}

.plans-list {
  min-height: 0;
  overflow: auto;
  padding: 0 8px 12px;
}

.plans-list.empty {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  color: rgba(255, 255, 255, 0.62);
  font-size: 13px;
  text-align: center;
}

.plans-model-group {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 8px 7px 5px;
  background: #101823;
  color: rgba(255, 255, 255, 0.78);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.plans-item {
  width: 100%;
  display: block;
  text-align: left;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.045);
  color: #ffffff;
  padding: 9px 10px;
  margin: 6px 0;
  cursor: pointer;
}

.plans-item:hover,
.plans-item.active {
  background: rgba(0, 102, 204, 0.40);
  border-color: rgba(90, 170, 255, 0.75);
}

.plans-item strong {
  display: block;
  font-size: 13px;
  line-height: 1.25;
}

.plans-item span {
  display: block;
  margin-top: 4px;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.62);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.plans-viewer-wrap {
  position: relative;
  min-height: 0;
  background: #1f2329;
}

.plans-viewer {
  width: 100%;
  height: 100%;
  border: 0;
  display: none;
  background: #2a2f36;
}

.plans-viewer.active {
  display: block;
}

.plans-viewer-empty {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  color: rgba(255, 255, 255, 0.62);
  text-align: center;
  font-size: 14px;
}

.plans-viewer-empty.hidden {
  display: none;
}

@media (max-width: 760px) {
  .plans-drawer {
    top: var(--mobile-header-height, 104px);
    right: 8px;
    left: 8px;
    bottom: 8px;
    width: auto;
    border-radius: 12px;
  }

  .plans-body {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(150px, 34%) 1fr;
  }

  .plans-list-wrap {
    border-right: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  }

  .plans-header {
    padding: 10px 12px;
  }

  .plans-viewer-wrap {
    min-height: 220px;
  }
}

/* ===== Mejoras panel 2D v3: splits, árbol compacto y visor PDF propio ===== */
.plans-drawer {
  width: var(--plans-drawer-width, min(1040px, calc(100vw - 28px)));
  min-width: min(520px, calc(100vw - 28px));
  max-width: calc(100vw - 28px);
}

.plans-drawer-resizer {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 8px;
  z-index: 5;
  cursor: col-resize;
  background: transparent;
}

.plans-drawer-resizer::after {
  content: '';
  position: absolute;
  top: 12px;
  bottom: 12px;
  left: 3px;
  width: 2px;
  border-radius: 2px;
  background: rgba(80, 170, 255, 0.0);
  transition: background 0.16s ease;
}

.plans-drawer-resizer:hover::after,
body.plans-resizing .plans-drawer-resizer::after {
  background: rgba(80, 170, 255, 0.9);
}

body.plans-resizing,
body.plans-list-resizing {
  user-select: none;
  cursor: col-resize;
}

.plans-body {
  grid-template-columns: var(--plans-list-width, 384px) 7px minmax(0, 1fr);
}

.plans-list-resizer {
  position: relative;
  min-width: 7px;
  cursor: col-resize;
  background: rgba(255, 255, 255, 0.04);
  border-left: 1px solid rgba(255, 255, 255, 0.08);
  border-right: 1px solid rgba(255, 255, 255, 0.08);
}

.plans-list-resizer::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 2px;
  height: 52px;
  transform: translate(-50%, -50%);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.28);
}

.plans-list-resizer:hover::after,
body.plans-list-resizing .plans-list-resizer::after {
  background: rgba(80, 170, 255, 0.95);
}

.plans-list-wrap {
  min-width: 0;
}

.plans-list {
  padding: 0 8px 12px 10px;
}

.plans-tree-folder {
  margin: 8px 0 4px;
}

.plans-tree-folder-title {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  padding: 7px 8px;
  border-radius: 8px;
  background: rgba(0, 122, 255, 0.13);
  border: 1px solid rgba(80, 170, 255, 0.20);
  color: rgba(226, 243, 255, 0.92);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.035em;
  text-transform: uppercase;
}

.plans-tree-folder-title::before {
  content: '▸';
  color: rgba(80, 170, 255, 0.95);
  font-size: 10px;
}

.plans-tree-folder-title span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.plans-tree-folder-items {
  padding-left: 10px;
  border-left: 1px dashed rgba(80, 170, 255, 0.22);
  margin-left: 8px;
}

.plans-model-group {
  position: relative;
  top: auto;
  z-index: auto;
  margin: 8px 0 4px;
  padding: 7px 8px;
  border-radius: 8px;
  background: rgba(0, 122, 255, 0.13);
  border: 1px solid rgba(80, 170, 255, 0.20);
}

.plans-item {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  padding: 7px 9px;
  margin: 4px 0;
  border-radius: 8px;
}

.plans-item::before {
  content: 'PDF';
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 19px;
  border-radius: 5px;
  background: rgba(0, 122, 255, 0.28);
  color: #cfeaff;
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.03em;
}

.plans-item strong {
  min-width: 0;
  font-size: 12px;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.plans-item span {
  display: none !important;
}

.plans-viewer-wrap {
  min-width: 0;
  overflow: hidden;
}

.plans-viewer {
  background: #202326;
}

.plans-pdf-viewer {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-rows: auto 1fr;
  background: #202326;
  color: #ffffff;
  z-index: 1;
}

.plans-pdf-viewer.hidden {
  display: none !important;
}

.plans-pdf-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 42px;
  padding: 6px 8px;
  background: rgba(25, 28, 33, 0.96);
  border-bottom: 1px solid rgba(255, 255, 255, 0.10);
}

.plans-pdf-toolbar-left,
.plans-pdf-toolbar-right {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.plans-pdf-tool {
  min-width: 32px;
  height: 30px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.075);
  color: #f8fbff;
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
  padding: 0 9px;
}

.plans-pdf-tool:hover {
  background: rgba(0, 122, 255, 0.32);
  border-color: rgba(80, 170, 255, 0.78);
}

.plans-pdf-zoom-value {
  min-width: 48px;
  text-align: center;
  color: rgba(255, 255, 255, 0.82);
  font-size: 12px;
  font-weight: 800;
}

.plans-pdf-stage {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background:
    radial-gradient(circle at 24px 24px, rgba(255,255,255,0.05) 1px, transparent 1px),
    #24272c;
  background-size: 24px 24px;
  cursor: grab;
  touch-action: none;
}

.plans-pdf-stage.panning {
  cursor: grabbing;
}

.plans-pdf-canvas {
  position: absolute;
  top: 0;
  left: 0;
  transform-origin: 0 0;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.42);
  background: #ffffff;
}

.plans-pdf-loading {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  padding: 10px 13px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.72);
  color: #ffffff;
  font-size: 13px;
  font-weight: 800;
  pointer-events: none;
}

.plans-pdf-loading.hidden {
  display: none !important;
}

.plans-native-mode .plans-pdf-viewer {
  display: none !important;
}

.plans-native-mode .plans-viewer.active {
  display: block;
}

@media (max-width: 760px) {
  .plans-drawer {
    width: auto !important;
    min-width: 0;
  }

  .plans-drawer-resizer {
    display: none;
  }

  body.plans-list-resizing {
    cursor: row-resize;
  }

  .plans-body {
    grid-template-columns: 1fr;
    grid-template-rows: var(--plans-list-mobile-height, 32%) 7px minmax(0, 1fr);
  }

  .plans-list-resizer {
    min-width: 0;
    min-height: 7px;
    cursor: row-resize;
    border-left: 0;
    border-right: 0;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  }

  .plans-list-resizer::after {
    width: 52px;
    height: 2px;
  }

  .plans-tree-folder-items {
    padding-left: 8px;
    margin-left: 6px;
  }

  .plans-pdf-toolbar {
    flex-wrap: wrap;
  }

  .plans-pdf-toolbar-right {
    margin-left: auto;
  }
}

/* ===== Panel 2D v4: integrado al layout, árbol real y visor con retorno ===== */
.app:not(.plans-panel-visible) > #plansPanel,
.app:not(.plans-panel-visible) > #plansColumnSplitter {
  display: none !important;
}

.app.plans-panel-visible:not(.clash-panel-visible):not(.works-panel-visible) {
  display: grid !important;
  grid-template-columns: var(--sidebar-width, 330px) 10px minmax(0, 1fr) 10px var(--properties-width, 360px) 10px var(--plans-width, 760px) !important;
  grid-template-rows: minmax(0, 1fr) !important;
}
.app.sidebar-collapsed.plans-panel-visible:not(.clash-panel-visible):not(.works-panel-visible) {
  grid-template-columns: 52px 0 minmax(0, 1fr) 10px var(--properties-width, 360px) 10px var(--plans-width, 760px) !important;
}
.app.plans-panel-visible:not(.clash-panel-visible):not(.works-panel-visible) > .sidebar { grid-column: 1 !important; grid-row: 1 !important; }
.app.plans-panel-visible:not(.clash-panel-visible):not(.works-panel-visible) > #columnSplitter { grid-column: 2 !important; grid-row: 1 !important; }
.app.plans-panel-visible:not(.clash-panel-visible):not(.works-panel-visible) > .viewer-column { grid-column: 3 !important; grid-row: 1 !important; min-width: 0 !important; }
.app.plans-panel-visible:not(.clash-panel-visible):not(.works-panel-visible) > #propertiesSplitter { grid-column: 4 !important; grid-row: 1 !important; }
.app.plans-panel-visible:not(.clash-panel-visible):not(.works-panel-visible) > .properties-column { grid-column: 5 !important; grid-row: 1 !important; min-width: 0 !important; }
.app.plans-panel-visible:not(.clash-panel-visible):not(.works-panel-visible) > #plansColumnSplitter { grid-column: 6 !important; grid-row: 1 !important; display: block !important; }
.app.plans-panel-visible:not(.clash-panel-visible):not(.works-panel-visible) > #plansPanel { grid-column: 7 !important; grid-row: 1 !important; display: block !important; }

.app.plans-panel-visible.clash-panel-visible:not(.works-panel-visible) {
  grid-template-columns: var(--sidebar-width, 330px) 10px minmax(0, 1fr) 10px var(--properties-width, 360px) 10px var(--clash-width, 430px) 10px var(--plans-width, 760px) !important;
}
.app.sidebar-collapsed.plans-panel-visible.clash-panel-visible:not(.works-panel-visible) {
  grid-template-columns: 52px 0 minmax(0, 1fr) 10px var(--properties-width, 360px) 10px var(--clash-width, 430px) 10px var(--plans-width, 760px) !important;
}
.app.plans-panel-visible.clash-panel-visible:not(.works-panel-visible) > #plansColumnSplitter { grid-column: 8 !important; grid-row: 1 !important; display: block !important; }
.app.plans-panel-visible.clash-panel-visible:not(.works-panel-visible) > #plansPanel { grid-column: 9 !important; grid-row: 1 !important; display: block !important; }

.app.plans-panel-visible.works-panel-visible:not(.clash-panel-visible) {
  grid-template-columns: var(--sidebar-width, 330px) 10px minmax(0, 1fr) 10px var(--properties-width, 360px) 10px var(--works-width, 720px) 10px var(--plans-width, 760px) !important;
}
.app.sidebar-collapsed.plans-panel-visible.works-panel-visible:not(.clash-panel-visible) {
  grid-template-columns: 52px 0 minmax(0, 1fr) 10px var(--properties-width, 360px) 10px var(--works-width, 720px) 10px var(--plans-width, 760px) !important;
}
.app.plans-panel-visible.works-panel-visible:not(.clash-panel-visible) > #plansColumnSplitter { grid-column: 8 !important; grid-row: 1 !important; display: block !important; }
.app.plans-panel-visible.works-panel-visible:not(.clash-panel-visible) > #plansPanel { grid-column: 9 !important; grid-row: 1 !important; display: block !important; }

.app.plans-panel-visible.clash-panel-visible.works-panel-visible {
  grid-template-columns: var(--sidebar-width, 330px) 10px minmax(0, 1fr) 10px var(--properties-width, 360px) 10px var(--clash-width, 430px) 10px var(--works-width, 720px) 10px var(--plans-width, 760px) !important;
}
.app.sidebar-collapsed.plans-panel-visible.clash-panel-visible.works-panel-visible {
  grid-template-columns: 52px 0 minmax(0, 1fr) 10px var(--properties-width, 360px) 10px var(--clash-width, 430px) 10px var(--works-width, 720px) 10px var(--plans-width, 760px) !important;
}
.app.plans-panel-visible.clash-panel-visible.works-panel-visible > #plansColumnSplitter { grid-column: 10 !important; grid-row: 1 !important; display: block !important; }
.app.plans-panel-visible.clash-panel-visible.works-panel-visible > #plansPanel { grid-column: 11 !important; grid-row: 1 !important; display: block !important; }

.app.plans-panel-visible > #plansPanel {
  position: relative !important;
  inset: auto !important;
  top: auto !important;
  right: auto !important;
  bottom: auto !important;
  left: auto !important;
  width: var(--plans-width, 760px) !important;
  min-width: 0 !important;
  max-width: var(--plans-width, 760px) !important;
  height: auto !important;
  min-height: 0 !important;
  z-index: 2 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  overflow: hidden !important;
}

.plans-column-splitter {
  cursor: col-resize !important;
  pointer-events: auto !important;
  touch-action: none;
  z-index: 12;
  background: rgba(51, 65, 85, 0.85);
}
.plans-column-splitter.dragging,
body.plans-resizing .plans-column-splitter {
  background: #38bdf8 !important;
}
.plans-drawer-resizer { display: none !important; }

.plans-panel {
  grid-template-rows: 1fr !important;
  position: relative;
  border-radius: 0 !important;
  box-shadow: none !important;
}
.plans-header { display: none !important; }
.plans-close-floating {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 9;
  width: 30px;
  height: 30px;
}
.plans-body {
  min-height: 0;
  height: 100%;
  grid-template-columns: var(--plans-list-width, 384px) 7px minmax(0, 1fr) !important;
}
.plans-search-row {
  margin: 10px 10px 6px 10px !important;
}
.plans-counter-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0 10px 8px;
  min-height: 20px;
}
.plans-status {
  display: inline-flex !important;
  align-items: center;
  min-height: 20px;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid rgba(80, 170, 255, 0.28);
  background: rgba(0, 122, 255, 0.12);
  color: rgba(215, 236, 255, 0.88) !important;
  font-size: 11px !important;
  font-weight: 800;
  margin: 0 !important;
}

.plans-list {
  scrollbar-width: thin;
  scrollbar-color: rgba(80, 170, 255, 0.60) rgba(15, 23, 42, 0.65);
}
.plans-list::-webkit-scrollbar,
.plans-pdf-stage::-webkit-scrollbar,
.plans-viewer-wrap::-webkit-scrollbar {
  width: 9px;
  height: 9px;
}
.plans-list::-webkit-scrollbar-track,
.plans-pdf-stage::-webkit-scrollbar-track,
.plans-viewer-wrap::-webkit-scrollbar-track {
  background: rgba(15, 23, 42, 0.65);
  border-radius: 999px;
}
.plans-list::-webkit-scrollbar-thumb,
.plans-pdf-stage::-webkit-scrollbar-thumb,
.plans-viewer-wrap::-webkit-scrollbar-thumb {
  background: rgba(80, 170, 255, 0.58);
  border-radius: 999px;
  border: 2px solid rgba(15, 23, 42, 0.65);
}
.plans-list::-webkit-scrollbar-thumb:hover,
.plans-pdf-stage::-webkit-scrollbar-thumb:hover,
.plans-viewer-wrap::-webkit-scrollbar-thumb:hover {
  background: rgba(125, 196, 255, 0.86);
}

.plans-tree-branch {
  margin: 4px 0;
  padding-left: calc(var(--plans-tree-level, 0) * 10px);
}
.plans-tree-node {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) auto;
  align-items: center;
  gap: 6px;
  min-width: 0;
  height: 30px;
  padding: 0 7px;
  border-radius: 8px;
  color: rgba(232, 244, 255, 0.94);
}
.plans-tree-node-folder {
  background: rgba(0, 122, 255, 0.13);
  border: 1px solid rgba(80, 170, 255, 0.22);
  font-weight: 850;
}
.plans-tree-node-model {
  margin-top: 5px;
  background: rgba(255, 255, 255, 0.055);
  border: 1px solid rgba(255, 255, 255, 0.11);
  font-weight: 800;
}
.plans-tree-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: rgba(0, 122, 255, 0.16);
  font-size: 13px;
}
.plans-tree-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11px;
  letter-spacing: 0.015em;
}
.plans-count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 18px;
  padding: 0 6px;
  border-radius: 999px;
  background: rgba(0, 122, 255, 0.34);
  color: #e8f5ff;
  font-size: 10px;
  font-weight: 900;
}
.plans-tree-children {
  margin-left: 11px;
  padding-left: 8px;
  border-left: 1px dashed rgba(80, 170, 255, 0.20);
}
.plans-tree-plan-items {
  padding-top: 4px;
  padding-bottom: 4px;
}
.plans-tree-folder,
.plans-tree-folder-title,
.plans-tree-folder-items {
  display: none !important;
}
.plans-item {
  min-height: 30px;
  padding: 6px 8px !important;
}
.plans-item::before {
  width: 24px !important;
  height: 18px !important;
  font-size: 8px !important;
}
.plans-item strong {
  font-size: 11px !important;
}
.plans-viewer-modebar {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 5;
  display: flex;
  gap: 6px;
  padding: 5px;
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.28);
}
.plans-viewer-modebar.hidden { display: none !important; }
.plans-viewer-modebar .plans-pdf-tool {
  height: 28px;
  min-width: 72px;
}
.plans-pdf-toolbar {
  padding-right: 84px !important;
}
.plans-native-mode .plans-viewer-modebar {
  display: flex;
}


.plans-anno-size-input {
  width: 66px;
  height: 22px;
  padding: 0 6px;
  border: 1px solid rgba(80, 170, 255, 0.28);
  border-radius: 6px;
  background: rgba(8, 15, 25, 0.95);
  color: #f8fbff;
  font-size: 11px;
  font-weight: 600;
  outline: none;
}

.plans-annotation-item {
  pointer-events: all;
  cursor: move;
}

.plans-annotation-shape,
.plans-annotation-text-box {
  pointer-events: visibleStroke;
}

.plans-annotation-hit {
  fill: none;
  stroke: rgba(255, 255, 255, 0.001);
  pointer-events: stroke;
}

.plans-annotation-text-box {
  fill: rgba(255, 255, 255, 0.02);
  stroke-dasharray: 0.008 0.005;
}

.plans-annotation-selection-box {
  fill: rgba(56, 189, 248, 0.04);
  stroke: rgba(125, 211, 252, 0.95);
  stroke-width: 0.0014;
  stroke-dasharray: 0.006 0.004;
  pointer-events: none;
}

.plans-annotation-handle {
  fill: #ffffff;
  stroke: #0ea5e9;
  stroke-width: 0.0012;
  pointer-events: all;
}

.plans-pdf-stage.editing-annotation,
.plans-pdf-stage.editing-annotation .plans-annotation-item {
  cursor: grabbing;
}

.plans-annotation-text-editor {
  position: absolute;
  z-index: 8;
  min-width: 120px;
  min-height: 54px;
  padding: 7px;
  border: 2px solid rgba(14, 165, 233, 0.95);
  border-radius: 8px;
  background: rgba(2, 6, 23, 0.90);
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.38), 0 0 0 1px rgba(255, 255, 255, 0.08) inset;
  color: #f8fbff;
  resize: both;
  overflow: auto;
}

.plans-text-editor-body {
  min-width: 110px;
  min-height: 34px;
  width: max-content;
  max-width: none;
  outline: none;
  white-space: pre-wrap;
  word-break: normal;
  overflow-wrap: anywhere;
  line-height: 1.25;
  font-family: Arial, Helvetica, sans-serif;
  font-weight: 400;
  color: inherit;
}

.plans-text-editor-actions {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
  margin-top: 6px;
}

.plans-text-editor-actions button {
  height: 24px;
  padding: 0 10px;
  border: 1px solid rgba(80, 170, 255, 0.45);
  border-radius: 6px;
  background: rgba(14, 116, 204, 0.42);
  color: #ffffff;
  font-family: inherit;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}

.plans-folder-editor-panel,
.plans-folder-editor-panel *:not(button):not(input) {
  font-weight: 400 !important;
}

.plans-folder-editor-column-title {
  font-weight: 600 !important;
}

@media (max-width: 760px), (pointer: coarse) and (max-width: 1100px) {
  .app.mobile-stacked-layout.plans-panel-visible,
  .app.mobile-stacked-layout.sidebar-collapsed.plans-panel-visible,
  .app.mobile-stacked-layout.plans-panel-visible.clash-panel-visible,
  .app.mobile-stacked-layout.plans-panel-visible.works-panel-visible,
  .app.mobile-stacked-layout.plans-panel-visible.clash-panel-visible.works-panel-visible {
    display: flex !important;
    flex-direction: column !important;
    grid-template-columns: none !important;
    grid-template-rows: none !important;
    overflow: auto !important;
  }
  .app.mobile-stacked-layout > #plansColumnSplitter {
    display: none !important;
  }
  .app.mobile-stacked-layout.plans-panel-visible > #plansPanel {
    display: block !important;
    position: relative !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    height: clamp(380px, 72dvh, 760px) !important;
    min-height: 380px !important;
    flex: 0 0 auto !important;
    border-radius: 12px !important;
    border: 1px solid rgba(255, 255, 255, 0.12) !important;
    overflow: hidden !important;
  }
  .app.mobile-stacked-layout:not(.plans-panel-visible) > #plansPanel {
    display: none !important;
  }
  .app.mobile-stacked-layout.plans-panel-visible > .viewer-column {
    min-height: 300px !important;
    height: auto !important;
    flex: 0 0 auto !important;
  }
  .app.mobile-stacked-layout.plans-panel-visible .viewer-card {
    height: clamp(300px, 48dvh, 560px) !important;
    min-height: 300px !important;
    flex: 0 0 auto !important;
  }
  .plans-body {
    grid-template-columns: 1fr !important;
    grid-template-rows: var(--plans-list-mobile-height, 34%) 7px minmax(0, 1fr) !important;
  }
  .plans-search-row {
    margin-right: 10px !important;
  }
  .plans-tree-node {
    height: 29px;
  }
  .plans-viewer-modebar {
    top: 6px;
    right: 6px;
  }
  .plans-pdf-toolbar {
    padding-right: 6px !important;
  }
}

/* ===== Ajustes panel 2D v5: árbol arriba + visor libre único ===== */
.plans-list-wrap {
  grid-template-rows: auto auto minmax(0, 1fr) !important;
  align-content: stretch !important;
}

.plans-list {
  align-self: stretch !important;
  min-height: 0 !important;
}

.plans-counter-row {
  align-self: start !important;
}

.plans-pdf-toolbar {
  justify-content: flex-start !important;
  padding-right: 8px !important;
  overflow: hidden;
}

.plans-pdf-toolbar-left {
  flex: 1 1 auto;
  max-width: 100%;
  flex-wrap: wrap;
}

.plans-pdf-toolbar-right,
.plans-viewer-modebar,
.plans-viewer,
.plans-native-mode .plans-viewer.active {
  display: none !important;
}

.plans-pdf-tool-icon {
  width: 32px;
  min-width: 32px;
  padding: 0 !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.plans-pdf-tool-text {
  min-width: 62px;
}

.plans-pdf-tool svg {
  width: 16px;
  height: 16px;
  display: block;
  pointer-events: none;
}

.plans-pdf-zoom-value {
  min-width: 54px;
  padding: 0 6px;
}


.plans-anno-size-input {
  width: 66px;
  height: 22px;
  padding: 0 6px;
  border: 1px solid rgba(80, 170, 255, 0.28);
  border-radius: 6px;
  background: rgba(8, 15, 25, 0.95);
  color: #f8fbff;
  font-size: 11px;
  font-weight: 600;
  outline: none;
}

.plans-annotation-item {
  pointer-events: all;
  cursor: move;
}

.plans-annotation-shape,
.plans-annotation-text-box {
  pointer-events: visibleStroke;
}

.plans-annotation-hit {
  fill: none;
  stroke: rgba(255, 255, 255, 0.001);
  pointer-events: stroke;
}

.plans-annotation-text-box {
  fill: rgba(255, 255, 255, 0.02);
  stroke-dasharray: 0.008 0.005;
}

.plans-annotation-selection-box {
  fill: rgba(56, 189, 248, 0.04);
  stroke: rgba(125, 211, 252, 0.95);
  stroke-width: 0.0014;
  stroke-dasharray: 0.006 0.004;
  pointer-events: none;
}

.plans-annotation-handle {
  fill: #ffffff;
  stroke: #0ea5e9;
  stroke-width: 0.0012;
  pointer-events: all;
}

.plans-pdf-stage.editing-annotation,
.plans-pdf-stage.editing-annotation .plans-annotation-item {
  cursor: grabbing;
}

.plans-annotation-text-editor {
  position: absolute;
  z-index: 8;
  min-width: 120px;
  min-height: 54px;
  padding: 7px;
  border: 2px solid rgba(14, 165, 233, 0.95);
  border-radius: 8px;
  background: rgba(2, 6, 23, 0.90);
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.38), 0 0 0 1px rgba(255, 255, 255, 0.08) inset;
  color: #f8fbff;
  resize: both;
  overflow: auto;
}

.plans-text-editor-body {
  min-width: 110px;
  min-height: 34px;
  width: max-content;
  max-width: none;
  outline: none;
  white-space: pre-wrap;
  word-break: normal;
  overflow-wrap: anywhere;
  line-height: 1.25;
  font-family: Arial, Helvetica, sans-serif;
  font-weight: 400;
  color: inherit;
}

.plans-text-editor-actions {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
  margin-top: 6px;
}

.plans-text-editor-actions button {
  height: 24px;
  padding: 0 10px;
  border: 1px solid rgba(80, 170, 255, 0.45);
  border-radius: 6px;
  background: rgba(14, 116, 204, 0.42);
  color: #ffffff;
  font-family: inherit;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}

.plans-folder-editor-panel,
.plans-folder-editor-panel *:not(button):not(input) {
  font-weight: 400 !important;
}

.plans-folder-editor-column-title {
  font-weight: 600 !important;
}

@media (max-width: 760px), (pointer: coarse) and (max-width: 1100px) {
  .plans-list-wrap {
    grid-template-rows: auto auto minmax(0, 1fr) !important;
  }

  .plans-pdf-toolbar {
    min-height: 40px;
    padding: 5px 6px !important;
  }

  .plans-pdf-toolbar-left {
    gap: 5px;
  }

  .plans-pdf-tool-text {
    min-width: 58px;
  }
}


/* ===== Corrección v6: el panel 2D no debe reservar espacio de Control/Propiedades si están cerrados =====
   Estas reglas sólo actúan cuando el panel 2D está abierto en escritorio. El comportamiento existente
   de Panel de Control, Propiedades, Interferencias y Obras queda intacto. */
@media (min-width: 761px) {
  .app.plans-panel-visible:not(.mobile-stacked-layout):not(.clash-panel-visible):not(.works-panel-visible) {
    display: grid !important;
    grid-template-columns: var(--sidebar-width, 330px) 10px minmax(0, 1fr) 10px var(--properties-width, 360px) 10px var(--plans-width, 760px) !important;
    grid-template-rows: minmax(0, 1fr) !important;
  }
  .app.sidebar-collapsed.plans-panel-visible:not(.mobile-stacked-layout):not(.clash-panel-visible):not(.works-panel-visible) {
    grid-template-columns: 52px 0 minmax(0, 1fr) 10px var(--properties-width, 360px) 10px var(--plans-width, 760px) !important;
  }
  .app.plans-panel-visible:not(.mobile-stacked-layout):not(.mobile-sidebar-open):not(.clash-panel-visible):not(.works-panel-visible) {
    grid-template-columns: 0 0 minmax(0, 1fr) 10px var(--properties-width, 360px) 10px var(--plans-width, 760px) !important;
  }
  .app.plans-panel-visible:not(.mobile-stacked-layout):not(.mobile-properties-open):not(.clash-panel-visible):not(.works-panel-visible) {
    grid-template-columns: var(--sidebar-width, 330px) 10px minmax(0, 1fr) 0 0 10px var(--plans-width, 760px) !important;
  }
  .app.sidebar-collapsed.plans-panel-visible:not(.mobile-stacked-layout):not(.mobile-properties-open):not(.clash-panel-visible):not(.works-panel-visible) {
    grid-template-columns: 52px 0 minmax(0, 1fr) 0 0 10px var(--plans-width, 760px) !important;
  }
  .app.plans-panel-visible:not(.mobile-stacked-layout):not(.mobile-sidebar-open):not(.mobile-properties-open):not(.clash-panel-visible):not(.works-panel-visible) {
    grid-template-columns: 0 0 minmax(0, 1fr) 0 0 10px var(--plans-width, 760px) !important;
  }

  .app.plans-panel-visible:not(.mobile-stacked-layout).clash-panel-visible:not(.works-panel-visible) {
    display: grid !important;
    grid-template-columns: var(--sidebar-width, 330px) 10px minmax(0, 1fr) 10px var(--properties-width, 360px) 10px var(--clash-width, 430px) 10px var(--plans-width, 760px) !important;
    grid-template-rows: minmax(0, 1fr) !important;
  }
  .app.sidebar-collapsed.plans-panel-visible:not(.mobile-stacked-layout).clash-panel-visible:not(.works-panel-visible) {
    grid-template-columns: 52px 0 minmax(0, 1fr) 10px var(--properties-width, 360px) 10px var(--clash-width, 430px) 10px var(--plans-width, 760px) !important;
  }
  .app.plans-panel-visible:not(.mobile-stacked-layout):not(.mobile-sidebar-open).clash-panel-visible:not(.works-panel-visible) {
    grid-template-columns: 0 0 minmax(0, 1fr) 10px var(--properties-width, 360px) 10px var(--clash-width, 430px) 10px var(--plans-width, 760px) !important;
  }
  .app.plans-panel-visible:not(.mobile-stacked-layout):not(.mobile-properties-open).clash-panel-visible:not(.works-panel-visible) {
    grid-template-columns: var(--sidebar-width, 330px) 10px minmax(0, 1fr) 0 0 10px var(--clash-width, 430px) 10px var(--plans-width, 760px) !important;
  }
  .app.sidebar-collapsed.plans-panel-visible:not(.mobile-stacked-layout):not(.mobile-properties-open).clash-panel-visible:not(.works-panel-visible) {
    grid-template-columns: 52px 0 minmax(0, 1fr) 0 0 10px var(--clash-width, 430px) 10px var(--plans-width, 760px) !important;
  }
  .app.plans-panel-visible:not(.mobile-stacked-layout):not(.mobile-sidebar-open):not(.mobile-properties-open).clash-panel-visible:not(.works-panel-visible) {
    grid-template-columns: 0 0 minmax(0, 1fr) 0 0 10px var(--clash-width, 430px) 10px var(--plans-width, 760px) !important;
  }

  .app.plans-panel-visible:not(.mobile-stacked-layout).works-panel-visible:not(.clash-panel-visible) {
    display: grid !important;
    grid-template-columns: var(--sidebar-width, 330px) 10px minmax(0, 1fr) 10px var(--properties-width, 360px) 10px var(--works-width, 720px) 10px var(--plans-width, 760px) !important;
    grid-template-rows: minmax(0, 1fr) !important;
  }
  .app.sidebar-collapsed.plans-panel-visible:not(.mobile-stacked-layout).works-panel-visible:not(.clash-panel-visible) {
    grid-template-columns: 52px 0 minmax(0, 1fr) 10px var(--properties-width, 360px) 10px var(--works-width, 720px) 10px var(--plans-width, 760px) !important;
  }
  .app.plans-panel-visible:not(.mobile-stacked-layout):not(.mobile-sidebar-open).works-panel-visible:not(.clash-panel-visible) {
    grid-template-columns: 0 0 minmax(0, 1fr) 10px var(--properties-width, 360px) 10px var(--works-width, 720px) 10px var(--plans-width, 760px) !important;
  }
  .app.plans-panel-visible:not(.mobile-stacked-layout):not(.mobile-properties-open).works-panel-visible:not(.clash-panel-visible) {
    grid-template-columns: var(--sidebar-width, 330px) 10px minmax(0, 1fr) 0 0 10px var(--works-width, 720px) 10px var(--plans-width, 760px) !important;
  }
  .app.sidebar-collapsed.plans-panel-visible:not(.mobile-stacked-layout):not(.mobile-properties-open).works-panel-visible:not(.clash-panel-visible) {
    grid-template-columns: 52px 0 minmax(0, 1fr) 0 0 10px var(--works-width, 720px) 10px var(--plans-width, 760px) !important;
  }
  .app.plans-panel-visible:not(.mobile-stacked-layout):not(.mobile-sidebar-open):not(.mobile-properties-open).works-panel-visible:not(.clash-panel-visible) {
    grid-template-columns: 0 0 minmax(0, 1fr) 0 0 10px var(--works-width, 720px) 10px var(--plans-width, 760px) !important;
  }

  .app.plans-panel-visible:not(.mobile-stacked-layout).clash-panel-visible.works-panel-visible {
    display: grid !important;
    grid-template-columns: var(--sidebar-width, 330px) 10px minmax(0, 1fr) 10px var(--properties-width, 360px) 10px var(--clash-width, 430px) 10px var(--works-width, 720px) 10px var(--plans-width, 760px) !important;
    grid-template-rows: minmax(0, 1fr) !important;
  }
  .app.sidebar-collapsed.plans-panel-visible:not(.mobile-stacked-layout).clash-panel-visible.works-panel-visible {
    grid-template-columns: 52px 0 minmax(0, 1fr) 10px var(--properties-width, 360px) 10px var(--clash-width, 430px) 10px var(--works-width, 720px) 10px var(--plans-width, 760px) !important;
  }
  .app.plans-panel-visible:not(.mobile-stacked-layout):not(.mobile-sidebar-open).clash-panel-visible.works-panel-visible {
    grid-template-columns: 0 0 minmax(0, 1fr) 10px var(--properties-width, 360px) 10px var(--clash-width, 430px) 10px var(--works-width, 720px) 10px var(--plans-width, 760px) !important;
  }
  .app.plans-panel-visible:not(.mobile-stacked-layout):not(.mobile-properties-open).clash-panel-visible.works-panel-visible {
    grid-template-columns: var(--sidebar-width, 330px) 10px minmax(0, 1fr) 0 0 10px var(--clash-width, 430px) 10px var(--works-width, 720px) 10px var(--plans-width, 760px) !important;
  }
  .app.sidebar-collapsed.plans-panel-visible:not(.mobile-stacked-layout):not(.mobile-properties-open).clash-panel-visible.works-panel-visible {
    grid-template-columns: 52px 0 minmax(0, 1fr) 0 0 10px var(--clash-width, 430px) 10px var(--works-width, 720px) 10px var(--plans-width, 760px) !important;
  }
  .app.plans-panel-visible:not(.mobile-stacked-layout):not(.mobile-sidebar-open):not(.mobile-properties-open).clash-panel-visible.works-panel-visible {
    grid-template-columns: 0 0 minmax(0, 1fr) 0 0 10px var(--clash-width, 430px) 10px var(--works-width, 720px) 10px var(--plans-width, 760px) !important;
  }

  .app.plans-panel-visible:not(.mobile-stacked-layout) > .sidebar { grid-column: 1 !important; grid-row: 1 !important; }
  .app.plans-panel-visible:not(.mobile-stacked-layout) > #columnSplitter { grid-column: 2 !important; grid-row: 1 !important; }
  .app.plans-panel-visible:not(.mobile-stacked-layout) > .viewer-column { grid-column: 3 !important; grid-row: 1 !important; min-width: 0 !important; }
  .app.plans-panel-visible:not(.mobile-stacked-layout) > #propertiesSplitter { grid-column: 4 !important; grid-row: 1 !important; }
  .app.plans-panel-visible:not(.mobile-stacked-layout) > .properties-column { grid-column: 5 !important; grid-row: 1 !important; min-width: 0 !important; }

  .app.plans-panel-visible:not(.mobile-stacked-layout):not(.clash-panel-visible):not(.works-panel-visible) > #plansColumnSplitter { grid-column: 6 !important; grid-row: 1 !important; display: block !important; }
  .app.plans-panel-visible:not(.mobile-stacked-layout):not(.clash-panel-visible):not(.works-panel-visible) > #plansPanel { grid-column: 7 !important; grid-row: 1 !important; display: block !important; }

  .app.plans-panel-visible:not(.mobile-stacked-layout).clash-panel-visible:not(.works-panel-visible) > #clashSplitter { grid-column: 6 !important; grid-row: 1 !important; display: block !important; }
  .app.plans-panel-visible:not(.mobile-stacked-layout).clash-panel-visible:not(.works-panel-visible) > #clashPanel { grid-column: 7 !important; grid-row: 1 !important; display: block !important; }
  .app.plans-panel-visible:not(.mobile-stacked-layout).clash-panel-visible:not(.works-panel-visible) > #plansColumnSplitter { grid-column: 8 !important; grid-row: 1 !important; display: block !important; }
  .app.plans-panel-visible:not(.mobile-stacked-layout).clash-panel-visible:not(.works-panel-visible) > #plansPanel { grid-column: 9 !important; grid-row: 1 !important; display: block !important; }

  .app.plans-panel-visible:not(.mobile-stacked-layout).works-panel-visible:not(.clash-panel-visible) > #worksSplitter { grid-column: 6 !important; grid-row: 1 !important; display: block !important; }
  .app.plans-panel-visible:not(.mobile-stacked-layout).works-panel-visible:not(.clash-panel-visible) > #worksPanel { grid-column: 7 !important; grid-row: 1 !important; display: block !important; }
  .app.plans-panel-visible:not(.mobile-stacked-layout).works-panel-visible:not(.clash-panel-visible) > #plansColumnSplitter { grid-column: 8 !important; grid-row: 1 !important; display: block !important; }
  .app.plans-panel-visible:not(.mobile-stacked-layout).works-panel-visible:not(.clash-panel-visible) > #plansPanel { grid-column: 9 !important; grid-row: 1 !important; display: block !important; }

  .app.plans-panel-visible:not(.mobile-stacked-layout).clash-panel-visible.works-panel-visible > #clashSplitter { grid-column: 6 !important; grid-row: 1 !important; display: block !important; }
  .app.plans-panel-visible:not(.mobile-stacked-layout).clash-panel-visible.works-panel-visible > #clashPanel { grid-column: 7 !important; grid-row: 1 !important; display: block !important; }
  .app.plans-panel-visible:not(.mobile-stacked-layout).clash-panel-visible.works-panel-visible > #worksSplitter { grid-column: 8 !important; grid-row: 1 !important; display: block !important; }
  .app.plans-panel-visible:not(.mobile-stacked-layout).clash-panel-visible.works-panel-visible > #worksPanel { grid-column: 9 !important; grid-row: 1 !important; display: block !important; }
  .app.plans-panel-visible:not(.mobile-stacked-layout).clash-panel-visible.works-panel-visible > #plansColumnSplitter { grid-column: 10 !important; grid-row: 1 !important; display: block !important; }
  .app.plans-panel-visible:not(.mobile-stacked-layout).clash-panel-visible.works-panel-visible > #plansPanel { grid-column: 11 !important; grid-row: 1 !important; display: block !important; }
}


/* ===== Ajustes panel 2D v7: splits libres, sin cierre interno, selector de calidad ===== */
#plansCloseButton,
.plans-close-floating {
  display: none !important;
}

.plans-pdf-quality-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  padding: 0 7px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.055);
  color: rgba(241, 248, 255, 0.86);
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.plans-pdf-quality-label span {
  color: rgba(188, 222, 255, 0.88);
}

.plans-pdf-quality-select {
  height: 24px;
  min-width: 76px;
  border: 1px solid rgba(80, 170, 255, 0.28);
  border-radius: 6px;
  background: rgba(8, 15, 25, 0.95);
  color: #f8fbff;
  font-size: 11px;
  font-weight: 800;
  outline: none;
  cursor: pointer;
}

.plans-pdf-quality-select:focus {
  border-color: rgba(80, 170, 255, 0.85);
  box-shadow: 0 0 0 2px rgba(14, 165, 233, 0.18);
}

@media (min-width: 761px) {
  .app.plans-panel-visible:not(.mobile-stacked-layout) > #plansPanel {
    min-width: 0 !important;
    max-width: none !important;
  }


  .plans-body {
    grid-template-columns: var(--plans-list-width, 384px) 7px minmax(0, 1fr) !important;
  }
}


.plans-anno-size-input {
  width: 66px;
  height: 22px;
  padding: 0 6px;
  border: 1px solid rgba(80, 170, 255, 0.28);
  border-radius: 6px;
  background: rgba(8, 15, 25, 0.95);
  color: #f8fbff;
  font-size: 11px;
  font-weight: 600;
  outline: none;
}

.plans-annotation-item {
  pointer-events: all;
  cursor: move;
}

.plans-annotation-shape,
.plans-annotation-text-box {
  pointer-events: visibleStroke;
}

.plans-annotation-hit {
  fill: none;
  stroke: rgba(255, 255, 255, 0.001);
  pointer-events: stroke;
}

.plans-annotation-text-box {
  fill: rgba(255, 255, 255, 0.02);
  stroke-dasharray: 0.008 0.005;
}

.plans-annotation-selection-box {
  fill: rgba(56, 189, 248, 0.04);
  stroke: rgba(125, 211, 252, 0.95);
  stroke-width: 0.0014;
  stroke-dasharray: 0.006 0.004;
  pointer-events: none;
}

.plans-annotation-handle {
  fill: #ffffff;
  stroke: #0ea5e9;
  stroke-width: 0.0012;
  pointer-events: all;
}

.plans-pdf-stage.editing-annotation,
.plans-pdf-stage.editing-annotation .plans-annotation-item {
  cursor: grabbing;
}

.plans-annotation-text-editor {
  position: absolute;
  z-index: 8;
  min-width: 120px;
  min-height: 54px;
  padding: 7px;
  border: 2px solid rgba(14, 165, 233, 0.95);
  border-radius: 8px;
  background: rgba(2, 6, 23, 0.90);
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.38), 0 0 0 1px rgba(255, 255, 255, 0.08) inset;
  color: #f8fbff;
  resize: both;
  overflow: auto;
}

.plans-text-editor-body {
  min-width: 110px;
  min-height: 34px;
  width: max-content;
  max-width: none;
  outline: none;
  white-space: pre-wrap;
  word-break: normal;
  overflow-wrap: anywhere;
  line-height: 1.25;
  font-family: Arial, Helvetica, sans-serif;
  font-weight: 400;
  color: inherit;
}

.plans-text-editor-actions {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
  margin-top: 6px;
}

.plans-text-editor-actions button {
  height: 24px;
  padding: 0 10px;
  border: 1px solid rgba(80, 170, 255, 0.45);
  border-radius: 6px;
  background: rgba(14, 116, 204, 0.42);
  color: #ffffff;
  font-family: inherit;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}

.plans-folder-editor-panel,
.plans-folder-editor-panel *:not(button):not(input) {
  font-weight: 400 !important;
}

.plans-folder-editor-column-title {
  font-weight: 600 !important;
}

@media (max-width: 760px), (pointer: coarse) and (max-width: 1100px) {
  .plans-body {
    grid-template-rows: var(--plans-list-mobile-height, 34%) 7px minmax(0, 1fr) !important;
  }

  .plans-pdf-quality-label {
    min-height: 28px;
    padding: 0 6px;
    font-size: 10px;
  }

  .plans-pdf-quality-select {
    min-width: 70px;
    height: 22px;
    font-size: 10px;
  }
}

/* ===== Panel 2D v16: árbol desplegable de láminas ===== */
.plans-tree-node {
  width: 100%;
  grid-template-columns: 14px 22px minmax(0, 1fr) auto !important;
  cursor: pointer;
  user-select: none;
  appearance: none;
  -webkit-appearance: none;
  font: inherit;
  text-align: left;
}

.plans-tree-node:hover {
  filter: brightness(1.12);
}

.plans-tree-node:focus-visible {
  outline: 2px solid rgba(56, 189, 248, 0.85);
  outline-offset: 1px;
}

.plans-tree-caret {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 22px;
  color: rgba(125, 211, 252, 0.95);
  font-size: 11px;
  line-height: 1;
  transform: rotate(0deg);
  transition: transform 0.14s ease;
}

.plans-tree-node[aria-expanded="false"] .plans-tree-caret,
.plans-collapsible-branch.collapsed > .plans-tree-node .plans-tree-caret {
  transform: rotate(-90deg);
}

.plans-collapsible-branch.collapsed > .plans-tree-children {
  display: none !important;
}

/* ===== Panel 2D v17: organización de planos por carpetas personalizadas ===== */
.plans-tree-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 5px;
  min-width: 0;
}

.plans-tree-edit-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 18px;
  border-radius: 6px;
  border: 1px solid rgba(56, 189, 248, 0.22);
  background: rgba(14, 165, 233, 0.16);
  color: #dff6ff;
  font-size: 12px;
  font-weight: 900;
  line-height: 1;
  cursor: pointer;
  opacity: 0.86;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease, opacity 0.15s ease;
}

.plans-tree-edit-button:hover,
.plans-tree-edit-button:focus-visible {
  background: rgba(14, 165, 233, 0.36);
  border-color: rgba(125, 211, 252, 0.78);
  opacity: 1;
  transform: translateY(-1px);
  outline: none;
}

.plans-tree-node-custom-folder {
  margin-top: 4px;
  background: rgba(14, 116, 144, 0.16);
  border: 1px solid rgba(103, 232, 249, 0.22);
  font-weight: 830;
}

.plans-custom-folder-branch {
  margin-top: 4px;
}

.plans-folder-editor {
  position: fixed;
  z-index: 600;
  display: flex;
  flex-direction: column;
  min-width: min(560px, calc(100vw - 20px));
  max-width: calc(100vw - 20px);
  border: 1px solid rgba(125, 211, 252, 0.34);
  border-radius: 12px;
  background: rgba(8, 13, 22, 0.98);
  color: #eaf6ff;
  box-shadow: 0 22px 68px rgba(0, 0, 0, 0.50), 0 0 0 1px rgba(14, 165, 233, 0.10) inset;
  overflow: hidden;
  backdrop-filter: blur(10px);
}

.plans-folder-editor.hidden {
  display: none !important;
}

.plans-folder-editor-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.22);
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.98), rgba(10, 18, 30, 0.98));
}

.plans-folder-editor-header strong {
  display: block;
  font-size: 13px;
  line-height: 1.1;
  color: #ffffff;
}

.plans-folder-editor-header span {
  display: block;
  margin-top: 3px;
  max-width: 560px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #9fd8ff;
  font-size: 11px;
  font-weight: 750;
}

.plans-folder-editor-close {
  flex: 0 0 auto;
  width: 26px;
  height: 26px;
  border: 1px solid rgba(148, 163, 184, 0.32);
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.72);
  color: #eaf6ff;
  cursor: pointer;
  font-size: 17px;
  line-height: 1;
}

.plans-folder-editor-close:hover {
  background: rgba(239, 68, 68, 0.22);
  border-color: rgba(248, 113, 113, 0.56);
}

.plans-folder-editor-grid {
  display: grid;
  grid-template-columns: minmax(150px, 0.85fr) minmax(190px, 1.08fr) minmax(210px, 1.25fr);
  gap: 10px;
  min-height: 0;
  padding: 10px;
  overflow: hidden;
}

.plans-folder-editor-column {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 7px;
  border: 1px solid rgba(148, 163, 184, 0.20);
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.62);
  padding: 8px;
  overflow: hidden;
}

.plans-folder-editor-column-title {
  flex: 0 0 auto;
  color: #bfe9ff;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.035em;
  text-transform: uppercase;
}

.plans-folder-create-row {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 30px;
  gap: 6px;
}

.plans-folder-create-row input {
  min-width: 0;
  height: 28px;
  border: 1px solid rgba(148, 163, 184, 0.30);
  border-radius: 7px;
  background: rgba(2, 6, 23, 0.56);
  color: #f8fbff;
  padding: 0 8px;
  font-size: 12px;
  outline: none;
}

.plans-folder-create-row input:focus {
  border-color: rgba(56, 189, 248, 0.80);
  box-shadow: 0 0 0 2px rgba(14, 165, 233, 0.15);
}

.plans-folder-create-row button,
.plans-folder-editor-footer button {
  border: 1px solid rgba(56, 189, 248, 0.42);
  border-radius: 7px;
  background: rgba(14, 116, 204, 0.88);
  color: #ffffff;
  font-size: 13px;
  font-weight: 900;
  cursor: pointer;
}

.plans-folder-create-row button:hover,
.plans-folder-editor-footer button:hover {
  background: rgba(14, 165, 233, 0.95);
}

.plans-folder-list,
.plans-folder-plan-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding-right: 2px;
  scrollbar-color: rgba(80, 170, 255, 0.58) rgba(15, 23, 42, 0.65);
  scrollbar-width: thin;
}

.plans-folder-list.empty,
.plans-folder-plan-list.empty {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  border: 1px dashed rgba(148, 163, 184, 0.22);
  border-radius: 8px;
  color: #8aa4ba;
  font-size: 12px;
  line-height: 1.35;
  text-align: center;
}

.plans-folder-list::-webkit-scrollbar,
.plans-folder-plan-list::-webkit-scrollbar {
  width: 9px;
  height: 9px;
}

.plans-folder-list::-webkit-scrollbar-track,
.plans-folder-plan-list::-webkit-scrollbar-track {
  background: rgba(15, 23, 42, 0.65);
  border-radius: 999px;
}

.plans-folder-list::-webkit-scrollbar-thumb,
.plans-folder-plan-list::-webkit-scrollbar-thumb {
  background: rgba(80, 170, 255, 0.58);
  border-radius: 999px;
  border: 2px solid rgba(15, 23, 42, 0.65);
}

.plans-folder-row {
  width: 100%;
  min-height: 30px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 24px;
  align-items: center;
  gap: 6px;
  padding: 5px 5px 5px 8px;
  margin: 0 0 5px;
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.82);
  color: #ecf8ff;
  text-align: left;
  cursor: pointer;
}

.plans-folder-row:hover,
.plans-folder-row.active {
  background: rgba(14, 116, 204, 0.32);
  border-color: rgba(56, 189, 248, 0.52);
}

.plans-folder-row-name,
.plans-folder-plan-row span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11px;
  font-weight: 800;
}

.plans-folder-row-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 18px;
  padding: 0 6px;
  border-radius: 999px;
  background: rgba(14, 165, 233, 0.26);
  color: #dff6ff;
  font-size: 10px;
  font-weight: 900;
}

.plans-folder-remove-button,
.plans-folder-plan-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border: 1px solid rgba(248, 113, 113, 0.32);
  border-radius: 6px;
  background: rgba(127, 29, 29, 0.24);
  color: #fecaca;
  font-size: 16px;
  font-weight: 900;
  line-height: 1;
  cursor: pointer;
}

.plans-folder-remove-button:hover,
.plans-folder-plan-remove:hover {
  background: rgba(220, 38, 38, 0.42);
  color: #ffffff;
}

.plans-folder-plan-row {
  min-height: 30px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 6px;
  padding: 5px 5px 5px 8px;
  margin: 0 0 5px;
  border: 1px solid rgba(148, 163, 184, 0.14);
  border-radius: 8px;
  background: rgba(2, 6, 23, 0.38);
  color: #f1f8ff;
}

#plansFolderAvailableList .plans-folder-plan-row {
  cursor: copy;
}

#plansFolderAvailableList .plans-folder-plan-row:hover {
  background: rgba(14, 116, 204, 0.24);
  border-color: rgba(56, 189, 248, 0.44);
}

.plans-folder-editor-footer {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 10px;
  border-top: 1px solid rgba(148, 163, 184, 0.22);
  background: rgba(15, 23, 42, 0.82);
}

.plans-folder-editor-footer span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #93c5fd;
  font-size: 11px;
  font-weight: 750;
}

.plans-folder-editor-footer span.warning {
  color: #fde68a;
}

.plans-folder-editor-footer button {
  flex: 0 0 auto;
  height: 30px;
  min-width: 96px;
  padding: 0 16px;
}

@media (max-width: 820px) {
  .plans-folder-editor {
    width: calc(100vw - 20px) !important;
    left: 10px !important;
  }

  .plans-folder-editor-grid {
    grid-template-columns: 1fr;
    overflow: auto;
  }

  .plans-folder-editor-column {
    min-height: 155px;
  }

  .plans-folder-editor-footer {
    align-items: stretch;
    flex-direction: column;
  }

  .plans-folder-editor-footer button {
    width: 100%;
  }
}


/* ===== Panel 2D v18: ajustes de árbol y editor de carpetas ===== */
.plans-tree-revit-icon {
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, rgba(8, 145, 178, 0.98), rgba(37, 99, 235, 0.98)) !important;
  color: #ffffff !important;
  font-size: 11px !important;
  font-weight: 950 !important;
  letter-spacing: -0.02em;
  border: 1px solid rgba(191, 219, 254, 0.42);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}
.plans-tree-revit-icon::after {
  content: '';
  position: absolute;
  top: -1px;
  right: -1px;
  width: 8px;
  height: 8px;
  background: rgba(226, 246, 255, 0.72);
  clip-path: polygon(100% 0, 0 0, 100% 100%);
}
#plansFolderAvailableList .plans-folder-plan-row {
  cursor: default !important;
}
#plansFolderAvailableList .plans-folder-plan-row:hover {
  background: rgba(2, 6, 23, 0.38) !important;
  border-color: rgba(148, 163, 184, 0.14) !important;
}
.plans-folder-plan-row,
.plans-folder-plan-row span {
  cursor: default;
}
.plans-folder-plan-remove,
.plans-folder-remove-button,
.plans-folder-row,
.plans-folder-create-row button,
.plans-folder-editor-footer button {
  cursor: pointer;
}

/* ===== Panel 2D v20: anotaciones editables sobre planos y textos normales en editor ===== */
.plans-pdf-viewer {
  grid-template-rows: auto auto minmax(0, 1fr) !important;
}

.plans-annotation-toolbar {
  min-height: 38px;
  padding: 5px 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(13, 18, 28, 0.96);
  overflow-x: auto;
  overflow-y: hidden;
}

.plans-annotation-toolbar::-webkit-scrollbar {
  height: 7px;
}

.plans-annotation-toolbar::-webkit-scrollbar-track {
  background: rgba(15, 23, 42, 0.6);
  border-radius: 999px;
}

.plans-annotation-toolbar::-webkit-scrollbar-thumb {
  background: rgba(80, 170, 255, 0.55);
  border-radius: 999px;
}

.plans-annotation-tools {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: max-content;
}

.plans-anno-tool {
  min-width: 30px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(148, 163, 184, 0.20);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.06);
  color: #eaf7ff;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  padding: 0 8px;
}

.plans-anno-tool:hover,
.plans-anno-tool.active {
  background: rgba(14, 116, 204, 0.42);
  border-color: rgba(80, 170, 255, 0.76);
  color: #ffffff;
}

.plans-anno-tool.danger:hover {
  background: rgba(220, 38, 38, 0.36);
  border-color: rgba(248, 113, 113, 0.75);
}

.plans-anno-control {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  padding: 0 7px;
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.045);
  color: rgba(226, 242, 255, 0.9);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.plans-anno-control input[type="color"] {
  width: 28px;
  height: 22px;
  padding: 0;
  border: 0;
  border-radius: 5px;
  background: transparent;
  cursor: pointer;
}

.plans-anno-control select,
.plans-anno-size-input {
  height: 22px;
  border: 1px solid rgba(80, 170, 255, 0.28);
  border-radius: 6px;
  background: rgba(8, 15, 25, 0.95);
  color: #f8fbff;
  font-size: 11px;
  font-weight: 700;
  outline: none;
  cursor: pointer;
}

.plans-annotation-layer {
  position: absolute;
  top: 0;
  left: 0;
  transform-origin: 0 0;
  overflow: visible;
  pointer-events: none;
  z-index: 3;
}

.plans-pdf-canvas {
  z-index: 2;
}

.plans-native-view-hotspots {
  position: absolute;
  inset: 0;
  z-index: 6;
  pointer-events: none;
  overflow: hidden;
}

.plans-native-view-cube {
  position: absolute;
  width: 26px;
  height: 26px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.96);
  border-radius: 7px;
  background: linear-gradient(145deg, #2196f3 0%, #0b66c3 100%);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(0, 45, 95, 0.48), 0 0 0 1px rgba(5, 75, 145, 0.24);
  transform: translate(-50%, -50%);
  display: grid;
  place-items: center;
  cursor: pointer;
  pointer-events: auto;
  transition: transform 120ms ease, filter 120ms ease, box-shadow 120ms ease;
}

.plans-native-view-cube svg {
  width: 18px;
  height: 18px;
  display: block;
}

.plans-native-view-cube:hover,
.plans-native-view-cube:focus-visible {
  filter: brightness(1.13);
  transform: translate(-50%, -50%) scale(1.1);
  box-shadow: 0 4px 12px rgba(0, 65, 135, 0.58), 0 0 0 2px rgba(112, 196, 255, 0.55);
  outline: none;
}

.plans-native-view-cube.active {
  background: linear-gradient(145deg, #31a8ff 0%, #0755a8 100%);
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.96), 0 0 0 4px rgba(33, 150, 243, 0.7), 0 4px 13px rgba(0, 45, 95, 0.62);
}

.plans-native-view-cube.loading {
  pointer-events: none;
  opacity: 0.72;
}

@media (max-width: 760px) {
  .plans-native-view-cube {
    width: 24px;
    height: 24px;
    border-radius: 6px;
  }

  .plans-native-view-cube svg {
    width: 16px;
    height: 16px;
  }
}

.plans-pdf-stage.annotation-mode {
  cursor: crosshair;
}

.plans-pdf-stage.annotation-mode.panning {
  cursor: grabbing;
}

.plans-folder-row-name,
.plans-folder-plan-row span {
  font-weight: 400 !important;
}

.plans-folder-editor-column-title,
.plans-folder-editor-footer span {
  font-weight: 600 !important;
}


.plans-anno-size-input {
  width: 66px;
  height: 22px;
  padding: 0 6px;
  border: 1px solid rgba(80, 170, 255, 0.28);
  border-radius: 6px;
  background: rgba(8, 15, 25, 0.95);
  color: #f8fbff;
  font-size: 11px;
  font-weight: 600;
  outline: none;
}

.plans-annotation-item {
  pointer-events: all;
  cursor: move;
}

.plans-annotation-shape,
.plans-annotation-text-box {
  pointer-events: visibleStroke;
}

.plans-annotation-hit {
  fill: none;
  stroke: rgba(255, 255, 255, 0.001);
  pointer-events: stroke;
}

.plans-annotation-text-box {
  fill: rgba(255, 255, 255, 0.02);
  stroke-dasharray: 0.008 0.005;
}

.plans-annotation-selection-box {
  fill: rgba(56, 189, 248, 0.04);
  stroke: rgba(125, 211, 252, 0.95);
  stroke-width: 0.0014;
  stroke-dasharray: 0.006 0.004;
  pointer-events: none;
}

.plans-annotation-handle {
  fill: #ffffff;
  stroke: #0ea5e9;
  stroke-width: 0.0012;
  pointer-events: all;
}

.plans-pdf-stage.editing-annotation,
.plans-pdf-stage.editing-annotation .plans-annotation-item {
  cursor: grabbing;
}

.plans-annotation-text-editor {
  position: absolute;
  z-index: 8;
  min-width: 120px;
  min-height: 54px;
  padding: 7px;
  border: 2px solid rgba(14, 165, 233, 0.95);
  border-radius: 8px;
  background: rgba(2, 6, 23, 0.90);
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.38), 0 0 0 1px rgba(255, 255, 255, 0.08) inset;
  color: #f8fbff;
  resize: both;
  overflow: auto;
}

.plans-text-editor-body {
  min-width: 110px;
  min-height: 34px;
  width: max-content;
  max-width: none;
  outline: none;
  white-space: pre-wrap;
  word-break: normal;
  overflow-wrap: anywhere;
  line-height: 1.25;
  font-family: Arial, Helvetica, sans-serif;
  font-weight: 400;
  color: inherit;
}

.plans-text-editor-actions {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
  margin-top: 6px;
}

.plans-text-editor-actions button {
  height: 24px;
  padding: 0 10px;
  border: 1px solid rgba(80, 170, 255, 0.45);
  border-radius: 6px;
  background: rgba(14, 116, 204, 0.42);
  color: #ffffff;
  font-family: inherit;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}

.plans-folder-editor-panel,
.plans-folder-editor-panel *:not(button):not(input) {
  font-weight: 400 !important;
}

.plans-folder-editor-column-title {
  font-weight: 600 !important;
}

@media (max-width: 760px), (pointer: coarse) and (max-width: 1100px) {
  .plans-annotation-toolbar {
    min-height: 36px;
    padding: 4px 6px;
  }
  .plans-anno-tool {
    min-width: 28px;
    height: 26px;
    font-size: 13px;
    padding: 0 7px;
  }
  .plans-anno-control {
    min-height: 26px;
    font-size: 10px;
  }
}

/* ===== Panel 2D v21: edición de anotaciones más limpia ===== */
.plans-annotation-selection-box {
  fill: transparent !important;
  stroke: transparent !important;
  stroke-width: 0 !important;
  stroke-dasharray: none !important;
  pointer-events: none !important;
}

.plans-annotation-shape {
  pointer-events: visibleStroke;
}

.plans-annotation-text-box {
  display: none !important;
}

.plans-annotation-text-hit {
  fill: rgba(255, 255, 255, 0.001);
  stroke: transparent;
  pointer-events: all;
}

.plans-annotation-text-draft-box {
  fill: rgba(14, 165, 233, 0.04);
  stroke: #0ea5e9;
  stroke-width: 0.0014;
  stroke-dasharray: 0.006 0.004;
  pointer-events: none;
}

.plans-annotation-handle {
  fill: #ffffff !important;
  stroke: #0ea5e9 !important;
  stroke-width: 0.0012 !important;
  pointer-events: all;
}

.plans-annotation-text-editor {
  position: absolute;
  z-index: 8;
  min-width: 24px;
  min-height: 18px;
  padding: 2px 4px;
  border: 2px solid #004dff;
  border-radius: 0;
  background: rgba(255, 255, 255, 0.02);
  box-shadow: none;
  color: #ff0000;
  outline: none;
  resize: none;
  overflow: hidden;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  line-height: 1.25;
  font-family: Arial, Helvetica, sans-serif;
  font-weight: 400;
  cursor: text;
}

.plans-annotation-text-editor:focus {
  box-shadow: 0 0 0 1px rgba(14, 165, 233, 0.25);
}

.plans-text-editor-body,
.plans-text-editor-actions {
  display: none !important;
}

/* ===== Panel 2D v22: anotaciones editables más precisas ===== */
.plans-annotation-handle {
  fill: #ffffff !important;
  stroke: #0ea5e9 !important;
  stroke-width: 0.8px !important;
  pointer-events: all !important;
}

.plans-annotation-text-editor {
  position: absolute !important;
  z-index: 8 !important;
  min-width: 1px !important;
  min-height: 1px !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  outline: none !important;
  color: #ff0000;
  resize: none !important;
  overflow: hidden !important;
  white-space: pre-wrap !important;
  overflow-wrap: anywhere !important;
  line-height: 1.25 !important;
  font-family: Arial, Helvetica, sans-serif !important;
  font-weight: 400 !important;
  cursor: text !important;
  caret-color: currentColor;
}

.plans-annotation-text-editor:focus {
  border: 0 !important;
  box-shadow: none !important;
  outline: none !important;
}

.plans-annotation-text-draft-box {
  fill: transparent !important;
  stroke: transparent !important;
  stroke-width: 0 !important;
  stroke-dasharray: none !important;
}

/* ===== Panel 2D v24: anotaciones texto libre y puntos más visibles ===== */
.plans-annotation-handle {
  fill: #ffffff !important;
  stroke: #0ea5e9 !important;
  stroke-width: 0.9px !important;
  pointer-events: all !important;
}

.plans-pdf-stage,
.plans-pdf-stage.panning,
.plans-pdf-stage.annotation-mode.panning {
  cursor: default !important;
}

.plans-pdf-stage.annotation-mode {
  cursor: crosshair !important;
}

.plans-pdf-stage.editing-annotation,
.plans-pdf-stage.editing-annotation .plans-annotation-item {
  cursor: move !important;
}

.plans-annotation-text-editor {
  position: absolute !important;
  z-index: 8 !important;
  min-width: 1px !important;
  min-height: 1px !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  outline: none !important;
  color: #ff0000;
  resize: none !important;
  overflow: visible !important;
  white-space: pre;
  overflow-wrap: normal;
  word-break: keep-all;
  line-height: 1.25 !important;
  font-family: Arial, Helvetica, sans-serif !important;
  font-weight: 400 !important;
  cursor: text !important;
  caret-color: currentColor;
}

.plans-annotation-text-editor:focus {
  border: 0 !important;
  box-shadow: none !important;
  outline: none !important;
}


/* ===== Panel 2D v25: puntos de edición más grandes y texto seleccionado ajustado ===== */
.plans-annotation-handle {
  fill: #ffffff !important;
  stroke: #0ea5e9 !important;
  stroke-width: 0.9px !important;
  pointer-events: all !important;
}


/* ===== Panel 2D v28: símbolos minimalistas y lista simple ===== */
.plans-tree-icon,
.plans-tree-revit-icon {
  width: 18px !important;
  height: 18px !important;
  min-width: 18px !important;
  border-radius: 0 !important;
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  color: rgba(245, 250, 255, 0.92) !important;
  font-size: 13px !important;
  font-weight: 700 !important;
  line-height: 1 !important;
  letter-spacing: 0 !important;
}

.plans-tree-revit-icon::after {
  content: none !important;
}

.plans-tree-node-folder .plans-tree-icon,
.plans-tree-node-custom-folder .plans-tree-icon,
.plans-tree-node-model .plans-tree-icon {
  color: rgba(245, 250, 255, 0.92) !important;
}

.plans-item {
  gap: 0 !important;
  padding-left: 10px !important;
}

.plans-item::before {
  content: none !important;
  display: none !important;
}

.plans-item strong {
  font-weight: 700 !important;
}


/* ===== Panel 2D v29: iconos más representativos ===== */
.plans-tree-node {
  grid-template-columns: 14px 22px minmax(0, 1fr) auto !important;
}

.plans-tree-icon {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 18px !important;
  height: 18px !important;
  min-width: 18px !important;
  color: rgba(245, 250, 255, 0.96) !important;
}

.plans-tree-icon svg,
.plans-item-icon svg {
  width: 100%;
  height: 100%;
  display: block;
}

.plans-tree-folder-icon {
  color: rgba(245, 250, 255, 0.96) !important;
}

.plans-tree-revit-icon {
  font-size: 15px !important;
  font-weight: 900 !important;
  letter-spacing: -0.02em !important;
  font-family: Arial, Helvetica, sans-serif !important;
  color: rgba(245, 250, 255, 0.98) !important;
}

.plans-item {
  gap: 8px !important;
  padding-left: 10px !important;
}

.plans-item-icon {
  flex: 0 0 18px;
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: rgba(245, 250, 255, 0.96);
}

.plans-item strong {
  display: block !important;
  min-width: 0;
  margin: 0 !important;
}

/* ===== Panel de control v30: Proyecto/Categorías desplegables y selección controlada ===== */
.sidebar {
  display: flex !important;
  flex-direction: column !important;
  grid-template-rows: none !important;
  gap: 10px !important;
}

.sidebar-toggle-row {
  flex: 0 0 auto !important;
}

#sidebarRowSplitter,
.row-splitter#sidebarRowSplitter {
  display: none !important;
}

.control-tree-section {
  flex: 1 1 0 !important;
  min-height: 0 !important;
  display: grid !important;
  grid-template-rows: auto minmax(0, 1fr) !important;
  overflow: hidden !important;
}

.control-tree-section.collapsed {
  flex: 0 0 auto !important;
  grid-template-rows: auto !important;
}

.control-tree-section.collapsed .control-section-body {
  display: none !important;
}

.control-section-body {
  min-height: 0 !important;
  overflow: hidden !important;
  display: grid !important;
  grid-template-rows: minmax(0, 1fr) !important;
}

.control-section-title-row {
  display: flex !important;
  align-items: center !important;
  gap: 7px !important;
  min-width: 0 !important;
}

.control-section-title-row h2 {
  margin: 0 !important;
  min-width: 0 !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}

.control-section-toggle {
  width: 22px !important;
  height: 22px !important;
  min-width: 22px !important;
  border: 0 !important;
  border-radius: 6px !important;
  background: rgba(255, 255, 255, 0.08) !important;
  color: rgba(255, 255, 255, 0.92) !important;
  display: inline-grid !important;
  place-items: center !important;
  cursor: pointer !important;
  font-size: 13px !important;
  line-height: 1 !important;
  padding: 0 !important;
}

.control-section-toggle:hover,
.control-section-toggle:focus-visible {
  background: rgba(14, 165, 233, 0.28) !important;
  outline: 1px solid rgba(125, 211, 252, 0.55) !important;
}

.tree-selection-mode {
  display: inline-flex !important;
  align-items: center !important;
  gap: 7px !important;
  width: max-content !important;
  max-width: 100% !important;
  min-height: 24px !important;
  color: rgba(226, 232, 240, 0.92) !important;
  font-size: 11px !important;
  font-weight: 650 !important;
  user-select: none !important;
  cursor: pointer !important;
}

.tree-selection-mode input[type="checkbox"] {
  width: 14px !important;
  height: 14px !important;
  margin: 0 !important;
  accent-color: #0ea5e9 !important;
  cursor: pointer !important;
}

.app.sidebar-collapsed .sidebar {
  display: grid !important;
  grid-template-rows: 38px 0 0 !important;
}

.app.sidebar-collapsed .control-tree-section {
  display: none !important;
}


/* ===== Panel de control v31: desplegables con estilo de Obras ===== */
.sidebar .control-tree-section {
  border: 1px solid rgba(148, 163, 184, 0.28) !important;
  border-radius: 10px !important;
  background: rgba(15, 23, 42, 0.88) !important;
  overflow: hidden !important;
  flex: 0 0 auto !important;
  min-height: 0 !important;
  display: flex !important;
  flex-direction: column !important;
  padding: 0 !important;
  margin: 0 !important;
  box-shadow: none !important;
}

.sidebar .control-tree-section:not(.collapsed) {
  flex: 1 1 0 !important;
  min-height: 0 !important;
}

.sidebar .control-tree-section.collapsed {
  flex: 0 0 auto !important;
}

.sidebar .control-tree-section.collapsed > .control-section-body {
  display: none !important;
}

.sidebar .control-tree-section > .control-section-toggle {
  width: 100% !important;
  height: 34px !important;
  min-width: 0 !important;
  border: 0 !important;
  border-bottom: 1px solid rgba(148, 163, 184, 0.24) !important;
  border-radius: 0 !important;
  background: rgba(30, 41, 59, 0.95) !important;
  color: #f8fafc !important;
  font-weight: 800 !important;
  font-size: 13px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: flex-start !important;
  gap: 6px !important;
  padding: 0 10px !important;
  cursor: pointer !important;
  text-align: left !important;
  line-height: 1 !important;
  box-sizing: border-box !important;
}

.sidebar .control-tree-section > .control-section-toggle:hover,
.sidebar .control-tree-section > .control-section-toggle:focus-visible {
  background: rgba(51, 65, 85, 0.95) !important;
  outline: none !important;
}

.sidebar .control-tree-section .control-section-caret,
.sidebar .control-tree-section .works-section-caret {
  width: 14px !important;
  min-width: 14px !important;
  height: auto !important;
  display: inline-block !important;
  transform: rotate(90deg) !important;
  transition: transform 0.16s ease !important;
  color: rgba(226, 232, 240, 0.92) !important;
  font-size: 11px !important;
  line-height: 1 !important;
}

.sidebar .control-tree-section.collapsed .control-section-caret,
.sidebar .control-tree-section.collapsed .works-section-caret {
  transform: rotate(0deg) !important;
}

.sidebar .control-tree-section.collapsed > .control-section-toggle {
  border-bottom: 0 !important;
}

.sidebar .control-tree-section > .control-section-body {
  padding: 10px !important;
  min-height: 0 !important;
  min-width: 0 !important;
  overflow: hidden !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 10px !important;
  box-sizing: border-box !important;
  grid-template-rows: none !important;
}

.sidebar .control-section-tools {
  flex: 0 0 auto !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 8px !important;
  min-width: 0 !important;
}

.sidebar .control-tree-section .tree-search-row {
  flex: 0 0 auto !important;
}

.sidebar .control-tree-section .tree-selection-mode {
  flex: 0 0 auto !important;
  margin: 0 !important;
}

.sidebar .control-tree-section .tree-list {
  flex: 1 1 auto !important;
  min-height: 0 !important;
  overflow: auto !important;
}

.sidebar .control-tree-section .tree-list::-webkit-scrollbar {
  width: 9px;
  height: 9px;
}

.sidebar .control-tree-section .tree-list::-webkit-scrollbar-track {
  background: rgba(15, 23, 42, 0.55);
  border-radius: 999px;
}

.sidebar .control-tree-section .tree-list::-webkit-scrollbar-thumb {
  background: rgba(96, 165, 250, 0.42);
  border-radius: 999px;
  border: 2px solid rgba(15, 23, 42, 0.55);
}

.sidebar .control-tree-section .tree-list::-webkit-scrollbar-thumb:hover {
  background: rgba(96, 165, 250, 0.72);
}


/* ===== Panel de control v32: comportamiento tipo Obras ===== */
.sidebar {
  display: flex !important;
  flex-direction: column !important;
  align-items: stretch !important;
  justify-content: flex-start !important;
  align-content: stretch !important;
  gap: 8px !important;
  height: 100% !important;
  min-height: 0 !important;
  overflow: hidden !important;
  box-sizing: border-box !important;
}

.sidebar-toggle-row {
  flex: 0 0 auto !important;
  height: 34px !important;
  min-height: 34px !important;
  max-height: 34px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: flex-start !important;
  margin: 0 0 4px 0 !important;
  padding: 0 8px !important;
  box-sizing: border-box !important;
}

.sidebar .control-tree-section {
  width: 100% !important;
  min-width: 0 !important;
  max-width: 100% !important;
  margin: 0 !important;
  padding: 0 !important;
  box-sizing: border-box !important;
  display: flex !important;
  flex-direction: column !important;
  overflow: hidden !important;
  align-self: stretch !important;
  justify-content: flex-start !important;
}

.sidebar .control-tree-section:not(.collapsed) {
  flex: 1 1 0 !important;
  min-height: 0 !important;
}

.sidebar .control-tree-section.collapsed {
  flex: 0 0 34px !important;
  height: 34px !important;
  min-height: 34px !important;
  max-height: 34px !important;
}

.sidebar .control-tree-section.collapsed > .control-section-body {
  display: none !important;
}

.sidebar .control-tree-section > .control-section-toggle {
  flex: 0 0 34px !important;
  height: 34px !important;
  min-height: 34px !important;
  max-height: 34px !important;
  width: 100% !important;
  display: flex !important;
  align-items: center !important;
  justify-content: flex-start !important;
  margin: 0 !important;
  box-sizing: border-box !important;
}

.sidebar .control-tree-section > .control-section-body {
  flex: 1 1 auto !important;
  min-height: 0 !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: stretch !important;
  justify-content: flex-start !important;
  align-content: flex-start !important;
  overflow: hidden !important;
}

.sidebar .control-tree-section .control-section-tools {
  flex: 0 0 auto !important;
}

.sidebar .control-tree-section .tree-list {
  flex: 1 1 auto !important;
  min-height: 0 !important;
  align-self: stretch !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
}

.app.sidebar-collapsed .sidebar-toggle-row {
  height: 34px !important;
  min-height: 34px !important;
  max-height: 34px !important;
}


/* ===== Panel de control v33: acordeón exacto tipo Obras ===== */
.sidebar {
  display: flex !important;
  flex-direction: column !important;
  align-items: stretch !important;
  justify-content: flex-start !important;
  gap: 8px !important;
  height: 100% !important;
  min-height: 0 !important;
  overflow: hidden !important;
  box-sizing: border-box !important;
}

.sidebar-toggle-row {
  flex: 0 0 34px !important;
  height: 34px !important;
  min-height: 34px !important;
  max-height: 34px !important;
  margin: 0 !important;
  padding: 0 8px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: flex-start !important;
}

#sidebarRowSplitter,
.row-splitter#sidebarRowSplitter {
  display: none !important;
}

.sidebar .control-tree-section {
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 1px solid rgba(148, 163, 184, 0.28) !important;
  border-radius: 10px !important;
  background: rgba(15, 23, 42, 0.88) !important;
  display: flex !important;
  flex-direction: column !important;
  overflow: hidden !important;
  box-sizing: border-box !important;
  align-self: stretch !important;
}

.sidebar .control-tree-section.collapsed {
  flex: 0 0 34px !important;
  height: 34px !important;
  min-height: 34px !important;
  max-height: 34px !important;
}

.sidebar .control-tree-section.collapsed > .control-section-body {
  display: none !important;
}

.sidebar .control-tree-section > .control-section-toggle {
  flex: 0 0 34px !important;
  width: 100% !important;
  height: 34px !important;
  min-height: 34px !important;
  max-height: 34px !important;
  border: 0 !important;
  border-bottom: 1px solid rgba(148, 163, 184, 0.24) !important;
  border-radius: 0 !important;
  background: rgba(30, 41, 59, 0.95) !important;
  color: #f8fafc !important;
  font-weight: 800 !important;
  font-size: 13px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: flex-start !important;
  gap: 6px !important;
  padding: 0 10px !important;
  margin: 0 !important;
  text-align: left !important;
  cursor: pointer !important;
  box-sizing: border-box !important;
}

.sidebar .control-tree-section.collapsed > .control-section-toggle {
  border-bottom: 0 !important;
}

.sidebar .control-tree-section .control-section-caret,
.sidebar .control-tree-section .works-section-caret {
  width: 14px !important;
  min-width: 14px !important;
  display: inline-block !important;
  transform: rotate(90deg) !important;
  transition: transform 0.16s ease !important;
  color: rgba(226, 232, 240, 0.92) !important;
  font-size: 12px !important;
  line-height: 1 !important;
}

.sidebar .control-tree-section.collapsed .control-section-caret,
.sidebar .control-tree-section.collapsed .works-section-caret {
  transform: rotate(0deg) !important;
}

.sidebar .control-tree-section > .control-section-body {
  flex: 1 1 auto !important;
  min-height: 0 !important;
  min-width: 0 !important;
  padding: 10px !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: stretch !important;
  justify-content: flex-start !important;
  gap: 10px !important;
  overflow: hidden !important;
  box-sizing: border-box !important;
}

.sidebar .control-section-tools {
  flex: 0 0 auto !important;
  min-width: 0 !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 8px !important;
}

.sidebar .control-tree-section .tree-list {
  flex: 1 1 auto !important;
  min-height: 0 !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
}

.app.sidebar-collapsed .control-tree-section {
  display: none !important;
}


/* ===== Panel de control v34: acordeón real arriba/50-50 y árbol ancho completo ===== */
#sidebar.sidebar {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) !important;
  grid-template-rows: 34px 34px 34px minmax(0, 1fr) !important;
  align-items: stretch !important;
  justify-items: stretch !important;
  gap: 8px !important;
  width: 100% !important;
  max-width: none !important;
  min-width: 0 !important;
  height: 100% !important;
  min-height: 0 !important;
  overflow: hidden !important;
  box-sizing: border-box !important;
  padding: 0 8px 8px 8px !important;
}

#sidebar.sidebar.control-project-open.control-category-open {
  grid-template-rows: 34px minmax(0, 1fr) minmax(0, 1fr) !important;
}

#sidebar.sidebar.control-project-open.control-category-collapsed {
  grid-template-rows: 34px minmax(0, 1fr) 34px !important;
}

#sidebar.sidebar.control-project-collapsed.control-category-open {
  grid-template-rows: 34px 34px minmax(0, 1fr) !important;
}

#sidebar.sidebar.control-project-collapsed.control-category-collapsed {
  grid-template-rows: 34px 34px 34px minmax(0, 1fr) !important;
}

#sidebar.sidebar > .sidebar-toggle-row {
  grid-row: 1 !important;
  grid-column: 1 !important;
  width: 100% !important;
  min-width: 0 !important;
  height: 34px !important;
  min-height: 34px !important;
  max-height: 34px !important;
  padding: 0 !important;
  margin: 0 !important;
  align-self: stretch !important;
  justify-self: stretch !important;
}

#sidebar.sidebar > #projectControlSection.control-tree-section {
  grid-row: 2 !important;
  grid-column: 1 !important;
}

#sidebar.sidebar > #categoryControlSection.control-tree-section {
  grid-row: 3 !important;
  grid-column: 1 !important;
}

#sidebar.sidebar > .control-tree-section,
#sidebar.sidebar > #projectControlSection.control-tree-section,
#sidebar.sidebar > #categoryControlSection.control-tree-section {
  width: 100% !important;
  max-width: none !important;
  min-width: 0 !important;
  height: auto !important;
  min-height: 0 !important;
  max-height: none !important;
  flex: none !important;
  align-self: stretch !important;
  justify-self: stretch !important;
  margin: 0 !important;
  padding: 0 !important;
  box-sizing: border-box !important;
  display: flex !important;
  flex-direction: column !important;
  overflow: hidden !important;
}

#sidebar.sidebar > .control-tree-section.collapsed {
  height: 34px !important;
  min-height: 34px !important;
  max-height: 34px !important;
}

#sidebar.sidebar > .control-tree-section:not(.collapsed) {
  height: auto !important;
  max-height: none !important;
}

#sidebar.sidebar > .control-tree-section > .control-section-toggle {
  flex: 0 0 34px !important;
  width: 100% !important;
  max-width: none !important;
  min-width: 0 !important;
  height: 34px !important;
  min-height: 34px !important;
  max-height: 34px !important;
  box-sizing: border-box !important;
}

#sidebar.sidebar > .control-tree-section > .control-section-body {
  flex: 1 1 auto !important;
  width: 100% !important;
  max-width: none !important;
  min-width: 0 !important;
  min-height: 0 !important;
  height: auto !important;
  max-height: none !important;
  box-sizing: border-box !important;
  overflow: hidden !important;
  display: flex !important;
  flex-direction: column !important;
  justify-content: flex-start !important;
  align-items: stretch !important;
}

#sidebar.sidebar > .control-tree-section.collapsed > .control-section-body {
  display: none !important;
}

#sidebar.sidebar .control-section-tools,
#sidebar.sidebar .tree-search-row,
#sidebar.sidebar .tree-search,
#sidebar.sidebar .tree-selection-mode,
#sidebar.sidebar .tree-list {
  max-width: none !important;
  min-width: 0 !important;
  box-sizing: border-box !important;
}

#sidebar.sidebar .control-section-tools,
#sidebar.sidebar .tree-search-row,
#sidebar.sidebar .tree-search,
#sidebar.sidebar .tree-list {
  width: 100% !important;
}

#sidebar.sidebar .tree-list {
  flex: 1 1 auto !important;
  min-height: 0 !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  padding-right: 2px !important;
}

#sidebar.sidebar .tree-group,
#sidebar.sidebar .tree-children,
#sidebar.sidebar .category-root-children {
  width: 100% !important;
  max-width: none !important;
  min-width: 0 !important;
  box-sizing: border-box !important;
}

#sidebar.sidebar .tree-selectable {
  display: grid !important;
  grid-template-columns: 18px 18px minmax(0, 1fr) max-content !important;
  align-items: center !important;
  column-gap: 6px !important;
  width: auto !important;
  max-width: none !important;
  min-width: 0 !important;
  box-sizing: border-box !important;
}

#sidebar.sidebar .tree-name {
  min-width: 0 !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}

#sidebar.sidebar .tree-count {
  justify-self: end !important;
  white-space: nowrap !important;
}

.app.sidebar-collapsed #sidebar.sidebar {
  display: grid !important;
  grid-template-rows: 34px !important;
  padding: 0 8px !important;
}

.app.sidebar-collapsed #sidebar.sidebar > .control-tree-section {
  display: none !important;
}


/* ===== v35 móvil: orden real de paneles, ocultación estricta y botones visibles ===== */
@media (max-width: 1100px), (pointer: coarse) and (max-width: 1400px) {
  .app.mobile-stacked-layout {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 0 !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
  }

  .app.mobile-stacked-layout > .viewer-column {
    order: 10 !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    flex: 1 0 auto !important;
  }

  .app.mobile-stacked-layout.mobile-sidebar-open > #sidebar {
    order: 1 !important;
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    flex: 0 0 auto !important;
    position: relative !important;
    inset: auto !important;
  }

  .app.mobile-stacked-layout.mobile-data-open #massInfoPanel {
    order: 2 !important;
    display: grid !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    flex: 0 0 auto !important;
    position: relative !important;
    inset: auto !important;
  }

  .app.mobile-stacked-layout.mobile-properties-open > .properties-column {
    order: 3 !important;
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    flex: 0 0 auto !important;
    position: relative !important;
    inset: auto !important;
  }

  .app.mobile-stacked-layout.clash-panel-visible > #clashPanel {
    order: 4 !important;
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    flex: 0 0 auto !important;
    position: relative !important;
    inset: auto !important;
  }

  .app.mobile-stacked-layout.works-panel-visible > #worksPanel {
    order: 5 !important;
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    flex: 0 0 auto !important;
    position: relative !important;
    inset: auto !important;
  }

  .app.mobile-stacked-layout.plans-panel-visible > #plansPanel {
    order: 6 !important;
    display: block !important;
    position: relative !important;
    inset: auto !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    flex: 0 0 auto !important;
  }

  .app.mobile-stacked-layout:not(.mobile-sidebar-open) > #sidebar,
  .app.mobile-stacked-layout:not(.mobile-sidebar-open) > #columnSplitter,
  .app.mobile-stacked-layout:not(.mobile-data-open) #massInfoPanel,
  .app.mobile-stacked-layout:not(.mobile-properties-open) > .properties-column,
  .app.mobile-stacked-layout:not(.mobile-properties-open) > #propertiesSplitter,
  .app.mobile-stacked-layout:not(.clash-panel-visible) > #clashPanel,
  .app.mobile-stacked-layout:not(.clash-panel-visible) > #clashSplitter,
  .app.mobile-stacked-layout:not(.works-panel-visible) > #worksPanel,
  .app.mobile-stacked-layout:not(.works-panel-visible) > #worksSplitter,
  .app.mobile-stacked-layout:not(.plans-panel-visible) > #plansPanel,
  .app.mobile-stacked-layout:not(.plans-panel-visible) > #plansColumnSplitter,
  .app.mobile-stacked-layout > .column-splitter,
  .app.mobile-stacked-layout > .viewer-row-splitter,
  .app.mobile-stacked-layout > .mass-column-splitter,
  .app.mobile-stacked-layout > .clash-splitter,
  .app.mobile-stacked-layout > .works-splitter,
  .app.mobile-stacked-layout > .plans-column-splitter,
  .app.mobile-stacked-layout > #plansColumnSplitter {
    display: none !important;
    width: 0 !important;
    height: 0 !important;
    min-width: 0 !important;
    min-height: 0 !important;
    max-width: 0 !important;
    max-height: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    border: 0 !important;
    overflow: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
  }

  .app.mobile-stacked-layout.mobile-sidebar-open > #sidebar,
  .app.mobile-stacked-layout.mobile-data-open #massInfoPanel,
  .app.mobile-stacked-layout.mobile-properties-open > .properties-column,
  .app.mobile-stacked-layout.clash-panel-visible > #clashPanel,
  .app.mobile-stacked-layout.works-panel-visible > #worksPanel,
  .app.mobile-stacked-layout.plans-panel-visible > #plansPanel {
    opacity: 1 !important;
    pointer-events: auto !important;
  }

  .app.mobile-stacked-layout.mobile-sidebar-open > #sidebar {
    height: min(42dvh, 430px) !important;
    max-height: min(42dvh, 430px) !important;
    min-height: 185px !important;
    overflow: auto !important;
  }

  .app.mobile-stacked-layout.plans-panel-visible > #plansPanel {
    height: clamp(380px, 72dvh, 760px) !important;
    min-height: 380px !important;
    max-height: 760px !important;
    overflow: hidden !important;
  }
}

@media (max-height: 620px) and (max-width: 1400px), (max-width: 820px), (pointer: coarse) and (max-width: 1100px) and (max-height: 620px) {
  .viewer-card {
    overflow: hidden !important;
  }

  .viewer-actions.floating-actions,
  .floating-actions {
    position: absolute !important;
    left: 8px !important;
    right: 8px !important;
    bottom: max(8px, env(safe-area-inset-bottom)) !important;
    top: auto !important;
    transform: none !important;
    width: auto !important;
    max-width: none !important;
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: wrap !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 4px !important;
    padding: 4px !important;
    border-radius: 12px !important;
    overflow: visible !important;
    z-index: 120 !important;
  }

  .viewer-actions button,
  .viewer-actions button.measure-mini-button {
    display: inline-grid !important;
    place-items: center !important;
    width: 28px !important;
    height: 28px !important;
    min-width: 28px !important;
    min-height: 28px !important;
    padding: 0 !important;
    flex: 0 0 auto !important;
  }

  .viewer-actions .tool-icon {
    width: 17px !important;
    height: 17px !important;
  }
}

/* Obras: reportes semanal y diario */
#worksWeeklyReportSection:not(.collapsed),
#worksDailyReportSection:not(.collapsed) {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
#worksWeeklyReportSection:not(.collapsed) > .works-section-body,
#worksDailyReportSection:not(.collapsed) > .works-section-body {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: auto;
}
#worksWeeklyReportContent,
#worksDailyReportContent {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.works-temporal-report {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
  min-height: 0;
  color: #e5f3ff;
}
.works-temporal-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid rgba(148,163,184,0.24);
  border-radius: 9px;
  background: rgba(30,41,59,0.82);
}
.works-temporal-title {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 2px;
}
.works-temporal-title strong {
  color: #f8fafc;
  font-size: 13px;
  font-weight: 850;
}
.works-temporal-title span {
  overflow: hidden;
  color: #93c5fd;
  font-size: 11px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.works-temporal-year {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 6px;
  color: #bfdbfe;
  font-size: 11px;
  font-weight: 800;
}
.works-temporal-year input {
  width: 82px;
  height: 28px;
  box-sizing: border-box;
  border: 1px solid rgba(148,163,184,0.48);
  border-radius: 6px;
  background: #0f172a;
  color: #f8fafc;
  padding: 3px 6px;
  font-size: 12px;
  font-weight: 750;
}
.works-temporal-calendar {
  padding: 9px;
  border: 1px solid rgba(148,163,184,0.24);
  border-radius: 10px;
  background: linear-gradient(180deg, rgba(30,41,59,0.82), rgba(15,23,42,0.78));
}
.works-calendar-weekdays,
.works-calendar-week {
  display: grid;
  grid-template-columns: repeat(7, minmax(28px, 1fr));
  gap: 4px;
}
.works-calendar-weekdays {
  margin-bottom: 5px;
}
.works-calendar-weekdays span {
  color: #93c5fd;
  font-size: 10px;
  font-weight: 850;
  text-align: center;
}
.works-calendar-grid {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.works-calendar-week {
  padding: 3px;
  border: 1px solid transparent;
  border-radius: 7px;
  transition: background 0.14s ease, border-color 0.14s ease, box-shadow 0.14s ease;
}
.works-temporal-calendar.weekly-mode .works-calendar-week {
  cursor: pointer;
}
.works-temporal-calendar.weekly-mode .works-calendar-week:hover {
  border-color: rgba(56,189,248,0.72);
  background: rgba(14,165,233,0.15);
}
.works-temporal-calendar.weekly-mode .works-calendar-week.selected {
  border-color: #38bdf8;
  background: rgba(14,165,233,0.28);
  box-shadow: inset 3px 0 0 #38bdf8;
}
.works-calendar-day {
  min-width: 0;
  height: 30px;
  padding: 0;
  border: 1px solid rgba(148,163,184,0.20);
  border-radius: 6px;
  background: rgba(15,23,42,0.76);
  color: #e5f3ff;
  font-size: 11px;
  font-weight: 800;
  text-align: center;
}
.works-calendar-day.empty {
  border-color: transparent;
  background: transparent;
}
.works-temporal-calendar.daily-mode .works-calendar-day:not(.empty) {
  cursor: pointer;
}
.works-temporal-calendar.daily-mode .works-calendar-day:not(.empty):hover {
  border-color: rgba(56,189,248,0.78);
  background: rgba(14,165,233,0.18);
}
.works-temporal-calendar.daily-mode .works-calendar-day.selected {
  border-color: #7dd3fc;
  background: #0284c7;
  color: #ffffff;
  box-shadow: 0 0 0 2px rgba(56,189,248,0.24);
}
.works-calendar-help {
  margin-top: 7px;
  color: #bfdbfe;
  font-size: 10px;
  line-height: 1.35;
  text-align: center;
}
.works-temporal-period {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid rgba(148,163,184,0.22);
  border-radius: 8px;
  background: rgba(15,23,42,0.72);
}
.works-temporal-period strong {
  min-width: 0;
  overflow: hidden;
  color: #f8fafc;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.works-temporal-period span {
  flex: 0 0 auto;
  color: #93c5fd;
  font-size: 10px;
  font-weight: 700;
}
.works-temporal-content {
  display: grid;
  grid-template-columns: minmax(220px, 0.62fr) minmax(420px, 1.38fr);
  gap: 10px;
  min-width: 0;
  min-height: 0;
}
.works-temporal-pie-card {
  display: flex;
  min-width: 0;
  align-items: center;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  padding: 8px;
  border: 1px solid rgba(148,163,184,0.22);
  border-radius: 10px;
  background: rgba(15,23,42,0.72);
}
.works-temporal-pie {
  width: min(100%, 300px);
  height: auto;
  min-height: 220px;
  overflow: visible;
}
.works-temporal-pie-slice {
  cursor: pointer;
  stroke: rgba(15,23,42,0.92);
  stroke-width: 2;
  transition: opacity 0.14s ease, filter 0.14s ease;
}
.works-temporal-pie-slice:hover,
.works-temporal-pie-slice.selected {
  filter: brightness(1.16);
  stroke: #ffffff;
  stroke-width: 3;
}
.works-temporal-pie-hole {
  fill: #0f172a;
  stroke: rgba(148,163,184,0.24);
  stroke-width: 1;
}
.works-temporal-pie-total {
  fill: #f8fafc;
  font-size: 16px;
  font-weight: 900;
}
.works-temporal-pie-unit {
  fill: #93c5fd;
  font-size: 10px;
  font-weight: 750;
}
.works-temporal-pie-caption {
  color: #bfdbfe;
  font-size: 10px;
  font-weight: 700;
  text-align: center;
}
.works-temporal-table-wrap {
  min-width: 0;
  max-height: clamp(260px, 42vh, 620px);
  overflow: auto;
  border: 1px solid rgba(148,163,184,0.22);
  border-radius: 10px;
  background: rgba(15,23,42,0.72);
}
.works-temporal-table {
  width: 100%;
  min-width: 690px;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 11px;
  user-select: none;
}
.works-temporal-table th,
.works-temporal-table td {
  padding: 7px 7px;
  border-bottom: 1px solid rgba(148,163,184,0.16);
  color: #e5f3ff;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.works-temporal-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #1e293b;
  color: #bfdbfe;
  font-weight: 850;
  text-align: left;
}
.works-temporal-table tbody tr {
  cursor: pointer;
}
.works-temporal-table tbody tr:hover {
  background: rgba(14,165,233,0.15);
}
.works-temporal-table tbody tr.selected {
  background: rgba(14,165,233,0.28);
  box-shadow: inset 3px 0 0 #38bdf8;
}
.works-temporal-table th:nth-child(1),
.works-temporal-table td:nth-child(1) { width: 32px; text-align: center; }
.works-temporal-table th:nth-child(2),
.works-temporal-table td:nth-child(2) { width: 118px; }
.works-temporal-table th:nth-child(3),
.works-temporal-table td:nth-child(3) { width: auto; }
.works-temporal-table th:nth-child(4),
.works-temporal-table td:nth-child(4) { width: 72px; text-align: center; }
.works-temporal-table th:nth-child(5),
.works-temporal-table td:nth-child(5) { width: 105px; text-align: right; }
.works-temporal-swatch {
  display: inline-block;
  width: 17px;
  height: 17px;
  border: 1px solid rgba(255,255,255,0.78);
  border-radius: 4px;
  box-shadow: inset 0 0 0 1px rgba(2,6,23,0.28);
}
.works-temporal-empty {
  min-height: 70px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}
@media (max-width: 980px) {
  .works-temporal-content { grid-template-columns: 1fr; }
  .works-temporal-pie { width: min(100%, 280px); }
}
@media (max-width: 620px) {
  .works-temporal-toolbar,
  .works-temporal-period { align-items: stretch; flex-direction: column; }
  .works-temporal-period span { white-space: normal; }
  .works-calendar-weekdays,
  .works-calendar-week { grid-template-columns: repeat(7, minmax(24px, 1fr)); gap: 2px; }
  .works-calendar-day { height: 28px; }
}

/* Configuraciones guardadas del panel Obras */
.works-saved-config-header {
  flex: 0 0 auto;
  min-width: 0;
  padding: 0 !important;
  border-bottom: 0 !important;
  background: transparent !important;
}
.works-saved-config-bar {
  width: 100%;
  min-width: 0;
  display: grid;
  grid-template-columns: auto minmax(150px, 1fr) minmax(150px, 1fr) auto;
  align-items: center;
  gap: 7px;
  padding: 8px;
  box-sizing: border-box;
  border: 1px solid rgba(148,163,184,0.28);
  border-radius: 8px;
  background: rgba(30,41,59,0.82);
}
.works-saved-config-save-button,
.works-saved-config-delete-button,
.works-saved-config-name-input,
.works-saved-config-select {
  min-height: 32px;
  border-radius: 6px;
  border: 1px solid rgba(148,163,184,0.34);
  box-sizing: border-box;
  font: inherit;
  font-size: 12px;
}
.works-saved-config-name-input,
.works-saved-config-select {
  width: 100%;
  min-width: 0;
  padding: 6px 9px;
  color: #f8fafc;
  background: rgba(15,23,42,0.96);
  outline: none;
}
.works-saved-config-name-input:focus,
.works-saved-config-select:focus {
  border-color: #38bdf8;
  box-shadow: 0 0 0 2px rgba(56,189,248,0.14);
}
.works-saved-config-select.dirty {
  border-color: rgba(251,191,36,0.78);
}
.works-saved-config-save-button,
.works-saved-config-delete-button {
  padding: 6px 11px;
  color: #f8fafc;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
}
.works-saved-config-save-button {
  background: #0284c7;
  border-color: #0ea5e9;
}
.works-saved-config-save-button:hover:not(:disabled) {
  background: #0369a1;
}
.works-saved-config-delete-button {
  background: rgba(127,29,29,0.88);
  border-color: rgba(248,113,113,0.52);
}
.works-saved-config-delete-button:hover:not(:disabled) {
  background: rgba(153,27,27,0.96);
}
.works-saved-config-save-button:disabled,
.works-saved-config-delete-button:disabled {
  opacity: 0.48;
  cursor: default;
}
@media (max-width: 760px) {
  .works-saved-config-bar {
    grid-template-columns: auto minmax(0, 1fr) auto;
  }
  .works-saved-config-select {
    grid-column: 1 / span 2;
    grid-row: 2;
  }
  .works-saved-config-delete-button {
    grid-column: 3;
    grid-row: 2;
  }
}


/* Reportes semanal y diario: mismo patrón visual que el resumen mensual */
.works-temporal-summary-main {
  align-items: stretch;
}
.works-temporal-period-controls {
  min-height: 0;
}
.works-temporal-period-controls-scroll {
  min-height: 0;
  max-height: 330px;
  overflow: auto;
  border-radius: 7px;
}
.works-temporal-period-controls .works-month-controls-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
}
.works-temporal-details {
  display: flex;
  min-width: 0;
  min-height: 0;
  flex-direction: column;
  gap: 8px;
  padding: 9px;
  border: 1px solid rgba(148,163,184,0.22);
  border-radius: 10px;
  background: rgba(15,23,42,0.72);
}
.works-temporal-details .works-temporal-table-wrap {
  max-height: clamp(260px, 40vh, 600px);
}
.works-calendar-week.has-progress {
  box-shadow: inset 3px 0 0 var(--works-period-color, #38bdf8);
}
.works-temporal-calendar.weekly-mode .works-calendar-week.has-progress:hover {
  border-color: var(--works-period-color, #38bdf8);
}
.works-temporal-calendar.weekly-mode .works-calendar-week.selected {
  border-color: var(--works-period-color, #38bdf8);
  box-shadow: inset 4px 0 0 var(--works-period-color, #38bdf8), 0 0 0 1px rgba(255,255,255,0.12);
}
.works-calendar-day.has-progress {
  box-shadow: inset 0 -3px 0 var(--works-period-color, #38bdf8);
}
.works-temporal-calendar.daily-mode .works-calendar-day.has-progress:hover {
  border-color: var(--works-period-color, #38bdf8);
}
.works-temporal-calendar.daily-mode .works-calendar-day.selected {
  border-color: #ffffff;
  background: var(--works-period-color, #0284c7);
  color: #ffffff;
  box-shadow: 0 0 0 2px rgba(255,255,255,0.22), inset 0 -3px 0 rgba(255,255,255,0.45);
}
@media (max-width: 980px) {
  .works-temporal-summary-main {
    grid-template-columns: 1fr;
  }
  .works-temporal-period-controls-scroll {
    max-height: 290px;
  }
}

/* ===== Obras v22: altura útil de tablas y scroll por desplegable ===== */
.works-panel {
  --works-six-row-table-height: 232px;
}

/* Cada bloque abierto conserva su propio desplazamiento. De esta manera el
   contenido interno no se comprime hasta dejar visible una sola partida. */
.works-section:not(.collapsed) > .works-section-body,
#worksSummarySection:not(.collapsed) > .works-section-body,
#worksWeeklyReportSection:not(.collapsed) > .works-section-body,
#worksDailyReportSection:not(.collapsed) > .works-section-body {
  overflow-x: auto !important;
  overflow-y: auto !important;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

/* El contenido completo se mantiene a su altura natural; cuando no entra,
   quien desplaza es el cuerpo del desplegable y no se aplasta la tabla. */
#worksSummaryContent,
#worksWeeklyReportContent,
#worksDailyReportContent,
.works-month-summary-panel,
.works-temporal-report {
  flex: 0 0 auto !important;
  min-height: 0;
}

#worksPartidasSection:not(.collapsed) .works-partidas-panel {
  flex: 0 0 auto;
}

/* Las tablas muestran como mínimo el encabezado y seis partidas. A partir de
   esa altura usan su propio scroll vertical para el resto de filas. */
#worksPartidasSection:not(.collapsed) .works-partidas-table-wrap,
.works-month-details-table-wrap,
.works-temporal-details .works-temporal-table-wrap {
  flex: 0 0 auto !important;
  min-height: var(--works-six-row-table-height) !important;
  height: clamp(var(--works-six-row-table-height), 38vh, 470px);
  max-height: 470px !important;
  overflow: auto !important;
  scrollbar-gutter: stable;
}

.works-month-details,
.works-temporal-details {
  flex: 0 0 auto !important;
  min-height: 0;
}

/* ===== Obras v22: calendario semanal/diario desplegable ===== */
.works-calendar-disclosure {
  min-width: 0;
  border: 1px solid rgba(148,163,184,0.24);
  border-radius: 9px;
  overflow: hidden;
  background: rgba(15,23,42,0.72);
}
.works-calendar-disclosure-toggle {
  width: 100%;
  min-height: 34px;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 6px 10px;
  border: 0;
  background: rgba(30,41,59,0.90);
  color: #f8fafc;
  cursor: pointer;
  text-align: left;
}
.works-calendar-disclosure-toggle:hover {
  background: rgba(51,65,85,0.94);
}
.works-calendar-disclosure-toggle strong {
  min-width: 0;
  color: #f8fafc;
  font-size: 12px;
  font-weight: 850;
}
.works-calendar-disclosure-toggle > span:last-child {
  margin-left: auto;
  color: #93c5fd;
  font-size: 10px;
  font-weight: 750;
  white-space: nowrap;
}
.works-calendar-disclosure-caret {
  flex: 0 0 auto;
  display: inline-block;
  transform: rotate(90deg);
  transition: transform 0.16s ease;
  color: #7dd3fc;
  font-size: 10px;
}
.works-calendar-disclosure.collapsed .works-calendar-disclosure-caret {
  transform: rotate(0deg);
}
.works-calendar-disclosure-body {
  padding: 8px;
  border-top: 1px solid rgba(148,163,184,0.20);
}
.works-calendar-disclosure.collapsed .works-calendar-disclosure-body {
  display: none;
}
.works-calendar-disclosure-body .works-temporal-calendar {
  border: 0;
  border-radius: 0;
  background: transparent;
  padding: 0;
}

@media (max-height: 720px) {
  .works-panel {
    --works-six-row-table-height: 218px;
  }
}

/* ===== Obras v25: selección desde cabecera y corrección de fechas inválidas ===== */
.works-select-all-color-header {
  width: 36px !important;
  min-width: 36px !important;
  max-width: 36px !important;
  padding: 5px 7px !important;
  text-align: center !important;
  overflow: visible !important;
}
.works-select-all-color-button {
  display: inline-block;
  width: 18px;
  height: 18px;
  min-width: 18px;
  padding: 0;
  border: 1px solid rgba(255,255,255,0.82);
  border-radius: 4px;
  cursor: pointer;
  vertical-align: middle;
  box-shadow: inset 0 0 0 1px rgba(2,6,23,0.30), 0 0 0 1px rgba(56,189,248,0.10);
}
.works-select-all-color-button:hover:not(:disabled) {
  outline: 2px solid rgba(56,189,248,0.78);
  outline-offset: 1px;
}
.works-select-all-color-button:disabled {
  opacity: 0.38;
  cursor: default;
}

/* La primera columna de Partidas avanzadas es exclusivamente el color. */
.works-month-details-table th:nth-child(1),
.works-month-details-table td:nth-child(1) { width: 36px !important; text-align: center; }
.works-month-details-table th:nth-child(2),
.works-month-details-table td:nth-child(2) { width: 140px !important; }
.works-month-details-table th:nth-child(3),
.works-month-details-table td:nth-child(3) { width: auto !important; text-align: left; }
.works-month-details-table th:nth-child(4),
.works-month-details-table td:nth-child(4) { width: 80px !important; text-align: center; }
.works-month-details-table th:nth-child(5),
.works-month-details-table td:nth-child(5) { width: 120px !important; text-align: right; }

.works-invalid-date-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  padding: 4px 7px;
  border: 1px solid rgba(248,113,113,0.55);
  border-radius: 7px;
  background: rgba(127,29,29,0.22);
  color: #fecaca;
  font-size: 11px;
  font-weight: 800;
  line-height: 1.2;
  cursor: pointer;
  text-align: right;
}
.works-invalid-date-toggle:hover {
  border-color: rgba(252,165,165,0.90);
  background: rgba(153,27,27,0.36);
}
.works-invalid-date-caret {
  display: inline-block;
  flex: 0 0 auto;
  color: #fca5a5;
  font-size: 9px;
  transform: rotate(0deg);
  transition: transform 0.16s ease;
}
.works-invalid-date-toggle[aria-expanded="true"] .works-invalid-date-caret {
  transform: rotate(90deg);
}
.works-invalid-dates-disclosure {
  min-width: 0;
  border: 1px solid rgba(248,113,113,0.34);
  border-radius: 9px;
  overflow: hidden;
  background: rgba(69,10,10,0.16);
}
.works-invalid-dates-disclosure.collapsed {
  display: none;
}
.works-invalid-dates-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 9px;
}
.works-invalid-dates-help {
  color: #fecaca;
  font-size: 10px;
  line-height: 1.35;
}
.works-invalid-dates-toolbar {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}
.works-invalid-date-bulk-input,
.works-invalid-date-inline-input {
  min-width: 0;
  border: 1px solid rgba(148,163,184,0.45);
  border-radius: 6px;
  background: rgba(15,23,42,0.94);
  color: #f8fafc;
  font: inherit;
  outline: none;
}
.works-invalid-date-bulk-input {
  width: 150px;
  padding: 6px 8px;
  font-size: 11px;
}
.works-invalid-date-inline-input {
  width: 100%;
  padding: 4px 6px;
  font-size: 11px;
}
.works-invalid-date-bulk-input:focus,
.works-invalid-date-inline-input:focus {
  border-color: rgba(56,189,248,0.92);
  box-shadow: 0 0 0 2px rgba(14,165,233,0.18);
}
.works-invalid-date-bulk-input.invalid,
.works-invalid-date-inline-input.invalid {
  border-color: #f87171;
  box-shadow: 0 0 0 2px rgba(248,113,113,0.18);
}
.works-invalid-date-apply {
  padding: 6px 9px;
  border: 1px solid rgba(56,189,248,0.58);
  border-radius: 7px;
  background: rgba(14,165,233,0.18);
  color: #e0f2fe;
  font-size: 10px;
  font-weight: 850;
  white-space: nowrap;
  cursor: pointer;
}
.works-invalid-date-apply:hover {
  background: rgba(14,165,233,0.34);
  border-color: rgba(125,211,252,0.92);
}
.works-invalid-dates-table-wrap {
  max-height: 270px;
  overflow: auto;
  border: 1px solid rgba(148,163,184,0.22);
  border-radius: 8px;
  background: rgba(15,23,42,0.74);
  scrollbar-gutter: stable;
}
.works-invalid-dates-table {
  width: 100%;
  min-width: 700px;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 11px;
}
.works-invalid-dates-table th,
.works-invalid-dates-table td {
  padding: 6px 7px;
  border-bottom: 1px solid rgba(148,163,184,0.16);
  color: #e5f3ff;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.works-invalid-dates-table th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #1e293b;
  color: #bfdbfe;
  font-weight: 850;
  text-align: left;
}
.works-invalid-dates-table th:nth-child(1),
.works-invalid-dates-table td:nth-child(1) { width: 36px; text-align: center; }
.works-invalid-dates-table th:nth-child(2),
.works-invalid-dates-table td:nth-child(2) { width: 250px; }
.works-invalid-dates-table th:nth-child(3),
.works-invalid-dates-table td:nth-child(3) { width: 190px; }
.works-invalid-dates-table th:nth-child(4),
.works-invalid-dates-table td:nth-child(4) { width: auto; }
.works-invalid-dates-table tbody tr:hover {
  background: rgba(248,113,113,0.08);
}
.works-invalid-dates-table tbody tr.readonly {
  opacity: 0.62;
}
.works-invalid-date-value.editable {
  color: #fde68a;
  cursor: text;
}
.works-invalid-date-value.editable:hover {
  background: rgba(250,204,21,0.08);
}
.works-invalid-date-value.editing {
  padding: 2px 4px;
  overflow: visible;
}

@media (max-width: 720px) {
  .works-month-summary-header {
    align-items: stretch;
    flex-direction: column;
  }
  .works-invalid-date-toggle {
    justify-content: flex-start;
    text-align: left;
  }
  .works-invalid-dates-toolbar {
    align-items: stretch;
    flex-direction: column;
  }
  .works-invalid-date-bulk-input,
  .works-invalid-date-apply {
    width: 100%;
  }
}

/* ===== Obras v26: tabla simple de fechas inválidas y selección múltiple ===== */
.works-invalid-dates-body {
  gap: 0;
  padding: 8px;
}
.works-invalid-dates-table {
  min-width: 620px;
}
.works-invalid-dates-table th:nth-child(1),
.works-invalid-dates-table td:nth-child(1) {
  width: 280px;
  text-align: left;
}
.works-invalid-dates-table th:nth-child(2),
.works-invalid-dates-table td:nth-child(2) {
  width: 210px;
  text-align: left;
}
.works-invalid-dates-table th:nth-child(3),
.works-invalid-dates-table td:nth-child(3) {
  width: auto;
  text-align: left;
}
.works-invalid-dates-table tbody tr {
  cursor: pointer;
  user-select: none;
}
.works-invalid-dates-table tbody tr.selected {
  background: rgba(14,165,233,0.22);
  box-shadow: inset 3px 0 0 #38bdf8;
}
.works-invalid-dates-table tbody tr.selected:hover {
  background: rgba(14,165,233,0.28);
}
.works-invalid-date-value.editable {
  color: #fde68a;
  cursor: default;
}
.works-invalid-date-value.editable:hover {
  background: rgba(250,204,21,0.06);
}
.works-invalid-date-value.editing {
  cursor: text;
  user-select: text;
}

/* ===== Obras v27: altura flexible y contexto opcional en reportes ===== */
/* El panel completo puede desplazarse cuando varios desplegables abiertos ya
   no caben conservando la altura mínima de sus tablas. */
.works-panel {
  --works-six-row-table-height: 232px;
  --works-open-section-min-height: 316px;
  overflow-x: hidden !important;
  overflow-y: auto !important;
  scrollbar-gutter: stable;
  overscroll-behavior: contain;
}

.works-saved-config-header,
.works-section.collapsed {
  flex: 0 0 auto !important;
}

/* Un bloque abierto crece para usar todo el espacio libre. Si hay varios y la
   suma de sus mínimos no entra, el scroll se genera en el panel Obras. */
.works-section:not(.collapsed) {
  flex: 1 1 0 !important;
  min-height: var(--works-open-section-min-height) !important;
}

#worksPartidasSection:not(.collapsed) {
  min-height: calc(var(--works-six-row-table-height) + 92px) !important;
}

#worksSummarySection:not(.collapsed),
#worksWeeklyReportSection:not(.collapsed),
#worksDailyReportSection:not(.collapsed) {
  min-height: calc(var(--works-six-row-table-height) + 108px) !important;
}

/* El cuerpo del desplegable es el desplazamiento general de su contenido.
   Estructura de partidas mantiene la búsqueda fija y desplaza solo la tabla. */
.works-section:not(.collapsed) > .works-section-body,
#worksSummarySection:not(.collapsed) > .works-section-body,
#worksWeeklyReportSection:not(.collapsed) > .works-section-body,
#worksDailyReportSection:not(.collapsed) > .works-section-body {
  flex: 1 1 auto !important;
  min-height: 0 !important;
  overflow-x: auto !important;
  overflow-y: auto !important;
  scrollbar-gutter: stable;
}

#worksPartidasSection:not(.collapsed) > .works-section-body {
  overflow: hidden !important;
}

#worksPartidasSection:not(.collapsed) .works-partidas-panel {
  flex: 1 1 auto !important;
  min-height: 0 !important;
}

/* Las tablas ya no tienen una altura máxima rígida. Crecen con el desplegable
   y solamente activan su scroll tras conservar seis filas visibles. */
#worksPartidasSection:not(.collapsed) .works-partidas-table-wrap,
.works-month-details-table-wrap,
.works-temporal-details .works-temporal-table-wrap {
  flex: 1 1 0 !important;
  height: auto !important;
  min-height: var(--works-six-row-table-height) !important;
  max-height: none !important;
  overflow: auto !important;
  scrollbar-gutter: stable;
}

#worksSummaryContent,
#worksWeeklyReportContent,
#worksDailyReportContent,
.works-month-summary-panel,
.works-temporal-report {
  flex: 1 1 auto !important;
  min-height: 0 !important;
}

.works-month-details,
.works-temporal-details {
  flex: 1 1 auto !important;
  min-height: calc(var(--works-six-row-table-height) + 42px) !important;
}

/* Opción para mantener visible el contexto general del modelo. */
.works-temporal-context-toggle {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 28px;
  padding: 4px 9px;
  border: 1px solid rgba(148,163,184,0.34);
  border-radius: 7px;
  background: rgba(15,23,42,0.64);
  color: #dbeafe;
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
  user-select: none;
}
.works-temporal-context-toggle:hover {
  border-color: rgba(56,189,248,0.72);
  background: rgba(14,165,233,0.14);
}
.works-temporal-context-toggle input {
  width: 15px;
  height: 15px;
  margin: 0;
  accent-color: #0ea5e9;
  cursor: pointer;
}

@media (max-width: 720px) {
  .works-panel {
    --works-six-row-table-height: 218px;
    --works-open-section-min-height: 300px;
  }
  .works-temporal-toolbar {
    align-items: stretch;
  }
  .works-temporal-context-toggle {
    align-self: flex-start;
  }
}


/* ===== Obras v28: scroll independiente por desplegable ===== */
/* El panel deja de desplazarse como un bloque único. Los desplegables abiertos
   comparten la altura disponible y cada uno administra su propio contenido. */
.works-panel {
  overflow: hidden !important;
}

/* Un único desplegable sigue usando todo el espacio. Con dos o más abiertos,
   Flexbox reparte la altura entre ellos y permite que se reduzcan sin quedar
   fuera del panel. El encabezado siempre permanece visible. */
.works-section:not(.collapsed),
#worksConfigSection:not(.collapsed),
#worksPartidasSection:not(.collapsed),
#worksSummarySection:not(.collapsed),
#worksWeeklyReportSection:not(.collapsed),
#worksDailyReportSection:not(.collapsed) {
  flex: 1 1 0 !important;
  min-height: 96px !important;
  max-height: none !important;
}

/* El scroll vertical general pertenece al cuerpo de cada desplegable. De esta
   forma se puede recorrer pastel, controles, calendario y tabla sin depender
   del desplazamiento completo del panel Obras. */
.works-section:not(.collapsed) > .works-section-body,
#worksConfigSection:not(.collapsed) > .works-section-body,
#worksPartidasSection:not(.collapsed) > .works-section-body,
#worksSummarySection:not(.collapsed) > .works-section-body,
#worksWeeklyReportSection:not(.collapsed) > .works-section-body,
#worksDailyReportSection:not(.collapsed) > .works-section-body {
  flex: 1 1 auto !important;
  min-height: 0 !important;
  overflow-x: auto !important;
  overflow-y: auto !important;
  scrollbar-gutter: stable;
  overscroll-behavior: contain;
}

/* Los reportes conservan su altura natural dentro del cuerpo desplazable. Esto
   evita que los gráficos y tablas se compriman o desaparezcan al abrir dos
   reportes simultáneamente. */
#worksSummarySection:not(.collapsed) > .works-section-body,
#worksWeeklyReportSection:not(.collapsed) > .works-section-body,
#worksDailyReportSection:not(.collapsed) > .works-section-body {
  display: block !important;
}

#worksSummaryContent,
#worksWeeklyReportContent,
#worksDailyReportContent,
.works-month-summary-panel,
.works-temporal-report {
  flex: 0 0 auto !important;
  height: auto !important;
  min-height: 0 !important;
  overflow: visible !important;
}

/* Estructura de partidas continúa aprovechando todo el espacio cuando es el
   único bloque abierto. Si su mínimo ya no cabe, el cuerpo del desplegable se
   desplaza sin reducir la tabla por debajo de seis filas. */
#worksPartidasSection:not(.collapsed) > .works-section-body {
  display: flex !important;
  flex-direction: column !important;
}

#worksPartidasSection:not(.collapsed) .works-partidas-panel {
  flex: 1 0 auto !important;
  min-height: calc(var(--works-six-row-table-height) + 42px) !important;
}

#worksPartidasSection:not(.collapsed) .works-partidas-table-wrap {
  flex: 1 1 0 !important;
  height: auto !important;
  min-height: var(--works-six-row-table-height) !important;
  max-height: none !important;
  overflow: auto !important;
}

/* En los reportes, la tabla mantiene el mínimo de seis filas; el desplazamiento
   general del desplegable permite llegar a ella aunque arriba haya gráficos o
   calendarios abiertos. */
.works-month-details,
.works-temporal-details {
  flex: 0 0 auto !important;
  min-height: calc(var(--works-six-row-table-height) + 42px) !important;
}

.works-month-details-table-wrap,
.works-temporal-details .works-temporal-table-wrap {
  flex: 0 0 auto !important;
  height: var(--works-six-row-table-height) !important;
  min-height: var(--works-six-row-table-height) !important;
  max-height: var(--works-six-row-table-height) !important;
  overflow: auto !important;
}

@media (max-height: 620px), (max-width: 820px) {
  .works-section:not(.collapsed),
  #worksConfigSection:not(.collapsed),
  #worksPartidasSection:not(.collapsed),
  #worksSummarySection:not(.collapsed),
  #worksWeeklyReportSection:not(.collapsed),
  #worksDailyReportSection:not(.collapsed) {
    min-height: 82px !important;
  }
}

/* ===== Obras v29: Partidas avanzadas ocupa toda la altura libre ===== */
/*
   Regla de distribución:
   1) Si el desplegable dispone de altura libre, Partidas avanzadas crece y la
      tabla aprovecha todo ese espacio antes de activar su scroll interno.
   2) Si el contenido superior (pastel, controles, calendario, etc.) más seis
      filas no cabe, el cuerpo completo del desplegable conserva su scroll
      vertical general.
*/
#worksSummarySection:not(.collapsed) > .works-section-body,
#worksWeeklyReportSection:not(.collapsed) > .works-section-body,
#worksDailyReportSection:not(.collapsed) > .works-section-body {
  display: flex !important;
  flex-direction: column !important;
  align-items: stretch !important;
  overflow-x: auto !important;
  overflow-y: auto !important;
}

/* El contenido del reporte llena como mínimo el alto útil del cuerpo. Si sus
   mínimos exceden ese alto, crece naturalmente y lo recorre el scroll general
   del desplegable. */
#worksSummaryContent,
#worksWeeklyReportContent,
#worksDailyReportContent {
  display: flex !important;
  flex-direction: column !important;
  flex: 1 1 auto !important;
  width: 100% !important;
  min-height: 100% !important;
  height: auto !important;
  overflow: visible !important;
}

.works-month-summary-panel,
.works-temporal-report {
  display: flex !important;
  flex-direction: column !important;
  flex: 1 1 auto !important;
  width: 100% !important;
  min-height: 0 !important;
  height: auto !important;
  overflow: visible !important;
}

/* Pastel, controles, barras y calendario conservan su altura natural. El
   espacio sobrante se entrega al bloque de Partidas avanzadas. */
.works-month-summary-header,
.works-month-summary-main,
.works-invalid-date-disclosure,
.works-temporal-toolbar,
.works-temporal-summary-main,
.works-calendar-disclosure,
.works-temporal-period {
  flex: 0 0 auto !important;
}

.works-month-details,
.works-temporal-details {
  display: flex !important;
  flex-direction: column !important;
  flex: 1 1 0 !important;
  height: auto !important;
  min-height: calc(var(--works-six-row-table-height) + 42px) !important;
  overflow: hidden !important;
}

/* Se elimina la altura fija introducida en v28. La tabla se expande con el
   espacio libre, pero nunca baja del equivalente a seis partidas visibles. */
.works-month-details-table-wrap,
.works-temporal-details .works-temporal-table-wrap {
  flex: 1 1 auto !important;
  height: auto !important;
  min-height: var(--works-six-row-table-height) !important;
  max-height: none !important;
  overflow: auto !important;
  scrollbar-gutter: stable;
}

/* ===== Obras v30: scroll general completo para resumen y reportes ===== */
/*
   Cada desplegable abierto mantiene su propio scroll vertical. El contenido
   no se comprime para caber en la altura repartida entre varios bloques:
   conserva pastel, controles, calendario y Partidas avanzadas. Cuando el
   contenido supera el espacio visible, el cuerpo del desplegable permite
   recorrerlo completo, desde el encabezado hasta la última fila.
*/
#worksSummarySection:not(.collapsed) > .works-section-body,
#worksWeeklyReportSection:not(.collapsed) > .works-section-body,
#worksDailyReportSection:not(.collapsed) > .works-section-body {
  display: flex !important;
  flex-direction: column !important;
  min-height: 0 !important;
  overflow-x: auto !important;
  overflow-y: auto !important;
  scrollbar-gutter: stable;
  overscroll-behavior: contain;
}

/* height:100% aprovecha el espacio cuando sobra. min-height:max-content evita
   que Flexbox reduzca el contenido por debajo de su altura real cuando hay
   dos o más desplegables abiertos; así el exceso forma parte del scrollHeight
   del cuerpo y no queda recortado. */
#worksSummaryContent,
#worksWeeklyReportContent,
#worksDailyReportContent {
  display: flex !important;
  flex-direction: column !important;
  flex: 0 0 auto !important;
  flex-shrink: 0 !important;
  box-sizing: border-box !important;
  width: 100% !important;
  height: 100% !important;
  min-height: max-content !important;
  overflow: visible !important;
}

.works-month-summary-panel,
.works-temporal-report {
  display: flex !important;
  flex-direction: column !important;
  flex: 0 0 auto !important;
  flex-shrink: 0 !important;
  box-sizing: border-box !important;
  width: 100% !important;
  height: 100% !important;
  min-height: max-content !important;
  overflow: visible !important;
}

/* Pastel, controles, calendarios y barras de periodo mantienen siempre su
   altura natural. */
.works-month-summary-header,
.works-month-summary-main,
.works-invalid-dates-disclosure,
.works-temporal-toolbar,
.works-temporal-summary-main,
.works-calendar-disclosure,
.works-temporal-period {
  flex: 0 0 auto !important;
  flex-shrink: 0 !important;
}

/* Partidas avanzadas absorbe el espacio sobrante cuando lo hay, pero nunca se
   reduce por debajo del encabezado más seis filas. Cuando ese mínimo ya no
   entra, queda debajo y se alcanza usando el scroll general del desplegable. */
.works-month-details,
.works-temporal-details {
  display: flex !important;
  flex-direction: column !important;
  flex: 1 0 auto !important;
  flex-shrink: 0 !important;
  height: auto !important;
  min-height: calc(var(--works-six-row-table-height) + 42px) !important;
  overflow: hidden !important;
}

.works-month-details-table-wrap,
.works-temporal-details .works-temporal-table-wrap {
  flex: 1 1 auto !important;
  height: auto !important;
  min-height: var(--works-six-row-table-height) !important;
  max-height: none !important;
  overflow: auto !important;
  scrollbar-gutter: stable;
}

/* ===== Obras v31: panel móvil con triple de altura ===== */
@media (max-width: 1100px), (pointer: coarse) and (max-width: 1400px) {
  .app.mobile-stacked-layout.works-panel-visible > #worksPanel {
    height: clamp(780px, 168dvh, 1680px) !important;
    min-height: 780px !important;
    max-height: 1680px !important;
    overflow: auto !important;
    -webkit-overflow-scrolling: touch !important;
  }

  .app.mobile-stacked-layout.works-panel-visible > #worksPanel .works-panel {
    height: 100% !important;
    min-height: 100% !important;
    max-height: none !important;
  }
}

/* ===== Obras v32: Configuración desplazable y controles de partidas ===== */
/* Configuración conserva un scroll vertical propio cuando sus parámetros y
   reglas de metrado superan la altura repartida entre los desplegables. */
#worksConfigSection:not(.collapsed) > .works-section-body {
  display: flex !important;
  flex-direction: column !important;
  flex: 1 1 auto !important;
  min-height: 0 !important;
  overflow-x: auto !important;
  overflow-y: auto !important;
  scrollbar-gutter: stable;
  overscroll-behavior: contain;
}

#worksConfigSection:not(.collapsed) .works-config-grid {
  flex: 0 0 auto !important;
  min-height: max-content !important;
}

/* Opción explícita para evitar selecciones masivas accidentales en el visor. */
.works-partidas-options-row {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  min-width: 0;
}

.works-partidas-select-viewer-toggle {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 28px;
  padding: 4px 8px;
  border: 1px solid rgba(148,163,184,0.30);
  border-radius: 7px;
  background: rgba(15,23,42,0.62);
  color: #cbd5e1;
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
  user-select: none;
}

.works-partidas-select-viewer-toggle:hover {
  border-color: rgba(56,189,248,0.72);
  background: rgba(14,165,233,0.12);
  color: #f8fafc;
}

.works-partidas-select-viewer-toggle input {
  width: 15px;
  height: 15px;
  margin: 0;
  accent-color: #0ea5e9;
  cursor: pointer;
}

/* Las filas sólo muestran intención de selección cuando el control superior
   está activo. Los checks de la columna Usar funcionan siempre. */
.works-partidas-table tr.viewer-selection-enabled > td {
  cursor: pointer;
}

/* Los checks de agrupadores pueden quedar en estado parcial cuando sólo una
   parte de sus partidas hijas está habilitada. */
.works-partida-group-row .works-partida-report-check:not(:disabled) {
  opacity: 1;
}


/* ===== Obras v33: scroll real de Configuración e icono Guardar ===== */
/*
   El cuerpo de Configuración es un elemento flex dentro de una sección cuya
   altura se comparte con los demás desplegables. height: 0 fuerza a que tome
   únicamente el espacio libre asignado por Flexbox; todo el contenido que no
   entra (parámetros y reglas de metrado) pasa a formar parte de su scrollHeight
   y queda accesible mediante un scroll vertical general del bloque.
*/
#worksConfigSection:not(.collapsed) {
  overflow: hidden !important;
}

#worksConfigSection:not(.collapsed) > #worksConfigBody {
  display: block !important;
  flex: 1 1 0 !important;
  width: 100% !important;
  height: 0 !important;
  min-height: 0 !important;
  max-height: none !important;
  overflow-x: auto !important;
  overflow-y: auto !important;
  scrollbar-gutter: stable;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

/* Los dos bloques deben conservar su altura natural dentro del área que se
   desplaza: primero la selección de parámetros y después el metrado de acero. */
#worksConfigBody > .works-config-grid,
#worksConfigBody > .works-measurement-rules-panel {
  display: grid;
  flex: 0 0 auto !important;
  height: auto !important;
  min-height: 0 !important;
}

#worksConfigBody > .works-measurement-rules-panel {
  display: block;
  margin-bottom: 2px;
}

/* Mismo símbolo de guardado utilizado en el panel Datos. */
.works-saved-config-save-button {
  width: 34px !important;
  min-width: 34px !important;
  height: 32px !important;
  min-height: 32px !important;
  padding: 0 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  font-size: 16px !important;
  line-height: 1 !important;
}


/* ===== Obras v34: botón Guardar con el estilo del panel Datos ===== */
/* Conserva el tamaño propio del panel Obras, pero elimina el relleno azul
   permanente. El botón usa el mismo borde, fondo neutro y estados visuales
   del botón Guardar del panel Datos. */
.works-saved-config-save-button {
  background: #111827 !important;
  border-color: #38bdf8 !important;
  color: #e0f2fe !important;
  box-shadow: none !important;
}

.works-saved-config-save-button:hover:not(:disabled) {
  background: #003f7f !important;
  border-color: #38bdf8 !important;
  color: #e0f2fe !important;
}

.works-saved-config-save-button:active:not(:disabled) {
  background: #075985 !important;
}

.works-saved-config-save-button:focus-visible {
  outline: 2px solid rgba(56, 189, 248, 0.48);
  outline-offset: 2px;
}

/* ===== Fase 16: vistas nativas de Revit superpuestas en el modelo 3D ===== */
.plans-native-views-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.plans-native-views-button.active,
.plans-native-views-button[aria-expanded="true"] {
  border-color: rgba(96, 190, 255, 0.86);
  background: rgba(0, 122, 255, 0.34);
}

.plans-native-views-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 19px;
  height: 19px;
  padding: 0 5px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.15);
  font-size: 10px;
  line-height: 1;
}

.plans-native-views-menu {
  position: absolute;
  top: 48px;
  left: 8px;
  z-index: 45;
  width: min(430px, calc(100% - 16px));
  max-height: min(520px, calc(100% - 62px));
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgba(148, 194, 235, 0.32);
  border-radius: 11px;
  background: rgba(14, 19, 27, 0.985);
  box-shadow: 0 16px 42px rgba(0, 0, 0, 0.48);
  color: #f7fbff;
}

.plans-native-views-menu.hidden {
  display: none !important;
}

.plans-native-views-menu-header {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 12px 13px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.09);
}

.plans-native-views-menu-header strong {
  font-size: 13px;
  line-height: 1.25;
}

.plans-native-views-menu-header span {
  color: rgba(230, 240, 250, 0.68);
  font-size: 11px;
  line-height: 1.35;
}

.plans-native-views-list {
  min-height: 54px;
  max-height: 342px;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 7px;
}

.plans-native-views-list::-webkit-scrollbar {
  width: 8px;
}

.plans-native-views-list::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(93, 173, 238, 0.48);
}

.plans-native-view-row + .plans-native-view-row {
  margin-top: 5px;
}

.plans-native-view-show {
  width: 100%;
  min-height: 46px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 9px 7px 10px;
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.045);
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.plans-native-view-show:hover,
.plans-native-view-row.active .plans-native-view-show {
  border-color: rgba(91, 177, 247, 0.64);
  background: rgba(0, 122, 255, 0.18);
}

.plans-native-view-text {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.plans-native-view-text strong,
.plans-native-view-text small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.plans-native-view-text strong {
  font-size: 12px;
  line-height: 1.25;
}

.plans-native-view-text small {
  color: rgba(225, 237, 248, 0.66);
  font-size: 10px;
}

.plans-native-view-state {
  flex: 0 0 auto;
  padding: 4px 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.09);
  color: rgba(239, 247, 255, 0.88);
  font-size: 10px;
  font-weight: 800;
}

.plans-native-view-row.active .plans-native-view-state {
  background: rgba(26, 157, 255, 0.28);
  color: #ffffff;
}

.plans-native-views-empty {
  padding: 17px 12px;
  color: rgba(230, 239, 248, 0.68);
  font-size: 12px;
  line-height: 1.4;
  text-align: center;
}

.plans-native-views-menu-footer {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 9px;
  border-top: 1px solid rgba(255, 255, 255, 0.09);
  background: rgba(5, 9, 15, 0.42);
}

.plans-native-opacity {
  min-width: 0;
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  color: rgba(237, 245, 252, 0.78);
  font-size: 10px;
  font-weight: 800;
}

.plans-native-opacity input[type="range"] {
  min-width: 70px;
  flex: 1 1 auto;
  accent-color: #4daeff;
}

.plans-native-footer-button {
  flex: 0 0 auto;
  height: 28px;
  padding: 0 9px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.07);
  color: #f7fbff;
  cursor: pointer;
  font-size: 10px;
  font-weight: 850;
}

.plans-native-footer-button:hover:not(:disabled) {
  border-color: rgba(81, 175, 250, 0.68);
  background: rgba(0, 122, 255, 0.22);
}

.plans-native-footer-button.danger:hover:not(:disabled) {
  border-color: rgba(255, 112, 112, 0.68);
  background: rgba(184, 30, 45, 0.25);
}

.plans-native-footer-button:disabled,
.plans-native-opacity input:disabled {
  opacity: 0.42;
  cursor: default;
}

@media (max-width: 760px) {
  .plans-native-views-menu {
    top: 48px;
    left: 6px;
    width: calc(100% - 12px);
    max-height: calc(100% - 58px);
  }

  .plans-native-views-menu-footer {
    flex-wrap: wrap;
  }

  .plans-native-opacity {
    flex-basis: 100%;
  }
}

/* ===== Obras v33: navegación compacta por menús ===== */
/* El bloque de configuraciones guardadas permanece arriba. Debajo se muestra
   una sola barra de navegación; cada opción sustituye a los antiguos
   desplegables sin modificar el contenido interno de las vistas. */
.works-panel {
  gap: 0 !important;
  overflow: hidden !important;
}

.works-saved-config-header {
  margin-bottom: 8px;
}

.works-menu {
  flex: 0 0 auto;
  width: 100%;
  min-width: 0;
  display: grid;
  grid-template-columns: 38px repeat(4, minmax(0, 1fr));
  align-items: stretch;
  gap: 4px;
  margin: 0 0 8px;
  padding: 5px;
  box-sizing: border-box;
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 8px;
  background: rgba(30, 41, 59, 0.82);
}

.works-menu-button {
  min-width: 0;
  height: 32px;
  padding: 0 8px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: rgba(15, 23, 42, 0.72);
  color: #cbd5e1;
  font: inherit;
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.works-menu-button:hover {
  background: rgba(51, 65, 85, 0.96);
  color: #f8fafc;
  border-color: rgba(148, 163, 184, 0.32);
}

.works-menu-button.active,
.works-menu-button[aria-selected="true"] {
  background: #0369a1;
  border-color: #38bdf8;
  color: #ffffff;
  box-shadow: inset 0 -2px 0 rgba(125, 211, 252, 0.9);
}

.works-menu-button:focus-visible {
  outline: 2px solid #7dd3fc;
  outline-offset: 1px;
}

.works-menu-icon-button {
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.works-menu-gear {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: Arial, "Segoe UI Symbol", sans-serif;
  font-size: 19px;
  line-height: 1;
}

/* Las pestañas sustituyen visualmente a los encabezados de acordeón. Solo la
   vista seleccionada ocupa el espacio disponible del panel. */
.works-section {
  width: 100%;
  flex: 1 1 auto !important;
  min-height: 0 !important;
  border-radius: 8px;
}

.works-section.collapsed {
  display: none !important;
}

.works-section:not(.collapsed),
#worksConfigSection:not(.collapsed),
#worksPartidasSection:not(.collapsed),
#worksSummarySection:not(.collapsed),
#worksWeeklyReportSection:not(.collapsed),
#worksDailyReportSection:not(.collapsed) {
  display: flex !important;
  flex: 1 1 auto !important;
  min-height: 0 !important;
}

.works-section:not(.collapsed) > .works-section-body,
#worksConfigSection:not(.collapsed) > .works-section-body,
#worksPartidasSection:not(.collapsed) > .works-section-body,
#worksSummarySection:not(.collapsed) > .works-section-body,
#worksWeeklyReportSection:not(.collapsed) > .works-section-body,
#worksDailyReportSection:not(.collapsed) > .works-section-body {
  flex: 1 1 auto !important;
  min-height: 0 !important;
}

.works-partidas-menu-status-row {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  min-height: 18px;
  margin-bottom: 4px;
}

.works-partidas-menu-status-row .works-partidas-summary {
  margin: 0;
}

@media (max-width: 620px) {
  .works-menu {
    grid-template-columns: 34px repeat(4, minmax(58px, 1fr));
    gap: 3px;
    padding: 4px;
    overflow-x: auto;
  }
  .works-menu-button {
    height: 31px;
    padding-inline: 6px;
    font-size: 11px;
  }
}

/* ===== Obras v36: reglas configurables de unidades y barras ===== */
.works-measurement-rules-panel {
  display: grid !important;
  gap: 10px;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  overflow: visible !important;
}

.works-rules-section {
  width: 100%;
  min-width: 0;
  overflow: hidden;
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 8px;
  background: rgba(2, 6, 23, 0.30);
  box-sizing: border-box;
}

.works-rule-header-title {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.works-rule-header-title strong {
  color: #f8fafc;
  font-size: 12px;
  line-height: 1.2;
}

.works-rule-header-title small {
  color: #94a3b8;
  font-size: 10px;
  font-weight: 500;
  line-height: 1.25;
}

.works-rule-add-button,
.works-rule-remove-button {
  border: 1px solid rgba(56, 189, 248, 0.62);
  border-radius: 6px;
  background: rgba(15, 23, 42, 0.92);
  color: #e0f2fe;
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
}

.works-rule-add-button {
  min-height: 27px;
  padding: 4px 9px;
  white-space: nowrap;
}

.works-rule-remove-button {
  width: 27px;
  min-width: 27px;
  height: 27px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  line-height: 1;
}

.works-rule-add-button:hover,
.works-rule-remove-button:hover:not(:disabled) {
  background: #003f7f;
}

.works-rule-remove-button:disabled {
  opacity: 0.32;
  cursor: default;
}

.works-unit-rules-list {
  display: grid;
  gap: 8px;
  padding: 9px;
}

.works-unit-rule-card {
  min-width: 0;
  padding: 8px;
  border: 1px solid rgba(148, 163, 184, 0.20);
  border-radius: 7px;
  background: rgba(15, 23, 42, 0.50);
}

.works-unit-rule-card.global {
  border-color: rgba(56, 189, 248, 0.34);
  background: rgba(3, 105, 161, 0.10);
}

.works-unit-rule-top {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 8px;
}

.works-unit-rule-title {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.works-unit-rule-title strong {
  color: #dbeafe;
  font-size: 11px;
}

.works-unit-rule-title small {
  color: #94a3b8;
  font-size: 10px;
}

.works-unit-name-field {
  flex: 1 1 auto;
}

.works-unit-aliases-field {
  margin-top: 7px;
}

.works-unit-aliases-input {
  width: 100%;
  min-width: 0;
  min-height: 48px;
  resize: vertical;
  box-sizing: border-box;
  font-family: inherit;
  line-height: 1.3;
}

.works-unit-rule-fields {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 7px;
  margin-top: 7px;
}

.works-rule-field.disabled {
  opacity: 0.46;
}

.works-steel-bars-toolbar {
  min-height: 34px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 9px;
  border-top: 1px solid rgba(148, 163, 184, 0.16);
  border-bottom: 1px solid rgba(148, 163, 184, 0.16);
  color: #dbeafe;
  background: rgba(15, 23, 42, 0.42);
  font-size: 11px;
}

.works-steel-bars-table {
  min-width: 690px;
  table-layout: fixed;
}

.works-steel-bars-table th:nth-child(1),
.works-steel-bars-table td:nth-child(1) { width: 17%; }
.works-steel-bars-table th:nth-child(2),
.works-steel-bars-table td:nth-child(2) { width: 41%; }
.works-steel-bars-table th:nth-child(3),
.works-steel-bars-table td:nth-child(3) { width: 14%; }
.works-steel-bars-table th:nth-child(4),
.works-steel-bars-table td:nth-child(4) { width: 16%; }
.works-steel-bars-table th:nth-child(5),
.works-steel-bars-table td:nth-child(5) { width: 42px; text-align: center; }

.works-steel-cell-input {
  width: 100%;
  min-width: 0;
  height: 27px;
  box-sizing: border-box;
  font-size: 10px;
}

.works-steel-coeff-scroll {
  overflow-x: auto !important;
}

@media (max-width: 980px) {
  .works-unit-rule-fields {
    grid-template-columns: repeat(2, minmax(130px, 1fr));
  }
}

@media (max-width: 620px) {
  .works-rule-header {
    align-items: flex-start;
  }
  .works-rule-header-title small {
    display: none;
  }
  .works-unit-rule-fields {
    grid-template-columns: 1fr;
  }
}

/* ===== Obras v37: desplegables de metrado, tabla adaptable e importación Excel ===== */
.works-rule-disclosure-toggle {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  font: inherit;
  cursor: pointer;
}

.works-rule-disclosure-toggle:focus-visible {
  outline: 2px solid #7dd3fc;
  outline-offset: 2px;
  border-radius: 4px;
}

.works-rule-disclosure-chevron {
  flex: 0 0 auto;
  width: 12px;
  color: #7dd3fc;
  font-size: 10px;
  line-height: 1;
  text-align: center;
}

.works-rules-section.collapsed > .works-rule-header {
  border-bottom-color: transparent;
}

.works-rules-section.collapsed > .works-rules-section-body {
  display: none !important;
}

.works-steel-rules-body {
  min-width: 0;
}

.works-partidas-options-row {
  justify-content: space-between;
  gap: 8px;
  padding: 0 0 7px;
}

.works-partidas-import-excel-button {
  flex: 0 0 auto;
  min-height: 28px;
  padding: 4px 10px;
  border: 1px solid rgba(56, 189, 248, 0.62);
  border-radius: 7px;
  background: rgba(15, 23, 42, 0.92);
  color: #e0f2fe;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
  cursor: pointer;
}

.works-partidas-import-excel-button:hover:not(:disabled) {
  background: #003f7f;
  border-color: #7dd3fc;
  color: #ffffff;
}

.works-partidas-import-excel-button:disabled {
  opacity: 0.58;
  cursor: wait;
}

.works-partidas-import-excel-input {
  display: none !important;
}

/* Código, Unidad, Metrado y Usar conservan un ancho estable. Descripción usa
   todo el espacio restante y sólo activa el scroll cuando alcanza el ancho
   mínimo necesario para mostrar su encabezado. */
.works-partidas-table {
  width: 100% !important;
  min-width: 548px !important;
  table-layout: fixed !important;
}

.works-partidas-table th:nth-child(1),
.works-partidas-table td:nth-child(1) {
  width: 205px !important;
  min-width: 205px !important;
}

.works-partidas-table th:nth-child(2),
.works-partidas-table td:nth-child(2) {
  width: auto !important;
  min-width: 100px !important;
}

.works-partidas-table th:nth-child(3),
.works-partidas-table td:nth-child(3) {
  width: 72px !important;
  min-width: 72px !important;
  text-align: center;
  white-space: nowrap;
}

.works-partidas-table th:nth-child(4),
.works-partidas-table td:nth-child(4) {
  width: 112px !important;
  min-width: 112px !important;
  text-align: right;
  white-space: nowrap;
}

.works-partidas-table th:nth-child(5),
.works-partidas-table td:nth-child(5) {
  width: 58px !important;
  min-width: 58px !important;
  text-align: center;
  white-space: nowrap;
}

.works-partidas-table td:nth-child(2) {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 620px) {
  .works-partidas-options-row {
    align-items: stretch;
  }
  .works-partidas-select-viewer-toggle {
    min-width: 0;
  }
  .works-partidas-select-viewer-toggle span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}

/* ===== Obras: exportación y configuración especial por partida ===== */
.works-partidas-options-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
}

.works-partidas-show-config-toggle {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 28px;
  padding: 3px 8px;
  border: 1px solid rgba(100, 116, 139, 0.72);
  border-radius: 7px;
  background: rgba(15, 23, 42, 0.82);
  color: #dbeafe;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
}

.works-partidas-show-config-toggle:hover {
  border-color: #38bdf8;
  background: rgba(3, 63, 127, 0.62);
}

.works-partidas-show-config-toggle input {
  margin: 0;
  accent-color: #0ea5e9;
}

.works-partidas-excel-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}

.works-partidas-export-excel-button {
  flex: 0 0 auto;
  min-height: 28px;
  padding: 4px 11px;
  border: 1px solid #22c55e;
  border-radius: 7px;
  background: #15803d;
  color: #ffffff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18), 0 0 0 1px rgba(34, 197, 94, 0.18);
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
  cursor: pointer;
}

.works-partidas-export-excel-button:hover:not(:disabled) {
  background: #16a34a;
  border-color: #4ade80;
}

.works-partidas-export-excel-button:disabled {
  opacity: 0.58;
  cursor: wait;
}

.works-partidas-table th.works-partida-code-column,
.works-partidas-table td.works-partida-code-column {
  width: 205px !important;
  min-width: 205px !important;
}

.works-partidas-table th.works-partida-description-column,
.works-partidas-table td.works-partida-description-column {
  width: auto !important;
  min-width: 100px !important;
}

.works-partidas-table th.works-partida-unit-column,
.works-partidas-table td.works-partida-unit-column {
  width: 72px !important;
  min-width: 72px !important;
  text-align: center;
  white-space: nowrap;
}

.works-partidas-table th.works-partida-quantity-column,
.works-partidas-table td.works-partida-quantity-column {
  width: 112px !important;
  min-width: 112px !important;
  text-align: right;
  white-space: nowrap;
}

.works-partidas-table th.works-partida-measurement-config-column,
.works-partidas-table td.works-partida-measurement-config-column {
  display: none;
  width: 230px !important;
  min-width: 230px !important;
  text-align: left;
}

.works-partidas-table.show-measurement-config {
  min-width: 778px !important;
}

.works-partidas-table.show-measurement-config th.works-partida-measurement-config-column,
.works-partidas-table.show-measurement-config td.works-partida-measurement-config-column {
  display: table-cell;
}

.works-partidas-table th.works-partida-use-column,
.works-partidas-table td.works-partida-use-column {
  width: 58px !important;
  min-width: 58px !important;
  text-align: center;
  white-space: nowrap;
}

.works-partida-measurement-config-button {
  display: block;
  width: 100%;
  min-height: 25px;
  padding: 3px 7px;
  overflow: hidden;
  border: 1px solid rgba(100, 116, 139, 0.7);
  border-radius: 6px;
  background: rgba(15, 23, 42, 0.82);
  color: #cbd5e1;
  font-size: 10px;
  font-weight: 700;
  line-height: 1.25;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
}

.works-partida-measurement-config-button:hover {
  border-color: #38bdf8;
  background: #003f7f;
  color: #ffffff;
}

.works-partida-measurement-config-button.special {
  border-color: #f59e0b;
  background: rgba(120, 53, 15, 0.62);
  color: #fef3c7;
}

.works-partida-rule-dialog-overlay {
  position: fixed;
  inset: 0;
  z-index: 12000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(2, 6, 23, 0.72);
}

.works-partida-rule-dialog {
  width: min(460px, calc(100vw - 36px));
  max-height: calc(100vh - 36px);
  overflow: auto;
  padding: 16px;
  border: 1px solid #475569;
  border-radius: 10px;
  background: #111827;
  color: #e5e7eb;
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.52);
}

.works-partida-rule-dialog-title {
  color: #ffffff;
  font-size: 14px;
  font-weight: 900;
}

.works-partida-rule-dialog-subtitle {
  margin: 3px 0 13px;
  overflow: hidden;
  color: #94a3b8;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.works-partida-rule-dialog-field {
  display: grid;
  grid-template-columns: 132px minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  margin-top: 8px;
  color: #cbd5e1;
  font-size: 11px;
  font-weight: 700;
}

.works-partida-rule-dialog-select,
.works-partida-rule-dialog-factor {
  width: 100%;
  min-width: 0;
}

.works-partida-rule-dialog-hint {
  margin-top: 12px;
  padding: 8px;
  border-left: 3px solid #38bdf8;
  background: rgba(14, 116, 144, 0.13);
  color: #bae6fd;
  font-size: 10px;
  line-height: 1.35;
}

.works-partida-rule-dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 15px;
}

.works-partida-rule-dialog-cancel,
.works-partida-rule-dialog-save {
  min-height: 30px;
  padding: 5px 13px;
  border-radius: 7px;
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
}

.works-partida-rule-dialog-cancel {
  border: 1px solid #64748b;
  background: #1e293b;
  color: #e2e8f0;
}

.works-partida-rule-dialog-save {
  border: 1px solid #38bdf8;
  background: #0f66c2;
  color: #ffffff;
}

@media (max-width: 700px) {
  .works-partidas-excel-actions {
    width: 100%;
    margin-left: 0;
  }
  .works-partidas-import-excel-button,
  .works-partidas-export-excel-button {
    flex: 1 1 0;
  }
  .works-partida-rule-dialog-field {
    grid-template-columns: 1fr;
    gap: 4px;
  }
}

/* ===== 2D v19.7: buscador contenido dentro de la columna de láminas =====
   .tree-search-row usa width:100%; sumarle márgenes laterales hacía que la
   fila excediera el ancho real de la columna y alcanzara el splitter. */
.plans-search-row {
  width: auto !important;
  min-width: 0 !important;
  margin: 10px 12px 6px 10px !important;
}
.plans-search-row .tree-search {
  width: 100% !important;
  min-width: 0 !important;
  max-width: 100% !important;
}
@media (max-width: 1100px), (pointer: coarse) and (max-width: 1400px) {
  .plans-search-row {
    margin-right: 10px !important;
  }
}
