/* ج١ «مساعد كيان» — user 2026-11-23: a modern, polished assistant: a floating card of its own, a button that says its name on hover,
   a chat-app composer. Loaded after site.css, so these rules replace the phase A look of the conversation. */
:root {
  --ai-g1: #1d2b64; --ai-g2: #3949ab; --ai-g3: #7c4dff;
  --ai-grad: linear-gradient(135deg, var(--ai-g1) 0%, var(--ai-g2) 55%, var(--ai-g3) 100%);
  --ai-soft: #f5f6fc; --ai-ink: #1f2547; --ai-muted: #6b7290;
}

/* ---- the sparkle mark */
.ai-orb { flex: none; display: grid; place-items: center; width: 38px; height: 38px; border-radius: 12px; background: var(--ai-grad); color: #fff;
  box-shadow: 0 4px 12px rgba(57,73,171,.35), inset 0 1px 0 rgba(255,255,255,.25); }
.ai-orb svg { width: 21px; height: 21px; fill: currentColor; }
.ai-orb-lg { width: 64px; height: 64px; border-radius: 20px; margin: 0 auto 14px; animation: ai-float 4s ease-in-out infinite; }
.ai-orb-lg svg { width: 34px; height: 34px; }
@keyframes ai-float { 50% { transform: translateY(-4px); box-shadow: 0 12px 26px rgba(57,73,171,.38); } }
.ai-online { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #34d399; margin-inline-end: 6px; vertical-align: 1px;
  box-shadow: 0 0 0 3px rgba(52,211,153,.25); }
