/* ==========================================================
   منصة ميزان — الأنماط العامة
   هوية بصرية: كحلي داكن + ذهبي (مختلفة عن الهوية الفيروزية الأصلية)
   ========================================================== */

:root {
  --primary: #123A5C;
  --primary-dark: #0B2740;
  --primary-light: #1E5385;
  --accent: #C9A24B;
  --accent-light: #E4C77A;
  --bg: #F5F7FA;
  --surface: #FFFFFF;
  --border: #E4E8EF;
  --text: #1D2733;
  --text-muted: #64748B;
  --success: #1E8E5A;
  --success-bg: #E7F6EF;
  --warning: #B8860B;
  --warning-bg: #FCF3DA;
  --danger: #C0392B;
  --danger-bg: #FBEAE8;
  --info: #2563A8;
  --info-bg: #E8F0FA;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 3px rgba(18,58,92,0.08), 0 1px 2px rgba(18,58,92,0.06);
  --shadow-md: 0 8px 24px rgba(18,58,92,0.10);
}

* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  font-family: 'Tajawal', 'Segoe UI', Tahoma, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}
a { text-decoration: none; color: inherit; }
ul { list-style: none; margin: 0; padding: 0; }
h1,h2,h3,h4,h5 { margin: 0 0 .5rem; font-weight: 700; color: var(--primary-dark); }
p { margin: 0 0 .75rem; }
.container { max-width: 1180px; margin: 0 auto; padding: 0 24px; }

/* ---------- عناصر مشتركة ---------- */
.brand { display: flex; align-items: center; gap: 10px; font-weight: 900; font-size: 1.25rem; color: var(--primary-dark); }
.brand-mark {
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; border-radius: 10px;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: var(--accent-light); font-weight: 900; font-size: 1.1rem;
  box-shadow: var(--shadow);
}
.brand-name small { font-size: .6rem; font-weight: 500; color: var(--text-muted); display: block; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 20px; border-radius: var(--radius-sm); font-weight: 700; font-size: .92rem;
  border: 1px solid transparent; cursor: pointer; transition: .15s ease;
  font-family: inherit;
}
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 2px 8px rgba(18,58,92,.18); }
.btn-primary:hover { background: var(--primary-dark); box-shadow: 0 4px 12px rgba(18,58,92,.25); transform: translateY(-1px); }
.btn-accent { background: var(--accent); color: var(--primary-dark); }
.btn-accent:hover { background: var(--accent-light); }
.btn-ghost { background: transparent; border-color: var(--border); color: var(--primary-dark); }
.btn-ghost:hover { background: var(--bg); }
.btn-outline { background: transparent; border-color: var(--primary); color: var(--primary); }
.btn-outline:hover { background: var(--primary); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #a5321f; }
.btn-sm { padding: 6px 14px; font-size: .82rem; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 22px; box-shadow: var(--shadow);
}
.card + .card { margin-top: 18px; }
.card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; gap: 10px; flex-wrap: wrap; }
.card-header h3 { margin: 0; display: flex; align-items: center; gap: 8px; }

.grid { display: grid; gap: 18px; }
.grid > * { min-width: 0; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 900px) { .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 600px) { .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr; } }

