/* ─────────────────────────────────────────────────────────────
   ZACKGO AI COPILOT — Premium executive chat experience
   ChatGPT Enterprise–inspired · dark + light themes
────────────────────────────────────────────────────────────── */

/* Shell & hero */
.copilot-shell {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: calc(100vh - 220px);
}

.copilot-hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  padding: 22px 24px;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, color-mix(in oklab, var(--accent) 10%, var(--surface-elev)), var(--surface-elev));
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.copilot-hero h2 {
  font-size: 22px;
  font-weight: 800;
  color: var(--text-strong);
  letter-spacing: -0.4px;
  margin: 6px 0 4px;
}

.copilot-hero-sub {
  font-size: 13px;
  color: var(--text-dim);
  line-height: 1.6;
  max-width: 560px;
}

.copilot-pro-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 100px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #071A14;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.8px;
  text-transform: uppercase;
}

/* Main panel */
.copilot-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  border-radius: var(--radius-lg);
  background: var(--surface-elev);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  min-height: 480px;
}

.copilot-panel-header {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.copilot-panel-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-strong);
}

.copilot-panel-meta {
  font-size: 12px;
  color: var(--text-mute);
}

/* Chat log */
.copilot-chat-log {
  flex: 1;
  min-height: 320px;
  max-height: min(58vh, 560px);
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 24px 20px;
  scroll-behavior: smooth;
}

.copilot-chat-log::-webkit-scrollbar {
  width: 6px;
}

.copilot-chat-log::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

/* Empty state */
.copilot-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 32px 24px 24px;
  animation: copilotFadeIn 0.45s var(--ease, ease) both;
}

.copilot-empty-icon {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-soft);
  border: 1px solid var(--accent-strong);
  color: var(--accent);
  margin-bottom: 18px;
}

.copilot-empty-icon svg {
  width: 28px;
  height: 28px;
}

.copilot-empty-title {
  font-size: 20px;
  font-weight: 800;
  color: var(--text-strong);
  letter-spacing: -0.35px;
  margin-bottom: 8px;
}

.copilot-empty-sub {
  font-size: 13.5px;
  color: var(--text-dim);
  line-height: 1.65;
  max-width: 440px;
  margin-bottom: 28px;
}

.copilot-empty-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 10px;
  width: 100%;
  max-width: 680px;
  margin-bottom: 24px;
}

.copilot-empty-card-wrap {
  position: relative;
}

.copilot-empty-card-remove {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-elev, var(--surface));
  color: var(--text-mute);
  cursor: pointer;
  padding: 0;
  opacity: 0;
  transform: scale(0.92);
  transition: opacity 0.15s ease, background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
  z-index: 2;
}

.copilot-empty-card-wrap:hover .copilot-empty-card-remove,
.copilot-empty-card-remove:focus-visible {
  opacity: 1;
  transform: scale(1);
}

.copilot-empty-card-remove:hover {
  border-color: var(--danger, #EF4444);
  background: rgba(239, 68, 68, 0.08);
  color: var(--danger, #EF4444);
}

.copilot-empty-card-remove svg {
  width: 12px;
  height: 12px;
}

.copilot-empty-card-wrap .copilot-empty-card {
  width: 100%;
  padding-right: 38px;
}

.copilot-empty-card {
  text-align: left;
  padding: 14px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  font-family: inherit;
  transition: border-color 0.18s ease, background 0.18s ease, transform 0.18s ease;
}

.copilot-empty-card:hover {
  border-color: var(--accent-strong);
  background: var(--accent-soft);
  transform: translateY(-1px);
}

.copilot-empty-card-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-mute);
  margin-bottom: 4px;
}

.copilot-empty-card-text {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-strong);
  line-height: 1.45;
}

.copilot-recent {
  width: 100%;
  max-width: 680px;
  text-align: left;
}

.copilot-recent-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.65px;
  color: var(--text-mute);
  margin-bottom: 10px;
}

.copilot-recent-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.copilot-recent-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  font-family: inherit;
  text-align: left;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.copilot-recent-item:hover {
  border-color: var(--accent-strong);
  background: var(--accent-soft);
}

.copilot-recent-item-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-strong);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.copilot-recent-item-time {
  font-size: 11px;
  color: var(--text-mute);
  flex-shrink: 0;
}

/* Message rows */
.copilot-msg-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-width: min(92%, 760px);
  animation: copilotFadeIn 0.35s var(--ease, ease) both;
}

.copilot-msg-row.user {
  align-self: flex-end;
  align-items: flex-end;
}

.copilot-msg-row.assistant {
  align-self: flex-start;
  align-items: flex-start;
  max-width: min(96%, 820px);
}

.copilot-msg-meta {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--text-mute);
  letter-spacing: 0.3px;
  padding: 0 4px;
}

.copilot-msg-bubble {
  position: relative;
  width: 100%;
}

.copilot-msg-bubble.user {
  padding: 12px 16px 10px;
  border-radius: 18px 18px 4px 18px;
  background: linear-gradient(135deg, color-mix(in oklab, var(--accent) 22%, var(--surface-elev)), color-mix(in oklab, var(--accent) 12%, var(--surface)));
  border: 1px solid var(--accent-strong);
  color: var(--text-strong);
  font-size: 13.5px;
  line-height: 1.55;
  font-weight: 500;
  box-shadow: 0 4px 14px -8px rgba(245, 181, 68, 0.35);
}

.copilot-user-text {
  white-space: pre-wrap;
  word-break: break-word;
}

