/* ==========================================================================
   Nexus Unified Design System — Carbon & Paper
   Shared across Studio, PDF & Media, Whiteboard, Education & Marketing
   ========================================================================== */

:root {
  --nx-bg: #0E0E0D;
  --nx-sidebar: #131311;
  --nx-header: rgba(19, 19, 17, 0.88);
  --nx-surface: #171715;
  --nx-elev: #201F1C;
  --nx-elev-hover: #292824;
  --nx-canvas: #0A0A09;
  --nx-code: #080807;
  --nx-border: rgba(243, 240, 232, 0.09);
  --nx-border-strong: rgba(243, 240, 232, 0.19);
  --nx-fg: #F3F0E8;
  --nx-fg-body: #D6D2C7;
  --nx-fg-muted: #938E82;
  --nx-fg-faint: #68645B;
  --nx-accent: #C8935A;
  --nx-accent-hover: #D8A46C;
  --nx-accent-soft: rgba(200, 147, 90, 0.14);
  --nx-primary-bg: #F3F0E8;
  --nx-primary-fg: #0E0E0D;
  --nx-success: #34D399;
  --nx-danger: #F87171;
  --nx-radius-sm: 8px;
  --nx-radius-md: 11px;
  --nx-radius-lg: 16px;

  /* Map page-level legacy variables onto unified Carbon & Paper tokens */
  --bg-app: var(--nx-bg);
  --bg-sidebar: var(--nx-sidebar);
  --bg-header: var(--nx-header);
  --bg-panel: var(--nx-surface);
  --bg-subtle: var(--nx-elev);
  --bg-subtle-hover: var(--nx-elev-hover);
  --bg-canvas: var(--nx-canvas);
  --bg-code: var(--nx-code);
  --border-subtle: var(--nx-border);
  --text-strong: var(--nx-fg);
  --text-body: var(--nx-fg-body);
  --text-muted: var(--nx-fg-muted);
  --text-faint: var(--nx-fg-faint);
  --aurora: none;

  /* Media / PDF Studio variables */
  --bg-root: var(--nx-bg);
  --bg-rail: var(--nx-sidebar);
  --bg-stage: var(--nx-canvas);
  --border: var(--nx-border);
  --border-strong: var(--nx-border-strong);
  --ink-strong: var(--nx-fg);
  --ink-body: var(--nx-fg-body);
  --ink-muted: var(--nx-fg-muted);
  --accent: var(--nx-accent);
  --accent-soft: var(--nx-accent-soft);

  /* Education variables */
  --bg-main: var(--nx-bg);
  --bg-card: var(--nx-surface);
  --text-main: var(--nx-fg);
  --input-bg: var(--nx-elev);

  color-scheme: dark;
}

html[data-theme="light"] {
  --nx-bg: #F6F4EE;
  --nx-sidebar: #EEEAE0;
  --nx-header: rgba(246, 244, 238, 0.90);
  --nx-surface: #FFFFFF;
  --nx-elev: #E8E3D7;
  --nx-elev-hover: #DDD7C8;
  --nx-canvas: #FCFBF8;
  --nx-code: #F0ECE2;
  --nx-border: rgba(23, 22, 20, 0.10);
  --nx-border-strong: rgba(23, 22, 20, 0.22);
  --nx-fg: #171614;
  --nx-fg-body: #32302B;
  --nx-fg-muted: #645F55;
  --nx-fg-faint: #8A8478;
  --nx-accent: #9A5B25;
  --nx-accent-hover: #814A1C;
  --nx-accent-soft: rgba(154, 91, 37, 0.11);
  --nx-primary-bg: #171614;
  --nx-primary-fg: #F6F4EE;
  --nx-success: #059669;
  --nx-danger: #DC2626;
  color-scheme: light;
}

html, body {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif !important;
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
}

.font-serif-editorial, .font-editorial {
  font-family: 'Instrument Serif', Georgia, serif !important;
}

.font-mono-code, .font-mono-tech, code, pre, kbd {
  font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace !important;
}

/* Enforce readable minimum UI type floor (eliminate 9px–10px squint text) */
.text-\[9px\], .text-\[10px\] {
  font-size: 11.5px !important;
  line-height: 1.35 !important;
}
.text-\[11px\] {
  font-size: 12px !important;
  line-height: 1.45 !important;
}

/* Remove neon aurora backgrounds */
.aurora-bg {
  background-image: none !important;
  background-color: var(--nx-bg) !important;
}

/* Unified buttons & interactive controls */
.nx-btn-primary {
  background: var(--nx-primary-bg) !important;
  color: var(--nx-primary-fg) !important;
  border: 1px solid transparent !important;
  border-radius: var(--nx-radius-sm);
  font-weight: 600;
  transition: opacity 0.16s ease, transform 0.16s ease;
}
.nx-btn-primary:hover {
  opacity: 0.90;
}

