/* تخطيط نظام الكراج — هيدر ثابت 70px + سايدبار RTL قابل للطي 264px (فوق ahadcode-theme.css) */
:root { --hdr-h: 70px; --side-w: 264px; --app-bg: #F1F5F9; }
html, body { font-family: 'Cairo', Tahoma, sans-serif; }
body { background: var(--app-bg); color: #1E293B; font-size: .94rem; }
a { color: var(--royal); }

.app-header { position: fixed; top: 0; inset-inline: 0; height: var(--hdr-h); z-index: 1030; background: #fff;
  box-shadow: 0 1px 3px rgba(16,42,67,.08); display: flex; align-items: center; justify-content: space-between; padding: 0 1rem; }
.hdr-btn { width: 42px; height: 42px; display: inline-flex; align-items: center; justify-content: center; padding: 0; }
.brand { display: flex; align-items: center; gap: .6rem; text-decoration: none; color: var(--navy); }
.brand img { width: 46px; height: 46px; border-radius: 50%; object-fit: cover; border: 2px solid var(--royal-light); }
.hdr-search { width: 320px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--navy); color: #fff; display: inline-flex;
  align-items: center; justify-content: center; font-weight: 700; }
.notif-menu { width: 360px; max-height: 480px; overflow-y: auto; }

.app-wrapper { padding-top: var(--hdr-h); min-height: 100vh; }
.app-sidebar { position: fixed; top: var(--hdr-h); bottom: 0; right: 0; width: var(--side-w); background: var(--navy);
  overflow-y: auto; z-index: 1020; transition: transform .25s ease; padding: .75rem .6rem 2rem; }
.app-sidebar::-webkit-scrollbar { width: 6px; } .app-sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.15); border-radius: 3px; }
.app-main { margin-right: var(--side-w); padding: 1.5rem; transition: margin .25s ease; min-height: calc(100vh - var(--hdr-h)); display: flex; flex-direction: column; }
.app-main > footer { margin-top: auto; }
body.sidebar-collapsed .app-sidebar { transform: translateX(100%); }
body.sidebar-collapsed .app-main { margin-right: 0; }

.side-link, .side-group__btn { display: flex; align-items: center; gap: .7rem; width: 100%; padding: .62rem .85rem; color: #CBD5E1;
  text-decoration: none; border-radius: 10px; border: 0; background: transparent; font-size: .9rem; text-align: right; }
