:root {
  --bg: #0B1310; --side: #0E1814; --panel: #121D18; --panel2: #17251F; --line: #1B2B24; --line2: #22352C;
  --text: #EDF3EF; --muted: #9DB0A6; --gold: #DDB876; --mint: #7FE0B0; --coral: #F47C66; --sky: #8FB8F0; --grey: #5E7A6D;
  --serif: 'Instrument Serif', 'IBM Plex Sans Arabic', Georgia, serif;
  --sans: Manrope, 'IBM Plex Sans Arabic', system-ui, -apple-system, 'Segoe UI', Tahoma, sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--sans); font-size: 15px; line-height: 1.45; }
[dir=rtl] body { font-family: 'IBM Plex Sans Arabic', Manrope, Tahoma, sans-serif; }
a { color: var(--gold); text-decoration: none; }
a:hover { color: #F0D6A3; }
h1, h2 { font-family: var(--serif); font-weight: 400; margin: 0; line-height: 1.1; }
[dir=rtl] h1, [dir=rtl] h2 { font-family: 'IBM Plex Sans Arabic', Tahoma, sans-serif; font-weight: 600; }
h1 { font-size: 40px; } h2 { font-size: 26px; }
p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); font-size: 13px; }
.center { text-align: center; }
.mono { font-variant-numeric: tabular-nums; font-size: 13px; }
.pre { white-space: pre-wrap; }
.ok-text { color: #8CE6B8; } .bad-text { color: #FF9C89; } .gold-text { color: var(--gold); }
.loading { padding: 48px; color: var(--muted); text-align: center; }
.eyebrow { font-size: 12px; color: var(--muted); letter-spacing: .08em; text-transform: uppercase; }
[dir=rtl] .eyebrow { letter-spacing: 0; }

/* layout */
.shell { display: flex; min-height: 100vh; }
.side { flex: 0 0 240px; background: var(--side); border-inline-end: 1px solid var(--line); padding: 26px 16px; display: flex; flex-direction: column; gap: 28px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 12px; color: var(--text); padding: 0 8px; }
.brand span { display: flex; flex-direction: column; line-height: 1.15; }
.brand b { font-size: 17px; } .brand i { font-style: normal; font-size: 13px; color: var(--muted); }
.side-links { display: flex; flex-direction: column; gap: 4px; }
.side-links a { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 0 12px; border-radius: 11px; color: var(--muted); font-weight: 500; }
.side-links a:hover { background: var(--panel); color: var(--text); }
.side-links a.on { background: var(--panel2); color: var(--text); font-weight: 600; }
.side-links a.on svg { color: var(--gold); }
.side-user { margin-top: auto; padding: 14px; border: 1px solid var(--line2); border-radius: 14px; display: flex; flex-direction: column; gap: 2px; font-size: 13px; color: var(--muted); }
.side-user b { color: var(--text); font-size: 14px; overflow: hidden; text-overflow: ellipsis; }
.main { flex: 1; min-width: 0; padding: 30px 34px 48px; }
.page { display: flex; flex-direction: column; gap: 20px; max-width: 1280px; margin: 0 auto; }
.page.narrow { max-width: 820px; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; }
.head-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.bottom { display: none; }
.back { font-weight: 600; align-self: flex-start; padding: 6px 0; }

/* cards */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 22px; padding: 24px; display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.card-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 20px; }
.row { display: flex; flex-wrap: wrap; gap: 20px; }
.grow2 { flex: 2 1 520px; } .grow1 { flex: 1 1 320px; }
.empty { align-items: flex-start; padding: 40px; }

