@font-face { font-family: 'Shamel'; src: url('assets/fonts/shamel-book.ttf') format('truetype'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Shamel'; src: url('assets/fonts/shamel-bold.ttf') format('truetype'); font-weight: 700; font-display: swap; }

:root {
  --p: #4640E6; --p-dark: #2F2A9E; --navy: #1E1B6E; --tint: #E8E7FD; --tint2: #EEEBFD;
  --bg: #F5F4FA; --card: #FFFFFF; --line: #E7E5F0; --muted: #5C5775; --text: #1E1B6E;
  --ok-bg: #E3F4EA; --ok: #12663B; --wait-bg: #FFF1C7; --wait: #7A5200;
  --doing-bg: #E4ECFB; --doing: #1D4BA8; --late-bg: #FDE2E2; --late: #B42318;
  --warn: #F97316;
  box-sizing: border-box;
}
*, *::before, *::after { box-sizing: inherit; }
html, body { height: 100%; margin: 0; }
html { touch-action: manipulation; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { background: var(--bg); color: var(--text); font-family: 'Shamel', 'Segoe UI', Tahoma, sans-serif; font-size: 14px; line-height: 1.55; -webkit-tap-highlight-color: transparent; }
button, input, select, textarea { font-family: inherit; font-size: 14px; color: inherit; }
input, select, textarea { font-size: 16px !important; }
button { cursor: pointer; }
#app { max-width: 520px; margin: 0 auto; min-height: 100%; position: relative; background: var(--bg); }
.boot { display: flex; align-items: center; justify-content: center; height: 100vh; color: var(--p); font-weight: 700; letter-spacing: 2px; }

/* login */
.login { min-height: 100vh; display: flex; flex-direction: column; justify-content: center; gap: 22px; padding: calc(32px + env(safe-area-inset-top, 0px)) 26px calc(32px + env(safe-area-inset-bottom, 0px));
  background: linear-gradient(180deg, #5450F2 0%, #3F3AD0 55%, #2A2696 100%); color: #fff; }
.login .brand { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.login .brand img { height: 104px; }
.login .brand span { font-size: 14px; font-weight: 700; letter-spacing: 6px; text-indent: 6px; opacity: .9; }
.panel { background: #fff; color: var(--text); border-radius: 18px; padding: 20px; display: flex; flex-direction: column; gap: 14px; }
label.f { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); }
.in { height: 46px; border: 1px solid #D9D6E6; border-radius: 10px; padding: 0 12px; background: #fff; width: 100%; color: var(--text); }
textarea.in { height: auto; padding: 10px 12px; resize: none; }
.err { color: var(--late); font-size: 13px; }

/* buttons */
.btn { height: 46px; font-size: 14px; border: none; border-radius: 12px; background: linear-gradient(135deg, #6E6AF7 0%, #4E49E2 100%); color: #fff; font-weight: 700; padding: 0 16px; }
.btn:disabled { opacity: .6; }
.btn.dark { background: linear-gradient(135deg, #6E6AF7 0%, #4E49E2 100%); }
.btn.green { background: var(--ok); }
.btn.ghost { background: #fff; color: var(--p); border: 1px solid var(--p); }
.btn.soft { background: #FFF6F0; color: #9A3A12; border: 1px solid #F6D3BF; }
.btn.light { background: #fff; color: #3F3AD0; }
.btn.sm { height: 36px; font-size: 13px; border-radius: 9px; }
.row { display: flex; gap: 8px; align-items: center; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }

/* header */
.hdr { background: linear-gradient(135deg, #706CF8 0%, #4E49E2 100%); color: #fff; padding: calc(8px + env(safe-area-inset-top, 0px)) 16px 10px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 10px; position: sticky; top: 0; z-index: 5; }
.hdr img { width: 26px; height: 26px; opacity: .95; }
.hdr .t { min-width: 0; }
.hdr .t small { display: block; font-size: 10.5px; opacity: .8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hdr .t b { display: block; font-size: 13.5px; font-weight: 400; line-height: 1.4; }
.hdr .bell { justify-self: end; }
.bell { border: none; color: #fff; position: relative; width: 36px; height: 36px; border-radius: 12px; background: rgba(255,255,255,.16); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.bell svg { width: 20px; height: 20px; }
.bell i { position: absolute; top: -5px; left: -5px; min-width: 20px; height: 20px; border-radius: 999px; background: var(--warn); color: var(--navy); font-size: 11px; font-weight: 700; font-style: normal; display: flex; align-items: center; justify-content: center; padding: 0 5px; }

main.content { padding: 14px 14px calc(96px + env(safe-area-inset-bottom, 0px)); display: flex; flex-direction: column; gap: 12px; }
main.content > * { flex-shrink: 0; }
.sheet > * { flex-shrink: 0; }
h3.sec { font-size: 14px; font-weight: 700; margin: 6px 0 -2px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 14px; }
.muted { color: var(--muted); font-size: 12.5px; }
.empty { color: var(--muted); font-size: 14px; }

.av { width: 44px; height: 44px; border-radius: 999px; background: var(--tint) center/cover no-repeat; color: var(--p-dark); display: inline-flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; flex-shrink: 0; }
.av.lg { width: 54px; height: 54px; border-radius: 16px; font-size: 18px; }
.av.sm { width: 26px; height: 26px; font-size: 10px; }

.chip { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; white-space: nowrap; }
.s-wait { background: var(--wait-bg); color: var(--wait); }
.s-doing { background: var(--doing-bg); color: var(--doing); }
.s-done { background: var(--ok-bg); color: var(--ok); }
.s-late { background: var(--late-bg); color: var(--late); }

.task { width: 100%; text-align: right; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; }
.task .top { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.task .ttl { font-size: 14px; line-height: 1.55; }
.task .who { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }

.alert { border-radius: 16px; padding: 14px; display: flex; flex-direction: column; gap: 10px; background: linear-gradient(160deg, #F4F3FF 0%, #ECEAFE 100%); border: 1.5px solid #B9B6F8; }
.alert.urgent { background: linear-gradient(160deg, #FFF5EE 0%, #FFEBDD 100%); border-color: #F8B48A; }
.alert .h { font-weight: 700; font-size: 13.5px; }

.att { border-radius: 16px; padding: 14px; display: flex; flex-direction: column; gap: 8px; }
.att b { font-size: 14px; }
.att span { font-size: 12.5px; line-height: 1.6; }
.att-none { background: linear-gradient(160deg, #6E6AF7 0%, #5550EC 100%); color: #fff; }
.att-in { background: linear-gradient(160deg, #EFFAF3 0%, #E3F4EA 100%); color: #0F4F2F; border: 1px solid #CDEBD9; }
.att-out { background: #fff; border: 1px solid var(--line); }
.seg { height: 36px; border-radius: 10px; font-size: 13px; background: rgba(255,255,255,.12); color: #fff; border: 1px solid rgba(255,255,255,.35); }
.seg.on { background: #fff; color: var(--navy); border-color: #fff; font-weight: 700; }

.kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.kpi { border-radius: 14px; padding: 12px 14px; display: flex; flex-direction: column; gap: 2px; }
.kpi b { font-size: 24px; line-height: 1.1; }
.kpi span { font-size: 12.5px; }

.chips { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; }
.fchip { height: 34px; padding: 0 14px; border-radius: 999px; font-size: 13px; white-space: nowrap; background: #fff; border: 1px solid #D9D6E6; flex-shrink: 0; }
.fchip.on { background: var(--p); color: #fff; border-color: var(--p); font-weight: 700; }

.member { display: flex; align-items: center; gap: 10px; }
.member .nm { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.skills { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; }
.skills span { font-size: 11px; background: var(--tint2); color: var(--p-dark); border-radius: 6px; padding: 1px 7px; }

/* nav */
nav.bottom { position: fixed; bottom: 0; left: 50%; transform: translateX(-50%); width: 100%; max-width: 520px; background: #fff; border-top: 1px solid var(--line);
  display: grid; height: calc(64px + env(safe-area-inset-bottom, 0px)); padding-bottom: env(safe-area-inset-bottom, 0px); z-index: 6; }
nav.bottom button { background: none; border: none; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 12px; color: var(--muted); }
nav.bottom button.on { color: var(--p); font-weight: 700; }
nav.bottom svg { width: 22px; height: 22px; }
.fab { position: fixed; bottom: calc(78px + env(safe-area-inset-bottom, 0px)); left: max(16px, calc(50% - 244px)); height: 46px; padding: 0 18px; border: none; border-radius: 14px;
  background: linear-gradient(135deg, #7874F9 0%, #5550EC 100%); color: #fff; font-size: 14px; box-shadow: 0 6px 18px rgba(85,80,236,.35); z-index: 7; }

/* sheet */
.sheet-bg { position: fixed; inset: 0; background: rgba(20,16,40,.5); z-index: 20; display: flex; align-items: flex-end; justify-content: center; }
.sheet { background: #fff; width: 100%; max-width: 520px; border-radius: 22px 22px 0 0; max-height: 90vh; overflow-y: auto; padding: 16px 18px calc(24px + env(safe-area-inset-bottom, 0px)); display: flex; flex-direction: column; gap: 12px; }
.sheet .x { width: 40px; height: 40px; border: none; border-radius: 12px; background: #F0EFF6; font-size: 20px; }
.meta { background: var(--bg); border-radius: 10px; padding: 8px 10px; font-size: 13px; }
.meta small { display: block; color: var(--muted); }
.log { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; padding: 6px 0; border-bottom: 1px solid #F0EFF6; }
.cmt { background: var(--bg); border-radius: 12px; padding: 8px 12px; font-size: 14px; }
.cmt small { display: block; font-size: 12px; color: var(--muted); }

.toast { position: fixed; top: calc(12px + env(safe-area-inset-top, 0px)); left: 50%; transform: translateX(-50%); z-index: 50; background: var(--navy); color: #fff;
  padding: 10px 16px; border-radius: 12px; font-size: 14px; max-width: 90vw; box-shadow: 0 6px 18px rgba(0,0,0,.2); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

.s-ready { background: #ECEAFE; color: #3F3AD0; }
nav.bottom button { font-size: 11px; }
.chat-full { position: fixed; inset: 0; z-index: 25; background: var(--bg); display: flex; flex-direction: column; max-width: 520px; margin: 0 auto; }
.chat-full .hdr { position: static; }
.chat-full .hdr .t small { order: 2; }
.chat-note { background: var(--tint2); color: var(--p-dark); font-size: 11.5px; text-align: center; padding: 5px 12px; }
.msgs { flex: 1; min-height: 0; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.bub-row { display: flex; justify-content: flex-end; }
.bub-row.me { justify-content: flex-start; }
.bub { max-width: 80%; padding: 8px 12px; border-radius: 14px; background: #fff; border: 1px solid var(--line); display: flex; flex-direction: column; gap: 2px; font-size: 14px; border-bottom-left-radius: 4px; }
.bub b { font-size: 11.5px; color: var(--p-dark); }
.bub small { font-size: 10.5px; color: var(--muted); }
.bub-row.me .bub { background: linear-gradient(135deg, #7874F9, #5550EC); color: #fff; border: none; border-bottom-left-radius: 14px; border-bottom-right-radius: 4px; }
.bub-row.me .bub small { color: #DCD9FF; }
.chat-in { display: flex; gap: 8px; padding: 10px 10px calc(10px + env(safe-area-inset-bottom, 0px)); background: #fff; border-top: 1px solid var(--line); }
.chat-in .btn { height: 46px; }

.s-comp { background: #FFEEDD; color: #9A4A0C; }
nav.bottom button { font-size: 10.5px; }
nav.bottom svg { width: 21px; height: 21px; }
.news { display: flex; flex-direction: column; gap: 8px; }
.news.urgent { border-color: #F6C3B6; }
.para { display: flex; gap: 8px; align-items: flex-start; background: var(--bg); border-radius: 10px; padding: 8px 10px; font-size: 14px; line-height: 1.7; }
.para span { flex: 1; white-space: pre-wrap; }
.para.title { background: var(--tint2); color: var(--navy); font-weight: 700; }
.cp { flex-shrink: 0; width: 34px; height: 34px; border-radius: 9px; border: 1px solid #D9D6E6; background: #fff; color: var(--p); display: flex; align-items: center; justify-content: center; padding: 0; }
.cp svg { width: 17px; height: 17px; }
.orig { background: #FAFAFC; border: 1px dashed #D9D6E6; border-radius: 10px; padding: 8px 10px; font-size: 13px; color: var(--muted); }
.orig p { margin: 6px 0 0; }
.note { background: #FFF6F0; color: #9A3A12; border-radius: 10px; padding: 8px 10px; font-size: 13px; }

.para.body span { white-space: pre-wrap; }

.upbar { position: relative; height: 26px; border-radius: 999px; background: var(--tint2); overflow: hidden; }
.upbar i { position: absolute; inset: 0 0 0 auto; right: 0; left: auto; background: linear-gradient(135deg, #7874F9, #5550EC); transition: width .2s; }
.upbar span { position: relative; display: flex; align-items: center; justify-content: center; height: 100%; font-size: 12.5px; font-weight: 700; color: var(--navy); }

.chips.wrap { flex-wrap: wrap; overflow: visible; }

.me-btn { background: none; border: none; color: #fff; display: flex; align-items: center; gap: 8px; text-align: right; padding: 0; min-width: 0; }
.me-btn span { min-width: 0; }
.me-btn .av { border: 1.5px solid rgba(255,255,255,.6); }

.login .brand img { height: 96px; }
.welcome { font-size: 17px; font-weight: 700; margin-top: 18px; opacity: 0; animation: fadeUp .9s ease .3s forwards; }
.motto { font-size: 13px; opacity: 0; margin-top: 6px; animation: fadeUp .9s ease 1s forwards; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: .9; transform: none; } }
.news-mini { width: 100%; text-align: right; display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.news-mini.urgent { border-color: #F6C3B6; }
.nm-title { font-size: 14px; color: var(--navy); line-height: 1.5; }
.clamp2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; line-height: 1.6; }
.flist { display: flex; flex-direction: column; gap: 6px; }
.fitem { display: flex; align-items: center; gap: 8px; background: var(--bg); border-radius: 10px; padding: 6px 10px; font-size: 13px; }
.fitem span:first-child { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rm { width: 28px; height: 28px; border-radius: 8px; border: 1px solid #F6C3B6; background: #fff; color: var(--late); font-size: 13px; padding: 0; flex-shrink: 0; }

/* v0.8 — تسلسل بصري أوضح */
.task .ttl, .nm-title, .card .ttl { font-weight: 700; color: var(--navy); font-size: 14.5px; }
.task .who { font-size: 12px; color: #6B6785; }
.task .muted, .card .muted { color: #7A7692; }
/* مركز الإشعارات */
.nbg { position: fixed; inset: 0; z-index: 30; background: rgba(20,16,40,.18); }
.npanel { position: fixed; z-index: 31; top: calc(58px + env(safe-area-inset-top, 0px)); left: 50%; transform: translateX(-50%); width: min(500px, calc(100vw - 16px));
  max-height: 72vh; background: #fff; border-radius: 16px; box-shadow: 0 16px 40px rgba(30,27,110,.22); display: flex; flex-direction: column; overflow: hidden; }
.nhead { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.nhead b { font-size: 15px; }
.nlink { background: none; border: none; color: var(--p); font-size: 12.5px; padding: 0; }
.nlist { overflow-y: auto; }
.nitem { width: 100%; display: flex; gap: 10px; align-items: flex-start; text-align: right; background: #fff; border: none; border-bottom: 1px solid #F2F1F7; padding: 10px 14px; position: relative; }
.nitem.unread { background: #F6F5FF; }
.nicon { width: 36px; height: 36px; border-radius: 999px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.nicon svg { width: 18px; height: 18px; }
.ntext { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.ntext b { font-size: 13.5px; color: var(--navy); line-height: 1.45; }
.nbody { font-size: 12.5px; color: #5C5775; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ntime { font-size: 11.5px; color: #8A86A0; }
.nitem.unread .ntime { color: var(--p); }
.ndot { width: 9px; height: 9px; border-radius: 999px; background: var(--p); flex-shrink: 0; margin-top: 6px; }

/* v0.9 */
.pre { white-space: pre-wrap; word-break: break-word; }
.s-sched { background: #E8F3F7; color: #0E5A73; }
.msgbox { height: 46px; min-height: 46px; max-height: 140px; resize: none; padding-top: 11px; line-height: 1.5; }
.chat-in { align-items: flex-end; }
.upnote { font-size: 12.5px; background: #F4F3FF; color: var(--p-dark); border-radius: 10px; padding: 8px 10px; line-height: 1.6; }
.upnote.warn { background: #FFF6E5; color: #7A5200; }
