:root {
  --ink: #10232B; --muted: #4B5F67; --line: #DCE3E6; --line-2: #E6EDEF; --bg: #F3F6F7; --card: #FFFFFF;
  --brand: #0E7490; --brand-dark: #0B4F63; --brand-soft: #E0F2F6;
  --nav: #0F2A33; --nav-2: #16343F; --nav-ink: #D6E6EB; --nav-muted: #9FB8C0;
  --ok: #17602F; --ok-bg: #E6F4EA; --warn: #7A4505; --warn-bg: #FDF2DF; --bad: #8E1B12; --bad-bg: #FDECEA;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font-family: "Cairo", "Segoe UI", Tahoma, sans-serif; font-size: 15px; }
a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-dark); text-decoration: underline; }
h1 { font-size: 26px; margin: 0; font-weight: 700; }
h2 { font-size: 18px; margin: 0 0 12px; font-weight: 700; }
h3 { font-size: 15px; margin: 0 0 8px; font-weight: 700; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.num { direction: ltr; text-align: left; font-variant-numeric: tabular-nums; white-space: nowrap; }

.layout { display: flex; flex-wrap: wrap; min-height: 100vh; }
.side { flex: 1 1 240px; max-width: 100%; background: var(--nav); color: var(--nav-ink); padding: 20px 14px; display: flex; flex-direction: column; gap: 3px; }
.side .brand { display: flex; align-items: center; gap: 10px; padding: 0 6px 16px; }
.side .logo { width: 36px; height: 36px; background: var(--brand); clip-path: polygon(8px 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%, 0 8px); display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 700; }
.side .brand b { color: #fff; display: block; }
.side .brand span { font-size: 12px; color: var(--nav-muted); }
.side .ctx { background: var(--nav-2); border-radius: 6px; padding: 9px 11px; margin-bottom: 10px; }
.side .ctx .k { font-size: 11px; color: var(--nav-muted); }
.side .ctx .v { color: #fff; font-weight: 600; font-size: 14px; }
.side a.nav { display: flex; align-items: center; gap: 10px; padding: 9px 10px; min-height: 42px; border-radius: 6px; color: var(--nav-ink); font-size: 14px; }
.side a.nav:hover { background: var(--nav-2); text-decoration: none; }
.side a.nav.on { background: var(--brand); color: #fff; font-weight: 600; }
.side a.nav .n { width: 22px; text-align: center; font-size: 12px; opacity: .8; }
.side .sep { border-top: 1px solid #23434F; margin: 10px 4px; }
.side .foot { margin-top: auto; padding: 12px 6px 0; border-top: 1px solid #23434F; font-size: 12px; color: var(--nav-muted); }
.side .foot a { color: var(--nav-ink); }

.main { flex: 999 1 560px; min-width: 0; padding: 26px 30px 60px; display: flex; flex-direction: column; gap: 18px; }
.head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: 14px; }
.head p { margin: 4px 0 0; color: var(--muted); font-size: 14px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 18px; }
.grid { display: grid; gap: 14px; }
.g2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 360px), 1fr)); }
.g3 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); }
.g4 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); }
.kpi .k { font-size: 13px; color: var(--muted); }
.kpi .v { font-size: 24px; font-weight: 700; }
.kpi .s { font-size: 12px; color: var(--muted); }

