/* Минимальный кастомный CSS поверх Tailwind. */

:root {
  --brand: #1e3a8a;
  --brand-soft: #dbeafe;
}

html { font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; }

/* Аккуратная типографика для длинных сгенерированных документов */
.prose-document {
  font-size: 1rem;
  line-height: 1.7;
  color: #1f2937;
  white-space: pre-wrap;
  word-wrap: break-word;
}
.prose-document h1,
.prose-document h2,
.prose-document h3 { font-weight: 600; color: #111827; }

/* Спиннер загрузки */
.spinner {
  display: inline-block;
  width: 1rem;
  height: 1rem;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Markdown-ответ от агента поиска: жирные акценты + списки + кликабельные цитаты */
.markdown-answer {
  font-size: 1rem;
  line-height: 1.7;
  color: #1f2937;
}
.markdown-answer p { margin-bottom: 0.85rem; }
.markdown-answer p:last-child { margin-bottom: 0; }
.markdown-answer ul {
  list-style: disc;
  margin: 0.6rem 0 0.85rem 1.5rem;
  padding-left: 0;
}
.markdown-answer ul:last-child { margin-bottom: 0; }
.markdown-answer li { margin-bottom: 0.35rem; }
.markdown-answer strong { color: #0f172a; font-weight: 600; }
.markdown-answer code {
  background: #f1f5f9;
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 0.92em;
  color: #0f172a;
}
.markdown-answer .cite-ref {
  display: inline-block;
  margin: 0 2px;
  padding: 0 6px;
  background: #dbeafe;
  color: #1e3a8a;
  border-radius: 999px;
  font-size: 0.78em;
  font-weight: 600;
  text-decoration: none;
  vertical-align: baseline;
}
.markdown-answer .cite-ref:hover { background: #bfdbfe; }

/* Скелетон для блока пока грузится */
.skeleton {
  background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
  background-size: 200% 100%;
  animation: skeleton 1.4s ease-in-out infinite;
  border-radius: 0.375rem;
}
@keyframes skeleton {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* --- Шапка AiDocMaker + модалки входа (раньше инлайн в shell.js injectStyles) --- */
.dm-modal-backdrop { position: fixed; inset: 0; background: rgba(15,23,42,.65);
  display: flex; align-items: center; justify-content: center; z-index: 1000; padding: 1rem; }
.dm-modal { background: white; border-radius: 12px; max-width: 460px; width: 100%;
  padding: 1.75rem 1.75rem 1.5rem; box-shadow: 0 25px 50px -12px rgba(0,0,0,.4); }
.dm-modal h2 { font-size: 1.25rem; font-weight: 600; margin-bottom: .5rem; color: #0f172a; }
.dm-modal p { font-size: .9rem; color: #475569; line-height: 1.5; margin-bottom: 1rem; }
.dm-modal label { display:block; font-size:.8rem; color:#475569; margin:.6rem 0 .25rem; }
.dm-modal input { width: 100%; padding: .55rem .8rem; border: 1px solid #cbd5e1;
  border-radius: 8px; font-size: 1rem; }
.dm-modal input:focus { outline: 2px solid #1d4ed8; outline-offset: 0; border-color: #1d4ed8; }
.dm-modal-actions { margin-top: 1rem; display: flex; gap: .5rem; justify-content: flex-end; }
.dm-btn-primary { padding: .55rem 1rem; background: #1d4ed8; color: white; border: none;
  border-radius: 8px; font-weight: 500; cursor: pointer; }
.dm-btn-primary:hover { background: #1e40af; }
.dm-btn-primary:disabled { background: #94a3b8; cursor: wait; }
.dm-error { color: #b91c1c; font-size: .85rem; margin-top: .5rem; }
.dm-header { background: white; border-bottom: 1px solid #e2e8f0; }
.dm-header-inner { max-width: 1100px; margin: 0 auto; padding: .85rem 1.5rem;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.dm-brand { display: flex; align-items: center; gap: .5rem; text-decoration: none; color: #0f172a; }
.dm-brand-mark { width: 28px; height: 28px; border-radius: 8px;
  background: linear-gradient(135deg, #1d4ed8 0%, #3b82f6 100%);
  display: flex; align-items: center; justify-content: center; color: white;
  font-weight: 700; font-size: .85rem; }
.dm-brand-name { font-weight: 600; font-size: 1rem; }
.dm-brand-tag { font-size: .7rem; padding: 2px 6px; background: #fef3c7;
  color: #92400e; border-radius: 4px; margin-left: .35rem; font-weight: 500; }
.dm-nav { display: flex; gap: 1.25rem; align-items: center; flex-wrap: wrap; }
.dm-nav a { color: #475569; font-size: .88rem; text-decoration: none; }
.dm-nav a:hover, .dm-nav a.active { color: #1d4ed8; }
.dm-user { display: flex; align-items: center; gap: .75rem; font-size: .82rem; color: #475569; }
.dm-user-name { font-weight: 500; color: #0f172a; }
.dm-quota { padding: 2px 8px; background: #f1f5f9; border-radius: 999px; font-size: .75rem;
  color: #475569; text-decoration: none; }
a.dm-quota:hover { background: #e2e8f0; }
.dm-quota.warn { background: #fef3c7; color: #92400e; }
.dm-quota.danger { background: #fee2e2; color: #b91c1c; }
.dm-logout { color: #94a3b8; font-size: .78rem; cursor: pointer; background: none;
  border: none; padding: 0; }
.dm-logout:hover { color: #475569; }
@media (max-width: 640px) {
  .dm-header-inner { flex-wrap: wrap; }
  .dm-nav { order: 3; width: 100%; justify-content: flex-start; }
}
