/* الخط: IBM Plex Sans Arabic مستضاف محلياً (رخصة OFL في fonts/OFL-LICENSE.txt) */
@font-face { font-family: "IBM Plex Sans Arabic"; font-style: normal; font-weight: 400; font-display: swap; src: url(fonts/plex-arabic-arabic-400.woff2) format("woff2"); unicode-range: U+0600-06FF,U+0750-077F,U+0870-088E,U+0890-0891,U+0897-08E1,U+08E3-08FF,U+200C-200E,U+2010-2011,U+204F,U+2E41,U+FB50-FDFF,U+FE70-FE74,U+FE76-FEFC,U+102E0-102FB,U+10E60-10E7E,U+10EC2-10EC4,U+10EFC-10EFF,U+1EE00-1EE03,U+1EE05-1EE1F,U+1EE21-1EE22,U+1EE24,U+1EE27,U+1EE29-1EE32,U+1EE34-1EE37,U+1EE39,U+1EE3B,U+1EE42,U+1EE47,U+1EE49,U+1EE4B,U+1EE4D-1EE4F,U+1EE51-1EE52,U+1EE54,U+1EE57,U+1EE59,U+1EE5B,U+1EE5D,U+1EE5F,U+1EE61-1EE62,U+1EE64,U+1EE67-1EE6A,U+1EE6C-1EE72,U+1EE74-1EE77,U+1EE79-1EE7C,U+1EE7E,U+1EE80-1EE89,U+1EE8B-1EE9B,U+1EEA1-1EEA3,U+1EEA5-1EEA9,U+1EEAB-1EEBB,U+1EEF0-1EEF1; }
@font-face { font-family: "IBM Plex Sans Arabic"; font-style: normal; font-weight: 400; font-display: swap; src: url(fonts/plex-arabic-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+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: "IBM Plex Sans Arabic"; font-style: normal; font-weight: 500; font-display: swap; src: url(fonts/plex-arabic-arabic-500.woff2) format("woff2"); unicode-range: U+0600-06FF,U+0750-077F,U+0870-088E,U+0890-0891,U+0897-08E1,U+08E3-08FF,U+200C-200E,U+2010-2011,U+204F,U+2E41,U+FB50-FDFF,U+FE70-FE74,U+FE76-FEFC,U+102E0-102FB,U+10E60-10E7E,U+10EC2-10EC4,U+10EFC-10EFF,U+1EE00-1EE03,U+1EE05-1EE1F,U+1EE21-1EE22,U+1EE24,U+1EE27,U+1EE29-1EE32,U+1EE34-1EE37,U+1EE39,U+1EE3B,U+1EE42,U+1EE47,U+1EE49,U+1EE4B,U+1EE4D-1EE4F,U+1EE51-1EE52,U+1EE54,U+1EE57,U+1EE59,U+1EE5B,U+1EE5D,U+1EE5F,U+1EE61-1EE62,U+1EE64,U+1EE67-1EE6A,U+1EE6C-1EE72,U+1EE74-1EE77,U+1EE79-1EE7C,U+1EE7E,U+1EE80-1EE89,U+1EE8B-1EE9B,U+1EEA1-1EEA3,U+1EEA5-1EEA9,U+1EEAB-1EEBB,U+1EEF0-1EEF1; }
@font-face { font-family: "IBM Plex Sans Arabic"; font-style: normal; font-weight: 500; font-display: swap; src: url(fonts/plex-arabic-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+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: "IBM Plex Sans Arabic"; font-style: normal; font-weight: 600; font-display: swap; src: url(fonts/plex-arabic-arabic-600.woff2) format("woff2"); unicode-range: U+0600-06FF,U+0750-077F,U+0870-088E,U+0890-0891,U+0897-08E1,U+08E3-08FF,U+200C-200E,U+2010-2011,U+204F,U+2E41,U+FB50-FDFF,U+FE70-FE74,U+FE76-FEFC,U+102E0-102FB,U+10E60-10E7E,U+10EC2-10EC4,U+10EFC-10EFF,U+1EE00-1EE03,U+1EE05-1EE1F,U+1EE21-1EE22,U+1EE24,U+1EE27,U+1EE29-1EE32,U+1EE34-1EE37,U+1EE39,U+1EE3B,U+1EE42,U+1EE47,U+1EE49,U+1EE4B,U+1EE4D-1EE4F,U+1EE51-1EE52,U+1EE54,U+1EE57,U+1EE59,U+1EE5B,U+1EE5D,U+1EE5F,U+1EE61-1EE62,U+1EE64,U+1EE67-1EE6A,U+1EE6C-1EE72,U+1EE74-1EE77,U+1EE79-1EE7C,U+1EE7E,U+1EE80-1EE89,U+1EE8B-1EE9B,U+1EEA1-1EEA3,U+1EEA5-1EEA9,U+1EEAB-1EEBB,U+1EEF0-1EEF1; }
@font-face { font-family: "IBM Plex Sans Arabic"; font-style: normal; font-weight: 600; font-display: swap; src: url(fonts/plex-arabic-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+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: "IBM Plex Sans Arabic"; font-style: normal; font-weight: 700; font-display: swap; src: url(fonts/plex-arabic-arabic-700.woff2) format("woff2"); unicode-range: U+0600-06FF,U+0750-077F,U+0870-088E,U+0890-0891,U+0897-08E1,U+08E3-08FF,U+200C-200E,U+2010-2011,U+204F,U+2E41,U+FB50-FDFF,U+FE70-FE74,U+FE76-FEFC,U+102E0-102FB,U+10E60-10E7E,U+10EC2-10EC4,U+10EFC-10EFF,U+1EE00-1EE03,U+1EE05-1EE1F,U+1EE21-1EE22,U+1EE24,U+1EE27,U+1EE29-1EE32,U+1EE34-1EE37,U+1EE39,U+1EE3B,U+1EE42,U+1EE47,U+1EE49,U+1EE4B,U+1EE4D-1EE4F,U+1EE51-1EE52,U+1EE54,U+1EE57,U+1EE59,U+1EE5B,U+1EE5D,U+1EE5F,U+1EE61-1EE62,U+1EE64,U+1EE67-1EE6A,U+1EE6C-1EE72,U+1EE74-1EE77,U+1EE79-1EE7C,U+1EE7E,U+1EE80-1EE89,U+1EE8B-1EE9B,U+1EEA1-1EEA3,U+1EEA5-1EEA9,U+1EEAB-1EEBB,U+1EEF0-1EEF1; }
@font-face { font-family: "IBM Plex Sans Arabic"; font-style: normal; font-weight: 700; font-display: swap; src: url(fonts/plex-arabic-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+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
/* نظام الأرشفة والمتابعة — التصميم المعتمد (الاتجاه أ: العنابي والذهبي) */
:root {
  --maroon-dark: #6B0F2A; --maroon: #8A1538; --maroon-hover: #7E1634; --maroon-deep: #5E0C24;
  --gold: #A9832F; --gold-light: #E3C77E;
  --bg: #F4F2EC; --ink: #1B2421; --muted: #5B6661; --ink-2: #3D4844; --ink-3: #4C5752;
  --card-border: #E2DED3; --input-border: #CFC9BA; --line: #ECE8DE; --line-2: #DDD8CB;
  --th-bg: #F1EEE5; --row-even: #FBFAF6; --row-hover: #FAF1F3;
  --ok: #1E7A46; --late: #B42318; --ip: #2F5D8A; --ip-bar: #9DB8D6;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); }
body { font-family: "IBM Plex Sans Arabic", system-ui, sans-serif; color: var(--ink); font-variant-numeric: tabular-nums; }
a { color: var(--maroon); }
a:hover { color: var(--maroon-deep); }
button { font-family: inherit; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.ltr { direction: ltr; text-align: right; }

/* ---------- الهيكل ---------- */
.shell { min-height: 100vh; display: flex; flex-wrap: wrap; align-items: stretch; }
.side { flex: 1 1 240px; max-width: 100%; background: var(--maroon-dark); color: #F1DCE2; padding: 24px 16px; display: flex; flex-direction: column; gap: 28px; }
.brand { display: flex; align-items: center; gap: 12px; }
.logo-box { width: 52px; height: 52px; border-radius: 10px; border: 1.5px dashed var(--gold); display: flex; align-items: center; justify-content: center; font-size: 11px; color: var(--gold-light); flex: none; overflow: hidden; }
.logo-box.has { border: none; background: #fff; }
.logo-box img { width: 100%; height: 100%; object-fit: contain; }
.brand-org { font-size: 13px; color: var(--gold-light); }
.brand-name { font-size: 16px; font-weight: 700; color: #fff; }
.nav { display: flex; flex-direction: column; gap: 4px; }
.navl { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 0 14px; border-radius: 8px; color: #F1DCE2; text-decoration: none; font-size: 15px; }
.navl:hover { background: var(--maroon-hover); color: #fff; }
.navl svg { flex: none; }
.navl[aria-current="page"] { background: var(--maroon); color: #fff; font-weight: 600; }
.navl[aria-current="page"] svg { stroke: var(--gold-light); }
.navl .count { margin-inline-start: auto; font-size: 12px; background: var(--late); color: #fff; border-radius: 999px; padding: 0 8px; }
.nav-sep { height: 1px; background: #86304A; margin: 8px 0; }
.me { margin-top: auto; display: flex; align-items: center; gap: 10px; padding-top: 16px; border-top: 1px solid #86304A; }
.avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--gold-light); color: var(--maroon-dark); font-weight: 700; display: flex; align-items: center; justify-content: center; flex: none; font-size: 14px; }
.me-text { display: flex; flex-direction: column; flex: 1; min-width: 0; text-decoration: none; }
.me-name { font-size: 14px; color: #fff; }
.me-role { font-size: 12px; color: #E3C2CC; }
.icon-btn { width: 44px; height: 44px; border: none; background: transparent; color: #E3C2CC; border-radius: 8px; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.icon-btn:hover { background: var(--maroon-hover); color: #fff; }
.main { flex: 999 1 560px; min-width: 0; padding: 28px 32px 40px; display: flex; flex-direction: column; }
.page { display: flex; flex-direction: column; gap: 22px; flex: 1; }

/* ---------- عناصر عامة ---------- */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; }
.page-head h1 { margin: 0; font-size: 28px; font-weight: 700; color: var(--maroon); }
.page-sub { font-size: 14px; color: var(--muted); margin-top: 4px; }
.tools { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; }
.card { background: #fff; border: 1px solid var(--card-border); border-radius: 12px; }
.pad { padding: 20px 22px; }
.sec { margin: 0; font-size: 17px; font-weight: 700; }
.sec-m { margin: 0; font-size: 19px; font-weight: 700; color: var(--maroon); }
.hint { font-size: 12.5px; color: var(--muted); }
.muted { color: var(--muted); }
.lbl { font-size: 14px; font-weight: 500; color: var(--ink-2); }
.lbl-s { font-size: 13px; color: var(--muted); }
.req { color: var(--late); }
.f { display: flex; flex-direction: column; gap: 6px; }
.fh { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.grid-f { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 16px; }

.inp { font-family: inherit; font-size: 15px; height: 44px; padding: 0 12px; border: 1px solid var(--input-border); border-radius: 8px; background: #fff; color: var(--ink); width: 100%; }
textarea.inp { height: auto; padding: 10px 12px; line-height: 1.8; resize: vertical; }
.inp:focus { outline: 3px solid var(--gold-light); outline-offset: 1px; border-color: var(--maroon); }
.inp:disabled { background: var(--bg); color: #8A918D; }
.inp.ai { background: #FBF6EA; border-color: #D9C38E; }
.inp.warn { background: #FFF6E5; border-color: #D99A1E; }
.inp.bad { border-color: #E4A49D; }
select.inp { padding-left: 8px; }

.btn { font-family: inherit; font-size: 15px; font-weight: 600; height: 44px; padding: 0 18px; border: none; border-radius: 8px; background: var(--maroon); color: #fff; display: inline-flex; align-items: center; justify-content: center; gap: 8px; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { background: var(--maroon-deep); color: #fff; }
.btn.lg { height: 48px; font-size: 16px; padding: 0 24px; }
.btn:disabled { opacity: .55; cursor: default; }
.btn2 { font-family: inherit; font-size: 15px; height: 44px; padding: 0 16px; border: 1px solid var(--input-border); border-radius: 8px; background: #fff; color: var(--ink); display: inline-flex; align-items: center; justify-content: center; gap: 8px; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn2:hover { border-color: var(--maroon); color: var(--maroon); }
.btn2.lg { height: 48px; }
.btn-o { font-family: inherit; font-size: 15px; height: 44px; padding: 0 16px; border: 1px solid var(--maroon); border-radius: 8px; background: #fff; color: var(--maroon); cursor: pointer; }
.btn-danger { color: var(--late); border-color: #E4A49D; }
.ib { font-family: inherit; font-size: 14px; min-height: 36px; padding: 0 12px; border: 1px solid var(--input-border); border-radius: 8px; background: #fff; color: var(--ink); cursor: pointer; white-space: nowrap; }
.sb { font-family: inherit; font-size: 13.5px; min-height: 36px; padding: 0 12px; border-radius: 8px; cursor: pointer; white-space: nowrap; border: 1px solid var(--input-border); background: #fff; color: var(--ink); }
.sb.pri { border: none; background: var(--maroon); color: #fff; }
.pg { font-family: inherit; font-size: 14px; min-width: 40px; height: 40px; border: 1px solid var(--line-2); border-radius: 8px; background: #fff; color: var(--ink); cursor: pointer; }
.pg[aria-current="page"] { background: var(--maroon); color: #fff; border-color: var(--maroon); }
.linkbtn { font-family: inherit; font-size: 14px; min-height: 44px; padding: 0 8px; border: none; background: transparent; color: var(--maroon); cursor: pointer; text-decoration: underline; }

.seg { display: flex; border: 1px solid var(--input-border); border-radius: 8px; overflow: hidden; height: 44px; }
.seg button { flex: 1; font-family: inherit; font-size: 15px; border: none; background: #fff; color: var(--ink); cursor: pointer; }
.seg button[aria-checked="true"] { background: var(--maroon); color: #fff; font-weight: 600; }
.seg.blue button[aria-checked="true"] { background: #244B72; }
.seg.green button[aria-checked="true"][data-v="منجز"] { background: #17603A; }
.seg button:disabled { cursor: default; color: #8A918D; }

.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; padding: 3px 10px; border-radius: 999px; white-space: nowrap; }
.pill.big { font-size: 14px; padding: 6px 14px; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.st-done { background: #E6F2EA; color: #17603A; }
.st-ip { background: #E7EEF6; color: #244B72; }
.st-late { background: #FBE9E7; color: #9A1B12; }
.st-draft { background: #F1EEE5; color: #3D4844; }
.pr-1 { background: #FBE9E7; color: #9A1B12; }
.pr-2 { background: #FCEFD9; color: #7A4A00; }
.pr-3 { background: #F1EEE5; color: #3D4844; }
.amber { background: #FCEFD9; color: #7A4A00; }
.neutral { background: var(--bg); color: var(--ink); }
.tag { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; padding: 1px 8px; border-radius: 999px; }
.t-ex { background: #F5ECD6; color: #6E5212; }
.t-sg { background: #F7E9EE; color: #7A1230; }
.t-wr { background: #FCE9C6; color: #7A4A00; }
.role-admin { background: #6B0F2A; color: #fff; }
.role-director { background: #F5ECD6; color: #6E5212; }
.role-followup { background: #F7E9EE; color: #7A1230; }
.role-archive { background: #E7EEF6; color: #244B72; }
.role-department { background: #F1EEE5; color: #3D4844; }

.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { background: var(--th-bg); color: var(--ink-2); font-weight: 600; text-align: right; padding: 10px 12px; border-bottom: 1px solid var(--line-2); white-space: nowrap; }
.tbl td { padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl.top td { vertical-align: top; }
.tbl.zebra tbody tr:nth-child(even) td { background: var(--row-even); }
.tbl tbody tr:hover td { background: var(--row-hover); }
.tbl tr.click { cursor: pointer; }
.tbl .num { white-space: nowrap; font-weight: 600; }
.tbl .num a { text-decoration: none; }
.nowrap { white-space: nowrap; }
.scroll-x { overflow-x: auto; }
.empty { padding: 28px; text-align: center; color: var(--muted); font-size: 15px; }
.days { display: inline-block; min-width: 34px; text-align: center; font-weight: 700; color: #9A1B12; background: #FBE9E7; border-radius: 6px; padding: 2px 8px; }

.ai-note { display: flex; gap: 10px; background: #FBF6EA; border: 1px solid #E8D7AC; border-radius: 10px; padding: 12px 14px; font-size: 14px; line-height: 1.8; }
.ai-note svg { flex: none; margin-top: 3px; }
.drop { border: 2px dashed var(--input-border); border-radius: 10px; background: var(--row-even); padding: 22px 16px; display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; cursor: pointer; position: relative; }
.drop.row { flex-direction: row; text-align: start; padding: 16px; gap: 12px; }
.drop.over { border-color: var(--maroon); background: var(--row-hover); }
.drop input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.file-row { display: flex; align-items: center; gap: 12px; border: 1px solid var(--card-border); border-radius: 10px; padding: 10px 12px; }
.file-ico { width: 40px; height: 48px; border-radius: 4px; background: #F7E9EE; color: var(--maroon); font-size: 11px; font-weight: 700; display: flex; align-items: center; justify-content: center; flex: none; }
.file-ico.xls { background: #E6F2EA; color: #17603A; }
.spinner { display: inline-block; width: 16px; height: 16px; border: 2px solid #E2DED3; border-top-color: var(--maroon); border-radius: 50%; animation: spin .8s linear infinite; vertical-align: middle; }
@keyframes spin { to { transform: rotate(360deg); } }

.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px); background: var(--ink); color: #fff; padding: 12px 20px; border-radius: 10px; font-size: 15px; opacity: 0; pointer-events: none; transition: .2s; z-index: 50; max-width: 90vw; }
.toast.show { opacity: 1; transform: translateX(-50%); }
.toast.err { background: #9A1B12; }

/* ---------- لوحة المتابعة ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 16px; }
.kpi { background: #fff; border: 1px solid var(--card-border); border-radius: 12px; padding: 18px 18px 16px; display: flex; flex-direction: column; gap: 8px; border-top: 4px solid var(--c); }
.kpi-l { font-size: 14px; color: var(--ink-3); font-weight: 500; }
.kpi-v { font-size: 34px; font-weight: 700; line-height: 1.1; }
.kpi-u { font-size: 14px; color: var(--muted); }
.kpi-s { font-size: 13px; color: var(--muted); }
.charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(440px, 1fr)); gap: 16px; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 13px; color: var(--ink-2); }
.legend span { display: flex; align-items: center; gap: 6px; }
.sw { width: 12px; height: 12px; border-radius: 3px; }
.ln { width: 18px; height: 3px; }
.bars { display: flex; flex-direction: column; gap: 11px; }
.bar-row { display: grid; grid-template-columns: 128px minmax(0, 1fr) 40px; align-items: center; gap: 10px; font-size: 14px; }
.bar-row > span:first-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-track { height: 18px; background: var(--bg); border-radius: 4px; }
.bar { height: 18px; display: flex; border-radius: 4px; overflow: hidden; }
.bar > div { color: #fff; font-size: 11px; display: flex; align-items: center; justify-content: center; }
.prt { display: none; align-items: center; justify-content: space-between; border-bottom: 2px solid var(--maroon); padding-bottom: 10px; }

/* ---------- تفاصيل الكتاب ---------- */
.crumbs { font-size: 14px; color: var(--muted); display: flex; gap: 8px; flex-wrap: wrap; }
.steps { list-style: none; margin: 0; padding: 14px 18px; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.steps li { display: flex; flex-direction: column; gap: 6px; }
.steps .bar-s { height: 4px; border-radius: 2px; background: var(--card-border); }
.steps .on .bar-s { background: var(--maroon); }
.steps .bad .bar-s { background: var(--late); }
.steps .ok .bar-s { background: var(--ok); }
.steps b { font-size: 14px; }
.steps .off b { color: var(--muted); }
.steps .bad b { color: #9A1B12; }
.steps span { font-size: 13px; color: var(--muted); }
.cols { display: flex; flex-wrap: wrap; gap: 20px; align-items: flex-start; }
.col-main { flex: 999 1 560px; min-width: 0; display: flex; flex-direction: column; gap: 20px; }
.col-side { flex: 1 1 340px; min-width: 0; }
.dl { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); margin: 0; }
.dl div { padding: 12px 0; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 3px; }
.dl dt { font-size: 13px; color: var(--muted); }
.dl dd { margin: 0; font-size: 15px; font-weight: 500; }
.block { padding: 14px 0; display: flex; flex-direction: column; gap: 4px; }
.block + .block { border-top: 1px solid var(--line); }
.block p { margin: 0; font-size: 15px; line-height: 1.9; white-space: pre-wrap; }
.timeline { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.timeline li { display: grid; grid-template-columns: 14px minmax(0, 1fr); gap: 12px; }
.tl-dot { display: flex; flex-direction: column; align-items: center; }
.tl-dot span:first-child { width: 10px; height: 10px; border-radius: 50%; margin-top: 6px; }
.tl-dot span:last-child { flex: 1; width: 1px; background: var(--card-border); }
.tl-body { display: flex; flex-direction: column; gap: 4px; padding-bottom: 18px; }
.tl-body p { margin: 0; font-size: 14.5px; line-height: 1.8; border-radius: 8px; padding: 8px 12px; white-space: pre-wrap; }
.side-note { margin: 0; font-size: 13px; color: var(--muted); background: var(--bg); border-radius: 8px; padding: 10px 12px; line-height: 1.7; }

/* ---------- تسجيل كتاب ---------- */
.reg-sec { margin: 0; font-size: 16px; font-weight: 700; color: var(--maroon); padding-bottom: 10px; border-bottom: 1px solid var(--line); width: 100%; }
fieldset { border: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 16px; min-width: 0; }
legend.reg-sec { margin-bottom: 16px; }
.numbox { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; background: #fff; border: 1px solid var(--card-border); border-radius: 10px; padding: 8px 16px; }
.numbox span:first-child { font-size: 12px; color: var(--muted); }
.numbox span:last-child { font-size: 20px; font-weight: 700; }
.preview { background: var(--bg); border-radius: 8px; padding: 18px; }
.page-sk { background: #fff; aspect-ratio: 210 / 297; box-shadow: 0 1px 3px rgba(0,0,0,.12); padding: 24px 22px; display: flex; flex-direction: column; gap: 9px; }
.page-sk i { display: block; height: 6px; background: #E6E1D6; border-radius: 2px; }
.preview iframe, .preview img { width: 100%; aspect-ratio: 210 / 297; border: none; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.12); object-fit: contain; }
.form-actions { display: flex; flex-wrap: wrap; gap: 10px; padding-top: 16px; border-top: 1px solid var(--line); }

/* ---------- التقرير الأسبوعي ---------- */
.sheet { background: #fff; border: 1px solid var(--card-border); border-radius: 12px; padding: 36px 40px; display: flex; flex-direction: column; gap: 24px; width: 100%; max-width: 1000px; align-self: center; }
.sheet-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding-bottom: 14px; border-bottom: 3px solid var(--maroon); }
.sheet .logo-box { width: 64px; height: 64px; color: #6E5212; }
.sum { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); border: 1px solid var(--card-border); border-radius: 10px; overflow: hidden; }
.sum > div { padding: 14px 16px; display: flex; flex-direction: column; gap: 4px; border-inline-start: 1px solid var(--card-border); margin-inline-start: -1px; }
.sum span:first-child { font-size: 13px; color: var(--ink-3); }
.sum span:last-child { font-size: 28px; font-weight: 700; }
.sheet .tbl th { padding: 9px 10px; }
.sheet .tbl td { padding: 10px; vertical-align: top; }
.sheet .tbl tbody tr:hover td { background: none; }
.signs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 40px; padding-top: 18px; }
.signs div { display: flex; flex-direction: column; gap: 28px; font-size: 14px; }
.signs span { border-top: 1px solid #8A918D; padding-top: 6px; color: var(--muted); }
tr.more { display: none; }
.show-all tr.more { display: table-row; }
.done-row td { opacity: .55; }

/* ---------- المساعد ---------- */
.chat-wrap { display: flex; flex-wrap: wrap; gap: 20px; align-items: flex-start; }
.chat { flex: 999 1 520px; min-width: 0; display: flex; flex-direction: column; min-height: calc(100vh - 68px); }
.chat-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 22px; border-bottom: 1px solid var(--line); }
.spark { width: 40px; height: 40px; border-radius: 10px; background: #FBF6EA; border: 1px solid #E8D7AC; display: flex; align-items: center; justify-content: center; flex: none; }
.spark.sm { width: 32px; height: 32px; border-radius: 8px; }
.msgs { padding: 22px; display: flex; flex-direction: column; gap: 20px; flex: 1; }
.q { align-self: flex-start; max-width: 70%; background: var(--maroon); color: #fff; border-radius: 14px 14px 4px 14px; padding: 10px 16px; font-size: 15.5px; line-height: 1.8; white-space: pre-wrap; }
.a { align-self: flex-end; width: 100%; max-width: 680px; display: flex; gap: 12px; }
.a-body { flex: 1; min-width: 0; background: var(--row-even); border: 1px solid var(--line); border-radius: 4px 14px 14px 14px; padding: 14px 16px; display: flex; flex-direction: column; gap: 12px; font-size: 15px; line-height: 1.85; }
.a-body p, .a-body ul, .a-body ol { margin: 0; }
.a-body ul, .a-body ol { padding-inline-start: 22px; }
.a-body h3, .a-body h4 { margin: 0; font-size: 16px; }
.mini { width: 100%; border-collapse: collapse; font-size: 14px; }
.mini th { text-align: right; font-weight: 600; color: var(--ink-3); padding: 6px 8px; border-bottom: 1px solid var(--line-2); }
.mini td { padding: 7px 8px; border-bottom: 1px solid var(--line); }
.composer { margin-top: auto; padding: 16px 22px 20px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 12px; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; }
.chip { font-family: inherit; font-size: 14px; min-height: 38px; padding: 0 14px; border: 1px solid #D9C38E; border-radius: 999px; background: #FBF6EA; color: #4A3A10; cursor: pointer; white-space: nowrap; }
.composer textarea { flex: 1; font-family: inherit; font-size: 15.5px; line-height: 1.7; padding: 10px 14px; border: 1px solid var(--input-border); border-radius: 10px; resize: none; color: var(--ink); }
.composer textarea:focus { outline: 3px solid var(--gold-light); border-color: var(--maroon); }
.send { width: 52px; height: 52px; border: none; border-radius: 10px; background: var(--maroon); color: #fff; cursor: pointer; display: flex; align-items: center; justify-content: center; flex: none; }
.send:disabled { opacity: .5; cursor: default; }
.chat-side { flex: 1 1 280px; min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.sq { font-family: inherit; font-size: 14.5px; text-align: right; min-height: 44px; padding: 8px 12px; border: 1px solid var(--card-border); border-radius: 10px; background: #fff; color: var(--ink); cursor: pointer; line-height: 1.6; }
.sq:hover { border-color: var(--maroon); background: var(--row-hover); }
.grp { font-size: 12.5px; color: var(--muted); font-weight: 600; margin-top: 6px; }
.conv { font-size: 14px; min-height: 40px; display: flex; flex-direction: column; justify-content: center; text-decoration: none; color: var(--ink); border-radius: 6px; padding: 2px 6px; }
.conv.on { background: var(--row-hover); }
.conv span { font-size: 12px; color: var(--muted); }

/* ---------- الإعدادات ---------- */
.tabs { display: flex; overflow-x: auto; border-bottom: 1px solid var(--line-2); }
.tabl { display: flex; align-items: center; min-height: 44px; padding: 0 16px; font-size: 15px; text-decoration: none; color: var(--ink-2); border-bottom: 3px solid transparent; white-space: nowrap; }
.tabl[aria-current="page"] { color: var(--maroon); border-bottom-color: var(--maroon); font-weight: 600; }
.sla { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.sla > div { border: 1px solid var(--card-border); border-radius: 10px; padding: 16px; display: flex; flex-direction: column; gap: 10px; border-top: 4px solid var(--c); }
.check { display: flex; align-items: center; gap: 8px; min-height: 44px; font-size: 14.5px; }
.check input { width: 18px; height: 18px; accent-color: var(--maroon); }
.perm { background: var(--row-even); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
.tbl tr.sel td { background: var(--row-hover); }

/* ---------- الجوال ---------- */
@media (max-width: 820px) {
  .side { padding: 14px 16px; gap: 14px; }
  .nav { flex-direction: row; overflow-x: auto; }
  .navl { white-space: nowrap; }
  .nav-sep { display: none; }
  .me { margin-top: 0; padding-top: 10px; }
  .main { padding: 20px 16px 32px; }
  .charts { grid-template-columns: 1fr; }
  .sheet { padding: 20px 16px; }
  .steps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .q { max-width: 90%; }
  .chat { min-height: 70vh; }
}

/* ---------- الطباعة ---------- */
@media print {
  body { background: #fff; }
  .side, .np, .toast { display: none !important; }
  .main { padding: 0; }
  .page { gap: 14px; }
  .card, .kpi { box-shadow: none !important; break-inside: avoid; }
  .prt { display: flex !important; }
  .sheet { border: none !important; padding: 0 !important; max-width: none; }
  tr.more { display: table-row !important; }
  .tbl tbody tr:hover td { background: inherit; }
  a { color: inherit; text-decoration: none; }
  .scroll-x { overflow: visible; }
  .tbl { font-size: 11px; }
  .tbl th, .tbl td, .sheet .tbl th, .sheet .tbl td { padding: 6px; }
  .tbl td[style*="min-width"] { min-width: 0 !important; }
  .tbl.zebra tbody tr:nth-child(even) td { background: #FBFAF6 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  tr { break-inside: avoid; }
  .page-head h1 { font-size: 22px; }
  .kpis { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; }
  .kpi { padding: 10px 12px; gap: 4px; }
  .kpi-v { font-size: 24px; }
  .charts { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .charts .card { padding: 12px !important; }
  .bar-row { grid-template-columns: 110px minmax(0, 1fr) 32px; font-size: 12px; }
  .sheet { gap: 16px; }
  .sum span:last-child { font-size: 22px; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