.btn { font: inherit; font-size: 14px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; padding: 8px 16px; border-radius: 6px; border: 1px solid #B9C8CD; background: #fff; color: var(--ink); cursor: pointer; text-decoration: none; }
.btn:hover { border-color: var(--brand); text-decoration: none; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 600; }
.btn.primary:hover { background: var(--brand-dark); }
.btn.danger { color: var(--bad); border-color: #E7B4AE; }
.btn.sm { min-height: 32px; padding: 4px 10px; font-size: 13px; }
.pills { display: flex; flex-wrap: wrap; gap: 6px; }
.pill { font-size: 13px; padding: 5px 13px; border-radius: 999px; border: 1px solid var(--line); background: #fff; color: var(--ink); }
.pill.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.pill:hover { text-decoration: none; border-color: var(--brand); }

.tag { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 10px; border-radius: 999px; white-space: nowrap; }
.tag.ok { background: var(--ok-bg); color: var(--ok); }
.tag.warn { background: var(--warn-bg); color: var(--warn); }
.tag.bad { background: var(--bad-bg); color: var(--bad); }
.tag.info { background: var(--brand-soft); color: var(--brand-dark); }
.tag.gray { background: var(--bg); color: var(--muted); }

.msg { border-radius: 8px; padding: 10px 14px; font-size: 14px; line-height: 1.7; }
.msg.ok, .msg.success { background: var(--ok-bg); color: var(--ok); border: 1px solid #B9DEC4; }
.msg.warn, .msg.warning, .msg.info { background: var(--warn-bg); color: var(--warn); border: 1px solid #F0D2A2; }
.msg.info { background: var(--brand-soft); color: var(--brand-dark); border-color: #B5DDE7; }
.msg.bad, .msg.error { background: var(--bad-bg); color: var(--bad); border: 1px solid #F3C2BC; }
.msgs { display: flex; flex-direction: column; gap: 8px; }

.tablewrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; font-size: 14px; }
table.t th { text-align: right; font-size: 12px; font-weight: 600; color: var(--muted); padding: 8px; border-bottom: 1px solid var(--line); white-space: nowrap; background: #FAFCFC; position: sticky; top: 0; }
table.t td { padding: 8px; border-top: 1px solid var(--line-2); vertical-align: top; }
table.t tr.group td { background: #F7FAFB; font-weight: 700; }
table.t tr.total td { font-weight: 700; border-top: 1px solid var(--ink); }
table.t tr.grand td { font-weight: 700; border-top: 1px solid var(--ink); border-bottom: 3px double var(--ink); }
table.t tr.flag td { background: #FFF8F7; }
table.t td.ind { padding-right: 24px; }
table.t th.num, table.t td.num { text-align: left; }

form .field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }
form label { font-size: 13px; color: var(--muted); font-weight: 600; }
form .req { color: var(--bad); }
form .help { font-size: 12px; color: var(--muted); }
form .err { font-size: 13px; color: var(--bad); }
input[type=text], input[type=password], input[type=email], input[type=number], input[type=date], input[type=file], select, textarea {
  font: inherit; font-size: 14px; padding: 8px 10px; border: 1px solid #B9C8CD; border-radius: 6px; background: #fff; color: var(--ink); width: 100%; min-height: 40px;
}
textarea { line-height: 1.7; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand-soft); border-color: var(--brand); }
label.check { display: flex; gap: 8px; align-items: center; color: var(--ink); font-weight: 400; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); gap: 0 14px; }
.form-grid .wide { grid-column: 1 / -1; }

.steps { display: flex; flex-direction: column; gap: 6px; }
.step { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; background: #FAFCFC; border: 1px solid var(--line-2); }
.step .dot { width: 24px; height: 24px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; }
.step .dot.done { background: var(--ok-bg); color: var(--ok); }
.step .dot.todo { background: var(--bg); color: var(--muted); }
.step a { margin-right: auto; font-size: 13px; }

.paper { border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.paper-head { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr)); gap: 0; border-bottom: 1px solid var(--line); }
.paper-head > div { padding: 10px 14px; border-left: 1px solid var(--line-2); }
.paper-head .k { font-size: 11px; color: var(--muted); }
.paper-head .v { font-size: 14px; font-weight: 600; }
.paper-body { padding: 16px; }
.note { border-radius: 8px; padding: 10px 12px; background: #F7FAFB; border: 1px solid var(--line-2); margin-bottom: 10px; }
.note .meta { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.note .resp { margin-top: 8px; padding: 8px 10px; background: var(--brand-soft); border-radius: 6px; color: var(--brand-dark); }
.inline { display: inline; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.err-list { margin: 0; padding-right: 18px; line-height: 1.9; }
.right { margin-right: auto; }
@media (max-width: 720px) {
  .main { padding: 18px 14px 40px; }
  .side { flex-direction: row; flex-wrap: nowrap; overflow-x: auto; padding: 10px; gap: 6px; align-items: center; }
  .side .brand, .side .ctx, .side .sep { display: none; }
  .side a.nav { flex: 0 0 auto; min-height: 40px; white-space: nowrap; }
  .side .foot { margin: 0; padding: 0 6px; border: 0; flex: 0 0 auto; white-space: nowrap; }
}

/* v0.2 */
.ticks { display: flex; gap: 2px; flex-wrap: nowrap; }
.ticks label { cursor: pointer; }
.ticks input { display: none; }
.ticks span { display: inline-flex; width: 24px; height: 24px; align-items: center; justify-content: center; border-radius: 4px; border: 1px solid var(--line); color: #A9B9BF; font-size: 13px; }
.ticks input:checked + span { background: var(--brand); border-color: var(--brand); color: #fff; }
input.tref { width: 90px; min-height: 30px; padding: 3px 6px; font-size: 13px; }
.chips { display: flex; flex-wrap: wrap; gap: 4px; }
.chip { font-size: 11px; padding: 1px 8px; border-radius: 999px; background: var(--brand-soft); color: var(--brand-dark); white-space: nowrap; }
table.procs td { min-width: 70px; }
table.procs td:nth-child(2) { min-width: 260px; }
table.procs textarea { min-height: 34px; padding: 4px 8px; font-size: 13px; }
table.procs select { min-height: 32px; padding: 3px 6px; width: 105px; }
table.procs input.na { display: none; margin-top: 4px; min-height: 30px; font-size: 13px; padding: 3px 8px; }
table.procs tr.st-na input.na { display: block; }
table.procs tr.st-done td:first-child { box-shadow: inset -3px 0 0 var(--ok); }
table.procs tr.st-na td:first-child { box-shadow: inset -3px 0 0 #9FB0B6; }
table.procs tr.st-pending td:first-child { box-shadow: inset -3px 0 0 #E5A54B; }
.progress { width: 200px; height: 8px; background: var(--bg); border-radius: 99px; overflow: hidden; align-self: center; }
.progress span { display: block; height: 100%; background: var(--ok); }
details summary { cursor: pointer; color: var(--brand); font-weight: 600; font-size: 14px; }
.colmap select { min-width: 110px; min-height: 32px; padding: 3px 6px; font-size: 12px; }
.colmap td, .colmap th { font-size: 12px; white-space: nowrap; max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
.colmap tr.hdr td { background: var(--brand-soft); font-weight: 700; }
.colmap tr.skip td { color: #A9B9BF; }
.sheetwrap { overflow: auto; direction: ltr; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.jexcel_container { direction: ltr; }
.jexcel > tbody > tr > td { font-family: "Cairo", sans-serif; }

/* القوائم: لون لكل قائمة */
.stmt { border-top: 6px solid var(--c); padding-top: 0; overflow: hidden; }
.stmt .stmt-head { text-align: center; margin: 0 -18px 14px; padding: 14px 18px 12px; background: var(--bg); border-bottom: 1px solid var(--line); }
.stmt .stmt-head h2 { color: var(--c); }
.stmt table.t th { background: var(--bg); color: var(--c); }
.stmt table.t tr.group td { background: var(--bg); color: var(--c); }
.s-bs { --c: #0B4F63; --bg: #E0F2F6; } .s-is { --c: #3730A3; --bg: #ECEDFA; } .s-eq { --c: #8A4B08; --bg: #FBEFDF; }
.s-cf { --c: #17602F; --bg: #E6F4EA; } .s-nt { --c: #4B5F67; --bg: #F0F3F4; }
tr.res-exception td { background: #FFF4F2; }
tr.res-ok td:first-child { box-shadow: inset -3px 0 0 var(--ok); }
