/* Rio Ai — الأنماط المشتركة (دردشة + دخول + لوحة تحكم) */
@font-face { font-family: 'Plex Arabic'; font-weight: 400; font-display: swap; src: url(/vendor/fonts/ibm-plex-sans-arabic-arabic-400-normal.woff2) format('woff2'); unicode-range: U+0600-06FF, U+0750-077F, U+0870-08FF, U+FB50-FDFF, U+FE70-FEFF, U+200C-200E; }
@font-face { font-family: 'Plex Arabic'; font-weight: 600; font-display: swap; src: url(/vendor/fonts/ibm-plex-sans-arabic-arabic-600-normal.woff2) format('woff2'); unicode-range: U+0600-06FF, U+0750-077F, U+0870-08FF, U+FB50-FDFF, U+FE70-FEFF, U+200C-200E; }
@font-face { font-family: 'Plex Arabic'; font-weight: 400; font-display: swap; src: url(/vendor/fonts/ibm-plex-sans-arabic-latin-400-normal.woff2) format('woff2'); unicode-range: U+0000-00FF, U+2000-206F, U+20AC, U+2122; }
@font-face { font-family: 'Plex Arabic'; font-weight: 600; font-display: swap; src: url(/vendor/fonts/ibm-plex-sans-arabic-latin-600-normal.woff2) format('woff2'); unicode-range: U+0000-00FF, U+2000-206F, U+20AC, U+2122; }

:root {
  /* Rio Ai — ألوان سادة بأسلوب Claude. النهاري: أبيض مكسور محايد هادئ (بلا اصفرار) */
  --bg: #f7f7f5;
  --panel: #fbfbfa;
  --panel-2: #f1f1ef;
  --hover: #ebebe8;
  --line: #e6e6e3;
  --line-strong: #d4d4cf;
  --fg: #1c1c1b;
  --muted: #6e6d68;
  --accent: #c96442;
  --accent-fg: #ffffff;
  --accent-soft: #f6ebe5;
  --icon: #3a3a37;
  --icon-bg: #efefec;
  --icon-muted: #5f5e5a;
  --chat-bg: #fbfbfa;
  --me: #efefec;
  --bot: #ffffff;
  --danger: #c4323f;
  --ok: #3d8a5a;
  --code-bg: #1f1f1e;
  --code-fg: #f0efec;
  --shadow: none;
  --font: 'Plex Arabic', 'Segoe UI', Tahoma, system-ui, sans-serif;
  --mono: ui-monospace, 'Cascadia Code', Consolas, monospace;
  color-scheme: light;
}
/* الداكن: مأخوذ من Claude نفسه — خلفية #151515، ومربعات #20201f، وحدود #333332، ونص أبيض شبه ناصع #f0efec */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #151515;
    --panel: #181818;
    --panel-2: #20201f;
    --hover: #262625;
    --line: #2a2a29;
    --line-strong: #333332;
    --fg: #f0efec;
    --muted: #a3a29d;
    --accent: #d97757;
    --accent-fg: #ffffff;
    --accent-soft: #2e221d;
    --icon: #f0efec;
    --icon-bg: #262625;
    --icon-muted: #b5b4ae;
    --chat-bg: #151515;
    --me: #262625;
    --bot: #1c1c1b;
    --danger: #f0707a;
    --ok: #6cc18b;
    --code-bg: #0f0f0f;
    --shadow: none;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #151515;
  --panel: #181818;
  --panel-2: #20201f;
  --hover: #262625;
  --line: #2a2a29;
  --line-strong: #333332;
  --fg: #f0efec;
  --muted: #a3a29d;
  --accent: #d97757;
  --accent-fg: #ffffff;
  --accent-soft: #2e221d;
  --icon: #f0efec;
  --icon-bg: #262625;
  --icon-muted: #b5b4ae;
  --chat-bg: #151515;
  --me: #262625;
  --bot: #1c1c1b;
  --danger: #f0707a;
  --ok: #6cc18b;
  --code-bg: #0f0f0f;
  --shadow: none;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: var(--bg); color: var(--fg); font: 15px/1.7 var(--font); -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }

.ic { width: 22px; height: 22px; flex: none; display: block; }
.ic-sm { width: 18px; height: 18px; }
.icon-btn { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; color: var(--icon-muted); flex: none; }
.icon-btn:hover { background: var(--hover); color: var(--fg); }
.icon-btn.on { color: var(--icon); background: var(--icon-bg); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 18px; border-radius: 12px; background: var(--accent); color: var(--accent-fg); font-weight: 600; }
.btn:hover { filter: brightness(1.07); }
.btn:disabled { opacity: .55; cursor: default; }
.btn.ghost { background: var(--panel-2); color: var(--fg); border: 1px solid var(--line); }
.btn.danger { background: transparent; color: var(--danger); border: 1px solid currentColor; }
.btn.small { padding: 6px 12px; font-size: 13px; border-radius: 10px; }

.field { display: grid; gap: 6px; }
.field label { font-size: 13px; color: var(--muted); }
.input { width: 100%; padding: 11px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel-2); outline: 0; }
.input:focus { border-color: var(--accent); }
textarea.input { resize: vertical; line-height: 1.8; }

