/* Lenci · Nawaa tools — the vision package (alt-text.js, photo-post.js, vision-kit.js; v3/docs/tools/vision.md). Builds on nawaa-tools.css:
   the picture picker (tabs, the drop zone, the picked strip), the size check and the crop previews, the alt-text results (lint chips, limits,
   warnings, OCR, SEO), the bulk progress and the photo-to-post results. Logical properties only, so Arabic mirrors itself. */

/* ---- the picker */
.nv-picker { display: grid; gap: 10px; }
.nv-tabs { display: flex; gap: 4px; padding: 4px; border-radius: 14px; background: rgba(10,10,16,.6); border: 1px solid var(--line); width: fit-content; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.nv-tab { display: inline-flex; align-items: center; gap: 7px; padding: 8px 14px; border: 0; border-radius: 10px; background: transparent; color: var(--muted); font: 600 12.5px/1 var(--display); cursor: pointer; white-space: nowrap; transition: background .2s var(--ease), color .2s; }
[dir="rtl"] .nv-tab { font-family: var(--arabic); font-size: 13px; }
.nv-tab svg { width: 15px; height: 15px; flex: none; }
.nv-tab:hover { color: var(--ink); background: rgba(255,255,255,.04); }
.nv-tab[aria-selected="true"] { color: #fff; background: linear-gradient(180deg, rgba(34,211,238,.22), rgba(99,102,241,.16)); box-shadow: inset 0 0 0 1px rgba(34,211,238,.45); }
.nv-tab:focus-visible, .nv-drop:focus-visible { outline: 2px solid #22d3ee; outline-offset: 2px; }
.nv-pane { min-width: 0; }
.nv-drop { position: relative; display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 14px; padding: 18px 20px; border-radius: 16px; border: 1.5px dashed rgba(34,211,238,.35); background: radial-gradient(120% 140% at 0% 0%, rgba(34,211,238,.08), transparent 60%), rgba(10,10,16,.5); cursor: pointer; transition: border-color .2s, background .2s; }
.nv-drop:hover, .nv-drop.over { border-color: rgba(34,211,238,.8); background: radial-gradient(120% 140% at 0% 0%, rgba(34,211,238,.16), transparent 60%), rgba(10,10,16,.6); }
.nv-drop.busy { opacity: .7; pointer-events: none; }
.nv-file { position: absolute; inset: 0; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.nv-drop-ico { width: 40px; height: 40px; padding: 9px; border-radius: 12px; background: var(--nw); color: #fff; box-shadow: 0 0 18px var(--nw-glow); box-sizing: border-box; }
.nv-drop-text { display: grid; gap: 3px; min-width: 0; }
.nv-drop-text strong { font-family: var(--display); font-size: 14px; }
.nv-drop-text small { color: var(--dim); font-size: 12px; line-height: 1.45; }
.nv-drop-status { grid-column: 1 / -1; color: var(--muted); font-size: 12px; }
.nv-drop-status:empty { display: none; }
.nv-drop-status.bad, .nv-bad { color: #fca5a5; }
.nv-libpick { grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); max-height: 260px; overflow-y: auto; padding: 2px; }
.nv-strip { display: grid; grid-template-columns: 56px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 8px 10px; border-radius: 14px; border: 1px solid rgba(34,211,238,.28); background: rgba(34,211,238,.05); }
.nv-strip-img { width: 56px; height: 56px; object-fit: cover; border-radius: 10px; background: var(--panel-2); }
.nv-strip-text { display: grid; gap: 2px; min-width: 0; }
.nv-strip-text strong { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nv-strip-text small { color: var(--muted); font-size: 11.5px; }
.nv-warn-text { color: #fde68a !important; }
.nv-noimg { width: 84px; height: 84px; border-radius: 10px; flex: none; display: grid; place-items: center; background: rgba(255,255,255,.03); border: 1px dashed var(--line-2); color: var(--dim); }
.nv-noimg svg { width: 26px; height: 26px; }
.nv-dim { color: #a5f3fc; font-size: 11.5px; }
.nv-linkrow { display: flex; gap: 8px; align-items: stretch; }
.nv-linkrow .nt-input { flex: 1; min-width: 0; }
.nv-check { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); cursor: pointer; }
.nv-check input { width: 16px; height: 16px; accent-color: #22d3ee; flex: none; }
.nv-opts > .nt-field { flex: 1 1 200px; }
.nv-multi .nw-chip[aria-pressed="true"]::before { background: #fff; }

/* ---- chips, limits, headings */
.nv-h { margin: 0; font-family: var(--display); font-size: 13.5px; font-weight: 700; color: var(--ink); }
.nv-chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.nv-chip { display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: 999px; font-size: 11.5px; line-height: 1.5; color: var(--muted); background: rgba(255,255,255,.05); border: 1px solid var(--line); white-space: nowrap; }
.nv-chip.ok { color: #a7f3d0; background: rgba(52,211,153,.1); border-color: rgba(52,211,153,.3); }
.nv-chip.bad { color: #fecaca; background: rgba(239,68,68,.1); border-color: rgba(239,68,68,.32); }
.nv-chip.soft { color: #fde68a; background: rgba(245,176,65,.08); border-color: rgba(245,176,65,.28); }
.nv-chip.seen { color: #cffafe; background: linear-gradient(180deg, rgba(34,211,238,.2), rgba(99,102,241,.14)); border-color: rgba(34,211,238,.45); }
.nv-chip.brief { color: #fde68a; background: rgba(245,176,65,.1); border-color: rgba(245,176,65,.35); }
.nv-chip.fact { color: #e9d5ff; background: rgba(139,92,246,.14); border-color: rgba(139,92,246,.38); font-family: "Inter", "Cairo", system-ui, sans-serif; unicode-bidi: isolate; }
.nv-lims { display: flex; flex-wrap: wrap; gap: 6px; }
.nv-lim { font-size: 11px; padding: 2px 8px; border-radius: 8px; color: var(--dim); background: rgba(255,255,255,.03); border: 1px solid var(--line); }
.nv-lim.ok { color: #86efac; } .nv-lim.soft { color: #fcd34d; } .nv-lim.bad { color: #fca5a5; }
.nv-res-top { display: flex; align-items: center; justify-content: space-between; gap: 8px 14px; flex-wrap: wrap; }
.nv-block { gap: 10px; align-content: start; }

/* ---- alt text results */
.nv-alt-top, .nv-pp-top { display: grid; grid-template-columns: minmax(0, 300px) minmax(0, 1fr); gap: 16px; align-items: start; }
.nv-alt-top.nopic { grid-template-columns: minmax(0, 1fr); }
.nv-figure { margin: 0; display: grid; gap: 6px; position: relative; }
.nv-figure img { width: 100%; max-height: 360px; object-fit: contain; border-radius: 14px; background: repeating-conic-gradient(rgba(255,255,255,.04) 0 25%, transparent 0 50%) 0 0 / 16px 16px; border: 1px solid var(--line); }
.nv-figure figcaption { font-size: 11.5px; color: var(--dim); text-align: center; }
.nv-side { display: grid; gap: 12px; min-width: 0; align-content: start; }
.nv-warns { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.nv-warn { display: grid; grid-template-columns: 30px minmax(0, 1fr); gap: 10px; align-items: start; padding: 10px 12px; border-radius: 12px; background: rgba(245,176,65,.06); border: 1px solid rgba(245,176,65,.22); }
.nv-warn.info_only_in_image { background: rgba(239,68,68,.06); border-color: rgba(239,68,68,.25); }
.nv-warn-ico { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; font-weight: 800; color: #fde68a; background: rgba(245,176,65,.14); }
.nv-warn.info_only_in_image .nv-warn-ico { color: #fecaca; background: rgba(239,68,68,.16); }
.nv-warn > div { display: grid; gap: 3px; min-width: 0; }
.nv-warn .nv-chips { margin-top: 3px; }
.nv-warn strong { font-size: 13px; }
.nv-warn small { color: var(--muted); font-size: 12px; line-height: 1.45; }
.nv-warn .nv-warn-note { color: var(--dim); font-style: italic; }
.nv-alts { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; }
.nv-altcard textarea { min-height: 84px; }
.nv-ocr { margin: 0; padding: 10px 12px; border-radius: 10px; background: rgba(10,10,16,.6); border: 1px solid var(--line); white-space: pre-wrap; overflow-wrap: anywhere; font: 13.5px/1.6 "Inter", "Cairo", system-ui, sans-serif; color: var(--ink); max-height: 220px; overflow-y: auto; }
.nv-mono { font-family: var(--mono) !important; font-size: 13px; }
.nv-filerow { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.nv-filerow .nt-input { flex: 1 1 220px; min-width: 0; }
.nv-titlerow { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.nv-title-text { flex: 1 1 160px; font-size: 13.5px; min-width: 0; overflow-wrap: anywhere; }
.nv-snippet { display: grid; gap: 6px; }
.nv-code { margin: 0; padding: 10px 12px; border-radius: 10px; background: #07070c; border: 1px solid var(--line); color: #a5f3fc; font: 12px/1.6 var(--mono); white-space: pre-wrap; overflow-wrap: anywhere; text-align: left; max-height: 200px; overflow-y: auto; }

/* ---- the bulk run */
.nv-bulk { display: grid; gap: 12px; }
.nv-bulk-sum { display: grid; gap: 10px; padding: 14px; border-radius: 14px; border: 1px solid var(--line); background: rgba(255,255,255,.025); }
.nv-bulk-text { display: grid; gap: 3px; }
.nv-bulk-text strong { font-family: var(--display); font-size: 15px; }
.nv-bulk-text small { color: var(--dim); font-size: 12px; }
.nv-thumbs { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.nv-thumbs img { width: 46px; height: 46px; object-fit: cover; border-radius: 9px; border: 1px solid var(--line); }
.nv-more { font-family: var(--mono); font-size: 12px; color: var(--muted); padding: 0 6px; }
.nv-progress { display: grid; gap: 8px; padding: 12px 14px; border-radius: 14px; border: 1px solid rgba(34,211,238,.25); background: rgba(34,211,238,.04); }
.nv-bar { position: relative; height: 10px; border-radius: 999px; background: rgba(255,255,255,.06); overflow: hidden; }
.nv-bar i { position: absolute; inset-block: 0; inset-inline-start: 0; border-radius: inherit; background: var(--nw); box-shadow: 0 0 12px var(--nw-glow); transition: width .35s var(--ease); }
.nv-prog-line { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; font-size: 12.5px; }
.nv-prog-line strong { font-family: var(--display); margin-inline-end: auto; }
.nv-ok { color: #86efac; } .nv-ko { color: #fca5a5; }
.nv-report { display: grid; gap: 6px; padding-top: 6px; border-top: 1px dashed var(--line-2); }
.nv-rep-row { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 6px 8px; border-radius: 10px; background: rgba(255,255,255,.02); border: 1px solid var(--line); }
.nv-rep-row.ko { border-color: rgba(239,68,68,.3); }
.nv-rep-row img { width: 40px; height: 40px; object-fit: cover; border-radius: 8px; }
.nv-rep-row div { display: grid; gap: 2px; min-width: 0; }
.nv-rep-row strong { font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nv-rep-row small { color: var(--muted); font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.nv-rep-row.ko small { color: #fca5a5; }
.nv-rep-row .nv-chips { display: flex; gap: 4px; margin-top: 2px; }
.nv-rep-row .nv-chip { font-size: 10.5px; padding: 1px 7px; }
.nv-needlook { margin: 0; color: #fde68a; }

/* ---- the size check and the crops */
.nv-sizecheck { display: grid; gap: 10px; padding: 14px; border-radius: 16px; border: 1px solid var(--line-2); background: linear-gradient(180deg, rgba(34,211,238,.05), rgba(139,92,246,.04)); }
.nv-sizecheck-head { display: flex; align-items: center; gap: 10px; }
.nv-free { font-size: 10.5px; font-weight: 700; padding: 2px 8px; border-radius: 999px; color: #052e16; background: #34d399; }
.nv-sizeline { margin: 0; font-size: 13px; color: #cffafe; }
.nv-notes { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; font-size: 12.5px; }
.nv-notes li { padding-inline-start: 18px; position: relative; color: var(--muted); }
.nv-notes li::before { position: absolute; inset-inline-start: 0; }
.nv-notes li.ok::before { content: "✓"; color: #34d399; } .nv-notes li.warn::before { content: "!"; color: #f5b041; font-weight: 800; }
.nv-crops { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; align-items: start; }
.nv-crops.small { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.nv-crop { margin: 0; display: grid; gap: 6px; padding: 8px; border-radius: 12px; border: 1px solid var(--line); background: rgba(10,10,16,.45); min-width: 0; }
.nv-crop.best { border-color: rgba(34,211,238,.55); box-shadow: 0 0 0 1px rgba(34,211,238,.18), 0 0 18px rgba(34,211,238,.08); }
/* the frame keeps the format's ratio inside a fixed-height stage: width = min(100%, stage height × ratio) */
.nv-crop-stage { --fh: 190px; height: var(--fh); display: flex; align-items: center; justify-content: center; }
.nv-crops.small .nv-crop-stage { --fh: 128px; }
.nv-crop-frame { position: relative; width: min(100%, calc(var(--fh) * var(--ar, 1))); aspect-ratio: var(--ar, 1); border-radius: 8px; overflow: hidden; background: #000; box-shadow: 0 0 0 1px rgba(255,255,255,.08); }
.nv-crop-frame img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.nv-safe { position: absolute; inset-inline: 0; height: 14%; background: repeating-linear-gradient(135deg, rgba(239,68,68,.28) 0 6px, rgba(239,68,68,.12) 6px 12px); border-block: 1px dashed rgba(254,202,202,.6); pointer-events: none; }
.nv-safe.top { top: 0; } .nv-safe.bottom { bottom: 0; }
.nv-crop figcaption { display: grid; gap: 2px; min-width: 0; }
.nv-crop figcaption strong { font-size: 12px; line-height: 1.3; }
.nv-crop figcaption small { font-size: 10.5px; color: var(--dim); }
.nv-grade { justify-self: start; font-size: 11px; padding: 3px 8px; border-radius: 8px; line-height: 1.4; }
.nv-grade.ideal { color: #052e16; background: #34d399; } .nv-grade.good { color: #a7f3d0; background: rgba(52,211,153,.14); }
.nv-grade.crop { color: #fde68a; background: rgba(245,176,65,.14); } .nv-grade.poor { color: #fecaca; background: rgba(239,68,68,.14); }
.nv-crop-dl { justify-self: stretch; }
.nv-palette { display: grid; gap: 6px; }
.nv-sws { display: flex; flex-wrap: wrap; gap: 6px; }
.nv-sw { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px 3px 4px; border-radius: 999px; border: 1px solid var(--line); background: rgba(255,255,255,.03); font-size: 11.5px; }
[dir="rtl"] .nv-sw { padding: 3px 4px 3px 9px; }
.nv-sw i { width: 18px; height: 18px; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(255,255,255,.2); flex: none; }
.nv-sw span { font-size: 11.5px; }
.nv-sw span.hex { font-family: var(--mono); font-size: 11px; }
.nv-sw small { color: var(--dim); font-size: 10.5px; }
.nv-brandmatch { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.nv-bm { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; padding: 3px 9px 3px 4px; border-radius: 999px; border: 1px solid var(--line); }
[dir="rtl"] .nv-bm { padding: 3px 4px 3px 9px; }
.nv-bm i { width: 16px; height: 16px; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(255,255,255,.2); }
.nv-bm.match { color: #a7f3d0; border-color: rgba(52,211,153,.35); } .nv-bm.close { color: #fde68a; border-color: rgba(245,176,65,.35); } .nv-bm.missing { color: var(--dim); }

/* ---- photo to post results */
.nv-seen { display: grid; gap: 10px; padding: 12px 14px; border-radius: 14px; border: 1px solid var(--line); background: rgba(255,255,255,.025); }
.nv-seen dl { margin: 0; display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 6px 14px; font-size: 13px; }
.nv-seen dt { color: var(--dim); font-size: 12px; }
.nv-seen dd { margin: 0; color: var(--ink); overflow-wrap: anywhere; }
.nv-ocr-inline { white-space: pre-wrap; font-family: "Inter", "Cairo", system-ui, sans-serif; }
.nv-best { display: grid; gap: 4px; padding: 12px 14px; border-radius: 14px; border: 1px solid color-mix(in srgb, var(--pc, #22d3ee) 45%, transparent); background: linear-gradient(135deg, color-mix(in srgb, var(--pc, #22d3ee) 12%, transparent), rgba(10,10,16,.3)); }
.nv-best strong { font-family: var(--display); font-size: 15px; }
.nv-best p { margin: 0; font-size: 13px; color: var(--muted); line-height: 1.55; }
.nv-plat { display: grid; gap: 10px; padding: 14px; border-radius: 16px; border: 1px solid var(--line); border-top: 3px solid var(--pc, #8b5cf6); background: rgba(255,255,255,.015); }
.nv-plat-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.nv-plat-head .nv-h { font-size: 15px; }
.nv-plat-head small { color: var(--dim); font-size: 11.5px; }
.nv-opts-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 12px; }
.nv-opt { align-content: start; }
.nv-cap { display: grid; gap: 6px; }
.nv-cap-head { display: flex; align-items: center; gap: 10px; }
.nv-meter-slot { flex: 1; min-width: 0; }
.nv-cap-text { font-size: 14px; line-height: 1.65; }
.nv-cap-info { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.nv-cap-info:empty { display: none; }
.nv-fold { flex-basis: 100%; display: grid; gap: 4px; padding: 8px 10px; border-radius: 10px; background: rgba(10,10,16,.55); border: 1px dashed var(--line-2); }
.nv-fold-text { margin: 0; font-size: 12.5px; line-height: 1.55; color: var(--muted); overflow-wrap: anywhere; }
.nv-fold-text .nv-more { color: #a5f3fc; font-family: inherit; font-size: inherit; padding: 0; }
.nv-two { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 12px; }
.nv-altline { display: grid; gap: 6px; padding-bottom: 8px; border-bottom: 1px dashed var(--line); }
.nv-altline:last-of-type { border-bottom: 0; }
.nv-quality { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 8px; }
.nv-quality li { display: grid; grid-template-columns: 26px minmax(0, 1fr); gap: 10px; align-items: start; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); background: rgba(255,255,255,.02); }
.nv-quality li div { display: grid; gap: 2px; min-width: 0; }
.nv-quality strong { font-size: 12.5px; }
.nv-quality span:not(.nv-lvl) { font-size: 12.5px; color: var(--muted); line-height: 1.5; }
.nv-lvl { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: 13px; }
.lvl-good .nv-lvl { color: #052e16; background: #34d399; } .lvl-ok .nv-lvl { color: #422006; background: #fcd34d; } .lvl-fix .nv-lvl { color: #fff; background: #ef4444; }
/* what an option states that the owner never gave (prices, offers, dates…): re-checked while editing */
.nv-unver { display: grid; gap: 6px; padding: 8px 10px; border-radius: 10px; background: rgba(239,68,68,.07); border: 1px solid rgba(239,68,68,.3); }
.nv-unver[hidden] { display: none; }
.nv-unver-head { font-size: 12px; color: #fecaca; line-height: 1.45; }
.nv-unver .nv-chip { white-space: normal; overflow-wrap: anywhere; }
.nv-missing { margin: 0; color: #fde68a; }
.nv-cal-warn { margin: 0; font-size: 12px; line-height: 1.45; }
/* the kit's History list is a one-column grid whose track grows to a long nowrap title (rows clipped at 390 px, Save / × off screen):
   the vision tools pin the track to the panel's width (kit change wished: grid-template-columns: minmax(0, 1fr) on .nt-history-list) */
#nt-panel:has(.nv-picker, .nv-bulk, .nv-mode) .nt-history-list { grid-template-columns: minmax(0, 1fr); }
/* the calendar popover opens from the option's footer (its start edge), so it never leaves a phone screen */
.nv-opt .nt-res-foot { position: relative; }
.nv-opt .nt-cal-wrap { position: static; }
.nv-cal-pop { width: min(300px, 86vw); }
.nv-opt .nv-cal-pop { inset-inline-start: 0; inset-inline-end: auto; width: min(300px, 100%); box-sizing: border-box; }

/* ---- small screens */
@media (max-width: 900px) {
  .nv-alt-top, .nv-pp-top { grid-template-columns: minmax(0, 1fr); }
  .nv-figure img { max-height: 280px; }
}
@media (max-width: 480px) {
  .nv-tabs { width: 100%; }
  .nv-tab { flex: 1 1 0; justify-content: center; padding: 8px 6px; gap: 5px; font-size: 12px; }
  .nv-drop { grid-template-columns: minmax(0, 1fr); justify-items: center; text-align: center; padding: 16px; }
  .nv-opts-grid, .nv-alts, .nv-two { grid-template-columns: minmax(0, 1fr); }
  .nv-crops { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .nv-crops.small { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .nv-strip { grid-template-columns: 48px minmax(0, 1fr); }
  .nv-strip-img { width: 48px; height: 48px; }
  .nv-strip-x { grid-column: 1 / -1; justify-self: stretch; }
  .nv-seen dl { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .nv-seen dd { margin-bottom: 6px; }
  .nv-linkrow { flex-wrap: wrap; } .nv-linkrow .ghost { flex: 1 1 100%; }
}
/* Arabic never goes through the mono face (it has no Arabic: the letters would not join) */
[dir="rtl"] .nv-grade, [dir="rtl"] .nv-lim, [dir="rtl"] .nv-more, [dir="rtl"] .nv-mono:lang(ar) { font-family: var(--arabic); letter-spacing: 0; }
@media (prefers-reduced-motion: reduce) { .nv-bar i, .nv-tab { transition: none; } }
