/* ═══════════════════════════════════════════════════════
   XuanPivot — Design System (Linear-inspired Dark Theme)
   ═══════════════════════════════════════════════════════ */

:root,
[data-theme="dark"] {
  /* Colors — Dark Theme (Linear-style) */
  --bg-primary: #0a0a0f;
  --bg-secondary: #111119;
  --bg-tertiary: #18181f;
  --bg-elevated: #1c1c26;
  --bg-hover: #22222e;
  --bg-active: #2a2a3a;

  --border-default: #26263a;
  --border-subtle: #1e1e30;
  --border-strong: #35354a;

  --text-primary: #e1e1e8;
  --text-secondary: #8b8b9e;
  --text-tertiary: #5c5c70;
  --text-inverse: #0a0a0f;

  --accent-primary: #e1e1e8;
  --accent-hover: #ffffff;
  --accent-subtle: rgba(225, 225, 232, 0.08);
  --accent-text: #c0c0cc;

  --segment-active-bg: var(--accent-primary);
  --segment-active-text: var(--text-inverse);

  /* Select chevron — @tabler/icons chevron-down, colored to --text-secondary */
  --select-chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%238b8b9e' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath stroke='none' d='M0 0h24v24H0z' fill='none'/%3E%3Cpath d='M6 9l6 6l6 -6'/%3E%3C/svg%3E");

  --success: #22c55e;
  --success-subtle: rgba(34, 197, 94, 0.12);
  --warning: #f59e0b;
  --warning-subtle: rgba(245, 158, 11, 0.12);
  --error: #ef4444;
  --error-subtle: rgba(239, 68, 68, 0.12);
  --info: #3b82f6;
  --info-card-accent: #818cf8;
  --info-card-accent-end: #a78bfa;

  /* Status colors */
  --status-running: #22c55e;
  --status-idle: #8b8b9e;
  --status-stopped: #5c5c70;
  --status-error: #ef4444;

  /* Spacing */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;

  /* Typography */
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

  --text-xs: 11px;
  --text-sm: 13px;
  --text-base: 14px;
  --text-lg: 16px;
  --text-xl: 18px;
  --text-2xl: 24px;
  --text-3xl: 32px;

  /* Border Radius */
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;
  --radius-xl: 12px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.25);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.45);

  /* Transitions */
  --transition-fast: 120ms ease;
  --transition-default: 200ms ease;
  --transition-slow: 300ms ease;

  /* Layout */
  --sidebar-width-expanded: 240px;
  --sidebar-width-collapsed: 68px;
  --sidebar-width: var(--sidebar-width-expanded);
  --header-height: 52px;

  /* Notification bar */
  --notification-bar-height: 0px;
  --notification-bar-bg: var(--accent-primary);
  --notification-bar-text: var(--bg-primary);
  --notification-bar-close-hover: rgba(0, 0, 0, 0.1);
}

/* ─── Notification Bar ──────────────────────────────── */

.notification-bar {
  width: 100%;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--notification-bar-bg);
  color: var(--notification-bar-text);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.01em;
  position: sticky;
  top: 0;
  z-index: 100;
  flex-shrink: 0;
  overflow: visible;
}

.notification-bar-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  width: calc(100% - 60px);
  height: 100%;
  overflow: hidden;
  position: relative;
}

.notification-bar-text {
  white-space: nowrap;
  display: inline-block;
}

.notification-bar-text.marquee {
  position: absolute;
  left: 0;
  animation: marquee 20s linear infinite;
}

.notification-bar-text.marquee:hover {
  animation-play-state: paused;
}

@keyframes marquee {
  0% { transform: translateX(100%); }
  100% { transform: translateX(-100%); }
}

.notification-bar-close {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: inherit;
  opacity: 0.6;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  padding: 2px 4px;
  border-radius: 3px;
  transition: opacity 120ms ease;
}

.notification-bar-close:hover {
  opacity: 1;
  background: var(--notification-bar-close-hover);
}

.notification-bar-close-wrap {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 1;
}

.notification-bar-dismiss-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 148px;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  box-shadow: var(--shadow-lg);
  z-index: 120;
}

.notification-bar-dismiss-menu button {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: 8px 10px;
  border-radius: 8px;
  background: transparent;
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.3;
  transition: background var(--transition-fast), color var(--transition-fast);
}

.notification-bar-dismiss-menu button:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

[data-theme="light"] {
  --bg-primary: #f8f8f7;
  --bg-secondary: #f5f5f3;
  --bg-tertiary: #efefec;
  --bg-elevated: #fffefd;
  --bg-hover: #ededeb;
  --bg-active: #e2e2dd;

  --border-default: #d5d4cd;
  --border-subtle: #e3e2dc;
  --border-strong: #c3c1b9;

  --text-primary: #1a1a22;
  --text-secondary: #6b6b80;
  --text-tertiary: #9898a8;
  --text-inverse: #ffffff;

  --accent-primary: #3a3a42;
  --accent-hover: #28282e;
  --accent-subtle: rgba(58, 58, 66, 0.08);
  --accent-text: #3a3a42;

  --segment-active-bg: var(--bg-elevated);
  --segment-active-text: var(--text-primary);

  /* Select chevron — @tabler/icons chevron-down, colored to --text-secondary */
  --select-chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%236b6b80' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath stroke='none' d='M0 0h24v24H0z' fill='none'/%3E%3Cpath d='M6 9l6 6l6 -6'/%3E%3C/svg%3E");

  --success: #16a34a;
  --success-subtle: rgba(22, 163, 74, 0.08);
  --warning: #d97706;
  --warning-subtle: rgba(217, 119, 6, 0.08);
  --error: #dc2626;
  --error-subtle: rgba(220, 38, 38, 0.08);
  --info: #2563eb;
  --info-card-accent: #6366f1;
  --info-card-accent-end: #8b5cf6;

  --status-running: #16a34a;
  --status-idle: #9898a8;
  --status-stopped: #d0d0d8;
  --status-error: #dc2626;

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);

  /* Light mode: notification bar always white text */
  --notification-bar-text: var(--bg-primary); /* For light mode, bg-primary is #fff */
  --notification-bar-close-hover: rgba(255, 255, 255, 0.2);
}

/* Light-mode overrides: primary button uses dark bg → white text */
[data-theme="light"] .btn-primary {
  color: #ffffff;
}

/* Light-mode secondary button — keep neutral gray style */
[data-theme="light"] .btn-secondary {
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  color: var(--text-secondary);
}

[data-theme="light"] .btn-secondary:hover {
  background: var(--bg-hover);
  border-color: var(--border-strong);
  color: var(--text-primary);
  box-shadow: none;
}

/* ─── Reset ─────────────────────────────────────────── */

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

html {
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-family);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.5;
  min-height: 100dvh;
}

a {
  color: var(--accent-text);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--accent-hover);
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
}

input,
textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: var(--space-2) var(--space-3);
  outline: none;
  transition: border-color var(--transition-fast);
}

select {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  background-color: var(--bg-elevated);
  background-image: var(--select-chevron);
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 16px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: 4px 32px 4px 12px;
  outline: none;
  transition: border-color var(--transition-fast);
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  text-overflow: ellipsis;
}

/* Theme-colored radio and checkbox */
input[type="radio"],
input[type="checkbox"] {
  accent-color: var(--accent-primary);
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 2px var(--accent-subtle);
}

/* ─── Layout ────────────────────────────────────────── */

.app-layout {
  display: flex;
  min-height: calc(100dvh - var(--notification-bar-height));
}

.app-layout.sidebar-collapsed {
  --sidebar-width: var(--sidebar-width-collapsed);
}

.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: var(--notification-bar-height);
  left: 0;
  bottom: 0;
  height: calc(100dvh - var(--notification-bar-height));
  max-height: calc(100dvh - var(--notification-bar-height));
  z-index: 10;
  transition: width var(--transition-default);
  /* Allow account language submenu to extend to the right; vertical scroll stays in .sidebar-scrollable */
  overflow-x: visible;
  overflow-y: hidden;
  isolation: isolate;
}

.sidebar-top {
  padding-top: var(--space-2);
  flex-shrink: 0;
  position: relative;
  z-index: 1;
  background: var(--bg-secondary);
}

.sidebar-scrollable {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  min-height: 0;
  position: relative;
  z-index: 0;
  background: var(--bg-secondary);
}

/* Custom scrollbar for sidebar */
.sidebar-scrollable::-webkit-scrollbar {
  width: 4px;
}

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

.sidebar-scrollable::-webkit-scrollbar-thumb {
  background: transparent;
  border-radius: 4px;
}

.sidebar-scrollable:hover::-webkit-scrollbar-thumb {
  background: var(--border-strong);
}

.sidebar-agent-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 2px 14px 6px;
  color: var(--text-tertiary);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.sidebar-agent-header button,
.sidebar-agent-drawer-header button {
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  background: var(--bg-primary);
  color: var(--text-tertiary);
  cursor: pointer;
  transition: all 0.15s ease;
}

.sidebar-agent-header button:hover,
.sidebar-agent-drawer-header button:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
  border-color: var(--border-strong);
}

.sidebar-agent-search {
  position: relative;
  padding: 2px 12px 6px;
}

.sidebar-agent-search-icon {
  position: absolute;
  left: 20px;
  top: calc(50% - 2px);
  transform: translateY(-50%);
  pointer-events: none;
  color: var(--text-tertiary);
}

.sidebar-agent-search input {
  width: 100%;
  box-sizing: border-box;
  padding: 5px 24px 5px 28px;
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-size: 12px;
  outline: none;
}

.sidebar-agent-search input:focus {
  border-color: var(--primary);
}

.sidebar-agent-search button {
  position: absolute;
  right: 18px;
  top: calc(50% - 2px);
  transform: translateY(-50%);
  display: flex;
  padding: 0;
  border: none;
  background: none;
  color: var(--text-tertiary);
  cursor: pointer;
}

.sidebar-agent-empty {
  padding: 12px 16px;
  color: var(--text-tertiary);
  font-size: 12px;
  text-align: center;
}

.sidebar-bottom {
  flex-shrink: 0;
  border-top: 1px solid var(--border-subtle);
}

.sidebar-logo {
  padding: var(--space-3) var(--space-5);
  margin-bottom: var(--space-3);
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.sidebar-workspace-row {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3) var(--space-2) var(--space-4);
  margin-bottom: var(--space-2);
}

.workspace-switcher-trigger {
  min-width: 0;
  height: 34px;
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 8px;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--text-primary);
  cursor: pointer;
  transition: background var(--transition-fast), border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.workspace-switcher-trigger:hover,
.workspace-switcher-trigger.open {
  background: var(--bg-hover);
  border-color: var(--border-subtle);
}

.workspace-switcher-trigger:focus-visible {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 2px var(--accent-subtle);
}

.workspace-switcher-avatar {
  width: 26px;
  height: 26px;
  flex: 0 0 26px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #eeeeec;
  border: none;
  color: #6f6f68;
  font-size: 15px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0;
}

.workspace-switcher-avatar img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.workspace-switcher-avatar.tone-1 {
  background: #eeeeec;
  color: #6f6f68;
}

.workspace-switcher-avatar.tone-2 {
  background: #f0eeeb;
  color: #776b5f;
}

.workspace-switcher-avatar.tone-3 {
  background: #ecefee;
  color: #61716d;
}

.workspace-switcher-avatar.tone-4 {
  background: #efeeee;
  color: #725f63;
}

.workspace-switcher-avatar.tone-5 {
  background: #f1efea;
  color: #766c58;
}

.workspace-switcher-avatar.tone-6 {
  background: #eceef1;
  color: #5f6876;
}

[data-theme="dark"] .workspace-switcher-avatar {
  background: #2a2a32;
  color: #aaaab7;
}

[data-theme="dark"] .workspace-switcher-avatar.tone-1 {
  background: #2a2a32;
  color: #aaaab7;
}

[data-theme="dark"] .workspace-switcher-avatar.tone-2 {
  background: #302d2a;
  color: #b2a89e;
}

[data-theme="dark"] .workspace-switcher-avatar.tone-3 {
  background: #29302e;
  color: #9fb4ad;
}

[data-theme="dark"] .workspace-switcher-avatar.tone-4 {
  background: #312c2e;
  color: #b4a2a8;
}

[data-theme="dark"] .workspace-switcher-avatar.tone-5 {
  background: #302f2a;
  color: #b4ad9c;
}

[data-theme="dark"] .workspace-switcher-avatar.tone-6 {
  background: #292d33;
  color: #a3adbb;
}

.workspace-switcher-name {
  min-width: 0;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: left;
  font-size: 14px;
  font-weight: 600;
}

.workspace-switcher-chevron {
  flex: 0 0 auto;
  color: var(--text-tertiary);
  opacity: 0;
  transition: opacity var(--transition-fast), transform var(--transition-fast);
}

.workspace-switcher-trigger:hover .workspace-switcher-chevron,
.workspace-switcher-trigger:focus-visible .workspace-switcher-chevron,
.workspace-switcher-trigger.open .workspace-switcher-chevron {
  opacity: 1;
}

.workspace-switcher-trigger.open .workspace-switcher-chevron {
  transform: rotate(180deg);
}

.tenant-switcher-popover {
  position: fixed;
  top: calc(82px + var(--notification-bar-height));
  left: var(--space-4);
  width: 304px;
  max-height: min(520px, calc(100vh - 96px - var(--notification-bar-height)));
  overflow: hidden;
  z-index: 10020;
  padding: 10px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  transform-origin: top left;
  animation: tenantDropdownIn 0.16s ease;
  display: flex;
  flex-direction: column;
}

.tenant-switcher-label {
  flex-shrink: 0;
  padding: 8px 12px 7px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-tertiary);
}

.tenant-switcher-search {
  flex-shrink: 0;
  height: 34px;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 0 9px;
  margin: 2px 2px 8px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--bg-secondary);
  color: var(--text-tertiary);
}

.tenant-switcher-search input {
  min-width: 0;
  flex: 1;
  height: 100%;
  border: none;
  background: transparent;
  color: var(--text-primary);
  font-size: 13px;
  outline: none;
  box-shadow: none;
  padding: 0;
}

.tenant-switcher-search input:focus {
  box-shadow: none;
}

.tenant-switcher-search button {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 5px;
  background: transparent;
  color: var(--text-tertiary);
  cursor: pointer;
}

.tenant-switcher-search button:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.tenant-switcher-list {
  min-height: 0;
  max-height: 286px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-right: 2px;
}

.tenant-switcher-list::-webkit-scrollbar {
  width: 4px;
}

.tenant-switcher-list::-webkit-scrollbar-track {
  background: transparent;
}

.tenant-switcher-list::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 4px;
}

.tenant-switcher-item,
.tenant-switcher-action {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 14px;
  text-align: left;
  transition: background var(--transition-fast), color var(--transition-fast), border-color var(--transition-fast);
}

.tenant-switcher-item:hover,
.tenant-switcher-action:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.tenant-switcher-item.active {
  background: var(--bg-tertiary);
  border-color: var(--border-subtle);
  color: var(--text-primary);
  font-weight: 600;
}

.tenant-switcher-icon {
  width: 22px;
  flex: 0 0 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
}

.tenant-switcher-name {
  min-width: 0;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tenant-switcher-empty {
  padding: 16px 10px;
  color: var(--text-tertiary);
  font-size: 13px;
  text-align: center;
}

.tenant-switcher-divider {
  flex-shrink: 0;
  height: 1px;
  background: var(--border-subtle);
  margin: 10px 0;
}

.tenant-setup-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 10030;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(0, 0, 0, 0.48);
}

.tenant-setup-modal {
  width: min(440px, calc(100vw - 48px));
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  padding: 22px;
  background: var(--bg-primary);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  display: flex;
  flex-direction: column;
  gap: 18px;
  animation: accountDropdownIn 0.16s ease;
}

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

.tenant-setup-modal-header h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}

.tenant-setup-modal-header p {
  margin: 6px 0 0;
  font-size: 12px;
  line-height: 1.45;
  color: var(--text-tertiary);
}

.tenant-setup-modal-header button {
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--text-tertiary);
  cursor: pointer;
}

.tenant-setup-modal-header button:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.tenant-setup-error {
  padding: 8px 10px;
  border-radius: var(--radius-md);
  background: var(--error-subtle);
  color: var(--error);
  font-size: 12px;
}

.tenant-setup-section {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.tenant-setup-section-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
}

.tenant-setup-row {
  display: flex;
  gap: 8px;
}

.tenant-setup-row .form-input {
  min-width: 0;
  flex: 1;
  height: 38px;
  font-size: 13px;
}

.tenant-setup-row .btn {
  height: 38px;
  padding: 0 16px;
  font-size: 12px;
}

.tenant-setup-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-tertiary);
  font-size: 11px;
  font-weight: 600;
}

.tenant-setup-divider::before,
.tenant-setup-divider::after {
  content: '';
  height: 1px;
  flex: 1;
  background: var(--border-subtle);
}

.company-identity-logo-row {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 14px;
}

.company-identity-logo-preview {
  width: 48px;
  height: 48px;
  flex: 0 0 48px;
  border-radius: 10px;
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  font-size: 24px;
  font-weight: 700;
}

.company-identity-logo-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.tenant-logo-crop-backdrop {
  position: fixed;
  inset: 0;
  z-index: 10040;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(0, 0, 0, 0.52);
}

.tenant-logo-crop-modal {
  width: min(420px, calc(100vw - 48px));
  padding: 22px;
  border-radius: 12px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-primary);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.32);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

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

.tenant-logo-crop-header h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
}

.tenant-logo-crop-header p {
  margin: 5px 0 0;
  color: var(--text-tertiary);
  font-size: 12px;
  max-width: 300px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tenant-logo-crop-header button {
  width: 30px;
  height: 30px;
  border: none;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--text-tertiary);
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
}

.tenant-logo-crop-header button:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.tenant-logo-crop-stage {
  width: 240px;
  height: 240px;
  align-self: center;
  position: relative;
  overflow: hidden;
  border-radius: 12px;
  background:
    linear-gradient(45deg, var(--bg-secondary) 25%, transparent 25%),
    linear-gradient(-45deg, var(--bg-secondary) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, var(--bg-secondary) 75%),
    linear-gradient(-45deg, transparent 75%, var(--bg-secondary) 75%);
  background-color: var(--bg-tertiary);
  background-size: 20px 20px;
  background-position: 0 0, 0 10px, 10px -10px, -10px 0;
  cursor: grab;
  touch-action: none;
  user-select: none;
}

.tenant-logo-crop-stage:active {
  cursor: grabbing;
}

.tenant-logo-crop-stage::after {
  content: '';
  position: absolute;
  inset: 0;
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 12px;
  pointer-events: none;
}

[data-theme="light"] .tenant-logo-crop-stage::after {
  border-color: rgba(0, 0, 0, 0.16);
}

.tenant-logo-crop-stage img {
  position: absolute;
  left: 50%;
  top: 50%;
  transform-origin: center center;
  translate: -50% -50%;
  max-width: none;
  user-select: none;
  pointer-events: none;
}

.tenant-logo-crop-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-secondary);
  font-size: 12px;
}

.tenant-logo-crop-controls input {
  flex: 1;
}

.tenant-logo-crop-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

@keyframes tenantDropdownIn {
  from {
    opacity: 0;
    transform: translateY(-6px) scaleY(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scaleY(1);
  }
}

.sidebar-section {
  padding: var(--space-1) var(--space-3);
  margin-top: var(--space-2);
  margin-bottom: var(--space-2);
}

.sidebar-section + .sidebar-section {
  margin-top: var(--space-1);
  padding-top: var(--space-2);
  border-top: 1px solid var(--border-subtle);
}

.sidebar-divider {
  height: 1px;
  background: var(--border-subtle);
  margin: var(--space-2) var(--space-4);
  opacity: 0.6;
}

.sidebar-section-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-tertiary);
  letter-spacing: 0.8px;
  padding: 4px var(--space-2);
  margin-bottom: var(--space-2);
  display: flex;
  align-items: center;
  gap: 6px;
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 8px var(--space-3);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  color: var(--text-secondary);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  margin-bottom: 2px;
  position: relative;
  overflow: hidden;
}

.sidebar-item::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 0;
  background: var(--accent);
  border-radius: 0 2px 2px 0;
  transition: height 0.2s ease;
}

.sidebar-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  transform: translateX(2px);
}

.sidebar-item.active {
  background: var(--accent-subtle);
  color: var(--accent-text);
  font-weight: 500;
}

.sidebar-item.active::before {
  height: 60%;
}

