/* ============================================
   مكتب الدكتور عبدالله الماقوسى
   التصميم: ذهبي × أسود (بروفيشنال)
   Version: 2.3.0 - Mobile First + Video + Device Lock + Notifications
   ============================================ */

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

:root {
  --black: #0a0a0a;
  --black-2: #141414;
  --black-3: #1c1c1c;
  --border: #2a2a2a;
  --border-gold: rgba(212,175,55,0.3);
  --gold: #d4af37;
  --gold-2: #f4d03f;
  --gold-3: #b8941f;
  --text: #f0f0f0;
  --muted: #8a8a8a;
  --success: #22c55e;
  --danger: #ef4444;
  --warning: #f59e0b;
  --info: #3b82f6;
  --purple: #a78bfa;
  --radius: 14px;
  --shadow: 0 4px 24px rgba(0,0,0,0.6);
  --shadow-gold: 0 8px 32px rgba(212,175,55,0.15);
  --tr: all 0.25s ease;
}

html { font-size: 16px; -webkit-text-size-adjust: 100%; }

body {
  font-family: 'Segoe UI', Tahoma, sans-serif;
  background: var(--black);
  color: var(--text);
  line-height: 1.6;
  direction: rtl;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}

img, video { max-width: 100%; height: auto; display: block; }
button { font-family: inherit; }

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--black); }
::-webkit-scrollbar-thumb { background: var(--gold-3); border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: var(--gold); }

/* ============================================
   LOGIN / GATE
   ============================================ */
.login-page {
  min-height: 100vh; min-height: 100dvh;
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
  background:
    radial-gradient(circle at 15% 20%, rgba(212,175,55,0.10) 0%, transparent 50%),
    radial-gradient(circle at 85% 80%, rgba(212,175,55,0.08) 0%, transparent 50%),
    var(--black);
  position: relative;
}
.login-page::before {
  content: ''; position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(212,175,55,0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(212,175,55,0.04) 1px, transparent 1px);
  background-size: 45px 45px;
  pointer-events: none;
}
.login-container { width: 100%; max-width: 440px; position: relative; z-index: 1; }
.login-card {
  background: linear-gradient(145deg, var(--black-2), var(--black));
  border: 1px solid var(--border-gold);
  border-radius: 20px;
  padding: 32px 24px;
  box-shadow: var(--shadow-gold);
  position: relative;
  overflow: hidden;
}
.login-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
}
.login-logo {
  font-size: 54px; text-align: center; margin-bottom: 8px;
  filter: drop-shadow(0 0 24px rgba(212,175,55,0.6));
}
.login-card h1 {
  text-align: center; color: var(--gold); font-size: 20px;
  margin-bottom: 6px; font-weight: 800; line-height: 1.3;
}
.login-sub {
  text-align: center; color: var(--muted); margin-bottom: 22px; font-size: 13px;
}
.gate-badge {
  display: inline-block; padding: 5px 14px;
  border: 1px solid var(--gold); color: var(--gold);
  border-radius: 30px; font-size: 11px; font-weight: 700;
  letter-spacing: 2px; margin: 0 auto 14px; text-transform: uppercase;
}
.gate-office {
  text-align: center; color: var(--gold); font-size: 18px;
  font-weight: 800; margin-bottom: 8px;
}
.gate-warn {
  background: rgba(239,68,68,0.08);
  border: 1px solid rgba(239,68,68,0.3);
  color: #ff8b8b; padding: 10px 12px; border-radius: 10px;
  font-size: 12px; text-align: center; margin-bottom: 18px; line-height: 1.6;
}
.gate-hint { text-align: center; font-size: 12px; color: var(--muted); margin-top: 16px; }
.pin-box {
  display: flex; justify-content: center; gap: 6px;
  margin: 18px 0 6px; direction: ltr; flex-wrap: wrap;
}
.pin-dot {
  width: 40px; height: 50px;
  border: 1.5px solid var(--border); border-radius: 10px;
  background: var(--black-2); color: var(--gold);
  font-size: 22px; font-weight: 800; text-align: center;
  caret-color: var(--gold); font-family: monospace;
  -moz-appearance: textfield;
}
.pin-dot::-webkit-outer-spin-button,
.pin-dot::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.pin-dot:focus {
  outline: none; border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(212,175,55,0.2);
}
.pin-dot.filled {
  border-color: var(--gold); background: rgba(212,175,55,0.06);
}

/* ============================================
   FORM
   ============================================ */
.form-group { margin-bottom: 16px; }
.form-group label {
  display: block; margin-bottom: 6px;
  font-size: 13px; font-weight: 700; color: var(--gold);
}
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%; padding: 12px 14px;
  border: 1.5px solid var(--border); border-radius: 10px;
  font-size: 16px; font-family: inherit;
  background: var(--black-2); color: var(--text);
  transition: var(--tr); -webkit-appearance: none; appearance: none;
}
.form-group select {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'><path fill='%23d4af37' d='M6 9L1 4h10z'/></svg>");
  background-repeat: no-repeat;
  background-position: left 14px center;
  padding-left: 36px;
}
.form-group input::placeholder,
.form-group textarea::placeholder { color: #4a4a4a; }
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none; border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(212,175,55,0.15);
  background: var(--black-3);
}
.form-group select option { background: var(--black-2); color: var(--text); }
.form-group textarea { resize: vertical; min-height: 70px; }
.form-group small { display: block; margin-top: 4px; font-size: 11px; color: var(--muted); }

