/* Teléfono: navegación al alcance del pulgar, fichas y formularios amplios. */
.mobile-bar,.mobile-camera{display:none}
.mobile-intro>summary{display:none}
main,.page,.panel,.data-row>div,.record,.loan-body{min-width:0}
#network[role=button]{cursor:pointer}
#mobileMenu{width:min(560px,calc(100% - 24px));padding:24px}
.mobile-menu-head{display:flex;align-items:center;justify-content:space-between;gap:16px;margin-bottom:22px}
.mobile-menu-head h2{margin-top:8px}
.mobile-menu-grid{display:grid;grid-template-columns:1fr 1fr;gap:10px}
.mobile-menu-grid button{min-height:72px;background:var(--paper);border:1px solid var(--line);border-radius:14px;padding:14px;text-align:left;font-weight:700;color:var(--forest)}
.mobile-menu-grid button.selected{background:var(--pale);border-color:var(--forest)}
.mobile-photo-preview{display:flex;flex-wrap:wrap;gap:8px;margin:12px 0}
.mobile-photo-preview:empty{display:none}
.mobile-photo-preview p{width:100%;font-size:13px;color:var(--forest);margin:0 0 4px}
.mobile-photo-preview img{width:72px;height:72px;border-radius:10px;object-fit:cover;border:1px solid var(--line)}
@media screen and (max-width:950px){
  :root{--mobile-header:84px;--mobile-bottom:calc(74px + env(safe-area-inset-bottom,0px))}
  html{scroll-padding-top:100px;-webkit-text-size-adjust:100%}
  body{line-height:1.5}
  body:has(dialog[open]){overflow:hidden}
  .shell{display:block;min-height:100dvh}
  .sidebar{display:none}
  .topbar{position:sticky;top:0;z-index:15;display:grid;grid-template-columns:minmax(0,1fr) auto;gap:2px 10px;height:var(--mobile-header);min-height:var(--mobile-header);padding:12px max(16px,env(safe-area-inset-left));background:#fffefbf5;backdrop-filter:blur(14px);box-shadow:0 3px 15px #173e3708}
  .crumb{display:block;grid-column:1;grid-row:1;min-width:0;font-size:0;letter-spacing:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
  .crumb span{display:none}.crumb b{font-size:17px;font-weight:750}
  .top-actions{display:contents}
  #network{grid-row:2;grid-column:1;max-width:100%;font-size:11px;line-height:1.5;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;padding:3px 0;min-height:24px}
  #network:before{width:6px;height:6px;margin-right:5px}
  #quickAdd{grid-column:2;grid-row:1/span 2;font-size:12px;min-height:46px;border-radius:13px;padding:10px 12px}
  .page{padding:24px 16px calc(var(--mobile-bottom) + 30px);max-width:100%;overflow-wrap:anywhere}
  h1{font-size:32px!important;line-height:1.12;letter-spacing:-.045em}h2{font-size:23px;line-height:1.2}h3{font-size:18px}
  .lead{font-size:15px;line-height:1.6}.eyebrow{font-size:10px}
  .page-head{margin-bottom:22px;gap:12px}.page-head h1{margin-top:8px!important}
  .panel{padding:18px;border-radius:18px}.notice{padding:14px 16px;font-size:13px;margin-bottom:20px}
  .stats{grid-template-columns:repeat(3,minmax(0,1fr));gap:8px;margin:22px 0}
  .stat{padding:14px 10px;min-width:0;border-radius:15px}.stat:last-child{grid-column:auto}
  .stat small{font-size:10px;line-height:1.45;min-height:30px}.stat strong{font-size:28px;margin:8px 0 4px}.stat span{display:block;font-size:10px;line-height:1.5}
  .grid-2,.map-layout,.record-grid{grid-template-columns:minmax(0,1fr);gap:14px}
  .section-head{align-items:center;gap:10px;margin-bottom:14px}.section-head h2{font-size:21px}
  button,.button,.row-action,.text-button,.section-tabs button{min-height:46px;touch-action:manipulation}
  .button{border-radius:12px;padding:11px 14px;font-size:14px;white-space:normal;line-height:1.35}
  .icon-button{width:44px;height:44px;flex:none;border-radius:12px}
  .controls{gap:8px}.controls>.button{flex:1}
  .toolbar{gap:8px}.toolbar select{font-size:16px;min-width:0;height:48px;flex:1 1 130px;width:100%;padding:0 10px;border-radius:12px}
  .toolbar .quick-search{min-width:100%;height:52px;flex:1 0 100%;border-radius:14px}
  input,select,textarea,.quick-search input,dialog input,dialog select,dialog textarea{font-size:16px}
  .quick-search{height:52px;padding:0 14px}.quick-search input{min-height:46px}
  .inventory-toolbar{position:sticky;top:var(--mobile-header);z-index:12;background:var(--cream);padding:10px 0;margin:0 0 14px}
  .inventory-toolbar{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr)}
  .inventory-toolbar .quick-search{grid-column:1/-1;grid-row:1;min-width:0}
  .inventory-toolbar #categoryFilter{grid-column:1;grid-row:2}.inventory-toolbar #boxFilter{grid-column:2;grid-row:2}
  .inventory-toolbar #addItem{display:none}
  .mobile-intro>summary{display:flex;align-items:center;gap:8px;min-height:40px;font-size:12px;font-weight:700;color:#607567;cursor:pointer}.mobile-intro>summary:after{content:'＋';font-size:16px}.mobile-intro[open]>summary:after{content:'−'}.mobile-intro .lead{margin-top:2px}
  .table-wrap{border:0;background:transparent;box-shadow:none;overflow:visible;border-radius:0}
  .table-wrap table{display:block;width:100%;min-width:0}
  .table-wrap thead{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}
  .table-wrap tbody{display:grid;gap:12px}
  .table-wrap tr{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:12px;background:var(--paper);border:1px solid var(--line);border-radius:17px;padding:16px;box-shadow:0 2px 6px #173e3704}
  .table-wrap td{display:block;border:0;padding:0;font-size:14px;min-width:0;overflow-wrap:anywhere}
  .table-wrap td:first-child,.table-wrap td:nth-child(4),.table-wrap td:last-child{grid-column:1/-1}
  .table-wrap td strong{font-size:17px;line-height:1.4}.table-wrap td small{font-size:12px;line-height:1.55;color:#64756d}
  .table-wrap td:nth-child(2)::before,.table-wrap td:nth-child(3)::before,.table-wrap td:nth-child(4)::before{content:attr(data-label);display:block;color:#65766c;font-size:10px;letter-spacing:.06em;text-transform:uppercase;margin-bottom:5px;font-weight:700}
  .table-wrap .row-action{width:100%;text-align:center;background:var(--pale);border-radius:10px;padding:10px;margin-top:2px}
  .table-wrap .badge{max-width:100%;white-space:normal;line-height:1.5}
  .table-wrap .empty{grid-column:1/-1;padding:20px 0;text-align:center}
  .box-grid{grid-template-columns:minmax(0,1fr)}.card{padding:20px;border-radius:17px}.card h3{margin-top:16px}
  .loan-grid{grid-template-columns:minmax(0,1fr)}.loan-photo{height:190px}.loan-body{padding:18px}.loan-body p{font-size:14px;line-height:1.6}
  .section-tabs{gap:7px;margin-right:-16px;padding-right:16px;scroll-snap-type:x proximity}.section-tabs button{scroll-snap-align:start;padding:10px 15px;font-size:13px}
  .section-management form{width:100%}.section-management input{width:100%;font-size:16px;min-height:48px}
  .record .section-head{align-items:flex-start}.record .badge{white-space:normal;max-width:46%;text-align:center}
  .record p{line-height:1.6}.record .hint{font-size:13px}.record .controls .button{flex:1}
  .map-frame{padding:10px;max-width:100%;overscroll-behavior-x:contain}.map-side .panel{height:auto}.location-list button{min-height:48px;font-size:14px}
  .data-row{gap:10px}.data-row p{font-size:14px}.data-row .buttons{display:grid;grid-template-columns:minmax(0,1fr);width:100%}.data-row>div:last-child{flex:1}.data-row .glyph{width:34px;height:34px;font-size:20px}
  .connection-panel .toolbar{display:grid;grid-template-columns:minmax(0,1fr)}.connection-panel .toolbar input{min-width:0;width:100%;min-height:48px;border:1px solid var(--line);border-radius:10px;padding:12px}
  #page>[data-text-editor] .button{min-height:40px;font-size:12px;width:100%;background:transparent;border-style:dashed;font-weight:600}
  dialog,#cargoDialog,.photos-dialog,#sheetDialog,.text-editor-dialog{width:100%;max-width:none;max-height:94vh;max-height:94dvh;margin:auto 0 0;padding:0;border-radius:22px 22px 0 0;overscroll-behavior:contain;overflow:auto;scroll-padding-top:88px;scroll-padding-bottom:100px}
  dialog[open],#cargoDialog[open],.text-editor-dialog[open],.photos-dialog[open]{max-height:min(94dvh,calc(var(--mobile-visible-height,100dvh) - 12px));bottom:var(--mobile-viewport-bottom,0px)}
  dialog form{padding:18px 18px calc(18px + env(safe-area-inset-bottom,0px))}
  .dialog-head{position:sticky;top:-18px;z-index:3;background:var(--paper);padding:14px 0;margin:-4px 0 18px;border-bottom:1px solid var(--line);gap:12px}.dialog-head h2{font-size:24px}
  dialog label{font-size:13px;margin-bottom:18px;line-height:1.5}dialog input,dialog select,dialog textarea{padding:13px;min-height:48px;border-radius:11px}
  dialog input[type=hidden],dialog input[hidden]{display:none}dialog input[type=checkbox]{min-height:22px;width:22px;height:22px;flex:none;margin:0}
  dialog input[type=file]{padding:12px 8px;max-width:100%;font-size:13px}
  .fields,.check-grid{grid-template-columns:minmax(0,1fr);gap:0}.check-grid{gap:8px}.check-grid label{padding:12px;border:1px solid var(--line);border-radius:12px;margin:0;font-size:14px;min-height:48px}
  .dialog-actions{position:sticky;bottom:0;z-index:3;background:var(--paper);padding:14px 0 calc(14px + env(safe-area-inset-bottom,0px));margin:12px 0 0;gap:8px;flex-wrap:wrap}.dialog-actions .button{flex:1}.dialog-actions .spacer{display:none}
  .dialog-actions .primary{min-width:45%}.dialog-actions .danger{flex:1 0 100%;border:0;background:none;padding:6px;min-height:40px}
  .text-editor-dialog form{padding:22px 18px}.text-editor-dialog h2{font-size:25px}.text-editor-dialog form>p{font-size:14px;line-height:1.6}
  .text-editor-fields{gap:16px;margin:20px 0}.text-editor-fields label{font-size:13px}.text-editor-fields textarea{font-size:16px;min-height:100px;line-height:1.5}
  .text-editor-dialog form>.controls{position:sticky;bottom:0;z-index:3;background:var(--paper);padding:14px 0 calc(14px + env(safe-area-inset-bottom,0px));display:grid;grid-template-columns:1fr 1fr;border-top:1px solid var(--line)}.text-editor-dialog .controls .primary{grid-column:1/-1;grid-row:1}
  .photo-head{position:sticky;top:0;background:var(--paper);padding:18px;z-index:3}.photo-head h2{font-size:23px}.photo-gallery{padding:0 12px 24px}
  .mobile-camera{display:block;width:100%;margin:-6px 0 14px;background:var(--pale);border-color:#bdcdbd}
  #mobileMenu{width:calc(100% - 16px);max-height:88dvh;margin:auto 8px 8px;border-radius:24px;padding:24px 18px calc(20px + env(safe-area-inset-bottom,0px))}
  .mobile-menu-grid button{font-size:14px;line-height:1.45;min-width:0;overflow-wrap:anywhere}
  .mobile-bar{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));position:fixed;inset:auto 0 0;z-index:20;min-height:var(--mobile-bottom);padding:8px max(8px,env(safe-area-inset-right)) calc(8px + env(safe-area-inset-bottom,0px));background:#fffefbf7;backdrop-filter:blur(16px);border-top:1px solid var(--line);box-shadow:0 -5px 24px #173e3706}
  .mobile-bar button{border:0;background:none;color:#6d7e73;display:flex;align-items:center;justify-content:center;flex-direction:column;gap:4px;padding:6px 2px;min-height:56px;font-size:10px;font-weight:700;border-radius:13px;line-height:1.2}
  .mobile-bar svg{width:23px;height:23px}.mobile-bar button.selected{color:var(--forest);background:var(--pale)}
  body.mobile-keyboard .mobile-bar,body:has(dialog[open]) .mobile-bar{display:none}
  body.mobile-keyboard .inventory-toolbar{position:relative;top:auto}
  #toast{bottom:calc(var(--mobile-bottom) + 12px);left:16px;right:16px;text-align:center;font-size:14px;padding:14px;border-radius:14px}
  body:has(dialog[open]) #toast{bottom:20px}
  #loginGate{padding:18px;overflow-y:auto;min-height:100dvh}#loginGate .panel{padding:28px 22px;border-radius:23px;width:100%}#loginGate h1{font-size:36px!important}.remember{font-size:14px;line-height:1.6}
  @media(prefers-reduced-motion:reduce){*{scroll-behavior:auto!important;transition:none!important}}
}
@media print{.mobile-bar,#mobileMenu,.mobile-camera,.mobile-photo-preview{display:none!important}}

@media screen and (max-width:950px) and (max-height:500px){:root{--mobile-header:66px;--mobile-bottom:calc(60px + env(safe-area-inset-bottom,0px))}.topbar{padding-block:6px}.inventory-toolbar{position:static}.mobile-bar{padding-top:4px;padding-bottom:calc(4px + env(safe-area-inset-bottom,0px))}.mobile-bar button{min-height:48px}.mobile-bar svg{width:20px;height:20px}.page{padding-top:18px}}

/* Editor de estructura compartida. */
[hidden][data-layout-section]{display:none!important}
.custom-layout-blocks{display:grid;gap:18px;margin-top:20px}
.custom-layout-block p{white-space:pre-wrap;overflow-wrap:anywhere}
.layout-editor fieldset{min-width:0;border:1px solid #d5dfd6;border-radius:14px;margin:18px 0;padding:16px}
.layout-editor legend{font-weight:700;padding:0 6px}
.layout-editor [data-labels],.layout-editor [data-quick]{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}
.layout-editor .layout-toggle{display:flex;align-items:center;gap:12px;min-height:46px}
.layout-toggle input{width:22px;height:22px;flex-shrink:0}
.layout-block-editor{border-top:1px solid #d5dfd6;padding:16px 0}
.layout-block-editor .button{margin:4px}
.mobile-bar button span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;max-width:100%}
@media(max-width:600px){.layout-editor [data-labels],.layout-editor [data-quick]{grid-template-columns:1fr}.layout-editor fieldset{padding:12px}}

.admin-editing-banner{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:12px;background:#fff2c9;border:1px solid #c5a650;border-radius:12px;margin-bottom:14px}
.layout-section-row{display:flex;align-items:center;gap:6px;flex-wrap:wrap;border-bottom:1px solid #e0e5de;padding:6px 0}.layout-section-row label{flex:1;min-width:140px}
body[data-theme="oceano"]{--admin-accent:#175575;--admin-soft:#e8f3f9}body[data-theme="uva"]{--admin-accent:#62416d;--admin-soft:#f3edf7}body[data-theme="terracota"]{--admin-accent:#8b4833;--admin-soft:#fbefe7}
body[data-theme]:not([data-theme="bosque"]) .button.primary,body[data-theme]:not([data-theme="bosque"]) .sidebar{background:var(--admin-accent);color:white}
body[data-theme]:not([data-theme="bosque"]) .mobile-bar button.selected{color:var(--admin-accent);background:var(--admin-soft)}
body[data-reading="large"] #page p,body[data-reading="large"] #page td,body[data-reading="large"] #page label,body[data-reading="large"] #page .notice{font-size:18px;line-height:1.65}
body[data-density="compact"] #page .panel{padding:16px}body[data-density="compact"] .custom-layout-blocks{gap:10px}
.global-notice{white-space:pre-wrap;overflow-wrap:anywhere}
@media(max-width:600px){.admin-editing-banner{align-items:stretch;flex-direction:column}.layout-section-row .button{min-width:70px}}

/* Tabla de preparación: el borrador no modifica la vista compartida. */
.draft-actions{display:flex;align-items:center;gap:10px;flex-wrap:wrap;margin:14px 0}.draft-actions label{flex:1;min-width:180px}
.draft-table{overflow:auto;max-width:100%;border:1px solid #d8e0d8;border-radius:12px}.draft-table table{min-width:1100px;width:100%;border-collapse:collapse}.draft-table th,.draft-table td{padding:10px;vertical-align:top}.draft-table input,.draft-table select{min-width:130px;width:100%}.draft-table td:first-child{font-size:12px;max-width:110px;overflow-wrap:anywhere}.draft-table .button{margin-bottom:6px}
@media(max-width:700px){.draft-workspace{padding:12px!important}.draft-table{border:0;overflow:visible}.draft-table table,.draft-table tbody,.draft-table tr,.draft-table td{display:block;min-width:0;width:auto}.draft-table thead{display:none}.draft-table tr{border:1px solid #d8e0d8;border-radius:14px;margin:12px 0;padding:8px}.draft-table td{border:0;padding:6px}.draft-table td::before{content:attr(data-label);display:block;font-weight:700;font-size:12px;margin-bottom:4px}.draft-table td:first-child{max-width:none}.draft-table input,.draft-table select{min-width:0;width:100%}.draft-actions>.button{flex-grow:1}}

.sidebar .nav[hidden]{display:none!important}

#quickAdd[hidden]{display:none!important}

.content-editable{overflow-wrap:anywhere}.content-editable[hidden]{display:none!important}.content-editable[data-content-hidden]{opacity:.65;text-decoration:line-through}
.content-inline-tools{display:inline-flex;gap:6px;flex-wrap:wrap;vertical-align:middle;margin:4px 6px;font:600 12px/1.3 system-ui;text-decoration:none}
.content-inline-tools button{font:inherit;min-height:34px;border:1px solid #8ba394;background:#f1f7f0;color:#173e37;border-radius:8px;padding:6px 9px;cursor:pointer}
.custom-layout-block[data-block-kind="notice"]{background:#fff4d5;border-left:5px solid #ad8322}.custom-layout-block[data-block-kind="plain"]{background:transparent;border:0;box-shadow:none;padding:8px 0}
.layout-editor fieldset[hidden]{display:none!important}
@media(max-width:700px){.content-inline-tools button{min-height:44px}.content-editor-toolbar .button{width:100%}}
@media print{.content-inline-tools,.content-editor-toolbar{display:none!important}}

@media print{.content-editable[data-content-hidden]{display:none!important}}

@media(max-width:950px){.mobile-bar svg{width:25px;height:25px;flex-shrink:0}.mobile-bar button.selected svg{stroke-width:2.2;filter:drop-shadow(0 2px 3px #173e3714)}.mobile-menu-grid svg{width:27px;height:27px}}
