:root {
  --green-900: #0b3d2e;
  --green-700: #14532d;
  --green-500: #1e7a4b;
  --gold-500: #c9a227;
  --bg: #f7f8f4;
  --card-bg: #ffffff;
  --text: #1f2937;
  --muted: #6b7280;
  --border: #e5e7eb;
  --danger: #b91c1c;
  --radius: 12px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Segoe UI', Roboto, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

body.lang-ur {
  direction: rtl;
  font-family: 'Noto Nastaliq Urdu', 'Jameel Noori Nastaleeq', 'Segoe UI', sans-serif;
}

.container { max-width: 960px; margin: 0 auto; padding: 0 16px; }

/* ---------- Header ---------- */
header.site-header {
  background: var(--green-900);
  color: #fff;
  padding: 14px 0;
}
header.site-header .container { display: flex; align-items: center; justify-content: space-between; }
header.site-header .logo { font-size: 1.2rem; font-weight: 700; color: #fff; text-decoration: none; }
header.site-header .logo span { color: var(--gold-500); }

.lang-toggle {
  display: flex; gap: 4px; background: rgba(255,255,255,0.1); border-radius: 8px; padding: 4px;
}
.lang-toggle button {
  border: none; background: transparent; color: #fff; padding: 6px 14px; border-radius: 6px;
  cursor: pointer; font-weight: 600; font-size: 0.9rem;
}
.lang-toggle button.active { background: var(--gold-500); color: var(--green-900); }

/* ---------- Hero ---------- */
.hero { padding: 48px 0 32px; text-align: center; }
.hero h1 { font-size: 2rem; color: var(--green-900); margin-bottom: 8px; }
.hero p { color: var(--muted); max-width: 640px; margin: 0 auto 20px; }
.btn-primary {
  display: inline-block; background: var(--green-700); color: #fff; padding: 12px 28px;
  border-radius: 8px; text-decoration: none; font-weight: 600; border: none; cursor: pointer; font-size: 1rem;
}
.btn-primary:hover { background: var(--green-500); }
.btn-secondary {
  display: inline-block; background: #fff; color: var(--green-700); padding: 11px 24px;
  border: 2px solid var(--green-700); border-radius: 8px; text-decoration: none; font-weight: 600; cursor: pointer;
}

/* ---------- Wizard ---------- */
.wizard { background: var(--card-bg); border-radius: var(--radius); padding: 24px; margin: 24px 0;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08); }

.step-indicator { display: flex; justify-content: space-between; margin-bottom: 28px; gap: 6px; }
.step-indicator .step {
  flex: 1; text-align: center; padding: 8px 4px; border-radius: 8px; font-size: 0.8rem; font-weight: 600;
  color: var(--muted); background: #f0f1ed; position: relative;
}
.step-indicator .step.active { background: var(--green-700); color: #fff; }
.step-indicator .step.done { background: var(--gold-500); color: var(--green-900); }

.wizard-step { display: none; }
.wizard-step.active { display: block; animation: fadeIn 0.25s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px);} to { opacity: 1; transform: translateY(0);} }

.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-weight: 600; margin-bottom: 6px; font-size: 0.92rem; }
.form-group .hint { color: var(--muted); font-size: 0.8rem; margin-top: 4px; }
.form-group input[type=number], .form-group input[type=text] {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; font-size: 1rem;
}
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 560px) { .form-row { grid-template-columns: 1fr; } }

.heir-section { margin-bottom: 18px; }
.heir-section-title {
  font-size: 0.78rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em;
  color: var(--green-700); margin: 18px 0 8px; padding-bottom: 4px; border-bottom: 2px solid #e8ebe4;
}
.heir-section:first-child .heir-section-title { margin-top: 0; }

