@font-face{font-family:"Vazirmatn";src:url("/fonts/Vazirmatn-Regular.woff2") format("woff2");font-weight:400;font-display:swap}
@font-face{font-family:"Vazirmatn";src:url("/fonts/Vazirmatn-Medium.woff2") format("woff2");font-weight:500;font-display:swap}
@font-face{font-family:"Vazirmatn";src:url("/fonts/Vazirmatn-SemiBold.woff2") format("woff2");font-weight:600;font-display:swap}
@font-face{font-family:"Vazirmatn";src:url("/fonts/Vazirmatn-Bold.woff2") format("woff2");font-weight:700;font-display:swap}
@font-face{font-family:"Inter";src:url("/fonts/inter-latin-400.woff2") format("woff2");font-weight:400;font-display:swap}
@font-face{font-family:"Inter";src:url("/fonts/inter-latin-500.woff2") format("woff2");font-weight:500;font-display:swap}
@font-face{font-family:"Inter";src:url("/fonts/inter-latin-600.woff2") format("woff2");font-weight:600;font-display:swap}
@font-face{font-family:"Cinzel";src:url("/fonts/cinzel-latin-500.woff2") format("woff2");font-weight:500;font-display:swap}
@font-face{font-family:"Cinzel";src:url("/fonts/cinzel-latin-600.woff2") format("woff2");font-weight:600;font-display:swap}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg-canvas);
  color: var(--fg-primary);
  font-family: var(--font-fa);
  font-size: var(--text-base);
  line-height: var(--lh-base);
  -webkit-font-smoothing: antialiased;
}
button, input { font: inherit; }
a { color: inherit; text-decoration: none; }
.ltr { direction: ltr; unicode-bidi: isolate; }
.tabular { font-variant-numeric: tabular-nums; font-family: var(--font-ui); }

/* ── Brand lockup ─────────────────────────────────────────────── */
.brand-lockup {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}
.brand-lockup img {
  width: 36px;
  height: 36px;
  display: block;
  filter: drop-shadow(0 0 12px rgba(212,175,55,.18));
}
.brand-word {
  display: flex;
  flex-direction: column;
  gap: 2px;
  line-height: 1;
}
.brand-word strong {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 18px;
  letter-spacing: .22em;
  color: var(--fg-primary);
}
.brand-word span {
  font-family: var(--font-ui);
  font-size: 9px;
  letter-spacing: .28em;
  color: var(--fg-gold);
  text-transform: uppercase;
}

/* ── Shell ────────────────────────────────────────────────────── */
.app { min-height: 100%; }
.app.is-authed {
  display: grid;
  grid-template-columns: 248px 1fr;
  min-height: 100vh;
}
.side {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 22px 14px 16px;
  background: linear-gradient(180deg, #0C0B09 0%, #090807 100%);
  border-inline-end: 1px solid var(--border-subtle);
}
.side__brand { padding: 4px 10px 18px; }
.side__nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 12px;
  border-radius: var(--r-lg);
  color: var(--fg-secondary);
  border: 1px solid transparent;
  transition: background var(--dur-base) var(--ease-out),
              color var(--dur-base) var(--ease-out),
              border-color var(--dur-base) var(--ease-out);
}
.nav-item svg { width: 16px; height: 16px; opacity: .75; flex: 0 0 auto; }
.nav-item:hover { background: var(--bg-hover); color: var(--fg-primary); }
.nav-item.is-active {
  background: var(--bg-gold-tint);
  border-color: var(--border-gold-soft);
  color: var(--fg-gold-strong);
}
.nav-item.is-active svg { opacity: 1; color: var(--fg-gold); }
.side__foot {
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid var(--border-subtle);
}
.user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: var(--r-xl);
  border: 1px solid var(--border-subtle);
  background: rgba(20,18,15,.55);
}
.user-chip__avatar {
  width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--grad-gold);
  color: var(--fg-inverse);
  font-family: var(--font-ui);
  font-size: 12px; font-weight: 600;
}
.user-chip__meta { flex: 1; min-width: 0; }
.user-chip__meta b { display: block; font-size: 13px; font-weight: 600; }
.user-chip__meta small {
  color: var(--fg-tertiary); font-size: 10px;
  letter-spacing: .14em; font-family: var(--font-ui);
}
.btn-text {
  background: none; border: 0; color: var(--fg-tertiary);
  cursor: pointer; padding: 6px 8px; border-radius: var(--r-md);
}
.btn-text:hover { color: var(--fg-danger); background: var(--bg-danger-soft); }

