/* TS WhatsApp 15.87: layout and accordions. Scoped, responsive, theme-aware. */
.ts87-accordion {border:1px solid var(--line,var(--border,#324760));border-radius:15px;background:var(--panel,var(--card,#192b43));margin:0 0 15px;min-width:0;overflow:clip;color:var(--text,inherit)}
.ts87-accordion>summary{list-style:none;display:flex;justify-content:space-between;align-items:center;gap:16px;padding:17px 20px;min-height:62px;cursor:pointer;user-select:none;outline-offset:-3px;font-weight:750}
.ts87-accordion>summary::-webkit-details-marker{display:none}
.ts87-accordion>summary .ts87-caption{display:flex;flex-direction:column;min-width:0;gap:4px}
.ts87-accordion>summary .ts87-caption small{font-size:12px;line-height:1.4;font-weight:450;color:var(--muted,#a0b4c9)}
.ts87-accordion>summary .ts87-chevron{width:34px;height:34px;display:grid;place-items:center;border:1px solid var(--line,var(--border,#3c5572));border-radius:9px;flex:none;transition:transform .22s cubic-bezier(.2,.8,.2,1),background .18s}
.ts87-accordion[open]>summary .ts87-chevron{transform:rotate(180deg)}
.ts87-accordion>summary:hover{background:rgba(96,150,210,.055)}
.ts87-accordion>summary:focus-visible{outline:2px solid #6bb6ff}
.ts87-accordion .ts87-panel-body{padding:0 16px 16px;min-width:0}
.ts87-accordion .ts87-panel-body>.card,.ts87-accordion .ts87-panel-body>section.card{margin:0!important}
.ts87-accordion .ts87-panel-body>*{min-width:0}
/* Modern browsers animate <details> without altering built-in semantics. */
@supports (interpolate-size:allow-keywords){
  :root{interpolate-size:allow-keywords}
  .ts87-accordion::details-content{height:0;opacity:0;overflow:clip;transition:height .28s cubic-bezier(.22,.82,.3,1),opacity .24s ease,content-visibility .28s allow-discrete}
  .ts87-accordion[open]::details-content{height:auto;opacity:1}
  @starting-style{.ts87-accordion[open]::details-content{height:0;opacity:0}}
}
/* Existing accordions: smoother affordance across CRM, no JS interception. */
.content details:not(.ts-number-menu):not(.ts-number-submenu)>summary{transition:background-color .2s ease,color .2s ease,border-color .2s ease;cursor:pointer}
.content details:not(.ts-number-menu):not(.ts-number-submenu)>summary:focus-visible{outline:2px solid #69adf8;outline-offset:2px}
@media (prefers-reduced-motion:reduce){.ts87-accordion *,.ts87-accordion::details-content,.content details>summary{transition:none!important;animation:none!important}}
/* Templates: correct dual column at wide sizes; usable preview and toolbar */
.page-templates .template-layout,.page-templates .ts15-template-index{display:grid!important;grid-template-columns:minmax(0,1.48fr) minmax(290px,.92fr)!important;gap:16px!important;width:100%!important;max-width:none!important;align-items:start!important}
.page-templates .template-layout>*{min-width:0!important;width:100%!important;max-width:none!important}
.page-templates .template-layout .template-phone{position:sticky;top:90px;min-height:320px;max-height:min(72vh,720px);overflow:auto}
.page-templates .toolbar-primary{display:flex;gap:14px;justify-content:space-between;align-items:end;flex-wrap:wrap}
.page-templates .toolbar-primary form,.page-templates .toolbar-primary select{max-width:100%}
.page-templates .ts15-list-toolbar,.page-campaigns .ts15-list-toolbar{display:flex!important;gap:10px!important;flex-wrap:wrap!important;align-items:end!important}
.page-templates .ts15-list-search,.page-campaigns .ts15-list-search{position:relative!important;display:flex!important;align-items:center!important;min-width:220px!important;flex:1 1 265px!important;max-width:480px!important}
.page-templates .ts15-list-search input,.page-campaigns .ts15-list-search input{width:100%!important;min-height:42px!important;padding:10px 14px 10px 40px!important;box-sizing:border-box!important;text-indent:0!important}
.page-templates .ts15-list-search>span,.page-campaigns .ts15-list-search>span{position:absolute!important;left:13px!important;top:50%!important;transform:translateY(-50%)!important;pointer-events:none!important;line-height:1!important;color:var(--muted,#9db4c9)!important;z-index:1!important;font-size:18px!important}
.page-templates .ts15-list-status,.page-campaigns .ts15-list-status{flex:0 1 200px;min-width:165px}
/* Broadcast: remove narrow central column, keep table scroll on small screens. */
.page-campaigns .bc-page,.page-campaigns .ts15-broadcast-index,.page-campaigns .ts15-broadcast-create{width:100%!important;max-width:none!important;min-width:0!important;margin-left:0!important;margin-right:0!important}
.page-campaigns .ts15-broadcast-index .card{width:100%!important;max-width:none!important;box-sizing:border-box}
.page-campaigns .table-wrap{width:100%;max-width:100%;overflow-x:auto;-webkit-overflow-scrolling:touch}
.page-campaigns .table-wrap table{min-width:940px;width:100%}
.page-campaigns .table-wrap th,.page-campaigns .table-wrap td{vertical-align:middle;padding:12px 13px}
.page-campaigns .ts87-accordion .ts87-panel-body{padding:0 16px 16px}
/* Auto Handoff: reduce excessive space and keep actions readable. */
.page-broadcast_handoff .tsbh-wrap{max-width:none!important;margin:0!important;gap:12px!important}
.page-broadcast_handoff .tsbh-card{padding:16px!important}
.page-broadcast_handoff .tsbh-stats{gap:10px!important}
.page-broadcast_handoff .tsbh-top{gap:10px!important}
.page-broadcast_handoff .tsbh-top h1{font-size:23px!important}
.page-broadcast_handoff .tsbh-quick{margin:0!important}
.page-broadcast_handoff .tsbh-primary{width:auto!important;min-width:210px!important;max-width:100%!important;min-height:42px!important;margin-top:8px!important}
.page-broadcast_handoff .tsbh-one-click{margin-top:9px!important}
.page-broadcast_handoff .tsbh-table-scroll{overflow-x:auto;-webkit-overflow-scrolling:touch}
.page-broadcast_handoff .ts19-handoff-bulk{display:flex;align-items:center;gap:10px;flex-wrap:wrap;max-width:100%}
/* Follow Up: smaller stacked panels and usable template inventory. */
.page-followups .f83 .f83-grid{grid-template-columns:repeat(2,minmax(0,1fr));align-items:start;gap:14px}
.page-followups .f83 .f83-grid>.ts87-accordion{margin:0}
.page-followups .f83 .f83-card{min-width:0}
.page-followups .f83 .f83-templates{display:grid!important;grid-template-columns:repeat(2,minmax(0,1fr))!important;max-height:260px;overflow-y:auto;gap:8px!important}
.page-followups .f83 .f83-templates .ts87-template-link{display:flex;align-items:center;justify-content:space-between;gap:10px;min-width:0;white-space:normal;text-align:left;padding:11px!important;border-radius:10px!important;text-decoration:none!important}
.page-followups .f83 .f83-templates .ts87-template-link small{display:block;opacity:.75;margin-top:4px;overflow-wrap:anywhere;font-size:11px}
.page-followups .f83 .ts87-template-tools{display:flex;align-items:center;gap:8px;flex-wrap:wrap;padding:12px 0;border-top:1px solid var(--f83-border,#405471);margin-top:13px}
.page-followups .f83 .ts87-template-tools form{margin:0}
.page-followups .f83 #f83body{height:170px!important;min-height:135px!important;max-height:none!important;resize:vertical!important;line-height:1.6}
.page-followups .f83 .f83-formgrid{gap:12px}
.page-followups .f83 .ts87-section-note{font-size:12px;color:var(--f83-muted,#9fb3ca)}
.page-followups .f83 .ts87-accordion .ts87-panel-body>.f83-card{margin:0!important;border:0!important;border-radius:0!important;padding:5px 3px 8px!important;background:transparent!important}
/* Device onboarding: connect choices as accessible collapsible cards; no fake QR. */
.page-devices .onboarding-mode-grid{display:grid!important;grid-template-columns:repeat(2,minmax(0,1fr))!important;align-items:start;gap:14px}
.page-devices .onboarding-mode-grid>.ts87-accordion{margin:0;overflow:visible}
.page-devices .onboarding-mode-grid .onboarding-mode-card{margin:0!important;height:auto!important;min-height:0!important;border:0!important;box-shadow:none!important;padding:14px!important}
.page-devices .onboarding-mode-grid .connect-choice-actions{margin-top:14px;gap:10px}
.page-devices .onboarding-mode-grid .connect-choice-actions>*{min-height:42px}
.page-devices .onboarding-mode-grid .ts-coex-qr-caption{margin:10px 0 0;max-width:80ch;font-size:12px;line-height:1.65}
.page-devices .ts87-connect-status{display:block;color:var(--muted,#a7b8d0);font-size:12px;line-height:1.6;margin-top:12px}
@media(max-width:1100px){.page-followups .f83 .f83-grid,.page-devices .onboarding-mode-grid{grid-template-columns:1fr!important}.page-templates .template-layout{grid-template-columns:1fr!important}.page-templates .template-layout .template-phone{position:static;max-height:none}}
@media(max-width:720px){.ts87-accordion>summary{padding:13px 14px;min-height:56px}.ts87-accordion .ts87-panel-body{padding:0 10px 12px}.page-followups .f83 .f83-templates{grid-template-columns:1fr!important}.page-campaigns .table-wrap table{min-width:840px}.page-broadcast_handoff .tsbh-stats{grid-template-columns:repeat(2,minmax(0,1fr))}.page-templates .ts15-list-search,.page-campaigns .ts15-list-search{max-width:none!important;flex-basis:100%!important}.page-templates .ts15-list-status,.page-campaigns .ts15-list-status{flex-basis:100%}}
@media(max-width:440px){.page-broadcast_handoff .tsbh-card{padding:12px!important}.page-devices .onboarding-mode-grid .onboarding-mode-card{padding:10px!important}}

/* Visibly distinguish create/duplicate/delete management without destructive styling elsewhere. */
.page-followups .ts87-template-tools .danger{border-color:#aa5765!important;color:#f4a4ad!important}
.page-devices .ts87-mode .ts87-panel-body{padding:0 10px 12px}
@supports (interpolate-size:allow-keywords){
  .content details.device-admin-panel::details-content,
  .content details.advanced-device-card::details-content,
  .content details.device-help-note::details-content,
  .content details.f83-bottom::details-content,
  .content details.bc-options::details-content,
  .content details.source-fold::details-content {height:0;opacity:0;overflow:clip;transition:height .28s ease,opacity .2s ease,content-visibility .28s allow-discrete}
  .content details.device-admin-panel[open]::details-content,
  .content details.advanced-device-card[open]::details-content,
  .content details.device-help-note[open]::details-content,
  .content details.f83-bottom[open]::details-content,
  .content details.bc-options[open]::details-content,
  .content details.source-fold[open]::details-content {height:auto;opacity:1}
}
/* Screenshot-specific spacing cleanup */
.page-templates .studio-module-intro .studio-module-eyebrow{display:block;margin:0 0 7px!important;letter-spacing:.07em}
.page-templates .studio-module-intro strong{display:block;line-height:1.5}
.page-templates .studio-module-intro p{margin:8px 0 0}
.page-templates .ts15-template-index .meta-strip{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px}
.page-templates .ts15-template-index .meta-strip>span{min-width:0;overflow-wrap:anywhere}
.page-broadcast_handoff .tsbh-wrap>*{margin-block:0!important}
.page-broadcast_handoff .tsbh-quick .tsbh-alert{margin-bottom:0}
.page-devices .onboarding-mode-grid .onboarding-mode-head{margin-bottom:8px}
.page-devices .onboarding-mode-grid .connect-choice-actions{display:flex!important;flex-wrap:wrap;align-items:center}
.page-devices .onboarding-mode-grid .connect-choice-actions>*{flex:1 1 180px}
.page-devices .onboarding-mode-grid .ts87-connect-mark{display:inline-grid;place-items:center;width:20px;height:20px;font-size:19px}
@media(max-width:540px){.page-templates .ts15-template-index .meta-strip{grid-template-columns:1fr}.page-broadcast_handoff .tsbh-top{align-items:flex-start}.page-campaigns .ts87-accordion .ts87-panel-body{padding-inline:9px}}