/* ============================================
   BUTTONS
   ============================================ */
.btn {
  padding: 12px 20px; border: none; border-radius: 10px;
  font-size: 14px; font-weight: 700; cursor: pointer;
  transition: var(--tr); font-family: inherit;
  display: inline-flex; align-items: center; justify-content: center;
  gap: 6px; text-decoration: none; white-space: nowrap;
  min-height: 42px; touch-action: manipulation;
}
.btn:active { transform: scale(0.97); }
.btn-primary {
  background: linear-gradient(135deg, var(--gold-2), var(--gold-3));
  color: #000; box-shadow: 0 4px 14px rgba(212,175,55,0.3);
}
.btn-block { width: 100%; }
.btn-danger {
  background: rgba(239,68,68,0.15); color: var(--danger);
  border: 1px solid rgba(239,68,68,0.35);
}
.btn-danger:active { background: var(--danger); color: #fff; }
.btn-success {
  background: rgba(34,197,94,0.15); color: var(--success);
  border: 1px solid rgba(34,197,94,0.35);
}
.btn-success:active { background: var(--success); color: #fff; }
.btn-outline {
  background: transparent; border: 1.5px solid var(--gold); color: var(--gold);
}
.btn-outline:active { background: var(--gold); color: #000; }
.btn-info {
  background: rgba(59,130,246,0.15); color: var(--info);
  border: 1px solid rgba(59,130,246,0.35);
}
.btn-sm { padding: 8px 12px; font-size: 12.5px; min-height: 36px; }
.btn-icon { padding: 10px 12px; font-size: 14px; }

.error-msg {
  color: var(--danger); text-align: center; margin-top: 10px; font-size: 13px;
}

/* ============================================
   LAYOUT
   ============================================ */
.sidebar-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.75); z-index: 150; backdrop-filter: blur(3px);
}
.sidebar-overlay.active { display: block; }

.app-layout { display: flex; min-height: 100vh; min-height: 100dvh; }

.sidebar {
  width: 280px;
  background: linear-gradient(180deg, var(--black-2), var(--black));
  border-left: 1px solid var(--border-gold);
  padding: 20px 0;
  position: fixed; top: 0; right: 0;
  height: 100vh; height: 100dvh;
  overflow-y: auto;
  transition: transform 0.3s ease;
  z-index: 200; -webkit-overflow-scrolling: touch;
}
.sidebar-header {
  padding: 0 20px 18px; border-bottom: 1px solid var(--border); margin-bottom: 14px;
}
.sidebar-header h2 {
  font-size: 16px; display: flex; align-items: center; gap: 8px;
  color: var(--gold); font-weight: 800; line-height: 1.3;
}
.sidebar-user {
  font-size: 12px; color: var(--muted); margin-top: 8px;
  padding: 6px 10px; background: rgba(212,175,55,0.08);
  border-radius: 8px; border-right: 3px solid var(--gold);
  word-break: break-word;
}
.sidebar-nav { list-style: none; padding: 0 12px; }
.sidebar-nav li a {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; color: var(--muted); text-decoration: none;
  font-size: 14px; border-radius: 10px; transition: var(--tr);
  margin-bottom: 3px; cursor: pointer; min-height: 44px;
}
.sidebar-nav li a:active { background: rgba(212,175,55,0.15); color: var(--gold); }
.sidebar-nav li a.active {
  background: linear-gradient(135deg, rgba(212,175,55,0.22), rgba(212,175,55,0.08));
  color: var(--gold); border-right: 3px solid var(--gold);
}
.sidebar-nav li a .icon { font-size: 18px; }

.main-content {
  flex: 1; margin-right: 280px; padding: 24px;
  transition: margin 0.3s;
  min-height: 100vh; min-height: 100dvh;
  max-width: 100%; overflow-x: hidden;
}

.topbar {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 20px; flex-wrap: wrap; gap: 12px;
}
.topbar h1 {
  font-size: 22px; color: var(--gold); font-weight: 800;
  line-height: 1.3; word-break: break-word;
}
.topbar-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.menu-toggle {
  display: none; background: var(--black-2); color: var(--gold);
  border: 1px solid var(--border-gold);
  padding: 10px 14px; border-radius: 10px;
  font-size: 22px; cursor: pointer;
  min-height: 44px; min-width: 44px;
}

/* ============================================
   CARDS
   ============================================ */
.card {
  background: linear-gradient(145deg, var(--black-2), var(--black));
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px; box-shadow: var(--shadow); margin-bottom: 16px;
}
.card h2 {
  color: var(--gold); font-size: 17px; margin-bottom: 14px;
  font-weight: 800; display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}

/* ============================================
   STATS
   ============================================ */
.stats-grid {
  display: grid; grid-template-columns: repeat(2, 1fr);
  gap: 12px; margin-bottom: 20px;
}
.stat-card {
  background: linear-gradient(145deg, var(--black-2), var(--black));
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px; box-shadow: var(--shadow);
  border-right: 4px solid var(--gold);
  transition: var(--tr); position: relative; overflow: hidden;
}
.stat-card .stat-icon { font-size: 26px; margin-bottom: 8px; display: block; }
.stat-card .stat-value { font-size: 26px; font-weight: 900; color: var(--gold); line-height: 1.1; }
.stat-card .stat-label { font-size: 12px; color: var(--muted); margin-top: 4px; }
.stat-card.success { border-right-color: var(--success); }
.stat-card.success .stat-value { color: var(--success); }
.stat-card.warning { border-right-color: var(--warning); }
.stat-card.warning .stat-value { color: var(--warning); }
.stat-card.danger  { border-right-color: var(--danger); }
.stat-card.danger  .stat-value { color: var(--danger); }
.stat-card.info    { border-right-color: var(--info); }
.stat-card.info    .stat-value { color: var(--info); }
.stat-card.purple  { border-right-color: var(--purple); }
.stat-card.purple  .stat-value { color: var(--purple); }

/* ============================================
   SEARCH
   ============================================ */
.search-bar { display: flex; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.search-bar input, .search-bar select {
  flex: 1; min-width: 0; padding: 12px 16px;
  border: 1.5px solid var(--border); border-radius: 12px;
  font-size: 16px; font-family: inherit;
  background: var(--black-2); color: var(--text);
  -webkit-appearance: none;
}
.search-bar input::placeholder { color: #4a4a4a; }
.search-bar input:focus {
  outline: none; border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(212,175,55,0.15);
}

/* ============================================
   CASE CARDS
   ============================================ */
.cases-grid { display: grid; grid-template-columns: 1fr; gap: 14px; }
.case-card {
  background: linear-gradient(145deg, var(--black-2), var(--black));
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px; box-shadow: var(--shadow); cursor: pointer;
  transition: var(--tr); border-right: 4px solid var(--gold);
  text-decoration: none; color: inherit; display: block;
}
.case-card:active { transform: scale(0.99); }
.case-card h3 { color: var(--gold); margin-bottom: 8px; font-size: 16px; font-weight: 800; }
.case-meta { display: flex; flex-wrap: wrap; gap: 6px; font-size: 12px; color: var(--muted); margin-bottom: 10px; }

/* ============================================
   BADGES
   ============================================ */
.badge {
  display: inline-block; padding: 3px 10px;
  border-radius: 20px; font-size: 11px; font-weight: 700;
  border: 1px solid; white-space: nowrap;
}
.badge-primary { background: rgba(212,175,55,0.12); color: var(--gold); border-color: rgba(212,175,55,0.35); }
.badge-success { background: rgba(34,197,94,0.12); color: var(--success); border-color: rgba(34,197,94,0.35); }
.badge-warning { background: rgba(245,158,11,0.12); color: var(--warning); border-color: rgba(245,158,11,0.35); }
.badge-danger  { background: rgba(239,68,68,0.12); color: var(--danger); border-color: rgba(239,68,68,0.35); }
.badge-info    { background: rgba(59,130,246,0.12); color: var(--info); border-color: rgba(59,130,246,0.35); }
.badge-purple  { background: rgba(167,139,250,0.12); color: var(--purple); border-color: rgba(167,139,250,0.35); }

.urgent-badge {
  display: inline-block; padding: 3px 10px;
  border-radius: 20px; font-size: 11px; font-weight: 800;
  background: rgba(239,68,68,0.15); color: #ff8b8b;
  border: 1px solid rgba(239,68,68,0.4);
  animation: pulse 1.6s infinite; white-space: nowrap;
}
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.55; } }
.normal-badge {
  display: inline-block; padding: 3px 10px;
  border-radius: 20px; font-size: 11px; font-weight: 800;
  background: rgba(34,197,94,0.15); color: #7ee2a8;
  border: 1px solid rgba(34,197,94,0.4); white-space: nowrap;
}

/* ============================================
   TABLES
   ============================================ */
.table-wrap {
  overflow-x: auto; border-radius: var(--radius);
  -webkit-overflow-scrolling: touch;
  margin: 0 -18px; padding: 0 18px;
}
table {
  width: 100%; border-collapse: collapse;
  background: var(--black-2); border-radius: var(--radius);
  overflow: hidden; font-size: 13px;
}
th, td {
  padding: 10px 12px; text-align: right;
  border-bottom: 1px solid var(--border); white-space: nowrap;
}
th { background: var(--black); color: var(--gold); font-weight: 800; font-size: 12px; }
tbody tr { transition: var(--tr); }
tbody tr:last-child td { border-bottom: none; }

/* ============================================
   GALLERY
   ============================================ */
.gallery {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 10px; margin-top: 10px;
}
.gallery-item {
  position: relative; aspect-ratio: 1;
  border-radius: 10px; overflow: hidden; cursor: pointer;
  border: 1.5px solid var(--border); background: var(--black);
}
.gallery-item img { width: 100%; height: 100%; object-fit: cover; }
.gallery-item .img-label {
  position: absolute; bottom: 0; left: 0; right: 0;
  background: linear-gradient(transparent, rgba(0,0,0,0.9));
  color: var(--gold); padding: 14px 6px 5px;
  font-size: 10px; text-align: center; font-weight: 700;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.gallery-item .delete-img {
  position: absolute; top: 5px; left: 5px;
  background: rgba(239,68,68,0.9); color: #fff;
  border: none; width: 28px; height: 28px;
  border-radius: 50%; cursor: pointer; font-size: 16px;
  display: flex; align-items: center; justify-content: center; line-height: 1;
}

/* ============================================
   VIDEO
   ============================================ */
.video-container { display: flex; flex-direction: column; gap: 12px; margin-top: 10px; }
.video-item {
  background: var(--black-2); border: 1px solid var(--border);
  border-radius: 12px; padding: 12px; transition: var(--tr);
}
.video-item video {
  width: 100%; max-height: 400px;
  border-radius: 8px; background: #000; display: block;
}
.video-info {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 10px; gap: 10px; flex-wrap: wrap;
}
.video-name {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; color: var(--muted);
  word-break: break-word; flex: 1; min-width: 0;
}
.video-actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* ============================================
   UPLOAD AREA
   ============================================ */
.upload-area {
  border: 2px dashed var(--border-gold);
  border-radius: var(--radius);
  padding: 24px 16px; text-align: center;
  cursor: pointer; transition: var(--tr); background: var(--black-2);
}
.upload-area:active, .upload-area:hover {
  border-color: var(--gold); background: rgba(212,175,55,0.04);
}
.upload-area .upload-icon { font-size: 38px; margin-bottom: 8px; }
.upload-area p { color: var(--muted); font-size: 13px; }
.upload-area strong { color: var(--gold); }

/* ============================================
   MODAL
   ============================================ */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.9); backdrop-filter: blur(6px);
  display: none; align-items: flex-start; justify-content: center;
  z-index: 300; padding: 16px; overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.modal-overlay.active { display: flex; }
.modal {
  background: linear-gradient(145deg, var(--black-2), var(--black));
  border: 1px solid var(--border-gold); border-radius: var(--radius);
  padding: 20px; max-width: 720px; width: 100%;
  max-height: 92vh; max-height: 92dvh;
  overflow-y: auto; box-shadow: var(--shadow-gold);
  margin: auto 0; -webkit-overflow-scrolling: touch;
}
.modal-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 16px; padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
  gap: 10px; flex-wrap: wrap;
}
.modal-header h2 { color: var(--gold); font-size: 17px; line-height: 1.3; }
.modal-close {
  background: none; border: none; font-size: 30px;
  cursor: pointer; color: var(--muted); line-height: 1;
  padding: 4px 10px; min-width: 40px; min-height: 40px;
}
.modal img, .modal video {
  width: 100%; border-radius: 10px; display: block; background: #000;
}