.main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  background:
    radial-gradient(900px 420px at 100% -10%, rgba(212,175,55,.06), transparent 55%),
    var(--bg-canvas);
}
.topbar {
  height: 62px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 28px;
  border-bottom: 1px solid var(--border-subtle);
  background: rgba(10,9,8,.72);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 5;
}
.topbar__title {
  font-size: 13px;
  color: var(--fg-tertiary);
  letter-spacing: .08em;
}
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 30px;
  padding: 0 12px;
  border-radius: var(--r-pill);
  border: 1px solid var(--border-subtle);
  background: var(--bg-success-soft);
  color: var(--fg-success);
  font-size: 12px;
  font-family: var(--font-ui);
}
.status-pill .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 8px currentColor;
}
.content {
  padding: 28px;
  animation: rise .42s var(--ease-out) both;
}
@keyframes rise {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

.page-head { margin-bottom: 28px; }
.eyebrow {
  margin: 0 0 10px;
  font-family: var(--font-ui);
  font-size: 11px;
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
  color: var(--fg-gold);
}
.page-head h1 {
  margin: 0 0 8px;
  font-size: var(--text-2xl);
  line-height: var(--lh-2xl);
  font-weight: 600;
}
.page-head p {
  margin: 0;
  color: var(--fg-secondary);
  max-width: 52ch;
}

/* ── Metrics / surfaces ───────────────────────────────────────── */
.metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}
.metric {
  background: var(--grad-surface, linear-gradient(180deg, #14120F, #100E0C));
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-2xl);
  padding: 18px 18px 16px;
}
.metric__label {
  display: flex; align-items: center; justify-content: space-between;
  color: var(--fg-tertiary); font-size: 12px; margin-bottom: 14px;
}
.metric__icon {
  width: 28px; height: 28px; border-radius: 50%;
  display: grid; place-items: center;
  border: 1px solid var(--border-gold-soft);
  color: var(--fg-gold);
  background: var(--bg-gold-tint);
}
.metric__icon svg { width: 14px; height: 14px; }
.metric__value {
  font-family: var(--font-ui);
  font-size: 34px;
  line-height: 1;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.02em;
}
.metric__hint {
  margin-top: 10px;
  font-size: 12px;
  color: var(--fg-success);
}
.metric__hint.is-warn { color: var(--fg-warning); }
.metric__hint.is-mute { color: var(--fg-tertiary); }

.grid-2 {
  display: grid;
  grid-template-columns: 1.1fr .9fr;
  gap: 14px;
}
.surface {
  background: rgba(20,18,15,.72);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-2xl);
  padding: 20px;
}
.surface h2 {
  margin: 0 0 16px;
  font-size: 14px;
  font-weight: 600;
}
.feed { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; }
.feed li {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  gap: 12px;
  align-items: start;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-subtle);
}
.feed li:last-child { border-bottom: 0; padding-bottom: 0; }
.feed__ico {
  width: 28px; height: 28px; border-radius: 50%;
  display: grid; place-items: center;
  border: 1px solid var(--border-gold-soft);
  background: var(--bg-gold-tint);
  color: var(--fg-gold);
}
.feed__ico svg { width: 13px; height: 13px; }
.feed strong { display: block; font-size: 13.5px; font-weight: 500; }
.feed span { color: var(--fg-tertiary); font-size: 12px; }
.feed time {
  color: var(--fg-tertiary); font-size: 11px;
  font-family: var(--font-ui); white-space: nowrap;
}
.kv { display: grid; gap: 12px; }
.kv div {
  display: flex; justify-content: space-between; gap: 16px;
  padding: 12px 0; border-bottom: 1px solid var(--border-subtle);
}
.kv div:last-child { border-bottom: 0; }
.kv dt { color: var(--fg-tertiary); font-size: 13px; }
.kv dd { margin: 0; font-family: var(--font-ui); font-variant-numeric: tabular-nums; }

