/* EJA AI (ai.ejaservices.co, 11/2026): the platform's page, in the approved redesign's look (a white side menu, white
   cards with a thin line, pill choices, one header with the gold line). Tokens only: light and dark, English and Arabic. */
.aip-page { background: var(--desk-bg, var(--bg)); }
.aip-main { max-width: 1420px; margin: 0 auto; padding: 18px 16px 40px; }
.aip-shell { display: grid; grid-template-columns: 236px minmax(0, 1fr); gap: 20px; align-items: start; }
.aip-side { position: sticky; top: 88px; display: grid; gap: 4px; padding: 8px; background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius-16); box-shadow: var(--shadow-card); }
.aip-side a { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 12px; border-radius: var(--radius-12);
  color: var(--brand); font-weight: 600; text-decoration: none; }
.aip-side a:hover { background: var(--bg2); }
.aip-side a.on { background: var(--brand-soft); }
.aip-side .aip-side-note { padding: 10px 12px 4px; font-size: 12px; color: var(--muted); line-height: 1.5; }
.aip-panel { display: grid; gap: 16px; min-width: 0; }
.aip-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-16); box-shadow: var(--shadow-card);
  padding: 16px; min-width: 0; }
.aip-head { display: flex; align-items: center; gap: 12px; }
.aip-head h1 { font-size: calc(20px * var(--ts, 1)); margin: 0; }
.aip-head p { margin: 2px 0 0; color: var(--muted); font-size: calc(13px * var(--ts, 1)); }
.aip-wallet { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 12px; border: 1px solid var(--line);
  border-radius: var(--radius-pill); background: var(--card); font-size: 13px; }
.aip-wallet select { border: 0; background: transparent; color: var(--text); font: inherit; max-width: 180px; }
.aip-wallet b { color: var(--brand); }

/* the conversation */
.aip-thread { display: grid; gap: 14px; min-height: 240px; align-content: start; }
.aip-empty { color: var(--muted); text-align: center; padding: 40px 12px; }
.aip-msg { display: grid; gap: 6px; max-width: 100%; }
.aip-msg.user { justify-items: end; }
.aip-bubble { padding: 12px 14px; border-radius: var(--radius-16); background: var(--bg2); line-height: 1.65; overflow-wrap: anywhere;
  max-width: min(780px, 100%); }
.aip-msg.user .aip-bubble { background: var(--brand-fill); color: var(--on-brand); white-space: pre-wrap; }
.aip-msg.ai .aip-bubble { background: var(--card); border: 1px solid var(--line); }
.aip-bubble p { margin: 0 0 8px; }
.aip-bubble p:last-child { margin-bottom: 0; }
.aip-bubble ul, .aip-bubble ol { margin: 0 0 8px; padding-inline-start: 22px; }
.aip-bubble h3 { font-size: 15px; margin: 10px 0 6px; }
.aip-bubble code { font-family: var(--font-mono); font-size: 0.92em; background: var(--bg2); padding: 1px 5px; border-radius: 6px; }
.aip-bubble pre { position: relative; direction: ltr; text-align: left; overflow-x: auto; background: var(--bg2); border: 1px solid var(--line);
  border-radius: var(--radius-12); padding: 12px; margin: 0 0 8px; }
.aip-bubble pre code { background: none; padding: 0; white-space: pre; }
.aip-copy { position: absolute; inset-inline-end: 6px; top: 6px; min-height: 30px; padding: 0 10px; font-size: 12px; }
.aip-cite { font-size: 0.75em; vertical-align: super; text-decoration: none; color: var(--brand); padding: 0 1px; }
.aip-meta { display: flex; flex-wrap: wrap; gap: 6px 12px; color: var(--muted); font-size: 12px; }
.aip-meta .aip-backup { color: var(--warn, var(--gold)); }
.aip-sources { display: grid; gap: 4px; font-size: 13px; }
.aip-sources a { color: var(--brand); text-decoration: none; overflow-wrap: anywhere; }

/* the box to write in */
.aip-compose { display: grid; gap: 10px; }
.aip-compose textarea { width: 100%; min-height: 96px; resize: vertical; border: 1px solid var(--line); border-radius: var(--radius-12);
  background: var(--bg2); color: var(--text); padding: 12px; font: inherit; line-height: 1.6; }
