/* --- فونت وزیر (وزیرمتن)، لوکال و آفلاین --- */
@font-face {
  font-family: "Vazirmatn";
  src: url("/static/fonts/Vazirmatn-Regular.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Vazirmatn";
  src: url("/static/fonts/Vazirmatn-Medium.woff2") format("woff2");
  font-weight: 500; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Vazirmatn";
  src: url("/static/fonts/Vazirmatn-Bold.woff2") format("woff2");
  font-weight: 700; font-style: normal; font-display: swap;
}

/* ---------- پالت (تاریک پیش‌فرض + روشن) ---------- */
:root {
  --bg: #0e1219;
  --bg-grad: radial-gradient(1200px 600px at 80% -10%, #16203a22, transparent 60%), var(--bg);
  --surface: #161c26;
  --surface-2: #1b222d;
  --surface-3: #222b38;
  --border: #262f3d;
  --border-soft: #1d2530;
  --text: #d8dee8;
  --text-strong: #f1f4f9;
  --muted: #8a94a6;
  --accent: #7f9bff;
  --accent-2: #5c78f6;
  --accent-soft: rgba(127,155,255,.14);
  --green: #4ec26f;
  --red: #f26a6f;
  --yellow: #e0a53b;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 10px 30px rgba(0,0,0,.35);
  --shadow-sm: 0 2px 8px rgba(0,0,0,.25);
  --mono: "Vazirmatn", ui-monospace, "SFMono-Regular", "Courier New", monospace;
}
:root[data-theme="light"] {
  --bg: #f3f5f9;
  --bg-grad: radial-gradient(1200px 600px at 80% -10%, #6c8cff14, transparent 60%), var(--bg);
  --surface: #ffffff;
  --surface-2: #f4f6fa;
  --surface-3: #e9edf4;
  --border: #e2e7ee;
  --border-soft: #eef1f6;
  --text: #2b3342;
  --text-strong: #10151f;
  --muted: #69748a;
  --accent: #4a6bff;
  --accent-2: #3a5bef;
  --accent-soft: rgba(74,107,255,.10);
  --green: #17a34a;
  --red: #e5484d;
  --yellow: #b4790f;
  --shadow: 0 10px 30px rgba(30,40,70,.10);
  --shadow-sm: 0 2px 8px rgba(30,40,70,.06);
}

* { box-sizing: border-box; }
/* The [hidden] attribute must always win over any display rule. */
[hidden] { display: none !important; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 10px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: var(--muted); background-clip: padding-box; }
::-webkit-scrollbar-track { background: transparent; }

body {
  margin: 0;
  font-family: "Vazirmatn", "Segoe UI", Tahoma, sans-serif;
  background: var(--bg-grad);
  color: var(--text);
  height: 100vh;
  display: flex;
  flex-direction: column;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

/* ---------- تاپ‌بار ---------- */
.topbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 20px;
  background: color-mix(in srgb, var(--surface) 70%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.brand { font-weight: 700; font-size: 17px; color: var(--text-strong); display: flex; align-items: center; gap: 8px; }
.meta { display: flex; gap: 10px; align-items: center; }
.badge {
  background: var(--surface-2); border: 1px solid var(--border);
  padding: 6px 12px; border-radius: 999px; font-size: 12px; color: var(--muted);
}
.badge.warn { color: var(--yellow); border-color: color-mix(in srgb, var(--yellow) 40%, var(--border)); background: color-mix(in srgb, var(--yellow) 8%, transparent); }
.badge.ok { color: var(--green); border-color: color-mix(in srgb, var(--green) 40%, var(--border)); background: color-mix(in srgb, var(--green) 8%, transparent); }

/* ---------- چیدمان ---------- */
.layout {
  flex: 1;
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr) 0;
  gap: 14px;
  padding: 14px;
  overflow: hidden;
  transition: grid-template-columns .2s ease;
}
.layout.tools-open { grid-template-columns: 260px minmax(0, 1fr) 400px; }
.sidebar, .chat, .tools {
  overflow-y: auto;
  display: flex; flex-direction: column; gap: 14px;
  min-height: 0;
}
.tools { display: flex; }
.layout:not(.tools-open) .tools { display: none; }
#modelSelect { max-width: 190px; padding: 7px 10px; }

/* سایدبار گفتگوها */
.new-chat { width: 100%; padding: 11px; font-size: 14px; border-radius: 11px; }
.sidebar-label { color: var(--muted); font-size: 12px; font-weight: 600; padding: 0 4px; }
.conv-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; overflow-y: auto; }
.conv-list li {
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  padding: 10px 11px; border-radius: 10px; cursor: pointer; border: 1px solid transparent;
  transition: background .15s, border-color .15s;
}
.conv-list li:hover { background: var(--surface); }
.conv-list li.active { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 45%, transparent); }
.conv-list .c-main { flex: 1; min-width: 0; }
.conv-list .c-title { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.conv-list .c-sub { display: block; color: var(--muted); font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; direction: ltr; text-align: right; }
.conv-list .del { color: var(--muted); background: none; border: none; padding: 3px 7px; border-radius: 6px; }
.conv-list .del:hover { color: var(--red); background: color-mix(in srgb, var(--red) 12%, transparent); filter: none; }

/* ---------- پنل‌ها ---------- */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow-sm);
}
.panel h3, .files h3, .chat h3 { margin: 0 0 12px; font-size: 13px; color: var(--muted); font-weight: 600; letter-spacing: .2px; }

/* ---------- فرم‌ها ---------- */
input, textarea, select, button {
  font-family: inherit; font-size: 13px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  padding: 9px 11px;
  outline: none;
  transition: border-color .15s, box-shadow .15s, background .15s, filter .15s;
}
input::placeholder, textarea::placeholder { color: color-mix(in srgb, var(--muted) 80%, transparent); }
input:focus, textarea:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

button {
  cursor: pointer;
  background: linear-gradient(180deg, var(--accent), var(--accent-2));
  border: 1px solid transparent; color: #fff; font-weight: 600;
}
button:hover { filter: brightness(1.08); }
button:active { transform: translateY(1px); }
button:disabled { opacity: .55; cursor: not-allowed; filter: none; transform: none; }
button.mini { padding: 6px 10px; background: var(--surface-2); border-color: var(--border); color: var(--text); font-weight: 500; }
button.mini:hover { background: var(--surface-3); filter: none; }
button.danger { background: linear-gradient(180deg, #f2696e, #e0484d); }

.clone-box { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }

/* انتخابگر ریپو از گیت‌هاب */
.repo-picker { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.repo-picker select { width: 100%; }
.repo-picker .branch-row { margin-bottom: 0; }
.repo-hint { line-height: 1.9; margin-bottom: 10px; }
.repo-hint code { background: var(--surface-2); padding: 1px 5px; border-radius: 4px; direction: ltr; display: inline-block; }
details#manualClone { margin-bottom: 12px; }
details#manualClone > summary {
  cursor: pointer; color: var(--muted); font-size: 12px; padding: 6px 0; list-style: none; user-select: none;
}
details#manualClone > summary::-webkit-details-marker { display: none; }
details#manualClone > summary::before { content: "▸ "; }
details#manualClone[open] > summary::before { content: "▾ "; }

/* ---------- لیست‌ها (مخازن / گفتگوها) ---------- */
.ws-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 5px; }
.ws-list li {
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  padding: 10px 11px; border-radius: 10px; cursor: pointer; border: 1px solid transparent;
  transition: background .15s, border-color .15s;
}
.ws-list li:hover { background: var(--surface-2); }
.ws-list li.active { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 45%, transparent); }
.ws-list .ws-branch { color: var(--muted); font-size: 11px; }
.ws-list .del { color: var(--muted); background: none; border: none; padding: 3px 7px; border-radius: 6px; }
.ws-list .del:hover { color: var(--red); background: color-mix(in srgb, var(--red) 12%, transparent); filter: none; }

.panel-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.panel-head h3 { margin: 0; }
#convList li { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
#convList .conv-title { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
#convList .conv-count { color: var(--muted); font-size: 11px; }

.branch-row { display: flex; gap: 7px; margin-bottom: 9px; }
.branch-row select, .branch-row input { flex: 1; }
.branch-row button { white-space: nowrap; }

.status-box {
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px;
  padding: 10px; font-size: 12px; max-height: 150px; overflow: auto; margin-bottom: 10px;
  font-family: var(--mono); direction: ltr; text-align: left;
}
.status-box .clean { color: var(--green); }
.status-box .modified { color: var(--yellow); }

#commitMsg { width: 100%; min-height: 54px; resize: vertical; }
.btn-row { display: flex; gap: 7px; flex-wrap: wrap; }
.btn-row button { flex: 1; }

/* ---------- تب‌ها ---------- */
.tools { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow-sm); }
.tabs { display: flex; gap: 4px; background: var(--surface-2); padding: 4px; border-radius: 11px; }
.tab { flex: 1; background: none; border: none; color: var(--muted); padding: 8px 12px; border-radius: 8px; font-weight: 500; }
.tab:hover { color: var(--text); filter: none; }
.tab.active { background: var(--surface); color: var(--text-strong); box-shadow: var(--shadow-sm); }
.tab-content { display: none; flex: 1; flex-direction: column; gap: 12px; overflow: hidden; min-height: 0; }
.tab-content.active { display: flex; }

