/* ============================================================
   معالج حاسبة دية النفس — يعتمد متغيرات app.css
   ============================================================ */

.page {
  max-width: 1200px; margin: 0 auto; padding: 28px 32px 72px;
}

.crumbs {
  display: flex; align-items: center; gap: 10px;
  font-size: 13.5px; color: var(--muted); margin-bottom: 16px; flex-wrap: wrap;
}
.crumbs .now { color: var(--ink); font-weight: 600; }

.page h1 { margin: 0 0 24px; font-size: 30px; font-weight: 700; color: var(--green); }

/* ---------- شريط الخطوات ---------- */
.steps {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 22px 32px; box-shadow: var(--shadow); margin-bottom: 26px;
}
.steps__row { display: flex; align-items: flex-start; }
.step { display: flex; align-items: flex-start; flex: 1; }
.step__box {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  min-width: 110px; background: none; border: 0; font: inherit;
  cursor: pointer; padding: 0;
}
.step__box[disabled] { cursor: not-allowed; }
.step__mark {
  width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
  font-size: 14px; font-weight: 700; font-variant-numeric: tabular-nums;
  background: #fff; color: var(--hint); border: 2px solid var(--line);
}
.step__label { font-size: 13px; color: var(--hint); text-align: center; }
.step__line { flex: 1; height: 2px; background: var(--line); margin-top: 16px; }

.step.is-done .step__mark { background: var(--green-soft); color: var(--green); border-color: var(--green); }
.step.is-done .step__label { color: var(--green); font-weight: 600; }
.step.is-done .step__line { background: var(--green); }
.step.is-active .step__mark { background: var(--green); color: #fff; border-color: var(--green); }
.step.is-active .step__label { color: var(--ink); font-weight: 700; }

/* ---------- بطاقات الاختيار ---------- */
.pick-list { display: flex; flex-direction: column; gap: 14px; max-width: 760px; }
.pick {
  background: #fff; border: 1.5px solid var(--line); border-radius: var(--radius);
  padding: 20px 24px; display: flex; gap: 16px; cursor: pointer;
  font: inherit; text-align: right; width: 100%; color: inherit;
}
.pick:hover { border-color: var(--green); }
.pick[aria-pressed="true"] { background: var(--green-soft); border: 2px solid var(--green); padding: 19px 23px; }
.pick__dot {
  flex: none; width: 22px; height: 22px; border-radius: 50%;
  border: 2px solid #C6C2B8; background: #fff; margin-top: 3px;
  display: grid; place-items: center;
}
.pick[aria-pressed="true"] .pick__dot { border-color: var(--green); }
.pick[aria-pressed="true"] .pick__dot::after {
  content: ''; width: 11px; height: 11px; border-radius: 50%; background: var(--green);
}
.pick > span:last-child { display: block; }
.pick__title { display: block; font-size: 17px; font-weight: 700; }
.pick[aria-pressed="true"] .pick__title { color: var(--green); }
.pick__desc { display: block; font-size: 14.5px; color: var(--muted); line-height: 1.8; margin-top: 6px; }
.pick[aria-pressed="true"] .pick__desc { color: var(--ink-2); }

.lede { margin: 0 0 20px; font-size: 14.5px; color: var(--muted); line-height: 1.8; }
.section-title { margin: 0 0 6px; font-size: 21px; font-weight: 700; }
.subhead { margin: 28px 0 12px; font-size: 16px; font-weight: 700; color: var(--green); }

/* ---------- حقول ---------- */
.form-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 18px; max-width: 760px;
}
.field { display: flex; flex-direction: column; gap: 8px; }
.field > label { font-size: 14px; font-weight: 600; }
.field input, .field textarea, .field select {
  height: 48px; border: 1.5px solid var(--line); border-radius: var(--radius);
  background: #fff; font: inherit; font-size: 15px; padding: 0 16px; color: inherit;
}
.field textarea { height: auto; min-height: 92px; padding: 12px 16px; line-height: 1.8; resize: vertical; }
.field .help { font-size: 12.5px; color: var(--hint); line-height: 1.7; }
.field .help strong { color: var(--green); font-weight: 700; }

