/* ===========================
   LAN AI — Chat Platform CSS
   =========================== */

:root {
  --gold: #d4a017;
  --gold-light: #f0c040;
  --gold-bright: #ffd700;
  --gold-dim: #8b6914;
  --navy: #0d1b2a;
  --navy-mid: #1a2d42;
  --navy-light: #243650;
  --bg: #080e17;
  --surface: #0f1c2e;
  --surface2: #162436;
  --surface3: #1c2e44;
  --border: rgba(212, 160, 23, 0.1);
  --border-bright: rgba(212, 160, 23, 0.35);
  --text: #eee8d8;
  --text-muted: #7a8fa8;
  --text-dim: #3a4a5e;
  --red: #e74c3c;
  --green: #2ecc71;
  --sidebar-w: 270px;
  --input-max: 820px;
  --msg-max: 760px;
  --radius: 16px;
  --radius-sm: 10px;
}

/* ======= RESET ======= */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  scroll-behavior: smooth;
  height: 100%;
  height: -webkit-fill-available;
}

body {
  font-family: 'Cairo', 'Tajawal', sans-serif;
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
  height: 100vh;
  height: 100dvh;
  direction: rtl;
}

/* ======= SCROLLBAR ======= */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--gold-dim); border-radius: 4px; }

/* ======= APP SHELL ======= */
#app {
  display: flex;
  height: 100vh;
  height: 100dvh;
  position: relative;
  overflow: hidden;
}

/* ======= SIDEBAR ======= */
.sidebar {
  width: var(--sidebar-w);
  height: 100vh;
  height: 100dvh;
  background: var(--surface);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  z-index: 50;
  transition: transform 0.3s cubic-bezier(.4,0,.2,1);
  overflow: hidden;
}

.sidebar-top {
  padding: 18px 16px 12px;
  flex-shrink: 0;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 10px;
  transition: background .2s;
  margin-bottom: 14px;
}
.sidebar-logo:hover { background: rgba(212,160,23,.06); }
.logo-mark { width: 32px; height: 32px; flex-shrink: 0; }
.logo-mark img {
  border-radius: 4px;
}
.logo-name {
  font-size: 20px;
  font-weight: 900;
  background: linear-gradient(135deg, var(--gold-bright), var(--gold));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: .5px;
}

.new-chat-btn {
  width: 100%;
  padding: 10px 14px;
  background: rgba(212,160,23,.1);
  border: 1px solid var(--border-bright);
  border-radius: var(--radius-sm);
  color: var(--gold-light);
  font-family: 'Cairo', sans-serif;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: all .2s;
}
.new-chat-btn:hover {
  background: rgba(212,160,23,.18);
  border-color: var(--gold);
}
.new-chat-btn i { font-size: 13px; }

.sidebar-search {
  padding: 8px 16px 4px;
  position: relative;
  flex-shrink: 0;
}
.sidebar-search i {
  position: absolute;
  right: 28px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-dim);
  font-size: 12px;
  pointer-events: none;
}
.sidebar-search input {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 34px 8px 12px;
  color: var(--text);
  font-family: 'Cairo', sans-serif;
  font-size: 13px;
  outline: none;
  direction: rtl;
  transition: border-color .2s;
}
.sidebar-search input:focus { border-color: var(--gold-dim); }
.sidebar-search input::placeholder { color: var(--text-dim); }

.sidebar-section {
  padding: 8px 10px;
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}
.section-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.2px;
  color: var(--text-dim);
  padding: 6px 8px 6px;
  text-transform: uppercase;
}

.chats-list { display: flex; flex-direction: column; gap: 2px; }

