/* v1.9.43: icons look the same on every PC/phone (Windows 10 draws its own flat emoji). Twemoji by Twitter, CC-BY 4.0 */
@font-face { font-family: "TbEmoji"; src: url(fonts/twemoji.ttf) format("truetype"); font-display: block;
  unicode-range: U+203C, U+2049, U+2139, U+231A-231B, U+2328, U+23CF, U+23E9-23F3, U+23F8-23FA, U+24C2, U+2600-2604, U+260E-2712, U+2719-27BF,
    U+2934-2935, U+2B1B-2B1C, U+2B50, U+2B55, U+3030, U+303D, U+3297, U+3299, U+FE0F, U+200D, U+1F000-1FAFF, U+E0020-E007F; }
button, input, select, textarea { font-family: inherit; }
:root {
/* v1.8.1: computers always use the light Odoo look; only phones follow dark mode */
  --brand: #714B67; --brand-d: #5a3b52; --teal: #017E84; --gold: #F4B860;
  --bg: #f3f4f6; --card: #ffffff; --ink: #1f2937; --muted: #6b7280; --line: #e5e7eb;
  --ok: #15803d; --ok-bg: #dcfce7; --bad: #b91c1c; --bad-bg: #fee2e2; --warn: #b45309; --warn-bg: #fef3c7;
  --r: 14px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}
