/* =========================================================
   JAFU Calculator
   ভাবনা: হালখাতা। ফলাফল দেখায় লাল কাপড়ে বাঁধানো খাতার পাতার মতো—
   নীল রুল, লাল মার্জিন, যোগফলের নিচে দুই দাগ। বাকি সব চুপচাপ।
   ========================================================= */

@font-face {
  font-family: 'Anek Bangla';
  font-style: normal;
  font-display: swap;
  font-weight: 100 800;
  font-stretch: 75% 125%;
  src: url(../vendor/fonts/anek-bangla-bengali-standard-normal.woff2) format('woff2-variations'),
       url(../vendor/fonts/anek-bangla-bengali-standard-normal.woff2) format('woff2');
  unicode-range: U+0951-0952, U+0964-0965, U+0980-09FE, U+1CD0-1CF7, U+200C-200D, U+20B9, U+25CC, U+A8F1;
}
@font-face {
  font-family: 'Anek Bangla';
  font-style: normal;
  font-display: swap;
  font-weight: 100 800;
  font-stretch: 75% 125%;
  src: url(../vendor/fonts/anek-bangla-latin-standard-normal.woff2) format('woff2-variations'),
       url(../vendor/fonts/anek-bangla-latin-standard-normal.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --bg: #f2f4f1;
  --paper: #ffffff;
  --ink: #1b2431;
  --ink-2: #445063;
  --muted: #687384;
  --line: #d8dde3;
  --rule: #d3e0ef;
  --margin: #e6a0a6;
  --green: #0b5d45;
  --green-ink: #084a37;
  --green-tint: #e1eee8;
  --on-green: #ffffff;
  --red: #b3202c;
  --red-deep: #861720;
  --red-tint: #f9e6e7;
  --amber: #8a5a00;
  --amber-tint: #fbf0d9;
  --hl: rgba(255, 207, 0, .30);
  --radius: 14px;
  --font: 'Anek Bangla', 'Noto Sans Bengali', 'Hind Siliguri', 'Kalpurush', 'SolaimanLipi', system-ui, sans-serif;

  --bs-body-font-family: var(--font);
  --bs-body-bg: var(--bg);
  --bs-body-color: var(--ink);
  --bs-border-color: var(--line);
  --bs-link-color: var(--green);
  --bs-link-color-rgb: 11, 93, 69;
  --bs-link-hover-color: var(--green-ink);
}

:root[data-bs-theme="dark"] {
  --bg: #11161c;
  --paper: #182029;
  --ink: #e6ebf1;
  --ink-2: #b6c1ce;
  --muted: #8b97a7;
  --line: #2b3643;
  --rule: #263546;
  --margin: #6f343a;
  --green: #3cb98a;
  --green-ink: #5ccc9f;
  --green-tint: #15332a;
  --on-green: #062419;
  --red: #e2555f;
  --red-deep: #a3313b;
  --red-tint: #3a1c20;
  --amber: #f0b54a;
  --amber-tint: #362a12;
  --hl: rgba(255, 207, 0, .14);
  --bs-link-color-rgb: 60, 185, 138;
}

/* ---------- ভিত্তি ---------- */
html { font-size: 17px; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.6;
  font-variant-numeric: tabular-nums;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.site-main { flex: 1; padding-top: 1.5rem; padding-bottom: 3rem; }
h1, h2, h3 { color: var(--ink); line-height: 1.25; }
a { color: var(--green); }
a:hover { color: var(--green-ink); }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--green) 55%, transparent); outline-offset: 2px; }
.skip-link { position: absolute; left: -999px; top: 0; background: var(--paper); padding: .5rem 1rem; z-index: 100; }
.skip-link:focus { left: 1rem; top: 1rem; }
.muted { color: var(--muted); }
code { color: var(--red); }

