/* مُلّاك على الكمبيوتر — حسب دليل الهوية (Marketing/brand-guide/mullak-web-guide.html)
   وتصميم الشاشات (Mullak Web UX Canvas): نهار نجدي في الوضع الفاتح، ليل نجدي في الداكن، والقائمة كحلي في الحالتين */
@import url("https://fonts.googleapis.com/css2?family=IBM+Plex+Sans+Arabic:wght@400;500;600;700&family=Noto+Kufi+Arabic:wght@600;800&family=El+Messiri:wght@600;700&display=swap");

:root {
  --ground: #F5EDE0; --card: #FFF9F1; --card-2: #EFE4D2; --field: #fff; --ink: #3B2A1E; --ink-2: #6E5440; --muted: #8A6E55; --line: #E4D6BF;
  --gold: #B8913F; --navy: #14213D; --navy-lift: #22345C; --side: #14213D; --side-ink: #CFD6E4; --brand-gold: #E2C27A;
  --green: #17804A; --red: #B42318; --amber: #B86E0B;
  --c1: #14213D; --c2: #B8913F; --c3: #C9B79C; --c4: #8A6E55;
  --logo: "El Messiri", "Geeza Pro", serif;
  --display: "Noto Kufi Arabic", "Geeza Pro", "SF Arabic", system-ui, sans-serif;
  --body: "IBM Plex Sans Arabic", "SF Arabic", "Geeza Pro", Tahoma, system-ui, sans-serif;
  --shadow: 0 1px 2px #3B2A1E14;
  --r: 16px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --ground: #0B1426; --card: #14213D; --card-2: #1B2A4A; --field: #0F1A30; --ink: #E9EDF5; --ink-2: #C2CADA; --muted: #9AA4B8; --line: #22345C;
    --gold: #E2C27A; --navy: #22345C; --navy-lift: #2C4170; --side: #070C16; --side-ink: #9AA4B8;
    --green: #4CC38A; --red: #F09595; --amber: #F0B45A;
    --c1: #E2C27A; --c2: #7C93C4; --c3: #4CC38A; --c4: #9AA4B8;
    --shadow: none;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--ground); color: var(--ink); font: 15px/1.6 var(--body); }
