:root {
  color-scheme: light;
  --bg-0: #d9dbe2;
  --bg-1: #cfd2da;
  --bg-2: #c7cad3;
  --line: rgba(255, 255, 255, 0.28);
  --text: #151821;
  --muted: #5f6573;
  --surface: rgba(255, 255, 255, 0.18);
  --surface-soft: rgba(255, 255, 255, 0.12);
  --glass-fill: rgba(255, 255, 255, 0.32);
  --glass-edge: rgba(255, 255, 255, 0.74);
  --glass-edge-soft: rgba(255, 255, 255, 0.45);
  --glass-highlight: rgba(255, 255, 255, 0.56);
  --shadow: 0 20px 48px rgba(96, 103, 120, 0.14);
  --shadow-strong: 0 34px 80px rgba(80, 88, 108, 0.18);
  --message-ai: rgba(255, 255, 255, 0.28);
  --message-user: rgba(255, 255, 255, 0.46);
  --button-text: #ffffff;
  --button-bg: rgba(24, 28, 35, 0.88);
  --link-color: #2f73fc;
  --link-hover-color: #1a5ac7;
}

body.dark {
  color-scheme: dark;
  --bg-0: #2d3138;
  --bg-1: #252930;
  --bg-2: #20242a;
  --line: rgba(255, 255, 255, 0.08);
  --text: #eef2fb;
  --muted: #a3abbb;
  --surface: rgba(255, 255, 255, 0.06);
  --surface-soft: rgba(255, 255, 255, 0.04);
  --glass-fill: rgba(255, 255, 255, 0.09);
  --glass-edge: rgba(255, 255, 255, 0.28);
  --glass-edge-soft: rgba(255, 255, 255, 0.14);
  --glass-highlight: rgba(255, 255, 255, 0.16);
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.28);
  --shadow-strong: 0 36px 86px rgba(0, 0, 0, 0.34);
  --message-ai: rgba(255, 255, 255, 0.08);
  --message-user: rgba(255, 255, 255, 0.16);
  --button-text: #1a1f29;
  --button-bg: rgba(244, 247, 255, 0.92);
  --link-color: #5ea2ff;
  --link-hover-color: #8ab4f8;
}

* {
  box-sizing: border-box;
}

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

body {
  font-family: "Manrope", sans-serif;
  color: var(--text);
  background:
    radial-gradient(1200px 560px at 10% 0%, rgba(255, 255, 255, 0.22), transparent 64%),
    linear-gradient(180deg, var(--bg-0), var(--bg-1) 55%, var(--bg-2));
  overflow-x: hidden;
}

body.auth-locked {
  overflow-y: auto;
  height: auto;
  min-height: 100vh;
}

body.auth-locked .app-shell {
  display: none !important;
}

.grid {
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 78px 78px;
  pointer-events: none;
}

.backdrop-glow {
  position: fixed;
  width: 420px;
  height: 420px;
  border-radius: 50%;
  filter: blur(70px);
  pointer-events: none;
  opacity: 0.34;
}

.glow-a {
  top: -120px;
  left: -120px;
  background: rgba(255, 255, 255, 0.8);
}

.glow-b {
  right: -100px;
  bottom: -160px;
  background: rgba(146, 154, 172, 0.6);
}

.auth-logo {
  display: none;
  position: fixed;
  top: 24px;
  left: 24px;
  z-index: 30;
}

.auth-logo img {
  width: 38px;
  height: 38px;
  display: block;
  object-fit: contain;
  border-radius: 10px;
  filter: invert(1);
}

body:not(.dark) .auth-logo img {
  filter: none;
}

body.auth-locked .auth-logo {
  display: block;
}

.auth-gate {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 1.5rem;
}

.auth-gate.hidden-auth-gate {
  display: none;
}

.auth-card {
  width: min(480px, calc(100vw - 3rem));
  padding: 2.8rem 2.4rem;
  border-radius: 38px !important;
  background: var(--glass-fill);
  border: 1px solid var(--glass-edge-soft);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.42), 
              0 0 0 1px rgba(255, 255, 255, 0.06) !important;
  display: flex;
  flex-direction: column;
}

.auth-card-icon {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: var(--surface-soft);
  border: 1px solid var(--glass-edge-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1.2rem;
  box-shadow: inset 0 1px 2px rgba(255, 255, 255, 0.05);
}

.auth-card-icon img {
  width: 30px;
  height: 30px;
  object-fit: contain;
  filter: invert(1);
}

body:not(.dark) .auth-card-icon img {
  filter: none;
}

.auth-card .eyebrow {
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--link-color);
  margin: 0 0 0.4rem;
  text-align: center;
}

.auth-card h2 {
  margin: 0;
  font-size: 1.85rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text);
  line-height: 1.25;
  text-align: center;
}

.auth-sub {
  margin: 0.5rem 0 1.6rem;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.5;
  text-align: center;
}

.google-auth-btn {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--glass-edge);
  border-radius: 9999px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 0.75rem 1.4rem;
  color: var(--text);
  background: var(--surface-soft);
  font: inherit;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 200ms cubic-bezier(0.4, 0, 0.2, 1);
}

.google-auth-btn:hover {
  border-color: var(--text);
  background: var(--surface);
  transform: translateY(-1px);
}

.google-auth-btn:active {
  transform: scale(0.98);
}

.google-auth-btn:disabled {
  cursor: wait;
  opacity: 0.6;
  transform: none;
}

.google-auth-btn svg {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
}

.auth-divider {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.8rem;
  margin: 1.35rem 0;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 500;
}

.auth-divider::before,
.auth-divider::after {
  content: "";
  height: 1px;
  flex: 1;
  background: var(--glass-edge-soft);
}

.auth-switch {
  display: inline-flex;
  padding: 0.25rem;
  border-radius: 9999px;
  background: var(--surface-soft);
  border: 1px solid var(--glass-edge-soft);
  margin: 0 auto 1.25rem;
  gap: 4px;
}

.auth-tab {
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-weight: 600;
  font-size: 0.9rem;
  border-radius: 9999px;
  padding: 0.5rem 1.2rem;
  cursor: pointer;
  flex: 1;
  transition: all 180ms ease;
}

.auth-tab:hover {
  color: var(--text);
}

.auth-tab.active {
  background: var(--button-bg);
  color: var(--button-text);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.auth-form {
  display: grid;
  gap: 0.75rem;
}

.auth-form input {
  border: 2px solid transparent;
  border-radius: 9999px;
  padding: 0.85rem 1.4rem;
  font: inherit;
  font-size: 0.95rem;
  color: var(--text);
  background: var(--surface-soft);
  outline: none;
  transition: all 200ms cubic-bezier(0.4, 0, 0.2, 1);
}

.auth-form input::placeholder {
  color: var(--muted);
  opacity: 0.8;
}

.auth-form input:hover {
  background: var(--surface);
}

.auth-form input:focus {
  background: transparent;
  border-color: var(--link-color);
  box-shadow: 0 0 0 4px rgba(47, 115, 252, 0.15);
}

.auth-submit {
  width: 100%;
  margin-top: 0.5rem;
  min-height: 48px;
  border: none;
  border-radius: 9999px;
  font: inherit;
  font-weight: 600;
  font-size: 0.95rem;
  color: #ffffff;
  background: var(--link-color);
  box-shadow: 0 4px 14px rgba(47, 115, 252, 0.3);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 200ms cubic-bezier(0.4, 0, 0.2, 1);
}

.auth-submit:hover {
  background: var(--link-hover-color);
  box-shadow: 0 6px 20px rgba(47, 115, 252, 0.45);
  transform: translateY(-1px);
}

.auth-submit:active {
  transform: scale(0.98);
}

.auth-error {
  min-height: 1.25rem;
  margin: 0.75rem 0 0;
  color: #ff4a6b;
  font-size: 0.85rem;
  font-weight: 500;
  line-height: 1.4;
}

.auth-info {
  margin: 0.6rem 0 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.45;
}

.password-meter {
  display: grid;
  gap: 0.35rem;
  margin-top: 0.1rem;
}

.password-meter-bar {
  height: 6px;
  border-radius: 999px;
  background: var(--surface-soft);
  overflow: hidden;
}

#passwordMeterFill {
  display: block;
  height: 100%;
  width: 0%;
  background: #ff4a6b;
  transition: width 220ms cubic-bezier(0.4, 0, 0.2, 1), background 220ms ease;
}

#passwordMeterText {
  margin: 0;
  font-size: 0.78rem;
  color: var(--muted);
  font-weight: 500;
}

/* Collapsible Email Container */
.auth-email-container {
  max-height: 0;
  opacity: 0;
  transform: translateY(15px);
  overflow: hidden;
  transition: max-height 400ms cubic-bezier(0.16, 1, 0.3, 1),
              opacity 300ms cubic-bezier(0.16, 1, 0.3, 1),
              transform 400ms cubic-bezier(0.16, 1, 0.3, 1),
              margin 400ms cubic-bezier(0.16, 1, 0.3, 1);
  margin-top: 0;
  display: flex;
  flex-direction: column;
}

.auth-email-container.expanded {
  max-height: 600px;
  opacity: 1;
  transform: translateY(0);
  margin-top: 1.5rem;
  overflow: visible; /* Prevent focus outline clipping */
}

/* Back button in email form */
.auth-back-btn {
  background: transparent;
  border: none;
  color: var(--muted);
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  margin: 1rem auto 0;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  transition: all 200ms ease;
  padding: 0.3rem 0.8rem;
  border-radius: 9999px;
}

.auth-back-btn:hover {
  color: var(--text);
  background: var(--surface-soft);
}

.auth-back-btn:active {
  transform: scale(0.98);
}

/* OTP Inputs Styles */
.otp-inputs-wrapper {
  display: flex;
  gap: 8px;
  justify-content: center;
  align-items: center;
  margin: 1.2rem 0 1.6rem;
}

.otp-inputs-wrapper input {
  width: 50px;
  height: 52px;
  border-radius: 14px !important;
  padding: 0 !important;
  border: 2px solid transparent;
  background: var(--surface-soft);
  color: var(--text);
  font-size: 1.5rem;
  font-weight: 700;
  text-align: center;
  outline: none;
  transition: all 200ms cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: inset 0 1px 2px rgba(255, 255, 255, 0.02);
}

.otp-inputs-wrapper input:hover {
  background: var(--surface);
}

.otp-inputs-wrapper input:focus {
  background: transparent;
  border-color: var(--link-color);
  box-shadow: 0 0 0 4px rgba(47, 115, 252, 0.18);
}

.otp-separator {
  color: var(--muted);
  font-size: 1.5rem;
  font-weight: 700;
  opacity: 0.5;
  margin: 0 2px;
}

.otp-resend-text {
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: 1rem;
  text-align: center;
}

.otp-resend-link {
  background: transparent;
  border: none;
  color: var(--link-color);
  font-weight: 700;
  cursor: pointer;
  padding: 0;
  font-family: inherit;
  font-size: inherit;
  transition: color 150ms ease;
  margin-left: 2px;
}

.otp-resend-link:hover {
  color: var(--link-hover-color);
  text-decoration: underline;
}

.otp-resend-link:disabled {
  opacity: 0.5;
  cursor: wait;
}

/* Shake Animation for incorrect inputs */
.shake-animation {
  animation: shake 300ms ease-in-out;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-8px); }
  40%, 80% { transform: translateX(8px); }
}

/* Collapsible Email Toggle Button Wrapper */
.auth-toggle-btn-wrapper {
  display: flex;
  flex-direction: column;
  transition: max-height 400ms cubic-bezier(0.16, 1, 0.3, 1),
              opacity 300ms cubic-bezier(0.16, 1, 0.3, 1),
              transform 400ms cubic-bezier(0.16, 1, 0.3, 1),
              margin 400ms cubic-bezier(0.16, 1, 0.3, 1);
  max-height: 100px;
  opacity: 1;
  transform: translateY(0);
}

.auth-toggle-btn-wrapper.hidden-toggle {
  max-height: 0;
  opacity: 0;
  transform: translateY(-15px);
  margin: 0;
  overflow: hidden;
  pointer-events: none;
}

/* Beta Warning Modal */
.beta-warning-overlay {
  position: fixed !important;
  inset: 0 !important;
  z-index: 100010 !important;
  background: rgba(5, 5, 15, 0.72);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeInBeta 250ms ease forwards;
}

@keyframes fadeInBeta {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.beta-warning-card {
  width: min(520px, calc(100vw - 2.5rem));
  background: var(--glass-fill, rgba(255,255,255,0.06));
  border: 1px solid var(--glass-edge, rgba(255,255,255,0.12));
  border-radius: 28px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(255,255,255,0.04);
  padding: 2.8rem 2.8rem 2.4rem;
  text-align: center;
  animation: slideUpBeta 320ms cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes slideUpBeta {
  from { opacity: 0; transform: translateY(24px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.beta-warning-icon {
  font-size: 3.2rem;
  line-height: 1;
  margin-bottom: 1.2rem;
  display: block;
  filter: drop-shadow(0 4px 12px rgba(255, 200, 50, 0.35));
}

.beta-warning-title {
  font-size: 1.8rem;
  font-weight: 800;
  letter-spacing: -0.035em;
  margin: 0 0 1rem 0;
  background: linear-gradient(135deg, #f5c842 0%, #f79a28 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.beta-warning-body {
  font-size: 1rem;
  line-height: 1.65;
  color: var(--muted, rgba(255,255,255,0.65));
  margin: 0 0 0.6rem 0;
}

.beta-warning-body strong {
  color: var(--text, #fff);
}

.beta-warning-sub {
  font-size: 0.88rem;
  color: var(--muted, rgba(255,255,255,0.4));
  margin: 0 0 2rem 0;
}

.beta-warning-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: linear-gradient(135deg, #f5c842 0%, #e8861e 100%);
  color: #1a1000;
  font-weight: 700;
  font-size: 0.95rem;
  padding: 0.85rem 2.2rem;
  border: none;
  border-radius: 100px;
  cursor: pointer;
  transition: transform 150ms ease, box-shadow 150ms ease, filter 150ms ease;
  box-shadow: 0 4px 20px rgba(245, 180, 30, 0.35);
  letter-spacing: -0.01em;
}

.beta-warning-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(245, 180, 30, 0.5);
  filter: brightness(1.05);
}

.beta-warning-btn:active {
  transform: translateY(0);
  filter: brightness(0.95);
}

/* AGB Consent Banner & Overlay */
.agb-consent-overlay {
  position: fixed !important;
  inset: 0 !important;
  z-index: 99990 !important;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 300ms ease;
}

.agb-consent-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.agb-consent-banner {
  position: fixed !important;
  left: 50% !important;
  bottom: 8% !important;
  transform: translate(-50%, 150%) scale(0.95) !important;
  width: min(800px, calc(100vw - 2rem)) !important;
  background: var(--glass-fill);
  border: 1px solid var(--glass-edge);
  border-radius: 24px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.35);
  z-index: 99999 !important;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  padding: 2.2rem;
  transition: transform 450ms cubic-bezier(0.16, 1, 0.3, 1), opacity 450ms ease;
  opacity: 0;
  pointer-events: none;
}

.agb-consent-banner.active {
  transform: translate(-50%, 0) scale(1) !important;
  opacity: 1;
  pointer-events: auto;
}

.agb-consent-banner .consent-content {
  flex: 1;
}

.agb-consent-banner .consent-content h3 {
  margin: 0 0 0.5rem 0;
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.agb-consent-banner .consent-content p {
  margin: 0;
  font-size: 0.92rem;
  line-height: 1.5;
  color: var(--muted);
}

.agb-consent-banner .consent-content a {
  color: var(--link-color);
  text-decoration: underline;
  font-weight: 600;
  transition: color 150ms ease;
}

.agb-consent-banner .consent-content a:hover {
  color: var(--link-hover-color);
}

.agb-consent-banner .consent-actions {
  flex-shrink: 0;
}

.agb-consent-banner .consent-actions button {
  padding: 0.8rem 1.6rem;
  font-size: 0.95rem;
  font-weight: 700;
}

@media (max-width: 768px) {
  .agb-consent-banner {
    flex-direction: column;
    align-items: stretch;
    gap: 1.2rem;
    padding: 1.5rem;
    max-height: 50vh;
    bottom: 2% !important;
  }
  
  .agb-consent-banner .consent-actions button {
    width: 100%;
  }
}

.app-shell {
  width: min(1320px, calc(100vw - 1rem));
  height: calc(100vh - 2rem);
  margin: 1rem auto;
  display: grid;
  grid-template-columns: 290px minmax(0, 1fr);
  gap: 1rem;
  position: relative;
}

.glass {
  position: relative;
  background: linear-gradient(180deg, var(--glass-fill), rgba(255, 255, 255, 0.04));
  border: 1px solid var(--glass-edge);
  backdrop-filter: blur(18px) saturate(138%);
  -webkit-backdrop-filter: blur(18px) saturate(138%);
  box-shadow: var(--shadow);
}

.glass::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(140deg, var(--glass-highlight), transparent 40%);
  opacity: 0.42;
  pointer-events: none;
}

.chrome {
  border-radius: 24px;
}

.glass-inline {
  position: relative;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.24), rgba(255, 255, 255, 0.08));
  border: 1px solid var(--glass-edge-soft);
  backdrop-filter: blur(14px) saturate(130%);
  -webkit-backdrop-filter: blur(14px) saturate(130%);
}

.eyebrow {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.sidebar {
  padding: 1rem;
  display: grid;
  grid-template-rows: auto auto auto minmax(0, 1fr) auto;
  gap: 0.95rem;
  overflow: hidden;
  min-height: 0;
  position: relative;
  z-index: 3;
  transition:
    padding 300ms ease,
    gap 300ms ease,
    transform 300ms ease,
    opacity 300ms ease;
}

.sidebar-top {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.sidebar-toggle {
  width: 46px;
  height: 46px;
  border: 0;
  border-radius: 14px;
  display: grid;
  place-items: center;
  cursor: pointer;
  outline: none;
  position: relative;
  z-index: 5;
  color: #1f2531;
}

.sidebar-toggle:focus-visible {
  outline: 2px solid rgba(76, 98, 139, 0.5);
  outline-offset: 2px;
}

.sidebar-toggle span {
  display: block;
  width: 14px;
  height: 1.6px;
  background: currentColor;
  border-radius: 999px;
  transition: transform 220ms ease, opacity 220ms ease;
}

.toggle-line + .toggle-line {
  margin-top: 4px;
}

.brand-block h1 {
  margin: 0.18rem 0 0;
  font-size: 1.28rem;
  letter-spacing: -0.03em;
}

.new-chat {
  border: 0;
  border-radius: 18px;
  padding: 0.9rem 1rem;
  text-align: left;
  font: inherit;
  color: inherit;
  cursor: pointer;
}

.sidebar-section {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  min-height: 0;
  overflow: hidden;
}

#chatList {
  display: grid;
  gap: 0.45rem;
  overflow: auto;
  min-height: 0;
  max-height: 100%;
  padding-right: 0.2rem;
}

.chat-search {
  border: 0;
  border-radius: 14px;
  padding: 0.7rem 0.85rem;
  font: inherit;
  color: var(--text);
  outline: none;
}

.chat-search::placeholder {
  color: var(--muted);
}

.auth-box {
  border-radius: 14px;
  padding: 0.62rem 0.72rem;
}

.auth-state {
  margin: 0;
  font-size: 0.78rem;
  color: var(--muted);
}

.auth-actions {
  margin-top: 0.45rem;
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.auth-btn {
  border: 1px solid var(--glass-edge-soft);
  background: rgba(255, 255, 255, 0.12);
  color: var(--text);
  font: inherit;
  font-size: 0.76rem;
  border-radius: 999px;
  padding: 0.3rem 0.6rem;
  cursor: pointer;
}

.hidden-auth {
  display: none;
}

.section-label {
  margin: 0;
  padding: 0 0.2rem;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.chat-link {
  border: 0;
  border-radius: 16px;
  padding: 0.82rem 0.9rem;
  text-align: left;
  font: inherit;
  color: inherit;
  background: transparent;
  cursor: pointer;
  display: grid;
  gap: 0.22rem;
  min-height: 64px;
  position: relative;
  overflow: hidden;
  transition:
    background 180ms ease,
    transform 180ms ease,
    border-color 180ms ease,
    box-shadow 180ms ease;
}

.chat-link::after {
  content: "";
  position: absolute;
  left: 0.9rem;
  right: 0.9rem;
  bottom: 0.5rem;
  height: 1px;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.52), transparent 78%);
  opacity: 0;
  transform: scaleX(0.7);
  transform-origin: left center;
  transition: opacity 220ms ease, transform 220ms ease;
}

.chat-link:hover,
.chat-link.active {
  background: var(--surface-soft);
  transform: translateX(2px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14);
}

.chat-link:hover::after,
.chat-link.active::after {
  opacity: 1;
  transform: scaleX(1);
}

.chat-link-title {
  display: block;
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-link-preview {
  display: block;
  font-size: 0.78rem;
  line-height: 1.35;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.system-note {
  opacity: 0.8;
}

.sidebar-foot {
  padding: 0.9rem 1rem;
  border-radius: 18px;
}

.sidebar-foot p {
  margin: 0.2rem 0 0;
  font-size: 0.82rem;
  color: var(--muted);
}

.main-panel {
  min-width: 0;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 0.8rem;
  min-height: 0;
  overflow: hidden;
  position: relative;
}

.main-panel.pristine-chat {
  grid-template-rows: auto 1fr;
}

.main-panel.pristine-chat .content-stage {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  height: auto;
  min-height: 210px;
  max-height: none;
}

.main-panel.pristine-chat .conversation {
  display: none;
}

.main-panel.pristine-chat .chat-view {
  align-content: start;
}

.main-panel.pristine-chat .composer {
  width: calc(100% - 2rem);
  max-width: 940px;
  margin: 0 auto;
  transform: translateY(0);
  transition: transform 240ms ease;
  justify-self: center;
}

.pristine-intro,
.starter-actions {
  display: none;
}

.main-panel.pristine-chat .pristine-intro {
  display: block;
  margin: 0 0 1.15rem;
  text-align: center;
  z-index: 1;
}

.main-panel.pristine-chat .pristine-intro h2 {
  margin: 0;
  font-size: clamp(1.8rem, 4.2vw, 3rem);
  letter-spacing: -0.03em;
  font-weight: 600;
}

.main-panel.pristine-chat .starter-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.7rem;
  margin: 1.05rem auto 0;
  z-index: 1;
}

.starter-chip {
  border: 1px solid rgba(255, 255, 255, 0.26);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  border-radius: 999px;
  padding: 0.62rem 1rem;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.toolbar {
  padding: 0.78rem 0.92rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.toolbar-menu-btn {
  display: none;
  background: transparent;
  border: none;
  color: var(--text);
  cursor: pointer;
  padding: 0.5rem;
  margin-right: 0.25rem;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  transition: background 0.2s, transform 0.2s;
}
.toolbar-menu-btn:hover {
  background: var(--surface-soft);
}
.toolbar-menu-btn:active {
  transform: scale(0.95);
}

.toolbar-group,
.toolbar-actions {
  display: flex;
  align-items: center;
  gap: 0.7rem;
}

.mode-switch {
  display: flex;
  align-items: center;
  gap: 0.2rem;
  padding: 0.22rem;
  border-radius: 999px;
}

.mode-chip {
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-weight: 600;
  padding: 0.42rem 0.86rem;
  cursor: pointer;
}

.mode-chip.active {
  background: rgba(255, 255, 255, 0.42);
  color: var(--text);
}

.toolbar-group p {
  margin: 0.14rem 0 0;
  font-size: 0.82rem;
  color: var(--muted);
}

.toolbar-badge {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.64;
}

.action-chip {
  border: 0;
  border-radius: 999px;
  padding: 0.56rem 0.82rem;
  font: inherit;
  color: inherit;
  background: transparent;
  cursor: pointer;
}

.theme-toggle {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.25rem 0.35rem;
  border-radius: 999px;
  color: var(--muted);
}

.theme-toggle input {
  display: none;
}

.toggle-label {
  font-size: 0.78rem;
}

.toggle-pill {
  width: 48px;
  height: 28px;
  display: block;
  padding: 2px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.42);
  border: 1px solid rgba(255, 255, 255, 0.46);
}

.toggle-knob {
  display: block;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: white;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.18);
  transition: transform 220ms ease;
}

.theme-toggle input:checked + .toggle-label + .toggle-pill .toggle-knob {
  transform: translateX(20px);
}

.hero-stage {
  min-height: 220px;
  position: relative;
  border-radius: 34px;
  border: 1px solid rgba(255, 255, 255, 0.34);
  background:
    radial-gradient(720px 240px at 10% 0%, rgba(255, 255, 255, 0.18), transparent 60%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.04)),
    linear-gradient(180deg, transparent, rgba(255, 255, 255, 0.04));
  overflow: hidden;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.28);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.hero-stage::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 58%, rgba(0, 0, 0, 0.08));
  pointer-events: none;
}

.hero-copy {
  position: relative;
  padding: 1.4rem 1.4rem 0;
  z-index: 1;
}

.hero-copy h2 {
  margin: 0.2rem 0 0;
  font-size: clamp(1.85rem, 4vw, 2.75rem);
  letter-spacing: -0.03em;
}

.hero-text {
  margin: 0.55rem 0 0;
  max-width: 52ch;
  color: var(--muted);
  line-height: 1.5;
}

.hero-meta {
  position: relative;
  z-index: 1;
  display: flex;
  gap: 0.65rem;
  flex-wrap: wrap;
  padding: 1rem 1.4rem 1.3rem;
}

.hero-meta-pill {
  padding: 0.58rem 0.82rem;
  border-radius: 999px;
  font-size: 0.82rem;
  color: var(--muted);
}

.hero-start-btn {
  border: 0;
  border-radius: 999px;
  padding: 0.58rem 0.95rem;
  font: inherit;
  font-weight: 700;
  color: var(--text);
  cursor: pointer;
}

.main-panel.in-chat .hero-stage {
  display: none;
}

.main-panel.image-mode .hero-stage {
  display: none;
}

.content-stage {
  position: relative;
  border-radius: 32px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  background:
    linear-gradient(180deg, var(--surface), rgba(255, 255, 255, 0.05)),
    radial-gradient(1000px 420px at 50% 0%, rgba(255, 255, 255, 0.1), transparent 60%);
  box-shadow: var(--shadow-strong);
  overflow: hidden;
  min-height: 0;
  height: 100%;
}

.chat-view,
.image-view,
.image-edit-view,
.notes-view,
.friends-view {
  min-height: 0;
  display: grid;
  gap: 0.8rem;
}

.code-output-panel {
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 16px;
  padding: 0.65rem;
  background: rgba(18, 22, 31, 0.92);
  color: #dfe7ff;
  min-height: 0;
  height: 100%;
}

.code-output-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.45rem;
  font-size: 0.85rem;
}

.code-output-title-wrap {
  display: flex;
  align-items: baseline;
  gap: 0.45rem;
}

#codeOutputLang {
  color: #8ea0bf;
  font-size: 0.82rem;
}