.copilot-msg-bubble.assistant {
  padding: 0;
  background: transparent;
  border: none;
  width: 100%;
}

.copilot-msg-content-wrap {
  padding: 16px 18px;
  border-radius: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.copilot-msg-content {
  font-size: 14px;
  line-height: 1.72;
  color: var(--text);
  letter-spacing: -0.01em;
}

.copilot-msg-content h1,
.copilot-msg-content h2,
.copilot-msg-content h3 {
  color: var(--text-strong);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 1.1em 0 0.45em;
  line-height: 1.35;
}

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

.copilot-msg-content h1 { font-size: 1.25em; }
.copilot-msg-content h2 {
  font-size: 1.05em;
  padding-bottom: 8px;
  margin-top: 1.25em;
}
.copilot-msg-content h3 { font-size: 1.02em; }

.copilot-md-label {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent-2, var(--accent));
  margin: 0.85em 0 0.35em;
}

.copilot-md-section:first-child .copilot-md-label {
  margin-top: 0;
}

.copilot-md-label-body {
  margin-top: 0.35em !important;
  margin-bottom: 0.5em !important;
}

.copilot-md-section {
  padding-bottom: 0.15em;
}

.copilot-msg-content p {
  margin: 0 0 0.75em;
}

.copilot-msg-content p:last-child {
  margin-bottom: 0;
}

.copilot-msg-content ul,
.copilot-msg-content ol {
  margin: 0.5em 0 0.85em;
  padding-left: 1.35em;
}

.copilot-msg-content li {
  margin-bottom: 0.35em;
}

.copilot-msg-content li:last-child {
  margin-bottom: 0;
}

.copilot-msg-content strong {
  font-weight: 700;
  color: var(--text-strong);
}

.copilot-msg-content em {
  font-style: italic;
  color: var(--text-dim);
}

.copilot-msg-content blockquote {
  margin: 0.75em 0;
  padding: 10px 14px;
  border-left: 3px solid var(--accent);
  background: var(--surface-2);
  border-radius: 0 var(--radius-xs) var(--radius-xs) 0;
  color: var(--text-dim);
  font-size: 0.95em;
}

.copilot-msg-content hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 1.1em 0;
}

.copilot-msg-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 0.75em 0 1em;
  font-size: 12.5px;
  overflow-x: auto;
  display: block;
}

.copilot-msg-content th,
.copilot-msg-content td {
  padding: 8px 12px;
  border: 1px solid var(--border);
  text-align: left;
}

.copilot-msg-content th {
  background: var(--surface-2);
  font-weight: 700;
  color: var(--text-strong);
}

.copilot-msg-content code {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.88em;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--surface-2);
  border: 1px solid var(--border);
}

.copilot-stream-cursor {
  display: inline-block;
  width: 2px;
  height: 1em;
  background: var(--accent);
  margin-left: 2px;
  vertical-align: text-bottom;
  animation: copilotBlink 0.9s step-end infinite;
}

/* Loading state */
.copilot-loading {
  align-self: flex-start;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border-radius: var(--radius);
  background: var(--surface-2);
  border: 1px solid var(--border);
  animation: copilotFadeIn 0.3s ease both;
}

.copilot-loading-dots {
  display: flex;
  gap: 4px;
}

.copilot-loading-dots span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  animation: copilotDot 1.2s ease-in-out infinite;
}

.copilot-loading-dots span:nth-child(2) { animation-delay: 0.15s; }
.copilot-loading-dots span:nth-child(3) { animation-delay: 0.3s; }

.copilot-loading-text {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-dim);
  transition: opacity 0.25s ease;
}

/* Source references */
.copilot-refs {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.copilot-refs-label {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: var(--text-mute);
  margin-bottom: 10px;
}

.copilot-refs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 8px;
}

.copilot-ref-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  font-family: inherit;
  text-align: left;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s ease;
}

.copilot-ref-card:hover {
  border-color: var(--accent-strong);
  background: var(--accent-soft);
  transform: translateY(-1px);
}

.copilot-ref-card-icon {
  width: 14px;
  height: 14px;
  color: var(--accent);
}

.copilot-ref-card-title {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-strong);
  line-height: 1.35;
}

.copilot-ref-card-meta {
  font-size: 10.5px;
  color: var(--text-mute);
}

.copilot-ref-card-excerpt {
  font-size: 11px;
  color: var(--text-dim);
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Follow-up chips */
.copilot-followups {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.copilot-followup-chip {
  padding: 7px 13px;
  border-radius: 100px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-dim);
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

.copilot-followup-chip:hover:not(:disabled) {
  border-color: var(--accent-strong);
  background: var(--accent-soft);
  color: var(--text-strong);
  transform: translateY(-1px);
}

.copilot-followup-chip:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Message actions */
.copilot-msg-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-top: 10px;
  opacity: 1;
}

.copilot-msg-actions--user {
  justify-content: flex-end;
  margin-top: 8px;
  opacity: 0.72;
  transition: opacity 0.2s ease;
}

.copilot-msg-row.user:hover .copilot-msg-actions--user,
.copilot-msg-row.user:focus-within .copilot-msg-actions--user {
  opacity: 1;
}

.copilot-msg-actions .copilot-action-secondary {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.copilot-msg-row.assistant:hover .copilot-action-secondary,
.copilot-msg-row.assistant:focus-within .copilot-action-secondary {
  opacity: 1;
  pointer-events: auto;
}

.copilot-copy-btn {
  opacity: 1 !important;
  pointer-events: auto !important;
}

.copilot-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text-mute);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.copilot-action-btn:hover {
  background: var(--surface-2);
  color: var(--text-strong);
}

.copilot-action-btn.active-up {
  color: var(--success);
}

.copilot-action-btn.active-down {
  color: var(--danger);
}

.copilot-action-btn svg {
  width: 16px;
  height: 16px;
}

.copilot-action-divider {
  width: 1px;
  height: 18px;
  background: var(--border);
  margin: 0 4px;
}

/* Error state */
.copilot-error {
  align-self: flex-start;
  max-width: min(92%, 560px);
  padding: 14px 16px;
  border-radius: var(--radius);
  border: 1px solid color-mix(in oklab, var(--danger) 40%, var(--border));
  background: var(--danger-soft);
  animation: copilotFadeIn 0.35s ease both;
}

.copilot-error-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--danger);
  margin-bottom: 4px;
}

