/* ============================================================
   AI Assistant MVP — Design System
   Minimalist · Slate/Zinc palette · subtle brand accent
   ============================================================ */

:root {
  /* Surfaces & text (slate / zinc) */
  --bg: #f8fafc;            /* slate-50 */
  --bg-subtle: #f1f5f9;     /* slate-100 */
  --surface: #ffffff;
  --surface-muted: #f8fafc;
  --text: #0f172a;          /* slate-900 */
  --text-secondary: #475569;/* slate-600 */
  --muted: #94a3b8;         /* slate-400 */
  --border: #e2e8f0;        /* slate-200 */
  --border-strong: #cbd5e1; /* slate-300 */

  /* Brand accent — a refined indigo/violet */
  --accent: #6366f1;        /* indigo-500 */
  --accent-hover: #4f46e5;  /* indigo-600 */
  --accent-soft: #eef2ff;   /* indigo-50 */
  --accent-ring: rgba(99, 102, 241, 0.18);

  /* Status */
  --chip-pending: #94a3b8;
  --chip-processing: #f59e0b;
  --chip-done: #10b981;
  --chip-error: #ef4444;

  /* Elevation */
  --shadow-sm: 0 1px 2px 0 rgb(15 23 42 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(15 23 42 / 0.07), 0 2px 4px -2px rgb(15 23 42 / 0.05);
  --shadow-lg: 0 10px 15px -3px rgb(15 23 42 / 0.08), 0 4px 6px -4px rgb(15 23 42 / 0.04);

  /* Radii */
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --radius-xl: 22px;
  --radius-full: 999px;

  /* Typography */
  --font-sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI",
    Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

button { font-family: inherit; }

/* ============================================================
   Brand wordmark
   ============================================================ */
.brand {
  display: inline-flex;
  align-items: baseline;
  gap: 2px;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
  white-space: nowrap;
}
.brand .brand-mvp {
  color: var(--accent);
  font-weight: 800;
  letter-spacing: 0.02em;
}

/* ============================================================
   Header
   ============================================================ */
.page-header {
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 20;
}
.header-inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.header-inner nav {
  display: flex;
  align-items: center;
  gap: 6px;
}
.header-inner nav a {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 14px;
  border-radius: var(--radius-full);
  text-decoration: none;
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 500;
  transition: background 0.18s ease, color 0.18s ease;
}
.header-inner nav a svg { width: 16px; height: 16px; }
.header-inner nav a:hover { background: var(--bg-subtle); color: var(--text); text-decoration: none; }
.header-inner nav a.active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}
/* Button that visually matches the nav pills (e.g. the Prompt button) */
.header-inner nav .nav-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 14px;
  border: none;
  border-radius: var(--radius-full);
  background: transparent;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease;
}
.header-inner nav .nav-btn svg { width: 16px; height: 16px; }
.header-inner nav .nav-btn:hover { background: var(--bg-subtle); color: var(--text); }

/* ============================================================
   Layout
   ============================================================ */
.container {
  max-width: 1120px;
  margin: 0 auto;
  padding: 28px 24px 48px;
}

/* ============================================================
   Buttons
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border: none;
  border-radius: var(--radius);
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: background 0.18s ease, transform 0.12s ease, box-shadow 0.18s ease;
}
.btn svg { width: 16px; height: 16px; }
.btn:hover { background: var(--accent-hover); box-shadow: var(--shadow-md); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; box-shadow: none; }

.btn-secondary {
  background: var(--surface);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}
.btn-secondary:hover { background: var(--bg-subtle); color: var(--text); border-color: var(--border-strong); }

.btn-danger {
  background: transparent;
  color: var(--chip-error);
  border: 1px solid var(--border);
}
.btn-danger:hover { background: #fef2f2; border-color: #fecaca; color: #b91c1c; }

/* ============================================================
   Panels & cards
   ============================================================ */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}
.section-header h2 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.section-header .section-sub {
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 400;
}

/* ============================================================
   Forms
   ============================================================ */