@media (prefers-color-scheme: dark) and (max-width: 800px) {
  :root { --bg: #111318; --card: #1b1e25; --ink: #e5e7eb; --muted: #9ca3af; --line: #2b2f38;
          --ok-bg: #0f2e1b; --bad-bg: #3a1414; --warn-bg: #3a2a0c; --ok: #4ade80; --bad: #f87171; --warn: #fbbf24; }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--ink);
  font-family: "TbEmoji", "Segoe UI", Tahoma, "Noto Sans Arabic", system-ui, sans-serif; font-size: 16px; }
[hidden] { display: none !important; }
button, input, select { font: inherit; color: inherit; }
.screen { min-height: 100vh; min-height: 100dvh; }

/* login */
.login { background: linear-gradient(160deg, var(--brand) 0%, var(--brand-d) 55%, var(--teal) 100%);
  display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px 16px; }
.lg-top { text-align: center; color: #fff; margin-bottom: 18px; }
.lg-logo { width: 190px; max-width: 60vw; }
.lg-club { opacity: .85; margin-top: 4px; }
.lg-card { width: 100%; max-width: 380px; background: var(--card); border-radius: 18px; padding: 22px 18px;
  box-shadow: 0 10px 30px rgba(0,0,0,.25); display: flex; flex-direction: column; gap: 12px; }
.lg-card h1 { margin: 0 0 4px; font-size: 20px; text-align: center; }
label { display: flex; flex-direction: column; gap: 6px; font-size: 14px; color: var(--muted); }
input, select { width: 100%; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--card);
  font-size: 16px; color: var(--ink); }
input:focus, select:focus { outline: 2px solid var(--teal); border-color: transparent; }
.pw { position: relative; display: block; }
.pw input { padding-left: 46px; }
.eye { position: absolute; left: 6px; top: 50%; transform: translateY(-50%); border: 0; background: none; font-size: 20px; padding: 6px; }
.dev { font-size: 12px; color: var(--muted); text-align: center; }
.err { background: var(--bad-bg); color: var(--bad); padding: 10px 12px; border-radius: 10px; font-size: 14px; }

.btn { border: 1px solid var(--line); background: var(--card); padding: 11px 16px; border-radius: 10px; cursor: pointer; font-weight: 600; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.big { padding: 14px; font-size: 17px; }
.btn:disabled { opacity: .6; }

/* header + tabs */
.top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 10px;
  background: var(--brand); color: #fff; padding: calc(env(safe-area-inset-top, 0px) + 10px) 16px 10px;
  border-bottom: 3px solid var(--teal); }
.top-logo { height: 30px; }
.top-who { flex: 1; text-align: left; font-size: 14px; opacity: .9; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
/* 🏠 back to the office home (on a computer this page opens inside the Tabyun window, which has no back button) */
.top-btn.home { display: flex; align-items: center; justify-content: center; gap: 6px; text-decoration: none; width: auto; min-width: 38px; padding: 0 10px; font-size: 16px; }
.top-btn.home span { display: none; font-size: 14px; font-weight: 700; }
@media (min-width: 800px) { .top-btn.home span { display: inline; } }
.top-btn { border: 0; background: rgba(255,255,255,.15); color: #fff; width: 38px; height: 38px; border-radius: 10px; font-size: 18px; }
#pages { padding: 12px 16px calc(84px + var(--safe-b)); max-width: 760px; margin: 0 auto; }
.tabs { position: fixed; bottom: 0; left: 0; right: 0; z-index: 6; display: flex; background: var(--card);
  border-top: 1px solid var(--line); padding-bottom: var(--safe-b); }
.tabs button { flex: 1; border: 0; background: none; padding: 8px 4px 10px; font-size: 12px; color: var(--muted);
  display: flex; flex-direction: column; align-items: center; gap: 2px; }
.tabs button span { font-size: 20px; }
.tabs button.on { color: var(--brand); font-weight: 700; }
@media (prefers-color-scheme: dark) and (max-width: 800px) { .tabs button.on { color: var(--gold); } }

.page-head { display: flex; align-items: center; justify-content: space-between; margin: 4px 0 8px; }
.page-head h2 { margin: 0; font-size: 20px; }
.chip { border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 6px 12px; font-size: 14px; }
.asof { color: var(--muted); font-size: 12px; margin-bottom: 10px; }

/* kpis */
.kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }
.kpi { background: var(--card); border-radius: var(--r); padding: 12px; border-top: 4px solid var(--c, var(--brand));
  box-shadow: 0 1px 2px rgba(0,0,0,.05); min-width: 0; }
.kpi.click { cursor: pointer; }
.kpi .l { font-size: 13px; color: var(--muted); }
.kpi .v { font-size: 22px; font-weight: 700; margin: 4px 0 2px; direction: ltr; text-align: right; }
.kpi .s { font-size: 12px; color: var(--muted); }
.up { color: var(--ok); } .down { color: var(--bad); }

.card { background: var(--card); border-radius: var(--r); padding: 14px; margin-bottom: 12px; box-shadow: 0 1px 2px rgba(0,0,0,.05); }
.card h3 { margin: 0 0 10px; font-size: 16px; }
.bars { display: flex; align-items: flex-end; gap: 4px; height: 140px; direction: ltr; }
.bar { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; min-width: 0; }
.bar i { display: block; width: 100%; background: var(--teal); border-radius: 4px 4px 0 0; min-height: 2px; }
.bar.today i { background: var(--brand); }
.bar b { font-size: 9px; color: var(--muted); margin-top: 4px; font-weight: 400; white-space: nowrap; }
.hrow { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--line); }
.hrow:last-child { border-bottom: 0; }
.hrow .n { font-variant-numeric: tabular-nums; direction: ltr; }
.hrow .track { grid-column: 1 / -1; height: 6px; background: var(--line); border-radius: 4px; overflow: hidden; }
.hrow .track i { display: block; height: 100%; background: var(--brand); }
.alert { padding: 10px 12px; border-radius: 10px; margin-bottom: 6px; font-size: 14px; }
.p1 { background: var(--bad-bg); color: var(--bad); }
.p2 { background: var(--warn-bg); color: var(--warn); }
.p3 { background: var(--ok-bg); color: var(--ok); }
.empty { color: var(--muted); font-size: 14px; text-align: center; padding: 10px; }

/* analysis */
.filters { display: flex; gap: 8px; margin-bottom: 10px; align-items: flex-end; }
.filters select { flex: 1; }
.filters .f { flex: 1; font-size: 12px; }
.filters .f input { padding: 9px; font-size: 15px; }
.note { background: var(--card); border-radius: var(--r); padding: 12px; margin-bottom: 8px; border-right: 5px solid var(--c, var(--muted)); }
.note .t { font-size: 12px; font-weight: 700; color: var(--c, var(--muted)); margin-bottom: 4px; }
.note .m { font-size: 15px; line-height: 1.55; }
.note .a { font-size: 14px; color: var(--muted); margin-top: 6px; line-height: 1.5; }
.note .a::before { content: "👈 "; }
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th { text-align: right; color: var(--muted); font-weight: 600; padding: 6px 4px; border-bottom: 1px solid var(--line); }
.tbl td { padding: 7px 4px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl td.num { direction: ltr; text-align: left; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tbl tr.h td { background: var(--bg); font-weight: 700; color: var(--brand); }
.tbl tr.t td { font-weight: 700; }
@media (prefers-color-scheme: dark) and (max-width: 800px) { .tbl tr.h td { color: var(--gold); } }
.scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.sec { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.sec:last-child { border-bottom: 0; }
.sec .nm { font-weight: 700; }
.sec .ev { font-size: 13px; }
.sec .dt { grid-column: 1 / -1; font-size: 12px; color: var(--muted); }

/* approval */
.seg { display: flex; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 3px; margin-bottom: 10px; }
.seg button { flex: 1; border: 0; background: none; padding: 8px; border-radius: 8px; }
.seg button.on { background: var(--brand); color: #fff; font-weight: 700; }
.sum { font-size: 14px; color: var(--muted); margin-bottom: 8px; }
.rv { background: var(--card); border-radius: var(--r); padding: 12px; margin-bottom: 8px; display: grid;
  grid-template-columns: 1fr auto; gap: 4px 10px; box-shadow: 0 1px 2px rgba(0,0,0,.05); cursor: pointer; }
.rv .who { font-weight: 700; }
.rv .acc { font-size: 13px; color: var(--muted); }
.rv .amt { font-size: 18px; font-weight: 700; direction: ltr; text-align: left; }
.rv .st { font-size: 12px; padding: 2px 8px; border-radius: 999px; justify-self: end; }
.rv .st.wait { background: var(--warn-bg); color: var(--warn); }
.rv .st.done { background: var(--ok-bg); color: var(--ok); }
.rv .st.chg { background: var(--bad-bg); color: var(--bad); }
.rv .ex { grid-column: 1 / -1; font-size: 12px; color: var(--muted); }

.sheet { position: fixed; inset: 0; z-index: 20; }
.sheet-bg { position: absolute; inset: 0; background: rgba(0,0,0,.45); }
.sheet-card { position: absolute; left: 0; right: 0; bottom: 0; background: var(--card); border-radius: 18px 18px 0 0;
  padding: 10px 16px calc(16px + var(--safe-b)); display: flex; flex-direction: column; gap: 10px; max-width: 560px; margin: 0 auto;
  max-height: 92vh; overflow: auto; }
.sheet-grip { width: 40px; height: 4px; background: var(--line); border-radius: 4px; margin: 0 auto 4px; }
.sheet-card h3 { margin: 0; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; font-size: 14px; }
.kv span:nth-child(odd) { color: var(--muted); }
.diff { font-size: 14px; padding: 8px 10px; border-radius: 10px; background: var(--bg); }
.row2 { display: grid; grid-template-columns: 1fr 2fr; gap: 8px; }

.toast { position: fixed; bottom: calc(90px + var(--safe-b)); left: 16px; right: 16px; z-index: 30; background: #1f2937; color: #fff;
  padding: 12px 14px; border-radius: 12px; text-align: center; max-width: 520px; margin: 0 auto; }
.busy { position: fixed; inset: 0; z-index: 40; background: rgba(0,0,0,.15); display: flex; align-items: center; justify-content: center; }
.spin { width: 42px; height: 42px; border: 4px solid rgba(255,255,255,.6); border-top-color: var(--brand); border-radius: 50%; animation: s .8s linear infinite; }
@keyframes s { to { transform: rotate(360deg); } }

.acclist { max-height: 38vh; overflow: auto; border: 1px solid var(--line); border-radius: 10px; }
.acclist button { display: block; width: 100%; text-align: right; border: 0; border-bottom: 1px solid var(--line); background: none; padding: 11px 12px; }
.acclist button:last-child { border-bottom: 0; }
.acclist button.on { background: var(--brand); color: #fff; font-weight: 700; }
.rv .kind { font-size: 12px; padding: 2px 8px; border-radius: 999px; justify-self: end; }
.rv .kind.in { background: var(--ok-bg); color: var(--ok); }
.rv .kind.out { background: var(--bad-bg); color: var(--bad); }

/* v1.9.15: الوضع المظلم بزرار (theme.js بيحط data-theme على html) */
html[data-theme="dark"] { color-scheme: dark;
  --bg: #15171c; --card: #1e2128; --ink: #e5e7eb; --muted: #9ca3af; --line: #2f3440;
  --ok-bg: #0f2e1b; --bad-bg: #3a1414; --warn-bg: #3a2a0c; --ok: #4ade80; --bad: #f87171; --warn: #fbbf24;
  --brand: #8a5f7f; --brand-d: #6b4762; }
html[data-theme="dark"] .tabs button.on, html[data-theme="dark"] .tbl tr.h td { color: var(--gold); }
@media print { html[data-theme="dark"] { color-scheme: light; --bg: #fff; --card: #fff; --ink: #000; --muted: #555; --line: #ccc; } }
/* 1.9.116.32: اختيار من قايمة البرنامج (علامة صح) */
.fmulti { flex: 1 1 100%; margin-bottom: 10px; }
.fmulti .fmt { font-weight: 600; margin-bottom: 4px; }
.fmulti .fmq { width: 100%; margin-bottom: 6px; }
.fmbox { display: flex; flex-wrap: wrap; gap: 6px 10px; max-height: 260px; overflow: auto; padding: 8px; border: 1px solid var(--line, #d0d7e2); border-radius: 10px; }
.fmbox label.chk { display: inline-flex; gap: 5px; align-items: center; padding: 4px 10px; border-radius: 999px; background: rgba(127,127,127,.08); cursor: pointer; margin: 0; }
.fmbox label.chk:has(input:checked) { background: rgba(26,48,98,.14); font-weight: 600; }
.fmbox label.gone { color: #B03A2E; }
