#portal-sms [hidden]{display:none!important}
#portal-sms .smsx-head{align-items:flex-start}
#portal-sms .smsx-role-badge{display:inline-flex;align-items:center;min-height:34px;padding:7px 10px;border:1px solid var(--border);border-radius:999px;background:var(--panel);color:var(--muted);font-size:.72rem;font-weight:800;white-space:nowrap}
#portal-sms .smsx-role-badge.admin{border-color:rgba(34,197,94,.45);color:#8fe9ad;background:rgba(34,197,94,.08)}
#portal-sms .smsx-role-badge.dispatcher{border-color:rgba(59,130,246,.45);color:#a8ccff;background:rgba(59,130,246,.08)}
#portal-sms .smsx-role-notice,#portal-sms .smsx-provider{display:flex;align-items:center;gap:11px;margin-bottom:12px;padding:12px 14px;border:1px solid var(--border);border-radius:10px;background:var(--panel)}
#portal-sms .smsx-role-notice{display:grid;grid-template-columns:auto 1fr;gap:4px 12px;background:linear-gradient(100deg,rgba(244,124,31,.09),var(--panel) 55%)}
#portal-sms .smsx-role-notice strong{color:var(--text);font-size:.78rem}
#portal-sms .smsx-role-notice span,#portal-sms .smsx-provider span{color:var(--muted);font-size:.73rem;line-height:1.45}
#portal-sms .smsx-provider>div{display:grid;gap:2px}
#portal-sms .smsx-provider strong{font-size:.8rem}
#portal-sms .smsx-provider-dot{width:10px;height:10px;border-radius:50%;background:var(--muted);box-shadow:0 0 0 4px var(--soft-border);flex:0 0 auto}
#portal-sms .smsx-provider-dot.ready{background:var(--green);box-shadow:0 0 0 4px rgba(34,197,94,.11)}
#portal-sms .smsx-provider-dot.danger{background:var(--danger);box-shadow:0 0 0 4px rgba(239,68,68,.1)}
#portal-sms .smsx-status{min-height:22px;margin:0 0 12px;color:var(--muted);font-size:.75rem;line-height:1.45}
#portal-sms .smsx-status.success{color:#8fe9ad}
#portal-sms .smsx-status.warning{color:#fbc56d}
#portal-sms .smsx-status.danger{color:#ff9d9d}

#portal-sms .smsx-tabs{display:flex;gap:4px;margin:0 0 18px;padding:5px;overflow-x:auto;border:1px solid var(--border);border-radius:10px;background:var(--surface-deep);scrollbar-width:thin}
#portal-sms .smsx-tabs button{min-height:38px;padding:8px 14px;border:0;border-radius:7px;background:transparent;color:var(--muted);font:inherit;font-size:.76rem;font-weight:800;white-space:nowrap;cursor:pointer}
#portal-sms .smsx-tabs button:hover{color:var(--text);background:var(--panel)}
#portal-sms .smsx-tabs button.active{color:#17110c;background:var(--orange)}
#portal-sms .smsx-tabs button:focus-visible,#portal-sms button:focus-visible,#portal-sms input:focus-visible,#portal-sms select:focus-visible,#portal-sms textarea:focus-visible{outline:3px solid rgba(244,124,31,.42);outline-offset:2px}
#portal-sms .smsx-panel[hidden]{display:none!important}
#portal-sms .smsx-compose-grid{display:grid;grid-template-columns:minmax(0,1.06fr) minmax(340px,.94fr);gap:18px;align-items:start}
#portal-sms .smsx-form{display:grid;gap:15px;margin-top:17px}
#portal-sms .smsx-two-fields{display:grid;grid-template-columns:1fr 1fr;gap:13px}
#portal-sms .smsx-field{display:grid;gap:6px;min-width:0}
#portal-sms .smsx-field label,#portal-sms .smsx-schedule legend,#portal-sms .smsx-schedule-time>label{color:var(--label);font-size:.75rem;font-weight:800}
#portal-sms .smsx-field label span{color:var(--muted);font-size:.66rem;font-weight:600}
#portal-sms input:not([type=checkbox]):not([type=radio]),#portal-sms select,#portal-sms textarea{width:100%;min-height:43px;padding:10px 11px;border:1.5px solid var(--border);border-radius:8px;background:var(--panel-2);color:var(--text);font:inherit;font-size:.84rem}
#portal-sms textarea{resize:vertical;line-height:1.5}
#portal-sms input:focus,#portal-sms select:focus,#portal-sms textarea:focus{border-color:var(--orange);outline:none}
#portal-sms input:disabled,#portal-sms select:disabled,#portal-sms textarea:disabled{opacity:.52;cursor:not-allowed}
#portal-sms .smsx-field-meta{display:flex;justify-content:space-between;gap:12px;color:var(--muted);font-size:.68rem}
#portal-sms .smsx-form-actions{display:flex;justify-content:flex-end;align-items:center;gap:9px;flex-wrap:wrap;margin-top:4px}
#portal-sms .smsx-form-actions .primary-btn,#portal-sms .smsx-form-actions .secondary-btn{min-height:42px}