.sidebar-item-icon {
  width: 18px;
  text-align: center;
  flex-shrink: 0;
}

.sidebar-item-text {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: opacity var(--transition-fast);
}

/* Sidebar agent item with pin button */
.sidebar-agent-item {
  position: relative;
  /* Margin matches sidebar-item horizontal layout to allow absolute pin to stay within 215px */
  margin: 0 var(--space-3);
  margin-bottom: 1px;
}

.sidebar-agent-item .sidebar-item {
  margin: 0;
  min-height: 34px;
  padding-top: 5px;
  padding-bottom: 5px;
  padding-right: 28px; /* Leave space for pin icon so text doesn't overlap long names */
}

.sidebar-agent-item.owned .agent-avatar::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: -2px;
  width: 7px;
  height: 7px;
  background: var(--accent-primary);
  border-radius: 50%;
  border: 1.5px solid var(--bg-secondary);
}

.sidebar-pin-btn {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  padding: 3px;
  color: var(--text-tertiary);
  opacity: 0;
  transition: opacity 0.25s ease-in-out, color 0.25s ease-in-out, background 0.25s ease-in-out;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
}

.sidebar-pin-btn:hover {
  color: var(--text-primary);
  background: var(--bg-tertiary);
}

.sidebar-pin-btn.pinned {
  opacity: 0.7;
  color: var(--accent-primary);
}

.sidebar-agent-item:hover .sidebar-pin-btn {
  opacity: 1;
}

/* Pinned icon swap: show pin by default, unpin only when hovering the button itself */
.sidebar-pin-btn.pinned .pin-hover {
  display: none;
}

.sidebar-pin-btn.pinned:hover .pin-default {
  display: none;
}

.sidebar-pin-btn.pinned:hover .pin-hover {
  display: inline;
}

/* When hovering the pin button itself on a pinned agent, turn red to indicate unpin */
.sidebar-pin-btn.pinned:hover {
  color: var(--error);
  background: var(--error-subtle);
}

.sidebar-agent-unread {
  position: absolute;
  right: -7px;
  top: -6px;
  min-width: 14px;
  height: 14px;
  padding: 0;
  border-radius: 999px;
  background: var(--text-primary);
  color: var(--bg-primary);
  font-size: 10px;
  font-weight: 600;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 0 2px var(--bg-primary);
}

.sidebar-agent-unread:not(:empty) {
  padding: 0 4px;
}

.sidebar-agent-drawer {
  position: fixed;
  top: calc(10px + var(--notification-bar-height));
  left: calc(var(--sidebar-width-collapsed) + 8px);
  z-index: 9400;
  width: 278px;
  height: calc(100vh - 20px - var(--notification-bar-height));
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  animation: sidebarAgentDrawerIn 0.14s ease;
}

.sidebar-agent-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  padding: 12px 14px 8px;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.sidebar-agent-drawer .sidebar-agent-search {
  flex-shrink: 0;
}

.sidebar-agent-drawer-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding-bottom: 8px;
}

.sidebar-agent-drawer-list::-webkit-scrollbar {
  width: 4px;
}

.sidebar-agent-drawer-list::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 4px;
}

.sidebar-agent-item.drawer-agent {
  margin-left: 10px;
  margin-right: 10px;
}

@keyframes sidebarAgentDrawerIn {
  from {
    opacity: 0;
    transform: translateX(-6px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.sidebar-footer {
  padding: var(--space-4) var(--space-5);
}

/* Collapse/expand toggle in logo row */
.sidebar-collapse-btn {
  transition: opacity 0.2s ease;
}

.sidebar.collapsed .sidebar-collapse-btn {
  margin-left: 0 !important;
}

/* Account row trigger */
.sidebar-account-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 6px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.sidebar-account-row:hover {
  background: var(--bg-tertiary);
}

/* Account dropdown: main menu full width; language submenu cascades to the right (no squeeze) */
.account-menus-container {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 100;
}

.account-dropdown {
  position: relative;
  width: 100%;
  box-sizing: border-box;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 4px;
  box-shadow: var(--shadow-lg);
  animation: accountDropdownIn 0.15s ease;
}

.account-lang-submenu {
  min-width: 148px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 4px;
  box-shadow: var(--shadow-lg);
  animation: accountDropdownIn 0.15s ease;
}

/* Portaled to document.body so it layers above main content (not clipped by sidebar) */
.account-lang-submenu-portal {
  position: fixed;
  z-index: 9500;
}

.account-lang-submenu-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  padding: 8px 12px;
  border: none;
  background: none;
  border-radius: var(--radius-md);
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.12s ease;
  text-align: left;
}

.account-lang-submenu-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.account-lang-submenu-item.is-active {
  color: var(--accent-primary);
  font-weight: 600;
}

.account-dropdown-language-hover-wrap {
  width: 100%;
}

.account-dropdown-item.language-menu-trigger {
  gap: 10px;
}

.account-dropdown-item.language-menu-trigger > .language-menu-label {
  flex: 1;
  min-width: 0;
  text-align: left;
}

.account-dropdown-item.language-menu-trigger > .language-menu-chevron {
  margin-left: auto;
}

.account-dropdown-item .language-menu-chevron {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-tertiary);
  flex-shrink: 0;
  pointer-events: none;
}

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

.account-dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 12px;
  border: none;
  background: none;
  border-radius: var(--radius-md);
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.12s ease;
}

.account-dropdown-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.account-dropdown-danger {
  color: var(--error);
}

.account-dropdown-danger:hover {
  background: var(--error-subtle);
  color: var(--error);
}

.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  min-height: calc(100dvh - var(--notification-bar-height));
  padding: var(--space-8);
  width: calc(100vw - var(--sidebar-width));
  max-width: calc(100vw - var(--sidebar-width));
  overflow-x: clip;
  box-sizing: border-box;
  transition: all var(--transition-default);
}

/* Chat page needs a fixed viewport height so the inner chat-messages
   can scroll independently. Without this, .main-content grows with content
   (min-height: 100vh) and overflow-y: auto on .chat-messages never fires. */
.main-content.chat-page {
  height: calc(100dvh - var(--notification-bar-height));
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding: 0;
}

.main-content.agent-settings-page {
  padding-top: 8px;
}

/* ─── Collapsed Sidebar Overrides ───────────────────── */
.sidebar.collapsed {
  --sidebar-width: var(--sidebar-width-collapsed);
}

.sidebar.collapsed .sidebar-logo {
  justify-content: center;
  padding: var(--space-3) 0;
  flex-direction: column;
  gap: var(--space-2);
}

.sidebar.collapsed .sidebar-workspace-row {
  justify-content: center;
  flex-direction: column;
  padding: var(--space-3) 0;
  gap: var(--space-2);
}

.sidebar.collapsed .workspace-switcher-trigger {
  width: 36px;
  flex: 0 0 36px;
  justify-content: center;
  padding: 6px;
}

.sidebar.collapsed .workspace-switcher-name,
.sidebar.collapsed .workspace-switcher-chevron {
  display: none;
}

.sidebar.collapsed .tenant-switcher-popover {
  top: 76px;
  left: calc(var(--sidebar-width-collapsed) + 8px);
}

.sidebar.collapsed .sidebar-logo-text {
  display: none;
}

.sidebar.collapsed .sidebar-section-title {
  opacity: 0;
  height: 0;
  margin: 0;
  padding: 0;
  overflow: hidden;
}

.sidebar.collapsed .sidebar-item {
  justify-content: center;
  padding: var(--space-2) 0;
  padding-right: 0 !important;
}

.sidebar.collapsed .sidebar-item-text {
  opacity: 0;
  width: 0;
  display: none;
}

.sidebar.collapsed .sidebar-item-icon {
  margin: 0;
}

.sidebar.collapsed .tenant-switcher,
.sidebar.collapsed .tenant-name {
  display: none;
}

.sidebar.collapsed .sidebar-footer {
  padding: var(--space-4) 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-3);
}

.sidebar.collapsed .sidebar-footer-controls {
  flex-direction: column;
  gap: var(--space-2);
  margin-bottom: 4px !important;
}

.sidebar.collapsed .sidebar-account-row {
  justify-content: center;
  padding: var(--space-2) 0;
}

.sidebar.collapsed .sidebar-footer-user-info,
.sidebar.collapsed .sidebar-account-row > svg {
  display: none;
}

.sidebar.collapsed .account-menus-container {
  position: fixed;
  left: calc(var(--sidebar-width-collapsed) + 8px);
  right: auto;
  bottom: 64px;
  width: 220px;
  z-index: 10020;
}

.sidebar.collapsed .btn-ghost span {
  display: none;
}

/* ─── Components ────────────────────────────────────── */

/* Button */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: 500;
  line-height: 1;
  height: 34px;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.btn-primary {
  background: var(--accent-primary);
  /* Dark theme: near-white bg → needs dark text for contrast */
  color: #0a0a0f;
}

.btn-primary:hover {
  background: var(--accent-hover);
  box-shadow: var(--shadow-sm);
}

.btn-secondary {
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  color: var(--text-primary);
}

.btn-secondary:hover {
  background: var(--bg-hover);
  border-color: var(--accent-primary);
  color: var(--text-primary);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
}

.btn:disabled:hover {
  background: inherit;
  border-color: inherit;
  box-shadow: none;
}

.btn-ghost {
  color: var(--text-secondary);
}

.btn-ghost:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.btn-danger {
  background: var(--error);
  color: white;
}

.btn-danger:hover {
  background: #dc2626;
}

/* Card */
.card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  transition: all var(--transition-default);
}

.card:hover {
  border-color: var(--border-default);
  box-shadow: var(--shadow-sm);
}

.card-clickable {
  cursor: pointer;
}

.card-clickable:hover {
  border-color: var(--accent-primary);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

/* Metric tooltip */
.metric-tooltip-trigger {
  position: relative;
}

.metric-tooltip {
  display: none;
  position: absolute;
  bottom: calc(100% + 6px);
  left: 0;
  background: var(--bg-elevated);
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.5;
  padding: 8px 12px;
  border-radius: 6px;
  border: 1px solid var(--border-subtle);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  white-space: normal;
  width: 260px;
  z-index: 100;
  pointer-events: none;
}

.metric-tooltip-trigger:hover .metric-tooltip {
  display: block;
}

/* Status dot (used in Dashboard / AgentDetail) */
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

.status-dot.running {
  background: var(--status-running);
  box-shadow: 0 0 6px var(--status-running);
}

.status-dot.idle {
  background: var(--status-idle);
  box-shadow: 0 0 6px var(--status-idle);
}

.status-dot.stopped {
  background: var(--status-stopped);
}

.status-dot.error {
  background: var(--status-error);
  box-shadow: 0 0 6px var(--status-error);
}

.status-dot.creating {
  background: var(--info);
  animation: pulse 1.5s infinite;
}

.status-dot.disconnected {
  background: var(--warning);
}

/* Agent avatar — sidebar letter icon */
.agent-avatar {
  position: relative;
  width: 20px;
  height: 20px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--bg-tertiary);
  flex-shrink: 0;
  line-height: 1;
  letter-spacing: -0.02em;
}

/* OpenClaw agent — dashed border to indicate external/connected */
.agent-avatar.openclaw {
  border: 1.5px dashed var(--text-tertiary);
  background: transparent;
}

/* OpenClaw link icon — top-right of avatar */
.agent-avatar-link {
  position: absolute;
  top: -3px;
  right: -3px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-tertiary);
}

/* Small badge dot — absolute over avatar */
.agent-avatar-badge {
  position: absolute;
  bottom: -1px;
  right: -1px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  border: 1.5px solid var(--bg-secondary);
}

.agent-avatar-badge.error {
  background: var(--status-error);
}

.agent-avatar-badge.creating {
  background: var(--info);
  animation: pulse 1.5s infinite;
}

.agent-avatar-badge.disconnected {
  background: var(--warning, #f59e0b);
}

@keyframes pulse {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.4;
  }
}

/* Badge */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 2px var(--space-2);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 500;
}

.badge-success {
  background: var(--success-subtle);
  color: var(--success);
}

.badge-warning {
  background: var(--warning-subtle);
  color: var(--warning);
}

.badge-error {
  background: var(--error-subtle);
  color: var(--error);
}

.badge-info {
  background: var(--accent-subtle);
  color: var(--accent-text);
}

/* Tabs */
.tabs {
  display: flex;
  gap: var(--space-1);
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: var(--space-6);
  position: sticky;
  top: var(--notification-bar-height);
  background: var(--bg-primary);
  z-index: 5;
  padding-top: var(--space-2);
}

.tab {
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-sm);
  color: var(--text-tertiary);
  border-bottom: 2px solid transparent;
  transition: all var(--transition-fast);
  cursor: pointer;
}

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

.tab.active {
  color: var(--text-primary);
  border-bottom-color: var(--accent-primary);
}

/* Session sidebar admin tabs — segment control style */
.session-sidebar-segment-control {
  display: flex;
  margin: 0 12px 8px;
  padding: 2px;
  height: 28px;
  background: var(--accent-subtle);
  border-radius: 6px;
  border: 1px solid var(--border-subtle);
  box-sizing: border-box;
}

.session-sidebar-segment-control .segment-item {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: var(--text-tertiary);
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
  user-select: none;
  border: none;
  background: none;
  padding: 0;
  line-height: 1;
}

.session-sidebar-segment-control .segment-item:hover {
  color: var(--text-secondary);
}

.session-sidebar-segment-control .segment-item.active {
  background: var(--segment-active-bg);
  color: var(--segment-active-text);
  font-weight: 500;
}

/* Custom scope dropdown */
.scope-dropdown {
  position: relative;
  flex: 1;
  min-width: 0;
}
.scope-dropdown-trigger {
  all: unset;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  max-width: 120px;
  box-sizing: border-box;
}
.scope-dropdown-trigger:hover .scope-dropdown-label {
  color: var(--text-primary);
}
.scope-dropdown-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color 0.12s ease;
}
.scope-dropdown-chevron {
  flex-shrink: 0;
  color: var(--text-tertiary);
  transition: transform 0.15s ease;
}
.scope-dropdown-chevron--open {
  transform: rotate(180deg);
}
.scope-dropdown-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  min-width: 140px;
  max-width: 200px;
  padding: 4px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
  z-index: 90;
  animation: fadeIn 0.12s ease;
}
[data-theme="dark"] .scope-dropdown-menu {
  background: rgba(32, 32, 40, 0.95);
  border-color: rgba(255, 255, 255, 0.08);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}
.scope-dropdown-item {
  padding: 6px 10px;
  font-size: 12px;
  color: var(--text-secondary);
  border-radius: 5px;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: background 0.1s ease, color 0.1s ease;
}
.scope-dropdown-item:hover {
  background: var(--bg-secondary);
  color: var(--text-primary);
}
.scope-dropdown-item--active {
  color: var(--text-primary);
  font-weight: 500;
}
.scope-dropdown-item--disabled {
  color: var(--text-tertiary);
  cursor: default;
  font-style: italic;
}
.scope-dropdown-item--disabled:hover {
  background: none;
  color: var(--text-tertiary);
}

/* Sidebar toggle button — unified for collapse & expand */
.session-sidebar-toggle-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: none;
  border: none;
  color: var(--text-tertiary);
  cursor: pointer;
  flex-shrink: 0;
  padding: 0;
  transition: background 0.12s ease, color 0.12s ease;
}
.session-sidebar-toggle-btn:hover {
  background: var(--bg-secondary);
  color: var(--text-secondary);
}
.session-sidebar-toggle-btn--floating {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 10;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
}
.session-sidebar-toggle-btn--floating:hover {
  background: var(--bg-secondary);
}

/* New session button */
.new-session-btn {
  width: 100%;
  height: 28px;
  padding: 0 10px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.15s ease;
  box-sizing: border-box;
  line-height: 1;
}

.new-session-btn:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border-color: var(--border-strong);
}
[data-theme="dark"] .new-session-btn {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.08);
  color: var(--text-secondary);
}
[data-theme="dark"] .new-session-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.14);
  color: var(--text-primary);
}

/* Session item — delete button & message count hover behaviour */
.session-del-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  padding: 0;
  border: none;
  border-radius: 4px;
  background: none;
  color: var(--text-tertiary);
  cursor: pointer;
  transition: color 0.35s ease-in-out, background 0.35s ease-in-out;
}

.session-item:hover .session-del-btn {
  display: flex;
}

.session-del-btn:hover {
  color: var(--status-error);
  background: var(--bg-hover);
}

.session-item:hover .session-msg-count {
  display: none;
}

/* Page header */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-6);
}

/* When inside the chat page (main-content.chat-page removes outer padding),
   give page-header its own padding to replicate the normal main-content spacing */
.main-content.chat-page .page-header {
  padding: var(--space-4) var(--space-8) 0;
  flex-shrink: 0;
  margin-bottom: 0;
}

.page-title {
  font-size: var(--text-2xl);
  font-weight: 600;
}

.page-subtitle {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  margin-top: var(--space-1);
}

/* Grid */
.agent-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--space-5);
}

/* Forms */
.form-group {
  margin-bottom: var(--space-5);
}

.form-label {
  display: block;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: var(--space-2);
}

.form-input {
  width: 100%;
  height: 38px;
}

.form-input.input-error {
  border-color: var(--error);
}

.form-input.input-error:focus {
  border-color: var(--error);
  box-shadow: 0 0 0 2px var(--error-subtle);
}

.form-textarea {
  width: 100%;
  min-height: 100px;
  resize: vertical;
}

/* Login page — premium split-screen */
.login-page {
  display: flex;
  min-height: calc(100dvh - var(--notification-bar-height));
  background: #f8f8f6;
  color: #111114;
}

/* ── Left: Hero Branding Panel ── */
.login-hero {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  min-height: calc(100dvh - var(--notification-bar-height));
  background: #f8f8f6;
}

.login-hero-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 20% 22%, rgba(17, 17, 20, 0.055), transparent 0 1px, transparent 1.5px),
    radial-gradient(circle at 78% 18%, rgba(124, 124, 114, 0.09), transparent 32%),
    radial-gradient(circle at 22% 76%, rgba(160, 166, 151, 0.13), transparent 36%),
    linear-gradient(125deg, rgba(255, 255, 255, 0.92), rgba(245, 245, 240, 0.34) 46%, rgba(255,255,255,0.72)),
    #f8f8f6;
  z-index: 0;
}

.login-hero-bg::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(17, 17, 20, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(17, 17, 20, 0.035) 1px, transparent 1px);
  background-size: 72px 72px;
  mask-image:
    linear-gradient(90deg, rgba(0,0,0,0.12), rgba(0,0,0,0.04) 70%, transparent),
    linear-gradient(180deg, transparent 0%, rgba(0,0,0,0.7) 12%, rgba(0,0,0,0.95) 76%, transparent 100%);
  mask-composite: intersect;
}

.login-hero-bg::after {
  content: '';
  position: absolute;
  left: 9%;
  right: 11%;
  bottom: 15%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(17, 17, 20, 0.12), transparent);
  opacity: 0.55;
}

.login-hero-content {
  position: relative;
  z-index: 2;
  max-width: 520px;
  padding: 48px;
  transform: translate(-8%, -4%);
}

.login-hero-mark {
  position: absolute;
  top: 54px;
  left: 64px;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: #9b9ba4;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.02em;
}

.login-hero-mark-logo {
  width: 18px;
  height: 18px;
  object-fit: contain;
  opacity: 0.82;
}

.login-hero-mark-divider {
  width: 24px;
  height: 1px;
  background: rgba(17, 17, 20, 0.12);
}

.login-hero-logo {
  width: 120px;
  height: 120px;
  margin-bottom: 32px;
  filter: brightness(1.1) drop-shadow(0 0 20px rgba(255, 255, 255, 0.1));
  opacity: 0.85;
  transition: all 300ms ease;
}

.login-hero-logo:hover {
  opacity: 1;
  filter: brightness(1.2) drop-shadow(0 0 30px rgba(255, 255, 255, 0.2));
  transform: scale(1.05);
}

.login-hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(255, 255, 255, 0.095);
  font-size: 12px;
  color: rgba(255, 255, 255, 0.68);
  margin-bottom: 32px;
}

.login-hero-badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: 0 0 12px rgba(255, 255, 255, 0.34);
}

.login-hero-title {
  font-size: 48px;
  font-weight: 500;
  line-height: 1.16;
  letter-spacing: 0;
  color: #141417;
  margin-bottom: 16px;
  font-family: Georgia, 'Times New Roman', serif;
}

