/* Lenci · Nawaa — E-mail studio (v3/nawaa-tools-ui/email.js). Builds on nawaa-tools.css (the .nt-email editor / preview grid, .nt-seg,
   .nt-card-res, .nt-meter) and the studio tokens. Logical properties only, so Arabic mirrors itself; the e-mail, the inbox rows, the
   WhatsApp bubble and the subject lines carry dir="auto" for mixed Arabic / English text. */

/* the mode switch: one e-mail · sequence · subject lab */
.nt-em-modes { display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 4px; border-radius: 14px; border: 1px solid var(--line-2); background: rgba(10,10,16,.55); width: max-content; max-width: 100%; }
.nt-em-modes .nw-chip { padding: 8px 16px; font-size: 13px; border-color: transparent; background: transparent; }
.nt-em-modes .nw-chip[aria-checked="true"] { box-shadow: 0 0 14px rgba(34,211,238,.2); }

/* goals in three groups */
.nt-em-goals { display: grid; gap: 8px; }
.nt-em-goalrow { display: grid; grid-template-columns: 92px minmax(0, 1fr); gap: 10px; align-items: start; }
.nt-em-goalgrp { padding-top: 7px; font-size: 11.5px; color: var(--dim); font-family: var(--display); font-weight: 600; }
.nt-em-settings { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px 18px; align-items: end; }
.nt-em-settings .nt-em-salla { grid-column: 1 / -1; }
.nt-em-check { display: inline-flex; align-items: center; gap: 9px; padding: 10px 12px; border-radius: 11px; border: 1px solid var(--line); cursor: pointer; font-size: 13px; color: var(--ink); align-self: end; }
.nt-em-check input { width: 16px; height: 16px; accent-color: #22d3ee; flex: none; }
.nt-em-salla summary { cursor: pointer; color: var(--muted); font-size: 12.5px; }
.nt-em-salla p { margin: 6px 0 0; font-size: 12.5px; line-height: 1.6; color: var(--muted); }
.nt-seq-plan { margin: 0; padding: 0; list-style: none; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; counter-reset: st; }
.nt-seq-plan li { display: grid; gap: 4px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); background: rgba(255,255,255,.025); counter-increment: st; position: relative; font-size: 13px; }
.nt-seq-plan li::before { content: counter(st); position: absolute; inset-inline-end: 10px; top: 8px; font: 700 11px var(--display); color: var(--dim); }
.nt-seq-when { font-size: 11.5px; color: #8be9fd; }

/* editor extras */
.nt-em-link { justify-self: start; padding: 2px 0; border: 0; background: none; color: #8be9fd; font: inherit; font-size: 12.5px; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.nt-em-link:hover { color: #c7f9ff; }
.nt-em-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 8px 10px; border-radius: 11px; border: 1px dashed var(--line-2); }
.nt-em-tools .nt-hint { margin-inline-end: auto; }
.nt-em-tag { font: 11px var(--mono); color: #c4b5fd; background: rgba(167,139,250,.1); padding: 2px 7px; border-radius: 6px; direction: ltr; unicode-bidi: isolate; overflow-wrap: anywhere; }
.nt-em-group { display: grid; gap: 10px; }
.nt-em-segs { display: flex; gap: 8px; flex-wrap: wrap; }
.nt-email-prev .nt-prev-top { align-items: center; }

/* the inbox row: how the e-mail appears in a list before it is opened */
.nt-em-inbox { display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 10px; align-items: center; padding: 10px 12px; border-radius: 12px; background: #fbfbfd; color: #1d1d24; border: 1px solid #e3e3ea; box-shadow: 0 6px 20px rgba(0,0,0,.25); font: 13px/1.4 "Inter", "Cairo", system-ui, sans-serif; justify-self: center; width: 100%; box-sizing: border-box; transition: max-width .25s var(--ease); }
.nt-em-inbox.phone { max-width: 375px; align-items: start; }
.nt-em-av { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--nw, #6d28d9); color: #fff; font-weight: 700; font-size: 14px; }
.nt-em-inbox-tx { display: grid; gap: 1px; min-width: 0; }
.nt-em-inbox-top { display: flex; justify-content: space-between; gap: 8px; }
.nt-em-inbox-top strong { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nt-em-inbox-top small { color: #8a8a96; font-size: 11.5px; flex: none; }
.nt-em-inbox-sub { font-weight: 600; overflow-wrap: anywhere; }
.nt-em-inbox-pre { color: #6e6e7a; overflow-wrap: anywhere; }
.nt-em-inbox-line { overflow-wrap: anywhere; } .nt-em-inbox-line b { font-weight: 600; }
.nt-em-inbox.desktop .nt-em-inbox-tx { grid-template-columns: minmax(0, 1fr); }
.nt-em-size { display: grid; gap: 4px; }
.nt-em-size .nt-hint { font-size: 11px; }

/* tabs under the editor */
.nt-em-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line-2); margin-top: 6px; overflow-x: auto; scrollbar-width: none; scroll-margin-top: 12px; }
.nt-em-tab { display: inline-flex; align-items: center; gap: 8px; padding: 10px 14px; border: 0; border-bottom: 2px solid transparent; background: none; color: var(--muted); font: 600 13px var(--display); cursor: pointer; white-space: nowrap; margin-bottom: -1px; }
.nt-em-tab[aria-selected="true"] { color: var(--ink); border-bottom-color: #22d3ee; }
.nt-em-tab:focus-visible { outline: 2px solid rgba(34,211,238,.6); outline-offset: -2px; border-radius: 8px 8px 0 0; }
.nt-em-badge { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; display: inline-grid; place-items: center; font: 700 10.5px var(--display); box-sizing: border-box; }
.nt-em-badge:empty { display: none; }
.nt-em-badge.pass { background: rgba(52,211,153,.18); color: #6ee7b7; } .nt-em-badge.warn { background: rgba(245,176,65,.2); color: #fcd34d; } .nt-em-badge.fail { background: rgba(239,68,68,.22); color: #fca5a5; }
.nt-em-panel { display: grid; gap: 12px; padding-top: 12px; min-width: 0; }

/* the checklist */
.nt-em-verdict { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); }
.nt-em-verdict strong { font-family: var(--display); font-size: 15px; }
.nt-em-verdict span { color: var(--muted); font-size: 12.5px; }
.nt-em-verdict.ready { background: rgba(52,211,153,.1); border-color: rgba(52,211,153,.35); } .nt-em-verdict.ready strong { color: #6ee7b7; }
.nt-em-verdict.review { background: rgba(245,176,65,.08); border-color: rgba(245,176,65,.35); } .nt-em-verdict.review strong { color: #fcd34d; }
.nt-em-verdict.fix { background: rgba(239,68,68,.08); border-color: rgba(239,68,68,.35); } .nt-em-verdict.fix strong { color: #fca5a5; }
.nt-em-list { margin: 0; padding: 0; list-style: none; display: grid; gap: 6px; }
.nt-em-list li { display: grid; grid-template-columns: 24px minmax(0, 1fr); gap: 10px; align-items: start; padding: 9px 12px; border-radius: 11px; border: 1px solid var(--line); background: rgba(255,255,255,.02); font-size: 13px; }
.nt-em-list li > div { display: grid; gap: 2px; min-width: 0; }
.nt-em-list li strong { font-size: 13px; }
.nt-em-list li span:not(.nt-em-ico) { color: var(--muted); line-height: 1.5; overflow-wrap: anywhere; }
.nt-em-ico { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font: 800 11.5px var(--display); }
.nt-em-list .pass .nt-em-ico { background: rgba(52,211,153,.18); color: #6ee7b7; }
.nt-em-list .warn .nt-em-ico { background: rgba(245,176,65,.2); color: #fcd34d; }
.nt-em-list .fail .nt-em-ico { background: rgba(239,68,68,.22); color: #fca5a5; }
.nt-em-list .info .nt-em-ico { background: rgba(34,211,238,.14); color: #67e8f9; font-style: italic; font-family: Georgia, serif; }
.nt-em-list .fail { border-color: rgba(239,68,68,.3); } .nt-em-list .warn { border-color: rgba(245,176,65,.28); }
.nt-em-list.small li { padding: 6px 10px; font-size: 12px; grid-template-columns: 20px minmax(0, 1fr); align-items: center; } .nt-em-list.small .nt-em-ico { width: 18px; height: 18px; font-size: 10px; }
.nt-em-law { padding: 10px 14px; border-radius: 12px; border: 1px solid var(--line); background: rgba(255,255,255,.02); }
.nt-em-law summary { cursor: pointer; font-family: var(--display); font-weight: 600; font-size: 13px; }
.nt-em-law p { margin: 8px 0 0; font-size: 12.5px; line-height: 1.65; color: var(--muted); }
.nt-em-law p strong { color: var(--ink); }

/* the subject line lab */
.nt-lab-in { display: grid; gap: 12px; }
.nt-lab-acts { align-items: center; gap: 10px; }
.nt-lab-score { display: inline-flex; align-items: center; gap: 8px; padding: 10px 16px; font-size: 13px; }
.nt-lab-note { margin: 0; }
.nt-lab-rows { display: grid; gap: 10px; }
.nt-lab-ab { display: grid; gap: 6px; padding: 12px 14px; border-radius: 14px; border: 1px solid rgba(167,139,250,.4); background: linear-gradient(135deg, rgba(167,139,250,.12), rgba(34,211,238,.06)); }
.nt-lab-ab p { margin: 0; display: flex; gap: 10px; align-items: baseline; font-size: 13.5px; overflow-wrap: anywhere; }
.nt-lab-abk { flex: none; min-width: 20px; height: 20px; border-radius: 6px; display: inline-grid; place-items: center; font: 800 11px var(--display); color: #0b0b12; background: linear-gradient(120deg, #22d3ee, #a78bfa); }
.nt-lab-row { gap: 10px; border-inline-start: 3px solid var(--tc, #22d3ee); }
.nt-lab-row.strong { --tc: #34d399; } .nt-lab-row.good { --tc: #22d3ee; } .nt-lab-row.fair { --tc: #f5b041; } .nt-lab-row.weak { --tc: #f87171; }
.nt-lab-head { display: grid; grid-template-columns: 46px minmax(0, 1fr); gap: 12px; align-items: center; }
.nt-lab-sc { width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; font: 800 15px var(--display); color: var(--ink); background: radial-gradient(closest-side, var(--panel, #111118) 76%, transparent 78% 100%), conic-gradient(var(--tc) calc(var(--s, 50) * 1%), rgba(255,255,255,.08) 0); }
.nt-lab-ttl { display: grid; gap: 5px; min-width: 0; }
.nt-lab-ttl strong { font-size: 14.5px; overflow-wrap: anywhere; }
.nt-lab-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.nt-lab-tier { font: 700 11px var(--display); padding: 2px 8px; border-radius: 999px; color: var(--tc); background: rgba(255,255,255,.05); border: 1px solid currentColor; }
.nt-lab-tier.strong { color: #34d399; } .nt-lab-tier.good { color: #22d3ee; } .nt-lab-tier.fair { color: #f5b041; } .nt-lab-tier.weak { color: #f87171; }
.nt-lab-pre { color: var(--muted); font-size: 12px; }
.nt-lab-prev { display: grid; grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr); gap: 8px; }
.nt-lab-box { display: grid; gap: 3px; padding: 8px 10px; border-radius: 10px; background: #fbfbfd; color: #1d1d24; font: 12.5px/1.4 "Inter", "Cairo", system-ui, sans-serif; min-width: 0; }
.nt-lab-box b { font-weight: 600; } .nt-lab-box div span { color: #6e6e7a; }
.nt-lab-box.phone div { display: grid; } .nt-lab-box div { overflow-wrap: anywhere; }
.nt-lab-dev { font: 600 10px var(--display); letter-spacing: .05em; text-transform: uppercase; color: #8a8a96; }
[dir="rtl"] .nt-lab-dev { letter-spacing: 0; text-transform: none; font-family: var(--arabic); }
.nt-lab-rules { margin: 0; padding: 0; list-style: none; display: flex; flex-wrap: wrap; gap: 6px; }
.nt-lab-rules li { display: inline-flex; align-items: baseline; gap: 6px; padding: 3px 9px; border-radius: 999px; font-size: 11.5px; background: rgba(255,255,255,.04); border: 1px solid var(--line); color: var(--muted); max-width: 100%; }
.nt-lab-rules li b { font-family: var(--display); font-size: 11px; }
.nt-lab-rules li.plus b { color: #6ee7b7; } .nt-lab-rules li.minus b { color: #fca5a5; }
.nt-lab-rules li span { overflow-wrap: anywhere; }

/* WhatsApp */
.nt-wa-top { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; justify-content: space-between; }
.nt-wa-top .nt-hint { margin: 0; flex: 1 1 260px; }
.nt-wa-list { display: grid; gap: 12px; }
.nt-wa-grid { display: grid; grid-template-columns: minmax(0, 340px) minmax(0, 1fr); gap: 16px; align-items: start; }
.nt-wa-phone { display: grid; gap: 4px; padding: 14px 12px; border-radius: 16px; background: #efeae2 linear-gradient(0deg, rgba(0,0,0,.02), rgba(0,0,0,.02)); min-width: 0; }
.nt-wa-bubble { position: relative; display: grid; gap: 6px; padding: 8px 10px 18px; border-radius: 10px; border-start-start-radius: 2px; background: #ffffff; color: #111b21; font: 14px/1.45 "Inter", "Cairo", system-ui, sans-serif; box-shadow: 0 1px 1px rgba(0,0,0,.12); overflow-wrap: anywhere; }
.nt-wa-h { font-weight: 700; font-size: 14.5px; }
.nt-wa-b { white-space: pre-wrap; }
.nt-wa-f { font-size: 12.5px; color: #667781; }
.nt-wa-time { position: absolute; inset-inline-end: 8px; bottom: 4px; font-size: 10.5px; color: #667781; }
.nt-wa-var { background: #d9fdd3; border-radius: 4px; padding: 0 3px; }
.nt-wa-btn { padding: 9px 10px; border-radius: 10px; background: #ffffff; color: #027eb5; text-align: center; font: 600 13.5px "Inter", "Cairo", system-ui, sans-serif; box-shadow: 0 1px 1px rgba(0,0,0,.1); overflow-wrap: anywhere; }
.nt-wa-side { display: grid; gap: 10px; min-width: 0; }
.nt-wa-meter { display: grid; gap: 4px; }
.nt-wa-side .nt-hint { margin: 0; overflow-wrap: anywhere; }

/* sequences */
.nt-seq-head { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.nt-seq-head > .nt-field { flex: 1 1 280px; }
.nt-seq-head .nt-kind { margin-bottom: 10px; }
.nt-seq-line { margin: 0; padding: 0; list-style: none; display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; }
.nt-seq-card { display: grid; gap: 8px; padding: 10px; border-radius: 14px; border: 1px solid var(--line); background: rgba(255,255,255,.025); min-width: 0; position: relative; }
.nt-seq-card[aria-current="step"] { border-color: rgba(34,211,238,.6); background: linear-gradient(135deg, rgba(34,211,238,.1), rgba(139,92,246,.08)); box-shadow: 0 0 0 1px rgba(34,211,238,.15); }
.nt-seq-open { display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 10px; align-items: start; padding: 2px; border: 0; background: none; color: var(--ink); font: inherit; text-align: start; cursor: pointer; border-radius: 10px; }
.nt-seq-open:focus-visible { outline: 2px solid rgba(34,211,238,.6); outline-offset: 2px; }
.nt-seq-n { width: 28px; height: 28px; border-radius: 9px; display: grid; place-items: center; font: 800 13px var(--display); background: rgba(34,211,238,.12); color: #67e8f9; border: 1px solid rgba(34,211,238,.3); }
.nt-seq-card[aria-current="step"] .nt-seq-n { background: var(--nw); color: #fff; border-color: transparent; }
.nt-seq-tx { display: grid; gap: 3px; min-width: 0; }
.nt-seq-tx strong { font-size: 13.5px; overflow-wrap: anywhere; }
.nt-seq-tx small { color: var(--dim); font-size: 11.5px; line-height: 1.4; }
.nt-seq-time { display: grid; grid-template-columns: 76px minmax(0, 1fr); gap: 6px; align-items: center; }
.nt-seq-time .nt-input { padding: 6px 8px; font-size: 12.5px; }
.nt-seq-time .nt-hint { grid-column: 1 / -1; }
.nt-seq-editing { margin-top: 2px; }
.nt-seq-item { display: flex; gap: 8px; align-items: center; }

/* the owner's pictures: thumbnails of the posts (tap: main image → product card → off), then the per-e-mail editor rows */
.nt-em-imgs { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; min-width: 0; }
.nt-em-thumbs { display: flex; flex-wrap: wrap; gap: 8px; min-width: 0; }
.nt-em-thumb { position: relative; flex: none; width: 88px; height: 88px; padding: 0; border-radius: 10px; border: 2px solid var(--line); background: rgba(255,255,255,.03); overflow: hidden; cursor: pointer; }
.nt-em-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; opacity: .85; }
.nt-em-thumb.hero { border-color: #22d3ee; } .nt-em-thumb.card { border-color: #a78bfa; } .nt-em-thumb.hero img, .nt-em-thumb.card img { opacity: 1; }
.nt-em-thumb:focus-visible { outline: 2px solid rgba(34,211,238,.7); outline-offset: 2px; }
.nt-em-thumb-tag { position: absolute; inset-inline: 3px; bottom: 3px; padding: 1px 3px; border-radius: 6px; font: 700 9.5px var(--display); color: #0b0b12; background: #67e8f9; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nt-em-thumb.card .nt-em-thumb-tag { background: #c4b5fd; }
.nt-em-mrow { display: grid; grid-template-columns: 64px minmax(0, 1fr) auto; gap: 10px; align-items: start; padding: 8px; border-radius: 12px; border: 1px solid var(--line); }
.nt-em-mrow > img { width: 64px; height: 64px; object-fit: cover; border-radius: 9px; }
.nt-em-mfields { display: grid; gap: 6px; min-width: 0; }
.nt-em-mfields strong { font-size: 12.5px; color: var(--muted); }
/* the subject: its length and live rule score */
.nt-em-subj-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-height: 18px; }
.nt-em-subj-meta .nt-chars.near { color: #fcd34d; } .nt-em-subj-meta .nt-chars.over { color: #fca5a5; }
.nt-em-check > span { display: grid; gap: 2px; } .nt-em-check .nt-hint { font-size: 11px; }
.nt-em-espnote { display: block; color: #fcd34d; }
.nt-seq-range { font-size: 10.5px; }
.nt-wa-optnote { font-size: 11.5px; }
.nt-wa-opt { flex-wrap: wrap; }
.nt-em-fix { margin-top: 2px; font-size: 12px; }
.nt-em-fix::after { content: " →"; } [dir="rtl"] .nt-em-fix::after { content: " ←"; }
/* wide panels: the checklist and the lab's lines in two columns (what to fix first stays first) */
@media (min-width: 1200px) {
  .nt-em-list.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .nt-lab-rows { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
  .nt-lab-rows > .nt-lab-ab, .nt-lab-rows > .nt-empty { grid-column: 1 / -1; }
  .nt-lab-rows .nt-lab-prev { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 1100px) {
  .nt-wa-grid { grid-template-columns: minmax(0, 1fr); }
  .nt-wa-phone { max-width: 380px; }
}
@media (max-width: 700px) {
  .nt-em-settings { grid-template-columns: minmax(0, 1fr); }
  .nt-em-goalrow { grid-template-columns: minmax(0, 1fr); gap: 4px; }
  .nt-em-goalgrp { padding-top: 0; }
  .nt-seq-plan { grid-template-columns: minmax(0, 1fr); }
  .nt-lab-prev { grid-template-columns: minmax(0, 1fr); }
  .nt-em-modes { width: 100%; box-sizing: border-box; }
  .nt-em-modes .nw-chip { flex: 1 1 auto; justify-content: center; padding: 8px 10px; }
  .nt-em-tab { padding: 10px 11px; }
  .nt-seq-line { grid-template-columns: minmax(0, 1fr); }
  .nt-em-mrow { grid-template-columns: 48px minmax(0, 1fr) auto; } .nt-em-mrow > img { width: 48px; height: 48px; }
}
[dir="rtl"] .nt-em-tag { font-family: var(--mono); }
[dir="rtl"] .nt-em-badge, [dir="rtl"] .nt-lab-sc, [dir="rtl"] .nt-lab-rules li b, [dir="rtl"] .nt-seq-n, [dir="rtl"] .nt-lab-tier, [dir="rtl"] .nt-em-tab { font-family: var(--arabic); }
@media (prefers-reduced-motion: reduce) { .nt-em-inbox { transition: none; } }