.inline-form {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: stretch;
}
.inline-form input[type="url"],
.inline-form input[type="text"] {
  padding: 11px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-muted);
  color: var(--text);
  font-size: 0.95rem;
  min-width: 120px;
  flex: 1 1 260px;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}
.inline-form input:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--surface);
  box-shadow: 0 0 0 3px var(--accent-ring);
}

/* ============================================================
   Status chips
   ============================================================ */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  font-weight: 600;
  color: #fff;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.chip::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.85;
}
.chip-pending   { background: var(--chip-pending); }
.chip-processing{ background: var(--chip-processing); }
.chip-done      { background: var(--chip-done); }
.chip-error     { background: var(--chip-error); }

/* ============================================================
   Dashboard — horizontal scrollable card rows
   ============================================================ */
.scroll-row {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  padding: 4px 2px 12px;
  scroll-snap-type: x mandatory;
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
}
.scroll-row::-webkit-scrollbar { height: 8px; }
.scroll-row::-webkit-scrollbar-track { background: transparent; }
.scroll-row::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: var(--radius-full);
}

.source-card {
  flex: 0 0 340px;
  scroll-snap-align: start;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}
.source-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: var(--border-strong);
}

/* Video card — thumbnail on top */
.video-card { padding: 0; overflow: hidden; }
.video-card .thumb-wrap {
  position: relative;
  aspect-ratio: 16 / 9;
  background: var(--bg-subtle);
  overflow: hidden;
}
.video-card .thumb-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.3s ease;
}
.video-card:hover .thumb-wrap img { transform: scale(1.04); }
.video-card .thumb-fallback {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
}
.video-card .thumb-fallback svg { width: 34px; height: 34px; }
.video-card .video-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 16px 16px;
}
.video-card .video-title {
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: -0.01em;
  color: var(--text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.video-card .video-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.82rem;
}
.video-card .video-meta svg { width: 14px; height: 14px; }

/* Article card */
.article-card .card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}
.article-card .card-icon {
  flex-shrink: 0;
  width: 38px;
  height: 38px;
  border-radius: var(--radius);
  background: var(--accent-soft);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
}
.article-card .card-icon svg { width: 18px; height: 18px; }
.article-card .card-title {
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: -0.01em;
  color: var(--text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.article-card .card-url {
  font-size: 0.8rem;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.article-card .card-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.82rem;
}
.article-card .card-meta svg { width: 14px; height: 14px; }
.article-card .card-actions {
  display: flex;
  gap: 8px;
  margin-top: 2px;
}
.article-card .card-actions button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text-secondary);
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.article-card .card-actions button svg { width: 14px; height: 14px; }
.article-card .card-actions button:hover { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.article-card .card-actions .btn-danger:hover { background: #fef2f2; border-color: #fecaca; color: #b91c1c; }

.source-error {
  color: var(--chip-error);
  font-size: 0.82rem;
  margin-top: 2px;
}

.empty-state {
  color: var(--muted);
  margin: 8px 0;
  font-size: 0.9rem;
}
.muted { color: var(--muted); font-size: 0.9rem; }

/* ============================================================
   Chat
   ============================================================ */
.chat-layout {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 66px);
  padding-bottom: 0;
  max-width: 860px;
}

.chat-log {
  flex: 1 1 auto;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 24px 8px 16px;
  scroll-behavior: smooth;
}
.chat-log::-webkit-scrollbar { width: 8px; }
.chat-log::-webkit-scrollbar-track { background: transparent; }
.chat-log::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: var(--radius-full); }

/* Bubbles */
.bubble {
  display: flex;
  gap: 12px;
  max-width: 82%;
  animation: bubble-in 0.28s ease;
}
@keyframes bubble-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.bubble .bubble-avatar {
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-sm);
}
.bubble .bubble-avatar svg { width: 17px; height: 17px; }
.bubble .bubble-content {
  padding: 12px 16px;
  border-radius: var(--radius-lg);
  font-size: 0.95rem;
  line-height: 1.6;
  word-break: break-word;
  box-shadow: var(--shadow-sm);
}