/* ── Forms / buttons ──────────────────────────────────────────── */
.field { display: grid; gap: 7px; }
.field label {
  font-size: 12px; color: var(--fg-tertiary);
}
.field input, .field select {
  width: 100%;
  height: 44px;
  padding: 0 14px;
  border-radius: var(--r-lg);
  border: 1px solid var(--border-default);
  background: var(--bg-input);
  color: var(--fg-primary);
  transition: border-color var(--dur-fast) var(--ease-out),
              box-shadow var(--dur-fast) var(--ease-out);
}
.field input:focus {
  outline: none;
  border-color: var(--border-gold);
  box-shadow: 0 0 0 3px rgba(212,175,55,.12);
}
.field input.ltr { direction: ltr; text-align: left; }

.btn {
  appearance: none; border: 0; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 44px; padding: 0 18px;
  border-radius: var(--r-lg);
  font-weight: 600; font-size: 14px;
  transition: transform var(--dur-fast) var(--ease-out),
              filter var(--dur-fast) var(--ease-out),
              background var(--dur-fast) var(--ease-out);
}
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: var(--grad-gold);
  color: var(--accent-fg);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.22);
}
.btn-primary:hover { filter: brightness(1.05); }
.btn-ghost {
  background: transparent;
  color: var(--fg-secondary);
  border: 1px solid var(--border-default);
}
.btn-ghost:hover { background: var(--bg-hover); color: var(--fg-primary); }
.btn-danger {
  background: var(--bg-danger-soft);
  color: var(--fg-danger);
  border: 1px solid var(--border-danger);
}
.btn-sm { height: 34px; padding: 0 12px; font-size: 12.5px; border-radius: var(--r-md); }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; }
.err { color: var(--fg-danger); font-size: 13px; }
.ok { color: var(--fg-success); font-size: 13px; }
.muted { color: var(--fg-tertiary); font-size: 13px; }

.secret {
  margin-top: 4px;
  padding: 16px;
  border-radius: var(--r-xl);
  border: 1px solid var(--border-gold);
  background: var(--bg-gold-tint);
  animation: rise .35s var(--ease-out) both;
}
.secret pre, pre.code, code.inline {
  direction: ltr; text-align: left;
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--fg-gold-strong);
}
.secret pre, pre.code {
  margin: 10px 0 0;
  padding: 12px 14px;
  border-radius: var(--r-md);
  background: var(--bg-sunken);
  border: 1px solid var(--border-subtle);
  white-space: pre-wrap; word-break: break-all;
}
code.inline {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 6px;
  background: var(--bg-sunken);
  border: 1px solid var(--border-subtle);
}

.toolbar {
  display: flex; gap: 12px; flex-wrap: wrap; align-items: end;
  margin-bottom: 18px;
  padding: 16px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-2xl);
  background: rgba(20,18,15,.55);
}
.toolbar .field { flex: 1; min-width: 200px; }

.table-wrap {
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-2xl);
  overflow: hidden;
  background: rgba(20,18,15,.55);
}
table.keys {
  width: 100%;
  border-collapse: collapse;
  direction: ltr;
  text-align: left;
  font-family: var(--font-ui);
}
table.keys th, table.keys td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 13px;
  vertical-align: middle;
}
table.keys th {
  color: var(--fg-tertiary);
  font-weight: 500;
  font-size: 11.5px;
  letter-spacing: .08em;
  text-transform: uppercase;
  background: rgba(0,0,0,.18);
}
table.keys tr:last-child td { border-bottom: 0; }
table.keys td.name { direction: rtl; text-align: right; font-family: var(--font-fa); }
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  height: 24px; padding: 0 10px; border-radius: var(--r-pill);
  font-size: 11.5px; border: 1px solid transparent;
}
.badge-on {
  color: var(--fg-success);
  background: var(--bg-success-soft);
  border-color: rgba(127,179,154,.25);
}
.badge-off {
  color: var(--fg-tertiary);
  background: rgba(255,255,255,.03);
  border-color: var(--border-subtle);
}

