/*
|--------------------------------------------------------------------------
| Emaar Altelal CRM - Unified UI Stylesheet
| Lightweight CSS only (no Tailwind / no Vite)
|--------------------------------------------------------------------------
*/

/* =========================
   Design Tokens
   ========================= */
:root{
  --bg:#f6f8fc;
  --surface:#ffffff;
  --surface-soft:#f8fafc;
  --text:#111827;
  --muted:#6b7280;
  --border:#e5e7eb;

  --primary:#2563eb;
  --primary-hover:#1d4ed8;

  --success:#16a34a;
  --success-soft:#ecfdf5;
  --success-border:#a7f3d0;
  --success-text:#065f46;

  --warning:#f59e0b;
  --warning-soft:#fffbeb;
  --warning-border:#fde68a;
  --warning-text:#92400e;

  --danger:#dc2626;
  --danger-hover:#b91c1c;
  --danger-soft:#fef2f2;
  --danger-border:#fecaca;
  --danger-text:#991b1b;

  --dark:#111827;
  --dark-hover:#1f2937;

  --radius-sm:10px;
  --radius:14px;
  --radius-lg:20px;

  --shadow-sm:0 4px 10px rgba(15,23,42,.04);
  --shadow:0 10px 24px rgba(15,23,42,.06);
  --shadow-lg:0 18px 40px rgba(15,23,42,.10);
}

/* =========================
   Reset / Base
   ========================= */
*{ box-sizing:border-box; }

html,body{
  height:100%;
  max-width:100%;
  overflow-x:hidden;
}

body{
  margin:0;
  background:var(--bg);
  color:var(--text);
  font-family:ui-sans-serif,system-ui,-apple-system,"Segoe UI",Roboto,Arial,"Noto Sans",sans-serif;
}

a{ color:inherit; }

img{
  max-width:100%;
  height:auto;
}

.app-shell{
  min-height:100vh;
  display:flex;
  flex-direction:column;
}


/* ===== TOPBAR ===== */

.topbar{
  position:sticky;
  top:0;
  z-index:1000;
  background:#fff;
  border-bottom:1px solid var(--border);
}

.topbar .wrap{
  max-width:1280px;
  margin:0 auto;
  padding:10px 16px;

  display:flex;
  align-items:center;
  gap:14px;

  height:60px;
}

/* LEFT */

.tb-left{
  display:flex;
  align-items:center;
}

.brand img{
  height:36px;
}

/* SEARCH */

.tb-search{
  flex:0 0 260px;
}

.tb-search input{
  width:100%;
  border:1px solid var(--border);
  border-radius:12px;
  padding:8px 12px;
  font-size:14px;
}

/* CENTER NAV */

.tb-center{
  display:flex;
  gap:8px;
  flex:1;
  justify-content:center;
}

.nav-link{
  padding:6px 10px;
  border-radius:10px;
  text-decoration:none;
  font-weight:600;
  color:#374151;
}

.nav-link:hover{
  background:#f3f4f6;
}

/* RIGHT */

.tb-right{
  display:flex;
  align-items:center;
  gap:10px;
}

/* notification badge */

.badge{
  background:#ef4444;
  color:#fff;
  border-radius:999px;
  font-size:11px;
  padding:2px 6px;
}

/* dropdown */

.dd{
  position:relative;
}

.dd-menu{
  display:none;
  position:absolute;
  top:42px;
  right:0;

  min-width:220px;

  background:#fff;
  border:1px solid var(--border);
  border-radius:14px;

  box-shadow:0 18px 40px rgba(0,0,0,.08);

  padding:8px;
}

.dd.open .dd-menu{
  display:block;
}

.dd-menu a{
  display:block;
  padding:8px 10px;
  border-radius:8px;
  text-decoration:none;
}

.dd-menu a:hover{
  background:#f3f4f6;
}

/* =========================
   Layout
   ========================= */
.page{
  max-width:1280px;
  margin:0 auto;
  padding:18px 16px 36px;
}

.container-page{
  max-width:1280px;
  margin:0 auto;
  padding:18px 16px 36px;
}

.page-header{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:12px;
  flex-wrap:wrap;
  background:#fff;
  border:1px solid var(--border);
  border-radius:var(--radius);
  padding:14px 16px;
  margin-bottom:14px;
  box-shadow:var(--shadow-sm);
}

.page-title,
.page-header h1,
.page-header h2,
.page-header h3{
  margin:0;
  font-size:20px;
  font-weight:900;
  color:var(--text);
}

.page-subtitle{
  margin-top:4px;
  font-size:13px;
  color:var(--muted);
}

.page-actions{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
  align-items:center;
}

.page-body{
  background:#fff;
  border:1px solid var(--border);
  border-radius:var(--radius);
  padding:16px;
  box-shadow:var(--shadow-sm);
}

/* =========================
   Cards
   ========================= */
.card,
.card-ui,
.form-card{
  background:var(--surface);
  border:1px solid var(--border);
  border-radius:var(--radius);
  padding:16px;
  box-shadow:var(--shadow-sm);
}

.card-ui.soft{
  background:linear-gradient(180deg,#fff,#fafbfd);
}

.grid-cards{
  display:grid;
  grid-template-columns:repeat(auto-fit,minmax(260px,1fr));
  gap:16px;
}

/* =========================
   Tables
   ========================= */
.table-wrap{
  width:100%;
  max-width:100%;
  background:#fff;
  border:1px solid var(--border);
  border-radius:var(--radius);
  overflow:auto;
  box-shadow:var(--shadow-sm);
}

.table-ui,
table{
  width:100%;
  border-collapse:collapse;
  background:#fff;
}

.table-ui th,
.table-ui td,
table th,
table td{
  padding:12px 12px;
  border-bottom:1px solid #eef2f7;
  vertical-align:middle;
  font-size:14px;
}

.table-ui th,
table th{
  background:#f8fafc;
  color:#374151;
  font-weight:800;
  white-space:nowrap;
}

.table-ui tbody tr:hover td,
table tbody tr:hover td{
  background:#fcfcfd;
}

/* =========================
   Buttons
   ========================= */
.btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:8px;
  padding:9px 14px;
  border-radius:12px;
  border:1px solid var(--border);
  background:#fff;
  color:var(--text);
  text-decoration:none;
  cursor:pointer;
  font-weight:800;
  font-size:14px;
  transition:.18s ease;
  white-space:nowrap;
}