.files-header, .editor-header { display: flex; justify-content: space-between; align-items: center; }
.tree {
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 11px;
  padding: 8px; max-height: 38%; overflow: auto; font-size: 12px;
  direction: ltr; text-align: left; min-height: 60px;
}
.tree:empty::after { content: "— فایلی نیست —"; color: var(--muted); font-size: 12px; display: block; text-align: center; padding: 18px 0; }
.tree .node { padding: 4px 8px; border-radius: 7px; cursor: pointer; white-space: nowrap; }
.tree .node:hover { background: var(--surface-3); }
.tree .node.dir { color: var(--accent); }
.tree .node.file { color: var(--text); }

.editor-wrap { flex: 1; display: flex; flex-direction: column; gap: 8px; min-height: 200px; }
#editor {
  flex: 1; width: 100%; resize: none; font-family: var(--mono); font-size: 13px;
  direction: ltr; text-align: left; line-height: 1.6; min-height: 200px; background: var(--bg);
}
#openFile { font-family: var(--mono); direction: ltr; font-size: 12px; color: var(--muted); }

/* ---------- چت ---------- */
.chat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow-sm); }
.chat-header { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding-bottom: 12px; border-bottom: 1px solid var(--border-soft); }
.chat-title-wrap { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.chat-header h3 { margin: 0; font-size: 15px; color: var(--text-strong); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.repo-chips { display: flex; gap: 6px; }
.repo-chips .chip {
  font-size: 11px; color: var(--muted); background: var(--surface-2);
  border: 1px solid var(--border); border-radius: 999px; padding: 2px 10px; direction: ltr;
}
.chat-actions { display: flex; gap: 6px; }

/* نوار انتخاب ریپو/برنچ (قبل از اولین پیام) — چیپ‌های جمع‌وجور */
.repo-picker-bar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.repo-picker-bar select.picker {
  flex: 0 1 auto; width: auto; max-width: 240px;
  padding: 6px 10px; font-size: 12px; border-radius: 999px;
}
.repo-picker-bar select.picker.branch { max-width: 150px; }
.repo-picker-bar select.picker.model { max-width: 320px; border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); }
.repo-picker-bar select.picker.model:invalid { color: var(--muted); }
.manual-repo { flex: 0 0 100%; }
.manual-repo > summary { cursor: pointer; color: var(--muted); font-size: 12px; padding: 4px 0; list-style: none; user-select: none; }
.manual-repo > summary::-webkit-details-marker { display: none; }
.manual-repo > summary::before { content: "✏️ "; }
.manual-repo[open] { display: flex; flex-wrap: wrap; gap: 8px; }
.manual-repo[open] > summary { flex: 0 0 100%; }
.manual-repo input { flex: 1; }

.messages { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; padding: 14px 2px; min-height: 0; }
.messages:empty { align-items: center; justify-content: center; }
.messages:empty::after {
  content: "👋 برای شروع، یک مخزن را کلون یا انتخاب کن، بعد پیامت را بنویس";
  color: var(--muted); font-size: 14px; text-align: center; max-width: 300px; line-height: 2;
}
.msg { border-radius: 14px; padding: 11px 14px; max-width: 88%; white-space: pre-wrap; word-break: break-word; line-height: 1.75; box-shadow: var(--shadow-sm); }
.msg.user { background: linear-gradient(180deg, var(--accent), var(--accent-2)); color: #fff; align-self: flex-start; border-bottom-right-radius: 5px; }
.msg.assistant { background: var(--surface-2); border: 1px solid var(--border); align-self: flex-end; border-bottom-left-radius: 5px; }
.msg.tool {
  background: var(--bg); border: 1px solid var(--border-soft); font-size: 12px;
  font-family: var(--mono); direction: ltr; text-align: left; color: var(--muted);
  align-self: flex-end; max-width: 100%; box-shadow: none;
}
.msg.tool .tool-name { color: var(--accent); font-weight: 700; }
/* ترمینال زنده‌ی run_command */
.msg.term-msg { width: 100%; max-width: 100%; padding: 0; overflow: hidden; border-color: var(--border); }
.term-head {
  display: flex; align-items: center; gap: 8px; padding: 7px 12px;
  background: var(--surface-2); border-bottom: 1px solid var(--border);
  font-family: var(--mono); font-size: 12px; color: var(--text); direction: ltr; text-align: left;
}
.term-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--green); flex: 0 0 auto; box-shadow: 0 0 6px color-mix(in srgb, var(--green) 60%, transparent); }
.term-exit { margin-inline-start: auto; font-weight: 700; padding: 1px 8px; border-radius: 999px; font-size: 11px; }
.term-exit.ok { color: var(--green); background: color-mix(in srgb, var(--green) 12%, transparent); }
.term-exit.bad { color: var(--red); background: color-mix(in srgb, var(--red) 12%, transparent); }
.term-out {
  margin: 0 !important; border: 0 !important; border-radius: 0 !important;
  background: #0b0e14 !important; color: #cdd6e4; padding: 10px 12px !important;
  max-height: 360px; overflow: auto; white-space: pre-wrap; word-break: break-word;
  font-family: var(--mono); font-size: 12px; line-height: 1.5;
}
.msg.error { background: color-mix(in srgb, var(--red) 12%, transparent); border: 1px solid var(--red); color: var(--red); align-self: flex-end; }
.msg pre { margin: 6px 0 0; background: var(--bg); padding: 8px 10px; border-radius: 8px; overflow-x: auto; direction: ltr; text-align: left; border: 1px solid var(--border-soft); }

