/* ============================================================
   Quran Reading Coordination — modern, clean design system
   Arabic-first (RTL) with English fallback.
   ============================================================ */

:root {
  --brand: #0f766e;
  --brand-strong: #0d5d57;
  --brand-soft: #ccfbf1;
  --brand-contrast: #ffffff;

  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #f1f5f9;
  --surface-3: #e9eef5;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --text: #0f172a;
  --text-muted: #64748b;
  --text-faint: #94a3b8;

  --success: #10b981;
  --success-strong: #059669;
  --success-soft: #ecfdf5;
  --danger: #ef4444;
  --danger-soft: #fef2f2;
  --gold: #f59e0b;
  --gold-soft: #fffbeb;
  --gold-border: #fcd34d;
  --gold-text: #92400e;
  --indigo: #4f46e5;

  --radius-sm: 8px;
  --radius: 14px;
  --radius-lg: 20px;
  --radius-pill: 999px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .06), 0 1px 3px rgba(15, 23, 42, .04);
  --shadow: 0 4px 16px rgba(15, 23, 42, .06), 0 2px 6px rgba(15, 23, 42, .04);
  --shadow-lg: 0 12px 32px rgba(15, 23, 42, .14);
  --ring: 0 0 0 3px rgba(15, 118, 110, .28);
  --ease: cubic-bezier(.2, .7, .3, 1);

  --container: 980px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { color-scheme: dark; }
  :root:not([data-theme="light"]) { --dark: 1; }
}

:root[data-theme="dark"],
:root[data-auto-dark="1"] {
  --bg: #0b1120;
  --surface: #131c2e;
  --surface-2: #1b2740;
  --surface-3: #223052;
  --border: #25324d;
  --border-strong: #33425f;
  --text: #e8edf6;
  --text-muted: #9fb0cc;
  --text-faint: #6b7c9c;
  --brand: #2dd4bf;
  --brand-strong: #14b8a6;
  --brand-soft: #134e4a;
  --brand-contrast: #052e2b;
  --success-soft: #0c2a23;
  --danger-soft: #2a1416;
  --gold-soft: #2a2410;
  --gold-border: #b45309;
  --gold-text: #fcd34d;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow: 0 6px 20px rgba(0, 0, 0, .45);
  --shadow-lg: 0 14px 40px rgba(0, 0, 0, .6);
  --ring: 0 0 0 3px rgba(45, 212, 191, .35);
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: "Cairo", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.container {
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 clamp(14px, 4vw, 28px);
}

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-block: 14px;
}
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-mark {
  display: grid; place-items: center;
  width: 42px; height: 42px;
  border-radius: 12px;
  background: linear-gradient(140deg, var(--brand), var(--brand-strong));
  color: var(--brand-contrast);
  box-shadow: var(--shadow-sm);
  flex: none;
}
.brand-text h1 { margin: 0; font-size: clamp(1.05rem, 3.4vw, 1.3rem); font-weight: 800; letter-spacing: -.01em; }
.brand-text p { margin: 1px 0 0; font-size: .82rem; color: var(--text-muted); }
@media (max-width: 480px) { .brand-text p { display: none; } }

.header-actions { display: flex; align-items: center; gap: 8px; flex: none; }