.toast { position: fixed; inset-inline: 0; bottom: calc(90px + env(safe-area-inset-bottom, 0px)); margin: auto; width: max-content; max-width: calc(100% - 32px); background: var(--fg); color: var(--bg); padding: 10px 18px; border-radius: 12px; z-index: 100; font-size: 14px; box-shadow: 0 6px 24px rgba(0,0,0,.25); }
.toast.err { background: var(--danger); color: #fff; }

dialog { border: 0; border-radius: 18px; padding: 20px; background: var(--panel); color: var(--fg); width: min(400px, calc(100% - 32px)); box-shadow: 0 20px 60px rgba(0,0,0,.35); }
dialog::backdrop { background: rgba(5, 10, 20, .55); }
dialog h3 { margin: 0 0 12px; font-size: 17px; }
dialog .row { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; }

/* ================= تطبيق الدردشة ================= */
.app { display: flex; height: 100%; height: 100svh; overflow: hidden; }
.bar { display: flex; align-items: center; gap: 6px; padding: 10px 12px; padding-top: calc(10px + env(safe-area-inset-top, 0px)); background: var(--panel); border-bottom: 1px solid var(--line); min-height: 60px; flex: none; }
.bar .title { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; }
.bar h1, .bar h2 { margin: 0; font-size: 18px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar h2 { font-size: 16px; }
.avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--accent-soft); flex: none; object-fit: cover; }
/* شعار الواجهة: أيقونة bot من Lucide بألوان المظهر الحالي */
/* شعار الواجهة: أيقونة Rio Ai (lib/icons/app-logo.svg) */
.logo-badge { width: 40px; height: 40px; border-radius: 12px; background: var(--icon-bg); color: var(--icon); display: grid; place-items: center; flex: none; }
.logo-badge .ic { width: 24px; height: 24px; }
.logo-badge.lg { width: 96px; height: 96px; border-radius: 26px; margin: 0 auto 6px; background: linear-gradient(135deg, #00a884, #006d5b); color: #fff; box-shadow: 0 8px 22px color-mix(in srgb, var(--accent) 30%, transparent); }
.logo-badge.lg .ic { width: 54px; height: 54px; }
.install-banner { display: flex; align-items: center; gap: 10px; margin: 0 12px 8px; padding: 8px 8px 8px 12px; border-radius: 14px; background: var(--accent-soft); color: var(--fg); font-size: 14px; }
.install-banner > .ic { color: var(--icon); }
.install-banner span { flex: 1; min-width: 0; }
.install-banner .icon-btn { width: 32px; height: 32px; }
.steps { margin: 0; padding-inline-start: 22px; line-height: 2; }
.credit { font-size: 12px; color: var(--muted); text-align: center; padding: 10px 12px; padding-bottom: calc(18px + env(safe-area-inset-bottom, 0px)); letter-spacing: .02em; flex: none; }
.credit b { color: var(--icon); font-family: var(--mono); font-weight: 600; }
.corner { position: fixed; top: calc(12px + env(safe-area-inset-top, 0px)); inset-inline-start: 12px; }
.sub { font-size: 12px; color: var(--muted); line-height: 1.3; }
.sub.live { color: var(--accent); }

.list-pane { width: 380px; flex: none; display: flex; flex-direction: column; background: var(--panel); border-inline-end: 1px solid var(--line); }
.search { margin: 8px 12px; display: flex; align-items: center; gap: 8px; background: var(--panel-2); border-radius: 12px; padding: 0 12px; color: var(--muted); }
.search input { flex: 1; border: 0; background: none; outline: 0; padding: 9px 0; color: var(--fg); min-width: 0; }
.chats { list-style: none; margin: 0; padding: 0 0 12px; overflow-y: auto; flex: 1; }
.chat-item { display: flex; align-items: center; gap: 12px; padding: 10px 14px; width: 100%; text-align: start; }
.chat-item:hover { background: var(--hover); }
.chat-item.active { background: var(--accent-soft); }
.chat-item .meta { flex: 1; min-width: 0; border-bottom: 1px solid var(--line); padding-bottom: 10px; }
.chat-item:last-child .meta { border-bottom: 0; }
.chat-item .top { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.chat-item .name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.chat-item time { font-size: 12px; color: var(--muted); flex: none; }
.chat-item .prev { display: block; font-size: 13.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-av { width: 46px; height: 46px; border-radius: 50%; background: var(--icon-bg); color: var(--icon); display: grid; place-items: center; flex: none; }
.list-empty { padding: 40px 24px; text-align: center; color: var(--muted); }
.fab-new { position: absolute; bottom: calc(64px + env(safe-area-inset-bottom, 0px)); inset-inline-end: 20px; width: 56px; height: 56px; border-radius: 16px; background: var(--accent); color: #fff; display: none; place-items: center; box-shadow: 0 6px 18px color-mix(in srgb, var(--accent) 40%, transparent); }

.menu { position: absolute; top: 54px; inset-inline-end: 8px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 10px 30px rgba(0,0,0,.18); min-width: 200px; padding: 6px; z-index: 20; }
.menu button, .menu a { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 12px; border-radius: 10px; text-align: start; color: var(--fg); text-decoration: none; font-size: 14.5px; }
.menu button:hover, .menu a:hover { background: var(--hover); }
.menu .danger { color: var(--danger); }
.rel { position: relative; }

.chat-pane { flex: 1; min-width: 0; display: flex; flex-direction: column; background: var(--chat-bg); position: relative; }
.messages { flex: 1; overflow-y: auto; padding: 16px 5% 12px; display: flex; flex-direction: column; gap: 4px; overscroll-behavior: contain; }
.day { align-self: center; background: var(--panel); color: var(--muted); font-size: 12px; padding: 3px 12px; border-radius: 8px; margin: 10px 0; box-shadow: var(--shadow); }
.msg { max-width: min(78%, 720px); padding: 7px 11px 5px; border-radius: 12px; box-shadow: var(--shadow); position: relative; word-wrap: break-word; overflow-wrap: anywhere; margin-top: 4px; }
.msg.user { align-self: flex-end; background: var(--me); border-end-end-radius: 4px; white-space: pre-wrap; }
.msg.assistant { align-self: flex-start; background: var(--bot); border-end-start-radius: 4px; }
.msg .foot { display: flex; align-items: center; justify-content: flex-end; gap: 6px; font-size: 11px; color: var(--muted); margin-top: 2px; white-space: normal; }
.msg .foot button { color: var(--muted); padding: 2px; border-radius: 6px; display: grid; }
.msg .foot button:hover { color: var(--fg); }
.msg.error { background: color-mix(in srgb, var(--danger) 12%, var(--bot)); color: var(--danger); }
.md > :first-child { margin-top: 0; }
.md > :last-child { margin-bottom: 0; }
.md p { margin: 0 0 8px; }
.md ul, .md ol { margin: 4px 0 8px; padding-inline-start: 24px; }
.md li::marker { unicode-bidi: isolate; font-variant-numeric: tabular-nums; }
.md li { margin: 2px 0; }
.md a { color: var(--accent); }
.md blockquote { margin: 6px 0; padding: 2px 12px; border-inline-start: 3px solid var(--accent); color: var(--muted); }
.md code { font-family: var(--mono); font-size: .88em; background: var(--panel-2); padding: 1px 5px; border-radius: 5px; direction: ltr; unicode-bidi: isolate; }
.md hr { border: 0; border-top: 1px solid var(--line); margin: 10px 0; }
.code { direction: ltr; text-align: left; background: var(--code-bg); color: var(--code-fg); border-radius: 10px; margin: 6px 0 10px; overflow: hidden; }
.code .head { display: flex; justify-content: space-between; align-items: center; padding: 4px 6px 4px 12px; font: 12px var(--font); color: #94a3b8; background: rgba(255,255,255,.05); }
.code .head button { color: #94a3b8; display: flex; align-items: center; gap: 4px; padding: 3px 6px; border-radius: 6px; font-size: 12px; }
.code .head button:hover { color: #fff; background: rgba(255,255,255,.08); }
.code pre { margin: 0; padding: 10px 12px; overflow-x: auto; font: 13px/1.6 var(--mono); }
.code pre code { background: none; padding: 0; color: inherit; }
.tbl { overflow-x: auto; margin: 6px 0 10px; }
.md table { border-collapse: collapse; font-size: 14px; min-width: 100%; }
.md th, .md td { border: 1px solid var(--line); padding: 5px 10px; text-align: start; }
.md th { background: var(--panel-2); }
.gen-img { display: block; border-radius: 10px; max-width: 100%; width: 340px; aspect-ratio: 1; object-fit: cover; cursor: zoom-in; background: var(--panel-2); }
.img-cap { font-size: 13px; color: var(--muted); margin-top: 6px; }
.typing { display: flex; gap: 4px; padding: 6px 2px; }
.typing span { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); animation: blink 1.2s infinite; }
.typing span:nth-child(2) { animation-delay: .2s; } .typing span:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }
.cursor::after { content: '▍'; color: var(--accent); animation: blink 1s infinite; margin-inline-start: 2px; }

.welcome { margin: auto; text-align: center; color: var(--muted); max-width: 420px; padding: 20px; }
.welcome h2 { color: var(--fg); margin: 8px 0 4px; font-size: 20px; }
.welcome p { margin: 0 0 16px; }
.hints { display: grid; gap: 8px; }
.hints button { display: flex; align-items: center; gap: 10px; background: var(--panel); padding: 10px 14px; border-radius: 12px; box-shadow: var(--shadow); text-align: start; color: var(--fg); font-size: 14px; }
.hints button:hover { background: var(--hover); }

.to-bottom { position: absolute; inset-inline-start: 16px; bottom: 84px; width: 40px; height: 40px; border-radius: 50%; background: var(--panel); color: var(--muted); display: grid; place-items: center; box-shadow: 0 2px 8px rgba(0,0,0,.2); }

.composer { display: flex; align-items: flex-end; gap: 8px; padding: 8px 10px; padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px)); flex: none; }
.input-wrap { flex: 1; min-width: 0; display: flex; align-items: flex-end; background: var(--panel); border-radius: 24px; padding: 3px 4px; box-shadow: var(--shadow); }
.input-wrap textarea { flex: 1; min-width: 0; border: 0; background: none; outline: 0; resize: none; padding: 9px 6px; max-height: 160px; line-height: 1.6; }
.input-wrap .icon-btn { width: 40px; height: 40px; }
.mode-chip { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--icon); background: var(--icon-bg); padding: 2px 10px; border-radius: 999px; margin: 0 4px 6px; width: max-content; }
.action { width: 48px; height: 48px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; flex: none; box-shadow: 0 2px 8px color-mix(in srgb, var(--accent) 35%, transparent); }
.action:disabled { opacity: .6; }
.action.stop { background: var(--fg); color: var(--bg); }
.rec { flex: 1; display: flex; align-items: center; gap: 10px; background: var(--panel); border-radius: 24px; padding: 4px 6px 4px 14px; box-shadow: var(--shadow); min-height: 46px; }
.rec .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--danger); animation: blink 1s infinite; }
.rec .time { font-variant-numeric: tabular-nums; direction: ltr; }
.rec .label { flex: 1; color: var(--muted); font-size: 14px; }
.rec .icon-btn { color: var(--danger); }

.viewer { padding: 0; background: #000; width: min(900px, 96vw); }
.viewer img { display: block; max-width: 100%; max-height: 85vh; margin: auto; }
.viewer .row { padding: 8px; margin: 0; }

@media (max-width: 760px) {
  .list-pane { width: 100%; border: 0; position: relative; }
  .chat-pane { position: fixed; inset: 0; transform: translateX(-100%); transition: transform .22s ease; z-index: 10; }
  .app[data-view="chat"] .chat-pane { transform: none; }
  .fab-new { display: grid; }
  .chats { padding-bottom: 96px; }
  .msg { max-width: 88%; }
  .messages { padding-inline: 10px; }
  .desk-only { display: none !important; }
}
@media (min-width: 761px) { .mob-only { display: none !important; } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ================= صفحة الدخول ================= */
.login { min-height: 100%; display: grid; place-items: center; padding: 24px 16px; }
.login form { width: min(380px, 100%); background: var(--panel); border-radius: 22px; padding: 28px 22px; display: grid; gap: 14px; box-shadow: 0 10px 40px rgba(17, 27, 43, .1); }
.login .brand { text-align: center; }
.login .brand h1 { margin: 4px 0 0; font-size: 22px; }
.login .brand p { margin: 0; color: var(--muted); font-size: 14px; }
.pw { position: relative; }
.pw .input { padding-inline-end: 44px; }
.pw button { position: absolute; inset-block: 0; inset-inline-end: 4px; color: var(--muted); width: 40px; display: grid; place-items: center; }
.err-msg { color: var(--danger); font-size: 14px; display: flex; gap: 6px; align-items: center; }
.note { color: var(--muted); font-size: 12.5px; text-align: center; display: flex; gap: 6px; align-items: center; justify-content: center; }

/* ================= لوحة التحكم ================= */
.card { background: var(--panel); border-radius: 18px; padding: 18px; display: grid; gap: 14px; box-shadow: var(--shadow); }
.card h2 { margin: 0; font-size: 17px; display: flex; align-items: center; gap: 8px; }
.card .hint { margin: -8px 0 0; color: var(--muted); font-size: 13px; }
.prov { border: 1px solid var(--line); border-radius: 14px; padding: 14px; display: grid; gap: 10px; }
.prov-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.prov-head b { font-size: 16px; }
.badge { font-size: 12px; padding: 2px 10px; border-radius: 999px; background: var(--panel-2); color: var(--muted); }
.badge.ok { background: color-mix(in srgb, var(--ok) 15%, transparent); color: var(--ok); }
.badge.off { background: color-mix(in srgb, var(--danger) 12%, transparent); color: var(--danger); }
.grow { flex: 1; }
.inline { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.inline .input { flex: 1; min-width: 180px; }
.switch { position: relative; width: 48px; height: 28px; flex: none; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; z-index: 1; }
.switch span { position: absolute; inset: 0; border-radius: 999px; background: var(--line); transition: background .15s; }
.switch span::after { content: ''; position: absolute; top: 3px; inset-inline-start: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 3px rgba(0,0,0,.3); }
.switch input:checked + span { background: var(--ok); }
.switch input:checked + span::after { transform: translateX(-20px); }
.switch input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.users { display: grid; gap: 8px; }
.user-row { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; flex-wrap: wrap; }
.user-row .who { flex: 1; min-width: 140px; }
.user-row .who small { color: var(--muted); display: block; font-size: 12.5px; }

/* ================= الإصدار الثالث: حدود أوضح، أزرار أكبر، قائمة أسهل، ميزات جديدة ================= */
.list-pane { border-inline-end: 1px solid var(--line-strong); }
.bar { border-bottom: 1px solid var(--line-strong); gap: 8px; }

/* أزرار الأيقونات: مساحة نقر 44 بكسل وحدود واضحة */
.icon-btn { width: 44px; height: 44px; border: 1px solid transparent; transition: background .15s, border-color .15s, color .15s; touch-action: manipulation; }
.bar .icon-btn { background: var(--panel-2); border-color: var(--line); color: var(--icon-muted); }
.bar .icon-btn:hover, .bar .icon-btn:focus-visible { border-color: var(--line-strong); color: var(--fg); }
.icon-btn:active { transform: scale(.94); }
.icon-btn.sm { width: 34px; height: 34px; }
.icon-btn:disabled { opacity: .4; cursor: default; }
.icon-btn.on { color: var(--accent-fg); background: var(--accent); border-color: var(--accent); }
.btn { border: 1px solid transparent; box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.btn:active { transform: scale(.98); }

/* البحث ومربع الإدخال: حد وظل */
.search { background: var(--panel); border: 1px solid var(--line-strong); box-shadow: 0 1px 2px rgba(11, 20, 26, .06); }
.search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); }

/* قائمة المحادثات: فواصل واضحة */
.chats li { border-bottom: 1px solid var(--line); }
.chat-item .meta { border-bottom: 0; padding-bottom: 0; }
.chat-item { padding: 12px 14px; }
.chat-av { border: 1px solid var(--line); }
.chat-item.active { background: var(--accent-soft); box-shadow: inset -3px 0 0 var(--accent); }

/* القائمة المنسدلة */
.menu { min-width: 270px; padding: 8px; border-radius: 18px; border: 1px solid var(--line-strong); box-shadow: 0 16px 40px rgba(0,0,0,.22); animation: pop .14s ease-out; }
.menu button, .menu a { min-height: 48px; padding: 8px 10px; font-size: 15px; border-radius: 12px; }
.menu .mi { width: 34px; height: 34px; border-radius: 10px; background: var(--panel-2); border: 1px solid var(--line); display: grid; place-items: center; color: var(--icon-muted); flex: none; }
.menu .danger .mi { color: var(--danger); }
.menu-head { display: flex; align-items: center; gap: 12px; padding: 8px 10px 12px; }
.menu-head b { display: block; font-size: 15px; }
.menu-head small { color: var(--muted); font-size: 12.5px; }
.avatar-letter { width: 42px; height: 42px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; font-weight: 600; font-size: 18px; flex: none; }
.menu-sec { font-size: 12px; color: var(--muted); padding: 4px 10px 6px; }
.menu-sep { height: 1px; background: var(--line); margin: 8px 4px; }
.backdrop { position: fixed; inset: 0; background: rgba(5, 10, 20, .35); z-index: 8; }
.list-pane .bar, .chat-pane .bar { z-index: 16; }
.menu { z-index: 20; }
@keyframes pop { from { opacity: 0; transform: translateY(-6px) scale(.98); } to { opacity: 1; transform: none; } }

/* أزرار مجمّعة (المظهر، وخيار الصورة) */
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 14px; padding: 4px; }
.seg button { display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; border-radius: 10px; font-size: 13.5px; color: var(--muted); padding: 6px 8px; }
.menu .seg button { min-height: 40px; }
.seg button.on { background: var(--panel); color: var(--fg); box-shadow: 0 1px 3px rgba(0,0,0,.14); border: 1px solid var(--line); }
.seg.small button { min-height: 32px; font-size: 12.5px; }

/* مربع الكتابة */
.composer { flex-direction: column; align-items: stretch; gap: 6px; }
.compose-extra { display: flex; flex-direction: column; gap: 6px; }
.compose-row { display: flex; align-items: flex-end; gap: 8px; }
.input-wrap { border: 1px solid var(--line-strong); box-shadow: 0 2px 10px rgba(11, 20, 26, .08); padding: 3px; align-items: flex-end; }
.input-wrap:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 16%, transparent), 0 2px 10px rgba(11, 20, 26, .08); }
.input-wrap .icon-btn { width: 40px; height: 40px; border: 0; background: none; }
.input-wrap .icon-btn.on { background: var(--accent); color: var(--accent-fg); }
.action { width: 50px; height: 50px; border: 0; transition: transform .12s, background .15s; }
.action:active { transform: scale(.93); }
.action.recording { background: var(--danger); animation: pulse 1.4s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--danger) 45%, transparent); } 70% { box-shadow: 0 0 0 12px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }

