:root {
  --jo-green: #007a3d;
  --jo-red: #ce1126;
  --jo-gold: #c9a227;
  --jo-black: #1a1a1a;
  --white: #ffffff;
  --bg: #ffffff;
  --bg-soft: #f8fafb;
  --bg-sidebar: #f0f4f9;
  --bg-hover: #e8eef5;
  --bg-assistant: #f8fafb;
  --text: #1f1f1f;
  --text-muted: #5f6368;
  --text-dim: #80868b;
  --border: #e0e3e7;
  --border-strong: #d2d6dc;
  --shadow: 0 1px 3px rgba(0, 0, 0, .08), 0 4px 16px rgba(0, 0, 0, .06);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, .1);
  --radius: 16px;
  --radius-sm: 10px;
  --radius-full: 999px;
  --font: "IBM Plex Sans Arabic", "Google Sans", "Segoe UI", sans-serif;
  --msg-width: 720px;
  --gemini-gradient: linear-gradient(135deg, #007a3d 0%, #1a8f4e 40%, #c9a227 100%);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --jo-black: #f3f4f6;
    --white: #1e2430;
    --bg: #12151c;
    --bg-soft: #181c26;
    --bg-sidebar: #0f1218;
    --bg-hover: #252b38;
    --bg-assistant: #1a1f2b;
    --text: #e8eaed;
    --text-muted: #9aa0a6;
    --text-dim: #6b7280;
    --border: #2d3544;
    --border-strong: #3d4659;
    --shadow: 0 1px 3px rgba(0, 0, 0, .35), 0 4px 16px rgba(0, 0, 0, .25);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, .45);
  }
}

[data-theme="dark"] {
  --jo-black: #f3f4f6;
  --white: #1e2430;
  --bg: #12151c;
  --bg-soft: #181c26;
  --bg-sidebar: #0f1218;
  --bg-hover: #252b38;
  --bg-assistant: #1a1f2b;
  --text: #e8eaed;
  --text-muted: #9aa0a6;
  --text-dim: #6b7280;
  --border: #2d3544;
  --border-strong: #3d4659;
  --shadow: 0 1px 3px rgba(0, 0, 0, .35), 0 4px 16px rgba(0, 0, 0, .25);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, .45);
}

[data-theme="light"] {
  color-scheme: light;
}

[data-theme="dark"] {
  color-scheme: dark;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

button, textarea, input { font: inherit; cursor: pointer; }
textarea { cursor: text; }

.shell { display: flex; height: 100vh; overflow: hidden; }

/* ── Sidebar (Gemini-style) ── */
.sidebar {
  width: 280px;
  background: var(--bg-sidebar);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  padding: 16px 12px;
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 8px 16px;
}

.brand-logo {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  object-fit: cover;
  border: 1px solid var(--border);
}

.brand-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--jo-black);
}

.brand-title .accent {
  background: var(--gemini-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.brand-slogan {
  font-size: .72rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.new-chat-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
  background: var(--white);
  color: var(--text);
  font-weight: 500;
  font-size: .88rem;
  margin-bottom: 16px;
  transition: background .15s, box-shadow .15s;
}

.new-chat-btn:hover {
  background: var(--bg-hover);
  box-shadow: var(--shadow);
}

.sidebar-section { margin-bottom: 12px; }

.section-label, .history-label {
  font-size: .72rem;
  font-weight: 600;
  color: var(--text-dim);
  padding: 0 10px 8px;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.sidebar-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  font-size: .86rem;
  text-align: right;
  transition: background .12s;
}

.sidebar-item:hover { background: var(--bg-hover); color: var(--text); }
.sidebar-item.active { background: var(--white); color: var(--jo-green); font-weight: 600; box-shadow: var(--shadow); }
.sidebar-item.desktop-dl { text-decoration: none; color: inherit; }
.sidebar-item.desktop-dl:hover { color: var(--jo-green); }
.brand-link { text-decoration: none; color: var(--text-muted); font-size: 1.1rem; margin-left: 4px; }
.brand-block { display: flex; align-items: center; gap: 8px; }

.history {
  flex: 1;
  overflow-y: auto;
  padding: 0 4px;
}

.history-row {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 2px;
}

.history-row .history-item {
  flex: 1;
  margin-bottom: 0;
}

.history-item.active {
  background: var(--white);
  color: var(--jo-green);
  font-weight: 600;
  box-shadow: var(--shadow);
}

.history-delete {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-dim);
  font-size: 1.1rem;
  line-height: 1;
  opacity: .55;
  transition: opacity .12s, background .12s, color .12s;
}

.history-row:hover .history-delete,
.history-delete:focus-visible { opacity: 1; }
.history-delete:hover { background: rgba(200, 40, 40, .1); color: #c62828; }

@media (hover: none) {
  .history-delete { opacity: .85; }
}

.history-empty {
  padding: 12px;
  font-size: .78rem;
  color: var(--text-dim);
  line-height: 1.5;
  text-align: center;
}

.web-answer {
  margin-top: 12px;
  padding: 14px 16px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
}

.search-status + .web-answer { margin-top: 10px; }

.history-item {
  width: 100%;
  text-align: right;
  padding: 9px 12px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  font-size: .84rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 2px;
}

.history-item:hover { background: var(--bg-hover); color: var(--text); }

.sidebar-footer {
  padding-top: 12px;
  border-top: 1px solid var(--border);
  margin-top: auto;
}

.jordan-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: .72rem;
  color: var(--text-muted);
  padding: 8px 10px;
  background: var(--white);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  margin-bottom: 8px;
}

.user-mini {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: var(--white);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.user-name { font-size: .84rem; font-weight: 600; }
.user-email { font-size: .72rem; color: var(--text-muted); }

.user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--gemini-gradient);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: .85rem;
  flex-shrink: 0;
}