/* ---------- Buttons ---------- */
.btn {
  appearance: none;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 10px 18px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: background .18s var(--ease), border-color .18s var(--ease),
    transform .08s var(--ease), box-shadow .18s var(--ease), color .18s var(--ease);
}
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: none; box-shadow: var(--ring); }
.btn-primary { background: linear-gradient(140deg, var(--brand), var(--brand-strong)); color: var(--brand-contrast); box-shadow: var(--shadow-sm); }
.btn-primary:hover { filter: brightness(1.05); box-shadow: var(--shadow); }
.btn-ghost { background: var(--surface-2); color: var(--text); border-color: var(--border); padding: 7px 13px; font-size: .86rem; }
.btn-ghost:hover { border-color: var(--border-strong); background: var(--surface); }
.btn-danger { background: var(--danger-soft); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 35%, transparent); }
.btn-danger:hover { background: var(--danger); color: #fff; }
.btn-block { width: 100%; justify-content: center; display: inline-flex; align-items: center; gap: 8px; }

.icon-button {
  display: grid; place-items: center;
  width: 42px; height: 42px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer; flex: none;
  font-weight: 800; font-size: .9rem;
  transition: border-color .18s var(--ease), background .18s var(--ease), transform .08s var(--ease);
}
.icon-button:hover { border-color: var(--border-strong); }
.icon-button:active { transform: translateY(1px); }
.icon-button:focus-visible { outline: none; box-shadow: var(--ring); }

.icon-moon { display: none; }
:root[data-theme="dark"] .icon-sun, :root[data-auto-dark="1"] .icon-sun { display: none; }
:root[data-theme="dark"] .icon-moon, :root[data-auto-dark="1"] .icon-moon { display: block; }

/* ---------- Tabs ---------- */
.tabs { position: sticky; top: 71px; z-index: 19; background: var(--bg); border-bottom: 1px solid var(--border); }
.tabs-inner { display: flex; gap: 6px; }
.tab {
  appearance: none; background: none; border: none;
  font: inherit; font-weight: 700; color: var(--text-muted);
  padding: 13px 6px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 7px;
  border-bottom: 3px solid transparent;
  margin-bottom: -1px;
  transition: color .18s var(--ease), border-color .18s var(--ease);
}
.tab .tab-ico { font-size: 1.05rem; }
.tab + .tab { margin-inline-start: 18px; }
.tab:hover { color: var(--text); }
.tab.is-active { color: var(--brand); border-bottom-color: var(--brand); }
.tab:focus-visible { outline: none; box-shadow: var(--ring); border-radius: 6px; }

/* ---------- Cards & layout ---------- */
main.container { padding-top: 24px; padding-bottom: 56px; }
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: clamp(18px, 4vw, 28px);
  margin-bottom: 22px;
}
.card-title { margin: 0; font-size: 1.18rem; font-weight: 800; letter-spacing: -.01em; }
.card-subtitle { margin: 4px 0 18px; color: var(--text-muted); font-size: .92rem; }
.section-subhead { margin: 0; font-size: .8rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--text-faint); }

.summary-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }
.summary-columns .card { margin-bottom: 0; }
@media (max-width: 760px) { .summary-columns { grid-template-columns: 1fr; gap: 22px; } }
.stack > * + * { margin-top: 12px; }

/* ---------- Form fields ---------- */
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 18px; }
@media (max-width: 560px) { .field-grid { grid-template-columns: 1fr; } }
.field { margin-bottom: 18px; }
.field:last-child { margin-bottom: 0; }
.field label, .field-label { display: block; margin-bottom: 7px; font-size: .85rem; font-weight: 700; color: var(--text-muted); }

input[type="text"], input[type="date"] {
  width: 100%;
  padding: 11px 13px;
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  transition: border-color .18s var(--ease), box-shadow .18s var(--ease);
}
input::placeholder { color: var(--text-faint); }
input:focus { outline: none; border-color: var(--brand); box-shadow: var(--ring); }
input[type="date"]::-webkit-calendar-picker-indicator { cursor: pointer; opacity: .65; }

/* ---------- Color selector ---------- */
.color-selector { display: flex; flex-wrap: wrap; gap: 10px; }
.color-option {
  width: 36px; height: 36px; border-radius: 50%;
  cursor: pointer; border: 2px solid transparent; position: relative;
  transition: transform .15s var(--ease), box-shadow .15s var(--ease);
}
.color-option:hover { transform: scale(1.08); }
.color-option:focus-visible { outline: none; box-shadow: var(--ring); }
.color-option[aria-checked="true"] { transform: scale(1.08); box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--text); }
.color-option[aria-checked="true"]::after {
  content: "✓"; position: absolute; inset: 0; display: grid; place-items: center;
  color: #fff; font-weight: 800; font-size: 17px; text-shadow: 0 1px 2px rgba(0, 0, 0, .45);
}