.badge {
  display: inline-flex; align-items: center; padding: 4px 12px; border-radius: 999px;
  font-size: .78rem; font-weight: 700; white-space: nowrap;
}
.badge-success { background: var(--success-bg); color: var(--success); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-danger { background: var(--danger-bg); color: var(--danger); }
.badge-info { background: var(--info-bg); color: var(--info); }
.badge-muted { background: #EEF1F5; color: var(--text-muted); }

.alert { padding: 14px 18px; border-radius: var(--radius-sm); margin-bottom: 16px; font-weight: 600; border-inline-start: 4px solid transparent; }
.alert-danger { background: var(--danger-bg); color: var(--danger); border: 1px solid #f0c9c2; border-inline-start-color: var(--danger); }
.alert-success { background: var(--success-bg); color: var(--success); border: 1px solid #bfe6d3; border-inline-start-color: var(--success); }
.alert-info { background: var(--info-bg); color: var(--info); border: 1px solid #c7dbf2; border-inline-start-color: var(--info); }
.alert-warning { background: var(--warning-bg); color: var(--warning); border: 1px solid #f0dcae; border-inline-start-color: var(--warning); }

table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 13px 14px; text-align: right; border-bottom: 1px solid var(--border); font-size: .92rem; }
.table th { color: var(--text-muted); font-weight: 700; font-size: .78rem; text-transform: uppercase; letter-spacing: .03em; background: var(--bg); }
.table th:first-child { border-top-right-radius: var(--radius-sm); }
.table th:last-child { border-top-left-radius: var(--radius-sm); }
.table tbody tr { transition: background .12s ease; }
.table tbody tr:hover { background: var(--bg); }
.table tbody tr:last-child td { border-bottom: none; }
.table-wrap { overflow-x: auto; }

.form-group { margin-bottom: 16px; }
.form-group label { display: block; margin-bottom: 6px; font-weight: 700; font-size: .88rem; color: var(--primary-dark); }
.form-control, select.form-control, textarea.form-control {
  width: 100%; padding: 10px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-family: inherit; font-size: .95rem; background: #fff; color: var(--text);
}
.form-control:focus { outline: none; border-color: var(--primary-light); box-shadow: 0 0 0 3px rgba(18,58,92,.1); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 700px) { .form-row { grid-template-columns: 1fr; } }
.help-text { color: var(--text-muted); font-size: .82rem; margin-top: 4px; }

.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 22px; flex-wrap: wrap; gap: 12px; padding-bottom: 18px; border-bottom: 1px solid var(--border); }
.page-header h1 { font-size: 1.4rem; margin: 0; letter-spacing: -.01em; }
.page-header p { margin: 4px 0 0; color: var(--text-muted); font-size: .88rem; }

.breadcrumb { font-size: .85rem; color: var(--text-muted); margin-bottom: 10px; }
.breadcrumb a { color: var(--primary); font-weight: 600; }

.empty-state { text-align: center; padding: 60px 20px; color: var(--text-muted); }
.empty-icon {
  font-size: 2.2rem; margin: 0 auto 14px; width: 64px; height: 64px; border-radius: 50%;
  background: var(--bg); display: flex; align-items: center; justify-content: center;
}

.stat-card {
  display: flex; flex-direction: column; gap: 6px; position: relative; overflow: hidden;
  transition: transform .15s ease, box-shadow .15s ease;
}
.stat-card::before { content: ""; position: absolute; inset-inline: 0; top: 0; height: 3px; background: var(--stat-color, var(--primary)); }
.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.stat-card .stat-label { color: var(--text-muted); font-size: .82rem; font-weight: 700; }
.stat-card .stat-value { font-size: 1.9rem; font-weight: 900; color: var(--primary-dark); }
.stat-card .stat-sub { font-size: .8rem; color: var(--text-muted); }
.stat-icon { width: 44px; height: 44px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 1.3rem; margin-bottom: 8px; background: var(--stat-bg, var(--info-bg)); color: var(--stat-color, var(--primary)); }

.tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--border); margin-bottom: 20px; overflow-x: auto; }
.tabs a { padding: 10px 16px; font-weight: 700; color: var(--text-muted); border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs a.active { color: var(--primary); border-color: var(--primary); }

.pill-tabs { display: inline-flex; background: #EEF1F5; border-radius: 999px; padding: 4px; gap: 4px; }
.pill-tabs a { padding: 6px 16px; border-radius: 999px; font-size: .85rem; font-weight: 700; color: var(--text-muted); }
.pill-tabs a.active { background: var(--primary); color: #fff; }

/* ---------- صفحة تسجيل الدخول ---------- */
.plain-bg { background: linear-gradient(160deg, var(--primary-dark), var(--primary) 60%); min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.plain-wrap { width: 100%; max-width: 420px; padding: 24px; display: flex; flex-direction: column; align-items: center; }
.plain-brand { color: #fff; margin-bottom: 24px; font-size: 1.5rem; }
.plain-brand .brand-name { color: #fff; }
.auth-card { background: #fff; border-radius: var(--radius); padding: 32px; width: 100%; box-shadow: var(--shadow-md); }
.auth-card h2 { text-align: center; margin-bottom: 4px; }
.auth-card .sub { text-align: center; color: var(--text-muted); margin-bottom: 22px; font-size: .9rem; }
.demo-creds { margin-top: 18px; background: var(--bg); border-radius: var(--radius-sm); padding: 14px; font-size: .8rem; color: var(--text-muted); }
.demo-creds strong { color: var(--primary-dark); }
.demo-creds table { margin-top: 6px; }
.demo-creds td { padding: 3px 6px; border: none; font-size: .78rem; }

/* ---------- التطبيق الداخلي (Sidebar/Topbar) ---------- */
.app-shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 250px; background: var(--primary-dark); color: #fff; flex-shrink: 0;
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.sidebar-brand { display: flex; align-items: center; gap: 10px; padding: 22px 20px; font-weight: 900; font-size: 1.15rem; color: #fff; border-bottom: 1px solid rgba(255,255,255,.08); }
.side-nav { flex: 1; padding: 16px 12px; display: flex; flex-direction: column; gap: 3px; overflow-y: auto; }
.side-nav a { display: flex; align-items: center; gap: 10px; padding: 11px 14px; border-radius: var(--radius-sm); color: rgba(255,255,255,.75); font-weight: 600; font-size: .92rem; transition: background .15s ease, color .15s ease; }
.side-nav a:hover { background: rgba(255,255,255,.08); color: #fff; }
.side-nav a.active { background: var(--accent); color: var(--primary-dark); box-shadow: 0 2px 10px rgba(0,0,0,.15); }
.nav-ico { font-size: 1.05rem; width: 20px; text-align: center; }
.sidebar-foot { padding: 16px 20px; font-size: .72rem; color: rgba(255,255,255,.4); border-top: 1px solid rgba(255,255,255,.08); }

.main-col { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { height: 68px; background: #fff; border-bottom: 1px solid var(--border); display: flex; align-items: center; padding: 0 24px; gap: 16px; position: sticky; top: 0; z-index: 10; }
.topbar > * { min-width: 0; }
.topbar-spacer { flex: 1; }
.hamburger { display: none; background: none; border: none; font-size: 1.3rem; cursor: pointer; color: var(--primary-dark); }
.topbar-user { display: flex; align-items: center; gap: 14px; }
.user-chip { display: flex; align-items: center; gap: 10px; }
.user-avatar { width: 38px; height: 38px; border-radius: 50%; background: linear-gradient(135deg, var(--accent), var(--accent-light)); color: var(--primary-dark); display: flex; align-items: center; justify-content: center; font-weight: 900; box-shadow: 0 0 0 2px var(--surface), 0 0 0 3px var(--border); }
.user-meta { display: flex; flex-direction: column; line-height: 1.25; font-size: .85rem; }
.user-meta small { color: var(--text-muted); }
.content { padding: 26px; }

.portal-shell { min-height: 100vh; background: var(--bg); }
.portal-topbar { padding: 0 28px; }
.portal-content { max-width: 1000px; margin: 0 auto; width: 100%; }

.sidebar-backdrop { display: none; }
@media (max-width: 900px) {
  .sidebar { position: fixed; right: -260px; top: 0; z-index: 100; transition: right .2s ease; box-shadow: var(--shadow-md); }
  .sidebar.open { right: 0; }
  .hamburger { display: block; }
  .sidebar-backdrop { display: none; position: fixed; inset: 0; background: rgba(11,39,64,.45); z-index: 99; }
  .sidebar-backdrop.open { display: block; }
}

@media (max-width: 620px) {
  .topbar { padding: 0 12px; gap: 8px; }
  .search-btn-label, .search-btn-kbd { display: none; }
  .user-meta { display: none; }
  .topbar-user { gap: 8px; }
  .logout-btn { padding-inline: 10px; }
  .content { padding: 16px; }
  .table-wrap .table th, .table-wrap .table td { white-space: nowrap; }
}

/* ---------- الصفحة التسويقية ---------- */
.marketing { background: #fff; }
.mkt-header { position: sticky; top: 0; background: rgba(255,255,255,.95); backdrop-filter: blur(6px); border-bottom: 1px solid var(--border); z-index: 50; }
.mkt-header-inner { display: flex; align-items: center; gap: 32px; height: 76px; }
.mkt-nav { display: flex; gap: 26px; flex: 1; }
.mkt-nav a { font-weight: 700; color: var(--text-muted); }
.mkt-nav a:hover, .mkt-nav a.active { color: var(--primary); }
.mkt-actions { display: flex; gap: 10px; }
@media (max-width: 760px) { .mkt-nav { display: none; } }

.hero { background: linear-gradient(160deg, var(--primary-dark) 0%, var(--primary) 55%, var(--primary-light) 100%); color: #fff; padding: 80px 0 100px; position: relative; overflow: hidden; }
.hero::after { content: ""; position: absolute; inset: 0; background: radial-gradient(circle at 85% 20%, rgba(201,162,75,.25), transparent 55%); }
.hero-inner { position: relative; display: grid; grid-template-columns: 1.1fr .9fr; gap: 40px; align-items: center; }
@media (max-width: 900px) { .hero-inner { grid-template-columns: 1fr; } }
.hero-badge { display: inline-flex; align-items: center; gap: 8px; background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.2); padding: 6px 16px; border-radius: 999px; font-size: .8rem; font-weight: 700; margin-bottom: 20px; }
.hero h1 { color: #fff; font-size: 2.6rem; line-height: 1.3; margin-bottom: 16px; }
.hero h1 span { color: var(--accent-light); }
.hero p.lead { color: rgba(255,255,255,.85); font-size: 1.1rem; max-width: 540px; margin-bottom: 28px; }
.hero-actions { display: flex; gap: 14px; flex-wrap: wrap; }
.hero-stats { display: flex; gap: 30px; margin-top: 40px; flex-wrap: wrap; }
.hero-stats div strong { display: block; font-size: 1.6rem; color: #fff; }
.hero-stats div span { font-size: .8rem; color: rgba(255,255,255,.7); }

.hero-visual { background: #fff; border-radius: 18px; padding: 20px; box-shadow: 0 30px 60px rgba(0,0,0,.35); color: var(--text); }
.hero-visual .mock-topbar { display: flex; gap: 6px; margin-bottom: 14px; }
.hero-visual .mock-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--border); }
.mock-stat-row { display: grid; grid-template-columns: repeat(3,1fr); gap: 10px; margin-bottom: 14px; }
.mock-stat { background: var(--bg); border-radius: 10px; padding: 12px; }
.mock-stat b { display: block; font-size: 1.1rem; color: var(--primary-dark); }
.mock-stat span { font-size: .72rem; color: var(--text-muted); }
.mock-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 11px 0; border-bottom: 1px solid var(--border); font-size: .85rem; transition: background .15s ease; }
.mock-row:last-child { border-bottom: none; }
a.mock-row, .mock-row[href] { text-decoration: none; color: inherit; }
a.mock-row:hover { background: var(--bg); margin-inline: -10px; padding-inline: 10px; border-radius: var(--radius-sm); }

.section { padding: 80px 0; }
.section-alt { background: var(--bg); }
.section-head { text-align: center; max-width: 640px; margin: 0 auto 50px; }
.section-head .eyebrow { color: var(--accent); font-weight: 800; font-size: .82rem; letter-spacing: .05em; text-transform: uppercase; }
.section-head h2 { font-size: 2rem; margin: 8px 0 12px; }
.section-head p { color: var(--text-muted); }

.feature-card { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 26px; box-shadow: var(--shadow); height: 100%; }
.feature-card .f-icon { width: 48px; height: 48px; border-radius: 12px; background: var(--info-bg); color: var(--primary); display: flex; align-items: center; justify-content: center; font-size: 1.4rem; margin-bottom: 14px; }
.feature-card h3 { font-size: 1.05rem; margin-bottom: 6px; }
.feature-card p { color: var(--text-muted); font-size: .9rem; margin: 0; }

.module-row { display: grid; grid-template-columns: .9fr 1.1fr; gap: 50px; align-items: center; margin-bottom: 60px; }
.module-row.reverse { grid-template-columns: 1.1fr .9fr; }
.module-row.reverse .module-visual { order: 2; }
@media (max-width: 900px) { .module-row, .module-row.reverse { grid-template-columns: 1fr; } .module-row.reverse .module-visual { order: 0; } }
.module-visual { background: var(--bg); border-radius: var(--radius); padding: 24px; border: 1px solid var(--border); }
.module-tag { display: inline-block; background: var(--info-bg); color: var(--primary); font-weight: 700; font-size: .78rem; padding: 4px 12px; border-radius: 999px; margin-bottom: 12px; }
.module-list { margin-top: 16px; display: flex; flex-direction: column; gap: 10px; }
.module-list li { display: flex; gap: 10px; align-items: flex-start; font-size: .92rem; color: var(--text); }
.module-list .check { color: var(--success); font-weight: 900; }

.pricing-card { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 30px; text-align: center; box-shadow: var(--shadow); position: relative; }
.pricing-card.highlight { border: 2px solid var(--accent); transform: translateY(-8px); box-shadow: var(--shadow-md); }
.pricing-card .ribbon { position: absolute; top: -14px; left: 50%; transform: translateX(-50%); background: var(--accent); color: var(--primary-dark); font-size: .75rem; font-weight: 800; padding: 4px 14px; border-radius: 999px; }
.pricing-card .price { font-size: 2.4rem; font-weight: 900; color: var(--primary-dark); margin: 10px 0; }
.pricing-card .price small { font-size: .9rem; color: var(--text-muted); font-weight: 500; }
.pricing-card ul { text-align: right; margin: 20px 0; display: flex; flex-direction: column; gap: 10px; }
.pricing-card ul li { display: flex; gap: 8px; font-size: .88rem; }

.testimonial-card { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); }
.testimonial-card p { font-style: normal; color: var(--text); margin-bottom: 16px; }
.testimonial-person { display: flex; align-items: center; gap: 10px; }
.testimonial-person .av { width: 40px; height: 40px; border-radius: 50%; background: var(--primary); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 800; }
.testimonial-person strong { display: block; font-size: .9rem; }
.testimonial-person span { font-size: .78rem; color: var(--text-muted); }

.cta-band { background: linear-gradient(120deg, var(--primary-dark), var(--primary)); color: #fff; border-radius: 20px; padding: 50px; text-align: center; margin: 0 24px; }
.cta-band h2 { color: #fff; }
.cta-band p { color: rgba(255,255,255,.8); max-width: 480px; margin: 0 auto 24px; }

.mkt-footer { background: var(--primary-dark); color: rgba(255,255,255,.7); padding: 50px 0 20px; margin-top: 60px; }
.mkt-footer-inner { display: flex; justify-content: space-between; gap: 40px; flex-wrap: wrap; padding-bottom: 30px; border-bottom: 1px solid rgba(255,255,255,.1); }
.footer-brand .brand-name, .footer-brand .brand-mark { color: #fff; }
.footer-brand p { color: rgba(255,255,255,.55); font-size: .85rem; max-width: 260px; margin-top: 10px; }
.footer-cols { display: flex; gap: 60px; }
.footer-cols h4 { color: #fff; font-size: .85rem; margin-bottom: 12px; }
.footer-cols a, .footer-cols p { display: block; color: rgba(255,255,255,.6); font-size: .85rem; margin-bottom: 8px; }
.mkt-footer-bottom { display: flex; justify-content: space-between; padding-top: 20px; font-size: .78rem; color: rgba(255,255,255,.45); flex-wrap: wrap; gap: 8px; }

/* ---------- موقع المكتب العام (النسخة الخاصة): المدونة والصفحات الثابتة ---------- */
.blog-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 22px; }
.blog-card { display: block; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); text-decoration: none; color: inherit; transition: .15s ease; }
.blog-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.blog-card-date { font-size: .76rem; font-weight: 700; color: var(--accent); text-transform: uppercase; letter-spacing: .03em; }
.blog-card h3 { margin: 8px 0 6px; font-size: 1.05rem; }
.blog-card p { margin: 0; color: var(--text-muted); font-size: .88rem; line-height: 1.7; }
.site-content { font-size: 1.02rem; line-height: 2; color: var(--text); }
.site-content p, .site-content br { margin-bottom: 4px; }

/* ---------- طباعة (تقارير وفواتير) — متوافقة مع A4 ---------- */
.report-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 20px; }
.report-summary .stat-card { padding: 16px; }

@page { size: A4; margin: 14mm 12mm; }

@media print {
  * { -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important; color-adjust: exact !important; }

  .no-print, .sidebar, .topbar, .sidebar-backdrop, .filters-bar { display: none !important; }
  .app-shell, .main-col, .content { display: block !important; padding: 0 !important; margin: 0 !important; width: auto !important; height: auto !important; }

  html, body { background: #fff; font-size: 11pt; padding: 0 !important; margin: 0 !important; }
  a { color: inherit; text-decoration: none; }

  /* لا نمنع انقسام .card بين الصفحات بشكل عام: بطاقة تحوي جدولاً طويلاً (تقرير) يجب أن تتابع
     التدفّق الطبيعي بين الصفحات، وإلا قفزت بالكامل لصفحة جديدة وأهدرت مساحة الصفحة السابقة.
     الحماية من الانقسام مقصورة على عناصر قصيرة فعلاً (صف جدول، بطاقة إحصائية). */
  .card { box-shadow: none !important; border: 1px solid #ccc; padding: 14px; }
  .report-summary .stat-card { border: 1px solid #ccc; padding: 10px; break-inside: avoid; }

  table { border-collapse: collapse; width: 100%; }
  thead { display: table-header-group; } /* يتكرر رأس الجدول أعلى كل صفحة مطبوعة */
  tr { break-inside: avoid; }
  .table th, .table td { padding: 6px 8px; font-size: 10pt; border-bottom: 1px solid #ddd; }
  .table-wrap { overflow: visible; }

  .badge { border: 1px solid rgba(0,0,0,.15); }

  h1 { font-size: 16pt; }
  h2 { font-size: 14pt; }
  h3 { font-size: 12pt; }
}

/* ---------- لوحة التحكم — تصميم محسّن (dashboard.php فقط) ---------- */
.dash-hero {
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%);
  border-radius: var(--radius); padding: 26px 30px; color: #fff;
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 18px;
  position: relative; overflow: hidden; box-shadow: var(--shadow-md); margin-bottom: 20px;
}
.dash-hero::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(circle at 92% 8%, rgba(201,162,75,.28), transparent 60%);
}
.dash-hero-text { position: relative; z-index: 1; }
.dash-hero-greeting { font-size: 1.4rem; font-weight: 900; margin: 0 0 6px; color: #fff; }
.dash-hero-sub { color: rgba(255,255,255,.78); font-size: .85rem; display: flex; gap: 14px; flex-wrap: wrap; align-items: center; }
.dash-status { display: inline-flex; align-items: center; gap: 7px; }
.dash-status-dot { width: 8px; height: 8px; border-radius: 50%; background: #34D399; box-shadow: 0 0 0 3px rgba(52,211,153,.25); animation: dashPulse 2s infinite; }
@keyframes dashPulse { 0%, 100% { opacity: 1; } 50% { opacity: .45; } }
.dash-hero-clock { position: relative; z-index: 1; text-align: left; direction: ltr; }
.dash-customize-btn {
  background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.25); color: #fff;
  padding: 5px 12px; border-radius: 999px; font-size: .74rem; font-weight: 700; cursor: pointer;
  font-family: inherit; margin-bottom: 10px; transition: .15s ease;
}
.dash-customize-btn:hover { background: rgba(255,255,255,.22); }
.dash-hero-time { font-size: 1.7rem; font-weight: 900; font-variant-numeric: tabular-nums; line-height: 1; }
.dash-hero-date { font-size: .76rem; color: rgba(255,255,255,.7); margin-top: 6px; direction: rtl; text-align: left; }

.dash-quick-actions { display: flex; gap: 9px; flex-wrap: wrap; margin-top: 14px; position: relative; z-index: 1; }
.dash-quick-actions a {
  background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.25); color: #fff;
  padding: 7px 15px; border-radius: 999px; font-size: .8rem; font-weight: 700;
  display: inline-flex; align-items: center; gap: 6px; transition: .15s ease;
}
.dash-quick-actions a:hover { background: var(--accent); border-color: var(--accent); color: var(--primary-dark); }

.dash-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
@media (max-width: 900px) { .dash-stats { grid-template-columns: 1fr 1fr; } }
@media (max-width: 600px) { .dash-stats { grid-template-columns: 1fr; } }

.dash-stat-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px; box-shadow: var(--shadow); position: relative; overflow: hidden;
  transition: transform .15s ease, box-shadow .15s ease;
}
.dash-stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.dash-stat-card::before { content: ""; position: absolute; inset-inline: 0; top: 0; height: 3px; background: var(--stat-color, var(--primary)); }
.dash-stat-top { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 16px; }
.dash-stat-icon {
  width: 46px; height: 46px; border-radius: 12px; display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem; background: var(--stat-bg, var(--info-bg)); color: var(--stat-color, var(--primary));
}
.dash-stat-trend { font-size: .72rem; font-weight: 800; padding: 3px 9px; border-radius: 999px; display: inline-flex; align-items: center; gap: 3px; white-space: nowrap; }
.dash-stat-trend.up { background: var(--success-bg); color: var(--success); }
.dash-stat-trend.down { background: var(--danger-bg); color: var(--danger); }
.dash-stat-trend.flat { background: #EEF1F5; color: var(--text-muted); }
.dash-stat-value { font-size: 1.8rem; font-weight: 900; color: var(--primary-dark); line-height: 1.1; }
.dash-stat-label { font-size: .83rem; color: var(--text-muted); font-weight: 700; margin-top: 8px; }
.dash-stat-sub { font-size: .75rem; color: var(--text-muted); margin-top: 3px; }

.dash-card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; gap: 10px; flex-wrap: wrap; }
.dash-card-head h3 { display: flex; align-items: center; gap: 8px; font-size: .98rem; margin: 0; }
.dash-card-icon { width: 28px; height: 28px; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: .9rem; background: var(--info-bg); color: var(--primary); flex-shrink: 0; }

.dash-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--border); text-decoration: none; color: inherit; transition: background .15s ease; }
.dash-row:last-child { border-bottom: none; }
a.dash-row:hover { background: var(--bg); margin-inline: -10px; padding-inline: 10px; border-radius: var(--radius-sm); }
.dash-row-main { display: flex; align-items: center; gap: 10px; min-width: 0; }
.dash-row-icon { width: 32px; height: 32px; border-radius: 9px; display: flex; align-items: center; justify-content: center; font-size: .95rem; flex-shrink: 0; background: var(--bg); }
.dash-row-text { min-width: 0; }
.dash-row-title { font-weight: 700; font-size: .87rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dash-row-sub { font-size: .75rem; color: var(--text-muted); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- أدوات مساعدة ---------- */
.mt-0 { margin-top: 0; } .mb-0 { margin-bottom: 0; }
.text-muted { color: var(--text-muted); }
.text-center { text-align: center; }
.flex { display: flex; } .items-center { align-items: center; } .justify-between { justify-content: space-between; }
.gap-8 { gap: 8px; } .gap-12 { gap: 12px; } .gap-16 { gap: 16px; }
.w-full { width: 100%; }
.mono { font-family: 'Courier New', monospace; direction: ltr; display: inline-block; }
.divider { height: 1px; background: var(--border); margin: 18px 0; border: none; }
.filters-bar { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; align-items: center; }
.filters-bar .form-control { max-width: 220px; }
.link { color: var(--primary); font-weight: 700; }
.link:hover { text-decoration: underline; }
