/* ==========================================================================
   حاسبة أرباح الباروكات — السعودية
   Design tokens → light & dark, RTL-first
   ========================================================================== */

:root {
  --font: "SF Arabic", "SF Pro Arabic", "Segoe UI", "Noto Sans Arabic",
          "Dubai", "Tajawal", "Cairo", system-ui, -apple-system, sans-serif;
  --num: ui-rounded, "SF Pro Rounded", "Segoe UI", system-ui, sans-serif;

  --bg:        #FAF6F4;
  --bg-tint:   #F3E9EC;
  --surface:   #FFFFFF;
  --surface-2: #FBF8F9;
  --border:    #EADDE2;
  --border-2:  #DFCBD3;

  --text:      #2B1A22;
  --text-2:    #6B5560;
  --muted:     #93818A;

  --brand:     #7A2E52;
  --brand-2:   #A8436F;
  --brand-soft:#F7E9EF;
  --gold:      #B4874A;
  --gold-soft: #FBF0DF;

  --ok:        #0E8A5F;
  --ok-soft:   #E1F5EC;
  --warn:      #B57603;
  --warn-soft: #FDF0D8;
  --bad:       #C43D48;
  --bad-soft:  #FCE8E9;

  --shadow-sm: 0 1px 2px rgba(43,26,34,.06), 0 1px 3px rgba(43,26,34,.04);
  --shadow-md: 0 4px 14px rgba(43,26,34,.07), 0 1px 3px rgba(43,26,34,.05);
  --shadow-lg: 0 18px 46px -18px rgba(43,26,34,.28);

  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 20px;
  --r-xl: 26px;

  --c0: #C9BAC1; /* lost rev  */
  --c1: #7A2E52; /* product   */
  --c2: #C07A9B; /* shipping  */
  --c3: #B4874A; /* fees      */
  --c4: #8C93B8; /* ops       */
  --c5: #5E7C8B; /* vat       */
  --c6: #D9A441; /* ads       */
  --c7: #0E8A5F; /* profit    */
}

html[data-theme="dark"] {
  --bg:        #131017;
  --bg-tint:   #1C1721;
  --surface:   #1B1620;
  --surface-2: #221B29;
  --border:    #2E2536;
  --border-2:  #3D3146;

  --text:      #F4EDF1;
  --text-2:    #C0B0BB;
  --muted:     #8F8090;

  --brand:     #E79BC0;
  --brand-2:   #F0B4D0;
  --brand-soft:#2A1B26;
  --gold:      #E0B978;
  --gold-soft: #2A2118;

  --ok:        #46C795;
  --ok-soft:   #122E24;
  --warn:      #E5B45C;
  --warn-soft: #2E2415;
  --bad:       #F0808C;
  --bad-soft:  #331A1D;

  --shadow-sm: 0 1px 2px rgba(0,0,0,.4);
  --shadow-md: 0 4px 16px rgba(0,0,0,.42);
  --shadow-lg: 0 20px 50px -20px rgba(0,0,0,.7);

  --c0: #4A3E48;
  --c1: #E79BC0;
  --c2: #B2718F;
  --c3: #E0B978;
  --c4: #9AA1C6;
  --c5: #7699A9;
  --c6: #EFC96C;
  --c7: #46C795;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  font-size: 15.5px;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(720px 380px at 88% -6%, color-mix(in srgb, var(--brand) 14%, transparent), transparent 70%),
    radial-gradient(560px 320px at 4% 4%, color-mix(in srgb, var(--gold) 12%, transparent), transparent 68%);
}

.wrap { width: min(1240px, 100% - 2.5rem); margin-inline: auto; position: relative; z-index: 1; }

h1, h2, h3 { line-height: 1.3; margin: 0; letter-spacing: -.01em; }

.skip-link {
  position: absolute; inset-inline-start: 0; top: 0; z-index: 99;
  background: var(--brand); color: #fff; padding: .6rem 1rem; border-radius: 0 0 var(--r-sm) 0;
  clip-path: inset(50%); white-space: nowrap;
}
.skip-link:focus { clip-path: none; }

