/* أوتوكار — تصميم للتلفون أوّلاً (RTL) */
:root { --c: #f5a623; --c2: #e8951a; --ink: #1d2430; --mute: #6b7280; --bg: #f3f4f7; --card: #fff; --line: #e5e7eb; --ok: #16a34a; --bad: #dc2626; --warn: #d97706; --blue: #2563eb; --r: 14px; --sh: 0 1px 3px rgba(0,0,0,.08), 0 4px 14px rgba(0,0,0,.05); }
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: "Segoe UI", Tahoma, Arial, sans-serif; font-size: 16px; color: var(--ink); background: var(--bg); padding-bottom: 20px; }
a { color: var(--blue); text-decoration: none; }
h1, h2, h3 { margin: 0; }
.top { position: sticky; top: 0; z-index: 50; background: var(--c); color: #1d2430; box-shadow: 0 2px 8px rgba(0,0,0,.12); padding-top: env(safe-area-inset-top); }
.top-in { display: flex; align-items: center; gap: 10px; padding: 12px 14px; max-width: 980px; margin: 0 auto; }
.top h1 { font-size: 19px; font-weight: 700; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top .logo { font-size: 24px; }
.top .back { font-size: 30px; line-height: 1; color: inherit; padding: 0 4px; transform: scaleX(-1); display: inline-block; }
.top-right { display: flex; gap: 6px; }
.top-right a, .top-right button { background: rgba(255,255,255,.55); border: 0; border-radius: 10px; padding: 7px 10px; font-size: 14px; color: var(--ink); font-weight: 600; }
.main { max-width: 980px; margin: 0 auto; padding: 14px 14px 10px; }
body.wide .main, body.wide .top-in { max-width: 1400px; }
.card { background: var(--card); border-radius: var(--r); box-shadow: var(--sh); padding: 14px; margin-bottom: 12px; }
.card h2 { font-size: 16px; margin-bottom: 10px; color: var(--ink); }
.card h2 small { color: var(--mute); font-weight: 400; font-size: 13px; }
.flash { padding: 12px 14px; border-radius: 12px; margin-bottom: 12px; background: #dcfce7; color: #14532d; font-weight: 600; }
.flash.err { background: #fee2e2; color: #7f1d1d; }
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 12px; }
@media (min-width: 640px) { .stats { grid-template-columns: repeat(4, 1fr); } }
.stat { background: var(--card); border-radius: var(--r); box-shadow: var(--sh); padding: 14px 12px; text-align: center; }
.stat .v { font-size: 22px; font-weight: 800; letter-spacing: -.3px; }
.stat .l { font-size: 13px; color: var(--mute); margin-top: 3px; }
.stat.ok .v { color: var(--ok); } .stat.bad .v { color: var(--bad); } .stat.warn .v { color: var(--warn); } .stat.blue .v { color: var(--blue); }
/* أزرار */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 0; border-radius: 12px; padding: 12px 16px; font-size: 16px; font-weight: 700; background: var(--c); color: var(--ink); cursor: pointer; text-decoration: none; line-height: 1.1; min-height: 46px; }
.btn.sm { padding: 8px 12px; font-size: 14px; min-height: 36px; border-radius: 10px; }
.btn.wa { background: #25d366; color: #fff; }
.btn.blue { background: var(--blue); color: #fff; }
.btn.ok { background: var(--ok); color: #fff; }
.btn.bad { background: var(--bad); color: #fff; }
.btn.ghost { background: #fff; border: 1.5px solid var(--line); color: var(--ink); }
.btn.block { width: 100%; }
.btns { display: flex; flex-wrap: wrap; gap: 8px; }
.btns .btn { flex: 1 1 auto; }
/* نماذج */
label { display: block; font-size: 14px; color: var(--mute); margin: 10px 0 4px; font-weight: 600; }
input[type=text], input[type=tel], input[type=number], input[type=date], input[type=password], input[type=search], select, textarea { width: 100%; font: inherit; font-size: 17px; padding: 11px 12px; border: 1.5px solid var(--line); border-radius: 12px; background: #fff; color: var(--ink); }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--c); border-color: var(--c); }
textarea { min-height: 80px; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.row3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
.search { position: relative; margin-bottom: 10px; }
.search input { padding-inline-start: 40px; }
.search:before { content: "🔍"; position: absolute; inset-inline-start: 12px; top: 12px; opacity: .6; }
/* قوائم */
.list { background: var(--card); border-radius: var(--r); box-shadow: var(--sh); overflow: hidden; margin-bottom: 12px; }
.item { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-bottom: 1px solid var(--line); color: inherit; }
.item:last-child { border-bottom: 0; }
.item .av { width: 42px; height: 42px; border-radius: 50%; background: #fff3dd; display: flex; align-items: center; justify-content: center; font-weight: 800; color: var(--c2); flex-shrink: 0; font-size: 17px; }
.item .tx { flex: 1; min-width: 0; }
.item .t { font-weight: 700; font-size: 16px; }
.item .s { color: var(--mute); font-size: 13px; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item .amt { text-align: left; font-weight: 800; font-size: 15px; white-space: nowrap; }
.item .amt small { display: block; font-weight: 500; color: var(--mute); font-size: 12px; }
.c-ok { color: var(--ok); } .c-bad { color: var(--bad); } .c-warn { color: var(--warn); } .c-mute { color: var(--mute); }
.chip { display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: 12.5px; font-weight: 700; background: #eef2ff; color: #3730a3; }
.chip.ok { background: #dcfce7; color: #14532d; } .chip.bad { background: #fee2e2; color: #7f1d1d; } .chip.warn { background: #fef3c7; color: #78350f; } .chip.mute { background: #f1f5f9; color: #475569; }
/* جداول — عناوين ثابتة أثناء التمرير */
.tbl-wrap { overflow: visible; } /* الصفحة هي الأسانسير: لا صناديق تمرير داخلية حتى تبقى عناوين الأعمدة ثابتة */
@media (max-width: 640px) { table { font-size: 12px; } th, td { white-space: normal; padding: 6px 4px; word-break: break-word; } th { top: 108px; } .hp { display: none !important; } }
@media (min-width: 641px) { .sp { display: none !important; } }
.row.stack { grid-template-columns: 1fr; }
table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 14.5px; background: #fff; }
th, td { padding: 9px 8px; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; }
th { position: sticky; top: 112px; background: #fafafa; z-index: 5; font-size: 13px; color: var(--mute); font-weight: 700; }
td.n, th.n { text-align: left; font-variant-numeric: tabular-nums; }
tr.tot td { font-weight: 800; background: #fffbeb; }
/* شريط الأبواب فوق (تحت العنوان مباشرة) */
.tabs { display: flex; background: #fff; border-top: 1px solid rgba(0,0,0,.08); }
.tabs a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 7px 2px 6px; font-size: 12px; color: var(--mute); font-weight: 700; border-bottom: 3px solid transparent; }
.tabs a .ic { font-size: 21px; line-height: 1.1; }
.tabs a.on { color: var(--c2); border-bottom-color: var(--c); background: #fff8ea; }
/* شبكة «المزيد» */
.grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (min-width: 640px) { .grid { grid-template-columns: repeat(3, 1fr); } }
.tile { background: #fff; border-radius: var(--r); box-shadow: var(--sh); padding: 18px 12px; text-align: center; color: var(--ink); font-weight: 700; }
.tile .ic { font-size: 30px; display: block; margin-bottom: 6px; }
/* المسح */
#reader { width: 100%; max-width: 480px; margin: 0 auto; border-radius: 14px; overflow: hidden; background: #000; }
.seg { display: flex; background: #e9eaee; border-radius: 12px; padding: 4px; margin-bottom: 12px; }
.seg button { flex: 1; border: 0; background: transparent; padding: 11px; font: inherit; font-weight: 700; border-radius: 10px; color: var(--mute); }
.seg button.on { background: #fff; color: var(--ink); box-shadow: 0 1px 4px rgba(0,0,0,.12); }
.seg button.on.up { color: var(--ok); } .seg button.on.down { color: var(--blue); }
.scan-res { text-align: center; padding: 18px; border-radius: 14px; margin-top: 12px; font-weight: 800; font-size: 20px; display: none; }
.scan-res.ok { display: block; background: #dcfce7; color: #14532d; } .scan-res.bad { display: block; background: #fee2e2; color: #7f1d1d; } .scan-res.dup { display: block; background: #fef3c7; color: #78350f; }
.scan-res small { display: block; font-size: 14px; font-weight: 500; margin-top: 4px; }
/* بطاقات الباركود */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.qcard { background: #fff; border: 2px solid var(--ink); border-radius: 14px; padding: 12px; text-align: center; page-break-inside: avoid; }
.qcard .nm { font-weight: 800; font-size: 18px; margin: 6px 0 2px; } .qcard .fm { color: var(--mute); font-size: 13px; }
.qcard .qr { margin: 8px auto 0; } .qcard .qr img, .qcard .qr svg { width: 160px; height: 160px; }
.qcard .brand { font-size: 12px; color: var(--mute); margin-top: 6px; }
/* الوصل */
.receipt { max-width: 520px; margin: 0 auto; background: #fff; border-radius: 16px; box-shadow: var(--sh); padding: 20px; }
.receipt .hd { text-align: center; border-bottom: 2px dashed var(--line); padding-bottom: 12px; margin-bottom: 12px; }
.receipt .hd .nm { font-size: 20px; font-weight: 800; }
.receipt .big { font-size: 30px; font-weight: 900; text-align: center; color: var(--ok); margin: 10px 0; }
.receipt .kv { display: flex; justify-content: space-between; padding: 7px 0; border-bottom: 1px solid var(--line); }
.receipt .kv b { font-weight: 700; }
.months { display: flex; flex-wrap: wrap; gap: 6px; }
.months span { padding: 6px 10px; border-radius: 10px; font-size: 13px; font-weight: 700; background: #f1f5f9; color: #475569; }
.months span.paid { background: #dcfce7; color: #14532d; } .months span.part { background: #fef3c7; color: #78350f; } .months span.late { background: #fee2e2; color: #7f1d1d; }
.muted { color: var(--mute); font-size: 13.5px; }
.center { text-align: center; }
.mt { margin-top: 12px; }
.login { max-width: 380px; margin: 40px auto; }
.login .logo { font-size: 64px; text-align: center; }
@media print { .top, .bottom, .no-print, .flash { display: none !important; } body { background: #fff; padding: 0; } .main { padding: 0; max-width: none; } .card, .receipt { box-shadow: none; } th { position: static; } }