#portal-sms .smsx-schedule{display:grid;grid-template-columns:auto auto 1fr;align-items:center;gap:10px 18px;padding:13px;border:1px solid var(--border);border-radius:9px;background:var(--panel-2)}
#portal-sms .smsx-schedule legend{padding:0 5px}
#portal-sms .smsx-schedule>label,#portal-sms .smsx-toggle{display:flex;align-items:center;gap:8px;color:var(--text);font-size:.78rem;cursor:pointer}
#portal-sms .smsx-schedule input[type=radio],#portal-sms .smsx-toggle input,#portal-sms .smsx-check-row input{width:17px;height:17px;accent-color:var(--orange);flex:0 0 auto}
#portal-sms .smsx-schedule>label:has(input:disabled){color:var(--muted);cursor:not-allowed}
#portal-sms .smsx-schedule-readiness{justify-self:end;color:var(--muted);font-size:.67rem;line-height:1.4;text-align:right}
#portal-sms .smsx-schedule-readiness.ready{color:#8fe9ad}
#portal-sms .smsx-schedule-readiness.warning{color:#fbc56d}
#portal-sms .smsx-schedule-time{grid-column:1/-1;display:grid;grid-template-columns:minmax(190px,280px) 1fr;align-items:center;gap:7px 12px;padding-top:4px}
#portal-sms .smsx-schedule-time small{color:var(--muted);font-size:.67rem;overflow-wrap:anywhere}
#portal-sms .smsx-schedule-time small.danger{color:#ff9d9d}

#portal-sms .smsx-driver-picker{padding:12px;border:1px solid var(--border);border-radius:9px;background:var(--panel-2)}
#portal-sms .smsx-picker-head{display:flex;justify-content:space-between;align-items:center;margin-bottom:8px}
#portal-sms .smsx-picker-head>div{display:grid;gap:1px}
#portal-sms .smsx-picker-head strong{font-size:.77rem}
#portal-sms .smsx-picker-head span{color:var(--orange);font-size:.69rem;font-weight:800}
#portal-sms .smsx-check-list{max-height:310px;margin-top:8px;overflow:auto;border:1px solid var(--border);border-radius:8px;background:var(--panel)}
#portal-sms .smsx-check-row{display:flex;align-items:center;gap:10px;padding:10px 11px;border-bottom:1px solid var(--border);cursor:pointer}
#portal-sms .smsx-check-row:last-child{border-bottom:0}
#portal-sms .smsx-check-row:hover{background:var(--panel-2)}
#portal-sms .smsx-check-row>span{display:grid;gap:2px;min-width:0}
#portal-sms .smsx-check-row strong{font-size:.76rem}
#portal-sms .smsx-check-row small{color:var(--muted);font-size:.66rem;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}