.chat-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 10px;
  border-radius: 9px;
  cursor: pointer;
  transition: background .15s;
  position: relative;
  group: true;
}
.chat-item:hover { background: rgba(212,160,23,.07); }
.chat-item.active {
  background: rgba(212,160,23,.12);
  border: 1px solid rgba(212,160,23,.15);
}
.chat-item-icon {
  width: 26px;
  height: 26px;
  border-radius: 7px;
  background: var(--surface3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  color: var(--gold-dim);
  flex-shrink: 0;
}
.chat-item-title {
  font-size: 13px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  font-weight: 500;
}
.chat-item-del {
  display: none;
  color: var(--text-dim);
  font-size: 11px;
  padding: 2px 4px;
  transition: color .2s;
}
.chat-item:hover .chat-item-del { display: block; }
.chat-item-del:hover { color: var(--red); }

.workspace-links { display: flex; flex-direction: column; gap: 2px; }
.ws-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 9px;
  cursor: pointer;
  transition: background .15s;
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
}
.ws-link:hover { background: rgba(212,160,23,.07); color: var(--text); }
.ws-icon {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--surface2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.sidebar-bottom {
  padding: 10px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.user-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 10px;
  border-radius: 12px;
  cursor: pointer;
  transition: background .2s;
  margin-top: 4px;
}
.user-pill:hover { background: var(--surface2); }
.user-avatar-sm {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, var(--gold), #b8860b);
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 800;
  color: var(--navy);
  flex-shrink: 0;
}
.user-meta { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.user-nm { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-plan { font-size: 10px; color: var(--gold); font-weight: 600; }

/* ======= MAIN ======= */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
  position: relative;
}

/* TOPBAR (mobile only by default) */
.topbar {
  display: none;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  z-index: 10;
}
.topbar-menu, .topbar-new {
  width: 36px;
  height: 36px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text-muted);
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .2s;
}
.topbar-menu:hover, .topbar-new:hover { border-color: var(--gold); color: var(--gold); }
.topbar-logo {
  font-size: 16px;
  font-weight: 800;
  color: var(--gold);
  display: flex;
  align-items: center;
  gap: 6px;
}
.topbar-logo img {
  border-radius: 16px;
}

/* ======= CHAT VIEW ======= */
.chat-view {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  position: relative;
  scroll-behavior: smooth;
}

/* ======= WELCOME SCREEN ======= */
.welcome-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100%;
  padding: 40px 24px 120px;
}
.welcome-inner {
  max-width: 680px;
  width: 100%;
  text-align: center;
}
.welcome-orb {
  margin-bottom: 28px;
  animation: orbFloat 4s ease-in-out infinite;
}
.welcome-orb img {
  border-radius: 16px;
}

@keyframes orbFloat {
  0%,100% { transform: translateY(0) rotate(0deg); }
  50%      { transform: translateY(-10px) rotate(3deg); }
}
.welcome-title {
  font-size: clamp(28px, 4vw, 42px);
  font-weight: 900;
  margin-bottom: 12px;
  line-height: 1.2;
}
.welcome-title span {
  background: linear-gradient(135deg, var(--gold-bright), var(--gold));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.welcome-sub {
  font-size: 16px;
  color: var(--text-muted);
  line-height: 1.8;
  margin-bottom: 36px;
  max-width: 500px;
  margin-inline: auto;
}

.suggestion-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.suggestion-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 12px;
  cursor: pointer;
  transition: all .25s;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
}
.suggestion-card i {
  font-size: 18px;
  color: var(--gold);
  opacity: .8;
}
.suggestion-card span {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 600;
  line-height: 1.4;
}
.suggestion-card:hover {
  background: var(--surface2);
  border-color: var(--border-bright);
  transform: translateY(-2px);
}
.suggestion-card:hover span { color: var(--text); }
.suggestion-card:hover i { opacity: 1; }

/* ======= MESSAGES ======= */
.messages-container {
  padding: 24px 16px 120px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.message-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
  animation: msgIn .3s ease both;
}
@keyframes msgIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* User message */
.msg-user {
  display: flex;
  justify-content: flex-end;
  padding: 4px 0;
}
.msg-user-bubble {
  width: fit-content; 
  background: rgba(212,160,23,.12);
  border: 1px solid rgba(212,160,23,.2);
  border-radius: 18px 18px 4px 18px;
 padding: 5px 12px;
  font-size: 14px;
 line-height: 1.2;
  color: var(--text);
  white-space: pre-wrap;
max-width: min(var(--msg-max), 85%);
  word-break: break-word;
}
.msg-user-bubble.has-files {
  border-radius: 18px;
}

/* File attachment chips */
.msg-files {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}
.msg-file-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--surface3);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 5px 10px;
  font-size: 12px;
  color: var(--text-muted);
}
.msg-file-chip i { color: var(--gold); }

