:root {
  --navy: #021C38; --navy2: #0C2C4D; --orange: #FF6B00; --orange-text: #C2410C; --bg: #F3F5F9; --card: #fff;
  --text: #0F1B2D; --text2: #334155; --muted: #475569; --line: #EEF1F5; --border: #CBD5E1;
  --ok: #166534; --ok-bg: #DCFCE7; --warn: #92400E; --warn-bg: #FEF3C7; --bad: #B91C1C; --bad-bg: #FEE2E2; --info: #1D4ED8; --info-bg: #E8F0FB;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: #E5E9F0; }
body { font-family: 'Cairo', system-ui, sans-serif; color: var(--text); font-size: 15px; }
a { color: inherit; text-decoration: none; }
button, input, textarea, select { font-family: inherit; font-size: inherit; }
.shell { max-width: 480px; margin: 0 auto; min-height: 100%; height: 100dvh; display: flex; flex-direction: column; background: var(--bg); overflow: hidden; position: relative; }
.boot { flex: 1; display: grid; place-items: center; background: var(--navy); }
.scroll { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.pad { padding: 14px 16px 20px; display: flex; flex-direction: column; gap: 12px; }

/* الهيدر */
.hdr { background: var(--navy); color: #fff; padding: calc(12px + env(safe-area-inset-top)) 18px 14px; display: flex; flex-direction: column; gap: 10px; }
.hdr.orange { background: var(--orange); }
.brand { display: flex; align-items: center; gap: 8px; }
.brand img { width: 34px; height: 34px; border-radius: 9px; }
.brand b { font-size: 16px; font-family: Arial, sans-serif; line-height: 1.1; }
.brand small { display: block; font-size: 11px; color: #FFB37A; font-family: Arial, sans-serif; }
.hdr.orange .brand small { color: #FFF1E8; }
.hdr h1 { margin: 0; font-size: 20px; }
.hdr .row { display: flex; align-items: center; gap: 12px; }
.hdr .sub { color: #B9C8DA; font-size: 13px; }
.iconbtn { width: 44px; height: 44px; border-radius: 13px; background: var(--navy2); border: 0; color: #fff; display: grid; place-items: center; cursor: pointer; position: relative; flex: none; }
.dot { position: absolute; top: -4px; left: -4px; background: #DC2626; color: #fff; font-size: 11px; font-weight: 800; border-radius: 10px; padding: 0 6px; line-height: 18px; }
.seg { display: flex; gap: 6px; background: var(--navy2); border-radius: 12px; padding: 4px; }
.hdr.orange .seg { background: rgba(0,0,0,.14); }
.seg button { flex: 1; border: 0; border-radius: 9px; padding: 8px 4px; font-weight: 700; font-size: 13.5px; cursor: pointer; background: transparent; color: #C9D8EA; }
.hdr.orange .seg button { color: #fff; }
.seg button.on { background: var(--orange); color: #fff; }
.hdr.orange .seg button.on { background: #fff; color: var(--orange-text); }

/* كروت */
.card { background: var(--card); border-radius: 18px; padding: 14px; display: flex; flex-direction: column; gap: 10px; box-shadow: 0 1px 2px rgba(15,27,45,.06); }
.card h2 { margin: 0; font-size: 16px; }
.between { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.grid4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.stat { background: var(--bg); border-radius: 12px; padding: 10px 4px; text-align: center; }
.stat b { display: block; font-size: 22px; }
.stat span { font-size: 12px; color: var(--muted); }
.kpi { background: var(--card); border-radius: 16px; padding: 12px 14px; display: flex; flex-direction: column; gap: 2px; }
.kpi span { font-size: 13px; color: var(--muted); font-weight: 600; }
.kpi b { font-size: 24px; }
.kpi small { font-size: 12px; color: #64748B; }
.pill { display: inline-block; border-radius: 999px; padding: 3px 12px; font-weight: 800; font-size: 12.5px; white-space: nowrap; }
.pill.ok { background: var(--ok-bg); color: var(--ok); } .pill.warn { background: var(--warn-bg); color: var(--warn); }
.pill.bad { background: var(--bad-bg); color: #991B1B; } .pill.muted { background: #F1F5F9; color: var(--muted); } .pill.info { background: var(--info-bg); color: var(--info); }
.bar { height: 8px; background: var(--line); border-radius: 4px; overflow: hidden; } .bar > i { display: block; height: 100%; background: var(--orange); border-radius: 4px; }
.bar.dark { background: var(--navy2); }
.muted { color: var(--muted); font-size: 13px; }
.small { font-size: 12.5px; }
.empty { text-align: center; color: var(--muted); padding: 30px 10px; }
.points { background: var(--orange); color: #fff; border-radius: 20px; padding: 16px 18px; display: flex; align-items: center; gap: 14px; box-shadow: 0 8px 24px rgba(255,107,0,.25); }
.points b { font-size: 30px; line-height: 1.1; }
.bonus-banner { background: var(--navy); color: #fff; border-radius: 18px; padding: 14px 16px; display: flex; gap: 12px; align-items: center; }
.bonus-banner .ic { width: 44px; height: 44px; border-radius: 12px; background: var(--orange); display: grid; place-items: center; flex: none; }
.tiles a { background: var(--card); border-radius: 16px; padding: 12px 4px; display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; }
.tiles .ti { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; }
.list-item { display: flex; gap: 12px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); }
.list-item:first-of-type { border-top: 0; }
.nd { width: 10px; height: 10px; border-radius: 50%; flex: none; background: var(--orange); }
.nd.read { background: #CBD5E1; }

/* الفوتر */
.tabbar { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); background: #fff; border-top: 1px solid #E2E8F0; padding: 6px 4px calc(8px + env(safe-area-inset-bottom)); }
.tabbar a { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 0; font-size: 12px; font-weight: 700; color: var(--muted); }
.tabbar a.on { color: var(--orange-text); font-weight: 800; }

/* فورم */
.field { display: flex; flex-direction: column; gap: 6px; font-weight: 700; font-size: 14px; }
.input { height: 54px; border-radius: 14px; border: 1.5px solid var(--border); background: #fff; padding: 0 16px; font-size: 18px; font-weight: 700; direction: ltr; text-align: right; width: 100%; }
.input:focus, textarea:focus { outline: 2px solid var(--orange); border-color: var(--orange); }
textarea.input { height: auto; min-height: 110px; padding: 12px; font-size: 15px; font-weight: 600; direction: rtl; text-align: right; resize: none; }
.btn { height: 54px; border-radius: 16px; border: 0; background: var(--orange); color: #fff; font-size: 17px; font-weight: 800; cursor: pointer; width: 100%; }
.btn[disabled] { opacity: .6; }
.btn.ghost { background: #fff; color: var(--orange-text); border: 2px dashed #FDBA8C; height: 50px; font-size: 15px; }
.err { background: var(--bad-bg); color: #991B1B; border-radius: 12px; padding: 10px 12px; font-weight: 700; font-size: 14px; }
.okmsg { background: var(--ok-bg); color: var(--ok); border-radius: 12px; padding: 10px 12px; font-weight: 700; font-size: 14px; }
.login-top { flex: 0 0 auto; padding: calc(36px + env(safe-area-inset-top)) 20px 30px; display: flex; flex-direction: column; align-items: center; gap: 8px; background: var(--navy); color: #fff; text-align: center; }
.login-form { flex: 1; background: var(--bg); border-radius: 28px 28px 0 0; margin-top: -20px; padding: 28px 22px; display: flex; flex-direction: column; gap: 16px; overflow-y: auto; }

/* الشات */
.cats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.cats button { border-radius: 14px; padding: 10px; text-align: right; cursor: pointer; background: #fff; border: 1.5px solid #E2E8F0; color: var(--text2); }
.cats button.on { background: #FFF1E8; border: 2px solid var(--orange); color: #9A3412; }
.cats b { display: block; font-size: 14px; } .cats span { font-size: 11.5px; }
.ticket { background: #fff; border: 0; border-radius: 16px; padding: 14px; display: flex; flex-direction: column; gap: 6px; text-align: right; cursor: pointer; width: 100%; color: var(--text); }
.msgs { display: flex; flex-direction: column; gap: 10px; }
.msg { display: flex; } .msg.me { justify-content: flex-start; } .msg.them { justify-content: flex-end; } .msg.sys { justify-content: center; }
.bubble { max-width: 80%; border-radius: 16px; padding: 8px 12px; font-size: 14.5px; white-space: pre-wrap; word-break: break-word; }
.msg.me .bubble { background: var(--orange); color: #fff; } .msg.them .bubble { background: #fff; border: 1px solid #E2E8F0; }
.msg.sys .bubble { background: var(--warn-bg); color: var(--warn); font-size: 13px; font-weight: 700; }
.bubble small { display: block; font-size: 11px; opacity: .75; margin-top: 2px; } .bubble b { display: block; font-size: 12px; opacity: .85; }
.composer { display: flex; gap: 8px; padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); background: #fff; border-top: 1px solid #E2E8F0; }
.composer input { flex: 1; height: 48px; border-radius: 14px; border: 1.5px solid var(--border); padding: 0 14px; font-size: 15px; }
.composer button { width: 48px; height: 48px; border-radius: 14px; border: 0; background: var(--orange); color: #fff; display: grid; place-items: center; cursor: pointer; }
.week { display: flex; align-items: flex-end; gap: 8px; height: 130px; }
.week > div { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; justify-content: flex-end; height: 100%; }
.week i { display: block; width: 100%; max-width: 30px; border-radius: 6px 6px 2px 2px; }
.legend { display: flex; gap: 14px; font-size: 12.5px; color: var(--muted); flex-wrap: wrap; }
.legend span { display: flex; align-items: center; gap: 5px; } .legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.ring { width: 92px; height: 92px; border-radius: 50%; display: grid; place-items: center; flex: none; }
.ring > div { width: 72px; height: 72px; border-radius: 50%; background: #fff; display: grid; place-items: center; font-weight: 800; font-size: 20px; }
.days7 { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 5px; text-align: center; }
.days7 div { border-radius: 10px; padding: 6px 2px; font-size: 11px; } .days7 b { display: block; font-size: 12px; }
.toast { position: absolute; top: 12px; left: 12px; right: 12px; background: var(--navy); color: #fff; border-radius: 14px; padding: 12px 14px; font-weight: 700; z-index: 10; box-shadow: 0 10px 30px rgba(0,0,0,.25); }
.spin { width: 28px; height: 28px; border: 3px solid #CBD5E1; border-top-color: var(--orange); border-radius: 50%; animation: sp 0.8s linear infinite; margin: 40px auto; }
@keyframes sp { to { transform: rotate(360deg); } }
.soon { background: #fff; border-radius: 18px; padding: 26px 18px; text-align: center; display: flex; flex-direction: column; gap: 8px; align-items: center; }