.nx-btn-ghost, .theme-surface, .studio-btn {
  background: var(--nx-elev) !important;
  border: 1px solid var(--nx-border) !important;
  color: var(--nx-fg-body) !important;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.nx-btn-ghost:hover, .theme-surface:hover, .studio-btn:hover {
  background: var(--nx-elev-hover) !important;
  border-color: var(--nx-border-strong) !important;
  color: var(--nx-fg) !important;
}

.nx-nav-active, .studio-btn-active {
  background: var(--nx-accent-soft) !important;
  border: 1px solid var(--nx-accent) !important;
  color: var(--nx-fg) !important;
  font-weight: 600;
}

/* Calm neutral overrides for former neon accents across all panels & modals */
.bg-violet-600, .bg-indigo-600, .bg-purple-600,
.bg-sky-600, .bg-blue-600, .bg-emerald-600,
.bg-teal-600, .bg-fuchsia-600, .bg-amber-600, .bg-cyan-600 {
  background-color: var(--nx-primary-bg) !important;
  color: var(--nx-primary-fg) !important;
}
.bg-violet-600:hover, .bg-indigo-600:hover, .bg-purple-600:hover,
.bg-sky-600:hover, .bg-blue-600:hover, .bg-emerald-600:hover,
.bg-teal-600:hover, .bg-fuchsia-600:hover, .bg-amber-600:hover, .bg-cyan-600:hover {
  opacity: 0.90;
}
.bg-violet-500\/15, .bg-indigo-500\/15, .bg-fuchsia-500\/15, .bg-violet-600\/20, .bg-indigo-600\/20,
.bg-sky-500\/15, .bg-sky-500\/10, .bg-blue-500\/15, .bg-blue-500\/10,
.bg-emerald-500\/15, .bg-emerald-500\/10, .bg-teal-500\/15,
.bg-amber-500\/15, .bg-amber-500\/10, .bg-rose-500\/15, .bg-cyan-500\/15,
.bg-emerald-100, .bg-rose-100, .bg-sky-100, .bg-amber-100,
.bg-emerald-950\/50, .bg-amber-950\/70, .bg-rose-950\/70 {
  background-color: color-mix(in srgb, var(--nx-fg) 6%, transparent) !important;
}
.text-violet-300, .text-violet-400, .text-violet-500,
.text-indigo-300, .text-indigo-400, .text-fuchsia-400,
.text-sky-300, .text-sky-400, .text-sky-500,
.text-blue-300, .text-blue-400, .text-blue-500,
.text-emerald-300, .text-emerald-400, .text-emerald-500, .text-emerald-800,
.text-teal-300, .text-teal-400,
.text-amber-200, .text-amber-300, .text-amber-400, .text-amber-500,
.text-rose-200, .text-rose-300, .text-rose-800 {
  color: var(--nx-fg-body) !important;
}
.border-violet-500\/30, .border-violet-500\/25, .border-indigo-500\/30, .border-indigo-500\/40,
.border-fuchsia-500\/30, .border-sky-500\/30, .border-sky-500\/25,
.border-blue-500\/30, .border-blue-500\/25, .border-emerald-500\/30, .border-emerald-500\/25,
.border-amber-500\/30, .border-amber-500\/40, .border-amber-700\/40,
.border-rose-500\/30, .border-rose-700\/40, .border-emerald-700\/40 {
  border-color: var(--nx-border) !important;
}
.accent-violet-500, .accent-indigo-500, .accent-sky-500, .accent-emerald-500 {
  accent-color: var(--nx-primary-bg) !important;
}
.from-indigo-600, .from-violet-600, .from-purple-600, .from-sky-600, .from-emerald-600 {
  background-image: none !important;
  background-color: var(--nx-elev) !important;
  color: var(--nx-fg) !important;
  border: 1px solid var(--nx-border) !important;
}
.theme-input:focus, .edu-input:focus, .studio-input:focus {
  outline: none !important;
  border-color: var(--nx-accent) !important;
  box-shadow: 0 0 0 2px var(--nx-accent-soft) !important;
}

/* Crisp SVG icon alignment */
.nx-icon {
  width: 15px;
  height: 15px;
  stroke-width: 1.75;
  flex-shrink: 0;
  display: inline-block;
  vertical-align: -2px;
}

/* Embedded surface mode: eliminate duplicate chrome when PDF/Media or Whiteboard runs inside Studio */
html.is-embedded #media-top-header,
body.is-embedded #media-top-header {
  display: none !important;
}
html.is-embedded #wb-standalone-brand,
html.is-embedded #wb-home-link,
body.is-embedded #wb-standalone-brand,
body.is-embedded #wb-home-link {
  display: none !important;
}

/* ==========================================================================
   Multi-Device Ergonomics: iPhone · Galaxy S24/S25 Ultra · Foldables · iPad · Desktop
   ========================================================================== */
:root {
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

/* Use dynamic viewport height (100dvh) so mobile URL bars & gesture bars never clip toolbars */
body.h-screen {
  height: 100vh;
  height: 100dvh !important;
  max-width: 100vw;
  overflow-x: hidden;
}

button, a, select, summary, [role="button"] {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

/* Smooth horizontal touch pill scrollers without ugly scrollbars */
.nx-scroll-strip {
  display: flex;
  align-items: center;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  white-space: nowrap;
}
.nx-scroll-strip::-webkit-scrollbar {
  display: none;
}
.nx-scroll-strip > * {
  flex-shrink: 0;
}

/* Studio Off-Canvas Drawer & Mobile Bottom Dock defaults (Desktop >= 1024px) */
#mobile-menu-btn,
#mobile-sidebar-close-btn {
  display: none;
}

#studio-sidebar-backdrop,
#media-rail-backdrop,
#copilot-backdrop {
  position: fixed;
  inset: 0;
  z-index: 58;
  background: rgba(8, 8, 7, 0.62);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

#copilot-backdrop {
  z-index: 64;
}

#mobile-bottom-nav {
  display: none;
}