.reply-bar, .attach-bar, .live-text { background: var(--panel); border: 1px solid var(--line-strong); border-radius: 16px; box-shadow: 0 1px 4px rgba(0,0,0,.08); }
.reply-bar { display: flex; align-items: center; gap: 10px; padding: 6px 8px 6px 12px; border-inline-start: 4px solid var(--accent); }
.reply-bar > .ic { color: var(--accent); }
.rb-text { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.4; }
.rb-text b { font-size: 12.5px; color: var(--accent); }
.rb-text span { font-size: 13.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.attach-bar { display: flex; align-items: center; gap: 10px; padding: 6px 8px; }
.attach-bar img { width: 52px; height: 52px; border-radius: 10px; object-fit: cover; border: 1px solid var(--line); flex: none; }
.attach-bar .seg { flex: 1; min-width: 0; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--accent-fg); background: var(--accent); padding: 4px 12px; border-radius: 999px; cursor: pointer; }
.chip::after { content: '×'; margin-inline-start: 2px; opacity: .8; }
.live-text { padding: 10px 14px; font-size: 15px; line-height: 1.7; max-height: 140px; overflow-y: auto; display: flex; align-items: center; gap: 8px; }
.live-text.placeholder { color: var(--muted); font-size: 14px; }
.rec { padding: 4px 6px; border: 1px solid var(--danger); gap: 8px; min-height: 50px; }
.rec canvas { flex: 1; min-width: 0; height: 34px; display: block; }
.rec .time { color: var(--danger); font-weight: 600; padding-inline: 6px; }
.rec .icon-btn { border: 0; background: none; }