.heir-toggle { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px;
  border: 1px solid var(--border); border-radius: 10px; margin-bottom: 10px; background: #fafaf8;
}
.heir-toggle .heir-name { font-weight: 600; }
.heir-toggle .heir-desc { font-size: 0.78rem; color: var(--muted); }
.switch { position: relative; display: inline-block; width: 46px; height: 26px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; inset: 0; background: #ccc; border-radius: 26px; transition: 0.2s; }
.slider:before { position: absolute; content: ""; height: 20px; width: 20px; left: 3px; bottom: 3px; background: #fff; border-radius: 50%; transition: 0.2s; }
input:checked + .slider { background: var(--green-500); }
input:checked + .slider:before { transform: translateX(20px); }
body.lang-ur input:checked + .slider:before { transform: translateX(-20px); }

.count-stepper { display: flex; align-items: center; gap: 10px; }
.count-stepper button { width: 32px; height: 32px; border-radius: 8px; border: 1px solid var(--border); background: #fff; font-size: 1.1rem; cursor: pointer; }
.count-stepper span { min-width: 24px; text-align: center; font-weight: 700; }

.wizard-nav { display: flex; justify-content: space-between; margin-top: 24px; }

/* ---------- Persistent tab navigation ---------- */
.tabs-mode { display: flex; gap: 8px; margin-bottom: 14px; }
.tab-mode {
  flex: 1; padding: 12px 10px; border: 2px solid var(--border); border-radius: 10px; background: #fafaf8;
  cursor: pointer; font-weight: 700; font-size: 0.85rem; color: var(--muted);
  display: flex; align-items: center; justify-content: center; gap: 6px; transition: 0.15s;
}
.tab-mode:hover { border-color: var(--green-500); }
.tab-mode.active { border-color: var(--green-700); background: var(--green-700); color: #fff; }
.tab-mode .tab-icon { font-weight: 800; }

.tabs-step { display: flex; gap: 6px; margin-bottom: 22px; border-bottom: 2px solid #e8ebe4; }
.tab-step {
  flex: 1; padding: 10px 8px; border: none; background: transparent; cursor: pointer;
  font-weight: 600; font-size: 0.85rem; color: var(--muted); border-bottom: 3px solid transparent;
  margin-bottom: -2px; transition: 0.15s;
}
.tab-step:hover:not(.locked) { color: var(--green-700); }
.tab-step.active { color: var(--green-700); border-bottom-color: var(--gold-500); }
.tab-step.locked { opacity: 0.4; cursor: not-allowed; }

/* ---------- Mode select (legacy, kept for reference) ---------- */
.mode-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 560px) { .mode-cards { grid-template-columns: 1fr; } }
.mode-card {
  border: 2px solid var(--border); border-radius: var(--radius); padding: 22px 18px; text-align: center;
  cursor: pointer; transition: 0.15s; background: #fafaf8;
}
.mode-card:hover { border-color: var(--green-500); background: #f0f7f2; }
.mode-card .mode-icon {
  width: 48px; height: 48px; line-height: 48px; margin: 0 auto 12px; border-radius: 50%;
  background: var(--green-700); color: #fff; font-weight: 700; font-size: 1rem;
}
.mode-card h3 { margin: 0 0 8px; color: var(--green-900); font-size: 1.05rem; }
.mode-card p { color: var(--muted); font-size: 0.85rem; margin: 0; }

/* ---------- Property rows ---------- */
.property-row {
  border: 1px solid var(--border); border-radius: 10px; padding: 14px; margin-bottom: 12px; background: #fafaf8;
}
.property-row .prop-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr auto; gap: 8px; align-items: end; }
@media (max-width: 700px) { .property-row .prop-grid { grid-template-columns: 1fr 1fr; } }
.property-row label.small-label { font-size: 0.72rem; color: var(--muted); font-weight: 600; display: block; margin-bottom: 3px; }
.property-row input, .property-row select {
  width: 100%; padding: 8px 10px; border: 1px solid var(--border); border-radius: 6px; font-size: 0.9rem;
}
.property-row .prop-remove { background: #fef2f2; color: var(--danger); border: 1px solid #fca5a5; border-radius: 6px; padding: 8px 10px; cursor: pointer; }
.property-row .prop-value { font-size: 0.8rem; color: var(--green-700); font-weight: 600; margin-top: 6px; }
.btn-small { padding: 8px 16px; font-size: 0.85rem; }
.estate-total-preview { background: #f0f7f2; border: 1px solid #c8e6d5; border-radius: 8px; padding: 12px 14px; margin: 16px 0; font-weight: 600; color: var(--green-900); }

/* ---------- Result ---------- */
.result-summary { background: var(--green-900); color: #fff; border-radius: var(--radius); padding: 20px; margin-bottom: 20px; }
.result-summary .amount { font-size: 1.8rem; font-weight: 700; color: var(--gold-500); }

table.result-table { width: 100%; border-collapse: collapse; margin: 16px 0; }
table.result-table th, table.result-table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); }
body.lang-ur table.result-table th, body.lang-ur table.result-table td { text-align: right; }
table.result-table th { background: #f0f1ed; font-size: 0.85rem; }
table.result-table tr:last-child td { border-bottom: none; }
table.result-table .pct-sub { font-size: 0.72rem; color: var(--muted); }

.badge { display: inline-block; font-size: 0.68rem; font-weight: 700; padding: 2px 7px; border-radius: 20px; margin-inline-start: 6px; vertical-align: middle; }
.badge-asaba { background: #eaf3ec; color: var(--green-700); border: 1px solid #c8e6d5; }
.badge-adjust { background: #fff8e6; color: #92700c; border: 1px solid #f0d989; }

.notes-box { background: #fff8e6; border: 1px solid #f0d989; border-radius: 8px; padding: 14px; margin: 16px 0; font-size: 0.88rem; }
.disclaimer-box { background: #fef2f2; border: 1px solid #fca5a5; border-radius: 8px; padding: 14px; margin: 16px 0; font-size: 0.85rem; color: var(--danger); }

.result-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }

/* ---------- FAQ ---------- */
.faq-item { border-bottom: 1px solid var(--border); padding: 14px 0; }
.faq-item summary { font-weight: 600; cursor: pointer; }
.faq-item p { color: var(--muted); margin-top: 8px; }

/* ---------- Footer ---------- */
footer { text-align: center; padding: 32px 16px; color: var(--muted); font-size: 0.85rem; }

/* ---------- Print (PDF via browser print dialog) ---------- */
/* Show ONLY the result content (table + notes + disclaimer) — hide
   everything else on the page, regardless of what it is. */
@media print {
  body * { visibility: hidden; }
  #result-container, #result-container * { visibility: visible; }
  #result-container {
    position: absolute; left: 0; top: 0; width: 100%; margin: 0; padding: 16px;
  }
  .result-actions { display: none !important; }
  body { background: #fff; }
  .result-summary { background: #fff !important; color: #000 !important; border: 2px solid #000; }
  .result-summary .amount { color: #000 !important; }
}

.error-box { background: #fef2f2; border: 1px solid #fca5a5; color: var(--danger); padding: 12px 14px; border-radius: 8px; margin-bottom: 12px; }
.spinner { width: 20px; height: 20px; border: 3px solid #ddd; border-top-color: var(--green-700); border-radius: 50%; animation: spin 0.7s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