/* ---------- হেডার ---------- */
.site-header { background: var(--paper); border-bottom: 1px solid var(--line); }
.hdr { display: flex; align-items: center; gap: 1rem; min-height: 64px; }
.brand { display: inline-flex; align-items: center; gap: .6rem; text-decoration: none; color: var(--ink); }
.brand:hover { color: var(--ink); }
.brand-mark { flex: none; }
.brand-word { display: flex; flex-direction: column; line-height: 1; }
.brand-word b { font-weight: 800; font-stretch: 118%; font-size: 1.3rem; letter-spacing: .04em; }
.brand-word span { font-size: .8rem; color: var(--muted); margin-top: .2rem; }
.hdr-date { margin: 0 0 0 auto; text-align: right; line-height: 1.25; display: flex; flex-direction: column; }
.hdr-date .bdate { font-weight: 600; color: var(--red); }
.hdr-date .gdate { font-size: .85rem; color: var(--muted); }
.hdr-tools { display: flex; gap: .4rem; align-items: center; }
.hdr-tools form { margin: 0; }
.tool {
  border: 1px solid var(--line); background: transparent; color: var(--ink-2);
  border-radius: 10px; min-width: 2.6rem; height: 2.4rem; padding: 0 .6rem;
  font: inherit; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; gap: .35rem;
  text-decoration: none;
}
.tool:hover { background: var(--green-tint); color: var(--ink); }
@media (max-width: 575.98px) {
  .hdr-date .gdate, .hdr-date .wd { display: none; }
  .hdr-date { font-size: .85rem; }
  .brand-word span { display: none; }
}

/* ---------- প্রথম পাতা ---------- */
.hero { padding: 2.2rem 0 1.6rem; max-width: 46rem; }
.hero-title {
  font-size: clamp(2.5rem, 7vw, 4.4rem);
  font-weight: 760;
  font-stretch: 116%;
  letter-spacing: -.01em;
  margin: 0 0 .5rem;
}
.hero-sub { font-size: 1.15rem; color: var(--ink-2); max-width: 38rem; margin-bottom: 1.4rem; }
.search { position: relative; max-width: 34rem; }
.search i { position: absolute; left: 1.05rem; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search input {
  width: 100%; font: inherit; font-size: 1.15rem; padding: .85rem 1rem .85rem 2.9rem;
  border: 2px solid var(--ink); border-radius: var(--radius); background: var(--paper); color: var(--ink);
}
.search input:focus { outline: none; border-color: var(--green); box-shadow: 0 0 0 4px var(--green-tint); }

.today {
  display: grid; grid-template-columns: repeat(3, 1fr);
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius);
  margin: 1.2rem 0 2.4rem; overflow: hidden;
}
.rate { display: flex; flex-direction: column; padding: 1rem 1.25rem; text-decoration: none; color: var(--ink); }
.rate + .rate { border-left: 1px dashed var(--line); }
.rate:hover { background: var(--green-tint); color: var(--ink); }
.rate-k { font-size: .9rem; color: var(--ink-2); }
.rate-v { font-size: 1.75rem; font-weight: 700; font-stretch: 92%; line-height: 1.2; }
.rate-d { font-size: .8rem; color: var(--muted); }
@media (max-width: 767.98px) {
  .today { grid-template-columns: 1fr; }
  .rate + .rate { border-left: 0; border-top: 1px dashed var(--line); }
}

.index { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2rem 2.5rem; }
@media (max-width: 767.98px) { .index { grid-template-columns: 1fr; } }
.cat-title { font-size: 1rem; font-weight: 700; color: var(--green); margin: 0 0 .4rem; padding-bottom: .4rem; border-bottom: 2px solid var(--green); }
.cat-list { list-style: none; margin: 0; padding: 0; }
.cat-list li + li { border-top: 1px solid var(--line); }
.cat-list a { display: flex; gap: .85rem; align-items: flex-start; padding: .75rem .4rem; text-decoration: none; color: var(--ink); border-radius: 8px; }
.cat-list a:hover { background: var(--paper); }
.cat-list a:hover b { color: var(--green); }
.ci-icon { flex: none; width: 2.3rem; height: 2.3rem; border-radius: 9px; display: grid; place-items: center; background: var(--green-tint); color: var(--green); }
.ci-text { display: flex; flex-direction: column; }
.ci-text b { font-weight: 650; font-size: 1.08rem; }
.ci-text small { color: var(--muted); font-size: .9rem; line-height: 1.45; }
.no-match { grid-column: 1 / -1; color: var(--ink-2); padding: 1rem 0; }