/* Tablet & Mobile (< 1024px): Slide-Over Navigation Drawers + Slide-Over Copilot */
@media (max-width: 1023px) {
  #mobile-menu-btn,
  #mobile-sidebar-close-btn {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
  }

  #studio-sidebar {
    position: fixed !important;
    top: 0;
    bottom: 0;
    left: 0;
    width: min(85vw, 304px) !important;
    max-width: 304px;
    z-index: 60;
    padding-top: var(--safe-top);
    padding-bottom: var(--safe-bottom);
    transform: translate3d(-105%, 0, 0);
    transition: transform 0.24s cubic-bezier(0.22, 1, 0.36, 1);
    box-shadow: none;
  }

  body.sidebar-open #studio-sidebar {
    transform: translate3d(0, 0, 0);
    box-shadow: 20px 0 56px rgba(0, 0, 0, 0.62);
  }

  body.sidebar-open #studio-sidebar-backdrop {
    opacity: 1;
    pointer-events: auto;
  }

  body.copilot-open #copilot-backdrop {
    opacity: 1;
    pointer-events: auto;
  }

  #copilot-drawer {
    position: fixed !important;
    top: calc(58px + var(--safe-top));
    right: 12px;
    bottom: calc(12px + var(--safe-bottom));
    left: auto;
    width: min(92vw, 384px) !important;
    height: auto !important;
    z-index: 65;
    background: var(--nx-surface) !important;
    border: 1px solid var(--nx-border-strong) !important;
    border-radius: 20px;
    padding: 14px 16px !important;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.58);
  }

  .nx-desktop-only {
    display: none !important;
  }

  /* Media Studio left gallery drawer on phones & portrait tablets */
  #media-gallery-rail {
    position: fixed !important;
    top: 0;
    bottom: 0;
    left: 0;
    width: min(84vw, 290px) !important;
    z-index: 60;
    padding-top: var(--safe-top);
    padding-bottom: var(--safe-bottom);
    transform: translate3d(-105%, 0, 0);
    transition: transform 0.22s cubic-bezier(0.22, 1, 0.36, 1);
  }

  body.media-rail-open #media-gallery-rail {
    display: flex !important;
    transform: translate3d(0, 0, 0);
    box-shadow: 18px 0 48px rgba(0, 0, 0, 0.62);
  }

  body.media-rail-open #media-rail-backdrop {
    opacity: 1;
    pointer-events: auto;
  }
}

/* Phones (< 768px — Galaxy S24/S25 Ultra, iPhone 15/16/17 Pro, Pixel, Xiaomi) */
@media (max-width: 767px) {
  /* Prevent forced browser zoom when focusing inputs on iOS Safari & mobile WebKit */
  input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]),
  input[class]:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]),
  select,
  select[class],
  textarea,
  textarea[class] {
    font-size: 16px !important;
  }

  #studio-top-header {
    height: auto !important;
    min-height: 52px;
    padding: calc(6px + var(--safe-top)) 12px 6px 12px !important;
  }

  body.mode-is-media.media-doc-open #studio-top-header {
    display: none !important;
  }

  #mode-notes {
    padding: 16px 14px 96px 14px !important;
  }

  #mode-ai,
  #mode-billing,
  #mode-notifications {
    padding: 16px 14px 96px 14px !important;
  }

  #note-title-input {
    font-size: 1.65rem !important;
    line-height: 1.2 !important;
  }

  /* Native-grade thumb bottom dock on phones */
  #mobile-bottom-nav {
    display: grid !important;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 4px;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 46;
    padding: 6px 8px calc(6px + var(--safe-bottom));
    background: var(--nx-header);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid var(--nx-border-strong);
  }

  #mobile-bottom-nav button {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    min-height: 46px;
    border-radius: 10px;
    font-size: 10.5px;
    font-weight: 600;
    color: var(--nx-fg-muted);
    background: transparent;
    border: 1px solid transparent;
  }

  #mobile-bottom-nav button.is-active {
    color: var(--nx-fg);
    background: var(--nx-accent-soft);
    border-color: color-mix(in srgb, var(--nx-accent) 45%, transparent);
  }

  #studio-content-shell {
    padding-bottom: calc(58px + var(--safe-bottom));
  }

  /* Native OneUI / iOS bottom-sheet Assistant Overlay on phones (Galaxy S24/S25 Ultra, iPhone, Fold) */
  #copilot-drawer {
    position: fixed !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    top: auto !important;
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    min-height: min(54dvh, 440px);
    max-height: min(82dvh, 740px);
    z-index: 65;
    background: var(--nx-surface) !important;
    border-top: 1px solid var(--nx-border-strong) !important;
    border-left: none !important;
    border-right: none !important;
    border-bottom: none !important;
    border-radius: 24px 24px 0 0 !important;
    padding: 8px 16px calc(14px + var(--safe-bottom)) 16px !important;
    box-shadow: 0 -20px 64px rgba(0, 0, 0, 0.65);
    animation: nxAssistantSheetUp 0.22s cubic-bezier(0.22, 1, 0.36, 1);
  }

  /* Native OneUI / iOS bottom-sheet modals on mobile */
  #auth-modal,
  #enterprise-modal,
  #toolkit-modal,
  #comms-preview-modal,
  #vcs-modal,
  #atlassian-modal,
  #audio-modal,
  #share-modal,
  #main-share-modal,
  #wb-share-modal,
  #pdf-export-modal,
  #typistry-modal {
    align-items: flex-end !important;
    padding: 0 !important;
  }

  #auth-modal > div,
  #enterprise-modal > div,
  #toolkit-modal > div,
  #comms-preview-modal > div,
  #vcs-modal > div,
  #atlassian-modal > div,
  #audio-modal > div,
  #share-modal > div,
  #main-share-modal > div,
  #wb-share-modal > div,
  #pdf-export-modal > div,
  #typistry-modal > div {
    width: 100% !important;
    max-width: 100% !important;
    max-height: 92dvh !important;
    border-radius: 20px 20px 0 0 !important;
    padding-bottom: calc(14px + var(--safe-bottom));
    box-sizing: border-box !important;
    overflow-x: hidden !important;
  }
}

/* Deterministic Shareable Collaboration Link & Admit Banner Layout (Zero Overflow) */
.nx-admit-banner {
  max-width: calc(100vw - 16px) !important;
  box-sizing: border-box !important;
}
.nx-share-url-row {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}
.nx-share-url-row > input {
  flex: 1 1 0% !important;
  min-width: 0 !important;
  width: 0 !important;
  box-sizing: border-box !important;
}
.nx-share-actions-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}
.nx-share-actions-grid > button {
  min-height: 40px;
  min-width: 0;
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  box-sizing: border-box;
}
.nx-share-btn-danger {
  background: rgba(244, 63, 94, 0.12);
  color: #FDA4AF;
  border: 1px solid rgba(244, 63, 94, 0.34);
  font-weight: 600;
  border-radius: 12px;
  transition: background-color .15s ease, border-color .15s ease, opacity .15s ease;
}
.nx-share-btn-danger:hover:not(:disabled) {
  background: rgba(244, 63, 94, 0.22);
  border-color: rgba(244, 63, 94, 0.55);
}
.nx-share-btn-danger:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
html[data-theme="light"] .nx-share-btn-danger {
  background: rgba(225, 29, 72, 0.08);
  color: #BE123C;
  border-color: rgba(225, 29, 72, 0.28);
}