.user-avatar.sm { width: 32px; height: 32px; font-size: .78rem; }

/* ── Main ── */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--bg);
}

.topbar {
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  border-bottom: 1px solid var(--border);
  background: var(--white);
}

.topbar-center {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  font-size: .95rem;
  color: var(--jo-black);
}

.topbar-logo {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  object-fit: cover;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-right: auto;
}

.status-pill {
  font-size: .74rem;
  color: var(--jo-green);
  background: rgba(0, 122, 61, .08);
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-weight: 500;
}

.auth-buttons { display: flex; gap: 8px; }
.auth-buttons[hidden],
.user-menu[hidden],
.user-mini[hidden] { display: none !important; }

.btn-outline {
  padding: 8px 16px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-strong);
  background: var(--white);
  color: var(--text);
  font-size: .82rem;
  font-weight: 500;
}

.btn-outline:hover { background: var(--bg-soft); }

.btn-primary {
  padding: 8px 18px;
  border-radius: var(--radius-full);
  border: none;
  background: var(--jo-green);
  color: #fff;
  font-size: .82rem;
  font-weight: 600;
}

.btn-primary:hover { background: #006633; }
.btn-primary.full { width: 100%; padding: 12px; border-radius: var(--radius-sm); }
.btn-primary:disabled { opacity: .5; }

.user-menu { position: relative; }
.user-menu-trigger {
  border: 1px solid var(--border);
  border-radius: 50%;
  padding: 2px;
  background: var(--white);
}

.user-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  min-width: 220px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 8px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  transition: .15s;
  z-index: 50;
}

.user-menu.open .user-dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.dropdown-header { display: flex; gap: 10px; padding: 8px; }
.dropdown-name { font-weight: 600; font-size: .88rem; }
.dropdown-email { font-size: .74rem; color: var(--text-muted); }
.dropdown-divider { height: 1px; background: var(--border); margin: 4px 0; }

.dropdown-item {
  width: 100%;
  padding: 10px 12px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  text-align: right;
  font-size: .86rem;
  display: block;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
}

.dropdown-item:hover { background: var(--bg-soft); }
.dropdown-item.danger { color: var(--jo-red); }

.icon-btn {
  border: none;
  background: transparent;
  padding: 8px;
  border-radius: 8px;
  display: none;
}

.icon-btn:hover { background: var(--bg-hover); }

/* ── Chat ── */
.chat-viewport {
  flex: 1;
  overflow-y: auto;
  background: var(--white);
}

.chat-inner { padding-bottom: 24px; }

.hero {
  max-width: 720px;
  margin: 0 auto;
  padding: 48px 24px 40px;
  text-align: center;
}

.hero-badge {
  display: inline-block;
  padding: 6px 14px;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(0, 122, 61, .08), rgba(206, 17, 38, .06));
  border: 1px solid var(--border);
  font-size: .78rem;
  color: var(--text-muted);
  margin-bottom: 20px;
}

.hero-logo {
  width: 88px;
  height: 88px;
  border-radius: 22px;
  object-fit: cover;
  margin-bottom: 18px;
  border: 2px solid var(--border);
  box-shadow: var(--shadow);
}

