/* Sona3 v6.1.9 — isolated release overrides.
   Splash visuals are owned exclusively by the critical inline CSS in index.html. */
html,body{min-height:100%;min-height:100dvh}
#distribution .dt-hero-line h2{white-space:nowrap}
#distribution .dt-tabbar{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}
#distribution .dt-subtab-btn{min-width:0;width:100%;white-space:normal}
#distribution .dt-panel:not(.active){display:none!important}
#distribution .dt-manage-stack details.dt-main-collapse:not([open])>.dt-main-collapse-body{display:none}
.dt-exception-picker{position:relative;min-width:0}
.dt-exception-count{display:inline-grid;place-items:center;min-width:24px;height:24px;border-radius:999px;background:#e8eef8;padding:0 7px}
.dt-exception-suggestions{position:absolute;z-index:40;inset-inline:0;top:calc(100% - 2px);max-height:260px;overflow:auto;background:#fff;border:1px solid #d8e0ec;border-radius:12px;box-shadow:0 12px 28px rgba(0,0,0,.14);padding:6px}
.dt-exception-suggestion{display:block;width:100%;text-align:right;border:0;background:transparent;border-radius:9px;padding:10px;cursor:pointer}
.dt-exception-suggestion:hover{background:#f1f5f9}
.dt-exception-suggestion small{display:block;color:#64748b;margin-top:3px}
.dt-exception-chips{display:flex;flex-wrap:wrap;gap:7px;margin-top:8px;min-width:0}
.dt-exception-chip{display:inline-flex;align-items:center;gap:7px;max-width:100%;background:#eef4ff;border:1px solid #cddcf7;border-radius:999px;padding:6px 10px}
.dt-exception-chip span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.dt-exception-chip button{border:0;background:transparent;cursor:pointer;font-size:18px;line-height:1}
#settings-section-logs,#settings-section-logs *{max-width:100%;min-width:0;box-sizing:border-box}
#settings-section-logs .settings-section-head{display:flex;align-items:center;justify-content:space-between;gap:10px;flex-wrap:nowrap}
#settings-section-logs .log-card,#settings-section-logs .log-details,#settings-section-logs details,#settings-section-logs pre{width:100%;overflow-wrap:anywhere;white-space:normal}
#settings-section-logs .logs-pagination{display:flex;justify-content:center;align-items:center;gap:10px;margin:14px 0}
#settings-section-logs .technical-details{margin-top:8px}
@media(max-width:480px){#distribution .dt-page{min-width:0}#distribution .dt-hero{padding-inline:10px}#distribution .dt-hero-line h2{font-size:1.18rem}#settings-section-logs .settings-section-head h3{font-size:1rem}#settings-section-logs .clean-toolbar .btn{padding-inline:10px}}


/* Unified main search: normal cases + detailed case researches. */
.sona3-unified-search{display:grid;gap:16px;min-width:0}
.sona3-unified-search-overview{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:12px 14px;border:1px solid #dbe4ef;border-radius:14px;background:#f8fafc;color:#334155}
.sona3-unified-search-overview strong{font-size:1rem;color:#0f172a}
.sona3-unified-search-section{min-width:0;border:1px solid #dbe4ef;border-radius:16px;background:#fff;padding:12px;box-shadow:0 8px 22px rgba(15,23,42,.05)}
.sona3-unified-search-section.detailed-researches{border-color:#bfe5df;background:linear-gradient(180deg,#fbfffe 0%,#fff 100%)}
.sona3-unified-search-heading{display:flex;align-items:center;justify-content:space-between;gap:10px;margin-bottom:12px;padding-bottom:10px;border-bottom:1px solid #e5e7eb}
.sona3-unified-search-heading>div{display:flex;align-items:center;gap:9px;min-width:0}
.sona3-unified-search-heading h3{margin:0;color:#0f172a;font-size:1.05rem}
.sona3-unified-search-count{display:inline-grid;place-items:center;min-width:32px;height:32px;border-radius:999px;background:#e8eef8;color:#1e3a5f;padding:0 9px;font-weight:900}
.sona3-record-type-badge{display:inline-flex;align-items:center;border-radius:999px;padding:5px 9px;font-size:.76rem;font-weight:900;white-space:nowrap}
.sona3-record-type-badge.normal{background:#e8eef8;color:#1e3a5f}
.sona3-record-type-badge.detailed{background:#dff7f2;color:#0f766e}
.sona3-detailed-search-card{border:1px solid #cfe8e3;border-radius:14px;background:#fff;padding:13px;margin-bottom:10px;min-width:0}
.sona3-detailed-search-card:last-child{margin-bottom:0}
.sona3-detailed-search-card-head{display:flex;align-items:flex-start;justify-content:space-between;gap:10px;margin-bottom:11px}
.sona3-detailed-search-card-head h3{margin:8px 0 0;color:#0f172a;font-size:1.05rem;overflow-wrap:anywhere}
.sona3-record-link-badge{display:inline-flex;border-radius:999px;padding:5px 9px;background:#fff7d6;color:#92400e;font-size:.76rem;font-weight:900;white-space:nowrap}
.sona3-detailed-search-meta{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px 12px;color:#475569}
.sona3-detailed-search-meta span{min-width:0;overflow-wrap:anywhere}
.sona3-detailed-search-meta .wide{grid-column:1/-1}
.sona3-detailed-search-meta strong{color:#1f2937}
.sona3-detailed-search-actions{display:flex;justify-content:flex-end;margin-top:12px}
.sona3-unified-search-note{border:1px dashed #cbd5e1;border-radius:12px;background:#f8fafc;padding:14px;text-align:center;color:#64748b;font-weight:800}
.sona3-unified-search-note.error{border-color:#fecaca;background:#fff7f7;color:#991b1b}
body.dark-mode .sona3-unified-search-overview,body.dark-mode .sona3-unified-search-section,body.dark-mode .sona3-detailed-search-card{background:#111827;border-color:#334155;color:#d1d5db}
body.dark-mode .sona3-unified-search-section.detailed-researches{background:#101b1c;border-color:#285f59}
body.dark-mode .sona3-unified-search-heading,body.dark-mode .sona3-unified-search-heading h3,body.dark-mode .sona3-unified-search-overview strong,body.dark-mode .sona3-detailed-search-card-head h3,body.dark-mode .sona3-detailed-search-meta strong{color:#f8fafc}
body.dark-mode .sona3-detailed-search-meta{color:#cbd5e1}
body.dark-mode .sona3-unified-search-note{background:#111827;border-color:#475569;color:#cbd5e1}
@media(max-width:600px){.sona3-unified-search-overview,.sona3-unified-search-heading,.sona3-detailed-search-card-head{align-items:stretch;flex-direction:column}.sona3-unified-search-heading>div{flex-wrap:wrap}.sona3-unified-search-count{align-self:flex-start}.sona3-detailed-search-meta{grid-template-columns:1fr}.sona3-detailed-search-meta .wide{grid-column:auto}.sona3-detailed-search-actions .btn{width:100%}}

/* Sona3 v6.1.9 — Detailed Research modification 3.
   Safe visual proposal A: CSS overrides only; no list markup or behavior rewrite. */
body #detailedResearch .dr-page{max-width:1280px;margin-inline:auto;padding:12px 8px 34px;min-width:0}
body #detailedResearch .dr-hero{position:relative;overflow:hidden;border:1px solid #cfe5e2;border-radius:18px;padding:20px 22px;background:linear-gradient(135deg,#ffffff 0%,#f4fbfa 100%);box-shadow:0 12px 30px rgba(15,118,110,.08)}
body #detailedResearch .dr-hero::before{content:"";position:absolute;inset-block:0;inset-inline-start:0;width:5px;background:linear-gradient(180deg,#0f766e,#115e59)}
body #detailedResearch .dr-hero h2{font-size:clamp(1.35rem,2.4vw,2rem);line-height:1.35;color:#0f172a}
body #detailedResearch .dr-hero p{font-size:.96rem;line-height:1.8;color:#64748b}
body #detailedResearch .dr-toolbar{display:grid;grid-template-columns:minmax(260px,1fr) auto auto auto;gap:10px;align-items:stretch;margin:14px 0;padding:13px;border:1px solid #dce7ed;border-radius:16px;background:#fff;box-shadow:0 8px 24px rgba(15,23,42,.06)}
body #detailedResearch .dr-toolbar input{width:100%;min-width:0;min-height:46px;border:1px solid #cbd5e1;border-radius:12px;padding:0 14px;background:#fbfdff;transition:border-color .18s ease,box-shadow .18s ease}
body #detailedResearch .dr-toolbar input:focus{outline:0;border-color:#0f766e;box-shadow:0 0 0 3px rgba(15,118,110,.12)}
body #detailedResearch .dr-toolbar .dr-btn{min-height:46px;border-radius:12px;padding-inline:17px;box-shadow:none;transition:transform .16s ease,box-shadow .16s ease,background .16s ease}
body #detailedResearch .dr-toolbar .dr-btn:hover{transform:translateY(-1px);box-shadow:0 7px 16px rgba(15,23,42,.1)}
body #detailedResearch .dr-status:not(:empty){display:inline-flex;align-items:center;min-height:34px;margin:0 0 10px;padding:6px 12px;border:1px solid #cfe5e2;border-radius:999px;background:#edf9f7;color:#0f766e;font-size:.88rem}
body #detailedResearch .dr-table-wrap{overflow:auto;border:0;border-radius:0;background:transparent;box-shadow:none}
body #detailedResearch .dr-table{border-collapse:separate;border-spacing:0 10px;min-width:980px}
body #detailedResearch .dr-table thead th{padding:10px 12px;border:0;background:transparent;color:#475569;font-size:.82rem;white-space:nowrap}
body #detailedResearch .dr-table tbody tr{filter:drop-shadow(0 7px 12px rgba(15,23,42,.055))}
body #detailedResearch .dr-table tbody td{padding:13px 12px;border-block:1px solid #dce5eb;border-bottom:1px solid #dce5eb;background:#fff;color:#334155;vertical-align:middle;overflow-wrap:anywhere}
body #detailedResearch .dr-table tbody td:first-child{border-inline-start:1px solid #dce5eb;border-radius:0 14px 14px 0}
body #detailedResearch .dr-table tbody td:last-child{border-inline-end:1px solid #dce5eb;border-radius:14px 0 0 14px}
body #detailedResearch .dr-table tbody td:first-child strong{display:inline-flex;align-items:center;max-width:100%;padding:6px 9px;border-radius:9px;background:#e7f7f4;color:#0f766e;font-size:.8rem;direction:ltr;overflow-wrap:anywhere}
body #detailedResearch .dr-table tbody td:nth-child(2){font-size:1rem;font-weight:900;color:#0f172a}
body #detailedResearch #drResults .dr-actions{display:grid;grid-template-columns:repeat(2,minmax(92px,1fr));gap:7px;margin:0;min-width:205px}
body #detailedResearch #drResults .dr-actions .dr-btn{min-height:36px;padding:5px 8px;border-radius:9px;font-size:.78rem;white-space:normal}
body #detailedResearch #drResults .dr-actions .dr-btn.danger{grid-column:1/-1}
body #detailedResearch .dr-empty{border-radius:16px;padding:26px;border-color:#cbd5e1;background:#fff;box-shadow:0 8px 22px rgba(15,23,42,.04)}

/* Complete detailed-research view modal. */
body.dr-details-open{overflow:hidden}
body .dr-details-modal{position:fixed;inset:0;z-index:15000;display:none;align-items:center;justify-content:center;padding:18px;direction:rtl}
body .dr-details-modal.is-open{display:flex}
body .dr-details-backdrop{position:absolute;inset:0;background:rgba(15,23,42,.62);backdrop-filter:blur(3px)}
body .dr-details-dialog{position:relative;z-index:1;display:flex;flex-direction:column;width:min(1120px,96vw);max-height:94dvh;border:1px solid #d5e1e8;border-radius:20px;background:#f8fafc;box-shadow:0 28px 80px rgba(15,23,42,.28);overflow:hidden}
body .dr-details-header{display:flex;align-items:center;justify-content:space-between;gap:16px;padding:16px 18px;border-bottom:1px solid #dbe4ea;background:#fff}
body .dr-details-header h2{margin:2px 0 0;color:#0f172a;font-size:clamp(1.1rem,2.2vw,1.55rem);overflow-wrap:anywhere}
body .dr-details-kicker{display:block;color:#0f766e;font-size:.78rem;font-weight:900}
body .dr-details-close{display:grid;place-items:center;flex:0 0 42px;width:42px;height:42px;border:1px solid #d5dee5;border-radius:12px;background:#fff;color:#334155;font-size:1.8rem;line-height:1;cursor:pointer}
body .dr-details-close:hover{background:#fee2e2;color:#991b1b;border-color:#fecaca}
body .dr-details-body{overflow:auto;padding:16px;overscroll-behavior:contain}
body .dr-details-actions{position:sticky;top:-16px;z-index:3;display:flex;gap:8px;flex-wrap:wrap;margin:-2px 0 14px;padding:10px;border:1px solid #dce6eb;border-radius:14px;background:rgba(255,255,255,.96);box-shadow:0 7px 20px rgba(15,23,42,.07);backdrop-filter:blur(8px)}
body .dr-details-section{margin-bottom:13px;border:1px solid #dbe4ea;border-radius:15px;background:#fff;overflow:hidden}
body .dr-details-section>h3{margin:0;padding:10px 13px;border-bottom:1px solid #dbe4ea;background:linear-gradient(90deg,#f0f9f7,#f8fafc);color:#0f766e;font-size:1rem}
body .dr-details-section .dr-view-grid{grid-template-columns:repeat(3,minmax(0,1fr));gap:9px;padding:12px}
body .dr-details-section .dr-view-item{min-width:0;padding:10px 11px;border:1px solid #e2e8f0;border-radius:11px;background:#fbfdff;overflow-wrap:anywhere}
body .dr-details-section .dr-view-item strong{margin-bottom:5px;color:#64748b;font-size:.76rem}
body .dr-details-section .dr-view-item span{color:#0f172a;font-weight:800;line-height:1.65}
body .dr-details-section .dr-view-choice{grid-column:span 2}
body .dr-details-section .dr-view-choice b{color:#0f766e}
body .dr-choice-separator{padding-inline:5px;color:#94a3b8!important}
body .dr-details-table-wrap{overflow:auto;padding:12px}
body .dr-details-table{width:100%;border-collapse:collapse;min-width:620px}
body .dr-details-table th,body .dr-details-table td{padding:9px;border:1px solid #dbe4ea;text-align:right;vertical-align:top;overflow-wrap:anywhere}
body .dr-details-table th{background:#f1f5f9;color:#334155;font-size:.82rem}
body .dr-details-section .dr-story{margin:12px;min-height:auto;white-space:pre-wrap;line-height:1.9}
body .dr-details-section .dr-view-images{margin:0;padding:12px}

body.dark-mode #detailedResearch .dr-hero,body.dark-mode #detailedResearch .dr-toolbar,body.dark-mode #detailedResearch .dr-table tbody td,body.dark-mode #detailedResearch .dr-empty{background:#111827;border-color:#334155;color:#e5e7eb}
body.dark-mode #detailedResearch .dr-hero h2,body.dark-mode #detailedResearch .dr-table tbody td:nth-child(2){color:#f8fafc}
body.dark-mode #detailedResearch .dr-toolbar input{background:#0f172a;border-color:#475569;color:#f8fafc}
body.dark-mode .dr-details-dialog{background:#0f172a;border-color:#334155}
body.dark-mode .dr-details-header,body.dark-mode .dr-details-actions,body.dark-mode .dr-details-section{background:#111827;border-color:#334155}
body.dark-mode .dr-details-header h2,body.dark-mode .dr-details-section .dr-view-item span{color:#f8fafc}
body.dark-mode .dr-details-section>h3{background:#132525;border-color:#334155}
body.dark-mode .dr-details-section .dr-view-item{background:#0f172a;border-color:#334155}

@media(max-width:860px){
  body #detailedResearch .dr-toolbar{grid-template-columns:1fr 1fr}
  body #detailedResearch .dr-toolbar input{grid-column:1/-1}
  body .dr-details-section .dr-view-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
}
@media(max-width:700px){
  body #detailedResearch .dr-page{padding-inline:4px}
  body #detailedResearch .dr-hero{padding:17px 16px}
  body #detailedResearch .dr-toolbar{grid-template-columns:1fr;padding:10px}
  body #detailedResearch .dr-toolbar input{grid-column:auto}
  body #detailedResearch .dr-table-wrap{overflow:visible}
  body #detailedResearch .dr-table{display:block;min-width:0;width:100%;border-spacing:0}
  body #detailedResearch .dr-table thead{display:none}
  body #detailedResearch .dr-table tbody{display:grid;gap:12px}
  body #detailedResearch .dr-table tbody tr{display:grid;grid-template-columns:1fr 1fr;gap:10px;padding:14px;border:1px solid #dbe4ea;border-inline-start:4px solid #0f766e;border-radius:16px;background:#fff;box-shadow:0 10px 24px rgba(15,23,42,.07);filter:none;min-width:0}
  body #detailedResearch .dr-table tbody td{display:block;min-width:0;padding:0;border:0!important;border-radius:0!important;background:transparent!important;font-size:.88rem}
  body #detailedResearch .dr-table tbody td::before{display:block;margin-bottom:4px;color:#64748b;font-size:.69rem;font-weight:900}
  body #detailedResearch .dr-table tbody td:nth-child(1)::before{content:"كود البحث"}
  body #detailedResearch .dr-table tbody td:nth-child(2)::before{content:"الاسم"}
  body #detailedResearch .dr-table tbody td:nth-child(3)::before{content:"الرقم القومي"}
  body #detailedResearch .dr-table tbody td:nth-child(4)::before{content:"الموبايل"}
  body #detailedResearch .dr-table tbody td:nth-child(5)::before{content:"المنطقة"}
  body #detailedResearch .dr-table tbody td:nth-child(6)::before{content:"القرية / العنوان"}
  body #detailedResearch .dr-table tbody td:nth-child(7)::before{content:"تاريخ الإنشاء"}
  body #detailedResearch .dr-table tbody td:nth-child(8)::before{content:"الإجراءات"}
  body #detailedResearch .dr-table tbody td:nth-child(2),body #detailedResearch .dr-table tbody td:nth-child(6),body #detailedResearch .dr-table tbody td:nth-child(8){grid-column:1/-1}
  body #detailedResearch .dr-table tbody td:nth-child(2){grid-row:1;font-size:1.08rem}
  body #detailedResearch #drResults .dr-actions{grid-template-columns:repeat(2,minmax(0,1fr));min-width:0;width:100%;margin-top:3px}
  body .dr-details-modal{padding:0;align-items:stretch}
  body .dr-details-dialog{width:100%;max-height:100dvh;height:100dvh;border:0;border-radius:0}
  body .dr-details-header{padding:12px 14px}
  body .dr-details-body{padding:12px}
  body .dr-details-actions{top:-12px;display:grid;grid-template-columns:1fr 1fr}
  body .dr-details-actions .primary{grid-column:1/-1}
  body .dr-details-section .dr-view-grid{grid-template-columns:1fr}
  body .dr-details-section .dr-view-choice{grid-column:auto}
  body .dr-details-section .dr-view-images{grid-template-columns:1fr}
}

/* Sona3 v6.1.9 — Phase 2: image editing/download, expanded search, export and responsive refinements. */
.img-preview-edit{position:absolute;top:10px;left:50px;width:32px;height:32px;border-radius:50%;border:0;background:rgba(15,118,110,.92);color:#fff;font-size:17px;cursor:pointer;display:flex;align-items:center;justify-content:center;box-shadow:0 4px 12px rgba(15,118,110,.28);transition:.2s;z-index:3}
.img-preview-edit:hover{background:#0f5f59;transform:scale(1.08)}
#imgLightbox{cursor:default;padding:64px 18px 18px;box-sizing:border-box}
#imgLightboxToolbar{position:fixed;top:16px;left:16px;z-index:2;display:flex;align-items:center;gap:9px;direction:ltr}
#imgLightboxToolbar button{position:static;width:44px;height:44px;border-radius:50%;border:1px solid rgba(255,255,255,.3);background:rgba(255,255,255,.16);color:#fff;font-size:21px;cursor:pointer;display:grid;place-items:center;backdrop-filter:blur(6px);transition:.2s}
#imgLightboxToolbar button:hover{background:rgba(255,255,255,.3);transform:translateY(-1px)}
#imgLightboxToolbar button:disabled{opacity:.45;cursor:not-allowed;transform:none}
#imgLightboxClose{position:static}
#imgLightbox img{max-height:calc(100dvh - 90px)}
.sona3-search-match-reason,.dr-match-reason{display:inline-flex;align-items:center;width:max-content;max-width:100%;margin-top:6px;border:1px solid #bde4dc;border-radius:999px;background:#e7f7f4;color:#0f766e;padding:4px 8px;font-size:.72rem;font-weight:900;line-height:1.3;white-space:normal}
.sona3-detailed-search-badges{display:flex;align-items:flex-end;justify-content:flex-start;gap:6px;flex-wrap:wrap}
body.dark-mode .sona3-search-match-reason,body.dark-mode .dr-match-reason{background:#13342f;border-color:#286e64;color:#99f6e4}
body #detailedResearch .dr-match-reason{display:flex}
body #detailedResearch .dr-toolbar{grid-template-columns:minmax(250px,1fr) auto auto minmax(170px,auto) auto}
body #detailedResearch .dr-export-control{display:grid;grid-template-columns:minmax(82px,1fr) auto;gap:6px;min-width:170px}
body #detailedResearch .dr-export-control select{min-height:46px;border:1px solid #cbd5e1;border-radius:12px;padding:0 10px;background:#fff;color:#111827;font-family:inherit;font-weight:900}
body.dark-mode #detailedResearch .dr-export-control select{background:#0f172a;border-color:#475569;color:#f8fafc}

/* Compact Home dashboard on tablet/mobile so all main services appear sooner. */
@media(min-width:481px) and (max-width:900px){
  body.home-view #homeDashboard .home-action-grid{grid-template-columns:repeat(4,minmax(0,1fr))}
  body.home-view #homeDashboard #homeDistributionTile{grid-column:span 2!important}
  body.home-view #homeDashboard .home-stats-grid{grid-template-columns:repeat(4,minmax(0,1fr))}
}
@media(max-width:900px){
  body.home-view #mainApp>.header{min-height:68px;padding:9px 10px;margin-bottom:9px}
  body.home-view #mainApp>.header h1{font-size:clamp(1rem,3.2vw,1.25rem);margin-bottom:2px}
  body.home-view #mainApp>.header p{font-size:.72rem;margin:0}
  body.home-view #mainApp>.header .total-cases-badge{margin-top:5px;padding:4px 10px;font-size:.76rem}
  body.home-view #homeDashboard{margin-bottom:8px}
  body.home-view #homeDashboard .home-hero-card{padding:10px 12px;margin-bottom:8px;border-radius:18px}
  body.home-view #homeDashboard .home-title-only-card{padding-block:8px!important}
  body.home-view #homeDashboard .home-hero-title h2{font-size:1rem!important;margin-bottom:1px!important}
  body.home-view #homeDashboard .home-hero-title p{font-size:.7rem!important;line-height:1.45!important}
  body.home-view #homeDashboard .home-action-grid{gap:7px;margin-bottom:8px}
  body.home-view #homeDashboard .home-action-tile{min-height:74px;padding:8px 6px;border-radius:15px;gap:5px;font-size:.78rem;line-height:1.25}
  body.home-view #homeDashboard .home-action-tile .tile-icon{width:34px!important;height:34px!important;border-radius:12px!important;font-size:18px!important}
  body.home-view #homeDashboard #homeDistributionTile{min-height:74px!important;padding:8px 10px!important}
  body.home-view #homeDashboard #homeDistributionTile>span:last-child{font-size:.82rem}
  body.home-view #homeDashboard .home-follow-card{margin-top:0;margin-bottom:8px}
  body.home-view #homeDashboard .home-stats-grid{gap:7px;margin-top:8px}
  body.home-view #homeDashboard .home-stat-card{min-height:62px;padding:8px 9px;border-radius:15px;gap:8px}
  body.home-view #homeDashboard .home-stat-icon{width:34px;height:34px;border-radius:12px;font-size:17px}
  body.home-view #homeDashboard .home-stat-info span{font-size:.66rem}
  body.home-view #homeDashboard .home-stat-info strong{font-size:1.08rem;margin-top:1px}
  body.home-view #homeDashboard>.home-activity-card{padding:10px 12px;border-radius:18px}
  body.home-view #homeDashboard .home-activity-head{margin-bottom:4px}
  body.home-view #homeDashboard .home-activity-head h3{font-size:.92rem}
  body.home-view #homeDashboard .home-activity-row{padding:7px 0}
}
@media(max-width:480px){
  body.home-view #homeDashboard .home-action-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
  body.home-view #homeDashboard #homeDistributionTile{grid-column:1/-1!important}
  body.home-view #homeDashboard .home-stats-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
}

/* Detailed Research uses the new card layout on tablets, not the legacy wide table. */
@media(min-width:701px) and (max-width:1050px){
  body #detailedResearch .dr-toolbar{grid-template-columns:repeat(3,minmax(0,1fr))}
  body #detailedResearch .dr-toolbar input{grid-column:1/-1}
  body #detailedResearch .dr-export-control{min-width:0}
  body #detailedResearch .dr-table-wrap{overflow:visible}
  body #detailedResearch .dr-table{display:block;min-width:0;width:100%;border-spacing:0}
  body #detailedResearch .dr-table thead{display:none}
  body #detailedResearch .dr-table tbody{display:grid;grid-template-columns:1fr;gap:12px}
  body #detailedResearch .dr-table tbody tr{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:10px;padding:14px;border:1px solid #dbe4ea;border-inline-start:4px solid #0f766e;border-radius:16px;background:#fff;box-shadow:0 10px 24px rgba(15,23,42,.07);filter:none;min-width:0}
  body #detailedResearch .dr-table tbody td{display:block;min-width:0;padding:0;border:0!important;border-radius:0!important;background:transparent!important;font-size:.84rem}
  body #detailedResearch .dr-table tbody td::before{display:block;margin-bottom:4px;color:#64748b;font-size:.68rem;font-weight:900}
  body #detailedResearch .dr-table tbody td:nth-child(1)::before{content:"كود البحث"}
  body #detailedResearch .dr-table tbody td:nth-child(2)::before{content:"الاسم"}
  body #detailedResearch .dr-table tbody td:nth-child(3)::before{content:"الرقم القومي"}
  body #detailedResearch .dr-table tbody td:nth-child(4)::before{content:"الموبايل"}
  body #detailedResearch .dr-table tbody td:nth-child(5)::before{content:"المنطقة"}
  body #detailedResearch .dr-table tbody td:nth-child(6)::before{content:"القرية / العنوان"}
  body #detailedResearch .dr-table tbody td:nth-child(7)::before{content:"تاريخ الإنشاء"}
  body #detailedResearch .dr-table tbody td:nth-child(8)::before{content:"الإجراءات"}
  body #detailedResearch .dr-table tbody td:nth-child(2),body #detailedResearch .dr-table tbody td:nth-child(6){grid-column:span 2}
  body #detailedResearch .dr-table tbody td:nth-child(2){font-size:1rem}
  body #detailedResearch .dr-table tbody td:nth-child(8){grid-column:1/-1}
  body #detailedResearch #drResults .dr-actions{grid-template-columns:repeat(3,minmax(0,1fr));min-width:0;width:100%}
  body #detailedResearch #drResults .dr-actions .dr-btn.danger{grid-column:auto}
  body.dark-mode #detailedResearch .dr-table tbody tr{background:#111827;border-color:#334155}
}
@media(max-width:700px){
  body #detailedResearch .dr-export-control{min-width:0;width:100%}
  body #detailedResearch .dr-export-control select,body #detailedResearch .dr-export-control .dr-btn{width:100%}
}
@media(max-width:430px){
  #imgLightboxToolbar{top:10px;left:10px}
  #imgLightboxToolbar button{width:40px;height:40px}
}

/* Sona3 v6.1.9 — Phase 2 mobile hotfix: keep the detailed-research toolbar inside the viewport. */
@media(max-width:700px){
  body #detailedResearch,
  body #detailedResearch .dr-page,
  body #detailedResearch .dr-toolbar{max-width:100%;min-width:0;box-sizing:border-box}
  body #detailedResearch .dr-toolbar{
    width:100%;
    grid-template-columns:minmax(0,1fr) minmax(0,1fr);
    gap:8px;
    overflow:visible;
  }
  body #detailedResearch .dr-toolbar>*{min-width:0;max-width:100%;box-sizing:border-box}
  body #detailedResearch .dr-toolbar input{
    grid-column:1/-1;
    width:100%;
    min-width:0;
    max-width:100%;
    box-sizing:border-box;
  }
  body #detailedResearch .dr-toolbar #drSearchBtn,
  body #detailedResearch .dr-toolbar #drRefreshBtn{width:100%;padding-inline:10px}
  body #detailedResearch .dr-toolbar .dr-export-control{
    grid-column:1/-1;
    width:100%;
    min-width:0;
    max-width:100%;
    grid-template-columns:minmax(0,1fr) minmax(86px,auto);
  }
  body #detailedResearch .dr-toolbar .dr-export-control select,
  body #detailedResearch .dr-toolbar .dr-export-control .dr-btn{
    width:100%;
    min-width:0;
    max-width:100%;
    box-sizing:border-box;
  }
  body #detailedResearch .dr-toolbar #drAddBtn{grid-column:1/-1;width:100%}
}

/* ============================================================
   Phase 1 N02 + N03 — contextual section navigation and compact
   detailed/medical layouts. Scoped to the two target sections.
   ============================================================ */
.section-context-nav{
  display:none;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:8px;
  margin:0 0 10px;
  padding:7px;
  border:1px solid var(--border,#dbe4ea);
  border-radius:18px;
  background:#fff;
  box-shadow:0 8px 22px rgba(15,23,42,.06);
}
.section-context-btn{
  display:flex;
  align-items:center;
  justify-content:center;
  gap:7px;
  min-width:0;
  min-height:46px;
  padding:9px 10px;
  border:0;
  border-radius:14px;
  background:#f8fafc;
  color:var(--text,#17232e);
  font-family:inherit;
  font-size:15px;
  font-weight:900;
  cursor:pointer;
  transition:transform .18s ease,background .18s ease,box-shadow .18s ease;
}
.section-context-btn:hover:not(:disabled){transform:translateY(-1px);background:#eff6ff}
.section-context-btn.active{
  color:#0f172a;
  background:linear-gradient(135deg,#dbeafe 0%,#ccfbf1 100%);
  box-shadow:0 8px 18px rgba(37,99,235,.14),inset 0 0 0 1px rgba(37,99,235,.18);
}
.section-context-btn.active:hover:not(:disabled){
  color:#0f172a;
  background:linear-gradient(135deg,#dbeafe 0%,#ccfbf1 100%);
}
.section-context-btn:disabled,.section-context-btn.locked-option{opacity:.5;cursor:not-allowed;transform:none}
body.dark-mode .section-context-nav{background:#162238;border-color:#2b3b55}
body.dark-mode .section-context-btn{background:#111827;color:#e5e7eb}
body.dark-mode .section-context-btn.active,body.dark-mode .section-context-btn.active:hover:not(:disabled){color:#0f172a;background:linear-gradient(135deg,#bfdbfe 0%,#99f6e4 100%);box-shadow:0 8px 18px rgba(15,118,110,.22),inset 0 0 0 1px rgba(255,255,255,.2)}

/* One compact header footprint in Detailed Research and Medical, matching Home. */
@media(max-width:900px){
  body.detailed-research-mode #mainApp>.header,
  body.medical-mode #mainApp>.header{min-height:68px;padding:9px 10px;margin-bottom:9px}
  body.detailed-research-mode #mainApp>.header h1,
  body.medical-mode #mainApp>.header h1{font-size:clamp(1rem,3.2vw,1.25rem);margin-bottom:2px}
  body.detailed-research-mode #mainApp>.header p,
  body.medical-mode #mainApp>.header p{font-size:.72rem;margin:0}
  body.detailed-research-mode #mainApp>.header .total-cases-badge,
  body.medical-mode #mainApp>.header .total-cases-badge{margin-top:5px;padding:4px 10px;font-size:.76rem}
}

/* Detailed Research: title and controls are one card, with no duplicated shell. */
body #detailedResearch .dr-page{padding-top:0}
body #detailedResearch .dr-search-card{
  position:relative;
  overflow:hidden;
  margin:0 0 10px;
  padding:15px;
  border:1px solid #dce7ed;
  border-radius:18px;
  background:linear-gradient(135deg,#fff 0%,#f7fbfb 100%);
  box-shadow:0 10px 26px rgba(15,23,42,.06);
}
body #detailedResearch .dr-search-card::before{
  content:"";
  position:absolute;
  inset-block:0;
  inset-inline-start:0;
  width:5px;
  background:linear-gradient(180deg,#0f766e,#115e59);
}
body #detailedResearch .dr-search-card .dr-hero{
  overflow:visible;
  margin:0 0 11px;
  padding:0 3px;
  border:0;
  border-radius:0;
  background:transparent;
  box-shadow:none;
}
body #detailedResearch .dr-search-card .dr-hero::before{display:none}
body #detailedResearch .dr-search-card .dr-hero h2{
  margin:0;
  font-size:clamp(1.3rem,2.4vw,1.8rem);
  line-height:1.35;
}
body #detailedResearch .dr-search-card .dr-hero p{
  display:block;
  max-width:100%;
  margin:3px 0 0;
  overflow:hidden;
  color:#64748b;
  font-size:clamp(.75rem,2.7vw,.9rem);
  font-weight:800;
  line-height:1.55;
  text-overflow:ellipsis;
  white-space:nowrap;
}
body #detailedResearch .dr-search-card .dr-toolbar{
  margin:0;
  padding:0;
  border:0;
  border-radius:0;
  background:transparent;
  box-shadow:none;
}
body.dark-mode #detailedResearch .dr-search-card{background:#111827;border-color:#334155}
body.dark-mode #detailedResearch .dr-search-card .dr-hero{background:transparent;border-color:transparent}

@media(max-width:700px){
  .section-context-nav{margin-bottom:9px;padding:6px;border-radius:16px}
  .section-context-btn{min-height:43px;padding:8px 7px;font-size:13px}
  body #detailedResearch .dr-search-card{padding:12px 10px;border-radius:17px}
  body #detailedResearch .dr-search-card .dr-hero{padding:0 2px;margin-bottom:9px}
  body #detailedResearch .dr-search-card .dr-hero h2{font-size:1.35rem}
  body #detailedResearch .dr-search-card .dr-hero p{font-size:clamp(.68rem,3vw,.8rem)}
  body #detailedResearch .dr-search-card .dr-toolbar{padding:0}
  body.medical-mode .v613-medical-page{padding-top:4px}
}

/* Phase 1.1 — merge the Medical title and statistics into one compact card. */
.v613-medical-summary-card{
  overflow:hidden;
  padding:0;
}
.v613-medical-summary-title{
  padding:12px 14px 9px;
  border-bottom:1px solid #edf2f7;
  text-align:center;
}
.v613-medical-summary-title h2{
  margin:0;
  color:var(--text,#17232e);
  font-size:19px;
  line-height:1.4;
  text-align:center;
}
.v613-medical-summary-card .v613-medical-stats{
  box-sizing:border-box;
  padding:9px 9px 0;
}
.v613-medical-summary-card .v613-export-row{
  margin:8px 9px 9px;
}
body.dark-mode .v613-medical-summary-title{border-bottom-color:#334155}
body.dark-mode .v613-medical-summary-title h2{color:#f8fafc}
@media(max-width:700px){
  .v613-medical-summary-title{padding:11px 10px 8px}
  .v613-medical-summary-title h2{font-size:18px}
  .v613-medical-summary-card .v613-medical-stats{padding:8px 8px 0}
  .v613-medical-summary-card .v613-export-row{margin:7px 8px 8px}
}
