/* V0.1.31 — campos e controles em telas pequenas. Regras de negócio preservadas. */
@media screen and (max-width:760px), screen and (pointer:coarse){
  input:not([type=checkbox]):not([type=radio]):not([type=hidden]),select,textarea,
  .company-select,.topbar .company-select{font-size:16px}
}
@media screen and (max-width:760px){
  .content,.workspace,#page,.panel,.panel-body,.modal-body,.modal-form,
  .row,.row>*,.toolbar>*,.nfse,.nfse-grid>*{min-width:0;max-width:100%}
  input:not([type=checkbox]):not([type=radio]):not([type=hidden]),select,textarea{
    box-sizing:border-box;width:100%;min-width:0;max-width:100%;min-height:44px;
  }
  /* Safari: impedir que o valor nativo imponha uma largura maior que o campo. */
  input[type=date],input[type=time],input[type=datetime-local]{
    -webkit-appearance:none;appearance:none;display:block;width:100%;min-width:0;max-width:100%;
    min-height:44px;text-align:left;
  }
  input::-webkit-date-and-time-value{min-width:0;text-align:left}
  input::-webkit-datetime-edit{min-width:0;padding:0}
  input::-webkit-datetime-edit-fields-wrapper{min-width:0;padding:0}
  input[type=file]{overflow:hidden}
  label{min-width:0;overflow-wrap:anywhere}
  .toolbar{display:grid;grid-template-columns:minmax(0,1fr);align-items:end;gap:12px}
  .toolbar label,.toolbar label.grow{min-width:0;width:100%;margin:0}
  .toolbar .btn{width:100%;height:auto;min-height:44px}
  .toolbar .error{margin:0}
  .row>*{width:100%;flex-basis:auto}
  .btn{min-width:0;max-width:100%;min-height:44px;white-space:normal;overflow-wrap:anywhere;text-align:center;height:auto}
  .btn.small,.page-head .btn{min-height:44px;white-space:normal}
  .actions{flex-wrap:wrap;max-width:100%;gap:8px}
  .page-head{flex-direction:column;align-items:stretch}
  .page-head>div,.page-head>.actions{min-width:0;max-width:100%}
  .page-head>.btn{align-self:flex-start}
  .page-head>.actions{justify-content:flex-start}
  .panel-head{flex-direction:column;align-items:stretch;gap:12px}
  .panel-head>div,.panel-head>h2{min-width:0;overflow-wrap:anywhere}
  .panel-head>.btn{align-self:flex-start}
  .panel-head .actions{justify-content:flex-start}
  .panel-head .actions>.btn{flex:1 1 140px}
  .summary-list li{gap:12px;flex-wrap:wrap}
  .summary-list li>span{flex:1 1 120px;min-width:0;overflow-wrap:anywhere}
  .summary-list li>strong{min-width:0;max-width:100%;overflow-wrap:anywhere;text-align:right}
  .summary-list li>.actions{width:100%;justify-content:flex-start}
  .summary-list .actions>.btn{flex:1 1 85px}
  .search-item{flex-wrap:wrap;min-width:0}
  .search-item>div{flex:1 1 160px;min-width:0;overflow-wrap:anywhere}
  .search-item .btn{margin-left:0}
  .topbar .top-left{flex:1;min-width:0;max-width:none}
  .top-left>div:not(.header-brand){min-width:0;flex:1}
  .topbar .company-select{max-width:100%;min-width:0;width:100%;text-overflow:ellipsis}
  .topbar .menu-toggle,.topbar .account{flex-shrink:0}
  .topbar .account .btn{padding:8px}
  .topbar .header-brand{flex:0 0 64px}
  dialog{width:calc(100% - 24px);max-width:640px;max-height:calc(100vh - 24px);max-height:calc(100dvh - 24px);margin:auto;overflow:auto;overscroll-behavior:contain}
  .modal-head{gap:12px}
  .modal-head h2{min-width:0;overflow-wrap:anywhere}
  .modal-head>.btn{flex-shrink:0;width:44px}
  .modal-body{padding:4px 16px 20px}
  .modal-foot{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}
  .modal-foot .btn{width:100%;margin:0;min-height:44px}
  .grade-row{grid-template-columns:repeat(2,minmax(0,1fr));gap:10px;margin-bottom:20px}
  .grade-row>label:first-child{grid-column:1/-1}
  .grade-row .step{grid-column:1}
  .grade-row>.btn{grid-column:2;justify-self:end;width:44px}
  .grade-row label{min-width:0}
  .nfse .nfse-grid,.nfse .nfse-filters,.nfse .nfse-actions,.nfse .nfse-diagnostic li{grid-template-columns:minmax(0,1fr)}
  .nfse .nfse-grid label{grid-template-rows:auto 44px}
  .nfse .nfse-full{grid-column:auto}
  .nfse .nfse-full label{grid-template-rows:auto auto}
  .nfse .nfse-filters{padding:16px}
  .nfse .nfse-filters input{min-width:0;max-width:100%}
  .nfse .nfse-actions{width:100%}
  .calendar-navigation{min-width:0;width:100%}
  .calendar-navigation h2{flex-basis:100%;margin:6px 0 0;overflow-wrap:anywhere}
  .calendar-navigation .btn{min-width:44px}
  .tabs{max-width:100%;overscroll-behavior-x:contain}
  .notice,.hint,.record,.doctor-card h3{overflow-wrap:anywhere}
  /* Manter tabelas e calendários largos em suas áreas de rolagem. */
  .table-wrap,.calendar-scroll,.billing-scroll,.finance-table,.cash-table,.requests-scroll{min-width:0;max-width:100%;overscroll-behavior-x:contain}
  .nfse-actions .btn,.billing-detail-actions .btn{max-width:100%}
  html:has(dialog[open]),body:has(dialog[open]){overflow:hidden;overscroll-behavior:none}
}

/* V0.1.41 — entrada guiada, login e modais sem expansão lateral. */
textarea{resize:none}
.setup-list{list-style:none;margin:0;padding:0;display:grid;gap:12px}
.setup-item{display:flex;align-items:center;justify-content:space-between;gap:16px;border-bottom:1px solid #e3e9ef;padding:12px 0}
.setup-item>div{min-width:0}.setup-item .hint{margin:8px 0 0}
.setup-state{display:inline-block;margin-left:10px;padding:4px 8px;font-size:12px;border-radius:8px;background:#fff2cf;color:#815e12}
.setup-state.done{background:#e1f4eb;color:#23694d}
.setup-doctors{display:grid;gap:16px}.setup-doctor{padding:16px;border:1px solid #e3e9ef;border-radius:12px;min-width:0}
.setup-doctor h3{margin:0;overflow-wrap:anywhere}
@media(max-width:760px){
 .login,.login-form,.login-form>div,.boot{min-width:0;max-width:100%;box-sizing:border-box}
 .login-form{padding:24px 16px}.login-form form{min-width:0}
 .setup-item{flex-direction:column;align-items:stretch}.setup-item .btn{align-self:flex-start}
 .setup-state{margin-left:0;margin-top:8px;display:table}
 .setup-doctor .actions .btn{flex:1 1 140px}
 .modal-body p,.modal-body strong,.notice,.error{overflow-wrap:anywhere}
 .doctor-card{min-width:0;max-width:100%}
}