.help-grid { display: grid; gap: 14px; }
.help-card h3 {
  margin: 0 0 6px;
  font-size: 14px;
  font-weight: 600;
}
.help-card p { margin: 0 0 12px; color: var(--fg-secondary); font-size: 13px; }

/* ── Login ────────────────────────────────────────────────────── */
.app.is-login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px 16px;
  background:
    radial-gradient(700px 360px at 50% 0%, rgba(212,175,55,.10), transparent 60%),
    radial-gradient(900px 500px at 80% 100%, rgba(143,169,201,.05), transparent 50%),
    linear-gradient(180deg, #0F0D0B, var(--bg-canvas));
}
.login {
  width: min(440px, 100%);
  animation: rise .5s var(--ease-out) both;
}
.login__mark {
  display: grid;
  justify-items: center;
  gap: 18px;
  margin-bottom: 28px;
  text-align: center;
}
.login__mark img {
  width: 72px; height: 72px;
  filter: drop-shadow(0 0 24px rgba(212,175,55,.22));
  animation: breathe 4.5s var(--ease-in-out) infinite;
}
@keyframes breathe {
  0%, 100% { filter: drop-shadow(0 0 18px rgba(212,175,55,.16)); transform: scale(1); }
  50% { filter: drop-shadow(0 0 28px rgba(212,175,55,.28)); transform: scale(1.02); }
}
.login__mark .brand-word { align-items: center; }
.login__mark .brand-word strong { font-size: 28px; letter-spacing: .28em; margin-inline-start: .28em; }
.login__card {
  border: 1px solid var(--border-default);
  border-radius: 18px;
  padding: 28px;
  background: linear-gradient(180deg, rgba(27,24,21,.92), rgba(14,12,10,.96));
  box-shadow: 0 24px 60px rgba(0,0,0,.35);
}
.login__card h1 {
  margin: 0 0 6px;
  font-size: 22px;
  font-weight: 600;
}
.login__card .lead {
  margin: 0 0 22px;
  color: var(--fg-secondary);
  font-size: 13.5px;
}
.login__card .stack { display: grid; gap: 14px; }
.login__card .btn { width: 100%; margin-top: 4px; }
.login__foot {
  margin-top: 18px;
  text-align: center;
  color: var(--fg-tertiary);
  font-size: 11.5px;
  letter-spacing: .06em;
  font-family: var(--font-ui);
}

.composer-page {
  display: grid;
  gap: 18px;
  max-width: 760px;
  margin: 0 auto;
  min-height: calc(100vh - 120px);
  grid-template-rows: auto 1fr;
}
.composer-page__head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.composer-page__head h1 {
  margin: 0 0 6px;
  font-size: 26px;
  font-weight: 600;
}
.composer-page__chips { display: flex; gap: 8px; }
.chip-link {
  display: inline-flex;
  align-items: center;
  height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--border-subtle);
  background: rgba(255,255,255,.03);
  font-size: 12.5px;
  color: var(--fg-secondary);
}
.chip-link:hover { color: var(--fg-primary); border-color: var(--border-default); }

.chat {
  display: grid;
  gap: 14px;
  max-width: 860px;
}
.chat--composer {
  max-width: none;
  grid-template-rows: 1fr auto;
  min-height: 0;
}
.chat__log {
  min-height: 280px;
  max-height: none;
  overflow: auto;
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(16,14,12,.9), rgba(10,9,8,.95));
}
.chat--composer .chat__log {
  min-height: 360px;
  height: min(52vh, 520px);
}

