/* Screen-only emerald design overlay. Business styles and print remain in admin.css. */
@media screen {
  :root { --bg:#f3f5f3; --surface:#fff; --surface-alt:#f8fbf9; --border:#dce5df; --border-focus:#146348; --text-main:#192e28; --text-muted:#586d64; --text-heading:#203c31; --primary:#146348; --primary-hover:#0e5039; --primary-soft:#e9f5ee; --primary-text:#146348; --danger:#a22e39; --danger-soft:#fcecef; --danger-text:#962c38; --warning-text:#835517; --radius-md:12px; --radius-lg:18px; --shadow-sm:0 4px 18px #193d2805; --shadow-md:0 6px 24px #193d280c; }
  body { font-family:"Segoe UI",Tahoma,Arial,sans-serif; line-height:1.65; -webkit-font-smoothing:antialiased; }
  button,input,select,textarea { font-family:inherit; }
  button,a,input,select,textarea { -webkit-tap-highlight-color:transparent; }
  :focus-visible { outline:3px solid #78b796; outline-offset:3px; }
  .admin-navbar { background:#142b24; color:#e0eee6; padding:16px 26px; border:0; box-shadow:0 4px 18px #142b2414; gap:16px; }
  .admin-navbar .brand-logo { width:96px; height:56px; flex:0 0 96px; border-radius:10px; background:#fff; overflow:hidden; }
  .admin-navbar .brand-logo > .brand-image { display:block; width:100%; height:100%; object-fit:cover; object-position:center 58%; }
  .brand-title { color:#fff; font-size:22px; }
  .brand-badge { display:block; background:none; color:#b6d8c7; font-size:11px; padding:0; margin:0; }
  .user-pill { background:#203b30; color:#e0eee6; border-color:#416052; border-radius:10px; flex-wrap:wrap; }
  .user-role-badge { background:#375b47; color:#d9eee1; }
  .btn-nav-action { color:#e0eee6; background:#203b30; border-color:#416052; text-decoration:none; min-height:44px; border-radius:10px; }
  .btn-nav-action:hover { background:#2a5341; color:#fff; }
  .btn-nav-logout { background:transparent; color:#f1c9cb; border-color:#78575b; }
  .admin-layout { align-items:stretch; }
  .admin-sidebar { flex:0 0 248px; width:248px; background:#203b30; padding:22px 14px; border:0; gap:5px; }
  .nav-tab-btn { color:#d0e3d8; font-size:13px; font-weight:500; min-height:46px; border:1px solid transparent; border-radius:10px; text-decoration:none; padding:10px 12px; }
  .nav-tab-btn:hover { background:#284a3d; color:#fff; }
  .nav-tab-btn.active { color:#fff; background:#2a5341; border-color:#416f57; }
  .tab-icon { font-size:15px!important; opacity:.85; }
  .admin-main { min-width:0; padding:30px 32px 64px; }
  .view-section { max-width:1480px; margin-inline:auto; }
  .section-header { margin-bottom:24px; gap:18px; align-items:flex-start; }
  .section-title { font-size:clamp(23px,2.25vw,32px); line-height:1.55; letter-spacing:-.3px; }
  .section-subtitle { font-size:14px; max-width:760px; margin-top:8px; }
  .section-header>div:first-child::before { content:'باقة نت / الإدارة'; display:block; font-size:12px; color:var(--primary); font-weight:700; margin-bottom:7px; }
  button { line-height:1.4; }
  .btn-primary,.btn-secondary,.btn-nav-action,.btn-quick-action { min-height:44px; padding:11px 16px; border-radius:10px; }
  .btn-primary { box-shadow:0 3px 9px #14634812; }
  .btn-secondary { background:#fff; }
  .btn-secondary:hover { background:#edf3ef; }
  .btn-sm,.btn-xs { min-height:38px; padding:8px 11px; border-radius:8px; }
  .stats-grid { gap:14px; margin-bottom:24px; }
  .stat-card { border-radius:16px; padding:21px; box-shadow:var(--shadow-sm); min-width:0; }
  .stat-card:hover { transform:none; }
  .stat-info { min-width:0; }
  .stat-info h4 { font-size:13px; font-weight:600; }
  .stat-value { color:#203c31!important; font-variant-numeric:tabular-nums; }
  .stat-icon { width:42px; height:42px; border-radius:12px; font-size:20px; flex-shrink:0; }
  .filter-bar,.requests-filter-bar { border-radius:16px; padding:18px; gap:14px; margin-bottom:20px; }
  .filter-group { gap:10px; min-width:0; }
  .input-search,.select-filter,.form-control,.form-group input,.form-group select,.form-group textarea { min-height:44px; border:1px solid #cbdacf; border-radius:10px; background:#fafcfb; color:#192e28; padding:11px 12px; max-width:100%; min-width:0; font-size:14px; }
  .input-search { min-width:190px; }
  .filter-status-tabs { flex-wrap:wrap; gap:7px; }
  .filter-tab-btn { min-height:40px; border-radius:9px!important; font-family:inherit; font-size:13px; }
  .table-container { border-radius:16px; border-color:var(--border); box-shadow:var(--shadow-sm); overflow-x:auto; max-width:100%; overscroll-behavior-x:contain; }
  table { font-size:13px; width:100%; }
  .data-table { min-width:760px; }
  #view-brokers .data-table { min-width:1000px; }
  #view-main-lines .data-table { min-width:1100px; }
  #view-subscribers .data-table { min-width:1220px; }
  .modal-card .data-table { min-width:620px; }
  th { background:#eef5f0!important; color:#395b47; font-size:12px; font-weight:600; padding:15px 16px!important; }
  td { padding:16px!important; border-color:#e5ede7!important; color:#34513f; }
  tbody tr:nth-child(even) { background:#fafcfb; }
  tbody tr:hover { background:#f0f7f2; }
  .badge { border-radius:7px; font-size:11px; padding:5px 8px; }
  .pagination-bar { flex-wrap:wrap; gap:12px; padding:16px; }
  .dashboard-quick-actions { padding:18px; border-radius:16px; }
  .alert-card-item { padding:16px 18px; border-radius:12px; gap:12px; }
  .alert-card-content { min-width:0; }
  .modal-backdrop { background:#12291ec9; backdrop-filter:blur(4px); padding:22px; overflow-y:auto; }
  .modal-card { max-height:calc(100dvh - 44px); overflow-y:auto; border:1px solid var(--border); border-radius:20px; box-shadow:0 24px 70px #0a221833; }
  .modal-header { background:#fff; padding:22px 24px; gap:16px; }
  .modal-header h3 { font-size:21px; line-height:1.5; }
  .modal-close { min-width:44px; min-height:44px; flex-shrink:0; border-radius:10px; }
  .modal-body { padding:24px; gap:18px; }
  .modal-footer { padding:18px 24px; flex-wrap:wrap; }
  .modal.open { background:#12291ec9!important; backdrop-filter:blur(4px); padding:22px!important; }
  .modal.open .modal-box { background:#fff!important; color:#192e28!important; border:1px solid var(--border); border-radius:20px!important; max-height:calc(100dvh - 44px)!important; padding:26px!important; box-shadow:0 24px 70px #0a221833; }
  .modal.open h3 { font-size:22px; margin-bottom:12px; }
  .modal.open p { font-size:14px; color:#586d64; margin-block:12px; }
  .modal.open label { display:block; font-size:13px; font-weight:600; }
  .modal.open select { display:block; min-height:44px; max-width:100%; width:100%; padding:11px 12px; border:1px solid #cbdacf; border-radius:10px; background:#fafcfb; color:#192e28; margin-top:8px; }
  .modal.open table { min-width:650px; border-collapse:collapse; }
  .modal.open .actions { display:flex; flex-wrap:wrap; gap:10px; margin-top:20px; padding-top:18px; border-top:1px solid var(--border); }
  .modal.open .actions button { min-height:44px; padding:11px 16px; border-radius:10px; border:1px solid var(--border); cursor:pointer; font-weight:600; }
  .modal.open .actions .red { color:#fff; background:#a22e39; border-color:#a22e39; }
  .modal.open .actions .secondary { color:#203c31; background:#fff; }
  .modal.open .actions button:disabled { opacity:.5; cursor:default; }
  .form-group { min-width:0; }
  .form-group label { font-size:13px; color:#476352; }
  .wizard-container,.wizard-section-box,.entity-option-card,.strategy-card,.detail-kpi-card { border-radius:14px; }
  .entity-option-card,.strategy-card { min-width:0; }
  .entity-option-card.selected,.strategy-card.selected { border-color:#146348; background:#e9f5ee; }
  .entity-option-title { font-size:15px; }
  .entity-option-desc { font-size:13px; }
  .wa-admin-grid { grid-template-columns:repeat(auto-fill,minmax(min(250px,100%),1fr))!important; gap:14px!important; }
  .wa-card-compact { border-radius:14px; border-color:var(--border); height:auto!important; min-height:145px!important; max-height:none!important; padding:16px!important; }
  .wa-card-header-row { height:auto; min-height:28px; }
  .wa-card-meta-row { margin-block:8px; }
  .wa-card-title-text { font-size:14px; color:#203c31; }
  .wa-card-title-box { white-space:normal; }
  .wa-card-actions-row { height:auto; min-height:38px; }
  #view-whatsapp { padding-inline:0; }
  .ui-admin-toggle { display:none; }
  .ui-preview-note { background:#e9f5ee; color:#24503b; border-bottom:1px solid #cbded1; padding:10px 24px; font-size:12px; text-align:center; }
  .ui-preview-note a { color:inherit; font-weight:600; margin-inline-start:12px; }
  @media (min-width:1100px) { .admin-sidebar { position:sticky; top:80px; height:calc(100dvh - 80px); overflow-y:auto; } }
  @media (max-width:1099px) {
    .admin-layout { flex-direction:column; }
    .admin-sidebar { position:static; flex:0 0 auto; width:100%; flex-direction:row; flex-wrap:wrap; padding:12px 20px; gap:6px; }
    .nav-tab-btn { width:auto; flex:0 1 auto; padding:10px 12px; white-space:normal; }
    .admin-navbar { position:relative; flex-wrap:wrap; }
    .admin-main { padding:26px 24px 52px; }
    .user-nav-section { flex-wrap:wrap; gap:9px; }
    .stats-grid,.stats-grid-8 { grid-template-columns:repeat(2,minmax(0,1fr)); }
  }
  @media (max-width:600px) {
    .admin-navbar { padding:14px 16px; gap:13px; }
    .brand-section { flex:1; }
    .brand-title { font-size:21px; }
    .user-nav-section { width:100%; gap:8px; }
    .user-pill { width:100%; justify-content:flex-start; font-size:12px; }
    .btn-nav-action { font-size:12px; flex:1; justify-content:center; padding:10px; }
    .ui-admin-toggle { display:inline-flex; align-items:center; justify-content:center; min-height:44px; padding:10px 14px; border:1px solid #416052; color:#e0eee6; background:#203b30; border-radius:10px; font-size:13px; }
    .admin-sidebar { padding:14px 16px; display:none; }
    body.ui-admin-menu-open .admin-sidebar { display:grid; grid-template-columns:minmax(0,1fr); }
    .admin-sidebar .nav-tab-btn { width:100%; white-space:normal; min-height:46px; }
    .admin-main { padding:22px 16px 40px; }
    .section-header { gap:14px; margin-bottom:18px; }
    .section-title { font-size:25px; }
    .section-subtitle { font-size:13px; }
    .section-header>div { max-width:100%; }
    .section-header>div:last-child:not(:first-child) { display:flex; flex-wrap:wrap; gap:8px; }
    .stats-grid,.stats-grid-8 { gap:10px; }
    .dashboard-quick-actions { flex-direction:column; align-items:stretch; }
    .quick-actions-list { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); width:100%; gap:8px; }
    .btn-quick-action { padding:10px 8px; font-size:12px; justify-content:center; }
    .stat-card { padding:16px 13px; gap:8px; align-items:flex-start; flex-direction:column; }
    .stat-info .stat-value { font-size:26px; }
    .stat-info h4 { font-size:12px; }
    .stat-icon { width:34px; height:34px; font-size:17px; }
    .filter-bar,.requests-filter-bar { padding:14px; align-items:stretch; gap:12px; }
    .filter-group { width:100%; flex-direction:column; align-items:stretch; }
    .filter-group>* { width:100%; }
    .input-search,.select-filter { width:100%; min-width:0; }
    .search-box { min-width:0; max-width:100%; width:100%; }
    .filter-status-tabs { width:100%; }
    .filter-tab-btn { flex:1 0 auto; padding:9px 10px; }
    .table-container::before { content:'اسحب الجدول أفقيًا لعرض باقي البيانات'; display:block; font-size:11px; color:#586d64; padding:10px 14px; background:#f8fbf9; border-bottom:1px solid var(--border); }
    th,td { padding:13px!important; }
    .modal-backdrop { padding:10px; }
    .modal-card { max-height:calc(100dvh - 20px); max-width:100%!important; border-radius:17px; }
    .modal-header,.modal-body { padding:18px; }
    .modal-header h3 { font-size:19px; }
    .modal-footer { padding:16px 18px; }
    .modal-footer button { flex:1; justify-content:center; }
    .modal.open { padding:10px!important; }
    .modal.open .modal-box { padding:18px!important; max-height:calc(100dvh - 20px)!important; border-radius:17px!important; }
    .modal.open h3 { font-size:20px; }
    .modal.open .actions button { flex:1; }
    .modal-body [style*='grid-template-columns'], .modal-body [style*='display: grid'] { grid-template-columns:minmax(0,1fr)!important; }
    .admin-main [style*='display: flex'], .modal-body [style*='display: flex'] { flex-wrap:wrap; }
    .admin-main [style*='grid-template-columns'] { grid-template-columns:minmax(0,1fr)!important; }
    .admin-main .stats-grid[style*='grid-template-columns'] { grid-template-columns:repeat(2,minmax(0,1fr))!important; }
    .entity-grid,.strategy-grid { grid-template-columns:minmax(0,1fr); }
    .wizard-step-label { font-size:10px; }
    .wizard-step { min-width:0; flex:1; }
    .wizard-step-label { white-space:normal; overflow-wrap:anywhere; }
    .wizard-step-circle { width:34px; height:34px; }
    .wizard-steps { gap:5px; }
    .alert-card-item { flex-wrap:wrap; }
    .toast-container { inset-inline:12px; bottom:12px; }
    .toast { min-width:0; max-width:100%; font-size:13px; }
    .ui-preview-note { padding:10px 16px; text-align:start; }
  }
  @media (max-height:550px) { .modal-backdrop { align-items:flex-start; } }
  @media (prefers-reduced-motion:reduce) { *,*::before,*::after { animation:none!important; transition:none!important; scroll-behavior:auto!important; } }
}
@media print { .ui-admin-toggle,.ui-preview-note { display:none!important; } }

/* Fixed navigation uses the measured header height, including wrapped labels. */
@media screen {
  html { scroll-padding-top:calc(var(--bn-portal-header-height, 88px) + 16px); }
  .admin-navbar { position:sticky; top:0; z-index:100; }
  @media (min-width:1100px) {
    .admin-sidebar { position:sticky; top:var(--bn-portal-header-height, 88px); align-self:flex-start; min-height:0; height:calc(100vh - var(--bn-portal-header-height, 88px)); height:calc(100dvh - var(--bn-portal-header-height, 88px)); overflow-y:auto; overscroll-behavior-y:contain; }
  }
  @media (max-width:1099px) {
    .admin-navbar .brand-section { min-width:0; }
    .admin-navbar .brand-section > div:last-child { min-width:0;overflow-wrap:anywhere; }
    .ui-admin-toggle { display:inline-flex; align-items:center; justify-content:center; min-height:44px; padding:10px 14px; border:1px solid #416052; color:#e0eee6; background:#203b30; border-radius:10px; font:inherit; font-size:13px; }
    .admin-sidebar { position:fixed; inset-inline:0; top:var(--bn-portal-header-height, 88px); z-index:90; display:none; width:100%; max-height:calc(100vh - var(--bn-portal-header-height, 88px) - 8px); max-height:calc(100dvh - var(--bn-portal-header-height, 88px) - 8px); padding:12px 16px; overflow-y:auto; overscroll-behavior-y:contain; box-shadow:0 12px 20px #142b2426; }
    body.ui-admin-menu-open .admin-sidebar { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); }
    .admin-sidebar .nav-tab-btn { width:100%; min-height:46px; white-space:normal; }
  }
}
@media print {
  .admin-navbar, .admin-sidebar { display:none!important; }
}
