/* معاش — الأنماط */
:root {
  color-scheme: light;
  --page: #edf1ee;
  --surface: #fbfcfb;
  --surface-2: #f3f6f4;
  --ink: #13201c;
  --ink-2: #4b5853;
  --muted: #7d8883;
  --line: #dbe2de;
  --line-strong: #c3ccc7;
  --brand: #0f5e4c;
  --brand-ink: #ffffff;
  --brand-soft: #dcece5;
  --tank: #0f5e4c;
  --tank-fill: #2f8a70;
  --tank-ink: #ffffff;
  --saffron: #e0a226;
  --good: #0b7d3e;
  --good-bg: #e2f1e7;
  --warn: #9a6400;
  --warn-bg: #fbefd2;
  --bad: #b8312f;
  --bad-bg: #f8e1df;
  --topup: #0b7d3e;
  --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a; --s4: #eda100; --s5: #e87ba4; --s6: #008300; --s7: #6250d6; --s8: #e34948;
  --grid: #e3e8e5;
  --shadow: 0 1px 0 rgba(19,32,28,.04), 0 8px 24px -12px rgba(19,32,28,.18);
  --radius: 18px;
  --f-ui: "IBM Plex Sans Arabic", system-ui, -apple-system, "Segoe UI", sans-serif;
  --f-num: "Readex Pro", "IBM Plex Sans Arabic", system-ui, sans-serif;
  --nav-h: 68px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --page: #0a1411;
    --surface: #111e1a;
    --surface-2: #172621;
    --ink: #e8efeb;
    --ink-2: #b2bfb9;
    --muted: #7f8b86;
    --line: #22322d;
    --line-strong: #2f413b;
    --brand: #2fa37f;
    --brand-ink: #04140f;
    --brand-soft: #173a30;
    --tank: #0f3a30;
    --tank-fill: #1e6e58;
    --tank-ink: #f2f8f5;
    --saffron: #f0b13a;
    --good: #4cc77f;
    --good-bg: #12301f;
    --warn: #f0b13a;
    --warn-bg: #33270d;
    --bad: #f07a77;
    --bad-bg: #3a1716;
    --topup: #4cc77f;
    --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500; --s5: #d55181; --s6: #008300; --s7: #9085e9; --s8: #e66767;
    --grid: #1d2b27;
    --shadow: 0 1px 0 rgba(0,0,0,.3), 0 10px 30px -14px rgba(0,0,0,.7);
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--page); color: var(--ink);
  font-family: var(--f-ui); font-size: 16px; line-height: 1.6;
  min-height: 100vh; min-height: 100dvh;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--brand); }
:focus-visible { outline: 2.5px solid var(--saffron); outline-offset: 2px; border-radius: 8px; }
.num { font-family: var(--f-num); font-feature-settings: "tnum" 0; letter-spacing: -.01em; }
.ltr { direction: ltr; unicode-bidi: isolate; display: inline-block; }
.muted { color: var(--muted); }
.hidden { display: none !important; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }

/* ---------- boot */
.boot { min-height: 100vh; display: grid; place-items: center; }
.boot-mark { width: 44px; height: 60px; border-radius: 14px; border: 3px solid var(--brand); position: relative; overflow: hidden; }
.boot-mark::after { content: ""; position: absolute; inset: auto 0 0 0; height: 40%; background: var(--brand); animation: bootfill 1.2s ease-in-out infinite alternate; }
@keyframes bootfill { to { height: 85%; } }