.code-output-actions {
  display: flex;
  align-items: center;
  gap: 0.42rem;
}

.code-output-actions button {
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: #dfe7ff;
  font: inherit;
  font-size: 0.78rem;
  padding: 0.26rem 0.62rem;
  cursor: pointer;
}

#modeStateBadge {
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 999px;
  padding: 0.2rem 0.5rem;
  font-size: 0.75rem;
  color: #c2d2ff;
}

#codeOutputPre {
  margin: 0;
  height: calc(100% - 2.2rem);
  min-height: 220px;
  overflow: auto;
  padding: 0.72rem;
  border-radius: 12px;
  background: rgba(9, 12, 18, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

#codeOutputCode {
  font-family: "Consolas", "Cascadia Code", "Courier New", monospace;
  font-size: 0.83rem;
  line-height: 1.45;
  white-space: pre;
}

.image-view,
.image-edit-view,
.notes-view,
.friends-view {
  grid-template-rows: minmax(0, 1fr) auto;
  overflow: hidden;
}

.image-scroll {
  min-height: 0;
  overflow: auto;
  padding-right: 0.25rem;
  padding-bottom: 0.45rem;
}

.hidden-view {
  display: none !important;
}

.main-panel.image-mode #composer {
  display: none !important;
}

.main-panel.notes-mode #composer {
  display: none !important;
}

.main-panel.friends-mode #composer {
  display: none !important;
}

.image-create {
  padding: 0.8rem;
  width: min(860px, calc(100% - 1rem));
  margin: 0 auto;
  position: sticky;
  bottom: 0;
  z-index: 8;
}

.age-gate {
  margin-top: 0.5rem;
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  font-size: 0.8rem;
  color: var(--muted);
}

.age-gate input {
  margin-top: 0.15rem;
}

.image-head h3 {
  margin: 0 0 0.7rem;
  font-size: 2rem;
  letter-spacing: -0.02em;
}

.image-form {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.5rem;
}

.image-form input,
.image-form select {
  border: 0;
  border-radius: 16px;
  padding: 0.82rem 0.95rem;
  font: inherit;
  color: var(--text);
  background: rgba(255, 255, 255, 0.08);
  outline: none;
}

.image-presets h4 {
  margin: 0 0 0.55rem;
  font-size: 1.05rem;
}

.image-presets {
  position: sticky;
  top: 0;
  z-index: 6;
  padding: 0.2rem 0 0.5rem;
  background: linear-gradient(
    180deg,
    rgba(211, 214, 223, 0.9) 0%,
    rgba(211, 214, 223, 0.7) 72%,
    rgba(211, 214, 223, 0) 100%
  );
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

body.dark .image-presets {
  background: linear-gradient(
    180deg,
    rgba(37, 42, 50, 0.92) 0%,
    rgba(37, 42, 50, 0.74) 72%,
    rgba(37, 42, 50, 0) 100%
  );
}

.preset-row {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(170px, 1fr);
  gap: 0.7rem;
  overflow: auto;
  padding-bottom: 0.2rem;
}

.preset-card {
  border: 1px solid rgba(255, 255, 255, 0.26);
  border-radius: 20px;
  min-height: 132px;
  text-align: left;
  padding: 0.9rem;
  font: inherit;
  font-weight: 600;
  color: #f2f5fb;
  background-color: rgba(255, 255, 255, 0.05);
  position: relative;
  cursor: pointer;
  overflow: hidden;
}

.preset-card span {
  position: absolute;
  left: 0.8rem;
  right: 0.8rem;
  bottom: 0.8rem;
  z-index: 1;
  font-size: 0.95rem;
  line-height: 1.2;
}

.preset-card img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.preset-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.02) 44%, rgba(0, 0, 0, 0.62) 100%);
}

.image-grid {
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 0.8rem;
  overflow: auto;
  padding-right: 0.2rem;
}

.image-card {
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.08);
  position: relative;
}

.image-card img {
  width: 100%;
  height: 170px;
  object-fit: cover;
  display: block;
}

.image-card p {
  margin: 0;
  padding: 0.65rem 0.7rem 0.8rem;
  font-size: 0.8rem;
  color: var(--muted);
}

.image-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  padding: 0.62rem 0.7rem 0.8rem;
}

.image-card-foot p {
  margin: 0;
  padding: 0;
  flex: 1 1 auto;
  min-width: 0;
}

.image-regenerate {
  border: 1px solid rgba(255, 255, 255, 0.32);
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
  border-radius: 999px;
  padding: 0.34rem 0.62rem;
  font: inherit;
  font-size: 0.72rem;
  cursor: pointer;
}

.image-scroll::-webkit-scrollbar,
.preset-row::-webkit-scrollbar,
.image-grid::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

.image-scroll::-webkit-scrollbar-track,
.preset-row::-webkit-scrollbar-track,
.image-grid::-webkit-scrollbar-track {
  background: transparent;
  border-radius: 999px;
}

.image-scroll::-webkit-scrollbar-thumb,
.preset-row::-webkit-scrollbar-thumb,
.image-grid::-webkit-scrollbar-thumb {
  background: linear-gradient(
    180deg,
    rgba(156, 162, 178, 0.8),
    rgba(118, 126, 146, 0.76)
  );
  border: 2px solid transparent;
  background-clip: padding-box;
  border-radius: 999px;
}

.image-scroll::-webkit-scrollbar-thumb:hover,
.preset-row::-webkit-scrollbar-thumb:hover,
.image-grid::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(
    180deg,
    rgba(168, 174, 192, 0.92),
    rgba(128, 136, 156, 0.88)
  );
  border: 2px solid transparent;
  background-clip: padding-box;
}

.image-card.loading {
  min-height: 220px;
  background:
    linear-gradient(
      110deg,
      rgba(255, 255, 255, 0.06) 8%,
      rgba(255, 255, 255, 0.16) 18%,
      rgba(255, 255, 255, 0.06) 33%
    );
  background-size: 200% 100%;
  animation: imageShimmer 1.2s linear infinite;
}

.image-loading {
  min-height: 170px;
  display: grid;
  place-items: center;
  gap: 0.55rem;
}

.image-spinner {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: rgba(255, 255, 255, 0.9);
  animation: spin 0.8s linear infinite;
}

.image-loading p {
  margin: 0;
  font-size: 0.82rem;
  color: var(--muted);
}

@keyframes imageShimmer {
  to {
    background-position-x: -200%;
  }
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.content-stage::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.08), transparent 28%);
  pointer-events: none;
}

.conversation {
  position: relative;
  z-index: 1;
  height: 100%;
  padding: 1.35rem 1.45rem 1.55rem;
  display: flex;
  flex-direction: column;
  gap: 0.95rem;
  overflow: auto;
  min-height: 0;
}

#chatList::-webkit-scrollbar,
.conversation::-webkit-scrollbar {
  width: 3px;
  height: 3px;
}

#chatList::-webkit-scrollbar-track,
.conversation::-webkit-scrollbar-track {
  background: transparent;
}

#chatList::-webkit-scrollbar-thumb,
.conversation::-webkit-scrollbar-thumb {
  background-color: transparent;
  border-radius: 99px;
  background-image: linear-gradient(rgba(0, 0, 0, 0.22), rgba(0, 0, 0, 0.22));
  background-size: 100% 40px;
  background-repeat: no-repeat;
  background-position: center;
  transition: background-image 0.15s ease;
}

#chatList::-webkit-scrollbar-thumb:hover,
.conversation::-webkit-scrollbar-thumb:hover {
  background-color: transparent;
  background-image: linear-gradient(rgba(0, 0, 0, 0.42), rgba(0, 0, 0, 0.42));
  background-size: 100% 40px;
  background-repeat: no-repeat;
  background-position: center;
}

body.dark #chatList::-webkit-scrollbar-thumb,
body.dark .conversation::-webkit-scrollbar-thumb {
  background-color: transparent;
  background-image: linear-gradient(rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0.18));
  background-size: 100% 40px;
  background-repeat: no-repeat;
  background-position: center;
}

body.dark #chatList::-webkit-scrollbar-thumb:hover,
body.dark .conversation::-webkit-scrollbar-thumb:hover {
  background-color: transparent;
  background-image: linear-gradient(rgba(255, 255, 255, 0.38), rgba(255, 255, 255, 0.38));
  background-size: 100% 40px;
  background-repeat: no-repeat;
  background-position: center;
}

/* Chat Scroll Gauge (Depth Progress Indicator) */
.chat-scroll-gauge {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 100;
  display: none;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  pointer-events: none;
}

.main-panel.in-chat .chat-scroll-gauge {
  display: flex;
}

.gauge-tick {
  height: 2px;
  background: var(--text);
  opacity: 0.15;
  border-radius: 1px;
  transition: opacity 0.25s cubic-bezier(0.16, 1, 0.3, 1), 
              width 0.25s cubic-bezier(0.16, 1, 0.3, 1),
              background-color 0.25s ease;
}

.gauge-tick.tick-0 {
  width: 8px;
}
.gauge-tick.tick-0.active {
  width: 12px;
}

.gauge-tick.tick-33 {
  width: 12px;
}
.gauge-tick.tick-33.active {
  width: 16px;
}

.gauge-tick.tick-66 {
  width: 8px;
}
.gauge-tick.tick-66.active {
  width: 12px;
}

.gauge-tick.tick-100 {
  width: 18px;
}
.gauge-tick.tick-100.active {
  width: 24px;
}

.msg {
  max-width: min(72%, 42rem);
  padding: 0.95rem 1.05rem;
  border-radius: 20px;
  border: 1px solid var(--glass-edge-soft);
  background: var(--message-ai);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12);
  position: relative;
  margin-bottom: 0.15rem;
}

.msg p {
  margin: 0;
  line-height: 1.62;
}

.msg-content {
  display: grid;
  gap: 0.55rem;
}

.msg-content p {
  margin: 0;
}

.msg-list {
  margin: 0;
  padding-left: 1.1rem;
  display: grid;
  gap: 0.2rem;
}

.msg-list li {
  line-height: 1.4;
}

.msg-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 0.6rem 0;
  font-size: 0.9rem;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--glass-edge-soft);
}

.msg-content th,
.msg-content td {
  padding: 0.65rem 0.85rem;
  text-align: left;
  border-bottom: 1px solid var(--glass-edge-soft);
}

.msg-content th {
  background: rgba(255, 255, 255, 0.08);
  font-weight: 700;
  color: var(--text);
}

.msg-content tr:last-child td {
  border-bottom: 0;
}

.msg-content tr:nth-child(even) {
  background: rgba(255, 255, 255, 0.02);
}

.msg-content h1,
.msg-content h2,
.msg-content h3,
.msg-content h4 {
  color: var(--text);
  font-weight: 700;
  margin-top: 1rem;
  margin-bottom: 0.4rem;
  letter-spacing: -0.02em;
  line-height: 1.3;
}

.msg-content h1 { font-size: 1.4rem; }
.msg-content h2 { font-size: 1.25rem; }
.msg-content h3 { font-size: 1.12rem; }
.msg-content h4 { font-size: 1rem; }

.msg-content h1:first-child,
.msg-content h2:first-child,
.msg-content h3:first-child,
.msg-content h4:first-child {
  margin-top: 0;
}

.msg-code {
  margin: 0.2rem 0 0.15rem;
  padding: 0.68rem 0.72rem;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(6, 10, 16, 0.92);
  color: #d9e3ff;
  overflow: auto;
  white-space: pre;
}

.msg-code code {
  font-family: "Consolas", "Cascadia Code", "Courier New", monospace;
  font-size: 0.84rem;
  line-height: 1.45;
}

.msg.user {
  margin-left: auto;
  background: var(--message-user);
}

.msg.ai {
  max-width: min(82%, 54rem);
  border-left: 2px solid rgba(255, 255, 255, 0.36);
}

.msg.user {
  border-right: 2px solid rgba(255, 255, 255, 0.3);
}

.msg-model {
  position: absolute;
  top: 0.34rem;
  right: 0.52rem;
  font-size: 0.66rem;
  line-height: 1;
  padding: 0.2rem 0.42rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.26);
  color: var(--muted);
  max-width: 68%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.version-badge {
  display: inline-flex;
  align-items: center;
  max-width: 18rem;
  padding: 0.36rem 0.58rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  background: rgba(255, 255, 255, 0.34);
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.msg + .msg {
  margin-top: 0.1rem;
}

.loading-msg {
  border-color: rgba(94, 112, 148, 0.38);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.14),
    0 0 0 1px rgba(94, 112, 148, 0.12);
}

.mini-fill-loader {
  display: inline-flex;
  align-items: center;
  gap: 0.56rem;
  min-height: 1.2rem;
  color: rgba(188, 197, 214, 0.78);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.mini-fill-loader__box {
  position: relative;
  width: 0.92rem;
  height: 0.92rem;
  overflow: hidden;
  border: 1.5px solid rgba(203, 211, 226, 0.78);
  border-radius: 0.24rem;
  background: rgba(255, 255, 255, 0.025);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.035);
}

.mini-fill-loader__fill {
  position: absolute;
  inset: auto 0 0;
  height: 100%;
  border-radius: 0.15rem;
  background: rgba(203, 211, 226, 0.74);
  transform: scaleY(0);
  transform-origin: bottom;
  animation: miniFillBox 1.35s cubic-bezier(0.55, 0, 0.25, 1) infinite;
}

.mini-fill-loader__text::after {
  content: "...";
  display: inline-block;
  width: 0;
  overflow: hidden;
  vertical-align: bottom;
  text-align: left;
  animation: thinkingDots 1.2s steps(4, end) infinite;
}

@media (prefers-reduced-motion: reduce) {
  .mini-fill-loader__fill,
  .mini-fill-loader__text::after {
    animation: none;
  }

  .mini-fill-loader__fill {
    transform: scaleY(0.7);
  }

  .mini-fill-loader__text::after {
    content: "...";
  }
}

@keyframes miniFillBox {
  0% {
    opacity: 0.55;
    transform: scaleY(0);
  }
  72% {
    opacity: 0.9;
    transform: scaleY(1);
  }
  73%,
  100% {
    opacity: 0.55;
    transform: scaleY(0);
  }
}

@keyframes thinkingDots {
  0% {
    width: 0;
  }
  100% {
    width: 1.2em;
  }
}

.composer {
  position: relative;
  padding: 0.4rem;
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  gap: 0.5rem;
  align-items: center;
}

.code-mode-banner {
  width: min(940px, calc(100% - 2rem));
  margin: 0 auto 0.2rem;
  border: 1px solid rgba(92, 132, 255, 0.35);
  border-radius: 12px;
  background: rgba(44, 73, 148, 0.18);
  padding: 0.52rem 0.7rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text);
  font-size: 0.82rem;
}

.code-mode-banner strong {
  font-size: 0.84rem;
}

.code-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #5e8dff;
  box-shadow: 0 0 0 4px rgba(94, 141, 255, 0.18);
}

.chat-view.coding-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  grid-template-areas:
    "chat code"
    "banner banner"
    "composer composer"
    "starter starter";
  align-content: start;
  gap: 0.75rem;
}

.chat-view.coding-layout #contentStage {
  grid-area: chat;
  min-height: 520px;
}

.chat-view.coding-layout #codeOutputPanel {
  grid-area: code;
  display: block;
  min-height: 520px;
}

.chat-view.coding-layout #codeModeBanner {
  grid-area: banner;
}

.chat-view.coding-layout #composer {
  grid-area: composer;
  width: 100%;
  margin: 0;
}

