/* ============================================
   WWCT - Webwonder Creative Technologies
   File: web/static/css/style.css
   Role: OpenALKA Global UI Styles
   Structure:
   1. Tokens
   2. Reset / Global
   3. Shared UI
   4. Base Pages
   5. Workspace Desktop
   6. Workspace Mobile
   7. Modal / Share / Helpers
============================================ */

/* ============================================
   1. TOKENS
============================================ */

:root {
  --bg-1: #05070b;
  --bg-2: #0a1018;
  --panel: rgba(16, 22, 32, 0.78);
  --panel-soft: rgba(255, 255, 255, 0.035);
  --line: rgba(255, 255, 255, 0.08);
  --text: #eef4ff;
  --muted: #9eabc0;
  --blue: #6ea6ff;
  --gold: #d7b27a;
  --cyan: #69d8ff;
  --violet: #8f7cff;
  --shadow: 0 0 40px rgba(110, 166, 255, 0.12);

  --radius-xl: 24px;
  --radius-lg: 18px;
  --radius-md: 14px;
  --radius-sm: 10px;

  --content-max: 1120px;
  --content-gap: 36px;
  --workspace-sidebar-width: 290px;
}

/* ============================================
   2. RESET / GLOBAL
============================================ */

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top center, rgba(110, 166, 255, 0.12), transparent 24%),
    radial-gradient(circle at 50% 35%, rgba(215, 178, 122, 0.06), transparent 22%),
    linear-gradient(180deg, var(--bg-2), var(--bg-1));
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select,
textarea {
  font: inherit;
}

body.drawer-open {
  overflow: hidden;
}

/* ============================================
   3. SHARED UI
============================================ */

.brand-logo {
  width: 48px;
  height: 48px;
  object-fit: contain;
  flex-shrink: 0;
  filter: drop-shadow(0 0 10px rgba(110, 166, 255, 0.18));
}

.primary-btn,
.ghost-btn,
.new-chat-btn,
.mode-btn {
  cursor: pointer;
  transition: 0.2s ease;
  font: inherit;
}

.primary-btn:hover,
.ghost-btn:hover,
.new-chat-btn:hover,
.mode-btn:hover {
  transform: translateY(-1px);
}

.ghost-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
}

.ghost-btn:hover {
  border-color: rgba(215, 178, 122, 0.24);
  background: linear-gradient(
    180deg,
    rgba(215, 178, 122, 0.10),
    rgba(110, 166, 255, 0.06)
  );
}

.primary-btn {
  min-width: 156px;
  padding: 12px 18px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(215, 178, 122, 0.26);
  color: var(--text);
  font-weight: 600;
  background: linear-gradient(
    180deg,
    rgba(215, 178, 122, 0.18),
    rgba(110, 166, 255, 0.12)
  );
}

.response-tag,
.panel-tag {
  display: inline-flex;
  margin-bottom: 10px;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 0.76rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border: 1px solid rgba(215, 178, 122, 0.16);
  color: var(--gold);
  background: rgba(215, 178, 122, 0.08);
}

.hero,
.composer,
.panel-card,
.response-card,
.empty-state-box,
.base-topbar,
.legal-shell,
.modal-shell {
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: var(--shadow);
}

/* ============================================
   4. BASE PAGES
============================================ */

.base-page-body {
  min-height: 100vh;
}