.copilot-error-text {
  font-size: 12.5px;
  color: var(--text-dim);
  line-height: 1.55;
  margin-bottom: 12px;
}

.copilot-error-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.copilot-retry-btn {
  padding: 7px 14px;
  border-radius: 8px;
  border: none;
  background: var(--danger);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
}

.copilot-retry-btn:hover {
  opacity: 0.9;
}

/* Prompts bar & compose */
.copilot-prompts {
  padding: 0 20px 10px;
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.copilot-prompts.is-hidden,
.copilot-prompts[hidden] {
  display: none;
}

.copilot-prompts-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  flex: 1;
  min-width: 0;
}

.copilot-prompt-chip {
  display: inline-flex;
  align-items: stretch;
  max-width: 100%;
  border-radius: 100px;
  border: 1px solid var(--border);
  background: var(--surface);
  overflow: hidden;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.copilot-prompt-chip:hover {
  border-color: var(--border-strong, var(--border));
  background: var(--surface-2);
}

.copilot-prompt-remove {
  flex-shrink: 0;
  width: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-left: 1px solid var(--border);
  background: transparent;
  color: var(--text-mute);
  cursor: pointer;
  padding: 0;
  transition: background 0.15s ease, color 0.15s ease;
}

.copilot-prompt-remove svg {
  width: 12px;
  height: 12px;
}

.copilot-prompt-remove:hover {
  background: rgba(239, 68, 68, 0.08);
  color: var(--danger, #EF4444);
}

.copilot-prompts-empty {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--text-mute);
}

.copilot-prompts-restore {
  border: none;
  background: transparent;
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  padding: 0;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.copilot-prompts-restore:hover {
  opacity: 0.85;
}

.copilot-prompts-dismiss {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-mute);
  cursor: pointer;
  padding: 0;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.copilot-prompts-dismiss svg {
  width: 14px;
  height: 14px;
}

.copilot-prompts-dismiss:hover {
  border-color: var(--border-strong, var(--border));
  background: var(--surface-2);
  color: var(--text-strong);
}

.copilot-prompt-btn {
  padding: 7px 12px;
  border-radius: 0;
  border: none;
  background: transparent;
  color: var(--text-dim);
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  line-height: 1.35;
  text-align: left;
  transition: color 0.15s ease;
  max-width: 100%;
}

.copilot-prompt-btn:hover:not(:disabled) {
  color: var(--text-strong);
}

.copilot-prompt-btn:active:not(:disabled) {
  transform: none;
}

.copilot-prompt-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.copilot-compose {
  padding: 14px 20px 18px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 10px;
  align-items: flex-end;
  background: var(--surface);
}

.copilot-compose-inner {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 14px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--surface-elev);
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.copilot-compose-inner:focus-within {
  border-color: var(--accent-strong);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.copilot-compose textarea {
  width: 100%;
  min-height: 24px;
  max-height: 120px;
  resize: none;
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 13.5px;
  font-family: inherit;
  outline: none;
  line-height: 1.5;
}

.copilot-compose textarea::placeholder {
  color: var(--text-mute);
}

.copilot-compose-hint {
  font-size: 10.5px;
  color: var(--text-mute);
}

.copilot-send-btn {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #071A14;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 6px 16px -8px rgba(245, 181, 68, 0.55);
  transition: transform 0.15s ease, opacity 0.15s ease;
}

.copilot-send-btn:hover:not(:disabled) {
  transform: translateY(-1px);
}

.copilot-send-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.copilot-send-btn svg {
  width: 20px;
  height: 20px;
}

/* Overview CTA (unchanged branding) */
.copilot-overview-cta {
  margin-bottom: 28px;
  padding: 18px 20px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--accent-strong);
  background: var(--accent-soft);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.copilot-overview-cta-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-strong);
}

.copilot-overview-cta-sub {
  font-size: 12.5px;
  color: var(--text-dim);
  margin-top: 4px;
  max-width: 520px;
  line-height: 1.55;
}

/* Toast feedback */
.copilot-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(12px);
  padding: 10px 18px;
  border-radius: 100px;
  background: var(--surface-elev);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md, 0 8px 24px rgba(0, 0, 0, 0.2));
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-strong);
  z-index: 9999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.copilot-toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Animations */
@keyframes copilotFadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

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

@keyframes copilotDot {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
  40% { transform: scale(1); opacity: 1; }
}

.copilot-hero-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.copilot-hero-actions .btn-sm-outline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.copilot-hero-actions .btn-sm-outline svg {
  width: 14px;
  height: 14px;
}

