/* Shared responsive layer. Main panel and Render Studio have their own layouts. */
.cortala-access, .cortala-access * { box-sizing: border-box; }
.cortala-access { height: auto; min-height: 100vh; min-height: 100svh; padding: 24px; }
.cortala-access > .card { width: min(100%, 440px); margin: auto; overflow-wrap: anywhere; }
.cortala-access input:not([type="checkbox"]):not([type="radio"]), .cortala-access select { min-width: 0; max-width: 100%; font-size: 16px; min-height: 44px; }
.cortala-access button { min-height: 44px; white-space: normal; overflow-wrap: anywhere; }
.cortala-access .cortala-install-link { color: #2b5876; background: #f2f6f9; border: 1px solid #c8d7e2; font: 600 14px/1.4 system-ui, sans-serif; }
.cortala-table-scroll { width: 100%; min-width: 0; max-width: 100%; overflow: auto; overscroll-behavior-x: contain; -webkit-overflow-scrolling: touch; }
.cortala-table-scroll:focus-visible { outline: 2px solid #2b5876; outline-offset: 2px; }
.cortala-profile-nav { display: none; }

@media screen and (max-width: 900px), screen and (hover: none) and (pointer: coarse) {
  .pv-app { display: flex; flex-direction: column; }
  .pv-app .pv-layout { flex: 1 0 auto; }
  .pv-app, .pv-layout, .pv-layout > *, .pv-card, .pv-field, .pv-field > *, .pv-profile-picker, .ij-layout > *, .ij-grid > * { min-width: 0; }
  .pv-topbar { position: static; align-items: stretch; flex-direction: column; gap: 12px; padding: max(12px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) 12px max(12px, env(safe-area-inset-left)); }
  .pv-brand { min-width: 0; }
  .pv-brand > div:last-child { min-width: 0; overflow-wrap: anywhere; }
  .pv-brand strong { font-size: 14px; }
  .pv-brand span { font-size: 11px; }
  .pv-back, .pv-logo { flex: 0 0 42px; height: 42px; }
  .pv-profile-picker { width: 100%; flex-wrap: wrap; gap: 8px; }
  .pv-profile-picker label { flex: 1 0 100%; min-width: 0; }
  .pv-profile-picker select { min-width: 0; width: 100%; }
  .pv-profile-picker > button { flex: 1 1 auto; }
  .pv-layout { grid-template-columns: minmax(0, 1fr); gap: 10px; padding: 10px; }
  .pv-left, .pv-right { grid-column: auto; display: flex; flex-direction: column; overflow: visible; }
  .pv-workspace { grid-row: auto; grid-template-rows: auto auto minmax(250px, 42svh); }
  .pv-canvas-card { min-height: 0; }
  #pvFrontCanvas { min-height: 0; width: 100%; height: auto; aspect-ratio: 1100 / 760; }
  .pv-canvas-hint { max-width: calc(100% - 20px); white-space: normal; font-size: 11px; }
  .pv-workbar { flex-direction: column; align-items: stretch; }
  .pv-work-actions { gap: 6px; }
  .pv-work-actions > button { flex: 1 1 90px; }
  .pv-app button, .pv-app .pv-btn, .pv-app select { min-height: 44px; font-size: 13px; white-space: normal; overflow-wrap: anywhere; }
  .pv-app input:not([type="checkbox"]):not([type="radio"]), .pv-app select, .pv-app textarea { font-size: 16px; min-height: 44px; max-width: 100%; }
  .pv-field > span, .pv-profile-picker label span, .pv-card h2 { font-size: 12px; }
  .pv-check { min-height: 44px; font-size: 13px; }
  .pv-check input { min-width: 18px; min-height: 18px; }
  .pv-grid-2, .pv-mini-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pv-card p, .pv-field-help, .pv-result-row, .pv-empty { font-size: 12px; line-height: 1.5; overflow-wrap: anywhere; }
  .pv-statusbar { position: static; min-height: 34px; flex-wrap: wrap; padding: 8px 12px max(8px, env(safe-area-inset-bottom)); gap: 6px; }
  .cortala-profile-nav { position: sticky; top: 0; z-index: 25; display: flex; gap: 6px; padding: 8px 10px; background: #fff; border-bottom: 1px solid #d6dfe5; }
  .cortala-profile-nav button { flex: 1 1 0; min-width: 0; min-height: 44px; padding: 8px; border: 1px solid #c4d3df; border-radius: 9px; background: #f5f8fa; color: #2b5876; font: 600 13px/1.3 system-ui, sans-serif; }
  .cortala-profile-nav button[aria-selected="true"] { color: #fff; background: #2b5876; border-color: #2b5876; }
  #pvApp[data-mobile-view="model"] .pv-left, #pvApp[data-mobile-view="model"] .pv-right,
  #pvApp[data-mobile-view="settings"] .pv-workspace, #pvApp[data-mobile-view="settings"] .pv-right,
  #pvApp[data-mobile-view="selection"] .pv-workspace, #pvApp[data-mobile-view="selection"] .pv-left { display: none; }
  .ij-layout, .ij-layout > *, .ij-topbar > *, .ij-card-head > * { max-width: 100%; min-width: 0; }
  .ij-topbar, .ij-card-head { overflow-wrap: anywhere; }
  .ij-button, .ij-back, .ij-actions > a, .ij-details summary { min-height: 44px; }
  .ij-button { white-space: normal; overflow-wrap: anywhere; }
  .ij-layout input:not([type="checkbox"]):not([type="radio"]), .ij-layout select, .ij-layout textarea { font-size: 16px; }
  .ij-actions { align-items: stretch; }
  .ij-actions > button, .ij-actions > a { flex: 1 1 140px; }
  .etq-page .etq-wrap, .etq-page .etq-card, .etq-page .etq-grid > * { min-width: 0; }
  .etq-page .etq-actions a, .etq-page .etq-actions button { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; box-sizing: border-box; overflow-wrap: anywhere; }
  .etq-page input, .etq-page select { font-size: 16px; min-height: 44px; }
  .etq-page input[type="checkbox"], .etq-page input[type="radio"] { min-height: 20px; }
  .etq-page td a { display: inline-block; padding: 8px 0; }
}
@media screen and (max-width: 600px) {
  .cortala-access { padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left)); }
  .cortala-access > .card { padding: 26px 20px; }
  .cortala-access h2 { font-size: 22px; }
  .pv-preset-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pv-grid-2 .pv-field > span { overflow-wrap: anywhere; }
  .pv-toast-region { right: 10px; bottom: max(12px, env(safe-area-inset-bottom)); width: calc(100vw - 20px); }
  .ij-topbar { gap: 12px; padding: 16px; }
  .ij-topbar h1 { font-size: 25px; }
  .ij-card { padding: 16px; }
  .ij-card-head { flex-wrap: wrap; gap: 10px; }
  .ij-grid-2, .ij-grid-3 { grid-template-columns: minmax(0, 1fr); }
  .etq-page h1, .etq-page h2, .etq-page p, .etq-page .etq-revision { overflow-wrap: anywhere; }
  .etq-page .etq-actions > * { flex: 1 1 140px; text-align: center; }
  html[data-cortala-page="render_mueble"] #info { top: max(10px, env(safe-area-inset-top)); max-width: calc(100vw - 20px); box-sizing: border-box; padding-right: 12px; font-size: 12px; overflow-wrap: anywhere; pointer-events: none; }
  html[data-cortala-page="render_mueble"] .panel { max-height: min(70svh, calc(100svh - 24px)); bottom: max(10px, env(safe-area-inset-bottom)); }
  html[data-cortala-page="render_mueble"] .panel-body { max-height: min(50svh, calc(100svh - 170px)); }
  html[data-cortala-page="render_mueble"] .btn, html[data-cortala-page="render_mueble"] .panel-x { min-height: 44px; min-width: 44px; box-sizing: border-box; white-space: normal; }
  html[data-cortala-page="prueba_render"] body { display: flex; flex-direction: column; min-width: 0; }
  html[data-cortala-page="prueba_render"] #visor3D { width: calc(100% - 20px); min-height: 300px; }
  html[data-cortala-page="prueba_render"] #panelPiezas, html[data-cortala-page="prueba_render"] #panelExterno { box-sizing: border-box; width: calc(100% - 20px); max-height: none; }
}
@media print {
  .cortala-profile-nav, .cortala-install-link { display: none !important; }
  .cortala-table-scroll { overflow: visible; }
}