.login-hero-title span {
  color: #5c5c66;
  font-style: italic;
  font-weight: 400;
}

.login-hero-desc {
  font-size: 16px;
  line-height: 1.65;
  color: #767681;
  margin-bottom: 0;
}

.login-hero-features {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.login-hero-feature {
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 16px 18px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(255, 255, 255, 0.075);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.035);
  transition: background 180ms ease, border-color 180ms ease, transform 180ms ease;
}

.login-hero-feature:hover {
  background: rgba(255, 255, 255, 0.055);
  border-color: rgba(255, 255, 255, 0.12);
  transform: translateY(-1px);
}

.login-hero-feature-icon {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, 0.82);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
}

.login-hero-feature-title {
  font-size: 14px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.9);
}

.login-hero-feature-desc {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.46);
  margin-top: 2px;
}

/* ── Right: Form Panel ── */
.login-form-panel {
  width: 500px;
  min-width: 500px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f8f8f6;
  position: relative;
}

.login-form-wrapper {
  width: 100%;
  max-width: 376px;
  padding: 46px 0;
  position: relative;
}

.login-language-switcher {
  position: absolute;
  top: 0;
  right: 0;
  display: inline-flex;
  align-items: center;
  height: 38px;
  width: 42px;
  padding: 0;
  border: 1px solid rgba(17, 17, 20, 0.1);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.8);
  color: #777782;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 150ms ease, border-color 150ms ease, color 150ms ease, transform 150ms ease;
}

.login-language-switcher:hover {
  color: #141417;
  border-color: rgba(17, 17, 20, 0.18);
  background: #fff;
  transform: translateY(-1px);
}

.login-language-switcher:focus-visible {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px var(--accent-subtle);
}

.login-language-switcher-icon {
  display: inline-flex;
  line-height: 1;
  margin: 0 auto;
}

.login-language-switcher-text {
  letter-spacing: 0;
}

.login-form-header {
  margin-bottom: 32px;
  padding-top: 16px;
}

.login-form-logo {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 24px;
  color: #17171a;
  display: flex;
  align-items: center;
}

/* Invert the black logo to white when on dark backgrounds */
[data-theme="dark"] .login-logo-img {
  filter: invert(1);
}


.login-form-title {
  font-size: 28px;
  font-weight: 600;
  color: #17171a;
  letter-spacing: 0;
  margin-bottom: 8px;
}

.login-form-subtitle {
  font-size: 14px;
  color: #7d7d86;
  line-height: 1.5;
}

.login-error {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--error-subtle);
  color: var(--error);
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 20px;
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.login-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.login-field label {
  font-size: 13px;
  font-weight: 600;
  color: #686873;
}

.login-field input,
.login-field select {
  height: 50px;
  padding: 0 32px 0 15px;
  background: #fff;
  border: 1px solid rgba(17, 17, 20, 0.12);
  border-radius: 12px;
  font-size: 14px;
  color: #17171a;
  transition: border-color 150ms ease, background 150ms ease, box-shadow 150ms ease;
  outline: none;
}

.login-field select {
  cursor: pointer;
}

.login-field input::placeholder {
  color: #a1a1aa;
}

.login-field input:focus,
.login-field select:focus {
  border-color: rgba(17, 17, 20, 0.42);
  box-shadow: 0 0 0 4px rgba(17, 17, 20, 0.06);
  background: #fff;
}

.login-field input:-webkit-autofill,
.login-field input:-webkit-autofill:hover,
.login-field input:-webkit-autofill:focus,
.login-field input:-webkit-autofill:active {
  -webkit-text-fill-color: #17171a;
  caret-color: #17171a;
  box-shadow: 0 0 0 1000px #fff inset, 0 0 0 1px rgba(17, 17, 20, 0.12) inset;
  transition: background-color 9999s ease-in-out 0s;
}

.login-submit {
  height: 50px;
  border: none;
  border-radius: 12px;
  background: #101014;
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 200ms ease;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 4px;
}

.login-submit:hover:not(:disabled) {
  background: #000;
  transform: translateY(-1px);
  box-shadow: 0 12px 28px rgba(17, 17, 20, 0.16);
}

.login-submit:active:not(:disabled) {
  transform: translateY(0);
}

.login-submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.login-verification-actions {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: -4px;
}

.login-verification-actions button {
  border: none;
  background: transparent;
  color: #686873;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  padding: 4px 0;
}

.login-verification-actions button:hover:not(:disabled) {
  color: #17171a;
  text-decoration: underline;
}

.login-verification-actions button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.login-spinner {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

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

.login-switch {
  text-align: center;
  margin-top: 24px;
  font-size: 13px;
  color: var(--text-tertiary);
}

.login-switch a {
  color: var(--accent-text);
  font-weight: 500;
  text-decoration: none;
}

.login-switch a:hover {
  text-decoration: underline;
}

/* ─── Company Setup Page ───────────────────────────── */
.company-setup-page {
  min-height: calc(100dvh - var(--notification-bar-height));
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(circle at 18% 20%, rgba(17, 17, 20, 0.055), transparent 0 1px, transparent 1.5px),
    radial-gradient(circle at 78% 18%, rgba(124, 124, 114, 0.08), transparent 34%),
    radial-gradient(circle at 24% 78%, rgba(160, 166, 151, 0.11), transparent 38%),
    linear-gradient(125deg, rgba(255, 255, 255, 0.92), rgba(245, 245, 240, 0.35) 46%, rgba(255,255,255,0.72)),
    var(--bg-primary);
  padding: 40px 20px;
  position: relative;
  overflow: hidden;
}

.cosmic-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
}

/* ─── Dark cosmic theme for CompanySetup ──────────────── */
.company-setup-page--dark {
  background:
    radial-gradient(ellipse 80% 60% at 50% 35%, rgba(40, 60, 110, 0.18), transparent 70%),
    radial-gradient(ellipse 60% 50% at 80% 25%, rgba(80, 60, 140, 0.12), transparent 70%),
    #08090d;
  color: #f5f5f7;
}

.cosmic-particles {
  position: absolute !important;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
}

.cosmic-particles canvas {
  position: absolute !important;
  inset: 0;
  width: 100% !important;
  height: 100% !important;
}

.company-setup-newstar {
  position: absolute;
  top: 18%;
  right: 14%;
  width: 140px;
  height: 140px;
  pointer-events: none;
  z-index: 1;
  filter: drop-shadow(0 0 6px rgba(255, 255, 255, 0.22));
}

.company-setup-page--dark .company-setup-container {
  position: relative;
  z-index: 2;
}

.company-setup-page--dark .company-setup-header--genesis h1 {
  color: #f5f5f7;
  text-shadow: 0 2px 24px rgba(0, 0, 0, 0.4);
}

.company-setup-page--dark .company-name-form input {
  color: #f5f5f7;
  border-bottom-color: rgba(255, 255, 255, 0.22);
  caret-color: #f5f5f7;
}

.company-setup-page--dark .company-name-form input:focus {
  border-bottom-color: rgba(255, 255, 255, 0.55);
}

.company-setup-page--dark .company-name-form input::placeholder {
  color: rgba(255, 255, 255, 0.32);
}

.company-setup-page--dark .onboarding-primary-btn,
.onboarding-page--dark .onboarding-primary-btn {
  background: #f5f5f7;
  color: #111116;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(255, 255, 255, 0.1);
  transition: transform 140ms ease, box-shadow 140ms ease;
}

.company-setup-page--dark .onboarding-primary-btn:hover:not(:disabled),
.onboarding-page--dark .onboarding-primary-btn:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 16px 44px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(255, 255, 255, 0.2);
}

.company-setup-page--dark .onboarding-primary-btn:disabled,
.onboarding-page--dark .onboarding-primary-btn:disabled {
  background: rgba(255, 255, 255, 0.65);
}

.company-setup-page--dark .company-setup-join-link {
  color: rgba(255, 255, 255, 0.5);
  text-decoration-color: rgba(255, 255, 255, 0.2);
}

.company-setup-page--dark .company-setup-join-link:hover {
  color: #f5f5f7;
  text-decoration-color: #f5f5f7;
}

.company-setup-page--dark .login-error {
  background: rgba(255, 80, 90, 0.12);
  color: rgba(255, 180, 185, 0.95);
  border: 1px solid rgba(255, 80, 90, 0.25);
}

.company-setup-lang-switcher {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 42px;
  height: 38px;
  padding: 0;
  border-radius: 12px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 101;
  transition: background 140ms ease, border-color 140ms ease, color 140ms ease;
}

.company-setup-page--dark .company-setup-lang-switcher {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.14);
  color: rgba(255, 255, 255, 0.7);
}

.company-setup-page--dark .company-setup-lang-switcher:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.22);
  color: #f5f5f7;
}

.company-setup-container {
  max-width: 720px;
  width: 100%;
  position: relative;
  z-index: 1;
}

.company-setup-header {
  text-align: center;
  margin-bottom: 46px;
}

.company-setup-header h1 {
  font-size: 28px;
  font-weight: 600;
  margin: 16px 0 8px;
  letter-spacing: 0;
}

.company-setup-subtitle {
  font-size: 14px;
  color: var(--text-tertiary);
}

.company-setup-panels {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 0;
  align-items: stretch;
}

.company-setup-panels.single {
  grid-template-columns: 1fr;
  max-width: 400px;
  margin: 0 auto;
}

.company-setup-panel {
  background: color-mix(in srgb, var(--bg-elevated) 82%, transparent);
  border: 1px solid var(--border-default);
  border-radius: 14px;
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  box-shadow: 0 14px 48px rgba(17, 17, 20, 0.035);
  transition: border-color 200ms ease, background 200ms ease, box-shadow 200ms ease;
}

.company-setup-panel:hover {
  background: color-mix(in srgb, var(--bg-elevated) 92%, transparent);
  border-color: var(--border-strong);
  box-shadow: 0 18px 56px rgba(17, 17, 20, 0.055);
}

.company-setup-panel-header {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-primary);
}

.company-setup-panel-header h3 {
  font-size: 16px;
  font-weight: 600;
  margin: 0;
}

.company-setup-panel-desc {
  font-size: 13px;
  color: var(--text-tertiary);
  line-height: 1.5;
  margin: 0;
}

.company-setup-divider {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 20px;
}

.company-setup-divider span {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-tertiary);
  letter-spacing: 1px;
}

.company-setup-hint {
  text-align: center;
  font-size: 13px;
  color: var(--text-tertiary);
  margin-top: 16px;
}

.company-setup-header--ritual {
  max-width: 560px;
  margin-left: auto;
  margin-right: auto;
  margin-bottom: 32px;
}

.company-setup-header--genesis {
  max-width: 640px;
  margin: 0 auto 56px;
  text-align: center;
}

.company-setup-header--genesis h1 {
  font-size: 34px;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.01em;
  margin: 0;
  color: var(--text-primary);
}

.company-setup-join-link {
  display: block;
  margin: 40px auto 0;
  background: none;
  border: 0;
  padding: 6px 10px;
  font-size: 13px;
  color: var(--text-tertiary);
  cursor: pointer;
  text-decoration: underline;
  text-decoration-color: rgba(17, 17, 20, 0.18);
  text-underline-offset: 4px;
  transition: color 160ms ease, text-decoration-color 160ms ease;
}

.company-setup-join-link:hover {
  color: var(--text-primary);
  text-decoration-color: var(--text-primary);
}

.join-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(17, 17, 20, 0.42);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 20px;
  animation: join-modal-fade 160ms ease;
}

@keyframes join-modal-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

.join-modal {
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: 16px;
  width: 100%;
  max-width: 420px;
  padding: 32px 28px 28px;
  position: relative;
  box-shadow: 0 24px 80px rgba(17, 17, 20, 0.18);
  animation: join-modal-pop 200ms ease;
}

@keyframes join-modal-pop {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.join-modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  border: 0;
  background: transparent;
  color: var(--text-tertiary);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 140ms ease, color 140ms ease;
}

.join-modal-close:hover {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

.join-modal-close:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.join-modal-title {
  font-size: 20px;
  font-weight: 600;
  margin: 0 0 8px;
  color: var(--text-primary);
}

.join-modal-desc {
  font-size: 13px;
  color: var(--text-tertiary);
  margin: 0 0 20px;
  line-height: 1.5;
}

.join-modal-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.join-modal-input {
  width: 100%;
  height: 44px;
  padding: 0 14px;
  border: 1px solid var(--border-default);
  border-radius: 10px;
  background: var(--bg-primary);
  color: var(--text-primary);
  outline: none;
  font-size: 16px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  text-transform: uppercase;
  letter-spacing: 2px;
  transition: border-color 140ms ease;
}

.join-modal-input:focus {
  border-color: var(--text-primary);
}

.join-modal-form .onboarding-primary-btn {
  width: 100%;
  margin-top: 4px;
}

.onboarding-kicker {
  font-size: 12px;
  letter-spacing: 0.22em;
  color: var(--text-tertiary);
  margin-bottom: 24px;
}

.onboarding-kicker--dark {
  color: rgba(255, 255, 255, 0.46);
  margin-bottom: 14px;
}

.company-name-form {
  max-width: 520px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
}

.company-name-form input {
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--border-strong);
  background: transparent;
  color: var(--text-primary);
  outline: none;
  text-align: center;
  font-size: 30px;
  font-family: Georgia, 'Times New Roman', serif;
  font-style: italic;
  padding: 12px 8px 18px;
}

.company-name-form input::placeholder {
  color: var(--text-tertiary);
}

.onboarding-primary-btn {
  border: 0;
  background: #111116;
  color: #fff;
  min-height: 44px;
  padding: 0 24px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  box-shadow: 0 12px 30px rgba(17, 17, 22, 0.14);
}

.onboarding-primary-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.company-setup-join-inline {
  margin: 30px auto 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: 12px;
  color: var(--text-tertiary);
}

.company-setup-join-inline input {
  height: 34px;
  width: 160px;
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  background: var(--bg-elevated);
  color: var(--text-primary);
  padding: 0 10px;
  outline: none;
}

.company-setup-join-inline button {
  height: 34px;
  padding: 0 12px;
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  background: var(--bg-secondary);
  color: var(--text-primary);
  cursor: pointer;
}

/* ─── Founding Onboarding ───────────────────────────── */
.onboarding-page {
  min-height: calc(100dvh - var(--notification-bar-height));
  position: relative;
  overflow: hidden;
}

