:root {
  --bg: #f6f4ef;
  --surface: #ffffff;
  --ink: #18201f;
  --ink-2: #4a5553;
  --ink-3: #7a8583;
  --line: #e3dfd6;
  --brand: #0f3d3e;
  --brand-2: #155e5f;
  --brand-soft: #e3efee;
  --ok: #1b7a4b;   --ok-bg: #e6f4ec;
  --warn: #9a6200; --warn-bg: #fdf3dd;
  --bad: #b3261e;  --bad-bg: #fcebea;
  --muted-bg: #efede8;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 4px 16px rgba(16, 24, 40, .05);
  --font: "IBM Plex Sans Arabic", "Segoe UI", Tahoma, system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Consolas, monospace;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.7;
  font-size: 16px;
}
[hidden] { display: none !important; }
a { color: var(--brand-2); }
h1, h2, h3 { line-height: 1.35; margin: 0 0 .5rem; font-weight: 600; }
h1 { font-size: clamp(1.45rem, 4.2vw, 2.1rem); letter-spacing: -.01em; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 .75rem; }
.muted { color: var(--ink-2); }
.small { font-size: .875rem; }
[dir="ltr"] { text-align: left; unicode-bidi: isolate; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  padding: .7rem max(1rem, env(safe-area-inset-right)) .7rem max(1rem, env(safe-area-inset-left));
  background: rgba(246, 244, 239, .92);
  backdrop-filter: saturate(1.4) blur(8px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: .6rem; text-decoration: none; color: var(--ink); }
.brand-mark {
  width: 38px; height: 38px; border-radius: 11px;
  display: grid; place-items: center;
  background: var(--brand); color: #f6f4ef; font-weight: 600; font-size: 1.15rem;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-text strong { font-size: 1.05rem; }
.brand-text small { color: var(--ink-3); font-size: .75rem; }

/* ---------- layout ---------- */
.wrap { max-width: 980px; margin: 0 auto; padding: 1.25rem 1rem 2rem; }
.hero { padding: 1.25rem .25rem 1.25rem; }
.eyebrow {
  display: inline-block; margin-bottom: .6rem; padding: .15rem .65rem;
  font-size: .78rem; color: var(--brand); background: var(--brand-soft); border-radius: 999px;
}
.lead { color: var(--ink-2); max-width: 62ch; font-size: 1.02rem; }
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 1.1rem; margin-bottom: 1rem;
}
@media (min-width: 720px) { .card { padding: 1.5rem; } .wrap { padding-top: 2rem; } }

/* ---------- buttons ---------- */
.btn {
  font: inherit; font-weight: 500; cursor: pointer;
  border-radius: 10px; padding: .62rem 1.1rem; min-height: 44px;
  border: 1px solid transparent; transition: background .15s, border-color .15s, opacity .15s;
}
.btn.primary { background: var(--brand); color: #fff; }
.btn.primary:hover:not(:disabled) { background: var(--brand-2); }
.btn.primary:disabled { opacity: .45; cursor: not-allowed; }
.btn.ghost { background: transparent; border-color: var(--line); color: var(--ink); }
.btn.ghost:hover { background: var(--muted-bg); }
.btn.small { min-height: 34px; padding: .3rem .75rem; font-size: .875rem; }
.actions { display: flex; gap: .6rem; margin-top: 1rem; }
.actions .btn.primary { flex: 1; }
@media (min-width: 720px) { .actions .btn.primary { flex: 0 0 auto; min-width: 220px; } }

/* ---------- tabs ---------- */
.tabs { display: flex; gap: .25rem; padding: .25rem; background: var(--muted-bg); border-radius: 11px; margin-bottom: 1rem; }
.tab {
  flex: 1; font: inherit; border: 0; background: transparent; color: var(--ink-2);
  padding: .5rem .75rem; border-radius: 8px; cursor: pointer; min-height: 40px;
}
.tab.active { background: var(--surface); color: var(--ink); font-weight: 500; box-shadow: 0 1px 3px rgba(0,0,0,.08); }

/* ---------- drop zone ---------- */
.drop {
  display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center;
  gap: .3rem; padding: 2rem 1rem; border: 1.5px dashed #c9c3b6; border-radius: 12px;
  background: #fbfaf7; cursor: pointer; transition: border-color .15s, background .15s;
}
.drop:hover, .drop.over { border-color: var(--brand-2); background: var(--brand-soft); }
.drop input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.drop-icon { color: var(--brand); }
.drop-title { font-weight: 500; }
.drop-hint { font-size: .85rem; color: var(--ink-3); }
.file-list { list-style: none; margin: .75rem 0 0; padding: 0; display: grid; gap: .4rem; }
.file-list li {
  display: flex; align-items: center; justify-content: space-between; gap: .5rem;
  padding: .45rem .7rem; background: var(--muted-bg); border-radius: 9px; font-size: .9rem;
}
.file-list .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; direction: ltr; }
.file-list button { border: 0; background: none; color: var(--ink-3); cursor: pointer; font-size: 1.1rem; min-width: 32px; min-height: 32px; }
textarea {
  width: 100%; font-family: var(--mono); font-size: .85rem; line-height: 1.6;
  border: 1px solid var(--line); border-radius: 12px; padding: .8rem; resize: vertical; background: #fbfaf7; color: var(--ink);
}
textarea:focus, input:focus { outline: 2px solid var(--brand-2); outline-offset: 1px; }
.tip { font-size: .85rem; color: var(--ink-3); margin: .6rem 0 0; }
.privacy { font-size: .82rem; color: var(--ink-3); margin: .75rem 0 0; }

/* ---------- progress ---------- */
.progress-card { text-align: center; padding: 2rem 1.25rem; }
.bar { height: 10px; background: var(--muted-bg); border-radius: 999px; overflow: hidden; margin: 1.1rem 0 .7rem; }
.bar span { display: block; height: 100%; width: 0; background: var(--brand-2); border-radius: 999px; transition: width .4s ease; }
.progress-msg { font-weight: 500; }

/* ---------- report ---------- */
.report-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: .75rem; margin-bottom: 1rem; }
.report-head h1 { font-size: clamp(1.2rem, 3.6vw, 1.6rem); margin-bottom: .25rem; }
.report-head .meta { color: var(--ink-3); font-size: .85rem; }
.report-actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.paper-title { font-size: .95rem; color: var(--ink-2); margin: 0 0 .25rem; }