.btn:hover{
  background:#f9fafb;
}

.btn-primary{
  background:var(--primary);
  border-color:var(--primary);
  color:#fff;
}

.btn-primary:hover{
  background:var(--primary-hover);
  border-color:var(--primary-hover);
}

.btn-dark,
.btn-secondary{
  background:var(--dark);
  border-color:var(--dark);
  color:#fff;
}

.btn-dark:hover,
.btn-secondary:hover{
  background:var(--dark-hover);
  border-color:var(--dark-hover);
  color:#fff;
}

.btn-success{
  background:var(--success);
  border-color:var(--success);
  color:#fff;
}

.btn-success:hover{
  filter:brightness(1.04);
}

.btn-warning{
  background:var(--warning);
  border-color:var(--warning);
  color:#fff;
}

.btn-warning:hover{
  filter:brightness(1.04);
}

.btn-danger{
  background:var(--danger);
  border-color:var(--danger);
  color:#fff;
}

.btn-danger:hover{
  background:var(--danger-hover);
  border-color:var(--danger-hover);
}

.btn-light,
.btn-soft{
  background:#fff;
  color:var(--text);
  border-color:var(--border);
}

.btn-light:hover,
.btn-soft:hover{
  background:#f3f4f6;
}

.btn-back{
  background:#f3f4f6;
  border-color:#e5e7eb;
  color:#111827;
}

/* =========================
   Forms
   ========================= */
label,
.label{
  display:block;
  margin-bottom:6px;
  font-size:13px;
  font-weight:800;
  color:#4b5563;
}

input,
select,
textarea,
.input,
.select,
.textarea{
  width:100%;
  max-width:100%;
  border:1px solid #d1d5db;
  border-radius:12px;
  padding:10px 12px;
  font-size:14px;
  background:#fff;
  color:var(--text);
  transition:.18s ease;
}

input:focus,
select:focus,
textarea:focus,
.input:focus,
.select:focus,
.textarea:focus{
  outline:none;
  border-color:#93c5fd;
  box-shadow:0 0 0 4px rgba(37,99,235,.10);
}

textarea,
.textarea{
  min-height:110px;
  resize:vertical;
}

input[readonly]{
  background:#f9fafb;
  color:var(--muted);
}

input[type="checkbox"]{
  width:auto;
}

.help{
  margin-top:6px;
  font-size:12px;
  color:var(--muted);
}

/* =========================
   Form Grid
   ========================= */
.form-grid{
  display:grid;
  grid-template-columns:repeat(12,1fr);
  gap:12px;
}

.col-12{ grid-column:span 12; }
.col-6{ grid-column:span 6; }
.col-4{ grid-column:span 4; }
.col-3{ grid-column:span 3; }

@media (max-width:900px){
  .col-6,.col-4,.col-3{ grid-column:span 12; }
}

/* =========================
   Alerts
   ========================= */
.alert,
.alert-ui{
  padding:12px 14px;
  border-radius:12px;
  border:1px solid var(--border);
  background:#fff;
  font-size:14px;
}

.alert-success{
  background:var(--success-soft);
  border-color:var(--success-border);
  color:var(--success-text);
}

.alert-danger{
  background:var(--danger-soft);
  border-color:var(--danger-border);
  color:var(--danger-text);
}

.alert-info{
  background:#eff6ff;
  border-color:#bfdbfe;
  color:#1d4ed8;
}

/* =========================
   Badges
   ========================= */
.badge,
.badge-ui{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  padding:6px 10px;
  border-radius:999px;
  font-size:12px;
  font-weight:800;
  border:1px solid transparent;
  white-space:nowrap;
  line-height:1;
}

.badge.gray,
.badge-muted{
  background:#f3f4f6;
  color:#374151;
  border-color:#e5e7eb;
}

.badge.success,
.badge-success{
  background:var(--success-soft);
  color:var(--success-text);
  border-color:var(--success-border);
}

.badge.warning,
.badge-warning{
  background:var(--warning-soft);
  color:var(--warning-text);
  border-color:var(--warning-border);
}

.badge.danger,
.badge-danger{
  background:var(--danger-soft);
  color:var(--danger-text);
  border-color:var(--danger-border);
}

/* =========================
   Empty / Section / Stats
   ========================= */
.section-title{
  margin:0 0 10px;
  font-size:15px;
  font-weight:900;
}

.empty-state{
  text-align:center;
  padding:28px 16px;
  color:var(--muted);
  background:#fff;
  border:1px dashed #d1d5db;
  border-radius:16px;
}

.stat-tile{
  background:#fff;
  border:1px solid var(--border);
  border-radius:18px;
  padding:18px;
  box-shadow:var(--shadow-sm);
  transition:.18s ease;
}

.stat-tile:hover{
  transform:translateY(-3px);
  box-shadow:var(--shadow);
}

.stat-number{
  font-size:30px;
  font-weight:900;
  line-height:1;
  margin-bottom:8px;
}

.stat-label{
  font-size:14px;
  font-weight:700;
  color:#374151;
}

/* =========================
   Utilities
   ========================= */
