/* نظام الوحدات الخاصة الموحّد — التصميم الرملي النحاسي */
/* الخط مدمج داخل البرنامج — لا يعتمد على الإنترنت */
@font-face { font-family: 'Plex Arabic'; font-style: normal; font-weight: 400; font-display: swap; src: url('/fonts/plex-arabic-400.woff2') format('woff2'); unicode-range: U+0600-06FF, U+0750-077F, U+0870-08FF, U+FB50-FDFF, U+FE70-FEFF, U+200C-200E, U+2010-2011, U+204F, U+2E41; }
@font-face { font-family: 'Plex Arabic'; font-style: normal; font-weight: 400; font-display: swap; src: url('/fonts/plex-latin-400.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Plex Arabic'; font-style: normal; font-weight: 500; font-display: swap; src: url('/fonts/plex-arabic-500.woff2') format('woff2'); unicode-range: U+0600-06FF, U+0750-077F, U+0870-08FF, U+FB50-FDFF, U+FE70-FEFF, U+200C-200E, U+2010-2011, U+204F, U+2E41; }
@font-face { font-family: 'Plex Arabic'; font-style: normal; font-weight: 500; font-display: swap; src: url('/fonts/plex-latin-500.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Plex Arabic'; font-style: normal; font-weight: 600; font-display: swap; src: url('/fonts/plex-arabic-600.woff2') format('woff2'); unicode-range: U+0600-06FF, U+0750-077F, U+0870-08FF, U+FB50-FDFF, U+FE70-FEFF, U+200C-200E, U+2010-2011, U+204F, U+2E41; }
@font-face { font-family: 'Plex Arabic'; font-style: normal; font-weight: 600; font-display: swap; src: url('/fonts/plex-latin-600.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Plex Arabic'; font-style: normal; font-weight: 700; font-display: swap; src: url('/fonts/plex-arabic-700.woff2') format('woff2'); unicode-range: U+0600-06FF, U+0750-077F, U+0870-08FF, U+FB50-FDFF, U+FE70-FEFF, U+200C-200E, U+2010-2011, U+204F, U+2E41; }
@font-face { font-family: 'Plex Arabic'; font-style: normal; font-weight: 700; font-display: swap; src: url('/fonts/plex-latin-700.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
:root {
  --copper: #9A4A14;
  --copper-2: #C9824A;
  --copper-3: #E3B98F;
  --sand: #F6E9DE;
  --bg: #F8F5F1;
  --card: #FFFFFF;
  --line: #ECE5DD;
  --line-2: #DDD3C8;
  --ink: #2A221D;
  --muted: #75695F;
  --dark: #2B2420;
  --dark-2: #3B312B;
  --side-ink: #D6CCC2;
  --side-muted: #9C8F84;
  --red: #B42318;
  --red-bg: #FDECEA;
  --green: #1E7B4F;
  --green-bg: #E6F4EC;
  --amber: #9A6A00;
  --amber-bg: #FFF4D6;
  --blue: #2B5797;
  --blue-bg: #E6EEF8;
  --r: 8px;
  --font: 'Plex Arabic', 'IBM Plex Sans Arabic', 'Segoe UI', Tahoma, sans-serif;
  --shadow: 0 1px 2px rgba(43,36,32,.04), 0 2px 8px rgba(43,36,32,.04);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: var(--font); background: var(--bg); color: var(--ink); font-size: 14px; line-height: 1.75; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; font-feature-settings: 'kern' 1; }
a { color: var(--copper); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; letter-spacing: normal; }
.num, .ltr { direction: ltr; unicode-bidi: isolate; font-variant-numeric: tabular-nums; font-family: var(--font); }
.muted { color: var(--muted); }
.hidden { display: none !important; }
svg.i { width: 16px; height: 16px; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- الدخول ---------- */
.login {
  min-height: 100vh; display: flex; align-items: flex-end; justify-content: center; padding: 40px 24px 8vh;
  background: #E9E4DE url('/brand/banner.jpg') center top / cover no-repeat;
}
.login.nobanner { background: radial-gradient(1200px 600px at 50% 0%, #F6E9DE 0%, #E9E4DE 55%, #D9CFC4 100%); align-items: center; }
.login-card { width: 780px; max-width: 100%; display: flex; flex-wrap: wrap; border-radius: 18px; overflow: hidden; background: rgba(255,255,255,.95); border: 1px solid rgba(201,130,74,.55); box-shadow: 0 24px 60px rgba(43,36,32,.28); }
.login-brand { flex: 1 1 300px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 28px 24px; background: var(--dark); text-align: center; border-left: 3px solid var(--copper-2); }
.logo-frame { width: 132px; height: 102px; border-radius: 12px; background: #fff; display: flex; align-items: center; justify-content: center; box-shadow: 0 0 0 3px var(--copper-2); overflow: hidden; }
.logo-frame img { width: 118px; height: 92px; object-fit: contain; }
.logo-fallback { font-size: 34px; font-weight: 700; color: var(--copper); letter-spacing: 2px; }
.login-brand .t1 { font-size: 16px; font-weight: 700; color: #fff; line-height: 1.6; }
.login-brand .t2 { font-size: 12px; font-weight: 600; color: var(--copper-3); letter-spacing: 1.5px; }
.login-form { flex: 1 1 380px; padding: 28px; display: flex; flex-direction: column; justify-content: center; gap: 14px; }
.login-form h2 { margin: 0; font-size: 17px; }
.iconfield { display: flex; align-items: center; gap: 10px; height: 44px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--line-2); background: #fff; color: var(--muted); }
.iconfield:focus-within { border-color: var(--copper-2); box-shadow: 0 0 0 3px rgba(201,130,74,.15); }
.iconfield input { flex: 1; border: none; outline: none; background: transparent; font-size: 14px; color: var(--ink); min-width: 0; }
.iconfield button { border: none; background: transparent; color: var(--muted); cursor: pointer; display: flex; padding: 4px; }
.btn-login { height: 46px; border-radius: 10px; border: none; background: var(--copper); color: #fff; font-size: 15px; font-weight: 700; cursor: pointer; box-shadow: inset 0 -3px 0 var(--copper-2); }
.btn-login:disabled { opacity: .6; cursor: wait; }
.form-err { background: var(--red-bg); color: var(--red); border-radius: 8px; padding: 8px 12px; font-size: 12px; }
.check { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--copper); margin: 0; }

/* ---------- الإطار العام ---------- */
.app { display: flex; min-height: 100vh; }
.side { flex: 0 0 260px; background: var(--dark); padding: 16px 12px; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.side-brand { display: flex; align-items: center; gap: 10px; padding: 0 6px 12px; border-bottom: 1px solid var(--dark-2); }
.side-logo { width: 44px; height: 44px; border-radius: 8px; background: #fff; display: flex; align-items: center; justify-content: center; overflow: hidden; flex-shrink: 0; }
.side-logo img { width: 40px; height: 32px; object-fit: contain; }
.side-logo .logo-fallback { font-size: 14px; }
.side-brand .t1 { font-size: 14px; font-weight: 700; color: #fff; }
.side-brand .t2 { font-size: 12px; color: var(--copper-2); }
.nav { display: flex; flex-direction: column; gap: 1px; padding-top: 6px; }
.nav-sec { padding: 14px 12px 4px; font-size: 12px; font-weight: 600; color: var(--side-muted); }
.nav a { display: flex; align-items: center; gap: 10px; height: 38px; padding: 0 12px; border-radius: 8px; color: var(--side-ink); font-size: 14px; }
.nav a:hover { background: rgba(255,255,255,.04); }
.nav a.on { background: var(--dark-2); color: #fff; font-weight: 600; box-shadow: inset -3px 0 0 var(--copper-2); }
.nav a.soon { opacity: .45; cursor: default; }
.nav a.soon:hover { background: none; }
.nav .tag { margin-right: auto; font-size: 10px; padding: 0 6px; border-radius: 999px; border: 1px solid var(--side-muted); color: var(--side-muted); line-height: 16px; }
.nav .badge { margin-right: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--copper-2); color: var(--dark); font-size: 11px; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.side-user { margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 12px 6px 0; border-top: 1px solid var(--dark-2); }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--copper-2); color: var(--dark); display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; flex-shrink: 0; }
.side-user .n { font-size: 14px; font-weight: 600; color: #fff; }
.side-user .r { font-size: 12px; color: var(--side-muted); }
.side-user button { width: 32px; height: 32px; border: none; background: transparent; color: var(--side-muted); display: flex; align-items: center; justify-content: center; cursor: pointer; border-radius: 6px; }
.side-user button:hover { color: #fff; background: var(--dark-2); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 24px; background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.search { display: flex; align-items: center; gap: 8px; height: 40px; width: 400px; max-width: 100%; padding: 0 12px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg); color: var(--muted); }
.search:focus-within { border-color: var(--copper-2); background: #fff; }
.search input { flex: 1; border: none; outline: none; background: transparent; color: var(--ink); min-width: 0; }
.kbd { font-size: 11px; color: var(--muted); border: 1px solid var(--line); border-radius: 4px; padding: 0 6px; direction: ltr; }
.menu-btn { display: none; }
.demo-bar { background: var(--amber-bg); color: var(--amber); padding: 6px 24px; font-size: 12px; font-weight: 600; border-bottom: 1px solid #F1DFA8; }
.content { padding: 24px 28px 40px; display: flex; flex-direction: column; gap: 20px; max-width: 1600px; width: 100%; }

/* ---------- عناوين الصفحات ---------- */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; }
.crumb { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 4px; }
.page-head h1 { margin: 4px 0 0; font-size: 23px; font-weight: 700; line-height: 1.4; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---------- أزرار ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 38px; padding: 0 14px; font-size: 14px; font-weight: 500; border-radius: 8px; border: 1px solid var(--line); background: #fff; color: var(--ink); cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: var(--line-2); background: var(--bg); }
.btn.primary { border: none; background: var(--copper); color: #fff; font-weight: 600; box-shadow: inset 0 -3px 0 var(--copper-2); padding: 0 14px; }
.btn.primary:hover { background: #87400F; }
.btn.danger { color: var(--red); }
.btn.danger:hover { background: var(--red-bg); border-color: #F3C6C1; }
.btn.sm { height: 32px; padding: 0 11px; font-size: 13px; }
.btn.icon { width: 36px; padding: 0; }
.btn.sm.icon { width: 30px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.linkbtn { border: none; background: none; color: var(--copper); cursor: pointer; padding: 0; font-weight: 600; }

/* ---------- بطاقات ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 22px 24px; display: flex; flex-direction: column; gap: 16px; min-width: 0; box-shadow: var(--shadow); }
.card.flush { padding: 0; gap: 0; overflow: hidden; }
.card h2 { margin: 0; font-size: 16px; font-weight: 700; line-height: 1.5; border-right: 4px solid var(--copper-2); padding-right: 8px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.card h2 .sub { font-size: 13px; color: var(--muted); font-weight: 400; }
.card-head { padding: 18px 24px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.grid { display: grid; gap: 16px; }
.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.split { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-start; }
.split > .wide { flex: 2 1 560px; min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.split > .narrow { flex: 1 1 320px; min-width: 0; display: flex; flex-direction: column; gap: 16px; }

/* ---------- مؤشرات ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.kpi { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 18px 20px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 4px; position: relative; }
.kpi .lbl { font-size: 13.5px; font-weight: 500; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.kpi .val { font-size: 30px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.35; margin-top: 2px; }
.kpi .foot { font-size: 12.5px; color: var(--muted); }
.kpi.accent { border-top: 3px solid var(--copper); }
.kpi.warn .val { color: var(--amber); }
.kpi a.stretch::after { content: ''; position: absolute; inset: 0; }
.kpi:hover { border-color: var(--line-2); }
.up { color: var(--green); } .down { color: var(--red); }

/* ---------- رسوم ---------- */
.chart { width: 100%; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .bar { fill: var(--copper-2); }
.chart .bar.cur { fill: var(--copper); }
.chart .hit { fill: transparent; cursor: default; }
.chart .hit:hover + .bar, .chart g:hover .bar { fill: var(--copper); }
.chart .axis { fill: var(--muted); font-size: 12px; font-family: var(--font); }
.chart .val { fill: var(--ink); font-size: 12px; font-weight: 600; font-family: var(--font); }
.chart .grid-l { stroke: var(--line); stroke-width: 1; }
.hbars { display: flex; flex-direction: column; gap: 12px; }
.hbar { display: grid; grid-template-columns: minmax(0, 1fr) 48px; gap: 4px 10px; align-items: center; }
.hbar .nm { font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hbar .n { font-size: 13.5px; font-weight: 600; text-align: left; font-variant-numeric: tabular-nums; }
.hbar .track { grid-column: 1 / -1; height: 8px; border-radius: 4px; background: var(--bg); overflow: hidden; }
.hbar .fill { height: 100%; border-radius: 4px; background: var(--copper-2); }
.hbar:hover .fill { background: var(--copper); }
a.hbar { color: inherit; }
.tip { position: fixed; z-index: 100; pointer-events: none; background: var(--dark); color: #fff; font-size: 13px; padding: 6px 10px; border-radius: 6px; box-shadow: 0 6px 18px rgba(0,0,0,.18); white-space: nowrap; }

/* ---------- جداول ---------- */
.table-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; }
table.t th { text-align: right; font-size: 13px; font-weight: 600; color: var(--muted); background: #FAF7F3; padding: 0 14px; height: 44px; border-bottom: 1px solid var(--line); white-space: nowrap; position: sticky; top: 0; }
table.t td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; font-size: 14px; line-height: 1.6; }
table.t tr:last-child td { border-bottom: none; }
table.t tbody tr { cursor: pointer; }
table.t tbody tr:hover td { background: #FCF8F4; }
table.t.static tbody tr { cursor: default; }
table.t .no { font-weight: 600; white-space: nowrap; }
table.t .sub { font-size: 12.5px; color: var(--muted); }
table.t .clip { max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.empty { padding: 40px 20px; text-align: center; color: var(--muted); }
.pager { display: flex; justify-content: space-between; align-items: center; padding: 14px 24px; border-top: 1px solid var(--line); flex-wrap: wrap; gap: 8px; font-size: 13.5px; color: var(--muted); }
.pager .pg { display: flex; gap: 4px; align-items: center; }

/* ---------- شارات ---------- */
.chip { display: inline-flex; align-items: center; gap: 5px; height: 26px; padding: 0 10px; border-radius: 999px; font-size: 12.5px; font-weight: 600; background: var(--bg); color: var(--muted); white-space: nowrap; }
.chip.copper { background: var(--sand); color: var(--copper); }
.chip.green { background: var(--green-bg); color: var(--green); }
.chip.amber { background: var(--amber-bg); color: var(--amber); }
.chip.red { background: var(--red-bg); color: var(--red); }
.chip.blue { background: var(--blue-bg); color: var(--blue); }
.files { display: inline-flex; gap: 4px; }
.ficon { width: 30px; height: 24px; border-radius: 6px; display: inline-flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; }
.ficon.w { background: var(--blue-bg); color: var(--blue); }
.ficon.p { background: var(--red-bg); color: var(--red); }
.ficon.ghost { background: transparent; border: 1px dashed var(--line-2); color: var(--line-2); }
.ficon.flag { outline: 1px dashed currentColor; outline-offset: -1px; opacity: .7; }

/* ---------- فلاتر ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 16px 24px; border-bottom: 1px solid var(--line); }
.filters .search { width: 300px; background: #fff; }
.filters select, .filters input[type=date] { height: 40px; font-size: 14px; border-radius: 8px; border: 1px solid var(--line); background: #fff; padding: 0 10px; max-width: 200px; }
.filters .sep { flex: 1; }
.active-filters { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px 20px 0; }
.active-filters .chip { cursor: pointer; }

/* ---------- نماذج ---------- */
.fgrid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px 20px; }
.f { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.f.s2 { grid-column: span 2; } .f.s3 { grid-column: 1 / -1; }
.f label { font-size: 13.5px; font-weight: 600; color: var(--ink); }
.f label .req { color: var(--red); }
.f .hint { font-size: 12.5px; color: var(--muted); line-height: 1.5; }
.f .hint.warn { color: var(--amber); }
.f .hint.err { color: var(--red); }
.inp { min-height: 44px; padding: 0 14px; border-radius: 9px; border: 1px solid var(--line-2); background: #fff; width: 100%; outline: none; font-size: 14.5px; }
textarea.inp { padding: 10px 12px; min-height: 72px; resize: vertical; line-height: 1.6; }
.inp:focus { border-color: var(--copper-2); box-shadow: 0 0 0 3px rgba(201,130,74,.15); }
.inp[readonly] { background: var(--bg); }
.inp.bad { border-color: var(--red); }
select.inp { cursor: pointer; }
.combo { position: relative; }
.combo .inp { padding-left: 32px; }
.combo .caret { position: absolute; left: 10px; top: 12px; color: var(--muted); pointer-events: none; }
.combo-list { position: absolute; top: calc(100% + 4px); right: 0; left: 0; z-index: 30; background: #fff; border: 1px solid var(--line-2); border-radius: 8px; box-shadow: 0 12px 28px rgba(43,36,32,.14); max-height: 260px; overflow-y: auto; padding: 4px; }
.combo-list div { padding: 9px 12px; font-size: 14px; border-radius: 6px; cursor: pointer; display: flex; justify-content: space-between; gap: 8px; }
.combo-list div.on, .combo-list div:hover { background: var(--sand); }
.combo-list div .c { font-size: 12px; color: var(--muted); }
.combo-list .add { color: var(--copper); font-weight: 600; border-top: 1px solid var(--line); margin-top: 4px; }
.seg { display: inline-flex; border: 1px solid var(--line-2); border-radius: 9px; overflow: hidden; height: 44px; }
.seg button { border: none; background: #fff; padding: 0 18px; cursor: pointer; font-size: 14px; }
.seg button.on { background: var(--sand); color: var(--copper); font-weight: 600; }
.seg button + button { border-right: 1px solid var(--line); }

/* ---------- المرفقات ---------- */
.att { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 8px; border: 1px solid var(--line); }
.att .ic { width: 36px; height: 36px; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; flex-shrink: 0; }
.att .ic.WORD { background: var(--blue-bg); color: var(--blue); }
.att .ic.PDF { background: var(--red-bg); color: var(--red); }
.att .ic.OTHER { background: var(--bg); color: var(--muted); }
.att .meta { flex: 1; min-width: 0; }
.att .meta .nm { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.att .meta .sz { font-size: 12.5px; color: var(--muted); }
.drop { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 20px; border-radius: 8px; border: 1.5px dashed var(--copper-2); background: var(--sand); text-align: center; cursor: pointer; }
.drop.over { background: #F0DAC8; }
.drop .ttl { font-size: 14px; font-weight: 500; }
.drop .sml { font-size: 12.5px; color: var(--muted); }
.preview { width: 100%; height: 640px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); }

/* ---------- تفاصيل ---------- */
.dl { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px 20px; }
.dl > div { min-width: 0; }
.dl dt { font-size: 12.5px; color: var(--muted); margin-bottom: 4px; }
.dl dd { margin: 0; font-size: 15px; font-weight: 500; line-height: 1.6; overflow-wrap: anywhere; }
.dl .s3 { grid-column: 1 / -1; }
.hero-no { font-size: 22px; font-weight: 700; color: var(--copper); }
.list-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; min-height: 46px; font-size: 14px; border-top: 1px solid var(--line); font-size: 13px; color: inherit; }
.list-row:first-of-type { border-top: none; }
.list-row:hover { color: var(--copper); }
.notice { border-radius: 10px; padding: 12px 16px; font-size: 13.5px; line-height: 1.7; display: flex; gap: 8px; align-items: flex-start; }
.notice.warn { background: var(--amber-bg); color: var(--amber); }
.notice.info { background: var(--sand); color: var(--copper); }

/* ---------- نوافذ ---------- */
.modal-back { position: fixed; inset: 0; background: rgba(35,28,23,.45); z-index: 50; display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal { background: #fff; border-radius: 12px; width: 480px; max-width: 100%; max-height: 90vh; overflow-y: auto; box-shadow: 0 24px 60px rgba(0,0,0,.25); }
.modal .mh { padding: 16px 20px; border-bottom: 1px solid var(--line); font-weight: 700; font-size: 15px; }
.modal .mb { padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.modal .mf { padding: 14px 20px; border-top: 1px solid var(--line); display: flex; justify-content: flex-start; gap: 8px; }
.toasts { position: fixed; bottom: 20px; left: 20px; z-index: 60; display: flex; flex-direction: column; gap: 8px; }
.toast { background: var(--dark); color: #fff; padding: 12px 18px; border-radius: 10px; font-size: 14px; box-shadow: 0 8px 24px rgba(0,0,0,.2); max-width: 380px; animation: tin .2s ease-out; }
.toast.err { background: var(--red); }
.toast.ok { border-right: 4px solid var(--copper-2); }
@keyframes tin { from { opacity: 0; transform: translateY(8px); } }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); padding: 0 20px; }
.tabs button { border: none; background: none; padding: 14px 16px; font-size: 14px; cursor: pointer; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs button.on { color: var(--copper); border-bottom-color: var(--copper); font-weight: 600; }
.loading { padding: 60px; text-align: center; color: var(--muted); }
.spin { width: 22px; height: 22px; border: 2px solid var(--line); border-top-color: var(--copper); border-radius: 50%; animation: sp .8s linear infinite; display: inline-block; }
@keyframes sp { to { transform: rotate(360deg); } }

/* ---------- التقرير المطبوع ---------- */
.report-paper { background: #fff; width: 1123px; max-width: 100%; margin: 0 auto; padding: 32px 40px 24px; border: 1px solid var(--line); box-shadow: 0 8px 30px rgba(43,36,32,.08); color: #1F2328; }
.rp-head { display: flex; justify-content: space-between; align-items: center; padding-bottom: 12px; border-bottom: 2px solid var(--copper); gap: 12px; }
.rp-brand { display: flex; align-items: center; gap: 10px; }
.rp-brand .lg { width: 44px; height: 44px; border-radius: 8px; overflow: hidden; display: flex; align-items: center; justify-content: center; background: #fff; border: 1px solid var(--line); }
.rp-brand .lg img { width: 40px; height: 34px; object-fit: contain; }
.rp-brand .a { font-size: 14px; font-weight: 700; } .rp-brand .b { font-size: 10px; color: #5C6370; }
.rp-title { text-align: center; } .rp-title .a { font-size: 16px; font-weight: 700; color: var(--copper); } .rp-title .b { font-size: 10px; color: #5C6370; }
.rp-meta { font-size: 10px; color: #5C6370; line-height: 1.7; text-align: left; }
.rp-sum { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border: 1px solid #E4E6EA; border-radius: 6px; margin: 12px 0; }
.rp-sum > div { padding: 8px 12px; border-left: 1px solid #E4E6EA; } .rp-sum > div:last-child { border-left: none; }
.rp-sum .k { font-size: 10px; color: #5C6370; } .rp-sum .v { font-size: 12px; font-weight: 600; margin-top: 2px; }
table.rp { width: 100%; border-collapse: collapse; table-layout: fixed; font-size: 11px; }
table.rp th { text-align: right; padding: 0 8px; height: 30px; font-weight: 600; color: #fff; background: var(--copper); }
table.rp td { padding: 5px 8px; border-bottom: 1px solid #E4E6EA; vertical-align: top; overflow-wrap: anywhere; }
table.rp tr.mon td { background: var(--sand); color: var(--copper); font-weight: 700; padding: 6px 8px; }
table.rp tr.tot td { font-weight: 600; text-align: left; } table.rp tr.tot td:last-child { text-align: right; font-weight: 700; }
table.rp tr.grand td { background: var(--dark); color: #fff; font-weight: 700; text-align: left; } table.rp tr.grand td:last-child { text-align: right; }
table.rp thead { display: table-header-group; }
table.rp tr { page-break-inside: avoid; }
.rp-sign { display: flex; margin: 28px 0 12px; }
.rp-sign > div { flex: 1; text-align: center; font-size: 11px; color: #5C6370; }
.rp-sign .ln { border-top: 1px solid #C9CDD3; margin: 28px 24px 0; padding-top: 4px; font-size: 10px; }
.rp-foot { display: flex; justify-content: space-between; font-size: 10px; color: #5C6370; border-top: 1px solid #E4E6EA; padding-top: 6px; }

@media print {
  @page { size: A4 landscape; margin: 10mm; }
  body { background: #fff; }
  .side, .topbar, .demo-bar, .no-print, .toasts { display: none !important; }
  .content { padding: 0; }
  .report-paper { border: none; box-shadow: none; width: auto; padding: 0; }
  table.rp th, table.rp tr.mon td, table.rp tr.grand td { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* ---------- الشاشات المتوسطة ---------- */
@media (max-width: 1500px) {
  table.t .hide-l { display: none; }
  table.t td, table.t th { padding-left: 12px; padding-right: 12px; }
  table.t .subj { max-width: 200px; }
}

/* ---------- الجوال ---------- */
@media (max-width: 1100px) {
  .cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .side { position: fixed; right: 0; top: 0; z-index: 40; transform: translateX(105%); transition: transform .2s; visibility: hidden; }
  .app.menu-open .side { transform: none; visibility: visible; box-shadow: -10px 0 40px rgba(0,0,0,.3); }
  .topbar { flex-wrap: nowrap; }
  .topbar .lbl-t { display: none; }
  .topbar .btn.primary { width: 36px; padding: 0; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi { padding: 12px; }
  .kpi .val { font-size: 22px; }
  .page-head h1 { font-size: 18px; }
  .menu-btn { display: inline-flex; }
  .topbar, .content { padding-left: 14px; padding-right: 14px; }
  .search { width: auto; flex: 1; }
  .kbd { display: none; }
  .cols-2, .cols-3, .fgrid, .dl { grid-template-columns: minmax(0, 1fr); }
  .f.s2, .f.s3, .dl .s3 { grid-column: auto; }
  .filters .search { width: 100%; }
  .filters select, .filters input[type=date] { flex: 1 1 140px; max-width: none; }
  table.t .hide-m { display: none; }
  .preview { height: 420px; }
  .rp-sum { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* =====================================================================
   التصميم المعتمد — مضغوط، خطوط فاصلة في الجداول، خط واحد متناسق
   ===================================================================== */
:root { --bg: #F5F1EC; --line: #E3D9CE; --muted: #6F635A; --head: #F3E7DC; --head-ink: #6E340D; --zebra: #FBF8F4; }
body { font-size: 14px; line-height: 1.6; }
.side { flex: 0 0 236px; padding: 14px 10px; }
.nav a { height: 36px; font-size: 13.5px; border-radius: 7px; }
.nav-sec { padding: 12px 12px 4px; font-size: 11.5px; }
.side-brand .t1 { font-size: 13.5px; } .side-brand .t2 { font-size: 11.5px; }
.topbar { min-height: 56px; padding: 0 20px; }
.search { height: 36px; }
.content { padding: 16px 20px 24px; gap: 12px; max-width: none; }

/* عنوان الصفحة في سطر واحد */
.page-head { align-items: center; }
.page-head > div:first-child { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.page-head h1 { order: -1; margin: 0; font-size: 20px; }
.crumb { font-size: 12.5px; }

.btn { height: 34px; padding: 0 12px; font-size: 13.5px; border-radius: 7px; }
.btn.primary { padding: 0 14px; }
.btn.sm { height: 30px; font-size: 12.5px; }

.card { padding: 14px 16px; gap: 12px; border-radius: 10px; box-shadow: none; }
.card h2 { font-size: 14.5px; }
.card-head { padding: 10px 16px; background: var(--zebra); }
.kpis { gap: 12px; }
.kpi { padding: 14px 16px; border-radius: 10px; box-shadow: none; }
.kpi .val { font-size: 26px; }
.kpi .lbl { font-size: 13px; } .kpi .foot { font-size: 12px; }

/* الجداول بشبكة كاملة */
table.t { border-collapse: collapse; }
table.t th { background: var(--head); color: var(--head-ink); font-size: 13px; font-weight: 700; height: 38px; padding: 0 10px; border: 1px solid var(--line); position: static; }
table.t td { padding: 7px 10px; border: 1px solid var(--line); font-size: 13.5px; line-height: 1.55; }
table.t tbody tr:nth-child(even) td { background: var(--zebra); }
table.t tbody tr:hover td { background: #F6ECE2; }
table.t tr > :first-child { border-right: none; }
table.t tr > :last-child { border-left: none; }
table.t thead th { border-top: none; }
table.t tbody tr:last-child td { border-bottom: none; }
table.t .clip { max-width: none; white-space: normal; overflow: visible; text-overflow: clip; }
table.t .sub { font-size: 11.5px; }
table.t .no .num { font-size: 13px; white-space: nowrap; }
table.t td.idx { text-align: center; color: var(--muted); font-size: 12.5px; }
table.t.fixed { table-layout: fixed; min-width: 1100px; }
.pager { padding: 10px 14px; font-size: 13px; }

/* الفلاتر في صف واحد بعناوين صغيرة */
.filters { padding: 12px 14px; gap: 10px; align-items: flex-end; }
.filters .fl { display: flex; flex-direction: column; gap: 3px; flex: 0 1 140px; min-width: 100px; }
.filters .fl.grow { flex: 1 1 180px; min-width: 160px; }
.filters .fl > span { font-size: 12px; font-weight: 600; color: var(--muted); }
.filters .fl select, .filters .fl input[type=date] { height: 34px; max-width: none; width: 100%; font-size: 13.5px; border-radius: 7px; }
.filters .fl .search { width: 100%; height: 34px; border-radius: 7px; }

/* النماذج */
.card.sec { padding: 0; gap: 0; overflow: hidden; }
.card.sec > h2 { padding: 10px 16px; border-bottom: 1px solid var(--line); background: var(--zebra); border-right: none; justify-content: flex-start; gap: 8px; }
.card.sec > h2::before { content: ''; width: 4px; height: 16px; border-radius: 2px; background: var(--copper-2); }
.card.sec > .sec-body { padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; }
.card.sec > .fgrid { padding: 14px 16px; }
.card.sec > table.t { width: 100%; }
.fgrid { gap: 12px 14px; }
.f label { font-size: 12.5px; }
.f .hint { font-size: 11.5px; }
.inp { min-height: 36px; padding: 0 11px; border-radius: 7px; border-color: #DCD1C5; font-size: 13.5px; }
textarea.inp { min-height: 60px; padding: 8px 11px; }
.combo .caret { top: 11px; }
.seg { height: 34px; border-radius: 7px; border-color: #DCD1C5; }
.seg button { padding: 0 14px; font-size: 13px; }
.drop { padding: 12px; flex-direction: row; justify-content: center; gap: 8px; }
.att { padding: 8px 10px; border-radius: 7px; }
.dl { gap: 12px 16px; }
.dl dd { font-size: 14px; }
.notice { padding: 10px 14px; font-size: 13px; }
.list-row { min-height: 40px; font-size: 13.5px; }

/* ===== التقرير: بعرض الصفحة، تجميع شهر ← مكان عمل ← طالب ===== */
.report-paper { width: auto; max-width: none; margin: 0; padding: 22px 26px 18px; box-shadow: 0 6px 24px rgba(43,36,32,.08); border-radius: 4px; }
table.rp { table-layout: auto; font-size: 12px; }
table.rp th { border: 1px solid #8A4212; height: 32px; white-space: nowrap; }
table.rp td { border: 1px solid #D9CEC2; padding: 6px 8px; line-height: 1.55; }
table.rp td.nw { white-space: nowrap; }
table.rp td.subj { width: 100%; }
table.rp td.c { text-align: center; vertical-align: middle; }
table.rp tr.mon td { background: var(--sand); color: var(--copper); font-weight: 700; font-size: 13px; padding: 7px 10px; }
table.rp tr.wp td { background: #FBF5EF; font-weight: 700; font-size: 12.5px; padding: 6px 22px 6px 10px; }
table.rp tr.rq td { background: #fff; font-size: 12px; padding: 5px 40px 5px 10px; }
table.rp .lbl { color: #6F635A; font-weight: 500; }
table.rp .cnt { color: #6F635A; font-weight: 600; font-size: 11.5px; margin-right: 6px; }
table.rp tr.row:nth-child(even) td { background: #FBF8F4; }
.mk { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 20px; border-radius: 4px; }
.mk.w { background: var(--blue-bg); color: var(--blue); } .mk.p { background: var(--red-bg); color: var(--red); }
.mk svg.i { width: 13px; height: 13px; stroke-width: 2.2; }
.mk-no { color: #B7AA9D; }
@media print {
  @page { size: A4 landscape; margin: 8mm; }
  .report-paper { padding: 0; }
  table.rp tr.wp td, table.rp tr.rq td, table.rp tr.row td, .mk { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
@media (max-width: 860px) {
  .page-head > div:first-child { flex-direction: column; align-items: flex-start; gap: 2px; }
  .filters .fl, .filters .fl.grow { flex: 1 1 45%; }
}
table.rp tr.tot td.c, table.rp tr.grand td.c { text-align: center; }
table.rp td.c { white-space: nowrap; }
.active-filters:empty { display: none; }
.active-filters { padding: 8px 14px 0; }
.pager .pg select.btn { padding: 0 8px; }
.card.sec { overflow: visible; }
.card.sec > h2 { border-radius: 10px 10px 0 0; }
.card.sec > #hist table.t { border-radius: 0 0 10px 10px; overflow: hidden; }

/* =====================================================================
   خطوط أصغر + صف واحد لكل سطر + محاذاة حسب نوع البيان
   ===================================================================== */
body { font-size: 13px; line-height: 1.5; }
.side { flex: 0 0 220px; padding: 12px 8px; }
.side-logo { width: 38px; height: 38px; }
.side-brand .t1 { font-size: 13px; } .side-brand .t2 { font-size: 11px; }
.nav a { height: 32px; font-size: 13px; gap: 9px; padding: 0 10px; }
.nav-sec { padding: 10px 10px 3px; font-size: 11px; }
.nav .tag { font-size: 10px; line-height: 15px; }
.side-user .n { font-size: 12.5px; } .side-user .r { font-size: 11px; }
.avatar { width: 28px; height: 28px; font-size: 12px; }
svg.i { width: 15px; height: 15px; }

.topbar { min-height: 50px; padding: 0 18px; }
.search { height: 32px; font-size: 12.5px; }
.search input { font-size: 12.5px; }
.demo-bar { padding: 4px 18px; font-size: 11.5px; }
.content { padding: 14px 18px 20px; gap: 10px; }
.page-head h1 { font-size: 17px; }
.crumb { font-size: 11.5px; }

.btn { height: 32px; padding: 0 11px; font-size: 12.5px; gap: 5px; }
.btn.primary { padding: 0 12px; }
.btn.sm { height: 28px; padding: 0 9px; font-size: 12px; }
.btn.icon { width: 32px; } .btn.sm.icon { width: 28px; }

.card { padding: 12px 14px; gap: 10px; }
.card h2 { font-size: 13.5px; }
.card h2 .sub { font-size: 11.5px; }
.card-head { padding: 8px 14px; }
.kpis { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; }
.kpi { padding: 10px 14px; gap: 2px; }
.kpi .lbl { font-size: 12px; } .kpi .val { font-size: 22px; line-height: 1.3; } .kpi .foot { font-size: 11px; }
.hbars { gap: 9px; }
.hbar .nm, .hbar .n { font-size: 12.5px; }
.hbar .track { height: 6px; }
.chart .axis { font-size: 11px; } .chart .val { font-size: 11px; }

/* جداول: صف واحد، أعمدة على قد الكلام */
table.t th { font-size: 12px; height: 32px; padding: 0 8px; }
table.t td { font-size: 12.5px; padding: 5px 8px; line-height: 1.45; }
table.t td.nw, table.t th { white-space: nowrap; }
table.t td.c, table.t th.c { text-align: center; }
table.t td.el { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
table.t td.idx { font-size: 11.5px; width: 1%; }
table.t .no .num { font-size: 12.5px; }
table.t .sub { font-size: 11px; }
table.t.fixed { table-layout: auto; min-width: 0; }
.chip { height: 22px; padding: 0 8px; font-size: 11.5px; }
.ficon { width: 26px; height: 20px; font-size: 10px; border-radius: 5px; }
.pager { padding: 8px 14px; font-size: 12.5px; }
.pager .pg select.btn { height: 28px; font-size: 12px; }

/* فلاتر */
.filters { padding: 10px 12px; gap: 8px; }
.filters .fl > span { font-size: 11.5px; }
.filters .fl select, .filters .fl input[type=date], .filters .fl .search { height: 32px; font-size: 12.5px; }
.active-filters { padding: 6px 12px 0; }

/* نماذج وتفاصيل */
.card.sec > h2 { padding: 8px 14px; font-size: 13.5px; }
.card.sec > .fgrid, .card.sec > .sec-body { padding: 12px 14px; }
.fgrid { gap: 10px 12px; }
.f { gap: 4px; }
.f label { font-size: 12px; }
.f .hint { font-size: 11px; }
.inp { min-height: 32px; font-size: 13px; padding: 0 10px; }
textarea.inp { min-height: 54px; padding: 6px 10px; }
.combo .caret { top: 9px; }
.combo-list div { padding: 6px 10px; font-size: 13px; }
.seg { height: 32px; } .seg button { font-size: 12.5px; padding: 0 12px; }
.drop { padding: 10px; } .drop .ttl { font-size: 12.5px; } .drop .sml { font-size: 11px; }
.att { padding: 6px 8px; gap: 10px; } .att .ic { width: 30px; height: 30px; font-size: 10px; }
.att .meta .nm { font-size: 12.5px; } .att .meta .sz { font-size: 11px; }
.dl { gap: 10px 14px; } .dl dt { font-size: 11px; margin-bottom: 2px; } .dl dd { font-size: 13px; }
.notice { padding: 8px 12px; font-size: 12.5px; }
.list-row { min-height: 34px; font-size: 12.5px; }
.tabs button { padding: 10px 12px; font-size: 12.5px; }
.toast { padding: 9px 14px; font-size: 12.5px; }
.modal .mh { font-size: 14px; padding: 12px 16px; } .modal .mb { padding: 16px; gap: 12px; } .modal .mf { padding: 10px 16px; }
.preview { height: 560px; }

/* التقرير */
.report-paper { padding: 18px 22px 14px; }
.rp-brand .a { font-size: 13px; } .rp-title .a { font-size: 15px; }
.rp-sum .v { font-size: 11.5px; } .rp-sum .k { font-size: 10px; }
table.rp { font-size: 11px; }
table.rp th { height: 28px; font-size: 11px; padding: 0 6px; }
table.rp td { padding: 4px 6px; line-height: 1.4; }
table.rp tr.mon td { font-size: 12px; padding: 5px 8px; }
table.rp tr.wp td { font-size: 11.5px; padding: 4px 20px 4px 8px; }
table.rp tr.rq td { font-size: 11px; padding: 3px 36px 3px 8px; }
table.rp .cnt { font-size: 10.5px; }
.mk { width: 18px; height: 16px; } .mk svg.i { width: 11px; height: 11px; }

/* تسجيل الدخول */
.login-form { gap: 12px; }
.iconfield { height: 40px; } .iconfield input { font-size: 13.5px; }
.btn-login { height: 42px; font-size: 14px; }
/* الخلية الممتدة بتاخد الباقي والكلام بيتختصر بدل ما يوسّع الجدول */
table.t { width: 100%; }
table.t td.fill { width: 100%; max-width: 0; }
table.t .el { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
table.t td.fill .el { max-width: none; }
.chart .axis { fill: #4F453D; font-size: 11.5px; font-weight: 600; }
.chart .axis.sub { fill: #8A7E74; font-size: 10.5px; font-weight: 400; }

/* ===== صفحة التحليل ===== */
table.heat { width: 100%; border-collapse: separate; border-spacing: 3px; table-layout: fixed; min-width: 900px; }
table.heat th { font-size: 11.5px; font-weight: 600; color: var(--muted); padding: 2px 0 4px; text-align: center; }
table.heat th.hm-y { width: 92px; text-align: right; color: var(--ink); font-size: 12.5px; font-weight: 700; padding-right: 2px; }
table.heat td { height: 34px; text-align: center; font-size: 12.5px; font-weight: 600; border-radius: 5px; font-variant-numeric: tabular-nums; cursor: default; }
table.heat td.hm:hover { outline: 2px solid var(--dark); outline-offset: -2px; }
table.heat td.none { background: repeating-linear-gradient(135deg, #F7F3EE 0 4px, #EFE8E0 4px 5px); }
table.heat td.partial { box-shadow: inset 0 0 0 2px var(--dark); }
table.heat .hm-t { width: 86px; background: var(--zebra); color: var(--ink); font-weight: 700; }
table.heat th.hm-t { background: none; }
table.heat tr.hm-avg td { background: transparent; color: var(--muted); font-weight: 600; border-top: 1px solid var(--line); height: 30px; font-size: 12px; }
table.heat tr.hm-avg .hm-t { background: var(--sand); color: var(--copper); }
.hm-tag { display: block; font-size: 10px; font-weight: 500; color: var(--muted); }
.legend { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 11.5px; color: var(--muted); }
.legend i { width: 18px; height: 12px; border-radius: 3px; display: inline-block; }
.legend i.partial-sw { background: #fff; box-shadow: inset 0 0 0 2px var(--dark); }
.legend .sep { width: 14px; }
.legend.top { margin-top: -4px; }
.an-grid { align-items: start; }
table.types-y td.top { color: var(--copper); font-weight: 700; background: var(--sand) !important; }
@media print { .an-grid { grid-template-columns: 1fr 1fr; } table.heat td { -webkit-print-color-adjust: exact; print-color-adjust: exact; } }

/* ===== شكل البرنامج ===== */
.login { background-image: none; }
.login-brand .t1 { font-size: 16px; line-height: 1.6; }
.login-brand .t2 { font-size: 13.5px; font-weight: 600; color: var(--copper-3); letter-spacing: 0; }
.side-brand { align-items: flex-start; }
.side-brand .t1 { line-height: 1.4; }
.side-brand .t2 { line-height: 1.5; margin-top: 2px; }
.bg-prev { position: relative; aspect-ratio: 16 / 9; border-radius: 8px; border: 1px solid var(--line); background: radial-gradient(900px 400px at 50% 0%, #F6E9DE, #E9E4DE 60%, #D9CFC4) center / cover no-repeat; display: flex; align-items: flex-end; justify-content: center; padding: 0 0 7%; overflow: hidden; }
.bg-prev > span { position: absolute; top: 12px; right: 12px; font-size: 12px; }
.bg-card { width: 54%; display: flex; border-radius: 8px; overflow: hidden; background: rgba(255,255,255,.95); border: 1px solid rgba(201,130,74,.55); box-shadow: 0 10px 30px rgba(43,36,32,.3); }
.bg-side { flex: 0 0 44%; background: var(--dark); color: #fff; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 10px 6px; text-align: center; border-left: 2px solid var(--copper-2); }
.bg-side b { font-size: 9px; line-height: 1.4; } .bg-side small { font-size: 8px; color: var(--copper-3); }
.bg-logo { width: 40px; height: 30px; background: #fff; border-radius: 4px; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.bg-logo img { width: 36px; height: 26px; object-fit: contain; } .bg-logo .logo-fallback { font-size: 11px; }
.bg-form { flex: 1; padding: 12px; display: flex; flex-direction: column; gap: 6px; justify-content: center; }
.bg-form i { display: block; height: 10px; border-radius: 3px; border: 1px solid var(--line-2); }
.bg-form i.go { background: var(--copper); border: none; }

/* ================= الالتزامات المالية (العهد) ================= */
.fn-t td, .fn-t th { white-space: nowrap; }
.fn-t td.fill { white-space: normal; }
.fn-no { color: var(--copper); }
.fn-chips { display: inline-flex; gap: 3px; }
button.fn-chips.btnlike { border: none; background: none; padding: 2px; cursor: pointer; border-radius: 5px; }
button.fn-chips.btnlike:hover { background: var(--sand); }
.fn-chip { display: inline-flex; align-items: center; justify-content: center; min-width: 30px; height: 19px; padding: 0 4px; border-radius: 4px; font-size: 10px; font-weight: 700; line-height: 1; box-sizing: border-box; }
.fn-chip.x { background: #E7F3EC; color: #1D6B3F; }
.fn-chip.p { background: var(--red-bg); color: var(--red); }
.fn-chip.i { background: #EEF0FB; color: #3949AB; }
.fn-chip.a { background: #F3E7DC; color: var(--copper); }
.fn-chip.ghost { border: 1px dashed #D5CBC0; color: #C4B8AC; background: #fff; }
.fn-bar { display: inline-flex; align-items: center; gap: 6px; }
.fn-bar .tr { width: 60px; height: 6px; border-radius: 3px; background: #EFE6DC; overflow: hidden; display: inline-block; }
.fn-bar .tr span { display: block; height: 100%; background: var(--copper); border-radius: 3px; }
.fn-bar.over .tr span { background: var(--red); }
.fn-bar .num { font-size: 11.5px; font-weight: 600; min-width: 36px; }
.fn-bar.over .num { color: var(--red); }
.fn-st { display: inline-flex; align-items: center; gap: 3px; font-size: 11px; font-weight: 600; }
.fn-st .i { width: 12px; height: 12px; }
.fn-st.done { color: var(--green); } .fn-st.over { color: var(--red); } .fn-st.open { color: var(--muted); }
.fn-st.open i { width: 7px; height: 7px; border-radius: 50%; border: 1.5px solid var(--muted); box-sizing: border-box; display: inline-block; }
tr.fn-foot td { background: var(--sand); font-weight: 700; font-size: 12.5px; }
.fn-top { display: flex; gap: 10px; align-items: flex-start; }
.fn-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 9px 12px; }
.fn-grid .hint, .f .hint { font-size: 11px; color: var(--muted); min-height: 15px; }
.fn-slots { gap: 6px !important; }
.fn-slot { border: 1px solid var(--line); border-radius: 7px; padding: 5px 8px; }
.fn-slot.over { background: var(--sand); border-color: var(--copper-2); }
.fn-slot .h { display: flex; align-items: center; gap: 7px; font-size: 11.5px; }
.fn-slot .h b { flex: 1; font-weight: 600; color: var(--muted); }
.fn-slot .up { font-size: 11.5px; display: inline-flex; align-items: center; gap: 3px; cursor: pointer; }
.fn-slot .up .i { width: 13px; height: 13px; }
.fn-slot .fl1 { display: flex; align-items: center; gap: 6px; font-size: 11.5px; padding-top: 3px; min-width: 0; }
.fn-slot .fl1 .el { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fn-slot .fl1 .muted { font-size: 10.5px; }
.fn-slot .x { border: none; background: none; color: var(--muted); cursor: pointer; padding: 0; display: flex; }
.fn-slot .x .i { width: 13px; height: 13px; } .fn-slot .x:hover { color: var(--red); }
.fn-slot .none { font-size: 11px; color: #A99C90; padding-top: 2px; }
.fn-sum { display: flex; align-items: stretch; background: var(--dark); border-radius: 8px; overflow: hidden; color: #fff; }
.fn-sum > div { flex: 1; padding: 7px 14px; border-left: 1px solid #4A3E36; }
.fn-sum > div:last-child { border-left: none; }
.fn-sum .k { font-size: 11px; color: var(--side-muted); display: flex; justify-content: space-between; }
.fn-sum .k b { color: #fff; font-size: 13px; }
.fn-sum .v { font-size: 16px; font-weight: 700; }
.fn-sum .v small { font-size: 11px; font-weight: 500; }
.fn-sum .v.rem { color: var(--copper-2); } .fn-sum .v.neg { color: #F3A79F; }
.fn-sum .pc { flex: 1.3; display: flex; flex-direction: column; justify-content: center; gap: 4px; }
.fn-sum .tr { height: 7px; border-radius: 4px; background: #4A3E36; overflow: hidden; display: block; }
.fn-sum .tr span { display: block; height: 100%; background: var(--copper-2); }
.fn-sum .tr span.neg { background: #E5534B; }
.fn-sum .k2 { font-size: 10.5px; color: var(--side-muted); }
.fn-lines tr.fn-edit td { background: #FFF8F1; padding: 3px 4px; }
.inp.sm { min-height: 26px; height: 26px; font-size: 12px; padding: 0 6px; border-radius: 5px; width: 100%; box-sizing: border-box; }
.inp.sm.c { text-align: center; }
.fn-act { color: var(--muted); }
.fn-act button { border: none; background: none; color: var(--muted); cursor: pointer; padding: 2px 3px; }
.fn-act button:hover { color: var(--copper); }
.fn-act button[data-a=delete]:hover { color: var(--red); }
.fn-act .i { width: 14px; height: 14px; }
.fn-tip { padding: 6px 12px; font-size: 11px; color: var(--muted); border-top: 1px solid var(--line); }
.card.sec > h2 .sub { margin-right: 4px; }
.fn-rsum { grid-template-columns: 1.2fr 1.4fr repeat(4, minmax(0, 1fr)); }
.fn-rsum .v.big { font-size: 13px; }
table.rp tr.fn-ch td { font-weight: 500; font-size: 11.5px; color: var(--ink); }
table.rp tr.fn-ch td b { color: var(--ink); }
table.rp tr.fn-ch td > b:first-child { color: var(--copper); }
table.rp tr.fn-ch i { color: #B7AA9D; margin: 0 8px; font-style: normal; }
table.rp tr.fn-sub td { background: #FBF5EF; font-weight: 700; font-size: 11px; }
table.rp tr.fn-sub td:first-child { text-align: left; }
.mk.fn-ok { color: var(--green); background: none; }
@media print { table.rp tr.fn-ch td, table.rp tr.fn-sub td { -webkit-print-color-adjust: exact; print-color-adjust: exact; } }
@media (max-width: 900px) { .fn-top { flex-direction: column; } .fn-top > * { width: 100%; } .fn-grid { grid-template-columns: 1fr 1fr; } .fn-sum { flex-wrap: wrap; } .fn-sum > div { flex: 1 1 45%; } }
.hbar { grid-template-columns: minmax(0, 1fr) auto; }
.hbar .n { min-width: 40px; }
.hbar .track { display: block; } .hbar .fill { display: block; }
.fn-slot .fl1 a, .fn-slot .fl1 .el { unicode-bidi: plaintext; text-align: right; }
.fn-st .i { vertical-align: middle; position: relative; top: -1px; }
/* القائمة الجانبية: الشعار فوق، واسم الشركة سطر واحد، وتحته اسم البرنامج */
.side-brand { flex-direction: column; align-items: center; text-align: center; gap: 6px; padding: 2px 4px 10px; }
.side-brand .side-logo { width: 132px; height: 62px; border-radius: 9px; padding: 4px; box-sizing: border-box; }
.side-brand .side-logo img { width: 100%; height: 100%; object-fit: contain; }
.side-brand .side-logo .logo-fallback { font-size: 20px; }
.side-brand > div:last-child { width: 100%; min-width: 0; }
.side-brand .t1 { font-size: 12px; line-height: 1.5; white-space: nowrap; overflow: hidden; text-overflow: clip; display: block; }
.side-brand .t2 { font-size: 11px; margin-top: 0; }
/* الشعار يظهر كامل بمقاسه الطبيعي — الإطار الأبيض على قد الصورة */
.side-brand .side-logo { width: auto; height: auto; max-width: 100%; padding: 6px; overflow: visible; }
.side-brand .side-logo img { display: block; width: auto; height: auto; max-width: 180px; max-height: 84px; object-fit: contain; }
.side-brand .side-logo .logo-fallback { padding: 10px 26px; }
/* ===== القائمة الجانبية: مجموعات منسدلة ===== */
.nav { gap: 2px; }
.nav-h { display: flex; align-items: center; gap: 9px; width: 100%; height: 34px; padding: 0 10px; border: none; border-radius: 7px; background: none; color: #fff; font-family: inherit; font-size: 13px; font-weight: 600; cursor: pointer; text-align: right; }
.nav-h:hover { background: rgba(255,255,255,.05); }
.nav-h .car { margin-right: auto; width: 14px; height: 14px; color: var(--side-muted); transition: transform .15s; }
.nav-grp.open > .nav-h .car { transform: rotate(180deg); }
.nav-sub { display: none; flex-direction: column; gap: 1px; padding: 1px 0 4px; }
.nav-grp.open > .nav-sub { display: flex; }
.nav-grp.d1 > .nav-h { height: 30px; font-size: 12.5px; font-weight: 500; color: var(--side-ink); padding-right: 22px; }
.nav-grp.d1 > .nav-h .i:first-child { width: 15px; height: 15px; }
.nav-grp.d1.open > .nav-h { color: #fff; }
.nav a.d1 { padding-right: 22px; height: 30px; font-size: 12.5px; }
.nav a.d2 { padding-right: 36px; height: 29px; font-size: 12px; color: var(--side-muted); }
.nav a.d2:hover { color: var(--side-ink); }
.nav a.d2.on { color: #fff; }
.nav a.d1 .i, .nav a.d2 .i { width: 15px; height: 15px; }
.nav-grp.d0 { border-top: 1px solid rgba(255,255,255,.04); padding-top: 2px; }
.nav a.d0 { font-weight: 600; color: #fff; }
/* ===== التقارير: على قد الصفحة ومن غير مساحات فاضية ===== */
.report-paper { padding: 12px 16px 10px; overflow: hidden; }
.rp-head { padding-bottom: 6px; border-bottom-width: 1.5px; }
.rp-brand .lg { width: 34px; height: 34px; } .rp-brand .lg img { width: 30px; height: 26px; }
.rp-brand .a { font-size: 12px; } .rp-title .a { font-size: 13.5px; } .rp-title .b, .rp-meta, .rp-brand .b { font-size: 9.5px; line-height: 1.5; }
.rp-sum { margin: 6px 0; } .rp-sum > div { padding: 3px 8px; } .rp-sum .k { font-size: 9.5px; } .rp-sum .v { font-size: 11px; }
.fn-rsum .v.big { font-size: 11.5px; }
.rp-sign { margin: 12px 0 6px; } .rp-sign > div { font-size: 10px; } .rp-sign .ln { margin: 18px 24px 0; padding-top: 2px; font-size: 9px; }
.rp-foot { font-size: 9px; padding-top: 3px; }
table.rp { width: 100%; }
table.rp th { height: 24px; font-size: 10.5px; padding: 0 5px; }
table.rp td { padding: 2px 5px; font-size: 10.5px; line-height: 1.35; }
/* تقرير العهد: أعمدة ثابتة والكلام الطويل ينزل سطر بدل ما يوسّع الجدول */
table.rp.fn-rp { table-layout: fixed; }
table.rp.fn-rp td, table.rp.fn-rp td.nw { white-space: normal; overflow-wrap: anywhere; }
table.rp.fn-rp td.c.num, table.rp.fn-rp td.c { white-space: nowrap; }
table.rp.fn-rp tr.fn-ch td { padding: 3px 6px; font-size: 10.5px; }
table.rp.fn-rp tr.fn-sub td { font-size: 10px; padding: 2px 6px; }
table.rp.fn-rp tr.grand td { font-size: 10.5px; padding: 3px 6px; white-space: normal; }
table.rp .mk { width: 16px; height: 15px; } table.rp .mk .i { width: 11px; height: 11px; }
@media print { .report-paper { padding: 0; } table.rp th { -webkit-print-color-adjust: exact; print-color-adjust: exact; } }
/* بحث متقدم في سجل العهد */
.fn-adv { border-top: 1px dashed var(--line); padding-top: 8px !important; align-items: flex-end; }
.fn-adv .inp { height: 32px; min-height: 32px; font-size: 12.5px; }
.fn-seg { display: inline-flex; border: 1px solid #DCD1C5; border-radius: 7px; overflow: hidden; height: 32px; align-self: flex-end; }
.fn-seg button { border: none; background: #fff; padding: 0 12px; font-family: inherit; font-size: 12.5px; cursor: pointer; color: var(--ink); }
.fn-seg button + button { border-right: 1px solid #DCD1C5; }
.fn-seg button.on { background: var(--sand); color: var(--copper); font-weight: 700; }
mark { background: #FBE3C4; color: inherit; padding: 0 1px; border-radius: 2px; }
table.rp.fn-rp td { vertical-align: middle; }
/* نسخة اطلاع فقط: نخفي أزرار الإضافة والتعديل والحذف */
.ro-bar { background: #E8F1FA; color: #22507F; border-bottom-color: #C6DBF0; }
body.ro .topbar .actions .btn.primary, body.ro a.btn.primary[href$="/new"], body.ro #save, body.ro #del, body.ro #add,
body.ro .fn-edit, body.ro .fn-act, body.ro .fn-slot .up, body.ro .fn-slot .x, body.ro [data-del], body.ro [data-ldel],
body.ro .page-head .actions a[href*="/edit"], body.ro .drop { display: none !important; }
body.ro .fn-grid .inp, body.ro .fn-grid select { pointer-events: none; background: var(--bg); }