/* Markdown داخل پیام دستیار */
.msg.assistant { position: relative; }
.msg.assistant p { margin: 0 0 8px; }
.msg.assistant p:last-child { margin-bottom: 0; }
.msg.assistant h1, .msg.assistant h2, .msg.assistant h3, .msg.assistant h4 { margin: 12px 0 6px; color: var(--text-strong); line-height: 1.4; }
.msg.assistant h1 { font-size: 18px; } .msg.assistant h2 { font-size: 16px; } .msg.assistant h3 { font-size: 15px; } .msg.assistant h4 { font-size: 14px; }
.msg.assistant ul, .msg.assistant ol { margin: 6px 0; padding-inline-start: 22px; }
.msg.assistant li { margin: 3px 0; }
.msg.assistant a { color: var(--accent); }
.msg.assistant blockquote { margin: 6px 0; padding: 4px 12px; border-inline-start: 3px solid var(--accent); color: var(--muted); }
.msg.assistant hr { border: none; border-top: 1px solid var(--border); margin: 10px 0; }
.msg.assistant code { background: var(--bg); border: 1px solid var(--border-soft); border-radius: 5px; padding: 1px 5px; font-family: var(--mono); font-size: .92em; direction: ltr; }
.msg.assistant pre code { background: none; border: none; padding: 0; }