#portal-sms .smsx-preview-card{position:sticky;top:16px}
#portal-sms .smsx-preview-metrics{display:grid;grid-template-columns:repeat(6,1fr);gap:7px;margin:16px 0 12px}
#portal-sms .smsx-metric{display:grid;gap:2px;padding:10px 7px;border:1px solid var(--border);border-radius:8px;text-align:center;background:var(--panel-2)}
#portal-sms .smsx-metric strong{font-size:1.05rem}
#portal-sms .smsx-metric span{color:var(--muted);font-size:.61rem;font-weight:700}
#portal-sms .smsx-metric.success strong{color:#7ce6a3}
#portal-sms .smsx-metric.danger strong{color:#ff9d9d}
#portal-sms .smsx-metric.warning strong{color:#fbc56d}
#portal-sms .smsx-preview-list{max-height:500px;overflow:auto;border:1px solid var(--border);border-radius:9px}
#portal-sms .smsx-preview-row{display:grid;grid-template-columns:10px minmax(0,1fr) auto;align-items:center;gap:10px;padding:10px 11px;border-bottom:1px solid var(--border);background:var(--panel-2)}
#portal-sms .smsx-preview-row:last-child{border-bottom:0}
#portal-sms .smsx-preview-row>div{display:grid;gap:2px;min-width:0}
#portal-sms .smsx-preview-row strong{font-size:.75rem}
#portal-sms .smsx-preview-row small{color:var(--muted);font-size:.65rem;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
#portal-sms .smsx-preview-foot{padding:9px 11px;color:var(--muted);font-size:.64rem;font-weight:700;text-align:center;background:var(--surface-deep)}
#portal-sms .smsx-disposition{width:8px;height:8px;border-radius:50%;background:var(--amber)}
#portal-sms .smsx-disposition.eligible{background:var(--green)}
#portal-sms .smsx-disposition.suppressed_opt_out{background:var(--danger)}
#portal-sms .smsx-safety-note{display:grid;gap:3px;margin-top:12px;padding:11px;border:1px solid rgba(244,124,31,.3);border-radius:8px;background:rgba(244,124,31,.07)}
#portal-sms .smsx-safety-note strong{font-size:.73rem;color:#ffc18e}
#portal-sms .smsx-safety-note span{font-size:.66rem;color:var(--muted);line-height:1.5}

#portal-sms .smsx-tools{display:grid;grid-template-columns:minmax(240px,1fr) minmax(170px,240px);gap:10px;margin:16px 0}
#portal-sms .smsx-history{display:grid;gap:10px}
#portal-sms .smsx-history-item{display:grid;grid-template-columns:minmax(0,1fr) auto auto;align-items:center;gap:16px;padding:14px;border:1px solid var(--border);border-radius:9px;background:var(--panel-2)}
#portal-sms .smsx-history-main{display:grid;gap:5px;min-width:0}
#portal-sms .smsx-history-main>div{display:flex;align-items:center;gap:8px;flex-wrap:wrap}
#portal-sms .smsx-history-main>div>strong{font-size:.85rem}
#portal-sms .smsx-history-main p{color:var(--soft-text);font-size:.75rem;line-height:1.4;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
#portal-sms .smsx-history-main small{color:var(--muted);font-size:.66rem}
#portal-sms .smsx-history-counts{display:flex;gap:12px}
#portal-sms .smsx-history-counts span{display:grid;gap:1px;text-align:center;color:var(--muted);font-size:.59rem}
#portal-sms .smsx-history-counts strong{color:var(--text);font-size:.8rem}
#portal-sms .smsx-history-actions{display:flex;align-items:center;justify-content:flex-end;gap:6px;flex-wrap:wrap;max-width:230px}
#portal-sms .text-btn.danger{color:#ff9d9d}

#portal-sms .smsx-manage-grid{display:grid;grid-template-columns:1fr 1fr;gap:18px;align-items:start}
#portal-sms .smsx-manage-list{display:grid;gap:8px;margin-top:14px}
#portal-sms .smsx-manage-item{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:10px;align-items:center;padding:11px;border:1px solid var(--border);border-radius:8px;background:var(--panel-2)}
#portal-sms .smsx-manage-item.selected{border-color:var(--orange);box-shadow:inset 3px 0 0 var(--orange)}
#portal-sms .smsx-manage-item.archived{opacity:.65}
#portal-sms .smsx-manage-item>div:first-child,#portal-sms .smsx-item-main{display:grid;gap:2px;min-width:0}
#portal-sms .smsx-manage-item>div:last-child{display:flex;align-items:center;gap:6px}
#portal-sms .smsx-manage-item strong{font-size:.78rem;color:var(--text)}
#portal-sms .smsx-manage-item span{font-size:.68rem;color:var(--soft-text);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
#portal-sms .smsx-manage-item small{font-size:.63rem;color:var(--muted)}
#portal-sms .smsx-item-main{padding:0;border:0;text-align:left;background:none;cursor:pointer}
#portal-sms .smsx-item-main:disabled{cursor:not-allowed}
#portal-sms .smsx-compact-form{display:grid;gap:11px;margin-top:15px;padding-bottom:14px;border-bottom:1px solid var(--border)}
#portal-sms .smsx-full-search{margin-top:13px}
#portal-sms .smsx-membership-list{max-height:540px}