:focus-visible { outline: 2.5px solid var(--brand-2); outline-offset: 2px; border-radius: 6px; }

/* ============================ Topbar ============================ */

.topbar {
  position: sticky; top: 0; z-index: 40;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(1.6) blur(14px);
  -webkit-backdrop-filter: saturate(1.6) blur(14px);
  border-bottom: 1px solid var(--border);
}
.topbar-inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 66px; }

.brand { display: inline-flex; align-items: center; gap: .7rem; text-decoration: none; color: inherit; }
.brand-mark {
  width: 40px; height: 40px; display: grid; place-items: center; flex: none;
  border-radius: 13px; color: #fff;
  background: linear-gradient(145deg, var(--brand-2), var(--brand));
  box-shadow: 0 6px 16px -6px color-mix(in srgb, var(--brand) 70%, transparent);
}
html[data-theme="dark"] .brand-mark { color: #1B1620; }
.brand-text { display: flex; flex-direction: column; line-height: 1.25; }
.brand-text b { font-size: 1.02rem; font-weight: 800; }
.brand-text small { font-size: .73rem; color: var(--muted); }

.topbar-actions { display: flex; align-items: center; gap: .45rem; }

.btn {
  display: inline-flex; align-items: center; gap: .4rem;
  font-family: inherit; font-size: .84rem; font-weight: 700; color: var(--text-2);
  background: var(--surface); border: 1px solid var(--border);
  padding: .5rem .8rem; border-radius: 999px; cursor: pointer;
  transition: .18s ease;
}
.btn:hover { color: var(--brand); border-color: var(--brand); background: var(--brand-soft); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn.icon { padding: .5rem; border-radius: 50%; }

.ico-moon { display: none; }
html[data-theme="dark"] .ico-sun { display: none; }
html[data-theme="dark"] .ico-moon { display: block; }

/* ============================ Intro band ============================ */

.intro { padding: 1.6rem 0 1.2rem; }
.intro-inner {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 1.1rem 1.6rem;
}

.intro-head { min-width: 0; flex: 1 1 340px; }
.intro-head h1 {
  font-size: clamp(1.3rem, 2.4vw, 1.7rem); font-weight: 800;
  display: flex; align-items: center; gap: .5rem;
}
.intro-head h1::before {
  content: ""; width: 4px; align-self: stretch; min-height: 1.1em;
  border-radius: 99px; background: linear-gradient(var(--brand-2), var(--gold));
}
.intro-head p {
  margin: .45rem 0 0; color: var(--text-2); font-size: .88rem;
  max-width: 66ch; line-height: 1.7;
}

.presets {
  flex: 1 1 100%; min-width: 0;
  display: flex; align-items: flex-start; flex-wrap: wrap; gap: .5rem .7rem;
  border-top: 1px dashed var(--border-2); padding-top: .9rem;
}
.presets-label {
  font-size: .72rem; color: var(--muted); font-weight: 800;
  letter-spacing: .02em; flex: none; padding-top: .42rem;
}
.preset-chips { display: flex; flex-wrap: wrap; gap: .45rem; flex: 1; min-width: 0; }

.chip {
  font-family: inherit; font-size: .85rem; font-weight: 700; cursor: pointer;
  background: var(--surface); color: var(--text-2);
  border: 1px solid var(--border); border-radius: 999px;
  padding: .5rem .95rem; transition: .18s ease;
  display: inline-flex; align-items: center; gap: .4rem;
}
.chip:hover { border-color: var(--brand); color: var(--brand); transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.chip[aria-pressed="true"] {
  background: linear-gradient(140deg, var(--brand-2), var(--brand));
  border-color: transparent; color: #fff;
  box-shadow: 0 8px 18px -8px color-mix(in srgb, var(--brand) 75%, transparent);
}
html[data-theme="dark"] .chip[aria-pressed="true"] { color: #1B1620; }
.chip em { font-style: normal; opacity: .72; font-weight: 600; font-size: .78rem; }

/* ============================ Layout ============================ */

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 430px);
  gap: 1.4rem;
  align-items: start;
  padding-bottom: 3rem;
}

/* ============================ Input cards ============================ */

.col-inputs { display: flex; flex-direction: column; gap: .85rem; min-width: 0; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: border-color .2s ease, box-shadow .2s ease;
}
.card[data-open="true"] { box-shadow: var(--shadow-md); border-color: var(--border-2); }

.card-head {
  width: 100%; display: flex; align-items: center; gap: .85rem;
  background: none; border: 0; cursor: pointer;
  font-family: inherit; color: inherit; text-align: start;
  padding: 1.05rem 1.15rem;
}
.card-ico {
  width: 30px; height: 30px; flex: none; display: grid; place-items: center;
  border-radius: 9px; font-size: .82rem; font-weight: 800;
  color: var(--brand); background: var(--brand-soft);
  border: 1px solid color-mix(in srgb, var(--brand) 18%, transparent);
}
.card-title { display: flex; flex-direction: column; flex: 1; min-width: 0; line-height: 1.35; }
.card-title b { font-size: .98rem; font-weight: 800; }
.card-title small { font-size: .78rem; color: var(--muted); }
.chev { color: var(--muted); transition: transform .25s ease; flex: none; }
.card[data-open="true"] .chev { transform: rotate(180deg); }

/* ملخّص مباشر لمحتوى البطاقة، يظهر وهي مغلقة فلا تحتاج فتحها لتعرف ما بداخلها */
.card-sum {
  font-size: .78rem; font-weight: 700; color: var(--brand);
  background: var(--brand-soft);
  border: 1px solid color-mix(in srgb, var(--brand) 16%, transparent);
  border-radius: 999px; padding: .22rem .7rem; white-space: nowrap;
  max-width: 46%; overflow: hidden; text-overflow: ellipsis; flex: none;
}
.card[data-open="true"] .card-sum { display: none; }

.card-body { display: none; padding: 0 1.15rem 1.15rem; }
.card[data-open="true"] .card-body { display: block; animation: reveal .25s ease; }
@keyframes reveal { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

.fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(215px, 1fr)); gap: .9rem; }

/* ---- field ---- */

.field { display: flex; flex-direction: column; gap: .4rem; min-width: 0; }
.field.wide { grid-column: 1 / -1; }

.field-label {
  display: flex; align-items: center; gap: .35rem;
  font-size: .82rem; font-weight: 700; color: var(--text-2);
}

.hint {
  width: 16px; height: 16px; flex: none; border-radius: 50%; cursor: help;
  font-family: inherit; font-size: .65rem; font-weight: 800; line-height: 1;
  color: var(--muted); background: var(--bg-tint); border: 1px solid var(--border-2);
  display: grid; place-items: center; padding: 0; position: relative;
}
.hint:hover, .hint:focus-visible { color: #fff; background: var(--brand); border-color: var(--brand); }
/* التلميح يُنشأ عند التحويم فقط، حتى لا يوسّع منطقة تمرير الصفحة على الجوال */
.hint::after {
  content: "";
  position: absolute; bottom: calc(100% + 8px); inset-inline-start: 50%;
  transform: translateX(50%) translateY(4px);
  width: 0; padding: 0; overflow: hidden;
  background: var(--text); color: var(--bg);
  font-size: .76rem; font-weight: 600; line-height: 1.5; text-align: start;
  border-radius: 9px;
  opacity: 0; pointer-events: none; transition: opacity .18s ease, transform .18s ease; z-index: 30;
  box-shadow: var(--shadow-lg);
}
.hint:hover::after, .hint:focus::after, .hint:focus-visible::after {
  content: attr(data-tip);
  width: max-content; max-width: min(250px, 62vw); padding: .55rem .7rem;
  opacity: 1; transform: translateX(50%) translateY(0);
}

.input-shell {
  display: flex; align-items: center;
  background: var(--surface-2);
  border: 1.5px solid var(--border);
  border-radius: var(--r-sm);
  transition: .16s ease;
  overflow: hidden;
}
.input-shell:focus-within {
  border-color: var(--brand);
  background: var(--surface);
  box-shadow: 0 0 0 3.5px color-mix(in srgb, var(--brand) 14%, transparent);
}
.input-shell input {
  flex: 1; min-width: 0; width: 100%;
  font-family: var(--num); font-size: 1rem; font-weight: 700; color: var(--text);
  background: none; border: 0; outline: 0; padding: .58rem .7rem;
  direction: ltr; text-align: end;
}
.input-shell input::-webkit-outer-spin-button,
.input-shell input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.input-shell input[type=number] { -moz-appearance: textfield; }

.unit {
  font-size: .78rem; font-weight: 700; color: var(--muted);
  padding-inline: .7rem; flex: none;
  border-inline-start: 1px solid var(--border);
  align-self: stretch; display: flex; align-items: center;
}

select.select {
  width: 100%; font-family: inherit; font-size: .92rem; font-weight: 700; color: var(--text);
  background: var(--surface-2); border: 1.5px solid var(--border);
  border-radius: var(--r-sm); padding: .58rem .7rem; cursor: pointer; outline: 0;
  transition: .16s ease;
}
select.select:focus { border-color: var(--brand); box-shadow: 0 0 0 3.5px color-mix(in srgb, var(--brand) 14%, transparent); }

/* slider */
.slider { width: 100%; margin: 0; height: 20px; background: none; -webkit-appearance: none; appearance: none; cursor: pointer; }
.slider::-webkit-slider-runnable-track {
  height: 5px; border-radius: 99px;
  background: linear-gradient(to left, var(--brand) var(--pct, 0%), var(--border-2) var(--pct, 0%));
}
.slider::-moz-range-track { height: 5px; border-radius: 99px; background: var(--border-2); }
.slider::-moz-range-progress { height: 5px; border-radius: 99px; background: var(--brand); }
.slider::-webkit-slider-thumb {
  -webkit-appearance: none; width: 16px; height: 16px; margin-top: -5.5px;
  border-radius: 50%; background: var(--surface); border: 3px solid var(--brand);
  box-shadow: var(--shadow-sm); transition: transform .15s ease;
}
.slider::-moz-range-thumb {
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--surface); border: 3px solid var(--brand); box-shadow: var(--shadow-sm);
}
.slider:active::-webkit-slider-thumb { transform: scale(1.18); }

/* switch */
.switch-row {
  display: flex; align-items: center; justify-content: space-between; gap: .75rem;
  background: var(--surface-2); border: 1.5px solid var(--border);
  border-radius: var(--r-sm); padding: .55rem .75rem;
}
.switch { position: relative; width: 42px; height: 24px; flex: none; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; z-index: 2; }
.switch span {
  position: absolute; inset: 0; border-radius: 99px;
  background: var(--border-2); transition: .2s ease;
}
.switch span::before {
  content: ""; position: absolute; top: 3px; inset-inline-start: 3px;
  width: 18px; height: 18px; border-radius: 50%; background: #fff;
  box-shadow: var(--shadow-sm); transition: .2s ease;
}
.switch input:checked + span { background: var(--brand); }
.switch input:checked + span::before { transform: translateX(-18px); }
[dir="ltr"] .switch input:checked + span::before { transform: translateX(18px); }

.mini-note {
  margin-top: .9rem; font-size: .83rem; color: var(--text-2);
  background: var(--gold-soft); border: 1px dashed color-mix(in srgb, var(--gold) 40%, transparent);
  border-radius: var(--r-sm); padding: .6rem .8rem;
}
.mini-note b { color: var(--text); font-family: var(--num); }
.mini-note.warn { background: var(--bad-soft); border-color: color-mix(in srgb, var(--bad) 40%, transparent); }

/* ============================ Results ============================ */

.col-results { min-width: 0; }
.results-sticky { position: sticky; top: 82px; display: flex; flex-direction: column; gap: .85rem; }

.verdict {
  display: flex; align-items: center; gap: .85rem;
  border-radius: var(--r-lg); padding: .95rem 1.1rem;
  border: 1.5px solid; transition: .25s ease;
}
.verdict.good { background: var(--ok-soft);   border-color: color-mix(in srgb, var(--ok) 35%, transparent); }
.verdict.mid  { background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 38%, transparent); }
.verdict.bad  { background: var(--bad-soft);  border-color: color-mix(in srgb, var(--bad) 35%, transparent); }