/* بلوک کد با دکمه‌ی کپی */
.code-block { position: relative; margin: 8px 0; }
.code-block pre {
  margin: 0; background: var(--bg); border: 1px solid var(--border); border-radius: 10px;
  padding: 12px 12px 12px 12px; overflow-x: auto; direction: ltr; text-align: left;
}
.code-block code { font-family: var(--mono); font-size: 12.5px; line-height: 1.6; color: var(--text); }
.copy-btn {
  position: absolute; top: 6px; left: 6px; z-index: 1;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--muted);
  border-radius: 7px; padding: 3px 8px; font-size: 12px; cursor: pointer; opacity: 0; transition: opacity .15s;
}
.code-block:hover .copy-btn { opacity: 1; }
.copy-btn:hover { color: var(--text); filter: none; }
.msg-copy {
  position: absolute; top: 6px; left: 6px;
  background: none; border: none; color: var(--muted); font-size: 13px; cursor: pointer;
  padding: 2px 5px; border-radius: 6px; opacity: 0; transition: opacity .15s;
}
.msg.assistant:hover .msg-copy { opacity: .8; }
.msg-copy:hover { opacity: 1; background: var(--surface-2); filter: none; }

/* ---------- کامپوزر (چت‌باکس) ---------- */
.attach-bar { display: flex; flex-wrap: wrap; gap: 7px; }
.attach-bar:empty { display: none; }
.attach-chip {
  display: flex; align-items: center; gap: 7px; background: var(--surface-2);
  border: 1px solid var(--border); border-radius: 9px; padding: 5px 9px; font-size: 12px;
}
.attach-chip img { width: 30px; height: 30px; object-fit: cover; border-radius: 5px; }
.msg .att-img { max-width: 220px; max-height: 220px; border-radius: 8px; margin-top: 6px; display: block; }
.msg .att-file { font-size: 12px; color: var(--muted); margin-top: 4px; direction: ltr; }

