:root{color-scheme:dark;--bg:#0b1220;--surface:#111b2c;--surface2:#162238;--surface3:#1b2941;--outline:#27364c;--text:#eef4ff;--muted:#93a5bf;--blue:#4e84ff;--blue2:#2a56bf;--green:#33c6a1;--amber:#edb85e;--red:#f37f86;--font:Tahoma,Arial,sans-serif}*{box-sizing:border-box}body{margin:0;background:var(--bg);color:var(--text);font-family:var(--font);font-size:14px}button,input,textarea,select{font:inherit}button{cursor:pointer}a{color:var(--blue);text-decoration:none}.startup{padding:50px;text-align:center}.app-shell{display:grid;grid-template-columns:242px minmax(0,1fr);min-height:100vh}.sidebar{background:#101a2b;border-left:1px solid var(--outline);padding:24px 14px;display:flex;flex-direction:column;gap:24px;position:sticky;top:0;height:100vh}.brand{display:flex;gap:12px;align-items:center;padding:3px 10px 23px;border-bottom:1px solid var(--outline)}.brand-icon{display:grid;place-items:center;background:linear-gradient(130deg,#477bff,#70a5ff);border-radius:13px;width:40px;height:40px;color:white;font-size:17px;font-weight:900;box-shadow:0 5px 22px #2359f744}.brand b{font-size:19px;letter-spacing:.4px}.brand small{display:block;color:var(--muted);margin-top:5px;font-size:11px}.nav-title{font-size:11px;color:#7386a2;padding:0 14px 8px}.nav-button{width:100%;display:flex;gap:12px;align-items:center;border:0;color:#a9bad1;background:transparent;text-align:right;border-radius:10px;padding:12px 14px;margin:3px 0;transition:.14s}.nav-button .ni{font-size:16px;opacity:.95;width:23px;text-align:center}.nav-button:hover{background:#1c2b44;color:white}.nav-button.active{background:#1d3357;color:#e9f1ff;box-shadow:inset -3px 0 0 #5489ff}.sidebar-bottom{margin-top:auto;border-top:1px solid var(--outline);padding:20px 12px 0;color:var(--muted);line-height:1.9;font-size:12px}.dot{display:inline-block;height:8px;width:8px;border-radius:50%;background:var(--green);margin-left:7px}.main{min-width:0}.topbar{height:80px;display:flex;justify-content:space-between;align-items:center;padding:18px 32px;border-bottom:1px solid var(--outline);background:#0e1727}.topbar .crumb{font-size:12px;color:var(--muted);margin-bottom:6px}.topbar h1{font-size:23px;font-weight:800;margin:0}.topbar-right{display:flex;align-items:center;gap:12px}.userbubble{width:36px;height:36px;border-radius:50%;background:#24375b;display:grid;place-items:center;color:#adc5ff;font-weight:bold}.content{padding:32px;max-width:1560px;margin:auto}.btn{border:1px solid var(--outline);background:var(--surface2);color:var(--text);padding:10px 15px;border-radius:9px;font-weight:700;min-height:39px}.btn:hover{background:#23334e}.btn.primary{border-color:#4d7dea;background:#416eea;color:white}.btn.primary:hover{background:#5785ff}.btn.danger{border-color:#6c3f49;background:#422732;color:#ffc6c9}.btn.small{padding:6px 10px;min-height:30px;font-size:12px}.btn:disabled{opacity:.45;cursor:not-allowed}.section-header{display:flex;justify-content:space-between;align-items:center;gap:14px;margin-bottom:20px}.section-header h2{font-size:18px;margin:0}.section-header p,.subtitle{color:var(--muted);font-size:12px;line-height:1.8;margin:8px 0 0}.section-header .actions{display:flex;gap:9px;align-items:center}.muted{color:var(--muted)}.kpi-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:14px;margin-bottom:24px}.kpi{border:1px solid var(--outline);background:linear-gradient(145deg,#16223a,#111b2d);border-radius:14px;padding:20px;min-height:132px;display:flex;flex-direction:column;justify-content:space-between}.kpi .kpi-top{display:flex;justify-content:space-between;color:var(--muted)}.kpi .glyph{background:#22375b;border-radius:9px;padding:6px 9px;color:#91b6ff}.kpi strong{font-size:32px;letter-spacing:-1px}.kpi .kpi-foot{color:#8ba6c9;font-size:11px}.panel-grid{display:grid;grid-template-columns:1fr 1fr;gap:18px}.panel{border:1px solid var(--outline);border-radius:14px;background:var(--surface);overflow:hidden}.panel h3{font-size:14px;margin:0;padding:19px 21px;border-bottom:1px solid var(--outline)}.panel-pad{padding:22px}.funnel-row{display:flex;align-items:center;gap:12px;margin-bottom:17px}.funnel-row:last-child{margin-bottom:0}.funnel-row .flabel{width:130px;color:#c1cfe0;font-size:12px}.funnel-track{height:9px;flex:1;border-radius:20px;background:#263650;overflow:hidden}.funnel-fill{height:100%;border-radius:20px;background:linear-gradient(90deg,#467bff,#58b7ea)}.funnel-num{color:#c3d0e2;font-weight:bold;width:20px;text-align:left}.list-activity{display:flex;align-items:flex-start;gap:11px;padding:13px 0;border-bottom:1px solid #25334a}.list-activity:last-child{border:0}.acticon{width:32px;height:32px;border-radius:9px;background:#233650;display:grid;place-items:center}.actbody{flex:1;min-width:0}.actbody b{display:block;margin-bottom:5px;font-size:12px}.actbody small{color:var(--muted)}.toolbar{display:flex;gap:10px;align-items:center;margin-bottom:16px;flex-wrap:wrap}.search{background:var(--surface);border:1px solid var(--outline);border-radius:9px;min-width:230px;width:min(400px,100%);padding:11px 13px;color:var(--text);outline:none}.search:focus,input:focus,textarea:focus,select:focus{border-color:#4f7fff;outline:2px solid #4f7fff21}.filterselect{background:var(--surface);border:1px solid var(--outline);border-radius:9px;padding:10px;color:var(--text)}.data-table-wrap{border:1px solid var(--outline);border-radius:13px;overflow:auto;background:var(--surface)}table{width:100%;border-collapse:collapse;text-align:right;white-space:nowrap}th{color:#899bb5;font-size:12px;text-align:right;background:#142034;font-weight:600;padding:15px}td{padding:15px;border-top:1px solid #26334a;font-size:12px;max-width:340px;overflow:hidden;text-overflow:ellipsis}tbody tr:hover{background:#17253b}.name-cell{font-weight:700;color:#e6efff}.pill{display:inline-block;border:1px solid #395175;color:#a9c6fa;background:#1e3150;border-radius:20px;padding:5px 10px;font-size:11px}.pill.green{border-color:#236d5c;color:#66dbbc;background:#153e3b}.pill.orange{border-color:#6e5230;color:#eac083;background:#382e23}.pill.red{border-color:#783b45;color:#fca8ad;background:#40252c}.pill.dim{border-color:#374355;color:#a3aec2;background:#222b3a}.table-actions{display:flex;gap:6px}.empty{padding:58px 20px;text-align:center;color:var(--muted)}.empty .empticon{font-size:38px;margin-bottom:12px}.empty strong{display:block;color:var(--text);font-size:16px;margin-bottom:8px}.overlay{position:fixed;inset:0;background:#030810c9;display:flex;align-items:center;justify-content:center;padding:18px;z-index:20}.modal{width:min(860px,100%);max-height:94vh;display:flex;flex-direction:column;background:#101b2d;border:1px solid #364864;border-radius:16px;box-shadow:0 25px 75px #0008;overflow:hidden}.modal-header{display:flex;align-items:center;justify-content:space-between;padding:20px 24px;border-bottom:1px solid var(--outline)}.modal-header h2{font-size:18px;margin:0}.close{background:transparent;color:#becfe5;border:0;font-size:27px;line-height:1}.modal-content{overflow:auto;padding:24px}.form-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:17px}.field{display:flex;flex-direction:column;gap:8px;min-width:0}.field.full{grid-column:1/-1}.field label{font-size:12px;font-weight:700;color:#cbd9ea}.field input,.field select,.field textarea{width:100%;background:#0d1625;border:1px solid #33445f;color:var(--text);border-radius:9px;padding:11px 12px;min-height:42px;outline:0}.field textarea{resize:vertical;min-height:86px;line-height:1.7}.checks{display:flex;flex-wrap:wrap;gap:8px}.chip-check{cursor:pointer}.chip-check input{position:absolute;opacity:0;width:1px;height:1px}.chip-check span{display:inline-block;padding:8px 12px;border:1px solid #33445f;border-radius:8px;color:#a5b7d1;font-size:11px}.chip-check input:checked+span{background:#204277;color:#e1edff;border-color:#477deb}.modal-footer{display:flex;justify-content:space-between;align-items:center;border-top:1px solid var(--outline);padding:16px 24px;background:#111d30}.footer-actions{display:flex;gap:9px}.details{display:grid;grid-template-columns:repeat(2,1fr);gap:12px}.detail{padding:13px;background:#18263a;border-radius:10px}.detail small{display:block;color:var(--muted);margin-bottom:8px}.detail strong{font-size:13px;line-height:1.6}.notice{border:1px solid #6a4f2f;background:#342d22;color:#f2d9b0;border-radius:12px;padding:16px;line-height:1.9}.settings-stack{display:grid;gap:14px;max-width:900px}.settings-row{background:var(--surface);border:1px solid var(--outline);border-radius:12px;padding:20px}.settings-row b{display:block;margin-bottom:7px}.settings-row p{color:var(--muted);line-height:1.8;margin:0}.toast{position:fixed;bottom:25px;left:25px;padding:13px 19px;background:#204e49;border:1px solid #2a9d88;color:#e2fff5;box-shadow:0 12px 40px #0008;border-radius:10px;z-index:40}.toast.error{background:#532d36;border-color:#bd6570;color:#ffebec}.mob-nav{display:none}@media(max-width:1000px){.app-shell{grid-template-columns:190px minmax(0,1fr)}.sidebar{padding:15px 7px}.content{padding:22px}.kpi-grid{grid-template-columns:repeat(2,1fr)}.panel-grid{grid-template-columns:1fr}}@media(max-width:650px){.app-shell{display:block}.sidebar{position:static;height:auto;padding:10px;gap:8px}.brand{padding:4px 8px}.sidebar-bottom,.nav-title{display:none}.navigation{display:flex;overflow:auto}.nav-button{min-width:max-content;width:auto;margin:0;padding:9px}.topbar{height:auto;padding:18px;align-items:flex-start}.topbar h1{font-size:19px}.content{padding:15px}.kpi-grid{gap:9px}.kpi{padding:14px;min-height:109px}.kpi strong{font-size:25px}.panel-grid{display:block}.panel{margin-bottom:14px}.form-grid{grid-template-columns:1fr}.details{grid-template-columns:1fr}.modal-content{padding:15px}.section-header{align-items:flex-start;flex-direction:column}}
/* AC7 BLACK THEME */
html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #090909;
  --surface: #171717;
  --surface2: #222222;
  --surface3: #292929;
  --outline: #383838;
  --text: #f5f5f5;
  --muted: #a3a3a3;
  --blue: #e5e5e5;
}