.verdict-badge {
  width: 40px; height: 40px; flex: none; border-radius: 12px;
  display: grid; place-items: center; font-size: 1.25rem; color: #fff;
}
.verdict.good .verdict-badge { background: var(--ok); }
.verdict.mid  .verdict-badge { background: var(--warn); }
.verdict.bad  .verdict-badge { background: var(--bad); }

.verdict-text { display: flex; flex-direction: column; line-height: 1.4; min-width: 0; }
.verdict-text b { font-size: 1rem; font-weight: 800; }
.verdict.good b { color: var(--ok); }
.verdict.mid  b { color: var(--warn); }
.verdict.bad  b { color: var(--bad); }
.verdict-text span { font-size: .81rem; color: var(--text-2); }

.kpis { display: grid; grid-template-columns: 1fr 1fr; gap: .7rem; }

.kpi {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-md); padding: .85rem .9rem;
  box-shadow: var(--shadow-sm); display: flex; flex-direction: column; gap: .15rem; min-width: 0;
}
.kpi-hero {
  grid-column: 1 / -1;
  background:
    linear-gradient(150deg, color-mix(in srgb, var(--brand) 9%, var(--surface)), var(--surface) 62%);
  border-color: color-mix(in srgb, var(--brand) 26%, transparent);
  padding: 1.05rem 1.1rem;
}
.kpi-label { font-size: .78rem; font-weight: 700; color: var(--muted); display: flex; align-items: center; gap: .3rem; }
.kpi-value {
  font-family: var(--num); font-size: 1.35rem; font-weight: 800; letter-spacing: -.02em;
  direction: rtl; white-space: nowrap;
}
.kpi-hero .kpi-value { font-size: 2.15rem; }
.kpi-value.pos { color: var(--ok); }
.kpi-value.neg { color: var(--bad); }
.kpi-value.bump { animation: bump .32s cubic-bezier(.34,1.4,.5,1); }
@keyframes bump {
  0%   { transform: scale(1); }
  35%  { transform: scale(1.055); }
  100% { transform: scale(1); }
}
.kpi-foot { font-size: .76rem; color: var(--text-2); font-weight: 600; }

