/* QaydLab | قيد لاب — «دفتر قيد لاب» pages (/daftar/*). Loaded AFTER /styles.css (brand tokens, header, footer,
   buttons, .subbox). Each page answers ONE question, laid out like a page torn from the channel's notebook:
   page head · «لو مستعجل» sticky note · paper sheet (sections) · journal-entry cards · balance meter ·
   right/wrong · English-name table · quiz · FAQ · side rail (contents + the Short) · responsive · dark mode.
   Colours only from the :root tokens, so dark mode works by itself; the entry cards are "paper" and stay light. */

[hidden] { display: none !important; }

/* ---------- page head ---------- */
.dhead { position: relative; overflow: hidden; padding: clamp(26px, 5vw, 54px) 0 clamp(18px, 3vw, 30px); }
.dhead__glow { position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(560px 360px at 88% 20%, rgba(140, 195, 234, .30), transparent 70%), radial-gradient(420px 300px at 5% 0%, rgba(63, 180, 140, .12), transparent 70%); }
.dhead .wrap { position: relative; }
.crumbs { display: flex; flex-wrap: wrap; gap: 6px; font-size: .88rem; color: var(--ink-3); margin-bottom: 14px; }
.crumbs a { color: var(--ink-2); text-decoration: none; }
.crumbs a:hover { color: var(--link); }
.crumbs span[aria-hidden] { color: var(--line); }
.dhead__kicker { display: inline-flex; align-items: center; gap: 8px; font-size: .85rem; font-weight: 600; color: var(--link); margin-bottom: 10px; }
.dhead__kicker svg { width: 18px; height: 18px; }
.dhead h1 { font-size: clamp(1.9rem, 4.6vw, 3rem); font-weight: 700; max-width: 18em; }
.dhead h1 .hl { background: linear-gradient(transparent 58%, var(--yellow) 58%, var(--yellow) 92%, transparent 92%); padding-inline: .08em; }
.dhead__meta { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.chip { display: inline-flex; align-items: center; gap: 6px; font-size: .85rem; font-weight: 500; color: var(--ink-2); background: var(--card); border: 1px solid var(--line); border-radius: 999px; padding: .25em .85em; }
.chip svg { width: 15px; height: 15px; color: var(--link); }
.n { font-variant-numeric: tabular-nums; unicode-bidi: isolate; white-space: nowrap; }

/* ---------- «لو مستعجل» sticky note ---------- */
.rush { position: relative; max-width: 640px; margin-top: 26px; background: #FFF3A3; color: #1D2A33; border-radius: 4px 4px 18px 4px;
  padding: 26px 26px 22px; box-shadow: 0 18px 30px -18px rgba(29, 42, 51, .45); transform: rotate(-1.2deg); }
.rush::before { content: ""; position: absolute; top: -12px; inset-inline-start: 50%; width: 110px; height: 26px; margin-inline-start: -55px;
  background: rgba(140, 195, 234, .75); transform: rotate(2deg); }
.rush__tag { font-size: .8rem; font-weight: 700; letter-spacing: .02em; color: #7a5b00; margin-bottom: 6px; }
.rush p { font-size: 1.12rem; font-weight: 500; line-height: 1.85; }
.rush b { font-weight: 700; }

/* ---------- layout: paper sheet + side rail ---------- */
.dlay { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 28px; align-items: start; padding-bottom: 56px; }
.rail-side { position: sticky; top: 92px; display: grid; gap: 18px; }

/* the sheet: ruled lines + the pink margin on the RIGHT (Arabic notebooks), punched holes */
.sheet { position: relative; background: var(--card); border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow-sm);
  padding: clamp(26px, 4vw, 44px) clamp(66px, 7vw, 86px) clamp(26px, 4vw, 44px) clamp(22px, 4vw, 44px);
  background-image: repeating-linear-gradient(to bottom, transparent 0 35px, rgba(59, 143, 208, .10) 35px 36px); background-position: 0 18px; }
.sheet::before { content: ""; position: absolute; top: 0; bottom: 0; inset-inline-start: clamp(44px, 5vw, 58px); width: 2px; background: #F4B9C2; }
.sheet::after { content: ""; position: absolute; top: 40px; bottom: 40px; inset-inline-start: 16px; width: 14px;
  background: radial-gradient(circle at 7px 7px, var(--fog) 6px, rgba(29, 42, 51, .12) 7px, transparent 7.5px) 0 0 / 14px 120px repeat-y; }
.part { scroll-margin-top: 96px; }
.part + .part { margin-top: clamp(36px, 5vw, 52px); }
.part__no { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--blue); color: var(--link);
  font-weight: 700; font-size: .9rem; margin-inline-end: 10px; flex: none; }
.part h2 { display: flex; align-items: center; font-size: clamp(1.3rem, 2.6vw, 1.6rem); font-weight: 700; margin-bottom: 14px; }
.part p + p { margin-top: 12px; }
.part p { color: var(--ink); font-size: 1.04rem; }
.part .muted { color: var(--ink-2); font-size: .95rem; }
.term { white-space: nowrap; font-weight: 600; font-size: .8em; color: var(--link); border: 2px solid var(--blue); border-radius: 999px; padding: .05em .65em; background: var(--card); unicode-bidi: isolate; }
.pen { background: linear-gradient(transparent 62%, rgba(255, 228, 92, .85) 62%, rgba(255, 228, 92, .85) 90%, transparent 90%); font-weight: 600; }

/* story card: who, what, how much */
.scene { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin: 18px 0 6px; }
.scene div { background: var(--fog); border: 1px dashed var(--line); border-radius: 14px; padding: 14px 16px; }
.scene small { display: block; color: var(--ink-3); font-size: .78rem; }
.scene b { font-size: 1.05rem; font-weight: 700; }

/* ---------- journal-entry cards (paper, light in both themes) ---------- */
.jcard { --ink: #1D2A33; --ink-2: #4A5A66; --ink-3: #7A8994; --link: #2A72AD; color: var(--ink);
  position: relative; margin: 18px 0; padding: 18px 20px 18px 52px; border-radius: 14px; border: 1px solid #E9EEF2; box-shadow: var(--shadow-sm);
  background: repeating-linear-gradient(to bottom, #FFFDF7 0 31px, #E3EDF4 31px 32px); direction: rtl; }
.jcard::before { content: ""; position: absolute; top: 0; bottom: 0; left: 36px; width: 2px; background: #F4B9C2; }
.jcard__head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 8px; flex-wrap: wrap; }
.jcard__when { font-weight: 700; font-size: .95rem; }
.jcard__when small { font-weight: 500; color: var(--ink-3); margin-inline-start: 6px; }
.jtbl { width: 100%; border-collapse: collapse; font-size: .96rem; }
.jtbl th { font-weight: 500; font-size: .75rem; color: var(--ink-2); text-align: right; padding: 2px 6px; border-bottom: 2px solid var(--ink); }
.jtbl th:not(:first-child), .jtbl td:not(:first-child) { text-align: center; width: 24%; }
.jtbl td { padding: 6px; font-weight: 600; }
.jtbl td.to { padding-inline-start: 1.8em; color: var(--link); }
.jtbl td small { display: block; font-weight: 400; font-size: .75rem; color: var(--ink-3); }
.jtbl tbody tr:last-child td { border-bottom: 2px double var(--ink); }
.jcard__memo { margin-top: 10px; color: var(--ink-2); font-size: .85rem; }
.jcard__memo span { font-weight: 600; color: var(--ink); }
/* stamps */
.dstamp { position: absolute; top: 14px; left: 52px; font-weight: 700; font-size: .95rem; padding: .1em .7em; border: 3px solid; border-radius: 8px; transform: rotate(-8deg); opacity: .9; }
.dstamp--bad { color: #b3261e; border-color: #b3261e; }
.dstamp--ok { color: #1f8a65; border-color: #1f8a65; }
.jcard--bad { background: repeating-linear-gradient(to bottom, #FFF8F6 0 31px, #F2E1DD 31px 32px); }
.jcard--bad .jtbl td { text-decoration: line-through; text-decoration-color: rgba(179, 38, 30, .55); text-decoration-thickness: 2px; }

/* what the mistake does: two small cards */
.hurt { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 14px; }
.hurt div { border-inline-start: 4px solid var(--red); background: var(--fog); border-radius: 10px; padding: 12px 14px; font-size: .95rem; }
.hurt b { display: block; color: var(--red); font-size: .85rem; margin-bottom: 2px; }

/* ---------- 3 steps with the custody balance meter ---------- */
.steps { position: relative; margin-top: 8px; }
.step { position: relative; display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 14px; }
.step + .step { margin-top: 6px; }
.step__dot { position: relative; display: grid; justify-items: center; }
.step__dot b { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: var(--night); color: #fff; font-weight: 700; z-index: 1; }
.step__dot::after { content: ""; position: absolute; top: 40px; bottom: -10px; width: 2px; background: repeating-linear-gradient(to bottom, var(--sky) 0 6px, transparent 6px 11px); }
.step:last-child .step__dot::after { display: none; }
.step h3 { font-size: 1.1rem; font-weight: 700; margin-top: 7px; }
.step .jcard { margin-top: 10px; }

.meter { margin-top: 6px; background: var(--fog); border: 1px solid var(--line); border-radius: 14px; padding: 12px 16px; }
.meter__top { display: flex; justify-content: space-between; gap: 10px; font-size: .88rem; color: var(--ink-2); }
.meter__top b { color: var(--ink); font-size: 1rem; }
.meter__bar { position: relative; height: 12px; margin-top: 8px; border-radius: 999px; background: var(--line); overflow: hidden; }
.meter__bar i { position: absolute; inset-block: 0; inset-inline-start: 0; width: var(--w, 100%); border-radius: inherit;
  background: linear-gradient(90deg, var(--blue), var(--mint)); transform-origin: right; transform: scaleX(0); transition: transform 1s cubic-bezier(.2, .7, .2, 1); }
.meter.is-in .meter__bar i { transform: scaleX(1); }
.meter--zero .meter__top b { color: var(--green); }

/* ---------- English name ---------- */
.names { width: 100%; border-collapse: separate; border-spacing: 0; margin-top: 14px; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; font-size: .95rem; }
.names th, .names td { padding: 12px 14px; text-align: right; vertical-align: top; }
.names th { background: var(--fog); font-weight: 600; font-size: .85rem; color: var(--ink-2); }
.names tr + tr td { border-top: 1px solid var(--line); }
.names td:first-child { white-space: nowrap; font-weight: 700; color: var(--link); }
.names .no td:first-child { color: var(--red); text-decoration: line-through; }

/* two-column comparison (wrong vs right): first column is a plain label, not a crossed-out English name */
.cmp td:first-child { color: var(--ink-2); font-weight: 600; white-space: normal; }
.cmp td, .cmp th { text-align: center; }
.cmp td:first-child, .cmp th:first-child { text-align: right; }

/* 12-month strip (prepaid expense) */
.months { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 6px; margin-top: 14px; }
.months span { display: grid; place-items: center; min-height: 44px; padding: 6px 4px; border-radius: 10px; border: 1px dashed var(--line); background: var(--fog);
  font-size: .85rem; color: var(--ink-3); }
.months span.is-used { background: var(--blue); border: 1px solid var(--blue); color: #fff; font-weight: 600; }
.months__key { display: flex; flex-wrap: wrap; gap: 8px 20px; margin-top: 10px; font-size: .92rem; color: var(--ink-2); }
.months__key i { display: inline-block; width: 14px; height: 14px; border-radius: 4px; margin-inline-end: 6px; vertical-align: -2px; border: 1px dashed var(--ink-3); background: var(--fog); }
.months__key i.is-used { background: var(--blue); border: 1px solid var(--blue); }

/* ---------- auditor checklist ---------- */
.checks { list-style: none; padding: 0; margin: 14px 0 0; display: grid; gap: 10px; }
.checks li { position: relative; padding-inline-start: 36px; }
.checks li::before { content: ""; position: absolute; inset-inline-start: 0; top: 4px; width: 22px; height: 22px; border-radius: 6px; border: 2px solid var(--mint);
  background: no-repeat center / 14px url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='m5 12 5 5 9-10' fill='none' stroke='%233FB48C' stroke-width='3.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); }

/* ---------- quiz ---------- */
.quiz { margin-top: 14px; background: var(--night); color: #fff; border-radius: 20px; padding: clamp(20px, 3vw, 28px); position: relative; overflow: hidden; }
.quiz::after { content: ""; position: absolute; inset: auto -40px -40px auto; width: 220px; height: 110px; background: var(--pattern); opacity: .14; pointer-events: none; }
.part .quiz__q, .part .quiz__msg { color: #fff; }
.quiz__q { font-size: 1.1rem; font-weight: 600; line-height: 1.8; }
.quiz__opts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-top: 16px; position: relative; z-index: 1; }
.quiz__opts button { font: inherit; font-weight: 700; font-size: 1.15rem; color: #fff; background: rgba(255, 255, 255, .07); border: 2px solid rgba(255, 255, 255, .22);
  border-radius: 14px; padding: 12px 8px; cursor: pointer; transition: background .2s, border-color .2s, transform .15s; }
.quiz__opts button:hover:not(:disabled) { background: rgba(255, 255, 255, .14); transform: translateY(-2px); }
.quiz__opts button:disabled { cursor: default; }
.quiz__opts button.is-ok { background: rgba(63, 180, 140, .28); border-color: var(--mint); }
.quiz__opts button.is-no { background: rgba(255, 138, 128, .18); border-color: #FF8A80; }
.quiz__msg { margin-top: 14px; min-height: 1.8em; font-size: 1rem; position: relative; z-index: 1; }
.quiz__msg b { color: #9BE7C8; }

/* ---------- FAQ ---------- */
.faq { margin-top: 14px; display: grid; gap: 10px; }
.faq details { background: var(--fog); border: 1px solid var(--line); border-radius: 14px; padding: 0 16px; }
.faq summary { cursor: pointer; font-weight: 600; padding: 14px 0; list-style: none; display: flex; justify-content: space-between; gap: 12px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; font-size: 1.3rem; line-height: 1; color: var(--link); transition: transform .2s; }
.faq details[open] summary::after { transform: rotate(45deg); }
.faq details p { padding-bottom: 14px; color: var(--ink-2); font-size: .97rem; }

/* sources + disclaimer */
.sources { margin: 10px 0 0; padding-inline-start: 1.2em; color: var(--ink-2); font-size: .92rem; }
.sources a { color: var(--link); }
.disclaimer { margin-top: 16px; font-size: .88rem; color: var(--warn); background: rgba(255, 228, 92, .18); border-radius: 12px; padding: 12px 14px; }

/* ---------- side rail ---------- */
.toc, .watch, .ep-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 18px; box-shadow: var(--shadow-sm); }
.toc h4, .watch h4 { font-size: .95rem; font-weight: 700; margin-bottom: 10px; }
.toc ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; counter-reset: toc; }
.toc a { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink-2); font-size: .92rem; padding: 6px 8px; border-radius: 10px; transition: background .2s, color .2s; }
.toc a::before { counter-increment: toc; content: counter(toc); flex: none; display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%;
  border: 1.5px solid var(--line); font-size: .75rem; font-weight: 700; transition: background .2s, border-color .2s, color .2s; }
.toc a:hover { background: var(--fog); color: var(--ink); }
.toc a.is-done { color: var(--ink-3); }
.toc a.is-done::before { content: "✓"; background: var(--mint); border-color: var(--mint); color: #fff; }
.toc a.is-now { color: var(--ink); background: var(--fog); font-weight: 600; }
.toc a.is-now::before { border-color: var(--blue); color: var(--link); }

.watch__phone { position: relative; width: 100%; max-width: 230px; margin: 0 auto; aspect-ratio: 9 / 16; border-radius: 26px; background: var(--night); padding: 8px; box-shadow: 0 24px 40px -24px rgba(29, 42, 51, .6); }
.watch__phone iframe { width: 100%; height: 100%; border: 0; border-radius: 19px; background: #22313B; }
.watch p { margin-top: 10px; font-size: .85rem; color: var(--ink-2); text-align: center; }
.ep-card { display: grid; gap: 8px; text-decoration: none; transition: transform .2s, box-shadow .2s, border-color .2s; }
.ep-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--sky); }
.ep-card small { color: var(--ink-3); font-size: .8rem; }
.ep-card b { font-size: 1rem; line-height: 1.6; }
.ep-card span { color: var(--link); font-weight: 600; font-size: .9rem; }

.after { margin-top: 28px; }

/* ---------- index page (/daftar/): the notebook's «فهرس» ---------- */
.dhead__lead { margin-top: 12px; max-width: 40em; color: var(--ink-2); font-size: 1.06rem; }
.idx { margin-bottom: 56px; }
.idx__tools { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 26px; }
.idx__search { flex: 1 1 280px; display: flex; align-items: center; gap: 10px; background: var(--fog); border: 1px solid var(--line); border-radius: 999px; padding: 0 16px; }
.idx__search svg { width: 18px; height: 18px; color: var(--ink-3); flex: none; }
.idx__search input { flex: 1; min-width: 0; font: inherit; font-size: .98rem; color: var(--ink); background: transparent; border: 0; padding: 12px 0; outline: none; }
.idx__search:focus-within { border-color: var(--blue); }
.idx__chips { display: flex; flex-wrap: wrap; gap: 6px; }
.idx__chips button { font: inherit; font-size: .9rem; font-weight: 500; color: var(--ink-2); background: var(--card); border: 1px solid var(--line); border-radius: 999px; padding: .4em 1em; cursor: pointer; transition: background .2s, color .2s, border-color .2s; }
.idx__chips button:hover { border-color: var(--sky); color: var(--ink); }
.idx__chips button.is-on { background: var(--night); border-color: var(--night); color: #fff; }
.idx__title { font-size: 1rem; font-weight: 700; letter-spacing: .08em; color: var(--ink-3); margin-bottom: 6px; }
.idx__group + .idx__group { margin-top: 28px; }
.idx__series { display: inline-block; font-size: clamp(1.2rem, 2.4vw, 1.45rem); font-weight: 700; margin: 6px 0 8px;
  background: linear-gradient(transparent 62%, rgba(255, 228, 92, .85) 62%, rgba(255, 228, 92, .85) 90%, transparent 90%); }
.idx__list { list-style: none; margin: 0; padding: 0; }
.idx__row a { display: grid; grid-template-columns: 42px minmax(0, auto) minmax(24px, 1fr) auto; align-items: center; gap: 14px;
  padding: 14px 6px; text-decoration: none; color: var(--ink); border-bottom: 1px dashed var(--line); border-radius: 10px; transition: background .2s; }
.idx__row a:hover { background: var(--fog); }
.idx__no { font-weight: 700; color: var(--link); font-size: 1.05rem; }
.idx__q b { display: block; font-weight: 600; font-size: 1.06rem; line-height: 1.6; }
.idx__q small { display: block; color: var(--ink-3); font-size: .88rem; }
.idx__lead { align-self: end; margin-bottom: 1.1em; border-bottom: 2px dotted var(--line); }
.idx__go { color: var(--link); font-weight: 600; font-size: .92rem; white-space: nowrap; transition: transform .2s; }
.idx__row a:hover .idx__go { transform: translateX(-4px); }
.idx__empty { margin-top: 20px; color: var(--ink-2); }
.idx__empty a { color: var(--link); }

/* ---------- responsive ---------- */
@media (max-width: 980px) {
  .dlay { grid-template-columns: minmax(0, 1fr); }
  .rail-side { position: static; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .toc { display: none; }
}
@media (max-width: 620px) {
  .sheet { padding: 24px 46px 24px 16px; background-position: 0 12px; }
  .sheet::before { inset-inline-start: 34px; }
  .sheet::after { inset-inline-start: 9px; width: 12px; background-size: 12px 110px; }
  .scene { grid-template-columns: minmax(0, 1fr); }
  .hurt { grid-template-columns: minmax(0, 1fr); }
  .rail-side { grid-template-columns: minmax(0, 1fr); }
  .jcard { padding: 14px 10px 14px 18px; }
  .jcard::before { left: 8px; }
  .jtbl { font-size: .8rem; }
  .jtbl th:not(:first-child), .jtbl td:not(:first-child) { width: 1%; white-space: nowrap; }
  .jtbl td { padding: 5px 3px; }
  .jtbl td.to { padding-inline-start: 1em; }
  .dstamp { left: 18px; font-size: .8rem; }
  .names td:first-child { white-space: normal; }
  .quiz__opts { grid-template-columns: minmax(0, 1fr); }
  .step { grid-template-columns: 34px minmax(0, 1fr); gap: 10px; }
  .step__dot b { width: 32px; height: 32px; font-size: .9rem; }
  .step__dot::after { top: 32px; }
  .rush { transform: none; }
  .idx__row a { grid-template-columns: 30px minmax(0, 1fr); gap: 10px; }
  .idx__lead { display: none; }
  .idx__go { grid-column: 2; }
  .months { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
[data-theme="dark"] .idx__series { background: linear-gradient(transparent 62%, rgba(255, 228, 92, .30) 62%, rgba(255, 228, 92, .30) 90%, transparent 90%); }
@media (prefers-reduced-motion: reduce) {
  .meter__bar i { transition: none; transform: none; }
}

/* ---------- dark mode (screen only; /js/theme.js sets data-theme) ---------- */
@media screen {
  [data-theme="dark"] .dhead h1 .hl { background: linear-gradient(transparent 58%, rgba(255, 228, 92, .32) 58%, rgba(255, 228, 92, .32) 92%, transparent 92%); }
  [data-theme="dark"] .pen { background: linear-gradient(transparent 62%, rgba(255, 228, 92, .30) 62%, rgba(255, 228, 92, .30) 90%, transparent 90%); }
  [data-theme="dark"] .sheet { background-image: repeating-linear-gradient(to bottom, transparent 0 35px, rgba(140, 195, 234, .07) 35px 36px); }
  [data-theme="dark"] .sheet::before { background: rgba(244, 185, 194, .45); }
  [data-theme="dark"] .sheet::after { background-image: radial-gradient(circle at 7px 7px, var(--fog) 6px, rgba(0, 0, 0, .4) 7px, transparent 7.5px); }
  [data-theme="dark"] .quiz { border: 1px solid var(--line); }
  [data-theme="dark"] .disclaimer { background: rgba(242, 207, 91, .12); }
}