.chat-view.coding-layout #starterActions {
  grid-area: starter;
}

@media (max-width: 1180px) {
  .chat-view.coding-layout {
    grid-template-columns: 1fr;
    grid-template-areas:
      "code"
      "chat"
      "banner"
      "composer"
      "starter";
  }
}

.notes-panel {
  width: min(1120px, 100%);
  margin: 0 auto;
  padding: 0.9rem;
  display: grid;
  gap: 0.7rem;
  border-radius: 18px;
}

.notes-library {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.6rem;
  max-height: 220px;
  overflow: auto;
  min-height: 0;
  padding-right: 0.2rem;
}

.note-card {
  border: 1px solid rgba(255, 255, 255, 0.28);
  background:
    linear-gradient(180deg, rgba(255, 245, 186, 0.72), rgba(255, 238, 156, 0.82));
  color: #3f2f05;
  border-radius: 12px;
  min-height: 112px;
  padding: 0.65rem 0.62rem;
  text-align: left;
  font: inherit;
  cursor: pointer;
  display: grid;
  align-content: space-between;
  gap: 0.5rem;
  box-shadow: 0 10px 22px rgba(97, 82, 18, 0.14);
  transition: transform 150ms ease, box-shadow 150ms ease;
  pointer-events: auto;
}

.note-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 26px rgba(97, 82, 18, 0.18);
}

.note-card.expanded {
  transform: scale(1.03);
  box-shadow: 0 18px 30px rgba(97, 82, 18, 0.24);
}

.note-card-name {
  font-weight: 700;
  line-height: 1.2;
  display: block;
}

.note-card-mention {
  font-size: 0.78rem;
  opacity: 0.8;
}

body.dark .note-card {
  border-color: rgba(255, 255, 255, 0.16);
  background:
    linear-gradient(180deg, rgba(176, 142, 74, 0.82), rgba(146, 116, 54, 0.88));
  color: #fff6db;
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.26);
}

.notes-view {
  padding: 0.2rem 0.2rem 0.45rem;
}

.whiteboard-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  height: 100%;
  min-height: 0;
  border-radius: 16px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--glass-edge-soft);
}

/* Sidebar Styles */
.whiteboard-sidebar {
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--glass-edge-soft);
  background: rgba(255, 255, 255, 0.02);
  min-height: 0;
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem;
  border-bottom: 1px solid var(--glass-edge-soft);
}

.sidebar-header h3 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.sidebar-search {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--glass-edge-soft);
}

.sidebar-search input {
  width: 100%;
  box-sizing: border-box;
}

.notes-library {
  flex: 1;
  overflow-y: auto;
  padding: 0.5rem;
}

.whiteboard-page-item {
  display: flex;
  flex-direction: column;
  padding: 0.75rem 0.85rem;
  border-radius: 12px;
  cursor: pointer;
  margin-bottom: 0.35rem;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  border: 1px solid transparent;
}

.whiteboard-page-item:hover {
  background: rgba(255, 255, 255, 0.06);
}

.whiteboard-page-item.active {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--glass-edge-soft);
}

.page-item-title {
  font-weight: 500;
  font-size: 0.9rem;
  color: var(--text);
  margin-bottom: 0.2rem;
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
}

.page-item-meta {
  font-size: 0.75rem;
  color: var(--muted);
}

.page-item-shared {
  font-size: 0.75rem;
  color: #a78bfa;
  margin-top: 0.15rem;
}

/* Workspace Styles */
.whiteboard-workspace {
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100%;
  background: #12161f;
}

/* Minimal top bar — thin, understated */
.workspace-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.45rem 1rem;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  background: rgba(255,255,255,0.015);
  flex-shrink: 0;
  gap: 0.5rem;
}

.topbar-tools {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.topbar-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: transparent;
  border: 1px solid transparent;
  color: var(--muted);
  padding: 0.32rem 0.6rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 500;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.topbar-btn:hover {
  background: rgba(255,255,255,0.07);
  color: var(--text);
}

.topbar-btn.active {
  background: rgba(109, 40, 217, 0.2);
  border-color: rgba(167, 139, 250, 0.3);
  color: #c084fc;
}

.topbar-btn-danger:hover {
  background: rgba(239,68,68,0.12);
  color: #fca5a5;
}

.topbar-divider {
  width: 1px;
  height: 18px;
  background: rgba(255,255,255,0.1);
  margin: 0 0.3rem;
}

.topbar-draw-control {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  color: var(--muted);
}

.topbar-share {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--muted);
  font-size: 0.8rem;
}

.topbar-share-select {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 7px;
  color: var(--muted);
  padding: 0.28rem 0.45rem;
  font-size: 0.78rem;
  outline: none;
  cursor: pointer;
  max-width: 140px;
}

/* Canvas Styles */
.toolbar-color-picker {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  width: 28px;
  height: 28px;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0;
}

.toolbar-color-picker::-webkit-color-swatch {
  border-radius: 50%;
  border: 2px solid var(--glass-edge-soft);
}

.toolbar-color-picker::-moz-color-swatch {
  border-radius: 50%;
  border: 2px solid var(--glass-edge-soft);
}

.toolbar-thickness-slider {
  -webkit-appearance: none;
  width: 80px;
  height: 4px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.15);
  outline: none;
  cursor: pointer;
}

.toolbar-thickness-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
}

.toolbar-value {
  font-size: 0.8rem;
  color: var(--text);
  min-width: 32px;
}

/* Canvas Styles */
.whiteboard-canvas-wrapper {
  flex: 1;
  overflow: auto;
  position: relative;
  background: #12161f;
  cursor: text;
}

/* Document container — centered, document-like width */
.whiteboard-editor-container {
  position: relative;
  max-width: 860px;
  margin: 0 auto;
  min-height: 100%;
  padding: 60px 80px 120px;
  box-sizing: border-box;
}

/* Big Notion-style title */
.notion-title-input {
  display: block;
  width: 100%;
  background: transparent;
  border: none;
  outline: none;
  font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
  font-size: 2.6rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
  line-height: 1.2;
  margin-bottom: 1.5rem;
  padding: 0;
  caret-color: var(--accent);
}

.notion-title-input::placeholder {
  color: rgba(255,255,255,0.15);
}

/* Typing layer */
#whiteboardTextarea {
  position: relative;
  display: block;
  width: 100%;
  min-height: 600px;
  background: transparent;
  border: none;
  outline: none;
  resize: none;
  font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.75;
  color: rgba(255,255,255,0.87);
  padding: 0;
  box-sizing: border-box;
  white-space: pre-wrap;
  word-break: break-word;
  z-index: 1;
  caret-color: var(--accent);
  overflow: hidden;
}

#whiteboardTextarea::placeholder {
  color: rgba(255, 255, 255, 0.18);
}

/* Drawing canvas — absolutely positioned over the whole container */
#whiteboardCanvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: block;
  z-index: 2;
  pointer-events: none;
  cursor: crosshair;
}

/* When draw mode is active, the canvas captures all pointer events */
.whiteboard-canvas-wrapper.draw-mode #whiteboardCanvas {
  pointer-events: auto;
}

.whiteboard-canvas-wrapper.draw-mode {
  cursor: crosshair;
}

.whiteboard-canvas-wrapper::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

.whiteboard-canvas-wrapper::-webkit-scrollbar-track {
  background: transparent;
}

.whiteboard-canvas-wrapper::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 999px;
}

/* Notes workspace: integrated, Notion-like layout */
.notes-view {
  padding: 0;
  height: 100%;
  min-height: 0;
}

.notes-shell {
  grid-template-columns: 248px minmax(0, 1fr);
  min-height: clamp(620px, calc(100vh - 9rem), 920px);
  height: 100%;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.notes-shell .whiteboard-sidebar {
  background: rgba(255, 255, 255, 0.045);
  border-right: 1px solid rgba(255, 255, 255, 0.08);
}

.notes-shell .sidebar-header {
  align-items: flex-start;
  padding: 1.05rem 0.9rem 0.72rem;
  border-bottom: 0;
}

.notes-eyebrow {
  display: block;
  margin-bottom: 0.18rem;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.notes-shell .sidebar-header h3 {
  font-size: 1rem;
}

.notes-shell #newNoteBtn {
  min-height: 30px;
  padding: 0.32rem 0.58rem;
  border-radius: 8px;
  font-size: 0.78rem;
  background: rgba(255, 255, 255, 0.08);
  border-color: transparent;
  box-shadow: none;
}

.notes-shell .sidebar-search {
  padding: 0 0.75rem 0.7rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.055);
}

.notes-shell .sidebar-search input {
  min-height: 34px;
  border-radius: 8px;
  border: 0;
  background: rgba(255, 255, 255, 0.07);
  font-size: 0.84rem;
}

.notes-shell .notes-library {
  display: block;
  max-height: none;
  padding: 0.48rem;
}

.notes-shell .whiteboard-page-item {
  min-height: 44px;
  margin-bottom: 0.16rem;
  padding: 0.55rem 0.64rem;
  border-radius: 8px;
}

.notes-shell .whiteboard-page-item:hover,
.notes-shell .whiteboard-page-item.active {
  background: rgba(255, 255, 255, 0.075);
  border-color: transparent;
}

.notes-shell .page-item-title {
  font-size: 0.86rem;
}

.notes-shell .page-item-meta,
.notes-shell .page-item-shared {
  display: none;
}

.notes-shell .whiteboard-workspace {
  background: transparent;
}

.notes-shell .workspace-topbar {
  min-height: 43px;
  padding: 0.38rem clamp(0.9rem, 2vw, 1.5rem);
  justify-content: flex-start;
  background: rgba(255, 255, 255, 0.018);
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.notes-shell .topbar-right,
.notes-shell .topbar-share,
.notes-shell #whiteboardClearBtn {
  display: none;
}

.notes-shell .topbar-tools {
  flex-wrap: wrap;
}

.notes-shell .topbar-btn {
  min-height: 30px;
  padding: 0.28rem 0.55rem;
  border-radius: 7px;
  font-size: 0.78rem;
}

.notes-shell .topbar-btn.active {
  background: rgba(255, 255, 255, 0.1);
  border-color: transparent;
  color: var(--text);
}

.notes-shell .whiteboard-canvas-wrapper {
  background: transparent;
}

.notes-shell .whiteboard-editor-container {
  width: min(820px, calc(100% - 4rem));
  max-width: none;
  min-height: 100%;
  margin: 0 auto;
  padding: clamp(2.3rem, 6vw, 4.4rem) 0 7rem;
}

.notes-shell .notion-title-input {
  font-size: clamp(2.1rem, 5vw, 3.45rem);
  margin-bottom: 1rem;
}

.notes-shell #whiteboardTextarea {
  min-height: 58vh;
  font-size: 1rem;
  line-height: 1.78;
}

body:not(.dark) .notes-shell .whiteboard-sidebar {
  background: #f7f5f2;
  border-right-color: rgba(18, 20, 24, 0.08);
}

body:not(.dark) .notes-shell .workspace-topbar {
  background: rgba(255, 255, 255, 0.75);
  border-bottom-color: rgba(18, 20, 24, 0.08);
}

body:not(.dark) .notes-shell .whiteboard-page-item:hover,
body:not(.dark) .notes-shell .whiteboard-page-item.active,
body:not(.dark) .notes-shell #newNoteBtn,
body:not(.dark) .notes-shell .topbar-btn.active {
  background: rgba(18, 20, 24, 0.065);
}

body:not(.dark) .notes-shell .sidebar-search input {
  background: rgba(18, 20, 24, 0.055);
}

body:not(.dark) .notes-shell .notion-title-input::placeholder {
  color: rgba(18, 20, 24, 0.2);
}

body:not(.dark) .notes-shell #whiteboardTextarea {
  color: #1b1d22;
}

body:not(.dark) .notes-shell #whiteboardTextarea::placeholder {
  color: rgba(18, 20, 24, 0.26);
}

@media (max-width: 820px) {
  .notes-shell {
    grid-template-columns: 1fr;
  }

  .notes-shell .whiteboard-sidebar {
    max-height: 220px;
    border-right: 0;
    border-bottom: 1px solid var(--glass-edge-soft);
  }

  .notes-shell .whiteboard-editor-container {
    width: min(100% - 2rem, 820px);
    padding-top: 2rem;
  }
}


/* Attachments Panel in Whiteboard */
.whiteboard-attachments {
  border-top: 1px solid var(--glass-edge-soft);
  background: rgba(18, 22, 31, 0.6);
  padding: 1rem 1.25rem;
  flex-shrink: 0;
}

.whiteboard-attachments h4 {
  margin: 0 0 0.75rem 0;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
}

.whiteboard-attachments .upload-controls {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.whiteboard-attachments .note-upload {
  border: none;
  padding: 0;
  margin: 0;
}

#noteSearchInput {
  border: 1px solid var(--glass-edge-soft);
  border-radius: 14px;
  padding: 0.72rem 0.78rem;
  font: inherit;
  color: var(--text);
  background: rgba(255, 255, 255, 0.08);
  outline: none;
}

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

.note-docs-list {
  display: grid;
  gap: 0.38rem;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--glass-edge-soft);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.06);
  min-height: 52px;
}

.note-doc-row {
  display: block;
  border: 1px solid var(--glass-edge-soft);
  border-radius: 12px;
  padding: 0.5rem 0.65rem;
  text-decoration: none;
  color: var(--text);
  background: rgba(255, 255, 255, 0.08);
  font-size: 0.84rem;
}

.whiteboard-sidebar::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

.whiteboard-sidebar::-webkit-scrollbar-track {
  background: transparent;
}

.whiteboard-sidebar::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 999px;
}

.whiteboard-canvas-wrapper::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

.whiteboard-canvas-wrapper::-webkit-scrollbar-track {
  background: transparent;
}

.whiteboard-canvas-wrapper::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 999px;
}

.composer-icon,
.send-pill {
  border: 0;
  font: inherit;
  cursor: pointer;
}

.chat-model-select {
  border: 1px solid var(--glass-edge-soft);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  font: inherit;
  font-size: 0.82rem;
  min-width: 205px;
  max-width: 255px;
  padding: 0.5rem 0.75rem;
  outline: none;
}

@media (max-width: 860px) {
  .composer {
    grid-template-columns: auto 1fr auto;
  }

  .chat-model-select {
    grid-column: 1 / -1;
    justify-self: end;
    max-width: 100%;
    width: max-content;
  }
}

.composer-icon {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  color: inherit;
}

.prompt-editor {
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  padding: 0.4rem 0.1rem;
  outline: none;
  min-height: 1.4rem;
  white-space: pre-wrap;
  word-break: break-word;
}

.prompt-editor:empty::before {
  content: attr(data-placeholder);
  color: var(--muted);
}

.mention-token {
  color: #2c6cff;
  font-weight: 700;
}

body.dark .mention-token {
  color: #7ea7ff;
}

.mention-suggestions {
  position: absolute;
  left: 52px;
  right: 98px;
  bottom: calc(100% + 8px);
  border: 1px solid var(--glass-edge-soft);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(10px);
  padding: 0.25rem;
  display: grid;
  gap: 0.2rem;
  z-index: 30;
}

#commandSuggestions {
  left: 54px;
  right: auto;
  width: min(290px, calc(100% - 170px));
  top: auto;
  bottom: calc(100% + 10px);
  border-radius: 16px;
  background: rgba(18, 18, 20, 0.98);
  border-color: rgba(255, 255, 255, 0.16);
  box-shadow:
    0 18px 48px rgba(0, 0, 0, 0.48),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
  z-index: 120;
}

.main-panel.pristine-chat #commandSuggestions {
  top: auto;
  bottom: calc(100% + 10px);
}

#commandSuggestions .mention-item {
  color: #f6f7f8;
  min-height: 42px;
  padding: 0.58rem 0.66rem;
}

#commandSuggestions .mention-item strong {
  min-width: 3.3rem;
  color: #fff;
}

#commandSuggestions .mention-item span {
  color: rgba(190, 196, 208, 0.92);
}

#commandSuggestions .mention-item.active,
#commandSuggestions .mention-item:hover {
  background: rgba(255, 255, 255, 0.105);
}

body.dark .mention-suggestions {
  background: rgba(33, 38, 48, 0.95);
}

.mention-item {
  border: 0;
  background: transparent;
  color: var(--text);
  text-align: left;
  font: inherit;
  border-radius: 10px;
  padding: 0.4rem 0.5rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.7rem;
}

.mention-item span {
  color: var(--muted);
  font-size: 0.78rem;
}

.mention-item.active,
.mention-item:hover {
  background: var(--surface-soft);
}

.send-pill {
  padding: 0.66rem 1rem;
  border-radius: 999px;
  color: var(--button-text);
  background: var(--button-bg);
  font-weight: 700;
}

body.sidebar-collapsed .app-shell {
  grid-template-columns: 0 minmax(0, 1fr);
  transition: grid-template-columns 320ms cubic-bezier(0.22, 1, 0.36, 1);
}

body.sidebar-collapsed .main-panel {
  padding-left: 58px;
}

.app-shell {
  transition: grid-template-columns 320ms cubic-bezier(0.22, 1, 0.36, 1);
}

.brand-block,
.new-chat,
.chat-search,
.section-label,
.chat-link,
.sidebar-foot {
  opacity: 1;
  max-height: 120px;
  transition:
    opacity 220ms ease,
    transform 260ms ease,
    max-height 260ms ease,
    margin 260ms ease,
    padding 260ms ease;
  transform-origin: left center;
}

.brand-block {
  max-height: 80px;
}

.section-label {
  max-height: 24px;
}

.sidebar-foot {
  max-height: 96px;
}

body.sidebar-collapsed .brand-block,
body.sidebar-collapsed .new-chat,
body.sidebar-collapsed .sidebar-mode-switch,
body.sidebar-collapsed .chat-search,
body.sidebar-collapsed .section-label,
body.sidebar-collapsed .chat-link,
body.sidebar-collapsed .sidebar-foot {
  opacity: 0;
  transform: translateX(-12px);
  pointer-events: none;
}

body.sidebar-collapsed .brand-block,
body.sidebar-collapsed .sidebar-foot {
  max-height: 0;
  overflow: hidden;
  margin: 0;
  padding-top: 0;
  padding-bottom: 0;
}

body.sidebar-collapsed .new-chat,
body.sidebar-collapsed .sidebar-mode-switch,
body.sidebar-collapsed .chat-search,
body.sidebar-collapsed .section-label,
body.sidebar-collapsed .chat-link {
  max-height: 0;
  overflow: hidden;
  margin: 0;
  padding-top: 0;
  padding-bottom: 0;
}

body.sidebar-collapsed .sidebar {
  width: 0;
  min-width: 0;
  max-width: 0;
  height: 0;
  min-height: 0;
  max-height: 0;
  padding: 0;
  gap: 0;
  overflow: visible;
  border-color: transparent;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  pointer-events: none;
}

body.sidebar-collapsed .sidebar-top {
  width: 0;
  height: 0;
  margin: 0;
  overflow: visible;
}

body.sidebar-collapsed .sidebar::before {
  opacity: 0;
}

body.sidebar-collapsed .sidebar-toggle {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 9999;
  width: 46px;
  height: 46px;
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.44), rgba(255, 255, 255, 0.22));
  border: 1px solid rgba(255, 255, 255, 0.64);
  box-shadow: 0 10px 26px rgba(45, 53, 70, 0.18);
  pointer-events: auto;
}

body.sidebar-collapsed .sidebar-toggle::before {
  content: "";
}

body.sidebar-collapsed .line-a,
body.sidebar-collapsed .line-b,
body.sidebar-collapsed .line-c {
  opacity: 1;
  transform: none;
  width: 14px;
}@media (max-width: 980px) {
  .app-shell {
    width: calc(100vw - 1rem);
    margin: 0.5rem auto;
    height: calc(100vh - 1rem);
    grid-template-columns: 1fr;
  }

  .sidebar {
    order: 2;
    min-height: 42vh;
    max-height: 42vh;
  }

  .main-panel {
    order: 1;
    min-height: 70vh;
  }

  .toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .toolbar-actions {
    justify-content: space-between;
    flex-wrap: wrap;
  }

  .toggle-label {
    display: none;
  }

  .msg {
    max-width: 92%;
  }
}

/* Spacious Manetti interface inspired by wide AI workspaces, without copying another product. */
:root {
  --bg-0: #050506;
  --bg-1: #08090b;
  --bg-2: #0d0e11;
  --line: rgba(255, 255, 255, 0.035);
  --text: #f2f3f5;
  --muted: #8d929c;
  --surface: rgba(255, 255, 255, 0.055);
  --surface-soft: rgba(255, 255, 255, 0.082);
  --glass-fill: rgba(16, 17, 19, 0.72);
  --glass-edge: rgba(255, 255, 255, 0.09);
  --glass-edge-soft: rgba(255, 255, 255, 0.075);
  --glass-highlight: rgba(255, 255, 255, 0.055);
  --shadow: none;
  --shadow-strong: none;
  --message-ai: rgba(255, 255, 255, 0.035);
  --message-user: rgba(255, 255, 255, 0.1);
  --button-bg: rgba(255, 255, 255, 0.92);
  --button-text: #050506;
}