/* User bubble */
.bubble-user {
  align-self: flex-end;
  flex-direction: row-reverse;
}
.bubble-user .bubble-avatar {
  background: var(--accent);
  color: #fff;
}
.bubble-user .bubble-content {
  background: var(--accent);
  color: #fff;
  border-bottom-right-radius: 6px;
  font-weight: 500;
}

/* Assistant bubble */
.bubble-assistant { align-self: flex-start; }
.bubble-assistant .bubble-avatar {
  background: var(--surface);
  color: var(--accent);
  border: 1px solid var(--border);
}
.bubble-assistant .bubble-content {
  background: var(--surface);
  border: 1px solid var(--border);
  border-bottom-left-radius: 6px;
  color: var(--text);
}

/* Thinking indicator */
.bubble-thinking .bubble-content {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 0.9rem;
}
.typing-dots {
  display: inline-flex;
  gap: 4px;
  align-items: center;
}
.typing-dots span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0.4;
  animation: typing 1.2s infinite ease-in-out;
}
.typing-dots span:nth-child(2) { animation-delay: 0.15s; }
.typing-dots span:nth-child(3) { animation-delay: 0.3s; }
@keyframes typing {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-4px); opacity: 1; }
}

/* Citations */
.citations {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.citations-label {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}
.citation-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.88rem;
  color: var(--accent);
}
.citation-link svg { width: 14px; height: 14px; flex-shrink: 0; }
.citation-link:hover { text-decoration: underline; }
.citation-snippet {
  color: var(--muted);
  font-size: 0.85rem;
  margin-top: 2px;
}

/* ============================================================
   Chat — interactive inline citations
   ============================================================ */
.answer-text { white-space: pre-line; }

/* A cited sentence: invisible by default, highlighted on hover/focus */
.cite-ref {
  border-radius: 5px;
  padding: 1px 3px;
  margin: -1px -3px;
  cursor: pointer;
  transition: background 0.15s ease, box-shadow 0.15s ease;
}
.cite-ref:hover,
.cite-ref:focus-visible {
  background: var(--accent-soft);
  box-shadow: 0 0 0 1px var(--accent-ring);
  outline: none;
}

/* Floating source tooltip (fixed so it never clips inside the chat log) */
.cite-tip {
  position: fixed;
  z-index: 300;
  display: flex;
  align-items: center;
  gap: 6px;
  max-width: 320px;
  padding: 7px 11px;
  border-radius: var(--radius-sm);
  background: var(--text);
  color: #fff;
  font-size: 0.76rem;
  font-weight: 500;
  line-height: 1.35;
  box-shadow: var(--shadow-md);
  pointer-events: none;
  animation: cite-tip-in 0.14s ease;
}
.cite-tip[hidden] { display: none; }
.cite-tip svg { width: 13px; height: 13px; flex-shrink: 0; }
.cite-tip span {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
@keyframes cite-tip-in {
  from { opacity: 0; transform: translateY(3px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   Chat — YouTube source modal
   ============================================================ */
.yt-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  opacity: 0;
  transition: opacity 0.25s ease;
}
.yt-overlay[hidden] { display: none; }
.yt-overlay.is-open { opacity: 1; }

.yt-modal {
  width: 100%;
  max-width: 720px;
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 18px 20px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  opacity: 0;
  transform: scale(0.9);
  transition: opacity 0.22s ease, transform 0.25s cubic-bezier(0.34, 1.35, 0.64, 1);
}
.yt-overlay.is-open .yt-modal { opacity: 1; transform: scale(1); }

.yt-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.yt-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.yt-close { flex-shrink: 0; }

.yt-frame {
  position: relative;
  aspect-ratio: 16 / 9;
  background: #000;
  border-radius: var(--radius);
  overflow: hidden;
}
.yt-iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

.yt-modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
}
.yt-open-btn:hover { text-decoration: none; }

/* Lock background scroll while the video modal is open */
body.modal-open { overflow: hidden; }

/* ============================================================
   Chat composer — floating rounded box
   ============================================================ */
.chat-composer-wrap {
  padding: 8px 0 20px;
}
.chat-composer {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 8px 8px 8px 18px;
  box-shadow: var(--shadow-md);
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}
.chat-composer:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-ring), var(--shadow-md);
}
.chat-composer textarea {
  flex: 1 1 auto;
  border: none;
  outline: none;
  resize: none;
  background: transparent;
  color: var(--text);
  font-family: inherit;
  font-size: 0.98rem;
  line-height: 1.5;
  padding: 10px 0;
  max-height: 140px;
}
.chat-composer textarea::placeholder { color: var(--muted); }