/* ---------- shell */
.shell { max-width: 560px; margin: 0 auto; padding: 0 16px calc(var(--nav-h) + var(--safe-b) + 28px); }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: calc(env(safe-area-inset-top, 0px) + 14px) 0 12px; }
.topbar h1 { font-family: var(--f-num); font-weight: 600; font-size: 22px; margin: 0; letter-spacing: -.01em; }
.topbar .sub { font-size: 13px; color: var(--muted); margin-top: -2px; }
.avatar { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; font-weight: 600; font-size: 15px; color: #fff; border: 0; flex: none; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex: none; }
.c1 { background: var(--s1); } .c2 { background: var(--s2); } .c3 { background: var(--s3); } .c4 { background: var(--s4); }
.c5 { background: var(--s5); } .c6 { background: var(--s6); } .c7 { background: var(--s7); } .c8 { background: var(--s8); }

/* ---------- the tank (hero) */
.tank {
  position: relative; overflow: hidden; border-radius: 30px; background: var(--tank); color: var(--tank-ink);
  min-height: 248px; padding: 22px 22px 20px; isolation: isolate; box-shadow: var(--shadow);
}
.tank-fill {
  position: absolute; inset: auto 0 0 0; height: var(--level, 0%); background: var(--tank-fill); z-index: -1;
  transition: height 1.1s cubic-bezier(.2,.8,.2,1);
}
.tank-fill::before { /* سطح السائل */
  content: ""; position: absolute; left: 0; right: 0; top: -6px; height: 6px;
  background: radial-gradient(ellipse 60% 100% at 50% 100%, var(--tank-fill) 98%, transparent 100%);
  background-size: 140px 6px; background-repeat: repeat-x;
}
.tank.over .tank-fill { display: none; }
.tank.over { background: #5a1f1d; }
@media (prefers-color-scheme: dark) { .tank.over { background: #3d1513; } }
.tank-ideal { position: absolute; inset-inline: 0; bottom: var(--ideal, 0%); height: 0; border-top: 2px solid var(--saffron); z-index: 1; transition: bottom 1.1s cubic-bezier(.2,.8,.2,1); }
.tank-ideal span { position: absolute; inset-inline-end: 14px; top: -24px; font-size: 12px; color: var(--saffron); font-weight: 600; background: rgba(0,0,0,.28); padding: 0 8px; border-radius: 6px; white-space: nowrap; }
.tank-label { font-size: 15px; opacity: .85; }
.tank-amount { font-family: var(--f-num); font-weight: 600; font-size: clamp(52px, 16vw, 76px); line-height: 1.05; letter-spacing: -.03em; margin: 2px 0 0; direction: ltr; text-align: right; }
.tank-amount .frac { font-size: .5em; letter-spacing: 0; opacity: .85; }
.tank-amount small { font-size: 18px; font-weight: 500; letter-spacing: 0; opacity: .8; margin-inline-start: 6px; }
.tank-of { font-size: 14px; opacity: .85; margin-top: 4px; }
.tank-foot { position: absolute; inset: auto 22px 18px 22px; display: flex; justify-content: space-between; align-items: end; gap: 10px; font-size: 13px; }
.tank-foot b { font-family: var(--f-num); font-weight: 600; font-size: 15px; }

/* ---------- today strip */
.today {
  display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 12px;
  margin: 14px 0 0; padding: 14px 18px; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow);
}
.today .t1 { font-size: 14px; color: var(--ink-2); }
.today .t2 { font-family: var(--f-num); font-size: 30px; font-weight: 600; line-height: 1.1; }
.today .t2 small { font-size: 14px; font-weight: 500; color: var(--muted); margin-inline-start: 4px; }
.today .t3 { font-size: 13px; color: var(--muted); }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 999px; font-size: 13px; font-weight: 600; white-space: nowrap; }
.pill.good { background: var(--good-bg); color: var(--good); }
.pill.warn { background: var(--warn-bg); color: var(--warn); }
.pill.bad { background: var(--bad-bg); color: var(--bad); }

/* ---------- sections & lists */
.section { margin-top: 26px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.section-head h2 { font-size: 17px; font-weight: 600; margin: 0; }
.section-head a, .linkbtn { font-size: 14px; color: var(--brand); background: none; border: 0; padding: 4px 0; text-decoration: none; font-weight: 500; }
.panel { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 4px 16px; }
.panel.pad { padding: 16px; }

.people { display: flex; flex-direction: column; }
.person { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.person:last-child { border-bottom: 0; }
.person .amt { font-family: var(--f-num); font-weight: 600; }
.person .bar { grid-column: 2 / 4; height: 4px; background: var(--surface-2); border-radius: 4px; overflow: hidden; margin-top: -4px; }
.person .bar i { display: block; height: 100%; border-radius: 4px; }

.entries { list-style: none; margin: 0; padding: 0; }
.entry { display: grid; grid-template-columns: 42px 1fr auto; gap: 12px; align-items: center; padding: 11px 0; border-bottom: 1px solid var(--line); background: none; border-inline: 0; border-top: 0; width: 100%; text-align: start; }
.entry:last-child { border-bottom: 0; }
.entry .ico { width: 42px; height: 42px; border-radius: 13px; background: var(--surface-2); display: grid; place-items: center; font-size: 21px; position: relative; }
.entry .ico .dot { position: absolute; bottom: -1px; inset-inline-end: -1px; width: 12px; height: 12px; border: 2px solid var(--surface); }
.entry .t { min-width: 0; }
.entry .t1, .entry .t2 { display: block; }
.entry .t1 { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.entry .t2 { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.entry .a { font-family: var(--f-num); font-weight: 600; font-size: 17px; direction: ltr; }
.entry.topup .a { color: var(--topup); }
.entry.topup .ico { background: var(--good-bg); }
.day-head { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); padding: 16px 4px 6px; font-weight: 500; }
.day-head b { font-family: var(--f-num); font-weight: 500; color: var(--ink-2); }

.empty { text-align: center; padding: 34px 16px; color: var(--muted); }
.empty .big { font-size: 40px; display: block; margin-bottom: 4px; }
.empty b { color: var(--ink); display: block; font-size: 17px; margin-bottom: 2px; }

/* ---------- filters / period nav */
.period-nav { display: flex; align-items: center; justify-content: space-between; gap: 8px; background: var(--surface); border-radius: 999px; padding: 4px; box-shadow: var(--shadow); }
.period-nav button { width: 40px; height: 40px; border-radius: 50%; border: 0; background: var(--surface-2); font-size: 20px; line-height: 1; }
.period-nav button:disabled { opacity: .35; }
.period-nav .lbl { font-weight: 600; text-align: center; flex: 1; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 12px 0 2px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; border: 1px solid var(--line-strong); background: var(--surface); border-radius: 999px; padding: 6px 14px; font-size: 14px; display: inline-flex; align-items: center; gap: 6px; }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--page); border-color: var(--ink); }

/* ---------- stats */
.kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }
.kpi { background: var(--surface); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.kpi .l { font-size: 13px; color: var(--ink-2); }
.kpi .v { font-family: var(--f-num); font-weight: 600; font-size: 24px; line-height: 1.25; direction: ltr; text-align: right; }
.kpi .d { font-size: 12.5px; color: var(--muted); }
.insights { list-style: none; padding: 0; margin: 0; }
.insight { display: grid; grid-template-columns: 30px 1fr; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--line); align-items: start; font-size: 15px; }
.insight:last-child { border-bottom: 0; }
.insight .i { font-size: 20px; line-height: 1.4; }
.insight.bad { color: var(--bad); }
.insight.warn { color: var(--ink); }
.insight.warn .i { filter: none; }
.insight .tag { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-inline-end: 6px; vertical-align: middle; }

.chart { width: 100%; height: auto; display: block; overflow: visible; }
.chart text { font-family: var(--f-ui); fill: var(--muted); font-size: 11px; }
.chart .grid { stroke: var(--grid); stroke-width: 1; }
.chart .base { stroke: var(--line-strong); stroke-width: 1; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 13px; color: var(--ink-2); margin: 4px 0 8px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend .sw { width: 16px; height: 0; border-top: 2px solid; }
.legend .sw.dash { border-top-style: dashed; }
.chart-tip { position: fixed; pointer-events: none; z-index: 60; background: var(--ink); color: var(--page); padding: 7px 10px; border-radius: 10px; font-size: 13px; line-height: 1.45; box-shadow: var(--shadow); max-width: 220px; transform: translate(-50%, calc(-100% - 12px)); }
.chart-tip b { font-family: var(--f-num); }

.hbars { display: flex; flex-direction: column; }
.hbar { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; padding: 10px 0; border-bottom: 1px solid var(--line); background: none; border-inline: 0; border-top: 0; text-align: start; width: 100%; }
.hbar:last-child { border-bottom: 0; }
.hbar .n { font-size: 15px; }
.hbar .v { font-family: var(--f-num); font-weight: 600; direction: ltr; }
.hbar .track { grid-column: 1 / 3; height: 8px; position: relative; background: var(--surface-2); border-radius: 4px; }
.hbar .track i { position: absolute; inset-block: 0; inset-inline-start: 0; background: var(--s1); border-radius: 4px; }
.hbar .track i.over { background: var(--bad); }
.hbar .track .lim { position: absolute; top: -4px; bottom: -4px; width: 2px; background: var(--ink); border-radius: 2px; }
.hbar .meta { grid-column: 1 / 3; font-size: 12.5px; color: var(--muted); }

.table-toggle { margin-top: 6px; }
table.data { width: 100%; border-collapse: collapse; font-size: 14px; }
table.data th, table.data td { padding: 7px 4px; border-bottom: 1px solid var(--line); text-align: start; }
table.data td.n { font-family: var(--f-num); direction: ltr; text-align: end; font-variant-numeric: tabular-nums; }
table.data th { color: var(--muted); font-weight: 500; font-size: 13px; }

/* ---------- bottom nav */
.nav {
  position: fixed; inset: auto 0 0 0; z-index: 30; height: calc(var(--nav-h) + var(--safe-b)); padding-bottom: var(--safe-b);
  background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--line); display: grid; grid-template-columns: repeat(5, 1fr); align-items: center; max-width: 100%;
}
.nav a, .nav button.tab { display: flex; flex-direction: column; align-items: center; gap: 1px; font-size: 11.5px; color: var(--muted); text-decoration: none; background: none; border: 0; padding: 6px 0; }
.nav a svg { width: 24px; height: 24px; }
.nav a[aria-current="page"] { color: var(--brand); font-weight: 600; }
.nav .add {
  justify-self: center; width: 62px; height: 62px; border-radius: 22px; border: 0; margin-top: -22px;
  background: var(--brand); color: var(--brand-ink); display: grid; place-items: center; box-shadow: 0 10px 22px -8px color-mix(in srgb, var(--brand) 70%, transparent);
}
.nav .add svg { width: 30px; height: 30px; }
.nav .add:active { transform: scale(.96); }

/* ---------- buttons & forms */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 20px; border-radius: 14px; border: 1px solid var(--line-strong); background: var(--surface); font-weight: 600; text-decoration: none; color: var(--ink); }
.btn-primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn-danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 40%, transparent); background: transparent; }
.btn-ghost { background: transparent; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .5; }
.btn-row { display: flex; gap: 10px; margin-top: 14px; }
.btn-row .btn { flex: 1; }
.form fieldset { border: 0; padding: 0; margin: 0 0 18px; }
.form legend { font-weight: 600; font-size: 16px; margin-bottom: 8px; padding: 0; }
.form label { display: block; font-size: 14px; color: var(--ink-2); margin-bottom: 12px; }
.form input:not([type=radio]):not([type=checkbox]), .form select, .form textarea {
  display: block; width: 100%; margin-top: 5px; min-height: 48px; padding: 10px 14px; border-radius: 12px;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); font-size: 16px;
}
.form input:focus, .form select:focus { outline: 2px solid var(--brand); outline-offset: 0; border-color: transparent; }
.form label.radio, .form label.check { display: flex; gap: 10px; align-items: center; color: var(--ink); font-size: 15px; }
.form .two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.hint { font-size: 13px; color: var(--muted); }
.alert { padding: 11px 14px; border-radius: 12px; margin: 0 0 12px; font-size: 14.5px; }
.alert.bad { background: var(--bad-bg); color: var(--bad); }
.alert.good { background: var(--good-bg); color: var(--good); }
.alert.warn { background: var(--warn-bg); color: var(--warn); }