.base-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.base-topbar {
  width: min(var(--content-max), calc(100% - var(--content-gap)));
  margin: 22px auto 0;
  padding: 16px 18px;
  border-radius: var(--radius-xl);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.base-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.base-brand strong {
  margin: 0;
  font-size: 1rem;
  letter-spacing: 0.06em;
}

.base-brand span {
  margin: 3px 0 0;
  display: block;
  font-size: 0.78rem;
  color: var(--muted);
}

.base-nav {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.base-nav a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
}

.base-nav a:hover {
  transform: translateY(-1px);
  border-color: rgba(215, 178, 122, 0.24);
  background: linear-gradient(
    180deg,
    rgba(215, 178, 122, 0.10),
    rgba(110, 166, 255, 0.06)
  );
}

.base-content {
  flex: 1;
  width: 100%;
}

.legal-shell {
  width: min(920px, calc(100% - var(--content-gap)));
  margin: 22px auto 0;
  padding: 22px;
  border-radius: var(--radius-xl);
}

.site-footer {
  width: min(var(--content-max), calc(100% - var(--content-gap)));
  margin: 22px auto;
  padding: 16px 18px 24px;
  border-top: 1px solid var(--line);
  text-align: center;
  display: grid;
  gap: 6px;
  color: var(--muted);
}

.footer-main {
  font-weight: 600;
  color: var(--text);
}

.footer-sub {
  font-size: 0.85rem;
}

.footer-closure {
  margin-top: 6px;
  color: var(--gold);
  font-size: 0.9rem;
}

.footer-alka-out {
  margin: 12px auto 0;
  padding: 10px 16px;
  min-height: 42px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(215, 178, 122, 0.24);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  font-weight: 600;
  letter-spacing: 0.08em;
  cursor: pointer;
}

.footer-alka-out:hover {
  transform: translateY(-1px);
  border-color: rgba(215, 178, 122, 0.34);
  background: linear-gradient(
    180deg,
    rgba(215, 178, 122, 0.14),
    rgba(110, 166, 255, 0.08)
  );
}

/* Base mobile nav */
.base-mobile-menu-btn,
.base-mobile-drawer,
.base-mobile-overlay {
  display: none;
}

/* ============================================
   5. WORKSPACE DESKTOP
============================================ */

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: var(--workspace-sidebar-width) 1fr;
}

.main-content {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding-bottom: 40px;
}

.sidebar {
  border-right: 1px solid var(--line);
  background: rgba(5, 8, 12, 0.82);
  backdrop-filter: blur(10px);
  padding: 22px 18px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand h1 {
  margin: 0;
  font-size: 1rem;
  letter-spacing: 0.06em;
}

.brand p {
  margin: 3px 0 0;
  font-size: 0.78rem;
  color: var(--muted);
}

.new-chat-btn {
  border: 1px solid rgba(215, 178, 122, 0.22);
  padding: 14px 16px;
  text-align: left;
  border-radius: var(--radius-md);
  color: var(--text);
  background: linear-gradient(
    180deg,
    rgba(215, 178, 122, 0.14),
    rgba(110, 166, 255, 0.08)
  );
  font-weight: 600;
}

.sidebar-section {
  display: grid;
  gap: 10px;
}

.sidebar-title {
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.sidebar-card {
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.035);
  padding: 12px 14px;
  border-radius: var(--radius-md);
}

.sidebar-card strong {
  display: block;
  font-size: 0.9rem;
  margin-bottom: 4px;
}

.sidebar-card span {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.5;
}

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

.sidebar-footer p {
  margin: 0 0 4px;
  font-weight: 700;
  color: var(--gold);
}

.sidebar-footer span {
  color: var(--muted);
  font-size: 0.82rem;
}

.topbar {
  padding: 18px 28px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  background: rgba(5, 8, 12, 0.48);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 20;
}

.topbar h2 {
  margin: 0;
  font-size: 1.08rem;
}

.topbar p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.user-welcome {
  margin-top: 8px !important;
  color: var(--gold) !important;
  font-size: 0.9rem !important;
}

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

.logout-btn {
  border-color: rgba(215, 178, 122, 0.22);
}

.hero {
  margin: 28px auto 0;
  width: min(var(--content-max), calc(100% - var(--content-gap)));
  border-radius: var(--radius-xl);
  overflow: hidden;
}

.hero-premium {
  padding: 0;
}

.thinking-aura {
  position: relative;
  min-height: 320px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 28px;
  background:
    radial-gradient(circle at 50% 45%, rgba(110, 166, 255, 0.14), transparent 28%),
    radial-gradient(circle at 50% 45%, rgba(143, 124, 255, 0.08), transparent 38%),
    linear-gradient(180deg, rgba(255,255,255,0.02), rgba(255,255,255,0.01));
}

#auraCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
}

