@font-face {
  font-family: Tajawal;
  src: url("../fonts/tajawal-arabic-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-089F, U+08A0-08FF, U+FB50-FDFF, U+FE70-FEFF;
}
@font-face {
  font-family: Tajawal;
  src: url("../fonts/tajawal-latin-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+2000-206F;
}
@font-face {
  font-family: Tajawal;
  src: url("../fonts/tajawal-arabic-500.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-089F, U+08A0-08FF, U+FB50-FDFF, U+FE70-FEFF;
}
@font-face {
  font-family: Tajawal;
  src: url("../fonts/tajawal-latin-500.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+2000-206F;
}
@font-face {
  font-family: Tajawal;
  src: url("../fonts/tajawal-arabic-700.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-089F, U+08A0-08FF, U+FB50-FDFF, U+FE70-FEFF;
}
@font-face {
  font-family: Tajawal;
  src: url("../fonts/tajawal-latin-700.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+2000-206F;
}
@font-face {
  font-family: Tajawal;
  src: url("../fonts/tajawal-arabic-800.woff2") format("woff2");
  font-weight: 800;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-089F, U+08A0-08FF, U+FB50-FDFF, U+FE70-FEFF;
}
@font-face {
  font-family: Tajawal;
  src: url("../fonts/tajawal-latin-800.woff2") format("woff2");
  font-weight: 800;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+2000-206F;
}

:root {
  --paper: #f3eee6;
  --paper-deep: #e4d9c8;
  --card: #fffdf9;
  --ink: #1f1a16;
  --muted: #6a6158;
  --line: #e4d9c8;
  --gold: #a68456;
  --green: #1a6240;
  --green-soft: #e8f3ec;
  --clay: #9c3a2c;
  --clay-soft: #f8ebe6;
  --shadow: 0 16px 40px rgba(48, 32, 16, 0.07);
  --radius: 22px;
}

* { box-sizing: border-box; }
html { height: 100%; }
::selection { background: #d7ebdf; color: var(--ink); }
body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(880px 380px at 100% -10%, #fffaf2 0%, transparent 60%),
    radial-gradient(640px 320px at 0% 110%, #eadfcf 0%, transparent 55%),
    var(--paper);
  color: var(--ink);
  font-family: Tajawal, "Segoe UI", Tahoma, sans-serif;
  font-size: 16.5px;
  line-height: 1.55;
}
main {
  padding: 4px 16px calc(104px + env(safe-area-inset-bottom));
  max-width: 720px;
}
h1, h2, h3, p { margin: 0; }
h2 {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1.12rem;
  font-weight: 800;
  margin-bottom: 12px;
}
.card > h2::before,
.sheet > h2::before {
  content: "";
  width: 18px;
  height: 2px;
  border-radius: 99px;
  background: var(--gold);
  flex: 0 0 auto;
}
.eyebrow {
  margin: 0 0 2px;
  color: var(--green);
  font-size: 0.8rem;
  font-weight: 800;
}
h3 { font-size: 1rem; font-weight: 700; margin: 16px 0 8px; }
a { color: var(--green); }
button, input, select, textarea { font: inherit; color: inherit; }
img, svg { display: block; }

.topbar {
  position: static;
  z-index: 1;
  background: transparent;
  padding: 18px 16px 8px;
}
.topbar h1 { font-size: 1.45rem; font-weight: 800; letter-spacing: 0; }

.tabbar {
  position: fixed;
  z-index: 20;
  right: 0;
  left: 0;
  bottom: 0;
  display: flex;
  background: rgba(255, 253, 248, 0.94);
  backdrop-filter: blur(16px);
  border-top: 1px solid var(--line);
  box-shadow: 0 -10px 28px rgba(60, 40, 20, 0.05);
  padding-bottom: env(safe-area-inset-bottom);
  height: calc(68px + env(safe-area-inset-bottom));
}
.brand { display: none; }
.tabbar a {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 48px;
  text-decoration: none;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}
.tabbar a svg { width: 22px; height: 22px; }
.tabbar a.is-active { color: var(--green); }
.tabbar a.is-active span {
  background: var(--green-soft);
  border-radius: 999px;
  padding: 1px 8px;
}

.card {
  background: var(--card);
  border: 1px solid rgba(166, 132, 86, 0.22);
  border-radius: var(--radius);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9), var(--shadow);
  padding: 20px 18px;
  margin: 0 0 14px;
}
.tx:has(.figure.is-in),
.tx:has(.figure.is-ok) { box-shadow: var(--shadow), inset -3px 0 0 var(--green); }
.tx:has(.figure.is-out),
.tx:has(.figure.is-bad) { box-shadow: var(--shadow), inset -3px 0 0 var(--clay); }
.hero { padding: 20px 18px 18px; }
.hero-num, .figure { font-variant-numeric: tabular-nums; }
.hero-num {
  font-size: 2.65rem;
  font-weight: 800;
  line-height: 1.12;
  margin: 6px 0 10px;
  letter-spacing: 0;
}
.hero:first-of-type.is-ok,
.hero:first-of-type.is-bad {
  border: 0;
  color: #f7f3ea;
  box-shadow: 0 16px 34px rgba(36, 31, 26, 0.1);
}
.hero:first-of-type.is-ok { background: var(--green); }
.hero:first-of-type.is-bad { background: var(--clay); }
.hero:first-of-type.is-ok .stat-label,
.hero:first-of-type.is-ok .muted,
.hero:first-of-type.is-bad .stat-label,
.hero:first-of-type.is-bad .muted { color: rgba(247, 243, 234, 0.86); }
.hero:first-of-type.is-ok .hero-num,
.hero:first-of-type.is-bad .hero-num,
.hero:first-of-type .text-link { color: #fff; }
.hero:first-of-type .switch { margin-top: 12px; }
.hero:first-of-type .switch-btn {
  background: transparent;
  color: #fff;
  border-color: rgba(255, 255, 255, 0.38);
}
.hero:first-of-type .switch-btn.is-active {
  background: #fff;
  color: var(--ink);
  border-color: #fff;
}
.hero.is-ok:not(:first-of-type) { background: var(--green-soft); border-color: transparent; }
.hero.is-bad:not(:first-of-type) { background: var(--clay-soft); border-color: transparent; }
.surplus.is-ok { background: var(--green-soft); border-color: transparent; }
.surplus.is-bad { background: var(--clay-soft); border-color: transparent; }
.date-line {
  color: var(--muted);
  margin: 2px 0 12px;
  font-weight: 500;
}
.stat-label { color: var(--muted); font-size: 0.92rem; margin-bottom: 2px; }
.figure {
  font-size: 1.45rem;
  font-weight: 800;
  line-height: 1.25;
  margin: 2px 0;
}
.lead { font-weight: 700; margin-bottom: 4px; }
.muted { color: var(--muted); font-size: 0.95rem; margin-top: 4px; }
.sub { font-weight: 800; margin-top: 2px; }
.is-ok, .is-in { color: var(--green); }
.is-bad, .is-out { color: var(--clay); }
.is-zero { color: var(--ink); }
.hero.is-ok .hero-num, .surplus.is-ok .figure { color: var(--green); }
.hero.is-bad .hero-num, .surplus.is-bad .figure, .surplus.is-bad .sub { color: var(--clay); }
.stack-line {
  padding: 12px 0;
  border-top: 1px solid var(--line);
}
.stack-line:first-of-type { border-top: 0; }
.board .stack-line:first-of-type { border-top: 1px solid var(--line); }

.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 52px;
  margin-top: 12px;
  border-radius: 14px;
  border: 0;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.btn-primary {
  background: var(--green);
  color: #fff;
  box-shadow: 0 8px 18px rgba(27, 107, 67, 0.18);
}
.btn-ghost {
  background: var(--card);
  color: var(--ink);
  border: 1px solid var(--line);
}
.btn-line { background: rgba(255, 253, 248, 0.72); color: var(--ink); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.6; }
.action-stack { margin-bottom: 12px; }
.quick-grid { display: grid; gap: 8px; }
.quick-grid.two { grid-template-columns: 1fr 1fr; margin-bottom: 12px; }
.quick-grid.two .btn { margin-top: 0; }
.metric-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 12px;
}
.metric-grid.inside { margin: 8px 0 4px; }
.metric {
  background: var(--card);
  border: 1px solid rgba(36, 31, 26, 0.06);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 14px 14px 14px 12px;
}
.metric:has(.figure.is-ok) { box-shadow: var(--shadow), inset -3px 0 0 var(--green); }
.metric:has(.figure.is-bad) { box-shadow: var(--shadow), inset -3px 0 0 var(--clay); }
.metric .figure { font-size: 1.15rem; }
.trend { padding-top: 14px; border-top: 1px solid var(--line); }
.trend:first-of-type { border-top: 0; padding-top: 0; }
@media (max-width: 420px) {
  .hero-num { font-size: 2.05rem; }
}
.text-link { display: inline-block; margin-top: 8px; font-weight: 700; text-decoration: none; }
.page-links { margin: 0 0 12px; }

label { display: block; margin: 14px 0 6px; font-weight: 700; font-size: 0.95rem; }
input, select, textarea {
  width: 100%;
  min-height: 50px;
  padding: 10px 14px;
  border: 1px solid #ddd4c6;
  border-radius: 14px;
  background: #fffcf8;
}
textarea { min-height: 96px; resize: vertical; }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(27, 107, 67, 0.16);
}
button:focus-visible, a:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 2px;
}
.check { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.check input { width: 22px; height: 22px; min-height: 0; }

.fold { margin-top: 8px; }
.fold summary {
  min-height: 44px;
  display: flex;
  align-items: center;
  cursor: pointer;
  font-weight: 700;
  color: var(--muted);
}
.badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 700;
}
.badge-ok { background: var(--green-soft); color: var(--green); }
.badge-bad { background: var(--clay-soft); color: var(--clay); }
.badge-wait { background: var(--paper); color: var(--muted); }
.pay {
  padding: 12px 0;
  border-top: 1px solid var(--line);
}

.bar {
  height: 10px;
  background: #efe8dc;
  border-radius: 999px;
  overflow: hidden;
  margin-top: 8px;
}
.bar > span { display: block; height: 100%; background: var(--green); }
.bar.is-bad > span { background: var(--clay); }

.switch { display: flex; gap: 8px; margin-bottom: 4px; }
.switch-btn {
  flex: 1;
  min-height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  border: 1px solid var(--line);
  text-decoration: none;
  color: var(--ink);
  font-weight: 700;
  background: #fff;
}
.switch-btn.is-active { background: var(--green); color: #fff; border-color: var(--green); }

.chart {
  display: flex;
  align-items: flex-end;
  gap: 28px;
  height: 160px;
  margin: 8px 0 12px;
}
.chart .col {
  flex: 1;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}
.chart .fill { width: min(72px, 100%); border-radius: 12px 12px 4px 4px; }
.chart .fill.in { background: var(--green); }
.chart .fill.out { background: var(--clay); }

.legend {
  display: flex;
  gap: 16px;
  margin: 0 0 12px;
  color: var(--muted);
  font-weight: 700;
  font-size: 0.92rem;
}
.swatch {
  display: inline-block;
  width: 12px;
  height: 12px;
  margin-inline-end: 6px;
  border-radius: 4px;
  vertical-align: -1px;
}
.swatch.in { background: var(--green); }
.swatch.out { background: var(--clay); }
.plot {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: 168px;
  margin: 4px 0 8px;
  direction: ltr;
}
.plot-col {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  height: 100%;
}
.plot-bars {
  flex: 1;
  width: 100%;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 3px;
}
.plot-bar {
  width: 11px;
  min-height: 3px;
  border-radius: 6px 6px 2px 2px;
}
.plot-bar.in { background: var(--green); }
.plot-bar.out { background: var(--clay); }
.plot-label {
  margin-top: 8px;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--muted);
  line-height: 1.2;
  text-align: center;
}
.netplot {
  display: flex;
  align-items: stretch;
  gap: 6px;
  margin: 8px 0 4px;
  direction: ltr;
}
.net-col {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.net-up, .net-down {
  width: 100%;
  height: 72px;
  display: flex;
  justify-content: center;
}
.net-up { align-items: flex-end; }
.net-down { align-items: flex-start; border-top: 1px solid var(--line); }
.net-up span, .net-down span {
  display: block;
  width: 14px;
  border-radius: 6px;
}
.net-up span { background: var(--green); border-radius: 6px 6px 2px 2px; }
.net-down span { background: var(--clay); border-radius: 2px 2px 6px 6px; }
.split {
  display: flex;
  height: 14px;
  border-radius: 99px;
  overflow: hidden;
  background: #efe8dc;
  margin: 10px 0 4px;
  direction: ltr;
}
.split span { display: block; height: 100%; }
.split .in { background: var(--green); }
.split .out { background: var(--clay); }

.flash {
  border-radius: 14px;
  padding: 12px 14px;
  margin-bottom: 12px;
  font-weight: 700;
}
.flash.is-ok { background: var(--green-soft); color: var(--green); }
.flash.is-bad { background: var(--clay-soft); color: var(--clay); }
.toast {
  position: fixed;
  z-index: 60;
  top: 12px;
  left: 12px;
  right: 12px;
  background: var(--green);
  color: #fff;
  border-radius: 14px;
  padding: 12px 14px;
  text-align: center;
  font-weight: 700;
}
.toast.is-bad { background: var(--clay); }

.sheet-back {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(36, 28, 20, 0.38);
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.sheet-back[hidden] { display: none; }
.sheet {
  width: min(560px, 100%);
  max-height: 92vh;
  overflow: auto;
  background: var(--card);
  border-radius: 24px 24px 0 0;
  padding: 12px 16px calc(18px + env(safe-area-inset-bottom));
  box-shadow: 0 -16px 40px rgba(36, 31, 26, 0.12);
}
.sheet::before {
  content: "";
  display: block;
  width: 42px;
  height: 4px;
  margin: 2px auto 14px;
  border-radius: 99px;
  background: var(--line);
}
.dest-panel[hidden] { display: none; }

.pager { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 16px; }
.pager a {
  min-width: 40px;
  min-height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: var(--card);
  text-decoration: none;
  font-weight: 700;
}
.pager a.is-active { background: var(--green); color: #fff; }

.link-list a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 54px;
  border-top: 1px solid var(--line);
  text-decoration: none;
  font-weight: 700;
}
.link-list a::after {
  content: "‹";
  color: var(--muted);
  font-size: 1.35rem;
  font-weight: 400;
  line-height: 1;
}
.link-list a:first-of-type { border-top: 0; }
.menu-grid {
  display: grid;
  gap: 10px;
  margin: 0 0 16px;
}
.menu-grid a {
  display: block;
  background: var(--card);
  border: 1px solid rgba(166, 132, 86, 0.22);
  border-radius: 18px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9), var(--shadow);
  padding: 16px 16px 14px;
  text-decoration: none;
  color: var(--ink);
}
.menu-grid a strong {
  display: block;
  margin-top: 2px;
  font-size: 1.08rem;
  font-weight: 800;
}
.menu-grid a small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 500;
}
.menu-kicker {
  color: var(--gold);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.02em;
}
.inline-form { padding-top: 8px; border-top: 1px solid var(--line); }

.auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}
.auth-card { width: min(440px, 100%); padding: 28px 22px 22px; }
.brand-mark { font-size: 2.2rem; font-weight: 800; margin-bottom: 8px; color: var(--green); }
.brand-mark::after {
  content: "";
  display: block;
  width: 36px;
  height: 3px;
  margin-top: 10px;
  border-radius: 99px;
  background: var(--green);
}
body.no-nav main { padding: 0; max-width: none; }

@media (min-width: 960px) {
  body:not(.no-nav) {
    display: grid;
    grid-template-columns: 272px minmax(0, 1fr);
    grid-template-rows: auto 1fr;
    max-width: none;
    min-height: 100vh;
  }
  .tabbar {
    position: sticky;
    top: 0;
    grid-column: 1;
    grid-row: 1 / span 2;
    height: 100vh;
    flex-direction: column;
    align-items: stretch;
    border-top: 0;
    border-inline-end: 1px solid var(--line);
    background: var(--card);
    box-shadow: none;
    padding: 22px 16px;
  }
  .brand {
    display: block;
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--green);
    padding: 8px 12px 18px;
  }
  .tabbar a {
    flex: 0 0 auto;
    flex-direction: row;
    justify-content: flex-start;
    gap: 10px;
    width: 100%;
    min-height: 48px;
    padding: 0 12px;
    border-radius: 12px;
    font-size: 1rem;
  }
  .tabbar a { margin: 0 0 4px; }
  .tabbar a.is-active { background: var(--green-soft); margin: 0 0 4px; }
  .tabbar a.is-active span { background: transparent; padding: 0; }
  .topbar, main {
    grid-column: 2;
    width: min(760px, calc(100% - 56px));
    margin-inline: auto;
  }
  .topbar {
    grid-row: 1;
    position: static;
    background: transparent;
    backdrop-filter: none;
    padding: 28px 0 6px;
  }
  main { grid-row: 2; padding: 8px 0 64px; }
  .sheet-back { align-items: center; }
  .sheet { border-radius: 20px; margin: 24px; }
}
