/* سِجل — نظام إدارة مدفوعات العقار — Design tokens shared by admin + resident layouts */
:root{
  --ink:#16232E;
  --ink-soft:#4A5860;
  --paper:#EFEEE6;
  --surface:#FFFFFF;
  --line:#DBD7C9;
  --teal:#1F5C55;
  --teal-dark:#12332F;
  --teal-tint:#E4EDEB;
  --brass:#B07F28;
  --brass-tint:#F3E7C9;
  --rust:#A0432C;
  --rust-tint:#F3DED6;
  --radius:10px;
}
*{box-sizing:border-box;}
body{margin:0;background:var(--paper);color:var(--ink);font-family:'IBM Plex Sans Arabic',sans-serif;}
.num{font-family:'IBM Plex Mono','IBM Plex Sans Arabic',sans-serif; direction:ltr; unicode-bidi:isolate;}
a{color:inherit;}

/* ---- App shell ---- */
.app{display:flex; min-height:100vh;}
.sidebar{width:260px; flex-shrink:0; background:var(--teal-dark); color:#EFEEE6; display:flex; flex-direction:column; padding:28px 22px;}
.brand{display:flex; align-items:center; gap:12px; margin-bottom:38px;}
.brand-mark{width:40px;height:40px;border-radius:50%;border:2px solid var(--brass); display:flex;align-items:center;justify-content:center; font-family:'Amiri',serif;font-weight:700;font-size:19px;color:var(--brass); flex-shrink:0;}
.brand-text h1{font-family:'Amiri',serif;font-size:20px;margin:0;font-weight:700;letter-spacing:.5px;}
.brand-text p{margin:2px 0 0;font-size:11.5px;color:#A9BAB6;letter-spacing:.5px;}
nav.side-nav{display:flex;flex-direction:column;gap:4px;}
nav.side-nav a{color:#CFE0DC; text-decoration:none; font-size:14.5px; padding:11px 14px; border-radius:8px; display:flex; align-items:center; gap:12px; border-inline-start:3px solid transparent; transition:.15s;}
nav.side-nav a:hover{background:rgba(255,255,255,.06);}
nav.side-nav a.active{background:rgba(176,127,40,.18); color:#fff; border-inline-start-color:var(--brass); font-weight:600;}
.sidebar-foot{margin-top:auto; padding-top:22px; border-top:1px solid rgba(255,255,255,.1);}
.whoami{display:flex; align-items:center; gap:10px; font-size:13px; color:#BFD1CC;}
.whoami .dot{width:8px;height:8px;border-radius:50%;background:#5FBF9B;}
.main{flex:1; min-width:0; padding:34px 40px 60px;}
.topbar{display:flex; justify-content:space-between; align-items:flex-start; margin-bottom:26px; flex-wrap:wrap; gap:16px;}
.topbar h2{font-family:'Amiri',serif; font-size:26px; margin:0 0 4px; font-weight:700;}
.topbar .sub{color:var(--ink-soft); font-size:13.5px; margin:0;}

.flash{padding:12px 18px; border-radius:8px; font-size:13.5px; margin-bottom:20px;}
.flash.ok{background:var(--teal-tint); color:var(--teal-dark); border:1px solid var(--teal);}
.flash.err{background:var(--rust-tint); color:var(--rust); border:1px solid var(--rust);}

/* ---- Stat cards ---- */
.stats{display:flex; flex-wrap:wrap; gap:16px; margin-bottom:28px;}
.stat{background:var(--surface); border:1px solid var(--line); border-radius:var(--radius); padding:20px 22px; flex:1 1 220px;}
.stat .label{font-size:12.5px; color:var(--ink-soft); margin-bottom:10px;}
.stat .value{font-family:'Amiri',serif; font-size:28px; font-weight:700;}
.stat .value small{font-family:'IBM Plex Sans Arabic'; font-size:14px; font-weight:400; color:var(--ink-soft);}
.stat.good{border-top:3px solid var(--teal);}
.stat.warn{border-top:3px solid var(--rust);}
.stat.brass-top{border-top:3px solid var(--brass);}

/* ---- Panels ---- */
.panel{background:var(--surface); border:1px solid var(--line); border-radius:var(--radius); margin-bottom:24px;}
.panel-head{display:flex; justify-content:space-between; align-items:center; padding:16px 22px; border-bottom:1px solid var(--line);}
.panel-head h3{font-family:'Amiri',serif; font-size:17px; margin:0; font-weight:700;}
.panel-body{padding:6px 22px 18px;}
.row-list{display:flex; flex-direction:column;}
.row-item{display:flex; justify-content:space-between; align-items:center; padding:13px 0; border-bottom:1px dashed var(--line);}
.row-item:last-child{border-bottom:none;}
.row-item .who{font-size:14px; font-weight:500;}
.row-item .meta{font-size:12px; color:var(--ink-soft);}

/* ---- Badges ---- */
.stamp{display:inline-flex; align-items:center; justify-content:center; gap:6px; padding:4px 12px; border-radius:20px; font-size:11.5px; font-weight:700; letter-spacing:.4px; border:1.5px solid transparent;}
.stamp.paid{color:var(--teal); border-color:var(--teal); background:var(--teal-tint);}
.stamp.due{color:var(--rust); border-color:var(--rust); background:var(--rust-tint);}
.stamp.partial{color:var(--brass); border-color:var(--brass); background:var(--brass-tint);}

/* ---- Tables ---- */
table{width:100%; border-collapse:collapse; font-size:13.5px;}
thead th{text-align:right; font-weight:600; color:var(--ink-soft); font-size:12px; padding:10px 12px; border-bottom:2px solid var(--ink);}
tbody td{padding:12px; border-bottom:1px solid var(--line); vertical-align:middle;}
tbody tr:hover{background:#FAF9F5;}
.unit-tag{font-family:'Amiri',serif; font-weight:700; font-size:15px; background:var(--teal-tint); color:var(--teal-dark); width:34px; height:34px; display:inline-flex; align-items:center; justify-content:center; border-radius:8px;}

/* ---- Buttons / forms ---- */
.btn{border:1px solid var(--teal); color:var(--teal); background:transparent; padding:8px 16px; border-radius:7px; font-size:13px; font-weight:600; cursor:pointer; font-family:inherit; text-decoration:none; display:inline-block;}
.btn.solid{background:var(--teal); color:#fff;}
.btn.brass{border-color:var(--brass); color:var(--brass);}
.btn.small{padding:5px 10px; font-size:11.5px;}
.form-grid{display:grid; grid-template-columns:1fr 1fr; gap:16px;}
.field{margin-bottom:16px;}
.field label{display:block; font-size:12.5px; color:var(--ink-soft); margin-bottom:6px;}
.field input, .field select, .field textarea{
  width:100%; padding:10px 12px; border:1px solid var(--line); border-radius:7px; font-family:inherit; font-size:13.5px; background:#fff;
}

/* ---- Ledger grid ---- */
.legend{display:flex; gap:18px; padding:14px 22px 4px; font-size:12px; color:var(--ink-soft); flex-wrap:wrap;}
.legend span{display:inline-flex; align-items:center; gap:6px;}
.legend i{width:12px;height:12px;border-radius:3px; display:inline-block;}
.ledger-wrap{overflow-x:auto;}
.ledger{border-collapse:collapse; width:100%; min-width:760px;}
.ledger th, .ledger td{border:1px solid var(--line); text-align:center; padding:9px 6px;}
.ledger thead th{background:var(--teal-dark); color:#EFEEE6; font-weight:600; font-size:12px; border-color:var(--teal-dark);}
.ledger tbody th{text-align:right; background:#F7F6F0; font-weight:600; font-size:13px; padding-inline-start:14px;}
.cell{width:34px;height:34px;border-radius:7px;display:inline-flex;align-items:center;justify-content:center;font-size:13px; border:none; cursor:pointer; font-family:inherit;}
.cell.paid{background:var(--teal); color:#fff;}
.cell.due{background:var(--rust-tint); color:var(--rust); border:1.5px dashed var(--rust);}
.cell.partial{background:var(--brass-tint); color:var(--brass); border:1.5px solid var(--brass);}

/* ---- Incidents ---- */
.incident-card{border:1px solid var(--line); border-radius:var(--radius); padding:18px 20px; margin-bottom:14px; background:#fff;}
.incident-top{display:flex; justify-content:space-between; align-items:flex-start; gap:14px; margin-bottom:10px;}
.incident-top h4{font-family:'Amiri',serif; font-size:17px; margin:0 0 4px; font-weight:700;}
.incident-top .date{font-size:12px; color:var(--ink-soft);}
.incident-amount{font-family:'IBM Plex Mono'; font-size:20px; font-weight:600; color:var(--ink); direction:ltr;}
.incident-amount .cur{font-family:'IBM Plex Sans Arabic'; font-size:12px; color:var(--ink-soft); margin-inline-start:4px;}
.bar{height:6px; background:var(--line); border-radius:4px; overflow:hidden;}
.bar > div{height:100%; background:var(--teal);}
.progress-row{display:flex; align-items:center; gap:12px; margin-top:12px;}
.progress-row .bar{flex:1; margin:0;}
.progress-row .pct{font-size:12px; color:var(--ink-soft); font-family:'IBM Plex Mono';}
.new-incident-btn{display:inline-flex; align-items:center; gap:8px; background:var(--brass); color:#fff; border:none; padding:10px 18px; border-radius:8px; font-weight:600; font-size:13.5px; cursor:pointer; font-family:inherit; text-decoration:none;}

/* ---- Login page ---- */
.login-wrap{min-height:100vh; display:flex; align-items:center; justify-content:center; background:var(--paper);}
.login-card{background:var(--surface); border:1px solid var(--line); border-radius:14px; padding:36px 34px; width:100%; max-width:380px; box-shadow:0 10px 30px -14px rgba(0,0,0,.2);}
.login-card .brand-mark{margin:0 auto 16px;}
.login-card h1{font-family:'Amiri',serif; text-align:center; font-size:22px; margin:0 0 4px;}
.login-card .sub{text-align:center; color:var(--ink-soft); font-size:13px; margin:0 0 26px;}
.login-card .btn.solid{width:100%; padding:11px; margin-top:6px;}
.login-hint{margin-top:18px; font-size:11.5px; color:var(--ink-soft); text-align:center; line-height:1.7;}

/* ---- Resident (mobile) view ---- */
.phone{width:100%; max-width:460px; margin:0 auto; min-height:100vh; background:var(--paper); padding-bottom:40px;}
header.top{background:var(--teal-dark); color:#EFEEE6; padding:22px 24px 26px; border-radius:0 0 22px 22px;}
.top-row{display:flex; justify-content:space-between; align-items:center; margin-bottom:18px;}
.greet p{margin:0; font-size:12.5px; color:#A9BAB6;}
.greet h1{margin:2px 0 0; font-family:'Amiri',serif; font-size:20px; font-weight:700;}
.avatar{width:38px;height:38px;border-radius:50%;background:var(--brass); color:#fff; display:flex;align-items:center;justify-content:center; font-family:'Amiri',serif; font-weight:700;}
.status-hero{background:var(--surface); border-radius:16px; padding:22px; text-align:center; box-shadow:0 10px 30px -14px rgba(0,0,0,.35);}
.status-hero .month{font-size:12px; color:var(--ink-soft); margin-bottom:12px;}
.ring{width:100px; height:100px; border-radius:50%; margin:0 auto 14px; display:flex; align-items:center; justify-content:center; position:relative;}
.ring.paid{background:conic-gradient(var(--teal) 360deg);}
.ring.due{background:conic-gradient(var(--rust) 0deg 360deg);}
.ring.partial{background:conic-gradient(var(--brass) 0deg 180deg, var(--rust-tint) 180deg 360deg);}
.ring::before{content:'';position:absolute; inset:9px; background:var(--surface); border-radius:50%;}
.ring .stamp-text{position:relative; z-index:1; font-family:'Amiri',serif; font-weight:700; font-size:13px;}
.status-hero .amount{font-family:'IBM Plex Mono'; font-size:24px; font-weight:600; margin:2px 0 4px;}
.status-hero .amount .cur{font-family:'IBM Plex Sans Arabic'; font-size:12px; color:var(--ink-soft); margin-inline-start:5px;}
.status-hero .note{font-size:12.5px; color:var(--ink-soft);}
.res-section{padding:22px 24px 0;}
.sec-title{display:flex; justify-content:space-between; align-items:baseline; margin-bottom:12px;}
.sec-title h2{font-family:'Amiri',serif; font-size:16px; margin:0; font-weight:700;}
.sec-title .count{font-size:12px; color:var(--ink-soft);}
.receipt{background:var(--surface); border-radius:14px; margin-bottom:16px; padding:18px 20px 16px; border:1px solid var(--line);}
.receipt .perf{border-top:1.5px dashed var(--line); margin:12px 0;}
.receipt-top{display:flex; justify-content:space-between; align-items:flex-start;}
.receipt-top h3{font-size:14px; margin:0 0 4px; font-weight:600;}
.receipt-top .date{font-size:11.5px; color:var(--ink-soft);}
.receipt-amount{font-family:'IBM Plex Mono'; font-size:18px; font-weight:600; white-space:nowrap;}
.receipt-foot{display:flex; justify-content:space-between; align-items:center; font-size:12px; color:var(--ink-soft);}
.badge{padding:3px 10px; border-radius:20px; font-size:11px; font-weight:700;}
.badge.due{background:var(--rust-tint); color:var(--rust);}
.badge.paid{background:var(--teal-tint); color:var(--teal);}
.empty-note{background:var(--surface); border:1px dashed var(--line); border-radius:12px; padding:16px 18px; font-size:13px; color:var(--ink-soft); text-align:center; margin-bottom:16px;}
.timeline{background:var(--surface); border:1px solid var(--line); border-radius:14px; padding:6px 18px 4px;}
.t-row{display:flex; align-items:flex-start; gap:12px; padding:13px 0; border-bottom:1px solid var(--line);}
.t-row:last-child{border-bottom:none;}
.t-dot{width:9px; height:9px; border-radius:50%; margin-top:6px; flex-shrink:0;}
.t-dot.paid{background:var(--teal);}
.t-dot.due, .t-dot.partial{background:var(--brass);}
.t-body{flex:1;}
.t-title{font-size:13.5px; font-weight:500;}
.t-date{font-size:11.5px; color:var(--ink-soft); margin-top:2px;}
.t-amount{font-family:'IBM Plex Mono'; font-size:13.5px; align-self:center;}
.pay-cta{margin:22px 24px 0; background:var(--brass-tint); border:1px solid var(--brass); border-radius:12px; padding:14px 16px; font-size:12.5px; color:#7A5A1E; text-align:center; line-height:1.7;}

@media (max-width: 980px){
  .sidebar{position:fixed; inset-inline-start:0; top:0; bottom:0; z-index:20; transform:translateX(105%);}
  .app.nav-open .sidebar{transform:none;}
  .main{padding:20px;}
  .form-grid{grid-template-columns:1fr;}
}