/* ---------- ক্যালকুলেটর পাতা ---------- */
.crumbs { display: flex; gap: .75rem; align-items: center; font-size: .92rem; margin-bottom: 1rem; flex-wrap: wrap; }
.crumbs a { text-decoration: none; font-weight: 600; }
.crumb-cat { color: var(--muted); }
.crumb-cat::before { content: '/'; margin-right: .75rem; color: var(--line); }
.calc-head { display: flex; gap: 1rem; align-items: flex-start; margin-bottom: 1.5rem; }
.calc-icon { flex: none; width: 3rem; height: 3rem; border-radius: 12px; background: var(--red-tint); color: var(--red); display: grid; place-items: center; font-size: 1.3rem; }
.calc-head h1 { font-size: clamp(1.6rem, 4vw, 2.2rem); font-weight: 720; font-stretch: 108%; margin: 0; }
.calc-head p { color: var(--ink-2); margin: .2rem 0 0; }

.calc-grid { display: grid; gap: 1.75rem; grid-template-columns: minmax(0, 1fr); align-items: start; }
@media (min-width: 992px) {
  .calc-grid { grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: 2.25rem; }
  .calc-output { position: sticky; top: 1rem; }
}
.calc-input { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.4rem; }
@media (max-width: 575.98px) { .calc-input { padding: 1.1rem; } }
.form-intro, .mode-hint { color: var(--ink-2); font-size: .95rem; }
.mode-hint { margin: -.4rem 0 1rem; }

/* ঘর */
.field { margin-bottom: 1.05rem; }
.form-label { font-weight: 600; margin-bottom: .3rem; color: var(--ink); }
.opt { font-weight: 400; font-size: .8rem; color: var(--muted); border: 1px solid var(--line); border-radius: 6px; padding: 0 .35rem; margin-left: .25rem; }
.form-control, .form-select { font-size: 1.08rem; border-color: var(--line); background-color: var(--paper); color: var(--ink); border-radius: 10px; padding: .55rem .8rem; }
.form-control-sm, .form-select-sm { font-size: .98rem; padding: .35rem .55rem; border-radius: 8px; }
.form-control:focus, .form-select:focus { border-color: var(--green); box-shadow: 0 0 0 3px var(--green-tint); background-color: var(--paper); color: var(--ink); }
.form-control::placeholder { color: color-mix(in srgb, var(--muted) 70%, transparent); }
.input-group-text { background: var(--bg); border-color: var(--line); color: var(--ink-2); font-weight: 600; }
.input-group > .form-control { border-radius: 10px; }
.input-group > :not(:last-child) { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.input-group > :not(:first-child) { border-top-left-radius: 0; border-bottom-left-radius: 0; }
.form-text { color: var(--muted); font-size: .86rem; margin-top: .3rem; }
.num { font-variant-numeric: tabular-nums; }

.field-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; align-items: start; }
.field-row.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.field-row.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 420px) {
  .field-row.three { grid-template-columns: 1fr 1fr; }
  .field-row.four { grid-template-columns: 1fr 1fr; }
}

/* বোতাম-রেডিও */
.seg { display: inline-flex; flex-wrap: wrap; border: 1px solid var(--line); border-radius: 11px; padding: 3px; background: var(--bg); gap: 2px; }
.seg-btn { padding: .42rem .85rem; border-radius: 8px; cursor: pointer; color: var(--ink-2); font-weight: 600; font-size: .96rem; user-select: none; }
.seg-btn:hover { color: var(--ink); background: var(--paper); }
.btn-check:checked + .seg-btn { background: var(--green); color: var(--on-green); }
.btn-check:focus-visible + .seg-btn { outline: 3px solid color-mix(in srgb, var(--green) 55%, transparent); }

.group { border: 0; border-top: 1px solid var(--line); padding: 1rem 0 0; margin: 1rem 0 0; }
.group legend { font-size: .95rem; font-weight: 700; color: var(--green); float: none; width: auto; padding: 0 .5rem 0 0; margin-bottom: .6rem; }
.metal-row + .metal-row { border-top: 1px dashed var(--line); padding-top: 1rem; }

details.more { border-top: 1px solid var(--line); margin: .4rem 0 .6rem; padding-top: .8rem; }
details.more > summary { cursor: pointer; font-weight: 600; color: var(--green); margin-bottom: .8rem; list-style: none; }
details.more > summary::-webkit-details-marker { display: none; }
details.more > summary::before { content: '+'; display: inline-block; width: 1.2rem; font-weight: 800; }
details.more[open] > summary::before { content: '−'; }

.chips { display: flex; gap: .4rem; flex-wrap: wrap; margin: -.4rem 0 1rem; }
.chip { border: 1px solid var(--line); background: var(--paper); color: var(--ink-2); border-radius: 999px; padding: .15rem .75rem; font: inherit; font-size: .9rem; }
.chip:hover { border-color: var(--green); color: var(--green); }