.copilot-back-dashboard {
  text-decoration: none;
}

/* Standalone fullscreen page — premium executive workspace */
.copilot-page {
  min-height: 100vh;
  min-height: 100dvh;
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--copilot-bg, #030E0A);
  color: var(--text-strong);
  font-family: Inter, system-ui, sans-serif;
}

html:has(.copilot-page-premium) {
  height: 100%;
  overflow: hidden;
}

html:has(.copilot-page-premium) body {
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
}

#copilot-standalone-root {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.copilot-page-premium {
  --copilot-bg: #030E0A;
  --copilot-surface: rgba(255, 255, 255, 0.035);
  --copilot-surface-strong: rgba(255, 255, 255, 0.06);
  --copilot-border: rgba(255, 255, 255, 0.08);
  --copilot-border-strong: rgba(224, 180, 76, 0.22);
  --copilot-glow: rgba(224, 180, 76, 0.12);
  --accent-soft: rgba(224, 180, 76, 0.12);
  --accent-strong: rgba(224, 180, 76, 0.35);
  --surface: rgba(255, 255, 255, 0.03);
  --surface-2: rgba(255, 255, 255, 0.05);
  --surface-elev: rgba(255, 255, 255, 0.04);
  --text: #D1D5DB;
  --text-strong: #F9FAFB;
  --text-dim: #9CA3AF;
  --text-mute: #6B7280;
  --accent: #E0B44C;
  --accent-2: #C9992F;
  --radius: 12px;
  --radius-lg: 18px;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.24);
  --shadow-md: 0 12px 40px rgba(0, 0, 0, 0.35);
}

:root[data-theme="light"] .copilot-page-premium {
  --copilot-bg: #F4F7FB;
  --copilot-surface: rgba(255, 255, 255, 0.82);
  --copilot-surface-strong: #FFFFFF;
  --copilot-border: rgba(15, 23, 42, 0.08);
  --copilot-border-strong: rgba(180, 130, 20, 0.28);
  --copilot-glow: rgba(224, 180, 76, 0.08);
  --accent-soft: rgba(224, 180, 76, 0.14);
  --accent-strong: rgba(180, 130, 20, 0.35);
  --surface: #FFFFFF;
  --surface-2: #F8FAFC;
  --surface-elev: rgba(255, 255, 255, 0.92);
  --text: #334155;
  --text-strong: #0F172A;
  --text-dim: #475569;
  --text-mute: #64748B;
  --shadow-md: 0 12px 40px rgba(15, 23, 42, 0.08);
}

.copilot-ambient {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.copilot-ambient-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.55;
}

.copilot-ambient-orb--gold {
  width: 520px;
  height: 520px;
  top: -180px;
  right: -120px;
  background: radial-gradient(circle, rgba(224, 180, 76, 0.28), transparent 68%);
}

.copilot-ambient-orb--navy {
  width: 640px;
  height: 640px;
  bottom: -260px;
  left: -180px;
  background: radial-gradient(circle, rgba(16, 185, 129, 0.12), transparent 70%);
}

.copilot-ambient-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse 80% 70% at 50% 40%, black 20%, transparent 100%);
}

:root[data-theme="light"] .copilot-shell-premium .copilot-panel-premium > .copilot-compose,
:root[data-theme="light"] .copilot-shell-premium .copilot-panel-premium > .copilot-compose-premium {
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 -8px 32px rgba(15, 23, 42, 0.1);
}

:root[data-theme="light"] .copilot-shell-premium .copilot-panel-premium > .copilot-prompts:not(.is-hidden):not([hidden]) {
  background: rgba(255, 255, 255, 0.92);
}

:root[data-theme="light"] .copilot-ambient-grid {
  background-image:
    linear-gradient(rgba(15, 23, 42, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(15, 23, 42, 0.04) 1px, transparent 1px);
}

.copilot-page-body {
  position: relative;
  z-index: 1;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 0;
  max-width: none;
  width: 100%;
  margin: 0;
}

.copilot-page-loading,
.copilot-page-error {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 48px 24px;
  color: var(--text-dim);
  text-align: center;
}

.copilot-page-loading-mark {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--copilot-surface-strong);
  border: 1px solid var(--copilot-border);
  box-shadow: var(--shadow-md);
}

.copilot-page-loading-text {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.copilot-page-error a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}

.copilot-shell-premium {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.copilot-chrome {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--copilot-border);
  background: color-mix(in oklab, var(--copilot-surface-strong) 88%, transparent);
  backdrop-filter: blur(20px) saturate(1.4);
  -webkit-backdrop-filter: blur(20px) saturate(1.4);
  flex-shrink: 0;
}

.copilot-chrome-left,
.copilot-chrome-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.copilot-chrome-center {
  flex: 1;
  min-width: 0;
  display: flex;
  justify-content: center;
}

.copilot-chrome-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: inherit;
}

.copilot-chrome-logo,
.copilot-chrome-brand .zg-logo {
  width: 36px;
  height: 36px;
}

.copilot-chrome-brand-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.copilot-chrome-title {
  font-size: 15px;
  font-weight: 800;
  letter-spacing: -0.35px;
  color: var(--text-strong);
}

.copilot-chrome-company {
  font-size: 11.5px;
  font-weight: 500;
  color: var(--text-mute);
}

.copilot-chrome-meta {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: min(560px, 42vw);
  padding: 6px 14px;
  border-radius: 100px;
  border: 1px solid var(--copilot-border);
  background: var(--copilot-surface);
}

