/* © 2026 Anubis Empire. All rights reserved. Proprietary software — see LICENSE. */
:root{
  --green:#14532d; --green-2:#1a6b3a; --green-3:#e7f1ea;
  --gold:#b8963e; --gold-2:#f5edd6;
  --red:#b91c1c; --red-2:#fdecec; --ok:#15803d; --wait:#a16207; --wait-2:#fdf3d8;
  --bg:#f5f6f2; --card:#fff; --ink:#1c2420; --muted:#667068; --line:#e1e5de;
  --radius:16px; color-scheme: light;
}
*{box-sizing:border-box;-webkit-tap-highlight-color:transparent}
[hidden]{display:none !important}
html,body{margin:0;height:100%;background:var(--bg);color:var(--ink);
  font-family:"Segoe UI",Tahoma,"Noto Naskh Arabic","Noto Sans Arabic",system-ui,sans-serif;font-size:17px;line-height:1.55}
#app{min-height:100%;display:flex;flex-direction:column;max-width:720px;margin:0 auto;background:var(--bg)}
h1,h2,h3{margin:0 0 .5rem;line-height:1.3} h2{font-size:1.25rem} h3{font-size:1.05rem}
a{color:var(--green-2)}
.muted{color:var(--muted)} .small{font-size:.88rem} .center{text-align:center}
.ltr{direction:ltr;unicode-bidi:plaintext;text-align:left}