.onboarding-page--light {
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(circle at 20% 18%, rgba(17, 17, 20, 0.055), transparent 0 1px, transparent 1.5px),
    linear-gradient(rgba(17, 17, 20, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(17, 17, 20, 0.025) 1px, transparent 1px),
    var(--bg-primary);
  background-size: auto, 72px 72px, 72px 72px, auto;
}

.onboarding-page--dark {
  background: #101115;
  color: rgba(255, 255, 255, 0.92);
}

.onboarding-lang,
.onboarding-back,
.onboarding-skip {
  position: absolute;
  z-index: 2;
  border: 1px solid var(--border-subtle);
  background: color-mix(in srgb, var(--bg-elevated) 84%, transparent);
  color: var(--text-secondary);
  border-radius: 10px;
  cursor: pointer;
}

.onboarding-lang {
  top: 18px;
  right: 18px;
  width: 42px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.onboarding-page--dark .onboarding-lang,
.onboarding-page--dark .onboarding-back,
.onboarding-page--dark .onboarding-skip {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.72);
}

.onboarding-back {
  top: 22px;
  left: 28px;
  padding: 8px 10px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.onboarding-skip {
  top: 22px;
  right: 78px;
  padding: 8px 12px;
}

.assistant-stage {
  min-height: 100dvh;
  display: grid;
  grid-template-columns: 44% 56%;
}

.assistant-spotlight {
  position: relative;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
}

.assistant-light-beam {
  position: absolute;
  left: 39%;
  top: -8%;
  width: 180px;
  height: 78%;
  background: linear-gradient(180deg, rgba(255,255,255,0.18), rgba(255,255,255,0.02) 70%, transparent);
  clip-path: polygon(42% 0, 58% 0, 100% 100%, 0 100%);
  filter: blur(0.2px);
}

.assistant-silhouette {
  position: absolute;
  left: 41%;
  top: 36%;
  width: 120px;
  height: 250px;
  filter: drop-shadow(0 32px 30px rgba(0,0,0,0.3));
}

.assistant-silhouette span {
  position: absolute;
  left: 36px;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: linear-gradient(145deg, #696a70, #3e3f45);
  border: 1px solid rgba(255,255,255,0.28);
}

.assistant-silhouette strong {
  position: absolute;
  left: 18px;
  top: 88px;
  width: 92px;
  height: 132px;
  border-radius: 54px 54px 0 0;
  background: linear-gradient(145deg, #62636a, #33343a);
  border: 1px solid rgba(255,255,255,0.2);
}

.assistant-panel {
  width: min(560px, calc(100vw - 40px));
  align-self: center;
  margin-left: 10%;
}

.assistant-panel h1 {
  font-family: Georgia, 'Times New Roman', serif;
  font-weight: 400;
  line-height: 1.25;
  font-size: 32px;
  margin: 0 0 14px;
  letter-spacing: 0;
}

.assistant-panel p {
  color: rgba(255,255,255,0.56);
  margin: 0 0 28px;
}

.assistant-name-input {
  width: 100%;
  border: 0;
  border-bottom: 1px solid rgba(255,255,255,0.28);
  background: transparent;
  color: rgba(255,255,255,0.92);
  font-family: Georgia, 'Times New Roman', serif;
  font-style: italic;
  font-size: 28px;
  padding: 14px 0;
  outline: none;
}

.assistant-name-input::placeholder,
.assistant-options textarea::placeholder {
  color: rgba(255,255,255,0.36);
}

.assistant-expand {
  width: 100%;
  margin: 22px 0 12px;
  padding: 12px 0;
  background: transparent;
  border: 0;
  border-bottom: 1px solid rgba(255,255,255,0.12);
  color: rgba(255,255,255,0.58);
  display: flex;
  justify-content: space-between;
  cursor: pointer;
}

.assistant-options {
  display: grid;
  gap: 18px;
  margin-bottom: 20px;
}

.assistant-options label {
  display: block;
  margin-bottom: 8px;
  color: rgba(255,255,255,0.52);
  font-size: 12px;
}

.assistant-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.assistant-chips button {
  border: 1px solid rgba(255,255,255,0.16);
  background: transparent;
  color: rgba(255,255,255,0.72);
  border-radius: 999px;
  padding: 7px 12px;
  cursor: pointer;
}

.assistant-chips button.active {
  background: #fff;
  color: #111116;
}

.assistant-options textarea {
  min-height: 64px;
  resize: vertical;
  border: 0;
  border-bottom: 1px solid rgba(255,255,255,0.18);
  background: transparent;
  color: rgba(255,255,255,0.86);
  outline: none;
}

.assistant-footer {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: 20px;
  color: rgba(255,255,255,0.42);
  font-size: 12px;
  margin-top: 26px;
}

.assistant-footer-skip {
  background: none;
  border: 0;
  padding: 6px 4px;
  color: rgba(255, 255, 255, 0.42);
  font-size: 13px;
  cursor: pointer;
  transition: color 140ms ease;
}

.assistant-footer-skip:hover:not(:disabled) {
  color: rgba(255, 255, 255, 0.88);
}

.assistant-footer-skip:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.opening-stage,
.onboarding-center-card {
  text-align: center;
  position: relative;
  z-index: 1;
}

.opening-stage--minimal {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 36px;
  padding: 40px 20px;
}

.opening-stage--minimal h1 {
  margin: 0;
}

.opening-newstar {
  width: 130px;
  height: 130px;
  display: block;
  filter: drop-shadow(0 0 6px rgba(0, 0, 0, 0.1));
}

.opening-stage h1,
.onboarding-center-card h1 {
  font-family: Georgia, 'Times New Roman', serif;
  font-weight: 400;
  font-size: 36px;
  margin: 0 0 12px;
}

.opening-stage p {
  color: var(--text-secondary);
  margin: 0 0 28px;
  line-height: 1.7;
}

.opening-cards {
  display: flex;
  gap: 16px;
  justify-content: center;
  align-items: center;
  margin-bottom: 34px;
}

.opening-cards div {
  width: 72px;
  height: 72px;
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 28px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  box-shadow: 0 18px 42px rgba(17,17,20,0.08);
  transform: rotate(-8deg);
}

.opening-cards div:nth-child(2) {
  background: #111116;
  color: #fff;
  transform: translateY(-8px);
}

.opening-cards div:nth-child(3) {
  transform: rotate(8deg);
}

.opening-confetti span {
  position: absolute;
  width: 6px;
  height: 6px;
  background: #111116;
  animation: floatConfetti 4s ease-in-out infinite;
}

.opening-confetti span:nth-child(1) { left: 18%; top: 20%; }
.opening-confetti span:nth-child(2) { left: 68%; top: 14%; animation-delay: .6s; }
.opening-confetti span:nth-child(3) { left: 82%; top: 42%; animation-delay: 1.1s; }
.opening-confetti span:nth-child(4) { left: 15%; top: 58%; animation-delay: 1.6s; background: transparent; border: 1px solid #111116; border-radius: 50%; }
.opening-confetti span:nth-child(5) { left: 58%; top: 78%; animation-delay: 2.1s; }

@keyframes floatConfetti {
  0%, 100% { transform: translateY(0) rotate(0deg); opacity: .9; }
  50% { transform: translateY(-14px) rotate(18deg); opacity: .55; }
}

.opening-check {
  margin-top: 20px;
  color: var(--text-tertiary);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
}

.onboarding-error {
  margin: 12px 0;
  color: var(--error);
  font-size: 13px;
}

@media (max-width: 820px) {
  .assistant-stage {
    grid-template-columns: 1fr;
  }
  .assistant-spotlight {
    min-height: 260px;
    border-right: 0;
  }
  .assistant-panel {
    margin: 0 auto 40px;
  }
  .assistant-silhouette {
    top: 28%;
  }
  .assistant-footer,
  .company-setup-join-inline {
    flex-direction: column;
  }
}

@media (max-width: 700px) {
  .company-setup-panels {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .company-setup-divider {
    padding: 0;
  }
}

/* Responsive: collapse to single column on small screens */
@media (max-width: 900px) {
  .login-page {
    flex-direction: column;
  }

  .login-hero {
    min-height: 40vh;
    padding: 40px 20px;
  }

  .login-hero-title {
    font-size: 32px;
  }

  .login-company-map {
    display: none;
  }

  .login-hero-content {
    transform: none;
  }

  .login-hero-mark {
    display: none;
  }

  .login-hero-features {
    display: none;
  }

  .login-form-panel {
    width: 100%;
    min-width: unset;
    border-left: none;
    border-top: 1px solid var(--border-subtle);
    padding: 40px 24px;
  }

  .login-language-switcher {
    right: 0;
  }
}

/* Chat */
.chat-container {
  display: flex;
  flex-direction: column;
  /* Fill the chat-page main-content area (which is padding: 0, height: 100vh).
     The page-header inside Chat is ~68px; flex: 1 + min-height: 0 lets
     .chat-messages own the remaining space and scroll independently. */
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

/* Restore horizontal padding that main-content normally provides */
.main-content.chat-page .chat-container {
  padding: 0 var(--space-8);
}


/* When live panel is active, switch to horizontal layout */
.chat-container.chat-with-live-panel {
  flex-direction: row;
  gap: 0;
}

.chat-with-live-panel > .chat-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.chat-main {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.agent-detail-page--chat {
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.agent-detail-header {
  flex-shrink: 0;
}

.agent-detail-page--chat .agent-detail-header {
  min-height: 42px;
  padding: 5px 0;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
}

.main-content.chat-page .agent-detail-page--chat .agent-detail-header {
  padding: 6px var(--space-8) 6px 20px;
  margin-bottom: 4px;
}

.agent-detail-page--settings .agent-detail-header {
  min-height: 0;
  justify-content: flex-end;
  margin-bottom: 0;
}

.agent-detail-page--settings .agent-detail-actions {
  display: none;
}

.agent-detail-page--settings > .tabs {
  align-items: center;
  border-bottom: none;
  padding-top: 0;
  margin-top: 0;
}

.agent-tabs-chat-action {
  margin-left: auto;
  flex-shrink: 0;
}

.agent-settings-savebar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  margin-bottom: 8px;
}

.agent-detail-identity {
  position: relative;
  min-width: 0;
  overflow: hidden;
}

.agent-detail-identity-trigger {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
}

.agent-detail-identity--compact .agent-detail-identity-trigger {
  gap: 9px;
  cursor: default;
  padding: 0 4px;
  border-radius: 9px;
  align-items: center;
}

.agent-detail-avatar {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: var(--accent-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-primary);
  font-size: 17px;
  font-weight: 650;
  flex-shrink: 0;
}

.agent-detail-identity--compact .agent-detail-avatar {
  width: 24px;
  height: 24px;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 650;
}

.agent-detail-page--chat .page-title {
  font-size: 14px;
  line-height: 1.2;
}

.agent-detail-page--chat .page-subtitle {
  font-size: 12px;
  margin-top: 2px !important;
}

.agent-detail-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.agent-top-action {
  height: 32px;
  gap: 6px;
  padding: 0 10px;
  font-size: 13px;
}

.agent-top-action:hover {
  color: #212121;
  background: rgba(34, 55, 89, 0.08);
}
.agent-top-action.active {
  color: #212121;
  background: rgba(34, 55, 89, 0.08);
  border-color: rgba(34, 55, 89, 0.18);
}

/* ══════════════════════════════════════════════════════
   Agent Info Hover Card — Enterprise SaaS Design System
   Glass card, gradient hero, icon headers, inner cards
   ══════════════════════════════════════════════════════ */
.agent-info-card {
  position: absolute;
  left: 0;
  top: calc(100% + 8px);
  width: min(560px, 86vw);
  padding: 0;
  border-radius: 16px;
  color: var(--text-primary);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px);
  pointer-events: none;
  transition: opacity 180ms cubic-bezier(0.16, 1, 0.3, 1),
              transform 180ms cubic-bezier(0.16, 1, 0.3, 1),
              visibility 180ms ease,
              box-shadow 250ms ease;
  z-index: 80;
  overflow: hidden;
  /* Glass card defaults */
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.45);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

[data-theme="dark"] .agent-info-card {
  background: rgba(28, 28, 38, 0.82);
  border-color: rgba(255, 255, 255, 0.08);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
}

/* Card open state (click-triggered) */
.agent-info-card--open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  pointer-events: auto;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08), 0 2px 8px rgba(0, 0, 0, 0.04);
}
[data-theme="dark"] .agent-info-card--open {
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35), 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* Fix: agent-info-card position override */
.agent-detail-identity .agent-info-card {
  position: absolute !important;
}

/* Chevron toggle button */
.agent-info-chevron {
  all: unset;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  color: var(--text-tertiary);
  flex-shrink: 0;
  opacity: 0;
  transition: opacity 120ms, color 120ms, background 120ms, transform 200ms ease;
}
.agent-detail-identity-trigger:hover .agent-info-chevron,
.agent-detail-identity-trigger:focus-within .agent-info-chevron,
.agent-info-chevron--open {
  opacity: 1;
}
.agent-info-chevron:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}
.agent-info-chevron--open {
  transform: rotate(180deg);
  color: var(--text-primary);
}

/* Bridge the 8px gap between trigger and card so hover doesn't break */
.agent-info-card--open::before {
  content: '';
  position: absolute;
  top: -12px;
  left: 0;
  right: 0;
  height: 12px;
}

/* ── Card inner wrapper (holds glow + grid) ── */
.agent-info-card-inner {
  position: relative;
}

.agent-info-card-glow {
  position: absolute;
  top: -40px;
  right: -40px;
  width: 120px;
  height: 120px;
  background: rgba(0, 0, 0, 0.04);
  border-radius: 50%;
  filter: blur(40px);
  pointer-events: none;
}
[data-theme="dark"] .agent-info-card-glow {
  background: rgba(255, 255, 255, 0.06);
}

/* ── Two-column grid ── */
.agent-info-card-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr);
}

/* ── Section ── */
.agent-info-card-section {
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.agent-info-card-section:first-child {
  border-right: 1px solid rgba(0, 0, 0, 0.06);
}
[data-theme="dark"] .agent-info-card-section:first-child {
  border-right-color: rgba(255, 255, 255, 0.06);
}

/* ── Section header — icon + title ── */
.agent-info-card-section-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px 10px;
}
.agent-info-section-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 7px;
  flex-shrink: 0;
}
.agent-info-section-icon--blue {
  background: var(--bg-secondary);
  color: var(--text-secondary);
}
.agent-info-section-icon--indigo {
  background: var(--bg-secondary);
  color: var(--text-secondary);
}
.agent-info-card-section-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

/* ── Section body ── */
.agent-info-card-body {
  padding: 12px 16px 16px;
  flex: 1;
}

.agent-info-card-body--compact {
  padding-top: 6px;
}

.agent-info-card-section--stacked {
  gap: 0;
}

.agent-info-subsection + .agent-info-subsection {
  border-top: 1px solid rgba(0, 0, 0, 0.05);
}

[data-theme="dark"] .agent-info-subsection + .agent-info-subsection {
  border-top-color: rgba(255, 255, 255, 0.06);
}

.agent-info-profile-panel {
  min-height: 100%;
  display: flex;
  flex-direction: column;
}

.agent-info-profile-role {
  font-size: 12px;
  line-height: 1.45;
  color: var(--text-secondary);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.agent-info-profile-meta {
  margin-top: 14px;
}

.agent-info-expiry--expired {
  color: var(--error) !important;
}

.agent-info-expiry-button {
  width: 100%;
  height: 30px;
  margin-top: auto;
  border-radius: 8px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-primary);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: background 120ms ease, color 120ms ease, border-color 120ms ease;
}

.agent-info-expiry-button:hover {
  background: var(--bg-secondary);
  color: var(--text-primary);
  border-color: var(--border-default);
}

.agent-expiry-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 9000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(0, 0, 0, 0.48);
}

.agent-expiry-modal {
  width: 390px;
  max-width: 100%;
  padding: 20px;
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  background: var(--bg-primary);
  color: var(--text-primary);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.18);
}

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

.agent-expiry-modal-header h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 650;
  line-height: 1.25;
  color: var(--text-primary);
}

.agent-expiry-current {
  margin-top: 8px;
  font-size: 12px;
  line-height: 1.4;
  color: var(--text-tertiary);
}

.agent-expiry-current strong,
.agent-expiry-status {
  color: var(--text-secondary);
  font-weight: 500;
}

.agent-expiry-status--expired {
  color: var(--error);
}

.agent-expiry-close {
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--text-tertiary);
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  transition: background 120ms ease, color 120ms ease;
}

.agent-expiry-close:hover {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

.agent-expiry-section {
  margin-bottom: 18px;
}

.agent-expiry-label {
  margin-bottom: 8px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-tertiary);
}

.agent-expiry-quick-actions {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.agent-expiry-chip,
.agent-expiry-secondary-action,
.agent-expiry-primary-action {
  height: 34px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 120ms ease, border-color 120ms ease, color 120ms ease, opacity 120ms ease;
}

.agent-expiry-chip {
  border: 1px solid var(--border-subtle);
  background: var(--bg-primary);
  color: var(--text-primary);
}

.agent-expiry-chip:hover,
.agent-expiry-secondary-action:hover {
  border-color: var(--border-default);
  background: var(--bg-secondary);
}

.agent-expiry-chip--selected,
.agent-expiry-chip--selected:hover {
  border-color: var(--text-primary);
  background: var(--text-primary);
  color: var(--bg-primary);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.16);
}

.agent-expiry-input {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  box-sizing: border-box;
  border: 1px solid var(--border-subtle);
  border-radius: 9px;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 13px;
}

.agent-expiry-input:focus {
  outline: none;
  border-color: var(--text-secondary);
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.06);
}

.agent-expiry-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 2px;
}

.agent-expiry-action-group {
  display: flex;
  gap: 8px;
}

.agent-expiry-secondary-action {
  padding: 0 14px;
  border: 1px solid var(--border-subtle);
  background: transparent;
  color: var(--text-secondary);
}

.agent-expiry-primary-action {
  padding: 0 16px;
  border: 1px solid var(--text-primary);
  background: var(--text-primary);
  color: var(--bg-primary);
}

.agent-expiry-primary-action:disabled,
.agent-expiry-secondary-action:disabled,
.agent-expiry-chip:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

[data-theme="dark"] .agent-expiry-input:focus {
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.08);
}

/* ── Token glass inner card ── */
.agent-info-token-glass {
  background: rgba(255, 255, 255, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 12px;
  padding: 16px;
}
[data-theme="dark"] .agent-info-token-glass {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.06);
}

/* ── Token hero ── */
.agent-info-token-hero {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 14px;
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}
[data-theme="dark"] .agent-info-token-hero {
  border-bottom-color: rgba(255, 255, 255, 0.06);
}
.agent-info-token-hero-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-tertiary);
}
.agent-info-token-hero-value {
  font-size: 32px;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.03em;
  background: linear-gradient(135deg, #1f2328 0%, #6b7280 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  width: fit-content;
}
[data-theme="dark"] .agent-info-token-hero-value {
  background: linear-gradient(135deg, #e1e1e8 0%, #8b8b9e 100%);
  -webkit-background-clip: text;
  background-clip: text;
}
.agent-info-token-hero-unit {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: 0;
  margin-left: 1px;
}

/* ── Token stats grid ── */
.agent-info-token-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.agent-info-stat-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.agent-info-stat-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-tertiary);
}
.agent-info-stat-value {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.3;
}
.agent-info-stat-unit {
  font-size: 10px;
  font-weight: 500;
  opacity: 0.5;
  margin-left: 1px;
}

/* ── Model inner card ── */
.agent-info-model-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--bg-secondary);
  border: none;
  margin-bottom: 12px;
}
[data-theme="dark"] .agent-info-model-card {
  background: rgba(255, 255, 255, 0.03);
}
.agent-info-model-card-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  font-size: 14px;
  flex-shrink: 0;
}
.agent-info-model-card-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}
.agent-info-model-card-label {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-tertiary);
}
.agent-info-model-card-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Meta rows ── */
.agent-info-meta-list {
  display: flex;
  flex-direction: column;
}
.agent-info-meta-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 6px 0;
  font-size: 11px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.04);
}
[data-theme="dark"] .agent-info-meta-row {
  border-bottom-color: rgba(255, 255, 255, 0.04);
}
.agent-info-meta-row:last-child {
  border-bottom: none;
  padding-bottom: 0;
}
.agent-info-meta-row > span:first-child {
  color: var(--text-tertiary);
  flex-shrink: 0;
}
.agent-info-meta-row > span:last-child {
  font-weight: 500;
  color: var(--text-secondary);
  text-align: right;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Meta rows — visual block, no dividers ── */
.agent-info-meta-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.agent-info-meta-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 6px 8px;
  font-size: 12px;
  border-radius: 4px;
  transition: background 100ms ease;
}

.agent-info-meta-row:hover {
  background: var(--bg-secondary);
}

.agent-info-meta-row > span:first-child {
  color: var(--text-tertiary);
  flex-shrink: 0;
}

.agent-info-meta-row > span:last-child {
  font-weight: 500;
  color: var(--text-secondary);
  text-align: right;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.agent-info-meta-list--model {
  margin-bottom: 12px;
}

.agent-info-profile-block {
  margin-top: 2px;
  padding-top: 12px;
  border-top: 1px solid rgba(0, 0, 0, 0.05);
}

[data-theme="dark"] .agent-info-profile-block {
  border-top-color: rgba(255, 255, 255, 0.06);
}

.agent-info-profile-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 10px;
}

/* (variant toggle removed — saas is the only style) */


.agent-chat-shell {
  flex: 1;
  min-height: 0;
  box-sizing: border-box;
  background: rgba(255, 255, 255, 0.55);
}
[data-theme="dark"] .agent-chat-shell {
  background: rgba(22, 22, 30, 0.7);
}

.agent-chat-area.has-live-panel {
  gap: 0;
  padding-right: 0;
  box-sizing: border-box;
}

.agent-chat-area.has-live-panel .agent-side-panel {
  border: 0;
  border-left: 1px solid var(--border-subtle);
  border-radius: 0;
  overflow: hidden;
  align-self: stretch;
}

.aware-side-preview {
  height: 100%;
  overflow: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.aware-side-section {
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  background: var(--bg-primary);
  padding: 14px;
}

.aware-side-section-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 10px;
}

.aware-side-focus {
  border-radius: 7px;
}

.aware-side-focus + .aware-side-focus {
  margin-top: 6px;
}

.aware-side-focus.done {
  opacity: 0.72;
}

.aware-side-focus-head {
  width: 100%;
  border: 1px solid transparent;
  background: color-mix(in srgb, var(--bg-secondary) 34%, transparent);
  color: inherit;
  border-radius: 7px;
  padding: 9px 10px;
  display: flex;
  gap: 10px;
  align-items: flex-start;
  text-align: left;
  cursor: pointer;
  transition: background var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast), box-shadow var(--transition-fast);
}

