/* Compact phone reports and accessible POS scanning; retained in GAINVO v3.0. */
.bi-custom-period{display:contents}
.bi-custom-period>summary{display:none}
.bi-periods a.active{background:var(--brand);color:#fff}

@media(min-width:681px){
  .bi-custom-period:not([open])>form{display:flex!important}
}

@media(max-width:680px){
  html,body{max-width:100%;overflow-x:hidden}
  .app-main,.content,.panel,.bi-page,.bi-page>*,.bi-toolbar,.bi-hero,.bi-main-grid,.bi-secondary-grid{min-width:0;max-width:100%}
  .bi-page{gap:10px}

  .bi-toolbar{grid-template-columns:minmax(0,1fr);align-items:stretch;gap:9px;padding:0;background:transparent;overflow:visible}
  .bi-periods{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));width:100%;max-width:100%;gap:4px;padding:4px;overflow:visible}
  .bi-periods a{min-width:0;padding:8px 5px;white-space:nowrap;text-align:center;font-size:10px}
  .bi-custom-period{display:block;min-width:0;width:100%;border:1px solid var(--line);border-radius:13px;background:#fff;overflow:hidden}
  .bi-custom-period>summary{min-height:46px;display:flex;align-items:center;gap:8px;padding:9px 12px;list-style:none;cursor:pointer;color:var(--ink);font-size:11px;font-weight:800}
  .bi-custom-period>summary::-webkit-details-marker{display:none}
  .bi-custom-period>summary span{flex:1}
  .bi-custom-period>summary small{color:var(--muted);font-size:9px;font-weight:650;white-space:nowrap}
  .bi-custom-period>summary .icon{width:14px;transition:transform .2s ease}
  .bi-custom-period[open]>summary .icon{transform:rotate(90deg)}
  .bi-custom-period form{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:8px;padding:0 10px 10px;border-top:1px solid var(--line)}
  .bi-custom-period form label{min-width:0;padding-top:9px;font-size:9px}
  .bi-custom-period form input{min-width:0;max-width:100%;width:100%;min-height:42px;padding:8px 7px;font-size:11px}
  .bi-custom-period form .btn{grid-column:1/-1;width:100%;min-width:0;min-height:42px;padding:8px 12px;font-size:11px}
  .bi-booklet{display:none!important}

  .bi-hero{display:block;min-height:0;padding:20px 17px;border-radius:18px;overflow:hidden}
  .bi-hero>div:first-child{min-width:0}
  .bi-hero>div:first-child>strong{font-size:clamp(29px,9.5vw,36px);line-height:1.15;overflow-wrap:anywhere}
  .bi-hero p{max-width:100%;margin:5px 0 10px;font-size:9px;line-height:1.5;white-space:normal;overflow-wrap:anywhere}
  .bi-change{max-width:100%;white-space:normal}
  .bi-hero-metrics{grid-template-columns:repeat(2,minmax(0,1fr));gap:7px;margin-top:15px}
  .bi-hero-metrics article{min-width:0;min-height:70px;padding:10px}
  .bi-hero-metrics article:nth-child(2),.bi-hero-metrics article:nth-child(4){display:none}
  .bi-hero-metrics strong{font-size:13px;white-space:normal;overflow-wrap:anywhere}

  .bi-kpis{grid-template-columns:repeat(2,minmax(0,1fr));gap:7px}
  .bi-kpis>article,.bi-kpis>a{min-width:0;min-height:82px;padding:10px 8px;gap:7px}
  .bi-kpis>*:nth-child(5),.bi-kpis>*:nth-child(6){display:none}
  .bi-kpis .bi-icon{width:34px;height:34px;flex:0 0 34px}
  .bi-kpis strong{font-size:12px}

  .bi-main-grid{display:flex;flex-direction:column;gap:10px}
  .bi-insights{order:1}
  .bi-trend{order:2}
  .bi-panel-head{min-width:0;gap:8px}
  .bi-panel-head>div{min-width:0}
  .bi-panel-head h2{font-size:16px}
  .bi-panel-head p{font-size:9px}
  .bi-trend{min-width:0;overflow:hidden;padding:15px}
  .bi-trend .bi-panel-head>strong{display:none}
  .bi-bars{width:100%;min-width:0;height:145px;gap:5px;overflow:hidden}
  .bi-bars>div{display:none;min-width:0}
  .bi-bars>div:nth-last-child(-n+7){display:grid}
  .bi-bars small{max-width:100%;overflow:hidden;font-size:7px;text-overflow:ellipsis}
  .bi-insight-list article{padding:10px}
  .bi-insight-list article:nth-child(n+4){display:none}

  .bi-secondary-grid{grid-template-columns:minmax(0,1fr);gap:10px}
  .bi-products{margin-inline:0;padding:14px 12px;border-radius:15px}
  .bi-products .table-wrap{overflow:visible}
  .bi-products table,.bi-products tbody{display:block;width:100%;min-width:0}
  .bi-products thead{display:none}
  .bi-products tbody tr{display:grid;grid-template-columns:30px minmax(0,1fr) auto;grid-template-rows:auto auto;column-gap:8px;row-gap:2px;padding:10px 0;border-bottom:1px solid var(--line)}
  .bi-products tbody tr:last-child{border-bottom:0}
  .bi-products tbody tr:nth-child(n+6){display:none}
  .bi-products td{display:block;min-width:0;padding:0!important;border:0!important;text-align:left!important;font-size:9px}
  .bi-products td:nth-child(1){grid-column:1;grid-row:1/3;align-self:center}
  .bi-products td:nth-child(2){grid-column:2;grid-row:1}
  .bi-products td:nth-child(2)>strong{display:block;max-width:100%;overflow-wrap:anywhere}
  .bi-products td:nth-child(3){grid-column:2;grid-row:2;color:var(--muted)}
  .bi-products td:nth-child(3):before{content:"Units ";font-size:8px}
  .bi-products td:nth-child(4){grid-column:3;grid-row:1;font-size:10px;text-align:right!important}
  .bi-products td:nth-child(5){display:none}
  .bi-products td:nth-child(6){grid-column:3;grid-row:2;color:var(--muted);text-align:right!important}
  .bi-products td:nth-child(6):before{content:"Stock ";font-size:8px}
  .bi-products td[colspan]{display:block;grid-column:1/-1;grid-row:auto;padding:10px 0!important;text-align:center!important}
  .bi-products .table-sub{max-width:100%;white-space:normal;font-size:7px;line-height:1.35}
  .bi-product-share{display:none}
  .bi-payments{padding:15px}

  .bi-bottom-grid,.bi-data-note{display:none}

  /* Sale details become readable summaries instead of a horizontally scrolling desktop table. */
  .sale-view-grid,.sale-detail-card,.sale-side{min-width:0;max-width:100%}
  .sale-detail-card{margin:0;border-radius:15px;border:1px solid var(--line);overflow:hidden}
  .sale-detail-head{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:8px}
  .sale-detail-head>div{min-width:0}
  .sale-detail-head h2{font-size:clamp(20px,7vw,26px);line-height:1.2;overflow-wrap:anywhere}
  .sale-customer{min-width:0}
  .sale-customer>span:last-child{min-width:0}
  .sale-customer strong,.sale-customer em{max-width:100%;overflow-wrap:anywhere}
  .sale-items-table{display:block!important;width:100%;min-width:0!important;overflow:visible!important}
  .sale-items-table thead{display:none!important}
  .sale-items-table tbody{display:grid!important;width:100%!important;min-width:0!important}
  .sale-items-table tr{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:6px;padding:12px 0;border-bottom:1px solid var(--line)}
  .sale-items-table td{display:block;min-width:0;padding:0!important;border:0!important;font-size:10px;text-align:left!important;overflow-wrap:anywhere}
  .sale-items-table td:first-child{grid-column:1/-1;font-size:11px}
  .sale-items-table td:nth-child(2):before,.sale-items-table td:nth-child(3):before,.sale-items-table td:nth-child(4):before{display:block;color:var(--muted);font-size:7px;font-weight:750;letter-spacing:.06em;text-transform:uppercase}
  .sale-items-table td:nth-child(2):before{content:"Quantity"}
  .sale-items-table td:nth-child(3):before{content:"Unit price"}
  .sale-items-table td:nth-child(4):before{content:"Amount"}
  .sale-items-table td:nth-child(3){text-align:center!important}
  .sale-items-table td:nth-child(4){text-align:right!important}
  .sale-total-block{width:100%;max-width:100%;margin:14px 0 0;padding:12px 13px;border-radius:12px;background:#f7f9fc}
  .sale-total-block p{min-width:0;gap:12px}
  .sale-total-block p span{min-width:0}
  .sale-total-block p strong{white-space:nowrap}
  .sale-side .panel{min-width:0}

  /* The original phone rule hid every POS heading button. Keep the scanner visible and remove only the redundant stock shortcut. */
  .pos-heading{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:10px;align-items:start}
  .pos-heading>div:first-child{min-width:0}
  .pos-heading-actions{display:block;width:auto}
  .pos-heading .pos-heading-actions [data-start-camera-scan]{display:inline-flex!important;min-height:42px;padding:8px 12px;font-size:10px;white-space:nowrap}
  .pos-heading .pos-heading-actions>a.btn{display:none!important}
}

@media(max-width:400px){
  .topbar-actions{gap:4px}
  .topbar-actions .app-refresh-button{width:36px;height:36px;min-height:36px;padding:0}
  .topbar-title h1{font-size:17px;white-space:nowrap}
  .user-avatar{width:36px;height:36px;border-radius:10px}
  .notification-button{width:36px;height:36px}
  .sync-status-button{width:36px;height:36px;min-height:36px}
  .bi-hero-metrics{grid-template-columns:minmax(0,1fr)}
  .bi-hero-metrics article:nth-child(3){display:none}
  .bi-kpis .bi-icon{display:none}
  .bi-kpis>article,.bi-kpis>a{min-height:72px;padding:10px}
  .bi-payments{display:none}
}

@media(max-width:340px){
  .content{padding-inline:9px}
  .bi-periods a{font-size:9px}
  .bi-kpis{grid-template-columns:minmax(0,1fr)}
  .pos-heading{grid-template-columns:minmax(0,1fr)}
  .pos-heading-actions,.pos-heading .pos-heading-actions [data-start-camera-scan]{width:100%}
  .sale-items-table tr{grid-template-columns:1fr 1fr}
  .sale-items-table td:first-child{grid-column:1/-1}
  .sale-items-table td:nth-child(4){grid-column:1/-1;text-align:left!important}
}

@media(prefers-reduced-motion:reduce){
  .bi-custom-period>summary .icon{transition:none}
}