/* ---------- وسائل التقويم ---------- */
.means { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; }
.mean {
  background: #fff; border: 1.5px solid var(--line); border-radius: var(--radius);
  padding: 18px 20px; cursor: pointer; font: inherit; text-align: right;
  position: relative; color: inherit;
}
.mean:hover { border-color: var(--green); }
.mean[aria-pressed="true"] { background: var(--green-soft); border: 2px solid var(--green); padding: 17px 19px; }
.mean--origin { border-color: var(--gold); background: #FDFBF7; }
.mean__tag {
  position: absolute; top: -11px; right: 16px; background: var(--gold); color: #fff;
  font-size: 11.5px; font-weight: 700; border-radius: 20px; padding: 3px 12px;
}
.mean__name { display: block; font-size: 15.5px; font-weight: 700; }
.mean__qty { display: block; font-size: 13.5px; color: var(--muted); margin-top: 6px; }
.mean__off { display: block; font-size: 12px; color: var(--warn); margin-top: 6px; line-height: 1.6; }

/* ---------- النتيجة ---------- */
.result-head {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 30px 34px;
}
.result-head__top {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 12px;
}
.result-head__top h2 { margin: 0; font-size: 24px; font-weight: 700; color: var(--green); }
.tags { display: flex; gap: 8px; flex-wrap: wrap; }
.tag {
  font-size: 13px; font-weight: 600; background: var(--green-soft); color: var(--green);
  border-radius: 20px; padding: 6px 14px;
}
.headline { margin-top: 22px; }
.headline__label { font-size: 14px; color: var(--muted); }
.headline__value {
  font-size: 46px; font-weight: 700; color: var(--green);
  line-height: 1.2; margin-top: 2px;
}
.headline__value small { font-size: 18px; font-weight: 600; color: var(--muted); }
.flash { animation: flash .5s ease; }
@keyframes flash { 0% { background: #FFF3D6; } 100% { background: transparent; } }

.val-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(185px, 1fr)); gap: 16px; margin-top: 24px; }
.val {
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 22px; background: #fff; position: relative;
}
.val--origin { border: 2px solid var(--gold); background: #FDFBF7; }
.val__tag {
  position: absolute; top: -12px; right: 20px; background: var(--gold); color: #fff;
  font-size: 12px; font-weight: 700; border-radius: 20px; padding: 4px 14px;
}
.val__name { font-size: 14.5px; font-weight: 600; color: var(--green); }
.val--origin .val__name { color: var(--gold-press); }
.val__qty { font-size: 15px; color: var(--muted); margin-top: 10px; }
.val__amount { font-size: 34px; font-weight: 700; color: var(--ink); margin-top: 6px; line-height: 1.2; }
.val__cur { font-size: 13.5px; color: var(--muted); margin-top: 4px; }
.val__off { font-size: 12.5px; color: var(--warn); margin-top: 8px; line-height: 1.7; }

.result-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 18px; margin-top: 18px; align-items: start; }
.result-grid > * { min-width: 0; }
.panel {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 24px 28px;
}
.panel h3 { margin: 0; font-size: 18px; font-weight: 700; }
.panel p { margin: 8px 0 16px; font-size: 13.5px; color: var(--muted); line-height: 1.8; }

table.plain { width: 100%; border-collapse: collapse; font-size: 14px; }
table.plain thead tr { background: var(--green-soft); color: var(--green); }
table.plain th { text-align: right; padding: 11px 16px; font-weight: 700; white-space: nowrap; }
table.plain th:last-child, table.plain td:last-child { text-align: left; }
table.plain td { padding: 11px 16px; border-top: 1px solid var(--line); }
table.plain tbody tr:nth-child(even) { background: #F4F8F6; }

.side-col { display: flex; flex-direction: column; gap: 18px; }
.stamp {
  border: 1.5px dashed var(--gold); border-radius: var(--radius);
  padding: 18px 22px; background: #FDFBF7;
}
.stamp__head {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; font-weight: 700; color: var(--gold-press);
}
.stamp__body { font-size: 13.5px; color: var(--muted); line-height: 1.9; margin-top: 8px; }
.stamp__grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.stamp__grid label { font-size: 12px; color: var(--muted); display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.stamp__grid input {
  width: 100%; min-width: 0;
  height: 38px; border: 1.5px solid var(--line); border-radius: 9px; background: #fff;
  font: inherit; font-size: 13.5px; font-weight: 600; padding: 0 10px;
  direction: ltr; text-align: left; font-variant-numeric: tabular-nums;
}

.nav-row {
  display: flex; justify-content: space-between; gap: 12px;
  margin-top: 30px; max-width: 760px; flex-wrap: wrap;
}
.nav-row--wide { max-width: none; }

.ibil-list {
  display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px;
}
.ibil-list span {
  font-size: 13px; font-weight: 600; background: var(--green-soft); color: var(--green);
  border-radius: 8px; padding: 6px 12px;
}

/* ---------- عناصر شاشة الغُرَّة ---------- */
.chip-row { display: flex; flex-wrap: wrap; gap: 10px; }
.chip-row .chip { height: 40px; padding: 0 20px; border-radius: 20px; font-size: 14px; }

.chk-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 10px; max-width: 820px; }
.chk {
  display: flex; align-items: center; gap: 10px;
  background: #fff; border: 1.5px solid var(--line); border-radius: var(--radius);
  padding: 12px 16px; font-size: 14.5px; cursor: pointer; min-width: 0;
}
.chk:hover { border-color: var(--green); }
.chk input { width: 18px; height: 18px; accent-color: var(--green); flex: none; cursor: pointer; }
.chk:has(input:checked) { background: var(--green-soft); border-color: var(--green); font-weight: 600; }

.big-stepper {
  display: inline-flex; align-items: center; border: 1.5px solid var(--line);
  border-radius: var(--radius); background: #fff; overflow: hidden;
}
.big-stepper button {
  width: 48px; height: 48px; border: none; background: #F4F8F6;
  color: var(--green); font-size: 22px; cursor: pointer; font-family: inherit; line-height: 1;
}
.big-stepper button:hover { background: var(--green-soft); }
.big-stepper span {
  width: 80px; text-align: center; font-size: 20px; font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.band-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.band {
  background: #fff; border: 1.5px solid var(--line); border-radius: var(--radius);
  padding: 18px 14px; text-align: center; cursor: pointer; font: inherit;
  color: inherit; position: relative;
}
.band:hover { border-color: var(--green); }
.band[aria-pressed="true"] { background: var(--green-soft); border: 2px solid var(--green); padding: 17px 13px; }
.band__label { display: block; font-size: 15px; font-weight: 600; line-height: 1.6; }
.band[aria-pressed="true"] .band__label { font-weight: 700; color: var(--green); }
.band__tag {
  position: absolute; top: -10px; left: 12px; background: var(--green); color: #fff;
  font-size: 11px; font-weight: 700; border-radius: 20px; padding: 2px 10px;
}

.seg--wide { height: 48px; border-radius: var(--radius); width: 100%; }
.seg--wide button { flex: 1; font-size: 14.5px; }
.seg--wide button[aria-pressed="true"] { background: var(--green-soft); color: var(--green); font-weight: 700; }

.shares { display: flex; flex-direction: column; gap: 10px; max-width: 620px; margin-top: 14px; }
.share-row { display: flex; align-items: center; gap: 10px; }
.share-row input {
  height: 44px; border: 1.5px solid var(--line); border-radius: 10px;
  background: #fff; font: inherit; font-size: 14.5px; padding: 0 14px; min-width: 0; flex: 1;
}
.share-row .share-pct { flex: none; width: 90px; text-align: center; direction: ltr; font-weight: 700; }
.share-sign { font-size: 14px; color: var(--muted); }
.share-bar {
  height: 8px; border-radius: 4px; background: var(--line);
  overflow: hidden; max-width: 620px; margin-top: 14px;
}
.share-bar span { display: block; height: 100%; transition: width .2s ease; }
.share-bar span.is-ok { background: var(--ok); }
.share-bar span.is-bad { background: var(--warn); }

.verdict {
  border-radius: var(--radius); padding: 24px 28px;
  display: flex; gap: 18px; align-items: flex-start;
}
.verdict--ok { background: var(--ok-bg); border: 2px solid var(--ok); }
.verdict--warn { background: var(--warn-bg); border: 2px solid var(--warn); }
.verdict__badge {
  flex: none; color: #fff; font-size: 14px; font-weight: 700;
  border-radius: 20px; padding: 8px 20px; white-space: nowrap;
}
.verdict--ok .verdict__badge { background: var(--ok); }
.verdict--warn .verdict__badge { background: var(--warn); }
.verdict h2 { margin: 0; font-size: 21px; font-weight: 700; }
.verdict p { margin: 8px 0 0; font-size: 15px; line-height: 1.9; }
.verdict--ok h2, .verdict--ok p { color: var(--ok-ink); }
.verdict--warn h2, .verdict--warn p { color: var(--warn-ink); }

@media print {
  .topbar, .steps, .crumbs, .nav-row, .stamp__grid,
  #print-report, #use-in-injuries, [data-go] { display: none !important; }
  body { background: #fff; }
  .page { padding: 0; max-width: none; }
  .result-grid { grid-template-columns: 1fr; }
  .panel, .result-head, .val { box-shadow: none; break-inside: avoid; }
}

@media (max-width: 1000px) {
  .result-grid { grid-template-columns: 1fr; }
  .page { padding: 22px 20px 56px; }
  .steps { padding: 18px 14px; }
  .step__box { min-width: 74px; }
  .step__label { font-size: 11.5px; }
  .headline__value { font-size: 36px; }
}
@media (max-width: 620px) {
  /* شريط الخطوات يمرّر أفقياً بدل أن يدفع الصفحة */
  .steps { overflow-x: auto; padding: 16px 12px; }
  .steps__row { min-width: max-content; }
  .step__box { min-width: 64px; }
  .step__label { font-size: 11px; }
  .step__line { min-width: 14px; }
  .page h1 { font-size: 24px; }
  .val__amount { font-size: 27px; }
  .panel { padding: 18px 16px; }
}
