/* ═══ Tool pages (zakat, retirement, my stack, year-end guess, ask, halving) ═══
   Builds on style.css tokens and the plan.css page shell (.plan-page, .plan-card, .plan-h, .plan-hero). */

.tool-page { max-width: 600px; }
.tool-page h1.plan-title { margin: 0; }
.tool-page h2.plan-h { margin-top: 0; }
.tool-lead { font-size: 0.86rem; color: var(--sub); line-height: 1.7; margin: -0.3rem 0.2rem 0.9rem; }

/* a labelled field: label on top, input with a unit chip */
.tf-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.7rem; }
.tf-grid.one { grid-template-columns: minmax(0, 1fr); }
.tf { display: flex; flex-direction: column; gap: 0.3rem; min-width: 0; }
.tf label { font-size: 0.74rem; font-weight: 600; color: var(--sub); }
.tf .hint { font-size: 0.66rem; color: var(--dim); line-height: 1.45; }
.tf-in { display: flex; align-items: stretch; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--card); overflow: hidden; }
.tf-in:focus-within { outline: 2px solid var(--btc); outline-offset: 1px; border-color: transparent; }
.tf-in input, .tf-in select { flex: 1; min-width: 0; border: 0; background: transparent; padding: 0.55rem 0.65rem; font-family: var(--mono); font-size: 0.95rem; font-weight: 600; color: var(--ink); direction: ltr; text-align: start; }
.tf-in input:focus, .tf-in select:focus { outline: none; }
.tf-in input[type="date"] { font-size: 0.86rem; }
.tf-in .u { display: flex; align-items: center; padding: 0 0.6rem; background: var(--bg-soft); color: var(--sub); font-family: var(--mono); font-size: 0.72rem; font-weight: 600; border-inline-start: 1px solid var(--line); white-space: nowrap; }
[dir="rtl"] .tf-in input { text-align: right; }

/* segmented choice */
.seg { display: inline-flex; background: var(--bg-soft); border: 1px solid var(--line); border-radius: 100px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg button { border: 0; background: transparent; color: var(--sub); font: inherit; font-size: 0.76rem; font-weight: 600; padding: 0.38rem 0.85rem; border-radius: 100px; cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--card); color: var(--ink); box-shadow: var(--shadow-sm); }
.seg-row { display: flex; align-items: center; justify-content: space-between; gap: 0.6rem; flex-wrap: wrap; margin-bottom: 0.8rem; }
.seg-row > span { font-size: 0.76rem; font-weight: 600; color: var(--sub); }

