/* ═══════════════ e'thix AI — Export (print → PDF) and the artifact editor ═══════════════
   Owner: W8 (PK-W8-1). Served under style-src 'self': every rule lives here; the only per-document CSS (the @page margin
   boxes with the document's title and «صفحة N من M») is a constructed stylesheet export.js adopts while printing. */

/* ─────────────── print: only the export, on white paper ─────────────── */
.ex-print{display:none}
@media print{
  html.ex-printing,html.ex-printing body{
    height:auto !important;min-height:0 !important;max-height:none !important;overflow:visible !important;
    background:#fff !important;color:#111 !important;
  }
  html.ex-printing body{margin:0 !important;padding:0 !important;position:static !important;display:block !important}
  html.ex-printing body > :not(.ex-print){display:none !important}
  html.ex-printing .ex-print{
    display:block !important;
    font-family:'IBM Plex Sans Arabic','Noto Naskh Arabic','Segoe UI',Tahoma,Arial,sans-serif;
    font-size:11pt;line-height:1.75;color:#111;background:#fff;
    -webkit-print-color-adjust:exact;print-color-adjust:exact;
  }
  .ex-print .ex-p-head{border-bottom:1.5pt solid #b08d57;padding-bottom:6pt;margin-bottom:10pt}
  .ex-print .ex-p-brand{font-size:8.5pt;letter-spacing:.06em;color:#6b5a3a}
  .ex-print .ex-p-title{font-size:19pt;line-height:1.35;margin:2pt 0 3pt;font-weight:700}
  .ex-print .ex-p-meta{font-size:9pt;color:#444}
  .ex-print .ex-p-draft{border:.75pt solid #b3261e;color:#b3261e;border-radius:3pt;padding:0 5pt;font-weight:700}
  .ex-print .ex-p-disc{margin:0 0 12pt;padding:6pt 10pt;border:.75pt solid #b08d57;background:#f7f3ea;font-size:9.5pt}
  .ex-print h2{font-size:14.5pt;margin:14pt 0 5pt;break-after:avoid;page-break-after:avoid}
  .ex-print h3{font-size:12.5pt;margin:12pt 0 4pt;break-after:avoid;page-break-after:avoid}
  .ex-print h4{font-size:11.5pt;margin:10pt 0 3pt;break-after:avoid;page-break-after:avoid}
  .ex-print p,.ex-print li{orphans:3;widows:3}
  .ex-print p{margin:0 0 7pt}
  .ex-print ul,.ex-print ol{margin:0 0 8pt;padding-inline-start:18pt}
  .ex-print blockquote{margin:0 0 8pt;padding:3pt 10pt;border-inline-start:2pt solid #999;color:#333}
  .ex-print table{border-collapse:collapse;width:100%;margin:0 0 10pt;font-size:9.5pt}
  .ex-print thead{display:table-header-group}
  .ex-print tr{break-inside:avoid;page-break-inside:avoid}
  .ex-print th,.ex-print td{border:.75pt solid #999;padding:3pt 5pt;vertical-align:top;text-align:start}
  .ex-print th{background:#efefef}
  .ex-print hr{border:0;border-top:.75pt solid #bbb;margin:10pt 0}
  .ex-print code{font-family:Consolas,'Courier New',monospace;font-size:9.5pt}
  .ex-print .fig{font-weight:700}
  .ex-print .blank{background:#fff3b0;border-bottom:.75pt dashed #8a6d00;padding:0 2pt}
  .ex-print .ex-p-end{margin-top:16pt;padding-top:6pt;border-top:.75pt solid #bbb;font-size:9pt;color:#333;break-inside:avoid}
}

/* ─────────────── the export button and menu ─────────────── */
.ex-btn{white-space:nowrap}
.ex-menu .pop-label small{display:block;font-size:11.5px;color:var(--muted);font-weight:400;margin-top:1px}
/* inside an open sheet the same choices come as a sheet of their own (a popover would sit under the sheet's top layer) */
.ex-choices{display:grid;gap:2px}
.ex-choice{display:flex;align-items:center;gap:12px;width:100%;min-height:48px;padding:8px 12px;border-radius:12px;text-align:start;font:inherit;font-size:14.5px;font-weight:500;color:var(--ink);background:transparent;border:0;cursor:pointer}
.ex-choice:hover{background:var(--surface-2)}
.ex-choice:focus-visible{outline:2px solid var(--accent-a);outline-offset:-2px}
.ex-choice > .i{width:18px;height:18px;flex:none;color:var(--ink-soft)}
.ex-choice-l{display:grid;flex:1;min-width:0;line-height:1.4}
.ex-choice-l small{font-size:12px;color:var(--muted);font-weight:400}
.ex-sep{border:0;height:1px;background:var(--line);margin:4px 8px}

/* ─────────────── the artifact editor ─────────────── */
.ae{display:grid;gap:12px;min-width:0}
.ae-intro{margin:0;color:var(--ink-soft);font-size:13.5px;line-height:1.7}
.ae-warn{display:flex;align-items:center;gap:10px;flex-wrap:wrap;padding:10px 12px;border-radius:12px;background:var(--danger-soft);color:var(--danger);font-size:13.5px;line-height:1.6}
.ae-warn[hidden]{display:none}
.ae-warn-txt{flex:1 1 220px}
.ae-main{display:grid;grid-template-columns:minmax(220px,280px) minmax(0,1fr);gap:16px;align-items:start}
.ae-side{display:grid;gap:10px;position:sticky;top:0;min-width:0}
.ae-box{border:1px solid var(--line);border-radius:14px;background:var(--surface-2);min-width:0}
.ae-box[hidden]{display:none}
.ae-box summary{cursor:pointer;list-style:none;display:flex;align-items:center;gap:8px;padding:10px 12px;min-height:44px;font-weight:600;font-size:13.5px;border-radius:14px}
.ae-box summary::-webkit-details-marker{display:none}
.ae-box summary::after{content:"";margin-inline-start:auto;width:7px;height:7px;border-right:2px solid currentColor;border-bottom:2px solid currentColor;transform:translateY(-2px) rotate(45deg);transition:transform .2s var(--ease);flex:none}
.ae-box[open] summary::after{transform:translateY(2px) rotate(-135deg)}
.ae-box-t{min-width:0}
.ae-count,.ae-lcount,.ae-vcount{font-weight:500;color:var(--muted);font-size:12px}
.ae-hint{margin:0 12px 10px;color:var(--muted);font-size:12.5px;line-height:1.6}
.ae-fields{display:grid;gap:10px;padding:0 12px 12px}
.ae-field .input{min-height:44px}
.ae-locks{list-style:none;margin:0;padding:0 12px 12px;display:grid;gap:6px}
.ae-locks li{display:flex;align-items:center;gap:6px;font-size:13px;font-weight:600;min-width:0;overflow-wrap:anywhere}
.ae-locks .i{width:14px;height:14px;color:var(--gold-text);flex:none}
.ae-versions{list-style:none;margin:0;padding:0 6px 8px;display:grid;gap:2px}
.ae-ver{display:flex;align-items:center;gap:8px;padding:6px;border-radius:10px}
.ae-ver:hover{background:color-mix(in srgb,var(--ink) 4%,transparent)}
.ae-ver-t{display:grid;flex:1;min-width:0;font-size:13px}
.ae-ver-t small{color:var(--muted);font-size:11.5px;line-height:1.5}
.ae-ver .b{min-height:36px}
.ae-doc{display:grid;gap:8px;min-width:0}
.ae-tools{display:flex;align-items:center;gap:2px;flex-wrap:wrap;padding:4px;border:1px solid var(--line);border-radius:12px;background:var(--surface-2);position:sticky;top:0;z-index:1}
.ae-paper{max-width:none;min-height:320px;padding:36px clamp(18px,5vw,56px);animation:none;overflow-wrap:anywhere}
.ae-paper:focus-visible{outline:2px solid var(--gold-deep);outline-offset:2px}
html[data-theme="dark"] .ae-paper :is(td,th){border-color:rgba(233,227,217,.2)}
html[data-theme="dark"] .ae-paper hr{border-top-color:rgba(233,227,217,.25)}
.ae-lock{display:inline-block;padding:0 6px;border-radius:6px;background:rgba(201,174,126,.2);border:1px solid rgba(150,120,70,.5);font-weight:700;white-space:nowrap;cursor:not-allowed}
html[data-theme="dark"] .ae-lock{background:rgba(216,190,144,.16);border-color:rgba(216,190,144,.45)}
.ae-blank{display:inline-block;padding:0 6px;border-radius:6px;background:#FFF3B0;color:#4F3D00;border:1px dashed #957800;cursor:pointer}
.ae-blank.is-filled{background:transparent;color:inherit;border:0;border-bottom:1px solid rgba(150,120,70,.6);border-radius:0;padding:0 1px}
html[data-theme="dark"] .ae-blank:not(.is-filled){background:rgba(255,220,100,.18);color:#FFE7A0;border-color:rgba(255,220,100,.55)}
.ae-blank:focus-visible{outline:2px solid var(--gold-deep);outline-offset:2px}
.ae-draft{margin:0;font-size:12px;color:var(--muted);text-align:center;line-height:1.6}
.ae-sheet .sheet-foot{align-items:center}
.ae-status{margin-inline-end:auto;color:var(--muted);font-size:12.5px;min-width:0;flex:1 1 180px}
.ae-kbd{margin-inline-start:6px;font-size:10.5px;opacity:.8}
@media (max-width:820px){
  .ae-main{grid-template-columns:minmax(0,1fr)}
  .ae-side{position:static}
}
@media (max-width:640px){
  .ae-paper{padding:22px 16px;min-height:240px}
  .ae-kbd{display:none}
  .ae-status{flex-basis:100%}
  .ae-sheet .sheet-foot .b{flex:1 1 auto}
}
@media (prefers-reduced-motion:reduce){.ae-box summary::after{transition:none}}