/* ---------- login */
.login { max-width: 400px; margin: 0 auto; padding: 12vh 22px 40px; }
.login .mark { width: 56px; height: 76px; border-radius: 18px; border: 3.5px solid var(--brand); position: relative; overflow: hidden; margin-bottom: 18px; }
.login .mark::after { content: ""; position: absolute; inset: auto 0 0 0; height: 62%; background: var(--brand); }
.login h1 { font-family: var(--f-num); font-weight: 600; font-size: 34px; margin: 0; }
.login p.lead { color: var(--ink-2); margin: 4px 0 26px; }

/* ---------- sheet */
.sheet-backdrop { position: fixed; inset: 0; z-index: 50; background: rgba(5,12,10,.42); animation: fade .18s ease-out; }
.sheet {
  position: fixed; inset: auto 0 0 0; z-index: 51; max-width: 560px; margin: 0 auto; background: var(--surface);
  border-radius: 26px 26px 0 0; padding: 8px 18px calc(18px + var(--safe-b)); max-height: 94vh; max-height: 94dvh; overflow-y: auto;
  animation: up .26s cubic-bezier(.2,.8,.2,1); overscroll-behavior: contain;
}
.sheet .grab { width: 40px; height: 5px; border-radius: 3px; background: var(--line-strong); margin: 0 auto 10px; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.sheet-head h3 { margin: 0; font-size: 19px; font-weight: 600; }
.sheet-head .x { width: 38px; height: 38px; border-radius: 50%; border: 0; background: var(--surface-2); font-size: 18px; }
@keyframes up { from { transform: translateY(100%); } }
@keyframes fade { from { opacity: 0; } }

/* ---------- add flow */
.amount-display { text-align: center; padding: 6px 0 4px; }
.amount-display .v { font-family: var(--f-num); font-weight: 600; font-size: 60px; line-height: 1.1; letter-spacing: -.03em; direction: ltr; min-height: 66px; }
.amount-display .v.zero { color: var(--line-strong); }
.amount-display .c { color: var(--muted); font-size: 15px; }
.amount-display .after { font-size: 13.5px; color: var(--ink-2); min-height: 22px; }
.amount-display .after.bad { color: var(--bad); }
.quick { display: flex; justify-content: center; gap: 8px; margin: 10px 0 12px; flex-wrap: wrap; }
.quick button { border: 1px solid var(--line-strong); background: var(--surface); border-radius: 999px; padding: 6px 14px; font-family: var(--f-num); font-weight: 500; }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; direction: ltr; }
.keypad button { height: 58px; border: 0; border-radius: 16px; background: var(--surface-2); font-family: var(--f-num); font-size: 26px; font-weight: 500; }
.keypad button:active { background: var(--line); }
.cats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 10px; }
.cat { border: 1.5px solid transparent; background: var(--surface-2); border-radius: 18px; padding: 14px 6px 10px; display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 14px; line-height: 1.3; min-height: 92px; text-align: center; }
.cat .e { font-size: 30px; line-height: 1; }
.cat[aria-pressed="true"] { border-color: var(--brand); background: var(--brand-soft); }
.cat:active { transform: scale(.97); }
.step-amount { display: inline-flex; align-items: center; gap: 8px; background: var(--brand-soft); color: var(--ink); padding: 6px 14px; border-radius: 999px; font-family: var(--f-num); font-weight: 600; font-size: 18px; border: 0; }
.whenrow { display: flex; gap: 8px; margin-top: 12px; align-items: center; flex-wrap: wrap; }
.note-in { width: 100%; min-height: 46px; padding: 10px 14px; border-radius: 12px; border: 1px solid var(--line-strong); background: var(--surface); margin-top: 12px; font-size: 16px; }