/* buttons and inputs */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px; border-radius: 12px; border: 1px solid var(--line2); background: var(--panel2); color: var(--text); font-weight: 600; cursor: pointer; }
.btn:hover { border-color: var(--grey); color: var(--text); }
.btn-primary { background: var(--gold); border-color: var(--gold); color: #0B1310; font-weight: 700; }
.btn-primary:hover { background: #E9CB93; color: #0B1310; }
.btn-outline { background: transparent; border-color: var(--gold); color: var(--gold); }
.btn-danger { background: var(--coral); border-color: var(--coral); color: #0B1310; }
.btn-danger-outline { background: transparent; border-color: #7A3A30; color: #FF9C89; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .6; cursor: default; }
.btn.busy { opacity: .6; pointer-events: none; }
.btn-ghost { background: none; border: none; color: var(--muted); cursor: pointer; min-width: 44px; min-height: 44px; font-size: 16px; }
.btn-link { background: none; border: none; padding: 8px 6px; color: var(--gold); font-weight: 600; cursor: pointer; font-size: 13px; }
.btn-link.danger { color: #FF9C89; }
.icon-btn { position: relative; width: 46px; height: 46px; border-radius: 14px; border: 1px solid var(--line2); background: var(--panel); color: var(--text); display: inline-flex; align-items: center; justify-content: center; }
.badge { position: absolute; top: -6px; inset-inline-end: -6px; background: var(--coral); color: #0B1310; font-size: 12px; font-weight: 700; min-width: 21px; height: 21px; padding: 0 5px; border-radius: 11px; display: flex; align-items: center; justify-content: center; }
input[type=text], input[type=email], input[type=password], input[type=tel], input[type=number], input[type=date], input[type=search], select, textarea {
  width: 100%; min-height: 44px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line2); background: #0E1814; color: var(--text); color-scheme: dark; }
textarea { resize: vertical; }
input[type=file] { color: var(--muted); font-size: 13px; }
.select-sm { width: auto; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field label { font-size: 13px; font-weight: 600; }
.field small { color: var(--muted); font-size: 12px; }
.opt { color: var(--muted); font-weight: 400; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.field-wide { grid-column: 1 / -1; }
.form-error { color: #FF9C89; min-height: 1em; font-size: 14px; }
.inline { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.inline input { flex: 1 1 220px; }
.filters { display: grid; grid-template-columns: 2fr repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.form-page { gap: 18px; }

/* pills and dots */
.pill { display: inline-block; font-size: 12px; font-weight: 700; padding: 5px 10px; border-radius: 9px; white-space: nowrap; background: var(--panel2); color: var(--muted); }
.pill.st-rented, .pill.st-paid { background: #12301F; color: #8CE6B8; }
.pill.st-renewal, .pill.st-upcoming { background: #15283D; color: #A9C8F5; }
.pill.st-overdue { background: #3A1C17; color: #FF9C89; }
.pill.st-due { background: #3A2E14; color: #EBC98A; }
.pill.st-vacant { background: #22302A; color: #B8C7BF; }
.dot { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.dot::before { content: ''; width: 9px; height: 9px; border-radius: 5px; background: var(--grey); flex: none; }
.dot.ok::before, .dot.st-rented::before, .dot.st-paid::before { background: var(--mint); }
.dot.bad::before, .dot.st-overdue::before { background: var(--coral); }
.dot.info::before, .dot.st-renewal::before, .dot.st-upcoming::before { background: var(--sky); }
.dot.gold::before, .dot.st-due::before { background: var(--gold); }
.legend { display: flex; flex-wrap: wrap; gap: 14px; }

/* dashboard hero */
.hero-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.big { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin: 6px 0; }
.big span { font-size: 17px; font-weight: 600; color: var(--gold); }
.big b { font-family: 'Instrument Serif', Georgia, serif; font-weight: 400; font-size: clamp(52px, 7vw, 92px); line-height: .95; }
.big.small b { font-size: 46px; }
.ring { position: relative; flex: none; width: 124px; height: 124px; }
.ring-text { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.ring-text b { font-size: 25px; } .ring-text span { font-size: 11px; color: var(--muted); }
.split { display: flex; height: 10px; gap: 3px; }
.split.tall { height: 12px; }
.split div { border-radius: 6px; min-width: 4px; }
.split .ok { background: var(--mint); } .split .bad { background: var(--coral); } .split .info { background: var(--sky); } .split .gold { background: var(--gold); } .split .grey { background: var(--grey); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 16px; }
.stats > div { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.stats span { font-size: 13px; color: var(--muted); }
.stats b { font-size: 22px; font-weight: 700; }
.stats small { font-size: 12px; color: var(--muted); }
.cat-list { display: flex; flex-direction: column; gap: 12px; }
.cat-list > div { display: flex; justify-content: space-between; gap: 12px; }
.cat-list .dot { color: var(--text); font-size: 14px; }

/* map */
.map-card { padding: 0; overflow: hidden; position: relative; min-height: 380px; gap: 0; }
.map-title { position: absolute; z-index: 3; left: 18px; top: 16px; background: rgba(11, 19, 16, .85); padding: 8px 12px; border-radius: 10px; display: flex; flex-direction: column; gap: 2px; }
.map-legend { position: absolute; z-index: 3; left: 18px; right: 18px; width: fit-content; bottom: 28px; background: rgba(11, 19, 16, .85); padding: 8px 12px; border-radius: 10px; }
.map-host { flex: 1; min-height: 380px; }
.map-host.small { min-height: 260px; height: 260px; border-radius: 14px; flex: none; }
.mmap { position: relative; overflow: hidden; background: #0E1A1F; touch-action: none; user-select: none; -webkit-user-select: none; cursor: grab; }
.mmap.mmap-pick { cursor: crosshair; }
.mmap-layer, .mmap-pins { position: absolute; inset: 0; }
.mmap-layer img { position: absolute; left: 0; top: 0; width: 256px; height: 256px; filter: invert(1) hue-rotate(180deg) brightness(.85) contrast(.9) saturate(.6); }
.mmap-marker { position: absolute; transform: translate(-50%, -100%); z-index: 2; }
.mmap-pin { width: 22px; height: 22px; border-radius: 50% 50% 50% 0; background: var(--gold); border: 3px solid #0B1310; transform: translate(-50%, -100%) rotate(-45deg); }
.map-pin { display: flex; align-items: center; gap: 7px; padding: 7px 11px 7px 8px; border-radius: 20px; background: var(--text); color: #0B1310; font-size: 12px; font-weight: 700; white-space: nowrap; box-shadow: 0 2px 8px rgba(0, 0, 0, .5); }
.map-pin:hover { color: #0B1310; }
.map-pin i { width: 11px; height: 11px; border-radius: 6px; background: #1F9D63; }
.map-pin.st-renewal i { background: #2F6FD0; } .map-pin.st-vacant i { background: #6B7C74; }
.map-pin.st-overdue { background: var(--coral); } .map-pin.st-overdue i { background: #0B1310; }
.mmap-ctl { position: absolute; z-index: 4; top: 12px; right: 12px; display: flex; flex-direction: column; gap: 6px; }
.mmap-ctl button { width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--line2); background: rgba(11, 19, 16, .9); color: var(--text); font-size: 20px; cursor: pointer; }
.mmap-attr { position: absolute; z-index: 3; right: 6px; bottom: 4px; font-size: 10px; color: #C9D4CE; background: rgba(11, 19, 16, .7); padding: 1px 5px; border-radius: 4px; }

/* calendar and chart */
.tbl-wrap { overflow-x: auto; }
.cal { min-width: 640px; display: flex; flex-direction: column; gap: 8px; }
.cal-row { display: grid; grid-template-columns: 130px repeat(12, minmax(0, 1fr)); gap: 6px; align-items: center; }
.cal-row > a { color: var(--text); font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-head span { font-size: 11px; color: var(--muted); text-align: center; text-transform: uppercase; }
.cell { height: 34px; border-radius: 8px; background: var(--panel2); display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; color: #0B1310; }
.cell.st-paid { background: var(--mint); } .cell.st-due { background: var(--gold); } .cell.st-overdue { background: var(--coral); }
.cell.st-upcoming { background: transparent; border: 1px dashed var(--grey); color: var(--muted); }
.chart { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 8px; height: 230px; }
.chart-col { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.chart-col .bars { flex: 1; display: flex; align-items: flex-end; justify-content: center; gap: 4px; border-bottom: 1px solid var(--line2); }
.chart-col i { width: 38%; max-width: 18px; border-radius: 5px 5px 0 0; display: block; }
.chart-col i.ok { background: var(--mint); } .chart-col i.info { background: var(--sky); }
.chart-col span { font-size: 11px; color: var(--muted); text-align: center; text-transform: uppercase; overflow: hidden; }

[dir=rtl] .cal-head span, [dir=rtl] .chart-col span { font-size: 10px; }

/* attention */
.att { display: flex; flex-direction: column; }
.att-row { display: flex; align-items: center; gap: 14px; padding: 10px 0; border-bottom: 1px solid var(--line); color: var(--text); }
.att-row:last-child { border-bottom: none; }
.att-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.att-text strong { font-size: 15px; font-weight: 600; }
.date-tile { flex: none; width: 50px; height: 54px; border-radius: 12px; display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.1; background: #15283D; color: #A9C8F5; }
.date-tile.st-overdue { background: #3A1C17; color: #FF9C89; } .date-tile.st-due { background: #3A2E14; color: #EBC98A; }
.date-tile b { font-size: 19px; } .date-tile span { font-size: 11px; font-weight: 600; text-transform: uppercase; }

/* property cards */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.pcard { padding: 0; overflow: hidden; gap: 0; color: var(--text); }
.pcard:hover { border-color: var(--grey); color: var(--text); }
.pcard-top { position: relative; }
.pcard-pill { position: absolute; top: 12px; inset-inline-start: 12px; }
.pcard-body { padding: 16px; display: flex; flex-direction: column; gap: 6px; }
.pcard-body strong { font-size: 17px; }
.cover { height: 140px; display: flex; align-items: flex-end; justify-content: center; overflow: hidden; background: #1D3A30; color: #4E8F78; }
.cover.tone-renewal { background: #1C3148; color: #5C8CC4; } .cover.tone-overdue { background: #43251F; color: #B0604F; } .cover.tone-vacant { background: #222C28; color: #5E7A6D; }
.cover img { width: 100%; height: 100%; object-fit: cover; }
.bar { height: 6px; border-radius: 3px; background: var(--line2); margin-top: 4px; }
.bar-fill { height: 100%; border-radius: 3px; background: var(--mint); }
.bar-fill.bad { background: var(--coral); }

/* property page */
.phead { flex-direction: row; flex-wrap: wrap; padding: 0; overflow: hidden; gap: 0; }
.phead-cover { flex: 1 1 300px; height: auto; min-height: 260px; }
.phead-body { flex: 2 1 380px; min-width: 0; padding: 28px; display: flex; flex-direction: column; gap: 12px; }
.phead-title { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; }
.phead-title h1 { font-size: 52px; }
.phead .stats { padding-top: 16px; border-top: 1px solid var(--line); }
.agent-box { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; font-size: 14px; }
.dl { display: grid; grid-template-columns: auto 1fr; gap: 10px 18px; margin: 0; font-size: 14px; }
.dl dt { color: var(--muted); } .dl dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 560px; }
.tbl th { text-align: start; padding: 10px 8px; font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; border-bottom: 1px solid var(--line2); white-space: nowrap; }
.tbl td { padding: 12px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; overflow-wrap: anywhere; }
.tbl tr:last-child td { border-bottom: none; }
.tbl .num { text-align: end; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tbl .actions { text-align: end; white-space: nowrap; }
.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.photo { position: relative; aspect-ratio: 4 / 3; border-radius: 12px; overflow: hidden; background: var(--panel2); }
.photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-del { position: absolute; top: 6px; inset-inline-end: 6px; width: 32px; height: 32px; border-radius: 16px; border: none; background: rgba(11, 19, 16, .85); color: #FF9C89; cursor: pointer; }
.code { font-family: ui-monospace, Menlo, Consolas, monospace; background: var(--panel2); padding: 4px 8px; border-radius: 8px; letter-spacing: .08em; }
.big-code { font-size: 26px; padding: 10px 16px; color: var(--gold); }
.chips { display: flex; flex-wrap: wrap; gap: 10px; }
.chip { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 14px; border-radius: 12px; background: var(--panel2); color: var(--text); font-weight: 600; }
.lang { display: flex; gap: 8px; justify-content: center; }
.lang button { min-height: 40px; padding: 0 16px; border-radius: 10px; border: 1px solid var(--line2); background: transparent; color: var(--muted); cursor: pointer; }
.lang button.on { border-color: var(--gold); color: var(--gold); }
.card .lang { justify-content: flex-start; }

.cheque-preview { margin: 0; padding-inline-start: 24px; padding-inline-end: 4px; display: flex; flex-direction: column; gap: 8px; max-height: 260px; overflow-y: auto; }
.cheque-preview li::marker { color: var(--muted); }
.cheque-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; }

/* dialogs and toasts */
.dlg { border: 1px solid var(--line2); border-radius: 20px; background: var(--panel); color: var(--text); padding: 0; width: min(560px, calc(100vw - 24px)); max-height: calc(100vh - 24px); }
.dlg.dlg-wide { width: min(760px, calc(100vw - 24px)); }
.dlg::backdrop { background: rgba(0, 0, 0, .6); }
.dlg-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 22px 0; }
.dlg-body { padding: 18px 22px 22px; display: flex; flex-direction: column; gap: 14px; }
.dlg-actions { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.toast { position: fixed; z-index: 50; bottom: 96px; left: 50%; transform: translateX(-50%); background: var(--text); color: #0B1310; padding: 12px 18px; border-radius: 12px; font-weight: 600; max-width: calc(100vw - 32px); box-shadow: 0 6px 24px rgba(0, 0, 0, .5); }
.toast.toast-bad { background: var(--coral); }

/* auth */
.auth { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.auth-card { width: min(440px, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: 24px; padding: 32px; display: flex; flex-direction: column; gap: 16px; }
.auth-card .brand { padding: 0; }
.auth-form { display: flex; flex-direction: column; gap: 14px; }
.roles { border: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.roles legend { font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.roles label { display: flex; align-items: center; gap: 12px; padding: 12px; border: 1px solid var(--line2); border-radius: 12px; cursor: pointer; }
.roles label:has(input:checked) { border-color: var(--gold); }
.roles span { display: flex; flex-direction: column; }
.roles small { color: var(--muted); }
.roles input { accent-color: var(--gold); width: 18px; height: 18px; }

.divider { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 13px; }
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--line2); }
.btn-google { background: var(--text); border-color: var(--text); color: #0B1310; font-weight: 700; }
.btn-google:hover { background: #FFFFFF; color: #0B1310; }

/* phone */
@media (max-width: 860px) {
  .side { display: none; }
  .main { padding: 18px 14px 110px; }
  h1 { font-size: 30px; } h2 { font-size: 22px; }
  .card { padding: 18px; border-radius: 18px; }
  .map-card { padding: 0; }
  .hero-top { align-items: center; }
  .ring { width: 84px; height: 84px; } .ring svg { width: 84px; height: 84px; } .ring-text b { font-size: 17px; } .ring-text span { display: none; }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .filters { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } .filters input { grid-column: 1 / -1; }
  .phead-title h1 { font-size: 36px; } .phead-body { padding: 18px; } .phead-cover { min-height: 180px; }
  .grid2 { grid-template-columns: minmax(0, 1fr); }
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .cover { height: 96px; } .pcard-body { padding: 12px; } .pcard-body strong { font-size: 15px; }
  .bottom { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); align-items: center; position: fixed; z-index: 20; left: 0; right: 0; bottom: 0; background: var(--side); border-top: 1px solid var(--line); padding: 8px 8px calc(10px + env(safe-area-inset-bottom)); }
  .bottom a { min-height: 48px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--muted); font-size: 11px; font-weight: 600; }
  .bottom a.on { color: var(--gold); }
  .bottom a.fab { justify-self: center; width: 54px; height: 54px; border-radius: 27px; background: var(--gold); color: #0B1310; }
  .dlg { width: calc(100vw - 16px); }
  .chart { gap: 3px; } .chart-col span { font-size: 9px; }
  [dir=rtl] .chart-col span { font-size: 8px; }
}