.aura-grid {
  position: absolute;
  inset: 0;
  z-index: 2;
  background-image:
    linear-gradient(rgba(110,166,255,0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(110,166,255,0.05) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: radial-gradient(circle at center, black 25%, transparent 75%);
  opacity: 0.32;
  pointer-events: none;
}

.aura-rings {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
}

.aura-rings::before,
.aura-rings::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 48%;
  transform: translate(-50%, -50%);
  border-radius: 999px;
  border: 1px solid rgba(105, 216, 255, 0.12);
  box-shadow: 0 0 22px rgba(110, 166, 255, 0.08);
}

.aura-rings::before {
  width: 280px;
  height: 280px;
  animation: ringPulse 6.5s ease-in-out infinite;
}

.aura-rings::after {
  width: 380px;
  height: 380px;
  border-color: rgba(143, 124, 255, 0.10);
  animation: ringPulse 8.5s ease-in-out infinite;
}

@keyframes ringPulse {
  0% {
    transform: translate(-50%, -50%) scale(0.98);
    opacity: 0.45;
  }
  50% {
    transform: translate(-50%, -50%) scale(1.03);
    opacity: 0.72;
  }
  100% {
    transform: translate(-50%, -50%) scale(0.98);
    opacity: 0.45;
  }
}

.hero-center {
  position: relative;
  z-index: 3;
  display: grid;
  justify-items: center;
  text-align: center;
  gap: 18px;
  max-width: 760px;
  margin: 0 auto;
}

.hero-logo {
  width: 220px;
  height: 220px;
  object-fit: contain;
  filter:
    drop-shadow(0 0 18px rgba(110, 166, 255, 0.24))
    drop-shadow(0 0 30px rgba(143, 124, 255, 0.14));
  animation: logoFloat 5s ease-in-out infinite;
}

@keyframes logoFloat {
  0% {
    transform: translateY(0px);
  }
  50% {
    transform: translateY(-6px);
  }
  100% {
    transform: translateY(0px);
  }
}

.hero-title-wrap h3 {
  margin: 0 0 12px;
  font-size: clamp(1.7rem, 3vw, 2.5rem);
  line-height: 1.1;
}

.hero-lead {
  max-width: 740px;
  margin: 0 auto 12px;
  color: var(--text);
  opacity: 0.94;
  line-height: 1.7;
}

.hero-quote {
  margin: 0 auto;
  max-width: 660px;
  color: var(--gold);
  line-height: 1.75;
  font-size: 0.98rem;
}

.composer {
  margin: 22px auto 0;
  width: min(var(--content-max), calc(100% - var(--content-gap)));
  padding: 20px;
  border-radius: var(--radius-xl);
  display: grid;
  gap: 16px;
}

.composer label {
  color: #f4f7ff;
  font-size: 1rem;
  font-weight: 700;
}

.composer textarea {
  width: 100%;
  min-height: 220px;
  max-height: 420px;
  resize: vertical;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  line-height: 1.72;
  font-size: 1.02rem;
  padding: 16px;
  outline: none;
}

.composer textarea::placeholder {
  color: #8f9bb0;
}

.composer textarea:focus {
  border-color: rgba(110, 166, 255, 0.30);
  box-shadow: 0 0 0 1px rgba(110, 166, 255, 0.18);
}

.composer-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: nowrap;
}

.mode-bar {
  display: flex;
  gap: 10px;
  flex-wrap: nowrap;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 2px 2px 6px;
  scrollbar-width: none;
}

.mode-bar::-webkit-scrollbar {
  display: none;
}

.mode-btn,
.primary-btn {
  padding: 12px 16px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
}

.mode-btn {
  flex: 0 0 auto;
  min-height: 46px;
  color: rgba(255, 255, 255, 0.78);
}

.mode-btn.active,
.primary-btn {
  border-color: rgba(215, 178, 122, 0.26);
  background: linear-gradient(
    180deg,
    rgba(215, 178, 122, 0.13),
    rgba(110, 166, 255, 0.08)
  );
}

.mode-btn.active {
  color: #ffffff;
  box-shadow: 0 0 16px rgba(110, 166, 255, 0.10);
}

.mode-btn-compass {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-color: rgba(105, 216, 255, 0.16);
  background:
    linear-gradient(180deg, rgba(105, 216, 255, 0.06), rgba(143, 124, 255, 0.05)),
    rgba(255, 255, 255, 0.03);
  color: #cfe9ff;
}

.mode-btn-icon {
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  font-size: 0.72rem;
  background: linear-gradient(
    180deg,
    rgba(105, 216, 255, 0.32),
    rgba(143, 124, 255, 0.26)
  );
}

#modeCompass.active {
  color: #f5fbff;
  border-color: rgba(105, 216, 255, 0.34);
  background:
    linear-gradient(180deg, rgba(105, 216, 255, 0.18), rgba(143, 124, 255, 0.14)),
    rgba(255, 255, 255, 0.05);
}