.copilot-chrome-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 14px;
  border-radius: 10px;
  border: 1px solid var(--copilot-border);
  background: var(--copilot-surface);
  color: var(--text-dim);
  font-size: 12.5px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  text-decoration: none;
  transition: border-color 0.18s ease, background 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.copilot-chrome-btn svg {
  width: 15px;
  height: 15px;
}

.copilot-chrome-btn:hover {
  border-color: var(--copilot-border-strong);
  background: var(--accent-soft);
  color: var(--text-strong);
}

.copilot-chrome-btn--icon {
  padding: 9px;
  width: 38px;
  height: 38px;
  justify-content: center;
}

.copilot-chrome-exit {
  color: var(--text-strong);
}

.copilot-layout-premium {
  flex: 1;
  min-height: 0;
  border: none;
  border-radius: 0;
  box-shadow: none;
  background: transparent;
}

.copilot-shell-premium .copilot-sidebar-premium {
  width: 300px;
  max-height: none;
  height: auto;
  align-self: stretch;
  background: color-mix(in oklab, var(--copilot-surface-strong) 72%, transparent);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-right: 1px solid var(--copilot-border);
}

.copilot-shell-premium .copilot-panel-premium {
  min-height: 0;
  flex: 1;
  border: none;
  border-radius: 0;
  box-shadow: none;
  background: transparent;
  display: flex;
  flex-direction: column;
}

.copilot-shell-premium .copilot-chat-wrap {
  flex: 1;
  min-height: 0;
}

.copilot-shell-premium .copilot-chat-log {
  max-height: none;
  min-height: 0;
  flex: 1;
  padding: 28px clamp(20px, 4vw, 48px) 32px;
}

.copilot-shell-premium .copilot-empty {
  min-height: min(520px, calc(100vh - 280px));
}

.copilot-shell-premium .copilot-empty-title {
  font-size: clamp(22px, 3vw, 28px);
  letter-spacing: -0.5px;
}

.copilot-shell-premium .copilot-empty-sub {
  font-size: 14.5px;
  max-width: 520px;
}

.copilot-shell-premium .copilot-empty-grid {
  max-width: 780px;
  gap: 12px;
}

.copilot-shell-premium .copilot-empty-card {
  padding: 18px 18px;
  border-radius: 14px;
  background: var(--copilot-surface);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.copilot-shell-premium .copilot-empty-card:hover {
  box-shadow: 0 8px 32px -12px var(--copilot-glow);
}

.copilot-shell-premium .copilot-msg-row {
  max-width: min(820px, 92%);
}

.copilot-shell-premium .copilot-msg-row.assistant {
  max-width: min(860px, 94%);
}

.copilot-compose-premium {
  padding: 16px clamp(20px, 4vw, 48px) 24px;
  background: transparent;
  border-top: 1px solid var(--copilot-border);
  flex-shrink: 0;
  z-index: 2;
}

.copilot-compose-premium .copilot-compose-inner {
  padding: 12px 16px;
  border-radius: 16px;
  background: var(--copilot-surface-strong);
  border-color: var(--copilot-border);
  box-shadow: var(--shadow-md);
  min-height: 52px;
}

.copilot-compose-premium .copilot-compose-inner:focus-within {
  border-color: var(--accent-strong);
  box-shadow: 0 0 0 3px var(--accent-soft), var(--shadow-md);
}

.copilot-compose-premium .copilot-compose textarea {
  font-size: 14.5px;
}

.copilot-shell-premium .copilot-prompts {
  padding: 0 clamp(20px, 4vw, 48px) 10px;
  flex-shrink: 0;
}

.copilot-sidebar-toggle-desktop {
  display: none;
}

.copilot-shell-standalone {
  min-height: 100%;
}

/* In-page fullscreen within executive dashboard */
body.copilot-inpage-fullscreen {
  overflow: hidden;
}

body.copilot-inpage-fullscreen .sidebar,
body.copilot-inpage-fullscreen #sidebar,
body.copilot-inpage-fullscreen .sidebar-overlay,
body.copilot-inpage-fullscreen #sidebarOverlay,
body.copilot-inpage-fullscreen .topbar {
  display: none !important;
}

body.copilot-inpage-fullscreen .main {
  margin-left: 0 !important;
  width: 100% !important;
  max-width: none !important;
  padding: 12px 16px 16px !important;
}

body.copilot-inpage-fullscreen .tab-content:not(#tab-copilot) {
  display: none !important;
}

body.copilot-inpage-fullscreen #tab-copilot {
  display: block !important;
}

body.copilot-inpage-fullscreen .copilot-shell {
  min-height: calc(100vh - 24px);
}

body.copilot-inpage-fullscreen .copilot-chat-log {
  max-height: calc(100vh - 300px);
  min-height: calc(100vh - 300px);
}

body.copilot-inpage-fullscreen .copilot-panel {
  min-height: calc(100vh - 180px);
}

@media (min-width: 901px) {
  .copilot-layout {
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: var(--surface-elev);
    box-shadow: var(--shadow-sm);
  }

  .copilot-main .copilot-panel {
    border: none;
    border-radius: 0;
    box-shadow: none;
  }
}

.copilot-sidebar-toggle {
  display: none;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-dim);
  cursor: pointer;
  align-items: center;
  justify-content: center;
}

.copilot-sidebar-toggle svg {
  width: 18px;
  height: 18px;
}

.copilot-layout {
  display: flex;
  gap: 0;
  flex: 1;
  min-height: 0;
  position: relative;
}