.aware-side-focus-head:hover {
  background: var(--bg-secondary);
  border-color: var(--border-subtle);
  color: var(--text-primary);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.aware-side-focus-head .aware-side-item-title {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.aware-side-focus-badge {
  display: inline-flex;
  align-items: center;
  height: 18px;
  padding: 0 7px;
  border-radius: 999px;
  font-size: 11px;
  line-height: 18px;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  border: 1px solid transparent;
}

.aware-side-focus-badge.active,
.aware-side-focus-badge.system {
  color: #4f7db8;
  background: color-mix(in srgb, #4f7db8 9%, transparent);
  border-color: color-mix(in srgb, #4f7db8 18%, transparent);
}

.aware-side-focus-badge.done {
  color: color-mix(in srgb, var(--success, #10b981) 72%, black);
  background: color-mix(in srgb, var(--success, #10b981) 9%, transparent);
  border-color: color-mix(in srgb, var(--success, #10b981) 18%, transparent);
}

.aware-side-check {
  width: 14px;
  height: 14px;
  border-radius: 4px;
  border: 1.5px solid var(--border-strong);
  color: var(--bg-primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  line-height: 1;
  font-weight: 700;
  flex: 0 0 14px;
  margin-top: 2px;
  box-sizing: border-box;
}

.aware-side-check.active {
  border-color: var(--accent-primary);
  background: color-mix(in srgb, var(--accent-primary) 18%, transparent);
  color: var(--accent-primary);
}

.aware-side-check.done {
  border-color: var(--success, #10b981);
  background: var(--success, #10b981);
}

.aware-side-status-dot {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  flex: 0 0 9px;
  margin-top: 5px;
  box-shadow: 0 0 0 3px transparent;
}

.aware-side-status-dot.active {
  background: #4f7db8;
  box-shadow: 0 0 0 3px color-mix(in srgb, #4f7db8 12%, transparent);
}

.aware-side-status-dot.done {
  background: var(--success, #10b981);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--success, #10b981) 12%, transparent);
}

.aware-side-focus-marker {
  display: none;
}

.aware-side-focus-marker.todo {
  border-color: var(--border-strong);
}

.aware-side-focus-marker.active {
  background: #4f7db8;
  border-color: #4f7db8;
  box-shadow: 0 0 0 3px color-mix(in srgb, #4f7db8 14%, transparent);
}

.aware-side-focus-marker.done {
  background: var(--success, #10b981);
  border-color: var(--success, #10b981);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--success, #10b981) 12%, transparent);
}

.aware-side-focus-marker.system {
  background: #4f7db8;
  border-color: #4f7db8;
  box-shadow: 0 0 0 3px color-mix(in srgb, #4f7db8 14%, transparent);
}

.aware-side-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.aware-view-switch,
.aware-calendar-toolbar {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px;
  border-radius: 7px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
}

.aware-view-button {
  border: 0;
  background: transparent;
  color: var(--text-tertiary);
  border-radius: 5px;
  padding: 3px 7px;
  font-size: 11px;
  line-height: 16px;
  cursor: pointer;
}

.aware-view-button.active {
  color: var(--text-primary);
  background: var(--bg-primary);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
}

.aware-side-focus-group + .aware-side-focus-group {
  margin-top: 14px;
}

.aware-side-subtitle {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  font-size: 11px;
  line-height: 16px;
  color: var(--text-tertiary);
  font-weight: 600;
  margin-bottom: 8px;
}

.aware-side-collapse {
  width: auto;
  max-width: 100%;
  border: 1px solid var(--border-subtle);
  background: var(--bg-secondary);
  color: var(--text-secondary);
  border-radius: 7px;
  padding: 5px 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  font-size: 12px;
  line-height: 16px;
  transition: background var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast), box-shadow var(--transition-fast);
}

.aware-side-collapse:hover {
  background: var(--bg-tertiary);
  border-color: var(--border-default);
  color: var(--text-primary);
}

.aware-side-collapse:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent-primary) 26%, transparent);
}

.aware-calendar {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.aware-calendar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.aware-calendar-toolbar {
  align-self: flex-start;
}

.aware-calendar-nav {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
}

.aware-calendar-nav-button,
.aware-calendar-range {
  border: 1px solid var(--border-subtle);
  background: var(--bg-primary);
  color: var(--text-secondary);
  border-radius: 6px;
  height: 26px;
  padding: 0 8px;
  font-size: 11px;
  line-height: 24px;
  cursor: pointer;
}

.aware-calendar-nav-button {
  width: 26px;
  padding: 0;
  font-size: 16px;
  color: var(--text-tertiary);
}

.aware-calendar-range {
  max-width: 190px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.aware-calendar-nav-button:hover,
.aware-calendar-range:hover {
  color: var(--text-primary);
  border-color: var(--border-default);
  background: var(--bg-secondary);
}

.aware-calendar-grid {
  display: grid;
  gap: 6px;
  min-width: 0;
  overflow: visible;
}

.aware-calendar-grid.mode-day {
  grid-template-columns: 1fr;
}

.aware-calendar-grid.mode-week,
.aware-calendar-grid.mode-month {
  grid-template-columns: repeat(7, minmax(0, 1fr));
}

.aware-calendar-day {
  min-width: 0;
  min-height: 62px;
  border: 1px solid var(--border-subtle);
  border-radius: 7px;
  padding: 6px;
  background: var(--bg-primary);
  overflow: visible;
  position: relative;
}

.aware-calendar-day.is-today {
  border-color: color-mix(in srgb, #4f7db8 42%, var(--border-subtle));
  background: color-mix(in srgb, #4f7db8 5%, var(--bg-primary));
}

.aware-calendar-day-label {
  font-size: 10px;
  line-height: 14px;
  color: var(--text-tertiary);
  margin-bottom: 4px;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 4px;
}

.aware-calendar-today-pill {
  font-size: 9px;
  line-height: 13px;
  padding: 0 5px;
  border-radius: 999px;
  color: #3f6696;
  background: color-mix(in srgb, #4f7db8 14%, transparent);
}

.aware-calendar-empty {
  color: var(--text-tertiary);
  opacity: 0.45;
  font-size: 11px;
}

.aware-calendar-event {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  color: var(--text-secondary);
  padding: 4px 0;
  min-width: 0;
  max-width: 100%;
  position: relative;
  cursor: default;
}

.aware-calendar-event::after {
  content: attr(data-tooltip);
  position: absolute;
  right: auto;
  left: 0;
  bottom: calc(100% + 8px);
  z-index: 20;
  width: max-content;
  max-width: min(360px, 56vw);
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-elevated, var(--bg-primary));
  color: var(--text-primary);
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.16);
  font-size: 12px;
  line-height: 1.45;
  white-space: pre-line;
  opacity: 0;
  visibility: hidden;
  transform: translateY(2px);
  transition: opacity 80ms ease, transform 80ms ease, visibility 80ms ease;
  pointer-events: none;
}

.aware-calendar-event::before {
  content: "";
  position: absolute;
  right: auto;
  left: 14px;
  bottom: calc(100% + 3px);
  z-index: 21;
  width: 10px;
  height: 10px;
  background: var(--bg-elevated, var(--bg-primary));
  border-right: 1px solid var(--border-subtle);
  border-bottom: 1px solid var(--border-subtle);
  transform: rotate(45deg);
  opacity: 0;
  visibility: hidden;
  transition: opacity 80ms ease, visibility 80ms ease;
  pointer-events: none;
}

.aware-calendar-day:nth-child(7n) .aware-calendar-event::after,
.aware-calendar-day:nth-child(7n - 1) .aware-calendar-event::after {
  left: auto;
  right: 0;
}

.aware-calendar-day:nth-child(7n) .aware-calendar-event::before,
.aware-calendar-day:nth-child(7n - 1) .aware-calendar-event::before {
  left: auto;
  right: 14px;
}

.aware-calendar-day:nth-child(-n + 7) .aware-calendar-event::after {
  top: calc(100% + 8px);
  bottom: auto;
  transform: translateY(-2px);
}

.aware-calendar-day:nth-child(-n + 7) .aware-calendar-event::before {
  top: calc(100% + 3px);
  bottom: auto;
  border-right: 0;
  border-bottom: 0;
  border-left: 1px solid var(--border-subtle);
  border-top: 1px solid var(--border-subtle);
}

.aware-calendar-event:hover::after {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.aware-calendar-event:hover::before {
  opacity: 1;
  visibility: visible;
}

.aware-calendar-event-body {
  display: flex;
  flex-direction: column;
  gap: 1px;
  flex: 1 1 auto;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
}

.aware-calendar-event-title {
  font-size: 11px;
  line-height: 14px;
  font-weight: 500;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.aware-calendar-event-meta {
  font-size: 10px;
  line-height: 13px;
  color: var(--text-tertiary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.aware-calendar-event.recurring .aware-calendar-event-title,
.aware-calendar-event.recurring .aware-calendar-event-meta {
  white-space: normal;
  overflow-wrap: anywhere;
}

.aware-calendar-more {
  font-size: 10px;
  color: var(--text-tertiary);
}

.aware-calendar-recurring {
  border-top: 1px solid var(--border-subtle);
  padding-top: 8px;
}

.aware-side-count {
  flex: 0 0 auto;
  font-size: 10px;
  line-height: 1;
  color: var(--text-tertiary);
  padding: 4px 7px;
  border-radius: 999px;
  background: var(--bg-secondary);
  margin-top: 1px;
}

.aware-side-chevron {
  color: var(--text-tertiary);
  font-size: 9px;
  line-height: 16px;
  transform: rotate(0deg);
  transition: transform 0.15s ease;
  margin-top: 1px;
}

.aware-side-chevron.open {
  transform: rotate(90deg);
}

.aware-side-nested {
  padding: 2px 0 10px 22px;
}

.aware-side-item,
.aware-side-trigger {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  border-radius: 7px;
  padding: 7px 8px;
}

.aware-side-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--border-strong);
  margin-top: 5px;
  flex: 0 0 8px;
}

.aware-side-dot.active {
  background: var(--accent-primary);
}

.aware-side-dot.done {
  background: var(--success, #10b981);
}

.aware-side-item-title {
  font-size: 12px;
  line-height: 1.45;
  color: var(--text-primary);
}

.aware-side-item-meta {
  font-size: 11px;
  line-height: 1.45;
  color: var(--text-tertiary);
  margin-top: 2px;
}

.aware-side-trigger-main {
  flex: 1;
  min-width: 0;
}

.aware-side-trigger.done .aware-side-item-title {
  color: var(--text-tertiary);
  text-decoration: line-through;
}

.aware-side-empty {
  font-size: 12px;
  color: var(--text-tertiary);
  padding: 8px 0;
}

.aware-side-empty.compact {
  padding: 6px 0;
}

.aware-side-reflection {
  border-top: 1px solid var(--border-subtle);
}

.aware-side-reflection:first-of-type {
  border-top: none;
}

.aware-side-reflection-head {
  width: 100%;
  border: 0;
  background: transparent;
  color: inherit;
  padding: 8px 0;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  text-align: left;
  cursor: pointer;
}

.aware-side-reflection-head:hover {
  color: var(--text-primary);
}

.aware-side-reflection-detail {
  padding: 0 0 8px 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.aware-side-reflection-message {
  padding: 7px 8px;
  border-radius: 6px;
  background: var(--bg-secondary);
  border-left: 2px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.aware-side-reflection-message.role-assistant {
  border-left-color: var(--accent-primary);
}

.aware-side-reflection-message.role-tool_call,
.aware-side-reflection-message.role-tool_result {
  border-left-color: var(--text-tertiary);
}

.aware-side-reflection-role {
  font-size: 9px;
  line-height: 1;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0;
  font-family: var(--font-mono, monospace);
}

.aware-side-reflection-text {
  font-size: 11px;
  line-height: 1.45;
  color: var(--text-secondary);
  overflow-wrap: anywhere;
}

/* ─── AgentBay Live Preview Panel ───────────────── */
.live-panel {
  /* Width is now controlled via inline style from the component (resizable). */
  min-width: 300px;
  max-width: 65vw;
  display: flex;
  flex-direction: column;
  position: relative;
  border-left: 1px solid var(--border-subtle);
  background: var(--bg-secondary);
  animation: livePanelSlideIn 250ms ease;
}

/* Drag handle on the left edge of the live panel */
.live-panel-resize-handle {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 5px;
  cursor: col-resize;
  z-index: 10;
  /* Show a subtle visual indicator */
  background: transparent;
  transition: background 150ms ease;
}

.live-panel-resize-handle:hover,
.live-panel-resize-handle:active {
  background: var(--accent-primary);
  opacity: 0.35;
}

@keyframes livePanelSlideIn {
  from { opacity: 0; transform: translateX(16px); }
  to { opacity: 1; transform: translateX(0); }
}

.live-panel-header {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 48px;
  padding: 7px 10px 7px 12px;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-elevated);
  flex-shrink: 0;
}
.live-panel-title {
  flex: 1;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.3;
}

.agent-side-panel-tabs {
  display: flex;
  align-items: center;
  gap: 3px;
  min-width: 0;
  flex: 1;
  overflow-x: auto;
  scrollbar-width: none;
  flex-shrink: 0;
}

.agent-side-panel-tabs::-webkit-scrollbar {
  display: none;
}

.agent-side-panel-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-width: 0;
  height: 30px;
  padding: 0 8px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: var(--text-tertiary);
  font-size: 12px;
  font-weight: 550;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  transition: color 140ms ease, background 140ms ease, border-color 140ms ease;
}

.agent-side-panel-tab:hover {
  color: var(--text-secondary);
  background: var(--bg-tertiary);
}

.agent-side-panel-tab.active {
  color: var(--text-primary);
  background: var(--bg-primary);
  border-color: var(--border-subtle);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03);
}

.agent-side-panel-tab-dot {
  width: 5px;
  height: 5px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent-primary) 72%, var(--text-tertiary));
  opacity: 0.75;
  flex-shrink: 0;
}

.live-panel-tabs {
  display: flex;
  gap: 2px;
}

.live-panel-tab {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: var(--text-tertiary);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 150ms ease;
}

.live-panel-tab:hover {
  color: var(--text-secondary);
  background: var(--bg-tertiary);
}

.live-panel-tab.active {
  color: var(--text-primary);
  background: var(--bg-tertiary);
}

.live-panel-collapse {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--text-tertiary);
  cursor: pointer;
  transition: all 150ms ease;
}

.live-panel-collapse:hover {
  color: var(--text-secondary);
  background: var(--bg-tertiary);
}

.live-panel-header-right {
  display: flex;
  align-items: center;
  gap: 0;
  margin-left: auto;
}

.live-panel-workspace-actions {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  margin-right: 2px;
}

.live-panel-workspace-actions:empty {
  display: none;
}

.live-panel-workspace-actions a.live-panel-icon-btn {
  text-decoration: none;
}

.live-panel-icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--text-tertiary);
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
}
.live-panel-icon-btn:hover {
  color: var(--text-secondary);
  background: var(--bg-tertiary);
}
.live-panel-icon-btn.active {
  color: var(--text-primary);
  background: var(--bg-tertiary);
}

.live-panel-header-sep {
  display: inline-block;
  width: 1px;
  height: 16px;
  background: var(--border-subtle);
  margin: 0 4px;
  flex-shrink: 0;
}

.live-panel-take-control {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border-radius: 6px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 150ms ease;
  margin-right: 4px;
}

.live-panel-take-control:hover {
  background: var(--bg-tertiary);
  border-color: var(--border-strong);
}

.live-panel-content {
  flex: 1;
  overflow: hidden;
  position: relative;
}

.live-panel-iframe {
  width: 100%;
  height: 100%;
  border: none;
  background: #000;
}

.live-panel-browser {
  width: 100%;
  height: 100%;
  position: relative;
  overflow: auto;
  background: var(--bg-primary);
}

.live-panel-screenshot {
  width: 100%;
  height: auto;
  display: block;
}

.live-panel-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.5px;
}

.live-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 4px rgba(34, 197, 94, 0.6);
  animation: livePulse 2s ease-in-out infinite;
}

@keyframes livePulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.live-panel-code {
  width: 100%;
  height: 100%;
  overflow: auto;
  padding: 12px;
  background: #0d1117;
  color: #c9d1d9;
}

.live-panel-code pre {
  margin: 0;
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
  font-size: 12px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-all;
}

.live-panel-transfer {
  width: 100%;
  height: 100%;
  overflow: auto;
  padding: 16px;
  background: var(--bg-primary);
}

.live-panel-transfer-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-width: 560px;
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 14px;
  background: var(--bg-elevated);
}

.live-panel-transfer-title {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 650;
}

.live-panel-transfer-route {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  color: var(--text-tertiary);
}

.live-panel-transfer-route > div {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px;
  border-radius: 8px;
  background: var(--bg-secondary);
}

.live-panel-transfer-route span {
  color: var(--text-tertiary);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.live-panel-transfer-route strong {
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 650;
}

.live-panel-transfer-route code {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
  font-size: 11px;
  color: var(--text-secondary);
}

.live-panel-transfer-result {
  max-height: 220px;
  overflow: auto;
  margin: 0;
  padding: 10px;
  border-radius: 8px;
  background: var(--bg-secondary);
  color: var(--text-secondary);
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
  font-size: 11px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}

.live-panel-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  gap: 8px;
  color: var(--text-tertiary);
  font-size: 12px;
}

/* ─── Workspace Operation Area ───────────────────── */
.agent-side-panel {
  background: var(--bg-primary);
}

.workspace-op {
  position: relative;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg-primary);
  color: var(--text-primary);
  overflow: hidden;
}

.workspace-op-inline-actions {
  position: absolute;
  top: 8px;
  right: 12px;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 2px 4px;
  border-radius: 8px;
  background: color-mix(in srgb, var(--bg-elevated) 90%, transparent);
  border: 1px solid var(--border-subtle);
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.workspace-op-inline-actions a {
  display: inline-flex;
  color: inherit;
  text-decoration: none;
}

.workspace-op-icon-btn {
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  background: var(--bg-primary);
  color: var(--text-tertiary);
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  transition: background var(--transition-fast), color var(--transition-fast), border-color var(--transition-fast);
}

.workspace-op-icon-btn:hover,
.workspace-op-icon-btn.active {
  background: var(--bg-tertiary);
  border-color: var(--border-default);
  color: var(--text-primary);
}

.workspace-op-save {
  padding: 2px 6px;
  border-radius: 5px;
  background: var(--bg-tertiary);
  color: var(--text-tertiary);
  font-size: 11px;
  line-height: 16px;
  transition: color var(--transition-fast), background var(--transition-fast), opacity var(--transition-fast);
}

.workspace-op-save.saving {
  color: var(--text-secondary);
}

.workspace-op-save.saved {
  background: var(--success-subtle);
  color: var(--success);
}

.workspace-op-save.error {
  background: var(--error-subtle);
  color: var(--error);
}

.workspace-op-body {
  --workspace-side-width: 230px;
  position: relative;
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 230px;
  background: var(--bg-primary);
  overflow: hidden;
}

.workspace-op-body.activity-open {
  --workspace-side-width: 260px;
  grid-template-columns: minmax(0, 1fr) 260px;
}

.workspace-op-body.tree-closed {
  --workspace-side-width: 0px;
  grid-template-columns: minmax(0, 1fr);
}

.workspace-op-body.tree-closed.activity-open {
  grid-template-columns: minmax(0, 1fr) 260px;
}

.workspace-op-tree,
.workspace-op-side {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg-secondary);
  overflow: hidden;
}

.workspace-op-tree {
  border-left: 1px solid var(--border-subtle);
}

.workspace-op-tree .workspace-op-side-title {
  justify-content: flex-start;
  padding-left: 8px;
  padding-right: 8px;
}

.workspace-op-side {
  border-left: 1px solid var(--border-subtle);
}

.workspace-op-side-title {
  height: 34px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 10px;
  color: var(--text-tertiary);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--border-subtle);
}

.workspace-op-tree-list {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 12px 7px 10px;
}

.workspace-op-side-list {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding-bottom: 10px;
}

.workspace-op-tree-tools {
  display: flex;
  align-items: center;
  gap: 6px;
}

.workspace-op-tree-tools-full {
  width: 100%;
  justify-content: space-between;
  min-width: 0;
}

.workspace-op-tree-actions {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.workspace-op-tree-primary-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  margin: 0;
  flex-shrink: 0;
}

.workspace-op-tree-action-btn {
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid var(--border-subtle);
  border-radius: 7px;
  background: var(--bg-elevated);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 11px;
  font-weight: 650;
  cursor: pointer;
  transition: background var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast);
}

.workspace-op-tree-action-btn:hover {
  background: var(--bg-tertiary);
  border-color: var(--border-default);
  color: var(--text-primary);
}

.workspace-op-tree-action-btn svg {
  flex-shrink: 0;
}

.workspace-op-tree-scope {
  display: inline-flex;
  align-items: center;
  padding: 2px;
  border: 1px solid var(--border-subtle);
  border-radius: 7px;
  background: color-mix(in srgb, var(--bg-tertiary) 80%, transparent);
  min-width: 0;
  flex-shrink: 1;
}

.workspace-op-tree-scope button {
  height: 20px;
  padding: 0 6px;
  border: none;
  border-radius: 5px;
  background: transparent;
  color: var(--text-tertiary);
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
}

.workspace-op-tree-scope button.active {
  background: var(--bg-elevated);
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
}

.workspace-op-mini-btn {
  height: 24px;
  padding: 0 8px;
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  background: var(--bg-elevated);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast), border-color var(--transition-fast);
}

.workspace-op-mini-btn:hover {
  background: var(--bg-tertiary);
  border-color: var(--border-default);
  color: var(--text-primary);
}

.workspace-op-mini-btn-icon {
  width: 24px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

@keyframes analysis-tool-running-dot {
  0%, 100% {
    opacity: 0.35;
    transform: scale(0.92);
  }
  50% {
    opacity: 0.78;
    transform: scale(1);
  }
}

.analysis-trace {
  width: min(760px, calc(100% - 72px));
  margin: 4px 0 14px 36px;
  color: var(--text-secondary);
}

.chat-msg-row--analysis {
  align-items: flex-start;
  margin-bottom: 22px;
}

.chat-msg-row--analysis .analysis-trace {
  width: min(760px, 100%);
  margin: 0;
}

.analysis-trace-shell {
  position: relative;
  width: fit-content;
  max-width: 100%;
  min-height: 28px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.analysis-trace-shell::before {
  content: none;
}

.analysis-trace--running .analysis-trace-shell::before {
  content: none;
}

.analysis-trace-header {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  min-height: 28px;
  border: 0;
  padding: 0 4px 0 0;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  user-select: none;
  list-style: none;
}

.analysis-trace-title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  letter-spacing: 0;
}

.analysis-trace-signal {
  display: inline-flex;
  width: 6px;
  height: 6px;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
}

.analysis-trace-signal span {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: var(--text-tertiary);
  opacity: 0.48;
}

.analysis-trace-signal span:nth-child(2) {
  display: none;
}

.analysis-trace-signal span:nth-child(3) {
  display: none;
}

.analysis-trace--running .analysis-trace-signal span:first-child {
  animation: analysis-tool-running-dot 1.25s ease-in-out infinite;
}

.analysis-trace-chevron {
  flex-shrink: 0;
  color: var(--text-tertiary);
  transition: transform 140ms ease, color var(--transition-fast);
}

.analysis-trace:not(.analysis-trace--open) .analysis-trace-chevron {
  transform: rotate(-90deg);
}

.analysis-trace-body {
  position: relative;
  margin-top: 10px;
  padding: 2px 0 0 2px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.analysis-trace-body::before {
  content: none;
}

.analysis-trace-row {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  column-gap: 10px;
}

.analysis-trace-node-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.analysis-trace-node {
  width: 22px;
  height: 22px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--text-tertiary);
  display: flex;
  align-items: center;
  justify-content: center;
}

.analysis-trace-node--thought,
.analysis-trace-node--done {
  border-radius: 999px;
}

.analysis-trace-row--running .analysis-trace-node,
.analysis-trace-node--pending {
  color: var(--text-secondary);
  background: transparent;
}

.analysis-trace-node--done:not(.analysis-trace-node--pending) {
  color: var(--text-primary);
}

.analysis-trace-rail {
  width: 1px;
  flex: 1;
  min-height: 30px;
  margin-top: 5px;
  border-radius: 999px;
  background: var(--border-subtle);
}

.analysis-trace-row-content {
  min-width: 0;
}

.analysis-tool-icon {
  position: relative;
  overflow: visible;
}

.analysis-tool-icon svg {
  position: relative;
  z-index: 2;
}

.analysis-tool-icon--running {
  background: transparent;
}

.analysis-tool-icon--running::before {
  content: none;
}

.analysis-tool-icon--running::after {
  content: none;
}

.workspace-op-tree-dir,
.workspace-op-tree-file {
  width: 100%;
  height: 30px;
  display: flex;
  align-items: center;
  gap: 6px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--text-secondary);
  text-align: left;
  cursor: pointer;
  font-size: 13px;
  line-height: 20px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.workspace-op-tree-dir {
  font-weight: 600;
}

.workspace-op-tree-dir.active,
.workspace-op-tree-file.active {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.workspace-op-tree-dir-main {
  min-width: 0;
  flex: 1;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: none;
  background: transparent;
  color: inherit;
  cursor: pointer;
  text-align: left;
  font: inherit;
}

.workspace-op-tree-file {
  font-weight: 400;
  color: var(--text-secondary);
}

.workspace-op-tree-dir:hover,
.workspace-op-tree-file:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.workspace-op-tree-file:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.workspace-op-tree-chevron {
  width: 16px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-tertiary);
  font-size: 15px;
  line-height: 1;
}

.workspace-op-tree-empty,
.workspace-op-side-empty {
  padding: 12px;
  color: var(--text-tertiary);
  font-size: 12px;
}

.workspace-op-tree-upload {
  margin: 4px 0;
  padding: 8px 10px 8px 0;
  border-radius: 8px;
  background: color-mix(in srgb, var(--bg-tertiary) 68%, transparent);
}

.workspace-op-tree-upload-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.workspace-op-tree-upload-name {
  min-width: 0;
  color: var(--text-primary);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.workspace-op-tree-upload-status {
  flex-shrink: 0;
  color: var(--text-tertiary);
  font-size: 11px;
}

.workspace-op-tree-upload-bar {
  width: 100%;
  height: 4px;
  margin-top: 6px;
  border-radius: 999px;
  background: var(--bg-hover);
  overflow: hidden;
}

.workspace-op-tree-upload-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--info);
  transition: width var(--transition-default);
}

.workspace-op-tree-upload.processing .workspace-op-tree-upload-bar span {
  background: var(--warning);
}

.workspace-op-tree-upload.done .workspace-op-tree-upload-bar span {
  background: var(--success);
}

.workspace-op-tree-upload-error {
  margin-top: 6px;
  color: var(--error);
  font-size: 11px;
  line-height: 1.4;
}

.workspace-op-main {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: auto;
  padding: 16px;
  background: var(--bg-primary);
}

.workspace-op-tree-edge-toggle {
  position: absolute;
  top: 12px;
  right: calc(var(--workspace-side-width) - 13px);
  z-index: 8;
  width: 26px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-subtle);
  border-radius: 7px;
  background: color-mix(in srgb, var(--bg-elevated) 92%, transparent);
  color: var(--text-secondary);
  cursor: pointer;
  line-height: 1;
  opacity: 0.86;
  box-shadow: var(--shadow-sm);
  transition: background var(--transition-fast), color var(--transition-fast), border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.workspace-op-body.tree-closed .workspace-op-tree-edge-toggle {
  right: 12px;
}

.workspace-op-tree-edge-toggle:hover,
.workspace-op-tree-edge-toggle.active:hover {
  background: var(--bg-elevated);
  border-color: var(--border-default);
  color: var(--text-primary);
  box-shadow: var(--shadow-md);
}

.workspace-op-side-resize {
  position: absolute;
  top: 0;
  right: calc(var(--workspace-side-width) - 3px);
  z-index: 6;
  width: 7px;
  height: 100%;
  cursor: col-resize;
}

.workspace-op-side-resize::after {
  content: "";
  position: absolute;
  top: 0;
  right: 3px;
  width: 1px;
  height: 100%;
  background: transparent;
  transition: background var(--transition-fast);
}

.workspace-op-side-resize:hover::after {
  background: var(--border-default);
}

.workspace-op-body.tree-closed .workspace-op-side-resize {
  display: none;
}

.workspace-op-main .markdown-content {
  max-width: 880px;
  margin: 0 auto;
}

.markdown-image-wrap {
  position: relative;
  display: inline-flex;
  margin: 8px 0;
  max-width: 100%;
}

.markdown-inline-image {
  max-width: 100%;
  max-height: 400px;
  border-radius: 6px;
  object-fit: contain;
  cursor: zoom-in;
  border: 1px solid var(--border-subtle);
  background: color-mix(in srgb, var(--bg-secondary) 45%, transparent);
}

.markdown-image-download-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 30px;
  height: 30px;
  border: 1px solid color-mix(in srgb, var(--border-default) 88%, transparent);
  border-radius: 999px;
  background: color-mix(in srgb, var(--bg-elevated) 92%, rgba(0, 0, 0, 0.4));
  color: var(--text-primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  opacity: 0;
  transform: translateY(-2px);
  transition: opacity var(--transition-fast), transform var(--transition-fast), background var(--transition-fast), border-color var(--transition-fast);
  box-shadow: var(--shadow-sm);
}

.markdown-image-wrap:hover .markdown-image-download-btn,
.markdown-image-wrap:focus-within .markdown-image-download-btn {
  opacity: 1;
  transform: translateY(0);
}

.markdown-image-download-btn:hover {
  background: var(--bg-elevated);
  border-color: var(--border-default);
}

.markdown-image-lightbox {
  position: fixed;
  inset: 0;
  z-index: 10030;
  background: rgba(10, 12, 18, 0.82);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  gap: 16px;
}

.markdown-image-lightbox__toolbar {
  position: absolute;
  top: 20px;
  right: 20px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  border: 1px solid color-mix(in srgb, var(--border-default) 82%, transparent);
  border-radius: 999px;
  background: color-mix(in srgb, var(--bg-elevated) 90%, rgba(0, 0, 0, 0.35));
  box-shadow: var(--shadow-md);
}

.markdown-image-lightbox__btn {
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: var(--text-primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast);
}

.markdown-image-lightbox__btn:hover {
  background: var(--bg-secondary);
}

.markdown-image-lightbox__stage {
  max-width: min(92vw, 1400px);
  max-height: calc(100vh - 140px);
  overflow: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
}

.markdown-image-lightbox__image {
  max-width: 100%;
  max-height: calc(100vh - 180px);
  object-fit: contain;
  transform-origin: center center;
  transition: transform var(--transition-fast);
  box-shadow: var(--shadow-lg);
  border-radius: 10px;
  background: white;
}

.markdown-image-lightbox__footer {
  position: absolute;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%);
  max-width: min(90vw, 820px);
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--bg-elevated) 90%, rgba(0, 0, 0, 0.35));
  color: var(--text-primary);
  border: 1px solid color-mix(in srgb, var(--border-default) 82%, transparent);
  box-shadow: var(--shadow-md);
  font-size: 12px;
}

.markdown-image-lightbox__alt {
  max-width: min(72vw, 640px);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-secondary);
}

@media (max-width: 720px) {
  .markdown-image-lightbox {
    padding: 16px;
  }

  .markdown-image-lightbox__toolbar {
    top: 14px;
    right: 14px;
    gap: 4px;
    padding: 6px;
  }

  .markdown-image-lightbox__btn {
    width: 30px;
    height: 30px;
  }

  .markdown-image-lightbox__footer {
    bottom: 14px;
    padding: 7px 10px;
  }
}

.workspace-op-empty {
  height: 100%;
  min-height: 220px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-tertiary);
  font-size: 13px;
}

.workspace-op-preview-paused {
  min-height: 420px;
  border: 1px dashed var(--border-subtle);
  border-radius: 8px;
  background: color-mix(in srgb, var(--bg-secondary) 88%, white);
}

.workspace-op-deleted {
  flex-direction: column;
  gap: 10px;
  padding: 24px;
  text-align: center;
}

.workspace-op-deleted-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
}

.workspace-op-deleted-path {
  max-width: 560px;
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.6;
  word-break: break-word;
}

.workspace-op-live {
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.workspace-op-live-banner {
  flex-shrink: 0;
  color: var(--text-tertiary);
  font-size: 12px;
}

.workspace-op-html-fit {
  width: 100%;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  display: flex;
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 10px;
}

.workspace-op-html-fit iframe {
  display: block;
  flex: 1;
  width: 100%;
  height: 100%;
  min-height: 0;
  border: none;
  background: #fff;
  border-radius: 8px;
}

.workspace-op-image-preview {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100%;
  padding: 24px;
}

.workspace-op-image {
  display: block;
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 14px;
  box-shadow: 0 18px 44px rgba(15, 23, 42, 0.08);
  background: #fff;
}

.workspace-op-modal-overlay {
  position: absolute;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 42, 0.18);
}

.workspace-op-modal {
  width: min(420px, calc(100% - 32px));
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  background: var(--bg-primary);
  box-shadow: 0 24px 64px rgba(15, 23, 42, 0.18);
  padding: 20px;
}

.workspace-op-modal-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
}

.workspace-op-modal-text {
  margin-top: 10px;
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.6;
}

.workspace-op-modal-actions {
  margin-top: 18px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.workspace-op-editor {
  width: 100%;
  height: 100%;
  min-height: 420px;
  resize: none;
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 14px;
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.6;
  outline: none;
}

.workspace-op-editor:focus {
  border-color: var(--border-strong);
}

.workspace-op-table-wrap {
  max-width: 100%;
  overflow: auto;
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  background: var(--bg-secondary);
}

.workspace-op-table {
  width: max-content;
  min-width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  table-layout: auto;
}

.workspace-op-table thead th {
  background: color-mix(in srgb, var(--bg-tertiary) 92%, transparent);
  color: var(--text-primary);
  font-weight: 700;
  position: sticky;
  top: 0;
  z-index: 1;
}

.workspace-op-table td,
.workspace-op-table th {
  padding: 8px 10px;
  border-right: 1px solid var(--border-subtle);
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
}

.workspace-op-table tbody tr:nth-child(even) td {
  background: color-mix(in srgb, var(--bg-primary) 84%, var(--bg-tertiary));
}

.workspace-op-table td:empty::after,
.workspace-op-table th:empty::after {
  content: " ";
}

.workspace-op-table tr:last-child td {
  border-bottom: none;
}

.workspace-op-pdf {
  width: 100%;
  height: 100%;
  min-height: 640px;
  border: none;
  border-radius: 8px;
  background: var(--bg-secondary);
}

.workspace-op-text-preview {
  margin: 0;
  padding: 14px;
  border-radius: 8px;
  background: var(--bg-secondary);
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-word;
}

.workspace-op-ppt-preview {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.workspace-op-slide-card {
  margin: 0;
}

.workspace-op-slide-label {
  margin-bottom: 6px;
  color: var(--text-tertiary);
  font-size: 12px;
  font-weight: 600;
}

.workspace-op-slide-canvas {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}

.workspace-op-slide-shape {
  position: absolute;
  padding: 4px;
  color: #222;
  font-size: 12px;
  line-height: 1.35;
  overflow: hidden;
  white-space: pre-wrap;
}

.workspace-op-revision {
  margin: 10px;
  padding: 10px;
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  background: var(--bg-primary);
}

.workspace-op-revision-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
  font-size: 12px;
}

.workspace-op-revision-meta {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.workspace-op-revision strong {
  font-size: 13px;
}

.workspace-op-revision span {
  color: var(--text-tertiary);
}

.workspace-op-revision-time {
  flex-shrink: 0;
  color: var(--text-tertiary);
  font-size: 11px;
}

.workspace-op-revision pre {
  max-height: 160px;
  overflow: auto;
  margin: 0 0 8px;
  color: var(--text-tertiary);
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.5;
  white-space: pre-wrap;
}

.workspace-op-revision-note {
  color: var(--text-secondary);
}

/* Collapsed toggle button (shown on the right edge) */
.live-panel-toggle {
  position: fixed;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 28px;
  height: 56px;
  border: 1px solid var(--border-subtle);
  border-right: none;
  border-radius: 8px 0 0 8px;
  background: var(--bg-elevated);
  color: var(--text-tertiary);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  transition: all 150ms ease;
  z-index: 10;
}

.live-panel-toggle:hover {
  color: var(--text-secondary);
  background: var(--bg-tertiary);
  width: 32px;
}

.live-panel-toggle-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 4px rgba(34, 197, 94, 0.6);
  animation: livePulse 2s ease-in-out infinite;
}

/* Responsive: hide live panel on narrow screens */
@media (max-width: 900px) {
  .live-panel {
    display: none;
  }
  .live-panel-toggle {
    display: none;
  }
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-4) 0;
}

.chat-message {
  display: flex;
  gap: var(--space-3);
  padding: var(--space-3) 0;
  animation: fadeIn 200ms ease;
}

.chat-message.user {
  flex-direction: row-reverse;
}

.chat-avatar {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  background: var(--bg-elevated);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-sm);
  flex-shrink: 0;
}