.submit-row { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; margin-top: 1.2rem; }
.btn { font-family: inherit; }
.btn-jafu { --bs-btn-bg: var(--green); --bs-btn-color: var(--on-green); --bs-btn-border-color: var(--green);
  --bs-btn-hover-bg: var(--green-ink); --bs-btn-hover-color: var(--on-green); --bs-btn-hover-border-color: var(--green-ink);
  --bs-btn-active-bg: var(--green-ink); --bs-btn-active-color: var(--on-green);
  font-weight: 650; border-radius: 10px; padding: .6rem 1.25rem; }
.btn-jafu.btn-sm { padding: .35rem .85rem; font-size: .95rem; }
.btn-quiet { --bs-btn-color: var(--ink-2); --bs-btn-hover-color: var(--ink); --bs-btn-hover-bg: var(--bg); --bs-btn-border-color: transparent; font-weight: 600; }

/* ---------- হালখাতা: ফলাফলের পাতা ---------- */
.khata {
  position: relative;
  background: var(--paper);
  border: 1px solid var(--line);
  border-left: 12px solid var(--red);
  border-radius: 6px var(--radius) var(--radius) 6px;
  box-shadow: inset 3px 0 0 var(--red-deep);
}
.khata-body { position: relative; padding: 1rem 1.3rem 1.3rem 2.6rem; }
.khata-body::before { /* লাল মার্জিন */
  content: ''; position: absolute; top: 0; bottom: 0; left: 1.55rem; width: 2px;
  background: var(--margin); opacity: .8;
}
.khata-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding: .7rem 1rem .6rem 2.6rem; border-bottom: 2px solid var(--margin); }
.khata-head h2 { font-size: 1rem; font-weight: 700; color: var(--red); margin: 0; }
.khata-tools { display: flex; gap: .2rem; }
.kt { border: 0; background: transparent; color: var(--muted); width: 2.1rem; height: 2.1rem; border-radius: 8px; }
.kt:hover { background: var(--bg); color: var(--ink); }

.khata-blank { border-left-color: var(--line); box-shadow: none; border-style: dashed; border-left-style: solid; }
.khata-blank .khata-body::before { background: var(--line); }
.khata-hint { color: var(--muted); margin: 1.6rem 0; }
.khata-err { border-left-color: var(--amber); box-shadow: none; }
.khata-err .khata-body::before { background: var(--amber-tint); }
.err-title { font-weight: 700; color: var(--amber); margin: .2rem 0 .4rem; }
.khata-err ul { margin: 0; padding-left: 1.1rem; }

.answer { padding: .3rem 0 1rem; }
.answer-label { color: var(--ink-2); font-weight: 600; }
.answer-value {
  display: inline-block;
  font-size: clamp(2.1rem, 6vw, 3rem);
  font-weight: 760;
  font-stretch: 88%;
  line-height: 1.15;
  padding-bottom: .15rem;
  border-bottom: 5px double var(--ink);
  word-break: break-word;
}
.answer-note { color: var(--muted); margin-top: .45rem; font-size: .95rem; }
.answer.tone-good .answer-value { color: var(--green); border-bottom-color: var(--green); }
.answer.tone-bad .answer-value { color: var(--red); border-bottom-color: var(--red); }
.answer.tone-warn .answer-value { color: var(--amber); border-bottom-color: var(--amber); }

.kl-list { margin: .4rem 0 .8rem; }
.kl { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; padding: .42rem 0; border-bottom: 1px solid var(--rule); }
.kl dt { font-weight: 400; color: var(--ink-2); }
.kl dt small { display: block; color: var(--muted); font-size: .82rem; }
.kl dd { margin: 0; text-align: right; font-weight: 600; white-space: nowrap; }
.kl.minus dd { color: var(--red); }
.kl.sub dt { color: var(--ink); font-weight: 600; }
.kl.note dd { color: var(--amber); }
.kl.total { border-bottom: 0; padding-top: .55rem; }
.kl.total dt { color: var(--ink); font-weight: 700; }
.kl.total dd { font-weight: 760; font-size: 1.15rem; border-top: 1px solid var(--ink); border-bottom: 4px double var(--ink); padding: .1rem 0 .05rem .6rem; }
.kl.total.good dd { color: var(--green); }

