/* الديوان — لوحة التحكم */

@font-face { font-family: "IBM Plex Sans Arabic"; font-weight: 400; font-display: swap; src: url(fonts/plex-ar-400.woff2) format("woff2"); unicode-range: U+0600-06FF, U+0750-077F, U+0870-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FEFC; }
@font-face { font-family: "IBM Plex Sans Arabic"; font-weight: 500; font-display: swap; src: url(fonts/plex-ar-500.woff2) format("woff2"); unicode-range: U+0600-06FF, U+0750-077F, U+0870-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FEFC; }
@font-face { font-family: "IBM Plex Sans Arabic"; font-weight: 600; font-display: swap; src: url(fonts/plex-ar-600.woff2) format("woff2"); unicode-range: U+0600-06FF, U+0750-077F, U+0870-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FEFC; }
@font-face { font-family: "IBM Plex Sans Arabic"; font-weight: 700; font-display: swap; src: url(fonts/plex-ar-700.woff2) format("woff2"); unicode-range: U+0600-06FF, U+0750-077F, U+0870-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FEFC; }
@font-face { font-family: "IBM Plex Sans Arabic"; font-weight: 400 500; font-display: swap; src: url(fonts/plex-latin-400.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-200B, U+2012-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "IBM Plex Sans Arabic"; font-weight: 600 700; font-display: swap; src: url(fonts/plex-latin-600.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-200B, U+2012-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Noto Kufi Arabic"; font-weight: 600; font-display: swap; src: url(fonts/kufi-ar-600.woff2) format("woff2"); unicode-range: U+0600-06FF, U+0750-077F, U+0870-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FEFC; }
@font-face { font-family: "Noto Kufi Arabic"; font-weight: 700; font-display: swap; src: url(fonts/kufi-ar-700.woff2) format("woff2"); unicode-range: U+0600-06FF, U+0750-077F, U+0870-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FEFC; }

:root {
  --ink: #1f1b2a;
  --ink-2: #4b4559;
  --mute: #736d80;
  --line: #e4e1e8;
  --line-2: #d2cdd8;
  --wool: #f3f2f4;
  --paper: #ffffff;
  --madder: #9e2a24;
  --indigo: #2c3a6e;
  --indigo-2: #222d57;
  --saffron: #c38a2c;
  --sage: #3f6f4a;
  --font: "IBM Plex Sans Arabic", system-ui, -apple-system, "Segoe UI", Tahoma, sans-serif;
  --font-display: "Noto Kufi Arabic", "IBM Plex Sans Arabic", system-ui, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --sadu: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='12' viewBox='0 0 16 12'%3E%3Crect width='16' height='12' fill='%239e2a24'/%3E%3Cpath d='M8 1 13 6 8 11 3 6Z' fill='%23f3f2f4'/%3E%3Cpath d='M8 4 10 6 8 8 6 6Z' fill='%231f1b2a'/%3E%3Cpath d='M0 0H3L0 3ZM16 0H13L16 3ZM0 12H3L0 9ZM16 12H13L16 9Z' fill='%23c38a2c'/%3E%3C/svg%3E");
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.75;
  color: var(--ink);
  background: var(--wool);
  text-rendering: optimizeLegibility;
}
a { color: var(--indigo); text-underline-offset: 3px; }
a:hover { color: var(--indigo-2); }
h1, h2, h3 { font-family: var(--font-display); font-weight: 700; line-height: 1.5; margin: 0; }
p { margin: 0 0 10px; }
b, strong { font-weight: 600; }
code { font-family: var(--mono); font-size: 0.88em; }
:focus-visible { outline: 2px solid var(--indigo); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--mute); }
.small { font-size: 13.5px; }
.num { font-variant-numeric: tabular-nums; text-align: end; }
.nowrap { white-space: nowrap; }
.ta-start { text-align: start; }

/* ——— الهيكل ——— */
.shell { display: grid; grid-template-columns: 252px minmax(0, 1fr); min-height: 100vh; background: linear-gradient(to left, var(--ink) 252px, var(--wool) 252px); }
.side {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column;
  background: var(--ink); color: #e6e2ec;
  padding: 26px 18px 18px;
}
.side :focus-visible { outline-color: var(--saffron); }
.brand { display: grid; gap: 2px; text-decoration: none; padding: 0 10px 16px; }
.brand__mark { font-family: var(--font-display); font-weight: 700; font-size: 31px; line-height: 1.35; color: #fff; }
.brand__sub { font-size: 13px; color: #b5aec2; }
.sadu { height: 12px; background: var(--sadu) repeat-x center / auto 12px; }
.side .sadu { margin: 0 -18px 18px; }
.nav { display: grid; gap: 2px; }
.nav a {
  position: relative;
  display: block; padding: 9px 14px; border-radius: 8px;
  color: #d7d1e0; text-decoration: none; font-weight: 500;
}
.nav a:hover { background: rgba(255, 255, 255, 0.06); color: #fff; }
.nav a.is-active { background: rgba(255, 255, 255, 0.1); color: #fff; }
.nav a.is-active::before {
  content: ""; position: absolute; inset-inline-start: -4px; top: 50%;
  width: 8px; height: 8px; margin-top: -4px;
  background: var(--saffron); transform: rotate(45deg);
}
.side__out { margin-top: auto; padding: 0 10px; }
.side__note { margin-bottom: 0; font-size: 13px; color: #b5aec2; }
.linkbtn { background: none; border: 0; padding: 6px 0; color: #b5aec2; font: inherit; font-size: 14px; cursor: pointer; }
.linkbtn:hover { color: #fff; text-decoration: underline; }

.main { padding: 34px 44px 60px; max-width: 1060px; width: 100%; }

/* ——— رأس الصفحة ——— */
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 22px; }
.page-head h1 { font-size: 28px; }
.page-head__lead { color: var(--ink-2); margin: 4px 0 0; max-width: 62ch; }
.back { display: inline-block; font-size: 14px; color: var(--mute); text-decoration: none; margin-bottom: 4px; }
.back:hover { color: var(--ink); text-decoration: underline; }
.with-ava { display: flex; align-items: center; gap: 12px; }

/* ——— الألواح ——— */
.panel { background: var(--paper); border: 1px solid var(--line); border-radius: 12px; padding: 22px 24px; margin-bottom: 18px; }
.panel--flush { padding: 0; overflow: hidden; }
.panel--quiet { background: #faf9fb; }
.panel__title { font-size: 17px; font-weight: 600; margin-bottom: 12px; }
.panel__bar { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.panel__foot { margin: 14px 0 0; color: var(--mute); font-size: 14px; }
.sub-title { font-size: 15px; font-weight: 600; margin: 20px 0 6px; }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); gap: 18px; }
.grid-2 > .panel { margin-bottom: 18px; }
.empty { text-align: center; color: var(--mute); padding: 28px 12px; margin: 0; }

/* ——— الرسائل التنبيهية ——— */
.flash { padding: 12px 16px; border-radius: 10px; margin-bottom: 16px; border: 1px solid; font-size: 15px; }
.flash--ok { background: #e9f2eb; color: #2b5134; border-color: #cfe2d4; }
.flash--error { background: #f9eceb; color: #7c221d; border-color: #efcfcb; }

/* ——— الأزرار ——— */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: inherit; font-size: 15px; font-weight: 600; line-height: 1.2;
  padding: 10px 16px; border-radius: 8px;
  border: 1px solid var(--line-2); background: var(--paper); color: var(--ink);
  cursor: pointer; text-decoration: none; white-space: nowrap;
}
.btn:hover { border-color: var(--ink-2); color: var(--ink); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn--primary { background: var(--indigo); border-color: var(--indigo); color: #fff; }
.btn--primary:hover { background: var(--indigo-2); border-color: var(--indigo-2); color: #fff; }
.btn--danger { color: var(--madder); border-color: rgba(158, 42, 36, 0.35); }
.btn--danger:hover { background: #fbefee; border-color: var(--madder); color: var(--madder); }
.btn--ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn--ghost:hover { background: rgba(31, 27, 42, 0.05); border-color: transparent; }
.btn--small { font-size: 13.5px; padding: 6px 11px; }
.btn--wide { width: 100%; padding: 12px 16px; }

/* ——— النماذج ——— */
.form { margin: 0; }
.field { display: grid; gap: 6px; margin-bottom: 16px; min-width: 0; }
.field__label { font-size: 14px; font-weight: 600; color: var(--ink-2); }
.field__hint { font-size: 13px; color: var(--mute); line-height: 1.6; }
input:not([type="checkbox"]):not([type="color"]), select, textarea {
  width: 100%; font: inherit; font-size: 15.5px; line-height: 1.6;
  padding: 9px 12px; border: 1px solid var(--line-2); border-radius: 8px;
  background: #fff; color: var(--ink);
}
textarea { resize: vertical; min-height: 48px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--indigo); box-shadow: 0 0 0 3px rgba(44, 58, 110, 0.16); }
input[type="color"] { width: 64px; height: 42px; padding: 3px; border: 1px solid var(--line-2); border-radius: 8px; background: #fff; }
input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--indigo); margin: 0; flex: none; }
.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 0 16px; align-items: start; }
.field--short { max-width: 150px; }
.check { display: flex; align-items: center; gap: 10px; margin: 6px 0 12px; cursor: pointer; }
.check.is-disabled { color: var(--mute); cursor: default; }
.inline { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; color: var(--ink-2); font-weight: 600; }
.inline select { width: auto; padding: 6px 10px; }
.form__actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 4px; }
.form__actions form { margin: 0; }
.form--sections .panel { margin-bottom: 16px; }
.form > .form__actions { margin: 0 0 24px; }
bdi.cmd, .cmd { font-family: var(--mono); font-size: 0.9em; }
.danger-zone { margin-top: 28px; padding-top: 18px; border-top: 1px dashed var(--line-2); }

.idea-form .field { margin-bottom: 12px; }
.idea-form__row { display: flex; flex-wrap: wrap; align-items: center; gap: 14px 20px; }
.idea-form__row .check { margin: 0; }
.idea-form__row .btn { margin-inline-start: auto; }

/* ——— الحالات والوسوم ——— */
.pill {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 2px 11px; border-radius: 999px;
  font-size: 13px; font-weight: 600; line-height: 1.8;
  background: #eeecf1; color: var(--ink-2); white-space: nowrap;
}
.pill--running, .pill--summarizing, .pill--answering { background: #f8eae8; color: var(--madder); }
.pill--done { background: #e7f0e9; color: var(--sage); }
.pill--queued { background: #f6efe1; color: #81591a; }
.pill--waiting { background: #e9ecf6; color: var(--indigo); }
.pill--failed { background: #f8eae8; color: var(--madder); }
.pill__dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.35; transform: scale(0.75); } }

.tag { display: inline-block; padding: 1px 8px; border-radius: 6px; font-size: 12.5px; font-weight: 600; line-height: 1.8; white-space: nowrap; }
.tag--ok { background: #e7f0e9; color: #2f5a39; }
.tag--warn { background: #f6efe1; color: #7a5418; }
.tag--bad { background: #f8eae8; color: var(--madder); }

/* ——— المجلس (الرئيسية) ——— */
.majlis { background: var(--paper); border: 1px solid var(--line); border-radius: 14px; padding: 20px 24px 18px; margin-bottom: 18px; }
.majlis__team { list-style: none; display: flex; flex-wrap: wrap; gap: 14px 28px; margin: 0 0 16px; padding: 0 0 16px; border-bottom: 1px dashed var(--line-2); }
.majlis__team li { --c: #2c3a6e; display: grid; grid-template-columns: auto auto; grid-template-rows: auto auto; column-gap: 10px; align-items: center; }
.majlis__team .ava { grid-row: span 2; }
.majlis__name { font-weight: 700; color: var(--c); font-size: 15px; line-height: 1.35; }
.majlis__role { font-size: 12.5px; color: var(--mute); line-height: 1.35; }
.majlis .idea-form textarea { min-height: 92px; font-size: 17px; }
.live-card {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 12px 18px; margin-bottom: 16px; border-radius: 12px;
  background: #f8eae8; color: var(--madder); text-decoration: none; font-size: 15px;
}
.live-card:hover { color: var(--madder); background: #f4dfdc; }
.live-card .pill__dot { flex: none; }
.live-card__go { margin-inline-start: auto; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.row.row--stack { display: block; }
.row--stack .row__line { display: flex; align-items: center; gap: 12px; }
.row__rec { margin: 4px 0 0; font-size: 14px; color: var(--ink-2); line-height: 1.7; }
.row__rec::before { content: ""; display: inline-block; width: 6px; height: 6px; margin-inline-end: 8px; background: var(--saffron); transform: rotate(45deg) translateY(-2px); }

/* ——— خطوات التشغيل ——— */
.steps { list-style: none; margin: 0; padding: 0; counter-reset: step; display: grid; gap: 2px; }
.step { counter-increment: step; }
.step a {
  display: grid; grid-template-columns: 34px minmax(0, 1fr); grid-template-rows: auto auto; column-gap: 12px;
  padding: 10px 8px; border-radius: 10px; color: var(--ink); text-decoration: none;
}
.step a:hover { background: #f6f5f8; }
.step a::before {
  content: counter(step); grid-row: span 2;
  width: 30px; height: 30px; border-radius: 50%;
  display: grid; place-items: center;
  font-weight: 700; font-size: 14px; color: var(--madder);
  border: 1.5px solid currentColor; margin-top: 2px;
}
.step.is-done a::before { content: "✓"; color: #fff; background: var(--sage); border-color: var(--sage); }
.step__title { font-weight: 600; }
.step__detail { font-size: 13.5px; color: var(--mute); }
.step.is-done .step__title { color: var(--ink-2); }

/* ——— القوائم والجداول ——— */
.rows { list-style: none; margin: 0; padding: 0; }
.row { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.row:last-child { border-bottom: 0; }
.rows--padded .row { padding-inline: 22px; }
.row__main { flex: 1; min-width: 0; font-weight: 600; color: var(--ink); text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
a.row__main:hover { color: var(--indigo); text-decoration: underline; }
.row__meta { color: var(--mute); font-size: 13.5px; white-space: nowrap; }
.row form { margin: 0; }

.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 15px; }
.table th { text-align: start; font-size: 13px; font-weight: 600; color: var(--mute); padding: 10px 12px; border-bottom: 1px solid var(--line); }
.table td { padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table th.num { text-align: end; }
.table td a { color: var(--ink); font-weight: 600; text-decoration: none; }
.table td a:hover { color: var(--indigo); text-decoration: underline; }
.table--log td { font-size: 14px; }
.log__msg { word-break: break-word; }

.spend { font-size: 15px; color: var(--ink-2); margin-bottom: 10px; }
.spend b { font-family: var(--font-display); font-size: 26px; color: var(--ink); margin-inline-end: 4px; }
.meter { height: 6px; border-radius: 3px; background: #ebe8ee; overflow: hidden; margin-bottom: 12px; }
.meter span { display: block; height: 100%; background: var(--indigo); border-radius: 3px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { padding: 5px 13px; border: 1px solid var(--line-2); border-radius: 999px; color: var(--ink); text-decoration: none; font-size: 14.5px; background: #fff; }
.chip:hover { border-color: var(--indigo); color: var(--indigo); }

.copy { display: flex; gap: 8px; align-items: center; margin: 8px 0 10px; }
.copy code { flex: 1; min-width: 0; overflow-x: auto; white-space: nowrap; background: #f6f5f8; border: 1px solid var(--line); border-radius: 8px; padding: 9px 12px; text-align: left; }
.plain-steps, .plain-list { margin: 0 0 6px; padding-inline-start: 22px; line-height: 1.9; }

/* ——— الفريق ——— */
.team { list-style: none; margin: 0; padding: 0; }
.member {
  display: grid; grid-template-columns: 44px minmax(0, 1.2fr) minmax(0, 1fr) auto auto;
  align-items: center; gap: 14px; padding: 15px 22px; border-bottom: 1px solid var(--line);
}
.member:last-child { border-bottom: 0; }
.member.is-off { opacity: 0.55; }
.member__who, .member__model { display: grid; min-width: 0; line-height: 1.5; }
.member__name { font-weight: 700; color: var(--ink); text-decoration: none; font-size: 16.5px; }
.member__name:hover { color: var(--indigo); text-decoration: underline; }
.member__role { color: var(--ink-2); font-size: 14px; }
.member__model span:first-child { direction: ltr; text-align: right; font-size: 14px; }
.member__toggle { margin: 0; }

.ava {
  --c: #2c3a6e;
  width: 40px; height: 40px; border-radius: 50%; flex: none;
  display: inline-grid; place-items: center; font-size: 20px; line-height: 1;
  background: #eeedf3;
  background: color-mix(in srgb, var(--c) 13%, #fff);
  box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--c) 45%, #fff);
}
.ava--sm { width: 30px; height: 30px; font-size: 15px; }
.bot-line { display: flex; align-items: center; gap: 8px; }
.test-result { border-inline-start: 3px solid var(--c); }
.test-result__text { font-size: 16px; line-height: 1.85; }

/* ——— المجلس (صفحة النقاش) ——— */
.disc-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 14px; }
.disc-status { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; font-size: 14px; color: var(--ink-2); }
.disc-status b { font-variant-numeric: tabular-nums; }
.idea { margin: 0 0 26px; }
.idea__text {
  margin: 0; padding: 4px 18px 4px 0; padding-inline: 18px 0;
  border-inline-start: 4px solid var(--madder);
  font-family: var(--font-display); font-weight: 600; font-size: 22px; line-height: 1.75;
  max-width: 46ch;
}
.idea__cite { margin: 10px 0 0; font-size: 13.5px; color: var(--mute); }

.thread { display: flex; flex-direction: column; gap: 14px; padding-bottom: 8px; }
.msg { --c: #2c3a6e; display: grid; grid-template-columns: 40px minmax(0, 1fr); gap: 12px; max-width: 780px; }
.msg__body {
  background: var(--paper); border: 1px solid var(--line);
  border-inline-start: 3px solid var(--c);
  border-radius: 14px; border-start-start-radius: 4px;
  padding: 10px 16px 12px;
}
.msg__head { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.msg__name { color: var(--c); font-size: 15px; font-weight: 700; }
.msg__role { color: var(--mute); font-size: 13px; }
.msg__time { margin-inline-start: auto; color: var(--mute); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.msg__text { font-size: 16px; line-height: 1.85; margin-top: 2px; overflow-wrap: anywhere; }
.msg__text p, .summary__text p, .idea__text p, .note p, .test-result__text p { margin: 0 0 8px; }
.msg__text p:last-child, .summary__text p:last-child, .idea__text p:last-child, .note p:last-child, .test-result__text p:last-child { margin-bottom: 0; }
.msg--owner { grid-template-columns: minmax(0, 1fr); max-width: 640px; margin-inline-start: auto; }
.msg--owner .msg__body { background: var(--ink); color: #f1eef5; border-color: var(--ink); border-radius: 14px; border-start-end-radius: 4px; }
.msg--owner .msg__name { color: #fff; }
.msg--owner .msg__time { color: #b5aec2; }

.summary {
  --c: #2c3a6e;
  background: #fdf9f1; border: 1px solid #eadcc0; border-inline-start: 4px solid var(--saffron);
  border-radius: 12px; padding: 16px 22px 18px; max-width: 820px;
}
.summary__head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.summary__head h2 { font-size: 17px; font-weight: 600; }
.summary__text { font-size: 16px; line-height: 1.9; }
.summary__text p { margin-bottom: 12px; }

.round-divider { display: flex; align-items: center; gap: 12px; color: var(--mute); font-size: 13px; font-weight: 600; margin: 8px 0 0; }
.round-divider::before, .round-divider::after { content: ""; flex: 1; height: 1px; background: var(--line-2); }
.round-divider span { display: inline-flex; align-items: center; gap: 8px; }
.round-divider span::before { content: ""; width: 6px; height: 6px; background: var(--madder); transform: rotate(45deg); }

.note { margin: 0; text-align: center; color: var(--mute); font-size: 13.5px; }
.note--system { align-self: center; background: #ebe9ee; color: var(--ink-2); padding: 6px 16px; border-radius: 999px; max-width: 640px; }

.typing { display: flex; align-items: center; gap: 8px; color: var(--ink-2); font-size: 14px; margin: 6px 0 14px; }
.typing[hidden] { display: none; }
.dots { display: inline-flex; gap: 3px; margin-inline-start: 2px; }
.dots i { width: 5px; height: 5px; border-radius: 50%; background: var(--mute); animation: dot 1.2s infinite ease-in-out; }
.dots i:nth-child(2) { animation-delay: 0.15s; }
.dots i:nth-child(3) { animation-delay: 0.3s; }
@keyframes dot { 0%, 80%, 100% { opacity: 0.25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }

.composer {
  position: sticky; bottom: 0; z-index: 2;
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: end;
  padding: 12px 0 14px; background: linear-gradient(to top, var(--wool) 80%, rgba(243, 242, 244, 0));
  max-width: 820px;
}
.composer .btn { height: 48px; }
.disc-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; max-width: 820px; }
.disc-actions form { margin: 0; }
.disc-actions__meta { margin-inline-start: auto; }

/* ——— صفحة طريقة التشغيل ——— */
.guide { list-style: none; margin: 0 0 18px; padding: 0; counter-reset: g; }
.guide__step {
  counter-increment: g; position: relative;
  background: var(--paper); border: 1px solid var(--line); border-radius: 12px;
  padding: 18px 24px 12px; padding-inline-start: 74px; margin-bottom: 12px;
}
.guide__step::before {
  content: counter(g); position: absolute; inset-inline-start: 22px; top: 14px;
  font-family: var(--font-display); font-weight: 700; font-size: 26px; color: var(--madder); line-height: 1.4;
}
.guide__step h2 { font-size: 17px; font-weight: 600; margin-bottom: 6px; }

/* ——— الدخول والتجهيز ——— */
.auth {
  min-height: 100vh; display: grid; place-items: center; align-content: center; gap: 14px; padding: 28px 16px;
  background: var(--ink);
}
.auth > .flash { width: min(440px, 100%); }
.auth__card {
  width: min(440px, 100%); background: var(--paper); border-radius: 14px; overflow: hidden;
  padding: 0 30px 26px;
}
.sadu--card { margin: 0 -30px 22px; height: 14px; background-size: auto 14px; }
.auth__title { font-size: 34px; }
.auth__lead { color: var(--ink-2); margin-bottom: 18px; }
.auth__note { margin: 14px 0 0; font-size: 13px; color: var(--mute); }

/* ——— المساعد الصوتي ——— */
.va { display: flex; flex-direction: column; gap: 14px; max-width: 760px; margin: 0 auto; min-height: calc(100vh - 120px); }
.va__head { display: flex; align-items: center; gap: 14px; }
.va__head h1 { font-size: 28px; line-height: 1.35; }
.va__sub { margin: 0; color: var(--ink-2); font-size: 14.5px; }
.va__avatar {
  width: 52px; height: 52px; border-radius: 50%; flex: none;
  display: grid; place-items: center;
  background: var(--ink); color: var(--saffron);
  box-shadow: inset 0 0 0 2px rgba(195, 138, 44, 0.45);
}
.va__avatar svg { width: 26px; height: 26px; fill: currentColor; }
.va > .flash { margin: 0; }
.va__log { flex: 1; display: flex; flex-direction: column; gap: 10px; padding: 4px 0 8px; }
.va__empty { margin: auto 0; padding: 24px 12px; text-align: center; color: var(--ink-2); }
.va__empty p { margin: 0; }
.va__ideas { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 6px; color: var(--mute); font-size: 14.5px; }
.va-msg {
  align-self: flex-start; max-width: min(86%, 600px);
  background: var(--paper); border: 1px solid var(--line);
  border-radius: 18px; border-start-start-radius: 5px;
  padding: 9px 15px 7px;
}
.va-msg p { margin: 0; font-size: 16.5px; line-height: 1.85; white-space: pre-wrap; overflow-wrap: anywhere; }
.va-msg--me { align-self: flex-end; background: var(--ink); border-color: var(--ink); color: #f1eef5; border-radius: 18px; border-start-end-radius: 5px; padding-bottom: 9px; }
.va-msg.is-pending p { color: #a59fb3; }
.va-msg__tools { display: flex; align-items: center; gap: 14px; margin-top: 1px; }
.va-msg__btn { background: none; border: 0; padding: 2px 0; font: inherit; font-size: 13px; color: var(--mute); cursor: pointer; }
.va-msg__btn:hover { color: var(--indigo); text-decoration: underline; }
.va-msg__link { font-size: 13.5px; font-weight: 600; }
.va-note {
  align-self: center; max-width: 560px; margin: 0; padding: 6px 14px;
  text-align: center; font-size: 14px; line-height: 1.7;
  color: #7c221d; background: #f9eceb; border: 1px solid #efcfcb; border-radius: 12px;
}

.va__stage {
  position: sticky; bottom: 10px; z-index: 3;
  display: grid; justify-items: center; gap: 10px;
  padding: 24px 18px 16px; border-radius: 22px; overflow: hidden;
  background: var(--ink); color: #e6e2ec;
  box-shadow: 0 14px 40px rgba(31, 27, 42, 0.28);
}
.va__stage::before { content: ""; position: absolute; inset: 0 0 auto; height: 8px; background: var(--sadu) repeat-x center / auto 8px; }
.va__orb {
  --lvl: 0;
  position: relative; width: 104px; height: 104px; padding: 0; border: 0; border-radius: 50%;
  display: grid; place-items: center; cursor: pointer; color: var(--ink);
  background: radial-gradient(circle at 36% 30%, #f3cf7f 0%, var(--saffron) 52%, #8f6118 100%);
  box-shadow: 0 0 0 calc(7px + var(--lvl) * 26px) rgba(195, 138, 44, 0.2), 0 10px 26px rgba(0, 0, 0, 0.35);
  transition: box-shadow 0.09s linear, transform 0.15s ease;
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
}
.va__orb:active { transform: scale(0.96); }
.va__orb:focus-visible { outline: 3px solid #fff; outline-offset: 5px; }
.va__orb:disabled { cursor: progress; }
.va__icon { display: none; }
.va__icon--mic svg { display: block; width: 40px; height: 40px; fill: currentColor; }
.va[data-state="idle"] .va__icon--mic, .va[data-state="listening"] .va__icon--mic { display: block; }
.va[data-state="thinking"] .va__icon--think, .va[data-state="speaking"] .va__icon--wave { display: inline-flex; }
.va[data-state="listening"] .va__orb {
  color: #fff;
  background: radial-gradient(circle at 36% 30%, #e7786e 0%, var(--madder) 55%, #5e1712 100%);
  box-shadow: 0 0 0 calc(7px + var(--lvl) * 26px) rgba(231, 120, 110, 0.28), 0 10px 26px rgba(0, 0, 0, 0.35);
}
.va[data-state="thinking"] .va__orb::after {
  content: ""; position: absolute; inset: -9px; border-radius: 50%;
  border: 3px solid rgba(195, 138, 44, 0.22); border-top-color: var(--saffron);
  animation: va-spin 0.9s linear infinite;
}
.va[data-state="speaking"] .va__orb { animation: va-breathe 1.6s ease-in-out infinite; }
.va__icon--think { gap: 6px; }
.va__icon--think i { width: 9px; height: 9px; border-radius: 50%; background: var(--ink); animation: dot 1.2s infinite ease-in-out; }
.va__icon--think i:nth-child(2) { animation-delay: 0.15s; }
.va__icon--think i:nth-child(3) { animation-delay: 0.3s; }
.va__icon--wave { align-items: center; gap: 4px; height: 36px; }
.va__icon--wave i { width: 5px; height: 100%; border-radius: 3px; background: var(--ink); animation: va-wave 0.9s ease-in-out infinite; }
.va__icon--wave i:nth-child(2) { animation-delay: 0.15s; }
.va__icon--wave i:nth-child(3) { animation-delay: 0.3s; }
.va__icon--wave i:nth-child(4) { animation-delay: 0.45s; }
.va__icon--wave i:nth-child(5) { animation-delay: 0.6s; }
@keyframes va-spin { to { transform: rotate(360deg); } }
@keyframes va-wave { 0%, 100% { transform: scaleY(0.3); } 50% { transform: scaleY(1); } }
@keyframes va-breathe {
  0%, 100% { box-shadow: 0 0 0 8px rgba(195, 138, 44, 0.22), 0 10px 26px rgba(0, 0, 0, 0.35); }
  50% { box-shadow: 0 0 0 22px rgba(195, 138, 44, 0.1), 0 10px 26px rgba(0, 0, 0, 0.35); }
}
.va__hint { margin: 6px 0 0; min-height: 1.8em; text-align: center; font-size: 15px; color: #e6e2ec; }
.va__toggles { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.va__chip {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 4px 13px; border-radius: 999px; border: 1px solid rgba(255, 255, 255, 0.2);
  background: transparent; color: #b5aec2; font: inherit; font-size: 13.5px; line-height: 1.6; cursor: pointer;
}
.va__chip::before { content: ""; width: 8px; height: 8px; border-radius: 50%; border: 1.5px solid currentColor; }
.va__chip[aria-pressed="true"] { color: #fff; border-color: rgba(195, 138, 44, 0.7); background: rgba(195, 138, 44, 0.16); }
.va__chip[aria-pressed="true"]::before { background: var(--saffron); border-color: var(--saffron); }
.va__chip[hidden] { display: none; }
.va__chip:focus-visible { outline-color: var(--saffron); }
.va__type { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; width: 100%; margin-top: 2px; }
.va .va__type .va__input { background: rgba(255, 255, 255, 0.07); border-color: rgba(255, 255, 255, 0.16); color: #fff; }
.va .va__type .va__input::placeholder { color: #9d96ab; }
.va .va__type .va__input:focus { border-color: var(--saffron); box-shadow: 0 0 0 3px rgba(195, 138, 44, 0.22); }

.va-settings { max-width: 760px; margin: 18px auto 0; }
.va-settings > summary { display: flex; align-items: center; justify-content: space-between; margin: 0; cursor: pointer; list-style: none; }
.va-settings > summary::-webkit-details-marker { display: none; }
.va-settings > summary::after { content: "+"; font-size: 22px; line-height: 1; color: var(--mute); }
.va-settings[open] > summary { margin-bottom: 6px; }
.va-settings[open] > summary::after { content: "−"; }
.va-settings .form { margin-bottom: 18px; padding-bottom: 18px; border-bottom: 1px dashed var(--line-2); }
.va-settings .sub-title { margin-top: 8px; }

.va-card {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 18px; margin-bottom: 18px; border-radius: 16px;
  background: var(--ink); color: #f1eef5; text-decoration: none;
}
.va-card:hover { color: #fff; background: #2a2538; }
.va-card__orb {
  width: 48px; height: 48px; flex: none; border-radius: 50%;
  display: grid; place-items: center; color: var(--ink);
  background: radial-gradient(circle at 36% 30%, #f3cf7f 0%, var(--saffron) 55%, #8f6118 100%);
}
.va-card__orb svg { width: 24px; height: 24px; fill: currentColor; }
.va-card__text { display: grid; min-width: 0; line-height: 1.55; }
.va-card__text b { font-family: var(--font-display); font-size: 17px; }
.va-card__text span { font-size: 13.5px; color: #b5aec2; }
.va-card__go { margin-inline-start: auto; font-weight: 600; color: var(--saffron); white-space: nowrap; }

/* ——— الجوال ——— */
@media (max-width: 880px) {
  .shell { grid-template-columns: minmax(0, 1fr); background: var(--wool); }
  .side { position: static; height: auto; padding: 16px 14px 0; min-width: 0; }
  .main { min-width: 0; }
  .brand { padding: 0 6px 10px; }
  .brand__mark { font-size: 25px; }
  .side .sadu { margin: 0 -14px 0; order: 3; }
  .nav { display: flex; overflow-x: auto; gap: 4px; padding: 6px 0 12px; scrollbar-width: none; min-width: 0; }
  .nav a { white-space: nowrap; padding: 7px 12px; }
  .nav a.is-active::before { display: none; }
  .side__out { display: none; }
  .main { padding: 22px 16px 48px; }
  .grid-2 { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .page-head { flex-direction: column; gap: 12px; }
  .page-head h1 { font-size: 24px; }
  .member { grid-template-columns: 40px minmax(0, 1fr) auto; }
  .member__model { display: none; }
  .member__toggle { grid-column: 3; }
  .member__bot { grid-column: 2; grid-row: 2; }
  .table th:nth-child(3), .table td:nth-child(3) { display: none; }
  .idea__text { font-size: 19px; }
  .majlis { padding: 16px 16px 14px; }
  .majlis__team { flex-wrap: nowrap; overflow-x: auto; gap: 16px; margin-bottom: 12px; padding-bottom: 12px; scrollbar-width: none; }
  .majlis__team li { grid-template-columns: auto; grid-template-rows: auto auto; justify-items: center; row-gap: 4px; min-width: 52px; }
  .majlis__team .ava { grid-row: auto; }
  .majlis__name { font-size: 13px; }
  .majlis__role { display: none; }
  .guide__step { padding-inline-start: 56px; }
  .guide__step::before { inset-inline-start: 16px; }
  .va { min-height: calc(100vh - 150px); gap: 12px; }
  .va__head h1 { font-size: 24px; }
  .va__avatar { width: 44px; height: 44px; }
  .va__stage { bottom: 8px; padding: 22px 14px 14px; border-radius: 20px; }
  .va__orb { width: 96px; height: 96px; }
  .va-card { padding: 12px 14px; }
}

@media (prefers-reduced-motion: reduce) {
  .pill__dot, .dots i, .va__icon--think i, .va__icon--wave i, .va[data-state="speaking"] .va__orb { animation: none; }
  .va[data-state="thinking"] .va__orb::after { animation-duration: 3s; }
}