/* Carbon & Paper Live Upload Progress & Completion Notification HUD */
#nx-upload-hud {
  position: fixed;
  right: 16px;
  bottom: calc(18px + env(safe-area-inset-bottom, 0px));
  z-index: 95;
  width: 344px;
  max-width: calc(100vw - 24px);
  box-sizing: border-box;
  border-radius: 16px;
  padding: 12px 14px;
  background: rgba(20, 20, 19, 0.97);
  color: #F3F0E8;
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 20px 50px -12px rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  font-size: 12px;
  transition: opacity .18s ease, transform .18s ease;
}
html[data-theme="light"] #nx-upload-hud {
  background: rgba(252, 251, 248, 0.98);
  color: #171614;
  border-color: rgba(20, 20, 19, 0.14);
  box-shadow: 0 18px 42px -12px rgba(15, 23, 42, 0.22);
}
#nx-upload-hud.hidden {
  display: none !important;
}
@media (max-width: 639px) {
  #nx-upload-hud {
    left: 12px;
    right: 12px;
    width: auto;
    max-width: calc(100vw - 24px);
    bottom: calc(18px + env(safe-area-inset-bottom, 0px));
  }
  body:has(#mobile-bottom-nav) #nx-upload-hud {
    bottom: calc(72px + env(safe-area-inset-bottom, 0px));
  }
}
.nx-upload-track {
  width: 100%;
  height: 6px;
  border-radius: 9999px;
  background: rgba(128, 128, 128, 0.22);
  overflow: hidden;
  margin-top: 8px;
}
.nx-upload-fill {
  height: 100%;
  width: 0%;
  border-radius: 9999px;
  background: #D99B52;
  transition: width .12s ease, background-color .2s ease;
}
.nx-upload-fill.is-complete {
  background: #10B981;
}
.nx-upload-fill.is-error {
  background: #F43F5E;
}

/* ==================== IMMERSIVE FULL SCREEN & SUBTLE EXIT CONTROL ==================== */
html.nx-immersive-fullscreen #studio-sidebar,
html.nx-immersive-fullscreen #studio-sidebar-backdrop,
html.nx-immersive-fullscreen #studio-top-header,
html.nx-immersive-fullscreen #mobile-bottom-nav,
html.nx-immersive-fullscreen #media-top-header,
html.nx-immersive-fullscreen #media-gallery-rail,
html.nx-immersive-fullscreen #media-rail-backdrop,
html.nx-immersive-fullscreen #wb-top-bar {
  display: none !important;
}

html.nx-immersive-fullscreen #studio-content-shell,
html.nx-immersive-fullscreen #mode-whiteboard,
html.nx-immersive-fullscreen #mode-media {
  padding: 0 !important;
  padding-bottom: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
}

html.nx-immersive-fullscreen:not(.nx-wb-fs-tools-open) #wb-bottom-dock,
html.nx-immersive-fullscreen:not(.nx-wb-fs-tools-open) #wb-tool-popover,
html.nx-immersive-fullscreen:not(.nx-wb-fs-tools-open) #wb-more-tools-popover,
html.nx-immersive-fullscreen:not(.nx-wb-fs-tools-open) #wb-icon-picker {
  display: none !important;
}

#wb-fs-tools-pill {
  display: none;
}
html.nx-immersive-fullscreen #wb-fs-tools-pill {
  position: fixed;
  bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  right: 12px;
  z-index: 97;
  height: 30px;
  padding: 0 10px;
  border-radius: 9999px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: #F3F0E8;
  background: rgba(20, 20, 19, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.14);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.28);
  cursor: pointer;
  opacity: 0.36;
  transition: opacity 0.25s ease, background-color 0.15s ease;
}
html[data-theme="light"].nx-immersive-fullscreen #wb-fs-tools-pill {
  color: #171614;
  background: rgba(252, 251, 248, 0.78);
  border-color: rgba(20, 20, 19, 0.14);
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.12);
}
html.nx-immersive-fullscreen #wb-fs-tools-pill:hover,
html.nx-immersive-fullscreen #wb-fs-tools-pill:active,
html.nx-immersive-fullscreen.nx-wb-fs-tools-open #wb-fs-tools-pill {
  opacity: 1;
}
html.nx-immersive-fullscreen #wb-bottom-dock {
  bottom: calc(12px + env(safe-area-inset-bottom, 0px)) !important;
}

html.nx-immersive-fullscreen #mode-notes,
html.nx-immersive-fullscreen #mode-ai,
html.nx-immersive-fullscreen #mode-notifications,
html.nx-immersive-fullscreen #mode-billing,
html.nx-immersive-fullscreen #mode-benchmark {
  padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px)) !important;
}

#nx-exit-fullscreen-pill {
  position: fixed;
  top: calc(10px + env(safe-area-inset-top, 0px));
  right: 12px;
  z-index: 98;
  height: 30px;
  padding: 0 10px;
  border-radius: 9999px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: #F3F0E8;
  background: rgba(20, 20, 19, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.14);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.28);
  cursor: pointer;
  opacity: 0.86;
  transition: opacity 0.35s ease, transform 0.15s ease, background-color 0.15s ease;
}
html[data-theme="light"] #nx-exit-fullscreen-pill {
  color: #171614;
  background: rgba(252, 251, 248, 0.78);
  border-color: rgba(20, 20, 19, 0.14);
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.12);
}
#nx-exit-fullscreen-pill.is-settled {
  opacity: 0.36;
}
#nx-exit-fullscreen-pill:hover,
#nx-exit-fullscreen-pill:focus-visible,
#nx-exit-fullscreen-pill:active {
  opacity: 1 !important;
  transform: translateY(0);
}
#nx-exit-fullscreen-pill.hidden {
  display: none !important;
}