body.dark {
  color-scheme: dark;
  --bg-0: #050506;
  --bg-1: #08090b;
  --bg-2: #0d0e11;
  --line: rgba(255, 255, 255, 0.035);
  --text: #f2f3f5;
  --muted: #8d929c;
  --surface: rgba(255, 255, 255, 0.055);
  --surface-soft: rgba(255, 255, 255, 0.082);
  --glass-fill: rgba(16, 17, 19, 0.72);
  --glass-edge: rgba(255, 255, 255, 0.09);
  --glass-edge-soft: rgba(255, 255, 255, 0.075);
  --glass-highlight: rgba(255, 255, 255, 0.055);
  --message-ai: rgba(255, 255, 255, 0.035);
  --message-user: rgba(255, 255, 255, 0.1);
  --button-bg: rgba(255, 255, 255, 0.92);
  --button-text: #050506;
  background:
    radial-gradient(700px 460px at 62% 38%, rgba(255, 255, 255, 0.028), transparent 65%),
    radial-gradient(900px 520px at 78% 88%, rgba(98, 109, 132, 0.08), transparent 70%),
    linear-gradient(180deg, var(--bg-0), var(--bg-1) 48%, var(--bg-2));
}

.grid {
  opacity: 0.38;
  background-size: 96px 96px;
}

.backdrop-glow {
  display: none;
}

.app-shell {
  width: 100vw;
  height: 100vh;
  margin: 0;
  grid-template-columns: 270px minmax(0, 1fr);
  gap: 0;
}

.glass,
.glass-inline {
  background: var(--glass-fill);
  border-color: var(--glass-edge);
  box-shadow: none;
  backdrop-filter: blur(16px) saturate(116%);
  -webkit-backdrop-filter: blur(16px) saturate(116%);
}

.glass::before {
  display: none;
}

.chrome {
  border-radius: 0;
}

.sidebar {
  border-width: 0 1px 0 0;
  padding: 1.35rem 1rem 1rem;
  gap: 1.1rem;
  background: rgba(5, 5, 6, 0.84);
}

.sidebar-toggle {
  width: 44px;
  height: 44px;
  border-radius: 16px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.065);
}

.brand-block h1 {
  font-size: 1.22rem;
  letter-spacing: -0.02em;
}

.eyebrow {
  color: #7d838e;
}

.new-chat,
.chat-search {
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.075);
}

.new-chat {
  min-height: 52px;
  font-weight: 760;
}

.sidebar-mode-switch {
  display: grid;
  gap: 0.18rem;
  padding: 0;
  border: 0;
  background: transparent;
}

.sidebar-mode-switch .mode-chip {
  width: 100%;
  min-height: 42px;
  justify-content: flex-start;
  border-radius: 12px;
  padding: 0.58rem 0.74rem;
  color: rgba(246, 247, 248, 0.86);
  text-align: left;
}

.sidebar-mode-switch .mode-chip::before {
  width: 1.25rem;
  color: rgba(246, 247, 248, 0.72);
  font-weight: 700;
}

.sidebar-mode-switch #imageEditModeBtn::before {
  content: "🖌";
}

.sidebar-mode-switch #imageModeBtn::before {
  content: "▣";
}

.sidebar-mode-switch #notesModeBtn::before {
  content: "✎";
}

.sidebar-mode-switch .mode-chip.active,
.sidebar-mode-switch .mode-chip:hover {
  background: rgba(255, 255, 255, 0.085);
  color: #fff;
}

.section-label {
  padding: 0.35rem 0.35rem 0.15rem;
  color: #8b909a;
}

#chatList {
  gap: 0.18rem;
  padding-right: 0.25rem;
}

.chat-link {
  min-height: 54px;
  border-radius: 12px;
  padding: 0.64rem 0.74rem;
}

.chat-link:hover,
.chat-link.active {
  transform: none;
  background: rgba(255, 255, 255, 0.085);
}

.chat-link::after {
  display: none;
}

.chat-link-title {
  font-size: 0.9rem;
}

.sidebar-foot {
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.055);
}

.main-panel {
  padding: 1.25rem clamp(1.2rem, 2.2vw, 2.5rem);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 1.2rem;
  background: transparent;
  border: 0;
  box-shadow: none;
}

.toolbar {
  width: 100%;
  margin: 0 auto;
  padding: 0.72rem 1rem;
  border-radius: 24px;
  background: transparent;
  border-color: transparent;
}

.toolbar-group strong {
  font-size: 1.02rem;
}

.toolbar-group p {
  max-width: 34ch;
  font-size: 0.8rem;
}

.toolbar-badge {
  width: 9px;
  height: 9px;
}

.version-badge {
  max-width: 22rem;
  background: rgba(255, 255, 255, 0.075);
}

.theme-toggle {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.09);
}

.mode-switch {
  display: flex;
  align-items: center;
}

.mode-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.52rem;
  padding: 0.52rem 1.08rem;
}

.mode-chip.active {
  background: rgba(255, 255, 255, 0.92);
  color: #060607;
}

.mode-switch.sidebar-mode-switch {
  display: grid;
  align-items: stretch;
  gap: 0.18rem;
}

.sidebar-mode-switch .mode-chip {
  padding: 0.58rem 0.74rem;
}

.sidebar-mode-switch .mode-chip.active,
.sidebar-mode-switch .mode-chip:hover {
  background: rgba(255, 255, 255, 0.085);
  color: #fff;
}

.toggle-pill {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.12);
}

.chat-view,
.image-view,
.image-edit-view,
.notes-view {
  width: 100%;
  margin: 0 auto;
  gap: 1rem;
}

.chat-view {
  grid-template-rows: minmax(0, 1fr) auto auto;
}

.content-stage {
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.content-stage::before {
  display: none;
}

.conversation {
  width: 100%;
  padding: clamp(1rem, 3vw, 3rem) clamp(1rem, 5vw, 6rem) 7.2rem;
  max-width: none;
  margin: 0;
}

.msg {
  border-radius: 18px;
  border-color: rgba(255, 255, 255, 0.075);
  box-shadow: none;
}

.msg.ai {
  max-width: min(900px, calc(100% - 2rem));
  border-left: 0;
  background: rgba(255, 255, 255, 0.035);
}

.msg.user {
  max-width: min(720px, calc(100% - 2rem));
  border-right: 0;
  background: rgba(255, 255, 255, 0.12);
}

.msg-content {
  line-height: 1.58;
}

.msg-model {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.1);
}

.composer {
  width: calc(100% - 2rem);
  max-width: 860px;
  margin: 0 auto 1.1rem;
  position: sticky;
  bottom: 1.1rem;
  z-index: 15;
  padding: 0.58rem;
  grid-template-columns: auto auto minmax(0, 1fr) auto auto;
  border-radius: 999px;
  background: rgba(22, 22, 24, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.095);
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.32);
}

.composer-search-toggle {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--glass-edge-soft);
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  padding: 0;
  outline: none;
}
.composer-search-toggle:hover {
  background: rgba(255, 255, 255, 0.12);
  color: var(--text);
  transform: scale(1.05);
}
.composer-search-toggle:active {
  transform: scale(0.95);
}
.composer-search-toggle.active {
  background: rgba(94, 141, 255, 0.25) !important;
  border-color: rgba(94, 141, 255, 0.45) !important;
  color: #5e8dff !important;
  box-shadow: 0 0 14px rgba(94, 141, 255, 0.3);
}

.composer-icon {
  width: 42px;
  height: 42px;
  background: transparent;
  color: var(--muted);
  font-size: 1.6rem;
}

.prompt-editor {
  padding: 0.58rem 0.2rem;
  font-size: 1rem;
}

.chat-model-select {
  min-width: 155px;
  max-width: 190px;
  padding: 0.56rem 0.7rem;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-weight: 760;
}

.send-pill {
  min-width: 94px;
  border-radius: 999px;
  color: #050506;
  background: rgba(255, 255, 255, 0.94);
  font-weight: 820;
}

.main-panel.pristine-chat .content-stage {
  display: grid;
  align-items: center;
}

.main-panel.pristine-chat .conversation {
  display: none;
}

.main-panel.pristine-chat .pristine-intro {
  display: block;
  text-align: center;
  margin: 0 auto;
}

.main-panel.pristine-chat .pristine-intro h2 {
  font-size: clamp(2rem, 4.2vw, 4.8rem);
  letter-spacing: -0.055em;
  color: #f6f7f8;
}

.main-panel.pristine-chat .composer {
  width: calc(100% - clamp(2rem, 10vw, 12rem));
  max-width: 980px;
  margin-bottom: 0;
  justify-self: center;
}

.starter-actions {
  width: min(980px, calc(100% - 2rem));
  margin: 0 auto;
}

.starter-chip {
  background: rgba(255, 255, 255, 0.045);
  border-color: rgba(255, 255, 255, 0.09);
}

.image-create,
.notes-create {
  background: rgba(255, 255, 255, 0.045);
  border-radius: 22px;
}

.image-view,
.image-edit-view {
  grid-template-rows: minmax(0, 1fr) auto;
}

.image-scroll {
  padding: 0 clamp(0.25rem, 1.4vw, 1.2rem) 1rem 0;
}

.image-head h3 {
  margin: 0 0 1rem;
  font-size: clamp(2rem, 4vw, 3.7rem);
  letter-spacing: -0.055em;
}

.image-presets {
  position: relative;
  top: auto;
  z-index: 1;
  padding: 0;
  margin-bottom: 1rem;
  background: transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

body.dark .image-presets {
  background: transparent;
}

.image-presets h4 {
  margin: 0 0 0.7rem;
  color: rgba(246, 247, 248, 0.86);
  font-size: 0.9rem;
  letter-spacing: 0.01em;
}

.preset-row {
  grid-auto-columns: minmax(210px, 300px);
  gap: 0.75rem;
  padding: 0 0 0.35rem;
}

.preset-card {
  min-height: 132px;
  border-radius: 18px;
  border-color: rgba(255, 255, 255, 0.11);
  background: rgba(255, 255, 255, 0.045);
  box-shadow: none;
  transition:
    transform 160ms ease,
    border-color 160ms ease,
    background 160ms ease;
}

.preset-card:hover {
  transform: translateY(-1px);
  border-color: rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.075);
}

.preset-card::after {
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.04) 36%, rgba(0, 0, 0, 0.72) 100%);
}

.image-grid {
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.9rem;
  padding-right: 0;
}

.image-card {
  border-color: rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.045);
}

.image-create {
  width: min(980px, calc(100% - 2rem));
  padding: 0.58rem;
  bottom: 1rem;
  border-radius: 28px;
  background: rgba(22, 22, 24, 0.94);
  border-color: rgba(255, 255, 255, 0.095);
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.32);
}

.image-form {
  grid-template-columns: minmax(112px, 150px) minmax(0, 1fr) auto;
}

.image-form input,
.image-form select {
  border: 0;
  background: transparent;
  color: var(--text);
}

.image-form select {
  color: var(--muted);
  font-weight: 760;
}

.image-form input {
  min-width: 0;
}

.image-form .send-pill {
  min-width: 104px;
}

.age-gate {
  margin: 0.45rem 0.4rem 0;
  color: rgba(141, 146, 156, 0.9);
}

.image-grid,
.notes-layout,
.notes-list {
  gap: 1rem;
}

.code-mode-banner {
  width: min(980px, calc(100% - 2rem));
  background: rgba(91, 112, 255, 0.1);
  border-color: rgba(128, 146, 255, 0.22);
}

.chat-view.coding-layout {
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  grid-template-rows: auto minmax(0, 1fr) auto;
  grid-template-areas:
    "banner banner"
    "chat code"
    "composer composer";
  align-content: stretch;
  gap: 1rem;
}

.main-panel.pristine-chat .chat-view.coding-layout .content-stage {
  display: block;
  align-items: initial;
}

.main-panel.pristine-chat .chat-view.coding-layout .conversation {
  display: block;
}

.main-panel.pristine-chat .chat-view.coding-layout .pristine-intro,
.chat-view.coding-layout .pristine-intro,
.chat-view.coding-layout #starterActions {
  display: none;
}

.chat-view.coding-layout #contentStage,
.chat-view.coding-layout #codeOutputPanel {
  min-height: 0;
  height: min(62vh, 680px);
}

.chat-view.coding-layout #composer {
  width: min(980px, calc(100% - 2rem));
  margin: 0 auto;
  position: relative;
  bottom: auto;
  z-index: 20;
}

.chat-view.coding-layout .conversation {
  max-width: none;
  height: 100%;
  padding: 1.2rem;
}

@media (max-width: 1180px) {
  .chat-view.coding-layout {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(220px, auto) minmax(220px, auto) auto;
    grid-template-areas:
      "banner"
      "code"
      "chat"
      "composer";
  }

  .chat-view.coding-layout #contentStage,
  .chat-view.coding-layout #codeOutputPanel {
    height: min(34vh, 380px);
  }

  .chat-view.coding-layout #composer {
    width: calc(100% - 0.5rem);
  }
}

.code-output-panel {
  border-radius: 22px;
  background: rgba(9, 10, 13, 0.88);
  border-color: rgba(255, 255, 255, 0.08);
}

body.sidebar-collapsed .app-shell {
  grid-template-columns: 72px minmax(0, 1fr);
}

body.sidebar-collapsed .main-panel {
  transform: none;
  margin-left: 0;
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: minmax(220px, 34vw) minmax(0, 1fr);
  }

  .sidebar {
    padding: 1rem 0.8rem 0.8rem;
  }

  .new-chat {
    min-height: 46px;
  }

  .main-panel {
    padding: 1rem;
  }

  .toolbar {
    padding-inline: 0;
  }

  .toolbar-group p,
  .version-badge {
    display: none;
  }

  .conversation {
    padding: 1rem 0.25rem 6.5rem;
  }

  .msg.ai,
  .msg.user {
    max-width: calc(100% - 0.5rem);
  }

  .composer {
    width: calc(100% - 0.5rem);
  }
}

/* Compact logo sidebar */
.sidebar-top {
  min-height: 44px;
  justify-content: space-between;
  gap: 0.5rem;
}

.sidebar-logo {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  display: block;
  object-fit: contain;
  border-radius: 10px;
  filter: invert(1);
}

.sidebar-toggle {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  border: 0;
  border-radius: 10px;
  display: grid;
  place-items: center;
  color: rgba(220, 224, 232, 0.72);
  background: transparent;
  box-shadow: none;
  cursor: pointer;
}

.sidebar-toggle:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.075);
}

.sidebar-toggle-arrow {
  display: block;
  font-size: 1.55rem;
  font-weight: 400;
  line-height: 1;
  transform: translateY(-1px);
  transition: transform 220ms ease;
}

body.sidebar-collapsed .app-shell {
  grid-template-columns: 72px minmax(0, 1fr);
}

body.sidebar-collapsed .sidebar {
  width: auto;
  min-width: 0;
  max-width: none;
  height: 100vh;
  min-height: 0;
  max-height: none;
  padding: 1rem 0.65rem;
  gap: 0;
  overflow: hidden;
  border-width: 0 1px 0 0;
  border-color: rgba(255, 255, 255, 0.07);
  background: rgba(5, 5, 6, 0.92);
  pointer-events: auto;
}

body.sidebar-collapsed .sidebar-top {
  width: auto;
  height: auto;
  margin: 0;
  overflow: visible;
  flex-direction: column;
}

.pro-badge {
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.22);
  color: #ffffff;
  padding: 0.18rem 0.5rem;
  border-radius: 6px;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  display: inline-block;
  vertical-align: middle;
  line-height: 1;
}

body:not(.dark) .pro-badge {
  background: rgba(0, 0, 0, 0.06);
  border: 1px solid rgba(0, 0, 0, 0.12);
  color: #111827;
}

body.sidebar-collapsed #proBadgeSidebar {
  display: none !important;
}

body.sidebar-collapsed .sidebar-logo {
  width: 38px;
  height: 38px;
}

body.sidebar-collapsed .sidebar-toggle {
  position: static;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 10px;
  color: rgba(220, 224, 232, 0.72);
  background: transparent;
  box-shadow: none;
  pointer-events: auto;
}

body.sidebar-collapsed .sidebar-toggle-arrow {
  transform: rotate(180deg) translateY(1px);
}

body.sidebar-collapsed .main-panel {
  padding-left: clamp(1.2rem, 2.2vw, 2.5rem);
}

body.sidebar-collapsed .new-chat,
body.sidebar-collapsed .sidebar-mode-switch,
body.sidebar-collapsed .chat-search,
body.sidebar-collapsed .sidebar-section,
body.sidebar-collapsed .sidebar-foot {
  display: none;
}

@media (max-width: 980px) {
  body.sidebar-collapsed .app-shell {
    grid-template-columns: 64px minmax(0, 1fr);
  }

  body.sidebar-collapsed .sidebar {
    display: flex;
    padding: 0.8rem 0.45rem;
  }
}

/* Branded new-chat screen */
.main-panel.pristine-chat .pristine-intro {
  display: grid;
  justify-items: center;
  gap: 0.5rem;
  margin: 0;
}

.main-panel.pristine-chat {
  grid-template-rows: auto minmax(0, 1fr);
}

.main-panel.pristine-chat .toolbar {
  display: flex;
}

.main-panel.pristine-chat .toolbar-group {
  visibility: hidden;
}

.main-panel.pristine-chat .chat-view {
  height: 100%;
  grid-template-rows: max-content max-content;
  align-content: center;
  justify-items: stretch;
}

.main-panel.pristine-chat .content-stage {
  width: 100%;
  height: auto;
  min-height: 0;
  display: grid;
  grid-template-rows: max-content max-content;
  place-content: center;
  justify-items: center;
  gap: 1.25rem;
}

.main-panel.pristine-chat .composer {
  width: 800px;
  max-width: calc(100% - 2rem);
  margin: 0 auto;
  justify-self: center;
}

.main-panel.pristine-chat .starter-actions {
  margin: 0.2rem auto 0;
}

.pristine-brand {
  display: flex;
  align-items: center;
  gap: 0.72rem;
}

.pristine-brand img {
  width: clamp(52px, 5vw, 70px);
  height: clamp(52px, 5vw, 70px);
  object-fit: contain;
  border-radius: 16px;
  filter: invert(1);
}

.pristine-brand strong {
  color: var(--text);
  font-size: clamp(2rem, 4.2vw, 3.8rem);
  font-weight: 700;
  letter-spacing: -0.055em;
}

.main-panel.pristine-chat .pristine-intro p {
  margin: 0;
  color: var(--muted);
  font-size: 0.96rem;
}

/* Complete light theme */
body:not(.dark) {
  color-scheme: light;
  --bg-0: #ffffff;
  --bg-1: #fbfbfc;
  --bg-2: #f6f6f7;
  --line: rgba(18, 20, 24, 0.035);
  --text: #111216;
  --muted: #6d7078;
  --surface: rgba(18, 20, 24, 0.04);
  --surface-soft: rgba(18, 20, 24, 0.07);
  --glass-fill: rgba(255, 255, 255, 0.92);
  --glass-edge: rgba(18, 20, 24, 0.1);
  --glass-edge-soft: rgba(18, 20, 24, 0.08);
  --glass-highlight: rgba(255, 255, 255, 0.8);
  --message-ai: rgba(18, 20, 24, 0.035);
  --message-user: rgba(18, 20, 24, 0.075);
  --button-bg: #111216;
  --button-text: #ffffff;
  --link-color: #2e73fc;
  --link-hover-color: #1a5ac7;
  background: #fff;
}

body:not(.dark) .grid {
  opacity: 0.7;
}

body:not(.dark) .sidebar,
body:not(.dark).sidebar-collapsed .sidebar {
  background: rgba(250, 250, 251, 0.96);
  border-color: rgba(18, 20, 24, 0.08);
}

body:not(.dark) .sidebar-logo,
body:not(.dark) .pristine-brand img {
  filter: none;
}

body:not(.dark) .sidebar-toggle {
  color: rgba(18, 20, 24, 0.58);
}

body:not(.dark) .sidebar-toggle:hover,
body:not(.dark) .sidebar-mode-switch .mode-chip.active,
body:not(.dark) .sidebar-mode-switch .mode-chip:hover,
body:not(.dark) .chat-link:hover,
body:not(.dark) .chat-link.active {
  color: #111216;
  background: rgba(18, 20, 24, 0.045);
}

body:not(.dark) .new-chat,
body:not(.dark) .chat-search,
body:not(.dark) .sidebar-foot {
  color: #111216;
  background: rgba(18, 20, 24, 0.045);
  border-color: rgba(18, 20, 24, 0.08);
}

body:not(.dark) .sidebar-mode-switch .mode-chip,
body:not(.dark) .sidebar-mode-switch .mode-chip::before {
  color: rgba(18, 20, 24, 0.76);
}

body:not(.dark) .toolbar,
body:not(.dark) .content-stage {
  background: transparent;
}

body:not(.dark) .theme-toggle,
body:not(.dark) .version-badge {
  color: #5f626a;
  background: rgba(18, 20, 24, 0.045);
  border-color: rgba(18, 20, 24, 0.1);
}

body:not(.dark) .toggle-pill {
  background: rgba(18, 20, 24, 0.09);
  border-color: rgba(18, 20, 24, 0.1);
}

body:not(.dark) .composer,
body:not(.dark) .image-create {
  background: rgba(249, 249, 250, 0.97);
  border-color: rgba(18, 20, 24, 0.1);
  box-shadow: 0 14px 42px rgba(18, 20, 24, 0.08);
}

