/* الشكل العام: عربي RTL، موبايل الأول. اللون الأساسي من إعدادات البراند (--brand). */
:root {
  --brand: #0f2a4a; --accent: #c8962c; --bg: #f5f6f8; --card: #fff; --ink: #1c2430; --muted: #6b7380; --line: #e3e6eb;
  --ok: #1f7a4d; --bad: #b3261e; --radius: 12px;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.6 "IBM Plex Sans Arabic", "Segoe UI", Tahoma, sans-serif; }
a { color: var(--brand); }
header.top { background: var(--brand); color: #fff; display: flex; align-items: center; gap: 12px; padding: 10px 16px; position: sticky; top: 0; z-index: 5; flex-wrap: wrap; }
header.top .brand { font-weight: 700; font-size: 17px; display: flex; align-items: center; gap: 8px; }
header.top .brand img { height: 30px; width: auto; border-radius: 6px; background: #fff; }
header.top .by { font-size: 12px; opacity: .8; }
header.top nav { margin-inline-start: auto; display: flex; gap: 8px; flex-wrap: wrap; }
header.top nav button, header.top nav a { background: rgba(255,255,255,.12); color: #fff; border: 0; border-radius: 8px; padding: 6px 12px; cursor: pointer; text-decoration: none; font: inherit; font-size: 14px; }
main { max-width: 1100px; margin: 0 auto; padding: 16px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 16px; }
.card h2 { margin: 0 0 12px; font-size: 17px; }
.narrow { max-width: 420px; margin: 40px auto; }
label { display: block; font-size: 13px; color: var(--muted); margin: 10px 0 4px; }
input, select, textarea { width: 100%; padding: 9px 10px; border: 1px solid var(--line); border-radius: 8px; font: inherit; background: #fff; color: var(--ink); }
input:focus, select:focus { outline: 2px solid rgba(15, 42, 74, .25); border-color: var(--brand); }
button.btn { background: var(--brand); color: #fff; border: 0; border-radius: 8px; padding: 9px 16px; font: inherit; cursor: pointer; }
button.btn.ghost { background: transparent; color: var(--brand); border: 1px solid var(--brand); }
button.btn.danger { background: var(--bad); }
button.btn.small { padding: 4px 10px; font-size: 13px; }
button.btn:disabled { opacity: .5; cursor: not-allowed; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; }
.row > * { flex: 1 1 160px; }
.msg { padding: 8px 12px; border-radius: 8px; margin: 10px 0; display: none; }
.msg.show { display: block; }
.msg.err { background: #fdecea; color: var(--bad); }
.msg.ok { background: #e7f5ee; color: var(--ok); }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.tabs button { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 6px 14px; cursor: pointer; font: inherit; }
.tabs button.on { background: var(--brand); color: #fff; border-color: var(--brand); }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 8px; border-bottom: 1px solid var(--line); text-align: start; white-space: nowrap; }
th { background: #f0f2f5; font-weight: 600; }
td.num, th.num { text-align: left; direction: ltr; font-variant-numeric: tabular-nums; }
tfoot td { font-weight: 700; background: #fafbfc; }
td input, td select { padding: 6px 8px; min-width: 110px; }
.pill { display: inline-block; padding: 1px 10px; border-radius: 999px; font-size: 12px; background: #eef1f5; }
.pill.posted { background: #e7f5ee; color: var(--ok); }
.pill.draft { background: #fff4e0; color: #8a5a00; }
.muted { color: var(--muted); font-size: 13px; }
.hidden { display: none !important; }
.check { display: inline-flex; align-items: center; gap: 6px; margin-inline-end: 14px; font-size: 14px; color: var(--ink); }
.check input { width: auto; }
.code { font-family: ui-monospace, Consolas, monospace; background: #f0f2f5; padding: 2px 8px; border-radius: 6px; direction: ltr; display: inline-block; }
/* مكان زرار مُعين: بيظهر لما الأدمن يفعّله */
#assistant-slot { position: fixed; inset-inline-start: 16px; bottom: 16px; z-index: 10; }
#assistant-slot button { background: var(--accent); color: #fff; border: 0; border-radius: 999px; padding: 10px 18px; font: inherit; box-shadow: 0 4px 14px rgba(0,0,0,.15); cursor: pointer; }
@media (max-width: 600px) { main { padding: 12px 16px; } header.top .by { display: none; } }
/* نافذة مُعين */
#assistant-panel { position: fixed; inset-inline-start: 16px; bottom: 70px; z-index: 11; width: min(380px, calc(100vw - 32px)); max-height: min(560px, calc(100vh - 100px)); display: flex; flex-direction: column; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 10px 30px rgba(0,0,0,.18); }
#assistant-panel .ap-head { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
#assistant-panel .ap-head [data-x] { margin-inline-start: auto; border: 0; background: none; font-size: 22px; cursor: pointer; color: var(--muted); }
#assistant-panel .ap-focus:empty { display: none; }
#assistant-panel .ap-focus { padding: 6px 12px 0; }
#assistant-panel .ap-log { flex: 1; overflow-y: auto; padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; min-height: 80px; }
#assistant-panel .ap-msg { padding: 8px 10px; border-radius: 10px; font-size: 14px; max-width: 92%; }
#assistant-panel .ap-msg.me { background: #eef1f5; align-self: flex-start; }
#assistant-panel .ap-msg.bot { background: #f3f7fd; border: 1px solid #dbe6f5; align-self: flex-end; }
#assistant-panel .ap-msg.err { background: #fdecea; color: var(--bad); align-self: flex-end; }
#assistant-panel form { padding: 10px 12px; border-top: 1px solid var(--line); }
#assistant-panel .ap-row { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; }
/* PR 2: شاشة القيد والدليل */
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.actions-cell { display: flex; gap: 4px; flex-wrap: wrap; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; flex: 0 0 auto !important; }
.seg button { border: 0; background: #fff; padding: 6px 12px; font: inherit; font-size: 13px; cursor: pointer; }
.seg button.on { background: var(--brand); color: #fff; }
.errors { background: #fdecea; color: var(--bad); border-radius: 8px; padding: 8px 28px; margin: 10px 0 0; font-size: 14px; }
tr.bad-row td { background: #fff4f3; }
tr.inactive td { color: var(--muted); }
td.strong { font-weight: 700; }
td.wrap { white-space: normal; min-width: 160px; }
.ok-text { color: var(--ok); }
.bad-text { color: var(--bad); }
table.entry-lines td input[type="checkbox"] { width: auto; min-width: 0; }
table.entry-lines td select[data-acc] { min-width: 200px; }
/* PR 3: التقارير */
table.statement td { white-space: normal; }
table.statement tr.sec td { font-weight: 700; background: #f7f8fa; }
table.statement tr.total td { font-weight: 700; border-top: 2px solid var(--line); }
td.indent { padding-inline-start: 24px; }
td.indent2 { padding-inline-start: 44px; font-size: 13px; }
button.link { background: none; border: 0; color: var(--brand); cursor: pointer; font: inherit; font-size: 12px; padding: 0 4px; text-decoration: underline; }
#rOut h3 { font-size: 15px; margin: 18px 0 6px; }