.hero h1 {
  font-size: 2.2rem;
  font-weight: 700;
  color: var(--jo-black);
  margin-bottom: 8px;
}

.hero h1 span {
  background: var(--gemini-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-tagline {
  font-size: 1rem;
  color: var(--jo-green);
  font-weight: 500;
  margin-bottom: 12px;
}

.hero-desc {
  color: var(--text-muted);
  line-height: 1.75;
  max-width: 520px;
  margin: 0 auto 16px;
  font-size: .94rem;
}

.hero-features {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-bottom: 14px;
}

.hero-features span {
  font-size: .74rem;
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  color: var(--jo-green);
  font-weight: 500;
}

.hero-stat-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin: 18px 0 6px;
}

.hero-stat {
  padding: 7px 14px;
  border-radius: var(--radius-full);
  background: var(--bg-soft);
  border: 1px solid var(--border);
  font-size: .76rem;
  color: var(--text-muted);
}

.hero-guest-note {
  font-size: .8rem;
  color: var(--text-dim);
  margin-bottom: 22px;
  line-height: 1.6;
}

.inline-link {
  background: none;
  border: none;
  color: var(--jo-green);
  font: inherit;
  cursor: pointer;
  text-decoration: underline;
  padding: 0;
}

.chips-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  max-width: 640px;
  margin: 0 auto;
  text-align: right;
}

.chip-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--white);
  text-align: right;
  transition: border-color .15s, box-shadow .15s, transform .15s;
  min-height: 96px;
}

.chip-card:hover {
  border-color: var(--jo-green);
  box-shadow: var(--shadow);
  transform: translateY(-1px);
}

.chip-icon { font-size: 1.25rem; line-height: 1; }
.chip-title { font-size: .88rem; font-weight: 600; color: var(--text); }
.chip-desc {
  font-size: .72rem;
  color: var(--text-muted);
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  max-width: 560px;
  margin: 0 auto;
}

.chip {
  padding: 12px 18px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-soft);
  text-align: right;
  transition: all .15s;
  max-width: 260px;
}

.chip:hover {
  border-color: var(--jo-green);
  background: var(--white);
  box-shadow: var(--shadow);
}

.chip-title { font-size: .86rem; font-weight: 600; color: var(--text); margin-bottom: 4px; }
.chip-desc { font-size: .76rem; color: var(--text-muted); line-height: 1.4; }

@media (max-width: 720px) {
  .chips-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 480px) {
  .chips-grid { grid-template-columns: 1fr; }
  .hero { padding-top: 32px; }
}

.turn {
  border-bottom: 1px solid var(--border);
  animation: fadeUp .25s ease;
}

.turn.user { background: var(--white); }
.turn.assistant { background: var(--bg-assistant); }

.turn-inner {
  max-width: var(--msg-width);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 36px 1fr;
  gap: 16px;
  padding: 24px 20px;
}

.turn-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  overflow: hidden;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: .85rem;
}

.turn-icon img { width: 100%; height: 100%; object-fit: cover; }

.turn.user .turn-icon {
  background: var(--jo-green);
  color: #fff;
}

.turn.assistant .turn-icon {
  border: 1px solid var(--border);
  background: var(--white);
}

.turn-name {
  font-size: .75rem;
  font-weight: 600;
  color: var(--text-dim);
  margin-bottom: 8px;
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Markdown */
.md-content { font-size: .95rem; line-height: 1.85; color: var(--text); }
.md-content p { margin: 0 0 1em; }
.md-content h1, .md-content h2, .md-content h3 {
  color: var(--jo-black);
  font-weight: 700;
  margin: 1.2em 0 .5em;
}
.md-content h3 { font-size: 1.05rem; color: var(--jo-green); }
.md-content ul, .md-content ol { margin: .5em 0 1em; padding-right: 1.4em; }
.md-content li { margin-bottom: .4em; }
.md-content li::marker { color: var(--jo-green); }
.md-content strong { font-weight: 700; color: var(--jo-black); }
.md-content a { color: #1a73e8; text-decoration: underline; }
.md-content pre {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
  overflow-x: auto;
  margin: 1em 0;
  font-size: .84rem;
}
.md-content code {
  background: rgba(0, 122, 61, .08);
  padding: .12em .35em;
  border-radius: 4px;
  font-family: Consolas, monospace;
  color: var(--jo-green);
}

.search-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: var(--radius-full);
  background: rgba(26, 115, 232, .08);
  color: #1a73e8;
  font-size: .84rem;
  margin-bottom: 12px;
}

.search-status.done { background: rgba(0, 122, 61, .08); color: var(--jo-green); }

.search-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(26, 115, 232, .2);
  border-top-color: #1a73e8;
  border-radius: 50%;
  animation: spin .8s linear infinite;
}