/* gauge */
.gauge-box {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-md); padding: .9rem 1rem; box-shadow: var(--shadow-sm);
}
.gauge-head { display: flex; justify-content: space-between; align-items: baseline; font-size: .8rem; color: var(--muted); font-weight: 700; margin-bottom: .6rem; }
.gauge-head b { font-family: var(--num); font-size: .88rem; }
.gauge { position: relative; height: 12px; border-radius: 99px; background: var(--bg-tint); overflow: visible; margin-bottom: 24px; }
.gauge-fill {
  position: absolute; inset-block: 0; inset-inline-start: 0; width: 0;
  border-radius: 99px; transition: width .5s cubic-bezier(.4,0,.2,1), background .3s ease;
}
.gauge-mark {
  position: absolute; top: -5px; bottom: -5px; width: 2px;
  background: var(--text); border-radius: 2px; transition: inset-inline-start .5s ease;
}
.gauge-mark span {
  position: absolute; top: calc(100% + 5px); inset-inline-start: 50%; transform: translateX(50%);
  font-size: .68rem; font-weight: 800; color: var(--text); white-space: nowrap;
}
.gauge-scale { display: flex; justify-content: space-between; font-size: .7rem; color: var(--muted); font-family: var(--num); margin-top: 0; }

/* panels */
.panel {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-md); padding: 1rem; box-shadow: var(--shadow-sm);
}
.panel-title { font-size: .88rem; font-weight: 800; margin-bottom: .85rem; }
.panel-note { font-size: .76rem; color: var(--muted); margin: .6rem 0 0; }