.chat-bubble {
  max-width: 70%;
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-lg);
  font-size: var(--text-sm);
  line-height: 1.6;
}

.chat-message.assistant .chat-bubble {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
}

.chat-message.user .chat-bubble {
  background: var(--accent-primary);
  color: white;
}

/* ── SaaS chat message system (replaces inline styles) ── */
.chat-msg-row {
  display: flex;
  flex-direction: row;
  gap: 8px;
  margin-bottom: 8px;
  animation: fadeIn 0.2s ease;
}
.chat-msg-row--user {
  flex-direction: row-reverse;
}

.chat-msg-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--bg-elevated);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  flex-shrink: 0;
  color: var(--text-secondary);
  font-weight: 600;
  border: 1px solid var(--border-subtle);
}
.chat-msg-avatar--user {
  background: var(--bg-tertiary);
  border-color: var(--border-subtle);
  color: var(--text-secondary);
}
[data-theme="dark"] .chat-msg-avatar--user {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.08);
}

.chat-msg-col {
  max-width: 72%;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.chat-msg-row--user .chat-msg-col {
  align-items: flex-end;
}

.chat-msg-user-line {
  max-width: 100%;
  display: block;
}

.chat-msg-bubble {
  max-width: 100%;
  padding: 8px 12px;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.5;
  word-break: break-word;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
  transition: box-shadow 150ms ease;
}
.chat-msg-bubble--user {
  background: var(--bg-secondary);
  border-color: var(--border-default);
}
.chat-msg-bubble--thinking {
  padding: 4px 0;
  background: transparent;
  border-color: transparent;
  box-shadow: none;
}
[data-theme="dark"] .chat-msg-bubble {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.08);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}
[data-theme="dark"] .chat-msg-bubble--thinking {
  background: transparent;
  border-color: transparent;
  box-shadow: none;
}
[data-theme="dark"] .chat-msg-bubble--user {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.1);
}

.chat-msg-sender {
  font-size: 10px;
  color: var(--text-tertiary);
  margin-bottom: 2px;
  font-weight: 600;
}

.chat-msg-timestamp {
  font-size: 10px;
  color: var(--text-tertiary);
  margin-top: 3px;
  opacity: 0.6;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 4px;
}

.chat-msg-row--user .chat-msg-timestamp {
  align-self: flex-end;
  justify-content: flex-end;
  text-align: right;
  white-space: nowrap;
}

.chat-msg-file-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--bg-secondary);
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 11px;
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
}
[data-theme="dark"] .chat-msg-file-chip {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.08);
}

/* Empty state */
.chat-empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-tertiary);
}
.chat-empty-state__title {
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 4px;
  color: var(--text-secondary);
}
.chat-empty-state__subtitle {
  font-size: 12px;
}
.chat-empty-state__hint {
  font-size: 11px;
  margin-top: 6px;
  opacity: 0.65;
}

.chat-no-model-state {
  width: min(420px, 90%);
  margin: 0 auto;
  padding: 24px;
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  background: var(--bg-elevated);
  color: var(--text-secondary);
  box-shadow: 0 18px 50px rgba(17, 17, 20, 0.04);
}

.chat-no-model-state__icon {
  width: 38px;
  height: 38px;
  margin: 0 auto 12px;
  border-radius: 10px;
  background: var(--bg-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-primary);
}

.chat-no-model-state__title {
  color: var(--text-primary);
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 8px;
}

.chat-no-model-state__text {
  font-size: 13px;
  line-height: 1.6;
  margin-bottom: 16px;
}

.chat-no-model-state--floating {
  position: absolute;
  top: 22px;
  left: 50%;
  z-index: 12;
  transform: translateX(-50%);
  width: min(460px, calc(100% - 32px));
  text-align: left;
  display: grid;
  grid-template-columns: 38px 1fr;
  column-gap: 12px;
  align-items: start;
  padding: 18px 20px;
  box-shadow: 0 18px 56px rgba(17, 17, 20, 0.16);
}

.chat-no-model-state--floating .chat-no-model-state__icon {
  grid-row: 1 / span 3;
  margin: 0;
}

.chat-no-model-state--floating .chat-no-model-state__text {
  margin-bottom: 14px;
}

.chat-no-model-state--floating .btn {
  width: fit-content;
}

/* Company onboarding tour */
.company-tour-overlay {
  position: fixed;
  inset: 0;
  z-index: 20000;
  background: transparent;
  pointer-events: none;
}

.tour-spot {
  position: fixed;
  z-index: 20001;
  border-radius: 14px;
  background: transparent;
  border: 1px solid rgba(255,255,255,0.84);
  box-shadow:
    0 0 0 9999px rgba(17, 17, 18, 0.58),
    0 12px 40px rgba(0,0,0,0.16),
    0 0 0 1px rgba(17,17,20,0.12) inset;
  pointer-events: none;
}

.company-tour-card {
  position: fixed;
  z-index: 20002;
  pointer-events: auto;
  width: 320px;
  max-width: calc(100vw - 24px);
  background: #111116;
  color: #fff;
  border-radius: 10px;
  padding: 18px;
  box-shadow: 0 18px 60px rgba(0,0,0,0.34);
}

.company-tour-card::before {
  content: '';
  position: absolute;
  left: -8px;
  top: 24px;
  width: 16px;
  height: 16px;
  background: #111116;
  transform: rotate(45deg);
}

.company-tour-card--left::before {
  left: auto;
  right: -8px;
}

.company-tour-card--below::before {
  left: 24px;
  top: -8px;
}

.company-tour-card--above::before {
  left: 24px;
  top: auto;
  bottom: -8px;
}

.company-tour-step {
  width: 24px;
  height: 24px;
  min-width: 24px;
  border-radius: 999px;
  background: #fff;
  color: #111116;
  font-size: 11px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 10px;
}

.company-tour-card h3 {
  margin: 0 0 8px;
  font-size: 15px;
}

.company-tour-card p {
  margin: 0;
  color: rgba(255,255,255,0.78);
  font-size: 13px;
  line-height: 1.65;
}

.company-tour-controls {
  position: fixed;
  z-index: 20002;
  pointer-events: auto;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 16px;
  background: #111116;
  color: #fff;
  border-radius: 10px;
  padding: 10px 14px;
  box-shadow: 0 14px 40px rgba(0,0,0,0.26);
  max-width: calc(100vw - 24px);
  white-space: nowrap;
}

.company-tour-controls button {
  border: 0;
  background: transparent;
  color: rgba(255,255,255,0.78);
  cursor: pointer;
}

.company-tour-controls button:disabled {
  opacity: 0.38;
  cursor: not-allowed;
}

.company-tour-controls .company-tour-next {
  background: #fff;
  color: #111116;
  border-radius: 7px;
  padding: 7px 12px;
  font-weight: 600;
}

.company-tour-dots {
  display: flex;
  gap: 6px;
}

.company-tour-dots span {
  width: 18px;
  height: 3px;
  border-radius: 999px;
  background: rgba(255,255,255,0.28);
}

.company-tour-dots span.active {
  background: #fff;
}

.company-tour-hint {
  position: fixed;
  z-index: 20002;
  pointer-events: none;
  top: 12px;
  right: 14px;
  border: 1px dashed rgba(255,255,255,0.38);
  color: rgba(255,255,255,0.72);
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 12px;
}

