/* Operations Broadcast Center (مركز التعاميم). Every rule is scoped to the feature: .bc-* elements, the printable
   #broadcast-report, and the «مركز التعاميم» entry injected into the manager navigation. Same tokens as the dashboard
   (ref-dashboard.css): green = confirmed, amber = opened and waiting, neutral = not opened, red only for late. The device notification
   never uses green: blue when the push service accepted it, amber when it failed. */

/* ---------- navigation entry ---------- */
.ref-sidebar nav [data-side="broadcasts"] .bc-nav-short{display:none}
/* the header entry exists only for the 821-900 px gap, where the sidebar is hidden and the phone bar not shown yet */
.ref-actions .bc-top-btn{display:none!important}
@media(min-width:821px) and (max-width:900px){.ref-actions .bc-top-btn{display:inline-grid!important;place-items:center}}
@media(max-width:820px){
  /* The mobile bar is a fixed 4-column grid; with the extra entry (the module marks the nav) it becomes one even row. */
  .ref-sidebar nav.bc-nav-extra{grid-template-columns:none;grid-auto-flow:column;grid-auto-columns:minmax(0,1fr)}
  .ref-sidebar nav [data-side="broadcasts"] .bc-nav-long{display:none}
  .ref-sidebar nav [data-side="broadcasts"] .bc-nav-short{display:block}
}