.stackbar { display: flex; height: 30px; border-radius: 9px; overflow: hidden; background: var(--bg-tint); }
.stackbar div { transition: width .5s cubic-bezier(.4,0,.2,1); position: relative; }
.stackbar div:hover { filter: brightness(1.12); }

.legend { list-style: none; margin: .85rem 0 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: .35rem .8rem; }
.legend li { display: flex; align-items: center; gap: .4rem; font-size: .78rem; color: var(--text-2); min-width: 0; }
.legend i { width: 9px; height: 9px; border-radius: 3px; flex: none; }
.legend b { margin-inline-start: auto; font-family: var(--num); color: var(--text); font-weight: 700; white-space: nowrap; }

.chart { width: 100%; }
.chart svg { width: 100%; height: auto; display: block; overflow: hidden; direction: ltr; }

/* monthly */
.monthly { display: grid; gap: .55rem; }
.m-row { display: flex; align-items: center; justify-content: space-between; gap: .6rem; font-size: .85rem; }
.m-row span { color: var(--text-2); }
.m-row b { font-family: var(--num); font-weight: 800; white-space: nowrap; }
.m-row.total {
  border-top: 1px dashed var(--border-2); padding-top: .6rem; margin-top: .15rem; font-size: .95rem;
}
.m-row.total b { font-size: 1.15rem; }