.response-layout {
  width: min(var(--content-max), calc(100% - var(--content-gap)));
  margin: 22px auto 34px;
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(280px, 0.85fr);
  gap: 18px;
  align-items: start;
}

.response-column {
  min-width: 0;
  display: grid;
  gap: 14px;
}

.side-panel {
  min-width: 0;
  display: grid;
  gap: 14px;
  align-self: start;
}

.response-card,
.empty-state-box,
.panel-card {
  border-radius: var(--radius-xl);
  padding: 18px;
}

.block-content,
.empty-state-box p,
.panel-card p,
.mini-item span,
.modal-subtitle,
.preferences-message {
  line-height: 1.7;
  color: var(--muted);
}

.empty-state-box h4,
.panel-card h4,
.modal-header h3 {
  margin: 0 0 10px;
}

.mini-list {
  display: grid;
  gap: 12px;
}

.mini-item {
  border-radius: var(--radius-md);
  padding: 14px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.mini-item strong {
  display: block;
  margin-bottom: 6px;
  font-size: 0.9rem;
  color: var(--text);
}

.mini-item-compass {
  position: relative;
  overflow: hidden;
  border-color: rgba(105, 216, 255, 0.14);
  background:
    linear-gradient(180deg, rgba(105, 216, 255, 0.06), rgba(143, 124, 255, 0.05)),
    rgba(255, 255, 255, 0.03);
}

.mini-item-compass::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 16% 22%, rgba(105, 216, 255, 0.12), transparent 28%),
    radial-gradient(circle at 85% 78%, rgba(143, 124, 255, 0.10), transparent 32%);
}

.mini-item-compass strong,
.mini-item-compass span {
  position: relative;
  z-index: 1;
}

/* Workspace mobile nav: hidden on desktop */
.workspace-mobile-menu-btn,
.workspace-mobile-drawer,
.workspace-mobile-overlay {
  display: none;
}

/* ============================================
   6. WORKSPACE MOBILE
============================================ */

@media (max-width: 980px) {
  html,
  body {
    overflow-x: hidden;
  }

  .hero,
  .composer,
  .response-layout,
  .base-topbar,
  .legal-shell,
  .site-footer {
    width: calc(100% - 20px);
    margin-left: auto;
    margin-right: auto;
  }

  /* ---------- BASE PAGES MOBILE ---------- */

  .base-topbar {
    padding: 14px 16px;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }

  .base-nav {
    display: none;
  }

  .base-mobile-menu-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.03);
    color: var(--text);
    font-size: 1.2rem;
    cursor: pointer;
  }

  .base-mobile-drawer {
    position: fixed;
    top: 0;
    left: -280px;
    width: 260px;
    height: 100dvh;
    padding: 18px;
    background: rgba(10, 14, 20, 0.98);
    backdrop-filter: blur(12px);
    border-right: 1px solid var(--line);
    display: flex;
    flex-direction: column;
    gap: 12px;
    z-index: 999;
    transition: left 0.28s ease;
  }

  .base-mobile-drawer.open {
    left: 0;
  }

  .base-mobile-drawer a,
  .base-mobile-drawer button {
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;
    min-height: 42px;
    padding: 12px 14px;
    border-radius: var(--radius-md);
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.03);
    color: var(--text);
  }

  .base-mobile-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.52);
    z-index: 998;
    display: none;
  }

  .base-mobile-overlay.show {
    display: block;
  }

  /* ---------- WORKSPACE MOBILE ---------- */

  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    display: none;
  }

  .main-content {
    width: 100%;
    min-width: 0;
  }

  .topbar {
    padding: 16px 18px;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
  }

  .topbar-actions {
    display: none;
  }

  .workspace-mobile-menu-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.03);
    color: var(--text);
    font-size: 1.2rem;
    cursor: pointer;
    flex: 0 0 auto;
  }

  .workspace-mobile-drawer {
    position: fixed;
    top: 0;
    left: -280px;
    width: 260px;
    height: 100dvh;
    padding: 18px;
    background: rgba(10, 14, 20, 0.98);
    backdrop-filter: blur(12px);
    border-right: 1px solid var(--line);
    display: flex;
    flex-direction: column;
    gap: 12px;
    z-index: 999;
    transition: left 0.28s ease;
  }

  .workspace-mobile-drawer.open {
    left: 0;
  }

  .workspace-mobile-drawer a,
  .workspace-mobile-drawer button {
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;
    min-height: 42px;
    padding: 12px 14px;
    border-radius: var(--radius-md);
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.03);
    color: var(--text);
  }

  .workspace-mobile-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.52);
    z-index: 998;
    display: none;
  }

  .workspace-mobile-overlay.show {
    display: block;
  }

  .hero {
    margin-top: 18px;
  }

  .thinking-aura {
    min-height: 280px;
    padding: 24px 18px;
  }

  .hero-logo {
    width: 150px;
    height: 150px;
  }

  .response-layout {
    display: flex;
    flex-direction: column;
    gap: 14px;
  }

  .response-column,
  .side-panel {
    width: 100%;
    min-width: 0;
  }

  .composer {
    padding: 18px 16px;
  }

  .composer textarea {
    width: 100%;
    min-height: 220px;
  }

  .composer-footer {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .mode-bar {
    width: 100%;
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    gap: 10px;
    scrollbar-width: none;
  }

  .mode-bar::-webkit-scrollbar {
    display: none;
  }

  .mode-btn {
    white-space: nowrap;
    flex: 0 0 auto;
  }

  .primary-btn {
    width: 100%;
    min-width: 0;
    text-align: center;
  }
}