body:not(.dark) .send-pill {
  color: #fff;
  background: #111216;
}

body:not(.dark) .chat-model-select,
body:not(.dark) .composer-icon,
body:not(.dark) .prompt-editor {
  color: #555962;
}

body:not(.dark) .starter-chip,
body:not(.dark) .msg,
body:not(.dark) .image-card,
body:not(.dark) .notes-panel,
body:not(.dark) .code-mode-banner {
  color: #111216;
  background: rgba(18, 20, 24, 0.035);
  border-color: rgba(18, 20, 24, 0.09);
}

body:not(.dark) .msg.user {
  background: rgba(18, 20, 24, 0.075);
}

body:not(.dark) .code-output-panel,
body:not(.dark) #codeOutputPre {
  color: #22252c;
  background: #f7f7f8;
  border-color: rgba(18, 20, 24, 0.1);
}

body:not(.dark) .code-output-actions button,
body:not(.dark) #modeStateBadge {
  color: #333740;
  background: rgba(18, 20, 24, 0.04);
  border-color: rgba(18, 20, 24, 0.1);
}

body:not(.dark) .image-presets,
body:not(.dark) .image-form input,
body:not(.dark) .image-form select {
  color: #111216;
  background: transparent;
}

body:not(.dark) .preset-card {
  border-color: rgba(18, 20, 24, 0.12);
}

body:not(.dark) #commandSuggestions,
body:not(.dark) .mention-suggestions {
  color: #111216;
  background: rgba(255, 255, 255, 0.98);
  border-color: rgba(18, 20, 24, 0.12);
  box-shadow: 0 18px 48px rgba(18, 20, 24, 0.14);
}

body:not(.dark) #commandSuggestions .mention-item,
body:not(.dark) #commandSuggestions .mention-item strong {
  color: #111216;
}

body:not(.dark) #commandSuggestions .mention-item span {
  color: #747780;
}

body:not(.dark) #commandSuggestions .mention-item.active,
body:not(.dark) #commandSuggestions .mention-item:hover {
  background: rgba(18, 20, 24, 0.065);
}

/* Sidebar search and account menus */
.sidebar {
  grid-template-rows: auto auto auto auto minmax(0, 1fr) auto;
}

.sidebar-search-trigger {
  min-height: 42px;
  padding: 0.55rem 0.74rem;
  border: 0;
  border-radius: 12px;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--text);
  background: transparent;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.new-chat,
.sidebar-search-trigger,
.sidebar-mode-switch .mode-chip {
  min-height: 40px;
  padding: 0.5rem 0.42rem;
  border: 0;
  border-radius: 8px;
  color: var(--text);
  background: transparent;
  box-shadow: none;
  font-size: 0.9rem;
  font-weight: 700;
}

.new-chat:hover,
.sidebar-search-trigger:hover,
.sidebar-mode-switch .mode-chip:hover,
.sidebar-mode-switch .mode-chip.active {
  color: var(--text);
  background: rgba(255, 255, 255, 0.065);
}

.new-chat {
  position: relative;
  padding-left: 2.25rem;
}

.new-chat::before {
  content: "✎";
  position: absolute;
  left: 0.48rem;
  width: 1.2rem;
  color: var(--text);
  text-align: center;
}

.sidebar-mode-switch {
  gap: 0;
}

.sidebar-mode-switch .mode-chip {
  gap: 0.62rem;
}

.sidebar-search-trigger span {
  width: 1.25rem;
  color: var(--muted);
  font-size: 1.05rem;
}

.sidebar-search-trigger:hover {
  background: var(--surface-soft);
}

.sidebar-foot {
  width: 100%;
  border: 0;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 0.7rem;
  color: var(--text);
  text-align: left;
  font: inherit;
  cursor: pointer;
}

.account-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff;
  background: #626bd2;
  font-size: 0.82rem;
  font-weight: 750;
}

.account-menu {
  position: absolute;
  left: 0.65rem;
  right: 0.65rem;
  bottom: 4.9rem;
  z-index: 150;
  padding: 0.38rem;
  display: grid;
  gap: 0.12rem;
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 18px;
  background: rgba(34, 34, 36, 0.98);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.42);
}

.account-menu button {
  min-height: 40px;
  padding: 0.55rem 0.68rem;
  border: 0;
  border-radius: 12px;
  display: flex;
  align-items: center;
  gap: 0.68rem;
  color: #f2f3f5;
  background: transparent;
  font: inherit;
  font-size: 0.88rem;
  text-align: left;
  cursor: pointer;
}

.account-menu button span {
  width: 1.1rem;
  color: #a6aab2;
  text-align: center;
}

.account-menu button:hover {
  background: rgba(255, 255, 255, 0.075);
}

.account-menu button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.search-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: grid;
  place-items: start center;
  padding: min(8vh, 5rem) 1rem 1rem;
  background: rgba(0, 0, 0, 0.62);
  backdrop-filter: blur(9px);
  -webkit-backdrop-filter: blur(9px);
}

.search-modal {
  width: min(720px, calc(100vw - 2rem));
  max-height: min(82vh, 760px);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 22px;
  color: #f2f3f5;
  background: #121214;
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.58);
}

.search-modal-input-wrap {
  min-height: 58px;
  padding: 0 0.8rem 0 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.65rem;
}

.search-modal-input-wrap span {
  color: #9da1aa;
}

.search-modal-input-wrap input {
  min-width: 0;
  border: 0;
  outline: none;
  color: #f2f3f5;
  background: transparent;
  font: inherit;
  font-size: 1rem;
}

.search-modal-input-wrap button {
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 10px;
  color: #a7abb4;
  background: transparent;
  font-size: 1.4rem;
  cursor: pointer;
}

.search-modal-input-wrap button:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.075);
}

.search-modal-body {
  max-height: calc(min(82vh, 760px) - 59px);
  overflow: auto;
  padding: 1rem 1.2rem 1.2rem;
}

.search-group-label {
  margin: 0.35rem 0 0.5rem;
  color: #8e929b;
  font-size: 0.78rem;
}

.search-new-chat,
.search-result-item {
  width: 100%;
  min-height: 44px;
  padding: 0.62rem 0.35rem;
  border: 0;
  border-radius: 10px;
  color: #f2f3f5;
  background: transparent;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.search-result-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.18rem;
}

.search-result-item strong {
  overflow: hidden;
  font-size: 0.9rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.search-result-item span {
  overflow: hidden;
  color: #8f939c;
  font-size: 0.76rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.search-new-chat:hover,
.search-result-item:hover {
  background: rgba(255, 255, 255, 0.065);
}

.search-empty {
  color: #8f939c;
  font-size: 0.85rem;
}

body.sidebar-collapsed .sidebar-search-trigger {
  display: none;
}

body.sidebar-collapsed .account-menu {
  display: none;
}


body:not(.dark) .account-menu,
body:not(.dark) .search-modal {
  color: #111216;
  background: #fff;
  border-color: rgba(18, 20, 24, 0.12);
  box-shadow: 0 24px 70px rgba(18, 20, 24, 0.16);
}

body:not(.dark) .account-menu button,
body:not(.dark) .search-new-chat,
body:not(.dark) .search-result-item,
body:not(.dark) .search-modal-input-wrap input {
  color: #111216;
}

body:not(.dark) .account-menu button:hover,
body:not(.dark) .search-new-chat:hover,
body:not(.dark) .search-result-item:hover {
  background: rgba(18, 20, 24, 0.06);
}

body:not(.dark) .search-modal-input-wrap {
  border-color: rgba(18, 20, 24, 0.09);
}

body:not(.dark) .search-modal-backdrop {
  background: rgba(18, 20, 24, 0.28);
}

/* Stable composer wrapping */
.prompt-editor {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: normal;
}

.composer {
  grid-template-columns: auto auto minmax(120px, 1fr) auto auto;
}

@media (max-width: 1100px) {
  .composer,
  .main-panel.pristine-chat .composer {
    grid-template-columns: auto auto minmax(0, 1fr) auto;
  }

  .chat-model-select {
    grid-column: 1 / -1;
    grid-row: 2;
    justify-self: stretch;
    width: 100%;
    max-width: none;
    background: rgba(255, 255, 255, 0.055);
    border-radius: 14px;
    padding: 0.5rem;
  }

  .prompt-editor {
    grid-column: 3 / 4;
    grid-row: 1;
  }

  .send-pill {
    grid-column: 4 / 5;
    grid-row: 1;
  }
}

/* Settings modal */
.theme-toggle {
  display: none;
}

.settings-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 320;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: rgba(0, 0, 0, 0.58);
  backdrop-filter: blur(9px);
  -webkit-backdrop-filter: blur(9px);
}

.settings-modal {
  width: min(780px, calc(100vw - 2rem));
  min-height: 540px;
  padding: 1rem 1.1rem 1.1rem;
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 22px;
  color: #f2f3f5;
  background: #151517;
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.55);
}

.settings-modal header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.2rem 0.3rem 0.9rem;
}

.settings-modal header h2,
.settings-label {
  margin: 0;
}

.settings-label {
  color: #9498a1;
  font-size: 0.76rem;
}

.settings-modal header h2 {
  font-size: 1.22rem;
}

.settings-modal header button {
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 10px;
  color: #a7abb4;
  background: transparent;
  font-size: 1.4rem;
  cursor: pointer;
}

.settings-modal header button:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.075);
}

.settings-layout {
  min-height: 460px;
  display: grid;
  grid-template-columns: 170px minmax(0, 1fr);
  gap: 1rem;
}

.settings-nav {
  display: grid;
  align-content: start;
  gap: 0.22rem;
}

.settings-nav button {
  min-height: 42px;
  padding: 0.55rem 0.68rem;
  border: 0;
  border-radius: 12px;
  display: flex;
  align-items: center;
  gap: 0.7rem;
  color: #d8dbe1;
  background: transparent;
  font: inherit;
  font-size: 0.86rem;
  text-align: left;
  cursor: pointer;
}

.settings-nav button span {
  width: 1rem;
  color: #9da1aa;
  text-align: center;
}

.settings-nav button.active,
.settings-nav button:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.085);
}

.settings-content {
  min-width: 0;
  padding: 0.25rem 0 0 0.7rem;
}

.settings-panel {
  display: grid;
  align-content: start;
  gap: 1rem;
}

.settings-panel h3,
.settings-panel p {
  margin: 0;
}

.settings-panel > p {
  max-width: 54ch;
  color: #979ba4;
  line-height: 1.55;
}

.settings-account-row {
  padding: 0.25rem 0 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.settings-account-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff;
  background: #626bd2;
  font-size: 1.1rem;
  font-weight: 700;
}

.settings-account-row p {
  margin-top: 0.15rem;
  color: #9498a1;
  font-size: 0.8rem;
}

.settings-list {
  display: grid;
}

.settings-list div {
  min-height: 48px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.065);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  color: #d8dbe1;
  font-size: 0.86rem;
}

.settings-list div span {
  color: #92969f;
}

.theme-choice-grid {
  margin-top: 0.65rem;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.65rem;
}

.theme-choice-grid button {
  padding: 0.55rem;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 14px;
  display: grid;
  gap: 0.28rem;
  color: #f2f3f5;
  background: rgba(255, 255, 255, 0.035);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.theme-choice-grid button.active {
  border-color: rgba(139, 153, 255, 0.72);
  box-shadow: 0 0 0 2px rgba(112, 130, 255, 0.18);
}

.theme-choice-grid small {
  color: #90949d;
  font-size: 0.68rem;
}

.theme-preview {
  height: 72px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 10px;
}

.theme-preview-system {
  background: linear-gradient(90deg, #f5f5f6 0 50%, #111214 50%);
}

.theme-preview-light {
  background: #f5f5f6;
}

.theme-preview-dark {
  background: #111214;
}

body:not(.dark) .settings-modal {
  color: #111216;
  background: #fff;
  border-color: rgba(18, 20, 24, 0.12);
  box-shadow: 0 24px 70px rgba(18, 20, 24, 0.16);
}

body:not(.dark) .settings-section,
body:not(.dark) .theme-choice-grid button {
  color: #111216;
  background: rgba(18, 20, 24, 0.025);
  border-color: rgba(18, 20, 24, 0.09);
}

body:not(.dark) .settings-nav button {
  color: #4e5159;
}

body:not(.dark) .settings-nav button.active,
body:not(.dark) .settings-nav button:hover {
  color: #111216;
  background: rgba(18, 20, 24, 0.065);
}

body:not(.dark) .settings-account-row,
body:not(.dark) .settings-list div {
  border-color: rgba(18, 20, 24, 0.09);
}

body:not(.dark) .settings-list div {
  color: #24262c;
}

body:not(.dark) .settings-modal-backdrop {
  background: rgba(18, 20, 24, 0.28);
}

@media (max-width: 680px) {
  .settings-modal {
    min-height: 0;
    max-height: calc(100vh - 2rem);
    overflow: auto;
  }

  .settings-layout {
    min-height: 0;
    grid-template-columns: 1fr;
  }

  .settings-nav {
    grid-auto-flow: column;
    grid-auto-columns: minmax(max-content, 1fr);
    overflow-x: auto;
  }

  .settings-nav button {
    justify-content: center;
    font-size: 0;
  }

  .settings-nav button span {
    font-size: 0.9rem;
  }

  .settings-content {
    padding-left: 0;
  }

  .theme-choice-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: minmax(220px, 34vw) minmax(0, 1fr);
  }

  .sidebar {
    display: flex;
    padding: 1rem 0.8rem 0.8rem;
  }

  .main-panel {
    padding: 1rem;
  }

  .toolbar {
    padding-inline: 0;
  }

  .toolbar-actions {
    width: auto;
    justify-content: space-between;
    flex-wrap: wrap;
  }

  .toolbar-group p,
  .version-badge {
    display: none;
  }

  .conversation {
    padding: 1rem 0.25rem 6.5rem;
  }

  .composer {
    width: calc(100% - 0.5rem);
    grid-template-columns: auto auto minmax(0, 1fr) auto;
    border-radius: 24px;
  }

  .image-create {
    width: calc(100% - 0.5rem);
    border-radius: 24px;
  }

  .image-form {
    grid-template-columns: 1fr auto;
  }

  .chat-model-select {
    grid-column: 1 / -1;
    justify-self: stretch;
    width: 100%;
    max-width: none;
    background: rgba(255, 255, 255, 0.055);
    border-radius: 14px;
  }

  .image-form select {
    grid-column: 1 / -1;
    background: rgba(255, 255, 255, 0.055);
    border-radius: 14px;
  }

  #commandSuggestions {
    left: 48px;
    width: min(260px, calc(100% - 96px));
  }

  .msg.ai,
  .msg.user {
    max-width: 100%;
  }
}

/* Image Card Menu Styles */
.image-card-menu-container {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 10;
}

.image-card-menu-btn {
  background: rgba(30, 34, 45, 0.45);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #ffffff;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  line-height: 1;
  transition: background 0.2s, transform 0.2s;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  padding: 0;
  outline: none;
}

.image-card-menu-btn:hover {
  background: rgba(30, 34, 45, 0.75);
  transform: scale(1.05);
}

.image-card-dropdown {
  position: absolute;
  top: 32px;
  right: 0;
  background: rgba(30, 34, 45, 0.85);
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  padding: 4px;
  min-width: 130px;
  display: none;
  flex-direction: column;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  animation: fadeInMenu 0.15s ease-out;
}

.image-card-dropdown.show {
  display: flex;
}

.image-card-dropdown-item {
  background: transparent;
  border: none;
  color: #ffffff;
  padding: 8px 12px;
  text-align: left;
  font: inherit;
  font-size: 0.8rem;
  cursor: pointer;
  border-radius: 6px;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: background 0.2s;
}

.image-card-dropdown-item:hover {
  background: rgba(255, 255, 255, 0.1);
}

.image-card-dropdown-item .icon {
  font-size: 0.95rem;
  display: inline-block;
  width: 14px;
  text-align: center;
}

.image-card-dropdown-item.delete {
  color: #ff5555;
}

.image-card-dropdown-item.delete:hover {
  background: rgba(255, 85, 85, 0.15);
}

@keyframes fadeInMenu {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(-5px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

/* Web Search Button */
.web-search-btn {
  border: 1px solid var(--glass-edge-soft);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  font: inherit;
  font-size: 0.82rem;
  padding: 0.5rem 0.75rem;
  outline: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}

.web-search-btn.active {
  background: rgba(46, 115, 252, 0.25);
  border-color: rgba(46, 115, 252, 0.6);
  color: #5ea2ff;
  box-shadow: 0 0 10px rgba(46, 115, 252, 0.3);
}

.web-search-btn:hover {
  background: rgba(255, 255, 255, 0.15);
}

.web-search-btn.active:hover {
  background: rgba(46, 115, 252, 0.35);
}

/* Search Badge inside responses */
.msg-search-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  color: #5ea2ff;
  background: rgba(46, 115, 252, 0.1);
  border: 1px solid rgba(46, 115, 252, 0.2);
  border-radius: 6px;
  padding: 4px 8px;
  margin-top: 8px;
  width: max-content;
}

/* Responsive adjustment for Web Search button */
@media (max-width: 1100px) {
  .web-search-btn {
    grid-column: 2 / 3;
    grid-row: 2;
    justify-self: end;
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
  }
  .chat-model-select {
    max-width: calc(100% - 100px);
    font-size: 0.75rem;
  }
}

/* Chat Inline Links */
.chat-inline-link {
  color: var(--link-color);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s, text-decoration 0.2s;
}

.chat-inline-link:hover {
  color: var(--link-hover-color);
  text-decoration: underline;
}

/* Citation Pill */
.citation-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--surface);
  border: 1px solid var(--glass-edge-soft);
  color: var(--text);
  font-size: 0.72rem;
  font-weight: 500;
  padding: 1px 7px;
  border-radius: 999px;
  margin: 0 3px;
  cursor: pointer;
  user-select: none;
  transition: background 0.2s, border-color 0.2s, transform 0.1s;
  vertical-align: middle;
}

.citation-pill:hover {
  background: var(--surface-soft);
  border-color: var(--glass-edge);
  transform: scale(1.02);
}

.citation-pill:active {
  transform: scale(0.98);
}

/* Citation Popover Overlay */
.citation-popover {
  position: absolute;
  width: 290px;
  background: var(--glass-fill);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--glass-edge);
  border-radius: 12px;
  padding: 12px 16px;
  z-index: 500;
  box-shadow: var(--shadow-strong);
  display: flex;
  flex-direction: column;
  gap: 8px;
  animation: fadeInMenu 0.15s ease-out;
  color: var(--text);
}

.citation-popover-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.72rem;
  color: var(--muted);
}

.popover-nav-btn {
  background: var(--surface);
  border: 1px solid var(--glass-edge-soft);
  border-radius: 4px;
  color: var(--text);
  cursor: pointer;
  padding: 2px 6px;
  font-size: 0.75rem;
  transition: background 0.2s, border-color 0.2s;
}

.popover-nav-btn:hover:not(:disabled) {
  background: var(--surface-soft);
  border-color: var(--glass-edge);
}

.popover-nav-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.popover-pager {
  margin-left: auto;
  font-size: 0.68rem;
  font-weight: 500;
}

.citation-popover-body {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.citation-popover-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
  color: var(--muted);
}

.citation-popover-favicon {
  width: 12px;
  height: 12px;
  border-radius: 2px;
}

.citation-popover-title {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--link-color);
  text-decoration: none;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.citation-popover-title:hover {
  color: var(--link-hover-color);
  text-decoration: underline;
}

/* Sources Bar Pill */
.sources-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--surface);
  border: 1px solid var(--glass-edge-soft);
  border-radius: 999px;
  padding: 4px 10px 4px 8px;
  cursor: pointer;
  font: inherit;
  font-size: 0.75rem;
  color: var(--text);
  margin-top: 8px;
  width: max-content;
  transition: background 0.2s, border-color 0.2s, transform 0.1s;
}

.sources-pill:hover {
  background: var(--surface-soft);
  border-color: var(--glass-edge);
  transform: scale(1.01);
}

.sources-pill-icons {
  display: flex;
  align-items: center;
}

.sources-pill-favicon {
  width: 14px;
  height: 14px;
  border-radius: 20%;
  border: 1px solid var(--glass-edge-soft);
  margin-right: -4px;
  background: white;
  padding: 1px;
}

.sources-pill-favicon:last-child {
  margin-right: 4px;
}

/* Sources Drawer Sidebar */
.sources-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 380px;
  max-width: 100%;
  background: var(--glass-fill);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-left: 1px solid var(--glass-edge);
  z-index: 200;
  box-shadow: var(--shadow-strong);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.sources-drawer:not(.hidden-view) {
  transform: translateX(0);
}

.sources-drawer-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--glass-edge-soft);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sources-drawer-header h3 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
}

.sources-drawer-close {
  background: transparent;
  border: 0;
  color: var(--muted);
  font-size: 1.25rem;
  cursor: pointer;
  padding: 0.25rem;
  line-height: 1;
  transition: color 0.2s;
}

.sources-drawer-close:hover {
  color: var(--text);
}