/* Benchmark Suite responsive layout helpers */
#hw-tuning-drawer summary::-webkit-details-marker {
  display: none;
}
#hw-tuning-drawer[open] summary svg {
  transform: rotate(180deg);
}
.nx-hw-controls-grid {
  display: grid;
  grid-template-columns: 2fr 1.2fr 1fr 1.1fr auto;
  gap: 8px;
  align-items: center;
}
.nx-hw-stage-canvas-box {
  position: relative;
  width: 100%;
  height: 220px;
}
.nx-hw-vs-chips {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
}

@media (max-width: 900px) {
  .nx-hw-controls-grid {
    grid-template-columns: 1fr 1fr;
  }
  .nx-hw-controls-grid > button {
    grid-column: 1 / -1;
  }
}

@media (max-width: 640px) {
  .nx-hw-controls-grid {
    grid-template-columns: 1fr;
  }
  .nx-hw-stage-canvas-box {
    height: 178px;
  }
  .nx-hw-vs-chips {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  #hw-total-score {
    font-size: 1.95rem !important;
    line-height: 1.1 !important;
  }
  #hw-run-bench-btn {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    height: auto !important;
    min-height: 42px !important;
    box-sizing: border-box !important;
    justify-content: center;
    padding: 10px 14px !important;
    font-size: 13px !important;
  }
}

/* ==================== CLEAN EDITORIAL DIFF & RESTORE STUDIO ==================== */
.nx-vcs-shell {
  background: var(--nx-surface) !important;
  border: 1px solid var(--nx-border-strong) !important;
  color: var(--nx-fg);
}

.nx-vcs-card {
  background: var(--nx-canvas);
  border: 1px solid var(--nx-border);
  border-radius: 12px;
}

.nx-vcs-segmented {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  border-radius: 10px;
  background: var(--nx-elev);
  border: 1px solid var(--nx-border);
}

.nx-vcs-workspace-grid {
  display: grid;
  grid-template-columns: minmax(250px, 295px) minmax(0, 1fr);
  gap: 14px;
  align-items: stretch;
}

.nx-vcs-top-controls {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  gap: 10px;
}

.nx-vcs-log-pane {
  max-height: 430px;
  overflow-y: auto;
  padding-right: 4px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.nx-vcs-diff-pane {
  background: var(--nx-canvas);
  border: 1px solid var(--nx-border);
  border-radius: 12px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}

.nx-vcs-stage-scroll {
  max-height: 360px;
  overflow: auto;
  padding-right: 4px;
}

@media (max-width: 960px) {
  .nx-vcs-workspace-grid,
  .nx-vcs-top-controls {
    grid-template-columns: 1fr;
  }
  .nx-vcs-log-pane {
    max-height: 220px;
  }
}

.nx-vcs-mode-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 7px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--nx-fg-muted);
  background: transparent;
  border: 1px solid transparent;
  transition: background-color 0.14s ease, color 0.14s ease;
  cursor: pointer;
}
.nx-vcs-mode-pill:hover {
  color: var(--nx-fg);
}
.nx-vcs-mode-pill.is-active {
  color: var(--nx-fg);
  background: var(--nx-surface);
  border-color: var(--nx-border-strong);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

.nx-vcs-btn-subtle {
  padding: 5px 10px;
  border-radius: 8px;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--nx-fg-body);
  background: var(--nx-elev);
  border: 1px solid var(--nx-border);
  cursor: pointer;
  transition: background-color 0.14s ease, border-color 0.14s ease, color 0.14s ease;
}
.nx-vcs-btn-subtle:hover {
  background: var(--nx-elev-hover);
  border-color: var(--nx-border-strong);
  color: var(--nx-fg);
}

.nx-vcs-frame-node {
  position: relative;
  overflow: hidden;
  background: var(--nx-surface);
  border: 1px solid var(--nx-border);
  color: var(--nx-fg);
  transition: border-color 0.15s ease, background-color 0.15s ease;
}
.nx-vcs-frame-node:hover {
  border-color: var(--nx-border-strong);
  background: var(--nx-elev);
}
.nx-vcs-frame-node.is-head-target {
  border-color: var(--nx-accent) !important;
  background: var(--nx-accent-soft) !important;
}
.nx-vcs-frame-node.is-base-target {
  border-color: var(--nx-border-strong) !important;
  background: var(--nx-elev) !important;
}

.nx-vcs-log-item {
  padding: 10px 11px;
  border-radius: 10px;
  border: 1px solid var(--nx-border);
  background: var(--nx-canvas);
  cursor: pointer;
  transition: border-color 0.14s ease, background-color 0.14s ease;
}
.nx-vcs-log-item:hover {
  border-color: var(--nx-border-strong);
  background: var(--nx-elev);
}
.nx-vcs-log-item.is-target-b {
  border-color: var(--nx-accent);
  background: var(--nx-accent-soft);
}
.nx-vcs-log-item.is-base-a {
  border-color: var(--nx-border-strong);
  background: var(--nx-elev);
}

.nx-vcs-block-card {
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--nx-border);
  background: var(--nx-surface);
}
.nx-vcs-block-card.is-added {
  border-left: 3px solid var(--nx-success);
}
.nx-vcs-block-card.is-removed {
  border-left: 3px solid var(--nx-danger);
}
.nx-vcs-block-card.is-modified {
  border-left: 3px solid var(--nx-accent);
}
.nx-vcs-block-card.is-picked {
  border-color: var(--nx-accent);
  box-shadow: 0 0 0 1px var(--nx-accent);
}

