/* خط Cairo (اختاره المستخدم 2026-12-02) — محفوظ على السيرفر نفسه، فلا يُحمَّل شيء من خارج النظام */
@font-face {
  font-family: 'Cairo'; font-style: normal; font-weight: 400 700; font-display: swap;
  src: url(../fonts/cairo-arabic.woff2) format('woff2');
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-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;
}
@font-face {
  font-family: 'Cairo'; font-style: normal; font-weight: 400 700; font-display: swap;
  src: url(../fonts/cairo-latin.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;
}
/* ألوان شعار NSM: عنابي + رمادي داكن + أبيض */
:root {
  --brand: #9c2c52; --brand-dark: #7a1f3f; --brand-soft: #f7e6ed; --charcoal: #292929;
  --bg: #f4f3f4; --card: #fff; --ink: #242424; --muted: #6f6a6d; --line: #e6e2e4;
  --blue: var(--brand); --bb: #9c2c52; --hs: #3a3f47; --ex: #b8462e; --wd: #5a5f69; --cash: #1f7a4a;
  --yellow: #fff59d; --ok: #1f7a4a; --bad: #c62828;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.6 "Cairo", "Segoe UI", system-ui, -apple-system, "SF Arabic", "Geeza Pro", "Noto Sans Arabic", Tahoma, Arial, sans-serif; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
/* الأرقام بعرض ثابت: المبالغ تصطف تحت بعض */
.num, td.num, .val, .total, .stat .val { font-variant-numeric: tabular-nums; }
button, input, select { font: inherit; }
button { cursor: pointer; border: 0; border-radius: 8px; padding: 7px 14px; }
button.primary { background: var(--blue); color: #fff; }
button.primary.big { padding: 11px; font-size: 17px; }
button.soft { background: #efeaec; color: var(--ink); }
button.primary:hover { background: var(--brand-dark); }
button.warn { background: #f6c343; color: #3a2c00; }
button.danger { background: var(--bad); color: #fff; }
button.link { background: none; color: var(--blue); padding: 4px 6px; }
button.icon { background: none; padding: 2px 6px; font-size: 15px; opacity: .65; }
button.icon:hover { opacity: 1; }
button.small { padding: 4px 9px; font-size: 13px; }
input, select { border: 1px solid #cfd6de; border-radius: 8px; padding: 7px 9px; background: #fff; min-width: 0; }
input:focus, select:focus { outline: 2px solid #e3a9bf; border-color: var(--brand); }
input.num { text-align: left; direction: ltr; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.pad { padding: 20px; }
.hidden { display: none !important; }
.err { color: var(--bad); min-height: 1.4em; }

/* الدخول */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 16px; background: linear-gradient(155deg, #292929 0%, #292929 55%, #5b1a31 100%); }
.login { background: #fff; border-radius: 16px; padding: 28px 24px; width: min(360px, 100%); display: grid; gap: 12px; text-align: center; box-shadow: 0 20px 50px rgba(0,0,0,.35); border-top: 5px solid var(--brand); }
.login img { width: 190px; margin: 0 auto; filter: drop-shadow(0 2px 6px rgba(0,0,0,.08)); }
.login h1 { margin: 0; color: var(--charcoal); }
.login p { margin: 0 0 6px; }
.login label { display: grid; gap: 4px; text-align: right; font-size: 14px; color: var(--muted); }
.login input { padding: 10px; font-size: 16px; }

/* الشريط العلوي */
nav.top { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 8px 14px; background: var(--charcoal); color: #fff; border-bottom: 3px solid var(--brand); }
nav.top .brand { display: flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; }
nav.top .brand:hover img { opacity: .85; }
.page-head { display: flex; align-items: center; gap: 10px; margin: 6px 0; }
.page-head h2 { margin: 0; }
.page-head .back { font-size: 14px; padding: 5px 12px; white-space: nowrap; }
nav.top .brand img { height: 36px; width: auto; border-radius: 7px; box-shadow: 0 1px 3px rgba(0,0,0,.25); }
nav.top .brand .muted { color: #c9c3c6; }
nav.top .tabs { display: flex; gap: 4px; flex: 1; min-width: 0; overflow-x: auto; scrollbar-width: none; }
nav.top .tabs::-webkit-scrollbar { display: none; }
nav.top .tabs button { background: transparent; color: #dcd6d9; white-space: nowrap; flex: 0 0 auto; }
/* شاشة متوسطة: التبويبات بسطر كامل تحت الشعار، فلا يختفي «المخزن» أو غيره */
@media (max-width: 1150px) { nav.top { flex-wrap: wrap; } nav.top .tabs { order: 3; flex: 1 1 100%; } }
nav.top .tabs button.on { background: var(--brand); color: #fff; }
nav.top .tabs button:hover:not(.on) { background: rgba(255,255,255,.08); }
nav.top .who { display: flex; align-items: center; gap: 8px; }
nav.top .who .link { color: #dcd6d9; }
.me { font-weight: 600; }
.live { font-size: 12px; padding: 2px 8px; border-radius: 20px; background: rgba(255,255,255,.15); color: #ffd0d0; }
.live.on { color: #c8f7d4; }
.live::before { content: "● "; }

/* اليوم */
main { padding: 14px; max-width: 1500px; margin: 0 auto; }
.daybar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.daybar .daytitle { margin: 0 6px; font-size: 19px; }
.nav-btn { background: #fff; border: 1px solid var(--line); font-size: 20px; line-height: 1; padding: 5px 12px; }
.badge { font-size: 13px; padding: 3px 10px; border-radius: 20px; }
.badge.open { background: #e3f4e9; color: var(--ok); }
.badge.lock { background: #fde8e8; color: var(--bad); }
.strip { display: flex; gap: 4px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 12px; }
.dtab { background: #fff; border: 1px solid var(--line); white-space: nowrap; padding: 4px 11px; position: relative; font-size: 14px; }
.dtab.on { background: var(--blue); color: #fff; border-color: var(--blue); }
.dtab.locked::after { content: " 🔒"; font-size: 11px; }
.dtab.older { background: transparent; border-style: dashed; color: var(--muted, #666); }
.dtab .dot { font-style: normal; background: #f6c343; color: #3a2c00; border-radius: 10px; padding: 0 6px; font-size: 11px; margin-inline-start: 5px; }

.summary { display: grid; grid-template-columns: repeat(4, 1fr) 1.6fr; gap: 10px; margin-bottom: 14px; align-items: stretch; }
/* رصيد الصندوق: أهم رقم في الصفحة — أكبر ومميز بلون الشعار */
.stat.bal { background: linear-gradient(135deg, var(--brand) 0%, var(--brand-dark) 100%); color: #fff; border-top: 0; box-shadow: 0 6px 18px rgba(166, 42, 85, .28); display: flex; flex-direction: column; justify-content: center; }
.stat.bal .lbl { color: rgba(255, 255, 255, .9); font-size: 16px; font-weight: 600; }
.stat.bal .val { font-size: 44px; line-height: 1.1; letter-spacing: .5px; }
.stat.bal .sub { color: rgba(255, 255, 255, .8); }
.stat.bal.neg { background: linear-gradient(135deg, #d32f2f 0%, #8e1b1b 100%); box-shadow: 0 6px 18px rgba(198, 40, 40, .3); }
.stat.bal.clickable { cursor: pointer; transition: transform .12s ease, box-shadow .12s ease; user-select: none; }
.stat.bal.clickable:hover { transform: translateY(-2px); box-shadow: 0 10px 24px rgba(166, 42, 85, .35); }
.stat.bal.active { outline: 3px solid #f3c1d3; outline-offset: 2px; }
.stat.bal .hint { margin-top: 6px; font-size: 12.5px; background: rgba(255, 255, 255, .18); border-radius: 10px; padding: 2px 10px; align-self: flex-start; }
.stat .lbl .link { margin-inline-start: 6px; }
.stat.open { border-color: #8d6e63; } .stat.transfer { border-color: #37474f; }
.sec-sale > header { background: #00897b; }
.sec-purchase > header { background: #ef6c00; }
.sec-transfer > header { background: #37474f; }
.sec-tag-sale { background: #00897b; } .sec-tag-purchase { background: #ef6c00; } .sec-tag-transfer { background: #37474f; }
.stat { background: var(--card); border-radius: 12px; padding: 10px 14px; border-top: 4px solid var(--line); }
.stat .lbl { color: var(--muted); font-size: 13px; }
.stat .val { font-size: 26px; font-weight: 700; direction: ltr; text-align: right; }
.stat .sub { font-size: 12px; color: var(--muted); }
.stat.in { border-color: var(--cash); } .stat.out { border-color: var(--ex); } .stat.bal { border-color: var(--blue); }
.stat.cash { border-color: #999; } .stat.cash.ok { border-color: var(--ok); } .stat.cash.less { border-color: var(--bad); } .stat.cash.more { border-color: #f6a723; }
.stat.cash.less .sub { color: var(--bad); font-weight: 600; } .stat.cash.ok .sub { color: var(--ok); font-weight: 600; }

.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: start; }
.card { background: var(--card); border-radius: 12px; box-shadow: 0 1px 3px rgba(0,0,0,.06); overflow: hidden; }
.card > header { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 9px 12px; color: #fff; }
.card > header h3 { margin: 0; font-size: 16px; }
.card > header .total { font-size: 18px; font-weight: 700; background: rgba(255,255,255,.18); padding: 1px 10px; border-radius: 8px; direction: ltr; }
.card > header .tools { display: flex; gap: 6px; flex-wrap: wrap; margin-inline-start: auto; }
.card > header .tools button { background: rgba(255,255,255,.9); }
.sec-flow { margin-bottom: 14px; }
.sec-flow > header { background: var(--charcoal); border-bottom: 3px solid var(--brand); }
.sec-flow > header.clickable { cursor: pointer; user-select: none; }
.sec-flow > header.clickable:hover { background: #333; }
.sec-flow h3 .cnt { font-weight: 400; color: #cfc8cb; font-size: 13px; }
.sec-flow .flow-toggle { margin-inline-start: auto; font-size: 13px; background: var(--brand); color: #fff; padding: 3px 10px; border-radius: 12px; }
.sec-flow .flow-sum { font-size: 14px; color: #e9e4e6; }
.sec-flow .flow-sum b { color: #fff; }
.sec-flow .flow-sum .total { font-size: 16px; }
table.flow td { font-size: 14.5px; padding: 5px 8px; }
table.flow td.in { color: var(--ok); font-weight: 700; }
table.flow td.out { color: var(--bad); font-weight: 700; }
table.flow tr.opening-row td { background: #f7f3f5; }
table.flow tr.muted-row td { color: var(--muted); font-size: 12.5px; text-align: center; background: #fafafa; }
/* أدوات بجانب التاريخ */
.daytools { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-inline-start: auto; }
.daytools .quick-search input { width: 210px; padding: 6px 10px; border-radius: 18px; background: #fff; }
button.tool { background: #fff; border: 1px solid var(--line); color: var(--ink); padding: 6px 12px; border-radius: 18px; font-size: 14px; }
button.tool:hover { border-color: var(--brand); color: var(--brand); }
button.tool.on { background: var(--brand); color: #fff; border-color: var(--brand); }

/* الآلة الحاسبة العائمة */
.calc { position: fixed; bottom: 16px; left: 16px; z-index: 40; width: 270px; background: #fff; border-radius: 14px; box-shadow: 0 12px 36px rgba(0,0,0,.28); border-top: 4px solid var(--brand); padding: 10px; display: grid; gap: 8px; }
.calc-head { display: flex; justify-content: space-between; align-items: center; }
.calc-expr { font-size: 22px; text-align: left; padding: 8px 10px; font-weight: 700; }
.calc-res { min-height: 22px; text-align: left; direction: ltr; color: var(--brand); font-weight: 700; font-size: 18px; }
.calc-keys { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; direction: ltr; }
.calc-keys .key { padding: 11px 0; font-size: 18px; font-weight: 600; background: #f3f0f2; border-radius: 10px; }
.calc-keys .key:hover { background: #e9e3e6; }
.calc-keys .key.op { background: var(--charcoal); color: #fff; }
.calc-keys .key.clr { background: #fde8e8; color: var(--bad); }
.calc .row button { flex: 1; }
.calc button[disabled] { opacity: .45; cursor: not-allowed; }

/* خانة فيها معادلة: علامة ƒ صغيرة، والتلميح يعرض النتيجة أثناء الكتابة */
td.cell { position: relative; }
td.cell:has(.has-expr)::before { content: 'ƒ'; position: absolute; top: 2px; right: 4px; font-size: 11px; color: var(--brand); font-style: italic; font-weight: 700; pointer-events: none; }
td.hint.calc { color: var(--brand) !important; font-weight: 700; font-size: 14px !important; }

@media print {
  nav.top, .daytools, .strip, .calc, tr.new, td.act, th.act, td.chk, th.chk, .tools, .stat.bal .hint, .confirm-lock, .daybar button, .daybar input, .toast { display: none !important; }
  body, html { background: #fff; }
  main { padding: 0; max-width: none; }
  .grid { grid-template-columns: 1fr 1fr; }
  .card { box-shadow: none; border: 1px solid #ccc; break-inside: avoid; }
  .stat.bal { color: #000; background: #fff; border: 2px solid #000; box-shadow: none; }
  .stat.bal .lbl, .stat.bal .sub { color: #333; }
}

.confirm-lock { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; background: #fff4e5; border: 1px solid #f6c343; padding: 4px 10px; border-radius: 8px; font-size: 14px; }
.sec-broadband > header { background: var(--bb); }
.sec-hotspot > header { background: var(--hs); }
.sec-expense > header { background: var(--ex); }
.sec-withdrawal > header { background: var(--wd); }
.sec-cash > header { background: var(--cash); }

.tablewrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 6px 8px; border-bottom: 1px solid var(--line); text-align: right; vertical-align: middle; }
th { font-size: 12.5px; color: var(--muted); font-weight: 600; background: #fafbfc; white-space: nowrap; }
td.num, th.num { text-align: left; direction: ltr; white-space: nowrap; }
td.num { font-weight: 600; }
td.by { white-space: nowrap; font-size: 13px; }
td.by span { display: block; }
td.by small { color: var(--muted); margin-inline-end: 6px; }
td.by small.edited { color: #b26a00; }
td.act { white-space: nowrap; text-align: left; }
td.chk, th.chk { width: 28px; text-align: center; }
td.chk input { width: 17px; height: 17px; }
tr.posted td { background: var(--yellow); }
tr.skip td { color: var(--muted); }
/* مجموع سلف الموظف: الرقم الجديد بخط عريض، وتحته السابق */
table.grid-table td.cell .ro.cum { display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.15; white-space: nowrap; padding: 4px 2px; font-size: 14px; overflow: hidden; }
.ro.cum b { color: var(--brand-dark); font-size: 14px; }
.ro.cum small { color: var(--muted, #777); font-size: 11px; }
.ro.cum.neg b { color: #c0392b; }
.ro.cum.live b { color: #8a6d00; }
/* مبلغ بنجمة: للتذكير والترحيل، لا يدخل الصندوق */
tr.memo td.num input, tr.memo td.num .ro, .memo-amt { color: #8a6d00; font-style: italic; }
tr.memo td.rn { background: #fff4c7; }
tr.memo td.rn::after { content: '*'; color: #b08900; font-weight: 700; }
.card > header .memo-sum { font-size: 13px; color: #fff; background: rgba(0,0,0,.22); padding: 1px 8px; border-radius: 8px; direction: rtl; cursor: help; }
tr.empty td { color: var(--muted); text-align: center; padding: 14px; }
tr.editing td { background: #eef5fc; }
tr.editing input { width: 100%; min-width: 70px; }
select.cls { padding: 3px 6px; font-size: 13px; }
select.cls-internet { background: #e3f0fb; } select.cls-purchases { background: #f3e8fb; } select.cls-skip { background: #eee; color: var(--muted); }
select.cls-refund { background: #fdeee6; } select.cls-office { background: #fff6dc; } select.cls-power { background: #fff0e0; }
select.cls-maintenance { background: #e9f5ec; } select.cls-transport { background: #eef0fb; } select.cls-staff { background: #f9e9ef; }

/* الجدول مثل الإكسل: الخانة نفسها مكان الكتابة */
table.grid-table { border-collapse: collapse; table-layout: fixed; min-width: 600px; }
table.grid-table th, table.grid-table td { border: 1px solid #e1e5ea; }
table.grid-table th { background: #f4f6f9; color: #4b5866; font-size: 13px; padding: 6px 4px; }
table.grid-table td.cell { padding: 0; }
table.grid-table td.cell input { width: 100%; border: 0; border-radius: 0; background: transparent; padding: 9px 8px; font-size: 16px; }
table.grid-table td.cell input:focus { outline: 2px solid #3b82c4; outline-offset: -2px; background: #f2f8ff; }
table.grid-table td.cell .ro { display: block; padding: 9px 8px; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
table.grid-table td.num input, table.grid-table td.num .ro { font-weight: 700; }
/* عرض الأعمدة: الأعمدة الصغيرة ثابتة، والاسم يأخذ الباقي — فلا يركب نص على نص */
table.grid-table .w3 { width: auto; } table.grid-table .w2 { width: 18%; } table.grid-table .w1 { width: 84px; }
table.grid-table th.rn, table.grid-table td.rn { width: 32px; text-align: center; color: #9aa5b1; font-size: 12px; background: #f8f9fb; }
table.grid-table th.by, table.grid-table td.by { width: 92px; overflow: hidden; }
table.grid-table td.by span, table.grid-table td.by small { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.3; }
table.grid-table th.act, table.grid-table td.act { width: 56px; text-align: center; }
table.grid-table th.chk, table.grid-table td.chk { width: 32px; }
table.grid-table th.clscol, table.grid-table td.clscol { width: 128px; padding: 4px; overflow: hidden; }
table.grid-table td.clscol select { width: 100%; max-width: 100%; }
table.grid-table td, table.grid-table th { overflow: hidden; text-overflow: ellipsis; }
table.grid-table td.act { padding: 2px; text-overflow: clip; }
table.grid-table td.act button.icon { padding: 2px 4px; }
table.grid-table th { white-space: nowrap; }
tr.new td { background: #fbfdf6; }
tr.new td.cell input::placeholder { color: #a9b3bd; }
tr.new td.hint { color: #9aa5b1; font-size: 12px; }
tr.posted td.cell input, tr.posted td.cell .ro { background: var(--yellow); }
.add-btn { background: var(--cash); color: #fff; font-size: 20px; line-height: 1; padding: 4px 12px; }
button.del { color: var(--bad); opacity: .5; }
.tag { font-size: 11px; background: #f6e58d; color: #6b5800; padding: 2px 6px; border-radius: 6px; }
.opening { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; padding: 4px 0 8px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.opening small { margin-inline-start: 4px; }
.small-in { width: 110px; padding: 4px 6px; }

form.cash { padding: 10px 12px; display: grid; gap: 6px; }
.den { display: grid; grid-template-columns: 60px 16px 1fr 100px; align-items: center; gap: 8px; }
.den .face { font-weight: 700; background: #eef6f0; color: var(--cash); border-radius: 6px; text-align: center; padding: 3px 0; }
.den .line { text-align: left; direction: ltr; color: var(--muted); }
.cmp { display: flex; justify-content: space-between; padding: 8px 0 2px; border-top: 1px solid var(--line); margin-top: 4px; font-size: 15px; }
.cmp .ok { color: var(--ok); font-weight: 700; } .cmp .less { color: var(--bad); font-weight: 700; } .cmp .more { color: #b26a00; font-weight: 700; }

/* صفحات المدير */
.page h2 { margin: 6px 0; }
.filters { display: flex; gap: 10px; align-items: end; flex-wrap: wrap; margin: 10px 0; }
.filters label { display: grid; gap: 3px; font-size: 13px; color: var(--muted); }
table.log td { font-size: 13.5px; }
.nowrap { white-space: nowrap; }
tr.act-delete td { background: #fff1f0; } tr.act-edit td { background: #fffbea; } tr.act-login_failed td { background: #fde8e8; }
.adduser { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; padding: 12px; margin: 10px 0; }
.adduser h3 { margin: 0 0 0 8px; font-size: 16px; }
tr.inactive td { color: var(--muted); text-decoration: line-through; }
tr.inactive td.act { text-decoration: none; }
.notice { padding: 14px; margin-top: 12px; border-right: 5px solid #f6c343; }

/* الموظفون */
.pad-s { padding: 10px 14px; margin: 10px 0; }
.emp-head { justify-content: space-between; }
.emp-head label { display: grid; gap: 3px; font-size: 13px; color: var(--muted); }
.emp-tot { font-size: 16px; }
table.emp td { font-size: 15px; }
tr.unknown td { background: #fff8e1; }
.warn-txt { color: #b26a00; }
.neg-txt, .neg-txt b { color: #c0392b; }
.ok-txt { color: #1f7a4a; }
/* رابط بشكل زر (تنزيل النسخة الاحتياطية) */
a.btn { display: inline-block; text-decoration: none; border-radius: 8px; padding: 7px 14px; }
a.btn.primary { background: var(--brand); color: #fff; }
/* البرودباند: سطر ثانٍ من الريديس تحت الملاحظة — الحالة وكم يوم باقي للفاتورة */
/* عمود «الاشتراك» بالبرودباند: سطر واحد بالنص — نقطة الاتصال، والحالة، وكم يوم باقي */
table.grid-table th.wsub, table.grid-table td.wsub { width: 172px; text-align: center; }
.subline { display: inline-flex; flex-wrap: nowrap; justify-content: center; align-items: center; gap: 3px 5px; padding: 0 4px; font-size: 12px; line-height: 1.5; white-space: nowrap; vertical-align: middle; }
.subline.none { color: #b3b3b3; font-size: 12px; }
.subline .st-biz { background: #292929; color: #fff; border-radius: 6px; padding: 0 6px; font-size: 11.5px; }
.subline .conn { width: 8px; height: 8px; border-radius: 50%; background: #c9c9c9; flex: 0 0 auto; }
.subline .conn.on { background: #1f9d55; box-shadow: 0 0 0 2px rgba(31,157,85,.18); }
.subline .st { font-weight: 700; }
.subline .st-ok { color: #1f7a4a; } .subline .st-bad { color: #c0392b; } .subline .st-mute { color: #8a8a8a; } .subline .st-info { color: #2b6cb0; }
.subline .days { border-radius: 8px; padding: 0 6px; }
.subline .d-ok { background: #e7f5ec; color: #1f7a4a; } .subline .d-warn { background: #fff1d6; color: #9a6200; } .subline .d-bad { background: #fde8e6; color: #b03a2e; }
.card > header .stock-mini bdi.neg { color: #ffd0cc; font-weight: 700; }
@media (max-width: 560px) { table.grid-table th.wsub, table.grid-table td.wsub { width: 96px; } .subline { font-size: 11px; gap: 2px 3px; flex-wrap: wrap; } }
/* مخزن البطاقات */
.store-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 900px) { .store-grid { grid-template-columns: 1fr; } }
.store-form .row input, .store-form .row select { min-width: 0; }
.store-form .row input.num { width: 110px; }
table.stock td.big-num b { font-size: 18px; }
table.stock tr.sel td { background: #fbeef3; }
table.stock tr.dup td { opacity: .75; }
.item-card { margin-bottom: 14px; }
table.ledger td.in { color: #1e7b3c; } table.ledger td.out { color: #b03a2e; }
.warn-box { background: #fff7e0; border-top: 1px solid #f0dfa8; }
.chip { display: inline-flex; gap: 6px; align-items: center; background: #fff; border: 1px solid #e5d59c; border-radius: 12px; padding: 2px 10px; margin: 3px; }
.muted-h { font-size: 13px; opacity: .8; }
.card > header .stock-mini { font-size: 12px; background: rgba(255,255,255,.2); padding: 1px 8px; border-radius: 8px; cursor: pointer; white-space: nowrap; }
button.on { outline: 2px solid var(--brand); }
.adv-ctrl { margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--line); align-items: center; gap: 8px; }
table.emp td.num input.small-in { width: 100px; text-align: left; direction: ltr; }
tr.emp-detail > td { background: #f6f9fc; padding: 4px 30px 10px; }
tr.emp-detail table td { border-bottom: 1px dashed var(--line); font-size: 14px; }
table.grid-table td.cell select { width: 100%; border: 0; border-radius: 0; background: transparent; padding: 9px 6px; font-size: 15px; }

/* البحث */
.searchbox { padding: 14px; display: grid; gap: 10px; margin: 10px 0; }
.searchbox input.q { font-size: 18px; padding: 12px; }
.row.wrap { flex-wrap: wrap; align-items: end; }
.searchbox label { display: grid; gap: 3px; font-size: 13px; color: var(--muted); }
.card > header.res-head { display: flex; gap: 16px; align-items: center; padding: 10px 12px; background: #f4f6f9; color: var(--ink); font-size: 16px; }
table.results td { font-size: 15px; }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: #eef5fc; }
.sec-tag { font-size: 12px; padding: 2px 8px; border-radius: 10px; color: #fff; white-space: nowrap; }
.sec-tag-broadband { background: var(--bb); } .sec-tag-hotspot { background: var(--hs); } .sec-tag-expense { background: var(--ex); } .sec-tag-withdrawal { background: var(--wd); }
tr.flash td { animation: flash 1.2s ease-in-out 3; }
@keyframes flash { 50% { background: #ffe082; } }

.modal { position: fixed; inset: 0; background: rgba(10,20,30,.45); display: grid; place-items: center; z-index: 50; padding: 16px; }
.modal form { padding: 20px; display: grid; gap: 10px; width: min(360px, 100%); }
.modal h3 { margin: 0; }
.row { display: flex; gap: 8px; }

.toast { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); background: #22313f; color: #fff; padding: 10px 18px; border-radius: 10px; z-index: 60; box-shadow: 0 6px 20px rgba(0,0,0,.25); max-width: 90vw; }
.toast.bad { background: var(--bad); }

@media (max-width: 1500px) {
  .grid { grid-template-columns: 1fr; }
}
@media (max-width: 1200px) {
  .summary { grid-template-columns: repeat(4, 1fr); }
  .summary .stat.bal { grid-column: 1 / -1; order: -1; }
}
@media (max-width: 700px) {
  .summary { grid-template-columns: repeat(2, 1fr); }
  .stat.bal .val { font-size: 38px; }
}
@media (max-width: 560px) {
  main { padding: 8px; }
  nav.top { gap: 6px; padding: 6px 8px; }
  nav.top .brand .muted { display: none; }
  /* الجوال: تبويبات الصفحات في سطر مستقل يتمرر أفقياً بدل أن يوسّع الصفحة */
  nav.top .tabs { order: 3; flex: 1 1 100%; overflow-x: auto; min-width: 0; scrollbar-width: none; }
  nav.top .tabs::-webkit-scrollbar { display: none; }
  nav.top .tabs button { white-space: nowrap; padding: 6px 10px; font-size: 14px; flex: 0 0 auto; }
  nav.top .who { flex-wrap: wrap; gap: 4px 8px; font-size: 13px; min-width: 0; }
  .daybar { gap: 6px; }
  .daytools { margin-inline-start: 0; width: 100%; }
  .daytools .quick-search { flex: 1 1 100%; }
  .daytools .quick-search input { width: 100%; }
  .calc { left: 8px; right: 8px; width: auto; bottom: 8px; }
  .daybar input[type=date] { min-width: 0; max-width: 150px; }
  .stat .val { font-size: 21px; }
  .daybar .daytitle { font-size: 16px; width: 100%; order: 9; }
  /* الجوال: الأعمدة الأساسية فقط (الاسم، المبلغ، النوع)، والباقي يظهر على الكمبيوتر */
  table.grid-table { min-width: 0; }
  table.grid-table .by, table.grid-table .rn, table.grid-table .w2, table.grid-table .clscol { display: none; }
  table.grid-table .w1 { width: 66px; }
  table.grid-table td.cell input, table.grid-table td.cell .ro, table.grid-table td.cell select { font-size: 15px; padding: 9px 4px; }
  table.grid-table th.act, table.grid-table td.act { width: 40px; }
  table.grid-table th.chk, table.grid-table td.chk { width: 28px; }
}