.side-link:hover, .side-group__btn:hover { background: rgba(255,255,255,.07); color: #fff; }
.side-link.active { background: var(--royal); color: #fff; box-shadow: 0 4px 12px rgba(37,99,235,.35); }
.side-link i, .side-group__btn i { font-size: 1.05rem; width: 20px; text-align: center; }
.side-group__btn .caret { margin-inline-start: auto; font-size: .75rem; transition: transform .2s; }
.side-group.open .side-group__btn { color: #fff; }
.side-group.open .side-group__btn .caret { transform: rotate(180deg); }
.side-group__links { display: none; padding: .15rem 0 .35rem; }
.side-group.open .side-group__links { display: block; }
.side-link.sub { padding-inline-start: 1.6rem; font-size: .86rem; }
.side-link.sub i { font-size: .9rem; color: var(--gold); opacity: .8; }
.side-link.sub.active i { color: #fff; opacity: 1; }
.sidebar-backdrop { display: none; }

@media (max-width: 991.98px) {
  .app-sidebar { transform: translateX(100%); }
  .app-main { margin-right: 0; padding: 1rem; }
  body.sidebar-open .app-sidebar { transform: translateX(0); }
  body.sidebar-open .sidebar-backdrop { display: block; position: fixed; inset: var(--hdr-h) 0 0 0; background: rgba(15,23,42,.45); z-index: 1010; }
  .hdr-search { width: 200px; }
}

.app-footer { text-align: center; color: #94A3B8; font-size: .8rem; padding: 1.5rem 0 .5rem; }
.app-footer a { color: #64748B; text-decoration: none; }

/* عناصر عامة */
.form-label { font-weight: 600; font-size: .85rem; color: #334155; margin-bottom: .3rem; }
.form-control, .form-select { border-radius: 8px; border-color: #CBD5E1; }
.form-control:focus, .form-select:focus { border-color: var(--royal); box-shadow: 0 0 0 .2rem rgba(37,99,235,.15); }
.btn { border-radius: 8px; font-weight: 600; }
.card-section-title { font-weight: 700; color: var(--navy); font-size: 1rem; margin-bottom: 1rem; display: flex; align-items: center; gap: .5rem; }
.card-section-title i { color: var(--royal); }
.info-item { margin-bottom: 1rem; }
.info-item__label { font-size: .78rem; color: #64748B; }
.info-item__value { font-weight: 700; color: var(--navy); }
.money { font-variant-numeric: tabular-nums; font-weight: 700; direction: ltr; unicode-bidi: embed; }
.num { direction: ltr; unicode-bidi: embed; font-variant-numeric: tabular-nums; }
.table-sm td, .table-sm th { padding: .45rem .6rem !important; }
.table td.actions, .table th.actions { white-space: nowrap; text-align: center; width: 1%; }
tfoot td { font-weight: 800; background: #F8FAFC; }
.totals-box { background: #F8FAFC; border: 1px solid var(--ac-border); border-radius: var(--ac-radius); padding: 1rem 1.25rem; }
.totals-box .row-line { display: flex; justify-content: space-between; padding: .35rem 0; border-bottom: 1px dashed #E2E8F0; }
.totals-box .row-line:last-child { border-bottom: 0; }
.totals-box .grand { font-size: 1.15rem; font-weight: 800; color: var(--navy); }
.nav-tabs .nav-link { font-weight: 700; color: #475569; }
.nav-tabs .nav-link.active { color: var(--royal); }
.select2-container { width: 100% !important; }
.select2-container--default .select2-selection--single { height: 38px; border-color: #CBD5E1; border-radius: 8px; }
.select2-container--default .select2-selection--single .select2-selection__rendered { line-height: 36px; }
.select2-container--default .select2-selection--single .select2-selection__arrow { height: 36px; }
.select2-container--default .select2-selection--multiple { border-color: #CBD5E1; border-radius: 8px; min-height: 38px; }
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { position: relative; padding: 0 1.4rem .9rem 0; border-right: 2px solid #E2E8F0; }
.timeline li::before { content: ''; position: absolute; right: -7px; top: 4px; width: 12px; height: 12px; border-radius: 50%; background: var(--royal); }
.kanban { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1rem; }
.kanban-col { background: #fff; border: 1px solid var(--ac-border); border-radius: var(--ac-radius); }
.kanban-col__head { padding: .7rem 1rem; font-weight: 800; border-bottom: 1px solid var(--ac-border); display: flex; justify-content: space-between; }
.kanban-card { margin: .6rem; padding: .7rem .8rem; border: 1px solid var(--ac-border); border-radius: 10px; background: #F8FAFC; display: block; color: inherit; text-decoration: none; }
.kanban-card:hover { box-shadow: var(--ac-shadow-hover); }
.plate { display: inline-block; border: 2px solid #1E293B; border-radius: 6px; padding: 0 .45rem; font-weight: 800; background: #fff; direction: ltr; letter-spacing: 1px; font-size: .85rem; }
.demo-banner { position: fixed; bottom: 0; inset-inline: 0; z-index: 1040; background: #1E293B; color: #fff; text-align: center; padding: .45rem; font-size: .85rem; }
.text-navy { color: var(--navy) !important; }
.bg-royal-light { background: var(--royal-light) !important; }

/* صفحة الدخول */
.auth-body { min-height: 100vh; background: radial-gradient(circle at 20% 20%, #1D4ED8 0, #102A43 55%, #0B1E30 100%); display: flex; align-items: center; justify-content: center; }
.auth-wrap { width: 100%; max-width: 440px; padding: 1rem; }
.auth-card { background: #fff; border-radius: 18px; padding: 2rem; box-shadow: 0 20px 50px rgba(0,0,0,.25); }
.auth-logo { width: 84px; height: 84px; border-radius: 50%; object-fit: cover; display: block; margin: 0 auto 1rem; border: 3px solid var(--royal-light); }

/* الطباعة */
@media print {
  body { background: #fff; }
  .app-main { margin: 0 !important; padding: 0 !important; }
  .app-wrapper { padding-top: 0; }
  .data-card, .page-head { box-shadow: none; border-color: #ccc; }
}