.aip-compose textarea:focus { outline: 2px solid var(--gold); outline-offset: 1px; }
.aip-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.aip-row label { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.aip-row select { min-height: 40px; border: 1px solid var(--line); border-radius: var(--radius-pill); background: var(--card);
  color: var(--text); padding: 0 12px; font: inherit; max-width: 100%; }
.aip-row .aip-grow { flex: 1 1 auto; }
.aip-cost { font-size: 13px; color: var(--muted); }
.aip-cost b { color: var(--text); }
.aip-switch { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 12px; border: 1px solid var(--line);
  border-radius: var(--radius-pill); cursor: pointer; font-size: 13px; color: var(--text); }
.aip-switch input { accent-color: var(--brand-fill); }

/* pictures and videos */
.aip-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(240px, 100%), 1fr)); gap: 12px; }
.aip-media { display: grid; gap: 8px; }
.aip-media img, .aip-media video { width: 100%; border-radius: var(--radius-12); border: 1px solid var(--line); background: var(--bg2); }
.aip-job { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-12); }
.aip-job .bar { flex: 1 1 auto; height: 7px; border-radius: 99px; background: var(--line); overflow: hidden; }
.aip-job .bar i { display: block; height: 100%; width: 40%; background: var(--brand-fill); animation: aip-wait 1.4s ease-in-out infinite; }
@keyframes aip-wait { 0% { margin-inline-start: -40%; } 100% { margin-inline-start: 100%; } }
.aip-note { padding: 12px 14px; border-radius: var(--radius-12); background: var(--brand-soft); color: var(--text); font-size: 13px; line-height: 1.6; }
.aip-note.bad { background: color-mix(in srgb, var(--danger, #c0392b) 12%, transparent); }

@media (max-width: 899px) {
  .aip-shell { grid-template-columns: minmax(0, 1fr); }
  .aip-side { position: static; display: flex; overflow-x: auto; padding: 6px; }
  .aip-side a { flex: none; }
  .aip-side .aip-side-note { display: none; }
  .aip-wallet select { max-width: 120px; }
}
@media (prefers-reduced-motion: reduce) { .aip-job .bar i { animation: none; width: 100%; } }
/* a phone: the title never squeezed by the balance chip; the chip shows the balance only */
.aip-page .brand-text b { white-space: nowrap; }
@media (max-width: 600px) {
  .aip-wallet > span:not(.eja-ic), .aip-wallet > svg { display: none; }
  .aip-wallet { padding: 0 10px; }
  .aip-wallet select { max-width: 90px; }
}

/* 11/2026 b: one box for everything, conversations, attachments; the price and its button on their own line */
.aip-new { width: 100%; justify-content: center; margin-bottom: 6px; }
.aip-recent { display: grid; gap: 2px; margin-top: 6px; border-top: 1px solid var(--line); padding-top: 4px; }
.aip-recent-item { text-align: start; background: none; border: 0; padding: 8px 12px; border-radius: var(--radius-12); color: var(--text);
  font: inherit; font-size: 13px; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.aip-recent-item:hover, .aip-recent-item.on { background: var(--bg2); }
.aip-head-tools { display: flex; gap: 6px; flex: none; }
.aip-head h1 { overflow-wrap: anywhere; }
.aip-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.aip-tools .eja-btn.on { background: var(--brand-soft); color: var(--brand); }
.aip-kinds { display: flex; flex-wrap: wrap; gap: 6px; margin-inline-start: auto; }
.aip-chip { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 12px; border: 1px solid var(--line);
  border-radius: var(--radius-pill); background: var(--card); color: var(--text); font: inherit; font-size: 13px; cursor: pointer; text-align: start; }
.aip-chip:hover { background: var(--bg2); }
.aip-chip.on { background: var(--brand-fill); color: var(--on-brand); border-color: transparent; }
.aip-hint { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.aip-hint:empty { display: none; }
.aip-options { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(150px, 100%), 1fr)); gap: 10px 12px; align-items: end; }
.aip-field { display: grid; gap: 4px; min-width: 0; font-size: 12px; color: var(--muted); }
.aip-field.wide { grid-column: 1 / -1; }
.aip-field select { width: 100%; min-height: 40px; border: 1px solid var(--line); border-radius: var(--radius-12); background: var(--card);
  color: var(--text); padding: 0 10px; font: inherit; font-size: 14px; }
.aip-model-pick { display: grid; gap: 6px; }
.aip-model-info { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; margin: 0; font-size: 12px; color: var(--muted); line-height: 1.5; }
.aip-model-info:empty { display: none; }
.aip-unit { color: var(--text); font-weight: 600; }
.aip-tags { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.aip-tag { padding: 1px 8px; border-radius: var(--radius-pill); background: var(--bg2); color: var(--text); font-size: 11px; white-space: nowrap; }
/* the price on the left, the button on the right: never under each other, however long the words */
.aip-go { display: flex; align-items: center; gap: 12px; padding-top: 10px; border-top: 1px solid var(--line); }
.aip-price { flex: 1 1 auto; min-width: 0; display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 6px; font-size: 13px; color: var(--muted); }
.aip-price b { color: var(--text); font-size: 16px; }
.aip-price small { flex-basis: 100%; font-size: 12px; }
.aip-go > .eja-btn { flex: none; white-space: nowrap; }
.aip-short { color: var(--danger, #c0392b); font-weight: 600; }
.aip-files { display: flex; flex-wrap: wrap; gap: 6px; }
.aip-files[hidden] { display: none; }
.aip-file { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; padding: 4px 8px; border: 1px solid var(--line);
  border-radius: var(--radius-12); background: var(--bg2); font-size: 12px; }
.aip-file img { width: 32px; height: 32px; object-fit: cover; border-radius: 6px; }
.aip-file-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 220px; }
.aip-file-x { border: 0; background: none; color: var(--muted); cursor: pointer; padding: 2px; display: inline-flex; }
.aip-compose.drop { outline: 2px dashed var(--gold); outline-offset: 2px; }
.aip-follow { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.aip-msg.ai .aip-follow { justify-content: flex-start; }
.aip-actions { display: flex; gap: 6px; }
.aip-paid { color: var(--text); font-weight: 600; }
.aip-table-wrap { overflow-x: auto; max-width: 100%; }
.aip-table { border-collapse: collapse; width: 100%; font-size: 13px; }
.aip-table th, .aip-table td { border-bottom: 1px solid var(--line); padding: 6px 10px; text-align: start; vertical-align: top; }
.aip-table th { color: var(--muted); font-weight: 600; white-space: nowrap; }
.aip-stack { display: grid; gap: 12px; min-width: 0; }
.aip-convos { display: grid; gap: 6px; }
.aip-convo { display: flex; align-items: center; gap: 6px; padding: 4px; border: 1px solid var(--line); border-radius: var(--radius-12); }
.aip-convo-open { flex: 1 1 auto; min-width: 0; display: grid; gap: 2px; text-align: start; border: 0; background: none; color: var(--text);
  font: inherit; padding: 6px 8px; cursor: pointer; }
.aip-convo-open b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.aip-convo-open small { color: var(--muted); }
.aip-model-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(280px, 100%), 1fr)); gap: 10px; }
.aip-model-card { display: grid; gap: 6px; align-content: start; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius-12); }
.aip-model-card p { margin: 0; font-size: 13px; line-height: 1.5; }
.aip-model-top { display: grid; } .aip-model-top small { color: var(--muted); overflow-wrap: anywhere; }
.aip-prices { display: flex; flex-wrap: wrap; gap: 6px; }
.aip-price-chip { display: inline-flex; gap: 6px; padding: 3px 10px; border-radius: var(--radius-pill); background: var(--bg2); font-size: 12px; }
.aip-balance { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; }
.aip-balance b { display: block; font-size: 32px; color: var(--brand); }
.aip-balance small { color: var(--muted); }
.aip-wallet a { color: var(--brand); font-weight: 700; text-decoration: none; white-space: nowrap; }
.aip-wallet.low a { color: var(--danger, #c0392b); }
.aip-wallet.flash { animation: aip-flash 1.2s ease-out; }
@keyframes aip-flash { 0% { box-shadow: 0 0 0 0 var(--gold); } 100% { box-shadow: 0 0 0 10px transparent; } }
.aip-card h2 { margin: 0; font-size: 16px; }
@media (max-width: 899px) { .aip-recent, .aip-new { display: none; } .aip-kinds { margin-inline-start: 0; } }
@media (prefers-reduced-motion: reduce) { .aip-wallet.flash { animation: none; } }

/* 11/2026 c: the account's letter button and its menu; lists in EJA's look with a search */
.aip-me { position: relative; }
.aip-avatar { width: 40px; height: 40px; border-radius: 50%; border: 0; background: var(--brand-fill); color: var(--on-brand);
  font: inherit; font-weight: 800; font-size: 16px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.aip-menu { position: absolute; inset-inline-end: 0; top: 48px; z-index: 60; min-width: 230px; display: grid; gap: 2px; padding: 6px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-16); box-shadow: var(--shadow-card); }
.aip-menu[hidden] { display: none; }
.aip-menu-who { margin: 0 0 4px; padding: 8px 12px; font-size: 12px; color: var(--muted); border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.aip-menu-item { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 12px; border: 0; border-radius: var(--radius-12);
  background: none; color: var(--text); font: inherit; font-size: 14px; text-align: start; cursor: pointer; }
.aip-menu-item:hover { background: var(--bg2); }
.aip-menu-item svg { color: var(--brand); flex: none; }
.aip-pick-wrap { display: block; }
.aip-pick { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; min-height: 40px; padding: 0 12px;
  border: 1px solid var(--line); border-radius: var(--radius-12); background: var(--card); color: var(--text); font: inherit; font-size: 14px;
  cursor: pointer; text-align: start; }
.aip-pick svg { transform: rotate(90deg); color: var(--muted); flex: none; }
.aip-pick-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.aip-pick-box { display: grid; gap: 10px; min-width: min(420px, 80vw); }
.aip-pick-list { display: grid; gap: 2px; max-height: min(60vh, 520px); overflow: auto; }
.aip-pick-group { margin: 8px 0 2px; padding: 0 10px; font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.aip-pick-item { display: block; width: 100%; padding: 9px 12px; border: 0; border-radius: var(--radius-12); background: none; color: var(--text);
  font: inherit; font-size: 13px; line-height: 1.35; text-align: start; cursor: pointer; }
.aip-pick-item:hover { background: var(--bg2); }
.aip-pick-item.on { background: var(--brand-soft); color: var(--brand); font-weight: 700; }
@media (max-width: 600px) { .aip-page .brand-text > span { display: none; } .aip-page .top-tools { gap: 6px; } }