.table-wrap { overflow-x: auto; margin: .6rem 0 .8rem; }
.ktable { width: 100%; border-collapse: collapse; font-size: .95rem; }
.ktable caption { caption-side: top; color: var(--ink); font-weight: 700; padding: 0 0 .35rem; }
.ktable th { font-weight: 600; color: var(--ink-2); border-bottom: 1px solid var(--ink); padding: .35rem .4rem; text-align: left; }
.ktable td { padding: .38rem .4rem; border-bottom: 1px solid var(--rule); vertical-align: top; }
.ktable .num { text-align: right; white-space: nowrap; }
.ktable tfoot th, .ktable tfoot td { border-top: 1px solid var(--ink); border-bottom: 4px double var(--ink); font-weight: 700; color: var(--ink); }
.ktable tr.idle td { color: var(--muted); }
.ktable tr.hl td { background: var(--hl); }
.ktable tr.bad td { color: var(--red); }
.ktable tr.sub td { color: var(--ink-2); font-style: italic; }
.cell-note { display: block; color: var(--muted); font-size: .8rem; }
.ktable-mini { font-size: .9rem; }
.schedule summary { cursor: pointer; color: var(--green); font-weight: 600; margin: .4rem 0; }

.callout { background: var(--bg); border-radius: 10px; padding: .65rem .85rem; margin: .6rem 0; font-size: .95rem; }
.callout.warn { background: var(--amber-tint); color: var(--ink); }
.callout.good { background: var(--green-tint); }

.split { display: flex; height: 12px; border-radius: 6px; overflow: hidden; background: var(--red-tint); margin: .2rem 0 .3rem; }
.split-a { background: var(--green); }
.split-legend { font-size: .85rem; color: var(--muted); display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; }
.lg { display: inline-block; width: .8rem; height: .8rem; border-radius: 3px; margin-left: .4rem; }
.lg-a { background: var(--green); margin-left: 0; }
.lg-b { background: var(--red-tint); border: 1px solid var(--margin); }