/* Scroll-to-bottom button */
.chat-scroll-btn {
  position: absolute;
  right: 20px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.75);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  z-index: 10;
  transition: background 120ms ease, box-shadow 120ms ease;
}
.chat-scroll-btn:hover {
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}
[data-theme="dark"] .chat-scroll-btn {
  background: rgba(40, 40, 50, 0.75);
}
[data-theme="dark"] .chat-scroll-btn:hover {
  background: rgba(50, 50, 60, 0.9);
}

.chat-input-area {
  padding: var(--space-4);
}

/* Unified composer: attachments → text (top-aligned) → toolbar (attach | send) */
.chat-composer {
  display: flex;
  flex-direction: column;
  min-height: 80px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.65);
  overflow: hidden;
  transition: border-color 150ms ease, box-shadow 150ms ease;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.03);
}
[data-theme="dark"] .chat-composer {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.08);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
}

.chat-composer:focus-within {
  border-color: var(--border-strong);
  box-shadow: 0 0 0 3px rgba(58, 58, 66, 0.08);
}
[data-theme="dark"] .chat-composer:focus-within {
  border-color: rgba(255, 255, 255, 0.18);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.08);
}

.chat-composer-attachments {
  padding: 6px 6px 2px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  background: transparent;
}

.chat-composer-input-block {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 4px 6px 0;
  background: transparent;
}

.chat-composer-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  gap: 8px;
  padding: 2px 6px 6px;
  background: transparent;
}

.chat-composer-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.12s ease, color 0.12s ease;
}

.chat-composer-btn:hover:not(:disabled) {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.chat-composer-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Send: same as global .btn-primary (theme bg + primary-fg); icon uses currentColor */
.chat-composer .btn.chat-composer-send {
  background: #3a3a42;
  color: #ffffff;
  border-color: #3a3a42;
  padding: 0;
  width: 28px;
  min-width: 28px;
  height: 28px;
  flex-shrink: 0;
  border-radius: 6px;
}

.chat-composer .btn.chat-composer-send:hover:not(:disabled) {
  background: #28282e;
  border-color: #28282e;
}

[data-theme="dark"] .chat-composer .btn.chat-composer-send {
  background: #e1e1e8;
  border-color: #e1e1e8;
  color: #0a0a0f;
}

[data-theme="dark"] .chat-composer .btn.chat-composer-send:hover:not(:disabled) {
  background: #ffffff;
  border-color: #ffffff;
}

.chat-composer .btn.chat-composer-send:disabled {
  opacity: 0.45;
}

/* File chip: width follows content, capped so referenced workspace files stay readable */
.chat-file-pill {
  position: relative;
  display: inline-flex;
  width: fit-content;
  max-width: min(320px, 100%);
  min-width: 0;
  vertical-align: middle;
  border-radius: 9999px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-secondary);
  overflow: hidden;
  box-sizing: border-box;
  min-height: 26px;
}

.chat-file-pill--workspace {
  max-width: min(460px, 100%);
}

.chat-file-pill__fill {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 0;
  background: color-mix(in srgb, var(--accent-primary) 20%, var(--bg-secondary));
  transition: width 0.12s ease;
  pointer-events: none;
  border-radius: inherit;
}

.chat-file-pill__row {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 2px 10px;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}

.chat-file-pill__icon {
  display: inline-flex;
  color: var(--text-tertiary);
  flex-shrink: 0;
}

.chat-file-pill__thumb {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  object-fit: cover;
  flex-shrink: 0;
}

.chat-file-pill__name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: var(--text-base);
  font-weight: 400;
  line-height: 1.5;
  color: var(--text-primary);
}

.chat-file-pill__source {
  flex-shrink: 0;
  padding: 1px 5px;
  border-radius: 5px;
  background: var(--bg-tertiary);
  color: var(--text-tertiary);
  font-size: 11px;
  line-height: 16px;
}

.chat-file-pill__size {
  font-size: 14px;
  line-height: 14px;
  color: var(--text-tertiary);
  flex-shrink: 0;
}

.chat-file-pill__pct {
  font-size: 14px;
  line-height: 14px;
  font-variant-numeric: tabular-nums;
  color: var(--text-primary);
  flex-shrink: 0;
}

.chat-file-pill__remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 2px;
  border: none;
  background: none;
  color: var(--text-tertiary);
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  flex-shrink: 0;
}

.chat-file-pill__remove:hover {
  color: var(--text-primary);
}

.chat-composer .chat-input {
  flex: 1 1 auto;
  width: 100%;
  min-width: 0;
  min-height: 0;
  max-height: 180px;
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 2px 2px 4px;
  font-size: 14px;
  line-height: 22px;
  color: var(--text-primary);
  outline: none;
  align-self: stretch;
  white-space: pre-wrap;
  box-shadow: none;
  transition: none;
  overflow-y: auto;
  resize: none;
}

.chat-composer .chat-input:focus {
  border: none;
  box-shadow: none;
  background: transparent;
}

.chat-composer .chat-input:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.chat-composer-toolbar .btn-stop-generation {
  flex-shrink: 0;
  width: 28px;
  min-width: 28px;
  height: 28px;
  padding: 0;
  border-radius: 6px;
  box-sizing: border-box;
}

.chat-input {
  flex: 1;
  min-height: 40px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-default);
  border-radius: 8px;
  padding: 0 14px;
  font-size: 14px;
  color: var(--text-primary);
  transition: border-color 150ms ease, box-shadow 150ms ease;
  outline: none;
  align-self: center;
  white-space: pre-wrap;
}

.chat-input::placeholder {
  color: var(--text-tertiary);
  font-size: 13px;
}

.chat-input:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px var(--accent-subtle);
  background: var(--bg-elevated);
}

.chat-input:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

/* Stop generation button */
.btn-stop-generation {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  padding: 6px 14px;
  border-radius: 10px;
  border: 1px solid rgba(239, 68, 68, 0.3);
  background: rgba(239, 68, 68, 0.08);
  color: #ef4444;
  cursor: pointer;
  transition: all 150ms ease;
}

.btn-stop-generation:hover {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.5);
}

.stop-icon {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  background: currentColor;
}

[data-theme="light"] .btn-stop-generation {
  background: rgba(239, 68, 68, 0.06);
  border-color: rgba(239, 68, 68, 0.25);
}

[data-theme="light"] .btn-stop-generation:hover {
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.4);
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(4px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Thinking indicator */
.thinking-panel {
  margin-bottom: 8px;
  font-size: 12px;
  background: color-mix(in srgb, var(--bg-secondary) 68%, var(--bg-primary));
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  overflow: hidden;
}

.thinking-panel[open] {
  background: var(--bg-primary);
  border-color: var(--border-default);
}

.thinking-summary {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 32px;
  padding: 0 10px;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  user-select: none;
}

.thinking-summary::marker,
.thinking-summary::-webkit-details-marker {
  display: none;
  content: "";
}

.thinking-status-dot {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: var(--text-tertiary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--text-tertiary) 12%, transparent);
  flex-shrink: 0;
}

.thinking-content {
  max-height: 300px;
  overflow: auto;
  padding: 0 10px 9px 23px;
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}

.thought-disclosure summary::marker,
.thought-disclosure summary::-webkit-details-marker {
  display: none;
  content: "";
}

.thought-disclosure-chevron {
  transition: transform 140ms ease;
}

.thought-disclosure[open] .thought-disclosure-chevron {
  transform: rotate(0deg);
}

.thinking-indicator {
  display: flex;
  align-items: center;
  gap: 10px;
}

.thinking-dots {
  display: flex;
  gap: 4px;
  align-items: center;
}

.thinking-dots span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-tertiary);
  animation: thinkingBounce 1.4s ease-in-out infinite;
}

.thinking-dots span:nth-child(2) {
  animation-delay: 0.2s;
}

.thinking-dots span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes thinkingBounce {
  0%, 80%, 100% {
    opacity: 0.3;
    transform: scale(0.8);
  }
  40% {
    opacity: 1;
    transform: scale(1.1);
  }
}

/* Wizard / Stepper */
.wizard-steps {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-8);
}

.wizard-step {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  color: var(--text-tertiary);
}

.wizard-step.active {
  color: var(--accent-text);
}

.wizard-step.completed {
  color: var(--accent-text);
  opacity: 0.8;
}

.wizard-step-number {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-xs);
  font-weight: 600;
  border: 1px solid var(--border-default);
}

.wizard-step.active .wizard-step-number {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  color: var(--text-inverse);
  /* dark text on near-white bg in dark mode */
}

.wizard-step.completed .wizard-step-number {
  background: var(--accent-subtle);
  border-color: var(--accent-subtle);
  color: var(--accent-text);
}

.wizard-connector {
  flex: 1;
  height: 1px;
  background: var(--border-default);
}

/* Typing Indicator Animation */
.typing-indicator {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 6px;
  height: 24px;
}

.typing-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: var(--text-tertiary);
  animation: typing 1.4s infinite ease-in-out both;
}

.typing-dot:nth-child(1) {
  animation-delay: -0.32s;
}

.typing-dot:nth-child(2) {
  animation-delay: -0.16s;
}

@keyframes typing {
  0%, 80%, 100% {
    transform: scale(0);
  }
  40% {
    transform: scale(1);
  }
}

/* ─── Login QR Code ────────────────────────────────── */

.login-qr-toggle {
    margin-top: 24px;
    padding: 12px;
    border: 1px dashed var(--border-strong);
    border-radius: var(--radius-lg);
    text-align: center;
    cursor: pointer;
    font-size: var(--text-sm);
    color: var(--text-secondary);
    transition: all var(--transition-fast);
}

.login-qr-toggle:hover {
    border-color: var(--accent-primary);
    color: var(--text-primary);
    background: var(--bg-hover);
}

.login-qr-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    padding: 20px 0;
}

.login-qr-container {
    position: relative;
    width: 200px;
    height: 200px;
    padding: 10px;
    background: white;
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.login-qr-container img {
    width: 100%;
    height: 100%;
    display: block;
}

.login-qr-container img.blur {
    filter: blur(4px);
    opacity: 0.5;
}

.login-qr-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 10;
    padding: 20px;
    text-align: center;
}

.login-qr-overlay p {
    color: white;
    font-size: var(--text-sm);
    margin-bottom: 12px;
}

.login-qr-overlay button {
    background: var(--accent-primary);
    color: var(--bg-primary);
    border: none;
    padding: 6px 16px;
    border-radius: var(--radius-md);
    font-size: var(--text-xs);
    font-weight: 600;
}

.login-qr-overlay.success {
    background: rgba(34, 197, 94, 0.9);
}

.login-qr-hint {
    font-size: var(--text-xs);
    color: var(--text-tertiary);
    text-align: center;
}

.login-qr-back {
    margin-top: 12px;
    font-size: var(--text-sm);
    color: var(--accent-text);
    cursor: pointer;
}

.login-qr-back:hover {
    text-decoration: underline;
}

/* ─── Drop Zone Overlay (drag-and-drop upload) ───── */

.drop-zone-wrapper {
    position: relative;
}

.drop-zone-overlay {
    position: absolute;
    inset: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 8px;
    background: rgba(99, 102, 241, 0.07);
    border: 2px dashed rgba(99, 102, 241, 0.45);
    border-radius: 12px;
    pointer-events: none;
    animation: dropZoneFadeIn 0.15s ease;
}

.drop-zone-overlay__icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(99, 102, 241, 0.12);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: var(--accent-primary);
}

.drop-zone-overlay__text {
    font-size: 13px;
    font-weight: 600;
    color: var(--accent-primary);
    letter-spacing: 0.2px;
}

.drop-zone-overlay__hint {
    font-size: 11px;
    color: var(--text-tertiary);
}

@keyframes dropZoneFadeIn {
    from {
        opacity: 0;
        border-color: transparent;
    }
    to {
        opacity: 1;
        border-color: rgba(99, 102, 241, 0.45);
    }
}

[data-theme="light"] .drop-zone-overlay {
    background: rgba(99, 102, 241, 0.06);
    border-color: rgba(99, 102, 241, 0.35);
}

/* Workspace Panel file actions */
.workspace-op-tree-file-name {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.workspace-op-tree-file-delete {
  flex-shrink: 0;
  display: none;
  background: transparent;
  border: none;
  color: var(--text-tertiary);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  align-items: center;
  justify-content: center;
}

.workspace-op-tree-file-delete:hover {
  color: var(--system-danger);
  background: var(--bg-black-10);
}

.workspace-op-tree-dir:hover .workspace-op-tree-file-delete,
.workspace-op-tree-file:hover .workspace-op-tree-file-delete {
  display: flex;
}

/* Tool source tabs */
.tool-source-tabs {
  display: inline-flex;
  align-self: flex-start;
  align-items: center;
  gap: 2px;
  padding: 3px;
  margin-bottom: 12px;
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  background: var(--bg-secondary);
  width: fit-content;
  max-width: 100%;
}

.tool-source-tabs button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-width: 0;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--text-tertiary);
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  line-height: 18px;
  padding: 5px 11px;
  transition: background 140ms ease, color 140ms ease, box-shadow 140ms ease;
}

.tool-source-tabs button:hover {
  color: var(--text-secondary);
  background: var(--bg-tertiary);
}

.tool-source-tabs button.active {
  background: var(--bg-primary);
  color: var(--text-primary);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
}

.tool-source-tabs button:focus {
  outline: none;
}

.tool-source-tabs button:focus-visible {
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.18);
}

.tool-source-tab-count {
  min-width: 18px;
  height: 18px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--bg-tertiary);
  color: var(--text-tertiary);
  font-size: 11px;
  font-weight: 650;
  line-height: 18px;
}

.tool-source-tabs button.active .tool-source-tab-count {
  background: var(--bg-secondary);
  color: var(--text-secondary);
}

.enterprise-tool-source-tabs {
  margin-bottom: 16px;
}
/* ═══════════════════════════════════════════════════════
   玄枢 — AI / 科幻 / 互联网风格增强
   追加到现有主题之后，不影响已有功能
   ═══════════════════════════════════════════════════════ */

/* ── 全局：微光扫描线背景 ───────────────────────────── */

.app-layout::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 60% at 20% 80%, rgba(99,102,241,0.04), transparent),
    radial-gradient(ellipse 60% 50% at 80% 20%, rgba(139,92,246,0.03), transparent);
  pointer-events: none;
  z-index: -1;
}

/* ── 侧边栏：科技感背景 ────────────────────────────── */
.sidebar::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 1px;
  height: 100%;
  background: linear-gradient(
    to bottom,
    transparent 0%,
    rgba(99,102,241,0.3) 30%,
    rgba(139,92,246,0.2) 70%,
    transparent 100%
  );
  pointer-events: none;
}

/* 侧边栏头部：品牌发光 */
.sidebar-top {
  position: relative;
}

.sidebar-top::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 16px;
  right: 16px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border-default), rgba(99,102,241,0.15), var(--border-default), transparent);
}

/* ── 卡片 / 容器：AI 风微光边框 ───────────────────── */
[class*="card"],
[class*="Card"],
.chat-list-item,
.agent-card,
.skill-card {
  position: relative;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

[class*="card"]:hover,
[class*="Card"]:hover,
.chat-list-item:hover,
.agent-card:hover {
  border-color: rgba(99, 102, 241, 0.25) !important;
  box-shadow: 0 0 0 1px rgba(99, 102, 241, 0.08),
              0 4px 16px rgba(0, 0, 0, 0.2);
}

/* ── 按钮：渐变 + 光晕 ───────────────────────────── */
.btn-primary,
[class*="primary-btn"],
button[class*="primary"],
button[class*="Primary"] {
  background: linear-gradient(135deg, #6366f1, #8b5cf6) !important;
  border: none !important;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.25);
  transition: all 0.2s ease;
}

.btn-primary:hover,
[class*="primary-btn"]:hover,
button[class*="primary"]:hover {
  background: linear-gradient(135deg, #4f46e5, #7c3aed) !important;
  box-shadow: 0 4px 16px rgba(99, 102, 241, 0.35);
  transform: translateY(-1px);
}

/* ── 顶部栏：半透明毛玻璃 ────────────────────────── */
.topbar,
[class*="topbar"],
[class*="TopBar"],
[class*="header-bar"] {
  background: rgba(10, 10, 15, 0.7) !important;
  border-bottom: 1px solid var(--border-default) !important;
}

/* ── 输入框：科技感聚焦 ──────────────────────────── */
input[type="text"],
input[type="search"],
input[type="email"],
input[type="password"],
textarea {
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

input:focus,
textarea:focus {
  border-color: rgba(99, 102, 241, 0.5) !important;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1) !important;
}

/* ── 滚动条：科技感 ──────────────────────────────── */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(99, 102, 241, 0.2);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(99, 102, 241, 0.4);
}

/* ── 选中文字：品牌色 ────────────────────────────── */
::selection {
  background: rgba(99, 102, 241, 0.3);
  color: #fff;
}

/* ── 消息气泡：微光增强 ──────────────────────────── */
.message-bubble,
[class*="message"][class*="assistant"],
[class*="Message"][class*="assistant"] {
  position: relative;
}

.message-bubble::before,
[class*="message"][class*="assistant"]::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(99,102,241,0.12), transparent);
}

/* ── 导航 / 侧边栏菜单项 ────────────────────────── */
.sidebar-item,
[class*="sidebar-item"],
[class*="nav-item"] {
  transition: all 0.15s ease;
  border-radius: 6px;
}

.sidebar-item:hover,
[class*="sidebar-item"]:hover {
  background: rgba(99, 102, 241, 0.06) !important;
}

.sidebar-item.active,
[class*="sidebar-item"].active,
[class*="sidebar-item"][class*="selected"] {
  background: rgba(99, 102, 241, 0.1) !important;
  box-shadow: inset 3px 0 0 #818cf8;
}

/* ── 骨架屏 / 加载 ──────────────────────────────── */
[class*="skeleton"],
[class*="Skeleton"] {
  background: linear-gradient(90deg, var(--bg-tertiary), var(--bg-elevated), var(--bg-tertiary)) !important;
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s ease-in-out infinite;
}

@keyframes skeleton-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ── 主内容区：边缘辉光 ──────────────────────────── */
/* Note: removed position: relative from .main-content to avoid chat layout issues */
[class*="chat-panel"],
[class*="ChatPanel"] {
  position: relative;
}

/* ── 全局过渡动画 ────────────────────────────────── */
.app-layout > * {
  will-change: auto;
}

/* ═══════════════════════════════════════════════════════
   品牌 Logo 常亮（登录页 + 后台通用）
   ═══════════════════════════════════════════════════════ */
.atlas-brand-wordmark {
  display: block;
  flex: none;
}

.atlas-frame-top {
}
/* ═══════════════════════════════════════════════════════
   Atlas — Paper / Night design system
   Used only by the 4 onboarding screens. All tokens scoped
   to .atlas-page so the rest of the app is unaffected.
   ═══════════════════════════════════════════════════════ */

/* ─── Tokens ──────────────────────────────────────────── */
.atlas-page {
  /* Paper Atlas defaults (light theme) */
  --bg: #F4F1EB;
  --bg-card: #FFFFFF;
  --ink: #1A1814;
  --ink-soft: #3C3933;
  --muted: #8A8478;
  --hairline: #ECE9E2;
  --grid: rgba(26, 24, 20, 0.05);
  --star: rgba(26, 24, 20, 0.32);

  --font-serif: 'Newsreader', Georgia, 'Times New Roman', serif;
  --font-sans:  'IBM Plex Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --font-mono:  'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace;

  position: relative;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  overflow: hidden;
  animation: atlas-page-enter 520ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

/* Page enter — whole page fades in, then the body content lifts up
   slightly with a tiny stagger from the chrome */
@keyframes atlas-page-enter {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.atlas-page > .atlas-frame-body {
  animation: atlas-body-enter 720ms cubic-bezier(0.16, 1, 0.3, 1) 100ms both;
}

@keyframes atlas-body-enter {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  .atlas-page,
  .atlas-page > .atlas-frame-body {
    animation: none;
  }
}

[data-theme="dark"] .atlas-page {
  --bg: #0E0F14;
  --bg-card: #000000;
  --ink: #ECE9E2;
  --ink-soft: #C7C3B9;
  --muted: #6C6A65;
  --hairline: rgba(236, 233, 226, 0.12);
  --grid: rgba(236, 233, 226, 0.04);
  --star: rgba(236, 233, 226, 0.36);
}

/* ─── Page chrome (AtlasFrame) ───────────────────────── */
.atlas-frame-top {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  padding: 30px 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 50;
}

.atlas-frame-top-left {
  display: flex;
  align-items: center;
  gap: 24px;
}

.atlas-brand-wordmark {
  display: block;
  color: var(--ink);
  flex: none;
}

.atlas-step {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  color: var(--muted);
}

.atlas-step-rule {
  display: inline-block;
  width: 36px;
  border-top: 1px solid var(--hairline);
}

.atlas-globe-btn {
  width: 38px;
  height: 38px;
  border-radius: 999px;
  border: 1px solid var(--hairline);
  background: transparent;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: border-color 140ms ease, color 140ms ease;
}
.atlas-globe-btn:hover {
  border-color: var(--ink);
  color: var(--ink);
}

.atlas-back-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 16px;
  height: 32px;
  border-radius: 999px;
  border: 1px solid var(--hairline);
  background: transparent;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink);
  cursor: pointer;
  transition: border-color 140ms ease;
}
.atlas-back-btn:hover { border-color: var(--ink); }