/* ============================================
   TOAST
   ============================================ */
.toast {
  position: fixed; bottom: 20px; left: 50%;
  transform: translateX(-50%) translateY(120px);
  background: var(--black-2); border: 1.5px solid var(--gold);
  color: var(--gold); padding: 12px 20px;
  border-radius: 12px; box-shadow: var(--shadow-gold);
  opacity: 0; transition: all 0.3s;
  z-index: 400; font-weight: 700; font-size: 13px;
  max-width: calc(100vw - 32px); text-align: center; word-break: break-word;
}
.toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }
.toast.success { border-color: var(--success); color: var(--success); }
.toast.error   { border-color: var(--danger); color: var(--danger); }

/* ============================================
   EMPTY
   ============================================ */
.empty-state { text-align: center; padding: 40px 16px; color: var(--muted); }
.empty-state .empty-icon { font-size: 50px; margin-bottom: 12px; opacity: 0.4; }
.empty-state h3 { color: var(--text); margin-bottom: 6px; font-size: 16px; }

/* ============================================
   APPOINTMENT
   ============================================ */
.appointment-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px; background: var(--black-2);
  border: 1px solid var(--border); border-radius: 10px;
  margin-bottom: 8px; transition: var(--tr);
  border-right: 3px solid var(--gold);
}
.appointment-date {
  background: linear-gradient(135deg, var(--gold-2), var(--gold-3));
  color: #000; padding: 6px 10px;
  border-radius: 8px; text-align: center;
  min-width: 60px; font-weight: 800; flex-shrink: 0;
}
.appointment-date .day { font-size: 18px; line-height: 1; }
.appointment-date .month { font-size: 10px; }
.appointment-info { flex: 1; min-width: 0; }
.appointment-info h4 { color: var(--gold); font-size: 14px; margin-bottom: 2px; }
.appointment-info p { font-size: 12px; color: var(--muted); word-break: break-word; }