/* ============================================
   7. MODAL / SHARE / HELPERS
============================================ */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(5, 8, 12, 0.82);
  backdrop-filter: blur(6px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 999;
  padding: 24px;
}

.modal-shell {
  width: min(980px, 100%);
  max-height: 90vh;
  overflow-y: auto;
  border-radius: var(--radius-xl);
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

.modal-subtitle {
  margin: 0;
}

.preferences-message {
  min-height: 18px;
  color: var(--gold);
  font-size: 0.85rem;
  opacity: 0;
  transition: opacity 0.25s ease;
}

.preferences-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.preferences-section {
  display: grid;
  gap: 10px;
}

.preferences-section-wide {
  grid-column: span 2;
}

.preferences-section label {
  font-size: 0.82rem;
  color: var(--muted);
}

.preferences-section input,
.preferences-section select,
.preferences-section textarea {
  width: 100%;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: var(--radius-md);
  background: rgba(255,255,255,0.03);
  color: var(--text);
  padding: 10px 12px;
  outline: none;
  resize: vertical;
}

.preferences-section input::placeholder,
.preferences-section textarea::placeholder {
  color: #8f9bb0;
}

.preferences-section input:focus,
.preferences-section select:focus,
.preferences-section textarea:focus {
  border-color: rgba(110, 166, 255, 0.30);
  box-shadow: 0 0 0 1px rgba(110, 166, 255, 0.18);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}

.share-menu {
  position: absolute;
  z-index: 9999;
  min-width: 260px;
  max-width: min(280px, calc(100vw - 32px));
  max-height: min(320px, calc(100vh - 32px));
  overflow-y: auto;
  display: grid;
  gap: 6px;
  padding: 10px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(16, 22, 32, 0.96);
  box-shadow: 0 0 30px rgba(110,166,255,0.12);
  backdrop-filter: blur(10px);
}

.share-menu button {
  border: 1px solid rgba(255,255,255,0.06);
  background: rgba(255,255,255,0.03);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  text-align: left;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
}

.share-menu button:hover {
  transform: translateY(-1px);
  border-color: rgba(215,178,122,0.24);
  background: rgba(255,255,255,0.05);
}

.share-menu-icon {
  width: 40px;
  min-width: 40px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: rgba(255,255,255,0.04);
  color: var(--gold);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.share-menu-label {
  display: inline-flex;
  align-items: center;
  line-height: 1.2;
}

.first-time-state {
  padding: 24px;
  border-radius: var(--radius-xl);
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.first-time-state h4 {
  margin: 0 0 10px;
  font-size: 1.2rem;
}

.first-time-state p {
  margin: 0 0 18px;
  color: var(--muted);
  line-height: 1.7;
}

.starter-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.starter-card {
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.03);
  border-radius: var(--radius-lg);
  padding: 16px;
  cursor: pointer;
  transition: 0.2s ease;
}

.starter-card:hover {
  transform: translateY(-2px);
  border-color: rgba(215,178,122,0.24);
  background: rgba(255,255,255,0.05);
}

.starter-card strong {
  display: block;
  margin-bottom: 8px;
  color: var(--text);
}

.starter-card span {
  display: block;
  color: var(--muted);
  line-height: 1.55;
  font-size: 0.88rem;
}

.first-time-note {
  margin-top: 16px;
  color: rgba(215,178,122,0.92);
  font-size: 0.9rem;
}

.debug-badge {
  display: inline-block;
  margin: 0 0 12px;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.conversation-item {
  cursor: pointer;
  transition: 0.18s ease;
}

.conversation-item:hover {
  transform: translateY(-1px);
  border-color: rgba(215, 178, 122, 0.22);
  background: rgba(255, 255, 255, 0.05);
}

.graph-node {
  position: absolute;
  min-width: 130px;
  max-width: 180px;
  transform: translate(-50%, -50%);
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,0.08);
  box-shadow: var(--shadow);
  z-index: 2;
}

.graph-node strong {
  display: block;
  font-size: 0.88rem;
  margin-bottom: 4px;
}

.graph-node span {
  display: block;
  font-size: 0.76rem;
  color: var(--muted);
  line-height: 1.4;
}

.graph-theme-node {
  background: linear-gradient(180deg, rgba(215,178,122,0.16), rgba(110,166,255,0.10));
}

.graph-conversation-node {
  background: rgba(255,255,255,0.04);
}

.graph-conversation-node:hover {
  border-color: rgba(215,178,122,0.24);
  background: rgba(255,255,255,0.06);
}

.graph-edge {
  position: absolute;
  height: 2px;
  background: rgba(255,255,255,0.12);
  transform-origin: 0 0;
  z-index: 1;
}

@media (max-width: 900px) {
  .preferences-grid {
    grid-template-columns: 1fr;
  }

  .preferences-section-wide {
    grid-column: span 1;
  }

  .modal-shell {
    padding: 18px;
  }

  .starter-grid {
    grid-template-columns: 1fr;
  }

 /* ============================================
   WORKSPACE MOBILE - FINAL SAFE POLISH
   só mobile, sem tocar no desktop
============================================ */

@media (max-width: 980px) {
  .composer {
    overflow: hidden;
    padding: 18px 14px;
  }

  .composer textarea {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    min-height: 210px;
  }

  .composer-footer {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    align-items: stretch;
  }

  .composer-footer > * {
    min-width: 0;
  }

  .mode-bar {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    gap: 10px;
    padding: 2px 0 6px;
    justify-content: flex-start;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .mode-bar::-webkit-scrollbar {
    display: none;
  }

  .mode-btn {
    flex: 0 0 auto;
    white-space: nowrap;
    max-width: max-content;
  }

  .primary-btn {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    min-height: 46px;
    padding: 12px 14px;
    text-align: center;
  }

  .workspace-mobile-menu-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 46px;
    height: 46px;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.03);
  }

  .workspace-mobile-menu-logo {
    width: 24px;
    height: 24px;
    object-fit: contain;
    display: block;
    filter: drop-shadow(0 0 8px rgba(110, 166, 255, 0.18));
  }

 @media (max-width: 980px) {

  .workspace-mobile-menu-btn {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    gap: 2px;

    border: 1px solid var(--line);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.03);
  }

  .workspace-mobile-menu-logo {
    width: 22px;
    height: 22px;
  }

  .workspace-mobile-menu-text {
    font-size: 0.58rem;
    letter-spacing: 0.08em;
    color: var(--muted);
    line-height: 1;
  }

 /* ============================================
   WORKSPACE MOBILE - MENU LABEL FINAL TOUCH
   só mobile, sem tocar no desktop
============================================ */

@media (max-width: 980px) {
  .workspace-mobile-menu-btn {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    gap: 3px;
    padding: 0;

    border: 1px solid var(--line);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.03);
  }

  .workspace-mobile-menu-logo {
    width: 22px;
    height: 22px;
    object-fit: contain;
    display: block;
    filter: drop-shadow(0 0 8px rgba(110, 166, 255, 0.18));
  }

  .workspace-mobile-menu-text {
    font-size: 0.58rem;
    letter-spacing: 0.08em;
    line-height: 1;
    color: var(--muted);
  }
}