/* ---------- Portions grids ---------- */
.portions-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.portions-toolbar .field-label { margin-bottom: 0; }
.toolbar-actions { display: flex; gap: 8px; }

.portions-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; }
.portions-grid--overview { gap: 12px; }
@media (max-width: 620px) { .portions-grid { grid-template-columns: repeat(5, 1fr); } }
@media (max-width: 420px) { .portions-grid { grid-template-columns: repeat(4, 1fr); gap: 8px; } }

/* selectable portion (claim grid) */
.portion {
  position: relative;
  border: 1.5px solid var(--border-strong);
  background: var(--surface-2);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 12px 4px; text-align: center; font-weight: 700;
  cursor: pointer; user-select: none;
  transition: transform .1s var(--ease), border-color .15s var(--ease), background .15s var(--ease), box-shadow .15s var(--ease);
}
.portion:hover:not(.is-taken) { border-color: var(--brand); transform: translateY(-1px); }
.portion:focus-visible { outline: none; box-shadow: var(--ring); }
.portion.is-selected { background: linear-gradient(140deg, var(--brand), var(--brand-strong)); border-color: var(--brand-strong); color: var(--brand-contrast); box-shadow: var(--shadow-sm); }
.portion.is-taken { cursor: not-allowed; opacity: .55; border-style: dashed; }
.portion.is-taken .portion-taken-by { display: block; font-size: .62rem; font-weight: 600; margin-top: 2px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* overview cells — redesigned: clean, tappable, badge for done */
.overview-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 26px 0 12px; flex-wrap: wrap; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: .76rem; color: var(--text-muted); font-weight: 600; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 11px; height: 11px; border-radius: 4px; display: inline-block; }
.legend i.l-done { background: linear-gradient(140deg, var(--success), var(--success-strong)); }
.legend i.l-claimed { background: var(--indigo); }
.legend i.l-free { background: var(--surface-2); border: 1.5px dashed var(--border-strong); }