/* ============================================
   DETAIL GRID
   ============================================ */
.detail-grid { display: grid; grid-template-columns: 1fr; gap: 10px; font-size: 13px; }
.detail-item {
  padding: 10px 12px; background: var(--black-2);
  border-radius: 10px; border: 1px solid var(--border);
}
.detail-item .lbl { display: block; font-size: 11px; color: var(--muted); margin-bottom: 3px; }
.detail-item .val { color: var(--text); font-weight: 600; word-break: break-word; }

/* ============================================
   MONEY
   ============================================ */
.money-box {
  background: linear-gradient(135deg, rgba(212,175,55,0.08), rgba(212,175,55,0.02));
  border: 1px solid var(--border-gold); border-radius: 10px;
  padding: 12px; display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px; margin-bottom: 10px; text-align: center;
}
.money-box .amount { font-size: 15px; font-weight: 900; color: var(--gold); word-break: break-word; }
.money-box .lbl { display: block; font-size: 10px; color: var(--muted); margin-bottom: 2px; }

/* ============================================
   NOTES
   ============================================ */
.note-card {
  background: linear-gradient(145deg, var(--black-2), var(--black));
  border: 1px solid var(--border);
  border-left: 4px solid var(--gold);
  border-radius: var(--radius); padding: 14px; margin-bottom: 10px;
}
.note-card.unseen {
  border-left-color: #ff8b8b;
  background: linear-gradient(145deg, rgba(239,68,68,0.05), var(--black));
}