.composer-card {
  border: 1px solid var(--border-default);
  border-radius: 22px;
  padding: 16px 16px 14px;
  background: linear-gradient(180deg, rgba(27,24,21,.96), rgba(14,12,10,.98));
  box-shadow: 0 18px 40px rgba(0,0,0,.28);
}
.composer-card textarea {
  width: 100%;
  resize: vertical;
  min-height: 72px;
  max-height: 180px;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--fg-primary);
  font: inherit;
  line-height: 1.7;
  margin-bottom: 12px;
}
.composer-card textarea::placeholder { color: var(--fg-tertiary); }
.composer-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.composer-bar__left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.seg {
  display: inline-flex;
  padding: 3px;
  border-radius: 999px;
  background: rgba(0,0,0,.28);
  border: 1px solid var(--border-subtle);
}
.seg__btn {
  height: 30px;
  padding: 0 12px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--fg-secondary);
  cursor: pointer;
  font: inherit;
  font-size: 13px;
}
.seg__btn.is-active {
  background: rgba(212,175,55,.16);
  color: var(--fg-primary);
}
.model-pick {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 10px 0 12px;
  border-radius: 999px;
  border: 1px solid var(--border-subtle);
  background: rgba(255,255,255,.03);
  font-size: 12.5px;
  color: var(--fg-secondary);
}
.model-pick select {
  border: 0;
  background: transparent;
  color: var(--fg-primary);
  font: inherit;
  font-size: 13px;
  max-width: 200px;
}
.auto-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--border-subtle);
  font-size: 13px;
  color: var(--fg-secondary);
  cursor: pointer;
}
.composer-send { min-width: 96px; }
.bubble {
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  padding: 10px 12px;
  background: rgba(255,255,255,.02);
}
.bubble--user { border-color: rgba(212,175,55,.28); }
.bubble--assistant { border-color: rgba(127,179,154,.28); }
.bubble--worker { border-color: rgba(140,160,200,.25); }
.bubble--system { opacity: .85; }
.bubble__meta {
  font-size: 11px;
  color: var(--fg-tertiary);
  margin-bottom: 6px;
  font-family: var(--font-ui);
  letter-spacing: .04em;
}
.bubble pre {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: var(--font-fa);
  font-size: 13.5px;
  line-height: 1.7;
  color: var(--fg-primary);
}
.chat__compose {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: end;
}
.chat__compose textarea {
  width: 100%;
  resize: vertical;
  min-height: 64px;
  border-radius: 12px;
  border: 1px solid var(--border-default);
  background: rgba(0,0,0,.25);
  color: var(--fg-primary);
  padding: 12px 14px;
}
.servers-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)) auto;
  gap: 10px;
  align-items: end;
}
.servers-form select {
  width: 100%;
  border-radius: 12px;
  border: 1px solid var(--border-default);
  background: rgba(0,0,0,.25);
  color: var(--fg-primary);
  padding: 10px 12px;
}
.row-actions { display: flex; gap: 6px; justify-content: flex-end; }
.ok { color: #7FB39A; margin: 8px 0; }

@media (max-width: 960px) {
  .app.is-authed { grid-template-columns: 1fr; }
  .side {
    position: relative; height: auto;
    border-inline-end: 0;
    border-bottom: 1px solid var(--border-subtle);
  }
  .side__nav { flex-direction: row; flex-wrap: wrap; }
  .metrics, .grid-2 { grid-template-columns: 1fr; }
  .content { padding: 20px 16px 40px; }
  .topbar { padding: 0 16px; }
  .chat__compose { grid-template-columns: 1fr; }
}

/* ═══════════════════════════════════════════════════════════════
   Animated canvas + chat surface
   ═══════════════════════════════════════════════════════════════ */

.app.is-authed .main {
  position: relative;
  background: transparent;
}
.side { z-index: 2; }
.content { position: relative; z-index: 1; }

.aurora {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  contain: strict;
}

.au-orb {
  position: absolute;
  border-radius: 50%;
  mix-blend-mode: screen;
}
.au-orb::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 50%, var(--c), transparent 72%);
  animation: au-drift var(--dur) ease-in-out infinite;
  animation-delay: var(--delay, 0s);
  will-change: transform;
}
.au-orb--1 {
  top: -16vw; left: -10vw; width: 64vw; height: 64vw;
  --c: rgba(212, 175, 55, 0.22); --dur: 24s;
}
.au-orb--2 {
  top: 2vh; right: -18vw; width: 58vw; height: 58vw;
  --c: rgba(168, 124, 60, 0.18); --dur: 30s; --delay: -8s;
}
.au-orb--3 {
  bottom: -24vw; left: 4vw; width: 66vw; height: 66vw;
  --c: rgba(88, 108, 140, 0.16); --dur: 34s; --delay: -14s;
}
.au-orb--4 {
  top: 24vh; left: 42vw; width: 34vw; height: 34vw;
  --c: rgba(255, 224, 158, 0.12); --dur: 26s; --delay: -18s;
}