#portal-sms .smsx-dialog{width:min(720px,calc(100vw - 28px));max-height:calc(100vh - 28px);padding:0;border:1px solid var(--border);border-radius:12px;background:var(--charcoal);color:var(--text);box-shadow:0 24px 90px rgba(0,0,0,.65);overflow:auto}
#portal-sms .smsx-detail-dialog{width:min(1120px,calc(100vw - 28px))}
#portal-sms .smsx-dialog::backdrop{background:rgba(0,0,0,.76);backdrop-filter:blur(3px)}
#portal-sms .smsx-dialog>form,#portal-sms .smsx-detail-dialog{padding:20px}
#portal-sms .smsx-dialog-head{display:flex;justify-content:space-between;align-items:flex-start;gap:14px;margin-bottom:16px}
#portal-sms .smsx-dialog-head h2{font-size:1.18rem}
#portal-sms .smsx-confirm-body dl{display:grid;grid-template-columns:1fr 1fr;gap:0;margin:0;border:1px solid var(--border);border-radius:9px;overflow:hidden}
#portal-sms .smsx-confirm-body dl>div{display:grid;gap:3px;padding:10px 12px;border-bottom:1px solid var(--border);background:var(--panel)}
#portal-sms .smsx-confirm-body dl>div:nth-last-child(-n+2){border-bottom:0}
#portal-sms .smsx-confirm-body dt{color:var(--muted);font-size:.64rem;font-weight:700;text-transform:uppercase}
#portal-sms .smsx-confirm-body dd{margin:0;font-size:.78rem;font-weight:700}
#portal-sms .smsx-message-review,#portal-sms .smsx-detail-message{margin-top:12px;padding:12px;border:1px solid var(--border);border-radius:8px;background:var(--panel-2);font-size:.78rem;line-height:1.5;white-space:pre-wrap}
#portal-sms .smsx-dialog-warning{display:grid;gap:3px;margin-top:13px;padding:11px;border:1px solid rgba(245,158,11,.4);border-radius:8px;background:rgba(245,158,11,.08)}
#portal-sms .smsx-dialog-warning strong{color:#fbc56d;font-size:.74rem}
#portal-sms .smsx-dialog-warning span,#portal-sms #smsxActionHelp{color:var(--muted);font-size:.69rem;line-height:1.5}
#portal-sms .smsx-danger-btn{background:var(--danger);color:#fff}
#portal-sms .smsx-danger-btn:hover{background:#d73737}
#portal-sms .smsx-detail-summary{display:grid;grid-template-columns:repeat(6,1fr);gap:8px}
#portal-sms .smsx-detail-summary>div{display:grid;gap:4px;padding:10px;border:1px solid var(--border);border-radius:8px;background:var(--panel)}
#portal-sms .smsx-detail-summary span:first-child{color:var(--muted);font-size:.62rem;font-weight:700;text-transform:uppercase}
#portal-sms .smsx-detail-summary strong{font-size:1rem}
#portal-sms .smsx-detail-message{display:grid;gap:3px}
#portal-sms .smsx-detail-message span{color:var(--muted);font-size:.67rem}
#portal-sms .smsx-detail-table-wrap{margin-top:12px;overflow:auto;border:1px solid var(--border);border-radius:9px}
#portal-sms .smsx-detail-table{width:100%;border-collapse:collapse;font-size:.72rem}
#portal-sms .smsx-detail-table th{padding:9px 10px;text-align:left;color:var(--muted);font-size:.62rem;text-transform:uppercase;background:var(--surface-deep);white-space:nowrap}
#portal-sms .smsx-detail-table td{padding:10px;border-top:1px solid var(--border);vertical-align:top}
#portal-sms .smsx-detail-table td>strong,#portal-sms .smsx-detail-table td>small{display:block}
#portal-sms .smsx-detail-table td>small{margin-top:2px;color:var(--muted);font-size:.62rem;max-width:240px;overflow-wrap:anywhere}

