/* Phone layout (up to 700 px). Computers are not affected: everything is inside the media query except the elements that stay hidden. */
.mnav,.mburger,.dback{display:none}
.installBtn{width:100%;margin-bottom:6px;padding:9px 10px;border:0;border-radius:8px;background:var(--brand);color:var(--brand-ink);font:inherit;font-weight:700;cursor:pointer}
.iosHint{font-size:12px;color:var(--side-ink);padding:6px 8px;line-height:1.4}
@media (max-width:700px){
  html{-webkit-text-size-adjust:100%}
  body{font-size:14.5px;padding-bottom:env(safe-area-inset-bottom)}
  input,select,textarea{font-size:16px!important}                         /* below 16px iPhones zoom into the field */
  .btn,.tb,button,select{min-height:38px}
  .shell{display:block}
  /* menu: slides in from the left instead of taking space */
  aside.side{position:fixed!important;left:0;top:0;bottom:0;height:100dvh!important;width:272px!important;transform:translateX(-105%);transition:transform .2s ease;z-index:60;box-shadow:6px 0 30px rgba(0,0,0,.35);overflow:hidden}
  body.drawer aside.side{transform:none}
  aside.side .lbl,aside.side .logo b,body.slim aside.side .lbl,body.slim aside.side .logo b{display:inline!important}
  aside.side nav a,body.slim aside.side nav a{justify-content:flex-start!important;padding:12px 12px;font-size:15px}
  aside.side nav{padding-bottom:12px}
  #slimBtn{display:none}
  .dback{position:fixed;inset:0;background:rgba(10,15,25,.55);z-index:55}
  body.drawer .dback{display:block}
  body.drawer{overflow:hidden}
  /* top bar */
  .topbar,body.ses-admin #header{padding:7px 10px!important;gap:8px!important;justify-content:flex-end;flex-wrap:nowrap;top:0}
  .mburger{display:grid;place-items:center;width:42px;height:42px;border:0;border-radius:10px;background:var(--chip);color:var(--ink);margin-right:auto;flex:none}
  .topbar .who,#user-tools>strong,#user-tools>a,#user-tools>form,#user-tools .color-theme-toggle{display:none!important}
  .ccount{margin-right:0!important;padding:4px 9px}.ccount .ccbar{display:none}
  body.ses-admin #user-tools{display:flex;align-items:center;gap:8px;margin:0;padding:0;font-size:13px}
  main{padding:12px 12px 92px}
  body.ses-admin #content{padding:12px 12px 92px}
  h1{font-size:20px}
  /* bottom navigation */
  .mnav{display:flex;position:fixed;left:0;right:0;bottom:0;z-index:45;background:var(--card);border-top:1px solid var(--line);padding:4px 4px calc(4px + env(safe-area-inset-bottom));box-shadow:0 -4px 16px rgba(0,0,0,.08)}
  .mnav a,.mnav button{flex:1;display:flex;flex-direction:column;align-items:center;gap:2px;padding:6px 2px;border:0;background:none;color:var(--muted);font:inherit;font-size:11px;font-weight:600;position:relative;min-height:50px;border-radius:10px;cursor:pointer}
  .mnav svg{width:22px;height:22px;stroke:currentColor;fill:none;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
  .mnav a.on{color:var(--link)}.mnav a:hover{text-decoration:none}
  .mnav .waBadgeM{position:absolute;top:2px;left:calc(50% + 6px);background:#25a244;color:#fff;border-radius:9px;padding:0 5px;font-size:10px;line-height:15px}
  /* the pop-ups from the reminders must not hide behind the bottom bar */
  /* alerts sit under the top bar (the bottom stays free for the chat box and the menu bar) */
  .remPanel{top:62px!important;left:8px;right:8px;width:auto!important;max-height:68dvh}
  .remAlert{top:62px!important;bottom:auto!important;left:8px!important;right:8px;transform:none!important;width:auto!important;max-height:58dvh;overflow:auto}
  /* general content */
  .grid2{grid-template-columns:1fr}
  .cards{grid-template-columns:repeat(auto-fill,minmax(150px,1fr))}
  .rgroup{grid-template-columns:1fr}
  .kpi .v{font-size:24px}
  form.filters{padding:10px}form.filters label{flex:1 1 140px}form.filters select,form.filters input{min-width:0;width:100%}
  .bar{grid-template-columns:minmax(70px,34%) 1fr auto}
  .panel{overflow-x:auto}
  .table-wrap{-webkit-overflow-scrolling:touch}
  .lv-head{gap:8px}.lv-search{min-width:0;flex:1 1 100%}
  .toolbar{gap:6px}
  /* lists: filter panel becomes a sheet from the bottom, records become cards */
  .layout{grid-template-columns:1fr}
  #panel{position:fixed;left:0;right:0;bottom:0;top:auto;max-height:80dvh;z-index:58;border-radius:16px 16px 0 0;box-shadow:0 -10px 40px rgba(0,0,0,.35);padding-bottom:calc(14px + env(safe-area-inset-bottom))}
  .layout.nopanel #panel{display:none}
  .tablebox{border:0;background:transparent;overflow:visible}.tablebox .scroll{max-height:none;overflow:visible}
  table.lv,table.lv tbody,table.lv tr,table.lv td{display:block;width:100%}
  table.lv thead{display:none}
  table.lv tr{position:relative;border:1px solid var(--line);border-radius:12px;margin:0 0 10px;padding:10px 12px;background:var(--card)}
  table.lv td{border:0!important;padding:3px 0!important;white-space:normal!important;display:flex;gap:10px;justify-content:space-between;align-items:center;text-align:right!important}
  table.lv td::before{content:attr(data-label);color:var(--muted);font-size:12px;font-weight:600;text-align:left;flex:none;max-width:42%}
  table.lv td.sel{position:absolute;top:6px;right:8px;width:auto;padding:0!important}table.lv td.sel::before{content:none}
  table.lv td.lnk{justify-content:flex-start;font-size:16px;padding-right:34px!important}table.lv td.lnk::before{content:none}
  table.lv td:nth-child(n+8):not(.act){display:none}                       /* name + 6 columns are enough on a phone; computers show all */
  table.lv td.blank{display:none}                                           /* no value: no empty line on the card */
  table.lv td.act{position:static!important;box-shadow:none!important;justify-content:flex-start;gap:8px;margin-top:6px;background:transparent!important}table.lv td.act::before{content:none}
  table.lv td.act .btn,table.lv td.act a{padding:8px 14px}
  .tel{width:38px!important;height:38px!important;margin-left:10px!important}.tel svg{width:18px!important;height:18px!important}
  table.lv tbody tr:hover{background:var(--card)}
  .pager{padding:8px 4px}
  .kan{scroll-snap-type:x mandatory}.lane{min-width:82vw;max-width:82vw;scroll-snap-align:center}
  /* Django admin forms (lead page, invoices...) */
  body.ses-admin #header{display:flex!important;flex-direction:row!important;align-items:center}body.ses-admin #user-tools{margin-left:auto!important}
  body.ses-admin #user-tools{font-size:0}body.ses-admin #user-tools>*{font-size:13px}
  body.ses-admin .aligned label{float:none!important;width:auto!important;display:block;padding:0 0 4px!important;margin:0!important}
  body.ses-admin .aligned .form-row>div,body.ses-admin .aligned .form-row .flex-container{display:block!important;margin-left:0!important;width:100%!important;padding-left:0!important}
  body.ses-admin .aligned .form-row .flex-container label{width:auto!important}
  body.ses-admin fieldset.module,body.ses-admin .module{margin-left:0!important;margin-right:0!important;max-width:100%;overflow-x:auto}
  body.ses-admin .aligned input[type=text],body.ses-admin .aligned input[type=email],body.ses-admin .aligned input[type=number],body.ses-admin .aligned input[type=url],body.ses-admin .aligned select,body.ses-admin .aligned textarea,body.ses-admin .vTextField,body.ses-admin .vLargeTextField{width:100%!important;max-width:100%;box-sizing:border-box}
  body.ses-admin .aligned .help,body.ses-admin .help{margin-left:0!important;padding-left:0!important}
  body.ses-admin .submit-row{display:flex;flex-wrap:wrap;gap:8px;padding:10px}body.ses-admin .submit-row input,body.ses-admin .submit-row a{flex:1 1 140px;text-align:center}
  body.ses-admin #changelist{display:block}body.ses-admin #changelist .changelist-form-container{max-width:100%}
  body.ses-admin .results{overflow-x:auto}
  body.drawer .remAlert{display:none}
  /* WhatsApp chat: the message box must sit above the bottom bar */
  body main .wa{height:calc(100dvh - 57px - 66px - 20px - env(safe-area-inset-bottom));min-height:360px}
  body main .wa-h{padding:8px 10px;gap:8px;flex-wrap:nowrap}body main .wa-h .nm{font-size:15px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}body main .wa-h .sub2{display:none}
  body main .wa-h .sp{min-width:0;overflow:hidden}body main .wa-h a.b{padding:8px 11px;flex:none}
  /* dialogs and the call-result sheet */
  dialog{width:96%;max-width:none;padding:16px}
  .cq .box{max-height:92dvh;overflow:auto;padding-bottom:calc(20px + env(safe-area-inset-bottom))}
  /* invoice print screen: fit the phone instead of the paper */
  table.items{font-size:12px}table.items th,table.items td{white-space:normal;padding:6px 6px}
  .sheet,.invoice,.print-wrap{max-width:100%;overflow-x:auto}
}
@media (max-width:700px) and (display-mode:standalone){ .topbar,body.ses-admin #header{padding-top:calc(7px + env(safe-area-inset-top))!important} }