/* ---------- toast */
#toast-root { position: fixed; inset: auto 12px calc(var(--nav-h) + var(--safe-b) + 14px) 12px; z-index: 70; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; }
.toast { pointer-events: auto; background: var(--ink); color: var(--page); border-radius: 14px; padding: 12px 14px 12px 12px; display: flex; align-items: center; gap: 14px; max-width: 520px; width: 100%; box-shadow: var(--shadow); animation: up .22s ease-out; font-size: 15px; }
.toast .msg { flex: 1; }
.toast button { background: none; border: 0; color: var(--saffron); font-weight: 600; padding: 4px 6px; }
.toast.error { background: var(--bad); color: #fff; }

/* ---------- settings */
.list-rows { display: flex; flex-direction: column; }
.row { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; padding: 13px 0; border-bottom: 1px solid var(--line); background: none; border-inline: 0; border-top: 0; text-align: start; width: 100%; }
.row:last-child { border-bottom: 0; }
.row .r1 { font-weight: 500; }
.row .r2 { font-size: 13px; color: var(--muted); }
.row .chev { color: var(--muted); font-size: 18px; }
.row .e { font-size: 22px; width: 34px; text-align: center; }
.copybox { display: flex; gap: 8px; align-items: stretch; margin: 10px 0; }
.copybox input { flex: 1; min-width: 0; font-size: 13px !important; direction: ltr; }
.swatches { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 6px; }
.swatches button { width: 34px; height: 34px; border-radius: 50%; border: 3px solid transparent; }
.swatches button[aria-pressed="true"] { border-color: var(--ink); }
.emoji-pick { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.emoji-pick button { width: 42px; height: 42px; border-radius: 12px; border: 1.5px solid transparent; background: var(--surface-2); font-size: 22px; }
.emoji-pick button[aria-pressed="true"] { border-color: var(--brand); }
.install-tip { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: start; background: var(--brand-soft); border-radius: var(--radius); padding: 14px 16px; margin-top: 14px; font-size: 14px; }
.install-tip b { display: block; font-size: 15px; }
.install-tip button { border: 0; background: none; font-size: 18px; color: var(--muted); }

/* ---------- installer page */
.install-body { background: var(--page); }
.install { max-width: 520px; margin: 0 auto; padding: 40px 18px 60px; }
.install-title { font-family: var(--f-num); font-weight: 600; font-size: 30px; margin: 0 0 6px; }
.install-lead { color: var(--ink-2); margin: 0 0 22px; }
.install .form { background: var(--surface); padding: 20px; border-radius: var(--radius); box-shadow: var(--shadow); }
.install .mysql-fields { display: none; padding-top: 4px; }
.install form:has(input[value=mysql]:checked) .mysql-fields { display: block; }
code { background: var(--surface-2); padding: 1px 6px; border-radius: 6px; font-size: 13px; }

/* ---------- v1.1: الظروف */
.envs { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.env { display: flex; flex-direction: column; gap: 2px; text-align: start; background: var(--surface); border: 0; border-radius: var(--radius); padding: 12px 14px; box-shadow: var(--shadow); }
.env-h { font-size: 14px; color: var(--ink-2); display: flex; align-items: center; gap: 6px; }
.env-i { font-size: 18px; }
.env-v { font-family: var(--f-num); font-weight: 600; font-size: 24px; line-height: 1.2; }
.env-v small { font-family: var(--f-ui); font-size: 13px; font-weight: 500; color: var(--muted); }
.env-bar { height: 6px; border-radius: 4px; background: var(--surface-2); overflow: hidden; margin: 4px 0 2px; }
.env-bar i { display: block; height: 100%; background: var(--brand); border-radius: 4px; }
.env-d { font-size: 12.5px; color: var(--muted); }
.env.over .env-v { color: var(--bad); }

/* ---------- v1.1: بطاقة الالتزامات في الرئيسية */
.plan-card { display: grid; grid-template-columns: auto 1fr auto; gap: 14px; align-items: center; margin-top: 14px; padding: 14px 16px; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); color: var(--ink); text-decoration: none; }
.pc-ring { width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; background: conic-gradient(var(--brand) calc(var(--p) * 1%), var(--surface-2) 0); position: relative; }
.pc-ring::before { content: ""; position: absolute; inset: 5px; border-radius: 50%; background: var(--surface); }
.pc-ring b { position: relative; font-family: var(--f-num); font-size: 15px; font-weight: 600; direction: ltr; }
.pc-t { display: block; font-weight: 600; }
.pc-s { display: block; font-size: 13.5px; color: var(--muted); }
.plan-card .chev { color: var(--muted); font-size: 18px; }

/* ---------- v1.1: رحلة الراتب */
.flow-top { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 10px; }
.flow-top b { font-family: var(--f-num); font-size: 26px; font-weight: 600; }
.flow-top small { font-size: 14px; color: var(--muted); font-weight: 500; }
.flow-bar { display: flex; gap: 2px; height: 22px; border-radius: 8px; overflow: hidden; }
.flow-bar i { display: block; min-width: 4px; }
.s1 { background: var(--s1); } .s2 { background: var(--s2); } .s3 { background: var(--s3); } .s4 { background: var(--s4); }
.free { background: repeating-linear-gradient(135deg, var(--surface-2) 0 6px, var(--line) 6px 8px); }
.flow-legend { list-style: none; margin: 12px 0 0; padding: 0; }
.flow-legend li { display: grid; grid-template-columns: 14px 1fr auto 44px; gap: 10px; align-items: center; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 15px; }
.flow-legend li:last-child { border-bottom: 0; }
.flow-legend .sw { width: 14px; height: 14px; border-radius: 4px; }
.flow-legend b { font-family: var(--f-num); font-weight: 600; direction: ltr; }
.flow-legend .muted { font-size: 13px; text-align: end; }
.flow-legend li.neg span:nth-child(2), .flow-legend li.neg b { color: var(--bad); }

/* ---------- v1.1: قائمة يوم الراتب */
.checks { list-style: none; margin: 0; padding: 0; }
.check { display: grid; grid-template-columns: 28px 30px 1fr auto; gap: 10px; align-items: center; width: 100%; padding: 12px 0; background: none; border: 0; border-bottom: 1px solid var(--line); text-align: start; color: var(--ink); }
.checks li:last-child .check { border-bottom: 0; }
.check:disabled { cursor: default; opacity: 1; }
.check .box { width: 26px; height: 26px; border-radius: 8px; border: 2px solid var(--line-strong); display: grid; place-items: center; font-weight: 700; color: var(--brand-ink); font-size: 15px; }
.check.done .box { background: var(--brand); border-color: var(--brand); }
.check .ci { font-size: 22px; text-align: center; }
.check .ck1 { display: block; font-weight: 500; }
.check .ck2 { display: block; font-size: 13px; color: var(--muted); }
.check .ca { font-weight: 600; direction: ltr; }
.check.done .ck1, .check.done .ca { color: var(--muted); }
.check.done .ck1 { text-decoration: line-through; text-decoration-color: var(--line-strong); }

/* ---------- v1.1: الحصّالات */
.funds { display: flex; flex-direction: column; gap: 12px; }
.fund { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; }
.fund.soon { outline: 2px solid var(--saffron); outline-offset: -2px; }
.fund-h { display: flex; align-items: center; gap: 8px; }
.fund-i { font-size: 22px; }
.fund-n { font-weight: 600; flex: 1; }
.fund-v { margin-top: 6px; }
.fund-v b { font-family: var(--f-num); font-size: 30px; font-weight: 600; }
.fund-bar { height: 10px; border-radius: 6px; background: var(--surface-2); overflow: hidden; margin: 8px 0; }
.fund-bar i { display: block; height: 100%; background: var(--saffron); border-radius: 6px; }
.fund-d { font-size: 13.5px; color: var(--ink-2); }
.fund-s { font-size: 14px; margin-top: 4px; font-weight: 500; }
.fund-s .ok { color: var(--good); }
.fund-s .bad { color: var(--bad); }
.months { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.months .chip { padding: 5px 10px; font-size: 13px; }

/* ---------- v1.1: اقتراح الحدود */
.sug { display: grid !important; grid-template-columns: auto auto 1fr 90px; gap: 10px; align-items: center; padding: 10px 0; margin: 0 !important; border-bottom: 1px solid var(--line); color: var(--ink) !important; }
.sug .e { font-size: 20px; }
.sug .r1 { font-weight: 500; font-size: 15px; }
.sug .r2 { font-size: 12.5px; color: var(--muted); }
.form .sug-in { margin-top: 0 !important; min-height: 40px !important; padding: 6px 10px !important; }

.tank-ideal.below span { top: 6px; }
.tank { min-height: 230px; }
.tank-meta { display: flex; justify-content: space-between; gap: 10px; padding: 10px 6px 0; font-size: 14px; color: var(--ink-2); }
.tank-meta b { font-family: var(--f-num); font-weight: 600; color: var(--ink); }

/* ---------- v1.3: السلف + شريط التنقل على الشاشات العريضة */
.loan-line { display: flex; justify-content: space-between; gap: 10px; align-items: start; margin-top: 8px; padding: 10px 12px; border-radius: 12px; background: var(--warn-bg); font-size: 13.5px; line-height: 1.6; }
.loan-line .muted { font-size: 12.5px; }
.btn-row.wrap { flex-wrap: wrap; }
.btn-row.wrap .btn { flex: 1 1 auto; padding: 0 14px; }
.nav { max-width: 560px; margin: 0 auto; }
@media (min-width: 600px) { .nav { border-inline: 1px solid var(--line); border-radius: 18px 18px 0 0; } }
