/* Gestión móvil: optimización de densidad, jerarquía y navegación.
   Capa de presentación sobre los tokens existentes (Pernil verde). */
:root{--ui-mobile-border:#dbe6df;--ui-mobile-radius:12px}
:where(.live-thread,.live-card,.pedido-card,.channel-panel){overflow-wrap:anywhere}
.contact-attribution-details{margin:12px 0;border:1px solid #dbe6df;padding:0 10px;border-radius:10px}
.contact-attribution-details summary{padding:13px 0;cursor:pointer;min-height:44px;font-weight:760;color:#0b6552}
.contact-attribution-details p{font-size:12px;margin:6px 0}
.delivery-card h3{line-height:1.32}
.delivery-card .delivery-status{color:#1f6d55}
.legacy-value-alert{display:block;color:#9a3412;font-size:11px;font-weight:750;margin-top:5px}
.live-business-table{max-width:100%}
.live-business-table th,.live-business-table td{vertical-align:top}
#toggle-template-in-chat{display:none}
@media (max-width:760px){
  /* One compact application header; headings belong inside content. */
  html,body{overflow:hidden}
  .live-banner{display:none!important}
  .workspace{height:100dvh!important;min-height:0!important}
  .main{min-height:0;height:calc(100% - 62px - env(safe-area-inset-bottom))!important}
  .main-header{height:54px!important;min-height:54px;padding:0 12px;gap:8px;box-shadow:0 1px 0 #e3ebe4}
  .header-brand{min-width:0;flex:1}
  .header-brand h1{display:none}
  .header-brand .eyebrow{font-size:0;white-space:nowrap;display:block;letter-spacing:0}
  .header-brand .eyebrow:before{content:"PERNIL";font-size:13px;font-weight:850;letter-spacing:.12em;color:#164939}
  .header-right{gap:7px;flex:none}
  #provider-status{display:inline-flex;min-width:16px;max-width:16px;overflow:hidden;white-space:nowrap}
  #provider-status-text{display:none}
  #provider-status .sync-indicator{flex:none;width:10px;height:10px;margin:0}
  .header-pedido-cta{font-size:12px!important;min-height:40px!important;height:40px;padding:8px 12px!important;white-space:nowrap}
  .header-help{width:40px!important;height:40px!important;min-width:40px!important;min-height:40px!important;padding:0!important}
  .rail{height:calc(62px + env(safe-area-inset-bottom));min-height:62px;max-height:calc(62px + env(safe-area-inset-bottom));padding:5px 5px max(4px,env(safe-area-inset-bottom));border-top-color:#456055}
  .rail-nav{gap:2px}
  .rail-action{height:51px;min-height:51px;padding:3px 1px;min-width:0}
  .rail-action .glyph{font-size:22px;line-height:24px}
  .rail-action small{font-size:10px}
  .section,.live-section{min-width:0}
  .live-section{padding:14px 12px 24px!important;overscroll-behavior-y:contain}
  .live-section .section-heading{display:block;margin:0 0 15px}
  .live-section .section-heading .eyebrow{display:none}
  .live-section .section-heading h2{font-size:22px;line-height:1.15;letter-spacing:-.03em;margin:0 0 6px;font-weight:780}
  .live-section .section-heading p{font-size:12px;line-height:1.38;margin:0;color:#64776b;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}
  .live-section p{line-height:1.44}
  .live-grid{gap:9px}
  .live-card{padding:13px 14px;border-radius:12px;box-shadow:none}
  .live-card h3{font-size:15px;line-height:1.36;margin:0 0 7px}
  .live-card p{font-size:13px;margin:5px 0;line-height:1.42;color:#52665b}
  .live-card small{display:block;font-size:11px;line-height:1.35;margin-top:7px}
  .live-actions{gap:6px;margin-top:10px}
  .live-actions button{flex:1 1 90px;font-size:12px;min-height:44px;padding:8px 10px}
  /* Finance: move period above metrics, not beside the title */
  #channels .section-heading{display:flex;flex-direction:column;align-items:stretch;gap:10px}
  .channel-controls{display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:end;gap:8px;width:100%;margin:0}
  .channel-controls label{min-width:0;margin:0;font-size:11px}
  .channel-controls label:first-child{grid-column:1}
  .channel-controls select{width:100%;min-width:0;min-height:42px;padding:8px 10px;font-size:14px}
  .channel-controls #channel-refresh{grid-column:2;min-height:42px;padding:8px 12px;font-size:12px}
  .channel-controls .channel-custom-dates{min-width:0}
  .channel-controls .channel-custom-dates input{width:100%;min-width:0;min-height:42px;font-size:13px}
  .channel-kpis{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;margin:11px 0 15px}
  .channel-kpi{padding:12px;gap:5px;border-radius:11px;min-height:0}
  .channel-kpi small{font-size:10px;letter-spacing:.01em;line-height:1.3}
  .channel-kpi strong{font-size:clamp(19px,5.4vw,25px);letter-spacing:-.045em;line-height:1.16}
  .channel-kpi span{font-size:10px;line-height:1.3}
  .channel-kpi:nth-child(5){grid-column:1/-1;background:#f6fbf7;border-color:#aecdb9}
  .channel-kpi:nth-child(5) strong{font-size:27px}
  .channel-panel{padding:14px;border-radius:12px;margin-bottom:12px}
  .channel-panel h3{font-size:16px;margin:0 0 8px}
  .channel-panel p{font-size:12px;line-height:1.48}
  .channel-mini-metrics{gap:7px;margin:12px 0}
  .channel-mini-metrics span{padding:10px;font-size:11px}
  .channel-mini-metrics b{font-size:21px}
  .channel-financial-warning{padding:10px}
  .channel-table{font-size:12px}
  .channel-table th,.channel-table td{padding:9px}
  .channel-pedido-overview{padding:13px;margin:0 0 13px}
  .channel-pedido-overview-head{margin-bottom:10px}
  .channel-pedido-overview-head strong{font-size:14px}
  .channel-pedido-overview-head button{font-size:12px;padding:6px 8px;min-height:36px}
  .channel-pedido-kpis{gap:7px}
  .channel-pedido-kpis>div{padding:10px}
  .channel-pedido-kpis strong{font-size:20px}
  /* Orders: persistent + Pedido already exists in header. */
  #pedido-create{display:none!important}
  .pedido-stats{gap:8px;margin:10px 0}
  .pedido-stat{padding:11px}
  .pedido-stat small{font-size:11px}
  .pedido-stat strong{font-size:21px}
  .pedido-filters{grid-template-columns:1fr;gap:8px}
  .pedido-filters label{font-size:12px}
  .pedido-card{padding:12px;gap:8px;align-items:stretch}
  .pedido-card h3{font-size:15px}
  .pedido-card p{font-size:12px;margin:5px 0}
  /* Business panels: scan without sideways scrolling. */
  #business-summary{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:7px}
  #business-summary .live-card{padding:10px;min-width:0}
  #business-summary .live-card h3{font-size:23px;margin:7px 0 0}
  #business-summary .live-card small{font-size:10px;line-height:1.25;margin:0}
  .live-business-tabs{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:7px;margin:12px 0}
  .live-business-tabs button{min-width:0;font-size:12px;line-height:1.3;padding:10px 8px}
  .live-business-panel{padding:13px;border-radius:12px;margin:10px 0}
  .live-business-panel h3{font-size:16px;margin:0 0 11px}
  .live-business-panel p{font-size:12px;line-height:1.42}
  .live-business-panel p #go-to-pedidos{display:inline;padding:2px;min-width:0;min-height:0;background:transparent;color:#086550;text-decoration:underline;border:0;font-weight:700}
  .live-business-table{overflow-x:visible}
  .live-business-table table,.live-business-table tbody{display:block;width:100%;min-width:0}
  .live-business-table thead{display:none}
  .live-business-table tr{display:block;border:1px solid #dce7df;border-radius:10px;padding:6px 10px;margin:0 0 10px;background:#fff}
  .live-business-table td{display:flex;align-items:flex-start;justify-content:space-between;gap:12px;padding:9px 0!important;white-space:normal!important;font-size:12px;min-width:0;text-align:right!important;overflow-wrap:anywhere}
  .live-business-table td:last-child{border:0}
  .live-business-table td::before{content:attr(data-label);font-weight:780;color:#536e5c;flex:0 0 41%;text-align:left;font-size:11px}
  .live-business-table td :is(input,select){min-width:0;max-width:55vw}
  .live-business-table button{font-size:12px;min-height:38px;min-width:0;max-width:100%}
  .live-business-panel form{display:grid;grid-template-columns:1fr;gap:9px}
  .live-business-panel form input,.live-business-panel form select{width:100%;max-width:100%}
  .live-business-panel form button{min-height:44px}
  /* Agenda: compact daily counts; preserve 7-day grid. */
  .calendar-shell{padding:9px}
  .calendar-toolbar{padding:5px 1px 9px;gap:4px}
  .calendar-toolbar strong{font-size:15px}
  .calendar-arrow,.calendar-today{min-height:38px;height:38px}
  .calendar-day{min-height:62px!important;padding:5px 3px!important}
  .calendar-day .day-count{font-size:9px;line-height:1.15;letter-spacing:-.03em;overflow-wrap:anywhere}
  .date-number{font-size:12px}
  /* Chat: templates on demand to reserve height for messages. */
  .threads-top{padding:13px 15px 8px}
  .thread-footer{display:none}
  .thread-list{min-height:0}
  .live-thread{min-height:69px;padding:11px 13px;align-items:center}
  .live-thread .live-avatar{width:38px;height:38px}
  .live-thread strong{font-size:14px}
  .live-thread small{font-size:12px}
  .chat-header{height:55px;padding:0 10px}
  .chat-scroll{padding:10px 10px 12px;overscroll-behavior:contain}
  .chat-messages{gap:7px}
  .chat-messages .live-bubble{font-size:13px;line-height:1.5;margin:4px 0;padding:10px 12px;max-width:90%}
  .chat-messages .live-bubble.out{margin-left:auto}
  .chat-messages .live-bubble small{font-size:11px;margin-top:5px}
  .chat-bottom{padding:8px 10px 9px}
  .quick-actions{margin:0 0 7px;gap:6px}
  .quick-action{font-size:11px;min-height:38px;padding:8px 9px;flex:none}
  #toggle-template-in-chat{display:inline-flex;align-items:center}
  #chat-template-row{display:none;padding:4px 0 9px;background:transparent;gap:6px}
  #chat-template-row.is-open{display:flex}
  #chat-template-row button{font-size:11px;padding:6px;max-width:92px;white-space:normal}
  #chat-template-row select{font-size:13px;min-height:40px}
  .compose-row{gap:7px}
  .compose-row textarea{min-height:45px;max-height:105px;resize:none;font-size:16px}
  .compose-row .send-button{height:47px;width:48px;min-height:47px;min-width:48px}
  .composer-foot{font-size:10px;margin:4px 0 0 4px;line-height:1.25}
  .contact-panel{top:54px;bottom:calc(62px + env(safe-area-inset-bottom))}
  .contact-attribution-details summary{font-size:13px}
  /* Avoid blocking active form when Android keyboard opens. */
  .live-flash{bottom:calc(74px + env(safe-area-inset-bottom));left:12px;right:12px;width:auto;max-width:none}
}
@media(max-width:370px){
 .header-pedido-cta{font-size:11px!important;padding:7px 9px!important}
 .rail-action .glyph{font-size:20px}
 .rail-action small{font-size:9px}
 .channel-kpi strong{font-size:18px}
 .channel-controls #channel-refresh{font-size:11px;padding:8px}
}

@media(max-width:760px){
.signal-details summary,.delivery-details summary{cursor:pointer;font-weight:750;font-size:12px;color:#086550;padding:10px 0;min-height:40px}
.signal-details p,.delivery-details p{border-left:2px solid #a9cdb9;padding:6px 9px;margin:0 0 8px}
.delivery-card h3{font-size:16px}
.delivery-card a{display:inline-flex;min-height:42px;align-items:center;font-size:13px;font-weight:750;padding:8px 0}
.delivery-card .delivery-status{padding:6px 0;color:#1b5d46}
}

#money-visibility-toggle{display:inline-flex;align-items:center;justify-content:center;gap:5px;min-height:42px;padding:8px 10px;background:#eff5f0;border:1px solid #c9ded1;border-radius:10px;color:#145b46;font-size:12px;font-weight:800;cursor:pointer;white-space:nowrap}
#money-visibility-toggle[aria-pressed="true"]{background:#dcece1}
#money-visibility-toggle:focus-visible{outline:3px solid #80bba1;outline-offset:2px}
#money-visibility-toggle span[aria-hidden]{font-size:19px;line-height:1}
@media(max-width:760px){#money-visibility-toggle{min-width:42px;width:42px;height:42px;padding:0}#money-visibility-toggle .money-visibility-label{display:none}}

.supplier-overview{display:grid;gap:10px;margin:13px 0 20px}
.supplier-comparison{display:flex;gap:14px;align-items:start;justify-content:space-between;border:1px solid #d5e3d9;border-radius:12px;padding:14px;background:#f7fbf8}
.supplier-comparison>div{display:grid;gap:4px;min-width:0}
.supplier-comparison>div:last-child{text-align:right}
.supplier-comparison strong{font-size:15px;color:#1c4436}
.supplier-comparison small{font-size:11px;line-height:1.35;color:#617769}
.supplier-comparison span{font-size:13px;color:#415c4e}
.supplier-price-form{display:grid!important;grid-template-columns:repeat(2,minmax(0,1fr))!important;gap:12px!important}
.supplier-price-form label{display:grid;gap:5px;min-width:0;font-size:12px;font-weight:700;color:#516d5f}
.supplier-price-form :is(input,select,textarea){width:100%;max-width:100%;box-sizing:border-box;min-height:43px;font-size:15px;padding:9px;border:1px solid #cddfd2;border-radius:9px;background:#fff;color:#173f32}
.supplier-price-form .supplier-evidence{grid-column:1/-1}
.supplier-price-form button{grid-column:1/-1;min-height:44px}
.supplier-price-form .hidden{display:none}
.supplier-evidence-text{font-size:11px;line-height:1.45;max-width:260px;display:inline-block;overflow-wrap:anywhere}
@media(max-width:760px){.supplier-price-form{grid-template-columns:1fr!important}.supplier-comparison{gap:8px;padding:11px}.supplier-comparison strong{font-size:13px}.supplier-comparison span{font-size:11px}}

.supplier-feed-state{border:1px solid #cbdbcf;border-radius:11px;padding:12px 13px;background:#f4f8f5;display:grid;gap:4px;margin:10px 0 14px}
.supplier-feed-state strong{font-size:13px;color:#1d4838}
.supplier-feed-state span{font-size:12px;color:#51695b}
.supplier-feed-state small{font-size:11px;line-height:1.4;color:#677b6d}