/* AI message */
.msg-ai {
  display: flex;
  gap: 12px;
  padding: 4px 0;
  align-items: flex-start;
  max-width: calc(var(--msg-max) + 44px);
}
.msg-ai-avatar {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(212,160,23,.2), rgba(139,105,20,.15));
  border: 1px solid rgba(212,160,23,.2);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 2px;
}
.msg-ai-avatar svg { width: 16px; height: 16px; }
.msg-ai-content {
  flex: 1;
  min-width: 0;
}
.msg-ai-bubble {
  font-size: 14px;
  line-height: 1.85;
  color: var(--text);
  word-break: break-word;
}
.msg-ai-bubble p { margin-bottom: 10px; }
.msg-ai-bubble p:last-child { margin-bottom: 0; }
.msg-ai-bubble strong { color: var(--gold-light); }
.msg-ai-bubble em { color: var(--text-muted); font-style: italic; }
.msg-ai-bubble ul, .msg-ai-bubble ol { padding-right: 20px; margin-bottom: 10px; }
.msg-ai-bubble li { margin-bottom: 5px; }
.msg-ai-bubble h1, .msg-ai-bubble h2, .msg-ai-bubble h3 {
  color: var(--gold-light);
  font-weight: 700;
  margin-bottom: 8px;
  margin-top: 14px;
}
.msg-ai-bubble h1 { font-size: 18px; }
.msg-ai-bubble h2 { font-size: 16px; }
.msg-ai-bubble h3 { font-size: 14px; }
.msg-ai-bubble code {
  background: var(--surface3);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 2px 6px;
  font-size: 13px;
  font-family: 'Courier New', monospace;
  color: var(--gold-light);
}
.msg-ai-bubble pre {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  overflow-x: auto;
  margin: 10px 0;
}
.msg-ai-bubble pre code {
  background: none;
  border: none;
  padding: 0;
  font-size: 13px;
}
.msg-ai-bubble blockquote {
  border-right: 3px solid var(--gold-dim);
  padding-right: 12px;
  color: var(--text-muted);
  margin: 10px 0;
}

/* Actions bar */
.msg-actions {
  display: flex;
  gap: 6px;
  margin-top: 8px;
  opacity: 0;
  transition: opacity .2s;
}
.msg-ai:hover .msg-actions { opacity: 1; }
@media (hover: none) {
  .msg-actions { opacity: 1; }
}
.msg-action-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 6px;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-family: 'Cairo', sans-serif;
  font-size: 11px;
  cursor: pointer;
  transition: all .2s;
}
.msg-action-btn:hover { border-color: var(--gold-dim); color: var(--gold); }

/* Typing indicator */
.typing-indicator {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 12px 16px;
}
.typing-dot {
  width: 6px;
  height: 6px;
  background: var(--gold-dim);
  border-radius: 50%;
  animation: typingBounce 1.2s ease-in-out infinite;
}
.typing-dot:nth-child(2) { animation-delay: .15s; }
.typing-dot:nth-child(3) { animation-delay: .3s; }
@keyframes typingBounce {
  0%,60%,100% { transform: translateY(0); opacity: .4; }
  30%          { transform: translateY(-6px); opacity: 1; }
}

/* Streaming cursor */
.stream-cursor {
  display: inline-block;
  width: 2px;
  height: 1em;
  background: var(--gold);
  margin-right: 2px;
  vertical-align: text-bottom;
  animation: cursorBlink .7s steps(1) infinite;
}
@keyframes cursorBlink {
  0%,100% { opacity: 1; }
  50%      { opacity: 0; }
}

/* ======= INPUT AREA ======= */
.input-area {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 0 16px 20px;
  padding-bottom: max(20px, env(safe-area-inset-bottom));
  background: linear-gradient(to top, var(--bg) 60%, transparent);
  pointer-events: none;
  z-index: 20;
}
.input-area > * { pointer-events: auto; }

/* Upload previews */
.upload-previews {
  max-width: var(--input-max);
  margin: 0 auto 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.upload-thumb {
  position: relative;
  width: 60px;
  height: 60px;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--border-bright);
}
.upload-thumb img { width: 100%; height: 100%; object-fit: cover; }
.upload-thumb-file {
  width: auto;
  height: 36px;
  border-radius: 8px;
  padding: 0 10px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
}
.upload-thumb-file i { color: var(--gold); }
.upload-remove {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  background: rgba(0,0,0,.7);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 9px;
  color: #fff;
  border: none;
}

