.stats{grid-template-columns:repeat(auto-fit,minmax(165px,1fr))}.feed-head{display:flex;justify-content:space-between;align-items:end;gap:14px;margin:28px 0 12px}.feed-head h2{font-size:1.4rem;margin:3px 0 0}.feed-filters{display:flex;gap:6px;flex-wrap:wrap}.feed-filters button{padding:7px 12px}.feed-filters button.active{background:#0b55a3;border-color:#0b55a3;color:#fff}.section-title{margin:28px 0 12px}.intake select,.user-row select{font:inherit;border:1px solid #c7d6e7;border-radius:9px;padding:10px;background:#fff;color:#24374d}.intake label select{display:block;width:100%;margin-top:5px}.user-row{align-items:center;gap:16px}.archive-link{display:inline-block;margin-left:5px;padding:7px 9px;border:1px solid #cbd9e9;border-radius:10px;color:#174c8d;text-decoration:none;font-size:.8rem;font-weight:700}.archive-link:hover{background:#eaf3ff}@media(max-width:700px){.feed-head{align-items:flex-start;flex-direction:column}.stats{grid-template-columns:repeat(2,minmax(0,1fr))}.user-row{align-items:flex-start;flex-direction:column}}
.badge.possible{background:#e8f0fb;color:#225b91}.badge.complete{background:#e5f5ed;color:#087a50}
.notification-settings{display:flex;align-items:center;justify-content:space-between;gap:14px;margin:0 0 18px;padding:13px 16px;border:1px solid #b9d3ee;border-radius:13px;background:#eaf4ff;color:#183b63}.notification-settings[hidden]{display:none}.notification-settings strong,.notification-settings span{display:block}.notification-settings span{font-size:.86rem;margin-top:4px;line-height:1.4}.notification-settings button{flex:none;min-height:40px}.notification-settings.enabled{border-color:#b4dcc7;background:#ecf8f1}.notification-settings.blocked{border-color:#e7c8ab;background:#fff5eb}@media(max-width:600px){.notification-settings{align-items:stretch;flex-direction:column}.notification-settings button{width:100%}}
.brand .brand-mark{display:block;flex:none;width:68px;height:44px;overflow:visible}
@media(max-width:700px){.brand .brand-mark{width:50px;height:39px}}
@media(max-width:420px){.brand .brand-mark{width:48px}}
.auth-link{width:100%;margin-top:12px;border:0;background:transparent;color:#0b55a3}
.auth-link:hover{background:#eef6ff}
.invite-result{margin-top:22px;padding:18px;border:1px solid #b8d3ec;background:#f2f8ff;border-radius:12px}
.invite-result p{margin:7px 0 12px}
.invite-result code{display:block;overflow-wrap:anywhere;font-size:1.05rem;font-weight:800;color:#123e70;margin-bottom:12px}
.reset-credential{flex-basis:100%;width:100%;box-sizing:border-box}
#historyBlock[hidden],#inviteResult[hidden]{display:none}
@media(max-width:700px){.top #account span{display:inline;font-size:.8rem}.top-inner{flex-wrap:wrap}.top #account{margin-left:auto}}

button:focus-visible,summary:focus-visible,.archive-link:focus-visible{outline:3px solid #8ac2ff;outline-offset:2px}

/* O portal usa a mesma informação no desktop e no celular, mas no celular
   cada registro vira um cartão. Os rótulos vêm de data-label nos <td>. */
@media(max-width:700px){
  body{overflow-x:hidden}
  main{width:100%;min-width:0;margin:20px auto 0;padding:0 14px 48px}
  .top-inner{padding:12px 14px;align-items:flex-start;gap:8px 12px}
  .brand{min-width:0;gap:8px}
  .brand img{flex:none;width:50px;height:39px}
  .brand span{min-width:0}
  .brand strong{font-size:.9rem;line-height:1.2}
  .brand small{font-size:.7rem;line-height:1.25}
  .top #account{display:flex;align-items:center;justify-content:flex-end;gap:6px;min-width:0;max-width:100%;margin-left:auto}
  .top #account span{font-size:.75rem;line-height:1.25;overflow-wrap:anywhere;text-align:right}
  .top #account button{flex:none;margin-left:0;padding:7px 10px}
  .intro{gap:15px;margin-bottom:18px}
  .intro h1{font-size:clamp(1.75rem,7vw,2.2rem);line-height:1.12}
  .intro p{font-size:.92rem}
  .intro-actions{display:grid;width:100%;grid-template-columns:1fr;gap:8px}
  .intro-actions button{width:100%;min-height:46px}
  .stats{gap:9px;margin-bottom:14px}
  .stat{min-width:0;padding:15px;border-radius:13px}
  .stat strong{font-size:1.65rem}
  .stat span{display:block;font-size:.76rem;line-height:1.3}
  .toolbar{gap:9px;margin-bottom:14px;padding:14px}
  .toolbar .search{flex:1 0 100%;min-width:0;margin-bottom:2px}
  .toolbar button{flex:1 1 auto;min-height:42px;padding:8px 12px}
  .library-panel{margin:0 0 18px;border:0;border-radius:0;background:transparent;box-shadow:none;overflow:visible}
  .library-head{display:flex;align-items:stretch;flex-direction:column;gap:11px;padding:0 0 11px}
  .library-head h2{font-size:1.24rem}
  .library-head .search{flex:auto;width:100%;min-width:0;font-size:.85rem}
  .library-head .search input{min-height:44px}
  .case-filters{padding:0 0 12px}
  .library-panel .list-wrap.card{padding:0;border:0;background:transparent;box-shadow:none;overflow:visible}
  .performance{margin:21px 0;padding:16px}
  .performance h2{font-size:1.2rem}
  .performance p{font-size:.84rem;line-height:1.45}
  .chart-legend{gap:5px 15px;font-size:.72rem}
  .sales-chart{gap:10px}
  .sales-row{display:grid;grid-template-columns:minmax(0,1fr);gap:10px;padding:12px;border-radius:11px}
  .sales-name{min-width:0;font-size:.86rem;overflow-wrap:anywhere}
  .sales-bars{display:grid;gap:7px;min-width:0}
  .sales-bar{position:relative;width:100%;min-width:0;min-height:25px;border-radius:7px;background:#e8f1fb;overflow:hidden}
  .sales-bar .bar-fill{display:block;height:25px;min-width:3px;border-radius:7px;background:#0b55a3}
  .sales-bar.closed .bar-fill{background:#40a876}
  .sales-bar .bar-value{position:absolute;right:5px;top:3px;min-width:22px;padding:0 5px;border-radius:6px;background:#fff;color:#1b2f49;text-align:center;font-size:.72rem;font-weight:800;line-height:19px}
  .history-card{margin-top:17px;border-radius:14px}
  .history-card>summary{padding:15px}
  .history-card>summary strong{font-size:.9rem}
  .history-card>summary small{font-size:.73rem;line-height:1.35}
  .history-filters{padding:0 12px 12px}
  .history-card .list-wrap{padding:12px;border-top:1px solid #e8eef6;overflow:visible}
  .feed-head{margin:24px 0 11px;gap:12px}
  .feed-head h2{font-size:1.22rem;line-height:1.25}
  .feed-filters{width:100%;gap:7px}
  .feed-filters button{flex:1 1 auto;min-height:40px;padding:7px 10px;white-space:normal}
  .list-wrap.card{padding:0;border:0;background:transparent;box-shadow:none;overflow:visible}
  .list-wrap table{display:block;width:100%;min-width:0;border-collapse:separate}
  .list-wrap thead{display:none}
  .list-wrap tbody{display:grid;width:100%;gap:11px}
  #caseRows tr,#eventRows tr{display:block;min-width:0;overflow:hidden;border:1px solid #dbe6f3;border-radius:14px;background:#fff;box-shadow:0 4px 16px rgba(24,57,100,.045)}
  #caseRows td,#eventRows td{display:block;position:relative;min-width:0;min-height:42px;padding:10px 13px 10px 108px;border:0;border-bottom:1px solid #edf2f8;font-size:.9rem;line-height:1.35;white-space:normal;overflow-wrap:anywhere}
  #caseRows td:not(:last-child),#eventRows td:not(:last-child){border-bottom:1px solid #edf2f8}
  #caseRows td:last-child,#eventRows td:last-child{border-bottom:0}
  #caseRows td::before,#eventRows td::before{content:attr(data-label);position:absolute;left:13px;top:11px;width:83px;color:#58708a;font-size:.67rem;font-weight:800;letter-spacing:.06em;line-height:1.25;text-transform:uppercase;overflow-wrap:break-word}
  #caseRows td:first-child,#eventRows td:first-child{padding-top:13px;padding-bottom:13px;background:#f6f9fd;color:#203955;font-weight:700}
  #caseRows td:first-child::before,#eventRows td:first-child::before{top:14px}
  #caseRows td strong,#eventRows td strong{font-size:.92rem;line-height:1.3}
  #caseRows td small,#eventRows td small{margin-top:2px;font-size:.72rem}
  #caseRows td:last-child,#eventRows td:last-child{padding:34px 12px 10px;white-space:normal}
  #caseRows td:last-child::before,#eventRows td:last-child::before{top:10px;left:12px;width:auto}
  .actions-cell{display:flex;flex-wrap:wrap;gap:6px}
  #caseRows .actions-cell button,#eventRows .actions-cell button,.archive-link{display:inline-flex;align-items:center;justify-content:center;min-height:38px;margin:0;padding:7px 10px;font-size:.79rem}
  #caseRows .actions-cell button:first-of-type,#eventRows .actions-cell button:first-of-type{border-color:#0b55a3;background:#0b55a3;color:#fff}
  .empty{border:1px solid #dbe6f3;border-radius:14px;background:#fff;padding:24px 15px}
  .totals{margin-top:18px}
  .count-row{align-items:flex-start;flex-wrap:wrap;gap:4px 12px;font-size:.85rem}
  .intake{width:100%;max-width:none}
  .intake .actions button,.auth form button{width:100%;min-height:46px}
  #inviteForm{margin-top:22px;padding-top:18px;border-top:1px solid #e4edf7}
  #inviteForm h2{font-size:1.06rem}
  #inviteForm button{width:100%;min-height:46px}
  .invite-result{padding:15px}
  .invite-result code{font-size:.86rem;line-height:1.5}
  .invite-result button{width:100%;min-height:42px}
  .user-row{gap:8px;padding:13px 0;overflow-wrap:anywhere}
  .user-row select{width:100%;max-width:100%}
}
@media(max-width:380px){
  .top-inner{align-items:stretch}
  .top #account{width:100%;justify-content:space-between}
  .top #account span{text-align:left}
  .stats{grid-template-columns:repeat(2,minmax(0,1fr))}
  #caseRows td,#eventRows td{padding-left:97px}
  #caseRows td::before,#eventRows td::before{width:74px}
}

/* WebView: controles confortáveis ao toque e campos sempre legíveis com teclado. */
@media(max-width:700px){
  .top-inner{min-height:66px}
  .top #account{flex:0 1 auto}
  .account-menu{max-width:100%;min-width:0}
  .account-menu summary{display:flex;align-items:center;justify-content:center;min-height:44px;max-width:100%;padding:8px 10px;font-size:.8rem;line-height:1.25;overflow-wrap:anywhere}
  .account-options{min-width:min(190px,calc(100vw - 28px));max-width:calc(100vw - 28px)}
  .top .account-options button{min-height:44px;text-align:left}
  main{scroll-margin-top:12px}
  .auth{max-width:440px;margin:20px auto}
  .auth h1,.intake h1,.trash-view h1{font-size:clamp(1.55rem,6vw,2rem);line-height:1.16}
  .auth p,.intake p,.trash-view p{font-size:.94rem;line-height:1.5}
  .auth input,.intake input,.intake select,.search input{min-height:48px;font-size:16px;line-height:1.3}
  .auth label,.intake label{font-size:.92rem;line-height:1.4}
  .auth button,.intake button,.back,.feed-filters button,.record-open,.record-details summary,.record-delete,.record-whatsapp{min-height:44px;touch-action:manipulation}
  .back{display:inline-flex;align-items:center;text-align:left;line-height:1.35}
  .client-records{gap:12px}
  .client-record{max-width:100%;overflow:hidden}
  .record-top{grid-template-columns:40px minmax(0,1fr);align-items:start}
  .record-info,.record-content,.record-field{min-width:0}
  .record-by{line-height:1.45}
  .record-open{font-size:.95rem}
  .record-content{gap:14px 10px}
  .record-field{font-size:.91rem;line-height:1.4}
  .record-field small{font-size:.72rem;letter-spacing:.055em}
  .case-filters{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}
  .case-filters button{width:100%;min-width:0;white-space:normal}
  .case-filters #trashBtn{grid-column:1/-1;justify-self:start;width:auto;min-width:110px}
  .performance-details summary{display:flex;align-items:center;min-height:44px;line-height:1.3}
  .trash-record{gap:10px}
  .trash-record .record-open{align-self:stretch;text-align:center}
  #message{left:12px;right:12px;bottom:calc(12px + env(safe-area-inset-bottom));max-width:none;max-height:35dvh;overflow:auto;transform:none;text-align:center;line-height:1.4}
  :is(input,select,button,summary,a):focus-visible{outline:3px solid #79b7f6;outline-offset:2px}
}
@media(max-width:420px){
  .top-inner{align-items:stretch}
  .brand{flex:1 1 100%}
  .top #account{width:100%;justify-content:flex-end;margin-left:0}
  .account-menu{width:100%}
  .account-menu summary{width:100%;justify-content:space-between;text-align:left}
  .record-content{grid-template-columns:minmax(0,1fr)}
  .stats{grid-template-columns:repeat(2,minmax(0,1fr))}
  .stat{padding:13px 12px}
  .stat strong{font-size:1.55rem}
  .stat span{font-size:.8rem!important}
  .stat small{font-size:.72rem!important}
}