.atlas-frame-body {
  position: relative;
  z-index: 10;
  min-height: 100dvh;
}

.atlas-frame-bottom {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 0 40px 30px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.16em;
  color: var(--muted);
  z-index: 50;
  pointer-events: none;
  text-transform: uppercase;
}

.atlas-corner {
  position: absolute;
  width: 32px;
  height: 32px;
  pointer-events: none;
  z-index: 49;
}
.atlas-corner--bl { bottom: 28px; left: 28px; border-left: 1px solid var(--hairline); border-bottom: 1px solid var(--hairline); }
.atlas-corner--br { bottom: 28px; right: 28px; border-right: 1px solid var(--hairline); border-bottom: 1px solid var(--hairline); }
.atlas-corner--tl { top: 28px;    left: 28px; border-left: 1px solid var(--hairline); border-top: 1px solid var(--hairline); }
.atlas-corner--tr { top: 28px;    right: 28px; border-right: 1px solid var(--hairline); border-top: 1px solid var(--hairline); }

/* ─── Star field (background) ────────────────────────── */
.atlas-starfield {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
  color: var(--star);
}

/* ─── Illustration container helper ──────────────────── */
.atlas-illustration {
  display: block;
  color: var(--ink);
}
.atlas-illustration * {
  vector-effect: non-scaling-stroke;
}

/* ─── Typography ─────────────────────────────────────── */
.atlas-display {
  font-family: var(--font-serif);
  font-weight: 400;
  font-style: normal;
  font-size: 64px;
  line-height: 1.0;
  letter-spacing: -0.01em;
  color: var(--ink);
  margin: 0;
}
.atlas-display em {
  font-style: italic;
  font-weight: 400;
}

.atlas-h1 {
  font-family: var(--font-serif);
  font-weight: 400;
  font-style: normal;
  font-size: 44px;
  line-height: 1.1;
  letter-spacing: -0.01em;
  color: var(--ink);
  margin: 0;
}
.atlas-h1 em {
  font-style: italic;
  font-weight: 400;
}

.atlas-h2 {
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: 32px;
  line-height: 1.2;
  color: var(--ink);
  margin: 0;
}
.atlas-h2 em {
  font-style: italic;
}

.atlas-body {
  font-family: var(--font-sans);
  font-weight: 400;
  font-size: 14px;
  line-height: 1.6;
  color: var(--ink);
  margin: 0;
}
.atlas-body--muted { color: var(--muted); }

.atlas-mono {
  font-family: var(--font-mono);
  font-weight: 400;
  font-size: 11px;
  line-height: 1.4;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0;
}

.atlas-tag {
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0;
}

/* ─── Pill button ───────────────────────────────────── */
.atlas-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: 52px;
  padding: 0 28px;
  border-radius: 999px;
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
  transition: opacity 140ms ease, background 140ms ease, color 140ms ease, border-color 140ms ease;
}

.atlas-btn--primary {
  background: var(--ink);
  color: var(--bg);
  border: 1px solid var(--ink);
}
.atlas-btn--primary:hover:not(:disabled) {
  opacity: 0.88;
}

.atlas-btn--outline {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--ink);
}
.atlas-btn--outline:hover:not(:disabled) {
  background: var(--ink);
  color: var(--bg);
}

.atlas-btn--ghost {
  background: transparent;
  color: var(--muted);
  border: 0;
  height: auto;
  padding: 0 8px;
  font-family: var(--font-sans);
  font-size: 13px;
  letter-spacing: 0;
  text-transform: none;
}
.atlas-btn--ghost:hover:not(:disabled) {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-thickness: 0.5px;
  text-underline-offset: 4px;
}

.atlas-btn:disabled {
  opacity: 0.42;
  cursor: not-allowed;
}

/* ─── Hairline input ────────────────────────────────── */
.atlas-input-wrap {
  display: flex;
  flex-direction: column;
  width: 100%;
}

.atlas-input-row {
  display: flex;
  align-items: baseline;
  gap: 20px;
  border-bottom: 1px solid var(--hairline);
  padding: 10px 0;
}

.atlas-input-label {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  flex: none;
  min-width: 56px;
}

.atlas-input {
  flex: 1;
  width: 100%;
  background: transparent;
  border: 0;
  border-radius: 0;
  padding: 4px 0;
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 16px;
  outline: none;
}
.atlas-input::placeholder {
  color: var(--muted);
}

.atlas-input--serif {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 26px;
  font-weight: 400;
}

.atlas-input--serif-lg {
  font-family: var(--font-serif);
  font-style: normal;
  font-size: 26px;
  font-weight: 400;
  text-align: center;
}

.atlas-input-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 12px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.atlas-input-meta--right {
  justify-content: flex-end;
}

/* Standalone hairline (no row) — used in some forms */
.atlas-input-standalone {
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--hairline);
  padding: 12px 0;
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 16px;
  outline: none;
  border-radius: 0;
  width: 100%;
}
.atlas-input-standalone::placeholder { color: var(--muted); }
.atlas-input-standalone:focus { border-bottom-color: var(--ink); }

/* ─── Chips (Screen 3 personality) ──────────────────── */
.atlas-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 36px;
  padding: 0 16px;
  border-radius: 999px;
  border: 1px solid var(--hairline);
  background: transparent;
  font-family: var(--font-sans);
  font-size: 13px;
  color: var(--muted);
  cursor: pointer;
  transition: border-color 160ms ease, color 160ms ease, background 160ms ease;
}
.atlas-chip:hover {
  border-color: var(--ink);
  color: var(--ink);
}
.atlas-chip.is-active {
  border-color: var(--ink);
  color: var(--ink);
  background: color-mix(in srgb, var(--ink) 6%, transparent);
}

/* ─── Error state ───────────────────────────────────── */
.atlas-error {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border: 1px solid var(--ink);
  border-radius: 4px;
  font-family: var(--font-sans);
  font-size: 12px;
  color: var(--ink);
  background: transparent;
}

/* ─── Plate (illustration + caption) — used by SVG components ─── */
.atlas-plate {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}
.atlas-plate-caption {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ─── Generic modal (re-used for invitation flow) ───── */
.atlas-modal-overlay {
  position: fixed;
  inset: 0;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 20px;
}
.atlas-modal {
  background: var(--bg);
  border: 1px solid var(--ink);
  border-radius: 4px;
  width: 100%;
  max-width: 420px;
  padding: 36px 32px 28px;
  position: relative;
}
.atlas-modal-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 32px;
  height: 32px;
  border: 0;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
}
.atlas-modal-close:hover { color: var(--muted); }
.atlas-modal-close:disabled { opacity: 0.4; cursor: not-allowed; }
.atlas-modal-title {
  margin: 0 0 8px;
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: 26px;
  line-height: 1.2;
  color: var(--ink);
}
.atlas-modal-desc {
  margin: 0 0 24px;
  font-family: var(--font-sans);
  font-size: 14px;
  color: var(--muted);
}

/* ─── Form helper ───────────────────────────────────── */
.atlas-form {
  display: flex;
  flex-direction: column;
  gap: 24px;
  width: 100%;
}

/* ─── Focus rings — never wrap inputs in a 4-sided box ─── */
.atlas-page button:focus-visible,
.atlas-page a:focus-visible {
  outline: 1px solid var(--ink);
  outline-offset: 3px;
}

.atlas-page input,
.atlas-page textarea,
.atlas-page select {
  outline: none;
}

.atlas-page input:focus,
.atlas-page textarea:focus,
.atlas-page select:focus {
  outline: none;
  box-shadow: none;
}

.atlas-page input:focus-visible,
.atlas-page textarea:focus-visible {
  border-bottom-color: var(--ink) !important;
  border-bottom-width: 1.5px !important;
}

/* ═══════════════════════════════════════════════════════
   Layout primitives — split / center / plate / form
   ═══════════════════════════════════════════════════════ */

.atlas-screen-split {
  position: relative;
  z-index: 10;
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 100dvh;
}

.atlas-screen-plate {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 90px 48px;
  overflow: hidden;
}

.atlas-screen-plate--snug {
  padding: 60px 24px;
}

.atlas-screen-plate--gridded .atlas-grid-bg {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 64px 64px;
  pointer-events: none;
  mask-image: radial-gradient(circle at 50% 50%, black 0%, black 55%, transparent 95%);
  -webkit-mask-image: radial-gradient(circle at 50% 50%, black 0%, black 55%, transparent 95%);
}

.atlas-screen-form {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 90px 48px;
}

.atlas-screen-form--padded {
  max-width: 580px;
  width: 100%;
  gap: 28px;
}

.atlas-screen-center {
  position: relative;
  z-index: 10;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.atlas-screen-pad { padding: 90px 24px; }

.atlas-divider {
  height: 1px;
  width: 100%;
  background: var(--hairline);
  margin: 8px 0;
}

/* ═══════════════════════════════════════════════════════
/* ===== 玄枢 Login Page Redesign ===== */

/* Hero left panel — gradient background */
.atlas-login-hero {
  position: relative;
  flex-direction: column;
  justify-content: center;
  padding: 80px 64px 80px 64px;
  align-items: stretch;
  overflow: hidden;
  background: linear-gradient(135deg, #0f0c29 0%, #302b63 50%, #24243e 100%);
}

/* Animated floating orbs */
.atlas-login-hero::before,
.atlas-login-hero::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.35;
  animation: float-orb 8s ease-in-out infinite alternate;
  pointer-events: none;
}

.atlas-login-hero::before {
  width: 360px;
  height: 360px;
  background: radial-gradient(circle, #6366f1, transparent 70%);
  top: 10%;
  left: -60px;
}

.atlas-login-hero::after {
  width: 300px;
  height: 300px;
  background: radial-gradient(circle, #a855f7, transparent 70%);
  bottom: 10%;
  right: -40px;
  animation-delay: 3s;
}

@keyframes float-orb {
  0%   { transform: translate(0, 0) scale(1); }
  100% { transform: translate(30px, -20px) scale(1.08); }
}

/* Compass area — hide the big compass, show a refined one */
.atlas-login-compass {
  flex: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 280px;
  margin-bottom: 0;
  position: relative;
  z-index: 1;
}

.atlas-login-compass svg {
  max-width: 380px;
  max-height: 380px;
  opacity: 0.18;
  filter: drop-shadow(0 0 40px rgba(99,102,241,0.3));
}

/* Welcome text */
.atlas-login-welcome {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 520px;
  margin-top: 0;
  margin-left: 0;
  position: relative;
  z-index: 1;
  text-align: center;
  margin-left: auto;
  margin-right: auto;
}

.atlas-login-welcome .atlas-h1 {
  font-size: 52px;
  line-height: 1.1;
  font-weight: 700;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, #e0e7ff 0%, #c4b5fd 40%, #a78bfa 70%, #818cf8 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: fade-up 0.8s ease-out both;
}

.atlas-login-welcome .atlas-body {
  margin-top: 8px;
  font-size: 17px;
  color: rgba(255,255,255,0.55);
  letter-spacing: 0.08em;
  animation: fade-up 0.8s ease-out 0.15s both;
}

.atlas-login-welcome .atlas-mono {
  margin-bottom: 6px;
  color: rgba(255,255,255,0.4);
  font-size: 12px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

@keyframes fade-up {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Feature pills row */
.atlas-login-features {
  display: flex;
  gap: 12px;
  margin-top: 36px;
  justify-content: center;
  flex-wrap: wrap;
  animation: fade-up 0.8s ease-out 0.3s both;
}

.atlas-login-feature-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 100px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  color: rgba(255,255,255,0.7);
  font-size: 13px;
  backdrop-filter: blur(12px);
  transition: all 0.25s ease;
}

.atlas-login-feature-pill:hover {
  background: rgba(255,255,255,0.1);
  border-color: rgba(255,255,255,0.2);
  color: #fff;
  transform: translateY(-1px);
}

/* ═══ Right form panel ═══ */
.atlas-login-form-pane {
  border-left: none;
  padding: 80px 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg, #fafafa);
}

.atlas-login-form-wrapper {
  max-width: 400px;
  width: 100%;
  margin: 0 auto;
}

/* Form header */
.atlas-page .login-form-header {
  margin-bottom: 32px;
  text-align: center;
}

.atlas-page .login-form-title {
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 28px;
  line-height: 1.2;
  color: var(--ink);
  margin: 0 0 10px;
}

.atlas-page .login-form-subtitle {
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.6;
  color: var(--muted);
  margin: 0;
}

/* Form inputs */
.atlas-page .login-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.atlas-page .login-field label {
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
}

.atlas-page .login-field input {
  border-radius: 10px;
  padding: 12px 16px;
  font-size: 15px;
  border: 1.5px solid var(--hairline);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.atlas-page .login-field input:focus {
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99,102,241,0.1);
  outline: none;
}

/* Primary button */
.atlas-page .login-btn,
.atlas-page .atlas-btn--primary {
  border-radius: 10px;
  padding: 13px 24px;
  font-size: 15px;
  font-weight: 600;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff;
  border: none;
  cursor: pointer;
  transition: all 0.25s;
  letter-spacing: 0.02em;
}

.atlas-page .login-btn:hover,
.atlas-page .atlas-btn--primary:hover {
  background: linear-gradient(135deg, #4f46e5, #7c3aed);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(99,102,241,0.3);
}

/* Toggle link */
.atlas-page .login-toggle-link {
  color: #6366f1;
  font-weight: 500;
  cursor: pointer;
  transition: color 0.2s;
}

.atlas-page .login-toggle-link:hover {
  color: #4f46e5;
}

/* Divider */
.atlas-page .atlas-divider {
  height: 1px;
  background: var(--hairline);
  margin: 16px 0;
}

/* Footer links */
.atlas-page .login-footer {
  text-align: center;
  margin-top: 24px;
}

/* ═══ Responsive ═══ */
@media (max-width: 768px) {
  .atlas-login-split {
    grid-template-columns: 1fr;
  }

  .atlas-login-hero {
    min-height: 320px;
    padding: 48px 24px;
  }

  .atlas-login-compass {
    min-height: 200px;
  }

  .atlas-login-welcome .atlas-h1 {
    font-size: 36px;
  }

  .atlas-login-form-pane {
    padding: 40px 24px;
  }

  .atlas-login-features {
    gap: 8px;
  }
}


.atlas-page .login-field input:focus,
.atlas-page .login-field select:focus {
  outline: none;
  border-bottom-color: var(--ink);
  box-shadow: none;
}

.atlas-page .login-submit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: 52px;
  padding: 0 28px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--bg);
  border: 1px solid var(--ink);
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: none;
  transition: opacity 140ms ease;
  margin-top: 8px;
}
.atlas-page .login-submit:hover:not(:disabled) { opacity: 0.88; }
.atlas-page .login-submit:disabled { opacity: 0.42; cursor: not-allowed; }

.atlas-page .login-error {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border: 1px solid var(--ink);
  border-radius: 4px;
  font-family: var(--font-sans);
  font-size: 12px;
  color: var(--ink);
  background: transparent;
  margin-bottom: 16px;
}

.atlas-page .login-switch {
  margin-top: 24px;
  font-family: var(--font-sans);
  font-size: 13px;
  color: var(--muted);
  text-align: center;
}

.atlas-page .login-switch a {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-thickness: 0.5px;
  text-underline-offset: 4px;
}

.atlas-page .login-verification-actions {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 8px;
}

.atlas-page .login-verification-actions button {
  background: transparent;
  border: 0;
  color: var(--muted);
  font-family: var(--font-sans);
  font-size: 13px;
  cursor: pointer;
  padding: 4px 0;
}
.atlas-page .login-verification-actions button:hover:not(:disabled) {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-thickness: 0.5px;
  text-underline-offset: 4px;
}

/* ═══════════════════════════════════════════════════════
   SCREEN 2 — NAME YOUR COMPANY (centered)
   ═══════════════════════════════════════════════════════ */

.atlas-name-bg-circle {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 720px;
  height: 720px;
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 2;
  color: var(--ink);
  opacity: 0.14;
}

.atlas-name-stack {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 18px;
  width: 100%;
  max-width: 580px;
  position: relative;
  z-index: 10;
}

.atlas-display--centered { text-align: center; }

.atlas-name-stack .atlas-tag { margin-bottom: 4px; }

.atlas-name-stack .atlas-display {
  font-size: 56px;
  line-height: 1.05;
}

.atlas-name-sub {
  max-width: 460px;
  text-align: center;
  margin-top: 6px;
}

.atlas-name-form {
  width: 100%;
  max-width: 520px;
  display: flex;
  flex-direction: column;
  gap: 0;
  margin-top: 16px;
}

.atlas-name-input {
  width: 100%;
  border-bottom: 1px solid var(--hairline);
  padding-bottom: 12px;
  text-align: center;
}

.atlas-name-cta {
  align-self: center;
  margin-top: 28px;
}

.atlas-text-underline {
  background: none;
  border: 0;
  margin-top: 16px;
  font-family: var(--font-sans);
  font-size: 13px;
  color: var(--muted);
  cursor: pointer;
  text-decoration: underline;
  text-decoration-thickness: 0.5px;
  text-underline-offset: 4px;
  align-self: center;
}
.atlas-text-underline:hover { color: var(--ink); }

/* ═══════════════════════════════════════════════════════
   SCREEN 3 — FIRST EMPLOYEE
   ═══════════════════════════════════════════════════════ */

.atlas-screen-form--padded .atlas-tag {
  margin-bottom: 4px;
}

.atlas-screen-form--padded .atlas-h1 {
  font-size: 40px;
}

.atlas-expand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 16px 0;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--hairline);
  color: var(--ink);
  cursor: pointer;
}

.atlas-options {
  display: flex;
  flex-direction: column;
  gap: 18px;
  margin-top: -8px;
}

.atlas-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.atlas-textarea {
  width: 100%;
  min-height: 80px;
  border: 1px solid var(--hairline);
  border-radius: 4px;
  background: transparent;
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 13px;
  padding: 10px 12px;
  resize: vertical;
  outline: none;
}
.atlas-textarea:focus { border-color: var(--ink); }

.atlas-cta-row {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-top: 8px;
}

/* ═══════════════════════════════════════════════════════
   SCREEN 4 — YOUR UNIVERSE
   ═══════════════════════════════════════════════════════ */

.atlas-roster {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.atlas-roster li {
  display: grid;
  grid-template-columns: 22px 1fr auto;
  align-items: baseline;
  gap: 12px;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink);
}

.atlas-roster-mark {
  font-size: 14px;
  color: var(--muted);
  line-height: 1;
}

.atlas-roster-label {
  color: var(--muted);
}

.atlas-roster-value {
  color: var(--ink);
  text-align: right;
}

/* ═══════════════════════════════════════════════════════
   Responsive — collapse splits on narrow viewports
   ═══════════════════════════════════════════════════════ */
@media (max-width: 1100px) {
  .atlas-login-split { grid-template-columns: 1fr; }
  .atlas-login-form-pane { border-left: 0; border-top: 1px solid var(--hairline); padding: 60px 32px; }
}

@media (max-width: 900px) {
  .atlas-frame-top { padding: 20px 24px; }
  .atlas-frame-bottom { padding: 0 24px 20px; font-size: 9px; }
  .atlas-corner { width: 20px; height: 20px; }
  .atlas-corner--bl, .atlas-corner--br { bottom: 18px; }
  .atlas-corner--bl { left: 18px; }
  .atlas-corner--br { right: 18px; }
  .atlas-screen-split { grid-template-columns: 1fr; }
  .atlas-screen-plate { padding: 40px 24px; min-height: 360px; }
  .atlas-screen-form { padding: 40px 24px; }
  .atlas-name-stack .atlas-display { font-size: 40px; }
}