/* ============================================
   KPIs
   ============================================ */
.kpi-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 18px; }
.kpi {
  background: linear-gradient(145deg, var(--black-2), var(--black));
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px; border-right: 4px solid var(--gold); overflow: hidden;
}
.kpi .val { font-size: 18px; font-weight: 900; color: var(--gold); word-break: break-word; }
.kpi .lbl { font-size: 11px; color: var(--muted); margin-top: 3px; }
.kpi .icon { font-size: 20px; margin-bottom: 4px; display: block; }

/* ============================================
   CHARTS
   ============================================ */
.bars-wrap {
  display: flex; align-items: flex-end; gap: 8px;
  min-height: 220px; height: 220px;
  padding: 16px 12px 40px;
  background: var(--black-2); border-radius: 12px;
  border: 1px solid var(--border);
  overflow-x: auto; -webkit-overflow-scrolling: touch;
  position: relative;
}
.bar-col {
  display: flex; flex-direction: column; align-items: center;
  gap: 4px; flex: 0 0 auto; min-width: 60px;
  position: relative; z-index: 1;
}
.bar-num { font-size: 11px; font-weight: 800; color: var(--gold); }
.bar-body {
  width: 34px;
  background: linear-gradient(180deg, var(--gold-2), var(--gold-3));
  border-radius: 6px 6px 0 0; min-height: 4px;
  transition: height 0.5s ease;
  box-shadow: 0 0 12px rgba(212,175,55,0.25);
}
.bar-label {
  position: absolute; bottom: -26px;
  font-size: 10px; color: var(--muted);
  text-align: center; white-space: nowrap;
}

.donut-wrap { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; justify-content: center; }
.donut {
  width: 170px; height: 170px; border-radius: 50%;
  position: relative; display: flex;
  align-items: center; justify-content: center;
  box-shadow: 0 0 30px rgba(212,175,55,0.15);
}
.donut::after {
  content: ''; position: absolute; inset: 28%;
  background: var(--black-2); border-radius: 50%;
}
.donut-center { position: relative; z-index: 2; text-align: center; }
.donut-center .num { font-size: 24px; font-weight: 900; color: var(--gold); }
.donut-center .lbl { font-size: 10px; color: var(--muted); }
.donut-legend { display: flex; flex-direction: column; gap: 6px; min-width: 100%; flex: 1; }
.donut-legend .row { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.donut-legend .dot { width: 12px; height: 12px; border-radius: 3px; flex-shrink: 0; }
.donut-legend .num { margin-right: auto; font-weight: 800; color: var(--gold); font-size: 12px; }

.prog-row {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 0; border-bottom: 1px solid var(--border); flex-wrap: wrap;
}
.prog-row:last-child { border-bottom: none; }
.prog-name { min-width: 100px; font-size: 12px; font-weight: 700; color: var(--text); }
.prog-bar {
  flex: 1; height: 10px; background: var(--black-3);
  border-radius: 6px; overflow: hidden; min-width: 60px;
}
.prog-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--gold-2), var(--gold-3));
  border-radius: 6px; transition: width 0.6s;
}
.prog-val { min-width: 45px; text-align: left; font-weight: 800; color: var(--gold); font-size: 12px; }