@media(max-width:1100px){
  #portal-sms .smsx-compose-grid{grid-template-columns:1fr}
  #portal-sms .smsx-preview-card{position:static}
  #portal-sms .smsx-history-item{grid-template-columns:minmax(0,1fr) auto}
  #portal-sms .smsx-history-actions{grid-column:1/-1;justify-content:flex-start;max-width:none}
  #portal-sms .smsx-detail-summary{grid-template-columns:repeat(3,1fr)}
}

@media(max-width:760px){
  #portal-sms .smsx-head{display:grid;gap:12px}
  #portal-sms .smsx-head .head-actions{display:flex;width:100%;justify-content:space-between}
  #portal-sms .smsx-role-notice{grid-template-columns:1fr}
  #portal-sms .smsx-tabs{margin-left:-3px;margin-right:-3px}
  #portal-sms .smsx-tabs button{min-height:44px}
  #portal-sms .smsx-two-fields,#portal-sms .smsx-manage-grid,#portal-sms .smsx-tools{grid-template-columns:1fr}
  #portal-sms .smsx-schedule{grid-template-columns:1fr}
  #portal-sms .smsx-schedule-readiness{justify-self:start;text-align:left}
  #portal-sms .smsx-schedule-time{grid-template-columns:1fr}
  #portal-sms .smsx-preview-metrics{grid-template-columns:repeat(3,1fr)}
  #portal-sms .smsx-history-item{grid-template-columns:1fr}
  #portal-sms .smsx-history-counts{justify-content:flex-start}
  #portal-sms .smsx-form-actions{display:grid;grid-template-columns:1fr;width:100%}
  #portal-sms .smsx-form-actions button{width:100%}
  #portal-sms .smsx-confirm-body dl{grid-template-columns:1fr}
  #portal-sms .smsx-confirm-body dl>div:nth-last-child(-n+2){border-bottom:1px solid var(--border)}
  #portal-sms .smsx-confirm-body dl>div:last-child{border-bottom:0}
  #portal-sms .smsx-detail-summary{grid-template-columns:repeat(2,1fr)}
  #portal-sms .smsx-detail-table thead{display:none}
  #portal-sms .smsx-detail-table,#portal-sms .smsx-detail-table tbody,#portal-sms .smsx-detail-table tr,#portal-sms .smsx-detail-table td{display:block;width:100%}
  #portal-sms .smsx-detail-table tr{padding:7px 0;border-top:1px solid var(--border)}
  #portal-sms .smsx-detail-table tr:first-child{border-top:0}
  #portal-sms .smsx-detail-table td{display:grid;grid-template-columns:110px minmax(0,1fr);gap:8px;padding:6px 10px;border:0}
  #portal-sms .smsx-detail-table td::before{content:attr(data-label);color:var(--muted);font-size:.61rem;font-weight:800;text-transform:uppercase}
}

@media(max-width:430px){
  #portal-sms .smsx-role-badge{white-space:normal;text-align:center}
  #portal-sms .smsx-preview-metrics{grid-template-columns:repeat(2,1fr)}
  #portal-sms .smsx-preview-row{grid-template-columns:10px minmax(0,1fr)}
  #portal-sms .smsx-preview-row>.status-pill{grid-column:2;justify-self:start}
  #portal-sms .smsx-manage-item{grid-template-columns:1fr}
  #portal-sms .smsx-detail-summary{grid-template-columns:1fr 1fr}
  #portal-sms .smsx-detail-table td{grid-template-columns:92px minmax(0,1fr)}
}

@media (prefers-color-scheme:light){
  #portal-sms .smsx-role-badge.admin,#portal-sms .smsx-status.success,#portal-sms .smsx-schedule-readiness.ready,#portal-sms .smsx-metric.success strong{color:#166534}
  #portal-sms .smsx-role-badge.dispatcher{color:#1d4ed8}
  #portal-sms .smsx-status.warning,#portal-sms .smsx-schedule-readiness.warning,#portal-sms .smsx-metric.warning strong,#portal-sms .smsx-dialog-warning strong{color:#92400e}
  #portal-sms .smsx-status.danger,#portal-sms .smsx-schedule-time small.danger,#portal-sms .smsx-metric.danger strong,#portal-sms .text-btn.danger{color:#991b1b}
  #portal-sms .smsx-safety-note strong{color:#9a3412}
  #portal-sms .smsx-danger-btn{color:#fff}
  #portal-sms .smsx-dialog{box-shadow:0 20px 60px rgba(15,23,42,.18)}
}