.bmi-scale { position: relative; margin: .4rem 0 1.2rem; padding-top: 12px; }
.bmi-bar { display: flex; height: 12px; border-radius: 6px; overflow: hidden; }
.bmi-bar .b1 { width: 17.5%; background: #e0b043; }
.bmi-bar .b2 { width: 32.5%; background: #3e9b74; }
.bmi-bar .b3 { width: 25%; background: #e0b043; }
.bmi-bar .b4 { width: 25%; background: #d0525c; }
.bmi-pin { position: absolute; top: 0; width: 0; height: 0; border-left: 7px solid transparent; border-right: 7px solid transparent; border-top: 10px solid var(--ink); transform: translateX(-7px); }
.bmi-ticks { position: relative; height: 1.2rem; font-size: .78rem; color: var(--muted); }
.bmi-ticks span { position: absolute; transform: translateX(-50%); }
.bmi-ticks span:nth-child(1) { left: 17.5%; }
.bmi-ticks span:nth-child(2) { left: 50%; }
.bmi-ticks span:nth-child(3) { left: 75%; }

.words-num { font-size: 1.8rem; font-weight: 740; font-stretch: 90%; margin: .2rem 0 .6rem; }
.words-item { padding: .7rem 0; border-bottom: 1px solid var(--rule); }
.words-k { font-size: .85rem; color: var(--muted); font-weight: 600; }
.words-v { font-size: 1.22rem; font-weight: 600; margin: .1rem 0 .3rem; line-height: 1.5; }

.price-board { margin-bottom: 1.2rem; padding-bottom: 1rem; border-bottom: 1px solid var(--line); }
.board-date { font-size: .82rem; color: var(--muted); margin: .3rem 0 0; }

/* ফলাফল বদলালে এক ঝলক — শুধু ব্যবহারকারীর কাজের জবাবে */
.calc-output.is-fresh .answer-value,
.pct-out.is-fresh .mini-ans b { animation: settle .28s ease-out; }
@keyframes settle { from { opacity: .35; transform: translateY(3px); } to { opacity: 1; transform: none; } }
.calc-output.is-loading { opacity: .75; transition: opacity .15s; }

/* শতকরা পাতা */
.pct-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.25rem; }
@media (max-width: 767.98px) { .pct-grid { grid-template-columns: 1fr; } }
.pct-card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.15rem 1.2rem 1rem; border-top: 4px solid var(--green); }
.pct-card h2 { font-size: 1.08rem; font-weight: 700; margin: 0 0 .8rem; }
.pct-card .field { margin-bottom: .7rem; }
.pct-out:not(:empty) { margin-top: .9rem; padding-top: .7rem; border-top: 1px dashed var(--line); }
.mini-ans { margin: 0; display: flex; flex-direction: column; }
.mini-ans b { font-size: 1.6rem; font-weight: 740; font-stretch: 90%; line-height: 1.2; }
.mini-ans span { color: var(--muted); font-size: .92rem; }
.mini-err { color: var(--amber); margin: 0; font-size: .95rem; }

/* জিপিএ সারণি */
.grade-table { width: 100%; border-collapse: separate; border-spacing: 0 .35rem; }
.grade-table th { font-size: .85rem; color: var(--muted); font-weight: 600; padding: 0 .25rem; }
.grade-table td { padding: 0 .25rem; }
.grade-table td:first-child { width: 55%; }

/* সাধারণ ক্যালকুলেটর */
.basic-wrap { display: grid; grid-template-columns: minmax(0, 420px) minmax(0, 1fr); gap: 2rem; align-items: start; }
@media (max-width: 767.98px) { .basic-wrap { grid-template-columns: 1fr; } }
.basic-calc { background: var(--paper); border: 1px solid var(--line); border-left: 12px solid var(--red); border-radius: 6px var(--radius) var(--radius) 6px; padding: 1rem; }
.bc-screen { border-bottom: 2px solid var(--margin); padding: .4rem .3rem .6rem; margin-bottom: .9rem; text-align: right; min-height: 6rem; display: flex; flex-direction: column; justify-content: flex-end; }
.bc-expr { color: var(--muted); font-size: 1.05rem; min-height: 1.6rem; word-break: break-all; }
.bc-out { display: block; font-size: clamp(2.2rem, 9vw, 3rem); font-weight: 760; font-stretch: 88%; line-height: 1.1; word-break: break-all; }
.bc-keys { display: grid; grid-template-columns: repeat(4, 1fr); gap: .5rem; }
.k { font: inherit; font-size: 1.45rem; font-weight: 600; height: 3.6rem; border-radius: 12px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); }
.k:hover { border-color: var(--ink-2); }
.k:active { transform: translateY(1px); }
.k-fn { color: var(--ink-2); font-size: 1.2rem; }
.k-op { background: var(--green-tint); color: var(--green); border-color: transparent; font-size: 1.6rem; }
.k-eq { background: var(--green); color: var(--on-green); border-color: var(--green); }
.bc-side h2 { font-size: 1.05rem; font-weight: 700; }
.bc-history { list-style: none; padding: 0; margin: 0 0 1rem; }
.bc-history li { padding: .45rem 0; border-bottom: 1px solid var(--rule); display: flex; justify-content: space-between; gap: 1rem; cursor: pointer; }
.bc-history li:hover { color: var(--green); }
.bc-history li span { color: var(--muted); }
.bc-history .bc-empty { color: var(--muted); cursor: default; }
.bc-tip { color: var(--muted); font-size: .9rem; }

/* পাতার নিচে */
.calc-foot { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 2rem; margin-top: 2.5rem; padding-top: 1.5rem; border-top: 1px solid var(--line); }
@media (max-width: 767.98px) { .calc-foot { grid-template-columns: 1fr; } }
.calc-foot.no-notes { grid-template-columns: 1fr; }
.calc-foot.no-notes .related ul { display: flex; flex-wrap: wrap; gap: .25rem 1.5rem; }
.calc-foot.no-notes .related li + li { border-top: 0; }
.calc-foot h2 { font-size: 1.05rem; font-weight: 700; margin-bottom: .6rem; }
.notes ul { padding-left: 1.1rem; color: var(--ink-2); }
.notes li { margin-bottom: .45rem; }
.notes .ktable { max-width: 26rem; margin-top: 1rem; }
.related ul { list-style: none; padding: 0; margin: 0; }
.related li + li { border-top: 1px solid var(--line); }
.related a { display: block; padding: .5rem 0; text-decoration: none; font-weight: 600; }
.related i { width: 1.4rem; color: var(--muted); }

.empty-page { max-width: 36rem; padding: 3rem 0; }

/* ফুটার */
.site-footer { border-top: 1px solid var(--line); background: var(--paper); padding: 1.4rem 0; font-size: .9rem; color: var(--muted); }
.foot-note { max-width: 46rem; margin-bottom: .4rem; }
.foot-copy { margin: 0; }

/* ---------- ইনস্টল ও লগইন ---------- */
.page-install, .page-login { background: var(--bg); }
.install-box { max-width: 520px; margin: 3rem auto; background: var(--paper); border: 1px solid var(--line); border-left: 12px solid var(--red); border-radius: 6px var(--radius) var(--radius) 6px; padding: 1.6rem 1.8rem; }
.install-box h1 { font-size: 1.5rem; font-weight: 720; margin: .6rem 0 1rem; }
.install-box.warn { border-left-color: var(--amber); }
.install-brand { color: var(--red); font-weight: 700; margin: 0; }
.install-form .form-label { margin-top: .8rem; }
.install-steps li { margin-bottom: .4rem; }
.install-err { background: var(--bg); padding: .8rem; border-radius: 8px; white-space: pre-wrap; font-size: .85rem; }
.login-box .brand { margin-bottom: .5rem; }

/* ---------- অ্যাডমিন ---------- */
.admin-shell { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 2rem; padding-top: 1.5rem; padding-bottom: 3rem; flex: 1; }
@media (max-width: 991.98px) { .admin-shell { grid-template-columns: 1fr; gap: 1rem; } }
.admin-nav { display: flex; flex-direction: column; gap: .15rem; }
@media (max-width: 991.98px) { .admin-nav { flex-direction: row; flex-wrap: wrap; } .admin-who { display: none; } }
.admin-nav a { padding: .5rem .75rem; border-radius: 9px; text-decoration: none; color: var(--ink-2); font-weight: 600; }
.admin-nav a i { width: 1.3rem; color: var(--muted); }
.admin-nav a:hover { background: var(--paper); color: var(--ink); }
.admin-nav a.active { background: var(--green); color: var(--on-green); }
.admin-nav a.active i { color: inherit; }
.admin-who { margin-top: 1rem; font-size: .85rem; color: var(--muted); padding-left: .75rem; }
.admin-title { font-size: 1.6rem; font-weight: 720; margin-bottom: 1rem; }
.admin-sub { font-size: 1.1rem; font-weight: 700; color: var(--green); margin: 1.6rem 0 .6rem; }
.admin-main form > .btn-jafu { margin-top: 1rem; }
.admin-table { --bs-table-bg: var(--paper); --bs-table-color: var(--ink); background: var(--paper); border: 1px solid var(--line); }
.admin-table th { color: var(--ink-2); font-weight: 600; font-size: .9rem; }
.admin-table .num { text-align: right; }
.admin-table input.num { text-align: right; }
.admin-table tr.new-row td { background: var(--bg); }
.admin-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 1.25rem; max-width: 52rem; }
@media (max-width: 767.98px) { .admin-fields { grid-template-columns: 1fr; } }
.admin-narrow { max-width: 26rem; }
.dash-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; margin-bottom: 1.2rem; }
@media (max-width: 767.98px) { .dash-stats { grid-template-columns: 1fr 1fr; } }
.stat { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: .9rem 1rem; display: flex; flex-direction: column; }
.stat-k { color: var(--muted); font-size: .88rem; }
.stat-v { font-size: 1.6rem; font-weight: 720; font-stretch: 92%; }
.stat.stale { border-color: var(--amber); background: var(--amber-tint); }
.dash-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.25rem; }
@media (max-width: 991.98px) { .dash-grid { grid-template-columns: 1fr; } }
.panel { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem 1.2rem; }
.panel h2 { font-size: 1.05rem; font-weight: 700; margin-bottom: .8rem; }
.bars { display: flex; align-items: flex-end; gap: 6px; height: 160px; }
.bar { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; }
.bar span { display: block; width: 100%; background: var(--green); border-radius: 4px 4px 0 0; min-height: 4px; }
.bar small { font-size: .72rem; color: var(--muted); margin-top: .2rem; }

/* ---------- প্রিন্ট: শুধু খাতার পাতা ---------- */
@media print {
  .site-header, .site-footer, .calc-input, .crumbs, .calc-foot, .khata-tools, .skip-link, .admin-nav { display: none !important; }
  body { background: #fff; }
  .calc-grid { display: block; }
  .khata { box-shadow: none; border-left-width: 6px; }
  .calc-head { margin-bottom: .5rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
