/* ==========================================================================
   Ilova (chat) sahifasi
   ========================================================================== */
html, body { height: 100%; }
.app-body { overflow: hidden; }
.app { display: grid; grid-template-columns: 288px 1fr; height: 100dvh; transition: grid-template-columns .35s var(--ease); }
.app.sb-collapsed { grid-template-columns: 0 1fr; }
.app.sb-collapsed .sidebar { transform: translateX(-100%); opacity: 0; pointer-events: none; }

/* ---------- Sidebar ---------- */
.sidebar {
  display: flex; flex-direction: column; min-height: 0; min-width: 0; overflow: hidden;
  background: var(--bg-2); border-right: 1px solid var(--border); padding: 14px 12px 12px; gap: 10px;
  transition: transform .35s var(--ease), opacity .25s;
}
[data-theme="light"] .sidebar { background: #fbfbfe; }
.sb-head { display: flex; align-items: center; justify-content: space-between; padding: 2px 4px 6px; }
.sb-head .logo { font-size: 17px; }
.sb-head .logo-mark { width: 30px; height: 30px; border-radius: 9px; }
.sb-head .logo-mark svg { width: 17px; height: 17px; }

.new-chat {
  display: flex; align-items: center; gap: 10px; height: 44px; padding: 0 14px; border-radius: 12px; font-weight: 600; font-size: 14.5px;
  background: linear-gradient(135deg, rgba(99,102,241,.18), rgba(34,211,238,.1)); border: 1px solid rgba(124,127,245,.32);
  transition: background .2s, border-color .2s, transform .15s;
}
.new-chat:hover { background: linear-gradient(135deg, rgba(99,102,241,.28), rgba(34,211,238,.16)); border-color: rgba(124,127,245,.5); }
.new-chat:active { transform: scale(.99); }
.new-chat svg { width: 18px; height: 18px; color: var(--primary); }
.sb-link { display: flex; align-items: center; gap: 10px; height: 40px; padding: 0 14px; border-radius: 12px; font-weight: 500; font-size: 14px; color: var(--text-2); border: 1px solid transparent; transition: background .15s, color .15s; }
.sb-link:hover { background: var(--surface); color: var(--text); border-color: var(--border); }
.sb-link svg { width: 18px; height: 18px; color: var(--muted); }

.sb-search { position: relative; display: flex; align-items: center; gap: 8px; height: 38px; padding: 0 10px; border-radius: 10px; background: var(--surface); border: 1px solid var(--border); transition: border-color .15s; }
.sb-search:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px var(--ring); }
.sb-search svg { width: 16px; height: 16px; color: var(--muted); flex: none; }
.sb-search input { flex: 1; min-width: 0; background: none; border: 0; outline: none; font-size: 13.5px; }
.sb-search input::-webkit-search-cancel-button { display: none; }
kbd { font-family: var(--font); font-size: 10.5px; font-weight: 600; color: var(--muted); padding: 2px 6px; border-radius: 6px; border: 1px solid var(--border-strong); background: var(--surface); white-space: nowrap; }