@keyframes au-drift {
  0%, 100% { transform: translate3d(0, 0, 0) scale(1); }
  33% { transform: translate3d(6%, 5%, 0) scale(1.14); }
  66% { transform: translate3d(-5%, 6%, 0) scale(0.94); }
}

.au-ribbon {
  position: absolute;
  top: -55vw; left: 50%;
  width: 110vw; height: 110vw;
  margin-left: -55vw;
  border-radius: 50%;
  filter: blur(70px);
  opacity: 0.5;
  mix-blend-mode: screen;
  will-change: transform;
  background: conic-gradient(
    from 0deg,
    transparent 0deg,
    rgba(212, 175, 55, 0.45) 38deg,
    rgba(190, 140, 70, 0.28) 92deg,
    transparent 148deg,
    rgba(120, 100, 150, 0.22) 218deg,
    transparent 282deg,
    rgba(212, 175, 55, 0.3) 332deg,
    transparent 360deg
  );
  animation: au-spin 54s linear infinite;
}
@keyframes au-spin { to { transform: rotate(360deg); } }

.au-gridwrap { position: absolute; inset: -56px; }
.au-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(to right, rgba(246, 243, 236, 0.045) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(246, 243, 236, 0.045) 1px, transparent 1px);
  background-size: 56px 56px;
  -webkit-mask-image: radial-gradient(ellipse 74% 62% at 50% 46%, #000 0%, transparent 78%);
  mask-image: radial-gradient(ellipse 74% 62% at 50% 46%, #000 0%, transparent 78%);
  animation: au-grid-pan 40s linear infinite;
}
@keyframes au-grid-pan { to { transform: translate3d(-56px, -56px, 0); } }

.au-grain {
  position: absolute;
  inset: 0;
  opacity: 0.045;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)' opacity='0.55'/%3E%3C/svg%3E");
}

.au-vignette {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 94% 74% at 50% 44%, transparent 32%, rgba(0, 0, 0, 0.55) 100%);
}

.au-particles { position: absolute; inset: 0; }
.au-particle {
  position: absolute;
  bottom: -10vh;
  left: var(--left);
  width: var(--size);
  height: var(--size);
  border-radius: 50%;
  opacity: 0;
  background: radial-gradient(circle, rgba(255, 236, 190, 0.95), rgba(212, 175, 55, 0.2) 62%, transparent 72%);
  animation: au-rise var(--duration) linear infinite;
  animation-delay: var(--delay);
  will-change: transform, opacity;
}
@keyframes au-rise {
  0% { transform: translate3d(0, 0, 0) scale(0.5); opacity: 0; }
  12% { opacity: 0.5; }
  50% { transform: translate3d(calc(var(--drift) * 0.5), -55vh, 0) scale(1); }
  88% { opacity: 0.5; }
  100% { transform: translate3d(var(--drift), -112vh, 0) scale(0.65); opacity: 0; }
}

/* --- chat page --- */

.chat-page {
  display: flex;
  flex-direction: column;
  gap: 14px;
  height: calc(100dvh - 118px);
  min-height: 460px;
  max-width: 880px;
  margin: 0 auto;
}