/* ---------- shared pieces ---------- */
.bc-back,.bc-sheet,.bc-inbox,.bc-notice,.bc-toast,.bc-chip-btn{--bc-navy:#102342;--bc-blue:#1f61d5;--bc-text:#182033;--bc-muted:#6b778a;--bc-line:#e6ebf2;--bc-bg:#f7f9fc;--bc-card:#fff;
  --bc-ok:#16734a;--bc-ok-bg:#e8f6ee;--bc-warn:#9a5b06;--bc-warn-bg:#fff4e0;--bc-bad:#c0372f;--bc-bad-bg:#fdeeec;--bc-mute:#5f6b7c;--bc-mute-bg:#f1f3f6;--bc-info:#1f4f9e;--bc-info-bg:#eaf1fd}
.bc-pill{display:inline-flex;align-items:center;gap:4px;padding:4px 10px;border-radius:999px;font-size:11.5px;font-weight:800;white-space:nowrap;line-height:1.35}
.bc-pill.bc-ok{background:var(--bc-ok-bg);color:var(--bc-ok)}
.bc-pill.bc-warn{background:var(--bc-warn-bg);color:var(--bc-warn)}
.bc-pill.bc-bad{background:var(--bc-bad-bg);color:var(--bc-bad)}
.bc-pill.bc-muted{background:var(--bc-mute-bg);color:var(--bc-mute)}
/* the device notification when the push service accepted it: informative blue, never the green of «تم التأكيد» */
.bc-pill.bc-info{background:var(--bc-info-bg);color:var(--bc-info)}
.bc-primary,.bc-secondary,.bc-link,.bc-close,.bc-chip{font:inherit;cursor:pointer;border-radius:12px;min-height:44px}
.bc-primary{border:0;background:var(--bc-blue);color:#fff;font-weight:800;padding:10px 18px}
.bc-primary:disabled,.bc-secondary:disabled{opacity:.55;cursor:default}
.bc-secondary{border:1px solid var(--bc-line);background:#fff;color:var(--bc-text);font-weight:700;padding:9px 14px}
.bc-wide{width:100%}
.bc-row{display:flex;gap:10px;flex-wrap:wrap}
.bc-empty{margin:0;padding:22px 12px;text-align:center;color:var(--bc-muted);font-size:13px}
.bc-err{color:var(--bc-bad)}
.bc-note{margin:12px 0 0;color:var(--bc-muted);font-size:11.5px;line-height:1.7}
.bc-message{white-space:pre-wrap;overflow-wrap:anywhere;line-height:1.85;font-size:14px;color:var(--bc-text);background:var(--bc-bg);border:1px solid var(--bc-line);border-radius:14px;padding:12px 14px;margin:10px 0}
.bc-time{font-weight:700;unicode-bidi:isolate}
.bc-back bdi,.bc-sheet bdi,.bc-inbox bdi{unicode-bidi:isolate}

/* ---------- the center (full-screen, over the dashboard, under sheets and the printable report) ---------- */
body.bc-open{overflow:hidden}
.bc-back{position:fixed;inset:0;z-index:75;background:var(--bc-bg);overflow-y:auto;overflow-x:hidden;direction:rtl;color:var(--bc-text);-webkit-overflow-scrolling:touch}
.bc-center{box-sizing:border-box;width:min(1180px,100%);margin:0 auto;padding:18px 22px calc(28px + env(safe-area-inset-bottom))}
.bc-head{position:sticky;top:0;z-index:2;display:flex;justify-content:space-between;align-items:center;gap:14px;padding:14px 0;margin-bottom:6px;background:rgba(247,249,252,.94);backdrop-filter:blur(14px)}
.bc-head small{color:#b28a4a;font-weight:800;font-size:11px;letter-spacing:.2px}
.bc-head h1{margin:2px 0;font-size:26px;color:var(--bc-navy);letter-spacing:-.3px}
.bc-head p{margin:0;color:var(--bc-muted);font-size:12.5px}
.bc-head-actions{display:flex;gap:10px;align-items:center;flex:none}
.bc-close{width:44px;height:44px;padding:0;border:1px solid var(--bc-line);background:#fff;font-size:22px;line-height:1;color:var(--bc-text)}
.bc-kpis{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:12px;margin:8px 0 14px}
.bc-kpis-5{grid-template-columns:repeat(5,minmax(0,1fr))}
.bc-kpi{background:var(--bc-card);border:1px solid var(--bc-line);border-radius:18px;padding:14px 16px;min-width:0;box-shadow:0 1px 2px rgba(16,35,66,.04)}
.bc-kpi span{display:block;color:var(--bc-muted);font-size:12px;font-weight:700}
.bc-kpi strong{display:block;font-size:28px;margin:4px 0 2px;color:var(--bc-navy);unicode-bidi:isolate}
.bc-kpi small{display:block;color:var(--bc-muted);font-size:11px}
.bc-kpi-ok strong{color:var(--bc-ok)}.bc-kpi-warn strong{color:var(--bc-warn)}.bc-kpi-bad strong{color:var(--bc-bad)}.bc-kpi-muted strong{color:var(--bc-mute)}
.bc-filters{display:grid;grid-template-columns:minmax(0,2fr) repeat(4,minmax(0,1fr)) auto;gap:10px;align-items:end;background:var(--bc-card);border:1px solid var(--bc-line);border-radius:18px;padding:12px;margin-bottom:14px}
.bc-filters label,.bc-branch-search{display:grid;gap:5px;min-width:0}
.bc-filters label>span,.bc-branch-search>span{font-size:11.5px;color:var(--bc-muted);font-weight:700}
.bc-filters input,.bc-filters select,.bc-branch-search input{box-sizing:border-box;width:100%;min-height:42px;border:1px solid var(--bc-line);border-radius:11px;padding:8px 10px;font:inherit;font-size:14px;background:#fff;color:var(--bc-text)}
.bc-list{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}
.bc-list>.bc-empty{grid-column:1/-1}
.bc-card{background:var(--bc-card);border:1px solid var(--bc-line);border-radius:18px;padding:16px;display:grid;gap:10px;min-width:0}
.bc-card header{display:flex;justify-content:space-between;align-items:flex-start;gap:10px}
.bc-card h3{margin:0;font-size:16px;color:var(--bc-navy);overflow-wrap:anywhere}
.bc-preview{margin:0;color:#3b4658;font-size:13px;line-height:1.7;overflow-wrap:anywhere}
.bc-meta{display:flex;flex-wrap:wrap;gap:6px 14px;color:var(--bc-muted);font-size:12px}
.bc-meta-late{color:var(--bc-bad);font-weight:700}
.bc-stats{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:8px}
.bc-stats>div{background:var(--bc-bg);border-radius:12px;padding:8px 6px;text-align:center;min-width:0}
.bc-stats b{display:block;font-size:18px;color:var(--bc-navy);unicode-bidi:isolate}
.bc-stats span{display:block;font-size:11px;color:var(--bc-muted)}
.bc-stats .bc-stat-warn b{color:var(--bc-warn)}
.bc-progress{height:6px;border-radius:999px;background:#edf0f5;overflow:hidden}
.bc-progress i{display:block;height:100%;background:var(--bc-ok);border-radius:inherit}
.bc-link{justify-self:start;border:0;background:#eef4ff;color:var(--bc-blue);font-weight:800;padding:9px 16px}
.bc-more{display:flex;justify-content:center;margin:16px 0}
/* detail */
.bc-toolbar{display:flex;justify-content:space-between;gap:10px;margin:4px 0 12px}
.bc-detail-head{background:var(--bc-card);border:1px solid var(--bc-line);border-radius:18px;padding:16px 18px;margin-bottom:12px}
.bc-dtitle{display:flex;justify-content:space-between;align-items:flex-start;gap:12px}
.bc-dtitle h2{margin:0 0 6px;font-size:21px;color:var(--bc-navy);overflow-wrap:anywhere}
.bc-push-line{margin:-4px 0 4px;color:var(--bc-muted);font-size:12px}
.bc-push-note{margin:0 0 12px}
.bc-report{background:var(--bc-card);border:1px solid var(--bc-line);border-radius:18px;padding:14px}
.bc-chips{display:flex;gap:8px;flex-wrap:wrap;margin-bottom:10px}
.bc-chip{border:1px solid var(--bc-line);background:#fff;color:var(--bc-text);font-weight:700;font-size:12.5px;padding:8px 12px}
.bc-chip em{font-style:normal;color:var(--bc-muted);margin-inline-start:4px;unicode-bidi:isolate}
.bc-chip.active{background:var(--bc-navy);border-color:var(--bc-navy);color:#fff}
.bc-chip.active em{color:#c9d6ea}
.bc-branch-search{max-width:320px;margin-bottom:10px}
.bc-table-wrap{overflow-x:auto}
.bc-dtable{width:100%;border-collapse:collapse;font-size:13px}
.bc-dtable th{text-align:right;background:#f5f7fa;color:#5b6678;font-size:12px;font-weight:800;padding:10px;border-bottom:1px solid var(--bc-line);white-space:nowrap}
.bc-dtable td{padding:10px;border-bottom:1px solid #eef1f5;vertical-align:middle}
.bc-dtable td strong{display:block;color:var(--bc-navy)}
.bc-occ{display:block;color:var(--bc-muted);font-size:11px;margin-top:2px}
.bc-empty-row td{text-align:center;color:var(--bc-muted);padding:18px}

/* ---------- sheets (create / confirm / read) ---------- */
.bc-sheet .ref-sheet-body{direction:rtl}
/* the shared sheet's close button is 34 px; in a broadcast sheet (a phone flow) it is a full 44 px target, as on the
   branch detail sheet */
.bc-sheet header #sheet-close{width:44px;height:44px;border-radius:12px;flex:0 0 auto;touch-action:manipulation}
.bc-form{display:grid;gap:14px}
.bc-field{display:grid;gap:6px;border:0;margin:0;padding:0;min-width:0}
.bc-field>span,.bc-field legend{display:flex;justify-content:space-between;gap:8px;font-weight:800;font-size:13px;color:var(--bc-text);padding:0}
.bc-field em{font-style:normal;color:var(--bc-muted);font-weight:600;font-size:11.5px;unicode-bidi:isolate}
.bc-field textarea{resize:vertical;min-height:120px;line-height:1.7}
.bc-audience{display:flex;flex-wrap:wrap;gap:8px}
.bc-audience legend{width:100%;margin-bottom:6px}
.bc-radio{display:flex;align-items:center;gap:8px;min-height:44px;padding:0 14px;border:1px solid var(--bc-line);border-radius:12px;background:#fff;cursor:pointer}
.bc-picker{border:1px solid var(--bc-line);border-radius:14px;padding:10px;background:var(--bc-bg)}
.bc-picker[hidden]{display:none}
.bc-picker-bar{display:flex;gap:8px;flex-wrap:wrap}
.bc-picker-bar input{flex:1 1 180px;min-height:44px;border:1px solid var(--bc-line);border-radius:11px;padding:8px 10px;font:inherit;font-size:16px}
.bc-pick-count{margin:8px 0;font-size:12.5px;color:var(--bc-muted);font-weight:700}
.bc-pick-list{max-height:260px;overflow-y:auto;display:grid;grid-template-columns:repeat(auto-fill,minmax(170px,1fr));gap:6px}
.bc-pick{display:flex;align-items:center;gap:8px;min-height:44px;padding:0 10px;border-radius:10px;background:#fff;border:1px solid var(--bc-line);cursor:pointer;font-size:13px}
.bc-pick[hidden]{display:none}
.bc-pick input,.bc-radio input{width:18px;height:18px;flex:none}
.bc-form-error[hidden],.bc-err[hidden]{display:none}
.bc-form-actions .bc-primary{flex:1 1 160px}
.bc-confirm-lead{margin:0 0 12px;font-size:19px;font-weight:800;color:var(--bc-navy)}
.bc-summary{margin:0;display:grid;gap:10px}
.bc-summary>div{display:grid;gap:3px}
.bc-summary dt{font-size:12px;color:var(--bc-muted);font-weight:700}
.bc-summary dd{margin:0;font-size:14px;overflow-wrap:anywhere}
.bc-summary .bc-message{margin:0;max-height:220px;overflow-y:auto}
.bc-read-meta{display:flex;flex-wrap:wrap;gap:6px 14px;font-size:12.5px;color:var(--bc-muted)}
.bc-late{color:var(--bc-bad);font-weight:800}
.bc-ack{margin-top:14px}
.bc-confirm{border:1px solid #f1dcb4;background:var(--bc-warn-bg);border-radius:14px;padding:12px}
.bc-confirm p{margin:0 0 10px;font-weight:800;color:#5c3a05}
.bc-confirm .bc-row>button{flex:1 1 120px}
.bc-ack-done{display:grid;gap:3px;border:1px solid #bfe3cd;background:var(--bc-ok-bg);color:var(--bc-ok);border-radius:14px;padding:12px 14px}
.bc-ack-done b{font-size:16px}
.bc-ack-done span{color:#2b5b41;font-size:13px}
.bc-ack-late{border-color:#f1dcb4;background:var(--bc-warn-bg);color:var(--bc-warn)}
.bc-ack-late span{color:#6b4608}

/* ---------- branch: notice, section, badge ---------- */
.bc-notice{display:flex;justify-content:space-between;align-items:center;gap:10px;flex-wrap:wrap;margin:0 0 14px;padding:10px 14px;border:1px solid #f1dcb4;border-radius:16px;background:var(--bc-warn-bg);color:#5c3a05;direction:rtl}
.bc-notice b{font-weight:800}
.bc-inbox .bc-items{display:grid;gap:8px}
.bc-item{display:grid;gap:4px;width:100%;text-align:right;font:inherit;cursor:pointer;background:#fffaf1;border:1px solid #f1dcb4;border-radius:14px;padding:11px 13px;min-height:44px;color:var(--bc-text)}
.bc-item-new{background:#f6f9ff;border-color:#cddcf6}
.bc-item-done{background:#fff;border-color:var(--bc-line)}
.bc-item-head{display:flex;justify-content:space-between;align-items:center;gap:8px}
.bc-item-head strong{font-size:14px;overflow-wrap:anywhere}
.bc-item-meta{font-size:11.5px;color:var(--bc-muted)}
.bc-history{margin-top:10px}
.bc-history summary{cursor:pointer;min-height:44px;display:flex;align-items:center;font-weight:700;color:var(--bc-muted);font-size:13px}
.bc-chip-btn{position:relative;min-width:44px;min-height:44px;border:1px solid #e5eaf2;border-radius:12px;background:#fff;font-size:18px;cursor:pointer}
.bc-chip-btn i{position:absolute;top:-4px;inset-inline-start:-4px;min-width:18px;height:18px;padding:0 5px;border-radius:999px;background:#d4433c;color:#fff;font:800 11px/18px system-ui;font-style:normal}
.bc-chip-btn i[hidden]{display:none}
.bc-toast{position:fixed;z-index:210;left:50%;bottom:calc(96px + env(safe-area-inset-bottom));transform:translateX(-50%);max-width:calc(100vw - 32px);background:#102342;color:#fff;border-radius:14px;padding:11px 16px;font-size:13.5px;font-weight:700;box-shadow:0 16px 40px rgba(16,35,66,.25);direction:rtl}

/* ---------- small screens ---------- */
@media(max-width:900px){
  .bc-filters{grid-template-columns:repeat(2,minmax(0,1fr))}
  .bc-filters .bc-f-q{grid-column:1/-1}
  .bc-list{grid-template-columns:1fr}
  .bc-kpis-5{grid-template-columns:repeat(3,minmax(0,1fr))}
}
@media(max-width:700px){
  .bc-center{padding:10px 14px calc(24px + env(safe-area-inset-bottom))}
  .bc-head{padding:10px 0}
  .bc-head h1{font-size:21px}
  .bc-head p{display:none}
  .bc-head-actions .bc-primary{padding:10px 12px}
  .bc-kpis{grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}
  .bc-kpis-5>div:last-child{grid-column:1/-1}
  .bc-kpi{padding:11px 12px;border-radius:14px}
  .bc-kpi strong{font-size:23px}
  .bc-filters input,.bc-filters select,.bc-branch-search input{font-size:16px}
  .bc-stats{grid-template-columns:repeat(2,minmax(0,1fr))}
  .bc-branch-search{max-width:none}
  .bc-toolbar .bc-secondary{flex:1 1 0}
  /* the branch table becomes one card per branch */
  .bc-dtable thead{display:none}
  .bc-dtable,.bc-dtable tbody,.bc-dtable tr,.bc-dtable td{display:block;width:100%;box-sizing:border-box}
  .bc-dtable tr{border:1px solid var(--bc-line);border-radius:14px;padding:6px 10px;margin-bottom:8px}
  .bc-dtable td{display:flex;justify-content:space-between;align-items:center;gap:10px;border:0;padding:6px 0;min-height:32px}
  .bc-dtable td::before{content:attr(data-label);color:var(--bc-muted);font-size:11.5px;font-weight:700;flex:none}
  .bc-dtable td:first-child{display:block}
  .bc-dtable td:first-child::before{content:none}
  .bc-dtable .bc-empty-row td{display:block;text-align:center}
  .bc-dtable .bc-empty-row td::before{content:none}
  .bc-table-wrap{overflow:visible}
}
@media(prefers-reduced-motion:reduce){.bc-back,.bc-head{scroll-behavior:auto}}

/* ---------- dark mode (body.ref-dark, as the dashboard) ---------- */
.ref-dark .bc-back{--bc-text:#eef4ff;--bc-muted:#9aa7ba;--bc-line:#283446;--bc-bg:#101722;--bc-card:#17202d;--bc-navy:#e7eefb;--bc-mute-bg:#232e3e;--bc-mute:#b3bfd0}
.ref-dark .bc-head{background:rgba(16,23,34,.92)}
.ref-dark .bc-close,.ref-dark .bc-secondary,.ref-dark .bc-chip,.ref-dark .bc-filters input,.ref-dark .bc-filters select,.ref-dark .bc-branch-search input{background:#1d2735;color:#eef4ff;border-color:#2c3a4e}
.ref-dark .bc-dtable th{background:#1d2735;color:#b3bfd0}
.ref-dark .bc-dtable td{border-color:#243041}
.ref-dark .bc-preview{color:#c8d2e1}
.ref-dark .bc-link{background:#1d3558;color:#8bb8ff}
.ref-dark .bc-progress{background:#243041}
.ref-dark .bc-chip.active{background:#8bb8ff;color:#0d1a2e;border-color:#8bb8ff}
.ref-dark .bc-chip.active em{color:#1d3558}
.ref-dark .bc-sheet{--bc-text:#eef4ff;--bc-navy:#e7eefb;--bc-muted:#9aa7ba;--bc-line:#2c3a4e;--bc-bg:#101722;--bc-card:#17202d;--bc-mute-bg:#232e3e;--bc-mute:#b3bfd0}
.ref-dark .bc-sheet .bc-secondary,.ref-dark .bc-sheet .bc-radio,.ref-dark .bc-sheet .bc-pick,.ref-dark .bc-sheet .bc-picker-bar input{background:#1d2735;color:#eef4ff;border-color:#2c3a4e}
.ref-dark .bc-item,.ref-dark .bc-chip-btn{background:#17202d;color:#eef4ff;border-color:#2c3a4e}

/* ---------- printable report (inside .executive-report-back, the only thing print ever shows) ---------- */
.report-actions #bc-report-close{width:44px;height:44px;margin:-3px;padding:0;border:3px solid transparent;border-radius:14px;background:#f2f4f7;background-clip:padding-box;font-size:20px}
.report-actions #bc-report-print{background:#102c59;color:#fff}
#broadcast-report .report-brand{grid-template-columns:130px minmax(0,1fr) 220px}
#broadcast-report .report-brand p,#broadcast-report .report-meta strong{overflow-wrap:anywhere}
#broadcast-report .bc-rinfo{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:10px;margin:0 0 16px}
#broadcast-report .bc-rinfo>div{background:#f8f9fb;border:1px solid #eceff3;border-radius:12px;padding:10px 12px;min-width:0}
#broadcast-report .bc-rinfo dt{font-size:9px;color:#7c8798;font-weight:700}
#broadcast-report .bc-rinfo dd{margin:3px 0 0;font-size:12px;color:#172b4d;font-weight:700;overflow-wrap:anywhere}
#broadcast-report .bc-rinfo .bc-rinfo-msg{grid-column:1/-1}
#broadcast-report .bc-rinfo .bc-rinfo-msg dd{white-space:pre-wrap;font-weight:500;line-height:1.8}
#broadcast-report .report-summary{margin-bottom:8px}
#broadcast-report .bc-rpush{margin:0 0 14px;color:#5f6b7c;font-size:10.5px;font-weight:700}
#broadcast-report .bc-rpush-cell{color:#5f6b7c}
#broadcast-report .bc-table{width:100%;border-collapse:collapse}
#broadcast-report .bc-table th{white-space:normal}
#broadcast-report .bc-table td strong{display:block}
#broadcast-report .bc-rp{font-weight:800}
#broadcast-report .bc-rp-acknowledged{color:#16734a}
#broadcast-report .bc-rp-acknowledged_late{color:#9a5b06}
#broadcast-report .bc-rp-late{color:#c0372f}
#broadcast-report .bc-rp-pending{color:#5f6b7c}
@media(max-width:700px){#broadcast-report .bc-rinfo{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media print{
  /* The proven header rules of the transfers fix (ccfbac3), re-scoped: automatic column widths and wrapping 7.5px
     headers so nothing overlaps or clips on A4; the table follows the summary on the same sheet. */
  #broadcast-report .report-brand{grid-template-columns:76px minmax(0,1fr) 165px!important}
  #broadcast-report .bc-table{table-layout:auto!important;width:100%!important}
  #broadcast-report .bc-table th,#broadcast-report .bc-table td{width:auto!important}
  #broadcast-report .bc-table th{font-size:7.5px!important;line-height:1.3!important;white-space:normal!important;padding:5px 5px!important}
  #broadcast-report .bc-table td{font-size:8px!important;padding:4px 5px!important;white-space:normal!important;overflow-wrap:anywhere}
  #broadcast-report .bc-table td:first-child{white-space:normal!important}
  #broadcast-report .report-table-wrap{break-before:auto!important;page-break-before:auto!important;margin-top:4mm!important}
  #broadcast-report .bc-rinfo{gap:6px!important;margin-bottom:10px!important}
  #broadcast-report .bc-rinfo>div{padding:6px 8px!important;break-inside:avoid}
  #broadcast-report .bc-rinfo dt{font-size:7px!important}
  #broadcast-report .bc-rinfo dd{font-size:9px!important}
  #broadcast-report .report-summary{margin-bottom:6px!important}
  #broadcast-report .bc-rpush{font-size:8px!important;margin-bottom:6px!important}
  #broadcast-report .bc-rp{-webkit-print-color-adjust:exact;print-color-adjust:exact}
}
