/* CareGrid Manager panel: neutral "glass" look. No coloured accents, no rules or borders:
   surfaces are separated by blur, soft shadow and space only. */
:root {
  --ink: #0b0c0e; --ink-2: #474c55; --ink-3: #7d838d;
  --glass: rgba(255, 255, 255, .58); --glass-2: rgba(255, 255, 255, .8); --solid: #fff;
  --fill: rgba(14, 18, 28, .05); --fill-2: rgba(14, 18, 28, .09);
  --shadow: 0 1px 0 rgba(255, 255, 255, .75) inset, 0 10px 30px -12px rgba(22, 28, 45, .18), 0 2px 6px -2px rgba(22, 28, 45, .06);
  --shadow-pop: 0 1px 0 rgba(255, 255, 255, .8) inset, 0 24px 60px -16px rgba(18, 22, 38, .34), 0 4px 14px -4px rgba(18, 22, 38, .12);
  --blur: saturate(170%) blur(22px);
  --r: 16px; --r-s: 11px;
  --good: #0f6b46; --good-bg: rgba(22, 140, 92, .13); --warn: #8a5a00; --warn-bg: rgba(214, 150, 20, .16);
  --ease: cubic-bezier(.3, .7, .2, 1);
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; color: var(--ink); font: 14px/1.45 "Segoe UI Variable Text", "Segoe UI", Inter, system-ui, -apple-system, Roboto, sans-serif;
  background:
    radial-gradient(1100px 700px at 4% -8%, #dbe5f6 0, transparent 62%),
    radial-gradient(900px 620px at 102% 2%, #e2efe8 0, transparent 58%),
    radial-gradient(900px 640px at 62% 112%, #ebe4f4 0, transparent 58%),
    #eef1f5;
  background-attachment: fixed; -webkit-font-smoothing: antialiased;
}
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
svg.i { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.urdu { font-family: "Jameel Noori Nastaleeq", "Noto Nastaliq Urdu", "Urdu Typesetting", "Segoe UI", sans-serif; direction: rtl; }
.glass { background: var(--glass); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); box-shadow: var(--shadow); }
.muted { color: var(--ink-3); }
.num { font-variant-numeric: tabular-nums; }
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: rgba(14, 18, 28, .16); border-radius: 9px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background-color: rgba(14, 18, 28, .3); }

/* ---- shell ---- */
.app { display: grid; grid-template-columns: 232px minmax(0, 1fr); gap: 14px; height: 100vh; padding: 14px; }
.side { border-radius: 20px; display: flex; flex-direction: column; padding: 14px 10px 10px; min-height: 0; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 14px; }
.brand img { width: 30px; height: 30px; }
.brand b { display: block; font-size: 14.5px; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 160px; }
.brand span { display: block; font-size: 11.5px; color: var(--ink-3); }
.nav { flex: 1; overflow: auto; display: flex; flex-direction: column; gap: 2px; }
.nav h6 { margin: 12px 10px 4px; font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); font-weight: 600; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--r-s); color: var(--ink-2); text-decoration: none; font-weight: 500; transition: background .15s, color .15s; }
.nav a:hover { background: var(--fill); color: var(--ink); }
.nav a.on { background: var(--ink); color: #fff; box-shadow: 0 6px 16px -8px rgba(11, 12, 14, .6); }
.who { display: flex; align-items: center; gap: 9px; padding: 8px; border-radius: 13px; background: var(--fill); margin-top: 8px; }
.avatar { width: 30px; height: 30px; border-radius: 10px; background: var(--ink); color: #fff; display: grid; place-items: center; font-size: 12px; font-weight: 600; flex: none; }
.who div { flex: 1; min-width: 0; }
.who b { display: block; font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.who span { font-size: 11px; color: var(--ink-3); }
.iconbtn { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; color: var(--ink-2); transition: background .15s; }
.iconbtn:hover { background: var(--fill-2); color: var(--ink); }

.main { min-width: 0; display: flex; flex-direction: column; min-height: 0; }
.top { display: flex; align-items: center; gap: 12px; padding: 4px 4px 12px; flex-wrap: wrap; }
.top h1 { margin: 0; font-size: 20px; letter-spacing: -.02em; font-weight: 650; }
.top p { margin: 1px 0 0; font-size: 12.5px; color: var(--ink-3); }
.top .grow { flex: 1; min-width: 120px; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 999px; font-size: 12px; font-weight: 550; background: var(--glass-2); box-shadow: var(--shadow); color: var(--ink-2); white-space: nowrap; }
#view { flex: 1; overflow: auto; padding: 0 4px 24px; min-height: 0; }
.fade { animation: rise .28s var(--ease) both; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }

/* ---- controls ---- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 34px; padding: 0 13px; border-radius: var(--r-s); font-weight: 560; font-size: 13px; background: var(--glass-2); box-shadow: var(--shadow); color: var(--ink); transition: transform .12s, background .15s, box-shadow .15s; white-space: nowrap; }
a.btn, a.iconbtn { text-decoration: none; }
.btn:hover { background: #fff; }
.btn:active { transform: scale(.975); }
.btn.dark { background: var(--ink); color: #fff; box-shadow: 0 8px 18px -10px rgba(11, 12, 14, .7); }
.btn.dark:hover { background: #24272d; }
.btn.plain { background: transparent; box-shadow: none; color: var(--ink-2); }
.btn.plain:hover { background: var(--fill); color: var(--ink); }
.btn[disabled] { opacity: .5; pointer-events: none; }
.btn svg.i { width: 16px; height: 16px; }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field > span { font-size: 12px; font-weight: 560; color: var(--ink-2); }
.input, .select-btn { height: 36px; width: 100%; border: 0; outline: 0; border-radius: var(--r-s); background: var(--fill); padding: 0 11px; transition: box-shadow .15s, background .15s; }
textarea.input { height: auto; padding: 9px 11px; resize: vertical; min-height: 68px; }
.input:hover, .select-btn:hover { background: var(--fill-2); }
.input:focus, .select-btn:focus-visible, .select-btn.open { background: #fff; box-shadow: 0 0 0 3px rgba(11, 12, 14, .12), 0 2px 8px -2px rgba(11, 12, 14, .12); }
.input::placeholder { color: var(--ink-3); }
.search { position: relative; flex: 1; min-width: 160px; max-width: 320px; }
.search svg { position: absolute; left: 10px; top: 9px; color: var(--ink-3); }
.search .input { padding-left: 34px; background: var(--glass-2); box-shadow: var(--shadow); }
.select-btn { display: flex; align-items: center; justify-content: space-between; gap: 8px; text-align: left; white-space: nowrap; }
.select-btn span { overflow: hidden; text-overflow: ellipsis; }
.select-btn svg { color: var(--ink-3); width: 15px; height: 15px; transition: transform .18s; }
.select-btn.open svg { transform: rotate(180deg); }
.select-btn.bar { width: auto; background: var(--glass-2); box-shadow: var(--shadow); height: 34px; font-weight: 550; font-size: 13px; }
.pop { position: fixed; z-index: 80; min-width: 170px; max-height: 300px; overflow: auto; padding: 5px; border-radius: 14px; background: rgba(255, 255, 255, .9); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); box-shadow: var(--shadow-pop); animation: pop .16s var(--ease) both; }
@keyframes pop { from { opacity: 0; transform: translateY(-4px) scale(.98); } }
.pop button.opt { display: flex; align-items: center; gap: 8px; width: 100%; padding: 7px 10px; border-radius: 9px; text-align: left; font-size: 13px; }
.pop button.opt:hover, .pop button.opt.kb { background: var(--fill-2); }
.pop button.opt.sel { font-weight: 620; }
.pop button.opt svg { margin-left: auto; width: 15px; height: 15px; }
.switch { position: relative; width: 36px; height: 21px; border-radius: 21px; background: rgba(14, 18, 28, .2); transition: background .18s; flex: none; }
.switch::after { content: ""; position: absolute; left: 2.5px; top: 2.5px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .3); transition: transform .2s var(--ease); }
.switch.on { background: var(--ink); }
.switch.on::after { transform: translateX(15px); }
.check { display: flex; align-items: center; gap: 9px; padding: 6px 8px; border-radius: 9px; text-align: left; font-size: 13px; }
.check:hover { background: var(--fill); }
.box { width: 17px; height: 17px; border-radius: 5.5px; background: var(--fill-2); display: grid; place-items: center; flex: none; transition: background .15s; }
.box svg { width: 12px; height: 12px; stroke-width: 2.6; color: #fff; opacity: 0; }
.check.on .box { background: var(--ink); }
.check.on .box svg { opacity: 1; }
.seg { display: inline-flex; padding: 3px; border-radius: 12px; background: var(--glass-2); box-shadow: var(--shadow); gap: 2px; }
.seg button { padding: 5px 11px; border-radius: 9px; font-size: 12.5px; font-weight: 550; color: var(--ink-2); }
.seg button.on { background: var(--ink); color: #fff; }

/* calendar */
.cal { width: 252px; padding: 10px; }
.cal header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; font-weight: 620; font-size: 13px; }
.cal .grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.cal .dow { font-size: 10.5px; color: var(--ink-3); text-align: center; padding: 4px 0; }
.cal .day { height: 31px; border-radius: 9px; font-size: 12.5px; }
.cal .day:hover { background: var(--fill-2); }
.cal .day.out { color: var(--ink-3); opacity: .55; }
.cal .day.in { background: var(--fill-2); border-radius: 0; }
.cal .day.edge { background: var(--ink); color: #fff; border-radius: 9px; }
.cal .day.today { font-weight: 700; }
.cal footer { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; font-size: 12px; color: var(--ink-3); }

/* ---- content ---- */
.toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.toolbar .grow { flex: 1; }
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(172px, 1fr)); gap: 10px; margin-bottom: 12px; }
.kpi { border-radius: var(--r); padding: 12px 13px; display: flex; gap: 11px; align-items: flex-start; }
.kpi .ic { width: 32px; height: 32px; border-radius: 10px; background: var(--fill); display: grid; place-items: center; color: var(--ink-2); flex: none; }
.kpi small { display: block; font-size: 11.5px; color: var(--ink-3); font-weight: 550; }
.kpi b { display: block; font-size: 19px; letter-spacing: -.02em; font-weight: 660; line-height: 1.25; }
.kpi em { display: block; font-style: normal; font-size: 11.5px; color: var(--ink-3); }
.cols { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 12px; margin-bottom: 12px; }
.card { border-radius: var(--r); padding: 14px; min-width: 0; }
.card > header { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.card > header { flex-wrap: wrap; }
.card > header h3 { margin: 0; font-size: 13.5px; font-weight: 640; flex: 1; white-space: nowrap; }
.card > header small { color: var(--ink-3); font-size: 12px; }
.legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: 12px; color: var(--ink-2); }
.legend button { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; }
.legend button.off { opacity: .4; }
.legend i { width: 9px; height: 9px; border-radius: 3px; display: inline-block; }
.chart { position: relative; height: 210px; }
.chart svg { width: 100%; height: 100%; display: block; overflow: visible; }
.chart .tip { position: absolute; pointer-events: none; padding: 8px 10px; border-radius: 11px; background: rgba(255, 255, 255, .94); box-shadow: var(--shadow-pop); font-size: 12px; white-space: nowrap; transform: translate(-50%, -110%); }
.chart .tip b { display: block; margin-bottom: 2px; }
.feed { display: flex; flex-direction: column; gap: 2px; max-height: 262px; overflow: auto; margin: 0 -6px; }
.feed div { display: grid; grid-template-columns: 28px 1fr; gap: 9px; padding: 7px 6px; border-radius: 10px; }
.feed div:hover { background: var(--fill); }
.feed .ic { width: 28px; height: 28px; border-radius: 9px; background: var(--fill); display: grid; place-items: center; color: var(--ink-2); }
.feed .ic svg { width: 14px; height: 14px; }
.feed p { margin: 0; font-size: 12.5px; line-height: 1.35; }
.feed span { font-size: 11px; color: var(--ink-3); }

/* tables: rows are soft tiles, no rules */
.table { width: 100%; border-collapse: separate; border-spacing: 0 3px; }
.table th { text-align: left; font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-3); padding: 2px 10px 5px; white-space: nowrap; }
.table td { padding: 8px 10px; background: rgba(255, 255, 255, .5); vertical-align: middle; font-size: 13px; }
.table tr td:first-child { border-radius: 11px 0 0 11px; }
.table tr td:last-child { border-radius: 0 11px 11px 0; }
.table tbody tr { transition: transform .12s; }
.table tbody tr:hover td { background: rgba(255, 255, 255, .88); }
.table .r { text-align: right; }
.table .sub { display: block; font-size: 11.5px; color: var(--ink-3); }
.table tr.click { cursor: pointer; }
.chip { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 580; background: var(--fill-2); color: var(--ink-2); white-space: nowrap; }
.chip.good { background: var(--good-bg); color: var(--good); }
.chip.warn { background: var(--warn-bg); color: var(--warn); }
.chip.dark { background: var(--ink); color: #fff; }
.rowbtns { display: flex; gap: 2px; justify-content: flex-end; }
.pager { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 10px; font-size: 12.5px; color: var(--ink-3); }
.pager div { display: flex; gap: 6px; align-items: center; }
.empty { text-align: center; padding: 34px 10px; color: var(--ink-3); }
.empty svg { width: 30px; height: 30px; margin-bottom: 6px; opacity: .6; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 10px; }
.tile { border-radius: var(--r); padding: 13px; display: flex; flex-direction: column; gap: 8px; }
.tile header { display: flex; gap: 10px; align-items: center; }
.tile header div { flex: 1; min-width: 0; }
.tile header b { display: block; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile header div span { font-size: 12px; color: var(--ink-3); display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile .meta { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.tile .urdu { font-size: 15px; color: var(--ink-2); }
.tile footer { display: flex; gap: 6px; margin-top: auto; }
.bar { height: 6px; border-radius: 6px; background: var(--fill-2); overflow: hidden; margin-top: 4px; }
.bar i { display: block; height: 100%; border-radius: 6px; background: var(--ink); }

/* ---- dialogs ---- */
.veil { position: fixed; inset: 0; z-index: 60; background: rgba(20, 24, 36, .28); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); display: grid; place-items: center; padding: 16px; animation: veil .2s both; }
@keyframes veil { from { opacity: 0; } }
.sheet { width: min(640px, 100%); max-height: calc(100vh - 32px); display: flex; flex-direction: column; border-radius: 22px; background: rgba(255, 255, 255, .86); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); box-shadow: var(--shadow-pop); animation: sheet .26s var(--ease) both; }
.sheet.small { width: min(400px, 100%); }
@keyframes sheet { from { opacity: 0; transform: translateY(14px) scale(.98); } }
.sheet > header { display: flex; align-items: center; gap: 10px; padding: 16px 18px 6px; }
.sheet > header h2 { margin: 0; font-size: 16px; font-weight: 650; flex: 1; letter-spacing: -.01em; }
.sheet > .body { padding: 8px 18px 14px; overflow: auto; }
.sheet > footer { display: flex; justify-content: flex-end; gap: 8px; padding: 10px 18px 16px; }
.form { display: grid; grid-template-columns: 1fr 1fr; gap: 11px; }
.form .wide { grid-column: 1 / -1; }
.form h4 { grid-column: 1 / -1; margin: 8px 0 -2px; font-size: 11px; letter-spacing: .07em; text-transform: uppercase; color: var(--ink-3); font-weight: 600; }
.perms { display: grid; grid-template-columns: 1fr 1fr; gap: 0 8px; }
.err { grid-column: 1 / -1; padding: 8px 11px; border-radius: 10px; background: var(--warn-bg); color: var(--warn); font-size: 12.5px; font-weight: 550; }
.toasts { position: fixed; z-index: 99; bottom: 18px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast { display: flex; align-items: center; gap: 8px; padding: 9px 14px; border-radius: 13px; background: rgba(17, 19, 23, .92); color: #fff; font-size: 13px; font-weight: 520; box-shadow: var(--shadow-pop); animation: sheet .25s var(--ease) both; }
.loading { display: grid; place-items: center; padding: 50px; }
.spin { width: 22px; height: 22px; border-radius: 50%; background: conic-gradient(from 0deg, transparent, var(--ink)); -webkit-mask: radial-gradient(farthest-side, transparent 62%, #000 64%); mask: radial-gradient(farthest-side, transparent 62%, #000 64%); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(1turn); } }

.tabbar { display: none; }

/* ---- sign-in and setup pages ---- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 20px 16px; }
.auth-card { width: min(420px, 100%); border-radius: 24px; padding: 26px 24px 22px; }
.auth-card.wide { width: min(680px, 100%); }
.auth-card img.logo { height: 30px; display: block; margin-bottom: 18px; }
.auth-card h1 { margin: 0 0 4px; font-size: 21px; letter-spacing: -.02em; }
.auth-card > p { margin: 0 0 18px; color: var(--ink-2); font-size: 13.5px; }
.auth-card .form { margin-bottom: 16px; }
.auth-card .btn { width: 100%; height: 40px; font-size: 14px; }
.auth-card .foot { margin-top: 14px; text-align: center; font-size: 12.5px; color: var(--ink-3); }
.auth-card .foot a { color: var(--ink-2); font-weight: 560; text-decoration: none; }
.steps { display: flex; gap: 6px; margin-bottom: 16px; }
.steps i { height: 4px; flex: 1; border-radius: 4px; background: var(--fill-2); }
.steps i.on { background: var(--ink); }

/* ---- phone ---- */
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; padding: 10px 10px 0; height: 100dvh; }
  .side { display: none; }
  .cols { grid-template-columns: 1fr; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .kpi { padding: 10px; gap: 9px; }
  .kpi b { font-size: 17px; }
  .top h1 { font-size: 18px; }
  #view { padding-bottom: 86px; }
  .tabbar { display: flex; position: fixed; z-index: 50; left: 10px; right: 10px; bottom: 10px; border-radius: 20px; padding: 6px; justify-content: space-around; background: rgba(255, 255, 255, .78); }
  .tabbar a, .tabbar button { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 2px; border-radius: 14px; font-size: 10.5px; font-weight: 560; color: var(--ink-3); text-decoration: none; }
  .tabbar .on { background: var(--ink); color: #fff; }
  .form, .perms { grid-template-columns: 1fr; }
  .veil { place-items: end center; padding: 0; }
  .sheet, .sheet.small { width: 100%; border-radius: 22px 22px 0 0; max-height: 92dvh; }
  /* tables become stacked tiles */
  .table thead { display: none; }
  .table, .table tbody, .table tr, .table td { display: block; }
  .table tr { background: rgba(255, 255, 255, .58); border-radius: 13px; padding: 10px 12px; margin-bottom: 7px; display: grid; grid-template-columns: 1fr 1fr; gap: 6px 12px; box-shadow: var(--shadow); }
  .card:has(> .table) { background: none; box-shadow: none; padding: 0; -webkit-backdrop-filter: none; backdrop-filter: none; }
  .table td { background: none !important; padding: 0; border-radius: 0 !important; }
  .table td[data-l]::before { content: attr(data-l); display: block; font-size: 10.5px; color: var(--ink-3); text-transform: uppercase; letter-spacing: .04em; }
  .table td.r { text-align: right; }
  .table td.full { grid-column: 1 / -1; }
  .search { max-width: none; flex-basis: 100%; }
  .toasts { bottom: 86px; }
}