.search-status.done .search-spinner { display: none; }
@keyframes spin { to { transform: rotate(360deg); } }

.typing-dots { display: inline-flex; gap: 5px; }
.typing-dots span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--jo-green);
  opacity: .35;
  animation: bounce 1.2s infinite;
}
.typing-dots span:nth-child(2) { animation-delay: .15s; }
.typing-dots span:nth-child(3) { animation-delay: .3s; }

@keyframes bounce {
  0%, 80%, 100% { transform: translateY(0); opacity: .35; }
  40% { transform: translateY(-4px); opacity: 1; }
}

.error-box {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  background: rgba(206, 17, 38, .06);
  border: 1px solid rgba(206, 17, 38, .2);
  color: var(--jo-red);
  font-size: .88rem;
}

.sources { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--border); }
.sources-title { font-size: .78rem; color: var(--text-dim); font-weight: 600; margin-bottom: 8px; }
.source-item {
  display: block;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  margin-bottom: 6px;
  text-decoration: none;
  color: inherit;
}
.source-item:hover { background: var(--bg-soft); }
.source-title { font-size: .86rem; font-weight: 600; color: #1a73e8; }

/* ── Composer (Gemini pill) ── */
.composer-area {
  padding: 16px 24px 20px;
  background: var(--white);
  border-top: 1px solid var(--border);
}

.composer-box {
  max-width: var(--msg-width);
  margin: 0 auto;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 28px;
  box-shadow: var(--shadow);
  transition: border-color .2s, box-shadow .2s;
}

.composer-box.drag-over {
  border-color: var(--jo-green);
  box-shadow: 0 0 0 3px rgba(0, 122, 61, .12), var(--shadow);
}

.attachment-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 14px 0;
}

.attachment-preview[hidden] { display: none; }

.attachment-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--white);
  max-width: 220px;
}

.attachment-thumb {
  width: 40px;
  height: 40px;
  object-fit: cover;
  border-radius: 8px;
}

.attachment-file-icon {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  background: var(--bg-hover);
  border-radius: 8px;
  font-size: 1.1rem;
}

.attachment-meta { min-width: 0; flex: 1; }

.attachment-name {
  font-size: .78rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.attachment-size {
  font-size: .68rem;
  color: var(--text-dim);
}

.attachment-remove {
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 1.1rem;
  line-height: 1;
  padding: 2px 4px;
}

.attachment-remove:hover { color: var(--jo-red); }

.msg-attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.msg-attachment {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-width: 180px;
  font-size: .72rem;
  color: var(--text-muted);
}

.msg-attachment img {
  width: 100%;
  max-height: 140px;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid var(--border);
}

.msg-attachment.file {
  flex-direction: row;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-soft);
}

.msg-file-icon { font-size: 1rem; }

.image-card {
  margin-top: 12px;
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  background: var(--white);
  box-shadow: var(--shadow);
}

.image-card img {
  width: 100%;
  max-height: 420px;
  object-fit: contain;
  background: #f8f8f8;
  display: block;
}

.image-card.broken img {
  display: none;
}

.image-card.broken::after {
  content: "تعذر عرض الصورة — استخدم زر التحميل";
  display: block;
  padding: 24px;
  text-align: center;
  color: var(--text-muted);
}

.image-actions {
  padding: 10px 14px 0;
}

.image-meta {
  padding: 8px 14px 12px;
  font-size: .76rem;
  color: var(--text-muted);
}

.file-card {
  margin-top: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--white);
  box-shadow: var(--shadow);
  flex-wrap: wrap;
}

.file-card-icon {
  font-size: 1.6rem;
}

.file-card-meta { flex: 1; min-width: 140px; }

.file-card-name {
  font-size: .92rem;
  font-weight: 600;
}

.file-card-size {
  font-size: .74rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.download-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--radius-full);
  background: var(--jo-green);
  color: #fff;
  text-decoration: none;
  font-size: .82rem;
  font-weight: 600;
}

.download-btn:hover { background: #006633; }

.composer-box:focus-within {
  border-color: var(--jo-green);
  box-shadow: 0 0 0 3px rgba(0, 122, 61, .1), var(--shadow);
}

.composer-box form {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  padding: 8px 10px 8px 14px;
}

.tool-btn {
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--text-muted);
  display: grid;
  place-items: center;
  flex-shrink: 0;
  transition: all .15s;
}

