/* Layout uses logical properties (inline-start/end) throughout, so RTL and LTR share one
   stylesheet and nothing is "mirrored" by hand. Directional icons use .icon-dir. */

:root {
  --bg: #fafaf9;
  --surface: #ffffff;
  --text: #1c1917;
  --muted: #6b6560;
  --border: #e7e5e4;
  --subtle: #f5f5f4;
  --accent: #0f766e;
  --accent-hover: #115e59;
  --accent-soft: #f0fdfa;
  --danger: #b42318;
  --danger-soft: #fef3f2;
  --radius: 12px;
  --shadow: 0 1px 2px rgb(28 25 23 / 0.04), 0 4px 16px rgb(28 25 23 / 0.04);
  --font-latin: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-arabic: 'Noto Sans Arabic', 'Segoe UI', Tahoma, sans-serif;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-latin);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* Arabic script needs its own face first and more line height for ascenders/descenders. */
html[lang='ar'] body { font-family: var(--font-arabic), var(--font-latin); line-height: 1.85; }
html[lang='ar'] h1, html[lang='ar'] h2, html[lang='ar'] h3 { line-height: 1.5; letter-spacing: 0; }

/* User-entered text follows its own script, whatever the UI language. */
.user-text { font-family: var(--font-arabic), var(--font-latin); line-height: 1.9; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3 { margin: 0; letter-spacing: -0.01em; line-height: 1.25; }

.container { width: 100%; max-width: 1080px; margin-inline: auto; padding-inline: 16px; }
@media (min-width: 640px) { .container { padding-inline: 24px; } }

.muted { color: var(--muted); }
.small { font-size: 0.875rem; }
[hidden] { display: none !important; }

/* Flip arrows/chevrons in RTL. */
[dir='rtl'] .icon-dir { transform: scaleX(-1); }

/* ── buttons & inputs ───────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 40px; padding: 8px 16px;
  border: 1px solid var(--border); border-radius: 10px;
  background: var(--surface); color: var(--text);
  font: inherit; font-size: 0.9375rem; font-weight: 500; line-height: 1.2;
  cursor: pointer; white-space: nowrap; text-decoration: none;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.btn:hover { background: var(--subtle); text-decoration: none; }
.btn:focus-visible, .input:focus-visible, textarea:focus-visible, select:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-lg { min-height: 48px; padding: 12px 24px; font-size: 1rem; }
.btn-block { width: 100%; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn svg { width: 18px; height: 18px; flex: none; }

.input {
  width: 100%; min-height: 44px; padding: 10px 12px;
  border: 1px solid var(--border); border-radius: 10px;
  background: var(--surface); color: var(--text); font: inherit;
}
label.field { display: grid; gap: 6px; font-size: 0.9rem; font-weight: 500; }

.alert { padding: 10px 14px; border-radius: 10px; font-size: 0.9rem; }
.alert-error { background: var(--danger-soft); color: var(--danger); }
.alert-action { background: none; border: 0; padding: 0; font: inherit; font-weight: 600; color: inherit; text-decoration: underline; cursor: pointer; }
.alert-info { background: var(--accent-soft); color: var(--accent-hover); }

.badge {
  display: inline-block; padding: 2px 10px; border-radius: 999px;
  background: var(--subtle); color: var(--muted); font-size: 0.8rem; font-weight: 600;
}
.badge-pro { background: var(--accent-soft); color: var(--accent); }

.spinner {
  width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid rgb(255 255 255 / 0.4); border-top-color: #fff;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
/* A button waiting on a slow step (setLoading in common.js): locked, but not faded like a disabled one. */
.btn[aria-busy='true'] { opacity: 1; cursor: progress; }
.btn .spinner { flex: none; }

/* ── header ─────────────────────────────────────────────────────────────── */
.site-header { border-bottom: 1px solid var(--border); background: var(--surface); }
.site-header .container { display: flex; align-items: center; gap: 12px; min-height: 64px; }
.logo { display: flex; align-items: center; gap: 8px; color: var(--text); font-weight: 700; font-family: var(--font-latin); }
.logo:hover { text-decoration: none; }
.logo-mark {
  display: grid; place-items: center; width: 28px; height: 28px; border-radius: 8px;
  background: var(--accent); color: #fff; font-family: var(--font-arabic); font-size: 15px; line-height: 1;
}
.header-actions { display: flex; align-items: center; gap: 8px; margin-inline-start: auto; flex-wrap: wrap; justify-content: flex-end; }
.lang-btn { font-family: var(--font-arabic), var(--font-latin); }
html[lang='ar'] .lang-btn { font-family: var(--font-latin); }

/* ── landing ────────────────────────────────────────────────────────────── */
.hero { padding-block: 96px 80px; text-align: center; }
.eyebrow { display: inline-block; margin-block-end: 20px; color: var(--accent); font-size: 0.9rem; font-weight: 600; }
.hero h1 { max-width: 760px; margin-inline: auto; font-size: clamp(2rem, 5vw, 3.25rem); font-weight: 700; }
.hero p { max-width: 620px; margin: 20px auto 0; color: var(--muted); font-size: 1.125rem; }
.hero-compact { padding-block: 64px 32px; }
.hero-cta { display: flex; flex-direction: column; align-items: center; gap: 12px; margin-block-start: 36px; }

.section { padding-block: 72px; border-top: 1px solid var(--border); }
.section h2 { font-size: 1.5rem; font-weight: 700; margin-block-end: 36px; text-align: center; }

.narrow { max-width: 760px; }
.lead { margin: -16px auto 28px; max-width: 640px; text-align: center; color: var(--muted); font-size: 1.05rem; }
.pattern-list { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin: 0; padding: 0; list-style: none; }
.pattern-list li { padding: 8px 14px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); font-size: 0.95rem; }
.compare { display: grid; gap: 20px; grid-template-columns: 1fr; }
@media (min-width: 760px) { .compare { grid-template-columns: 1fr 1fr; } }
.compare-card p { margin: 0; }
.compare-label { margin-block-end: 12px; font-size: 0.95rem; color: var(--muted); }
.compare-after { border-color: var(--accent); }
.compare-after .compare-label { color: var(--accent); }
.compare mark { background: var(--danger-soft); color: var(--danger); border-radius: 4px; padding-inline: 2px; }
.compare-note { margin: 16px 0 0; text-align: center; }
.grid-4 { display: grid; gap: 20px; grid-template-columns: 1fr; }
@media (min-width: 640px) { .grid-4 { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 980px) { .grid-4 { grid-template-columns: repeat(4, 1fr); } }
.grid-3 { display: grid; gap: 20px; grid-template-columns: 1fr; }
@media (min-width: 760px) { .grid-3 { grid-template-columns: repeat(3, 1fr); } }

.card { padding: 24px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.card h3 { font-size: 1.0625rem; margin-block-end: 8px; }
.card p { margin: 0; color: var(--muted); }

.step-num {
  display: grid; place-items: center; width: 32px; height: 32px; margin-block-end: 14px;
  border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-weight: 700; font-family: var(--font-latin);
}

.pricing { display: grid; gap: 20px; max-width: 440px; margin-inline: auto; grid-template-columns: 1fr; }
/* Four plans (user decision, 24 Oct 2026): stacked on phones; from 740px a sideways slider that
   shows 3 cards at the old size (2 on tablets) with the next one peeking in, plus arrows and dots. */
.plan-slider { position: relative; }
.slider-arrow, .slider-dots { display: none; }
@media (min-width: 740px) {
  .pricing {
    display: flex; max-width: none; gap: 20px; overflow-x: auto; scroll-snap-type: x mandatory; scroll-behavior: smooth;
    padding: 20px 4px 12px; margin-inline: -4px; scroll-padding-inline: 4px; scrollbar-width: none; align-items: stretch;
  }
  .pricing::-webkit-scrollbar { display: none; }
  .price-card { flex: 0 0 calc((100% - 20px) / 2.25); scroll-snap-align: start; }
  .slider-arrow:not([hidden]) {
    display: grid; place-items: center; position: absolute; inset-block-start: 50%; z-index: 2; width: 40px; height: 40px;
    margin-block-start: -20px; padding: 0; border: 1px solid var(--border); border-radius: 50%; background: var(--surface);
    color: var(--text); box-shadow: var(--shadow); cursor: pointer;
  }
  .slider-arrow:disabled { opacity: 0.35; cursor: default; }
  .slider-arrow svg { width: 20px; height: 20px; }
  .slider-prev { inset-inline-start: -20px; }
  .slider-next { inset-inline-end: -20px; }
  [dir='rtl'] .slider-arrow svg { transform: scaleX(-1); }
  .slider-dots:not([hidden]) { display: flex; justify-content: center; gap: 8px; margin-block-start: 8px; }
  .slider-dots button { width: 9px; height: 9px; padding: 0; border: 0; border-radius: 50%; background: var(--border); cursor: pointer; }
  .slider-dots button[aria-current='true'] { background: var(--accent); }
}
@media (min-width: 1024px) { .price-card { flex-basis: calc((100% - 40px) / 3.25); } }
/* Shorter cards in the slider (user request, 24 Oct 2026): tighter spacing and feature lines. */
@media (min-width: 740px) {
  .price-card { padding: 20px 22px; gap: 14px; }
  .price-card .checklist { gap: 6px; }
  .price-card .checklist li { font-size: 0.9375rem; line-height: 1.5; }
  .price-card .checklist svg { width: 16px; height: 16px; margin-block-start: 3px; }
}
@media (min-width: 740px) and (max-width: 899px) {
  .pricing { gap: 14px; }
  .price-card { padding: 18px; }
  .price { font-size: 1.6rem; }
}
.price-card { position: relative; display: flex; flex-direction: column; gap: 20px; }
.plan-tag {
  position: absolute; inset-block-start: -12px; inset-inline-start: 24px;
  padding: 2px 12px; border-radius: 999px; background: var(--accent); color: #fff; font-size: 0.8rem; font-weight: 600;
}
.price-was { color: var(--muted); font-size: 1.1rem; font-weight: 500; }
.price-off {
  display: inline-block; padding: 1px 8px; border-radius: 999px; vertical-align: middle;
  background: #fef3c7; color: #92400e; font-size: 0.8rem; font-weight: 600; font-family: var(--font-arabic), var(--font-latin);
}
.interval-toggle { display: flex; width: fit-content; margin: 0 auto 24px; padding: 4px; gap: 4px; background: var(--subtle); border: 1px solid var(--border); border-radius: 999px; }
.interval-toggle button { border: 0; background: none; padding: 8px 18px; border-radius: 999px; font: inherit; font-weight: 500; color: var(--muted); cursor: pointer; }
.interval-toggle button[aria-pressed='true'] { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
/* "Save 17%" on the Yearly tab. */
.tab-save { font-size: 0.8em; font-weight: 700; color: var(--accent); white-space: nowrap; }
.interval-toggle button[aria-pressed='true'] .tab-save { color: inherit; opacity: 0.9; }
.price-note { display: block; font-size: 0.85rem; font-weight: 500; color: var(--muted); font-family: var(--font-arabic), var(--font-latin); }
.price-save { display: block; margin-block-start: 2px; font-size: 0.85rem; font-weight: 600; color: var(--accent); font-family: var(--font-arabic), var(--font-latin); }
.price-card.featured { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.price { font-size: 2rem; font-weight: 700; font-family: var(--font-latin); }
.price small { font-size: 0.95rem; font-weight: 500; color: var(--muted); font-family: var(--font-arabic), var(--font-latin); }
.checklist { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; flex: 1; align-content: start; }
.checklist li { display: flex; gap: 10px; align-items: flex-start; }
.checklist svg { width: 18px; height: 18px; margin-block-start: 4px; color: var(--accent); flex: none; }


/* ── processing animation ───────────────────────────────────────────────── */
.processing { flex: 1; display: grid; align-content: center; justify-items: center; gap: 22px; min-height: 380px; padding: 24px 20px; }
.proc-orb { position: relative; width: 72px; height: 72px; }
.proc-orb span {
  position: absolute; inset: 0; border-radius: 50%; border: 3px solid transparent;
  border-top-color: var(--accent); animation: spin 1.1s linear infinite;
}
.proc-orb span:nth-child(2) { inset: 10px; border-top-color: #14b8a6; animation-duration: 1.6s; animation-direction: reverse; }
.proc-orb span:nth-child(3) { inset: 22px; border: 0; background: var(--accent-soft); animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(0.7); opacity: 0.6; } }
.proc-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; width: min(100%, 360px); font-size: 0.925rem; }
.proc-steps li { display: flex; align-items: center; gap: 10px; color: #a8a29e; transition: color 0.3s; }
.proc-steps li::before {
  content: ''; flex: none; width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid var(--border); box-sizing: border-box;
}
.proc-steps li.active { color: var(--text); font-weight: 600; }
.proc-steps li.active::before { border-color: var(--accent-soft); border-top-color: var(--accent); animation: spin 0.8s linear infinite; }
.proc-steps li.done { color: var(--muted); }
.proc-steps li.done::before {
  content: '✓'; display: grid; place-items: center; border: 0;
  background: var(--accent); color: #fff; font-size: 11px; font-weight: 700;
}
.proc-bar { width: min(100%, 360px); height: 6px; border-radius: 999px; background: var(--subtle); overflow: hidden; }
.proc-bar span { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--accent), #14b8a6); }

.score-verdict { margin: 0 0 4px; padding: 10px 12px; border-radius: 10px; font-weight: 600; font-size: 0.95rem; }
.score-verdict[data-level='low'] { background: var(--accent-soft); color: var(--accent-hover); font-size: 1.05rem; }
.score-verdict[data-level='mid'] { background: #fffaeb; color: #93370d; font-weight: 500; }
.score-verdict[data-level='high'] { background: var(--danger-soft); color: var(--danger); font-weight: 500; }

/* ── Detect AI result ───────────────────────────────────────────────────── */
:root { --level-high: #b42318; --level-mid: #b54708; --level-low: #0f766e; }
.detect { display: grid; gap: 14px; padding: 16px; align-content: start; }
.detect-top { display: flex; align-items: center; gap: 16px; }
.detect-top h3 { font-size: 1.125rem; margin-block-end: 2px; }
.detect-top p { margin: 0; }
.gauge {
  --p: 0; --c: var(--level-low);
  flex: none; display: grid; place-content: center; justify-items: center;
  width: 96px; height: 96px; border-radius: 50%;
  background: radial-gradient(closest-side, var(--surface) 78%, transparent 80% 100%),
              conic-gradient(var(--c) calc(var(--p) * 1%), var(--subtle) 0);
  font-family: var(--font-latin); line-height: 1.1;
}
.gauge b { font-size: 1.5rem; color: var(--c); }
.gauge small { font-size: 0.7rem; color: var(--muted); font-family: var(--font-arabic), var(--font-latin); }
.gauge[data-level='high'] { --c: var(--level-high); }
.gauge[data-level='mid'] { --c: var(--level-mid); }
.detect-hint { margin: 0; color: var(--muted); }
.detect-text {
  max-height: 320px; overflow-y: auto; padding: 12px 14px; border-radius: 10px; background: var(--subtle);
  white-space: pre-wrap; overflow-wrap: anywhere; unicode-bidi: plaintext; text-align: start; font-size: 0.975rem;
}
.detect-text mark { background: #fde2e1; color: inherit; border-radius: 3px; padding-block: 1px; box-decoration-break: clone; -webkit-box-decoration-break: clone; }
.detect-foot { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.spinner-dark { border-color: rgb(28 25 23 / 0.2); border-top-color: var(--text); }
.panel-alert { margin: 0 16px 16px; }

/* ── tool ───────────────────────────────────────────────────────────────── */
.tool { padding-block: 32px 64px; }
.notice-stack { display: grid; gap: 10px; margin-block-end: 20px; }
.panels { display: grid; gap: 20px; grid-template-columns: 1fr; }
@media (min-width: 900px) { .panels { grid-template-columns: 1fr 1fr; } }

.panel { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); min-width: 0; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--border); min-height: 56px; }
.panel-head h2 { font-size: 0.95rem; font-weight: 600; }
.panel-body { flex: 1; display: flex; flex-direction: column; }
.panel-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 12px 16px; border-top: 1px solid var(--border); }

.editor, .output {
  flex: 1; width: 100%; min-height: 380px; margin: 0; padding: 16px;
  border: 0; background: transparent; color: var(--text); font-size: 1.0625rem; resize: vertical;
  unicode-bidi: plaintext; text-align: start;
}
.editor:focus { outline: none; }
.panel:focus-within { border-color: #d6d3d1; }
.output { resize: none; white-space: pre-wrap; overflow-wrap: anywhere; overflow-y: auto; max-height: 70vh; }
.output.empty { display: grid; place-items: center; color: var(--muted); font-family: inherit; font-size: 0.95rem; }

.counter { font-size: 0.875rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.counter.over { color: var(--danger); font-weight: 600; }
/* Wraps onto a second line when the panel is too narrow, so no button spills out of the box. */
.foot-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; margin-inline-start: auto; }
.foot-tools, .foot-main { display: contents; }
kbd { font-family: var(--font-latin); font-size: 0.75rem; color: var(--muted); }

.score { display: grid; gap: 12px; padding: 16px; border-top: 1px solid var(--border); }
.score-top { display: flex; align-items: center; gap: 16px; }
.score-note { margin: 0; color: var(--muted); }
.score-note.upsell { padding: 10px 12px; border-radius: 10px; background: #fffaeb; color: #93370d; font-weight: 600; }
.score-drop { margin: 0; font-weight: 600; }
.score-top .score-verdict { margin: 0 0 6px; }
.gauge-sm { width: 84px; height: 84px; }
.gauge-sm b { font-size: 1.3rem; }
.gauge[data-level='high'] b, .gauge[data-level='mid'] b { color: var(--c); }
.pro-tag { padding: 1px 7px; border-radius: 999px; background: var(--grad, var(--accent)); color: #fff; font-size: 0.7rem; font-weight: 700; font-family: var(--font-latin); line-height: 1.4; }

.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-block-end: 20px; }
#topup-home-btn { margin-inline-start: auto; }
#topup-home-btn:not([hidden]) + #manage-btn { margin-inline-start: 0; }
/* Tablet and up: the usage text wraps before the buttons do, so they stay on one row. */
@media (min-width: 641px) { .toolbar .usage { flex: 1 1 0; min-width: 0; } .toolbar > .btn { flex: none; } }
.usage { display: flex; align-items: center; gap: 10px; font-size: 0.875rem; color: var(--muted); }
.usage-bar { width: 120px; height: 6px; border-radius: 999px; background: var(--subtle); overflow: hidden; }
.usage-bar > span { display: block; height: 100%; background: var(--accent); }
@media (max-width: 640px) { .hide-sm, .usage-bar { display: none; } }

/* Password rules checklist: neutral until typing starts, then green (met) or red (missing). */
.pw-rules { list-style: none; margin: -6px 0 0; padding: 0; display: grid; gap: 2px; font-size: 0.8125rem; color: var(--muted); }
.pw-rules li { display: flex; gap: 8px; align-items: center; }
.pw-rules li::before { content: '○'; flex: none; width: 1em; text-align: center; }
.pw-rules li.ok { color: var(--accent); }
.pw-rules li.ok::before { content: '✓'; }
.pw-rules li.bad { color: var(--danger); }
.pw-rules li.bad::before { content: '✕'; }

/* ── auth ───────────────────────────────────────────────────────────────── */
.auth-wrap { display: grid; place-items: center; padding: 56px 16px; }
.auth-card { width: 100%; max-width: 400px; display: grid; gap: 18px; }
.auth-card h1 { font-size: 1.5rem; text-align: center; }
.divider { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 0.85rem; }
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.switch-mode { text-align: center; font-size: 0.9rem; }
.link-btn { border: 0; background: none; padding: 0; color: var(--accent); font: inherit; cursor: pointer; }
.link-btn:hover { text-decoration: underline; }

/* ── admin ──────────────────────────────────────────────────────────────── */
.stats { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); margin-block: 24px; }
.stat { padding: 16px 20px; }
.stat b { display: block; font-size: 1.5rem; font-family: var(--font-latin); }
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th, td { padding: 12px 16px; text-align: start; border-bottom: 1px solid var(--border); white-space: nowrap; }
th { font-weight: 600; color: var(--muted); background: var(--subtle); font-size: 0.8rem; }
tr:last-child td { border-bottom: 0; }
td.num { font-variant-numeric: tabular-nums; font-family: var(--font-latin); }
td .email { font-family: var(--font-latin); direction: ltr; unicode-bidi: isolate; }
.btn.danger { color: var(--danger); min-height: 34px; padding: 4px 10px; }
.ai-box { display: grid; gap: 12px; margin-block-end: 24px; }
.ai-box h2 { font-size: 1.1rem; margin: 0; }
.ai-box p { margin: 0; }
.ai-controls { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; }
.ai-controls label { display: grid; gap: 4px; }
.ai-controls select { min-width: 180px; }
.row-actions { white-space: nowrap; }
.row-actions .btn { min-height: 34px; padding: 4px 10px; }
tr.heavy { background: #fffbeb; }
tr.suspended td { color: var(--muted); }
td .over { color: var(--danger); font-weight: 600; }
.badge-danger { background: var(--danger-soft); color: var(--danger); margin-inline-start: 8px; }
.admin-tabs { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; border-bottom: 1px solid var(--border); margin-block: 16px 24px; }
.admin-tabs button { border: 0; background: none; padding: 10px 14px; margin-bottom: -1px; font: inherit; font-weight: 500; color: var(--muted); border-bottom: 2px solid transparent; cursor: pointer; white-space: nowrap; }
.admin-tabs button:hover { color: var(--text); }
.admin-tabs button[aria-selected="true"] { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
.stat small { display: block; margin-top: 4px; font-size: 0.8rem; line-height: 1.4; }
.admin-note { margin: 12px 0 0; }
.admin-h2 { font-size: 1.1rem; margin: 0 0 12px; }
.admin-h2:not(:first-child) { margin-top: 32px; }
.admin-tools .input { width: auto; max-width: 320px; }
/* After Next/Previous the page jumps to the search row; keep it clear of the sticky top bar. */
.admin-tools { scroll-margin-top: 88px; }
.admin-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
/* Users tab: a dropdown with tick boxes (several plans at once). */
.multi { position: relative; }
.multi > summary { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-width: 170px; min-height: 44px; cursor: pointer; list-style: none; user-select: none; }
.multi > summary::-webkit-details-marker { display: none; }
.multi > summary svg { width: 16px; height: 16px; flex: none; color: var(--muted); transition: transform 0.15s; }
.multi[open] > summary svg { transform: rotate(180deg); }
.multi > summary span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.multi-menu { position: absolute; z-index: 30; inset-inline-start: 0; top: calc(100% + 4px); min-width: 100%; width: max-content; display: grid; gap: 2px; padding: 6px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow); }
.multi-menu label { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; cursor: pointer; white-space: nowrap; }
.multi-menu label:hover { background: var(--subtle); }
.multi-menu .multi-all { font-weight: 600; border-bottom: 1px solid var(--border); border-radius: 8px 8px 0 0; margin-bottom: 2px; }
.multi-menu input { width: 16px; height: 16px; accent-color: var(--accent); }
.pager { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 12px; }
.pager:empty { display: none; }
.pager > span { text-align: center; }
.badge-trial { background: #fef3c7; color: #92400e; }
.badge-paid { background: var(--accent-soft); color: var(--accent); }
.badge-internal { background: var(--subtle); color: var(--muted); border: 1px solid var(--border); margin-inline-start: 8px; }
.bar-cell { width: 40%; min-width: 120px; }
.bar-stack { display: flex; height: 8px; border-radius: 4px; overflow: hidden; background: var(--subtle); }
.bar-stack .paid { background: var(--accent); }
.bar-stack .trial { background: #f59e0b; }
.bar-stack .internal { background: #a8a29e; }
.pricing-error { max-width: 720px; margin: 20px auto 0; text-align: center; }
.pricing-terms { margin: 16px 0 0; text-align: center; font-size: 0.875rem; }
.pricing-terms a { color: var(--muted); }
.price sup { font-size: 0.55em; margin-inline-start: 1px; }
select.input { min-height: 34px; padding: 4px 8px; width: auto; }


/* ── auth popup ─────────────────────────────────────────────────────────── */
.modal {
  width: min(440px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); overflow-y: auto;
  padding: 28px 24px 24px; border: 1px solid var(--border); border-radius: 16px;
  background: var(--surface); color: var(--text); box-shadow: 0 24px 64px rgb(28 25 23 / 0.18);
}
.modal::backdrop { background: rgb(28 25 23 / 0.45); }
.modal h2 { font-size: 1.25rem; text-align: center; padding-inline: 24px; }
.modal-sub { text-align: center; margin: 8px 0 20px; }
.modal-close { position: absolute; inset-block-start: 10px; inset-inline-end: 10px; min-height: 36px; padding: 6px; }
.auth-form { display: grid; gap: 14px; }
.consent { margin: 0; text-align: center; }
.verify-note { margin: 0; }
.code-input { font-size: 1.4rem; letter-spacing: 0.4em; text-align: center; font-family: var(--font-latin); }
.turnstile { min-height: 65px; }
.forgot-link { justify-self: end; margin-block-start: -6px; font-size: 0.875rem; }

/* ── footer ─────────────────────────────────────────────────────────────── */
.site-footer { margin-block-start: 0; border-top: 1px solid var(--border); background: var(--surface); font-size: 0.925rem; }
.footer-grid { display: grid; gap: 32px; padding-block: 48px 32px; grid-template-columns: 1fr 1fr; }
@media (min-width: 760px) { .footer-grid { grid-template-columns: 2fr 1fr 1fr 1fr; } }
.footer-brand { grid-column: 1 / -1; display: grid; gap: 10px; align-content: start; max-width: 340px; }
@media (min-width: 760px) { .footer-brand { grid-column: auto; } }
.footer-brand p { margin: 0; color: var(--muted); }
.footer-email { font-family: var(--font-latin); direction: ltr; unicode-bidi: isolate; justify-self: start; }
.footer-col { display: grid; gap: 10px; align-content: start; }
.footer-col h4 { margin: 0 0 4px; font-size: 0.85rem; font-weight: 600; }
.footer-col a { color: var(--muted); }
.footer-col a:hover { color: var(--text); text-decoration: none; }
.footer-bottom {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px;
  padding-block: 20px; border-top: 1px solid var(--border); color: var(--muted); font-size: 0.85rem;
}
.footer-meta { display: flex; gap: 16px; align-items: center; }

/* ── long-form pages (legal, about, contact) ────────────────────────────── */
/* Account menu in the header */
.account-menu { position: relative; }
.account-menu[hidden] { display: none; }
.account-trigger { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 4px 8px 4px 4px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); color: var(--text); font: inherit; font-size: 0.9rem; cursor: pointer; }
[dir='rtl'] .account-trigger { padding: 4px 4px 4px 8px; }
.account-trigger:hover { border-color: rgb(15 118 110 / 0.35); }
.account-trigger svg { width: 16px; height: 16px; color: var(--muted); }
.avatar { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--grad, var(--accent)); color: #fff; font-weight: 600; font-size: 0.9rem; font-family: var(--font-latin); }
.account-dropdown { position: absolute; inset-inline-end: 0; top: calc(100% + 8px); z-index: 60; min-width: 230px; max-width: calc(100vw - 32px); padding: 6px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-lg, var(--shadow)); }
.account-dropdown[hidden] { display: none; }
/* Phone menu (built by common.js): only on small screens, where the .hide-sm links are hidden. */
.nav-more { position: relative; display: none; }
.nav-toggle { padding-inline: 8px; }
.nav-toggle svg { width: 22px; height: 22px; }
.nav-dropdown { min-width: 180px; }
@media (max-width: 640px) { .nav-more { display: block; } }
.account-who { display: grid; gap: 2px; padding: 8px 10px 10px; margin-block-end: 6px; border-bottom: 1px solid var(--border); }
.account-who strong { font-size: 0.9rem; overflow-wrap: anywhere; }
.account-who span { color: var(--muted); font-size: 0.85rem; }
.account-dropdown a, .account-dropdown button { display: block; width: 100%; padding: 9px 10px; border: 0; border-radius: 8px; background: none; color: var(--text); font: inherit; font-size: 0.925rem; text-align: start; text-decoration: none; cursor: pointer; }
.account-dropdown a:hover, .account-dropdown button:hover, .account-dropdown a:focus-visible, .account-dropdown button:focus-visible { background: var(--subtle); }

/* Account page */
.account { max-width: 760px; padding-block: 40px 72px; display: grid; gap: 20px; }
.account h1 { font-size: 1.75rem; margin: 0; }
.account-card { display: grid; gap: 16px; scroll-margin-top: 88px; }
.account-card h2 { font-size: 1.125rem; margin: 0; }
.account-card p { margin: 0; }
.account-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.account-list { display: grid; gap: 10px; margin: 0; }
.account-list > div { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 16px; padding-block-end: 10px; border-bottom: 1px solid var(--border); }
.account-list > div:last-child { border-bottom: 0; padding-block-end: 0; }
.account-list dt { color: var(--muted); }
.account-list dd { margin: 0; font-weight: 500; overflow-wrap: anywhere; }
.account-actions { display: flex; flex-wrap: wrap; gap: 10px; }
/* Phones: one full-width button per row, instead of an uneven wrap. */
@media (max-width: 480px) { .account-actions > .btn { flex: 1 1 100%; justify-content: center; } }
.account-meter { display: flex; align-items: center; gap: 12px; }
.account-meter .usage-bar { flex: 1; width: auto; height: 8px; }
@media (max-width: 640px) { .account-meter { flex-wrap: wrap; } .account-meter .usage-bar { display: block; flex: 1 1 100%; } }
.account[hidden], .account [hidden] { display: none !important; }

.doc { max-width: 760px; padding-block: 48px 72px; }
.doc h1 { font-size: 2rem; margin-block-end: 8px; }
.doc .updated { color: var(--muted); font-size: 0.9rem; margin: 0 0 32px; }
.doc h2 { font-size: 1.2rem; margin: 36px 0 12px; }
.doc h3 { font-size: 1rem; margin: 20px 0 8px; }
.doc p, .doc li { color: #3f3a36; }
.doc ul, .doc ol { padding-inline-start: 22px; }
.doc li { margin-block-end: 6px; }

/* Blog: list of posts (/blog) and a single post (/blog/...). Posts are Arabic only. */
.post { line-height: 1.9; }
.post .crumbs { font-size: 0.875rem; color: var(--muted); margin: 0 0 12px; }
.post .crumbs a { color: var(--muted); }
.post blockquote { margin: 16px 0; padding: 12px 18px; border-inline-start: 3px solid var(--accent); background: var(--subtle); border-radius: 8px; color: #3f3a36; }
.post-top-cta { margin: -12px 0 28px; }
.post-top-cta .btn { white-space: normal; max-width: 100%; text-align: center; }
.post-cta { margin-block-start: 40px; padding: 24px; border-radius: var(--radius); background: var(--accent-soft); border: 1px solid #ccfbf1; }
.post-cta h2 { margin: 0 0 16px; color: var(--accent-hover); }
.post-cta p { margin: 0 0 16px; }
.post-cta .btn { white-space: normal; max-width: 100%; text-align: center; }
@media (max-width: 420px) { .post-cta { padding: 20px 16px; } }
.doc .post-tags { list-style: none; padding: 0; margin: -16px 0 32px; display: flex; flex-wrap: wrap; gap: 8px; }
.doc .post-tags li { margin: 0; padding: 2px 12px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-hover); font-size: 0.8rem; line-height: 1.8; }
.doc .post-card .post-tags { margin: 0 0 12px; }
.doc .post-tags a { color: inherit; }
.doc .post-tags li:has(a):hover { background: #ccfbf1; }
.post .table-wrap { overflow-x: auto; margin: 16px 0; }
.post table { width: 100%; border-collapse: collapse; font-size: 0.95rem; line-height: 1.7; background: var(--surface); }
.post th, .post td { border: 1px solid var(--border); padding: 10px 12px; text-align: start; vertical-align: top; white-space: normal; }
.post thead th { background: var(--accent-soft); color: var(--accent-hover); }
.post tbody th { background: var(--subtle); font-weight: 600; }
@media (max-width: 640px) { .post table { font-size: 0.85rem; } .post th, .post td { padding: 8px; } }
.blog-tools { display: grid; gap: 12px; margin-block-end: 24px; }
.tag-filter { display: flex; flex-wrap: wrap; gap: 8px; }
.tag-filter button { font: inherit; font-size: 0.85rem; padding: 6px 14px; min-height: 34px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer; }
.tag-filter button:hover { border-color: var(--accent); }
.tag-filter button[aria-pressed='true'] { background: var(--accent); border-color: var(--accent); color: #fff; }
.tag-filter button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.blog-empty { color: var(--muted); }
.post-list li[hidden] { display: none; }
.post-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 16px; }
.doc .post-list li { margin: 0; }
.post-card { display: block; padding: 20px 22px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); color: inherit; }
.post-card:hover { text-decoration: none; border-color: var(--accent); }
.post-card h2 { margin: 0 0 8px; font-size: 1.15rem; color: var(--text); }
.post-card p { margin: 0 0 10px; }
.post-card .more { color: var(--accent); font-weight: 600; font-size: 0.9rem; }
.admin-tools { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-block-end: 16px; }
.faq details { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); margin-block-end: 10px; }
.faq summary { cursor: pointer; padding: 14px 18px; font-weight: 600; list-style: none; display: flex; justify-content: space-between; gap: 12px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: '+'; color: var(--accent); font-size: 1.25rem; line-height: 1; }
.faq details[open] summary::after { content: '−'; }
.faq details p { margin: 0; padding: 0 18px 16px; }
.doc .box { padding: 16px 20px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
/* Show only the block matching the UI language. */
html[lang='ar'] .doc [data-doc-lang='en'], html[lang='en'] .doc [data-doc-lang='ar'] { display: none; }

/* ── tablet & mobile ────────────────────────────────────────────────────── */
@media (max-width: 899px) {
  .hero { padding-block: 64px 48px; }
  .hero-compact { padding-block: 44px 24px; }
  .section { padding-block: 56px; }
  .editor, .output { min-height: 280px; }
  .output { max-height: none; }
  /* Tablets: the Arabic menu labels are wider than the English ones; keep the logo and menu on
     one row instead of wrapping the logo text and the login button. */
  .logo-text { white-space: nowrap; }
  .header-actions { gap: 2px; flex-wrap: nowrap; }
  .header-actions .btn { padding-inline: 10px; }
}
@media (max-width: 760px) { .header-actions .btn { padding-inline: 8px; font-size: 0.9rem; } }

@media (max-width: 640px) {
  body { font-size: 15px; }
  .site-header .container { min-height: 56px; gap: 8px; }
  .header-actions { gap: 4px; flex-wrap: nowrap; }
  .header-actions .btn { min-height: 36px; padding: 6px 10px; font-size: 0.875rem; }
  .hero-compact { padding-block: 32px 16px; }
  .hero p { font-size: 1rem; margin-block-start: 14px; }
  .eyebrow { margin-block-end: 12px; }
  .section { padding-block: 44px; }
  .section h2 { font-size: 1.3rem; margin-block-end: 24px; }
  .card { padding: 20px; }
  .tool { padding-block: 16px 44px; }

  .toolbar { flex-direction: column; align-items: stretch; }
  /* Plan badge beside the usage text; the text wraps next to it, not under it. */
  .usage { flex-wrap: nowrap; align-items: flex-start; }
  .usage .badge { flex: none; }
  #usage-text { flex: 1; min-width: 0; padding-block-start: 2px; }
  .toolbar > .btn { width: 100%; }
  .panel-head { padding: 10px 12px; min-height: 50px; }
  .panel-foot { padding: 10px 12px; }
  /* Row 1: word count, then Clear and Upload. Row 2: Detect AI and Humanize side by side, full width. */
  .panel-foot { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 10px 8px; }
  .counter { white-space: nowrap; font-size: 0.8125rem; }
  .panel-foot .foot-actions { display: contents; }
  .foot-tools { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 2px; min-width: 0; }
  .foot-main { grid-column: 1 / -1; display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); gap: 10px; }
  #clear-btn, #upload-btn { min-height: 32px; padding: 4px 6px; gap: 6px; font-size: 0.875rem; }
  #detect-btn, #humanize-btn { width: 100%; min-height: 46px; padding-inline: 8px; white-space: normal; text-align: center; }
  .panel-alert { margin: 0 12px 12px; }
  .detect { padding: 12px; }
  .processing { min-height: 300px; }
  .gauge { width: 80px; height: 80px; }
  .gauge b { font-size: 1.25rem; }
  .detect-foot .btn { width: 100%; }
  .editor, .output { min-height: 220px; padding: 12px; font-size: 1rem; }
  .score { padding: 12px; }


  .footer-grid { gap: 24px; padding-block: 36px 24px; }
  .footer-bottom { flex-direction: column; align-items: flex-start; }

  .doc { padding-block: 32px 48px; }
  .doc h1 { font-size: 1.6rem; }
  .doc h2 { font-size: 1.1rem; margin-block-start: 28px; }

  .auth-wrap { padding: 32px 16px; }
  .modal { padding: 24px 16px 16px; }
  .stats { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat { padding: 12px 14px; }
  .admin-tools .input { flex: 1 1 140px; max-width: none; }
  .admin-tools .multi { flex: 1 1 140px; }
  .admin-tools .multi > summary { width: 100%; max-width: none; }
}

@media (max-width: 420px) { .logo-text { display: none; } }

/* ── modern layer (27 Sep 2026): gradients, glow, icons, motion. Overrides the base rules above. ── */
:root {
  --radius: 16px;
  --grad: linear-gradient(135deg, #0f766e, #14b8a6);
  --shadow-lg: 0 12px 32px -14px rgb(15 118 110 / 0.28), 0 2px 6px rgb(28 25 23 / 0.05);
}

/* Header: stays on top while scrolling, slightly see-through. */
.site-header { position: sticky; top: 0; z-index: 50; background: rgb(255 255 255 / 0.82); backdrop-filter: saturate(1.4) blur(10px); -webkit-backdrop-filter: saturate(1.4) blur(10px); }
.logo-mark { background: var(--grad); box-shadow: 0 4px 12px -4px rgb(15 118 110 / 0.6); }

.btn-primary { background: var(--grad); border-color: transparent; box-shadow: 0 6px 16px -8px rgb(15 118 110 / 0.75); }
.btn-primary:hover { background: linear-gradient(135deg, #115e59, #0d9488); border-color: transparent; }

/* Hero: soft teal glow and a large faint ع behind the headline. */
.hero { position: relative; isolation: isolate; overflow: hidden; }
.hero::before {
  content: ''; position: absolute; inset: 0; z-index: -2; pointer-events: none;
  background:
    radial-gradient(45% 60% at 50% 20%, rgb(20 184 166 / 0.16), transparent 70%),
    radial-gradient(30% 45% at 88% 0%, rgb(15 118 110 / 0.12), transparent 70%),
    radial-gradient(30% 45% at 8% 10%, rgb(250 204 21 / 0.09), transparent 70%);
}
.hero::after {
  content: 'ع'; position: absolute; z-index: -1; top: 50%; left: 50%; transform: translate(-50%, -52%);
  font-family: var(--font-arabic); font-size: clamp(11rem, 30vw, 22rem); font-weight: 700; line-height: 1;
  color: rgb(15 118 110 / 0.05); pointer-events: none; user-select: none;
}
.eyebrow {
  padding: 6px 14px; border-radius: 999px; background: rgb(255 255 255 / 0.75);
  border: 1px solid rgb(15 118 110 / 0.2); box-shadow: var(--shadow);
}
.eyebrow::before {
  content: ''; display: inline-block; width: 8px; height: 8px; margin-inline-end: 8px; vertical-align: middle;
  border-radius: 50%; background: #14b8a6; box-shadow: 0 0 0 4px rgb(20 184 166 / 0.2);
}
.trust { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px 24px; margin: 24px 0 0; padding: 0; list-style: none; color: var(--accent-hover); font-size: 0.95rem; font-weight: 600; }
.trust li { display: inline-flex; align-items: center; gap: 8px; }
.trust svg { width: 22px; height: 22px; padding: 4px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); flex: none; }

/* Tool: a gentle glow behind the two panels. */
.tool { isolation: isolate; }
.panels { position: relative; }
.panels::before {
  content: ''; position: absolute; inset: -28px 0; z-index: -1; pointer-events: none;
  background: radial-gradient(55% 60% at 50% 50%, rgb(20 184 166 / 0.16), transparent 72%); filter: blur(24px);
}
.panel { box-shadow: var(--shadow-lg); }
.panel:focus-within { border-color: rgb(15 118 110 / 0.35); box-shadow: 0 0 0 4px rgb(20 184 166 / 0.1), var(--shadow-lg); }

/* Sections: no dividers; a short gradient bar under each title. */
.section { border-top: 0; }
.section h2::after { content: ''; display: block; width: 44px; height: 4px; margin: 14px auto 0; border-radius: 4px; background: var(--grad); }

/* Cards: rounder, soft shadow, icon tile, lift on hover. */
.card { box-shadow: var(--shadow); }
.card-hover { transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease; }
.card-hover:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); border-color: rgb(15 118 110 / 0.25); }
.card-icon { display: grid; place-items: center; width: 44px; height: 44px; margin-block-end: 14px; border-radius: 12px; background: var(--accent-soft); color: var(--accent); }
.card-icon svg { width: 22px; height: 22px; }
.step-num { background: var(--grad); color: #fff; box-shadow: 0 4px 12px -4px rgb(15 118 110 / 0.6); }
.pattern-list li { box-shadow: var(--shadow); transition: border-color 0.2s, color 0.2s; }
.pattern-list li:hover { border-color: rgb(15 118 110 / 0.35); color: var(--accent-hover); }
.compare-after { background: linear-gradient(180deg, var(--accent-soft), var(--surface) 65%); }

/* Pricing: Pro gets a gradient border and sits a little higher. */
.price-card.featured {
  border: 2px solid transparent; box-shadow: var(--shadow-lg);
  background: linear-gradient(var(--surface), var(--surface)) padding-box, var(--grad) border-box;
}
@media (min-width: 740px) { .price-card.featured { transform: translateY(-8px); } }
.plan-tag { background: var(--grad); box-shadow: 0 4px 12px -4px rgb(15 118 110 / 0.6); }
.interval-toggle button[aria-pressed='true'] { background: var(--grad); color: #fff; }

/* Sections fade up as they scroll into view (js/common.js adds .in-view). */
.reveal-ready .reveal { opacity: 0; transform: translateY(24px); transition: opacity 0.6s ease, transform 0.6s ease; }
.reveal-ready .reveal.in-view { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .reveal-ready .reveal { opacity: 1; transform: none; transition: none; }
  .card-hover:hover { transform: none; }
}

/* Billing history popup (admin Users table). */
.history-modal { width: min(560px, calc(100vw - 32px)); }
.history-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.history-list li { display: grid; gap: 4px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 10px; background: var(--subtle); }
.history-top { display: flex; justify-content: space-between; align-items: baseline; gap: 4px 12px; flex-wrap: wrap; }
.history-top .num { font-family: var(--font-latin); }
#history-body > p { margin: 0; text-align: center; }

/* Customer popup (notes, tags, send an email, emails sent) and the email templates tab (admin). */
.crm-modal { width: min(640px, calc(100vw - 32px)); }
.crm-form { display: grid; gap: 12px; }
.crm-modal .crm-form { margin-block-start: 20px; padding-block-start: 16px; border-top: 1px solid var(--border); }
.crm-form h3 { margin: 0; font-size: 1rem; }
.crm-form p { margin: 0; }
.crm-form textarea { resize: vertical; line-height: 1.5; }
.crm-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
#tpl-form { margin-block-end: 24px; }
.crm-body { white-space: pre-wrap; overflow-wrap: anywhere; margin: 4px 0 0; }
.badge-tag { margin-inline-start: 6px; font-weight: 500; }
.contact-fresh { color: var(--accent); font-weight: 600; white-space: nowrap; }
.email-preview { display: block; width: 100%; height: min(70dvh, 720px); border: 1px solid var(--border); border-radius: 10px; background: #fff; }
.email-preview-inline { height: min(60dvh, 560px); margin-block-start: 8px; }
/* HTML code is typed left to right, whatever the page language. */
textarea.code { direction: ltr; text-align: left; font-family: ui-monospace, Consolas, monospace; font-size: 0.85rem; }

/* Extra-word packs (account page) and their terms popup. */
.pack-balance { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.pack-balance li { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 12px; padding: 10px 14px; border: 1px solid var(--border); border-radius: 10px; background: var(--subtle); }
.pack-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.pack-card { display: grid; gap: 4px; justify-items: center; padding: 16px 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); color: var(--text); font: inherit; cursor: pointer; text-align: center; }
.pack-card:hover, .pack-card:focus-visible { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.pack-card-price { font-size: 1.4rem; font-weight: 700; font-family: var(--font-latin); }
.pack-modal { width: min(560px, calc(100vw - 32px)); }
.pack-modal .pack-grid { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); margin-block-end: 4px; }
.pack-modal .pack-balance { margin-block-end: 16px; }
.pack-best { border-color: var(--accent); position: relative; }
.pack-tag { position: absolute; inset-block-start: -10px; inset-inline: 0; margin-inline: auto; width: max-content; padding: 2px 10px; border-radius: 999px; background: var(--accent); color: #fff; font-size: 0.75rem; font-weight: 600; }
.pack-modal .pack-grid { padding-block-start: 10px; }
.pack-terms-title { font-size: 1rem; margin: 0 0 8px; }
.pack-terms { margin: 0 0 12px; padding-inline-start: 20px; display: grid; gap: 8px; }
#topup-body > p:not(.modal-sub) { margin: 0 0 16px; }
.pack-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.pack-actions .btn { flex: 1 1 160px; justify-content: center; }
.pack-modal .alert { margin-top: 12px; }
@media (max-width: 480px) { .pack-modal .pack-grid { grid-template-columns: 1fr; gap: 14px; } .pack-card { padding: 12px; } }
/* Pro's tip in the top-up popup: upgrade to Gold instead of topping up every month. */
.pack-tip { display: grid; gap: 10px; margin-block-start: 16px; padding: 14px; border-radius: 12px; background: var(--subtle); border: 1px dashed var(--accent); text-align: center; }
.pack-tip p { margin: 0; font-size: 0.9rem; }
/* "Buy now" inside each top-up card, so the card clearly reads as a button. */
.pack-card-buy { margin-block-start: 6px; padding: 7px 18px; border-radius: 999px; background: var(--accent); color: #fff; font-size: 0.875rem; font-weight: 600; }
.pack-card:hover .pack-card-buy, .pack-card:focus-visible .pack-card-buy { filter: brightness(1.08); }