html[data-theme="dark"] .sidebar,
html[data-theme="dark"] .topbar,
html[data-theme="dark"] .modal,
html[data-theme="dark"] .modal-footer {
  background: #111111;
}

html[data-theme="dark"] .kpi {
  background: linear-gradient(145deg, #222, #151515);
}

html[data-theme="dark"] .nav-button.active,
html[data-theme="dark"] .nav-button:hover {
  background: #292929;
  color: #fff;
}

html[data-theme="dark"] .btn.primary {
  background: #363636;
  border-color: #555;
  color: white;
}

html[data-theme="dark"] .field input,
html[data-theme="dark"] .field select,
html[data-theme="dark"] .field textarea {
  background: #111;
  border-color: #444;
}

/* AC7 LIGHT THEME */
html[data-theme="light"] {
  color-scheme: light;
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface2: #edf0f4;
  --surface3: #e5e9ef;
  --outline: #dce1e8;
  --text: #20242a;
  --muted: #687384;
  --blue: #343b49;
}

html[data-theme="light"] .sidebar,
html[data-theme="light"] .topbar,
html[data-theme="light"] .modal,
html[data-theme="light"] .modal-footer {
  background: #ffffff;
}

html[data-theme="light"] .nav-button {
  color: #414b59;
}

html[data-theme="light"] .nav-button.active,
html[data-theme="light"] .nav-button:hover {
  background: #e9edf2;
  color: #20242a;
}

html[data-theme="light"] .kpi {
  background: #ffffff;
}

html[data-theme="light"] .kpi .glyph,
html[data-theme="light"] .acticon {
  background: #edf0f4;
  color: #343b49;
}

html[data-theme="light"] th,
html[data-theme="light"] tbody tr:hover {
  background: #f1f3f6;
}

html[data-theme="light"] td,
html[data-theme="light"] .list-activity {
  border-color: #e2e6eb;
}

html[data-theme="light"] .name-cell,
html[data-theme="light"] .field label,
html[data-theme="light"] .funnel-row .flabel,
html[data-theme="light"] .funnel-num {
  color: #20242a;
}

html[data-theme="light"] .field input,
html[data-theme="light"] .field select,
html[data-theme="light"] .field textarea {
  background: white;
  color: #20242a;
  border-color: #dce1e8;
}

html[data-theme="light"] .detail {
  background: #f1f3f6;
}

html[data-theme="light"] .btn.primary {
  background: #252a32;
  border-color: #252a32;
  color: white;
}
/* AC7 CRM Logo */

.crm-brand-logo {
  width: 62px;
  height: 62px;
  object-fit: contain;
  flex-shrink: 0;
  filter: drop-shadow(0 0 7px rgba(0, 180, 255, 0.18));
}

.crm-login-logo {
  display: block;
  width: 140px;
  height: 140px;
  object-fit: contain;
  margin: 0 auto 16px;
}

@media (max-width: 650px) {
  .crm-brand-logo {
    width: 48px;
    height: 48px;
  }
}

/* =========================================
   AC7 CRM - INDEPENDENT SIDEBAR SCROLL
   ========================================= */

@media (min-width: 651px) {

  /* تثبيت السايدبار على ارتفاع الشاشة */
  .sidebar {
    height: 100vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
  }

  /* سكرول مستقل لقائمة الصفحات فقط */
  .sidebar > .brand + div {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding-left: 5px;
    padding-right: 5px;
    overscroll-behavior: contain;

    scrollbar-width: thin;
    scrollbar-color: #526785 transparent;
  }

  /* تثبيت اللوجو فوق */
  .sidebar .brand {
    flex-shrink: 0;
  }

  /* تثبيت معلومات النسخة تحت */
  .sidebar .sidebar-bottom {
    flex-shrink: 0;
    margin-top: 0;
  }

  /* شكل شريط التمرير في Chrome */
  .sidebar > .brand + div::-webkit-scrollbar {
    width: 7px;
  }

  .sidebar > .brand + div::-webkit-scrollbar-track {
    background: transparent;
  }

  .sidebar > .brand + div::-webkit-scrollbar-thumb {
    background: #526785;
    border-radius: 10px;
  }

  .sidebar > .brand + div::-webkit-scrollbar-thumb:hover {
    background: #7295c8;
  }
}

/* =====================================
   AC7 CRM - SIDEBAR MENU TEXT FIX
   ===================================== */

.sidebar .navigation .nav-button {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;

  width: 100%;
  min-height: 52px;
  height: auto;

  padding: 12px 14px;

  direction: rtl;
  text-align: right;

  white-space: normal;
  overflow-wrap: normal;
  line-height: 1.6;
  font-size: 14px;
}

.sidebar .navigation .nav-button .ni {
  flex: 0 0 24px;

  display: flex;
  align-items: center;
  justify-content: center;

  width: 24px;
  min-width: 24px;

  font-size: 18px;
  line-height: 1;
}

/* السماح للأسماء الطويلة بالنزول لسطرين */
.sidebar .navigation .nav-button {
  word-break: normal;
}