.alert { border-radius: 12px; padding: .9rem 1rem; margin-bottom: 1rem; border: 1px solid; }
.alert.bad { background: var(--bad-bg); border-color: #f2c6c2; color: #7a1a14; }
.alert.ok { background: var(--ok-bg); border-color: #bfe3cf; color: #145c39; }
.alert.warn { background: var(--warn-bg); border-color: #f1d9a6; color: #6e4600; }

.tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: .6rem; margin-bottom: 1rem; }
@media (min-width: 640px) { .tiles { grid-template-columns: repeat(4, 1fr); } }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: .8rem .9rem; }
.tile .num { font-size: 1.6rem; font-weight: 600; line-height: 1.1; font-variant-numeric: tabular-nums; }
.tile .lbl { font-size: .8rem; color: var(--ink-2); }
.tile.ok .num { color: var(--ok); }
.tile.warn .num { color: var(--warn); }
.tile.bad .num { color: var(--bad); }

.section-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; flex-wrap: wrap; margin-bottom: .8rem; }
.section-head h2 { margin: 0; }
.count { color: var(--ink-3); font-weight: 400; font-size: .9rem; }

.chips { display: flex; gap: .35rem; flex-wrap: wrap; margin-bottom: .9rem; }
.chip {
  font: inherit; font-size: .85rem; border: 1px solid var(--line); background: var(--surface);
  color: var(--ink-2); border-radius: 999px; padding: .25rem .8rem; cursor: pointer; min-height: 34px;
}
.chip.active { background: var(--brand); border-color: var(--brand); color: #fff; }

.badge { display: inline-block; font-size: .78rem; font-weight: 500; padding: .12rem .6rem; border-radius: 999px; white-space: nowrap; }
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.bad { background: var(--bad-bg); color: var(--bad); }
.badge.muted { background: var(--muted-bg); color: var(--ink-2); }

.ref-list, .finding-list { display: grid; gap: .6rem; }
.ref, .finding {
  border: 1px solid var(--line); border-radius: 12px; padding: .85rem .95rem; background: var(--surface);
  border-inline-start: 4px solid var(--line);
}
.ref.ok, .finding.ok { border-inline-start-color: var(--ok); }
.ref.warn, .finding.medium, .finding.info { border-inline-start-color: #e2b350; }
.finding.info { border-inline-start-color: #b9b4a8; }
.ref.bad, .finding.high { border-inline-start-color: var(--bad); }
.ref.muted { border-inline-start-color: #b9b4a8; }
.ref-head { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; margin-bottom: .35rem; }
.ref-idx { font-family: var(--mono); font-size: .8rem; color: var(--ink-3); }
.sim { font-size: .78rem; color: var(--ink-3); margin-inline-start: auto; font-variant-numeric: tabular-nums; }
.ref-title { font-weight: 500; margin: 0 0 .3rem; overflow-wrap: anywhere; }
.ref details { font-size: .85rem; color: var(--ink-2); }
.ref summary { cursor: pointer; color: var(--ink-3); font-size: .8rem; }
.raw { font-family: var(--mono); font-size: .78rem; background: #fbfaf7; border-radius: 8px; padding: .5rem .6rem; margin: .4rem 0 0; overflow-wrap: anywhere; }
.match { font-size: .88rem; margin-top: .45rem; padding: .5rem .65rem; background: #fbfaf7; border-radius: 9px; overflow-wrap: anywhere; }
.match .k { color: var(--ink-3); font-size: .8rem; display: block; }
.match .m-meta { color: var(--ink-3); font-size: .8rem; display: block; }
.issues { margin: .45rem 0 0; padding-inline-start: 1.1rem; font-size: .88rem; color: var(--ink-2); }
.issues li { margin-bottom: .15rem; }
.suggest { font-size: .82rem; margin-top: .35rem; color: var(--ink-2); }
.suggest code { font-family: var(--mono); background: var(--muted-bg); padding: .05rem .35rem; border-radius: 5px; }

.finding h3 { font-size: 1rem; margin: .25rem 0 .3rem; }
.finding .detail { margin: 0; color: var(--ink-2); font-size: .93rem; }
.evidence {
  margin: .5rem 0 0; padding: .5rem .7rem; background: #fbfaf7; border-radius: 8px;
  font-size: .82rem; color: var(--ink-2); overflow-wrap: anywhere;
}

.checklist { list-style: none; margin: 0; padding: 0; display: grid; gap: .45rem; }
@media (min-width: 720px) { .checklist { grid-template-columns: 1fr 1fr; } }
.checklist li { display: flex; gap: .6rem; align-items: flex-start; padding: .6rem .7rem; border: 1px solid var(--line); border-radius: 10px; }
.mark { flex: 0 0 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: .8rem; font-weight: 600; margin-top: .15rem; }
.mark.yes { background: var(--ok-bg); color: var(--ok); }
.mark.no { background: var(--bad-bg); color: var(--bad); }
.checklist .ev { display: block; font-size: .78rem; color: var(--ink-3); overflow-wrap: anywhere; }

.notes { margin: 0; padding-inline-start: 1.1rem; color: var(--ink-2); font-size: .9rem; }
.empty { color: var(--ink-3); font-size: .92rem; padding: .5rem 0; }

/* ---------- history ---------- */
.history { list-style: none; margin: 0; padding: 0; display: grid; gap: .5rem; }
.history li {
  display: flex; align-items: center; gap: .6rem; padding: .7rem .8rem;
  border: 1px solid var(--line); border-radius: 11px;
}
.history .h-main { flex: 1; min-width: 0; cursor: pointer; }
.history .h-name { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; direction: ltr; text-align: right; }
.history .h-meta { font-size: .8rem; color: var(--ink-3); }

/* ---------- dialog / footer ---------- */
dialog { border: 0; border-radius: 16px; padding: 1.25rem; width: min(92vw, 380px); box-shadow: 0 20px 60px rgba(0,0,0,.25); }
dialog::backdrop { background: rgba(15, 25, 25, .45); }
dialog input { width: 100%; font: inherit; padding: .6rem .7rem; border: 1px solid var(--line); border-radius: 10px; margin: .5rem 0 1rem; }
.dialog-actions { display: flex; gap: .5rem; justify-content: flex-end; }
.footer { max-width: 980px; margin: 0 auto; padding: 0 1rem 2.5rem; font-size: .82rem; color: var(--ink-3); }

.toast {
  position: fixed; inset-inline: 1rem; bottom: max(1rem, env(safe-area-inset-bottom)); margin: 0 auto; max-width: 480px;
  background: var(--ink); color: #fff; padding: .75rem 1rem; border-radius: 12px; font-size: .92rem; z-index: 50;
  box-shadow: 0 10px 30px rgba(0,0,0,.25);
}

/* ---------- print ---------- */
@media print {
  .topbar, .footer, #homeView, #authView, #accountView, #uploadView, #progressView, #historyView, .report-actions, .chips, .toast { display: none !important; }
  body { background: #fff; }
  .card { box-shadow: none; break-inside: auto; }
  .ref, .finding, .tile, .cand, .idea-summary { box-shadow: none; break-inside: avoid; }
  .section-head, h2, h3 { break-after: avoid; }
  .report-head, .alert, .tiles { break-inside: avoid; }
  .ref details[open] summary, .ref details summary { display: none; }
  .ref details > * { display: block; }
}

/* ---------- upload options ---------- */
.options { display: grid; gap: .7rem; margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.check { display: flex; gap: .55rem; align-items: flex-start; cursor: pointer; font-size: .93rem; }
.check input { width: 18px; height: 18px; margin-top: .15rem; accent-color: var(--brand); flex: none; }
.check small, .date-field small { display: block; color: var(--ink-3); font-size: .8rem; }
.date-field { display: grid; gap: .35rem; font-size: .93rem; }
.date-field input { font: inherit; padding: .5rem .6rem; border: 1px solid var(--line); border-radius: 10px; background: #fbfaf7; max-width: 220px; }

/* ---------- idea similarity ---------- */
.idea-meta { display: grid; gap: .3rem; font-size: .88rem; color: var(--ink-2); margin-bottom: .9rem; }
.idea-meta b { color: var(--ink); font-weight: 600; }
.idea-summary { background: var(--brand-soft); border-radius: 12px; padding: .8rem .9rem; font-size: .92rem; margin-bottom: 1rem; }
.idea-summary dl { display: grid; grid-template-columns: max-content 1fr; gap: .25rem .8rem; margin: .6rem 0 0; font-size: .85rem; }
.idea-summary dt { color: var(--ink-3); }
.idea-summary dd { margin: 0; }
.cand { border: 1px solid var(--line); border-radius: 12px; padding: .85rem .9rem; margin-bottom: .7rem; border-inline-start: 4px solid var(--line); }
.cand.high { border-inline-start-color: var(--bad); }
.cand.medium { border-inline-start-color: var(--warn); }
.cand.info { border-inline-start-color: var(--ok); }
.cand-head { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; margin-bottom: .4rem; }
.cand-title { font-size: .95rem; margin: .1rem 0 .2rem; }
.cand-title a { text-decoration: none; }
.cand-meta { font-size: .8rem; color: var(--ink-3); }
.cand-expl { font-size: .9rem; color: var(--ink-2); margin: .5rem 0; }
.overall { font-weight: 600; font-size: .85rem; margin-inline-start: auto; }
.bars { display: grid; grid-template-columns: max-content 1fr 2.6rem; gap: .25rem .6rem; align-items: center; font-size: .8rem; color: var(--ink-2); }
.bars .track { height: 7px; background: var(--muted-bg); border-radius: 999px; overflow: hidden; }
.bars .fill { display: block; height: 100%; background: var(--brand-2); border-radius: 999px; }
.bars .v { text-align: end; font-variant-numeric: tabular-nums; }
.badge.tag { background: var(--muted-bg); color: var(--ink-2); }
.cost { font-size: .8rem; color: var(--ink-3); margin-top: .6rem; }
.self-list { font-size: .88rem; padding-inline-start: 1.1rem; margin: .4rem 0 0; }
.self-list li { margin-bottom: .35rem; }
.sub-h { font-size: .95rem; margin: 1.2rem 0 .4rem; }
@media print { .cand { break-inside: avoid; } }
.options[hidden] { display: none; }
.novelty { font-size: .88rem; background: var(--warn-bg); color: #6b4500; border-radius: 9px; padding: .45rem .6rem; margin: .4rem 0 .6rem; }

/* =====================================================================
   Accounts, navigation and landing (stage A)
   ===================================================================== */
.skip { position: absolute; inset-inline-start: -999px; top: .5rem; z-index: 50; background: var(--brand); color: #fff; padding: .4rem .8rem; border-radius: 8px; }
.skip:focus { inset-inline-start: .5rem; }
a.btn { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
.btn.block { width: 100%; }
.btn.loading { opacity: .6; pointer-events: none; }
button.link { font: inherit; background: none; border: 0; padding: 0; color: var(--brand-2); text-decoration: underline; cursor: pointer; }
:focus-visible { outline: 3px solid #7fb7b3; outline-offset: 2px; }

/* top navigation: inline on tablets/desktops, drop-down on phones */
.top-actions { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
.menu-btn { display: none; background: transparent; border: 1px solid var(--line); border-radius: 10px; width: 44px; height: 44px; color: var(--ink); cursor: pointer; }
@media (max-width: 760px) {
  .menu-btn { display: grid; place-items: center; }
  .top-actions {
    display: none; position: absolute; top: 100%; inset-inline: 0;
    flex-direction: column; align-items: stretch; gap: .35rem;
    padding: .75rem 1rem 1rem; background: var(--bg); border-bottom: 1px solid var(--line);
    box-shadow: 0 8px 18px rgba(16, 24, 40, .08);
  }
  .top-actions.open { display: flex; }
  .top-actions .btn { width: 100%; justify-content: center; }
}

/* landing */
.landing-hero { padding: 1.5rem .25rem 1.25rem; }
.landing-hero h1 { font-size: clamp(1.55rem, 4.6vw, 2.45rem); max-width: 24ch; }
.hero-actions { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: 1rem; }
.features { display: grid; grid-template-columns: 1fr; gap: .9rem; margin-top: .5rem; }
@media (min-width: 600px) { .features { grid-template-columns: 1fr 1fr; } }
@media (min-width: 1000px) { .features { grid-template-columns: repeat(4, 1fr); } }
.feature { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem; box-shadow: var(--shadow); }
.feature h3 { color: var(--brand); }
.feature p { color: var(--ink-2); font-size: .93rem; margin: 0; }

/* auth forms */
.auth-wrap { display: flex; justify-content: center; padding-top: .5rem; }
.auth-card { width: 100%; max-width: 440px; }
.auth-card h1 { font-size: 1.4rem; }
.auth-foot { margin-top: 1rem; padding-top: .9rem; border-top: 1px solid var(--line); font-size: .9rem; text-align: center; }
.field { display: grid; gap: .3rem; margin-bottom: .85rem; font-size: .93rem; }
.field > span { color: var(--ink-2); }
.field input, .field select, .field textarea {
  font: inherit; width: 100%; min-height: 46px; padding: .55rem .7rem;
  border: 1px solid var(--line); border-radius: 10px; background: #fbfaf7; color: var(--ink);
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--brand-2); background: #fff; outline: none; box-shadow: 0 0 0 3px var(--brand-soft); }
.pwd { position: relative; display: block; }
.pwd input { padding-inline-end: 4.6rem; }
.pwd-toggle { position: absolute; inset-inline-end: .35rem; top: 50%; transform: translateY(-50%); font: inherit; font-size: .8rem; background: var(--muted-bg); border: 0; border-radius: 7px; padding: .25rem .55rem; cursor: pointer; color: var(--ink-2); }
.code-input { font-family: var(--mono) !important; font-size: 1.5rem !important; letter-spacing: .45em; text-align: center !important; }
.hint { font-size: .8rem; color: var(--ink-3); margin: -.45rem 0 .8rem; }
.form-error { background: var(--bad-bg); color: var(--bad); border-radius: 9px; padding: .55rem .75rem; font-size: .9rem; margin: .6rem 0 0; }
.auth-card .check { margin: .2rem 0 1rem; }

/* account & static pages */
.grid-2 { display: grid; gap: 1rem; grid-template-columns: 1fr; }
@media (min-width: 860px) { .grid-2 { grid-template-columns: 1fr 1fr; } .grid-2 > .card { margin-bottom: 0; } .grid-2 { margin-bottom: 1rem; } }
.page { max-width: 760px; margin-inline: auto; }
.page h2 { margin-top: 1.1rem; color: var(--brand); }
.footer-links a { color: var(--ink-2); }
.toast[data-kind="ok"] { background: var(--ok); }

/* wide screens */
@media (min-width: 1280px) { .wrap, .footer { max-width: 1120px; } }
.brand-text small { max-width: 46vw; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 480px) { .brand-text small { display: none; } }

/* password field: the input is always LTR, so pin the toggle to the physical left and pad that side */
.pwd input { padding-left: 4.8rem !important; padding-right: .7rem !important; }
.pwd-toggle { left: .35rem !important; right: auto !important; inset-inline-end: auto; }

/* =====================================================================
   Stage B: pricing, checkout, invoices, credits, package-aware report
   ===================================================================== */
.plans { display: grid; gap: 1rem; grid-template-columns: 1fr; margin-bottom: 1rem; }
@media (min-width: 640px) { .plans { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1000px) { .plans { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); } }
.plan { position: relative; display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.2rem 1.1rem; box-shadow: var(--shadow); }
.plan.featured { border: 2px solid var(--brand); }
.plan h2 { font-size: 1.15rem; margin-bottom: .2rem; }
.plan-badge { position: absolute; top: -.7rem; inset-inline-start: 1rem; background: var(--brand); color: #fff; font-size: .75rem; padding: .1rem .6rem; border-radius: 999px; }
.price { font-size: 2rem; font-weight: 600; color: var(--brand); margin: .4rem 0 .6rem; text-align: right; }
.price small { font-size: .85rem; color: var(--ink-3); font-weight: 400; }
.plan-features { list-style: none; padding: 0; margin: 0 0 1rem; flex: 1; font-size: .9rem; }
.plan-features li { padding: .25rem 0; padding-inline-start: 1.3rem; position: relative; color: var(--ink-2); }
.plan-features li::before { content: "✓"; position: absolute; inset-inline-start: 0; color: var(--ok); font-weight: 600; }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.compare, table.orders, table.inv-lines { width: 100%; border-collapse: collapse; font-size: .9rem; }
.compare th, .compare td, .orders th, .orders td, .inv-lines th, .inv-lines td { padding: .55rem .6rem; border-bottom: 1px solid var(--line); text-align: start; vertical-align: top; }
.compare thead th { background: var(--muted-bg); font-weight: 600; text-align: center; }
.compare td { text-align: center; }
.compare th[scope=row] { font-weight: 500; color: var(--ink-2); min-width: 160px; }
.compare .yes { color: var(--ok); font-weight: 600; }
.compare .no { color: var(--ink-3); }
.faq dt { font-weight: 600; margin-top: .7rem; }
.faq dd { margin: .2rem 0 0; color: var(--ink-2); }

.coupon .row, .row { display: flex; gap: .5rem; }
.coupon .row input { flex: 1; text-transform: uppercase; }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
dl.sum { display: grid; grid-template-columns: 1fr auto; gap: .35rem 1rem; margin: 0 0 1rem; }
dl.sum dd { margin: 0; text-align: left; }
dl.sum .total { font-weight: 600; font-size: 1.1rem; border-top: 1px solid var(--line); padding-top: .45rem; }

.credit-box { margin-bottom: 1rem; }
.credit-box select { font: inherit; width: 100%; min-height: 46px; border: 1px solid var(--line); border-radius: 10px; padding: .4rem .6rem; background: #fbfaf7; }
.alert.small { font-size: .88rem; padding: .5rem .75rem; }
.credit-list { display: grid; gap: .7rem; }
.credit { border: 1px solid var(--line); border-radius: 12px; padding: .75rem .9rem; }
.credit.used { opacity: .65; }
.credit-head { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; margin-bottom: .2rem; }
.slot-list { margin: .4rem 0 0; padding-inline-start: 1.1rem; font-size: .86rem; }

.invoice { max-width: 760px; margin-inline: auto; }
.inv-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 1rem; border-bottom: 2px solid var(--brand); padding-bottom: .8rem; margin-bottom: .8rem; }
.inv-seller { font-size: .88rem; color: var(--ink-2); text-align: end; }
dl.inv-meta { display: grid; grid-template-columns: max-content 1fr; gap: .3rem 1rem; font-size: .92rem; margin: 0 0 1rem; }
dl.inv-meta dd { margin: 0; }
.inv-lines td:last-child, .inv-lines th:last-child { text-align: left; white-space: nowrap; }
.inv-lines tfoot th { font-size: 1.05rem; border-bottom: 0; }
.report-actions.no-print { display: flex; gap: .5rem; justify-content: flex-end; margin-bottom: .7rem; }

.overview .ov-list { list-style: none; padding: 0; margin: 0; display: grid; gap: .35rem; grid-template-columns: 1fr; }
@media (min-width: 760px) { .overview .ov-list { grid-template-columns: 1fr 1fr; } }
.ov-list li { display: flex; align-items: center; gap: .6rem; padding: .45rem .6rem; border-radius: 10px; background: var(--muted-bg); font-size: .9rem; }
.ov-list li.bad { background: var(--bad-bg); }
.ov-list li.warn { background: var(--warn-bg); }
.ov-list li.ok { color: var(--ink-3); }
.ov-n { min-width: 2rem; text-align: center; font-weight: 600; font-size: 1.05rem; }
.ov-list li.bad .ov-n { color: var(--bad); }
.ov-list li.warn .ov-n { color: var(--warn); }
.ov-ok { margin-inline-start: auto; color: var(--ok); }
.locked { border-style: dashed; background: #fbfaf7; }
.upsell { border: 2px solid var(--brand-soft); }
@media print { .no-print, .upsell, .locked .btn { display: none !important; } #pageView .invoice { box-shadow: none; border: 0; } }

/* free tool, Apple Pay, owned credits */
.free-tool textarea { width: 100%; font: .9rem/1.6 var(--mono); border: 1px solid var(--line); border-radius: 10px; padding: .7rem; background: #fbfaf7; resize: vertical; }
.free-list { list-style: none; padding: 0; margin: 1rem 0 .6rem; display: grid; gap: .45rem; }
.free-list li { display: flex; gap: .6rem; align-items: flex-start; flex-wrap: wrap; padding: .5rem .6rem; border: 1px solid var(--line); border-radius: 10px; font-size: .88rem; overflow-wrap: anywhere; }
.applepay { width: 100%; min-height: 48px; border: 0; border-radius: 10px; background: #000; color: #fff; font: 600 1.1rem -apple-system, "SF Pro Text", "Helvetica Neue", Arial, sans-serif; cursor: pointer; direction: ltr; }
.applepay span::before { content: ""; font-size: 1.25rem; }
.applepay:disabled { opacity: .6; }
.or { display: flex; align-items: center; gap: .6rem; color: var(--ink-3); font-size: .82rem; margin: .9rem 0; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.owned { font-size: .82rem; color: var(--ok); background: var(--ok-bg); border-radius: 8px; padding: .35rem .55rem; margin: 0 0 .6rem; }
.print-brand { display: none; }

/* long DOIs / URLs never overflow their box (screen and print) */
.ref, .ref-title, .raw, .match, .evidence, .cand-title, .cand-meta, .issues, .suggest, .notes li, .free-list li { overflow-wrap: anywhere; word-break: break-word; }

/* =====================================================================
   Professional print / PDF layout for reports and invoices
   ===================================================================== */
@page { size: A4; margin: 14mm 12mm 16mm; }
@media print {
  html, body { background: #fff !important; }
  body { font-size: 10pt; line-height: 1.5; color: #111; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .wrap { max-width: none !important; padding: 0 !important; margin: 0 !important; }
  .topbar, .footer, .skip, .menu-btn, #homeView, #authView, #accountView, #uploadView, #progressView, #historyView,
  .report-actions, .chips, .toast, .locked, .upsell, .btn, details > summary { display: none !important; }
  #reportView:not([hidden]) ~ #pageView, #pageView:not([hidden]) ~ #reportView { display: none !important; }
  .print-brand { display: flex !important; justify-content: space-between; align-items: baseline; gap: 1rem;
    border-bottom: 2px solid #0f3d3e; padding-bottom: 4pt; margin-bottom: 8pt; font-size: 9pt; color: #444; }
  .print-brand strong { color: #0f3d3e; font-size: 12pt; }
  h1 { font-size: 15pt; margin: 0 0 3pt; }
  h2 { font-size: 12pt; margin: 0 0 4pt; color: #0f3d3e; }
  h3 { font-size: 10.5pt; }
  .report-head { display: block !important; border: 0; padding: 0; margin: 0 0 6pt; }
  .paper-title { font-size: 11pt; font-weight: 600; margin: 2pt 0; }
  .meta { font-size: 8.5pt; color: #555; }
  .card { box-shadow: none !important; border: 1px solid #ccd3d2 !important; border-radius: 6px !important; padding: 8pt 10pt !important;
    margin: 0 0 8pt !important; background: #fff !important; break-inside: auto; }
  .section-head { display: flex; justify-content: space-between; align-items: baseline; break-after: avoid; margin-bottom: 4pt; }
  h2, h3, .section-head, .sub-h { break-after: avoid; page-break-after: avoid; }
  .alert { border: 1px solid currentColor; border-radius: 6px; padding: 6pt 8pt; margin: 0 0 8pt; font-size: 9.5pt; break-inside: avoid; }
  .tiles { display: grid !important; grid-template-columns: repeat(5, 1fr) !important; gap: 5pt !important; margin: 0 0 8pt !important; break-inside: avoid; }
  .tile { border: 1px solid #ccd3d2; border-radius: 6px; padding: 5pt !important; box-shadow: none !important; text-align: center; }
  .tile .num { font-size: 15pt !important; }
  .tile .lbl { font-size: 8pt !important; }
  .overview .ov-list { grid-template-columns: 1fr 1fr !important; gap: 3pt !important; }
  .ov-list li { padding: 3pt 6pt !important; font-size: 8.8pt !important; break-inside: avoid; }
  .ref, .finding, .cand, .tile, .idea-summary, .credit, .checklist li, .ov-list li, .free-list li { break-inside: avoid; page-break-inside: avoid; }
  .ref, .finding, .cand { border: 1px solid #dde3e2 !important; border-inline-start-width: 3pt !important; border-radius: 5px !important;
    padding: 5pt 7pt !important; margin: 0 0 5pt !important; box-shadow: none !important; }
  .ref details { display: block; }
  .ref details > *:not(summary) { display: block !important; }
  .raw, .evidence { font-size: 8.3pt !important; }
  .badge { border: 1px solid currentColor; padding: 0 4pt !important; font-size: 7.8pt !important; }
  .bars { grid-template-columns: max-content 1fr 2.4rem !important; font-size: 8pt !important; }
  .bars .track { height: 5pt !important; border: 1px solid #ccd3d2; }
  .checklist { grid-template-columns: 1fr 1fr !important; font-size: 8.8pt; }
  .tip, .cost { font-size: 8.2pt !important; }
  a { color: #0f3d3e !important; text-decoration: none !important; }
  /* invoice */
  .invoice { border: 0 !important; padding: 0 !important; max-width: none !important; }
  .inv-lines th, .inv-lines td { padding: 4pt 6pt !important; }
}
@page { @bottom-center { content: "ResearchAI Check — " counter(page) " / " counter(pages); font-size: 8pt; color: #777; } }

/* ---------- language switch & English (LTR) layout ---------- */
.top-end { display: flex; align-items: center; gap: .5rem; }
.lang-btn {
  min-height: 40px; padding: 0 .8rem; border: 1px solid var(--line); border-radius: 10px;
  background: transparent; color: var(--ink); font: 500 .9rem var(--font); cursor: pointer; white-space: nowrap;
}
.lang-btn:hover { background: var(--muted-bg); }
html[lang="en"] { --font: "IBM Plex Sans", "Segoe UI", system-ui, -apple-system, sans-serif; }
html[lang="en"] body { letter-spacing: 0; }
html[lang="en"] .history .h-name { text-align: left; }
html[lang="en"] .price { text-align: left; }
html[lang="en"] dl.sum dd { text-align: right; }
html[lang="en"] .inv-lines td:last-child, html[lang="en"] .inv-lines th:last-child { text-align: right; }
/* the password toggle sits at the end of the field in both languages */
html[lang="en"] .pwd input { padding-right: 4.8rem !important; padding-left: .7rem !important; }
html[lang="en"] .pwd-toggle { right: .35rem !important; left: auto !important; }
@media print { .lang-btn { display: none !important; } }

/* ---------- home-page ads (from the admin panel) ---------- */
.ads { display: grid; gap: .75rem; margin-bottom: 1rem; }
.ads:empty { display: none; }
.ad {
  display: grid; grid-template-columns: 1fr; overflow: hidden; text-decoration: none; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
}
a.ad:hover { border-color: var(--brand-2); }
.ad img { width: 100%; aspect-ratio: 3 / 1; object-fit: cover; display: block; }
.ad-text { padding: .9rem 1.1rem; display: grid; gap: .35rem; justify-items: start; }
.ad-text p { margin: 0; color: var(--ink-2); font-size: .93rem; }
@media (min-width: 760px) {
  .ad.has-img { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); align-items: center; }
  .ad.has-img img { aspect-ratio: 2.4 / 1; height: 100%; }
}
@media print { .ads { display: none !important; } }

/* ---------- submission risk score ---------- */
.risk-main { display: flex; gap: 1.1rem; align-items: center; margin-bottom: .9rem; }
.risk-main h2 { margin: 0 0 .25rem; }
.risk-main p { margin: .4rem 0 0; }
.risk-score {
  flex: none; width: 104px; height: 104px; border-radius: 50%; display: grid; place-content: center; text-align: center;
  border: 6px solid var(--line); background: var(--surface); line-height: 1;
}
.risk-score b { font-size: 2.3rem; font-weight: 600; }
.risk-score small { color: var(--ink-3); font-size: .8rem; margin-top: .2rem; }
.risk.ok .risk-score { border-color: var(--ok); color: var(--ok); }
.risk.warn .risk-score { border-color: #d99a1e; color: var(--warn); }
.risk.bad .risk-score { border-color: var(--bad); color: var(--bad); }
.risk-parts { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: .75rem; }
.risk-parts li { border: 1px solid var(--line); border-radius: 12px; padding: .65rem .8rem; }
.rp-head { display: flex; justify-content: space-between; gap: .5rem; font-weight: 500; font-size: .93rem; }
.rp-head b { color: var(--ink-2); font-weight: 500; font-size: .85rem; }
.rp-bar { height: 6px; background: var(--muted-bg); border-radius: 999px; margin: .45rem 0 .35rem; overflow: hidden; }
.rp-bar span { display: block; height: 100%; border-radius: 999px; background: var(--ok); }
.risk-parts li.warn .rp-bar span { background: #d99a1e; }
.risk-parts li.bad .rp-bar span { background: var(--bad); }
.rp-detail { color: var(--ink-2); font-size: .82rem; }
@media (max-width: 520px) { .risk-main { align-items: flex-start; } .risk-score { width: 84px; height: 84px; } .risk-score b { font-size: 1.9rem; } }
@media print { .risk { break-inside: avoid; } }

/* ---------- full peer review ---------- */
.review .rv-summary { font-size: 1rem; line-height: 1.9; margin: .2rem 0 .8rem; }
.rv-counts { display: flex; flex-wrap: wrap; gap: .4rem; margin: .4rem 0 .9rem; }
.rv-strengths ul { margin: .3rem 0 .8rem; padding-inline-start: 1.2rem; }
.rv-strengths li { margin: .2rem 0; }
.rv-group { font-size: 1.02rem; margin: 1.2rem 0 .6rem; padding-top: .6rem; border-top: 1px solid var(--line); }
.rv-issue { border: 1px solid var(--line); border-inline-start-width: 4px; border-radius: 10px; padding: .7rem .9rem; margin-bottom: .6rem; break-inside: avoid; }
.rv-issue.bad { border-inline-start-color: var(--bad); }
.rv-issue.warn { border-inline-start-color: #d99a1e; }
.rv-issue.muted { border-inline-start-color: var(--line); }
.rv-issue h4 { margin: .35rem 0 .3rem; font-size: .98rem; }
.rv-issue p { margin: .25rem 0; line-height: 1.8; }
.rv-top { display: flex; gap: .35rem; flex-wrap: wrap; }
.rv-fix { background: var(--ok-bg, #eef7f1); border-radius: 8px; padding: .35rem .6rem; }
.rv-lang { width: 100%; border-collapse: collapse; font-size: .9rem; }
.rv-lang th, .rv-lang td { border-bottom: 1px solid var(--line); padding: .35rem .5rem; text-align: start; vertical-align: top; }
.rv-lang del { color: var(--bad); }
.rv-questions li { margin: .3rem 0; line-height: 1.8; }
.locked-inline { background: var(--muted-bg); border-radius: 10px; padding: .55rem .8rem; margin-top: .8rem; font-size: .9rem; }

/* ---------- home: call to action, trust strip, plans ---------- */
.btn.cta { min-height: 54px; padding: 0 1.6rem; font-size: 1.08rem; font-weight: 600; border-radius: 14px;
  box-shadow: 0 8px 22px rgba(15, 61, 62, .25); }
.btn.cta:hover { transform: translateY(-1px); box-shadow: 0 10px 26px rgba(15, 61, 62, .3); }
html[lang="en"] .btn.cta span { display: inline-block; transform: scaleX(-1); }
.trust { list-style: none; padding: 0; margin: 1.1rem 0 0; display: flex; flex-wrap: wrap; gap: .45rem .9rem; color: var(--ink-2); font-size: .9rem; }
.trust li::before { content: "✓"; color: var(--ok); font-weight: 700; margin-inline-end: .35rem; }
.home-plans { margin-top: 1.6rem; }
.home-plan-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: .8rem; }
.home-plan { position: relative; display: grid; gap: .25rem; padding: 1rem 1.1rem; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); box-shadow: var(--shadow); color: var(--ink); text-decoration: none; }
.home-plan:hover { border-color: var(--brand-2); }
.home-plan.featured { border-color: var(--brand); border-width: 2px; }
.home-plan strong { font-size: 1.05rem; }
.hp-price { font-size: 1.4rem; font-weight: 600; color: var(--brand); text-align: start; }

/* ---------- which paid package pays for this check ---------- */
.credit-pick { border: 0; padding: 0; margin: 0 0 1rem; display: grid; gap: .55rem; }
.credit-pick legend { font-weight: 600; margin-bottom: .45rem; padding: 0; }
.credit-opt { display: flex; gap: .7rem; align-items: flex-start; border: 1.5px solid var(--line); border-radius: 12px; padding: .75rem .9rem; cursor: pointer; background: var(--surface); }
.credit-opt:hover { border-color: var(--brand-2); }
.credit-opt:has(input:checked) { border-color: var(--brand); background: #f3f8f7; box-shadow: 0 0 0 3px rgba(15, 61, 62, .08); }
.credit-opt input { margin-top: .3rem; accent-color: var(--brand); width: 18px; height: 18px; flex: none; }
.co-body { display: grid; gap: .2rem; min-width: 0; }
.co-head { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
.co-sub { color: var(--ink-2); font-size: .88rem; }
.co-papers { margin: .2rem 0 0; padding-inline-start: 1.1rem; color: var(--ink-2); font-size: .84rem; }
.co-papers li { overflow-wrap: anywhere; }

/* =====================================================================
   Logo, footer, sign-in popup, Google button, support tickets
   ===================================================================== */
.brand-logo { width: 38px; height: 38px; border-radius: 11px; display: block; flex: none; }

/* footer */
.footer { border-top: 1px solid var(--line); padding-top: 1.6rem; margin-top: 1rem; }
.footer-grid { display: grid; gap: 1.25rem; grid-template-columns: 1.2fr 1fr 1.2fr; align-items: start; }
@media (max-width: 820px) { .footer-grid { grid-template-columns: 1fr; } }
.f-logo { height: 34px; width: auto; display: block; margin-bottom: .45rem; }
.f-brand p { margin: 0; max-width: 34ch; }
.f-links { display: grid; gap: .35rem; font-size: .88rem; }
.f-links a { color: var(--ink-2); text-decoration: none; }
.f-links a:hover { color: var(--brand); text-decoration: underline; }
.f-label { display: block; font-size: .8rem; color: var(--ink-3); margin-bottom: .45rem; }
.pay-list { display: flex; flex-wrap: wrap; gap: .45rem; }
.pay-list span { background: #fff; border: 1px solid var(--line); border-radius: 8px; height: 38px; padding: 0 .55rem;
  display: inline-flex; align-items: center; }
.pay-list img { height: 22px; width: auto; display: block; }
.f-legal { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .5rem 1rem; margin-top: 1.25rem; padding-top: .9rem;
  border-top: 1px solid var(--line); font-size: .8rem; color: var(--ink-3); }
.f-legal a { color: var(--ink-2); }
.cert-badge { display: inline-flex; align-items: center; gap: .4rem; }
.cert-badge svg { color: var(--ok); flex: none; }

/* Google button */
.btn-google { display: flex; align-items: center; justify-content: center; gap: .6rem; width: 100%; min-height: 46px;
  background: #fff; color: #1f1f1f; border: 1px solid #c9cdd2; border-radius: 12px; font: inherit; font-weight: 500;
  text-decoration: none; cursor: pointer; }
.btn-google:hover { background: #f7f8f8; border-color: #aeb4ba; }
.btn-google svg, .btn-google img { width: 22px; height: 22px; flex: none; object-fit: contain; display: block; }
.or-line { display: flex; align-items: center; gap: .75rem; color: var(--ink-3); font-size: .82rem; margin: .9rem 0; }
.or-line::before, .or-line::after { content: ""; flex: 1; height: 1px; background: var(--line); }

/* sign-in / sign-up popup */
.auth-modal { border: 0; border-radius: 18px; padding: 0; width: min(440px, calc(100vw - 1.5rem)); max-height: calc(100dvh - 2rem);
  box-shadow: 0 24px 60px rgba(10, 30, 30, .28); color: var(--ink); background: var(--surface); overflow: auto; }
.auth-modal::backdrop { background: rgba(15, 30, 30, .45); backdrop-filter: blur(2px); }
.am-head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: 1.1rem 1.25rem .4rem; }
.am-head img { height: 30px; width: auto; }
.am-close { background: none; border: 0; width: 40px; height: 40px; border-radius: 10px; font-size: 1.4rem; line-height: 1; color: var(--ink-2); cursor: pointer; }
.am-close:hover { background: var(--muted-bg); }
.am-body { padding: .2rem 1.25rem 1.3rem; }
.am-body h2 { font-size: 1.25rem; margin: .3rem 0 .2rem; }
.am-tabs { display: grid; grid-template-columns: 1fr 1fr; background: var(--muted-bg); border-radius: 12px; padding: 4px; margin: .8rem 0 1rem; }
.am-tabs button { border: 0; background: transparent; border-radius: 9px; padding: .5rem; font: inherit; color: var(--ink-2); cursor: pointer; }
.am-tabs button[aria-selected="true"] { background: #fff; color: var(--ink); font-weight: 600; box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.am-body .field { margin-bottom: .7rem; }
.am-perks { list-style: none; padding: 0; margin: .4rem 0 0; display: grid; gap: .2rem; font-size: .85rem; color: var(--ink-2); }
.am-perks li::before { content: "✓"; color: var(--ok); font-weight: 700; margin-inline-end: .4rem; }
.am-foot { font-size: .8rem; color: var(--ink-3); margin-top: .8rem; text-align: center; }

/* support tickets */
.support-grid { display: grid; gap: 1rem; grid-template-columns: 1.4fr 1fr; align-items: start; }
@media (max-width: 860px) { .support-grid { grid-template-columns: 1fr; } }
.ticket-form .two-col { display: grid; gap: .7rem; grid-template-columns: 1fr 1fr; }
@media (max-width: 560px) { .ticket-form .two-col { grid-template-columns: 1fr; } }
.ticket-form textarea, .reply-box textarea { width: 100%; min-height: 150px; font: inherit; padding: .6rem .7rem; border: 1px solid var(--line);
  border-radius: 10px; background: #fbfaf7; resize: vertical; }
.ticket-form select { width: 100%; font: inherit; padding: .55rem .6rem; border: 1px solid var(--line); border-radius: 10px; background: #fbfaf7; }
/* honeypot for bots: visually hidden without moving it off-screen (that widens RTL pages) */
.hp-field { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; opacity: 0; pointer-events: none; }
.ticket-list { list-style: none; padding: 0; margin: 0; display: grid; gap: .5rem; }
.ticket-list a { display: grid; gap: .1rem; padding: .65rem .75rem; border: 1px solid var(--line); border-radius: 11px; text-decoration: none; color: var(--ink); }
.ticket-list a:hover { border-color: var(--brand-2); background: var(--brand-soft); }
.ticket-list .tl-top { display: flex; justify-content: space-between; gap: .5rem; align-items: center; }
.t-code { font-family: var(--mono); font-size: .85rem; direction: ltr; unicode-bidi: isolate; }

.ticket-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .75rem; align-items: flex-start; }
.ticket-head h1 { font-size: 1.35rem; margin: .1rem 0 .2rem; }
.stepper { list-style: none; display: grid; grid-template-columns: repeat(4, 1fr); gap: 0; padding: 0; margin: 1.2rem 0 .4rem; counter-reset: st; }
.stepper li { position: relative; text-align: center; font-size: .82rem; color: var(--ink-3); padding-top: 2.2rem; }
.stepper li::before { counter-increment: st; content: counter(st); position: absolute; top: 0; left: 50%; transform: translateX(-50%);
  width: 1.8rem; height: 1.8rem; border-radius: 50%; display: grid; place-items: center; background: var(--muted-bg); color: var(--ink-3);
  font-weight: 600; z-index: 1; border: 2px solid var(--surface); }
.stepper li::after { content: ""; position: absolute; top: .85rem; height: 3px; background: var(--line); inset-inline-start: 50%; width: 100%; }
.stepper li:last-child::after { display: none; }
.stepper li.done { color: var(--ink-2); }
.stepper li.done::before { content: "✓"; background: var(--ok); color: #fff; }
.stepper li.done::after { background: var(--ok); }
.stepper li.current { color: var(--ink); font-weight: 600; }
.stepper li.current::before { background: var(--brand); color: #fff; box-shadow: 0 0 0 4px var(--brand-soft); }
.timeline { list-style: none; padding: 0; margin: 0; position: relative; }
.timeline::before { content: ""; position: absolute; inset-inline-start: 11px; top: 6px; bottom: 6px; width: 2px; background: var(--line); }
.timeline li { position: relative; padding-inline-start: 2.1rem; margin-bottom: 1rem; }
.timeline .dot { position: absolute; inset-inline-start: 4px; top: .35rem; width: 16px; height: 16px; border-radius: 50%; background: var(--surface);
  border: 3px solid var(--ink-3); }
.timeline li.customer .dot { border-color: var(--brand-2); }
.timeline li.staff .dot { border-color: var(--ok); background: var(--ok); }
.timeline li.status .dot { border-color: var(--warn); width: 12px; height: 12px; inset-inline-start: 6px; top: .45rem; }
.timeline li.inote .dot { border-color: #8a6bbf; }
.tl-meta { font-size: .8rem; color: var(--ink-3); }
.tl-meta b { color: var(--ink-2); font-weight: 600; }
.tl-body { margin-top: .3rem; padding: .7rem .85rem; border-radius: 12px; background: var(--muted-bg); white-space: pre-wrap; overflow-wrap: anywhere; font-size: .93rem; }
.timeline li.staff .tl-body { background: var(--ok-bg); }
.timeline li.inote .tl-body { background: #f1ecf8; border: 1px dashed #c3b2e0; }
.reply-box { margin-top: 1rem; border-top: 1px solid var(--line); padding-top: 1rem; }
@media print { .footer, .auth-modal { display: none !important; } }

/* invoice logo */
.inv-logo { height: 34px; width: auto; display: block; margin-bottom: .5rem; }
.print-brand img.print-logo { height: 24px; width: auto; }
@media print { .print-brand img.print-logo { height: 20pt; } .inv-logo { height: 24pt; } }

/* payment gateway trust line */
.pay-trust { display: flex; gap: .55rem; align-items: flex-start; margin-top: .75rem; padding: .6rem .75rem; border-radius: 10px;
  background: var(--ok-bg); color: var(--ink-2); font-size: .8rem; line-height: 1.55; }
.pay-trust svg { color: var(--ok); flex: none; margin-top: .15rem; }
.pay-trust strong { display: block; color: var(--ink); font-weight: 600; font-size: .84rem; }
.checkout-pay { margin-top: .6rem; }

/* maintenance */
.maint { text-align: center; padding: 2.5rem 1.25rem !important; max-width: 560px; margin: 2rem auto; }
.maint img { border-radius: 16px; margin-bottom: .8rem; }
.maint .lead { margin-inline: auto; }
.maint-banner { background: var(--warn-bg); color: #6b4500; border: 1px solid #f0d9a8; border-radius: 12px; padding: .6rem .9rem; margin-bottom: 1rem; font-size: .9rem; }
/* Moyasar form */
#mysrForm { margin: .75rem 0; }
.admin-test { margin-top: .6rem; }

.pay-error { margin: .6rem 0; }
.pay-error .small { margin-top: .2rem; font-weight: 400; }
.mono { font-family: var(--mono); overflow-wrap: anywhere; }