.copilot-main {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.copilot-sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.copilot-sidebar-overlay.visible {
  opacity: 1;
  pointer-events: auto;
}

.copilot-sidebar {
  width: 280px;
  flex-shrink: 0;
  border-right: 1px solid var(--border);
  background: var(--surface);
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 280px);
}

.copilot-sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}

.copilot-sidebar-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-strong);
}

.copilot-sidebar-close {
  display: none;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text-mute);
  cursor: pointer;
  align-items: center;
  justify-content: center;
}

.copilot-sidebar-close svg {
  width: 16px;
  height: 16px;
}

.copilot-sidebar-search {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}

.copilot-sidebar-search input {
  width: 100%;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-elev);
  color: var(--text);
  font-size: 12.5px;
  font-family: inherit;
  outline: none;
}

.copilot-sidebar-search input:focus {
  border-color: var(--accent-strong);
}

.copilot-conv-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}

.copilot-sidebar-empty {
  padding: 24px 16px;
  text-align: center;
  font-size: 12.5px;
  color: var(--text-mute);
}

.copilot-conv-item {
  display: flex;
  align-items: stretch;
  gap: 2px;
  border-radius: var(--radius-sm);
  margin-bottom: 4px;
  transition: background 0.15s ease;
}

.copilot-conv-item:hover {
  background: var(--surface-2);
}

.copilot-conv-item.active {
  background: var(--accent-soft);
}

.copilot-conv-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 12px;
  border: none;
  background: transparent;
  cursor: pointer;
  font-family: inherit;
  text-align: left;
  min-width: 0;
}

.copilot-conv-pin {
  display: inline-flex;
  width: 12px;
  height: 12px;
  color: var(--accent);
  margin-bottom: 2px;
}

.copilot-conv-pin svg {
  width: 12px;
  height: 12px;
}

.copilot-conv-title {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-strong);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.copilot-conv-date {
  font-size: 10.5px;
  color: var(--text-mute);
}

.copilot-conv-actions {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  padding-right: 4px;
}

.copilot-conv-item:hover .copilot-conv-actions {
  display: flex;
}

.copilot-conv-actions button {
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--text-mute);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.copilot-conv-actions button:hover {
  background: var(--surface-elev);
  color: var(--text-strong);
}

.copilot-conv-actions button svg {
  width: 14px;
  height: 14px;
}

.copilot-sidebar-sync {
  color: var(--text-dim);
  font-size: 13px;
}

.copilot-conv-shared {
  display: inline-flex;
  color: var(--accent-orange, #f97316);
  opacity: 0.85;
}

.copilot-conv-shared svg {
  width: 12px;
  height: 12px;
}

/* ── Shared conversation page ── */
.copilot-share-page .copilot-page-body {
  min-height: 100dvh;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 24px 16px 48px;
}

.copilot-share-shell {
  width: min(760px, 100%);
}

.copilot-share-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 24px;
}

.copilot-share-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  color: var(--text-strong);
  text-decoration: none;
}

.copilot-share-badge {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(249, 115, 22, 0.12);
  color: var(--accent-orange, #f97316);
  border: 1px solid rgba(249, 115, 22, 0.25);
}

.copilot-share-state {
  text-align: center;
  padding: 48px 24px;
}

.copilot-share-error-icon {
  font-size: 32px;
  margin-bottom: 12px;
}

.copilot-share-content {
  background: var(--surface-1, rgba(255, 255, 255, 0.03));
  border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.08));
  border-radius: 16px;
  overflow: hidden;
}

.copilot-share-meta {
  padding: 24px 24px 8px;
  border-bottom: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.08));
}

.copilot-share-meta h1 {
  margin: 0 0 6px;
  font-size: 22px;
  color: var(--text-strong);
}

.copilot-share-meta p {
  margin: 0;
  font-size: 13px;
  color: var(--text-dim);
}

.copilot-share-log {
  padding: 16px 24px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-height: min(70dvh, 720px);
  overflow-y: auto;
}

.copilot-share-msg {
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.08));
}

.copilot-share-msg--user {
  background: rgba(249, 115, 22, 0.06);
}

.copilot-share-msg--assistant {
  background: var(--surface-2, rgba(255, 255, 255, 0.02));
}

.copilot-share-msg-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 8px;
}

.copilot-share-msg-body {
  font-size: 14px;
  line-height: 1.65;
  color: var(--text);
}

.copilot-share-msg-body h3,
.copilot-share-msg-body h4 {
  margin: 12px 0 6px;
  color: var(--text-strong);
}

.copilot-share-footer {
  padding: 16px 24px 20px;
  border-top: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.08));
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.copilot-share-footer p {
  margin: 0;
  font-size: 12px;
  color: var(--text-dim);
}

.copilot-share-cta {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent-orange, #f97316);
  text-decoration: none;
}

.copilot-share-empty {
  text-align: center;
  color: var(--text-dim);
  padding: 32px 16px;
}

@media (max-width: 640px) {
  .copilot-share-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .copilot-share-meta,
  .copilot-share-log,
  .copilot-share-footer {
    padding-left: 16px;
    padding-right: 16px;
  }
}

.copilot-chat-wrap {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.copilot-jump-btn {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%) translateY(8px);
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 100px;
  border: 1px solid var(--border);
  background: var(--surface-elev);
  box-shadow: var(--shadow-md, 0 8px 24px rgba(0, 0, 0, 0.18));
  color: var(--text-strong);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  z-index: 10;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease, transform 0.22s ease;
}