.sources-drawer-content {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* Individual Source Item in Drawer */
.source-item {
  display: flex;
  flex-direction: column;
  gap: 5px;
  background: var(--surface);
  border: 1px solid var(--glass-edge-soft);
  border-radius: 10px;
  padding: 0.8rem;
  transition: background 0.2s, border-color 0.2s;
}

.source-item:hover {
  background: var(--surface-soft);
  border-color: var(--glass-edge);
}

.source-item-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
  color: var(--muted);
}

.source-item-favicon {
  width: 14px;
  height: 14px;
  border-radius: 2px;
}

.source-item-title {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--link-color);
  text-decoration: none;
  line-height: 1.35;
}

.source-item-title:hover {
  color: var(--link-hover-color);
  text-decoration: underline;
}

.source-item-snippet {
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.4;
  margin: 0;
}

/* Chat Inline Images */
.chat-inline-image-container {
  margin: 12px 0;
  max-width: 500px;
  width: 100%;
}

.chat-inline-image {
  max-width: 100%;
  height: auto;
  border-radius: 12px;
  border: 1px solid var(--glass-edge-soft);
  box-shadow: var(--shadow);
  display: block;
  transition: transform 0.2s ease;
}

.chat-inline-image:hover {
  transform: scale(1.015);
}

/* Lightbox Modal */
.lightbox-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(25px);
  -webkit-backdrop-filter: blur(25px);
  z-index: 100000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 1;
  transition: opacity 0.2s ease;
}

.lightbox-backdrop.hidden-view {
  opacity: 0;
  pointer-events: none;
}

.lightbox-content {
  position: relative;
  max-width: 90vw;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.lightbox-image {
  max-width: 90vw;
  max-height: 72vh;
  object-fit: contain;
  border-radius: 12px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(0, 0, 0, 0.3);
}

.lightbox-close {
  position: absolute;
  top: 24px;
  right: 24px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #fff;
  font-size: 28px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  transition: all 0.2s ease;
  z-index: 10010;
}

.lightbox-close:hover {
  background: rgba(255, 255, 255, 0.18);
  transform: scale(1.05);
}

.lightbox-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 32px;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  transition: all 0.2s ease;
  z-index: 10005;
}

.lightbox-arrow:hover {
  background: rgba(255, 255, 255, 0.18);
  transform: translateY(-50%) scale(1.05);
}

.lightbox-arrow.prev {
  left: 32px;
}

.lightbox-arrow.next {
  right: 32px;
}

.lightbox-arrow.hidden-view {
  display: none;
}

.lightbox-footer {
  margin-top: 16px;
  width: 100%;
  max-width: 90vw;
  text-align: left;
  color: #fff;
  padding: 0 8px;
}

.lightbox-source-line {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.lightbox-favicon {
  width: 16px;
  height: 16px;
  border-radius: 3px;
  background: #fff;
  padding: 1px;
}

.lightbox-favicon.hidden-view {
  display: none;
}

.lightbox-source-link {
  color: rgba(255, 255, 255, 0.7);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  transition: color 0.15s ease;
}

.lightbox-source-link:hover {
  color: #fff;
  text-decoration: underline;
}

.lightbox-source-link.hidden-view {
  display: none;
}

.lightbox-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.4;
  color: #fff;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
}

@media (max-width: 768px) {
  .lightbox-arrow {
    width: 40px;
    height: 40px;
    font-size: 24px;
  }
  .lightbox-arrow.prev {
    left: 12px;
  }
  .lightbox-arrow.next {
    right: 12px;
  }
  .lightbox-close {
    top: 16px;
    right: 16px;
    width: 38px;
    height: 38px;
    font-size: 22px;
  }
}

/* Lightbox counter (top-right: "1 / 5") */
.lightbox-counter {
  position: absolute;
  top: 24px;
  right: 80px;
  color: rgba(255, 255, 255, 0.75);
  font-size: 0.92rem;
  font-weight: 500;
  letter-spacing: 0.03em;
  z-index: 10010;
  pointer-events: none;
  text-shadow: 0 1px 3px rgba(0,0,0,0.5);
}

/* --- Image Generator Redesign --- */
.image-grid {
  grid-template-columns: repeat(4, 1fr) !important;
  gap: 1rem !important;
  min-height: 0;
  overflow: auto;
}

@media (max-width: 1200px) {
  .image-grid {
    grid-template-columns: repeat(3, 1fr) !important;
  }
}

@media (max-width: 800px) {
  .image-grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }
}

@media (max-width: 480px) {
  .image-grid {
    grid-template-columns: 1fr !important;
  }
}

.image-card {
  aspect-ratio: 1 / 1 !important;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  position: relative;
  overflow: hidden;
  border-radius: 16px;
}

.image-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
}

.image-card img {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
  transition: transform 0.3s ease;
}

.image-card:hover img {
  transform: scale(1.04);
}

/* Hide footers and menus on cards inside the image-grid */
.image-grid .image-card .image-card-foot,
.image-grid .image-card .image-card-menu-container {
  display: none !important;
}

/* Image Generator Details Modal styling */
.image-details-content {
  width: 90%;
  max-width: 900px;
  background: rgba(30, 34, 45, 0.75);
  backdrop-filter: blur(25px);
  -webkit-backdrop-filter: blur(25px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 24px;
  display: flex;
  overflow: hidden;
  max-height: 80vh;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
  animation: detailsScaleIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  color: #ffffff;
}

@keyframes detailsScaleIn {
  from {
    transform: scale(0.95);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

.image-details-left {
  flex: 1.2;
  background: rgba(0, 0, 0, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
  aspect-ratio: 1 / 1;
}

.image-details-left img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.image-details-right {
  flex: 1;
  padding: 2rem;
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
  overflow-y: auto;
  border-left: 1px solid rgba(255, 255, 255, 0.08);
}

.image-details-right h3 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 700;
  color: #ffffff;
}

.image-details-prompt-box {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 12px;
  padding: 0.85rem 1rem;
}

.image-details-prompt-box .eyebrow {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted, #9ca2b2);
  margin-top: 0;
  margin-bottom: 0.4rem;
  font-weight: 600;
}

#imageDetailsPrompt {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.45;
  color: #e2e4e9;
  word-break: break-word;
}

.image-details-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.image-details-meta .version-badge {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 0.72rem;
  padding: 0.25rem 0.55rem;
  border-radius: 6px;
  color: #b0b3b8;
}

.image-details-actions {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin-top: auto;
}

.image-details-actions button {
  width: 100%;
  justify-content: center;
  padding: 0.75rem;
  font-size: 0.88rem;
  border-radius: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.image-details-actions .delete:hover {
  background: rgba(255, 85, 85, 0.15) !important;
  color: #ff5555 !important;
  border-color: rgba(255, 85, 85, 0.3) !important;
}

/* Responsive modal for tablet/mobile */
@media (max-width: 768px) {
  .image-details-content {
    flex-direction: column;
    max-height: 85vh;
    width: 95%;
  }
  
  .image-details-left {
    aspect-ratio: auto;
    max-height: 35vh;
    flex: none;
  }
  
  .image-details-right {
    padding: 1.25rem;
    border-left: none;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    flex: 1;
  }
}

/* Friends View (Freunde-Bereich) */
.friends-view {
  min-height: 0;
  display: grid;
  grid-template-rows: minmax(0, 1fr);
  overflow: hidden;
  height: 100%;
}

.friends-layout {
  display: flex;
  height: 100%;
  min-height: 0;
  gap: 12px;
  color: var(--text);
  box-sizing: border-box;
}

/* Left Sidebar: Narrow circular avatars column */
.friends-sidebar {
  width: 72px;
  min-width: 72px;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 1.25rem 0;
  overflow: hidden;
  box-sizing: border-box;
  gap: 12px;
}

.friends-sidebar-top {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.friends-add-btn {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 1px dashed var(--glass-edge);
  background: var(--surface-soft);
  color: var(--text);
  font-size: 1.5rem;
  font-weight: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.friends-add-btn:hover {
  border-color: var(--glass-edge);
  color: var(--text);
  background: var(--surface);
  border-radius: 35%;
  transform: scale(1.05);
}

.friends-lobby-btn {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 1px solid var(--glass-edge-soft);
  background: var(--surface-soft);
  color: var(--text);
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.friends-lobby-btn:hover,
.friends-lobby-btn.active {
  background: var(--surface);
  border-color: var(--glass-edge);
  border-radius: 35%;
  transform: scale(1.05);
}

.friends-divider {
  width: 32px;
  height: 1px;
  background: var(--glass-edge-soft);
  margin: 4px 0;
}

.friends-sidebar-scroll {
  flex: 1;
  width: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding-bottom: 1rem;
}

.friends-sidebar-scroll::-webkit-scrollbar {
  width: 0px;
}

.friend-circle-item {
  position: relative;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid transparent;
}

.friend-circle-item:hover,
.friend-circle-item.active {
  border-radius: 35%;
  transform: scale(1.05);
}

.friend-circle-item.active {
  border-color: var(--glass-edge);
}

.friend-circle-avatar {
  width: 100%;
  height: 100%;
  border-radius: inherit;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 600;
  font-size: 1.1rem;
  text-transform: uppercase;
  background: var(--avatar-gradient, linear-gradient(135deg, #64748b, #475569));
  box-shadow: var(--shadow-soft);
  transition: border-radius 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.friend-status-dot {
  position: absolute;
  bottom: -2px;
  right: -2px;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: #10b981; /* Green for online */
  border: 2px solid var(--bg-1);
  box-shadow: 0 1px 3px rgba(0,0,0,0.4);
  z-index: 10;
}

.friend-status-dot.offline {
  background: #6b7280; /* Gray for offline */
}

.friend-status-dot.pending {
  background: #f59e0b; /* Orange for pending request */
}

/* Tooltip on hover */
.friend-circle-item::after {
  content: attr(data-username);
  position: absolute;
  left: 74px;
  top: 50%;
  transform: translateY(-50%) scale(0.9);
  background: rgba(18, 22, 31, 0.95);
  border: 1px solid var(--glass-edge-soft);
  padding: 0.4rem 0.75rem;
  border-radius: 8px;
  color: var(--text);
  font-size: 0.8rem;
  font-weight: 500;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: all 0.15s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 100;
  box-shadow: var(--shadow-strong);
}

.friend-circle-item:hover::after {
  opacity: 1;
  transform: translateY(-50%) scale(1);
}

/* Main Content Area */
.friends-main {
  flex: 1;
  padding: 1.75rem;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  box-sizing: border-box;
}

.friends-main::-webkit-scrollbar {
  width: 6px;
}
.friends-main::-webkit-scrollbar-track {
  background: transparent;
}
.friends-main::-webkit-scrollbar-thumb {
  background: rgba(124, 132, 150, 0.25);
  border-radius: 3px;
}
.friends-main::-webkit-scrollbar-thumb:hover {
  background: rgba(124, 132, 150, 0.45);
}

/* Lobby / Welcome Dashboard styling */
.friends-lobby-container {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.friends-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.friends-header-left {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.friends-header h2 {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0;
  color: var(--text);
  letter-spacing: -0.01em;
}

.friends-subtitle {
  font-size: 0.85rem;
  color: var(--muted);
  margin: 0;
}

.add-friend-header-btn {
  background: var(--surface-soft) !important;
  border: 1px solid var(--glass-edge-soft) !important;
  color: var(--text) !important;
  font-size: 0.82rem !important;
  font-weight: 600 !important;
  padding: 0.55rem 1rem !important;
  border-radius: 10px !important;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.add-friend-header-btn:hover {
  background: var(--surface) !important;
  border-color: var(--glass-edge) !important;
  transform: translateY(-1px);
}

.friends-metrics-bar {
  display: flex;
  align-items: center;
  background: var(--surface-soft);
  border: 1px solid var(--glass-edge-soft);
  border-radius: 14px;
  padding: 0.85rem 1.25rem;
  gap: 1.25rem;
  box-sizing: border-box;
}

.metric-item {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}

.metric-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
}

.metric-value {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1;
}

.metric-label {
  font-size: 0.8rem;
  color: var(--muted);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.metric-divider {
  width: 1px;
  height: 20px;
  background: var(--glass-edge-soft);
  flex-shrink: 0;
}

.friends-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 3rem 1.5rem;
  border: 1.5px dashed var(--glass-edge-soft);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.01);
  margin-top: 0.5rem;
  box-sizing: border-box;
  transition: all 0.2s ease;
}

.friends-empty-state:hover {
  border-color: var(--glass-edge);
  background: rgba(255, 255, 255, 0.02);
}

.empty-icon {
  font-size: 2rem;
  margin-bottom: 0.75rem;
  opacity: 0.6;
  filter: grayscale(1);
}

.friends-empty-state h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 0.35rem 0;
}

.friends-empty-state p {
  font-size: 0.78rem;
  color: var(--muted);
  max-width: 280px;
  margin: 0;
  line-height: 1.4;
}

.friends-mini-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2rem 1.25rem;
  border: 1px dashed var(--glass-edge-soft);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.01);
  gap: 0.4rem;
  box-sizing: border-box;
}

.mini-empty-icon {
  font-size: 1.25rem;
  opacity: 0.5;
  filter: grayscale(1);
}

.friends-mini-empty p {
  font-size: 0.75rem;
  color: var(--muted);
  margin: 0;
}

/* Friend profile dashboard */
.friend-profile-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--glass-edge-soft);
  margin-bottom: 1.5rem;
}

.friend-profile-meta {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.friend-profile-avatar-large {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  font-weight: 700;
  color: #fff;
  text-transform: uppercase;
  background: var(--avatar-gradient, linear-gradient(135deg, #64748b, #475569));
  box-shadow: var(--shadow-strong);
}

.friend-profile-name-wrap {
  display: flex;
  flex-direction: column;
}

.friend-profile-name {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text);
  margin: 0;
}

.friend-profile-status {
  font-size: 0.85rem;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.2rem;
}

.friend-profile-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10b981;
}

.friend-profile-status-dot.offline {
  background: #6b7280;
}

.friend-profile-actions {
  display: flex;
  gap: 0.75rem;
}

/* Grid for lists in detailed view */
.friend-dashboard-sections {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

@media (max-width: 768px) {
  .friend-dashboard-sections {
    grid-template-columns: 1fr;
  }
}

.friend-dashboard-sec {
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.friend-dashboard-sec-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.friend-dashboard-sec-head h4 {
  margin: 0;
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

/* Item styling for lists inside card dashboard */
.friends-lobby-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.friends-dashboard-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 0;
  border: none;
  border-bottom: 1px solid var(--glass-edge-soft);
  border-radius: 0;
  background: transparent;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.friends-dashboard-item:hover {
  background: transparent;
  border-bottom-color: var(--glass-edge);
  padding-left: 6px;
}

.friends-dashboard-item-info {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
}

.friends-dashboard-item-title {
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.friends-dashboard-item-sub {
  font-size: 0.75rem;
  color: var(--muted);
}

.friends-dashboard-item-btn {
  background: var(--surface-soft);
  border: 1px solid var(--glass-edge-soft);
  color: var(--text);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  padding: 0.4rem 0.8rem;
  border-radius: 8px;
  transition: all 0.2s;
}

.friends-dashboard-item-btn:hover {
  background: var(--surface);
  border-color: var(--glass-edge);
  color: var(--text);
}

.friend-remove-btn {
  background: rgba(239, 68, 68, 0.06);
  border: 1px solid rgba(239, 68, 68, 0.15);
  color: #ef4444;
  font-size: 0.85rem;
  font-weight: 500;
  padding: 0.45rem 0.9rem;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
}

.friend-remove-btn:hover {
  background: rgba(239, 68, 68, 0.14);
  border-color: rgba(239, 68, 68, 0.3);
  color: #ef4444;
}

.friends-empty {
  text-align: center;
  padding: 1.5rem 1rem;
  color: var(--muted);
  font-size: 0.85rem;
}

.friend-accept-btn {
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.2);
  color: #10b981;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.4rem 0.75rem;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
}

.friend-accept-btn:hover {
  background: rgba(16, 185, 129, 0.16);
  border-color: rgba(16, 185, 129, 0.4);
}

.friend-decline-btn {
  background: rgba(239, 68, 68, 0.06);
  border: 1px solid rgba(239, 68, 68, 0.15);
  color: #ef4444;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.4rem 0.75rem;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
}

.friend-decline-btn:hover {
  background: rgba(239, 68, 68, 0.14);
  border-color: rgba(239, 68, 68, 0.3);
}

.shared-chat-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.72rem;
  background: var(--surface-soft);
  border: 1px solid var(--glass-edge-soft);
  color: var(--muted);
  padding: 0.15rem 0.45rem;
  border-radius: 6px;
  margin-left: 0.5rem;
  vertical-align: middle;
  font-weight: 500;
}


/* OneNote Redesign Layout */
.onenote-shell {
  display: flex;
  flex-direction: column;
  height: 100%;
  width: 100%;
  background: #11141c;
  color: #f1f5f9;
  font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, Roboto, sans-serif;
  overflow: hidden;
}

.onenote-header {
  background: #181d28;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  flex-direction: column;
}

.onenote-menu-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 16px;
  background: #5c2d91; /* OneNote Purple */
  height: 38px;
  box-sizing: border-box;
}

.onenote-app-title {
  font-weight: 700;
  font-size: 0.85rem;
  color: #ffffff;
  letter-spacing: 0.02em;
}

.onenote-tabs {
  display: flex;
  gap: 6px;
  height: 100%;
  align-items: flex-end;
}

.onenote-tab-btn {
  background: transparent;
  border: none;
  padding: 5px 14px;
  color: #dcdcdc;
  font-size: 0.82rem;
  cursor: pointer;
  border-top-left-radius: 4px;
  border-top-right-radius: 4px;
  transition: all 0.15s ease;
  height: 28px;
  box-sizing: border-box;
  display: flex;
  align-items: center;
}

.onenote-tab-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
}

.onenote-tab-btn.active {
  background: #1e2533;
  color: #ffffff;
  font-weight: 600;
  border-bottom: 2px solid #ffffff;
}

.onenote-window-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.onenote-share-select {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #fff;
  font-size: 0.75rem;
  padding: 2px 8px;
  border-radius: 4px;
  outline: none;
  cursor: pointer;
}

.onenote-ribbon {
  background: #1e2533;
  padding: 6px 16px;
  min-height: 48px;
  display: flex;
  align-items: center;
  box-sizing: border-box;
}

.ribbon-tab-content {
  display: none;
  align-items: center;
  gap: 12px;
  width: 100%;
}

.ribbon-tab-content.active {
  display: flex;
}

.ribbon-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ribbon-divider {
  width: 1px;
  height: 20px;
  background: rgba(255, 255, 255, 0.12);
}

.ribbon-select {
  background: #12161f;
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 4px;
  padding: 3px 8px;
  font-size: 0.8rem;
  outline: none;
  cursor: pointer;
}

.ribbon-btn {
  background: transparent;
  border: 1px solid transparent;
  color: #d1d5db;
  padding: 4px 10px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.1s ease;
}

.ribbon-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.15);
  color: #ffffff;
}

.ribbon-btn.active {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.3);
  color: #ffffff;
  font-weight: 600;
}

.ribbon-btn-danger:hover {
  background: rgba(239, 68, 68, 0.2);
  border-color: rgba(239, 68, 68, 0.4);
  color: #fca5a5;
}

.font-styles .ribbon-btn {
  font-weight: 500;
  width: 28px;
  height: 28px;
  justify-content: center;
  padding: 0;
}

.font-bold { font-weight: 700 !important; }
.font-italic { font-style: italic; }
.font-underline { text-decoration: underline; }
.font-strike { text-decoration: line-through; }

.onenote-workspace {
  display: flex;
  flex: 1;
  min-height: 0;
  position: relative;
}

/* Left-most Sidebar (Notebooks & Sections) */
.onenote-section-sidebar {
  width: 220px;
  background: #181d28;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  flex-direction: column;
  padding: 12px 0;
  box-sizing: border-box;
}

.notebook-header {
  padding: 0 16px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  margin-bottom: 8px;
}

.notebook-select {
  width: 100%;
  background: transparent;
  border: none;
  color: #ffffff;
  font-weight: 700;
  font-size: 0.85rem;
  outline: none;
  cursor: pointer;
  padding: 4px 0;
}

.sections-container {
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
  flex: 1;
}

.section-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  background: transparent;
  border: none;
  color: #94a3b8;
  font-size: 0.82rem;
  text-align: left;
  cursor: pointer;
  width: 100%;
  transition: all 0.12s ease;
  box-sizing: border-box;
}

.section-item:hover {
  background: rgba(255, 255, 255, 0.04);
  color: #ffffff;
}

.section-item.active {
  background: rgba(255, 255, 255, 0.07);
  color: #ffffff;
  font-weight: 600;
}

.section-tag {
  width: 4px;
  height: 16px;
  border-radius: 2px;
  flex-shrink: 0;
}

.section-title {
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
}

.add-section-btn {
  background: transparent;
  border: none;
  color: #c084fc;
  padding: 10px 16px;
  text-align: left;
  font-size: 0.82rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  transition: color 0.15s ease;
  width: 100%;
  box-sizing: border-box;
}

.add-section-btn:hover {
  color: #e9d5ff;
}

.sections-divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.06);
  margin: 8px 0;
}

