:root {
  color-scheme: dark;
  --bg: #0b0d12;
  --panel: #11141b;
  --panel-2: #161a23;
  --panel-3: #1b202b;
  --line: rgba(255, 255, 255, .08);
  --line-strong: rgba(255, 255, 255, .13);
  --text: #f5f7fb;
  --muted: #9aa3b2;
  --faint: #697386;
  --accent: #6c7cff;
  --accent-2: #8b5cf6;
  --green: #36d399;
  --amber: #f5b942;
  --red: #ff6577;
  --shadow: 0 24px 80px rgba(0, 0, 0, .38);
  --radius: 16px;
  --font: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Tahoma, Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { width: 100%; height: 100%; margin: 0; overflow: hidden; }
body { background: var(--bg); color: var(--text); font-family: var(--font); font-size: 15px; }
button, input, textarea { font: inherit; }
button { color: inherit; }
button:focus-visible, input:focus-visible, textarea:focus-visible { outline: 2px solid rgba(108, 124, 255, .8); outline-offset: 2px; }
.hidden { display: none !important; }
.mobile-only { display: none !important; }

.login-screen {
  position: relative;
  min-height: 100%;
  display: grid;
  place-items: center;
  overflow: hidden;
  padding: 24px;
  background:
    radial-gradient(circle at 50% 0%, rgba(108, 124, 255, .14), transparent 42%),
    linear-gradient(180deg, #0c0e14, #090b10);
}
.login-screen::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: .18;
  background-image: linear-gradient(rgba(255,255,255,.025) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.025) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: linear-gradient(to bottom, black, transparent 75%);
}
.login-glow { position: absolute; width: 420px; height: 420px; border-radius: 50%; filter: blur(110px); opacity: .13; }
.glow-one { background: #596cff; top: -150px; right: 8%; }
.glow-two { background: #8847ff; bottom: -200px; left: 8%; }
.login-card {
  position: relative;
  width: min(440px, 100%);
  padding: 38px;
  border: 1px solid var(--line-strong);
  border-radius: 24px;
  background: linear-gradient(155deg, rgba(24, 28, 38, .96), rgba(14, 17, 24, .97));
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}
.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-weight: 800;
  color: white;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 8px 24px rgba(108, 124, 255, .26);
}
.brand-mark.large { width: 48px; height: 48px; border-radius: 14px; margin-bottom: 22px; font-size: 20px; }
.eyebrow { margin: 0 0 7px; color: #a7b0c0; font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.login-card h1 { margin: 0; font-size: 31px; letter-spacing: -.025em; }
.login-copy { margin: 12px 0 28px; color: var(--muted); line-height: 1.8; }
.field-label { display: block; margin-bottom: 9px; font-size: 13px; font-weight: 700; }
.password-wrap { display: flex; align-items: center; background: #0d1016; border: 1px solid var(--line-strong); border-radius: 13px; transition: border-color .2s, box-shadow .2s; }
.password-wrap:focus-within { border-color: rgba(108,124,255,.7); box-shadow: 0 0 0 4px rgba(108,124,255,.09); }
.password-wrap input { flex: 1; min-width: 0; background: transparent; border: 0; color: var(--text); padding: 14px 16px; outline: none; }
.password-wrap .icon-button { margin-left: 7px; color: var(--muted); font-size: 12px; }
.primary-button, .secondary-button, .new-chat-button, .send-button, .footer-button, .danger-ghost {
  border: 0;
  cursor: pointer;
  transition: transform .16s ease, opacity .16s, background .16s, border-color .16s;
}
.primary-button { padding: 11px 17px; border-radius: 11px; background: linear-gradient(135deg, var(--accent), #7f64e9); color: white; font-weight: 750; box-shadow: 0 8px 24px rgba(108,124,255,.19); }
.primary-button:hover { transform: translateY(-1px); }
.primary-button:disabled { opacity: .5; cursor: default; transform: none; }
.primary-button.wide { width: 100%; margin-top: 16px; min-height: 49px; display: flex; align-items: center; justify-content: center; gap: 10px; }
.button-spinner { display: none; width: 15px; height: 15px; border: 2px solid rgba(255,255,255,.35); border-top-color: white; border-radius: 50%; animation: spin .75s linear infinite; }
.loading .button-spinner { display: block; }
@keyframes spin { to { transform: rotate(360deg); } }
.form-error { min-height: 20px; margin: 10px 0 0; color: #ff8795; font-size: 13px; }
.secure-note { margin: 18px 0 0; text-align: center; font-size: 12px; color: var(--faint); line-height: 1.6; }

.app-shell { height: 100%; display: grid; grid-template-columns: 286px minmax(0, 1fr); background: var(--bg); }
.sidebar {
  position: relative;
  z-index: 10;
  min-height: 0;
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--line);
  background: #0e1117;
  padding: 17px 14px 13px;
}
.sidebar-header { min-height: 46px; display: flex; align-items: center; justify-content: space-between; padding: 0 5px; }
.brand-row { display: flex; align-items: center; gap: 11px; }
.brand-row strong { display: block; font-size: 14px; }
.brand-row small { display: block; margin-top: 2px; color: var(--faint); font-size: 11px; }
.icon-button { min-width: 34px; min-height: 34px; border: 0; border-radius: 9px; background: transparent; cursor: pointer; color: var(--muted); }
.icon-button:hover { background: rgba(255,255,255,.06); color: var(--text); }
.new-chat-button { display: flex; align-items: center; justify-content: center; gap: 9px; width: 100%; margin: 14px 0 12px; padding: 11px 13px; border: 1px solid rgba(108,124,255,.28); border-radius: 11px; background: rgba(108,124,255,.095); color: #dce0ff; font-weight: 700; }
.new-chat-button:hover { background: rgba(108,124,255,.16); border-color: rgba(108,124,255,.45); }
.new-chat-button .plus { font-size: 18px; line-height: 1; }
.search-wrap { display: flex; align-items: center; gap: 7px; padding: 0 11px; border: 1px solid transparent; border-radius: 10px; background: rgba(255,255,255,.035); color: var(--faint); }
.search-wrap:focus-within { border-color: var(--line-strong); background: rgba(255,255,255,.05); }
.search-wrap input { min-width: 0; flex: 1; border: 0; outline: 0; padding: 10px 0; background: transparent; color: var(--text); font-size: 13px; }
.search-wrap input::placeholder { color: #626b79; }
.sidebar-section-label { margin: 20px 8px 8px; color: var(--faint); font-size: 11px; font-weight: 750; }
.conversation-list { flex: 1; min-height: 0; overflow-y: auto; padding: 0 0 8px; scrollbar-width: thin; scrollbar-color: #262b36 transparent; }
.conversation-item { position: relative; display: flex; align-items: center; gap: 9px; width: 100%; margin: 2px 0; padding: 10px 10px; border: 0; border-radius: 10px; background: transparent; color: var(--muted); text-align: right; cursor: pointer; }
.conversation-item:hover { background: rgba(255,255,255,.04); color: var(--text); }
.conversation-item.active { background: rgba(255,255,255,.075); color: var(--text); }
.conversation-icon { width: 27px; height: 27px; flex: 0 0 auto; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 8px; background: #151922; color: #9ba6b8; font-size: 12px; }
.conversation-copy { min-width: 0; flex: 1; }
.conversation-copy strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; font-weight: 640; }
.conversation-copy small { display: block; margin-top: 3px; color: var(--faint); font-size: 10px; }
.item-status { width: 6px; height: 6px; border-radius: 50%; background: transparent; }
.item-status.running, .item-status.planning { background: var(--green); box-shadow: 0 0 0 3px rgba(54,211,153,.09); }
.item-status.waiting_approval { background: var(--amber); box-shadow: 0 0 0 3px rgba(245,185,66,.09); }
.sidebar-footer { padding-top: 9px; border-top: 1px solid var(--line); }
.footer-button { width: 100%; display: flex; justify-content: space-between; padding: 10px 11px; border-radius: 9px; background: transparent; color: var(--muted); font-size: 13px; }
.footer-button:hover { background: rgba(255,255,255,.04); color: var(--text); }
.sidebar-scrim { display: none; }

.workspace { min-width: 0; min-height: 0; display: grid; grid-template-rows: auto minmax(0, 1fr) auto; background: #0b0e13; }
.topbar { min-height: 70px; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 11px 24px; border-bottom: 1px solid var(--line); background: rgba(11,14,19,.88); backdrop-filter: blur(16px); }
.topbar-title { min-width: 0; display: flex; align-items: center; gap: 10px; }
.topbar h2 { margin: 0 0 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 15px; font-weight: 720; max-width: min(52vw, 680px); }
.scope-button { max-width: min(52vw, 680px); display: flex; align-items: center; gap: 6px; padding: 0; border: 0; background: transparent; color: var(--faint); cursor: pointer; font-size: 11px; }
.scope-button:hover { color: var(--muted); }
.scope-button span:nth-child(2) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; direction: ltr; }
.status-dot { width: 6px; height: 6px; flex: 0 0 auto; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 3px rgba(54,211,153,.1); }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.connection-state { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 11px; }
.connection-state span { width: 6px; height: 6px; border-radius: 50%; background: var(--green); }
.connection-state.offline span { background: var(--red); }
.topbar-actions .icon-button { width: auto; padding: 0 10px; font-size: 11px; }

.timeline { min-height: 0; overflow-y: auto; overflow-x: hidden; scroll-behavior: smooth; scrollbar-width: thin; scrollbar-color: #2a303c transparent; }
.empty-state { min-height: 100%; max-width: 760px; margin: 0 auto; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 56px 24px 120px; text-align: center; }
.empty-orb { width: 62px; height: 62px; margin-bottom: 25px; display: grid; place-items: center; border: 1px solid rgba(121,134,255,.24); border-radius: 22px; background: linear-gradient(145deg, rgba(108,124,255,.2), rgba(139,92,246,.06)); box-shadow: 0 24px 80px rgba(87,79,212,.17), inset 0 1px rgba(255,255,255,.08); transform: rotate(6deg); }
.empty-orb span { font-size: 23px; font-weight: 850; transform: rotate(-6deg); }
.empty-state h1 { margin: 2px 0 11px; font-size: clamp(25px, 3vw, 35px); letter-spacing: -.035em; }
.empty-state > p:not(.eyebrow) { max-width: 590px; margin: 0; color: var(--muted); line-height: 1.85; }
.suggestion-grid { width: 100%; display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 32px; }
.suggestion { padding: 16px; border: 1px solid var(--line); border-radius: 13px; background: rgba(255,255,255,.025); color: var(--text); text-align: right; cursor: pointer; transition: transform .15s, background .15s, border-color .15s; }
.suggestion:hover { transform: translateY(-2px); background: rgba(255,255,255,.045); border-color: var(--line-strong); }
.suggestion strong { display: block; margin-bottom: 6px; font-size: 13px; }
.suggestion span { display: block; color: var(--faint); font-size: 11px; line-height: 1.5; }
.event-stream { width: min(850px, calc(100% - 34px)); margin: 0 auto; padding: 34px 0 100px; }
.event-group { margin-bottom: 22px; animation: eventIn .25s ease both; }
@keyframes eventIn { from { opacity: 0; transform: translateY(8px); } }
.event-label { margin: 0 0 7px; color: var(--faint); font-size: 10px; font-weight: 700; }
.message { max-width: 88%; border-radius: 16px; line-height: 1.78; white-space: pre-wrap; overflow-wrap: anywhere; }
.message.user { margin-right: auto; padding: 13px 16px; background: #252b38; border: 1px solid rgba(255,255,255,.055); border-bottom-left-radius: 5px; }
.message.assistant { padding: 3px 2px; color: #e8ebf1; }
.message.assistant h1, .message.assistant h2, .message.assistant h3 { margin: 14px 0 7px; }
.message.assistant code { direction: ltr; display: inline-block; padding: 2px 6px; border-radius: 5px; background: rgba(255,255,255,.07); color: #d7dcff; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .91em; }
.system-card { border: 1px solid var(--line); border-radius: 14px; background: rgba(255,255,255,.022); overflow: hidden; }
.system-card-header { display: flex; align-items: center; gap: 10px; padding: 12px 14px; }
.card-icon { width: 27px; height: 27px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 8px; background: rgba(108,124,255,.12); color: #aeb7ff; font-size: 12px; }
.system-card strong { display: block; font-size: 12px; }
.system-card p { margin: 3px 0 0; color: var(--muted); font-size: 12px; line-height: 1.65; white-space: pre-wrap; }
.plan-list { margin: 0; padding: 0 14px 13px 14px; list-style: none; counter-reset: plan; }
.plan-list li { position: relative; margin: 6px 0; padding-right: 25px; color: #b8c0cc; font-size: 11px; line-height: 1.6; counter-increment: plan; }
.plan-list li::before { content: counter(plan); position: absolute; right: 0; top: 1px; width: 17px; height: 17px; display: grid; place-items: center; border: 1px solid var(--line-strong); border-radius: 50%; color: var(--faint); font-size: 9px; }
.status-line { display: flex; align-items: center; gap: 9px; color: var(--muted); font-size: 12px; padding: 7px 2px; }
.status-line .mini-spinner { width: 13px; height: 13px; flex: 0 0 auto; border: 2px solid rgba(255,255,255,.12); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
.status-line.success .mini-spinner { border: 0; background: var(--green); box-shadow: 0 0 0 4px rgba(54,211,153,.08); animation: none; }
.status-line.error { color: #ff97a3; }
.status-line.error .mini-spinner { border: 0; background: var(--red); animation: none; }
.approval-card { border: 1px solid rgba(245,185,66,.3); border-radius: 16px; background: linear-gradient(145deg, rgba(245,185,66,.07), rgba(255,255,255,.018)); overflow: hidden; box-shadow: 0 12px 42px rgba(0,0,0,.14); }
.approval-head { display: flex; align-items: flex-start; gap: 12px; padding: 16px 16px 10px; }
.approval-head .card-icon { background: rgba(245,185,66,.12); color: var(--amber); }
.approval-head h3 { margin: 0 0 5px; font-size: 14px; }
.approval-head p { margin: 0; color: #c4c9d3; font-size: 12px; line-height: 1.7; white-space: pre-wrap; }
.risk-chip { margin-right: auto; padding: 4px 8px; border-radius: 99px; background: rgba(245,185,66,.11); color: #f7c967; font-size: 9px; white-space: nowrap; }
.approval-details { margin: 4px 16px 13px; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.approval-details summary { padding: 9px 11px; cursor: pointer; color: var(--muted); font-size: 10px; }
.approval-details pre { max-height: 260px; overflow: auto; margin: 0; padding: 12px; border-top: 1px solid var(--line); direction: ltr; text-align: left; background: #0b0d12; color: #b9c0cd; font: 10px/1.6 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; white-space: pre-wrap; }
.approval-actions { display: flex; gap: 8px; padding: 0 16px 16px; }
.approve-button, .reject-button { padding: 9px 14px; border-radius: 9px; cursor: pointer; font-weight: 720; font-size: 11px; }
.approve-button { border: 0; background: var(--green); color: #06140f; }
.reject-button { border: 1px solid var(--line-strong); background: transparent; color: #c4cad4; }
.approve-button:disabled, .reject-button:disabled { opacity: .45; cursor: default; }
.approval-card.resolved { border-color: var(--line); opacity: .72; }
.done-card { padding: 17px; border: 1px solid rgba(54,211,153,.24); border-radius: 16px; background: linear-gradient(145deg, rgba(54,211,153,.065), rgba(255,255,255,.016)); }
.done-card h3 { display: flex; align-items: center; gap: 8px; margin: 0 0 8px; font-size: 14px; }
.done-card h3 span { width: 20px; height: 20px; display: grid; place-items: center; border-radius: 50%; background: rgba(54,211,153,.15); color: var(--green); font-size: 11px; }
.done-card p { margin: 0; color: #cbd1d9; font-size: 12px; line-height: 1.8; white-space: pre-wrap; }
.tech-details { margin-top: 7px; border-right: 2px solid #2b313d; padding: 4px 11px 4px 0; }
.tech-details summary { cursor: pointer; color: var(--faint); font-size: 10px; }
.tech-details pre { max-height: 330px; overflow: auto; direction: ltr; text-align: left; color: #8792a3; font: 10px/1.6 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; white-space: pre-wrap; }

.composer-area { position: relative; z-index: 4; width: min(880px, calc(100% - 34px)); margin: 0 auto; padding: 0 0 max(13px, env(safe-area-inset-bottom)); background: linear-gradient(to top, #0b0e13 76%, transparent); }
.active-banner { display: flex; align-items: center; justify-content: space-between; margin: 0 3px 7px; padding: 8px 11px; border: 1px solid rgba(108,124,255,.19); border-radius: 10px; background: rgba(108,124,255,.07); color: #b8c0d5; font-size: 11px; }
.active-banner > div { display: flex; align-items: center; gap: 8px; }
.pulse-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 0 rgba(54,211,153,.35); animation: pulse 1.8s infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 7px rgba(54,211,153,0); } 100% { box-shadow: 0 0 0 0 rgba(54,211,153,0); } }
.danger-ghost { padding: 5px 9px; border: 1px solid rgba(255,101,119,.25); border-radius: 7px; background: transparent; color: #ff94a1; font-size: 10px; }
.danger-ghost:hover { background: rgba(255,101,119,.09); }
.composer { border: 1px solid var(--line-strong); border-radius: 17px; background: #151921; box-shadow: 0 16px 55px rgba(0,0,0,.28); overflow: hidden; transition: border-color .2s, box-shadow .2s; }
.composer:focus-within { border-color: rgba(108,124,255,.42); box-shadow: 0 16px 55px rgba(0,0,0,.32), 0 0 0 3px rgba(108,124,255,.055); }
.composer textarea { display: block; width: 100%; min-height: 53px; max-height: 210px; resize: none; padding: 15px 16px 8px; border: 0; outline: 0; background: transparent; color: var(--text); line-height: 1.65; }
.composer textarea::placeholder { color: #697283; }
.composer-bottom { min-height: 42px; display: flex; align-items: center; gap: 10px; padding: 5px 8px 7px 10px; }
.composer-chip { max-width: 240px; display: flex; align-items: center; gap: 6px; padding: 6px 9px; border: 1px solid var(--line); border-radius: 8px; background: rgba(255,255,255,.025); color: var(--muted); cursor: pointer; font-size: 10px; overflow: hidden; }
.composer-chip span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.composer-hint { margin-right: auto; color: var(--faint); font-size: 9px; }
.send-button { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 9px; background: var(--text); color: #0c0f15; font-size: 18px; font-weight: 800; }
.send-button:hover { transform: translateY(-1px); }
.send-button:disabled { opacity: .28; cursor: default; transform: none; }
.footer-note { margin: 6px 0 0; text-align: center; color: #515966; font-size: 9px; }

.scope-dialog { width: min(570px, calc(100% - 26px)); padding: 0; border: 1px solid var(--line-strong); border-radius: 18px; background: #12161e; color: var(--text); box-shadow: var(--shadow); }
.scope-dialog::backdrop { background: rgba(0,0,0,.65); backdrop-filter: blur(4px); }
.dialog-shell > header { display: flex; align-items: center; justify-content: space-between; padding: 17px 19px 13px; border-bottom: 1px solid var(--line); }
.dialog-shell h3 { margin: 0; font-size: 17px; }
.path-bar { display: flex; align-items: center; gap: 8px; margin: 13px 15px 9px; padding: 7px; border: 1px solid var(--line); border-radius: 10px; background: #0e1117; }
.path-bar code { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; direction: ltr; text-align: left; color: #b7c0cc; font-size: 10px; white-space: nowrap; }
.scope-list { height: 300px; overflow-y: auto; padding: 0 15px; }
.folder-row { width: 100%; display: flex; align-items: center; gap: 10px; padding: 10px 9px; border: 0; border-radius: 9px; background: transparent; color: #bdc4cf; cursor: pointer; text-align: right; }
.folder-row:hover { background: rgba(255,255,255,.045); color: var(--text); }
.folder-icon { width: 27px; height: 23px; display: grid; place-items: center; border-radius: 6px; background: rgba(108,124,255,.11); color: #aeb6ff; font-size: 11px; }
.scope-list .empty-folder { padding: 50px 10px; text-align: center; color: var(--faint); font-size: 12px; }
.dialog-shell > footer { display: flex; justify-content: flex-end; gap: 8px; padding: 13px 15px 15px; border-top: 1px solid var(--line); }
.secondary-button { padding: 10px 15px; border: 1px solid var(--line-strong); border-radius: 10px; background: transparent; color: var(--muted); }
.secondary-button:hover { background: rgba(255,255,255,.04); color: var(--text); }
.toast-stack { position: fixed; z-index: 100; left: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 8px; }
.toast { max-width: min(390px, calc(100vw - 36px)); padding: 11px 14px; border: 1px solid var(--line-strong); border-radius: 11px; background: #1a1f29; box-shadow: 0 12px 35px rgba(0,0,0,.35); color: #dfe3ea; font-size: 12px; line-height: 1.6; animation: toastIn .2s ease both; }
.toast.error { border-color: rgba(255,101,119,.3); color: #ffb1ba; }
@keyframes toastIn { from { opacity: 0; transform: translateY(7px); } }

@media (max-width: 820px) {
  .mobile-only { display: grid !important; place-items: center; }
  .app-shell { display: block; }
  .sidebar { position: fixed; inset: 0 0 0 auto; width: min(300px, 86vw); transform: translateX(104%); transition: transform .22s ease; box-shadow: -22px 0 70px rgba(0,0,0,.42); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-scrim { position: fixed; z-index: 9; inset: 0; width: 100%; height: 100%; border: 0; background: rgba(0,0,0,.53); }
  .sidebar.open + .sidebar-scrim { display: block; }
  .workspace { height: 100%; }
  .topbar { min-height: 64px; padding: 9px 12px; }
  .topbar-actions .icon-button { display: none; }
  .connection-state { font-size: 0; }
  .connection-state span { width: 7px; height: 7px; }
  .topbar h2 { max-width: 64vw; }
  .scope-button { max-width: 64vw; }
  .suggestion-grid { grid-template-columns: 1fr; }
  .empty-state { justify-content: flex-start; padding-top: 12vh; }
  .empty-state h1 { font-size: 26px; }
  .event-stream { width: calc(100% - 24px); padding-top: 24px; }
  .message { max-width: 94%; }
  .composer-area { width: calc(100% - 20px); }
  .composer-hint { display: none; }
  .composer-chip { max-width: 155px; }
  .login-card { padding: 29px 23px; }
}

@media (max-width: 480px) {
  .topbar-title { gap: 5px; }
  .topbar { padding-inline: 8px; }
  .topbar h2 { max-width: 60vw; font-size: 13px; }
  .scope-button { max-width: 60vw; }
  .empty-state { padding-inline: 16px; }
  .empty-state > p:not(.eyebrow) { font-size: 13px; }
  .approval-head { flex-wrap: wrap; }
  .risk-chip { margin-right: 39px; }
  .approval-actions > * { flex: 1; }
}

/* ===== المرفقات وحذف المحادثة ===== */
.attachment-preview { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px 10px 0; }
.attachment-preview.hidden { display: none; }
.attachment-chip { display: flex; align-items: center; gap: 8px; max-width: 270px; padding: 6px 8px 6px 10px; border: 1px solid var(--line-strong); border-radius: 10px; background: rgba(108,124,255,.07); }
.attachment-meta { min-width: 0; display: flex; flex-direction: column; }
.attachment-meta strong { color: var(--text); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 200px; }
.attachment-meta small { color: var(--faint); font-size: 10px; }
.attachment-remove { border: 0; background: transparent; color: var(--faint); font-size: 15px; cursor: pointer; padding: 0 2px; line-height: 1; }
.attachment-remove:hover { color: #ffb1ba; }
.attachment-event { padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: rgba(108,124,255,.05); }
.attachment-event-head { display: flex; align-items: center; gap: 8px; color: #c9cee8; font-size: 12px; }
.attachment-event-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.attachment-event-chip { padding: 4px 9px; border-radius: 999px; background: rgba(108,124,255,.13); color: #cdd2f5; font-size: 11px; }
.attachment-event-chip.muted { background: rgba(255,255,255,.05); color: var(--faint); }
.attachment-event-chip.bad { background: rgba(255,101,119,.12); color: #ffb1ba; }
.conversation-delete { margin-inline-start: auto; border: 0; background: transparent; color: var(--faint); cursor: pointer; font-size: 12px; padding: 4px; opacity: 0; transition: opacity .15s ease; }
.conversation-item:hover .conversation-delete { opacity: 1; }
.conversation-delete:hover { color: #ffb1ba; }

/* ===== الموافقة الجماعية ===== */
.batch-bar {
  position: sticky;
  top: 0;
  z-index: 40;
  margin: 14px 0 14px;
  padding: 14px 16px;
  background: linear-gradient(160deg, #1a1e2b, #13151f);
  border: 1px solid rgba(139, 92, 246, .35);
  border-radius: 14px;
  box-shadow: 0 10px 34px rgba(0, 0, 0, .45);
}
.batch-bar-head h3 { margin: 0 0 4px; font-size: 14px; color: #eceaf6; }
.batch-bar-head p { margin: 0 0 12px; font-size: 12px; color: #9b97ad; }
.batch-bar-list { display: flex; flex-direction: column; gap: 8px; max-height: 240px; overflow: auto; }
.batch-row { display: flex; align-items: flex-start; gap: 10px; padding: 8px 10px; background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.07); border-radius: 10px; cursor: pointer; }
.batch-row:hover { background: rgba(255,255,255,.07); }
.batch-row input[type="checkbox"] { width: 17px; height: 17px; margin-top: 2px; accent-color: #7c5cff; flex: none; cursor: pointer; }
.batch-row div:nth-child(2) { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.batch-row strong { font-size: 12px; color: #cfcbe0; }
.batch-row small { font-size: 11px; color: #9b97ad; white-space: pre-wrap; word-break: break-word; }
.batch-row .risk-chip { flex: none; }
.batch-bar-actions { display: flex; justify-content: flex-end; margin-top: 12px; }
.batch-mode .approval-actions { display: none; }

/* ===== عرض صورة المرفق داخل المحادثة ومعاينة التغيير ===== */
.attachment-event-images { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.attachment-thumb { max-width: 100%; max-height: 260px; border-radius: 12px; border: 1px solid var(--line); background: #000; object-fit: contain; cursor: zoom-in; }
.batch-preview { display: block; margin-top: 6px; padding: 6px 8px; border-radius: 8px; background: rgba(0,0,0,.28); border: 1px solid rgba(255,255,255,.06); color: #b9c0d8; font-size: 11px; white-space: pre-wrap; word-break: break-word; }

