/* Estructura común de campos para el portal. Mantiene controles nativos y validación. */
:root{--control-bg:#f6f6f6;--control-border:#d8d8d8;--control-ink:#191919;--control-radius:12px}
body :is(input:not([type]),input[type=text],input[type=email],input[type=password],input[type=tel],input[type=url],input[type=search],input[type=date],input[type=time],input[type=datetime-local],input[type=month],select,textarea){box-sizing:border-box;min-width:0;max-width:100%;border:1px solid var(--control-border)!important;border-radius:var(--control-radius)!important;background-color:var(--control-bg)!important;color:var(--control-ink);font:inherit;font-size:14px;line-height:1.4;min-height:44px;padding:11px 13px;box-shadow:none!important}
body textarea{min-height:88px;resize:vertical}
body :is(input,select,textarea)::placeholder{color:#777;opacity:1}
body :is(input:not([type]),input[type=text],input[type=email],input[type=password],input[type=tel],input[type=url],input[type=search],input[type=date],input[type=time],input[type=datetime-local],input[type=month],select,textarea):focus{border-color:#202020!important;outline:none!important;box-shadow:inset 0 0 0 1px #202020!important;background-color:#fff!important}
body :is(input,select,textarea):disabled{color:#888;background-color:#eee!important;cursor:not-allowed;opacity:.75}
body :is(input,select,textarea)[aria-invalid=true]{border-color:#b42318!important}
body select:not([multiple]){appearance:none;-webkit-appearance:none;background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='%23222222' stroke-width='2'%3E%3Cpath d='m6 8 4 4 4-4'/%3E%3C/svg%3E");background-position:right 12px center;background-size:18px;background-repeat:no-repeat;padding-right:38px}
body input[type=search]{border-radius:999px!important;padding-left:42px!important;background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23595959' stroke-width='1.8'%3E%3Ccircle cx='10' cy='10' r='6.5'/%3E%3Cpath d='m15 15 5 5'/%3E%3C/svg%3E");background-repeat:no-repeat;background-size:21px;background-position:13px center}
body :is(input[type=checkbox],input[type=radio]){accent-color:#181818;flex-shrink:0;width:18px;height:18px;min-height:18px;margin:0;vertical-align:middle}
body label:has(>input[type=radio]:not([hidden])):not(.product-icon-picker label){display:flex;align-items:center;justify-content:space-between;gap:14px;padding:14px 16px;min-height:56px;border:1px solid var(--control-border);border-radius:14px;background:#fff;color:var(--control-ink);cursor:pointer;box-sizing:border-box}
body label:has(>input[type=radio]:checked):not(.product-icon-picker label){border-color:#171717;box-shadow:inset 0 0 0 1px #171717;background:#fff}
body label>input[type=radio]{order:2;margin-left:auto}
body label:has(>input[type=radio]:focus-visible){outline:2px solid #555;outline-offset:3px}
body label:has(>input[type=radio]:disabled){opacity:.6;cursor:not-allowed}
body .highlight-days label{background:#f6f6f6;border-color:#dedede;color:#222;border-radius:9px;justify-content:center;min-width:46px}
body .highlight-days label:has(:checked){background:#181818;color:#fff;border-color:#181818}
body .highlight-days input{accent-color:#fff}
body .highlight-type-cards>button{background:#fff;border-color:#d8d8d8;color:#191919;border-radius:14px}
body .highlight-type-cards>button[aria-pressed=true]{background:#fff;border-color:#171717;box-shadow:inset 0 0 0 1px #171717}
body [data-interval-add]{background:#f5f5f5;color:#222;border:1px solid transparent;border-radius:12px;min-height:44px;padding:12px 18px;justify-self:start}
body .highlight-picker-layout aside{background:#f6f6f6;border-radius:16px}
body :is(.order-quantity-stepper,.floor-quantity-stepper){border-color:#c6c9cf;background:#fff}
body :is(.order-quantity-stepper,.floor-quantity-stepper)>input{min-height:0!important;background:transparent!important;border:0!important;box-shadow:none!important}
body :is(.order-quantity-stepper,.floor-quantity-stepper)>input:focus{outline:0!important;box-shadow:none!important}
@media(max-width:600px){body label:has(>input[type=radio]:not([hidden])):not(.product-icon-picker label){padding:12px;gap:10px}body :is(input[type=date],input[type=time],input[type=datetime-local],input[type=month]){max-width:100%}}
@media(forced-colors:active){body select:not([multiple]){appearance:auto;background-image:none}body :is(input,select,textarea):focus{outline:2px solid Highlight!important}}

/* Tipografía y estados de escritura según las referencias del portal. */
:root{--portal-font:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;font-family:var(--portal-font);--control-bg:#f6f6f6;--control-border:#d6d6d6;--control-radius:10px}
body,body :is(button,input,select,textarea,label,legend){font-family:var(--portal-font)}
body :is(h1,h2,h3,h4,h5,h6,.brand-copy strong,.brand-mark){font-family:var(--portal-font);letter-spacing:-.025em;font-weight:700}
body :is(input:not([type]),input[type=text],input[type=email],input[type=password],input[type=tel],input[type=url],input[type=search],textarea){border-width:2px!important;font-size:16px;font-weight:400;line-height:1.45;caret-color:#171717;transition:border-color .12s ease,background-color .12s ease}
body :is(input:not([type]),input[type=text],input[type=email],input[type=password],input[type=tel],input[type=url],input[type=search],textarea):not(:focus){background-color:var(--control-bg)!important;border-color:var(--control-border)!important;box-shadow:none!important}
body :is(input:not([type]),input[type=text],input[type=email],input[type=password],input[type=tel],input[type=url],input[type=search],textarea):focus{background-color:#fff!important;border-color:#171717!important;box-shadow:none!important;outline:0!important}
body :is(input,textarea)[readonly]{color:#626262}
body :is(input,textarea):disabled{background-color:#eee!important;color:#888}
body :is(input,textarea)[aria-invalid=true]{border-color:#b42318!important}
@media(prefers-reduced-motion:reduce){body :is(input,textarea){transition:none!important}}

/* Jerarquía y estructura general: superficies claras, navegación neutral y lectura amplia. */
@media screen{
 body.workspace-body{background:#fff;color:#191919;--text-main:#191919;--text-secondary:#6b6b6b;--ink:#191919;--muted:#6b6b6b;--line:#dedede;--border-soft:#dedede;--surface:#fff;--surface-muted:#f6f6f6;--shadow-card:none;font-size:15px;line-height:1.5}
 .workspace-body :is(.main-content h1,.main-content .admin-heading h1){font-size:32px;font-weight:750;line-height:1.2;letter-spacing:-.035em;margin-bottom:12px;color:#151515}
 .workspace-body :is(.main-content h2,.main-content .dashboard-section-heading h2){font-size:23px;font-weight:700;line-height:1.3;letter-spacing:-.025em;color:#191919}
 .workspace-body .main-content h3{font-size:18px;font-weight:650;line-height:1.35;letter-spacing:-.02em}
 .workspace-body :is(.admin-heading p,.page-heading p,.summary-definition,.management-card p){font-size:14px;line-height:1.55;color:#6b6b6b}
 .workspace-body :is(.panel,.management-card,.metric-card,.summary-card){background:#fff;border-color:#dcdcdc;border-radius:12px;box-shadow:none}
 .workspace-body :is(.section-heading,.dashboard-section-heading,.admin-heading){gap:16px;flex-wrap:wrap;margin-bottom:22px}
 .workspace-body :is(.section-heading,.dashboard-section-heading,.admin-heading)>:is(h1,h2,h3){margin-bottom:0}
 .workspace-body .module-sidebar{background:#fff;border-right-color:#dedede;color:#333}
 .workspace-body .module-sidebar nav a,.workspace-body .module-sidebar .operation-menu>summary{color:#555;font-size:14px;font-weight:500;line-height:1.35;border-radius:8px}
 .workspace-body .module-sidebar nav a:hover,.workspace-body .module-sidebar .operation-menu>summary:hover,.workspace-body .module-sidebar .operation-menu[open]>summary{background:#f5f5f5;color:#191919}
 .workspace-body .module-sidebar nav a[aria-current]{background:#ececec;color:#111;box-shadow:inset 3px 0 #161616;font-weight:650}
 .workspace-body .module-sidebar .operation-submenu{border-left-color:#dedede}
 .workspace-body .module-sidebar .operation-submenu a{font-size:14px}
 .workspace-body .module-sidebar .nav-group-label{color:#777;letter-spacing:.055em}
 .workspace-body .app-header{background:#fff;border-bottom-color:#dedede}
 .workspace-body .profile-avatar{background:#f3f3f3;color:#444}
 .workspace-body .context-nav a{color:#555}
 .workspace-body .context-nav a[aria-current]{background:#eee;color:#191919}
 .workspace-body .main-content>section+section{margin-top:24px}
 .workspace-body :is(dialog h2,.highlight-dialog h2){font-size:23px;line-height:1.3;letter-spacing:-.025em}
 @media(min-width:1100px){.workspace-body .main-content{padding:30px 36px 40px}.workspace-body .module-sidebar nav{gap:5px}}
 @media(max-width:767px){.workspace-body :is(.main-content h1,.main-content .admin-heading h1){font-size:26px}.workspace-body :is(.main-content h2,.main-content .dashboard-section-heading h2,dialog h2){font-size:21px}.workspace-body :is(.section-heading,.dashboard-section-heading,.admin-heading){gap:12px;margin-bottom:18px}}
}

/* Casillas con su etiqueta al lado; el texto largo se adapta sin bajar el check. */
body label.checkbox-field,
body label:has(> input[type=checkbox]:not([hidden]):not([role=switch])):not(.highlight-days label):not(.product-icon-picker label){display:flex!important;flex-direction:row!important;flex-wrap:nowrap!important;align-items:baseline;justify-content:flex-start;gap:10px;max-width:100%;text-align:left}
body label.checkbox-field>input[type=checkbox],
body label:has(> input[type=checkbox]:not([hidden]):not([role=switch])):not(.highlight-days label):not(.product-icon-picker label)>input[type=checkbox]{order:-1;flex:0 0 18px;width:18px;height:18px;min-height:18px;margin:0;align-self:flex-start;margin-top:3px}
body label.checkbox-field>span,body label.product-check>span{min-width:0}

/* Calendarios compartidos: formularios, filtros y filas creadas dinámicamente.
   Conservamos los controles nativos, sus límites y su navegación por teclado. */
body .main-content input:is([type=date],[type=month],[type=time],[type=datetime-local]),
body .main-content select:is([data-calendar],[aria-label="Día"],[aria-label="Mes"],[aria-label="Año"],[name=cash_month],[name=cash_year]) {
    width:100%; min-width:0; min-height:44px; height:auto;
    padding:10px 12px; margin:0; border-width:1px!important;
    border-radius:var(--control-radius)!important;
    font-family:var(--portal-font); font-size:14px; font-weight:400;
    line-height:1.5; font-variant-numeric:tabular-nums; color:var(--control-ink);
    color-scheme:light;
}
body .main-content select:is([data-calendar],[aria-label="Día"],[aria-label="Mes"],[aria-label="Año"],[name=cash_month],[name=cash_year]) {padding-right:32px;background-position:right 9px center}
body .main-content input:is([type=date],[type=month],[type=time],[type=datetime-local])::-webkit-calendar-picker-indicator {
    width:18px;height:18px;margin:0 0 0 8px;padding:0;cursor:pointer;opacity:.65;
}
body .main-content input:is([type=date],[type=month],[type=time],[type=datetime-local])::-webkit-datetime-edit {padding:0;min-width:0}
body .main-content input:is([type=date],[type=month],[type=time],[type=datetime-local])::-webkit-date-and-time-value {text-align:left;min-height:21px}
body .main-content label:has(>input:is([type=date],[type=month],[type=time],[type=datetime-local])),
body .main-content label:has(>select:is([data-calendar],[aria-label="Día"],[aria-label="Mes"],[aria-label="Año"],[name=cash_month],[name=cash_year])) {
    display:grid;align-content:start;gap:8px;min-width:0;text-align:left;
}
/* Compactos en filtros; en formularios respetan el ancho de su columna. */
body .main-content :is(.orders-filter-row,.production-period-filter,.cash-filter-row,.expense-filters,.catalog-filters,.promotion-filters,form.form-row[method=get]) > label:has(>input:is([type=date],[type=month],[type=time],[type=datetime-local])) {
    flex:0 1 var(--date-filter-width,178px);width:var(--date-filter-width,178px);
    min-width:0;max-width:100%;margin:0;
}
body .main-content label:has(>input[type=time]) {--date-filter-width:132px}
body .main-content label:has(>input[type=month]) {--date-filter-width:210px}
body .main-content label:has(>input[type=datetime-local]) {--date-filter-width:264px}
body .main-content :is(.orders-filter-row,.production-period-filter,.cash-filter-row,.expense-filters) > label:has(>select:is([data-calendar],[aria-label="Día"],[aria-label="Mes"],[aria-label="Año"],[name=cash_month],[name=cash_year],[name=year])) {
    flex:0 0 var(--calendar-field-width,100px);width:var(--calendar-field-width,100px);
    min-width:0;max-width:var(--calendar-field-width,100px);margin:0;display:grid;gap:8px;
}
body .main-content label:has(>select[name=cash_month]) {--calendar-field-width:92px}
body .main-content label:has(>select:is([name=cash_year],[name=year])) {--calendar-field-width:100px}
@media(max-width:600px){
    body .main-content :is(.orders-filter-row,.production-period-filter,.cash-filter-row,.expense-filters,.catalog-filters,.promotion-filters,form.form-row[method=get]) > label:has(>input:is([type=date],[type=month],[type=time],[type=datetime-local])) {flex-grow:1}
}
body .main-content label[hidden]{display:none!important}

/* Reserva exclusiva para la flecha: las hojas de cada módulo no deben cubrirla. */
body select:not([multiple]):not([size]),body select:not([multiple])[size="1"]{
    box-sizing:border-box;
    appearance:none!important;-webkit-appearance:none!important;
    padding-right:44px!important;
    background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='%23222222' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m5 7 5 5 5-5'/%3E%3C/svg%3E")!important;
    background-position:right 12px center!important;
    background-size:18px 18px!important;
    background-repeat:no-repeat!important;
    text-overflow:ellipsis;white-space:nowrap;overflow:hidden;
}
body .main-content select:is([data-calendar],[aria-label="Día"],[aria-label="Mes"],[aria-label="Año"],[name=cash_month],[name=cash_year]):not([multiple]){
    padding-right:36px!important;background-position:right 9px center!important;background-size:16px 16px!important;
}
@media(forced-colors:active){
    body select:not([multiple]):not([size]),body select:not([multiple])[size="1"]{appearance:auto!important;-webkit-appearance:auto!important;background-image:none!important}
}

/* Jerarquía única de títulos en las pantallas internas del portal. */
body.workspace-body{--portal-title-size:28px;--portal-section-size:20px;--portal-subsection-size:18px}
body.workspace-body .main-content h1{
    font-family:var(--portal-font)!important;font-size:var(--portal-title-size,28px)!important;
    font-weight:700!important;line-height:1.25!important;letter-spacing:-.025em!important;
    margin-top:0;margin-bottom:16px;
}
body.workspace-body :is(.main-content h2,dialog h2){
    font-family:var(--portal-font)!important;font-size:var(--portal-section-size,20px)!important;
    font-weight:650!important;line-height:1.35!important;letter-spacing:-.02em!important;
}
body.workspace-body :is(.main-content h3,dialog h3){
    font-family:var(--portal-font)!important;font-size:var(--portal-subsection-size,18px)!important;
    font-weight:600!important;line-height:1.4!important;letter-spacing:-.015em!important;
}
body.workspace-body :is(.page-heading,.section-heading,.admin-heading)>:is(h1,h2,h3),
body.workspace-body dialog>header :is(h1,h2,h3){margin:0}

/* Buscadores: ancho útil para escribir, sin ocupar el espacio de la lupa. */
body input[type=search]{
    box-sizing:border-box;padding-left:44px!important;padding-right:14px!important;
    background-position:14px center!important;background-size:20px 20px!important;background-repeat:no-repeat!important;
    text-indent:0!important;text-align:left;line-height:1.5;min-height:46px;
    color:var(--control-ink,#191919);
}
body input[type=search]::placeholder{color:#666;opacity:1}
body .main-content [class*="filter"] label:has(>input[type=search]){
    flex:1 1 300px!important;width:auto!important;min-width:min(100%,280px)!important;max-width:none!important;
}
body .main-content [class*="filter"] label>input[type=search]{width:100%;max-width:100%}
@media(max-width:600px){
    body .main-content [class*="filter"] label:has(>input[type=search]){flex-basis:100%!important;min-width:0!important;width:100%!important}
}