/* فایلی که هوش مصنوعی می‌فرستد */
.msg.file { max-width: 100%; width: min(560px, 100%); }
.file-cap { margin-bottom: 8px; }
.file-img { max-width: 100%; border-radius: 10px; border: 1px solid var(--border); display: block; }
.file-frame { width: 100%; height: 420px; border: 1px solid var(--border); border-radius: 10px; background: #fff; }
.file-frame.pdf { height: 520px; }
.file-icon { padding: 14px; background: var(--bg); border: 1px solid var(--border); border-radius: 10px; direction: ltr; text-align: center; }
.file-audio { width: 100%; margin-top: 4px; }

/* کارت برنامه (Plan/Todo) */
.msg.plan-card {
  align-self: stretch; max-width: 100%; background: var(--surface-2);
  border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--border));
  font-size: 13px;
}
.plan-title { font-weight: 700; color: var(--text-strong); margin-bottom: 8px; }
.plan-step { padding: 3px 0; color: var(--muted); }
.plan-step.done { color: var(--green); }
.plan-step.in_progress { color: var(--yellow); font-weight: 600; }
.plan-step.pending { color: var(--muted); }
.agent-row { padding: 6px 0; border-top: 1px solid var(--border-soft); }
.agent-row:first-of-type { border-top: none; }
.agent-sum { color: var(--muted); font-size: 12px; margin-top: 3px; white-space: pre-wrap; }
.file-actions { margin-top: 8px; }
.file-dl { display: inline-block; color: var(--accent); text-decoration: none; font-size: 13px; border: 1px solid var(--border); border-radius: 8px; padding: 5px 12px; }
.file-dl:hover { background: var(--surface-2); }
.attach-chip .rm { color: var(--red); background: none; border: none; cursor: pointer; padding: 0 2px; }

