/* Madafa mobile apps (staff & management): a light, native-feeling design — coloured header, white cards,
   colourful icon tiles, bottom tab bar and bottom sheets. Shared by /staff and /manage. */
:root {
  --primary: #e8455a; --primary-2: #ff6b5e; --primary-ink: #fff; --primary-soft: #fde8eb;
  --bg: #f3f4f8; --card: #ffffff; --ink: #1d2433; --ink-2: #4b5567; --mut: #8a94a6; --line: #eceef3;
  --ok: #17a35b; --ok-soft: #e3f6ec; --warn: #e88a12; --warn-soft: #fff2dc; --bad: #e23b4e; --bad-soft: #fde6e9; --info: #2f6fe8; --info-soft: #e5eefe;
  --violet: #7b5cf0; --violet-soft: #efeafe; --teal: #0ea5a0; --teal-soft: #dcf5f4; --amber: #f4a31b; --amber-soft: #fff4dd; --pink: #e6459b; --pink-soft: #fde7f3;
  --radius: 18px; --shadow: 0 2px 10px rgba(22, 31, 56, .06), 0 1px 2px rgba(22, 31, 56, .05);
  --tab-h: 64px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, Tahoma, "Noto Sans Arabic", sans-serif; }
body { max-width: 520px; margin: 0 auto; padding-bottom: calc(var(--tab-h) + 12px + env(safe-area-inset-bottom)); overscroll-behavior-y: contain; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
svg.i { width: 22px; height: 22px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.hide { display: none !important; }

/* ---- coloured header (continues the status bar) */
.hero { background: linear-gradient(135deg, var(--primary), var(--primary-2)); color: var(--primary-ink); padding: 14px 16px 54px; border-radius: 0 0 26px 26px; position: relative; }
.hero .bar { display: flex; align-items: center; gap: 10px; }
.hero .logo { width: 38px; height: 38px; border-radius: 12px; background: #fff; display: grid; place-items: center; flex: none; }
.hero .logo img { width: 28px; height: 28px; }
.hero .who { flex: 1; min-width: 0; } .hero .who b { display: block; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } .hero .who small { opacity: .9; font-size: 12.5px; }
.hero .ib { width: 40px; height: 40px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, .2); color: #fff; display: grid; place-items: center; position: relative; }
.hero .ib .badge { position: absolute; top: -2px; inset-inline-end: -2px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 10px; background: #fff; color: var(--primary); font-size: 11px; font-weight: 800; display: grid; place-items: center; }
.hero h1 { margin: 16px 0 0; font-size: 22px; font-weight: 800; } .hero .date { opacity: .9; font-size: 13px; }
.lift { margin: -40px 14px 0; position: relative; z-index: 2; }

/* ---- cards & lists */
main { padding: 0 14px; display: grid; gap: 14px; }
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px; }
.card.pad0 { padding: 0; overflow: hidden; }
.sec { display: flex; align-items: center; justify-content: space-between; margin: 6px 4px -4px; }
.sec h3 { margin: 0; font-size: 16px; font-weight: 800; } .sec a, .sec button { border: 0; background: none; color: var(--primary); font-weight: 700; font-size: 13.5px; padding: 0; }
.item { display: flex; align-items: center; gap: 12px; padding: 13px 14px; border-bottom: 1px solid var(--line); text-align: start; width: 100%; background: none; border-inline: 0; border-top: 0; }
.item:last-child { border-bottom: 0; }
.item .t { flex: 1; min-width: 0; } .item .t b { display: block; font-size: 15px; } .item .t small { display: block; color: var(--mut); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item .end { text-align: end; flex: none; } .chev { color: #c3c8d2; }
html[dir=rtl] .chev { transform: scaleX(-1); }
.av { width: 42px; height: 42px; border-radius: 14px; display: grid; place-items: center; flex: none; }
.av.round { border-radius: 50%; }
.c-red { background: var(--bad-soft); color: var(--bad); } .c-green { background: var(--ok-soft); color: var(--ok); } .c-blue { background: var(--info-soft); color: var(--info); }
.c-amber { background: var(--amber-soft); color: #c27c00; } .c-violet { background: var(--violet-soft); color: var(--violet); } .c-teal { background: var(--teal-soft); color: var(--teal); }
.c-pink { background: var(--pink-soft); color: var(--pink); } .c-grey { background: #eef0f4; color: #687386; } .c-primary { background: var(--primary-soft); color: var(--primary); }

/* ---- quick action tiles */
.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 84px)); justify-content: space-evenly; gap: 6px 4px; }
.tile { border: 0; background: none; display: grid; justify-items: center; gap: 7px; padding: 6px 2px; font-size: 12px; font-weight: 600; color: var(--ink-2); text-align: center; position: relative; }
.tile .av { width: 54px; height: 54px; border-radius: 18px; } .tile .av svg.i { width: 26px; height: 26px; }
.tile .n { position: absolute; top: 0; inset-inline-end: 10px; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 12px; background: var(--bad); color: #fff; font-size: 11px; font-weight: 800; display: grid; place-items: center; border: 2px solid var(--card); }

/* ---- stats */
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.stat { background: var(--card); border-radius: 16px; box-shadow: var(--shadow); padding: 12px 14px; display: flex; gap: 10px; align-items: center; border: 0; text-align: start; }
.stat b { display: block; font-size: 20px; font-weight: 800; line-height: 1.1; } .stat small { color: var(--mut); font-size: 12px; }
.stat .av { width: 38px; height: 38px; border-radius: 12px; }

/* ---- duty switch */
.duty { display: flex; align-items: center; gap: 12px; }
.duty .t { flex: 1; } .duty .t b { display: block; font-size: 16px; } .duty .t small { color: var(--mut); font-size: 12.5px; }
.switch { width: 56px; height: 32px; border-radius: 20px; background: #d5d9e2; position: relative; border: 0; flex: none; transition: background .2s; }
.switch::after { content: ""; position: absolute; top: 3px; inset-inline-start: 3px; width: 26px; height: 26px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: inset-inline-start .2s; }
.switch.on { background: var(--ok); } .switch.on::after { inset-inline-start: 27px; }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; background: #c3c8d2; } .dot.on { background: var(--ok); box-shadow: 0 0 0 4px var(--ok-soft); }

/* ---- chips, pills, segmented */
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 4px; scrollbar-width: none; } .chips::-webkit-scrollbar { display: none; }
.chip { flex: none; border: 1px solid var(--line); background: var(--card); border-radius: 22px; padding: 8px 14px; font-weight: 700; font-size: 13px; color: var(--ink-2); white-space: nowrap; }
.chip.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.pill { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 20px; font-size: 12px; font-weight: 700; }
.p-red { background: var(--bad-soft); color: var(--bad); } .p-green { background: var(--ok-soft); color: var(--ok); } .p-blue { background: var(--info-soft); color: var(--info); }
.p-amber { background: var(--amber-soft); color: #b57000; } .p-grey { background: #eef0f4; color: #5d6779; }
.seg { display: flex; background: #e7e9ef; border-radius: 14px; padding: 4px; gap: 4px; } .seg button { flex: 1; border: 0; background: none; padding: 9px 4px; border-radius: 11px; font-weight: 700; font-size: 13px; color: var(--ink-2); }
.seg button.on { background: var(--card); color: var(--ink); box-shadow: var(--shadow); }
.search { display: flex; align-items: center; gap: 8px; background: var(--card); border-radius: 14px; padding: 0 12px; box-shadow: var(--shadow); color: var(--mut); }
.search input { border: 0; outline: 0; background: none; padding: 13px 0; flex: 1; color: var(--ink); }

/* ---- buttons & forms */
.btn { border: 0; border-radius: 14px; padding: 13px 16px; font-weight: 800; background: #eef0f4; color: var(--ink); display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; text-decoration: none; }
.btn.primary { background: var(--primary); color: #fff; } .btn.green { background: var(--ok); color: #fff; } .btn.ghost { background: none; color: var(--primary); }
.btn.block { width: 100%; } .btn:disabled { opacity: .55; } .row { display: flex; gap: 10px; } .row > * { flex: 1; }
.field { display: grid; gap: 6px; } .field span { font-size: 13px; font-weight: 700; color: var(--ink-2); }
input[type=text], input[type=email], input[type=password], input[type=tel], select, textarea { width: 100%; padding: 13px 14px; border-radius: 14px; border: 1.5px solid var(--line); background: #fafbfc; outline: none; }
input:focus, select:focus, textarea:focus { border-color: var(--primary); background: #fff; }
.check { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-bottom: 1px solid var(--line); font-weight: 600; } .check:last-child { border-bottom: 0; }
.check input { width: 22px; height: 22px; accent-color: var(--ok); flex: none; } .check.done { color: var(--mut); text-decoration: line-through; }

/* ---- bottom tab bar */
.tabbar { position: fixed; inset-inline: 0; margin-inline: auto; max-width: 520px; bottom: 0; z-index: 40; background: var(--card); box-shadow: 0 -2px 14px rgba(22, 31, 56, .08); display: flex; height: calc(var(--tab-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom); }
.tabbar button { flex: 1; border: 0; background: none; display: grid; justify-items: center; align-content: center; gap: 3px; color: var(--mut); font-size: 11.5px; font-weight: 700; position: relative; }
.tabbar button.on { color: var(--primary); } .tabbar button.on svg.i { stroke-width: 2.3; }
.tabbar .n { position: absolute; top: 8px; inset-inline-start: calc(50% + 6px); min-width: 18px; height: 18px; padding: 0 5px; border-radius: 10px; background: var(--bad); color: #fff; font-size: 11px; display: grid; place-items: center; }

/* ---- bottom sheet */
.sheet-bg { position: fixed; inset: 0; z-index: 60; background: rgba(14, 18, 30, .45); display: flex; align-items: flex-end; justify-content: center; animation: fade .15s; }
.sheet { background: var(--bg); width: 100%; max-width: 640px; max-height: 92vh; overflow: auto; border-radius: 24px 24px 0 0; padding: 8px 14px calc(18px + env(safe-area-inset-bottom)); display: grid; gap: 12px; animation: up .22s ease-out; }
.sheet .grab { width: 42px; height: 5px; border-radius: 4px; background: #cfd3dc; margin: 4px auto 2px; }
.sheet .head { display: flex; align-items: center; gap: 12px; } .sheet .head h2 { margin: 0; font-size: 22px; flex: 1; }
.xbtn { width: 38px; height: 38px; border-radius: 50%; border: 0; background: #e7e9ef; display: grid; place-items: center; color: var(--ink-2); }
@keyframes up { from { transform: translateY(40px); opacity: .4; } } @keyframes fade { from { opacity: 0; } }

/* ---- misc */
.banner { display: flex; gap: 12px; align-items: center; padding: 12px 14px; border-radius: 16px; font-weight: 600; font-size: 13.5px; }
.banner.amber { background: var(--amber-soft); color: #8a5200; } .banner.red { background: var(--bad-soft); color: #a3172a; } .banner.blue { background: var(--info-soft); color: #1d4fb8; }
.banner .btn { min-height: 38px; padding: 8px 14px; flex: none; }
.empty { text-align: center; color: var(--mut); padding: 34px 16px; display: grid; justify-items: center; gap: 10px; }
.empty .av { width: 64px; height: 64px; border-radius: 22px; } .empty .av svg.i { width: 30px; height: 30px; }
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 11px 14px; border-bottom: 1px solid var(--line); } .kv:last-child { border-bottom: 0; } .kv span { color: var(--mut); } .kv b { text-align: end; }
.neg { color: var(--bad); } .pos { color: var(--ok); } .mut { color: var(--mut); }
.progress { height: 6px; border-radius: 6px; background: var(--line); overflow: hidden; } .progress i { display: block; height: 100%; background: var(--ok); border-radius: 6px; }
.ring { --p: 0; width: 86px; height: 86px; border-radius: 50%; background: conic-gradient(var(--primary) calc(var(--p) * 1%), #eceef3 0); display: grid; place-items: center; flex: none; }
.ring span { width: 66px; height: 66px; border-radius: 50%; background: var(--card); display: grid; place-items: center; font-weight: 800; font-size: 18px; }
.week { display: flex; gap: 8px; align-items: flex-end; height: 92px; } .week div { flex: 1; display: grid; gap: 4px; justify-items: center; font-size: 11px; color: var(--mut); }
.week i { display: block; width: 100%; max-width: 26px; border-radius: 8px 8px 4px 4px; background: linear-gradient(180deg, var(--primary-2), var(--primary)); min-height: 4px; }
#snack { position: fixed; inset-inline: 14px; bottom: calc(var(--tab-h) + 14px + env(safe-area-inset-bottom)); z-index: 80; display: grid; gap: 8px; pointer-events: none; }
.snack { background: #1d2433; color: #fff; padding: 13px 16px; border-radius: 14px; font-weight: 600; box-shadow: 0 6px 20px rgba(0, 0, 0, .2); animation: up .2s; } .snack.err { background: var(--bad); }
.login { min-height: 100vh; display: grid; align-content: center; gap: 14px; padding: 24px 20px; max-width: 440px; margin: 0 auto; }
.login .brand { display: grid; justify-items: center; gap: 10px; margin-bottom: 8px; } .login .brand .logo { width: 76px; height: 76px; border-radius: 24px; background: linear-gradient(135deg, var(--primary), var(--primary-2)); display: grid; place-items: center; box-shadow: 0 10px 24px rgba(232, 69, 90, .3); }
.login .brand .logo img { width: 52px; filter: brightness(0) invert(1); } .login h2 { margin: 0; font-size: 22px; } .login .err { color: var(--bad); font-weight: 700; min-height: 20px; text-align: center; }
.skeleton { background: linear-gradient(90deg, #eceef3, #f6f7fa, #eceef3); background-size: 200% 100%; animation: sk 1.2s infinite; border-radius: 12px; height: 72px; }
@keyframes sk { to { background-position: -200% 0; } }