.sections-groups {
  padding: 0 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.group-header {
  font-size: 0.76rem;
  color: #64748b;
  font-weight: 600;
  cursor: pointer;
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
  transition: color 0.15s ease;
}

.group-header:hover {
  color: #94a3b8;
}

/* Middle Sidebar (Pages list) */
.onenote-page-sidebar {
  width: 220px;
  background: #1d2331;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  flex-direction: column;
  padding: 12px 0;
  box-sizing: border-box;
}

.add-page-btn {
  margin: 0 12px 12px;
  border: 1px solid #c084fc;
  color: #c084fc;
  background: transparent;
  padding: 7px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 600;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s ease;
}

.add-page-btn:hover {
  background: rgba(192, 132, 252, 0.1);
  color: #e9d5ff;
}

.page-search {
  padding: 0 12px 12px;
}

.page-search input {
  width: 100%;
  background: #12161f;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  padding: 5px 10px;
  color: #ffffff;
  font-size: 0.8rem;
  outline: none;
  box-sizing: border-box;
}

.pages-list {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 0 8px;
}

/* Override whiteboard-page-item */
.onenote-page-sidebar .whiteboard-page-item {
  padding: 8px 12px;
  border-radius: 4px;
  cursor: pointer;
  background: transparent;
  color: #94a3b8;
  transition: all 0.12s ease;
}

.onenote-page-sidebar .whiteboard-page-item:hover {
  background: rgba(255, 255, 255, 0.04);
  color: #ffffff;
}

.onenote-page-sidebar .whiteboard-page-item.active {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
  font-weight: 600;
  border-left: 3px solid #c084fc;
}

/* Main Content Work Area */
.onenote-content-area {
  flex: 1;
  background: #12161f;
  overflow: auto;
  display: flex;
  flex-direction: column;
  position: relative;
}

.onenote-page-container {
  max-width: 900px;
  width: 100%;
  margin: 0 auto;
  padding: 32px 48px;
  display: flex;
  flex-direction: column;
  flex: 1;
  box-sizing: border-box;
}

.onenote-page-header {
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  padding-bottom: 10px;
  margin-bottom: 20px;
}

.onenote-title-input {
  background: transparent;
  border: none;
  outline: none;
  font-size: 2.1rem;
  font-weight: 700;
  color: #ffffff;
  width: 100%;
  font-family: inherit;
  padding: 0;
  margin-bottom: 4px;
}

.onenote-title-input::placeholder {
  color: rgba(255, 255, 255, 0.15);
}

.onenote-page-meta {
  font-size: 0.8rem;
  color: #64748b;
  margin-top: 4px;
}

.onenote-editor-body {
  flex: 1;
  position: relative;
  min-height: 550px;
  background: transparent;
}

.onenote-editor-body #whiteboardTextarea {
  width: 100%;
  height: 100%;
  min-height: 550px;
  background: transparent;
  border: none;
  outline: none;
  resize: none;
  color: #ffffff;
  font-size: 11pt;
  font-family: 'Calibri', sans-serif;
  line-height: 1.5;
  z-index: 1;
  position: relative;
  padding: 0;
}

.onenote-editor-body #whiteboardCanvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 2;
}

.onenote-color-picker {
  background: transparent;
  border: none;
  width: 24px;
  height: 24px;
  padding: 0;
  cursor: pointer;
  border-radius: 4px;
}

.onenote-thickness-slider {
  width: 80px;
  height: 4px;
  cursor: pointer;
}

.onenote-thickness-val {
  font-size: 0.78rem;
  color: #94a3b8;
  min-width: 32px;
}

@media (max-width: 900px) {
  .onenote-workspace {
    flex-direction: column;
  }
  .onenote-section-sidebar,
  .onenote-page-sidebar {
    width: 100%;
    max-height: 180px;
    border-right: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  }
  .onenote-page-container {
    padding: 20px;
  }
}







/* Glassmorphic 2-Pane Notes Layout Styles */
.notes-layout {
  display: flex;
  height: calc(100vh - 90px);
  min-height: 0;
  gap: 12px;
  font-family: 'Manrope', 'Segoe UI', -apple-system, sans-serif;
  color: var(--text);
  box-sizing: border-box;
}

/* Left Sidebar: Categories & Page list */
.notes-sidebar {
  width: 280px;
  min-width: 280px;
  background: var(--bg-1);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--glass-edge-soft);
  border-radius: 20px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-sizing: border-box;
}

.notes-sidebar-header {
  padding: 1.25rem 1.25rem 0.5rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.notes-sidebar-header h3 {
  font-size: 1.2rem;
  margin: 0;
  font-weight: 700;
  color: var(--text);
}

.notes-new-btn {
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text);
  border: 1px solid var(--glass-edge-soft);
  background: rgba(255, 255, 255, 0.05);
  cursor: pointer;
  transition: all 0.2s ease;
}

.notes-new-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: var(--glass-edge);
  transform: scale(1.02);
}

/* Horizontal category section bar */
.notes-sections-bar {
  display: none !important;
}

.notes-sections-tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  flex: 1;
  scrollbar-width: none; /* Firefox */
  box-sizing: border-box;
}

.notes-sections-tabs::-webkit-scrollbar {
  display: none; /* Chrome/Safari */
}

.notes-add-section-btn {
  width: 24px;
  height: 24px;
  min-width: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  color: var(--muted);
  cursor: pointer;
  padding: 0;
}

.notes-sections-tabs .section-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 14px;
  background: var(--surface);
  border: 1px solid var(--glass-edge-soft);
  color: var(--text);
  font-size: 0.76rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
  box-sizing: border-box;
}

.notes-sections-tabs .section-item:hover {
  background: var(--surface-soft);
  border-color: var(--glass-edge);
}

.notes-sections-tabs .section-item.active {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.3);
  color: #fff;
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.05);
  font-weight: 600;
}

.notes-sections-tabs .section-item .section-tag {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

.notes-sections-tabs .section-item .section-title {
  font-size: 0.76rem;
}

/* Page search bar */
.notes-search {
  padding: 0.75rem 1.25rem;
}

.notes-search input {
  width: 100%;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid var(--glass-edge-soft);
  background: rgba(0, 0, 0, 0.15);
  color: var(--text);
  outline: none;
  font-size: 0.82rem;
  box-sizing: border-box;
}

.notes-search input:focus {
  border-color: rgba(255, 255, 255, 0.4);
}

/* Notes Pages Library List */
.notes-list {
  flex: 1;
  overflow-y: auto;
  padding: 0.25rem 1.25rem 1.25rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-sizing: border-box;
}

.notes-list .whiteboard-page-item {
  padding: 14px 16px;
  border-radius: 16px;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.05);
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  gap: 6px;
  box-sizing: border-box;
}

.notes-list .whiteboard-page-item:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.12);
  transform: translateY(-1px);
}

.notes-list .whiteboard-page-item.active {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.2);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}

.notes-list .whiteboard-page-item .page-item-title {
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.notes-list .whiteboard-page-item .page-item-meta {
  font-size: 0.74rem;
  color: var(--muted);
}

.notes-list .whiteboard-page-item .page-item-shared {
  font-size: 0.7rem;
  color: var(--muted);
  font-weight: 500;
  margin-top: 1px;
}

/* Right Workspace: Canvas area */
.notes-main-workspace {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--bg-0);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--glass-edge-soft);
  border-radius: 20px;
  overflow: hidden;
  box-sizing: border-box;
}

.notes-topbar {
  padding: 1.25rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.1);
  box-sizing: border-box;
}

.notes-back-btn {
  display: none;
  background: transparent;
  border: none;
  color: var(--text);
  font-size: 1.5rem;
  font-weight: 500;
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  margin-right: 0.5rem;
  border-radius: 8px;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, transform 0.2s;
}
.notes-back-btn:hover {
  background: var(--surface-soft);
}
.notes-back-btn:active {
  transform: scale(0.95);
}

.notes-title-input {
  font-size: 1.35rem;
  font-weight: 600;
  color: var(--text);
  background: transparent;
  border: none;
  outline: none;
  flex: 1;
  margin-right: 1rem;
  padding: 0;
  box-sizing: border-box;
}

.notes-title-input::placeholder {
  color: var(--muted);
  opacity: 0.5;
}

.notes-save-btn {
  padding: 8px 16px;
  font-size: 0.82rem;
  font-weight: 600;
  border-radius: 10px;
  cursor: pointer;
  border: none;
  transition: all 0.2s ease;
}

/* Canvas workspace and typing area */
.notes-editor-canvas {
  flex: 1;
  position: relative;
  overflow: auto;
  cursor: grab;
  box-sizing: border-box;
}

/* Enable custom grabbing cursor during panning */
.notes-editor-canvas.is-panning {
  cursor: grabbing !important;
  user-select: none;
}

/* Virtual scrollable workspace extension for free-form panning */
.notes-editor-canvas::after {
  content: "";
  display: block;
  position: absolute;
  width: 3200px;
  height: 2400px;
  top: 0;
  left: 0;
  pointer-events: none;
  z-index: -1;
}
/* Minimalist Floating draggable text box */
.floating-text-node {
  position: absolute;
  min-width: 160px;
  min-height: 60px;
  background: transparent;
  border: 1px dashed transparent;
  border-radius: 6px;
  padding: 0;
  box-shadow: none;
  display: flex;
  flex-direction: column;
  transition: border-color 0.15s ease;
  box-sizing: border-box;
  resize: none; /* Disable browser native resize entirely */
  overflow: visible; /* Let custom resize handles sit slightly outside/on the borders */
}

.floating-text-node:hover,
.floating-text-node:focus-within {
  border-color: var(--glass-edge-soft);
  z-index: 10;
  box-shadow: none;
}

/* Drag Handle on top edge of floating box */
.floating-node-drag-handle {
  height: 12px;
  background: rgba(120, 120, 120, 0.08);
  border-top-left-radius: 5px;
  border-top-right-radius: 5px;
  cursor: grab;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.15s ease;
  flex-shrink: 0;
}

.floating-text-node:hover .floating-node-drag-handle,
.floating-text-node:focus-within .floating-node-drag-handle {
  opacity: 1;
}

.floating-node-drag-handle::before {
  content: "";
  display: block;
  width: 16px;
  height: 2px;
  border-top: 1px solid var(--muted);
  border-bottom: 1px solid var(--muted);
  opacity: 0.3;
}

.floating-node-drag-handle:active {
  cursor: grabbing;
}

/* Textarea input inside floating text box */
.floating-node-textarea {
  flex: 1;
  width: 100%;
  height: calc(100% - 12px);
  background: transparent;
  border: none;
  color: var(--text);
  font-size: 0.95rem;
  line-height: 1.4;
  resize: none; /* Disable browser native resize on textarea */
  outline: none;
  font-family: inherit;
  padding: 4px 8px;
  min-height: 48px;
  border-bottom-left-radius: 5px;
  border-bottom-right-radius: 5px;
  box-sizing: border-box;
  overflow: auto; /* Allow scrolling when manual resize makes it smaller than content */
}

.floating-node-textarea:empty::before {
  content: attr(data-placeholder);
  color: var(--muted);
  opacity: 0.5;
  pointer-events: none;
  display: block;
}

/* Custom Resize Handles styling */
.node-resize-handle {
  position: absolute;
  opacity: 0;
  transition: opacity 0.15s ease;
  z-index: 100;
}

.floating-text-node:hover .node-resize-handle,
.floating-text-node:focus-within .node-resize-handle {
  opacity: 1;
}

.handle-r {
  top: 0;
  right: -3px;
  width: 6px;
  height: 100%;
  cursor: ew-resize;
}

.handle-b {
  bottom: -3px;
  left: 0;
  height: 6px;
  width: 100%;
  cursor: ns-resize;
}

.handle-br {
  bottom: 2px;
  right: 2px;
  width: 12px;
  height: 12px;
  cursor: nwse-resize;
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
}

/* Beautiful minimalist diagonal stripes for the corner handle */
.handle-br::after {
  content: "";
  width: 8px;
  height: 8px;
  border-right: 2px solid rgba(255, 255, 255, 0.35);
  border-bottom: 2px solid rgba(255, 255, 255, 0.35);
  border-bottom-right-radius: 2px;
}

/* Global scrollbars style matching the website UI (no Windows default arrows) */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.22);
}

/* Firefox custom scrollbars */


/* Dragging utility class */
body.is-resizing {
  user-select: none !important;
  -webkit-user-select: none !important;
}

/* Floating Text Selection Formatting Toolbar Styles */
.text-format-toolbar {
  position: fixed;
  z-index: 10000;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 10px;
  background: rgba(18, 22, 31, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--glass-edge-soft);
  border-radius: 12px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
  pointer-events: auto;
  transition: opacity 0.15s ease, transform 0.15s ease;
  box-sizing: border-box;
}

.text-format-toolbar.hidden-view {
  opacity: 0;
  transform: translateY(5px) scale(0.95);
  pointer-events: none;
}

.format-btn {
  background: transparent;
  border: none;
  color: #f1f5f9;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
  transition: background 0.12s ease;
  padding: 0;
}

.format-btn:hover {
  background: rgba(255, 255, 255, 0.1);
}

.format-btn.highlight {
  font-size: 0.78rem;
}

.format-select {
  background: rgba(0, 0, 0, 0.3);
  color: #f1f5f9;
  border: 1px solid var(--glass-edge-soft);
  border-radius: 6px;
  padding: 3px 6px;
  font-size: 0.75rem;
  outline: none;
  cursor: pointer;
}

.format-select option {
  background: #181d28;
  color: #f1f5f9;
}

.format-color-picker {
  background: transparent;
  border: none;
  width: 24px;
  height: 24px;
  padding: 0;
  cursor: pointer;
  border-radius: 4px;
  margin-left: 2px;
}

/* Firefox Scrollbars styling using standard spec (wrapped so Chromium ignores it and uses Webkit scrollbars) */
@supports not (selector(::-webkit-scrollbar)) {
  #chatList,
  .conversation,
  .image-scroll,
  .preset-row,
  .friends-scroll,
  .floating-node-textarea,
  .notes-editor-canvas,
  .notes-list,
  .chat-messages {
    scrollbar-width: thin;
  }
  
  /* Default light theme */
  #chatList,
  .conversation,
  .image-scroll,
  .preset-row,
  .friends-scroll {
    scrollbar-color: rgba(120, 126, 140, 0.72) transparent;
  }
  
  /* Dark theme override */
  body.dark #chatList,
  body.dark .conversation,
  body.dark .image-scroll,
  body.dark .preset-row,
  body.dark .friends-scroll,
  body.dark .floating-node-textarea,
  body.dark .notes-editor-canvas,
  body.dark .notes-list,
  body.dark .chat-messages {
    scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
  }
}

/* --- Antigravity Mobile Responsiveness Overrides --- */
@media (max-width: 980px) {
  /* 1. App Shell Grid Override */
  .app-shell {
    grid-template-columns: 1fr !important;
    width: 100vw !important;
    height: 100vh !important;
    margin: 0 !important;
    gap: 0 !important;
  }

  /* 2. Floating Overlay Drawer Sidebar */
  .sidebar {
    position: fixed !important;
    top: 0 !important;
    bottom: 0 !important;
    left: 0 !important;
    width: 270px !important;
    height: 100vh !important;
    z-index: 10000 !important;
    transform: translateX(0) !important;
    transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1) !important;
    border-width: 0 1px 0 0 !important;
    background: var(--bg-1) !important;
    backdrop-filter: blur(20px) !important;
    -webkit-backdrop-filter: blur(20px) !important;
    display: flex !important;
    flex-direction: column !important;
    padding: 1.35rem 1rem 1rem !important;
    gap: 1.1rem !important;
    opacity: 1 !important;
    pointer-events: auto !important;
    overflow: visible !important;
    order: initial !important; /* Reset layout order property to prevent placement bug */
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.4) !important;
  }

  /* Force display sidebar elements on mobile when sidebar is open */
  .sidebar .new-chat,
  .sidebar .sidebar-mode-switch,
  .sidebar .chat-search,
  .sidebar .sidebar-section,
  .sidebar .sidebar-foot,
  .sidebar .brand-block,
  .sidebar .sidebar-search-trigger {
    display: block !important;
    opacity: 1 !important;
    max-height: none !important;
    transform: none !important;
    pointer-events: auto !important;
  }

  .sidebar .sidebar-mode-switch {
    display: grid !important;
  }

  .sidebar .sidebar-foot {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    gap: 0.75rem !important;
  }

  /* When collapsed: slide out sidebar */
  body.sidebar-collapsed .sidebar {
    transform: translateX(-270px) !important;
    pointer-events: none !important;
  }

  /* 3. Sidebar Toggle Button (Inside sidebar when open, hidden when collapsed) */
  .sidebar-toggle {
    position: absolute !important;
    top: 12px !important;
    right: 12px !important;
    z-index: 10001 !important;
    width: 40px !important;
    height: 40px !important;
    border-radius: 12px !important;
    background: rgba(255, 255, 255, 0.08) !important;
    border: 1px solid rgba(255, 255, 255, 0.15) !important;
    color: var(--text) !important;
    display: grid !important;
    place-items: center !important;
    cursor: pointer !important;
    pointer-events: auto !important;
    transform: none !important;
  }

  /* When sidebar is collapsed on mobile, hide the floating toggle arrow since we use the header hamburger menu button */
  body.sidebar-collapsed .sidebar-toggle {
    display: none !important;
  }

  body.sidebar-collapsed .sidebar-toggle-arrow {
    transform: rotate(180deg) !important;
  }

  /* Show hamburger menu button when sidebar is collapsed on mobile */
  body.sidebar-collapsed .toolbar-menu-btn {
    display: inline-flex !important;
  }

  /* 4. Dimmed Blur Backdrop Overlay */
  body:not(.sidebar-collapsed) .main-panel::after {
    content: "" !important;
    position: fixed !important;
    inset: 0 !important;
    background: rgba(0, 0, 0, 0.45) !important;
    backdrop-filter: blur(4px) !important;
    -webkit-backdrop-filter: blur(4px) !important;
    z-index: 9998 !important;
    pointer-events: auto !important;
    animation: antFadeIn 0.2s ease-out !important;
  }

  /* 5. Main Panel & Toolbar Resizing */
  .main-panel {
    width: 100% !important;
    max-width: 100vw !important;
    padding: 0 !important;
    margin: 0 !important;
    order: initial !important; /* Reset layout order property to prevent placement bug */
  }

  .toolbar {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: space-between !important;
    padding: 0.75rem 1rem !important;
    height: 64px !important;
    gap: 0.5rem !important;
  }

  .toolbar-group {
    display: flex !important;
    align-items: center !important;
    min-width: 0 !important;
  }

  body.sidebar-collapsed .toolbar-group {
    transition: padding-left 0.22s ease !important;
  }

  .toolbar-group p,
  .version-badge {
    display: none !important; /* Hide to save horizontal space on mobile */
  }

  .toolbar-actions {
    flex-shrink: 0 !important;
  }

  /* 6. Notes View Mobile Switcher Layout */
  .notes-layout {
    flex-direction: row !important;
    height: calc(100vh - 76px) !important;
    gap: 0 !important;
    padding: 0 !important;
    position: relative !important;
  }

  .notes-sidebar {
    width: 100% !important;
    min-width: 0 !important;
    max-height: none !important;
    border-radius: 0 !important;
    flex: 1 !important;
    display: flex !important;
    border: none !important;
  }

  .notes-main-workspace {
    width: 100% !important;
    height: 100% !important;
    border-radius: 0 !important;
    display: none !important;
    border: none !important;
  }

  /* Switch active panel display using layout classes */
  .notes-layout.show-workspace .notes-sidebar {
    display: none !important;
  }

  .notes-layout.show-workspace .notes-main-workspace {
    display: flex !important;
  }

  .notes-sidebar-header {
    padding: 0.75rem 1rem 0.25rem 1rem !important;
  }

  .notes-sections-bar {
    padding: 0.25rem 1rem 0.5rem 1rem !important;
  }

  .notes-search {
    padding: 0.25rem 1rem !important;
  }

  .notes-list {
    padding: 0.25rem 1rem 0.75rem 1rem !important;
  }

  /* Show notes back button on mobile workspace */
  .notes-back-btn {
    display: inline-flex !important;
  }

  /* 7. Friends View Responsive Rules */
  .friends-main {
    padding: 1rem !important;
  }

  .friends-metrics-bar {
    flex-wrap: wrap !important;
    gap: 1rem !important;
    padding: 0.75rem 1rem !important;
  }

  @media (max-width: 520px) {
    .friends-metrics-bar {
      flex-direction: column !important;
      align-items: stretch !important;
    }
    .metric-divider {
      display: none !important;
    }
    .friends-header {
      flex-direction: column !important;
      align-items: stretch !important;
      gap: 1rem !important;
    }
    .friends-header-right button {
      width: 100% !important;
    }
  }

  /* 8. Extra Mobile Spacing Fixes */
  .friends-add-form {
    flex-direction: column !important;
    gap: 0.5rem !important;
  }

  .friends-add-form button {
    width: 100% !important;
  }

  .onboarding-modal {
    padding: 1.25rem !important;
  }

  .settings-modal {
    min-height: 0 !important;
    max-height: calc(100vh - 2rem) !important;
    overflow-y: auto !important;
  }
}

@keyframes antFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Composer Plus Button & File Upload styles */
.composer-icon {
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), color 0.2s, background-color 0.2s;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.composer-icon:hover {
  color: var(--text) !important;
  transform: rotate(90deg) scale(1.08);
}