.copilot-jump-btn.visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}

.copilot-jump-btn svg {
  width: 14px;
  height: 14px;
}

.copilot-load-earlier {
  align-self: center;
  padding: 8px 16px;
  margin-bottom: 12px;
  border-radius: 100px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-dim);
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.copilot-load-earlier:hover {
  border-color: var(--accent-strong);
  background: var(--accent-soft);
}

/* Message enter animation */
.copilot-msg-enter {
  animation: copilotMsgEnter 0.42s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.copilot-msg-row.assistant.copilot-msg-enter {
  animation-name: copilotAssistantEnter;
}

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

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

/* Progressive markdown blocks */
.copilot-md-block {
  animation: copilotBlockReveal 0.38s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.copilot-streaming .copilot-md-block {
  animation: none;
}

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

.copilot-md-li {
  animation: copilotLiReveal 0.32s ease both;
}

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

.copilot-md-row {
  animation: copilotRowReveal 0.35s ease both;
}

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

.copilot-exec-heading {
  padding-bottom: 6px;
  border-bottom: 1px solid color-mix(in oklab, var(--accent) 25%, var(--border));
  margin-bottom: 0.6em !important;
}

.copilot-md-table-wrap {
  overflow-x: auto;
}

.copilot-md-table {
  width: 100%;
  border-collapse: collapse;
}

/* Thinking phase — emerald executive signal */
.copilot-thinking {
  align-self: flex-start;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  border-radius: var(--radius);
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.08), var(--surface-2));
  border: 1px solid rgba(16, 185, 129, 0.22);
  animation: copilotMsgEnter 0.35s ease both;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.copilot-thinking-out {
  opacity: 0;
  transform: translateY(-4px);
}

.copilot-thinking-pulse {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #10B981;
  box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.22);
  animation: copilotThinkPulse 1.4s ease-in-out infinite;
  flex-shrink: 0;
}

@keyframes copilotThinkPulse {
  0%, 100% { transform: scale(0.85); opacity: 0.55; box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.16); }
  50% { transform: scale(1.15); opacity: 1; box-shadow: 0 0 0 7px rgba(16, 185, 129, 0.08); }
}

.copilot-thinking-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.65px;
  color: #059669;
  margin-bottom: 2px;
}

.copilot-thinking-text {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-dim);
  transition: opacity 0.2s ease;
}

.copilot-thinking-fade {
  opacity: 0;
}

/* Enhanced source cards */
.copilot-ref-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.copilot-ref-confidence {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 100px;
  background: var(--success-soft);
  color: var(--success);
}

.copilot-compose-hint kbd {
  font-family: inherit;
  font-size: 10px;
  padding: 1px 5px;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-mute);
}