.nx-diff-tok-add {
  background: rgba(16, 185, 129, 0.20);
  color: var(--nx-success);
  border-radius: 3px;
  padding: 0 2px;
  font-weight: 600;
}
.nx-diff-tok-del {
  background: rgba(244, 63, 94, 0.18);
  color: var(--nx-danger);
  text-decoration: line-through;
  text-decoration-color: color-mix(in srgb, var(--nx-danger) 65%, transparent);
  border-radius: 3px;
  padding: 0 2px;
}
html[data-theme="light"] .nx-diff-tok-add {
  background: rgba(5, 150, 105, 0.14);
  color: #065f46;
}
html[data-theme="light"] .nx-diff-tok-del {
  background: rgba(220, 38, 38, 0.12);
  color: #9f1239;
}

.nx-split-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 1px;
  background: var(--nx-border);
  border: 1px solid var(--nx-border);
  border-radius: 10px;
  overflow: hidden;
}
.nx-split-cell {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 8px;
  padding: 4px 8px;
  font-size: 11.5px;
  line-height: 1.45;
  color: var(--nx-fg-body);
  background: var(--nx-surface);
}
.nx-split-cell.is-add {
  background: rgba(16, 185, 129, 0.08);
}
.nx-split-cell.is-del {
  background: rgba(244, 63, 94, 0.08);
}
.nx-split-cell.is-empty {
  background: var(--nx-code);
  opacity: 0.55;
}

@media (max-width: 768px) {
  .nx-split-grid {
    grid-template-columns: 1fr;
  }
}

/* Native Android APK Shell, iOS WebClip & Soft Keyboard Ecosystem Adjustments */
html.is-android-apk {
  --safe-top: 0px;
}

html.is-android-apk #wb-home-link,
html.is-android-apk #studio-back-link {
  display: none !important;
}

html.nx-keyboard-open #mobile-bottom-nav {
  display: none !important;
}

html.nx-keyboard-open #studio-content-shell {
  padding-bottom: 0 !important;
}

html.nx-keyboard-open #mode-notes,
html.nx-keyboard-open #mode-ai,
html.nx-keyboard-open #mode-billing,
html.nx-keyboard-open #mode-notifications,
html.nx-keyboard-open #mode-benchmark {
  padding-bottom: 16px !important;
}

html.nx-keyboard-open #copilot-drawer {
  bottom: var(--nx-kb-offset, 0px) !important;
  max-height: var(--nx-vv-height, 100dvh) !important;
}

@media (max-width: 639px) {
  .nx-hide-xs {
    display: none !important;
  }
}

@media (min-width: 640px) {
  .nx-only-xs {
    display: none !important;
  }
}

@media (max-width: 1023px) {
  .nx-hide-lt-lg {
    display: none !important;
  }
}

/* ==========================================================================
   Multi-SoC GPU & Tile Renderer Optimizations (Mali-G610 / Dimensity / Entry)
   Eliminate multi-pass backdrop blur compositing & layout thrash on TBDR GPUs.
   ========================================================================== */
.block-row,
.org-page-card {
  contain: layout style;
}

html[data-perf-tier="efficiency"] .glass-panel,
html[data-perf-tier="efficiency"] #mobile-bottom-nav,
html[data-perf-tier="efficiency"] #studio-top-header,
html[data-perf-tier="efficiency"] #studio-sidebar-backdrop,
html[data-perf-tier="efficiency"] #media-rail-backdrop,
html[data-perf-tier="efficiency"] .ne-hud-tl,
html[data-perf-tier="efficiency"] .ne-hud-tr,
html[data-perf-tier="efficiency"] .ne-stat,
html[data-perf-tier="efficiency"] .nxai-pill,
html[data-perf-tier="efficiency"] .nxai-panel,
html[data-perf-tier="midrange"] .glass-panel,
html[data-perf-tier="midrange"] #mobile-bottom-nav,
html[data-perf-tier="midrange"] #studio-top-header,
html[data-perf-tier="midrange"] #studio-sidebar-backdrop,
html[data-perf-tier="midrange"] #media-rail-backdrop,
html[data-perf-tier="midrange"] .ne-hud-tl,
html[data-perf-tier="midrange"] .ne-hud-tr,
html[data-perf-tier="midrange"] .ne-stat,
html[data-perf-tier="midrange"] .nxai-pill,
html[data-perf-tier="midrange"] .nxai-panel,
html[data-gpu-vendor="mali"] .glass-panel,
html[data-gpu-vendor="mali"] #mobile-bottom-nav,
html[data-gpu-vendor="mali"] #studio-top-header,
html[data-gpu-vendor="mali"] #studio-sidebar-backdrop,
html[data-gpu-vendor="mali"] #media-rail-backdrop,
html[data-gpu-vendor="mali"] .ne-hud-tl,
html[data-gpu-vendor="mali"] .ne-hud-tr,
html[data-gpu-vendor="mali"] .ne-stat,
html[data-gpu-vendor="mali"] .nxai-pill,
html[data-gpu-vendor="mali"] .nxai-panel,
html[data-gpu-vendor="powervr"] .glass-panel,
html[data-gpu-vendor="powervr"] #mobile-bottom-nav,
html[data-gpu-vendor="powervr"] #studio-top-header {
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

html[data-perf-tier="efficiency"] .glass-panel,
html[data-perf-tier="midrange"] .glass-panel,
html[data-gpu-vendor="mali"] .glass-panel,
html[data-gpu-vendor="powervr"] .glass-panel {
  background: var(--nx-surface) !important;
}

html[data-perf-tier="efficiency"] #studio-top-header,
html[data-perf-tier="efficiency"] #mobile-bottom-nav,
html[data-perf-tier="midrange"] #studio-top-header,
html[data-perf-tier="midrange"] #mobile-bottom-nav,
html[data-gpu-vendor="mali"] #studio-top-header,
html[data-gpu-vendor="mali"] #mobile-bottom-nav {
  background: var(--nx-sidebar) !important;
}