.cell {
  position: relative;
  border-radius: var(--radius);
  border: 1.5px solid var(--border);
  background: var(--surface-2);
  min-height: 84px;
  padding: 10px 8px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 3px;
  overflow: hidden;
  font: inherit;
  transition: transform .1s var(--ease), box-shadow .15s var(--ease), filter .15s var(--ease);
}
.cell[role="button"] { cursor: pointer; }
.cell[role="button"]:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.cell[role="button"]:focus-visible { outline: none; box-shadow: var(--ring); }
.cell-del {
  position: absolute; inset-block-start: 6px; inset-inline-start: 6px;
  width: 22px; height: 22px; border-radius: 6px; border: none; padding: 0;
  cursor: pointer; background: rgba(255, 255, 255, .9); color: #b91c1c;
  display: grid; place-items: center; font-size: .72rem; line-height: 1;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: transform .1s var(--ease);
}
.cell-del:hover { transform: scale(1.14); }
.cell-del:focus-visible { outline: none; box-shadow: var(--ring); }
.cell.is-claimed { color: #fff; border-color: transparent; }
.cell.is-done { background: linear-gradient(140deg, var(--success), var(--success-strong)) !important; color: #fff; }
.cell-num { font-weight: 800; font-size: 1.2rem; line-height: 1; }
.cell-reader { font-size: .72rem; font-weight: 700; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cell-date { font-size: .64rem; opacity: .92; font-variant-numeric: tabular-nums; }
.cell.is-available { background: var(--surface-2); border-style: dashed; }
.cell.is-available .cell-num { color: var(--text-faint); }
.cell-tag { font-size: .62rem; color: var(--text-faint); font-weight: 600; }
.cell-badge {
  position: absolute; inset-block-start: 6px; inset-inline-end: 6px;
  width: 20px; height: 20px; border-radius: 50%;
  background: rgba(255, 255, 255, .92); color: var(--success-strong);
  display: grid; place-items: center; font-size: .72rem; font-weight: 900;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .25);
}

/* ---------- Selection summary ---------- */
.selection-summary {
  margin: 16px 0; padding: 14px 16px;
  border: 1.5px dashed var(--border-strong); border-radius: var(--radius-sm);
  text-align: center; color: var(--text-muted); font-weight: 700; font-size: .92rem;
  transition: background .2s var(--ease), border-color .2s var(--ease), color .2s var(--ease);
}
.selection-summary.has-selection { background: var(--success-soft); border-style: solid; border-color: var(--success); color: var(--success-strong); }

.claim-actions { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.claim-message { font-weight: 700; font-size: .9rem; }
.claim-message.is-error { color: var(--danger); }
.claim-message.is-success { color: var(--success-strong); }

/* ---------- Progress ---------- */
.progress-track { height: 12px; width: 100%; background: var(--surface-2); border-radius: var(--radius-pill); overflow: hidden; margin: 6px 0 20px; }
.progress-fill { height: 100%; width: 0%; background: linear-gradient(90deg, var(--brand), var(--success)); border-radius: var(--radius-pill); transition: width .45s var(--ease); }

.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
@media (max-width: 520px) { .stat-grid { grid-template-columns: repeat(2, 1fr); } }
.stat { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px 12px; text-align: center; }
.stat-value { display: block; font-size: 1.6rem; font-weight: 800; letter-spacing: -.02em; }
.stat-label { font-size: .78rem; color: var(--text-muted); font-weight: 700; }

/* ---------- Reader & timeline cards ---------- */
.entry { background: var(--surface-2); border: 1px solid var(--border); border-inline-start: 4px solid var(--brand); border-radius: var(--radius-sm); padding: 14px 16px; }
.entry-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.chip { display: inline-flex; align-items: center; padding: 4px 12px; border-radius: var(--radius-pill); font-size: .82rem; font-weight: 700; color: #fff; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.entry-meta { font-size: .85rem; color: var(--text-muted); }
.entry-meta strong { color: var(--text); }
.entry-progress { font-size: .8rem; color: var(--text-faint); margin-top: 4px; font-variant-numeric: tabular-nums; }
.empty-state { text-align: center; color: var(--text-faint); padding: 22px 8px; font-size: .9rem; }

/* ---------- Banner / archive ---------- */
.banner { border-radius: var(--radius); padding: 16px 20px; margin-bottom: 22px; font-weight: 700; text-align: center; }
.banner-celebrate { background: var(--gold-soft); border: 1.5px solid var(--gold-border); color: var(--gold-text); }
.archive-row { margin-top: 22px; padding-top: 20px; border-top: 1px dashed var(--border); display: flex; flex-direction: column; gap: 10px; align-items: stretch; }
.archive-note { font-size: .85rem; color: var(--text-muted); text-align: center; }

/* ---------- Sync status ---------- */
.sync-status {
  position: fixed; inset-block-end: 14px; inset-inline-start: 14px; z-index: 60; pointer-events: none;
  display: inline-flex; align-items: center; gap: 8px; padding: 7px 14px; border-radius: var(--radius-pill);
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow);
  font-size: .82rem; font-weight: 700; color: var(--text-muted);
}
.sync-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--brand); animation: pulse 1.4s var(--ease) infinite; }
.sync-status[data-state="offline"] { color: var(--gold-text); }
.sync-status[data-state="offline"] .sync-dot { background: var(--gold-border); animation: none; }
.sync-status[data-state="synced"] .sync-dot { background: var(--success); animation: none; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--brand) 55%, transparent); } 70% { box-shadow: 0 0 0 8px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }

