/* Soft paper world-class consistency layer — loaded after styles.css */

:root {
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 20px;
  --shadow-soft: 0 10px 28px rgba(28, 27, 25, 0.08);
}

* {
  font-family: Outfit, system-ui, -apple-system, sans-serif;
}

.bubble-text,
.bubble-md,
.bubble-md p,
.bubble-md li {
  font-family: "Source Serif 4", Georgia, "Times New Roman", serif;
}

/* Focus system */
.primary-btn:focus-visible,
.ghost-btn:focus-visible,
.tab:focus-visible,
.icon-btn:focus-visible,
.account-menu-item:focus-visible,
.google-btn:focus-visible,
.starter-chip:focus-visible,
.settings-grid select:focus-visible,
.search-submit:focus-visible,
.notebook-dropzone:focus-within {
  outline: none;
  box-shadow: var(--glass-focus);
}

/* Auth: brand-first product screen */
body:has(#authCard:not(.hidden)):not(:has(#appCard:not(.hidden))) .bg-glow {
  opacity: 0.08;
  animation: none;
}

.auth-shell {
  width: min(100%, 420px);
  margin: min(14vh, 110px) auto 48px;
}

.auth-shell .brand-title {
  font-size: 1.7rem;
  letter-spacing: -0.04em;
}

.auth-shell .brand-kicker {
  margin-top: 2px;
}

.auth-signin-title {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: -0.02em;
}

.auth-shell .app-tagline {
  font-size: 15px;
  color: var(--muted);
}

.google-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  max-width: 360px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(28, 27, 25, 0.12);
  background: #ffffff;
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: var(--shadow-soft);
  transition: background var(--motion-fast), border-color var(--motion-fast), transform var(--motion-fast);
}

.google-btn:hover {
  background: #fbfaf7;
  border-color: rgba(28, 27, 25, 0.18);
  transform: translateY(-1px);
}

.google-btn-icon {
  flex: 0 0 auto;
}

/* Logged-in: quieter brand chrome */
#appCard .brand-kicker {
  display: none;
}

#appCard .app-head {
  gap: 8px;
  margin-bottom: 0;
}

#appCard .brand-title {
  font-size: 1.15rem;
}

/* Account menu — sit above tabs so Logout/Settings stay clickable */
#appCard .app-head,
#appCard .app-head-top {
  overflow: visible;
  position: relative;
  z-index: 50;
}

.account-menu {
  position: relative;
  z-index: 60;
}

.icon-btn {
  min-width: 40px;
  min-height: 40px;
  padding: 0 10px;
  border-radius: 999px;
  letter-spacing: 0.08em;
  font-weight: 700;
}

.account-menu-panel {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 168px;
  padding: 6px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: #ffffff;
  box-shadow: var(--shadow-soft);
  z-index: 70;
  display: grid;
  gap: 2px;
}

.account-menu-panel.hidden {
  display: none !important;
}

.account-menu-item {
  border: none;
  background: transparent;
  color: var(--text);
  text-align: left;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.account-menu-item:hover {
  background: var(--bg2);
}

/* Segmented tabs — same on all breakpoints */
.tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  margin: 10px 0 14px;
  padding: 4px;
  border-radius: var(--radius-md);
  background: var(--bg2);
  border: 1px solid rgba(28, 27, 25, 0.08);
  box-shadow: none;
}

.tab,
.ghost-btn.tab {
  border: none;
  background: transparent;
  box-shadow: none;
  border-radius: 12px;
  min-height: 40px;
  font-weight: 600;
  color: var(--muted);
}

.tab:hover {
  background: rgba(28, 27, 25, 0.04);
  border-color: transparent;
  color: var(--text);
}

.tab.active {
  background: #ffffff;
  color: var(--text);
  border: none;
  box-shadow: 0 1px 2px rgba(28, 27, 25, 0.06), 0 4px 12px rgba(28, 27, 25, 0.06);
  font-weight: 700;
}

/* Ask hero craft */
.search-title {
  background: none;
  -webkit-text-fill-color: var(--text);
  color: var(--text);
  font-weight: 700;
  font-size: 1.5rem;
  letter-spacing: -0.03em;
}

.search-bar,
.search-bar:not(.compact) {
  border-radius: var(--radius-lg) !important;
  border: 1px solid rgba(28, 27, 25, 0.12);
  background: #ffffff;
  box-shadow: var(--shadow-soft) !important;
}