.section-title {
  display: flex; align-items: center; gap: 8px;
  color: var(--gold); font-size: 15px; font-weight: 800; margin-bottom: 14px;
}
.section-title::before {
  content: ''; width: 4px; height: 18px;
  background: var(--gold); border-radius: 2px;
}

/* ============================================
   PRINT BUTTON
   ============================================ */
.print-btn-float {
  position: fixed; bottom: 16px; left: 16px;
  background: linear-gradient(135deg, var(--gold-2), var(--gold-3));
  color: #000; border: none; padding: 12px 16px;
  border-radius: 50px; font-size: 13px; font-weight: 800;
  cursor: pointer; box-shadow: 0 8px 24px rgba(212,175,55,0.4);
  z-index: 90; display: flex; align-items: center; gap: 6px;
  font-family: inherit; min-height: 44px;
}
.print-btn-float span.label { display: none; }

/* ============================================
   NOTIFICATIONS BELL + DROPDOWN
   ============================================ */

/* زرار الجرس — فوق زرار الطباعة على الشمال */
.notif-bell {
  position: fixed;
  bottom: 76px;
  left: 16px;
  background: linear-gradient(135deg, var(--gold-2), var(--gold-3));
  color: #000;
  border: none;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  font-size: 24px;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(212,175,55,0.4);
  z-index: 91;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--tr);
  font-family: inherit;
  animation: bellSwing 3s ease-in-out infinite;
}

.notif-bell:active {
  transform: scale(0.95);
}

.notif-bell:hover {
  transform: translateY(-3px) scale(1.05);
  box-shadow: 0 12px 32px rgba(212,175,55,0.6);
}

.notif-bell.active {
  animation: none;
  background: linear-gradient(135deg, #f4d03f, #d4af37);
}

.notif-bell.has-unread {
  animation: bellSwing 2s ease-in-out infinite;
}

/* Badge (الرقم الأحمر) */
.notif-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: var(--danger);
  color: #fff;
  font-size: 11px;
  font-weight: 900;
  min-width: 22px;
  height: 22px;
  border-radius: 11px;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
  border: 2px solid var(--black);
  box-shadow: 0 2px 8px rgba(239,68,68,0.6);
  animation: badgePulse 1.5s infinite;
}

/* Dropdown */
.notif-dropdown {
  position: fixed;
  bottom: 138px;
  left: 16px;
  width: 380px;
  max-width: calc(100vw - 32px);
  max-height: 520px;
  background: linear-gradient(145deg, var(--black-2), var(--black));
  border: 1.5px solid var(--border-gold);
  border-radius: var(--radius);
  box-shadow: 0 12px 48px rgba(0,0,0,0.8), 0 0 32px rgba(212,175,55,0.15);
  z-index: 92;
  display: none;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.25s ease;
}

.notif-dropdown.active {
  display: flex;
  opacity: 1;
  transform: translateY(0);
}

/* Header */
.notif-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  background: rgba(212,175,55,0.04);
  font-size: 15px;
  font-weight: 800;
  color: var(--gold);
}

.notif-close {
  background: none;
  border: none;
  font-size: 24px;
  color: var(--muted);
  cursor: pointer;
  line-height: 1;
  padding: 0 6px;
  transition: var(--tr);
}

.notif-close:hover {
  color: var(--danger);
}

/* Actions */
.notif-actions {
  display: flex;
  gap: 6px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--black);
  flex-wrap: wrap;
}

.notif-action-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: var(--tr);
  font-family: inherit;
}

.notif-action-btn:hover {
  background: rgba(212,175,55,0.08);
  border-color: var(--gold);
  color: var(--gold);
}

.notif-action-btn.danger:hover {
  background: rgba(239,68,68,0.08);
  border-color: var(--danger);
  color: var(--danger);
}

/* قائمة الإشعارات */
.notif-list {
  overflow-y: auto;
  max-height: 400px;
  padding: 4px 0;
}

/* عنصر إشعار */
.notif-item {
  display: flex;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: var(--tr);
  position: relative;
}

.notif-item:hover {
  background: rgba(212,175,55,0.04);
}

.notif-item.unread {
  background: rgba(212,175,55,0.06);
  border-right: 3px solid var(--gold);
}

.notif-item:last-child {
  border-bottom: none;
}

/* أيقونة */
.notif-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1.5px solid var(--gold);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
  background: rgba(212,175,55,0.05);
}

/* محتوى */
.notif-content {
  flex: 1;
  min-width: 0;
}

.notif-title {
  font-size: 13px;
  font-weight: 800;
  color: var(--gold);
  margin-bottom: 3px;
  word-break: break-word;
}

.notif-message {
  font-size: 12px;
  color: #bbb;
  line-height: 1.5;
  margin-bottom: 4px;
  word-break: break-word;
  white-space: pre-wrap;
}

.notif-time {
  font-size: 11px;
  color: var(--muted);
}