/* هيكل الصفحة */
.top{position:sticky;top:0;z-index:5;display:flex;align-items:center;justify-content:space-between;gap:.5rem;
  background:var(--green);color:#fff;padding:calc(.7rem + env(safe-area-inset-top)) 1rem .7rem}
.brand-sm{font-weight:700;font-size:1.1rem}
.content{flex:1;padding:1rem 1rem calc(5.5rem + env(safe-area-inset-bottom));overflow-x:hidden}
.tabs{position:fixed;bottom:0;left:0;right:0;max-width:720px;margin:0 auto;z-index:6;display:flex;background:#fff;
  border-top:1px solid var(--line);padding-bottom:env(safe-area-inset-bottom)}
.tab{flex:1;position:relative;border:0;background:none;padding:.45rem .1rem .35rem;color:var(--muted);font:inherit;font-size:.72rem;
  display:flex;flex-direction:column;align-items:center;gap:.05rem;min-height:56px;cursor:pointer}
.tab .ico{font-size:1.3rem;line-height:1.2}
.tab.active{color:var(--green);font-weight:700}
.tab.active::before{content:"";position:absolute;top:0;width:36px;height:3px;border-radius:0 0 3px 3px;background:var(--gold)}
.pip{position:absolute;top:2px;inset-inline-start:calc(50% + 6px);min-width:18px;height:18px;border-radius:9px;background:var(--red);
  color:#fff;font-size:.7rem;display:flex;align-items:center;justify-content:center;padding:0 4px}
.loading,.empty{text-align:center;color:var(--muted);padding:2rem 1rem}

/* بطاقات وقوائم */
.card{background:var(--card);border:1px solid var(--line);border-radius:var(--radius);padding:1rem;margin-bottom:.8rem}
.card.hero{background:linear-gradient(135deg,var(--green),var(--green-2));color:#fff;border:0}
.card.hero .k{opacity:.85;font-size:.95rem} .card.hero .v{font-size:2rem;font-weight:800}
.grid2{display:grid;grid-template-columns:1fr 1fr;gap:.7rem;margin-bottom:.8rem}
.stat{background:var(--card);border:1px solid var(--line);border-radius:14px;padding:.8rem}
.stat .k{color:var(--muted);font-size:.85rem} .stat .v{font-size:1.2rem;font-weight:700}
.stat.green .v{color:var(--ok)} .stat.red .v{color:var(--red)} .stat.gold .v{color:var(--wait)}
.item{display:flex;align-items:center;justify-content:space-between;gap:.7rem;padding:.75rem 0;border-bottom:1px solid var(--line)}
.item:last-child{border-bottom:0} .item .main{min-width:0;flex:1} .item .t{font-weight:600;overflow-wrap:anywhere}
.amount{font-weight:800;white-space:nowrap} .amount.in{color:var(--ok)} .amount.out{color:var(--ink)} .amount.debt{color:var(--red)}
.row{display:flex;align-items:center} .row.gap{gap:.6rem} .row.wrap{flex-wrap:wrap} .between{justify-content:space-between}
.stack>*+*{margin-top:.6rem}

/* شارات */
.badge{display:inline-block;padding:.12rem .6rem;border-radius:999px;font-size:.78rem;font-weight:700;background:#eceeea;color:#4b554e;white-space:nowrap}
.badge.ok{background:var(--green-3);color:var(--ok)} .badge.debt{background:var(--red-2);color:var(--red)}
.badge.wait{background:var(--wait-2);color:var(--wait)} .badge.gold{background:var(--gold-2);color:#7a5e12}
.top .badge.gold{background:rgba(255,255,255,.18);color:#fff}

/* أزرار وحقول */
.btn{appearance:none;border:0;border-radius:14px;padding:.8rem 1.1rem;min-height:48px;font:inherit;font-weight:700;cursor:pointer;width:100%}
.btn.small{width:auto;min-height:40px;padding:.4rem .9rem;font-size:.92rem}
.btn.primary{background:var(--green);color:#fff} .btn.gold{background:var(--gold);color:#fff}
.btn.ghost{background:#fff;color:var(--green);border:1.5px solid var(--green)}
.btn.danger{background:var(--red);color:#fff} .btn[disabled]{opacity:.55}
.row .btn{width:auto;flex:1}
.field{display:block;margin-bottom:.8rem} .field .lbl{display:block;font-weight:600;margin-bottom:.25rem}
.field .hint{display:block;color:var(--muted);font-size:.82rem;margin-top:.2rem}
input,select,textarea{width:100%;font:inherit;padding:.7rem .8rem;border:1.5px solid var(--line);border-radius:12px;background:#fff;color:var(--ink);min-height:48px}
input:focus,select:focus,textarea:focus{outline:2px solid var(--gold);border-color:var(--gold)}
input[type=checkbox],input[type=radio]{width:22px;height:22px;min-height:0;accent-color:var(--green);flex:none}
.check{display:flex;align-items:center;gap:.6rem;padding:.4rem 0}
.seg{display:flex;background:#e9ece6;border-radius:12px;padding:3px;margin-bottom:.8rem}
.seg button{flex:1;border:0;background:none;padding:.55rem;border-radius:10px;font:inherit;font-weight:600;color:var(--muted);cursor:pointer}
.seg button.on{background:#fff;color:var(--green);box-shadow:0 1px 3px rgba(0,0,0,.12)}
.chips{display:flex;gap:.5rem;overflow-x:auto;padding-bottom:.6rem;margin-bottom:.4rem}
.chip{flex:none;border:1.5px solid var(--line);background:#fff;border-radius:999px;padding:.35rem .9rem;font:inherit;font-size:.9rem;cursor:pointer}
.chip.on{background:var(--green);border-color:var(--green);color:#fff}

/* شاشات البداية */
.welcome{padding:calc(2rem + env(safe-area-inset-top)) 1.2rem 2rem}
.logo{width:84px;height:84px;margin:0 auto .6rem;border-radius:22px;background:var(--green);display:flex;align-items:center;justify-content:center;font-size:2.6rem;color:var(--gold)}
.tagline{color:var(--gold);font-weight:700}
.choice{display:block;width:100%;text-align:start;background:#fff;border:1.5px solid var(--line);border-radius:16px;padding:1rem;margin-bottom:.8rem;font:inherit;cursor:pointer}
.choice strong{display:block;color:var(--green);margin-bottom:.15rem}

/* نوافذ وإشعارات */
.overlay{position:fixed;inset:0;background:rgba(0,0,0,.45);z-index:20;display:flex;align-items:flex-end;justify-content:center}
.sheet{background:#fff;width:100%;max-width:720px;max-height:88vh;overflow-y:auto;border-radius:22px 22px 0 0;padding:1rem 1rem calc(1.2rem + env(safe-area-inset-bottom))}
.sheet-head{display:flex;justify-content:space-between;align-items:center;margin-bottom:.8rem}
.x{border:0;background:#eef0ec;border-radius:50%;width:36px;height:36px;font-size:1rem;cursor:pointer}
.msg{margin:.2rem 0 1rem}
.toasts{position:fixed;top:calc(.6rem + env(safe-area-inset-top));left:.6rem;right:.6rem;z-index:50;display:flex;flex-direction:column;gap:.4rem;pointer-events:none}
.toast{background:var(--ink);color:#fff;padding:.7rem 1rem;border-radius:12px;box-shadow:0 4px 14px rgba(0,0,0,.25)}
.toast.error{background:var(--red)} .toast.success{background:var(--ok)}

/* المحادثة */
.chat-wrap{display:flex;flex-direction:column;height:calc(100vh - 11.5rem);height:calc(100dvh - 11.5rem)}
.chat-list{flex:1;overflow-y:auto;padding:.2rem 0}
.bubble{max-width:82%;padding:.5rem .8rem;border-radius:16px;margin:.35rem 0;background:#fff;border:1px solid var(--line);overflow-wrap:anywhere;white-space:pre-wrap}
.bubble.mine{margin-inline-start:auto;background:var(--green-3);border-color:#cfe3d4}
.bubble .who{font-size:.78rem;font-weight:700;color:var(--green-2)} .bubble .when{font-size:.7rem;color:var(--muted);margin-top:.1rem}
.composer{display:flex;gap:.5rem;align-items:flex-end;padding-top:.6rem}
.composer textarea{min-height:48px;max-height:120px;resize:none} .composer .btn{width:auto;flex:none}
.offline{background:var(--wait-2);color:var(--wait);text-align:center;padding:.3rem;font-size:.85rem}

/* الصور الشخصية والأشكال الرمزية */
.avatar{border-radius:50%;object-fit:cover;background:#dfe9df;flex:none;display:inline-block;vertical-align:middle}
.avatar.big{display:block;margin:0 auto .5rem;border:3px solid var(--gold)}
.bubble .who{display:flex;align-items:center;gap:.4rem}
.item .avatar{margin-inline-end:.1rem}
.preset-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:.6rem;margin-bottom:.8rem}
.preset{background:#fff;border:1.5px solid var(--line);border-radius:14px;padding:.55rem .3rem;display:flex;flex-direction:column;align-items:center;gap:.3rem;font:inherit;cursor:pointer}
.preset:active{border-color:var(--gold)}
/* شاشة قفل البصمة */
.lock{position:fixed;inset:0;z-index:40;background:linear-gradient(160deg,var(--green),#0b3b1f);color:#fff;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:.8rem;padding:2rem;text-align:center}
.lock .btn{max-width:320px}
.btn.white{background:#fff;color:var(--green)} .btn.line{background:transparent;color:#fff;border:1.5px solid rgba(255,255,255,.7)}
.lock .logo{background:rgba(255,255,255,.12)}

.legal{text-align:center;color:var(--muted);font-size:.78rem;margin:1rem 0 .4rem}

/* تناسق البطاقات المتجاورة */
.grid2{grid-template-columns:repeat(2,minmax(0,1fr));align-items:stretch}
.grid2>.stat{height:100%;min-width:0;min-height:112px;display:flex;flex-direction:column;justify-content:space-between;overflow-wrap:anywhere}
.grid2>.card{height:100%;min-width:0}
.stat .k{min-height:2.7em;display:flex;align-items:flex-start}
.stat .v{margin-top:auto;overflow-wrap:anywhere;word-break:break-word}
.logo{overflow:hidden;background:transparent;border-radius:22px}
.logo img{display:block;width:100%;height:100%;object-fit:contain;border-radius:inherit}

/* ---------- تحسين بصري موحّد للبطاقات والمربعات ---------- */
:root{
  --card-shadow:0 5px 18px rgba(20,83,45,.055),0 1px 3px rgba(20,83,45,.045);
  --card-shadow-hover:0 10px 26px rgba(20,83,45,.10),0 3px 8px rgba(20,83,45,.06);
}
.card,.stat,.choice,.preset{
  border:1px solid #e5eae2;
  box-shadow:var(--card-shadow);
  transition:transform .18s ease,box-shadow .18s ease,border-color .18s ease;
}
.card{
  position:relative;
  border-radius:19px;
  padding:1rem;
  background:linear-gradient(155deg,#fff 0%,#fcfdfb 100%);
  margin-bottom:.9rem;
}
.card:not(.hero)::after{
  content:"";
  position:absolute;
  top:14px;
  inset-inline-start:0;
  width:3px;
  height:30px;
  border-radius:0 5px 5px 0;
  background:linear-gradient(180deg,var(--gold),#dfc77e);
  opacity:.8;
}
.card h2,.card h3{letter-spacing:-.2px}
.card.hero{
  overflow:hidden;
  position:relative;
  padding:1.2rem;
  border-radius:22px;
  background:linear-gradient(130deg,#0e4325 0%,#17683a 58%,#23834a 100%);
  box-shadow:0 10px 25px rgba(20,83,45,.20);
}
.card.hero::before{
  content:"";
  position:absolute;
  width:190px;height:190px;
  border:1px solid rgba(255,255,255,.12);
  border-radius:50%;
  inset-inline-end:-75px;top:-105px;
  box-shadow:0 0 0 22px rgba(255,255,255,.035),0 0 0 46px rgba(255,255,255,.025);
  pointer-events:none;
}
.card.hero .v{font-size:2.15rem;letter-spacing:-1px}
.grid2{gap:.75rem;margin-bottom:.9rem}
.grid2>.stat{
  position:relative;
  min-height:122px;
  padding:.9rem;
  border-radius:18px;
  background:linear-gradient(150deg,#fff 0%,#f8faf7 100%);
  box-shadow:var(--card-shadow);
}
.grid2>.stat::before{
  content:"";
  position:absolute;
  top:0;inset-inline-start:14px;inset-inline-end:14px;
  height:3px;border-radius:0 0 5px 5px;
  background:linear-gradient(90deg,#d9c17b,#b8963e);
  opacity:.8;
}
.stat .k{
  min-height:2.5em;
  color:#707b72;
  font-size:.82rem;
  font-weight:600;
  line-height:1.45;
}
.stat .v{
  margin-top:.5rem;
  color:#203b2a;
  font-size:1.35rem;
  font-weight:800;
  letter-spacing:-.35px;
}
.stat.green .v{color:#168044}
.stat.red .v{color:#c02c2c}
.stat.gold .v{color:#98721e}
.item{
  padding:.85rem .15rem;
  border-bottom:1px solid #edf0eb;
}
.item .t{font-weight:700;color:#26372b}
.badge{
  padding:.22rem .68rem;
  border:1px solid transparent;
  letter-spacing:.05px;
}
.badge.ok{border-color:#d1e8d7}
.badge.debt{border-color:#f5d6d6}
.badge.wait{border-color:#f0e2bc}
.badge.gold{border-color:#eadcb6}
.choice{
  border-radius:18px;
  padding:1rem 1.05rem;
  background:linear-gradient(145deg,#fff,#fafcf9);
}
.choice strong{font-size:1.02rem}
.preset{
  border-radius:16px;
  min-height:94px;
  justify-content:center;
}
.btn{
  border-radius:14px;
  box-shadow:0 2px 5px rgba(20,83,45,.08);
  transition:transform .15s ease,filter .15s ease,box-shadow .15s ease;
}
.btn.primary{background:linear-gradient(135deg,#14532d,#1d7040)}
.btn.gold{background:linear-gradient(135deg,#a98532,#c5a653)}
.btn.danger{background:linear-gradient(135deg,#a91f1f,#c93636)}
input,select,textarea{
  border-color:#dfe6dd;
  border-radius:13px;
  background:#fff;
  box-shadow:inset 0 1px 2px rgba(25,55,32,.025);
}
input:focus,select:focus,textarea:focus{
  outline:3px solid rgba(184,150,62,.16);
  border-color:var(--gold);
}
@media (hover:hover){
  .card:not(.hero):hover,.stat:hover,.choice:hover,.preset:hover{
    transform:translateY(-2px);
    box-shadow:var(--card-shadow-hover);
    border-color:#d6e2d5;
  }
  .btn:hover{filter:brightness(1.04);box-shadow:0 4px 10px rgba(20,83,45,.14)}
}
.btn:active,.choice:active,.preset:active{transform:scale(.985)}
@media(max-width:380px){
  .grid2{gap:.55rem}
  .grid2>.stat{min-height:112px;padding:.75rem}
  .stat .v{font-size:1.18rem}
  .card{padding:.9rem;border-radius:17px}
}
@media(prefers-reduced-motion:reduce){
  *,*::before,*::after{transition:none!important;scroll-behavior:auto!important}
}