.search-bar--branded {
  border: 1px solid rgba(28, 27, 25, 0.12) !important;
  background: #ffffff !important;
  box-shadow: var(--shadow-soft) !important;
}

.search-bar--branded:focus-within,
.search-bar:focus-within {
  border-color: rgba(47, 111, 237, 0.45) !important;
  box-shadow: var(--glass-focus), var(--shadow-soft) !important;
}

.search-bar--branded.search-bar--code {
  background: #ffffff !important;
  box-shadow: var(--shadow-soft) !important;
}

.search-submit {
  border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
}

.starter-chip {
  border-radius: 12px;
  border: 1px solid rgba(28, 27, 25, 0.12);
  background: var(--bg2);
  box-shadow: none;
  color: var(--text);
}

.starter-chip:hover {
  background: rgba(47, 111, 237, 0.08);
  border-color: rgba(47, 111, 237, 0.28);
  transform: none;
  box-shadow: none;
}

.status-line.is-busy {
  color: var(--muted);
}

.assistant-feedback-label,
.assistant-feedback-status {
  color: var(--muted);
}

.msg.user .bubble-label {
  color: rgba(28, 27, 25, 0.55);
}

.msg.user .bubble {
  background: rgba(47, 111, 237, 0.1);
  border-color: rgba(47, 111, 237, 0.18);
  box-shadow: none;
}

.msg.assistant .bubble {
  animation: glass-rise var(--motion-med) both;
}

/* Desktop reading surface fills the shell */
#appCard.card {
  display: flex;
  flex-direction: column;
}

#appCard .panel:not(.hidden) {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

#appCard #panelChat:not(.hidden),
#appCard #panelCode:not(.hidden) {
  overflow: hidden;
}

#appCard .answer-shell {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

#appCard .answer-shell .chat-thread.perplexity-thread,
#appCard .chat-thread.perplexity-thread {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  border: none;
  background: transparent;
  box-shadow: none;
}

.chat-thread,
.perplexity-thread {
  max-height: none;
}

.followup-bar {
  background: linear-gradient(180deg, transparent, rgba(247, 246, 243, 0.92) 35%, var(--bg) 100%);
}

/* Notebook dropzone */
.notebook-panel {
  gap: 14px;
}

.notebook-empty {
  display: grid;
  gap: 14px;
}

.notebook-dropzone {
  position: relative;
  display: grid;
  place-items: center;
  gap: 6px;
  min-height: 180px;
  padding: 28px 20px;
  border-radius: var(--radius-lg);
  border: 1.5px dashed rgba(28, 27, 25, 0.18);
  background: #ffffff;
  text-align: center;
  cursor: pointer;
  transition: border-color var(--motion-fast), background var(--motion-fast), box-shadow var(--motion-fast);
}

/* Keep the file input actionable inside the label (clip-based .sr-only can break pickers). */
.notebook-dropzone #docFileInput {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
  font-size: 0;
}

.notebook-dropzone:hover,
.notebook-dropzone.is-dragover {
  border-color: rgba(47, 111, 237, 0.45);
  background: rgba(47, 111, 237, 0.04);
  box-shadow: var(--shadow-soft);
}

.notebook-dropzone-title {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
}

.notebook-dropzone-sub {
  max-width: 28rem;
  font-size: 13px;
  line-height: 1.45;
}

.notebook-selected-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  min-height: 44px;
}

.notebook-selected-row .primary-btn:disabled,
.notebook-selected-row .primary-btn[aria-disabled="true"] {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
}

/* Prefer disabled over hidden so Analyze stays discoverable */
.notebook-selected-row .primary-btn.hidden {
  display: inline-flex !important;
}

#panelNotebook .chat-thread.notebook-thread {
  flex: 1 1 auto;
  min-height: 200px;
  max-height: none;
}

/* Slim promo bars */
.beta-banner,
.pwa-install-bar {
  box-shadow: none;
}

.pwa-install-bar {
  padding: 10px 12px;
}

/* Mobile: keep assistant flat */
@media (max-width: 640px) {
  .tabs {
    margin: 8px 0 12px;
  }

  .search-title {
    font-size: 1.3rem;
  }

  .msg.assistant .bubble {
    padding: 2px 0 8px;
    border-radius: 0;
    background: transparent;
    border: none;
    box-shadow: none;
  }

  .search-bar:not(.compact),
  .search-bar--branded {
    border-radius: var(--radius-lg) !important;
  }
}