/* النقطة الحمراء */
.notif-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--danger);
  flex-shrink: 0;
  align-self: center;
  box-shadow: 0 0 8px rgba(239,68,68,0.8);
  animation: badgePulse 1.5s infinite;
}

/* Empty state */
.notif-empty {
  padding: 40px 20px;
  text-align: center;
  color: var(--muted);
}

.notif-empty p {
  font-size: 13px;
}

/* Animations */
@keyframes bellSwing {
  0%, 100% { transform: rotate(0deg); }
  10%, 30% { transform: rotate(-10deg); }
  20%, 40% { transform: rotate(10deg); }
  50% { transform: rotate(0deg); }
}

@keyframes badgePulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15); }
}

/* ============================================
   GRID HELPERS
   ============================================ */
.grid-2 { display: grid; grid-template-columns: 1fr; gap: 12px; }
.grid-3 { display: grid; grid-template-columns: 1fr; gap: 10px; }
.actions-row { display: flex; gap: 6px; flex-wrap: wrap; }
.tag-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }

/* ============================================
   TABLET
   ============================================ */
@media (min-width: 769px) {
  .main-content { padding: 20px; }
  .stats-grid { grid-template-columns: repeat(3, 1fr); }
  .kpi-grid { grid-template-columns: repeat(3, 1fr); }
  .grid-2 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
  .cases-grid { grid-template-columns: repeat(2, 1fr); }
  .detail-grid { grid-template-columns: repeat(2, 1fr); }
  .gallery { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
  .bar-body { width: 38px; }
  .bar-col { min-width: 65px; }
  .donut { width: 190px; height: 190px; }
  .donut-legend { min-width: 180px; flex: initial; }
  .print-btn-float span.label { display: inline; }
  .print-btn-float { padding: 13px 18px; font-size: 14px; bottom: 20px; left: 20px; }

  /* Notif adjustments for tablet */
  .notif-bell { bottom: 84px; left: 20px; }
  .notif-dropdown { bottom: 148px; left: 20px; }
}

/* ============================================
   DESKTOP
   ============================================ */
@media (min-width: 1025px) {
  .stats-grid { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
  .kpi-grid { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
  .grid-2 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
  .grid-3 { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
  .cases-grid { grid-template-columns: repeat(auto-fill, minmax(310px, 1fr)); }
  .detail-grid { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
  .gallery { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  .bar-body { width: 42px; }
  .bar-col { min-width: 70px; }
  .donut { width: 200px; height: 200px; }
  .donut-legend { min-width: 180px; flex: initial; }
  .print-btn-float span.label { display: inline; }
  .print-btn-float { padding: 14px 20px; font-size: 15px; bottom: 24px; left: 24px; }
  .sidebar-nav li a:hover { background: rgba(212,175,55,0.08); color: var(--gold); }
  .btn-primary:hover { box-shadow: 0 6px 22px rgba(212,175,55,0.5); transform: translateY(-1px); }
  .case-card:hover { transform: translateY(-4px); border-color: var(--gold); box-shadow: var(--shadow-gold); }
  .gallery-item:hover img { transform: scale(1.06); }

  /* Notif adjustments for desktop */
  .notif-bell { bottom: 92px; left: 24px; }
  .notif-dropdown { bottom: 156px; left: 24px; }
}

/* ============================================
   MOBILE
   ============================================ */
@media (max-width: 768px) {
  .sidebar { transform: translateX(100%); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-right: 0; padding: 14px; }
  .menu-toggle { display: flex; align-items: center; justify-content: center; }
  .topbar h1 { font-size: 18px; }
  .topbar-actions { width: 100%; }
  .topbar-actions .btn { flex: 1; min-width: 100px; }

  .table-wrap { margin: 0; padding: 0; overflow: visible; }
  .table-wrap table, table { display: block; background: transparent; border-radius: 0; }
  .table-wrap table thead, table thead { display: none; }
  .table-wrap table tbody, table tbody,
  .table-wrap table tr, table tr {
    display: block; background: var(--black-2);
    border: 1px solid var(--border); border-radius: var(--radius);
    padding: 10px; margin-bottom: 10px;
    border-right: 4px solid var(--gold);
  }
  .table-wrap table td, table td {
    display: flex; justify-content: space-between; align-items: center;
    padding: 6px 0; border-bottom: 1px solid rgba(42,42,42,0.5);
    text-align: right; white-space: normal; word-break: break-word;
    gap: 10px; font-size: 13px;
  }
  .table-wrap table td:last-child, table td:last-child { border-bottom: none; }
  .table-wrap table td::before, table td::before {
    content: attr(data-label); color: var(--gold);
    font-weight: 800; font-size: 11px;
    flex-shrink: 0; min-width: 70px;
  }
  .table-wrap table td[data-label="م"], table td[data-label="م"] { display: none; }
  .table-wrap table td .btn, table td .btn {
    width: auto; min-height: 34px; padding: 6px 10px; font-size: 12px;
  }
  .card { padding: 14px; }
  .card h2 { font-size: 15px; }
  .donut-wrap { flex-direction: column; gap: 14px; }
  .donut { width: 150px; height: 150px; }
  .money-box { grid-template-columns: repeat(3, 1fr); font-size: 12px; }
  .money-box .amount { font-size: 13px; }
  .gallery { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .stat-card .stat-value { font-size: 22px; }
  .stat-card .stat-icon { font-size: 22px; }
  .pin-dot { width: 36px; height: 44px; font-size: 20px; }
  .pin-box { gap: 5px; }
  .appointment-item { padding: 10px; gap: 10px; }
  .appointment-date { min-width: 55px; padding: 5px 8px; }
  .appointment-date .day { font-size: 16px; }
  .print-btn-float { padding: 10px 14px; font-size: 12px; bottom: 12px; left: 12px; }

  .video-item { padding: 10px; }
  .video-item video { max-height: 250px; }
  .video-info { flex-direction: column; align-items: stretch; }
  .video-actions { justify-content: stretch; }
  .video-actions .btn { flex: 1; }
  .modal-header { flex-direction: column; align-items: flex-start; }
  .modal-header > div { width: 100%; }
  .modal-header .btn { flex: 1; }

  /* Notif adjustments for mobile */
  .notif-bell {
    width: 46px;
    height: 46px;
    font-size: 20px;
    bottom: 68px;
    left: 12px;
  }

  .notif-dropdown {
    width: calc(100vw - 24px);
    left: 12px;
    bottom: 124px;
    max-height: 70vh;
  }

  .notif-list {
    max-height: calc(70vh - 100px);
  }

  .notif-item {
    padding: 10px 12px;
  }

  .notif-icon {
    width: 36px;
    height: 36px;
    font-size: 16px;
  }
}

/* ============================================
   SMALL MOBILE
   ============================================ */
@media (max-width: 480px) {
  .login-card { padding: 26px 18px; border-radius: 16px; }
  .login-logo { font-size: 46px; }
  .login-card h1 { font-size: 18px; }
  .gate-office { font-size: 16px; }
  .pin-dot { width: 32px; height: 40px; font-size: 18px; border-radius: 8px; }
  .pin-box { gap: 4px; }
  .main-content { padding: 12px; }
  .card { padding: 12px; border-radius: 12px; }
  .topbar h1 { font-size: 17px; }
  .topbar-actions .btn { font-size: 12px; padding: 10px 12px; }
  .stat-card { padding: 12px; }
  .stat-card .stat-value { font-size: 20px; }
  .stat-card .stat-label { font-size: 11px; }
  .kpi .val { font-size: 16px; }
  .kpi-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .bar-col { min-width: 50px; }
  .bar-body { width: 28px; }
  .money-box { grid-template-columns: 1fr; text-align: right; gap: 6px; }
  .money-box > div { display: flex; justify-content: space-between; align-items: center; }
  .money-box .lbl { margin-bottom: 0; }
  .print-btn-float { padding: 10px 12px; }
  .print-btn-float span.label { display: none; }
  .toast { font-size: 12px; padding: 10px 16px; }
  .video-item video { max-height: 200px; }
  .video-name { font-size: 11px; }
  .video-actions { flex-direction: column; }
  .video-actions .btn { width: 100%; }

  /* Notif adjustments for small mobile */
  .notif-bell {
    width: 42px;
    height: 42px;
    font-size: 18px;
    bottom: 60px;
    left: 12px;
  }

  .notif-title {
    font-size: 12px;
  }

  .notif-message {
    font-size: 11px;
  }
}

/* ============================================
   PRINT
   ============================================ */
@media print {
  .sidebar, .menu-toggle, .topbar-actions .btn, .sidebar-overlay,
  .print-btn-float, .search-bar, .btn, .no-print,
  .video-container, video,
  .notif-bell, .notif-dropdown { display: none !important; }

  .main-content { margin: 0 !important; padding: 20px !important; }
  body { background: #fff !important; color: #000 !important; }
  .card, .kpi, .stat-card, .case-card, .note-card {
    border: 1px solid #ccc !important;
    background: #fff !important;
    box-shadow: none !important;
    page-break-inside: avoid;
  }
  .card h2, .topbar h1, .kpi .val, .stat-card .stat-value { color: #b8941f !important; }
  table { background: #fff !important; }
  th { background: #f5f5f5 !important; color: #000 !important; }
  td { color: #000 !important; }
  .badge { border: 1px solid #666 !important; color: #000 !important; background: #f0f0f0 !important; }
  .bars-wrap { background: #fafafa !important; }
  .bar-body { background: #b8941f !important; box-shadow: none !important; }
  .donut-legend .num { color: #000 !important; }
  .print-header {
    display: block !important;
    text-align: center;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 2px solid #b8941f;
  }
  .print-header h1 { color: #b8941f; font-size: 22px; }
  .print-header p { color: #666; font-size: 13px; }
}
.print-header { display: none; }