.tool-btn:hover { background: var(--bg-hover); color: var(--jo-green); }

textarea {
  flex: 1;
  border: none;
  outline: none;
  resize: none;
  background: transparent;
  color: var(--text);
  min-height: 24px;
  max-height: 180px;
  line-height: 1.55;
  padding: 10px 0;
  font-size: .94rem;
}

.send-btn {
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 50%;
  background: var(--jo-green);
  color: #fff;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  transition: background .15s;
}

.send-btn:hover { background: #006633; }
.send-btn:disabled { opacity: .4; cursor: not-allowed; }

.composer-note {
  text-align: center;
  font-size: .72rem;
  color: var(--text-dim);
  margin-top: 10px;
}

.site-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 6px;
  font-size: .7rem;
  color: var(--text-dim);
}

.site-footer a {
  color: var(--text-muted);
  text-decoration: none;
}

.site-footer a:hover { color: var(--jo-green); text-decoration: underline; }
.site-footer .dot { opacity: .5; }

.terms-check {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: .78rem;
  color: var(--text-muted);
  line-height: 1.5;
  cursor: pointer;
}

.profile-card { max-width: 440px; }
.profile-card select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font: inherit;
  background: var(--white);
}
.form-hint {
  font-size: .78rem;
  color: var(--text-muted);
  line-height: 1.5;
}
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .4);
  display: grid;
  place-items: center;
  z-index: 100;
  padding: 20px;
}

.modal-overlay[hidden] { display: none; }

.modal-card {
  width: 100%;
  max-width: 400px;
  background: var(--white);
  border-radius: 20px;
  padding: 28px 24px;
  box-shadow: var(--shadow-lg);
  position: relative;
}

.modal-close {
  position: absolute;
  top: 12px;
  left: 12px;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 50%;
  background: var(--bg-soft);
  font-size: 1.2rem;
  color: var(--text-muted);
}

.modal-brand { text-align: center; margin-bottom: 20px; }
.modal-logo { width: 56px; height: 56px; border-radius: 14px; margin-bottom: 12px; }
.modal-brand h2 { font-size: 1.2rem; margin-bottom: 4px; }
.modal-brand p { font-size: .84rem; color: var(--text-muted); }

.auth-form { display: flex; flex-direction: column; gap: 12px; }
.auth-form[hidden] { display: none; }

.field label { display: block; font-size: .78rem; font-weight: 600; color: var(--text-muted); margin-bottom: 5px; }
.field input {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  outline: none;
}
.field input:focus { border-color: var(--jo-green); box-shadow: 0 0 0 3px rgba(0, 122, 61, .1); }

.link-btn { background: none; border: none; color: var(--jo-green); font-size: .84rem; }
.link-btn.inline { display: inline; padding: 0; }
.auth-switch { text-align: center; font-size: .84rem; color: var(--text-muted); }
.form-hint { font-size: .84rem; color: var(--text-muted); line-height: 1.5; }

.auth-alert { margin-top: 12px; padding: 10px 14px; border-radius: var(--radius-sm); font-size: .84rem; }
.auth-alert.error { background: rgba(206, 17, 38, .06); color: var(--jo-red); border: 1px solid rgba(206, 17, 38, .2); }
.auth-alert.info { background: rgba(0, 122, 61, .06); color: var(--jo-green); border: 1px solid rgba(0, 122, 61, .2); }
.auth-alert.success { background: rgba(0, 122, 61, .06); color: var(--jo-green); }

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  padding: 12px 20px;
  border-radius: var(--radius-full);
  background: var(--jo-black);
  color: #fff;
  font-size: .86rem;
  z-index: 200;
  box-shadow: var(--shadow-lg);
}

.toast[hidden] { display: none; }

.mobile-only { display: none; }

.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .45);
  z-index: 35;
  border: none;
  padding: 0;
  cursor: pointer;
}

.sidebar-backdrop.visible { display: block; }

@media (max-width: 860px) {
  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 40;
    transform: translateX(100%);
    transition: transform .25s;
    box-shadow: var(--shadow-lg);
  }
  .sidebar.open { transform: translateX(0); }
  .mobile-only { display: grid; }
  .topbar-center { position: static; transform: none; }
  .topbar { justify-content: space-between; }
  .auth-buttons .btn-outline { display: none; }
  .chips { flex-direction: column; align-items: center; }
}