.hidden{ display:none !important; }
.flex{ display:flex; }
.items-center{ align-items:center; }
.justify-between{ justify-content:space-between; }
.justify-center{ justify-content:center; }
.gap-3{ gap:12px; }
.gap-6{ gap:24px; }
.w-full{ width:100%; }
.text-right{ text-align:right; }
.whitespace-nowrap{ white-space:nowrap; }
.text-sm{ font-size:14px; }
.text-xs{ font-size:12px; }
.text-xl{ font-size:20px; }
.font-semibold{ font-weight:700; }
.rounded{ border-radius:12px; }
.shadow{ box-shadow:0 10px 25px rgba(0,0,0,.05); }
.bg-white{ background:#fff; }
.p-6{ padding:24px; }
.p-4{ padding:16px; }
.py-6{ padding-top:24px; padding-bottom:24px; }
.px-4{ padding-left:16px; padding-right:16px; }
.mx-auto{ margin-left:auto; margin-right:auto; }
.max-w-7xl{ max-width:1200px; }
.max-w-6xl{ max-width:1000px; }
.border{ border:1px solid var(--border); }
.border-b{ border-bottom:1px solid var(--border); }
.text-gray-500{ color:var(--muted); }
.text-indigo-600{ color:#4f46e5; }
.text-red-600{ color:var(--danger); }
.bg-green-100{ background:#f0fdf4; }
.bg-red-50{ background:#fef2f2; }
.border-red-300{ border-color:#fca5a5; }
.ltr{ direction:ltr; text-align:left; }
.rtl{ direction:rtl; text-align:right; }
.auto-align{ text-align:start; }

/* Tailwind-like compatibility classes */
.sm\:px-6{ padding-left:24px; padding-right:24px; }
.lg\:px-8{ padding-left:32px; padding-right:32px; }

/* =========================
   RTL / LTR smart handling
   ========================= */
html[dir="rtl"] body{ direction:rtl; }
html[dir="ltr"] body{ direction:ltr; }

html[dir="rtl"] .text-start{ text-align:right; }
html[dir="rtl"] .text-end{ text-align:left; }
html[dir="ltr"] .text-start{ text-align:left; }
html[dir="ltr"] .text-end{ text-align:right; }

html[dir="rtl"] table th,
html[dir="rtl"] table td{
  text-align:right;
}

html[dir="ltr"] table th,
html[dir="ltr"] table td{
  text-align:left;
}

/* =========================
   Select fixes (macOS / Safari / Chrome)
   ========================= */
select{
  color:var(--text);
  background-color:#fff;
  padding-right:12px;
  padding-left:34px;
}

select option{
  color:var(--text);
  background-color:#fff;
  direction:inherit;
  unicode-bidi:plaintext;
}

html[dir="rtl"] select{
  direction:ltr;
  text-align:right;
  text-align-last:right;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}

html[dir="ltr"] select{
  direction:ltr;
  text-align:left;
  text-align-last:left;
}

/* =========================
   Chat / Comments Panel
   ========================= */
.chat-wrap{
  max-width:900px;
  margin:18px auto 0;
}

.chat-card{
  background:#f8fafc;
  border:1px solid var(--border);
  border-radius:16px;
  padding:14px;
  box-shadow:0 12px 26px rgba(0,0,0,.04);
}

.chat-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  margin-bottom:10px;
}

.chat-title{
  display:flex;
  align-items:center;
  gap:8px;
  font-weight:800;
  font-size:14px;
}

.chat-sub{
  color:var(--muted);
  font-size:12px;
}

.chat-list{
  display:flex;
  flex-direction:column;
  gap:10px;
  max-height:420px;
  overflow:auto;
  padding:6px;
  border-radius:12px;
  background:rgba(255,255,255,.65);
  border:1px dashed #e5e7eb;
}

.chat-msg{
  display:flex;
  gap:10px;
  align-items:flex-end;
}

.chat-msg .avatar{
  width:34px;
  height:34px;
  border-radius:10px;
  background:#fff;
  border:1px solid var(--border);
  display:flex;
  align-items:center;
  justify-content:center;
  font-size:16px;
  flex:0 0 auto;
}

.chat-bubble{
  max-width:78%;
  background:#fff;
  border:1px solid var(--border);
  border-radius:14px;
  padding:10px 12px;
  box-shadow:0 6px 14px rgba(0,0,0,.03);
}

.chat-meta{
  display:flex;
  gap:10px;
  align-items:center;
  justify-content:space-between;
  margin-bottom:6px;
}

.chat-name{
  font-weight:800;
  font-size:13px;
}

.chat-time{
  color:var(--muted);
  font-size:11px;
  white-space:nowrap;
}

.chat-text{
  font-size:14px;
  line-height:1.7;
  white-space:pre-wrap;
  overflow-wrap:anywhere;
  word-break:break-word;
}

.chat-msg.is-me{
  justify-content:flex-end;
}

.chat-msg.is-me .avatar{
  display:none;
}

.chat-msg.is-me .chat-bubble{
  background:#eff6ff;
  border-color:#bfdbfe;
}

html[dir="rtl"] .chat-msg{
  flex-direction:row-reverse;
}

html[dir="rtl"] .chat-msg.is-me{
  flex-direction:row-reverse;
  justify-content:flex-start;
}

html[dir="rtl"] .chat-msg:not(.is-me){
  justify-content:flex-start;
}

html[dir="ltr"] .chat-msg.is-me{
  justify-content:flex-end;
}

html[dir="ltr"] .chat-msg:not(.is-me){
  justify-content:flex-start;
}

.chat-compose{
  margin-top:10px;
  display:flex;
  gap:10px;
  align-items:flex-end;
}

.chat-compose textarea{
  min-height:42px;
  max-height:120px;
  resize:vertical;
}

.chat-compose .btn{
  height:42px;
  padding:0 14px;
  border-radius:12px;
}

/* =========================
   PR / Document Layouts
   ========================= */
.header-actions{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
  align-items:center;
  justify-content:flex-end;
}

.reject-form{
  display:flex;
  gap:6px;
  align-items:center;
}

.reject-form input{
  width:220px;
  border:1px solid var(--border);
  border-radius:12px;
  padding:8px 10px;
  font-size:14px;
}

.pr-layout{
  max-width:1200px;
  margin:0 auto;
  padding:16px;
  display:grid;
  grid-template-columns:420px 1fr;
  gap:16px;
  align-items:start;
}

.pr-chat-col{
  position:sticky;
  top:90px;
  z-index:800;
}

.pr-main-col{
  min-width:0;
}

.pr-header{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:16px;
  flex-wrap:wrap;
}

.pr-info{
  min-width:260px;
}

.pr-meta{
  margin-top:10px;
  font-size:12px;
  color:var(--muted);
  display:flex;
  gap:12px;
  flex-wrap:wrap;
}

.pr-meta b{
  color:var(--text);
}

.sticky-actions{
  position:sticky;
  top:72px;
  z-index:900;
  background:#fff;
  padding:8px 0;
  border-bottom:1px solid var(--border);
}

.actions-row{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
  align-items:center;
  justify-content:flex-end;
}

.doc-layout{
  display:grid;
  grid-template-columns:1fr 420px;
  gap:16px;
  align-items:start;
  max-width:100%;
}

.doc-main-col,
.doc-side-col{
  min-width:0;
}

.doc-side-col{
  position:sticky;
  top:90px;
  z-index:800;
}

@media (max-width:1100px){
  .pr-layout,
  .doc-layout{
    grid-template-columns:1fr;
  }

  .pr-chat-col,
  .doc-side-col{
    position:static;
  }
}

/* =========================
   Overflow / Dropdown safety
   ========================= */
.page,
.page-header,
.page-body,
.card,
.form-grid,
.field,
.app-shell{
  overflow:visible !important;
  transform:none !important;
  filter:none !important;
}

.table-wrap{
  overflow:auto;
}

.allow-dropdown{
  overflow:visible !important;
}

/* generic dropdown support */
.dropdown{
  position:relative;
  display:inline-block;
}

.dropdown > summary{
  cursor:pointer;
  list-style:none;
}

.dropdown > summary::-webkit-details-marker{
  display:none;
}

.dropdown-menu{
  display:none;
  position:absolute;
  top:calc(100% + 8px);
  inset-inline-start:0;
  min-width:220px;
  background:#fff;
  border:1px solid var(--border);
  border-radius:14px;
  box-shadow:var(--shadow-lg);
  padding:8px;
  z-index:99999;
}

details.dropdown[open] .dropdown-menu,
details.dropdown[open] > ul,
details.dropdown[open] > div[role="menu"]{
  display:block;
}

.dropdown a,
.dropdown button{
  display:block;
  width:100%;
  padding:10px 12px;
  border-radius:12px;
  text-decoration:none;
  background:transparent;
  border:0;
  cursor:pointer;
  text-align:start;
  color:var(--text);
}

.dropdown a:hover,
.dropdown button:hover{
  background:#f3f4f6;
}
/* ===== shell styles extracted from CRM app.blade.php ===== */
        :root{--bg:#f5f7fb;--surface:#fff;--text:#111827;--muted:#6b7280;--border:#e5e7eb;--primary:#2563eb;--primary-hover:#1d4ed8;--success:#16a34a;--warning:#f59e0b;--danger:#dc2626;--danger-hover:#b91c1c;--dark:#111827;--radius:14px;--radius-lg:20px;--shadow-sm:0 4px 10px rgba(15,23,42,.04);--shadow:0 10px 24px rgba(15,23,42,.06);}
        *{box-sizing:border-box} html,body{min-height:100%;overflow-x:hidden} body{margin:0;background:var(--bg);color:var(--text);font-family:ui-sans-serif,system-ui,-apple-system,"Segoe UI",Roboto,Arial,"Noto Sans",sans-serif;direction:inherit} a{color:inherit}
        .container-page,.page,.container{max-width:1320px;margin:0 auto;padding:18px 16px 34px}
        .page-header{display:flex;align-items:flex-start;justify-content:space-between;gap:12px;flex-wrap:wrap;background:#fff;border:1px solid var(--border);border-radius:18px;padding:16px 18px;margin-bottom:16px;box-shadow:var(--shadow-sm)}
        .page-header h1,.page-header h2,.page-header h3,.page-header h4,.page-title{margin:0;font-size:22px;font-weight:900;color:var(--text)} .page-subtitle{margin-top:4px;font-size:13px;color:var(--muted)}
        .page-actions,.header-actions,.actions-row{display:flex;gap:8px;align-items:center;flex-wrap:wrap}
        .card,.card,.card-ui{background:#fff;border:1px solid var(--border);border-radius:18px;box-shadow:var(--shadow-sm);padding:18px}.card-body{padding:0}
        .table-wrap,.table-responsive{background:#fff;border:1px solid var(--border);border-radius:18px;overflow:auto;box-shadow:var(--shadow-sm)} table,.table{width:100%;border-collapse:collapse;background:#fff} th,td,.table th,.table td{padding:13px 12px;border-bottom:1px solid #eef2f7;vertical-align:middle;font-size:14px} th,.table th{background:#f8fafc;color:#374151;font-weight:800;white-space:nowrap} tbody tr:hover td,.table tbody tr:hover td{background:#fcfcfd}
        .btn{display:inline-flex;align-items:center;justify-content:center;gap:8px;padding:10px 14px;border-radius:12px;border:1px solid var(--border);background:#fff;color:var(--text);text-decoration:none;cursor:pointer;font-weight:800;font-size:14px;transition:.18s ease}.btn:hover{background:#f9fafb}.btn-primary{background:var(--primary);border-color:var(--primary);color:#fff}.btn-primary:hover{background:var(--primary-hover);border-color:var(--primary-hover)}.btn-secondary,.btn-dark{background:var(--dark);border-color:var(--dark);color:#fff}.btn-secondary:hover,.btn-dark:hover{background:#1f2937;border-color:#1f2937;color:#fff}.btn-soft,.btn-light{background:#fff;border-color:var(--border);color:var(--text)}.btn-soft:hover,.btn-light:hover{background:#f3f4f6}.btn-warning{background:var(--warning);border-color:var(--warning);color:#fff}.btn-success{background:var(--success);border-color:var(--success);color:#fff}.btn-danger{background:var(--danger);border-color:var(--danger);color:#fff}.btn-danger:hover{background:var(--danger-hover);border-color:var(--danger-hover)}.btn-link{background:transparent;border-color:transparent;color:var(--primary);padding-inline:6px}.btn-sm{padding:8px 11px;font-size:12px;border-radius:10px}.btn-outline-primary{background:#fff;border-color:#bfdbfe;color:#1d4ed8}.btn-outline-primary:hover{background:#eff6ff}.btn-outline-secondary{background:#fff;border-color:#d1d5db;color:#111827}.btn-outline-secondary:hover{background:#f3f4f6}.btn-outline-danger{background:#fff;border-color:#fecaca;color:#b91c1c}.btn-outline-danger:hover{background:#fef2f2}.btn-outline-success{background:#fff;border-color:#a7f3d0;color:#065f46}.btn-outline-success:hover{background:#ecfdf5}.border-0{border:0!important}.col-sm-6{width:50%}@media (max-width:700px){.col-sm-6{width:100%}}.py-2{padding-top:8px!important;padding-bottom:8px!important}.px-3{padding-left:12px!important;padding-right:12px!important}
        label,.form-label{display:block;margin-bottom:6px;font-size:13px;font-weight:800;color:#4b5563} input,select,textarea,.form-control,.form-select{width:100%;max-width:100%;border:1px solid #d1d5db;border-radius:12px;padding:10px 12px;font-size:14px;background:#fff;color:var(--text);transition:.18s ease} input:focus,select:focus,textarea:focus,.form-control:focus,.form-select:focus{outline:none;border-color:#93c5fd;box-shadow:0 0 0 4px rgba(37,99,235,.10)} textarea{min-height:110px;resize:vertical} small,.form-text,.text-muted,.muted{color:var(--muted);font-size:12px}
        .alert{padding:12px 14px;border-radius:12px;border:1px solid var(--border);background:#fff;font-size:14px}.alert-success{background:#ecfdf5;border-color:#a7f3d0;color:#065f46}.alert-danger{background:#fef2f2;border-color:#fecaca;color:#991b1b}.alert-info{background:#eff6ff;border-color:#bfdbfe;color:#1d4ed8}
        .badge{display:inline-flex;align-items:center;justify-content:center;padding:6px 10px;border-radius:999px;font-size:12px;font-weight:800;border:1px solid transparent;line-height:1}.badge.bg-success,.badge.success{background:#ecfdf5;color:#065f46;border-color:#a7f3d0}.badge.bg-secondary,.badge.gray{background:#f3f4f6;color:#374151;border-color:#e5e7eb}.badge.warning{background:#fffbeb;color:#92400e;border-color:#fde68a}.badge.danger{background:#fef2f2;color:#991b1b;border-color:#fecaca}
        .row{display:flex;flex-wrap:wrap;margin-right:-8px;margin-left:-8px}.row>[class*='col-']{padding-right:8px;padding-left:8px}.g-2>[class*='col-']{padding-right:6px;padding-left:6px}.g-3>[class*='col-']{padding-right:8px;padding-left:8px}.row.g-2{margin-right:-6px;margin-left:-6px}.row.g-3{margin-right:-8px;margin-left:-8px}.col-md-1{width:8.3333%}.col-md-2{width:16.6667%}.col-md-3{width:25%}.col-md-4{width:33.3333%}.col-md-5{width:41.6667%}.col-md-6{width:50%}.col-md-7{width:58.3333%}.col-md-8{width:66.6667%}.col-md-9{width:75%}.col-md-10{width:83.3333%}.col-md-11{width:91.6667%}.col-md-12{width:100%}.col-lg-3{width:25%}.col-lg-4{width:33.3333%}.col-lg-6{width:50%}@media (max-width:992px){.col-lg-3,.col-lg-4,.col-lg-6{width:100%}}@media (max-width:900px){.col-md-1,.col-md-2,.col-md-3,.col-md-4,.col-md-5,.col-md-6,.col-md-7,.col-md-8,.col-md-9,.col-md-10,.col-md-11,.col-md-12{width:100%}}
        .d-flex{display:flex!important}.align-items-center{align-items:center!important}.align-items-end{align-items:flex-end!important}.justify-content-between{justify-content:space-between!important}.justify-content-center{justify-content:center!important}.flex-wrap{flex-wrap:wrap!important}.gap-2{gap:8px!important}.gap-3{gap:12px!important}.gap-4{gap:16px!important}.w-100{width:100%!important}.h-100{height:100%!important}.inline{display:inline}.mb-0{margin-bottom:0!important}.mb-1{margin-bottom:4px!important}.mb-2{margin-bottom:8px!important}.mb-3{margin-bottom:16px!important}.mb-4{margin-bottom:24px!important}.mt-1{margin-top:4px!important}.mt-2{margin-top:8px!important}.mt-3{margin-top:16px!important}.mt-4{margin-top:24px!important}.p-3{padding:16px!important}.p-4{padding:20px!important}.p-6{padding:24px!important}.py-12{padding-top:32px!important;padding-bottom:32px!important}.fw-bold,.font-bold,.font-semibold{font-weight:800!important}.text-center{text-align:center!important}.text-end{text-align:end!important}.text-start{text-align:start!important}.text-danger{color:#991b1b!important}.text-indigo-600{color:#4f46e5!important}.text-gray-500{color:var(--muted)!important}.whitespace-nowrap{white-space:nowrap!important}.list-disc{list-style:disc}.ps-3{padding-inline-start:16px}.rounded{border-radius:12px!important}.rounded-xl{border-radius:20px!important}.overflow-hidden{overflow:hidden}
        .grid{display:grid}.grid-cols-1{grid-template-columns:1fr}.md\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.md\:col-span-2{grid-column:span 2}.gap-4{gap:16px}.gap-6{gap:24px}.max-w-5xl{max-width:1100px}.max-w-4xl{max-width:1000px}.max-w-7xl{max-width:1320px}.mx-auto{margin-inline:auto}.px-4{padding-inline:16px}.sm\:px-6{padding-inline:24px}.lg\:px-8{padding-inline:32px}.py-6{padding-top:24px;padding-bottom:24px}.shadow-sm{box-shadow:var(--shadow-sm)!important}.bg-white{background:#fff}.text-xl{font-size:20px}.leading-tight{line-height:1.3}.underline{text-decoration:underline}.bg-black{background:#111827!important;color:#fff!important}.text-white{color:#fff!important}
        @media (max-width:900px){.md\:grid-cols-2{grid-template-columns:1fr}.md\:col-span-2{grid-column:span 1}}
        .form-check{display:flex;align-items:center;gap:8px;min-height:42px}.form-check-input{width:auto;margin:0}.form-check-label{margin:0;font-size:13px;font-weight:700;color:var(--text)}
        .empty-state{text-align:center;padding:28px 16px;color:var(--muted);background:#fff;border:1px dashed #d1d5db;border-radius:16px}.kpi-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(170px,1fr));gap:12px}.kpi-card{background:linear-gradient(180deg,#fff,#fafbfd);border:1px solid var(--border);border-radius:18px;box-shadow:var(--shadow-sm);padding:16px}.kpi-label{color:var(--muted);font-size:12px;font-weight:700}.kpi-value{font-size:26px;font-weight:900;margin-top:6px;color:var(--text)}
        .doc-page-grid{width:100%;max-width:100%;display:grid;grid-template-columns:minmax(0,1fr) 380px;gap:16px;align-items:start}.doc-page-grid>.main-col,.doc-page-grid>.side-col{min-width:0}.doc-page-grid .side-col{position:sticky;top:92px;align-self:start}@media (max-width:1100px){.doc-page-grid{grid-template-columns:1fr}.doc-page-grid .side-col{position:static}}.doc-meta-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(220px,1fr));gap:12px}.doc-meta-item{background:#fff;border:1px solid var(--border);border-radius:16px;padding:14px}.doc-meta-label{color:var(--muted);font-size:12px;font-weight:700;margin-bottom:6px}.doc-meta-value{color:var(--text);font-weight:800;font-size:14px}
        .chat-wrap{max-width:100%;margin:0}.chat-card{background:#f8fafc;border:1px solid var(--border);border-radius:18px;padding:14px;box-shadow:var(--shadow-sm)}.chat-head{display:flex;justify-content:space-between;align-items:center;gap:10px;margin-bottom:10px}.chat-title{font-weight:900;font-size:15px;display:flex;align-items:center;gap:8px}.chat-sub{color:var(--muted);font-size:12px}.chat-list{display:flex;flex-direction:column;gap:10px;max-height:480px;overflow:auto;padding:6px;border-radius:14px;background:rgba(255,255,255,.75);border:1px dashed #e5e7eb}.chat-msg{display:flex;gap:10px;align-items:flex-end}.chat-msg .avatar{width:34px;height:34px;border-radius:10px;background:#fff;border:1px solid var(--border);display:flex;align-items:center;justify-content:center;font-size:16px;flex:0 0 auto}.chat-bubble{max-width:82%;background:#fff;border:1px solid var(--border);border-radius:16px;padding:10px 12px;box-shadow:0 6px 14px rgba(0,0,0,.03)}.chat-msg.is-me .avatar{display:none}.chat-msg.is-me{justify-content:flex-start}.chat-msg.is-me .chat-bubble{background:#eff6ff;border-color:#bfdbfe}.chat-meta{display:flex;gap:10px;justify-content:space-between;align-items:center;margin-bottom:6px}.chat-name{font-weight:800;font-size:13px}.chat-time{color:var(--muted);font-size:11px}.chat-text{font-size:14px;line-height:1.75;white-space:pre-wrap;overflow-wrap:anywhere;word-break:break-word}.chat-empty{text-align:center;color:var(--muted);padding:18px 10px}.chat-compose{margin-top:10px;display:flex;gap:10px;align-items:flex-end}.chat-compose textarea{min-height:42px;max-height:120px;resize:vertical}
        .topbar,.page-header,.page-body,.card,.container-page,.page,.container{overflow:visible!important}
        /* 📱 غلاف الجدول يبقى ممرِّراً: الجداول أعرض من الجوال، وقصُّها بلا تمرير
           يخفي المحتوى بلا بيان. ومن احتاج منسدلاً داخل جدول يضيف .allow-dropdown */
        .table-wrap{overflow-x:auto!important;overflow-y:visible;-webkit-overflow-scrolling:touch}
        .table-wrap.allow-dropdown{overflow:visible!important}

        /* 🛟 شبكة أمان للجوال: جدولٌ نسي غلافه لا يُقصّ بلا تمرير — يصير هو نفسه
           حاويةَ التمرير. القاعدة أضيق من أن تمسّ الجداول المغلّفة أصلاً. */
        @media (max-width: 820px){
          /* حقولٌ فُرض عليها عرض أدنى في النمط السطري تُرخى، وإلا دفعت الصفحة */
          .form-select,.form-control,select,input[type=text],input[type=search]{min-width:0!important;max-width:100%}
          .page-header{flex-wrap:wrap;gap:8px}
          table:not(.table-wrap table){display:block;overflow-x:auto;-webkit-overflow-scrolling:touch;max-width:100%}
          table:not(.table-wrap table) > thead,
          table:not(.table-wrap table) > tbody{display:table;width:max-content;min-width:100%}
        }
        .app-shell{
            max-width: 1440px;
            margin: 0 auto;
            padding: 18px 16px 34px;
            display: grid;
            grid-template-columns: 280px minmax(0,1fr);
            gap: 18px;
            align-items: start;
        }
        .app-main{
            min-width: 0;
        }
        .app-main .container-page,
        .app-main .page,
        .app-main .container{
            max-width: none;
            margin: 0;
            padding: 0;
        }
        body.sidebar-collapsed .app-shell{
            grid-template-columns: 1fr;
        }
        @media (max-width: 1100px){
            .app-shell{
                grid-template-columns: 1fr;
                padding: 18px 16px 34px;
            }
            .app-main{
                padding-top: 0;
            }
        }
        @media (max-width: 900px){
            .app-shell{
                padding: 14px 12px 28px;
                gap: 14px;
            }
            .page-header{
                padding: 14px;
            }
            .page-header h1,
            .page-header h2,
            .page-header h3,
            .page-header h4,
            .page-title{
                font-size: 18px;
                line-height: 1.35;
            }
        }

/* ===== shell styles extracted from CRM _topbar.blade.php ===== */
    .topbar{
        position: sticky;
        top: 0;
        z-index: 1200;
        background: rgba(255,255,255,.96);
        backdrop-filter: blur(10px) saturate(180%);
        border-bottom: 1px solid #E5E7EB;
        box-shadow: 0 8px 20px rgba(15,23,42,.04);
    }
    .topbar .wrap{
        max-width: 1440px;
        margin: 0 auto;
        padding: 10px 16px;
        min-height: 68px;
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
    }
    .tb-left,.tb-right{
        display:flex;
        align-items:center;
        gap:10px;
        min-width:0;
    }
    .tb-left{
        flex: 1 1 auto;
    }
    .tb-right{
        flex: 0 0 auto;
    }
    .brand{
        display:inline-flex;
        align-items:center;
        gap:10px;
        text-decoration:none;
        color:#111827;
        padding:4px 6px;
        border-radius:12px;
        transition:.18s ease;
    }
    .brand:hover{ background:#F8FAFC; }
    .brand img{ height:38px; width:auto; display:block; }
    .sidebar-toggle,
    .topbar .btn,
    .topbar .dd > button{
        display:inline-flex;
        align-items:center;
        justify-content:center;
        gap:8px;
        padding:9px 13px;
        border-radius:12px;
        border:1px solid transparent;
        background:transparent;
        color:#111827;
        font-size:14px;
        font-weight:700;
        text-decoration:none;
        cursor:pointer;
        white-space:nowrap;
        transition:.18s ease;
    }
    .sidebar-toggle:hover,
    .topbar .btn:hover,
    .topbar .dd > button:hover{
        background:#F8FAFC;
        border-color:#E5E7EB;
    }
    .topbar .btn-primary{
        background:#2563EB;
        border-color:#2563EB;
        color:#fff;
    }
    .topbar .btn-primary:hover{
        background:#1D4ED8;
        border-color:#1D4ED8;
        color:#fff;
    }
    .topbar .btn-soft{
        background:#F3F4F6;
        border-color:#E5E7EB;
    }
    .topbar .btn-soft:hover{
        background:#E5E7EB;
    }
    .topbar .badge{
        background:#EF4444;
        color:#fff;
        border-radius:999px;
        font-size:11px;
        min-width:18px;
        height:18px;
        display:inline-flex;
        align-items:center;
        justify-content:center;
        padding:0 6px;
        line-height:1;
    }
    .topbar .dd{ position:relative; display:inline-block; }
    .topbar .dd-menu{
        display:none;
        position:absolute;
        top:calc(100% + 10px);
        left:0;
        min-width:260px;
        background:#fff;
        border:1px solid #E5E7EB;
        border-radius:16px;
        box-shadow:0 22px 45px rgba(0,0,0,.12);
        padding:8px;
        z-index:9999;
    }
    .topbar .dd.open .dd-menu{ display:block; }
    .topbar .dd-menu a{
        display:block;
        padding:10px 12px;
        border-radius:12px;
        color:#111827;
        text-decoration:none;
        border:1px solid transparent;
        transition:.18s ease;
        font-size:14px;
    }
    .topbar .dd-menu a:hover{
        background:#F9FAFB;
        border-color:#E5E7EB;
    }
    .topbar .muted{ color:#6B7280; font-size:12px; }
    .topbar .pill{
        display:inline-flex;
        align-items:center;
        gap:6px;
        padding:6px 10px;
        border-radius:999px;
        background:#F9FAFB;
        border:1px solid #E5E7EB;
        font-size:12px;
        color:#374151;
        font-weight:700;
    }
    .topbar-title{
        display:flex;
        flex-direction:column;
        min-width:0;
    }
    .topbar-title .page{
        font-size:16px;
        font-weight:900;
        color:#111827;
        line-height:1.2;
    }
    .topbar-title .sub{
        color:#6B7280;
        font-size:12px;
        margin-top:2px;
    }
    .panel{
        display:none;
        max-width: 520px;
        margin: 10px 16px 0 auto;
        padding: 14px 16px;
        border:1px solid #E5E7EB;
        border-radius:18px;
        background:#fff;
        box-shadow:0 16px 40px rgba(15,23,42,.08);
    }
    .noti{
        border:1px solid #E5E7EB;
        border-radius:14px;
        padding:12px;
        background:#fff;
        margin-bottom:10px;
    }
    .noti.unread{
        background:#F8FBFF;
        border-color:#DBEAFE;
    }
    .noti .t{ font-weight:800; color:#111827; }
    .noti .b{ color:#6B7280; font-size:13px; margin-top:4px; line-height:1.6; }
    .noti .d{ color:#9CA3AF; font-size:12px; margin-top:6px; }
    .noti .actions{ margin-top:10px; display:flex; gap:8px; flex-wrap:wrap; }
    .noti-pulse{ animation:notiPulse 1.2s ease; }
    @keyframes notiPulse{
        0% { transform: scale(1); }
        20% { transform: scale(1.08); }
        40% { transform: scale(1); }
        60% { transform: scale(1.08); }
        100% { transform: scale(1); }
    }
    @media (max-width: 900px){
        .topbar .wrap{
            flex-wrap:nowrap;
            align-items:center;
            padding:8px 12px;
            min-height:60px;
        }
        .tb-left{
            flex:1 1 auto;
            min-width:0;
        }
        .tb-right{
            flex:0 0 auto;
        }
        .brand img{
            height:32px;
        }
        .topbar-title .page{
            font-size:14px;
        }
        .topbar-title .sub{
            display:none;
        }
        .topbar .btn,
        .topbar .dd > button,
        .sidebar-toggle{
            padding:8px 10px;
            font-size:13px;
        }
        .tb-right{
            justify-content:flex-end;
            flex-wrap:nowrap;
            gap:8px;
        }
        .tb-right form{
            display:none;
        }
    }

/* ===== shell styles extracted from CRM _sidebar.blade.php ===== */
    .app-sidebar{
        position: sticky;
        top: 88px;
        align-self: start;
        width: 292px;
        background: #fff;
        border: 1px solid #E5E7EB;
        border-radius: 20px;
        box-shadow: 0 12px 28px rgba(15,23,42,.06);
        padding: 16px;
        max-height: calc(100vh - 110px);
        overflow: auto;
    }
    .app-sidebar-group + .app-sidebar-group{
        margin-top: 12px;
    }
    .app-sidebar-group{
        border: 1px solid #EEF2F7;
        border-radius: 16px;
        background: #FCFDFE;
        overflow: hidden;
    }
    .app-sidebar-group[open]{
        background: #fff;
        border-color: #DBEAFE;
        box-shadow: inset 0 0 0 1px rgba(191,219,254,.35);
    }
    .app-sidebar-summary{
        list-style: none;
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        padding: 12px 14px;
        cursor: pointer;
        font-size: 14px;
        font-weight: 800;
        color: #111827;
        user-select: none;
    }
    .app-sidebar-summary::-webkit-details-marker{
        display:none;
    }
    .app-sidebar-summary-main{
        display:flex;
        align-items:center;
        gap:10px;
        min-width:0;
    }
    .app-sidebar-summary-icon{
        width: 22px;
        text-align: center;
        color: #475569;
        flex: 0 0 22px;
    }
    .app-sidebar-summary-arrow{
        color: #64748B;
        transition: transform .18s ease;
        flex: 0 0 auto;
    }
    .app-sidebar-group[open] .app-sidebar-summary-arrow{
        transform: rotate(180deg);
    }
    .app-sidebar-group.is-active > .app-sidebar-summary{
        background: #EFF6FF;
        color: #1D4ED8;
    }
    .app-sidebar-group.is-active > .app-sidebar-summary .app-sidebar-summary-icon,
    .app-sidebar-group.is-active > .app-sidebar-summary .app-sidebar-summary-arrow{
        color: #1D4ED8;
    }
    .app-sidebar-children{
        display:grid;
        gap:4px;
        padding: 0 10px 10px;
    }
    .app-sidebar-link,
    .app-sidebar-sublink{
        display:flex;
        align-items:center;
        gap:10px;
        padding:10px 12px;
        border-radius:12px;
        text-decoration:none;
        color:#111827;
        border:1px solid transparent;
        transition:.18s ease;
        font-size:14px;
        font-weight:700;
    }
    .app-sidebar-sublink{
        background: #fff;
        font-size: 13px;
        font-weight: 700;
    }
    .app-sidebar-link:hover,
    .app-sidebar-sublink:hover{
        background:#F8FAFC;
        border-color:#E5E7EB;
    }
    .app-sidebar-link.active,
    .app-sidebar-sublink.active{
        background:#EFF6FF;
        border-color:#BFDBFE;
        color:#1D4ED8;
    }
    .app-sidebar-icon{
        width:20px;
        text-align:center;
        color:#64748B;
        flex:0 0 20px;
    }
    .app-sidebar-link.active .app-sidebar-icon,
    .app-sidebar-sublink.active .app-sidebar-icon{
        color:#1D4ED8;
    }
    /* عنوان قسم داخل القائمة الجانبية (الشبكة · بناء الشبكة · التواصل) */
    .app-sidebar-section{
        margin: 16px 10px 6px;
        font-size: 11px;
        font-weight: 800;
        color: #94A3B8;
        letter-spacing: .5px;
        user-select: none;
    }
    .app-sidebar > .app-sidebar-link{
        margin-bottom: 4px;
    }
    .app-sidebar > .app-sidebar-group{
        margin-top: 16px;
    }
    .app-sidebar-overlay{
        display:none;
    }
    body.sidebar-collapsed .app-sidebar{
        display:none;
    }
    @media (max-width: 1100px){
        .app-sidebar{
            position: fixed;
            top: 0;
            right: 0;
            width: min(88vw, 340px);
            max-height: 100vh;
            height: 100vh;
            border-radius: 0;
            z-index: 1300;
            transform: translateX(100%);
            transition: transform .22s ease;
        }
        body.sidebar-collapsed .app-sidebar{
            display:block;
        }
        .app-sidebar-overlay{
            display:block;
            position:fixed;
            inset:0;
            background:rgba(15,23,42,.48);
            z-index: 1250;
            opacity:0;
            pointer-events:none;
            transition: opacity .22s ease;
        }
        body.sidebar-open .app-sidebar{
            transform: translateX(0);
        }
        body.sidebar-open .app-sidebar-overlay{
            opacity:1;
            pointer-events:auto;
        }
    }

    /* 📱 الجوال الضيّق: الشريط العلوي يحمل ما يلزم فقط — الاسم والأدوات.
       عنوان المنصة يزاحم العلامة والأزرار فيتداخلان، فيُطوى. */
    @media (max-width: 640px){
        /* الشريط يحمل ما يلزم فقط: العلامة والأدوات. وعنوان المنصة واسمُ المستخدم
           يزاحمان العلامة حتى تختفي تحت الأزرار — فيُطويان ويبقى الزرّ بأيقونته. */
        .topbar-title{ display:none; }
        .userbox-name{ display:none; }
        .brand{ font-size:16px; flex:0 0 auto; }
        .tb-left{ flex:0 0 auto; }
        .tb-right{ flex:1 1 auto; justify-content:flex-end; gap:6px; min-width:0; }
        .topbar .wrap{ gap:8px; }
    }

    /* 📱 صفوف الاختيار على الجوال: خيارٌ في كل سطر — الدائرة ثم عنوانه،
       وشرحُه تحته لا بجانبه، فلا تتزاحم الكلمات في عمودٍ ضيق. */
    @media (max-width: 820px){
        .row > [class*='col-'] label:has(> input[type=radio]){
            width:100%;
            /* الأنماط السطرية في القوالب تعلو الورقة، فيلزم التصريح هنا */
            display:grid!important;
            grid-template-columns:auto minmax(0,1fr);
            align-items:start;
            gap:4px 8px;
        }
        .row > [class*='col-'] label:has(> input[type=radio]) > .muted{
            grid-column:2; margin:0;
        }
    }