.conv-list { flex: 1; min-height: 0; overflow-y: auto; margin: 0 -6px; padding: 4px 6px; scrollbar-width: thin; scrollbar-color: var(--surface-3) transparent; }
.conv-group { margin-bottom: 14px; }
.conv-group h5 { font-size: 11.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: 6px 10px; margin: 0; display: flex; gap: 6px; align-items: center; }
.conv-group h5 svg { width: 12px; height: 12px; }
.conv-item { position: relative; display: flex; align-items: center; border-radius: 10px; transition: background .15s; }
.conv-item a { flex: 1; min-width: 0; padding: 9px 10px; font-size: 14px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; -webkit-mask-image: linear-gradient(90deg, #000 85%, transparent); mask-image: linear-gradient(90deg, #000 85%, transparent); }
.conv-item:hover { background: var(--surface-2); }
.conv-item:hover a { color: var(--text); }
.conv-item.active { background: var(--surface-3); }
.conv-item.active a { color: var(--text); font-weight: 500; }
.conv-item .conv-more { opacity: 0; width: 28px; height: 28px; margin-right: 4px; border-radius: 8px; flex: none; }
.conv-item:hover .conv-more, .conv-item.active .conv-more, .conv-item .conv-more[aria-expanded="true"] { opacity: 1; }
.conv-item .conv-more svg { width: 16px; height: 16px; }
.conv-item input { flex: 1; margin: 3px; height: 32px; padding: 0 8px; border-radius: 8px; border: 1px solid var(--primary); background: var(--bg-elev); outline: none; font-size: 14px; }
.conv-empty { padding: 30px 14px; text-align: center; color: var(--muted); font-size: 13.5px; display: grid; justify-items: center; gap: 10px; }
.conv-empty svg { width: 28px; height: 28px; opacity: .6; }
.skeleton { height: 34px; border-radius: 10px; margin: 6px 4px; background: linear-gradient(90deg, var(--surface) 0%, var(--surface-2) 50%, var(--surface) 100%); background-size: 200% 100%; animation: shimmer 1.4s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

.popover {
  position: absolute; z-index: 60; min-width: 200px; padding: 6px; border-radius: 14px; background: var(--bg-elev);
  border: 1px solid var(--border-strong); box-shadow: var(--shadow-lg); animation: popIn .18s var(--ease);
}
@keyframes popIn { from { opacity: 0; transform: translateY(4px) scale(.98); } }
.popover a, .popover button { display: flex; width: 100%; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 9px; font-size: 14px; color: var(--text-2); text-align: left; }
.popover a:hover, .popover button:hover { background: var(--surface-2); color: var(--text); }
.popover svg { width: 16px; height: 16px; }
.popover .danger { color: var(--red); }
.popover .danger:hover { background: rgba(248,113,113,.1); color: var(--red); }
.pop-sep { height: 1px; background: var(--border); margin: 6px 4px; }
.pop-head { padding: 8px 10px 10px; display: grid; border-bottom: 1px solid var(--border); margin-bottom: 6px; }
.pop-head small { color: var(--muted); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; }
.conv-pop { right: 6px; top: 36px; }

.sb-foot { display: grid; gap: 10px; padding-top: 10px; border-top: 1px solid var(--border); }
.usage-card { padding: 12px 14px; border-radius: 14px; background: var(--surface); border: 1px solid var(--border); display: grid; gap: 9px; font-size: 13px; }
.usage-row { display: flex; justify-content: space-between; color: var(--text-2); }
.usage-row b { color: var(--text); }
.usage-bar { height: 6px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.usage-bar i { display: block; height: 100%; border-radius: inherit; background: var(--grad); transition: width .6s var(--ease); }
.usage-bar.warn i { background: linear-gradient(90deg, #f59e0b, #ef4444); }
.usage-card .btn { --h: 34px; font-size: 13px; }
.user-menu-wrap { position: relative; }
.user-btn { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px; border-radius: 12px; text-align: left; transition: background .15s; }
.user-btn:hover, .user-btn[aria-expanded="true"] { background: var(--surface-2); }
.user-btn > svg { width: 18px; height: 18px; color: var(--muted); }
.avatar { flex: none; width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; font-weight: 700; font-size: 13px; color: #fff; background: linear-gradient(135deg, #4f46e5, #0891b2); }
.user-meta { flex: 1; min-width: 0; display: grid; line-height: 1.3; }
.user-meta b { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-meta small { font-size: 12px; color: var(--muted); }
.user-pop { bottom: calc(100% + 8px); left: 0; right: 0; }

.sb-backdrop { display: none; }

/* ---------- Chat ---------- */
.chat { position: relative; display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--bg); }
.chat::before { content: ""; position: absolute; inset: 0 0 auto; height: 360px; pointer-events: none; background: radial-gradient(60% 100% at 50% 0%, rgba(99,102,241,.1), transparent 70%); }
.chat-top { position: relative; z-index: 5; display: flex; align-items: center; gap: 10px; height: 60px; padding: 0 16px; border-bottom: 1px solid transparent; transition: border-color .2s, background .2s; }
.chat-top.scrolled { border-bottom-color: var(--border); background: var(--glass); backdrop-filter: blur(14px); }
#openSidebar { display: none; }
.app.sb-collapsed #openSidebar { display: inline-grid; }
.chat-title-wrap { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; }
.chat-title { font-family: var(--font); font-size: 15px; font-weight: 600; letter-spacing: -0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.demo-pill { flex: none; display: inline-flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 999px; background: rgba(245,196,81,.1); color: var(--gold); border: 1px solid rgba(245,196,81,.3); }
[data-theme="light"] .demo-pill { color: #92400e; background: rgba(245,158,11,.12); border-color: rgba(217,119,6,.35); }
.demo-pill .dot { background: var(--gold); box-shadow: 0 0 0 3px rgba(245,196,81,.18); }
.top-actions { display: flex; align-items: center; gap: 4px; }

.chat-scroll { position: relative; flex: 1; min-height: 0; overflow-y: auto; scroll-behavior: auto; scrollbar-width: thin; scrollbar-color: var(--surface-3) transparent; }
.messages { width: min(800px, 100% - 32px); margin: 0 auto; padding: 18px 0 40px; display: grid; gap: 28px; }

/* ---------- Welcome ---------- */
.welcome { width: min(800px, 100% - 32px); margin: 0 auto; padding: clamp(24px, 8vh, 90px) 0 30px; text-align: center; display: grid; justify-items: center; gap: 12px; animation: rise .6s var(--ease); }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } }
.welcome h2 { font-size: clamp(28px, 4vw, 40px); font-weight: 800; letter-spacing: -0.035em; }
.welcome > p { max-width: 540px; font-size: 15.5px; }
.welcome-orb { position: relative; width: 76px; height: 76px; margin-bottom: 10px; }
.welcome-orb::before, .welcome-orb::after, .welcome-orb div { content: ""; position: absolute; inset: 0; border-radius: 50%; }
.welcome-orb::before { background: conic-gradient(from 0deg, #6366f1, #8b5cf6, #22d3ee, #6366f1); filter: blur(14px); opacity: .7; animation: spin 6s linear infinite; }
.welcome-orb div { inset: 4px; background: radial-gradient(circle at 35% 30%, #a5b4fc, #4f46e5 45%, #0e7490 100%); box-shadow: inset 0 -6px 18px rgba(0,0,0,.35), inset 0 4px 10px rgba(255,255,255,.35); }
.welcome-orb::after { inset: 4px; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 3v18M7 21h10M5 7h14'/%3E%3Cpath d='m5 7-3 7a3.5 3.5 0 0 0 6 0Z'/%3E%3Cpath d='m19 7-3 7a3.5 3.5 0 0 0 6 0Z'/%3E%3C/svg%3E") center / 50% no-repeat; }
.suggestions { margin-top: 26px; width: 100%; display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; text-align: left; }
.suggestion {
  display: grid; gap: 8px; align-content: start; text-align: left; padding: 16px; border-radius: 16px; background: var(--surface); border: 1px solid var(--border);
  transition: border-color .2s, background .2s, transform .25s var(--ease); animation: rise .6s var(--ease) both;
}
.suggestion:hover { border-color: rgba(124,127,245,.45); background: var(--surface-2); transform: translateY(-2px); }
.suggestion .s-head { display: flex; align-items: center; gap: 9px; font-weight: 600; font-size: 14px; }
.suggestion .s-head span { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; background: var(--surface-2); color: var(--primary); }
.suggestion .s-head svg { width: 16px; height: 16px; }
.suggestion p { font-size: 13.5px; color: var(--muted); line-height: 1.5; }
@media (max-width: 860px) { .suggestions { grid-template-columns: 1fr 1fr; } }
@media (max-width: 520px) { .suggestions { grid-template-columns: 1fr; } .suggestion:nth-child(n+5) { display: none; } }

/* ---------- Xabarlar ---------- */
.msg { animation: msgIn .35s var(--ease); }
@keyframes msgIn { from { opacity: 0; transform: translateY(8px); } }
.msg.user { display: grid; justify-items: end; gap: 6px; }
.msg.user .bubble {
  max-width: min(85%, 620px); padding: 12px 16px; border-radius: 20px 20px 6px 20px; background: var(--surface-3); border: 1px solid var(--border);
  white-space: pre-wrap; word-wrap: break-word; font-size: 15px;
}
.msg.user .msg-actions { opacity: 0; }
.msg.user:hover .msg-actions { opacity: 1; }

.msg.ai { display: flex; gap: 14px; }
.ai-avatar { flex: none; width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; color: #fff; background: var(--grad); box-shadow: 0 6px 18px -6px rgba(99,102,241,.8); }
.ai-avatar svg { width: 18px; height: 18px; }
.ai-body { flex: 1; min-width: 0; display: grid; gap: 10px; }
.ai-meta { display: flex; align-items: center; gap: 8px; font-size: 13.5px; height: 32px; }
.ai-meta b { font-weight: 600; }
.mode-tag { font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: rgba(139,92,246,.14); color: #c4b5fd; border: 1px solid rgba(139,92,246,.3); display: inline-flex; align-items: center; gap: 4px; }
[data-theme="light"] .mode-tag { color: #6d28d9; }
.mode-tag svg { width: 12px; height: 12px; }

.thinking { border-radius: 12px; border: 1px solid var(--border); background: var(--surface); font-size: 13.5px; width: fit-content; max-width: 100%; transition: width .3s; }
.thinking[open] { width: 100%; }
.thinking summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 8px; padding: 8px 12px; color: var(--text-2); user-select: none; }
.thinking summary::-webkit-details-marker { display: none; }
.thinking summary svg { width: 15px; height: 15px; }
.thinking summary .chev { transition: transform .2s; color: var(--muted); }
.thinking[open] summary .chev { transform: rotate(180deg); }
.thinking .t-pulse { width: 7px; height: 7px; border-radius: 50%; background: var(--cyan); animation: tpulse 1.1s ease-in-out infinite; }
.thinking.done .t-pulse { animation: none; background: var(--green); }
@keyframes tpulse { 50% { opacity: .3; transform: scale(.6); } }
.thinking-text { padding: 2px 14px 12px 14px; color: var(--muted); white-space: pre-wrap; max-height: 260px; overflow-y: auto; line-height: 1.55; border-top: 1px dashed var(--border); padding-top: 10px; }

.typing { display: inline-flex; gap: 5px; padding: 12px 0; }
.typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); animation: bounce 1.2s infinite ease-in-out; }
.typing i:nth-child(2) { animation-delay: .15s; }
.typing i:nth-child(3) { animation-delay: .3s; }
@keyframes bounce { 0%, 60%, 100% { transform: translateY(0); opacity: .4; } 30% { transform: translateY(-5px); opacity: 1; } }

.msg-actions { display: flex; gap: 2px; transition: opacity .2s; }
.msg-actions .icon-btn { width: 30px; height: 30px; border-radius: 8px; color: var(--muted); }
.msg-actions .icon-btn svg { width: 15px; height: 15px; }
.msg-actions .icon-btn.on { color: var(--primary); background: var(--surface-2); }
.msg.ai.streaming .msg-actions { display: none; }
.msg-note { font-size: 12.5px; color: var(--muted); font-style: italic; }
.msg-error { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 12px 14px; border-radius: 12px; background: rgba(248,113,113,.08); border: 1px solid rgba(248,113,113,.25); color: #fca5a5; font-size: 14px; }
[data-theme="light"] .msg-error { color: #b91c1c; }
.msg-error svg { width: 17px; height: 17px; flex: none; }

/* ---------- Markdown ---------- */
.md { font-size: 15.5px; line-height: 1.72; color: var(--text); overflow-wrap: anywhere; }
.md > *:first-child { margin-top: 0; }
.md > *:last-child { margin-bottom: 0; }
.md p { margin: 0 0 14px; }
.md h1, .md h2, .md h3, .md h4 { font-family: var(--font-display); margin: 24px 0 10px; letter-spacing: -0.02em; }
.md h1 { font-size: 22px; } .md h2 { font-size: 19.5px; } .md h3 { font-size: 17px; } .md h4 { font-size: 15.5px; }
.md strong { font-weight: 650; color: var(--text); }
.md em { color: var(--text-2); }
.md ul, .md ol { margin: 0 0 14px; padding-left: 24px; }
.md li { margin: 5px 0; }
.md li::marker { color: var(--primary); }
.md ol li::marker { font-weight: 700; }
.md a { color: var(--primary); text-decoration: underline; text-decoration-color: rgba(124,127,245,.4); text-underline-offset: 3px; }
.md a:hover { text-decoration-color: currentColor; }
.md blockquote { margin: 0 0 14px; padding: 10px 16px; border-left: 3px solid var(--primary); background: var(--surface); border-radius: 0 12px 12px 0; color: var(--text-2); }
.md blockquote p { margin: 0; }
.md hr { border: 0; height: 1px; background: var(--border); margin: 22px 0; }
.md code { font-family: var(--font-mono); font-size: .86em; padding: 2px 6px; border-radius: 6px; background: var(--code-bg); border: 1px solid var(--border); }
.md pre { position: relative; margin: 0 0 14px; padding: 16px; border-radius: 14px; background: var(--code-bg); border: 1px solid var(--border); overflow-x: auto; }
.md pre code { padding: 0; border: 0; background: none; font-size: 13.5px; line-height: 1.6; white-space: pre; }
.md pre .copy-code { position: absolute; top: 8px; right: 8px; width: 30px; height: 30px; border-radius: 8px; background: var(--bg-elev); border: 1px solid var(--border); opacity: 0; transition: opacity .2s; }
.md pre:hover .copy-code { opacity: 1; }
.md .md-table { margin: 0 0 16px; border: 1px solid var(--border); border-radius: 12px; overflow-x: auto; }
.md table { width: 100%; border-collapse: collapse; font-size: 14px; }
.md thead th { background: var(--surface-2); font-weight: 600; text-align: left; }
.md th, .md td { padding: 10px 14px; border-bottom: 1px solid var(--border); vertical-align: top; }
.md tr:last-child td { border-bottom: 0; }
.md .cursor { display: inline-block; width: 8px; height: 17px; margin-left: 2px; vertical-align: -3px; border-radius: 2px; background: var(--primary); animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

/* ---------- Composer ---------- */
.composer-wrap { position: relative; width: min(800px, 100% - 32px); margin: 0 auto; padding: 0 0 12px; }
.composer {
  border-radius: 22px; background: var(--bg-elev); border: 1px solid var(--border-strong); box-shadow: var(--shadow-lg);
  transition: border-color .2s, box-shadow .2s; padding: 12px 12px 10px 16px;
}
[data-theme="dark"] .composer { background: linear-gradient(180deg, rgba(20,24,48,.9), rgba(13,16,34,.95)); }
.composer:focus-within { border-color: rgba(124,127,245,.55); box-shadow: 0 0 0 4px var(--ring), var(--shadow-lg); }
.composer textarea { display: block; width: 100%; resize: none; border: 0; outline: none; background: none; font-size: 15.5px; line-height: 1.55; max-height: 240px; min-height: 26px; padding: 4px 0; }
.composer textarea::placeholder { color: var(--muted); }
.composer-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 8px; }
.mode-switch { display: inline-flex; padding: 3px; border-radius: 12px; background: var(--surface); border: 1px solid var(--border); }
.mode-switch button { display: inline-flex; align-items: center; gap: 6px; padding: 6px 11px; border-radius: 9px; font-size: 13px; font-weight: 600; color: var(--muted); transition: all .2s; }
.mode-switch button svg { width: 15px; height: 15px; }
.mode-switch button:hover { color: var(--text); }
.mode-switch button.active { background: var(--surface-3); color: var(--text); box-shadow: inset 0 0 0 1px var(--border-strong); }
.mode-switch button[data-mode="deep"].active svg { color: #a78bfa; }
.mode-switch button[data-mode="fast"].active svg { color: var(--gold); }
.pro-tag { font-size: 9.5px; font-weight: 800; letter-spacing: .05em; padding: 2px 5px; border-radius: 5px; background: var(--grad); color: #fff; }
.composer-right { display: flex; align-items: center; gap: 10px; }
.composer-left { display: flex; align-items: center; gap: 6px; min-width: 0; }
.attach-btn svg { width: 19px; height: 19px; }
.attach-btn:hover { color: var(--primary); }
.composer.has-attachment .mode-switch { display: none; }
.composer.drag { border-color: var(--primary); box-shadow: 0 0 0 4px var(--ring); }
.attach-chip { display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 10px; margin-bottom: 8px; border-radius: 12px; background: rgba(99,102,241,.1); border: 1px solid rgba(124,127,245,.35); }
.attach-chip .ac-icon, .attach-chip .spinner { flex: none; width: 18px; height: 18px; color: var(--primary); }
.attach-chip .ac-icon svg { width: 18px; height: 18px; }
.attach-chip .ac-text { display: grid; min-width: 0; flex: 1; }
.attach-chip b { font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.attach-chip small { font-size: 11.5px; color: var(--muted); }
.attach-chip .ac-remove { width: 30px; height: 30px; flex: none; }
.attach-chip .ac-remove svg { width: 16px; height: 16px; }
.char-count { font-size: 12px; color: var(--muted); }
.send-btn {
  width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; color: #fff; background: var(--grad);
  box-shadow: 0 8px 20px -8px rgba(99,102,241,.9); transition: transform .15s, opacity .2s, box-shadow .2s;
}
.send-btn svg { width: 19px; height: 19px; }
.send-btn:hover { transform: translateY(-1px); }
.send-btn:disabled { opacity: .35; box-shadow: none; transform: none; cursor: default; }
.send-btn.stop { background: var(--text); color: var(--bg); box-shadow: none; }
.composer-hint { text-align: center; font-size: 12px; color: var(--muted); margin-top: 9px; }
.composer-hint a { text-decoration: underline; }
.scroll-down { position: absolute; top: -52px; left: 50%; transform: translateX(-50%); width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: var(--bg-elev); border: 1px solid var(--border-strong); box-shadow: var(--shadow); color: var(--text-2); z-index: 3; }
.scroll-down svg { width: 18px; height: 18px; }

/* ---------- Mobil ---------- */
@media (max-width: 900px) {
  .app, .app.sb-collapsed { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 80; inset: 0 auto 0 0; width: min(310px, 86vw); transform: translateX(-100%); box-shadow: var(--shadow-lg); }
  .app.sb-open .sidebar { transform: none; opacity: 1; pointer-events: auto; }
  .app.sb-collapsed .sidebar { opacity: 1; }
  .sb-backdrop { display: block; position: fixed; inset: 0; z-index: 70; background: rgba(0,0,0,.5); backdrop-filter: blur(2px); opacity: 0; pointer-events: none; transition: opacity .3s; }
  .app.sb-open .sb-backdrop { opacity: 1; pointer-events: auto; }
  #openSidebar { display: inline-grid; }
  .sb-search kbd { display: none; }
  .chat-top { padding: 0 8px; }
  .upgrade-top { display: none; }
  .mode-switch button { padding: 6px 9px; }
  .md { font-size: 15px; }
  .msg.ai { gap: 10px; }
  .ai-avatar { width: 28px; height: 28px; }
}
@media (max-width: 420px) {
  .mode-switch button[data-mode="deep"] .pro-tag { display: none; }
  .composer-hint { font-size: 11px; }
}

/* ---------- Javobga e'tiroz (👎) ---------- */
.objection { display: grid; gap: 14px; }
.objection-reasons { display: flex; flex-wrap: wrap; gap: 8px; }
.objection-reason { position: relative; cursor: pointer; }
.objection-reason input { position: absolute; opacity: 0; pointer-events: none; }
.objection-reason span {
  display: inline-flex; align-items: center; min-height: 36px; padding: 6px 14px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface); font-size: 14px; font-weight: 500;
  transition: border-color .15s, background .15s, color .15s;
}
.objection-reason:hover span { border-color: var(--border-strong); }
.objection-reason input:checked + span { border-color: var(--primary); background: var(--surface-2); color: var(--primary); }
.objection-reason input:focus-visible + span { box-shadow: 0 0 0 4px var(--ring); }
.objection-comment { height: auto; min-height: 104px; padding: 12px 14px; resize: vertical; line-height: 1.5; }
.objection-count { justify-self: end; font-size: 12px; }

/* ---------- Hujjat tayyorlash ---------- */
.doc-wizard { display: grid; gap: 14px; }
.doc-lead { font-size: 14px; margin: 0; }
.doc-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.doc-card { display: flex; gap: 12px; align-items: flex-start; text-align: left; padding: 14px; border-radius: 14px; background: var(--surface); border: 1px solid var(--border); transition: border-color .15s, background .15s, transform .15s; }
.doc-card:hover { border-color: var(--primary); background: var(--surface-2); transform: translateY(-1px); }
.doc-card-icon { flex: none; width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: rgba(99,102,241,.14); color: var(--primary); }
.doc-card-icon svg { width: 18px; height: 18px; }
.doc-card-text { display: grid; gap: 4px; min-width: 0; }
.doc-card-text b { font-size: 14.5px; }
.doc-card-text small { color: var(--muted); font-size: 12.5px; line-height: 1.45; }
.doc-back { justify-self: start; }
.doc-back svg { width: 16px; height: 16px; }
.doc-title { font-size: 18px; margin: 0; }
.doc-ai { display: grid; gap: 8px; padding: 14px; border-radius: 14px; border: 1px dashed rgba(124,127,245,.45); background: rgba(99,102,241,.06); }
.doc-ai label { display: flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 600; color: var(--text-2); }
.doc-ai label svg { width: 16px; height: 16px; color: var(--primary); }
.doc-ai-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.doc-ai-row small { font-size: 12px; }
.doc-ai .btn svg { width: 16px; height: 16px; }
.doc-ai .btn .spinner { width: 14px; height: 14px; }
.doc-textarea { height: auto; min-height: 70px; padding: 10px 14px; resize: vertical; line-height: 1.5; }
.doc-form { display: grid; gap: 14px; }
.doc-group { border: 1px solid var(--border); border-radius: 14px; padding: 12px 14px 14px; margin: 0; min-width: 0; }
.doc-group legend { padding: 0 6px; font-size: 12.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.doc-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.doc-field.wide { grid-column: 1 / -1; }
.doc-field .input { height: 42px; }
.doc-field .doc-textarea { height: auto; }
.doc-field.filled .input { border-color: rgba(52, 211, 153, .55); }
.doc-req { color: var(--red); }
.doc-hint { color: var(--muted); font-size: 12px; }
.doc-note { display: flex; gap: 8px; align-items: flex-start; font-size: 12.5px; margin: 0; }
.doc-note svg { width: 16px; height: 16px; flex: none; margin-top: 1px; }
.doc-actions { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.doc-actions .btn svg, .doc-preview-bar .btn svg { width: 16px; height: 16px; }
.doc-preview-bar { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; position: sticky; top: -28px; z-index: 2; padding: 8px 0; background: var(--bg-elev); }
/* Word sahifasiga o'xshash ko'rinish: mavzudan qat'i nazar oq qog'oz */
.doc-paper { background: #fff; color: #111; font-family: "Times New Roman", Times, serif; font-size: 15px; line-height: 1.38; padding: 40px 36px 40px 52px; border-radius: 6px; box-shadow: 0 8px 30px -12px rgba(0,0,0,.45); border: 1px solid rgba(0,0,0,.08); }
.doc-paper .bold { font-weight: 700; }
.doc-p.al-both { text-align: justify; }
.doc-p.al-center { text-align: center; }
.doc-p.al-right { text-align: right; }
.doc-p.al-left { text-align: left; }
.doc-p.indent .doc-edit { text-indent: 1.25cm; }
.doc-edit { white-space: pre-wrap; outline: none; border-radius: 3px; min-height: 1.2em; transition: background .12s; }
.doc-edit:hover { background: rgba(250, 204, 21, .12); }
.doc-edit:focus { background: rgba(250, 204, 21, .22); box-shadow: 0 0 0 2px rgba(250, 204, 21, .35); }
.doc-tabs { display: flex; gap: 12px; }
.doc-tabs .doc-edit { flex: 1; }
.doc-tabs .doc-edit:last-child { text-align: right; }
.doc-tabs.n3 .doc-edit:nth-child(2) { text-align: center; }
.doc-table { width: 100%; border-collapse: collapse; table-layout: fixed; margin: 4px 0 8px; }
.doc-table td { vertical-align: top; padding: 2px 6px; text-align: left; }
.doc-table.bordered td { border: 1px solid #000; }
.doc-pagebreak { margin: 22px -36px 22px -52px; border-top: 2px dashed #c7c9d1; text-align: center; height: 0; }
.doc-pagebreak span { position: relative; top: -10px; background: #fff; color: #8a8fa3; font: 600 11px var(--font); padding: 0 8px; letter-spacing: .04em; text-transform: uppercase; }
@media (max-width: 640px) {
  .doc-list, .doc-grid { grid-template-columns: 1fr; }
  .doc-paper { padding: 22px 14px; font-size: 14px; }
  .doc-pagebreak { margin: 18px -14px; }
}