/* scenarios */
.table-scroll { overflow-x: auto; margin: 0 -.25rem; }
.scenarios { width: 100%; border-collapse: collapse; font-size: .82rem; }
.scenarios th {
  font-size: .72rem; color: var(--muted); font-weight: 700; text-align: start;
  padding: .35rem .45rem; border-bottom: 1px solid var(--border); white-space: nowrap;
}
.scenarios td { padding: .45rem; border-bottom: 1px solid var(--border); font-family: var(--num); font-weight: 700; white-space: nowrap; }
.scenarios tr:last-child td { border-bottom: 0; }
.scenarios tr.current td { background: var(--brand-soft); }
.scenarios tr.current td:first-child { border-start-start-radius: 8px; border-end-start-radius: 8px; }
.scenarios tr.current td:last-child { border-start-end-radius: 8px; border-end-end-radius: 8px; }
.scenarios td.pos { color: var(--ok); }
.scenarios td.neg { color: var(--bad); }
.tag-now { font-size: .62rem; background: var(--brand); color: #fff; border-radius: 5px; padding: .05rem .3rem; margin-inline-start: .3rem; font-family: var(--font); }

.suggest p { margin: 0; font-size: .87rem; color: var(--text-2); line-height: 1.75; }
.suggest b { color: var(--brand); font-family: var(--num); font-size: 1.05rem; }

/* ============================ Explain ============================ */

.explain { padding: 1rem 0 4rem; }
.explain h2 { font-size: clamp(1.35rem, 3vw, 1.85rem); font-weight: 800; margin: 2.4rem 0 1.2rem; }

.explain-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(255px, 1fr)); gap: .9rem; }
.explain-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-md); padding: 1.15rem; box-shadow: var(--shadow-sm);
}
.explain-card h3 { font-size: .95rem; font-weight: 800; color: var(--brand); margin-bottom: .5rem; }
.explain-card p { margin: 0 0 .8rem; font-size: .86rem; color: var(--text-2); }
.explain-card code {
  display: block; font-family: var(--num); font-size: .78rem; font-weight: 700; color: var(--text);
  background: var(--bg-tint); border-radius: 8px; padding: .5rem .65rem; line-height: 1.7;
}

.tips { display: grid; grid-template-columns: repeat(auto-fit, minmax(255px, 1fr)); gap: .9rem; }
.tip {
  display: flex; gap: .85rem; align-items: flex-start;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-md); padding: 1rem 1.1rem; box-shadow: var(--shadow-sm);
}
.tip-num {
  direction: ltr; unicode-bidi: isolate;
  font-family: var(--num); font-size: 1.15rem; font-weight: 800; color: var(--gold);
  background: var(--gold-soft); border-radius: 10px; padding: .35rem .6rem; flex: none; line-height: 1.2;
}
.tip p { margin: 0; font-size: .85rem; color: var(--text-2); }
.tip b { color: var(--text); }

.disclaimer {
  margin-top: 1.6rem; font-size: .84rem; color: var(--text-2); line-height: 1.8;
  background: var(--surface-2); border: 1px solid var(--border);
  border-inline-start: 4px solid var(--gold);
  border-radius: var(--r-sm); padding: .95rem 1.1rem;
}
.disclaimer b { color: var(--text); }