.composer {
  display: flex; align-items: flex-end; gap: 8px;
  padding: 8px; margin-top: 6px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 16px; box-shadow: var(--shadow-sm);
  transition: border-color .15s, box-shadow .15s;
}
.composer:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.composer textarea {
  flex: 1; border: none; background: transparent; resize: none; box-shadow: none;
  max-height: 180px; min-height: 46px; padding: 10px 8px; font-size: 14px; line-height: 1.7;
}
.composer textarea:focus { border: none; box-shadow: none; }
.attach-btn {
  display: flex; align-items: center; justify-content: center; cursor: pointer;
  width: 44px; height: 44px; flex: none; border-radius: 12px;
  background: var(--surface-3); border: 1px solid var(--border); font-size: 18px; user-select: none;
  transition: filter .15s, background .15s;
}
.attach-btn:hover { background: var(--surface); }
.composer #sendBtn { height: 44px; padding: 0 22px; border-radius: 12px; align-self: flex-end; }

.spinner { display: inline-block; width: 13px; height: 13px; border: 2px solid var(--muted);
  border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; vertical-align: middle; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Diff ---------- */
.diff-view {
  flex: 1; background: var(--bg); border: 1px solid var(--border); border-radius: 11px;
  padding: 12px; overflow: auto; font-family: var(--mono); font-size: 12px; line-height: 1.6;
  direction: ltr; text-align: left; white-space: pre; min-height: 220px;
}
.diff-view .add { color: var(--green); background: color-mix(in srgb, var(--green) 12%, transparent); display: block; }
.diff-view .del { color: var(--red); background: color-mix(in srgb, var(--red) 12%, transparent); display: block; }
.diff-view .hunk { color: var(--accent); display: block; }
.diff-view .meta { color: var(--muted); display: block; }

/* ---------- گیت‌هاب ---------- */
.tools .tab-content[data-tab="github"] { overflow-y: auto; }
.gh-section {
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 11px;
  padding: 14px; display: flex; flex-direction: column; gap: 9px;
}
.gh-section h3 { margin: 0; }
.gh-list { display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.gh-item {
  background: var(--surface); border: 1px solid var(--border); border-radius: 9px;
  padding: 9px 11px; display: flex; justify-content: space-between; align-items: center; gap: 8px;
}
.gh-item a { color: var(--accent); text-decoration: none; }
.gh-badge { font-size: 11px; padding: 3px 9px; border-radius: 999px; border: 1px solid var(--border); }
.gh-badge.success { color: var(--green); border-color: var(--green); }
.gh-badge.failure { color: var(--red); border-color: var(--red); }
.gh-badge.in_progress, .gh-badge.queued, .gh-badge.pending { color: var(--yellow); border-color: var(--yellow); }
#prBody { min-height: 54px; resize: vertical; }

/* ---------- ورود ---------- */
.overlay {
  position: fixed; inset: 0; background: color-mix(in srgb, var(--bg) 82%, #000); z-index: 1000;
  display: flex; align-items: center; justify-content: center; backdrop-filter: blur(6px);
}
.overlay[hidden] { display: none; }
.login-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 18px;
  padding: 30px; width: 340px; display: flex; flex-direction: column; gap: 14px; text-align: center;
  box-shadow: var(--shadow);
}
.login-card h2 { margin: 0; color: var(--text-strong); }
.login-card .muted, .muted { color: var(--muted); font-size: 12px; margin: 0; }
.login-err { color: var(--red); font-size: 12px; min-height: 16px; }

/* ---------- توست ---------- */
.toast {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%);
  background: var(--surface); border: 1px solid var(--border); padding: 11px 18px;
  border-radius: 11px; z-index: 100; box-shadow: var(--shadow); color: var(--text);
}
.toast.error { border-color: var(--red); color: var(--red); }
.toast.ok { border-color: var(--green); color: var(--green); }

/* استریم: مکان‌نمای چشمک‌زن */
.msg.assistant.streaming::after {
  content: "▋"; color: var(--accent); animation: blink 1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

/* ---------- واکنش‌گرا ---------- */
@media (max-width: 1100px) {
  .layout { grid-template-columns: 1fr; overflow: auto; }
  .sidebar, .center, .chat { overflow: visible; }
}