.ai-head-t { flex: 1; min-width: 0; line-height: 1.3; position: relative; z-index: 1; }
.ai-head-t b { display: block; font-size: 1rem; }
.ai-head-t small { display: block; font-size: .74rem; opacity: .88; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---- the conversation */
.ai-thread { display: flex; flex-direction: column; gap: .85rem; }
.ai-welcome { text-align: center; padding: 18px 10px 6px; color: var(--ai-ink); animation: ai-in .35s ease both; }
.ai-welcome h3 { font-size: 1.15rem; font-weight: 700; margin-bottom: .35rem; }
.ai-welcome p { font-size: .88rem; color: var(--ai-muted); margin: 0 auto; max-width: 340px; line-height: 1.75; }
.ai-q { align-self: flex-start; max-width: 84%; background: var(--ai-grad); color: #fff; padding: .6rem .95rem; border-radius: 18px 18px 18px 6px;
  box-shadow: 0 4px 14px rgba(57,73,171,.22); scroll-margin-top: 80px; animation: ai-in .25s ease both; line-height: 1.6; }
.ai-q small { display: block; opacity: .7; font-size: .7rem; margin-top: .1rem; }
.ai-a { position: relative; align-self: flex-end; width: calc(100% - 38px); margin-inline-end: 38px; background: #fff; color: var(--ai-ink);
  border: 1px solid #e6e8f3; padding: .8rem 1rem; border-radius: 18px 6px 18px 18px; box-shadow: 0 2px 10px rgba(17,26,68,.05); animation: ai-in .25s ease both; }
.ai-a::before { content: ''; position: absolute; top: 0; inset-inline-end: -38px; width: 30px; height: 30px; border-radius: 10px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'%3E%3Cpath d='M12 2.5l2.2 6.3 6.3 2.2-6.3 2.2L12 19.5l-2.2-6.3L3.5 11l6.3-2.2z'/%3E%3C/svg%3E") center / 17px no-repeat, var(--ai-grad);
  box-shadow: 0 3px 8px rgba(57,73,171,.3); }
.ai-a-error { border-color: #f5c2c7; background: #fffafa; }
.ai-a-stopped { background: var(--ai-soft); color: var(--ai-muted); font-size: .88rem; box-shadow: none; }
@keyframes ai-in { from { opacity: 0; transform: translateY(6px); } }
.ai-raw { white-space: pre-wrap; line-height: 1.75; }
.ai-a-live .ai-raw:empty { display: none; }
.ai-a-live .ai-raw:not(:empty)::after { content: ''; display: inline-block; width: .45em; height: 1em; margin-inline-start: 2px; vertical-align: -.15em;
  border-radius: 2px; background: var(--ai-g2); animation: ai-caret 1s steps(2) infinite; }
@keyframes ai-caret { to { opacity: 0; } }
.ai-status { display: flex; align-items: center; gap: .55rem; color: var(--ai-muted); font-size: .86rem; }
.ai-status[hidden] { display: none; }
.ai-dots { display: inline-flex; gap: 4px; }
.ai-dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--ai-g2); opacity: .3; animation: ai-dot 1.1s infinite ease-in-out; }
.ai-dots i:nth-child(2) { animation-delay: .16s; background: #5c6bc0; }
.ai-dots i:nth-child(3) { animation-delay: .32s; background: var(--ai-g3); }
@keyframes ai-dot { 0%, 80%, 100% { opacity: .25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-4px); } }
.ai-a-tools { display: flex; justify-content: flex-end; margin-top: .4rem; }
.ai-copy { display: inline-flex; align-items: center; gap: 4px; border: 0; background: none; color: var(--ai-muted); font-size: .76rem; padding: 3px 8px; border-radius: 8px; }
.ai-copy svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.ai-copy:hover { background: #eef0fb; color: var(--ai-g2); }
.ai-copy.done { color: #059669; }

/* ---- suggestions: cards on the welcome screen, chips afterwards */
.ai-suggest { display: flex; flex-wrap: wrap; gap: .45rem; }
.ai-suggest[hidden] { display: none; }
.ai-suggest-h { width: 100%; font-size: .74rem; font-weight: 600; color: var(--ai-muted); }
.ai-chip { display: inline-flex; align-items: center; gap: .4rem; border: 1px solid #D9DDF6; background: #F1F2FD;   /* no white chips (user 2026-11-29) */ color: var(--ai-ink); border-radius: 999px;
  padding: .32rem .8rem; font-size: .8rem; text-align: start; transition: border-color .15s, background .15s, transform .15s, box-shadow .15s; }
.ai-chip svg { flex: none; width: 14px; height: 14px; fill: none; stroke: var(--ai-g2); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; opacity: 0; transition: opacity .15s; }
.ai-chip:hover { border-color: #aab3e6; background: #E6E8FB; box-shadow: 0 3px 10px rgba(57,73,171,.12); }
.ai-chip:hover svg { opacity: 1; }
.ai-suggest-cards { flex-direction: column; flex-wrap: nowrap; }
.ai-suggest-cards .ai-chip { justify-content: space-between; width: 100%; border-radius: 14px; padding: .7rem .9rem; font-size: .86rem; }
.ai-suggest-cards .ai-chip svg { opacity: .55; }
.ai-suggest-cards .ai-chip:hover { transform: translateX(-3px); }

/* ---- composer */
.ai-composer { display: flex; align-items: flex-end; gap: 8px; background: #fff; border: 1.5px solid #dfe3f3; border-radius: 22px; padding: 6px;
  padding-inline-start: 14px; transition: border-color .15s, box-shadow .15s; }
.ai-composer:focus-within { border-color: #8f9be0; box-shadow: 0 0 0 4px rgba(57,73,171,.1); }
.ai-composer textarea { flex: 1; border: 0; outline: 0; resize: none; background: transparent; padding: 7px 0; min-height: 22px; max-height: 132px;
  line-height: 1.55; font-size: .93rem; color: var(--ai-ink); box-shadow: none; font-family: inherit; }
.ai-send, .ai-stop { flex: none; display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; border: 0; color: #fff;
  transition: transform .15s, opacity .15s, box-shadow .15s; }
.ai-send { background: var(--ai-grad); box-shadow: 0 4px 12px rgba(57,73,171,.35); }
.ai-send:hover:not(:disabled) { transform: translateY(-1px) scale(1.06); }
.ai-send:disabled { opacity: .35; box-shadow: none; }
.ai-send svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.ai-stop { background: #1f2547; }
.ai-stop svg { width: 16px; height: 16px; fill: currentColor; }
.ai-send[hidden], .ai-stop[hidden] { display: none; }
.ai-form-foot { display: flex; justify-content: space-between; gap: .5rem; padding: 6px 8px 0; font-size: .72rem; color: var(--ai-muted); }

/* ---- the /Ai page: the same conversation in a card of its own */
.ai-chat { max-width: 880px; background: #fff; border: 1px solid #e3e6f3; border-radius: 22px; overflow: hidden; box-shadow: 0 10px 30px rgba(17,26,68,.06); }
.ai-chat .ai-head { position: relative; display: flex; align-items: center; gap: 12px; padding: 16px 20px; background: var(--ai-grad); color: #fff; }
.ai-chat .ai-head::after, .ai-panel-head::after { content: ''; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(circle at 12% -50%, rgba(255,255,255,.3), transparent 55%); }
.ai-chat .ai-head .ai-orb, .ai-panel-head .ai-orb { position: relative; z-index: 1; background: rgba(255,255,255,.16); box-shadow: inset 0 0 0 1px rgba(255,255,255,.28); }
.ai-chat .ai-thread { padding: 22px 20px; background: linear-gradient(180deg, #f7f8fd, #fff); min-height: 240px; }
.ai-chat .ai-suggest { padding: 0 20px 14px; }
.ai-chat .ai-suggest-cards { max-width: 560px; margin: 0 auto; }
.ai-chat .ai-form { padding: 12px 16px 14px; border-top: 1px solid #eef0f7; background: #fff; }

/* ---- the floating button: a sparkle that opens into «مساعد كيان» on hover */
.ai-fab { position: fixed; z-index: 1040; left: 20px; bottom: 24px; height: 58px; min-width: 58px; padding: 0; border: 0; border-radius: 29px;
  display: inline-flex; align-items: center; touch-action: none; user-select: none; -webkit-user-select: none; color: #fff;
  background: var(--ai-grad); background-size: 180% 180%; animation: ai-shift 8s ease infinite;
  box-shadow: 0 10px 26px rgba(29,43,100,.38), inset 0 1px 0 rgba(255,255,255,.25); transition: box-shadow .2s, transform .2s, opacity .2s; }
.ai-fab::after { content: ''; position: absolute; inset: 0; border-radius: inherit; box-shadow: 0 0 0 0 rgba(124,77,255,.45); animation: ai-ring 2.6s ease-out 3; pointer-events: none; }
@keyframes ai-shift { 0%, 100% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } }
@keyframes ai-ring { to { box-shadow: 0 0 0 16px rgba(124,77,255,0); } }
.ai-fab-icon { display: grid; place-items: center; width: 58px; height: 58px; flex: none; }
.ai-fab-icon svg { width: 27px; height: 27px; fill: currentColor; transition: transform .35s cubic-bezier(.3,1.4,.5,1); }
.ai-fab-label { max-width: 0; overflow: hidden; white-space: nowrap; font-weight: 600; font-size: .95rem; opacity: 0;
  transition: max-width .3s cubic-bezier(.3,1.2,.5,1), opacity .2s, padding .3s; }
/* the sparkle stays on the side the button is attached to; the name opens away from the edge */
.ai-fab { flex-direction: row-reverse; }
.ai-fab.on-right { flex-direction: row; }
@media (hover: hover) {
  .ai-fab:hover:not(.dragging) { transform: translateY(-2px); box-shadow: 0 16px 34px rgba(29,43,100,.45), inset 0 1px 0 rgba(255,255,255,.25); }
  .ai-fab:hover:not(.dragging) .ai-fab-label { max-width: 140px; opacity: 1; padding-right: 20px; }
  .ai-fab.on-right:hover:not(.dragging) .ai-fab-label { padding-right: 0; padding-left: 20px; }
  .ai-fab:hover:not(.dragging) .ai-fab-icon svg { transform: rotate(-15deg) scale(1.12); }
}
.ai-fab:focus-visible { outline: 3px solid #b3bcf0; outline-offset: 3px; }
.ai-fab.dragging { transform: scale(1.08); cursor: grabbing; transition: none; }
.ai-fab-dot { position: absolute; top: 2px; left: 42px; width: 14px; height: 14px; border-radius: 50%; background: #ef4444; border: 2.5px solid #fff; }
.ai-fab.on-right .ai-fab-dot { left: auto; right: 42px; }
body.ai-panel-open .ai-fab { opacity: 0; pointer-events: none; transform: scale(.6); }

/* ---- the panel: a floating card of its own, apart from the page behind it */
.ai-panel { position: fixed; z-index: 1045; left: 20px; bottom: 20px; width: 410px; height: min(640px, calc(100vh - 40px)); max-width: calc(100vw - 40px);
  display: flex; flex-direction: column; overflow: hidden; background: #fff; border-radius: 24px; border: 1px solid rgba(29,43,100,.08);
  box-shadow: 0 30px 70px rgba(17,26,68,.28), 0 4px 14px rgba(17,26,68,.08); transform-origin: bottom left; animation: ai-pop .28s cubic-bezier(.2,.9,.3,1.15) both; }
.ai-panel.on-right { left: auto; right: 20px; transform-origin: bottom right; }
.ai-panel[hidden] { display: none; }
@keyframes ai-pop { from { opacity: 0; transform: translateY(14px) scale(.94); } }
.ai-panel-head { position: relative; display: flex; align-items: center; gap: 10px; padding: 14px 12px; padding-inline-start: 16px; background: var(--ai-grad); color: #fff; }
.ai-hbtn { position: relative; z-index: 1; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; border: 0; color: #fff;
  background: rgba(255,255,255,.14); transition: background .15s; }
.ai-hbtn:hover { background: rgba(255,255,255,.26); color: #fff; }
.ai-hbtn svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ai-panel-note { display: flex; gap: .4rem; align-items: center; padding: 9px 16px; background: linear-gradient(90deg, #eef0ff, #f6f0ff); color: var(--ai-g1);
  font-size: .82rem; font-weight: 500; text-decoration: none; border-bottom: 1px solid #e6e8f6; }
.ai-panel-note span { color: var(--ai-g3); }
.ai-panel-body, .ai-panel-chat { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.ai-panel-loading { flex: 1; display: grid; place-items: center; }
.ai-panel-chat .ai-thread { flex: 1; min-height: 0; overflow-y: auto; padding: 16px 14px; overscroll-behavior: contain; background: linear-gradient(180deg, #f7f8fd, #fbfbfe); }
.ai-panel-chat .ai-thread::-webkit-scrollbar { width: 6px; }
.ai-panel-chat .ai-thread::-webkit-scrollbar-thumb { background: #d5d9ec; border-radius: 3px; }
.ai-panel-chat .ai-suggest { padding: 4px 14px 10px; background: #fbfbfe; }
.ai-panel-chat .ai-form { padding: 10px 12px 12px; background: #fff; border-top: 1px solid #eef0f7; }

@media (max-width: 991.98px) {
  .ai-fab { bottom: calc(84px + env(safe-area-inset-bottom)); height: 52px; min-width: 52px; }
  .ai-fab-icon { width: 52px; height: 52px; }
  .ai-fab-icon svg { width: 24px; height: 24px; }
  .ai-fab-dot { left: 37px; }
  .ai-fab.on-right .ai-fab-dot { left: auto; right: 37px; }
  .ai-panel { bottom: calc(80px + env(safe-area-inset-bottom)); height: min(640px, calc(100vh - 100px)); }
  .ai-chat .ai-form { position: sticky; bottom: calc(68px + env(safe-area-inset-bottom)); z-index: 5; box-shadow: 0 -6px 18px rgba(17,26,68,.07); }
}
@media (max-width: 575.98px) {
  /* phone: still a card of its own, with a little of the page showing around it */
  .ai-panel, .ai-panel.on-right { left: 8px; right: 8px; top: 10px; bottom: calc(8px + env(safe-area-inset-bottom)); width: auto; height: auto; max-width: none;
    border-radius: 22px; transform-origin: bottom center; }
  body.ai-panel-open { overflow: hidden; }
  body.ai-panel-open::after { content: ''; position: fixed; inset: 0; z-index: 1041; background: rgba(17,26,68,.35); backdrop-filter: blur(2px); }
  .ai-q { max-width: 90%; }
  .ai-a { width: calc(100% - 34px); margin-inline-end: 34px; padding: .7rem .85rem; }
  .ai-a::before { inset-inline-end: -34px; width: 27px; height: 27px; background-size: 15px, auto; }
  .ai-chat { border-radius: 18px; }
  .ai-chat .ai-thread { padding: 16px 12px; }
  .ai-foot-note { display: none; }
}
@media print { .ai-fab, .ai-panel { display: none !important; } }

/* ---- ج٣ suggestion cards: an action the assistant proposes, decided by the manager */
.ai-cards { display: flex; flex-direction: column; gap: .6rem; margin-top: .75rem; }
.ai-card { border: 1px solid #dcd6fb; border-radius: 16px; background: linear-gradient(180deg, #faf8ff, #fff); padding: .75rem .85rem;
  box-shadow: 0 3px 12px rgba(124,77,255,.08); animation: ai-in .3s ease both; }
.ai-card-h { display: flex; align-items: center; gap: .5rem; margin-bottom: .35rem; }
.ai-card-ic { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 9px; background: var(--ai-grad); color: #fff; flex: none; }
.ai-card-ic svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ai-card-kind { font-weight: 700; font-size: .86rem; color: var(--ai-g1); flex: 1; }
.ai-card-st { font-size: .7rem; font-weight: 600; padding: .15rem .55rem; border-radius: 999px; background: #efeaff; color: #5b3fd6; white-space: nowrap; }
.ai-card-ok .ai-card-st, .ai-card.ai-card-ok .ai-card-st { background: #dcfce7; color: #15803d; }
.ai-card.ai-card-no .ai-card-st, .ai-card.ai-card-exp .ai-card-st { background: #f1f3f8; color: #6b7290; }
.ai-card.ai-card-fail .ai-card-st { background: #fee2e2; color: #b91c1c; }
.ai-card.ai-card-ok, .ai-card.ai-card-no, .ai-card.ai-card-exp { background: #fbfbfd; border-color: #e6e8f3; box-shadow: none; }
.ai-card.ai-card-fail { background: #fffafa; border-color: #f5c2c7; box-shadow: none; }
.ai-card-sum { margin: 0 0 .25rem; font-weight: 600; font-size: .9rem; line-height: 1.6; color: var(--ai-ink); }
.ai-card-why { margin: 0 0 .5rem; font-size: .8rem; color: var(--ai-muted); line-height: 1.6; }
.ai-card-res { margin: .2rem 0 0; font-size: .84rem; color: var(--ai-ink); }
.ai-card-res a { font-weight: 600; margin-inline-start: .3rem; }
.ai-card-list { display: flex; flex-direction: column; gap: .3rem; max-height: 220px; overflow-y: auto; margin-bottom: .5rem; }
.ai-card-row { display: flex; gap: .55rem; align-items: flex-start; padding: .45rem .55rem; border-radius: 10px; background: #fff; border: 1px solid #ece9fb; cursor: pointer; font-size: .82rem; line-height: 1.5; }
.ai-card-row input { margin-top: .25rem; accent-color: var(--ai-g2); }
.ai-card-row small { display: block; color: var(--ai-muted); font-size: .74rem; }
.ai-card-lbl { display: block; font-size: .74rem; font-weight: 600; color: var(--ai-muted); margin: .35rem 0 .2rem; }
.ai-card-in { width: 100%; border: 1px solid #dcdff0; border-radius: 10px; padding: .4rem .6rem; font-size: .86rem; background: #fff; font-family: inherit; color: var(--ai-ink); }
.ai-card-in:focus { outline: 0; border-color: #8f9be0; box-shadow: 0 0 0 3px rgba(57,73,171,.1); }
textarea.ai-card-in { resize: vertical; }
.ai-card-2 { display: grid; grid-template-columns: 1.4fr 1fr; gap: .5rem; }
.ai-card-act { display: flex; align-items: center; flex-wrap: wrap; gap: .45rem; margin-top: .6rem; }
.ai-card-act small { flex-basis: 100%; font-size: .7rem; color: var(--ai-muted); }
.ai-card-ok, .ai-card-no { border: 0; border-radius: 999px; padding: .38rem 1rem; font-size: .84rem; font-weight: 600; transition: transform .15s, box-shadow .15s, opacity .15s; }
.ai-card-ok { background: var(--ai-grad); color: #fff; box-shadow: 0 4px 12px rgba(57,73,171,.3); }
.ai-card-ok:hover:not(:disabled) { transform: translateY(-1px); }
.ai-card-no { background: #f1f3f8; color: #4b5270; }
.ai-card-no:hover:not(:disabled) { background: #e6e9f2; }
.ai-card-ok:disabled, .ai-card-no:disabled { opacity: .55; }
.ai-card-ok.busy::after, .ai-card-no.busy::after { content: ''; display: inline-block; width: .8em; height: .8em; margin-inline-start: .4em; border: 2px solid currentColor;
  border-top-color: transparent; border-radius: 50%; animation: ai-spin .8s linear infinite; vertical-align: -.1em; }
/* ج٥: «خذني للصفحة» — the note under the answer while the page opens; the sections it can open land below the top bar */
.ai-go { display: inline-flex; align-items: center; gap: .4rem; margin-top: .5rem; padding: .3rem .8rem; border-radius: 999px; background: #eef0ff;
  color: var(--ai-g2); font-size: .82rem; font-weight: 600; text-decoration: none; }
.ai-go::before { content: ''; width: .8em; height: .8em; border: 2px solid currentColor; border-top-color: transparent; border-radius: 50%; animation: ai-spin .8s linear infinite; }
#schedule, #new-plan, #new-doc { scroll-margin-top: 90px; }

/* ج٤: the full new-task card */
.ai-card-chips { display: flex; flex-wrap: wrap; gap: .35rem; margin-bottom: .35rem; }
.ai-card-chip { display: inline-flex; align-items: center; gap: .3rem; padding: .2rem .6rem; border-radius: 999px; background: #fff; border: 1px solid #dcd6fb; font-size: .8rem; cursor: pointer; }
.ai-card-chip input { accent-color: var(--ai-g2); }
.ai-card-add { font-size: .8rem; padding: .3rem .5rem; color: var(--ai-muted); }
.ai-card-dates { display: grid; grid-template-columns: 1fr; gap: .1rem; }
.ai-card-dt { display: grid; grid-template-columns: 1.3fr 1fr; gap: .35rem; }
.ai-card-in { min-width: 0; }
.ai-card-in[dir="ltr"] { text-align: right; }
.ai-card-lbl small { font-weight: 400; opacity: .8; }
.ai-card-checks { display: flex; flex-direction: column; justify-content: flex-end; gap: .25rem; font-size: .8rem; padding-bottom: .2rem; }
.ai-card-checks label { display: flex; align-items: center; gap: .35rem; cursor: pointer; }
.ai-card-checks input { accent-color: var(--ai-g2); }
.ai-card-diff { cursor: default; font-weight: 500; }
.ai-card [hidden] { display: none !important; }
@media (max-width: 575.98px) { .ai-card-2 { grid-template-columns: 1fr; } }

/* «حوّلها إلى إجراء» — under each recommendation of the weekly analysis / each item the digest asks to act on */
.ai-act { display: inline-flex; align-items: center; gap: .25rem; margin-inline-start: .5rem; padding: .05rem .6rem; border: 1px solid #d9dcff;
  border-radius: 999px; background: #f4f5ff; color: #4338ca; font-size: .78rem; line-height: 1.6; vertical-align: middle; cursor: pointer;
  transition: background .15s, border-color .15s, transform .15s; }
.ai-act:hover, .ai-act:focus-visible { background: linear-gradient(135deg, #4f46e5, #7c3aed); border-color: transparent; color: #fff; transform: translateY(-1px); }

/* ---- د١ photos with a question (2026-11-24): the attach button, the tray of photos waiting to be sent, thumbnails in the bubble */
.ai-composer:has(.ai-attach) { padding-inline-start: 6px; }
.ai-attach { flex: none; display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; border: 0; background: transparent; color: var(--ai-muted);
  transition: background .15s, color .15s, transform .15s; }
.ai-attach:hover { background: #eef0fb; color: var(--ai-g2); transform: scale(1.06); }
.ai-attach svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.ai-form.has-pics .ai-attach { color: var(--ai-g2); }
.ai-tray { margin-bottom: 8px; padding: 8px 10px; border-radius: 16px; background: var(--ai-soft); border: 1px dashed #cfd5f0; animation: ai-in .2s ease both; }
.ai-tray[hidden] { display: none; }
.ai-tray-pics { display: flex; flex-wrap: wrap; gap: 8px; }
.ai-tray-pics:empty { display: none; }
.ai-pic { position: relative; width: 64px; height: 64px; border-radius: 12px; overflow: hidden; background: #e8ebf7; box-shadow: 0 2px 8px rgba(17,26,68,.12); }
.ai-pic img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ai-pic img:not([src]), .ai-pic img[src=""] { opacity: 0; }
.ai-pic:has(img[src=""])::after { content: ''; position: absolute; inset: 0; margin: auto; width: 20px; height: 20px; border: 2px solid var(--ai-g2);
  border-top-color: transparent; border-radius: 50%; animation: ai-spin .8s linear infinite; }
.ai-pic button { position: absolute; top: 3px; inset-inline-end: 3px; width: 22px; height: 22px; border-radius: 50%; border: 0; padding: 0; line-height: 20px;
  background: rgba(31,37,71,.78); color: #fff; font-size: 15px; }
.ai-pic button:hover { background: #1f2547; }
.ai-tray-note { margin: 6px 0 0; font-size: .72rem; color: var(--ai-muted); }
.ai-tray-pics:empty + .ai-tray-note { margin-top: 0; }
.ai-tray-note.warn { color: #b42318; font-weight: 600; }
.ai-q-imgs { display: flex; flex-wrap: wrap; gap: 6px; margin: .15rem 0 .45rem; }
.ai-q-imgs a, .ai-q-imgs > img { display: block; }
.ai-q-imgs img { width: 92px; height: 92px; object-fit: cover; border-radius: 12px; border: 2px solid rgba(255,255,255,.55); background: rgba(255,255,255,.15); }
.ai-q-imgs a:hover img { border-color: #fff; }
.ai-q-gone { font-size: .74rem; opacity: .8; }
.ai-drop { outline: 2px dashed var(--ai-g3); outline-offset: -6px; border-radius: 18px; }
@keyframes ai-spin { to { transform: rotate(360deg); } }
@media (max-width: 575.98px) { .ai-q-imgs img { width: 76px; height: 76px; } }

/* ---- هـ١ «ابدأ بالصورة» on the visit page (2026-11-24) */
.vf { border-color: #dcd6fb; background: linear-gradient(180deg, #faf8ff, #fff); }
.vf-head { display: flex; align-items: center; gap: .6rem; margin-bottom: .6rem; }
.vf-orb { width: 34px; height: 34px; border-radius: 11px; }
.vf-orb svg { width: 18px; height: 18px; }
.vf-row { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.vf-row .form-control { flex: 1 1 200px; min-width: 0; }
.vf-snap { white-space: nowrap; }
.vf-go { background: var(--ai-grad); border: 0; white-space: nowrap; box-shadow: 0 4px 12px rgba(57,73,171,.3); }
.vf-go:disabled { opacity: .45; box-shadow: none; }
.vf-pics { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: .5rem; }
.vf-pics:empty { display: none; }
.vf-cards { display: flex; flex-direction: column; gap: .6rem; margin-top: .9rem; padding-top: .8rem; border-top: 1px dashed #d9d4f5; }
.vf-card .combo, .vf-card .form-select { font-size: .85rem; }
.vf-thumb img { width: 52px; height: 52px; object-fit: cover; border-radius: 10px; border: 1px solid #e3e0f7; }
@media (max-width: 575.98px) { .vf-row > * { flex: 1 1 100%; } }

/* ---- identity 2026-11-26 (approved): the assistant wears «ليل كيان» with the gold ✦ — gold means «the assistant» across the system */
:root { --ai-g1: #0F1636; --ai-g2: #1F2A6B; --ai-g3: #2E3D9A; }
.ai-fab { background: #0F1636; color: #F8BC18; animation: none;
  box-shadow: 0 10px 26px rgba(15,22,54,.4), 0 0 0 5px rgba(248,188,24,.22); }
.ai-fab::after { box-shadow: 0 0 0 0 rgba(248,188,24,.45); }
@keyframes ai-ring { to { box-shadow: 0 0 0 16px rgba(248,188,24,0); } }
.ai-fab-label { color: #fff; }
@media (hover: hover) { .ai-fab:hover:not(.dragging) { box-shadow: 0 16px 34px rgba(15,22,54,.45), 0 0 0 5px rgba(248,188,24,.35); } }
.ai-fab:focus-visible { outline-color: #F8BC18; }
.ai-orb { color: #F8BC18; }