/* الرسائل */
.msg { transition: transform .18s, box-shadow .2s; }
.msg.swipe-ready { box-shadow: 0 0 0 2px var(--accent); }
.msg.flash { box-shadow: 0 0 0 3px var(--accent); }
.msg.assistant { border: 1px solid var(--line); }
.quote { display: flex; flex-direction: column; text-align: start; width: 100%; background: color-mix(in srgb, var(--fg) 6%, transparent); border-inline-start: 3px solid var(--accent); border-radius: 8px; padding: 4px 10px; margin-bottom: 6px; line-height: 1.5; }
.quote b { font-size: 12px; color: var(--accent); }
.quote span { font-size: 13px; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.att-img { display: block; max-width: 240px; width: 100%; border-radius: 10px; margin-bottom: 6px; cursor: zoom-in; }
.u-text:empty { display: none; }
.foot .tag { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; color: var(--muted); margin-inline-end: auto; }
.foot .tag .ic { width: 13px; height: 13px; }
.foot button { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 8px; }
.foot button:hover { background: var(--hover); }
@media (hover: hover) { .foot .f-reply { opacity: 0; } .msg:hover .f-reply { opacity: 1; } }
.sources { margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--line-strong); display: flex; flex-wrap: wrap; gap: 6px; }
.src-title { width: 100%; display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.sources a { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; font-size: 12.5px; color: var(--fg); text-decoration: none; background: var(--panel-2); border: 1px solid var(--line); border-radius: 999px; padding: 3px 10px 3px 4px; }
.sources a:hover { border-color: var(--accent); }
.sources .n { width: 20px; height: 20px; border-radius: 50%; background: var(--accent); color: #fff; font-size: 11px; display: grid; place-items: center; flex: none; }
.sources .t { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 220px; }

/* مؤشرات العمل: يكتب، يبحث، يرسم */
.typing-row { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 14px; padding: 2px; }
.typing span { background: var(--accent); }
.gen-wait { width: min(320px, 70vw); }
.shimmer { aspect-ratio: 1; border-radius: 12px; background: linear-gradient(110deg, var(--panel-2) 30%, color-mix(in srgb, var(--accent) 22%, var(--panel-2)) 50%, var(--panel-2) 70%); background-size: 250% 100%; animation: shimmer 1.4s linear infinite; border: 1px solid var(--line); }
.gw-row { display: flex; align-items: center; gap: 8px; margin-top: 8px; color: var(--muted); font-size: 14px; }
.gw-row b { margin-inline-start: auto; font-variant-numeric: tabular-nums; font-weight: 500; }
.spin { animation: spin 1s linear infinite; }
.spin-soft { animation: spin 2.4s linear infinite; color: var(--accent); }
@keyframes shimmer { to { background-position: -150% 0; } }
@keyframes spin { to { transform: rotate(360deg); } }
.to-bottom { width: 44px; height: 44px; border: 1px solid var(--line-strong); bottom: 96px; z-index: 5; }
.to-bottom.live { width: auto; padding: 0 12px; border-radius: 999px; gap: 6px; display: flex; align-items: center; color: var(--accent); }
.tb-dots { display: inline-flex; gap: 3px; }
.tb-dots i { width: 5px; height: 5px; border-radius: 50%; background: currentColor; animation: blink 1.2s infinite; }
.tb-dots i:nth-child(2) { animation-delay: .2s; }
.tb-dots i:nth-child(3) { animation-delay: .4s; }

/* نافذة خيارات الرسالة (ضغط مطوّل) */
dialog.sheet { margin: auto auto 0; width: 100%; max-width: 520px; border-radius: 22px 22px 0 0; padding: 10px 10px calc(14px + env(safe-area-inset-bottom, 0px)); }
.sheet-list { display: grid; gap: 4px; }
.sheet-list button { display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 8px 12px; border-radius: 14px; font-size: 16px; text-align: start; }
.sheet-list button:hover { background: var(--hover); }
.sheet-list .muted { justify-content: center; color: var(--muted); }
.sheet-list .mi { width: 36px; height: 36px; border-radius: 10px; background: var(--panel-2); border: 1px solid var(--line); display: grid; place-items: center; }

@media (max-width: 760px) {
  /* القائمة على الجوال: لوحة تنزلق من الأسفل بعناصر كبيرة */
  .menu { position: fixed; top: auto; bottom: 0; inset-inline: 0; min-width: 0; border-radius: 22px 22px 0 0; padding: 12px 12px calc(16px + env(safe-area-inset-bottom, 0px)); animation: sheet .2s ease-out; }
  .menu::before { content: ''; display: block; width: 40px; height: 4px; border-radius: 4px; background: var(--line-strong); margin: 0 auto 8px; }
  .menu button, .menu a { min-height: 54px; font-size: 16px; }
  .to-bottom { bottom: 104px; }
}
@keyframes sheet { from { transform: translateY(100%); } to { transform: none; } }
@media (prefers-reduced-motion: reduce) { .shimmer, .spin, .spin-soft, .action.recording { animation: none !important; } }

.card { border: 1px solid var(--line); }
.prov, .user-row { border-color: var(--line-strong); }

/* ================= الإصدار الرابع ================= */
/* شريط القائمة لا يغطي شريط المحادثة على الجوال */
.list-pane .bar, .chat-pane .bar { z-index: auto; }

/* الفقاعة بحجم محتواها دائماً: لا تنكمش ولا يخرج النص عنها */
.messages > * { flex-shrink: 0; }
/* مثل واتساب: الرسائل تلتصق بأسفل الشاشة فوق مربع الكتابة، ولا تمرير إلا إذا امتلأت الشاشة */
.messages > :first-child { margin-top: auto; }
.messages > .welcome:first-child { margin-block: auto; }
/* عند فتح الدردشة: آخر الرسائل ترتفع بنعومة */
.messages.rise > * { animation: msg-rise .38s cubic-bezier(.2, .7, .2, 1) both; }
@keyframes msg-rise { from { opacity: 0; transform: translateY(22px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .messages.rise > * { animation: none; } }
/* شريط الرد قابل للضغط للقفز إلى الرسالة الأصلية */
.reply-bar .rb-text { cursor: pointer; }
.msg.pending { min-width: 0; }
/* الرد الطويل بعرض كامل بلا فقاعة */

/* عنصر المحادثة: خلفية الأرشفة والحذف تظهر عند السحب */
.ci { position: relative; overflow: hidden; }
.ci-under { position: absolute; inset: 0; display: none; align-items: center; justify-content: space-between; padding: 0 22px; font-weight: 600; color: #fff; }
.ci-under span { display: flex; align-items: center; gap: 8px; opacity: 0; transition: opacity .1s; }
.ci.show-arch .ci-under, .ci.show-del .ci-under { display: flex; }
.ci.show-arch .ci-under { background: #1f8f6a; }
.ci.show-del .ci-under { background: var(--danger); flex-direction: row-reverse; }
.ci.show-arch .u-arch, .ci.show-del .u-del { opacity: .75; }
.ci.armed .u-arch, .ci.armed .u-del { opacity: 1; transform: scale(1.06); }
.chat-item { position: relative; background: color-mix(in srgb, var(--panel) 66%, transparent); cursor: pointer; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.chat-item.selected { background: var(--accent-soft); }
.chat-item.selected .chat-av { background: var(--accent); color: #fff; border-color: var(--accent); }
.ci-more { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; color: var(--icon-muted); flex: none; opacity: 0; }
.chat-item:hover .ci-more, .ci-more:focus-visible { opacity: 1; }
.ci-more:hover { background: var(--hover); }
@media (pointer: coarse) { .ci-more { display: none; } }
.app.selecting .chat-item .chat-av { border-style: dashed; }

.arch-row { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 14px; text-align: start; border-bottom: 1px solid var(--line); font-weight: 600; }
.arch-row:hover { background: var(--hover); }
.arch-row b { font-size: 12.5px; color: var(--muted); background: var(--panel-2); border: 1px solid var(--line); border-radius: 999px; padding: 1px 10px; font-weight: 500; }
.sel-bar { background: var(--accent-soft); }
.sel-bar h1 { font-size: 17px; }
.sel-bar .icon-btn.danger { color: var(--danger); }

/* زر العودة بعد القفز إلى رسالة مقتبسة */
.jump-back { position: fixed; inset-inline: 0; margin: auto; width: max-content; bottom: calc(150px + env(safe-area-inset-bottom, 0px)); z-index: 30; display: flex; align-items: center; gap: 6px; background: var(--accent); color: #fff; border-radius: 999px; padding: 9px 16px; font-size: 14px; box-shadow: 0 6px 18px rgba(0,0,0,.25); }

.toast { display: flex; align-items: center; gap: 14px; }
.toast-btn { color: var(--accent); font-weight: 700; padding: 2px 6px; border-radius: 8px; background: color-mix(in srgb, var(--bg) 12%, transparent); }
.sheet-title { font-weight: 600; padding: 6px 12px 10px; border-bottom: 1px solid var(--line); margin-bottom: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sheet-list .danger { color: var(--danger); }

/* شريط التسجيل لا يدفع زر الإنهاء خارج الشاشة */
.rec { min-width: 0; flex: 1 1 0; overflow: hidden; }
.rec canvas { flex: 1 1 0; width: 0; min-width: 0; }
.typing.mini { display: inline-flex; gap: 3px; padding: 0; }
.typing.mini span { width: 5px; height: 5px; }

.chat-av.ok { background: color-mix(in srgb, var(--ok) 18%, transparent); color: var(--ok); }
.chat-av.bad { background: color-mix(in srgb, var(--danger) 15%, transparent); color: var(--danger); }
.user-row .res { color: var(--fg); margin-top: 2px; }
.user-row .mdl { text-align: right; }

/* ================= الإصدار السادس ================= */
/* خلفية زخرفية خفيفة داخل المحادثة */
.chat-pane { background-color: var(--chat-bg); background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240' viewBox='0 0 240 240'%3E%3Cg fill='none' stroke='%23000' stroke-opacity='0.06' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M22 30h34a8 8 0 0 1 8 8v16a8 8 0 0 1-8 8H36l-10 8v-8h-4a8 8 0 0 1-8-8V38a8 8 0 0 1 8-8z'/%3E%3Cpath d='M120 18l4 9 9 4-9 4-4 9-4-9-9-4 9-4z'/%3E%3Ccircle cx='196' cy='40' r='12'/%3E%3Cpath d='M190 40h12M196 34v12'/%3E%3Cpath d='M40 120c6-10 18-10 24 0s18 10 24 0'/%3E%3Cpath d='M150 104l26 12-26 12 6-12z'/%3E%3Crect x='196' y='110' width='24' height='18' rx='4'/%3E%3Cpath d='M202 128v6l6-6'/%3E%3Cpath d='M30 186a10 10 0 0 1 20 0c0 10-10 16-10 16s-10-6-10-16z'/%3E%3Ccircle cx='110' cy='184' r='3'/%3E%3Ccircle cx='124' cy='184' r='3'/%3E%3Ccircle cx='138' cy='184' r='3'/%3E%3Cpath d='M186 196l8-14 8 14z'/%3E%3Cpath d='M210 200h14'/%3E%3Cpath d='M90 60q10-12 20 0t20 0'/%3E%3Cpath d='M84 150l10 10M94 150l-10 10'/%3E%3C/g%3E%3C/svg%3E"); background-size: 240px 240px; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .chat-pane { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240' viewBox='0 0 240 240'%3E%3Cg fill='none' stroke='%23fff' stroke-opacity='0.035' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M22 30h34a8 8 0 0 1 8 8v16a8 8 0 0 1-8 8H36l-10 8v-8h-4a8 8 0 0 1-8-8V38a8 8 0 0 1 8-8z'/%3E%3Cpath d='M120 18l4 9 9 4-9 4-4 9-4-9-9-4 9-4z'/%3E%3Ccircle cx='196' cy='40' r='12'/%3E%3Cpath d='M190 40h12M196 34v12'/%3E%3Cpath d='M40 120c6-10 18-10 24 0s18 10 24 0'/%3E%3Cpath d='M150 104l26 12-26 12 6-12z'/%3E%3Crect x='196' y='110' width='24' height='18' rx='4'/%3E%3Cpath d='M202 128v6l6-6'/%3E%3Cpath d='M30 186a10 10 0 0 1 20 0c0 10-10 16-10 16s-10-6-10-16z'/%3E%3Ccircle cx='110' cy='184' r='3'/%3E%3Ccircle cx='124' cy='184' r='3'/%3E%3Ccircle cx='138' cy='184' r='3'/%3E%3Cpath d='M186 196l8-14 8 14z'/%3E%3Cpath d='M210 200h14'/%3E%3Cpath d='M90 60q10-12 20 0t20 0'/%3E%3Cpath d='M84 150l10 10M94 150l-10 10'/%3E%3C/g%3E%3C/svg%3E"); } }
:root[data-theme="dark"] .chat-pane { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240' viewBox='0 0 240 240'%3E%3Cg fill='none' stroke='%23fff' stroke-opacity='0.035' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M22 30h34a8 8 0 0 1 8 8v16a8 8 0 0 1-8 8H36l-10 8v-8h-4a8 8 0 0 1-8-8V38a8 8 0 0 1 8-8z'/%3E%3Cpath d='M120 18l4 9 9 4-9 4-4 9-4-9-9-4 9-4z'/%3E%3Ccircle cx='196' cy='40' r='12'/%3E%3Cpath d='M190 40h12M196 34v12'/%3E%3Cpath d='M40 120c6-10 18-10 24 0s18 10 24 0'/%3E%3Cpath d='M150 104l26 12-26 12 6-12z'/%3E%3Crect x='196' y='110' width='24' height='18' rx='4'/%3E%3Cpath d='M202 128v6l6-6'/%3E%3Cpath d='M30 186a10 10 0 0 1 20 0c0 10-10 16-10 16s-10-6-10-16z'/%3E%3Ccircle cx='110' cy='184' r='3'/%3E%3Ccircle cx='124' cy='184' r='3'/%3E%3Ccircle cx='138' cy='184' r='3'/%3E%3Cpath d='M186 196l8-14 8 14z'/%3E%3Cpath d='M210 200h14'/%3E%3Cpath d='M90 60q10-12 20 0t20 0'/%3E%3Cpath d='M84 150l10 10M94 150l-10 10'/%3E%3C/g%3E%3C/svg%3E"); }
.messages { background: transparent; }

/* حجم نص المحادثة: --fs من 1 (الحالي، الأصغر) حتى 1.6 */
.messages { font-size: calc(15px * var(--fs, 1)); }
.msg .foot { font-size: 11px; }
.fs-row { display: flex; align-items: center; gap: 6px; padding: 2px 4px 6px; }
.fs-row button { flex: 1; justify-content: center; min-height: 42px !important; border: 1px solid var(--line); background: var(--panel-2); }
.fs-row button:disabled { opacity: .4; cursor: default; }
.fs-row b { min-width: 52px; text-align: center; font-variant-numeric: tabular-nums; }

/* إخفاء قائمة المحادثات على الكمبيوتر والتابلت، والمحادثة تأخذ العرض كاملاً */
@media (min-width: 761px) {
  .list-pane { transition: margin .2s ease, opacity .2s; }
  .app.side-closed .list-pane { margin-inline-start: -380px; opacity: 0; pointer-events: none; }
  /* عمود المحادثة في الوسط بعرض مريح للقراءة */
  .messages { padding-inline: max(4%, calc((100% - 920px) / 2)); }
  .composer { padding-inline: max(10px, calc((100% - 940px) / 2)); }
}
/* التابلت: قائمة أضيق */
@media (min-width: 761px) and (max-width: 1100px) {
  .list-pane { width: 320px; }
  .app.side-closed .list-pane { margin-inline-start: -320px; }
}

/* لوحة التحكم: الحظر الصامت */
.guard-row { margin: 0 0 12px; padding: 10px 12px; border-radius: 12px; background: color-mix(in srgb, #f59e0b 14%, transparent); color: var(--fg); }
.blocked-tag { color: #d97706; font-weight: 600; }

/* زر البحث في الإنترنت داخل مربع الكتابة */
.input-wrap .search-toggle { display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; white-space: nowrap; width: auto; min-width: 40px; padding: 0 10px; gap: 5px; border-radius: 20px; color: var(--muted); transition: background .15s, color .15s; }
.input-wrap .search-toggle .lbl { font-size: 13px; font-weight: 600; }
.input-wrap .search-toggle:hover { color: var(--fg); background: var(--hover); }
.input-wrap .search-toggle.on, .input-wrap .search-toggle.on:hover { color: var(--accent-fg); background: var(--accent); }
.input-wrap.searching { border-color: color-mix(in srgb, var(--accent) 55%, var(--line-strong)); }
@media (max-width: 420px) {
  .input-wrap .search-toggle:not(.on) { padding: 0; width: 40px; }
  .input-wrap .search-toggle:not(.on) .lbl { display: none; }
}

/* الإصدار السابع: الإعدادات الشخصية والذاكرة */
.prefs-dlg { width: min(560px, calc(100vw - 24px)); max-height: min(88vh, 820px); padding: 0; border: 0; border-radius: 18px; background: var(--panel); color: var(--fg); box-shadow: 0 20px 60px rgba(0, 0, 0, .3); overflow: hidden; }
.prefs-dlg[open] { display: flex; flex-direction: column; }
.prefs-dlg::backdrop { background: rgba(0, 0, 0, .45); }
.prefs-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.prefs-head b { display: inline-flex; align-items: center; gap: 8px; font-size: 16px; }
.prefs-body { padding: 14px 16px 18px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; }
.prefs-body label { font-weight: 600; font-size: 14px; margin-top: 6px; }
.prefs-body textarea { width: 100%; resize: vertical; min-height: 76px; line-height: 1.6; font: inherit; }
.prefs-body .hint { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; margin: 0; }
.prefs-body > .btn { align-self: flex-start; }
.prefs-sec { display: flex; align-items: center; gap: 8px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.prefs-sec b { font-size: 15px; }
.prefs-sec small { margin-inline-start: auto; color: var(--muted); }
.mem-add { display: flex; gap: 8px; }
.mem-add .input { flex: 1; min-width: 0; }
.mem-list { list-style: none; margin: 4px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.mem-list li { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 12px; background: var(--panel-2); font-size: 14px; }
.mem-list li span { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.mem-list li.empty { color: var(--muted); justify-content: center; }
#memClear { align-self: flex-start; margin-top: 6px; }

/* ملاحظات الذاكرة تحت الرد */
.mem-notes { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.mem-note { display: flex; align-items: flex-start; gap: 6px; font-size: 13px; color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, transparent); padding: 6px 10px; border-radius: 10px; }
.mem-note.forgot { color: var(--muted); background: var(--panel-2); }
.mem-note i, .mem-suggest i { font-style: normal; }
.mem-note .ic { flex: none; margin-top: 2px; }
.mem-suggest { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; font-size: 13.5px; padding: 8px 10px; border-radius: 12px; border: 1px dashed color-mix(in srgb, var(--accent) 55%, transparent); }
.mem-suggest .ms-text { display: flex; gap: 6px; align-items: flex-start; flex: 1; min-width: 180px; }
.mem-suggest .ms-text .ic { flex: none; margin-top: 2px; color: var(--accent); }
.mem-suggest .ms-btns { display: flex; gap: 6px; }
.reply-bar.editing { border-inline-start-color: #d97706; }

/* إعادة الرد والتعديل */
.foot .f-regen, .foot .f-edit { display: inline-grid; }
.foot .f-regen[hidden], .foot .f-edit[hidden] { display: none; }

/* حفظ PDF أو طباعة: المحادثة وحدها */
@media print {
  .list-pane, .chat-pane > header, .composer, .to-bottom, .jump-back, .menu, .foot button, .backdrop, dialog, #toasts, .toast { display: none !important; }
  html, body, .app, .chat-pane, .messages { height: auto !important; min-height: 0 !important; overflow: visible !important; position: static !important; background: #fff !important; color: #000 !important; }
  .app { display: block !important; }
  .chat-pane { margin: 0 !important; background-image: none !important; }
  .messages { padding: 0 !important; }
  .msg { break-inside: avoid; box-shadow: none !important; border: 1px solid #ccc !important; background: #fff !important; color: #000 !important; max-width: 100% !important; }
  .msg.user { background: #eef7ea !important; }
}

/* ---------- التوهج في الخلفية: «سماء الليل» (اعتمده المالك) ----------
   الداكن: نجوم بيضاء ودرب مجرّة بأخضر التطبيق. النهاري: نفس العناصر بأخضر غامق ونجوم خضراء فحمية (درجة «متوسط»).
   يظهر في قائمة المحادثات والدردشة، قوياً قبل بدء الدردشة ثم يخفّ بعدها، ويتنفّس أثناء التفكير. ثابت لكل المستخدمين. */
:root {
  --g1: 0 92 75;      /* #005c4b أخضر غامق */
  --g2: 0 112 90;     /* #00705a */
  --g3: 18 128 100;   /* #128064 */
  --star: 16 58 48;   /* نجوم خضراء فحمية */
  --star-a: .7;
  --aura-k: 1;        /* قوة التوهج */
  --aura-calm: .45;   /* شفافيته بعد بدء الدردشة */
  /* ذرّة التفكير */
  --at-o1: #1f3a44; --at-o2: #2f6470; --at-o3: #6f969e; --at-n: #e08a1e; --at-n-glow: 224 138 30; --at-e1: #e5484d; --at-e2: #1d8f80;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --g1: 0 168 132; --g2: 14 124 134; --g3: 45 212 160; --star: 255 255 255; --star-a: .9; --aura-k: .85; --aura-calm: .3;
    --at-o1: #5eead4; --at-o2: #2dd4a0; --at-o3: #7cc6e8; --at-n: #f5a83a; --at-n-glow: 245 168 58; --at-e1: #ff6b6b; --at-e2: #ffffff;
  }
}
:root[data-theme="dark"] {
  --g1: 0 168 132; --g2: 14 124 134; --g3: 45 212 160; --star: 255 255 255; --star-a: .9; --aura-k: .85; --aura-calm: .3;
  --at-o1: #5eead4; --at-o2: #2dd4a0; --at-o3: #7cc6e8; --at-n: #f5a83a; --at-n-glow: 245 168 58; --at-e1: #ff6b6b; --at-e2: #ffffff;
}

.list-pane { position: relative; }
.aura { position: absolute; inset: 0; overflow: hidden; pointer-events: none; z-index: 0; transition: opacity 1.4s ease; --mx: 50%; --my: 65%; }
.aura i { position: absolute; display: block; }
.list-pane > :not(.aura, .fab-new), .messages, .composer { position: relative; z-index: 1; }
/* رؤوس القوائم فوق الطبقة المعتمة (8) حتى تعمل قوائمها، وتحت لوحة الدردشة على الجوال (10) */
.list-pane > .bar { z-index: 9; }
.list-pane > .fab-new { z-index: 2; }
.chat-pane > header.bar { position: relative; z-index: 9; }
.chat-pane > .to-bottom { z-index: 5; }
/* بعد بدء الدردشة يخفّ، وعند التفكير يتنفّس */
.chat-pane.calm > .aura { opacity: var(--aura-calm); }
.chat-pane.live > .aura { animation: aura-breathe 3.4s ease-in-out infinite; }
@keyframes aura-breathe { 0%, 100% { opacity: .8; } 50% { opacity: 1; } }

/* أفق يصعد من الأسفل */
.aura .floor { left: -30%; right: -30%; bottom: -28%; height: 56%; border-radius: 50%; background: radial-gradient(ellipse at 50% 100%, rgb(var(--g1) / calc(.5 * var(--aura-k))) 0%, rgb(var(--g2) / calc(.22 * var(--aura-k))) 42%, transparent 72%); transform-origin: 50% 100%; animation: aura-rise 12s ease-in-out infinite alternate; }
/* درب المجرّة القطري */
.aura .milky { inset: -20%; background: linear-gradient(118deg, transparent 30%, rgb(var(--g3) / calc(.16 * var(--aura-k))) 43%, rgb(var(--g1) / calc(.26 * var(--aura-k))) 50%, rgb(var(--g2) / calc(.16 * var(--aura-k))) 57%, transparent 70%); filter: blur(18px); animation: aura-rise 18s ease-in-out infinite alternate; }
/* نجوم بطبقتين تنجرف وتتلألأ */
.aura .st1, .aura .st2 { inset: -60%; background-repeat: repeat; will-change: transform; }
.aura .st1 {
  background-image:
    radial-gradient(1.6px 1.6px at 12px 18px, rgb(var(--star) / var(--star-a)), transparent),
    radial-gradient(1.3px 1.3px at 64px 92px, rgb(var(--star) / var(--star-a)), transparent),
    radial-gradient(1.7px 1.7px at 118px 40px, rgb(var(--star) / var(--star-a)), transparent),
    radial-gradient(1.3px 1.3px at 150px 130px, rgb(var(--star) / var(--star-a)), transparent),
    radial-gradient(1.5px 1.5px at 36px 150px, rgb(var(--star) / var(--star-a)), transparent),
    radial-gradient(1.3px 1.3px at 96px 8px, rgb(var(--star) / var(--star-a)), transparent),
    radial-gradient(1.6px 1.6px at 170px 70px, rgb(var(--star) / var(--star-a)), transparent);
  background-size: 170px 170px;
  animation: aura-drift 140s linear infinite, aura-twinkle 3.6s ease-in-out infinite alternate;
}
.aura .st2 {
  background-image:
    radial-gradient(2.3px 2.3px at 40px 60px, rgb(var(--star) / var(--star-a)), transparent),
    radial-gradient(2.6px 2.6px at 210px 170px, rgb(var(--star) / var(--star-a)), transparent),
    radial-gradient(2.1px 2.1px at 150px 250px, rgb(var(--star) / var(--star-a)), transparent),
    radial-gradient(2.8px 2.8px at 260px 40px, rgb(var(--g3) / .85), transparent);
  background-size: 290px 290px;
  animation: aura-drift 220s linear infinite reverse, aura-twinkle 5.2s ease-in-out infinite alternate-reverse;
}
/* شهاب يعبر أحياناً */
.aura .shoot { width: 36%; height: 1.6px; top: 14%; right: 6%; rotate: -28deg; border-radius: 2px; background: linear-gradient(90deg, rgb(var(--star) / .9), rgb(var(--g3) / .45) 30%, transparent); opacity: 0; animation: aura-shoot 9s ease-in infinite 2s; }
/* بقعة ضوء خفيفة تتبع الإصبع أو المؤشر */
.aura .spot { width: 60%; aspect-ratio: 1; left: var(--mx); top: var(--my); translate: -50% -50%; border-radius: 50%; background: radial-gradient(circle, rgb(var(--g2) / calc(.14 * var(--aura-k))), transparent 68%); transition: left 1.8s cubic-bezier(.2, .7, .2, 1), top 1.8s cubic-bezier(.2, .7, .2, 1); }
.chat-pane.live .aura .st1 { animation-duration: 140s, 1.2s; }
.chat-pane.live .aura .shoot { animation-duration: 3s; animation-delay: 0s; }
.chat-pane.live .aura .floor { animation-duration: 3s; }
@keyframes aura-rise { from { transform: scaleY(.9); } to { transform: scaleY(1.1); } }
@keyframes aura-drift { to { transform: translate(170px, 85px); } }
@keyframes aura-twinkle { 0% { opacity: .5; } 100% { opacity: 1; } }
@keyframes aura-shoot { 0% { opacity: 0; transform: translateX(0); } 2% { opacity: 1; } 10% { opacity: 0; transform: translateX(-260%); } 100% { opacity: 0; transform: translateX(-260%); } }

@media (prefers-reduced-motion: reduce) { .aura i, .chat-pane.live > .aura { animation: none !important; transition: none !important; } .aura .shoot { display: none; } }
@media print { .aura { display: none !important; } }

/* أيقونة واحدة لتبديل الفاتح والداكن: على الشاشات الواسعة تظهر في قائمة المحادثات فقط، إلا إذا أُخفيت القائمة */
@media (min-width: 761px) {
  .app:not(.side-closed) .chat-pane [data-theme-toggle] { display: none; }
}

/* ---------- التفكير: ذرّة متحركة و«جاري التفكير» بنقاط تزداد ---------- */
.atom { width: 24px; height: 24px; flex: none; overflow: visible; }
.atom .o1 { stroke: var(--at-o1); } .atom .o2 { stroke: var(--at-o2); } .atom .o3 { stroke: var(--at-o3); }
.atom .e1 { fill: var(--at-e1); } .atom .e2 { fill: var(--at-e2); }
.atom .nuc { fill: var(--at-n); filter: drop-shadow(0 0 4px rgb(var(--at-n-glow) / .8)); }
.typing-row.thinking { gap: 8px; }
.typing-row.thinking .tw-label { color: var(--fg); }
.think-dots { display: inline-flex; min-width: 1.2em; }
.think-dots b { font-weight: 600; opacity: 0; animation: 1.6s steps(1, end) infinite; }
.think-dots b:nth-child(1) { animation-name: think-d1; } .think-dots b:nth-child(2) { animation-name: think-d2; } .think-dots b:nth-child(3) { animation-name: think-d3; }
@keyframes think-d1 { 0% { opacity: 0; } 25%, 100% { opacity: 1; } }
@keyframes think-d2 { 0%, 25% { opacity: 0; } 50%, 100% { opacity: 1; } }
@keyframes think-d3 { 0%, 50% { opacity: 0; } 75%, 100% { opacity: 1; } }
#chatStatus.is-thinking { color: var(--accent); }
@media (prefers-reduced-motion: reduce) { .think-dots b { animation: none !important; opacity: 1; } }

/* أيقونة المحادثة في القائمة: فقاعة ممتلئة بثلاث نقاط */
.chat-av .ic { width: 26px; height: 26px; }

/* آيفون: التطبيق بارتفاع الجزء الظاهر فوق لوحة المفاتيح */
.ios-kb .app { height: var(--vvh, 100svh); }
@media (max-width: 760px) { .ios-kb .chat-pane { bottom: auto; height: var(--vvh, 100%); } }

/* ---------- لوحة التحكم: الاستهلاك والرصيد ---------- */
.uc-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.uc-stat { border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; display: grid; gap: 2px; background: var(--panel-2); min-width: 0; }
.uc-stat span { font-size: 12.5px; color: var(--muted); }
.uc-stat b { font-size: 22px; font-weight: 600; font-variant-numeric: tabular-nums; text-align: start; }
.uc-stat small { font-size: 11.5px; color: var(--muted); min-height: 1.2em; }
.uc-stat.bal { background: color-mix(in srgb, var(--accent) 9%, var(--panel-2)); border-color: color-mix(in srgb, var(--accent) 30%, var(--line)); }
.uc-stat.bal b { color: var(--accent); }
.uc-chart-box { border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px 8px; display: grid; gap: 8px; }
.uc-chart-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px; }
.uc-legend { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12px; }
.uc-legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.uc-legend .lg-all { background: color-mix(in srgb, var(--accent) 35%, transparent); }
.uc-legend .lg-me { background: var(--accent); margin-inline-start: 6px; }
.uc-chart { height: 120px; display: grid; grid-template-columns: repeat(14, 1fr); gap: 4px; align-items: end; direction: ltr; }
.uc-col { height: 100%; display: grid; grid-template-rows: 1fr auto; gap: 4px; align-items: end; min-width: 0; }
.uc-bar { width: 100%; border-radius: 5px 5px 2px 2px; background: color-mix(in srgb, var(--accent) 35%, transparent); position: relative; display: flex; align-items: flex-end; overflow: hidden; transition: height .4s ease; }
.uc-bar i { display: block; width: 100%; background: var(--accent); }
.uc-col span { font-size: 10.5px; color: var(--muted); text-align: center; font-variant-numeric: tabular-nums; }
.uc-table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 14px; }
.uc-table { width: 100%; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; }
.uc-table th { text-align: start; font-weight: 600; font-size: 12.5px; color: var(--muted); padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.uc-table td { padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.uc-table tbody tr:last-child td { border-bottom: 0; }
.uc-row { cursor: pointer; }
.uc-row:hover, .uc-row.open { background: var(--hover); }
.uc-row:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.uc-user { display: grid; line-height: 1.35; }
.uc-user small { color: var(--muted); font-size: 12px; text-align: start; }
.uc-table .muted, .uc-detail .muted { color: var(--muted); }
.uc-detail td { background: var(--panel-2); white-space: normal; }
.uc-kinds { display: flex; flex-wrap: wrap; gap: 8px; }
.uc-kinds span { display: grid; gap: 1px; padding: 6px 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); min-width: 110px; }
.uc-kinds b { font-size: 12.5px; font-weight: 600; }
.uc-kinds i { font-style: normal; font-size: 15px; color: var(--accent); text-align: start; }
.uc-kinds small { font-size: 11px; color: var(--muted); }

/* الحرارة داخل صف النموذج */
.ft-range { flex: 1 1 160px; accent-color: var(--accent); }
.ft-range:disabled { opacity: .45; }
.ft-val { min-width: 3.6em; text-align: center; font-variant-numeric: tabular-nums; }
.ft-auto { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); cursor: pointer; }

/* استهلاك المستخدم في إعداداته، وتكلفة الدردشة للمدير */
.my-usage { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.my-usage span { display: grid; gap: 2px; padding: 10px; border-radius: 12px; background: var(--panel-2); border: 1px solid var(--line); text-align: center; }
.my-usage small { color: var(--muted); font-size: 12px; }
.my-usage b { font-size: 17px; font-variant-numeric: tabular-nums; }
.chat-cost { display: flex; align-items: center; gap: 10px; padding: 10px 12px; margin: 2px 0 4px; border-radius: 12px; background: color-mix(in srgb, var(--accent) 9%, var(--panel-2)); font-size: 14px; }
.chat-cost span { flex: 1; }
.chat-cost b { color: var(--accent); font-variant-numeric: tabular-nums; }

.uc-manual { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; padding: 10px 12px; border-radius: 12px; border: 1px dashed color-mix(in srgb, var(--accent) 45%, var(--line)); font-size: 13.5px; }
.uc-manual span { flex: 1 1 260px; color: var(--muted); }
.uc-manual a { color: var(--accent); }
.uc-manual .input { width: 130px; flex: 0 0 auto; }

/* ---------- إصلاحات الأداء والثبات (2026-10-18) ---------- */
/* اللمس: المتصفح يتولى التمرير العمودي مباشرة، والسحب الأفقي للرد والأرشفة فقط */
.msg, .chat-item { touch-action: pan-y; }
/* الرد الطويل داخل فقاعته دائماً، والجداول والأكواد العريضة تتحرك أفقياً داخلها */
.msg.assistant { max-width: min(92%, 860px); }
.msg .md { min-width: 0; overflow-wrap: anywhere; }
.msg .tbl { overflow-x: auto; max-width: 100%; -webkit-overflow-scrolling: touch; }
.msg .code pre { overflow-x: auto; max-width: 100%; }
/* صورة مرفقة: مساحة ثابتة قبل التحميل فلا تقفز الرسائل */
.att-img { aspect-ratio: 4 / 3; object-fit: cover; background: var(--panel-2); }
/* عارض الصور: مؤشر تحميل ورسالة خطأ */
.viewer { position: relative; min-height: 120px; }
.viewer .v-state { position: absolute; inset: 0 0 52px; display: none; place-items: center; color: #e9edef; pointer-events: none; }
.viewer.loading .v-state, .viewer.failed .v-state { display: grid; }
.viewer .v-spin { width: 34px; height: 34px; border-radius: 50%; border: 3px solid rgb(255 255 255 / .25); border-top-color: #00a884; animation: v-spin .8s linear infinite; }
.viewer .v-err { display: none; gap: 10px; align-items: center; pointer-events: auto; }
.viewer.failed .v-spin { display: none; }
.viewer.failed .v-err { display: inline-flex; }
.viewer.loading img, .viewer.failed img { visibility: hidden; min-height: 200px; }
@keyframes v-spin { to { rotate: 360deg; } }

/* التوهج: طبقات بحجم الشاشة تقريباً بدل ضعفيها (كانت تستهلك نحو 200 ميغابايت من ذاكرة رسومات الجوال)،
   وبلا فلتر تمويه، ويتوقف في اللوحة المخفية على الجوال */
.aura { contain: strict; }
.aura .milky { inset: 0; filter: none; background: linear-gradient(118deg, transparent 22%, rgb(var(--g3) / calc(.12 * var(--aura-k))) 38%, rgb(var(--g1) / calc(.22 * var(--aura-k))) 50%, rgb(var(--g2) / calc(.12 * var(--aura-k))) 62%, transparent 78%); }
.aura .st1 { inset: -170px 0 0 -170px; animation: aura-drift-1 140s linear infinite, aura-twinkle 3.6s ease-in-out infinite alternate; }
.aura .st2 { inset: -290px 0 0 -290px; animation: aura-drift-2 220s linear infinite, aura-twinkle 5.2s ease-in-out infinite alternate-reverse; }
@keyframes aura-drift-1 { to { transform: translate(170px, 170px); } }
@keyframes aura-drift-2 { to { transform: translate(290px, 290px); } }
.chat-pane.live .aura .st1 { animation-duration: 140s, 1.2s; }
@media (max-width: 760px) {
  .app[data-view="chat"] .list-pane > .aura, .app:not([data-view="chat"]) .chat-pane > .aura { display: none; }
}

/* قائمة ⋮ داخل الدردشة: شبكة 3 أزرار في السطر، كبيرة للإصبع وبأسماء قصيرة */
#chatMenu { min-width: 300px; }
.menu-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; padding: 2px; }
.menu-grid[hidden] { display: none; }
#chatMenu .menu-grid button { flex-direction: column; justify-content: center; align-items: center; gap: 6px; min-height: 74px; padding: 10px 4px; border-radius: 14px; background: var(--panel-2); border: 1px solid var(--line); font-size: 13px; text-align: center; line-height: 1.3; }
#chatMenu .menu-grid button .ic { width: 24px; height: 24px; color: var(--icon); }
#chatMenu .menu-grid button:hover { background: var(--hover); }
#chatMenu .menu-grid button.danger { color: var(--danger); }
#chatMenu .menu-grid button.danger .ic { color: var(--danger); }

/* نتائج البحث داخل الرسائل */
.msg-results { position: relative; z-index: 1; border-top: 1px solid var(--line); }
.msg-results .mr-head { padding: 10px 16px 6px; font-size: 12.5px; font-weight: 600; color: var(--muted); }
.msg-results ul { list-style: none; margin: 0; padding: 0; }
.msg-results li button { display: grid; gap: 3px; width: 100%; padding: 10px 16px; text-align: start; border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--panel) 66%, transparent); }
.msg-results li button:hover { background: var(--hover); }
.mr-title { display: flex; justify-content: space-between; gap: 8px; font-size: 14px; }
.mr-title b { font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mr-title time { font-size: 11.5px; color: var(--muted); flex: none; }
.mr-snip { font-size: 13.5px; color: var(--muted); line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.mr-snip mark { background: color-mix(in srgb, var(--accent) 30%, transparent); color: var(--fg); border-radius: 3px; padding: 0 2px; }

/* ================= لوحة التحكم الجديدة: تبويبات ================= */
.adm-body { background: var(--bg); overflow: hidden; }
.adm { display: grid; grid-template-columns: 250px minmax(0, 1fr); height: 100vh; height: 100dvh; }
.adm-nav { background: var(--panel); border-inline-end: 1px solid var(--line); display: flex; flex-direction: column; gap: 6px; padding: 14px 10px calc(14px + env(safe-area-inset-bottom, 0px)); overflow-y: auto; min-width: 0; z-index: 21; }
.adm-brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 12px; }
.adm-brand b { font-size: 16px; flex: 1; }
.adm-close { display: none; }
.adm-tabs { display: grid; gap: 2px; }
.adm-tabs button, .adm-link { display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 12px; font-size: 15px; color: var(--fg); text-decoration: none; width: 100%; text-align: start; }
.adm-tabs button .ic, .adm-link .ic { color: var(--muted); flex: none; }
.adm-tabs button:hover, .adm-link:hover { background: var(--hover); }
.adm-tabs button[aria-selected="true"] { background: color-mix(in srgb, var(--accent) 13%, transparent); color: var(--accent); font-weight: 600; }
.adm-tabs button[aria-selected="true"] .ic { color: var(--accent); }
.adm-foot { margin-top: auto; display: grid; gap: 2px; padding-top: 10px; border-top: 1px solid var(--line); }
.adm-foot .credit { text-align: center; font-size: 11.5px; color: var(--muted); padding-top: 8px; }
.adm-scrim { position: fixed; inset: 0; background: rgba(0,0,0,.38); z-index: 20; }
.adm-scrim[hidden] { display: none; }
.adm-main { overflow-y: auto; overflow-x: hidden; min-width: 0; display: flex; flex-direction: column; }
.adm-top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 10px; padding: 12px 24px; padding-top: calc(12px + env(safe-area-inset-top, 0px)); background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.adm-top h1 { margin: 0; font-size: 19px; flex: 1; min-width: 0; }
.adm-menu { display: none; }
.adm-actions { display: flex; gap: 8px; }
.adm-actions .btn { display: inline-flex; align-items: center; gap: 6px; }
.adm-panel { padding: 20px 24px 60px; display: grid; gap: 16px; align-content: start; width: 100%; min-width: 0; }
.adm-panel[hidden] { display: none; }
.adm-note { color: var(--muted); font-size: 12.5px; margin: 0; }

/* النماذج */
.m-groups { display: grid; gap: 26px; }
.m-sec { display: grid; gap: 12px; min-width: 0; }
.m-sec-h { margin: 0; font-size: 15px; font-weight: 600; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.m-cols { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.m-row { border: 1px solid var(--line); border-radius: 16px; padding: 14px; display: grid; gap: 10px; align-content: start; background: var(--panel); box-shadow: var(--shadow); min-width: 0; }
.set-tile { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px; border: 1px solid var(--line); border-radius: 16px; background: var(--panel); box-shadow: var(--shadow); font-size: 14.5px; cursor: pointer; min-width: 0; }
.m-fields { grid-template-columns: repeat(5, minmax(0, 1fr)); padding: 14px; border: 1px solid var(--line); border-radius: 16px; background: var(--panel); box-shadow: var(--shadow); }
@media (max-width: 1300px) { .m-cols { grid-template-columns: repeat(2, minmax(0, 1fr)); } .m-fields { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 700px) { .m-cols { grid-template-columns: minmax(0, 1fr); } .m-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); } .m-groups { gap: 20px; } }
.m-row.changed { border-color: var(--accent); }
.m-head { display: flex; align-items: center; gap: 8px; min-width: 0; }
.m-head b { font-size: 15px; white-space: nowrap; }
.m-prov { width: auto; max-width: 150px; padding-block: 6px; font-size: 13.5px; }
.m-badge { font-size: 12px; color: var(--muted); padding: 3px 10px; border-radius: 999px; background: var(--panel); border: 1px solid var(--line); white-space: nowrap; }
.m-meta { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); min-width: 0; }
.m-price { font-variant-numeric: tabular-nums; color: var(--fg); opacity: .8; }
.m-err { font-size: 12.5px; color: var(--danger); background: color-mix(in srgb, var(--danger) 9%, transparent); border-radius: 10px; padding: 6px 10px; overflow-wrap: anywhere; }
.m-err[hidden] { display: none; }
.m-extra { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 13px; }
.m-extra > span { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); }
.m-extra .fn-size { width: 130px; flex: none; }
.m-row.testing .m-test .ic { animation: spin 1s linear infinite; }
.set-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 170px), 1fr)); gap: 12px; }
.set-grid .field > span { font-size: 13px; color: var(--muted); }

/* نقطة الحالة: أخضر يعمل، أحمر معطّل، رمادي لم يُختبر */
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--line-strong); flex: none; display: inline-block; }
.dot.ok { background: #22c55e; box-shadow: 0 0 0 3px color-mix(in srgb, #22c55e 22%, transparent); }
.dot.bad { background: var(--danger); box-shadow: 0 0 0 3px color-mix(in srgb, var(--danger) 22%, transparent); }
.dot.testing { background: #f59e0b; animation: dotPulse 1s ease-in-out infinite; }
.dot.big { width: 12px; height: 12px; margin: 0 6px; }
@keyframes dotPulse { 50% { opacity: .35; } }

/* البحث عن نموذج */
.mp { position: relative; min-width: 0; }
.mp-ic { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.mp-input { width: 100%; padding-left: 38px; padding-right: 12px; font-size: 14px; text-align: left; }
.mp-list { position: absolute; z-index: 15; inset-inline: 0; top: calc(100% + 4px); max-height: min(340px, 50vh); overflow-y: auto; overflow-x: hidden; background: var(--panel); border: 1px solid var(--line-strong); border-radius: 14px; box-shadow: 0 12px 32px rgba(0,0,0,.22); padding: 4px; overscroll-behavior: contain; }
.mp-list[hidden] { display: none; }
.mp-opt { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border-radius: 10px; text-align: start; min-width: 0; }
.mp-opt:hover, .mp-opt.act { background: var(--hover); }
.mp-opt.sel { background: color-mix(in srgb, var(--accent) 12%, transparent); }
.mp-txt { flex: 1; min-width: 0; display: grid; }
.mp-txt b, .mp-txt small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mp-txt b { font-size: 13.5px; font-weight: 600; }
.mp-txt small { font-size: 11.5px; color: var(--muted); text-align: left; }
.mp-price { font-size: 11px; color: var(--muted); white-space: nowrap; flex: none; font-variant-numeric: tabular-nums; }
.mp-empty { padding: 10px; color: var(--muted); font-size: 13px; text-align: center; }

/* المزوّدون والمستخدمون والتعليمة */
.p-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 380px), 1fr)); gap: 14px; align-items: start; }
.p-grid .card.prov { box-shadow: var(--shadow); padding: 16px; }
.key-line { font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
.u-add { max-width: 860px; }
.u-list { grid-template-columns: repeat(auto-fill, minmax(min(100%, 380px), 1fr)); }
.prompt-box { width: 100%; min-height: calc(100dvh - 160px); resize: vertical; font-size: 15px; line-height: 1.8; }

/* الجوال: قائمة جانبية منزلقة، وبلا تمرير أفقي */
@media (max-width: 860px) {
  .adm { grid-template-columns: minmax(0, 1fr); }
  .adm-nav { position: fixed; inset-block: 0; inset-inline-start: 0; width: min(290px, 84vw); transform: translateX(105%); transition: transform .25s ease; visibility: hidden; padding-top: calc(14px + env(safe-area-inset-top, 0px)); }
  .adm.nav-open .adm-nav { transform: none; visibility: visible; box-shadow: -10px 0 40px rgba(0,0,0,.25); }
  .adm-close, .adm-menu { display: grid; }
  .adm-top { padding-inline: 12px; }
  .adm-panel { padding: 14px 12px 50px; gap: 12px; }
  .uc-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .uc-stat b { font-size: 19px; }
  .uc-table-wrap { overflow-x: hidden; }
  .uc-table th:nth-child(4), .uc-table td:nth-child(4), .uc-table th:nth-child(5), .uc-table td:nth-child(5) { display: none; }
  .uc-table th, .uc-table td { padding: 10px 8px; }
  .uc-user b, .uc-user small { overflow: hidden; text-overflow: ellipsis; max-width: 40vw; }
  .m-head b { white-space: normal; }
  .user-row .who { min-width: 0; }
  .prompt-box { min-height: calc(100dvh - 130px); }
}
@media (prefers-reduced-motion: reduce) { .adm-nav { transition: none; } }
.adm-panel[data-panel="models"] { gap: 26px; }
.m-cols.set-cols { grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); }
@media (max-width: 1300px) { .m-cols.set-cols { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 700px) { .m-cols.set-cols { grid-template-columns: minmax(0, 1fr); } }
/* المستخدمون والمزوّدون: نفس أعمدة النماذج */
.u-add { max-width: none; }
.u-add .set-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.u-list, .p-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.u-list .user-row { background: var(--panel); box-shadow: var(--shadow); border-radius: 16px; padding: 12px 14px; flex-wrap: nowrap; }
@media (max-width: 1300px) { .u-list, .p-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .u-add .set-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 700px) { .u-list, .p-grid, .u-add .set-grid { grid-template-columns: minmax(0, 1fr); } }

/* بطاقات المستخدمين */
.u-card { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); padding: 16px; display: grid; gap: 12px; min-width: 0; }
.u-card.off { opacity: .6; }
.u-top { display: flex; align-items: center; gap: 12px; min-width: 0; }
.u-av { width: 44px; height: 44px; border-radius: 50%; flex: none; display: grid; place-items: center; font-weight: 700; font-size: 18px; background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent); }
.u-who { flex: 1; min-width: 0; display: grid; line-height: 1.4; }
.u-who b, .u-who small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.u-who b { font-size: 15.5px; }
.u-who small { color: var(--muted); font-size: 12.5px; text-align: start; }
.u-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.u-acts { display: flex; gap: 8px; padding-top: 12px; border-top: 1px solid var(--line); }
.u-acts .btn { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.u-acts .u-del { color: var(--danger); }
.u-add-btns { display: flex; gap: 8px; }
.u-add[hidden] { display: none; }

/* شريط حالة النماذج أعلى التبويب */
.m-status { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-radius: 16px; border: 1px solid var(--line); background: var(--panel); box-shadow: var(--shadow); min-width: 0; }
.m-status:empty { display: none; }
.ms-ic { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; flex: none; background: var(--panel-2); color: var(--muted); }
.m-status.all-ok .ms-ic { background: color-mix(in srgb, #22c55e 16%, transparent); color: #22c55e; }
.m-status.has-bad { border-color: color-mix(in srgb, var(--danger) 45%, var(--line)); }
.m-status.has-bad .ms-ic { background: color-mix(in srgb, var(--danger) 14%, transparent); color: var(--danger); }
.ms-txt { flex: 1; min-width: 0; display: grid; }
.ms-txt b { font-size: 15.5px; }
.ms-txt small { color: var(--muted); font-size: 12.5px; }
.ms-counts { display: flex; gap: 14px; font-variant-numeric: tabular-nums; font-weight: 600; }
.ms-counts span { display: inline-flex; align-items: center; gap: 7px; }
.m-ms { font-size: 12px; color: var(--muted); white-space: nowrap; }
.m-ms.ok { color: #22c55e; }
.m-ms.bad { color: var(--danger); }

/* ذاكرة الدردشة: زر طويل في القائمة، ولوحة من الأسفل على الجوال */
#chatMenu .mem-long { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 12px; margin: 2px 0 6px; border-radius: 14px; background: color-mix(in srgb, var(--accent) 10%, var(--panel-2)); border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--line)); text-align: start; }
#chatMenu .mem-long[hidden] { display: none; }
#chatMenu .mem-long:hover { background: color-mix(in srgb, var(--accent) 16%, var(--panel-2)); }
.ml-ic { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; flex: none; background: color-mix(in srgb, var(--accent) 18%, transparent); color: var(--accent); }
.ml-txt { flex: 1; min-width: 0; display: grid; line-height: 1.35; }
.ml-txt b { font-size: 15px; }
.ml-txt small { font-size: 12px; color: var(--muted); }
.ml-arrow { color: var(--muted); transform: scaleX(-1); }
.cm-dlg { width: min(620px, calc(100vw - 24px)); }
.cm-body { flex: 1; min-height: 0; }
.cm-list { display: grid; gap: 10px; }
.cm-item { border: 1px solid var(--line); border-radius: 14px; background: var(--panel-2); padding: 10px 12px; display: grid; gap: 6px; }
.cm-meta { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); }
.cm-meta b { color: var(--fg); font-size: 13.5px; }
.cm-meta .icon-btn { width: 32px; height: 32px; }
.cm-meta .cm-del { color: var(--danger); }
.cm-text { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14.5px; line-height: 1.75; }
.cm-text textarea { width: 100%; min-height: 140px; resize: vertical; font: inherit; line-height: 1.7; white-space: pre-wrap; }
.cm-edit-btns { display: flex; gap: 8px; margin-top: 8px; }
.cm-empty { display: grid; justify-items: center; gap: 6px; text-align: center; padding: 28px 12px; color: var(--muted); }
.cm-empty .ic { width: 34px; height: 34px; color: var(--accent); opacity: .8; }
.cm-empty b { color: var(--fg); }
.cm-foot { padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px)); border-top: 1px solid var(--line); display: grid; gap: 6px; background: var(--panel); }
.cm-analyze { width: 100%; justify-content: center; display: flex; align-items: center; gap: 8px; min-height: 48px; font-size: 16px; }
.cm-foot small { text-align: center; color: var(--muted); font-size: 12.5px; }
@media (max-width: 760px) {
  .cm-dlg { margin: auto auto 0; width: 100%; max-width: 100%; max-height: 88vh; border-radius: 22px 22px 0 0; }
}

/* ================= النسخة الثانية: مظهر سادة بأسلوب Claude ================= */
/* بلا توهج ولا زخرفة خلفية: ألوان سادة هادئة فقط */
.aura { display: none !important; }
.chat-pane, :root .chat-pane, :root[data-theme="dark"] .chat-pane { background-image: none !important; background-color: var(--chat-bg); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .chat-pane { background-image: none !important; } }
.chat-item { background: transparent; }
.logo-badge.lg { background: var(--accent); box-shadow: none; }
.viewer .v-spin { border-top-color: var(--accent); }
.msg.assistant { box-shadow: none; border: 1px solid var(--line); }
.msg.user { box-shadow: none; }

/* ---------- العناوين داخل الرد: لون وحجم كل مستوى قابلان للتعديل (من قائمة ⋮ ← تنسيق العناوين) ---------- */
/* الألوان لكل وضع على حدة (--hNc-l للفاتح و--hNc-d للداكن)، والأحجام مشتركة (--hNs بوحدة em) */
:root { --hc1: var(--h1c-l, var(--accent)); --hc2: var(--h2c-l, var(--accent)); --hc3: var(--h3c-l, var(--fg)); --hc4: var(--h4c-l, var(--fg)); --hc5: var(--h5c-l, var(--muted)); --hc6: var(--h6c-l, var(--muted)); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --hc1: var(--h1c-d, var(--accent)); --hc2: var(--h2c-d, var(--accent)); --hc3: var(--h3c-d, var(--fg)); --hc4: var(--h4c-d, var(--fg)); --hc5: var(--h5c-d, var(--muted)); --hc6: var(--h6c-d, var(--muted)); }
}
:root[data-theme="dark"] { --hc1: var(--h1c-d, var(--accent)); --hc2: var(--h2c-d, var(--accent)); --hc3: var(--h3c-d, var(--fg)); --hc4: var(--h4c-d, var(--fg)); --hc5: var(--h5c-d, var(--muted)); --hc6: var(--h6c-d, var(--muted)); }
.md h1, .md h2, .md h3, .md h4, .md h5, .md h6 { font-weight: 600; line-height: 1.45; margin: 1.1em 0 .45em; }
.md h1 { font-size: var(--h1s, 1.55em); color: var(--hc1); }
.md h2 { font-size: var(--h2s, 1.35em); color: var(--hc2); }
.md h3 { font-size: var(--h3s, 1.18em); color: var(--hc3); }
.md h4 { font-size: var(--h4s, 1.06em); color: var(--hc4); }
.md h5 { font-size: var(--h5s, 1em); color: var(--hc5); }
.md h6 { font-size: var(--h6s, .95em); color: var(--hc6); }
.md p { line-height: 1.85; }

/* المقال الطويل: عدد الكلمات تحت الرد */
.foot .wc { font-size: 11.5px; color: var(--muted); background: var(--panel-2); border: 1px solid var(--line); border-radius: 999px; padding: 0 8px; }

/* لوحة تنسيق العناوين */
.hd-dlg .prefs-body { gap: 10px; }
.hd-row { display: grid; gap: 8px; padding: 12px; border: 1px solid var(--line); border-radius: 14px; background: var(--panel-2); }
.hd-top { display: flex; align-items: center; gap: 10px; }
.hd-tag { font: 600 12px/1 var(--mono); color: var(--muted); background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 5px 7px; direction: ltr; flex: none; }
.hd-prev { flex: 1; min-width: 0; font-weight: 600; line-height: 1.35; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hd-ctrl { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.hd-sw { display: flex; gap: 6px; flex-wrap: wrap; flex: 1; min-width: 0; }
.hd-sw button { width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--panel); box-shadow: 0 0 0 1px var(--line-strong); }
.hd-sw button.on { box-shadow: 0 0 0 2px var(--fg); }
.hd-sw label { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; border: 1px dashed var(--line-strong); color: var(--muted); position: relative; overflow: hidden; cursor: pointer; }
.hd-sw label input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; cursor: pointer; border: 0; padding: 0; }
.hd-size { display: flex; align-items: center; gap: 4px; flex: none; }
.hd-size button { width: 34px; height: 34px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); font-weight: 600; }
.hd-size b { min-width: 46px; text-align: center; font-size: 13px; direction: ltr; }
.hd-note { font-size: 12.5px; color: var(--muted); margin: 0; }
.hd-foot { display: flex; gap: 8px; padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px)); border-top: 1px solid var(--line); }
.hd-foot .btn { flex: 1; }

/* ================= Rio Ai: تحديث المظهر ================= */
/* القائمة المختارة بلون محايد هادئ بدل الطيني */
.chat-item.active, .chat-item.selected { background: var(--hover); box-shadow: inset -3px 0 0 var(--accent); }
.chat-item.selected .chat-av { background: var(--accent); color: #fff; border-color: var(--accent); }
.chat-av { background: var(--icon-bg); color: var(--icon-muted); }
.logo-badge { background: var(--accent); color: #fff; }
.home-logo { cursor: pointer; border: 0; padding: 0; }
.home-logo:hover { filter: brightness(1.08); }
.composer textarea, #input { font-size: var(--input-size, 16px); }

/* ---------- أحجام الخطوط وألوانها (يضبطها المدير من لوحة التحكم ← الخطوط والألوان) ---------- */
body { font-size: var(--ui-size, 15px); }
.messages { font-size: calc(var(--msg-size, 15px) * var(--fs, 1)); }
.md p, .md li { line-height: var(--line, 1.85); }
.md strong { color: var(--strong-c, inherit); }
.md a { color: var(--link-c, var(--accent)); }
.chat-item .name { font-size: var(--list-size, 15px); }
.adm-top, .adm-panel { zoom: var(--adm-zoom, 1); }

/* ---------- الشريط العلوي للدردشة على الكمبيوتر: كل الأدوات ظاهرة ---------- */
.title-row { display: flex; align-items: center; gap: 4px; min-width: 0; }
.title-row h2 { min-width: 0; }
.rename-btn { width: 30px !important; height: 30px !important; border-radius: 9px !important; flex: none; background: transparent !important; border-color: transparent !important; }
.rename-btn .ic { width: 16px; height: 16px; }
.rename-btn:hover { background: var(--hover) !important; }
.hdr-tools { display: flex; align-items: center; gap: 6px; flex: none; }
.hdr-tools[hidden] { display: none !important; }
.hdr-cost { display: inline-flex; align-items: center; gap: 6px; height: 40px; padding: 0 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel-2); color: var(--muted); font-size: 13px; white-space: nowrap; }
.hdr-cost b { color: var(--fg); font-weight: 600; direction: ltr; }
.hdr-cost[hidden] { display: none !important; }
.hdr-fs { display: inline-flex; align-items: center; height: 40px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel-2); overflow: hidden; }
.hdr-fs button { width: 36px; height: 100%; display: grid; place-items: center; color: var(--icon-muted); }
.hdr-fs button:hover:not(:disabled) { background: var(--hover); color: var(--fg); }
.hdr-fs button:disabled { opacity: .35; cursor: default; }
.hdr-fs b { min-width: 44px; text-align: center; font-size: 12.5px; font-weight: 600; direction: ltr; }
.bar .icon-btn.hdr-del:hover { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 50%, var(--line)); }
.hdr-sep { width: 1px; height: 24px; background: var(--line); margin-inline: 2px; }
@media (max-width: 1100px) { .hdr-cost span { display: none; } }
@media (min-width: 761px) { #chatMenu .mob-only { display: none !important; } }

/* ---------- لوحة التحكم: الخطوط والألوان ---------- */
.ty-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.ty-card { border: 1px solid var(--line); border-radius: 16px; background: var(--panel); padding: 16px; display: grid; gap: 12px; align-content: start; }
.ty-card h3 { margin: 0; font-size: 15px; display: flex; align-items: center; gap: 8px; }
.ty-row { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 10px; min-height: 40px; }
.ty-row > span { font-size: 14px; }
.ty-row small { display: block; color: var(--muted); font-size: 12px; }
.ty-colors { display: flex; gap: 8px; align-items: center; }
.ty-swatch { position: relative; display: grid; justify-items: center; gap: 2px; font-size: 10.5px; color: var(--muted); }
.ty-swatch input { width: 40px; height: 32px; padding: 2px; border-radius: 9px; border: 1px solid var(--line-strong); background: var(--panel-2); cursor: pointer; }
.ty-swatch.def input { opacity: .55; }
.ty-reset { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; color: var(--muted); }
.ty-reset:hover { background: var(--hover); color: var(--fg); }
.ty-range { display: grid; grid-template-columns: 1fr 64px; gap: 10px; align-items: center; }
.ty-range input[type=range] { width: 100%; accent-color: var(--accent); }
.ty-range b { text-align: center; font-size: 13px; direction: ltr; background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 3px 0; }
.ty-prev { border: 1px solid var(--line); border-radius: 16px; background: var(--chat-bg); padding: 16px 18px; }
.ty-prev .msg { max-width: 100%; }
@media (max-width: 760px) { .ty-grid { grid-template-columns: 1fr; } }
/* شعار Rio Ai: صورة الأيقونة نفسها داخل الشارة */
.logo-badge { overflow: hidden; padding: 0; }
.logo-badge img { width: 100%; height: 100%; display: block; object-fit: cover; }