.send-btn {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border: none;
  border-radius: var(--radius-full);
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: background 0.18s ease, transform 0.12s ease, box-shadow 0.18s ease;
}
.send-btn svg { width: 19px; height: 19px; }
.send-btn:hover { background: var(--accent-hover); box-shadow: var(--shadow-md); transform: translateY(-1px); }
.send-btn:active { transform: scale(0.96); }
.send-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; box-shadow: none; }

/* Pause (interrupt) state */
.send-btn.is-interrupt {
  background: var(--surface);
  color: var(--chip-error);
  border: 1px solid #fecaca;
}
.send-btn.is-interrupt:hover { background: #fef2f2; }

/* Disclaimer under composer */
.composer-note {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.78rem;
}
.composer-note svg { width: 13px; height: 13px; }

/* ============================================================
   Login
   ============================================================ */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
  background:
    radial-gradient(1200px 600px at 50% -10%, var(--accent-soft), transparent 60%),
    var(--bg);
}
.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  padding: 40px 36px;
}
.login-card .brand {
  display: flex;
  justify-content: center;
  margin-bottom: 8px;
  font-size: 1.4rem;
}
.login-sub {
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 300;
  margin: 0 0 28px;
}
#login-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
#login-form label {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
}
#login-form input {
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-muted);
  color: var(--text);
  font-size: 1rem;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}
#login-form input:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--surface);
  box-shadow: 0 0 0 3px var(--accent-ring);
}
#login-form .btn { width: 100%; padding: 12px; font-size: 0.95rem; }
.error-text {
  margin: 2px 0 0;
  font-size: 0.85rem;
  color: var(--chip-error);
  min-height: 1.35em;
  text-align: center;
}

/* ============================================================
   Modal (prompt editor)
   ============================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 100;
}
.modal-overlay[hidden] { display: none; }
.modal {
  width: 100%;
  max-width: 640px;
  max-height: 90vh;
  overflow-y: auto;
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-header h2 { margin: 0; font-size: 1.1rem; font-weight: 600; letter-spacing: -0.01em; }
.modal-close {
  border: none;
  background: transparent;
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
  color: var(--muted);
  padding: 0 4px;
  border-radius: var(--radius-sm);
  transition: color 0.15s ease, background 0.15s ease;
}
.modal-close:hover { color: var(--text); background: var(--bg-subtle); }
.modal label {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
}
.modal textarea {
  width: 100%;
  resize: vertical;
  min-height: 220px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-muted);
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.9rem;
  line-height: 1.5;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}
.modal textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ring);
}
.prompt-footer {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}
.prompt-footer input[type="password"] {
  flex: 1 1 180px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-muted);
  color: var(--text);
  font-size: 0.95rem;
}
.prompt-footer input[type="password"]:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ring);
}
.prompt-footer button:disabled { opacity: 0.55; cursor: not-allowed; }
.prompt-status {
  margin: 0;
  font-size: 0.85rem;
  color: var(--muted);
  min-height: 1.3em;
}
.prompt-status.is-error { color: var(--chip-error); }
.prompt-status.is-ok { color: var(--chip-done); }

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 720px) {
  .header-inner { padding: 14px 16px; }
  .container { padding: 20px 16px 40px; }
  .source-card { flex-basis: 280px; }
  .bubble { max-width: 92%; }
  .brand { font-size: 1rem; }
}