.chat-page__head {
  flex: 0 0 auto;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.chat-page__title h1 {
  margin: 2px 0 4px;
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.chat-page__title .muted { margin: 0; font-size: 13px; }

.chat-log {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 6px 4px 16px;
  scrollbar-width: thin;
  scrollbar-color: rgba(212, 175, 55, 0.28) transparent;
}
.chat-log::-webkit-scrollbar { width: 8px; }
.chat-log::-webkit-scrollbar-thumb {
  background: rgba(212, 175, 55, 0.24);
  border-radius: 99px;
}

.msg {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-width: 78%;
  animation: au-msg-in 0.42s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.msg--user { align-self: flex-end; align-items: flex-end; }
.msg--assistant { align-self: flex-start; align-items: flex-start; }
.msg--worker { align-self: flex-start; align-items: flex-start; max-width: 86%; }
.msg--system { align-self: center; align-items: center; max-width: 92%; }

@keyframes au-msg-in {
  from { opacity: 0; transform: translateY(10px) scale(0.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.msg__bubble {
  padding: 11px 15px;
  border-radius: 16px;
  border: 1px solid transparent;
  font-family: var(--font-fa);
  font-size: 13.8px;
  line-height: 1.8;
  color: var(--fg-primary);
  overflow-wrap: anywhere;
}
.msg__bubble pre {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
}

.msg--user .msg__bubble {
  background: linear-gradient(180deg, rgba(212, 175, 55, 0.2), rgba(212, 175, 55, 0.09));
  border-color: rgba(212, 175, 55, 0.3);
  color: #FBF3DC;
  box-shadow: 0 12px 30px -20px rgba(212, 175, 55, 0.9);
}
.msg--assistant .msg__bubble {
  background: rgba(24, 21, 18, 0.76);
  border-color: rgba(246, 243, 236, 0.07);
  color: #EDE8DE;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}
.msg--worker .msg__bubble {
  background: rgba(88, 108, 140, 0.14);
  border-color: rgba(140, 160, 200, 0.22);
  color: #DDE4F0;
}
.msg--system .msg__bubble {
  background: rgba(255, 255, 255, 0.03);
  border-color: rgba(246, 243, 236, 0.06);
  color: var(--fg-secondary);
  font-size: 12.8px;
}

.msg__meta {
  font-size: 10.5px;
  letter-spacing: 0.04em;
  color: var(--fg-tertiary);
  font-family: var(--font-ui);
  padding: 0 5px;
}

.msg__bubble--typing {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 15px 16px;
}
.msg__bubble--typing span {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: rgba(243, 217, 139, 0.85);
  animation: au-typing 1.25s ease-in-out infinite;
}
.msg__bubble--typing span:nth-child(2) { animation-delay: 0.15s; }
.msg__bubble--typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes au-typing {
  0%, 60%, 100% { opacity: 0.25; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-3px); }
}

/* --- empty state --- */

.chat-empty {
  margin: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  text-align: center;
  padding: 20px 8px;
}
.chat-empty[hidden] { display: none; }

.chat-empty__badge {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 6px 14px 6px 11px;
  border-radius: 999px;
  font-family: var(--font-ui);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--fg-gold-strong);
  background: linear-gradient(180deg, rgba(212, 175, 55, 0.13), rgba(212, 175, 55, 0.04));
  border: 1px solid rgba(212, 175, 55, 0.3);
  box-shadow: 0 0 34px -10px rgba(212, 175, 55, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}
.chat-empty__dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--s-gold-300);
  box-shadow: 0 0 12px var(--s-gold-300);
  animation: au-dot 2.6s ease-in-out infinite;
}
@keyframes au-dot {
  0%, 100% { opacity: 0.45; transform: scale(0.8); }
  50% { opacity: 1; transform: scale(1.18); }
}

.chat-empty__title {
  margin: 0;
  font-size: clamp(26px, 3.2vw, 40px);
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.02em;
  color: transparent;
  background-image: linear-gradient(
    100deg,
    #F6F3EC 0%,
    #FFFFFF 18%,
    #F3D98B 36%,
    #FFFFFF 54%,
    #D9CDB4 74%,
    #F6F3EC 100%
  );
  background-size: 230% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  animation: au-title-sheen 11s linear infinite;
}
.chat-empty__title span { display: inline-block; }
@keyframes au-title-sheen {
  from { background-position: 0% 50%; }
  to { background-position: 230% 50%; }
}

.chat-empty__sub {
  margin: 0;
  max-width: 44ch;
  font-size: 13.5px;
  line-height: 1.7;
  color: var(--fg-secondary);
}

.chat-suggestions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 6px;
}
.chat-chip {
  height: 32px;
  padding: 0 14px;
  border-radius: 999px;
  font-family: var(--font-fa);
  font-size: 12.5px;
  color: var(--fg-secondary);
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid var(--border-subtle);
  cursor: pointer;
  transition: background-color 0.18s ease, border-color 0.18s ease,
    color 0.18s ease, transform 0.15s ease, box-shadow 0.18s ease;
}
.chat-chip:hover {
  color: var(--fg-primary);
  background: rgba(212, 175, 55, 0.12);
  border-color: rgba(212, 175, 55, 0.36);
  box-shadow: 0 10px 24px -14px rgba(212, 175, 55, 0.85);
  transform: translateY(-1px);
}
.chat-chip:active { transform: translateY(0) scale(0.98); }

/* --- docked composer --- */

.chat-dock {
  flex: 0 0 auto;
  position: relative;
}
.chat-dock::before {
  content: '';
  position: absolute;
  left: -24px; right: -24px;
  top: -26px; height: 26px;
  pointer-events: none;
  background: linear-gradient(180deg, transparent, rgba(10, 9, 8, 0.55));
}
.chat-page .composer-card {
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(27, 24, 21, 0.94), rgba(14, 12, 10, 0.96));
  border-color: rgba(212, 175, 55, 0.18);
  box-shadow:
    0 18px 44px rgba(0, 0, 0, 0.32),
    0 0 0 1px rgba(212, 175, 55, 0.06),
    0 24px 70px -46px rgba(212, 175, 55, 0.9);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  transition: border-color 0.25s ease, box-shadow 0.25s ease;
}
.chat-page .composer-card:focus-within {
  border-color: rgba(212, 175, 55, 0.4);
  box-shadow:
    0 18px 44px rgba(0, 0, 0, 0.34),
    0 0 0 1px rgba(212, 175, 55, 0.18),
    0 26px 80px -44px rgba(212, 175, 55, 1);
}
.chat-page .composer-card textarea { min-height: 54px; }
.chat-page .composer-card textarea::placeholder { color: var(--fg-tertiary); }

@media (max-width: 960px) {
  .chat-page {
    height: auto;
    min-height: 0;
  }

  .chat-log {
    min-height: 40vh;
    max-height: none;
    overflow: visible;
  }

  /* keep the composer on one row instead of stacking into a tall block */
  .composer-bar {
    flex-wrap: nowrap;
    gap: 8px;
  }

  .composer-bar__left {
    flex-wrap: nowrap;
    overflow-x: auto;
    min-width: 0;
    padding-bottom: 2px;
    scrollbar-width: none;
  }

  .composer-bar__left::-webkit-scrollbar {
    display: none;
  }

  .composer-send {
    min-width: 0;
    padding: 0 16px;
    flex-shrink: 0;
  }

  .chat-dock { position: static; }
  .chat-dock::before { display: none; }
  .msg { max-width: 92%; }
}

@media (prefers-reduced-motion: reduce) {
  .aurora *,
  .msg,
  .chat-empty__dot {
    animation: none !important;
  }
  .au-particle { display: none; }
}

/* ── کارت تسک غیرهم‌زمان ───────────────────────────────────────────── */
.msg--task { width: 100%; }

.task-card {
  width: min(720px, 100%);
  border: 1px solid var(--border-gold-soft, rgba(212, 175, 55, 0.18));
  border-radius: 12px;
  background: linear-gradient(180deg, #14120f, #0e0c0a);
  padding: 14px 16px;
}

.task-card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.task-card__state {
  font-size: 12.5px;
  color: var(--fg-gold-strong, #e8c547);
}

.task-card__cancel {
  font: inherit;
  font-size: 11px;
  color: #bdb6a8;
  background: transparent;
  border: 1px solid rgba(237, 232, 222, 0.18);
  border-radius: 6px;
  padding: 4px 10px;
  cursor: pointer;
}

.task-card__cancel:hover {
  border-color: rgba(224, 122, 106, 0.5);
  color: #f0b0a5;
}

.task-card__cancel:disabled {
  opacity: 0.45;
  cursor: default;
}

.task-card__meta {
  margin-top: 8px;
  font-size: 11.5px;
  color: #8f887b;
}

.task-card__log {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.task-card__line {
  font-size: 11.5px;
  color: #bdb6a8;
}

.task-card__reply {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid rgba(237, 232, 222, 0.08);
  white-space: pre-wrap;
  font-size: 13px;
  line-height: 1.9;
  color: #f6f3ec;
}