.input-box {
  max-width: var(--input-max);
  margin: 0 auto;
  background: var(--surface);
  border: 1px solid var(--border-bright);
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 8px 40px rgba(0,0,0,.5), 0 0 0 1px rgba(212,160,23,.04);
  transition: border-color .3s, box-shadow .3s;
  position: relative;
}
.input-box:focus-within {
  border-color: rgba(212,160,23,.5);
  box-shadow: 0 8px 40px rgba(0,0,0,.6), 0 0 0 3px rgba(212,160,23,.06);
}

.drag-overlay {
  position: absolute;
  inset: 0;
  background: rgba(212,160,23,.08);
  border: 2px dashed var(--gold);
  border-radius: 18px;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--gold);
  font-size: 14px;
  font-weight: 600;
}
.drag-overlay i { font-size: 28px; }

.input-row {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  padding: 8px 10px 8px;
}
.input-action-btn {
  width: 36px;
  height: 36px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 15px;
  cursor: pointer;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all .2s;
  margin-bottom: 1px;
}
.input-action-btn:hover { background: var(--surface2); color: var(--gold); }
.input-action-btn.recording { color: var(--red); animation: recPulse 1s ease infinite; }
@keyframes recPulse { 0%,100%{opacity:1}50%{opacity:.5} }

#user-input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text);
  font-family: 'Cairo', sans-serif;
  font-size: 16px;
  line-height: 1.7;
  resize: none;
  outline: none;
  min-height: 36px;
  max-height: 200px;
  overflow-y: auto;
  direction: rtl;
  padding: 7px 2px;
  scroll-behavior: smooth;
}
#user-input::placeholder { color: var(--text-dim); }

.send-btn {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--gold), #b8860b);
  border: none;
  border-radius: 11px;
  color: var(--navy);
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all .2s;
  margin-bottom: 1px;
}
.send-btn:hover { transform: scale(1.08); box-shadow: 0 4px 16px rgba(212,160,23,.4); }
.send-btn:disabled { opacity: .4; cursor: default; transform: none; }

.input-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 14px 10px;
}
.input-hint { font-size: 11px; color: var(--text-dim); }
.char-count { font-size: 11px; color: var(--text-dim); }

/* ======= WORKSPACE MODAL ======= */
.workspace-modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(8,14,23,.8);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: modalIn .25s ease;
}
@keyframes modalIn { from{opacity:0} to{opacity:1} }

.ws-panel {
  background: var(--surface);
  border: 1px solid var(--border-bright);
  border-radius: 22px;
  width: 100%;
  max-width: 860px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 32px 80px rgba(0,0,0,.6);
  animation: panelIn .3s cubic-bezier(.34,1.56,.64,1);
}
@keyframes panelIn {
  from { transform: scale(.95) translateY(10px); opacity: 0; }
  to   { transform: scale(1) translateY(0); opacity: 1; }
}

.ws-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--surface);
  z-index: 2;
  border-radius: 22px 22px 0 0;
}
.ws-title {
  font-size: 17px;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 10px;
}
.ws-close {
  width: 32px;
  height: 32px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 9px;
  color: var(--text-muted);
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .2s;
}
.ws-close:hover { border-color: var(--red); color: var(--red); }

.ws-body {
  padding: 20px 24px 24px;
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 20px;
}

.gen-controls { display: flex; flex-direction: column; }
.gen-output {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 14px;
  min-height: 340px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  overflow: hidden;
}
.gen-output img, .gen-output video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 14px;
}