button, input, select, textarea { font: inherit; color: inherit; }
.num, .stat b { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.red { color: var(--red); } .green { color: var(--green); } .amber { color: var(--amber); }
.center { display: grid; place-items: center; min-height: 60vh; text-align: center; padding: 24px; }
[hidden] { display: none !important; }
[dir="ltr"] .flip { transform: scaleX(-1); }
a { color: var(--gold); }
.btn:focus-visible, button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, [tabindex]:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

/* الأزرار */
.btn { border-radius: 10px; padding: 9px 16px; font-weight: 600; font-size: 14px; cursor: pointer; border: 1.5px solid var(--line); background: transparent; white-space: nowrap; display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; color: var(--ink); }
.btn:hover { border-color: var(--muted); }
.btn.main { background: var(--navy); color: var(--brand-gold); border-color: var(--navy); }
.btn.main:hover { background: var(--navy-lift); border-color: var(--navy-lift); }
.btn.danger { color: var(--red); border-color: color-mix(in srgb, var(--red) 30%, transparent); }
.btn.small { padding: 6px 12px; font-size: 13px; }
.btn.wide { width: 100%; padding: 12px; font-size: 15px; }
.btn:disabled { opacity: .55; cursor: default; }
.icon-btn { width: 34px; height: 34px; border-radius: 10px; border: 0; background: var(--card-2); color: var(--ink); display: grid; place-items: center; cursor: pointer; flex: none; }
.ghost { border: 0; background: none; color: var(--muted); cursor: pointer; padding: 6px; border-radius: 8px; display: grid; place-items: center; }
.ghost:hover { background: var(--card-2); color: var(--ink); }
.link { border: 0; background: none; padding: 0; color: var(--gold); cursor: pointer; font-size: 13px; }
.link:hover { text-decoration: underline; }

/* الهيكل */
.shell { display: grid; grid-template-columns: 236px minmax(0, 1fr); min-height: 100%; }
.side { background: var(--side); color: var(--side-ink); padding: 22px 14px; display: flex; flex-direction: column; gap: 6px; position: sticky; top: 0; height: 100vh; }
.side .logo { font-family: var(--logo); font-weight: 700; color: var(--brand-gold); font-size: 28px; padding: 0 12px 16px; }
.side nav { display: flex; flex-direction: column; gap: 4px; }
.side nav button { background: none; border: 0; text-align: start; padding: 10px 12px; border-radius: 10px; cursor: pointer; color: var(--side-ink); display: flex; gap: 10px; align-items: center; font-size: 15px; }
.side nav button:hover { background: #ffffff12; color: #fff; }
.side nav button[aria-current="page"] { background: #22345C; color: var(--brand-gold); font-weight: 600; }
.badge { margin-inline-start: auto; background: #B42318; color: #fff; font-style: normal; font-size: 11px; font-weight: 700; border-radius: 999px; padding: 1px 7px; line-height: 1.5; }
.side .who { margin-top: auto; font-size: 13px; padding: 14px 12px 0; border-top: 1px solid #ffffff1f; display: flex; flex-direction: column; gap: 3px; color: #9AA4B8; }
.side .who b { color: #fff; font-weight: 600; }
.side .who .mail { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side .who-btns { display: flex; gap: 6px; margin-top: 8px; }
.side .who-btns button { flex: 1; background: none; border: 1px solid #ffffff2a; color: var(--side-ink); border-radius: 8px; padding: 6px 8px; cursor: pointer; font-size: 13px; }
.side .who-btns button:hover { border-color: #ffffff55; color: #fff; }
.content { padding: 26px 32px 56px; max-width: 1240px; width: 100%; display: flex; flex-direction: column; gap: 20px; min-width: 0; }

/* راس الصفحة */
.head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.head .titles { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.head h1 { font-family: var(--display); font-weight: 800; font-size: 28px; margin: 0; line-height: 1.4; }
.head .titles > .muted { font-size: 14px; }
.head .actions { margin-inline-start: auto; display: flex; gap: 10px; align-items: center; flex-wrap: nowrap; flex: none; }
.live { font-size: 13px; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; }
.live i { width: 8px; height: 8px; border-radius: 50%; background: var(--green); flex: none; }
.live.off i { background: var(--amber); }
.gsearch { display: flex; align-items: center; gap: 8px; background: var(--card); border: 1.5px solid var(--line); border-radius: 12px; padding: 9px 12px; color: var(--muted); font-size: 14px; cursor: text; width: 340px; text-align: start; }
.gsearch:hover { border-color: var(--muted); }
.gsearch span { flex: 1; }
kbd { font-family: inherit; font-size: 11px; border: 1px solid var(--line); border-radius: 6px; padding: 1px 6px; color: var(--muted); }

/* البطاقات والأرقام */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; }
.stat { background: var(--card); border-radius: var(--r); padding: 16px 18px; box-shadow: var(--shadow); border: 0; text-align: start; display: flex; flex-direction: column; gap: 6px; color: inherit; }
button.stat { cursor: pointer; }
button.stat:hover { outline: 1.5px solid var(--line); }
.stat small { color: var(--muted); font-size: 13px; }
.stat b { font-size: 26px; font-weight: 700; line-height: 1.3; }
.stat b em { font-style: normal; font-size: 13px; font-weight: 500; color: var(--muted); }
.stat .sub { font-size: 12px; color: var(--muted); }
.stat.navy { background: var(--navy); }
.stat.navy small { color: var(--side-ink); }
.stat.navy b, .stat.navy b em { color: var(--brand-gold); }
.bar { height: 6px; background: var(--card-2); border-radius: 99px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--gold); border-radius: 99px; }
.bar.green i { background: var(--green); }
.split { display: flex; height: 10px; border-radius: 99px; overflow: hidden; gap: 2px; background: var(--card-2); }
.split i { display: block; height: 100%; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 12px; color: var(--ink-2); }
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; }

.box { background: var(--card); border-radius: var(--r); box-shadow: var(--shadow); overflow: hidden; }
.box > h2 { font-size: 17px; margin: 0; padding: 16px 18px 12px; display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.box > h2 small { font-size: 13px; color: var(--muted); font-weight: 500; }
.box-foot { display: block; width: 100%; text-align: start; padding: 12px 18px; border: 0; border-top: 1px solid var(--card-2); background: none; color: var(--gold); font-weight: 600; font-size: 14px; cursor: pointer; }
.box-foot:hover { background: var(--card-2); }
.pad { padding: 16px 18px; display: flex; flex-direction: column; gap: 14px; }
.empty { padding: 28px 18px; text-align: center; color: var(--muted); }
.cols { display: flex; flex-wrap: wrap; gap: 20px; align-items: flex-start; }
.cols > .wide { flex: 999 1 520px; min-width: 0; }
.cols > .narrow { flex: 1 1 300px; min-width: 0; display: flex; flex-direction: column; gap: 20px; }

/* القوائم الشبكية (بدل الجداول) */
.tbl { overflow-x: auto; }
.grid-row { display: grid; gap: 12px; align-items: center; padding: 11px 18px; border-top: 1px solid var(--card-2); font-size: 14px; }
.grid-row.th { font-size: 12px; color: var(--muted); background: var(--card-2); border-top: 0; padding-block: 8px; }
.grid-row[data-inst], .grid-row[data-tenant] { cursor: pointer; }
.grid-row[data-inst]:hover, .grid-row[data-tenant]:hover { background: color-mix(in srgb, var(--card-2) 60%, transparent); }
.grid-row b { font-weight: 600; }
.stack { display: flex; flex-direction: column; min-width: 0; }
.stack small { font-size: 12px; color: var(--muted); }
.stack small.red { color: var(--red); } .stack small.amber { color: var(--amber); }
.att { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr) minmax(0, .8fr) minmax(0, .9fr) 112px; }
.prow { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1.4fr) minmax(0, .9fr) minmax(0, .7fr) minmax(0, .7fr) minmax(0, .9fr) 118px; min-width: 900px; }
.prow.done { opacity: .72; }
.trow { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr) minmax(0, 1.4fr) minmax(0, 1fr) minmax(0, .8fr) 24px; min-width: 820px; }
.mrow { grid-template-columns: minmax(0, 1.7fr) minmax(0, 1.2fr) minmax(0, .9fr) minmax(0, 1.1fr) minmax(0, .7fr) 120px; min-width: 900px; }
.srow { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1.3fr) minmax(0, .8fr) minmax(0, 1.1fr) minmax(0, .9fr) minmax(0, 1.1fr); min-width: 880px; }
.rrow { grid-template-columns: minmax(0, .8fr) minmax(0, 1.4fr) minmax(0, .7fr) minmax(0, 1.1fr) minmax(0, .9fr) minmax(0, 1.2fr) 40px; min-width: 880px; }
.clip { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-acts .btn.small { padding: 4px 10px; }
.erow { grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr) minmax(0, 1.4fr) minmax(0, 1.4fr) minmax(0, .8fr) 72px; min-width: 850px; }
.grp { display: flex; justify-content: space-between; gap: 12px; padding: 10px 18px 6px; border-top: 1px solid var(--line); font-size: 13px; min-width: 900px; }
.grp b { font-weight: 700; }
.cell-end { display: flex; justify-content: flex-end; }
.avatar { flex: 0 0 34px; height: 34px; border-radius: 50%; background: var(--card-2); color: var(--ink-2); display: grid; place-items: center; font-weight: 700; }
.avatar.dark { background: var(--navy); color: var(--brand-gold); }
.who-cell { display: flex; align-items: center; gap: 10px; min-width: 0; }
.ltr { direction: ltr; text-align: end; }
[dir="ltr"] .ltr { text-align: start; }

/* الشارات */
.chip { display: inline-block; font-size: 12px; font-weight: 600; border-radius: 999px; padding: 3px 10px; white-space: nowrap; }
.chip.paid, .chip.rented { background: color-mix(in srgb, var(--green) 14%, transparent); color: var(--green); }
.chip.overdue { background: color-mix(in srgb, var(--red) 14%, transparent); color: var(--red); }
.chip.dueSoon, .chip.partial, .chip.ending { background: color-mix(in srgb, var(--amber) 14%, transparent); color: var(--amber); }
.chip.upcoming, .chip.cancelled, .chip.vacant { background: color-mix(in srgb, var(--muted) 14%, transparent); color: var(--ink-2); }

/* الفلاتر */
.tabs { display: flex; flex-wrap: wrap; gap: 4px; background: var(--card-2); border-radius: 12px; padding: 4px; align-self: flex-start; max-width: 100%; }
.tabs button { border: 0; background: none; padding: 7px 14px; border-radius: 9px; cursor: pointer; color: var(--muted); font-size: 14px; display: flex; flex-direction: column; align-items: flex-start; text-align: start; }
.tabs button span b { font-weight: 600; }
.tabs button small { font-size: 12px; font-variant-numeric: tabular-nums; }
.tabs button[aria-selected="true"] { background: var(--card); color: var(--ink); box-shadow: var(--shadow); }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 14px 18px; }
.field-search { flex: 0 1 320px; display: flex; align-items: center; gap: 8px; border: 1.5px solid var(--line); border-radius: 10px; padding: 7px 12px; color: var(--muted); background: var(--field); }
.field-search input { border: 0; background: none; outline: none; flex: 1; min-width: 0; color: var(--ink); font-size: 14px; }
.field-search:focus-within { border-color: var(--gold); }
.seg { display: inline-flex; background: var(--card-2); border-radius: 10px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg button { border: 0; background: none; padding: 6px 12px; border-radius: 8px; cursor: pointer; font-size: 13px; color: var(--muted); }
.seg button[aria-pressed="true"] { background: var(--card); color: var(--ink); font-weight: 600; box-shadow: var(--shadow); }
.input, select, textarea, input[type=date] { border: 1.5px solid var(--line); background: var(--field); border-radius: 10px; padding: 8px 12px; min-width: 0; color: var(--ink); font-size: 14px; }
.inline-label { font-size: 14px; color: var(--muted); display: flex; gap: 8px; align-items: center; }
.menu { position: relative; }
.menu summary { list-style: none; }
.menu summary::-webkit-details-marker { display: none; }
.menu-list { position: absolute; inset-inline-end: 0; top: calc(100% + 6px); background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 6px; display: flex; flex-direction: column; min-width: 170px; z-index: 5; box-shadow: 0 8px 24px #0B142626; }
.menu-list button { border: 0; background: none; text-align: start; padding: 9px 12px; border-radius: 8px; cursor: pointer; font-size: 14px; }
.menu-list button:hover { background: var(--card-2); }
.stepper { display: inline-flex; align-items: center; background: var(--card); border: 1.5px solid var(--line); border-radius: 10px; padding: 2px; }
.stepper button { border: 0; background: none; padding: 6px 12px; cursor: pointer; border-radius: 8px; font-size: 16px; }
.stepper button:hover { background: var(--card-2); }
.stepper b { min-width: 120px; text-align: center; font-weight: 600; }

/* الرئيسية */
.mini-prop { display: flex; flex-direction: column; gap: 6px; border: 0; background: none; padding: 0; cursor: pointer; text-align: start; }
.mini-prop span { display: flex; justify-content: space-between; font-size: 14px; }
.mini-prop span b { font-weight: 600; }
.feed { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; }
.feed .avatar { flex-basis: 30px; height: 30px; font-size: 13px; }

/* العقارات */
.key { display: flex; gap: 16px; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.key span { display: inline-flex; align-items: center; gap: 6px; }
.key i { width: 12px; height: 12px; border-radius: 4px; display: inline-block; }
.pcard { padding: 18px; display: flex; flex-direction: column; gap: 14px; }
.phead { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.picon { width: 44px; height: 44px; border-radius: 12px; background: var(--navy); color: var(--brand-gold); display: grid; place-items: center; flex: none; }
.phead h2 { margin: 0; font-size: 19px; }
.phead .muted { font-size: 13px; }
.pnums { margin-inline-start: auto; display: flex; gap: 22px; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.pnums span { display: flex; flex-direction: column; }
.pnums b { font-size: 17px; color: var(--ink); font-variant-numeric: tabular-nums; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.tile { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; padding: 12px 14px; border-radius: 12px; min-height: 86px; font-size: 13px; text-align: start; cursor: pointer; border: 1.5px solid; color: var(--ink); }
.tile b { font-size: 15px; font-weight: 600; }
.tile span { color: var(--ink-2); }
.tile small { font-weight: 600; font-size: 12px; }
.tile.rented { background: color-mix(in srgb, var(--green) 8%, var(--card)); border-color: var(--green); }
.tile.rented small { color: var(--green); }
.tile.late { background: color-mix(in srgb, var(--red) 9%, var(--card)); border-color: var(--red); }
.tile.late small { color: var(--red); }
.tile.vacant { background: transparent; border-style: dashed; border-color: var(--amber); }
.tile.vacant small { color: var(--amber); }
.tile.add { background: transparent; border-style: dashed; border-color: var(--line); color: var(--muted); align-items: center; justify-content: center; font-size: 14px; }
.tile:disabled { cursor: default; }
.tile:not(:disabled):hover { filter: brightness(.97); }

/* المصاريف */
.qadd { background: color-mix(in srgb, var(--card-2) 45%, var(--card)); border-top: 0; }
.qadd .input, .qadd select, .qadd input[type=date] { width: 100%; padding: 7px 10px; }
.qadd .plus { width: 36px; height: 36px; border: 0; border-radius: 9px; background: var(--navy); color: var(--brand-gold); font-size: 20px; cursor: pointer; }

/* الدخول */
.signin { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); }
.brand-side { position: relative; overflow: hidden; background: #14213D; color: #CFD6E4; padding: 48px 56px; display: flex; flex-direction: column; gap: 32px; }
.brand-side::before { content: ""; position: absolute; inset: 0; pointer-events: none;
  background:
    radial-gradient(circle at 100% 0%, rgba(226,194,122,.16), transparent 45%),
    radial-gradient(circle at 0% 100%, rgba(226,194,122,.10), transparent 50%),
    repeating-radial-gradient(circle at 0% 100%, transparent 0 46px, rgba(226,194,122,.07) 46px 47px); }
.brand-side > * { position: relative; }
.peek { background: #1C2B4D; border: 1px solid #2A3C66; border-radius: 16px; padding: 18px; display: flex; flex-direction: column; gap: 12px; box-shadow: 0 18px 40px rgba(0,0,0,.28); }
.peek-top { display: flex; justify-content: space-between; align-items: baseline; font-size: 13px; color: #9AA4B8; }
.peek-top b { font-family: var(--display); font-size: 20px; color: #fff; }
.peek-bar { height: 6px; border-radius: 99px; background: #2A3C66; overflow: hidden; }
.peek-bar i { display: block; height: 100%; border-radius: inherit; background: #E2C27A; }
.peek-row { display: flex; align-items: center; gap: 10px; font-size: 14px; color: #E4E8F0; padding-top: 10px; border-top: 1px solid #2A3C66; }
.peek-av { flex: none; width: 28px; height: 28px; border-radius: 50%; background: #2A3C66; color: #E2C27A; display: grid; place-items: center; font-size: 13px; font-weight: 600; }
.peek-name { flex: 1; min-width: 0; }
.chip-ok, .chip-late { flex: none; font-size: 12px; padding: 3px 10px; border-radius: 99px; }
.chip-ok { background: rgba(74,190,130,.16); color: #7FD9A8; }
.chip-late { background: rgba(232,110,90,.16); color: #F29A8A; }
.brand-side .logo-lg { font-family: var(--logo); font-weight: 700; font-size: 40px; line-height: 1.2; color: #E2C27A; }
.brand-body { margin-block: auto; display: flex; flex-direction: column; gap: 32px; max-width: 420px; }
.brand-side h1 { margin: 0; font-family: var(--display); font-size: 30px; line-height: 1.5; color: #fff; }
.feats { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 20px; }
.feats li { display: flex; gap: 14px; align-items: center; }
.feat-icon { flex: none; width: 44px; height: 44px; border-radius: 12px; background: #22345C; color: #E2C27A; display: grid; place-items: center; }
.feats b { color: #fff; font-weight: 600; font-size: 16px; }
.feats small { color: #9AA4B8; font-size: 14px; }
.brand-foot { margin: 0; font-size: 13px; color: #9AA4B8; }
.form-side { position: relative; display: grid; place-items: center; padding: 72px 24px 48px; }
.lang-switch { position: absolute; top: 20px; inset-inline-end: 24px; border: 1.5px solid var(--line); background: var(--card); color: var(--ink); border-radius: 10px; padding: 6px 14px; font-size: 13px; cursor: pointer; }
.lang-switch:hover { border-color: var(--muted); }
.auth-form { width: 100%; max-width: 400px; display: flex; flex-direction: column; gap: 14px; background: var(--card); border-radius: 20px; padding: 32px; box-shadow: var(--shadow); }
.auth-title { display: flex; flex-direction: column; gap: 4px; margin-bottom: 6px; }
.auth-form h2 { margin: 0; font-family: var(--display); font-size: 26px; line-height: 1.4; }
.auth-form p { margin: 0; }
.auth-note { text-align: center; font-size: 14px; color: var(--muted); padding-top: 4px; }
.sso { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 12px; border-radius: 12px; cursor: pointer; width: 100%; font-size: 15px; font-weight: 600; }
.sso.apple { background: #000; color: #fff; border: 1.5px solid #000; }
.sso.google { background: var(--field); color: var(--ink); border: 1.5px solid var(--line); }
.sso:hover { filter: brightness(.95); }
.or { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.fld { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); }
.fld .input, .fld select, .fld textarea, .fld input { font-size: 15px; padding: 10px 12px; border-radius: 11px; color: var(--ink); }
.fld-top { display: flex; justify-content: space-between; align-items: center; font-size: 13px; color: var(--muted); }
.note-ok { color: var(--green); font-size: 14px; } .note-bad { color: var(--red); font-size: 14px; }

/* الترقية والرسائل */
.gate { min-height: 100vh; display: grid; place-items: center; padding: 48px 24px; }
.gate-in { width: 100%; max-width: 880px; display: flex; flex-direction: column; gap: 22px; }
.gate-top { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; }
.gate-top .logo { font-family: var(--logo); font-weight: 700; font-size: 28px; color: var(--gold); }
.gate-card { background: var(--card); border-radius: 22px; overflow: hidden; display: flex; flex-wrap: wrap; box-shadow: var(--shadow); }
.gate-card > div { flex: 1 1 340px; padding: 36px; display: flex; flex-direction: column; gap: 16px; }
.gate-card > div + div { background: var(--card-2); }
.gate-card h1 { margin: 0; font-family: var(--display); font-size: 26px; line-height: 1.5; }
.gate-card h2 { margin: 0; font-size: 18px; }
.gate-card p { margin: 0; color: var(--ink-2); }
.pill-tag { align-self: flex-start; font-size: 12px; font-weight: 700; color: var(--gold); background: color-mix(in srgb, var(--gold) 14%, transparent); border-radius: 999px; padding: 4px 12px; }
.checks { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 10px; }
.checks li { display: flex; gap: 10px; }
.checks li::before { content: "✓"; color: var(--green); }
.steps { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 16px; counter-reset: s; }
.steps li { display: flex; gap: 14px; align-items: flex-start; counter-increment: s; }
.steps li::before { content: counter(s); flex: 0 0 30px; height: 30px; border-radius: 50%; background: var(--navy); color: var(--brand-gold); display: grid; place-items: center; font-weight: 700; font-size: 14px; }

/* النوافذ */
dialog { border: 0; border-radius: 20px; padding: 0; width: min(540px, calc(100% - 32px)); background: var(--card); color: var(--ink); }
dialog::backdrop { background: #0B142699; }
.dlg { padding: 24px; display: flex; flex-direction: column; gap: 16px; }
.dlg h2 { font-family: var(--display); margin: 0; font-size: 22px; }
.dlg-head { display: flex; align-items: flex-start; gap: 12px; }
.dlg-head > div { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.dlg-head p { margin: 0; font-size: 14px; color: var(--ink-2); }
.dlg .row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.dlg label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); }
.dlg label .input, .dlg label select, .dlg label textarea, .dlg label input { color: var(--ink); font-size: 15px; }
.dlg .actions { display: flex; gap: 10px; flex-wrap: wrap; }
.dlg .actions .grow { flex: 1; }
.dlg .error { color: var(--red); font-size: 13px; margin: 0; }
.dlg fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.dlg legend { font-size: 13px; color: var(--muted); margin-bottom: 6px; padding: 0; }
.sumbox { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; background: var(--card-2); border-radius: 14px; padding: 12px 14px; font-size: 12px; color: var(--ink-2); }
.sumbox span { display: flex; flex-direction: column; }
.sumbox b { font-size: 16px; color: var(--ink); font-variant-numeric: tabular-nums; }
.sumbox b.red { color: var(--red); } .sumbox b.green { color: var(--green); }
.input.big { font-size: 22px !important; font-weight: 700; font-variant-numeric: tabular-nums; }
.pills { display: flex; gap: 8px; flex-wrap: wrap; }
.pill { font-size: 13px; font-weight: 600; border-radius: 999px; padding: 7px 14px; cursor: pointer; background: var(--field); border: 1.5px solid var(--line); }
.pill[aria-pressed="true"] { background: var(--navy); color: var(--brand-gold); border-color: var(--navy); }
.mgrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.mopt { position: relative; }
.mopt input { position: absolute; opacity: 0; pointer-events: none; }
.mopt span { display: block; text-align: center; font-size: 14px; font-weight: 600; padding: 10px; border-radius: 11px; border: 1.5px solid var(--line); background: var(--field); color: var(--ink); cursor: pointer; }
.mopt input:checked + span { background: var(--navy); color: var(--brand-gold); border-color: var(--navy); }
.mopt input:focus-visible + span { outline: 2px solid var(--gold); outline-offset: 2px; }
.preview { margin: 0; font-size: 14px; border-radius: 11px; padding: 10px 12px; background: color-mix(in srgb, var(--amber) 12%, transparent); color: var(--amber); }
.preview.ok { background: color-mix(in srgb, var(--green) 12%, transparent); color: var(--green); }
.dlg .list { display: flex; flex-direction: column; gap: 6px; max-height: 220px; overflow: auto; }
.dlg .list > div, .dlg .list > button { display: flex; justify-content: space-between; gap: 10px; align-items: center; background: var(--field); border: 1px solid var(--card-2); border-radius: 11px; padding: 9px 12px; font-size: 14px; color: var(--ink); text-align: start; }
.dlg .list > button { cursor: pointer; width: 100%; }
.dlg .list > button:hover { border-color: var(--line); }
.dlg h3 { margin: 0; font-size: 15px; }
.dlg-actions { display: flex; gap: 8px; }
.dlg-actions > * { flex: 1; }

/* اللوح الجانبي (المستأجر) */
dialog.drawer { margin: 0; margin-inline-start: auto; height: 100%; max-height: 100%; width: min(520px, 100%); border-radius: 0; box-shadow: 0 0 40px #0B142640; }
dialog.drawer .dlg { min-height: 100%; }
dialog.drawer .foot { margin-top: auto; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.big-avatar { width: 52px; height: 52px; border-radius: 50%; background: var(--navy); color: var(--brand-gold); display: grid; place-items: center; font-size: 22px; font-weight: 700; flex: none; }

/* البحث */
/* المستندات والعارض */
.doc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 10px; }
.doc-tile { display: flex; flex-direction: column; gap: 6px; padding: 6px; border: 1px solid var(--card-2); border-radius: 12px; background: var(--field); cursor: pointer; text-align: start; }
.doc-tile:hover { border-color: var(--line); }
.doc-tile .thumb { aspect-ratio: 4 / 3; border-radius: 8px; background: var(--card-2); color: var(--muted); display: grid; place-items: center; overflow: hidden; }
.doc-tile .thumb img { width: 100%; height: 100%; object-fit: cover; }
.doc-tile .thumb small { font-size: 11px; font-weight: 700; }
.doc-tile.failed .thumb { opacity: .5; }
.doc-name { font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-acts { display: flex; gap: 2px; justify-content: flex-end; }
dialog.viewer { width: min(960px, calc(100% - 32px)); max-height: calc(100% - 32px); display: flex; flex-direction: column; }
dialog.viewer:not([open]) { display: none; }
.viewer-head { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--card-2); }
.viewer-head b { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.viewer-head .btn { display: inline-flex; gap: 6px; align-items: center; text-decoration: none; }
.viewer-body { padding: 14px; display: grid; place-items: center; overflow: auto; min-height: 160px; }
.viewer-body img { max-width: 100%; max-height: calc(100vh - 140px); border-radius: 10px; }
.viewer-body .error { color: var(--red); margin: 0; }
.viewer-body iframe { width: 100%; height: calc(100vh - 140px); border: 0; border-radius: 10px; background: #fff; }

dialog.search { margin-top: 12vh; width: min(600px, calc(100% - 32px)); }
dialog.search .dlg { padding: 0; gap: 0; }
.sbox { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line); color: var(--muted); }
.sbox input { flex: 1; border: 0; background: none; outline: none; font-size: 17px; color: var(--ink); min-width: 0; }
.sresults { max-height: 55vh; overflow: auto; padding: 8px; display: flex; flex-direction: column; gap: 2px; }
.sres { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 0; background: none; border-radius: 10px; cursor: pointer; text-align: start; width: 100%; }
.sres:hover, .sres:focus-visible { background: var(--card-2); }
.sres .stack b { font-weight: 600; }
.sres .kind { margin-inline-start: auto; font-size: 12px; color: var(--muted); }
.shint { padding: 18px; color: var(--muted); font-size: 14px; text-align: center; }

#toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: #14213D; color: #fff; padding: 10px 18px; border-radius: 12px; font-size: 14px; z-index: 20; box-shadow: 0 8px 24px #0B142640; }

/* شاشة الجوال: القائمة تصير شريط تحت */
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; inset: auto 0 0 0; height: auto; flex-direction: row; padding: 4px 6px calc(6px + env(safe-area-inset-bottom)); z-index: 10; }
  .side .logo, .side .who { display: none; }
  .side nav { flex-direction: row; width: 100%; justify-content: space-around; gap: 0; }
  .side nav button { flex: 1; flex-direction: column; gap: 2px; font-size: 11px; padding: 6px 2px; position: relative; }
  .side nav button[aria-current="page"] { background: none; }
  .badge { position: absolute; top: 2px; inset-inline-start: 55%; margin: 0; font-size: 10px; padding: 0 5px; }
  .content { padding: 18px 16px 96px; gap: 16px; }
  .head h1 { font-size: 22px; }
  .head .actions { margin-inline-start: 0; width: 100%; flex: 1 1 100%; flex-wrap: wrap; }
  .gsearch { flex: 1; width: auto; min-width: 0; }
  .gsearch kbd { display: none; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .stat { padding: 12px; }
  .stat b { font-size: 20px; }
  .att { grid-template-columns: minmax(0, 1fr) auto; row-gap: 6px; }
  .att > :nth-child(2) { grid-column: 1; grid-row: 2; }
  .att > :nth-child(3) { grid-column: 2; grid-row: 1; text-align: end; }
  .att > :nth-child(4) { grid-column: 2; grid-row: 2; justify-self: end; }
  .att > :nth-child(5) { grid-column: 1 / -1; }
  .att > :nth-child(5) .btn { width: 100%; }
  .att.th { display: none; }
  .signin { grid-template-columns: 1fr; }
  .brand-side { padding: 28px 24px; gap: 20px; }
  .brand-body { gap: 20px; }
  .brand-side h1 { font-size: 22px; }
  .feats { gap: 14px; }
  .brand-foot { display: none; }
  .peek { display: none; }
  .form-side { padding: 64px 16px 40px; }
  .auth-form { padding: 24px 20px; }
  .gate-card > div { padding: 24px; }
  .pnums { margin-inline-start: 0; }
  dialog.drawer { width: 100%; }
}

@media print {
  .side, .head .actions, .tabs, .toolbar, #toast, .no-print { display: none !important; }
  .shell { display: block; }
  body, .box, .stat { background: #fff; color: #000; box-shadow: none; }
  .prow, .grp { min-width: 0; }
}
