/* Phone workspace: the same records and permissions, arranged for touch. */
.mobile-nav,.mobile-cell-label{display:none}
.mobile-menu{display:grid;gap:8px}
.mobile-menu .btn{justify-content:flex-start;white-space:normal;text-align:left}
.mobile-menu .btn.active{background:var(--blue-light);border-color:var(--navy);color:var(--navy)}
@media(max-width:740px){
  .sidebar{display:none}
  .workspace{margin-left:0;min-width:0}
  .topbar{padding:14px 16px;gap:12px;flex-wrap:wrap}
  .topbar:before{content:"Bluegenic · DSP";display:block;color:var(--navy);font-weight:650;font-size:16px;width:100%}
  .top-controls{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);width:100%;gap:12px}
  .control-stack{min-width:0}
  .top-controls .control-stack>label{font-size:14px}
  .top-controls .select-control,.profile-select{width:100%;max-width:100%!important;min-width:0;font-size:16px;min-height:48px}
  .scope-lock{font-size:16px;min-height:48px;overflow-wrap:anywhere}
  .content{padding:20px 16px calc(100px + env(safe-area-inset-bottom,0px));min-width:0}
  .profile-note{font-size:13px;line-height:1.5;overflow-wrap:anywhere}
  .profile-note span:first-child{max-width:none}
  .page-head{display:block;margin-bottom:22px}
  h1{font-size:26px;line-height:1.25;overflow-wrap:anywhere}
  .page-head p{max-width:none;font-size:14px}
  .head-actions{margin-top:16px;justify-content:flex-start;width:100%}
  .head-actions:empty{display:none}
  .head-actions .btn{flex:1;font-size:14px}
  .btn,.icon-btn,.attention .btn,td .btn{min-height:48px;font-size:14px;padding:11px 14px;white-space:normal}
  .icon-btn{width:48px;height:48px;flex-shrink:0}
  input:not([type=checkbox]):not([type=radio]),select,textarea,.field input,.field select,.field textarea,.search input,.select-control{font-size:16px;min-height:48px;min-width:0;max-width:100%}
  input[type=checkbox],input[type=radio]{width:20px;height:20px;accent-color:var(--navy)}
  .cs-pick{min-height:48px;font-size:14px}
  .filters{display:grid;grid-template-columns:minmax(0,1fr);gap:10px}
  .filters>*{width:100%;max-width:100%}
  .filters .search input{width:100%}
  .toolbar{gap:12px}
  .toolbar>.btn{width:100%}
  .planning-controls{display:grid;grid-template-columns:auto minmax(0,1fr);width:100%;max-width:none}
  .planning-controls .select-control{max-width:none;width:100%}
  .planning-controls>.btn{grid-column:1/-1;width:100%;font-size:14px}
  .planning-head,.panel-head{padding:18px 16px;flex-wrap:wrap}
  .panel-head>div{min-width:0;flex:1 1 180px}
  .panel-head>.btn{flex:1 1 120px}
  .planning-summary{padding:16px;gap:10px}
  .planning-summary .planning-rule{font-size:14px!important}
  .metric-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
  .metric{padding:14px;min-width:0;min-height:132px}
  .metric-top{font-size:14px;gap:8px;align-items:flex-start}
  .metric-top .metric-icon{display:none}
  .metric-number{font-size:clamp(22px,6vw,28px);overflow-wrap:anywhere}
  .metric-foot{font-size:13px}
  .tag{white-space:normal;font-size:14px;max-width:100%}
  .notice,.scope-banner,.id-format{font-size:14px;overflow-wrap:anywhere}
  .branch-grid,.case-grid,.split{grid-template-columns:minmax(0,1fr)}
  .branch-title,.branch-payment,.case-top,.case-footer,.case-details-name,.review-total,.review-line{flex-wrap:wrap}
  .branch-stats{gap:24px;flex-wrap:wrap}
  .case-card h2,.case-card p,.schedule-info,.detail-value{overflow-wrap:anywhere}
  .schedule-row{grid-template-columns:minmax(0,1fr);gap:12px}
  .schedule-actions{grid-column:auto;flex-wrap:wrap}
  .schedule-info strong,.schedule-info p,.schedule-time{font-size:14px}
  .table-wrap{overflow:visible}
  .mobile-records,.planning-panel table.mobile-records,.collection-priority table.mobile-records,.report-table.mobile-records{display:block;width:100%;min-width:0}
  .mobile-records thead{position:absolute;width:1px;height:1px;padding:0;overflow:hidden;clip-path:inset(50%);white-space:nowrap}
  .mobile-records tbody{display:block;padding:0 16px}
  .mobile-records tbody tr{display:block;padding:18px 0;border-bottom:1px solid var(--line)}
  .mobile-records tbody tr:last-child{border-bottom:0}
  .mobile-records td,.mobile-records td.audit-cell{display:block;width:100%;min-width:0;max-width:none;padding:7px 0;border:0;white-space:normal;font-size:16px;overflow-wrap:anywhere}
  .mobile-records td .sub{font-size:14px;line-height:1.5;margin-top:5px}
  .mobile-cell-label{display:block;color:var(--muted);font-size:14px;font-weight:500;margin-bottom:4px}
  .mobile-records td:first-child .mobile-cell-label{display:none}
  .mobile-records td:first-child>strong{font-size:18px;color:var(--navy)}
  .mobile-records td.mobile-actions{display:flex;flex-wrap:wrap;gap:8px;padding-top:12px}
  .mobile-records td.mobile-actions .btn{flex:1}
  .mobile-records td.mobile-blank{display:none}
  .mobile-records .audit-value{max-height:180px;max-width:100%;font-size:14px}
  .table-footer{flex-wrap:wrap;gap:8px;font-size:14px}
  .tabs{flex-wrap:wrap;white-space:normal;overflow:visible;gap:4px}
  .tab{min-height:48px;padding:12px;font-size:14px;text-align:left}
  .excel-sections{grid-template-columns:minmax(0,1fr)}
  .excel-section{min-height:64px;padding:14px}
  .excel-section span{font-size:14px}
  .month-banner{flex-direction:column;align-items:flex-start}
  .month-total span{text-align:left;font-size:14px}
  .modal-shade{padding:0;align-items:stretch}
  .modal,.modal.wide{width:100%;max-width:none;max-height:none;height:100vh;height:100dvh;border-radius:0}
  .modal-head{padding:12px 16px;flex-shrink:0;gap:12px}
  .modal-head h2{font-size:20px;overflow-wrap:anywhere}
  .modal-body{padding:20px 16px calc(24px + env(safe-area-inset-bottom,0px));min-height:0;overscroll-behavior:contain}
  .form-grid,.details-grid{grid-template-columns:minmax(0,1fr)}
  .field.full{grid-column:auto}
  .form-actions{display:grid;grid-template-columns:minmax(0,1fr);gap:10px}
  .form-actions .btn{width:100%}
  .detail-label,.field .hint{font-size:14px}
  .detail-value{font-size:16px}
  .phone{max-width:100%;border:0;border-radius:14px;min-height:0;box-shadow:none}
  .phone-status{display:none}
  .phone-content{padding:12px;min-height:0}
  .phone-form{padding:16px}
  .bubble.user{margin-left:16px}
  .whatsapp-layout{grid-template-columns:minmax(0,1fr);gap:18px}
  .mobile-nav{display:grid;position:fixed;inset:auto 0 0;grid-template-columns:repeat(var(--mobile-tabs),minmax(0,1fr));gap:2px;padding:8px 6px calc(8px + env(safe-area-inset-bottom,0px));background:#fff;border-top:1px solid var(--line);z-index:20;box-shadow:0 -4px 20px #13265c08}
  .mobile-nav button{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:5px;border:0;border-radius:9px;background:transparent;color:var(--muted);font-size:12px;font-weight:550;min-height:58px;min-width:0;padding:6px 2px;line-height:1.2}
  .mobile-nav button.active{color:var(--navy);background:var(--blue-light)}
  #toast{bottom:calc(92px + env(safe-area-inset-bottom,0px));max-width:calc(100vw - 32px);overflow-wrap:anywhere}
}
@media(prefers-reduced-motion:reduce){button,#toast{transition:none}button:active{transform:none}}