/* the big answer at the top */
.t-big { font-family: var(--serif); font-weight: 700; font-size: 2.9rem; line-height: 1.05; letter-spacing: -0.02em; color: var(--btc); margin: 0.25rem 0 0.3rem; font-variant-numeric: tabular-nums; direction: ltr; unicode-bidi: isolate; display: inline-block; }
.t-big.muted { color: var(--ink); }
.t-sub { font-size: 0.86rem; color: var(--sub); line-height: 1.6; }
.t-sub b { color: var(--ink); font-family: var(--mono); font-weight: 600; font-size: 0.84rem; }
.t-pill { display: inline-flex; align-items: center; gap: 0.35rem; margin-top: 0.6rem; font-size: 0.74rem; font-weight: 700; border-radius: 100px; padding: 0.26rem 0.75rem; }
.t-pill.ok { background: #e9f8f1; color: #0b7a55; border: 1px solid #bfe8d4; }
.t-pill.no { background: var(--bg-soft); color: var(--sub); border: 1px solid var(--line-strong); }
.t-pill.warn { background: #fdf6e3; color: #8a6908; border: 1px solid #f0e0ae; }

/* key/value breakdown */
.kv { width: 100%; border-collapse: collapse; font-size: 0.82rem; }
.kv td { padding: 0.5rem 0; border-bottom: 1px solid var(--line-soft); }
.kv tr:last-child td { border-bottom: 0; }
.kv td.v { text-align: end; font-family: var(--mono); font-weight: 600; color: var(--ink); direction: ltr; unicode-bidi: isolate; white-space: nowrap; }
.kv tr.total td { font-weight: 700; color: var(--ink); border-top: 1.5px solid var(--line-strong); }
.kv tr.total td.v { color: var(--btc-deep); font-size: 0.95rem; }
.kv .k-note { display: block; font-size: 0.66rem; color: var(--dim); font-weight: 400; }

/* three scenario boxes */
.t-scn { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.55rem; }
.t-scn > div { background: var(--bg-soft); border-radius: 12px; padding: 0.65rem 0.6rem; text-align: center; min-width: 0; }
.t-scn .l { font-size: 0.68rem; font-weight: 700; color: var(--sub); }
.t-scn .y { font-family: var(--serif); font-weight: 700; font-size: 1.5rem; color: var(--ink); margin-top: 0.15rem; direction: ltr; unicode-bidi: isolate; }
.t-scn .s { font-size: 0.64rem; color: var(--dim); margin-top: 0.15rem; line-height: 1.4; }
.t-scn .base { background: var(--cream); }
.t-scn .base .y { color: var(--btc-deep); }

/* primary button */
.t-btn { display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem; min-height: 44px; padding: 0 1.3rem; border-radius: 100px; background: var(--ink); color: #fff; border: 1px solid var(--ink); font: inherit; font-size: 0.84rem; font-weight: 700; cursor: pointer; text-decoration: none; }
.t-btn:hover { background: #2a2e3a; }
.t-btn[disabled] { opacity: 0.55; cursor: default; }
.t-btn.ghost { background: var(--card); color: var(--ink); border-color: var(--line-strong); }
.t-btn.ghost:hover { background: var(--bg-soft); }
.t-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-top: 0.8rem; }
.t-msg { font-size: 0.78rem; margin-top: 0.6rem; color: var(--sub); }
.t-msg.err { color: var(--dn); }
.t-msg.ok { color: #0b7a55; }

/* FAQ (static text for search engines and readers) */
.faq details { border-bottom: 1px solid var(--line-soft); padding: 0.7rem 0; }
.faq details:last-child { border-bottom: 0; }
.faq summary { cursor: pointer; font-weight: 700; font-size: 0.88rem; color: var(--ink); list-style: none; display: flex; justify-content: space-between; gap: 0.6rem; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: '+'; color: var(--btc); font-weight: 700; }
.faq details[open] summary::after { content: '−'; }
.faq p { margin: 0.5rem 0 0; font-size: 0.82rem; line-height: 1.8; color: var(--sub); }
.t-prose { font-size: 0.84rem; line-height: 1.85; color: var(--sub); }
.t-prose p { margin: 0 0 0.7rem; }
.t-prose p:last-child { margin: 0; }
.t-prose b { color: var(--ink); }

/* list of entries (my stack) */
.t-list { width: 100%; border-collapse: collapse; font-size: 0.78rem; }
.t-list th { font-size: 0.66rem; font-weight: 600; color: var(--sub); text-align: start; padding: 0 0.3rem 0.4rem; border-bottom: 1px solid var(--line); }
.t-list td { padding: 0.45rem 0.3rem; border-bottom: 1px solid var(--line-soft); white-space: nowrap; }
.t-list td.n, .t-list th.n { text-align: end; font-family: var(--mono); direction: ltr; unicode-bidi: isolate; }
.t-list button { border: 0; background: transparent; color: var(--dim); cursor: pointer; font-size: 1rem; padding: 0 0.2rem; }
.t-list button:hover { color: var(--dn); }
.t-empty { font-size: 0.8rem; color: var(--dim); text-align: center; padding: 0.8rem 0; }

/* distribution bars (year-end guess) */
.dist { display: flex; flex-direction: column; gap: 0.3rem; }
.dist-row { display: grid; grid-template-columns: 9.5rem minmax(0, 1fr) 2.4rem; gap: 0.5rem; align-items: center; font-size: 0.72rem; }
.dist-row .lbl { font-family: var(--mono); color: var(--sub); direction: ltr; unicode-bidi: isolate; text-align: end; white-space: nowrap; }
.dist-row .bar { height: 14px; background: var(--bg-soft); border-radius: 7px; overflow: hidden; }
.dist-row .bar i { display: block; height: 100%; background: var(--btc); border-radius: 7px; min-width: 2px; }
.dist-row.trend .lbl { color: var(--btc-deep); font-weight: 700; }
.dist-row.mine .bar i { background: var(--ink); }
.dist-row .c { font-family: var(--mono); color: var(--dim); text-align: end; }

/* ask */
.ask-box textarea { width: 100%; box-sizing: border-box; min-height: 84px; resize: vertical; border: 1px solid var(--line-strong); border-radius: 12px; padding: 0.7rem 0.8rem; font: inherit; font-size: 0.92rem; line-height: 1.6; color: var(--ink); background: var(--card); }
.ask-box textarea:focus { outline: 2px solid var(--btc); outline-offset: 1px; border-color: transparent; }
.ask-chips { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.6rem; }
.ask-chips button { border: 1px solid var(--line-strong); background: var(--card); color: var(--sub); border-radius: 100px; font: inherit; font-size: 0.74rem; padding: 0.3rem 0.75rem; cursor: pointer; }
.ask-chips button:hover { color: var(--ink); border-color: var(--dim); }
.ask-answer { margin-top: 1rem; padding: 0.9rem 1rem; border-radius: 14px; background: var(--cream); border-inline-start: 3px solid var(--btc); font-size: 0.9rem; line-height: 1.85; color: var(--ink); white-space: pre-wrap; }
.ask-q { font-size: 0.78rem; color: var(--sub); margin-top: 1rem; }
.ask-off { text-align: center; font-size: 0.84rem; color: var(--sub); line-height: 1.7; }

/* halving countdown */
.hv-count { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.5rem; margin-top: 0.6rem; }
.hv-count > div { background: var(--bg-soft); border-radius: 12px; padding: 0.6rem 0.3rem; text-align: center; }
.hv-count b { display: block; font-family: var(--serif); font-size: 1.9rem; line-height: 1.1; color: var(--ink); font-variant-numeric: tabular-nums; }
.hv-count span { font-size: 0.66rem; color: var(--sub); font-weight: 600; }
[dir="rtl"] .hv-count span { font-family: 'IBM Plex Sans Arabic', 'Inter', sans-serif; }

.t-links { display: flex; flex-wrap: wrap; gap: 0.4rem 0.9rem; font-size: 0.8rem; }
.t-links a { color: var(--btc-deep); font-weight: 600; text-decoration: none; }
.t-links a:hover { text-decoration: underline; }

@media (max-width: 480px) {
    .tf-grid { grid-template-columns: minmax(0, 1fr); }
    .t-big { font-size: 2.4rem; }
    .t-scn .y { font-size: 1.2rem; }
    .dist-row { grid-template-columns: 7.6rem minmax(0, 1fr) 2rem; }
    .hv-count b { font-size: 1.5rem; }
}
.hv-table small { display: block; color: var(--dim); font-size: 0.64rem; }
.hv-table { font-size: 0.74rem; }
.tool-page ~ * .lang-group, .navbar .lang-group { flex-wrap: wrap; justify-content: flex-end; }
.hv-table td, .hv-table th { padding-inline: 0.45rem; }

/* embed page */
.emb-prev { display: flex; justify-content: center; padding: .4rem 0 .8rem; }
.emb-prev iframe { border: 0; max-width: 100%; }
.emb-code { margin: 0; background: var(--bg-soft); border: 1px solid var(--line); border-radius: 10px; padding: .6rem .7rem; font-family: var(--mono); font-size: .68rem; line-height: 1.5; color: var(--ink); white-space: pre-wrap; word-break: break-all; text-align: left; }
.t-prose code { font-family: var(--mono); font-size: .78rem; background: var(--bg-soft); padding: 0 .3rem; border-radius: 4px; direction: ltr; unicode-bidi: isolate; }
[dir="rtl"] .dist-row .lbl { direction: rtl; }
.hub-row { grid-template-columns: minmax(0, 1fr); gap: .55rem; }
.hub-row .tl-item { background: var(--card); border-color: var(--line); padding: .85rem .9rem; }
.hub-row .tl-ico { background: var(--cream); }
@media (min-width: 560px) { .hub-row { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