.composer-icon:active {
  transform: rotate(90deg) scale(0.92);
}

.composer-icon.uploading {
  animation: composerSpin 1.2s linear infinite !important;
  pointer-events: none;
  color: #5e8dff !important;
}

@keyframes composerSpin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.composer-attachments {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 6px 4px 10px;
  border-bottom: 1px solid var(--glass-edge-soft);
  margin-bottom: 4px;
}

.attachment-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.03);
  border: 1px solid var(--glass-edge-soft);
  color: var(--text);
  font-size: 0.82rem;
  max-width: 200px;
  transition: all 0.2s;
}

body.dark .attachment-pill {
  background: rgba(255, 255, 255, 0.04);
}

.attachment-pill .attachment-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.attachment-pill.loading {
  opacity: 0.7;
}

.attachment-remove {
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  padding: 0;
  line-height: 1;
  transition: color 0.2s;
}

.attachment-remove:hover {
  color: #ff5e5e;
}

.attachment-spinner {
  width: 12px;
  height: 12px;
  border: 2px solid rgba(128, 128, 128, 0.2);
  border-top: 2px solid var(--text);
  border-radius: 50%;
  animation: attachmentSpin 0.8s linear infinite;
}

@keyframes attachmentSpin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.credits-alert-banner {
  position: absolute;
  top: 4.8rem;
  left: 50%;
  transform: translateX(-50%);
  width: auto;
  max-width: calc(100% - 2rem);
  display: flex;
  justify-content: center;
  pointer-events: none;
  z-index: 100;
}

.credits-alert-banner > div {
  pointer-events: auto;
}

@media (min-width: 981px) {
  .main-panel {
    overflow: visible;
  }
}

/* Add extra padding to the top of active chats when the banner is visible to prevent first message overlap */
#creditsAlertBanner:not(.hidden-view) + #chatView .conversation {
  padding-top: 5.5rem !important;
}

/* Hide the banner in non-chat/non-image views */
.main-panel.notes-mode #creditsAlertBanner,
.main-panel.friends-mode #creditsAlertBanner {
  display: none !important;
}

/* ==========================================================================
   LANDING PAGE STYLES (Unauthenticated state)
   ========================================================================== */

/* Hide landing page by default when authenticated */
.landing-page {
  display: none !important;
}

/* Show landing page only when auth-locked */
body.auth-locked .landing-page {
  display: block !important;
  width: 100%;
  min-height: 100vh;
  background: #09090b;
  color: #fafafa;
  font-family: 'Inter', system-ui, sans-serif;
  overflow-y: visible;
  position: relative;
  z-index: 5;
}

/* Lock background scroll when modal is open */
body.auth-locked.modal-open {
  overflow: hidden;
}

/* Landing Page Container */
.landing-container {
  width: min(1200px, calc(100% - 3rem));
  margin: 0 auto;
}

/* Nav Bar */
.landing-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 70px;
  z-index: 100;
  display: flex;
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(9, 9, 11, 0.65);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.landing-nav-container {
  width: min(1200px, calc(100% - 3rem));
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.landing-logo {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  text-decoration: none;
  color: #fff;
  font-weight: 700;
  font-size: 1.15rem;
}

.landing-logo img {
  width: 32px;
  height: 32px;
  object-fit: contain;
}

.landing-nav-links {
  display: flex;
  align-items: center;
  gap: 2rem;
}

.landing-nav-links a {
  color: #a1a1aa;
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 500;
  transition: color 0.2s ease;
}

.landing-nav-links a:hover {
  color: #fff;
}

.landing-btn-login {
  padding: 0.45rem 1.25rem;
  font-size: 0.88rem;
  font-weight: 600;
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.landing-btn-login:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.25);
  transform: translateY(-1px);
}

/* Hero Section */
.landing-hero {
  padding-top: 170px;
  padding-bottom: 100px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.hero-title {
  font-size: clamp(2.2rem, 5vw, 3.8rem);
  font-weight: 850;
  line-height: 1.15;
  letter-spacing: -0.02em;
  max-width: 900px;
  margin: 0 auto 1.5rem;
  color: #fff;
}

.text-gradient {
  background: linear-gradient(135deg, #fff 30%, #a1a1aa 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-subtitle {
  font-size: clamp(1rem, 2.2vw, 1.25rem);
  color: #a1a1aa;
  line-height: 1.6;
  max-width: 650px;
  margin: 0 auto 2.5rem;
}

.hero-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.2rem;
  flex-wrap: wrap;
}

.landing-btn-primary {
  padding: 0.78rem 1.8rem;
  font-size: 0.95rem;
  font-weight: 700;
  color: #09090b;
  background: #fff;
  border: none;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 4px 20px rgba(255, 255, 255, 0.15);
}

.landing-btn-primary:hover {
  background: #f4f4f5;
  transform: translateY(-2px);
  box-shadow: 0 6px 25px rgba(255, 255, 255, 0.22);
}

.landing-btn-secondary {
  padding: 0.78rem 1.8rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: #fff;
  text-decoration: none;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.landing-btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.18);
  transform: translateY(-2px);
}

/* Sections Common */
.landing-features,
.landing-pricing {
  padding: 100px 0;
  position: relative;
}

.section-title {
  font-size: clamp(1.8rem, 4vw, 2.5rem);
  font-weight: 800;
  text-align: center;
  margin-bottom: 0.8rem;
  letter-spacing: -0.01em;
}

.section-subtitle {
  font-size: 1.05rem;
  color: #71717a;
  text-align: center;
  margin-bottom: 4rem;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

/* Features Grid */
.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.8rem;
}

.feature-card {
  padding: 2.2rem;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.05);
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.feature-card:hover {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.12);
  transform: translateY(-4px);
}

.feature-icon {
  font-size: 2.2rem;
  margin-bottom: 1.2rem;
}

.feature-card h3 {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 0.6rem;
  color: #fff;
}

.feature-card p {
  font-size: 0.92rem;
  color: #a1a1aa;
  line-height: 1.55;
  margin: 0;
}

/* Pricing Grid */
.pricing-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  max-width: 1040px;
  margin: 0 auto;
  align-items: stretch;
}
@media (max-width: 950px) {
  .pricing-grid {
    grid-template-columns: 1fr;
    max-width: 380px;
    gap: 2rem;
  }
}

.pricing-card {
  position: relative;
  padding: 3rem 2.5rem;
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  flex-direction: column;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.pricing-card.pro {
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.pricing-card:hover {
  transform: translateY(-4px);
}

.pricing-card.pro:hover {
  border-color: rgba(255, 255, 255, 0.22);
}

.pro-badge-glow {
  position: absolute;
  top: 1.2rem;
  right: 1.5rem;
  background: #fafafa;
  color: #09090b;
  font-size: 0.72rem;
  font-weight: 750;
  text-transform: uppercase;
  padding: 0.25rem 0.75rem;
  border-radius: 99px;
  letter-spacing: 0.04em;
}

.pricing-tier-name {
  font-size: 1.45rem;
  font-weight: 800;
  margin-bottom: 1rem;
  color: #fff;
}

.pricing-price {
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
  margin-bottom: 1rem;
}

.price-amount {
  font-size: 2.8rem;
  font-weight: 850;
  color: #fff;
  letter-spacing: -0.02em;
}

.price-period {
  font-size: 0.95rem;
  color: #71717a;
}

.pricing-desc {
  font-size: 0.92rem;
  color: #a1a1aa;
  line-height: 1.5;
  margin-bottom: 2rem;
  min-height: 42px;
}

.pricing-features {
  list-style: none;
  padding: 0;
  margin: 0 0 2.5rem 0;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  flex-grow: 1;
}

.pricing-features li {
  font-size: 0.92rem;
  color: #d4d4d8;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.pricing-features li::before {
  content: "✓";
  color: #fafafa;
  font-weight: bold;
}

.pricing-btn {
  width: 100%;
  padding: 0.75rem;
  font-size: 0.92rem;
  font-weight: 700;
  border-radius: 99px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
  cursor: pointer;
  transition: all 0.2s ease;
}

.pricing-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.2);
}

.pricing-btn.btn-pro {
  background: #fff;
  color: #09090b;
  border: none;
}

.pricing-btn.btn-pro:hover {
  background: #e4e4e7;
}

/* Footer */
.landing-footer {
  padding: 3rem 0;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  text-align: center;
}

.footer-copy {
  font-size: 0.85rem;
  color: #52525b;
  margin: 0;
}

/* Modals Override for Auth Gate */
body.auth-locked .auth-gate {
  position: fixed;
  inset: 0;
  background: rgba(9, 9, 11, 0.72);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

body.auth-locked .auth-gate:not(.hidden-auth-gate) {
  opacity: 1;
  pointer-events: auto;
}

.auth-close-btn {
  position: absolute;
  top: 1.2rem;
  right: 1.2rem;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  font-size: 1.1rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  z-index: 10;
}

.auth-close-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.25);
  transform: scale(1.05);
}

/* Mobile Responsiveness for Landing Page */
@media (max-width: 768px) {
  .landing-nav-links {
    display: none;
  }
  .landing-hero {
    padding-top: 130px;
    padding-bottom: 70px;
  }
  .landing-features,
  .landing-pricing {
    padding: 60px 0;
  }
}

/* Hero Badge Pill */
.hero-logo-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.4rem 1rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 99px;
  margin-bottom: 2rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.hero-logo-badge:hover {
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(255, 255, 255, 0.15);
  transform: translateY(-1px);
}
.hero-logo-badge img {
  width: 18px;
  height: 18px;
  object-fit: contain;
}
.hero-logo-badge span {
  font-size: 0.78rem;
  font-weight: 600;
  color: #d4d4d8;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

/* 3D Floating Hero Preview Mockup */
.hero-preview {
  margin-top: 4.5rem;
  position: relative;
  width: 100%;
  max-width: 1000px;
  margin-left: auto;
  margin-right: auto;
  perspective: 1200px;
  z-index: 10;
}
.hero-preview::before {
  content: "";
  position: absolute;
  top: 10%;
  left: 10%;
  width: 80%;
  height: 80%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.04) 0%, transparent 70%);
  filter: blur(80px);
  pointer-events: none;
  z-index: -1;
}
.hero-preview img {
  width: 100%;
  height: auto;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.7), 0 0 100px rgba(255, 255, 255, 0.015);
  transform: rotateX(6deg) rotateY(-2deg) rotateZ(0.5deg);
  transform-style: preserve-3d;
  transition: all 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}
.hero-preview:hover img {
  transform: rotateX(0deg) rotateY(0deg) rotateZ(0deg) scale(1.02);
  border-color: rgba(255, 255, 255, 0.2);
  box-shadow: 0 35px 80px rgba(0, 0, 0, 0.8), 0 0 120px rgba(255, 255, 255, 0.03);
}

/* Three Pricing Tiers Adjustments */
.pricing-card.plus {
  border-color: rgba(148, 163, 184, 0.12); /* Silver tint */
}
.pricing-card.premium {
  border-color: rgba(234, 179, 8, 0.18); /* Gold tint */
  background: rgba(234, 179, 8, 0.015);
  box-shadow: 0 15px 40px rgba(234, 179, 8, 0.03);
}
.pricing-card.plus:hover {
  border-color: rgba(148, 163, 184, 0.3);
  box-shadow: 0 15px 40px rgba(148, 163, 184, 0.05);
}
.pricing-card.premium:hover {
  border-color: rgba(234, 179, 8, 0.4);
  box-shadow: 0 20px 50px rgba(234, 179, 8, 0.07);
}

/* Badges for Plus and Premium */
.pro-badge-glow.silver {
  background: linear-gradient(135deg, #e2e8f0, #cbd5e1);
  color: #0f172a;
  box-shadow: 0 0 12px rgba(226, 232, 240, 0.3);
}
.pro-badge-glow.gold {
  background: linear-gradient(135deg, #fef08a, #eab308);
  color: #09090b;
  box-shadow: 0 0 15px rgba(234, 179, 8, 0.45);
}

/* Dynamic settings badge */
.pro-badge.silver {
  background: linear-gradient(135deg, #e2e8f0, #cbd5e1) !important;
  color: #0f172a !important;
  font-weight: 700;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
}
.pro-badge.gold {
  background: linear-gradient(135deg, #fef08a, #eab308) !important;
  color: #09090b !important;
  font-weight: 750;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  box-shadow: 0 0 8px rgba(234, 179, 8, 0.3);
}

/* Buttons in Pricing Cards */
.pricing-btn.btn-plus {
  background: linear-gradient(135deg, #e2e8f0, #cbd5e1);
  color: #0f172a;
  border: none;
  font-weight: 700;
}
.pricing-btn.btn-plus:hover {
  background: linear-gradient(135deg, #cbd5e1, #94a3b8);
  box-shadow: 0 4px 15px rgba(226, 232, 240, 0.25);
  transform: translateY(-1px);
}
.pricing-btn.btn-premium {
  background: linear-gradient(135deg, #fef08a, #eab308);
  color: #09090b;
  border: none;
  font-weight: 750;
  box-shadow: 0 4px 15px rgba(234, 179, 8, 0.2);
}
.pricing-btn.btn-premium:hover {
  background: linear-gradient(135deg, #eab308, #ca8a04);
  box-shadow: 0 6px 20px rgba(234, 179, 8, 0.4);
  transform: translateY(-1px);
}

/* HTML Scroll behavior & Transitions */
html {
  scroll-behavior: smooth;
}
.landing-page a {
  transition: all 0.25s ease;
}
.pricing-card, .feature-card {
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Tabbed / Dedicated Pricing View */
#landingPage.show-pricing .landing-hero,
#landingPage.show-pricing .landing-features {
  display: none !important;
}

#landingPage:not(.show-pricing) .landing-pricing {
  display: none !important;
}

#landingPage.show-pricing .landing-pricing {
  display: block !important;
  padding-top: 140px;
  min-height: calc(100vh - 80px);
}

/* Image Edit Section Styles */
.image-edit-container {
  display: flex;
  gap: 0.75rem;
  align-items: stretch;
  margin-bottom: 1.5rem;
}

.image-edit-preview-box {
  width: 220px;
  height: 132px;
  flex-shrink: 0;
  border-radius: 18px;
  border: 1px dashed rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.03);
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.2s, background-color 0.2s;
}

body:not(.dark) .image-edit-preview-box {
  border: 1px dashed rgba(0, 0, 0, 0.15);
  background: rgba(0, 0, 0, 0.02);
}

.image-edit-preview-box.drag-over {
  border-color: #6366f1;
  background: rgba(99, 102, 241, 0.1);
}

.image-edit-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 0.5rem;
  color: rgba(246, 247, 248, 0.6);
  font-size: 0.75rem;
  width: 100%;
  height: 100%;
}

body:not(.dark) .image-edit-placeholder {
  color: rgba(9, 9, 11, 0.6);
}

.image-edit-placeholder .icon {
  font-size: 1.6rem;
  margin-bottom: 0.25rem;
}

.image-edit-placeholder p {
  margin: 0 0 0.5rem 0;
  line-height: 1.2;
}

.image-edit-placeholder .upload-btn {
  padding: 0.25rem 0.6rem;
  font-size: 0.75rem;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  cursor: pointer;
  color: inherit;
}

body:not(.dark) .image-edit-placeholder .upload-btn {
  background: rgba(0, 0, 0, 0.05);
  border: 1px solid rgba(0, 0, 0, 0.1);
}

.image-edit-preview-box img.preview-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 18px;
}

.image-edit-remove-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.6);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  cursor: pointer;
  z-index: 2;
  transition: background 0.2s, transform 0.2s;
}

.image-edit-remove-btn:hover {
  background: rgba(220, 38, 38, 0.9);
  transform: scale(1.1);
}

/* Adjust preset row scroll when uploader is present */
.image-edit-container .preset-row {
  flex-grow: 1;
  padding-bottom: 0.15rem;
}

/* Highlight the active mode / uploader preview if image is selected */
.image-edit-preview-box.has-image {
  border: 1px solid rgba(255, 255, 255, 0.3);
}

body:not(.dark) .image-edit-preview-box.has-image {
  border: 1px solid rgba(0, 0, 0, 0.2);
}

/* Responsive adjustment */
@media (max-width: 768px) {
  .image-edit-container {
    flex-direction: column;
    align-items: stretch;
  }
  .image-edit-preview-box {
    width: 100%;
    height: 110px;
  }
}

/* Custom Image Form Layout Adjustments */
#imageForm {
  grid-template-columns: minmax(112px, 150px) minmax(0, 1fr) auto auto;
}
#imageEditForm {
  grid-template-columns: auto minmax(0, 1fr) auto auto;
}

@media (max-width: 768px) {
  #imageForm {
    grid-template-columns: 1fr auto auto;
  }
  #imageEditForm {
    grid-template-columns: auto 1fr auto auto;
  }
}

/* Attachment and Enhance buttons inside image-create forms */
.attach-btn,
.enhance-btn {
  background: transparent;
  border: none;
  font-size: 1.25rem;
  color: var(--muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  transition: background-color 0.2s, color 0.2s, transform 0.2s;
  padding: 0;
  outline: none;
}

.attach-btn:hover,
.enhance-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
}

.attach-btn:active,
.enhance-btn:active {
  transform: scale(0.92);
}

body:not(.dark) .attach-btn:hover,
body:not(.dark) .enhance-btn:hover {
  background: rgba(18, 20, 24, 0.06);
}

/* Spinner / Loading state for enhance button */
.enhance-btn.loading {
  animation: composerSpin 1.2s linear infinite;
  pointer-events: none;
  opacity: 0.7;
}

/* Attachment Preview Container & Chips */
.attachment-preview-container {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0.2rem 0.5rem 0.5rem;
}

.attachment-preview-container:empty {
  display: none;
}

.attachment-preview-chip {
  position: relative;
  width: 54px;
  height: 54px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(0, 0, 0, 0.2);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  animation: antFadeIn 0.25s ease-out;
}

.attachment-preview-chip img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.attachment-remove-btn {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.6);
  border: none;
  color: #fff;
  font-size: 10px;
  line-height: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s;
  padding: 0;
}

.attachment-remove-btn:hover {
  background: rgba(255, 59, 48, 0.9);
}

body:not(.dark) .attachment-preview-chip {
  border-color: rgba(18, 20, 24, 0.15);
  background: rgba(255, 255, 255, 0.8);
}

/* Style Edit Tabs */
.edit-nav-tabs {
  display: flex;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 20px;
  padding: 2px;
  gap: 2px;
}

body:not(.dark) .edit-nav-tabs {
  background: rgba(0, 0, 0, 0.05);
}

.edit-nav-tab {
  background: transparent;
  border: none;
  color: var(--muted);
  padding: 0.4rem 1rem;
  border-radius: 18px;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
  transition: all 0.2s ease;
}

.edit-nav-tab:hover {
  color: var(--text);
}

.edit-nav-tab.active {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

body:not(.dark) .edit-nav-tab.active {
  background: #fff;
  color: #111216;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

/* Edit Workspace Layout */
.edit-workspace {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  margin-bottom: 1.5rem;
  align-items: stretch;
}

@media (max-width: 768px) {
  .edit-workspace {
    grid-template-columns: 1fr;
  }
}

.workspace-panel {
  display: flex;
  flex-direction: column;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 18px;
  padding: 1rem;
  min-height: 300px;
  position: relative;
}

body:not(.dark) .workspace-panel {
  background: rgba(0, 0, 0, 0.015);
  border-color: rgba(0, 0, 0, 0.08);
}

.panel-title {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin-bottom: 0.75rem;
  font-weight: 700;
}

.panel-content {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  border-radius: 12px;
}

.workspace-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: var(--muted);
  border: 2px dashed rgba(255, 255, 255, 0.1);
  width: 100%;
  height: 100%;
  border-radius: 12px;
  padding: 1.5rem;
}

body:not(.dark) .workspace-placeholder {
  border-color: rgba(0, 0, 0, 0.1);
}

.workspace-placeholder .icon {
  font-size: 2.2rem;
  margin-bottom: 0.5rem;
  opacity: 0.6;
}

.workspace-placeholder p {
  margin: 0;
  font-size: 0.85rem;
}

/* Image styles in workspace */
.workspace-image {
  max-width: 100%;
  max-height: 400px;
  object-fit: contain;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

/* Result Workspace overlay actions */
.workspace-image-actions {
  position: absolute;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 0.5rem;
  background: rgba(0, 0, 0, 0.6);
  padding: 4px;
  border-radius: 20px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.workspace-image-actions .glass-btn {
  background: transparent;
  border: none;
  color: #fff;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.4rem 0.8rem;
  border-radius: 16px;
  cursor: pointer;
  transition: background-color 0.2s;
}

.workspace-image-actions .glass-btn:hover {
  background: rgba(255, 255, 255, 0.15);
}

/* Workspace Loading / Spinner */
.workspace-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  color: var(--text);
}

.workspace-loading .prompt-preview {
  font-size: 0.78rem;
  color: var(--muted);
  max-width: 200px;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-style: italic;
}

.workspace-error {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #ff4d4f;
  text-align: center;
  gap: 0.5rem;
}

.workspace-error .icon {
  font-size: 2rem;
}

.hidden-pane {
  display: none !important;
}