/* Adaptive Eco Power Saver & Hidden-Tab GPU Hibernation */
html.nx-eco-mode .glass-panel,
html.nx-eco-mode #mobile-bottom-nav,
html.nx-eco-mode #studio-top-header,
html.nx-eco-mode .toolbar-glass,
html.nx-tab-hidden .glass-panel,
html.nx-tab-hidden #mobile-bottom-nav,
html.nx-tab-hidden #studio-top-header,
html.nx-tab-hidden .toolbar-glass {
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

html.nx-eco-mode .glass-panel {
  background: var(--nx-surface) !important;
}

html.nx-tab-hidden .animate-pulse,
html.nx-tab-hidden .animate-spin,
html.nx-eco-mode .animate-pulse {
  animation-play-state: paused !important;
}

/* ==========================================================================
   Unified Carbon & Paper Stylus HUD & Contextual Ink Studio Popovers
   Shared across Notes, Book Studio, Whiteboard, and PDF & Media Studio
   ========================================================================== */
.nx-stylus-hud {
  position: fixed;
  top: calc(62px + env(safe-area-inset-top, 0px));
  left: 50%;
  transform: translate(-50%, -6px);
  z-index: 9999;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 6px 12px 6px 7px;
  border-radius: 12px;
  background: var(--nx-surface);
  color: var(--nx-fg);
  border: 1px solid var(--nx-border-strong);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.24);
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: -0.005em;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.16s ease, transform 0.16s ease;
}
.nx-stylus-hud.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}
.nx-stylus-hud-icon {
  width: 24px;
  height: 24px;
  border-radius: 8px;
  background: var(--nx-elev);
  border: 1px solid var(--nx-border);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--nx-fg);
}
.nx-stylus-hud-icon.is-eraser {
  color: #E11D48;
  background: rgba(225, 29, 72, 0.12);
  border-color: rgba(225, 29, 72, 0.28);
}
html:not([data-theme="light"]) .nx-stylus-hud-icon.is-eraser {
  color: #FB7185;
}
.nx-stylus-hud-tag {
  padding: 2px 6px;
  border-radius: 6px;
  background: var(--nx-elev);
  border: 1px solid var(--nx-border);
  color: var(--nx-fg-muted);
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.nx-ink-popover {
  background: var(--nx-surface) !important;
  color: var(--nx-fg) !important;
  border: 1px solid var(--nx-border-strong) !important;
  border-radius: 16px !important;
  padding: 14px !important;
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.26) !important;
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
}
.nx-ink-pop-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--nx-border);
}
.nx-ink-pop-title {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--nx-fg);
  letter-spacing: -0.01em;
}
.nx-ink-pop-badge {
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--nx-elev);
  border: 1px solid var(--nx-border);
  color: var(--nx-fg-muted);
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 10px;
  font-weight: 600;
}
.nx-ink-pop-close {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--nx-fg-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color 0.14s ease, color 0.14s ease;
}
.nx-ink-pop-close:hover {
  background: var(--nx-elev);
  color: var(--nx-fg);
}
.nx-ink-preview {
  width: 100%;
  height: 38px;
  display: block;
  border-radius: 10px;
  background: var(--nx-elev) !important;
  border: 1px solid var(--nx-border) !important;
}
.nx-ink-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 11px;
  font-weight: 500;
  color: var(--nx-fg-muted);
}
.nx-ink-label strong {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 10.5px;
  font-weight: 600;
  color: var(--nx-fg);
}
.nx-ink-seg {
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 3px;
  border-radius: 10px;
  background: var(--nx-elev);
  border: 1px solid var(--nx-border);
}
.nx-ink-seg-btn {
  flex: 1 1 0%;
  min-width: 0;
  height: 26px;
  padding: 0 7px;
  border-radius: 7px;
  border: 0;
  background: transparent;
  color: var(--nx-fg-muted);
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
  transition: background-color 0.14s ease, color 0.14s ease;
}
.nx-ink-seg-btn:hover {
  color: var(--nx-fg);
}
.nx-ink-seg-btn.is-active {
  background: var(--nx-primary-bg);
  color: var(--nx-primary-fg);
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.14);
}
.nx-ink-swatch {
  width: 24px;
  height: 24px;
  border-radius: 999px;
  border: 0;
  padding: 0;
  cursor: pointer;
  box-shadow: inset 0 0 0 1px rgba(128, 128, 128, 0.34);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.nx-ink-swatch:hover {
  transform: scale(1.08);
}
.nx-ink-swatch.is-active {
  transform: scale(1.1);
  box-shadow: inset 0 0 0 1px rgba(128, 128, 128, 0.3), 0 0 0 2px var(--nx-surface), 0 0 0 3.5px var(--nx-fg);
}
.nx-ink-color-add {
  width: 24px;
  height: 24px;
  border-radius: 999px;
  background: var(--nx-elev);
  border: 1px dashed var(--nx-border-strong);
  color: var(--nx-fg-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: color 0.14s ease, border-color 0.14s ease;
}
.nx-ink-color-add:hover {
  color: var(--nx-fg);
  border-color: var(--nx-fg-muted);
}
.nx-ink-slider {
  width: 100%;
  height: 5px;
  cursor: pointer;
  accent-color: var(--nx-primary-bg);
}
.nx-ink-check {
  accent-color: var(--nx-primary-bg);
  cursor: pointer;
}
.nx-ink-ghost-danger {
  width: 100%;
  height: 30px;
  border-radius: 9px;
  background: rgba(225, 29, 72, 0.08);
  border: 1px solid rgba(225, 29, 72, 0.24);
  color: #E11D48;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.14s ease;
}
html:not([data-theme="light"]) .nx-ink-ghost-danger {
  color: #FB7185;
}
.nx-ink-ghost-danger:hover {
  background: rgba(225, 29, 72, 0.15);
}

/* ==========================================================================
   Unified Header, Dropdown Menu & Modal Stacking-Context Protocol
   Guarantees top-bar & page three-dots menus ALWAYS render cleanly above
   editorial titles, blocks, quiet insert bars, and mobile bottom docks.
   ========================================================================== */
#studio-top-header {
  position: relative;
  z-index: 54 !important;
}
#studio-top-header:has(#header-tools-dropdown[open]),
#studio-top-header.has-open-menu {
  z-index: 57 !important;
}