/* ============================ Footer ============================ */

.footer { border-top: 1px solid var(--border); padding: 1.8rem 0; background: var(--surface); position: relative; z-index: 1; }
.footer-inner p { margin: 0; font-size: .82rem; color: var(--muted); text-align: center; }

/* ============================ Mobile mini bar ============================ */

.minibar { display: none; }

@media (max-width: 1080px) {
  .minibar {
    position: fixed; inset-inline: 0; bottom: 0; z-index: 45;
    display: flex; align-items: center; gap: .35rem;
    padding: .55rem max(.9rem, env(safe-area-inset-right)) max(.55rem, env(safe-area-inset-bottom)) max(.9rem, env(safe-area-inset-left));
    background: color-mix(in srgb, var(--surface) 92%, transparent);
    backdrop-filter: saturate(1.6) blur(14px);
    -webkit-backdrop-filter: saturate(1.6) blur(14px);
    border-top: 1px solid var(--border);
    box-shadow: 0 -8px 24px -14px rgba(0, 0, 0, .35);
    text-decoration: none; color: inherit;
    transform: translateY(110%); transition: transform .28s cubic-bezier(.2,.8,.3,1);
  }
  .minibar.show { transform: none; }
  body { padding-bottom: 62px; }
  .toast { bottom: 5.4rem; }   /* فوق الشريط الثابت لا تحته */
}

.minibar-cell { display: flex; flex-direction: column; flex: 1; min-width: 0; line-height: 1.3; }
.minibar-cell small { font-size: .66rem; color: var(--muted); font-weight: 700; }
.minibar-cell b {
  font-family: var(--num); font-size: .92rem; font-weight: 800;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.minibar-cell b.pos { color: var(--ok); }
.minibar-cell b.neg { color: var(--bad); }
.minibar-go {
  width: 30px; height: 30px; flex: none; border-radius: 50%;
  display: grid; place-items: center; color: #fff; background: var(--brand);
}
html[data-theme="dark"] .minibar-go { color: #1B1620; }

/* ============================ Toast ============================ */

.toast {
  position: fixed; bottom: 1.6rem; inset-inline-start: 50%; transform: translateX(50%) translateY(140%);
  background: var(--text); color: var(--bg);
  font-size: .87rem; font-weight: 700;
  padding: .7rem 1.2rem; border-radius: 999px; box-shadow: var(--shadow-lg);
  z-index: 90; transition: transform .3s cubic-bezier(.2,.9,.3,1.2); pointer-events: none;
}
.toast.show { transform: translateX(50%) translateY(0); }

/* ============================ Responsive ============================ */

@media (max-width: 1080px) {
  .layout { grid-template-columns: 1fr; }
  .results-sticky { position: static; }
  .col-results { order: -1; }
  .kpis { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
}

@media (max-width: 700px) {
  body { font-size: 15px; }
  .wrap { width: min(1240px, 100% - 1.6rem); }
  .intro { padding: 1.1rem 0 .9rem; }
  .intro-head p { font-size: .84rem; }
  .brand-text small { display: none; }
  .btn span { display: none; }
  .btn { padding: .5rem; border-radius: 50%; }
  .fields { grid-template-columns: 1fr; }
  .kpi-hero .kpi-value { font-size: 1.8rem; }
  .legend { grid-template-columns: 1fr; }
  .topbar-inner { min-height: 58px; }
  .chip em { display: none; }
  .chip { font-size: .81rem; padding: .45rem .8rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
}

/* ============================ Print ============================ */

@media print {
  body::before, .topbar, .presets, .footer, .toast, .minibar, .explain .tips, .skip-link { display: none !important; }
  body { background: #fff; font-size: 11pt; padding-bottom: 0; }
  .layout { grid-template-columns: 1fr 1fr; gap: 1rem; }
  .card-body { display: block !important; }
  .card-sum { display: none !important; }
  .card, .panel, .kpi, .gauge-box { box-shadow: none; break-inside: avoid; }
  .intro { padding: 0 0 1rem; }
  .intro-head h1 { font-size: 18pt; }
  .intro-head p { display: none; }
}