/* ---------- Toasts ---------- */
.toast-region { position: fixed; inset-inline: 0; inset-block-end: 22px; z-index: 80; display: flex; flex-direction: column; align-items: center; gap: 10px; pointer-events: none; padding-inline: 12px; }
.toast { pointer-events: auto; width: min(92vw, 440px); background: var(--surface); border: 1px solid var(--border); border-inline-start: 4px solid var(--brand); border-radius: var(--radius-sm); box-shadow: var(--shadow-lg); padding: 12px 16px; font-size: .9rem; font-weight: 700; color: var(--text); display: flex; align-items: center; gap: 10px; animation: toast-in .25s var(--ease); }
.toast.is-leaving { animation: toast-out .2s var(--ease) forwards; }
.toast.toast-success { border-inline-start-color: var(--success); }
.toast.toast-error { border-inline-start-color: var(--danger); }
.toast-confirm-actions { display: flex; gap: 8px; margin-inline-start: auto; }
.toast-confirm-actions .btn { padding: 6px 12px; font-size: .82rem; }
@keyframes toast-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(12px); } }

/* ---------- Action sheet ---------- */
.sheet-overlay { position: fixed; inset: 0; z-index: 90; background: rgba(15, 23, 42, .45); display: flex; align-items: flex-end; justify-content: center; animation: fade .2s var(--ease); }
.sheet { width: min(560px, 100%); background: var(--surface); border-radius: var(--radius-lg) var(--radius-lg) 0 0; box-shadow: var(--shadow-lg); padding: 14px clamp(16px, 5vw, 26px) calc(22px + env(safe-area-inset-bottom)); animation: sheet-up .28s var(--ease); }
.sheet-handle { width: 44px; height: 5px; border-radius: var(--radius-pill); background: var(--border-strong); margin: 2px auto 14px; }
.sheet-title { margin: 0 0 4px; font-size: 1.25rem; font-weight: 800; }
.sheet-sub { color: var(--text-muted); font-size: .9rem; margin: 0 0 16px; }
.sheet-meta { display: flex; flex-wrap: wrap; gap: 10px 22px; margin-bottom: 18px; font-size: .92rem; }
.sheet-meta b { font-weight: 800; }
.sheet-actions { display: flex; flex-direction: column; gap: 10px; }
@media (min-width: 520px) { .sheet-actions { flex-direction: row; } .sheet-actions .btn { flex: 1; } }
@keyframes sheet-up { from { transform: translateY(100%); } to { transform: translateY(0); } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

/* ============================================================
   REPORT VIEW
   ============================================================ */
.report-title { display: flex; align-items: center; gap: 10px; justify-content: center; font-size: 1.25rem; font-weight: 800; margin: 6px 0 20px; }
.report-section-title { display: flex; align-items: center; gap: 9px; justify-content: center; font-size: 1.12rem; font-weight: 800; margin: 30px 0 16px; }

.metric-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
@media (max-width: 760px) { .metric-grid { grid-template-columns: repeat(2, 1fr); } }
.metric {
  border-radius: var(--radius); padding: 20px 16px; text-align: center;
  border: 1px solid var(--border); background: var(--surface);
  box-shadow: var(--shadow-sm); position: relative; overflow: hidden;
}
.metric::before { content: ""; position: absolute; inset-block-start: 0; inset-inline: 0; height: 3px; background: var(--accent, var(--brand)); opacity: .9; }
.metric-value { font-size: 2rem; font-weight: 800; line-height: 1.1; color: var(--accent, var(--brand)); font-variant-numeric: tabular-nums; }
.metric-value.is-date { font-size: 1.35rem; }
.metric-label { font-size: .82rem; color: var(--text-muted); font-weight: 700; margin-top: 6px; }

.leaderboard { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
@media (max-width: 560px) { .leaderboard { grid-template-columns: 1fr; } }
.leader { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-sm); padding: 18px 14px; text-align: center; position: relative; }
.leader-medal { font-size: 1.5rem; line-height: 1; }
.leader-name { font-weight: 800; font-size: 1.02rem; margin: 8px 0 6px; }
.leader-big { font-size: 1.5rem; font-weight: 800; color: var(--brand); font-variant-numeric: tabular-nums; }
.leader-sub { font-size: .8rem; color: var(--text-muted); font-weight: 600; }
.leader.rank-1 { border-color: var(--gold-border); box-shadow: 0 0 0 1px var(--gold-border) inset, var(--shadow-sm); }

.gstats { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: 22px; text-align: center; }
.gstats-row + .gstats-row { margin-top: 18px; padding-top: 18px; border-top: 1px dashed var(--border); }
.gstats-big { font-size: 1.6rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.gstats-cap { font-size: .84rem; color: var(--text-muted); font-weight: 600; margin-top: 2px; }

.khatma { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-sm); padding: 20px; margin-bottom: 18px; }
.khatma-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.khatma-titles { text-align: start; }
.khatma-num-badge { width: 40px; height: 40px; border-radius: 50%; background: linear-gradient(140deg, var(--gold), #d97706); color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 1.1rem; box-shadow: var(--shadow-sm); flex: none; }
.khatma-title { font-weight: 800; font-size: 1.12rem; }
.khatma-reg { font-size: .82rem; color: var(--text-muted); margin-top: 2px; font-variant-numeric: tabular-nums; }
.badge-done { display: inline-flex; align-items: center; gap: 5px; background: linear-gradient(140deg, var(--success), var(--success-strong)); color: #fff; padding: 6px 14px; border-radius: var(--radius-pill); font-size: .82rem; font-weight: 800; }
.badge-progress { background: linear-gradient(140deg, var(--indigo), #6366f1); }

.khatma-stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; background: var(--surface-2); border-radius: var(--radius); padding: 16px; }
.kstat { text-align: center; }
.kstat-big { font-size: 1.35rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.kstat-big .unit { font-size: .9rem; font-weight: 700; color: var(--text-muted); }
.kstat-cap { font-size: .78rem; color: var(--text-muted); font-weight: 600; margin-top: 2px; }
.kstat-period { font-size: .82rem; color: var(--text-muted); margin-top: 4px; font-variant-numeric: tabular-nums; direction: ltr; }
.kstat-period .arrow { color: var(--brand); margin-inline: 4px; }

.khatma-highlight { display: inline-flex; align-items: center; gap: 8px; background: var(--gold-soft); border: 1px solid var(--gold-border); color: var(--gold-text); padding: 8px 14px; border-radius: var(--radius-pill); font-size: .85rem; font-weight: 700; margin-top: 12px; }
.khatma-highlight b { font-weight: 800; }
.highlights-row { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 14px; }

.dist-title { display: flex; align-items: center; gap: 8px; justify-content: center; font-weight: 800; font-size: .95rem; margin: 18px 0 12px; }
.dist-grid { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.dist-chip { display: inline-flex; align-items: center; gap: 8px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-pill); padding: 6px 8px 6px 14px; font-size: .9rem; font-weight: 700; }
.dist-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.dist-count { background: var(--surface-3); border-radius: var(--radius-pill); min-width: 26px; height: 26px; display: inline-grid; place-items: center; font-size: .82rem; font-weight: 800; font-variant-numeric: tabular-nums; padding: 0 6px; }

/* ---------- Skeleton ---------- */
.skeleton { background: linear-gradient(90deg, var(--surface-2) 25%, var(--border) 37%, var(--surface-2) 63%); background-size: 400% 100%; animation: shimmer 1.3s ease-in-out infinite; border-radius: var(--radius-sm); }
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }

/* ---------- LTR overrides ---------- */
html[dir="ltr"] .report-title, html[dir="ltr"] .report-section-title, html[dir="ltr"] .dist-title { justify-content: flex-start; }
html[dir="ltr"] .kstat-period { direction: ltr; }

/* ---------- Motion preferences ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}