.ws-label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 6px;
  display: block;
}
.ws-textarea {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
  color: var(--text);
  font-family: 'Cairo', sans-serif;
  font-size: 13px;
  resize: vertical;
  outline: none;
  direction: rtl;
  line-height: 1.8;
  transition: border-color .2s;
}
.ws-textarea:focus { border-color: var(--gold-dim); }
.ws-select {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  color: var(--text);
  font-family: 'Cairo', sans-serif;
  font-size: 13px;
  outline: none;
  direction: rtl;
  -webkit-appearance: none;
  transition: border-color .2s;
}
.ws-select:focus { border-color: var(--gold-dim); }
.ws-input {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  color: var(--text);
  font-family: 'Cairo', sans-serif;
  font-size: 13px;
  outline: none;
  direction: rtl;
  transition: border-color .2s;
  display: block;
  margin-bottom: 6px;
}
.ws-input:focus { border-color: var(--gold-dim); }
.ws-btn-primary {
  padding: 11px 18px;
  background: linear-gradient(135deg, var(--gold), #b8860b);
  border: none;
  border-radius: var(--radius-sm);
  color: var(--navy);
  font-family: 'Cairo', sans-serif;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all .2s;
}
.ws-btn-primary:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(212,160,23,.35); }
.ws-btn-ghost {
  padding: 10px 16px;
  background: transparent;
  border: 1px solid var(--border-bright);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-family: 'Cairo', sans-serif;
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all .2s;
}
.ws-btn-ghost:hover { border-color: var(--gold); color: var(--gold); }
.ws-spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(0,0,0,.2);
  border-top-color: var(--navy);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.settings-group { border-bottom: 1px solid var(--border); padding-bottom: 16px; }
.settings-label { font-size: 11px; font-weight: 700; letter-spacing: 1px; color: var(--text-dim); text-transform: uppercase; margin-bottom: 10px; }
.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 14px;
  color: var(--text);
}

/* ======= SIDEBAR OVERLAY ======= */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 49;
}

/* ======= TOAST ======= */
.toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--gold);
  color: var(--navy);
  padding: 11px 26px;
  border-radius: 100px;
  font-family: 'Cairo', sans-serif;
  font-size: 13px;
  font-weight: 700;
  z-index: 9999;
  box-shadow: 0 8px 30px rgba(212,160,23,.4);
  animation: toastIn .3s ease;
  white-space: nowrap;
}
@keyframes toastIn { from{opacity:0;transform:translateX(-50%) translateY(8px)} to{opacity:1;transform:translateX(-50%) translateY(0)} }
.toast.hidden { display: none; }

/* ======= RESPONSIVE ======= */
@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    right: 0;
    top: 0;
    height: 100%;
    height: 100dvh;
    transform: translateX(100%);
    z-index: 50;
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .sidebar-overlay.open { display: block; }
  .topbar { display: flex; }

  /* Welcome screen — less padding, smaller orb */
  .welcome-screen {
    padding: 24px 16px 140px;
    align-items: flex-start;
    padding-top: max(24px, 10vh);
  }
  .welcome-orb img { width: 60px; height: 60px; }
  .welcome-orb { margin-bottom: 18px; }
  .welcome-sub { font-size: 14px; margin-bottom: 24px; }
  .suggestion-grid { grid-template-columns: repeat(2, 1fr); }

  /* Messages — tighter padding */
  .messages-container { padding: 16px 12px 140px; }
  .msg-user-bubble { font-size: 14px; padding: 10px 13px; }
  .msg-ai-bubble { font-size: 14px; }
  .msg-ai { gap: 8px; }
  .msg-ai-avatar { width: 28px; height: 28px; flex-shrink: 0; }

  /* Input area */
  .input-area { padding: 0 10px 12px; padding-bottom: max(12px, env(safe-area-inset-bottom)); }
  .input-row { padding: 6px 8px; gap: 2px; }
  .input-action-btn { width: 34px; height: 34px; font-size: 14px; }
  .send-btn { width: 34px; height: 34px; }

  /* Workspace modals */
  .workspace-modal { padding: 0; align-items: flex-end; }
  .ws-panel {
    border-radius: 22px 22px 0 0;
    max-height: 92dvh;
    padding-bottom: env(safe-area-inset-bottom);
  }
  .ws-body { grid-template-columns: 1fr; padding: 16px; gap: 16px; }
  .gen-output { min-height: 220px; }
  .ws-header { padding: 16px 18px 12px; border-radius: 22px 22px 0 0; }

  /* Toast — avoid home bar */
  .toast { bottom: max(28px, calc(env(safe-area-inset-bottom) + 12px)); }
}

@media (min-width: 769px) {
  .topbar { display: none; }
}

/* ======= ANIMATIONS ======= */
@keyframes fadeIn  { from{opacity:0}to{opacity:1} }
@keyframes fadeUp  { from{opacity:0;transform:translateY(12px)}to{opacity:1;transform:translateY(0)} }
.fade-in { animation: fadeIn .4s ease both; }
.fade-up { animation: fadeUp .4s ease both; }