/* Responsive */
@media (max-width: 900px) {
  .copilot-page-body,
  #copilot-standalone-root,
  .copilot-shell-premium,
  .copilot-layout-premium,
  .copilot-main,
  .copilot-panel-premium {
    min-height: 0;
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

  .copilot-shell-premium .copilot-panel-premium {
    position: relative;
    height: 100%;
  }

  .copilot-shell-premium .copilot-chat-wrap {
    flex: 1;
    min-height: 0;
    overflow: hidden;
    padding-bottom: calc(92px + env(safe-area-inset-bottom, 0px));
  }

  .copilot-shell-premium .copilot-panel-premium:has(.copilot-prompts:not(.is-hidden):not([hidden])) .copilot-chat-wrap {
    padding-bottom: calc(148px + env(safe-area-inset-bottom, 0px));
  }

  .copilot-shell-premium .copilot-chat-log {
    max-height: none !important;
    min-height: 0 !important;
    flex: 1;
    padding: 16px 14px 24px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
  }

  /* Fixed input dock — always visible above mobile browser chrome */
  .copilot-shell-premium .copilot-panel-premium > .copilot-compose,
  .copilot-shell-premium .copilot-panel-premium > .copilot-compose-premium {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 50;
    margin: 0;
    padding: 10px 12px calc(10px + env(safe-area-inset-bottom, 0px));
    background: color-mix(in oklab, var(--copilot-surface-strong) 94%, transparent);
    backdrop-filter: blur(22px) saturate(1.5);
    -webkit-backdrop-filter: blur(22px) saturate(1.5);
    border-top: 1px solid var(--copilot-border);
    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.18);
  }

  .copilot-shell-premium .copilot-panel-premium > .copilot-prompts:not(.is-hidden):not([hidden]) {
    position: fixed;
    left: 0;
    right: 0;
    bottom: calc(72px + env(safe-area-inset-bottom, 0px));
    z-index: 49;
    margin: 0;
    padding: 8px 12px 6px;
    background: color-mix(in oklab, var(--copilot-surface-strong) 90%, transparent);
    backdrop-filter: blur(18px) saturate(1.4);
    -webkit-backdrop-filter: blur(18px) saturate(1.4);
    border-top: 1px solid var(--copilot-border);
    max-height: 96px;
    overflow-y: auto;
  }

  .copilot-shell-premium .copilot-compose-premium .copilot-compose-inner {
    min-height: 48px;
    padding: 10px 14px;
    border-radius: 14px;
  }

  .copilot-shell-premium .copilot-compose-premium textarea {
    font-size: 16px;
    line-height: 1.45;
    min-height: 24px;
    max-height: 120px;
  }

  .copilot-shell-premium .copilot-send-btn {
    width: 46px;
    height: 46px;
    border-radius: 13px;
    background: linear-gradient(180deg, #FB923C 0%, #F97316 55%, #EA580C 100%);
    color: #FFFFFF;
    box-shadow: 0 6px 20px -6px rgba(249, 115, 22, 0.45);
  }

  .copilot-jump-btn {
    bottom: calc(104px + env(safe-area-inset-bottom, 0px));
    z-index: 48;
  }

  .copilot-shell-premium .copilot-panel-premium:has(.copilot-prompts:not(.is-hidden):not([hidden])) .copilot-jump-btn {
    bottom: calc(160px + env(safe-area-inset-bottom, 0px));
  }

  .copilot-shell-premium .copilot-empty {
    min-height: auto;
    justify-content: flex-start;
    padding-top: 4px;
  }

  .copilot-shell-premium .copilot-empty-icon {
    margin-bottom: 12px;
  }

  .copilot-shell-premium .copilot-empty-title {
    font-size: 22px;
  }

  .copilot-shell-premium .copilot-empty-sub {
    font-size: 13.5px;
    margin-bottom: 18px;
  }

  .copilot-empty-card-remove {
    opacity: 1;
    transform: none;
  }

  .copilot-chrome {
    padding: 10px 12px;
    gap: 8px;
  }

  .copilot-chrome-left,
  .copilot-chrome-actions {
    gap: 6px;
  }

  .copilot-chrome-btn {
    min-width: 36px;
    min-height: 36px;
    padding: 8px;
  }

  .copilot-chrome-btn--icon {
    width: 36px;
    height: 36px;
  }

  .copilot-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 210;
    max-height: none;
    width: min(300px, 88vw);
    transform: translateX(-100%);
    transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1);
    box-shadow: var(--shadow-md, 0 12px 40px rgba(0, 0, 0, 0.25));
  }

  .copilot-sidebar.open {
    transform: translateX(0);
  }

  .copilot-sidebar-overlay {
    display: block;
  }

  .copilot-sidebar-toggle,
  .copilot-sidebar-toggle-desktop {
    display: flex;
  }

  .copilot-sidebar-close {
    display: flex;
  }

  .copilot-layout .copilot-sidebar {
    border-right: none;
  }

  .copilot-chrome-center {
    display: none;
  }

  .copilot-chrome {
    padding: 12px 14px;
    flex-wrap: wrap;
  }

  .copilot-chrome-left .copilot-pro-pill {
    display: none;
  }

  .copilot-chrome-btn:not(.copilot-chrome-btn--icon):not(.copilot-chrome-exit) {
    padding: 9px 10px;
    font-size: 0;
    gap: 0;
  }

  .copilot-chrome-btn:not(.copilot-chrome-btn--icon):not(.copilot-chrome-exit) svg {
    margin: 0;
  }

  .copilot-chrome-exit span,
  .copilot-chrome-exit {
    font-size: 0;
  }

  .copilot-chrome-exit svg {
    margin: 0;
  }
}

@media (max-width: 640px) {
  .copilot-hero {
    padding: 16px 18px;
  }

  .copilot-hero h2 {
    font-size: 19px;
  }

  .copilot-panel {
    min-height: 0;
  }

  .copilot-shell-premium .copilot-chat-log {
    padding: 12px 12px 16px;
    max-height: none !important;
  }

  .copilot-shell-premium .copilot-empty-grid {
    grid-template-columns: 1fr;
    gap: 8px;
    margin-bottom: 12px;
  }

  .copilot-compose-premium {
    padding: 10px 12px calc(10px + env(safe-area-inset-bottom, 0px));
  }

  .copilot-compose-premium .copilot-compose-hint {
    display: none;
  }

  /* Embedded dashboard copilot — fixed dock when not premium shell */
  .copilot-panel:not(.copilot-panel-premium) > .copilot-compose {
    position: sticky;
    bottom: 0;
    z-index: 20;
    background: var(--surface-elev);
    border-top: 1px solid var(--border);
    box-shadow: 0 -8px 24px rgba(15, 23, 42, 0.08);
  }

  .copilot-panel:not(.copilot-panel-premium) .copilot-chat-wrap {
    padding-bottom: 8px;
  }

  .copilot-chrome-brand-text {
    display: none;
  }

  .copilot-chat-log {
    padding: 16px 14px;
    max-height: none;
    min-height: 0;
    flex: 1;
  }

  .copilot-msg-row {
    max-width: 96%;
  }

  .copilot-empty-grid {
    grid-template-columns: 1fr;
  }

  .copilot-refs-grid {
    grid-template-columns: 1fr;
  }

  .copilot-msg-actions {
    opacity: 1;
  }

  .copilot-compose {
    padding: 12px 14px 16px;
    gap: 8px;
  }

  .copilot-send-btn {
    width: 48px;
    height: 48px;
  }

  .copilot-prompts {
    padding: 0 12px 8px;
  }

  .copilot-prompt-chip {
    max-width: 100%;
  }

  .copilot-prompt-btn {
    font-size: 12px;
    padding: 8px 10px;
  }

  .copilot-prompts-dismiss {
    width: 32px;
    height: 32px;
  }

  .copilot-prompt-btn {
    padding: 9px 14px;
    font-size: 12px;
  }

  .copilot-followup-chip {
    padding: 9px 14px;
    font-size: 12px;
  }

  .copilot-action-btn {
    width: 40px;
    height: 40px;
  }

  .copilot-ref-card {
    padding: 12px 14px;
  }
}
