.staff-communications .communications-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 13px; }
.staff-communications .communications-tabs [aria-pressed="true"] {
  border-color: var(--accent);
  background: var(--pale);
  color: var(--accent);
}
.staff-communications .communications-panel { border-top: 3px solid var(--accent); }
.staff-communications .communications-status:empty { display: none; }
.staff-communications .communications-status { margin: 8px 0; }
.staff-communications .communications-provider-panel {
  margin-top: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow-wrap: anywhere;
}
.staff-communications .communications-provider-panel > summary { font-weight: 700; cursor: pointer; }
.staff-communications .communications-provider-panel > p { margin: 8px 0; }
.staff-communications .communications-provider-panel > .btn + .btn { margin-inline-start: 8px; }
.staff-communications .communications-provider-list { padding: 0; list-style: none; }
.staff-communications .communications-provider-list > li { display: grid; gap: 3px; margin-bottom: 8px; }
.staff-communications .communications-provider-list > li > span { color: var(--muted); }
.staff-communications .communications-provider-form { margin-top: 8px; }
.staff-communications .communications-filters {
  grid-template-columns: repeat(3, minmax(0, 1fr)) auto;
  align-items: end;
  margin: 12px 0;
}
.staff-communications .communications-filters > label { min-width: 0; }
.staff-communications .table-wrap .subtitle { display: block; margin-top: 3px; }
.staff-communications .table-wrap th, .staff-communications .table-wrap td,
.staff-communications .table-wrap .btn { overflow-wrap: anywhere; }
.staff-communications .table-wrap .btn.text { min-height: 26px; padding: 2px 0; text-align: left; white-space: normal; }
.staff-communications .communications-detail-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 10px 0; }
.staff-communications .communications-detail-bar > label { font-weight: 650; }
.staff-communications .communications-detail-bar > select { width: auto; max-width: 100%; }
.staff-communications .communications-version-grid,
.staff-communications .communications-editor-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  gap: 15px;
  align-items: start;
  margin-top: 12px;
}
.staff-communications .communications-version-grid > div {
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 5px;
}
.staff-communications .communications-version-grid h3, .staff-communications .communications-message h3 { margin: 0 0 6px; }
.staff-communications .communications-version-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.staff-communications .communications-message {
  min-width: 0;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: 5px;
  background: var(--pale);
}
.staff-communications fieldset {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
  min-width: 0;
  padding: 0;
  margin: 0;
  border: 0;
}
.staff-communications fieldset button { justify-self: start; }
.staff-communications .communications-review {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr) auto;
  align-items: end;
  gap: 8px;
  margin-top: 11px;
}
.staff-communications .communications-planner {
  margin: 12px 0;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #f4f8fb;
}
.staff-communications .communications-planner summary { width: fit-content; color: var(--accent); font-weight: 700; cursor: pointer; }
.staff-communications .communications-planner form { margin-top: 10px; }
.staff-communications .communications-planner fieldset { grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: end; }
.communication-automations .automation-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:12px; align-items:end; }
.communication-automations form { margin-block:12px; }
.staff-communications .communication-automations .communications-planner fieldset { display:block; }
.communication-automations label { min-width:0; }
.communication-automations input,.communication-automations select { max-width:100%; }
.communication-automations label:has(input[type=checkbox]) { display:flex; align-items:center; gap:7px; }
.communication-automations input[type=checkbox] { width:auto; flex:0 0 auto; }
.communication-automations details { margin-block:12px; }
.communication-automations summary { cursor:pointer; font-weight:650; }
.staff-communications .communication-automations .communications-planner .automation-checks { display:flex; flex-wrap:wrap; gap:10px 18px; margin-top:12px; }
.communication-automations .automation-checks legend { margin-bottom:7px; }
.communication-automations .automation-recipients { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:9px; margin-top:12px; }
.communication-automations .automation-row { padding-block:15px; border-bottom:1px solid var(--line); overflow-wrap:anywhere; }
.communication-automations .automation-row h3,.communication-automations .automation-row h4 { margin:0 0 7px; }
.communication-automations .automation-row button { margin:5px 8px 0 0; }
.communication-automations .automation-definition { display:grid; grid-template-columns:minmax(120px,.7fr) minmax(0,2fr); gap:6px 14px; }
.communication-automations .automation-definition dt { font-weight:650; }
.communication-automations .automation-definition dd { margin:0; overflow-wrap:anywhere; }
@media(max-width:780px){.communication-automations .automation-grid{grid-template-columns:repeat(2,minmax(0,1fr));}}
@media(max-width:550px){.communication-automations .automation-grid,.communication-automations .automation-recipients{grid-template-columns:minmax(0,1fr);}}
@media(max-width:550px){.communication-automations .automation-definition{grid-template-columns:minmax(0,1fr);gap:4px}.communication-automations .automation-definition dd{margin-bottom:8px}}
@media (max-width: 780px) {
  .staff-communications .communications-filters, .staff-communications .communications-planner fieldset { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 550px) {
  .staff-communications .communications-version-grid, .staff-communications .communications-editor-grid,
  .staff-communications .communications-review, .staff-communications .communications-filters,
  .staff-communications .communications-planner fieldset { grid-template-columns: 1fr; }
}

/* Scoped communications library, focused editor and chronological scheduled list. */
#communications.communications-modern { font-family: var(--ui-font); }
#communications.communications-modern .communications-panel { min-width: 0; padding: var(--ui-space-5); border-top: 1px solid var(--line); box-shadow: none; }
#communications.communications-modern .communications-library-layout { display: grid; grid-template-columns: minmax(280px,.7fr) minmax(0,1.3fr); align-items: start; gap: var(--ui-space-4); }
#communications.communications-modern .communications-library { grid-column: 1; grid-row: 1; }
#communications.communications-modern :is(#communications-detail,#communications-editor,.communications-selection-hint) { grid-column: 2; grid-row: 1; }
#communications.communications-modern .communications-selection-hint { padding: var(--ui-space-6); color: var(--muted); }
#communications.communications-modern .communications-selection-hint .ui-icon { color: var(--accent); margin-bottom: var(--ui-space-3); }
#communications.communications-modern .communications-selection-hint h2 { color: var(--ink); margin: 0 0 var(--ui-space-2); }
#communications.communications-modern .communications-library-layout:has(#communications-detail:not([hidden]),#communications-editor:not([hidden])) .communications-selection-hint { display: none; }
#communications.communications-modern .communications-library-layout:has(#communications-editor:not([hidden])) { grid-template-columns: minmax(0,1fr); }
#communications.communications-modern .communications-library-layout:has(#communications-editor:not([hidden])) :is(.communications-library,#communications-detail) { display: none; }
#communications.communications-modern .communications-library-layout:has(#communications-editor:not([hidden])) #communications-editor { grid-column: 1; }
#communications.communications-modern .card-head { gap: var(--ui-space-3); align-items: center; flex-wrap: wrap; margin-bottom: var(--ui-space-4); }
#communications.communications-modern .card-head h2 { margin: 0; }
#communications.communications-modern .communications-filters { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: var(--ui-space-3); }
#communications.communications-modern #communications-template-filters > label { grid-column: 1 / -1; }
#communications.communications-modern .communications-filter-options > label { display: grid; gap: var(--ui-space-2); margin-block: var(--ui-space-3); }
#communications.communications-modern summary { min-height: 44px; padding-block: var(--ui-space-3); cursor: pointer; color: var(--ink); font-size: .875rem; font-weight: 650; }
#communications.communications-modern summary:hover { color: var(--accent); }
#communications.communications-modern .communications-template-list { padding: 0; margin: var(--ui-space-4) 0; list-style: none; }
#communications.communications-modern .communications-template-list > li + li { border-top: 1px solid var(--line); }
#communications.communications-modern .communications-template-select { display: flex; width: 100%; align-items: start; justify-content: space-between; gap: var(--ui-space-3); padding: var(--ui-space-4) var(--ui-space-2); border: 1px solid transparent; border-radius: var(--ui-control-radius); background: transparent; color: var(--ink); text-align: left; font: inherit; cursor: pointer; }
#communications.communications-modern .communications-template-select:hover { background: var(--bg); }
#communications.communications-modern .communications-template-select[aria-pressed="true"] { border-color: var(--accent); background: var(--pale); }
#communications.communications-modern .communications-template-copy { display: grid; gap: var(--ui-space-2); min-width: 0; overflow-wrap: anywhere; }
#communications.communications-modern .communications-template-copy strong { font-size: .9rem; }
#communications.communications-modern .communications-template-copy > span { color: var(--muted); font-size: .78rem; }
#communications.communications-modern .communications-state { flex: none; display: inline-block; padding: var(--ui-space-1) var(--ui-space-2); border-radius: var(--ui-control-radius); background: var(--pale); color: var(--ink); font-size: .75rem; font-weight: 650; line-height: 1.5; }
#communications.communications-modern .communications-state[data-state="approved"] { background: #e4f4ec; color: #23593d; }
#communications.communications-modern .communications-state[data-state="rejected"] { background: #fbecef; color: #8a2f40; }
#communications.communications-modern .communications-version-grid { grid-template-columns: minmax(0,1fr); gap: var(--ui-space-3); }
#communications.communications-modern .communications-version-grid > div { padding: 0; border: 0; }
#communications.communications-modern #communications-version-body { padding: var(--ui-space-4); background: var(--bg); border-radius: var(--ui-control-radius); line-height: 1.7; font-size: .9rem; }
#communications.communications-modern .communications-version-history { border-top: 1px solid var(--line); }
#communications.communications-modern .communications-review { grid-template-columns: minmax(0,1fr); border-top: 1px solid var(--line); padding-top: var(--ui-space-4); margin-top: var(--ui-space-4); }
#communications.communications-modern .communications-editor-grid { gap: var(--ui-space-5); grid-template-columns: minmax(0,1.15fr) minmax(0,.85fr); }
#communications.communications-modern .communications-editor-primary { display: grid; gap: var(--ui-space-4); }
#communications.communications-modern .communications-editor-primary textarea { min-height: 220px; }
#communications.communications-modern .communications-editor-settings { border-block: 1px solid var(--line); margin-block: var(--ui-space-2); }
#communications.communications-modern .communications-editor-metadata { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: var(--ui-space-3); padding-bottom: var(--ui-space-4); }
#communications.communications-modern .communications-message { position: sticky; top: var(--ui-space-4); padding: var(--ui-space-5); border: 1px solid var(--line); border-radius: 12px; background: var(--bg); overflow-wrap: anywhere; }
#communications.communications-modern .communications-message > .communications-version-text { min-height: 64px; line-height: 1.7; font-size: .95rem; }
#communications.communications-modern .communications-preview-options { margin-block: var(--ui-space-3); border-block: 1px solid var(--line); }
#communications.communications-modern .communications-preview-options form { display: grid; min-width: 0; gap: var(--ui-space-3); padding-bottom: var(--ui-space-4); }
#communications.communications-modern .communications-preview-options label { min-width: 0; }
#communications.communications-modern :is(input,select,textarea) { min-width: 0; max-width: 100%; }
#communications.communications-modern .btn { max-width: 100%; white-space: normal; }
#communications.communications-modern .communications-draft-state { color: var(--muted); font-size: .8rem; margin: var(--ui-space-2) 0 0; }
#communications.communications-modern .communications-calendar-list,
#communications.communications-modern .communications-day-group > ol { list-style: none; margin: 0; padding: 0; }
#communications.communications-modern .communications-day-group { margin-top: var(--ui-space-5); }
#communications.communications-modern .communications-day-group > h3 { margin: 0 0 var(--ui-space-2); color: var(--muted); font-size: .85rem; }
#communications.communications-modern .communications-calendar-entry { display: grid; grid-template-columns: 90px minmax(0,1fr) auto; gap: var(--ui-space-3); align-items: start; padding-block: var(--ui-space-4); border-top: 1px solid var(--line); }
#communications.communications-modern .communications-calendar-entry > time { font-variant-numeric: tabular-nums; font-weight: 650; }
#communications.communications-modern .communications-calendar-entry p { margin-top: var(--ui-space-1); overflow-wrap: anywhere; }
#communications.communications-modern .communications-calendar-entry > .btn { grid-column: 2 / -1; justify-self: start; }
#communications.communications-modern .communications-planner { padding: var(--ui-space-3) var(--ui-space-4); background: var(--bg); border-radius: var(--ui-control-radius); }
#communications.communications-modern #communications-calendar-filters { grid-template-columns: repeat(3,minmax(0,1fr)) auto; }
#communications.communications-modern .communications-empty { padding: var(--ui-space-5) 0; color: var(--muted); }
#communications.communications-modern :is(button,input,select,textarea,summary):focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
@media(max-width:980px) {
  #communications.communications-modern .communications-library-layout { grid-template-columns: minmax(0,1fr); }
  #communications.communications-modern :is(#communications-detail,#communications-editor,.communications-selection-hint) { grid-column: 1; }
  #communications.communications-modern .communications-selection-hint { display: none; }
  #communications.communications-modern .communications-library-layout:has(#communications-detail:not([hidden])) .communications-library { display: none; }
}
@media(max-width:760px) {
  #communications.communications-modern .communications-panel { padding: var(--ui-space-4); }
  #communications.communications-modern .communications-editor-grid { grid-template-columns: minmax(0,1fr); }
  #communications.communications-modern .communications-message { position: static; }
  #communications.communications-modern .communications-editor-metadata { grid-template-columns: minmax(0,1fr); }
  #communications.communications-modern #communications-calendar-filters { grid-template-columns: minmax(0,1fr); }
  #communications.communications-modern .communications-calendar-entry { grid-template-columns: 70px minmax(0,1fr); }
  #communications.communications-modern .communications-calendar-entry > .communications-state { grid-column: 2; justify-self: start; }
}
