/* Shafafeya — one phone-width column, sticky header, bottom tabs; clear cards on a pale Nile-green ground. */
:root {
  --bg:#EEF3F1; --surface:#FFFFFF; --surface-2:#F6F9F8; --ink:#10241F; --muted:#5A6B66; --line:#D9E2DF;
  --accent:#0F7B6C; --accent-ink:#FFFFFF; --accent-soft:#DCEFEA; --brass:#B9862F; --brass-soft:#F6EBD6;
  --ok:#2C8A55; --ok-soft:#DDF1E5; --warn:#B8700F; --warn-soft:#FBEBD3; --bad:#B4443A; --bad-soft:#F8E1DE;
  --c-security:#0F7B6C; --c-electricity:#C99A2E; --c-water:#3576BF; --c-maintenance:#7F57B8;
  --c-cleaning:#5F8A33; --c-elevator:#C0573E; --c-service:#4E6A80; --c-other:#7A847F;
  --shadow:0 1px 2px rgba(16,36,31,.06),0 6px 18px rgba(16,36,31,.06);
  --hero-bg:#10241F; --hero-fg:#EEF3F1;
  --f-display:"Readex Pro","IBM Plex Sans Arabic",Tahoma,sans-serif;
  --f-body:"IBM Plex Sans Arabic",Tahoma,"Segoe UI",sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg:#0C1513; --surface:#14201D; --surface-2:#182622; --ink:#E4EEEB; --muted:#94A6A1; --line:#26352F;
    --accent:#3BBEA7; --accent-ink:#06201B; --accent-soft:#123A33; --brass:#E0B25A; --brass-soft:#352A16;
    --ok:#5CC48A; --ok-soft:#143326; --warn:#E3A24A; --warn-soft:#3A2A12; --bad:#E07A6F; --bad-soft:#3A1C19;
    --c-security:#3BBEA7; --c-electricity:#E0B84E; --c-water:#6AA8EE; --c-maintenance:#B08FE6;
    --c-cleaning:#93C163; --c-elevator:#E8866E; --c-service:#8FB0C9; --c-other:#A3ADA9;
    --shadow:0 1px 2px rgba(0,0,0,.3),0 6px 18px rgba(0,0,0,.25);
    --hero-bg:#123A33; --hero-fg:#E4EEEB;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--ink); font-family: var(--f-body); font-size: 15px; line-height: 1.6;
  padding-top: env(safe-area-inset-top, 0px); -webkit-tap-highlight-color: transparent;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { opacity: .55; cursor: default; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
img { max-width: 100%; }
[hidden] { display: none !important; }

.app { max-width: 560px; margin: 0 auto; padding-inline: 16px; padding-block: 0 104px; }
.app.no-tabs { padding-block-end: 32px; }
.num { font-variant-numeric: tabular-nums; }
.boot { min-height: 70vh; display: grid; place-items: center; }

/* brand mark */
.mark { width: 36px; height: 36px; border-radius: 10px; background: var(--accent); display: grid; place-items: center; flex: none; }
.mark::before { content: ""; width: 18px; height: 18px; background: var(--accent-ink);
  -webkit-mask: url("/icons/glyph.svg") center/contain no-repeat; mask: url("/icons/glyph.svg") center/contain no-repeat; }
.big-mark { width: 64px; height: 64px; border-radius: 18px; }
.big-mark::before { width: 32px; height: 32px; }

/* header */
.top { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20; background: var(--bg); padding-block: 12px 10px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand h1 { font-family: var(--f-display); font-size: 20px; font-weight: 700; margin: 0; line-height: 1.1; }
.brand small { display: block; color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.role-chip { flex: none; }

/* blocks */
.stack { display: flex; flex-direction: column; gap: 14px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 16px; box-shadow: var(--shadow); min-width: 0; }
.h2 { font-family: var(--f-display); font-size: 16px; font-weight: 600; margin: 0; text-wrap: balance; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }
p { margin: 0; }
.link { border: 0; background: none; color: var(--accent); font-weight: 600; font-size: 13px; padding: 0; }

.btn { border: 0; border-radius: 12px; padding: 11px 16px; font-weight: 600; background: var(--accent); color: var(--accent-ink); text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.btn.ghost { background: var(--surface); color: var(--ink); border: 1px solid var(--line); }
.btn.danger { background: var(--bad-soft); color: var(--bad); }
.btn.block { width: 100%; }
.btn.sm { padding: 7px 12px; font-size: 13px; border-radius: 10px; }

.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; border-radius: 999px; padding: 3px 10px; white-space: nowrap; }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.pill.acc { background: var(--accent-soft); color: var(--accent); }
.pill.mute { background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); }
.dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }

.notice { display: flex; gap: 10px; align-items: flex-start; border-radius: 12px; padding: 12px 14px; font-size: 13px; }
.notice.warn { background: var(--warn-soft); }
.notice.acc { background: var(--accent-soft); }
.notice b { display: block; }

/* fund hero */
.fund { background: var(--hero-bg); color: var(--hero-fg); border: 0; position: relative; overflow: hidden; }
.fund::after { content: ""; position: absolute; inset-inline-start: -40px; top: -60px; width: 180px; height: 180px; border-radius: 50%; border: 28px solid var(--accent); opacity: .35; pointer-events: none; }
.fund .label { font-size: 13px; opacity: .8; }
.fund .big { font-family: var(--f-display); font-size: 34px; font-weight: 700; line-height: 1.2; margin-block: 4px 12px; }
.fund .big span { font-size: 16px; font-weight: 400; opacity: .8; }
.fund-split { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; position: relative; z-index: 1; }
.fund-split div { background: color-mix(in srgb, var(--hero-fg) 9%, transparent); border-radius: 12px; padding: 10px 12px; }
.fund-split b { display: block; font-family: var(--f-display); font-size: 17px; }
.fund-split small { font-size: 12px; opacity: .8; }

/* neighbors */
.neigh { display: flex; gap: 14px; align-items: center; }
.ring { width: 64px; height: 64px; flex: none; }
.neigh b { font-family: var(--f-display); font-size: 17px; }
.bar { height: 8px; border-radius: 99px; background: var(--surface-2); border: 1px solid var(--line); overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--accent); border-radius: 99px; }

/* chart */
.chart { width: 100%; height: auto; display: block; }
.chart text { font-family: var(--f-body); fill: var(--muted); font-size: 11px; }
.chart .val { fill: var(--ink); font-weight: 600; }

/* list rows */
.tx { display: flex; gap: 12px; align-items: center; padding-block: 12px; border-top: 1px solid var(--line); width: 100%; background: none; border-inline: 0; border-bottom: 0; text-align: start; }
.tx:first-child { border-top: 0; }
.tx .ic { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; flex: none; color: #fff; font-size: 11px; font-weight: 700; }
.tx .mid { flex: 1; min-width: 0; }
.tx .t { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tx .s { font-size: 12px; color: var(--muted); }
.tx .amt { font-family: var(--f-display); font-weight: 600; white-space: nowrap; }
.tx.deleted .t, .tx.deleted .amt { text-decoration: line-through; color: var(--muted); }
.tx.deleted .ic { opacity: .4; }
.tx .why { font-size: 12px; color: var(--bad); }
.tx-actions { display: flex; gap: 6px; flex: none; }
.month-h { font-family: var(--f-display); font-size: 14px; color: var(--muted); margin: 6px 4px 0; }
.empty { text-align: center; color: var(--muted); padding: 18px 8px; font-size: 14px; }

.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.chip { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 6px 14px; font-size: 13px; white-space: nowrap; }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }

.brk { display: grid; grid-template-columns: auto 1fr auto; gap: 8px 10px; align-items: center; font-size: 13px; }
.brk .sw { width: 10px; height: 10px; border-radius: 3px; }
.brk .bar { grid-column: 1 / -1; margin-top: -4px; }

/* apartments grid */
.apts { display: grid; grid-template-columns: repeat(8, 1fr); gap: 6px; }
.apt { aspect-ratio: 1; max-width: 100%; border-radius: 8px; display: grid; place-items: center; font-size: 12px; font-weight: 600; border: 1px solid var(--line); background: var(--surface-2); color: var(--muted); }
.apt.paid { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.apt.partial, .apt.pending { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.apt.mgr { box-shadow: inset 0 0 0 2px var(--accent); }
.apt.me { outline: 2px dashed var(--ink); outline-offset: 1px; }
.legend { display: flex; flex-wrap: wrap; gap: 12px; font-size: 12px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

/* ads */
.ad { background: var(--brass-soft); border-radius: 16px; padding: 14px 16px; display: flex; gap: 12px; align-items: center; }
.ad .badge { font-size: 11px; font-weight: 700; color: var(--brass); letter-spacing: .02em; }
.ad b { font-family: var(--f-display); }
.ltr { direction: ltr; unicode-bidi: isolate; font-variant-numeric: tabular-nums; }
.ad .ph { font-size: 13px; user-select: all; }

/* soon card */
.soon { border: 1.5px dashed var(--line); background: var(--surface-2); box-shadow: none; }
.logos { display: flex; gap: 8px; flex-wrap: wrap; }
.logo { font-size: 12px; font-weight: 700; padding: 4px 10px; border-radius: 8px; background: var(--surface); border: 1px solid var(--line); }

/* votes + info */
.vote { display: grid; grid-template-columns: 74px 1fr 34px; gap: 10px; align-items: center; font-size: 13px; }
.vote .bar i.other { background: var(--muted); opacity: .5; }
.info-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.info-grid div { background: var(--surface-2); border-radius: 12px; padding: 10px; text-align: center; min-width: 0; }
.info-grid b { display: block; font-family: var(--f-display); font-size: 20px; }
.info-grid small { color: var(--muted); font-size: 12px; }
.code { background: var(--surface-2); border: 1px dashed var(--line); border-radius: 10px; padding: 8px 12px; font-size: 13px; user-select: all; overflow-wrap: anywhere; }
.member { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-block: 10px; border-top: 1px solid var(--line); }
.member:first-child { border-top: 0; }

/* tabs */
.tabs { position: fixed; bottom: 0; inset-inline: 0; z-index: 30; background: var(--surface); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom, 0px); }
.tabs nav { max-width: 560px; margin: 0 auto; display: grid; grid-template-columns: repeat(4, 1fr); }
.tabs a { text-decoration: none; padding: 9px 4px 8px; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 12px; color: var(--muted); position: relative; }
.tabs a[aria-current="page"] { color: var(--accent); font-weight: 600; }
.tabs svg { width: 22px; height: 22px; }
.tabs .badge-n { position: absolute; top: 4px; inset-inline-start: calc(50% + 6px); background: var(--bad); color: #fff; border-radius: 99px; font-size: 10px; padding: 0 5px; line-height: 16px; }

/* forms + sheets */
.scrim { position: fixed; inset: 0; background: rgba(8,18,15,.45); z-index: 40; display: flex; align-items: flex-end; justify-content: center; }
.sheet { background: var(--surface); width: 100%; max-width: 560px; border-radius: 20px 20px 0 0; padding: 18px 16px calc(20px + env(safe-area-inset-bottom, 0px)); max-height: 92%; overflow-y: auto; }
.sheet h3, .page-h { font-family: var(--f-display); margin: 0 0 4px; font-size: 19px; text-wrap: balance; }
.field { display: grid; gap: 6px; font-size: 13px; font-weight: 600; min-width: 0; }
.field input, .field select, .field textarea { border: 1px solid var(--line); background: var(--surface-2); border-radius: 12px; padding: 10px 12px; font-weight: 400; font-size: 16px; width: 100%; }
.field .hint { font-weight: 400; color: var(--muted); font-size: 12px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; align-items: start; }
.check { display: flex; gap: 8px; align-items: center; font-size: 14px; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }
.choices { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.choice { border: 1.5px solid var(--line); background: var(--surface); border-radius: 12px; padding: 10px; font-weight: 600; text-align: center; }
.choice[aria-checked="true"] { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.err { color: var(--bad); font-size: 13px; font-weight: 600; }
.steps { display: flex; gap: 6px; margin-block: 4px 14px; }
.steps i { flex: 1; height: 4px; border-radius: 9px; background: var(--line); }
.steps i.on { background: var(--accent); }

/* map */
.map-wrap { position: relative; border-radius: 14px; overflow: hidden; border: 1px solid var(--line); height: 260px; background: var(--surface-2); }
.map { position: absolute; inset: 0; }
.pin { position: absolute; left: 50%; top: 50%; width: 30px; height: 40px; transform: translate(-50%, -100%); pointer-events: none; z-index: 2; }
gmp-place-autocomplete { width: 100%; }

/* login */
.login { min-height: 88vh; display: flex; flex-direction: column; justify-content: center; gap: 22px; padding-block: 24px; }
.login h1 { font-family: var(--f-display); font-size: 34px; margin: 0; line-height: 1.2; }
.login .lead { font-size: 17px; color: var(--muted); max-width: 30ch; }
.points { display: grid; gap: 10px; padding: 0; margin: 0; list-style: none; }
.points li { display: flex; gap: 10px; align-items: flex-start; }
.points li::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); margin-top: 9px; flex: none; }
.signin { display: grid; gap: 10px; justify-items: stretch; }
.ms-btn { background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 999px; padding: 10px 16px; min-height: 44px; }
.gbtn { min-height: 44px; display: flex; justify-content: center; }

.toast { position: fixed; bottom: calc(84px + env(safe-area-inset-bottom, 0px)); inset-inline: 16px; max-width: 520px; margin: 0 auto; background: var(--ink); color: var(--bg); border-radius: 12px; padding: 12px 14px; font-size: 14px; z-index: 50; box-shadow: var(--shadow); }
.toast.bad { background: var(--bad); color: #fff; }

@media (prefers-reduced-motion: no-preference) {
  .sheet { animation: up .22s ease-out; }
  @keyframes up { from { transform: translateY(24px); opacity: .6; } }
}
@media (max-width: 380px) {
  .apts { grid-template-columns: repeat(6, 1fr); }
  .fund .big { font-size: 28px; }
}