#header-tools-dropdown > div,
#note-actions-dropdown > div,
.nx-dropdown-menu {
  background: #1A1917 !important;
  border: 1px solid rgba(243, 240, 232, 0.18) !important;
  box-shadow: 0 24px 56px -8px rgba(0, 0, 0, 0.78), 0 0 0 1px rgba(0, 0, 0, 0.45) !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  max-height: min(78dvh, calc(100dvh - 76px - var(--safe-top, 0px) - var(--safe-bottom, 0px)));
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}
html[data-theme="light"] #header-tools-dropdown > div,
html[data-theme="light"] #note-actions-dropdown > div,
html[data-theme="light"] .nx-dropdown-menu {
  background: #FFFFFF !important;
  border: 1px solid rgba(23, 22, 20, 0.16) !important;
  box-shadow: 0 22px 52px -10px rgba(15, 23, 42, 0.22), 0 0 0 1px rgba(15, 23, 42, 0.04) !important;
}

#pdf-export-modal,
#flowchart-studio-modal,
#nexus-modals-root > .fixed.inset-0 {
  z-index: 80 !important;
}

/* ==========================================================================
   Carbon & Paper Assistant Overlay (#copilot-drawer) Design Protocol
   ========================================================================== */
@keyframes nxAssistantSheetUp {
  from { opacity: 0; transform: translate3d(0, 24px, 0); }
  to { opacity: 1; transform: translate3d(0, 0, 0); }
}

#copilot-drawer {
  background: var(--nx-surface);
  border-color: var(--nx-border-strong);
  color: var(--nx-fg-body);
}
#copilot-drawer.hidden {
  display: none !important;
}
body.copilot-open #copilot-toggle-btn {
  background: var(--nx-accent-soft);
  border-color: color-mix(in srgb, var(--nx-accent) 45%, transparent);
  color: var(--nx-fg);
}
.nx-copilot-grabber {
  width: 36px;
  height: 4px;
  border-radius: 999px;
  background: var(--nx-border-strong);
  margin: 2px auto 6px auto;
  flex-shrink: 0;
}
.nx-copilot-emblem {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--nx-accent-soft);
  border: 1px solid color-mix(in srgb, var(--nx-accent) 36%, transparent);
  color: var(--nx-accent);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.nx-copilot-action-btn {
  height: 34px;
  padding: 0 10px;
  border-radius: 10px;
  background: var(--nx-elev);
  border: 1px solid var(--nx-border);
  color: var(--nx-fg-muted);
  font-size: 11.5px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  cursor: pointer;
  transition: background-color 0.14s ease, color 0.14s ease, border-color 0.14s ease;
}
.nx-copilot-action-btn:hover {
  background: var(--nx-elev-hover);
  color: var(--nx-fg);
  border-color: var(--nx-border-strong);
}
.nx-copilot-action-btn.hidden {
  display: none !important;
}
.nx-copilot-close {
  width: 36px;
  height: 36px;
  min-width: 36px;
  min-height: 36px;
  border-radius: 10px;
  background: var(--nx-elev);
  border: 1px solid var(--nx-border);
  color: var(--nx-fg-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background-color 0.14s ease, color 0.14s ease;
}
.nx-copilot-close:hover {
  background: var(--nx-elev-hover);
  color: var(--nx-fg);
}
.nx-copilot-chip {
  text-align: left;
  padding: 10px 12px;
  min-height: 46px;
  border-radius: 13px;
  background: var(--nx-elev);
  border: 1px solid var(--nx-border);
  color: var(--nx-fg);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.35;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  cursor: pointer;
  transition: background-color 0.14s ease, border-color 0.14s ease, transform 0.12s ease;
}
.nx-copilot-chip:hover {
  background: var(--nx-elev-hover);
  border-color: var(--nx-border-strong);
}
.nx-copilot-chip:active {
  transform: scale(0.985);
}
.nx-copilot-chip small {
  font-size: 10.5px;
  font-weight: 500;
  color: var(--nx-fg-muted);
}
.nx-copilot-composer {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 5px 5px 14px;
  border-radius: 16px;
  background: var(--nx-elev);
  border: 1px solid var(--nx-border-strong);
  transition: border-color 0.15s ease;
}
.nx-copilot-composer:focus-within {
  border-color: var(--nx-accent);
}
.nx-copilot-composer input {
  flex: 1;
  min-width: 0;
  background: transparent !important;
  border: none !important;
  outline: none !important;
  color: var(--nx-fg) !important;
  font-size: 13px;
  padding: 6px 0;
}
.nx-copilot-send {
  width: 38px;
  height: 38px;
  min-width: 38px;
  min-height: 38px;
  border-radius: 12px;
  background: var(--nx-primary-bg);
  color: var(--nx-primary-fg);
  border: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: opacity 0.14s ease, transform 0.12s ease;
}
.nx-copilot-send:hover {
  opacity: 0.92;
}
.nx-copilot-send:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.nx-copilot-msg-user {
  align-self: flex-end;
  max-width: 86%;
  padding: 9px 13px;
  border-radius: 16px 16px 4px 16px;
  background: var(--nx-primary-bg);
  color: var(--nx-primary-fg);
  font-size: 12.5px;
  font-weight: 500;
  line-height: 1.45;
  word-break: break-word;
}
.nx-copilot-msg-ai {
  align-self: stretch;
  padding: 12px 13px;
  border-radius: 16px 16px 16px 4px;
  background: var(--nx-elev);
  border: 1px solid var(--nx-border);
  color: var(--nx-fg-body);
  font-size: 12.5px;
  line-height: 1.55;
  word-break: break-word;
}
