:root {
  --bg: #0b0c10;
  --surface: #111218;
  --surface-muted: #161823;
  --surface-2: #0f1016;
  --border: rgba(250, 250, 250, 0.08);
  --border-strong: rgba(250, 250, 250, 0.14);
  --text: #eaeaf0;
  --text-muted: rgba(234, 234, 240, 0.72);
  --text-soft: rgba(234, 234, 240, 0.55);
  --accent: #eaeaf0;
  --accent-contrast: #0b0c10;
  --accent-2: #7c3aed;
  --error-bg: rgba(127, 29, 29, 0.35);
  --error-border: rgba(248, 113, 113, 0.22);
  --error-text: #fecaca;
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35);
  --radius: 12px;
  --radius-sm: 8px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --topbar-h: 56px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b0c10;
  }
}

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

html {
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  height: 100%;
  overflow: hidden;
}

body {
  margin: 0;
  height: 100%;
  overflow: hidden;
}

/* Global dark scrollbars (WebKit + Firefox). */
* {
  scrollbar-width: thin;
  scrollbar-color: rgba(234, 234, 240, 0.28) rgba(17, 18, 24, 0.55);
}

*::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

*::-webkit-scrollbar-track {
  background: rgba(17, 18, 24, 0.55);
  border-radius: 999px;
}

*::-webkit-scrollbar-thumb {
  background: rgba(234, 234, 240, 0.26);
  border-radius: 999px;
  border: 2px solid rgba(17, 18, 24, 0.55);
}

*::-webkit-scrollbar-thumb:hover {
  background: rgba(234, 234, 240, 0.34);
}

.app-shell {
  height: 100vh;
}

.topbar {
  position: fixed;
  inset: 0 0 auto 0;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0 1rem;
  background: rgba(15, 16, 22, 0.75);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(10px);
  z-index: 30;
}

.topbar__left,
.topbar__right {
  display: flex;
  align-items: center;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  user-select: none;
}

.brand__mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 9px;
  border: 1px solid var(--border-strong);
  background: linear-gradient(180deg, rgba(124, 58, 237, 0.28), rgba(124, 58, 237, 0.06));
  box-shadow: var(--shadow-sm);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.dev-tier-switcher {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin-right: 0.65rem;
}

.dev-user-label {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-right: 0.35rem;
}

.user-auth-row {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  margin-right: 0.35rem;
}

.user-email-display {
  font-size: 0.8rem;
  color: var(--text-muted);
  max-width: 14rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.link-sign-out {
  font: inherit;
  font-size: 0.8rem;
  color: var(--text-soft);
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  text-decoration: underline;
}

.auth-gate {
  position: fixed;
  inset: var(--topbar-h) 0 0 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  z-index: 10;
}

.auth-gate__title {
  font-size: 1.15rem;
  font-weight: 500;
  color: var(--text-muted);
  margin: 0;
}

.brand__name {
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
}

.workspace {
  margin-top: var(--topbar-h);
  height: calc(100vh - var(--topbar-h));
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr) 385px;
  gap: 0.75rem;
  padding-left: 0.75rem;
  padding-right: 0.75rem;
  padding-bottom: 0.75rem;
}

.panel-shell {
  height: calc(100vh - var(--topbar-h) - 0.75rem);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(17, 18, 24, 0.92), rgba(15, 16, 22, 0.92));
  box-shadow: var(--shadow);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.panel-shell__head {
  padding: 0.85rem 0.9rem;
  border-bottom: 1px solid var(--border);
  background: rgba(22, 24, 35, 0.55);
}

.panel-shell__head--center {
  min-height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.65rem 0.9rem;
}

.panel-shell__title {
  margin: 0;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.panel-shell__body {
  padding: 0.9rem;
  min-height: 0;
  overflow: hidden;
}

.panel-shell--left .panel-shell__body {
  overflow-y: auto;
  flex: 1 1 auto;
}

.panel-shell__body--workspace {
  padding: 1rem;
}

/* Center workspace: never scroll as a whole; only timeline scrolls. */
.panel-shell--center .panel-shell__body--workspace {
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.flow-root {
  flex: 0 0 auto;
  min-height: 0;
}

.timeline-section {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.timeline-scroll {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
}

.panel-shell__body--rightbar {
  padding: 1rem;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.timeline-section--rightbar {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  margin-top: 0;
}

.timeline-scroll--rightbar {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
}

.chat-composer {
  margin-top: 0.85rem;
  flex: 0 0 auto;
  width: 100%;
}

.chat-box {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  padding: 0.65rem;
  background: rgba(17, 18, 24, 0.55);
  border: 1px solid rgba(234, 234, 240, 0.12);
  border-radius: 14px;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.18), 0 12px 30px rgba(0, 0, 0, 0.24);
}

.chat-box:focus-within {
  border-color: rgba(234, 234, 240, 0.22);
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.22), 0 12px 30px rgba(0, 0, 0, 0.24);
}

.chat-composer__input {
  flex: 0 0 auto;
  min-height: 0;
}

.chat-composer__actions {
  flex: 0 0 auto;
  min-height: 48px;
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  padding-top: 0.15rem;
}

.chat-composer__textarea {
  width: 100%;
  height: auto;
  min-height: 3.25rem;
  max-height: 240px;
  padding: 0.25rem 0.2rem;
  font-family: inherit;
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--text);
  background: transparent;
  border: none;
  border-radius: 0;
  box-shadow: none;
  resize: none;
  outline: none;
  overflow-y: hidden;
}

.chat-composer__textarea::placeholder {
  color: rgba(234, 234, 240, 0.5);
}

.chat-composer__send {
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(124, 58, 237, 0.92);
  color: #ffffff;
  cursor: pointer;
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.35);
}

.chat-composer__send:hover:not(:disabled) {
  filter: brightness(1.05);
}

.chat-composer__send:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  filter: saturate(0.65);
}

.panel-shell__placeholder {
  margin: 0;
  padding: 0.75rem;
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  background: rgba(17, 18, 24, 0.45);
  color: var(--text-soft);
  font-size: 0.8125rem;
}

.panel-shell__placeholder--muted {
  margin-bottom: 0.9rem;
  opacity: 0.9;
}

.btn--new-session {
  margin-bottom: 0.85rem;
  text-align: left;
  justify-content: flex-start;
  gap: 0.5rem;
  font-weight: 600;
}

.session-card {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.8rem;
  border: 1px solid transparent;
  margin-bottom: 0.35rem;
  background: var(--surface-2, rgba(255, 255, 255, 0.04));
}

.session-card:hover {
  border-color: var(--border, rgba(255, 255, 255, 0.1));
}

.session-card--active {
  border-color: var(--accent, #7c6af7);
}

.session-card__info {
  flex: 1;
  min-width: 0;
}

.session-card__name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 500;
}

.session-card__date {
  opacity: 0.5;
  margin-top: 0.15rem;
}

.session-card__delete {
  opacity: 0.4;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0 0.25rem;
  font-size: 1rem;
  color: inherit;
  flex-shrink: 0;
}

.session-card__delete:hover {
  opacity: 1;
  color: #f87171;
}

.sessions {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.session-item {
  display: grid;
  gap: 0.1rem;
  padding: 0.65rem 0.7rem;
  border-radius: 10px;
  border: 1px solid transparent;
  text-decoration: none;
  color: inherit;
  background: rgba(17, 18, 24, 0.35);
}

.session-item:hover {
  background: rgba(22, 24, 35, 0.55);
  border-color: rgba(234, 234, 240, 0.1);
}

.session-item--active {
  background: rgba(124, 58, 237, 0.16);
  border-color: rgba(124, 58, 237, 0.25);
}

.session-item__title {
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.session-item__meta {
  font-size: 0.75rem;
  color: var(--text-soft);
}

.hidden {
  display: none !important;
}

.fade-in {
  animation: fade-in 0.35s ease;
}

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

.error-banner {
  width: 100%;
  max-width: 60rem;
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--error-border);
  border-radius: var(--radius-sm);
  background: var(--error-bg);
  color: var(--error-text);
  font-size: 0.875rem;
}

.card {
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  padding: 1.15rem 1.25rem;
}

.card--center {
  text-align: center;
  padding: 1.5rem;
  background: var(--surface-muted);
}

.card__title {
  margin: 0;
  font-size: 0.875rem;
  font-weight: 600;
}

.done-text {
  margin: 0;
  font-size: 0.875rem;
  font-weight: 500;
}

.flow-root > * + * {
  margin-top: 1.75rem;
}

.upload-flow > * + * {
  margin-top: 1rem;
}

.drop-zone {
  cursor: pointer;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  padding: 3.25rem 1.5rem;
  text-align: center;
}

.drop-zone:hover {
  border-color: var(--text-soft);
  background: var(--surface-muted);
}

.drop-zone--active {
  border-color: var(--text-muted);
  background: var(--surface-muted);
}

.drop-zone__title {
  margin: 0;
  font-size: 0.875rem;
  font-weight: 500;
}

.drop-zone__hint {
  margin: 0.35rem 0 0;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.drop-zone--workspace {
  max-width: 46rem;
  margin: 0 auto;
  padding: 4rem 1.75rem;
  background: radial-gradient(1200px 500px at 50% 0%, rgba(124, 58, 237, 0.22), transparent 55%),
    linear-gradient(180deg, rgba(22, 24, 35, 0.8), rgba(17, 18, 24, 0.8));
  border-color: rgba(234, 234, 240, 0.18);
}

.flow-root {
  max-width: 56rem;
  margin: 0 auto;
}

.drop-zone__actions {
  margin-top: 1.15rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.85rem;
  flex-wrap: wrap;
}

.drop-zone__meta {
  font-size: 0.75rem;
  color: var(--text-soft);
}

.sheet-picker-label {
  margin: 0;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.sheet-picker-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-top: 0.75rem;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.panel {
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.panel--loading {
  padding: 3.5rem 1.5rem;
  text-align: center;
}

.panel--status {
  padding: 2rem 1.5rem;
  text-align: center;
}

.muted {
  margin: 0;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.processing-message {
  margin: 0;
  min-height: 1.5rem;
  font-size: 0.875rem;
  font-weight: 500;
}

.table-wrap {
  overflow: hidden;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  margin-bottom: 1rem;
}

.table-host {
  max-height: min(380px, 50vh);
  overflow: auto;
}

.table-host--iteration {
  max-height: min(420px, 52vh);
}

.iteration-preview-stack {
  width: 100%;
  flex: 0 0 auto;
}

.iteration-preview-block {
  margin-top: 0.25rem;
}

.table-wrap--excel {
  margin-bottom: 0;
  background: #ffffff;
  border-color: rgba(0, 0, 0, 0.12);
}

.btn-download-version {
  margin-top: 1.125rem;
  align-self: flex-start;
  text-decoration: none;
}

.output-block {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  flex: 0 1 auto;
  width: 100%;
}

.output-workspace-transition {
  transition: opacity 150ms ease, transform 150ms ease;
}

.output-workspace-transition.is-transitioning {
  opacity: 0;
  transform: translateY(4px);
}

.excel-preview {
  border-collapse: collapse;
  width: max-content;
  min-width: 100%;
  font-size: 0.8125rem;
  background: #ffffff;
  color: #111111;
}

.excel-preview th,
.excel-preview td {
  border: 1px solid #d0d0d0;
  padding: 0.35rem 0.55rem;
  vertical-align: middle;
}

.excel-preview__corner {
  width: 44px;
  min-width: 44px;
  max-width: 44px;
  padding: 0.25rem;
  background: #e8e8e8;
  color: #666666;
  font-size: 0.6875rem;
  font-weight: 500;
  text-align: center;
  border-left: none;
  position: sticky;
  left: 0;
  top: 0;
  z-index: 8;
  box-shadow: 1px 0 0 #d0d0d0;
}

.excel-preview__col-letter {
  background: #e8e8e8;
  color: #555555;
  font-size: 0.6875rem;
  font-weight: 500;
  text-align: center;
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 5;
  border-bottom: 1px solid #c6c6c6;
}

.excel-preview__col-name {
  background: #d4d4d4;
  color: #000000;
  font-size: 0.75rem;
  font-weight: 700;
  text-align: left;
  white-space: nowrap;
  position: sticky;
  top: 29px;
  z-index: 4;
  border-bottom: 1px solid #b8b8b8;
}

.excel-preview__rownum {
  width: 44px;
  min-width: 44px;
  max-width: 44px;
  box-sizing: border-box;
  background: #f2f2f2;
  color: #444444;
  font-size: 0.6875rem;
  font-weight: 500;
  text-align: center;
  border-left: none;
  position: sticky;
  left: 0;
  z-index: 3;
  box-shadow: 1px 0 0 #d0d0d0;
}

.excel-preview__cell {
  background: #ffffff;
  color: #000000;
  max-width: 14rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.data-table {
  width: 100%;
  min-width: 280px;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.75rem;
}

.data-table thead {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--surface-muted);
  border-bottom: 1px solid var(--border-strong);
}

.data-table th {
  padding: 0.65rem 0.75rem;
  font-size: 0.6875rem;
  font-weight: 600;
  white-space: nowrap;
}

.data-table td {
  padding: 0.5rem 0.75rem;
  max-width: 11rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
  border-bottom: 1px solid var(--border);
}

.data-table tbody tr:last-child td {
  border-bottom: none;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.65rem 1rem;
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  box-shadow: var(--shadow-sm);
}

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

.btn--primary {
  background: linear-gradient(180deg, rgba(234, 234, 240, 0.95), rgba(234, 234, 240, 0.86));
  color: var(--accent-contrast);
  border-color: rgba(234, 234, 240, 0.35);
}

.btn--secondary {
  background: rgba(17, 18, 24, 0.65);
  color: var(--text);
  border-color: var(--border);
}

.btn--secondary:hover:not(:disabled) {
  background: rgba(22, 24, 35, 0.75);
}

.btn--google {
  gap: 0.55rem;
  padding: 0.55rem 0.8rem;
  border-radius: 999px;
}

.btn--icon {
  gap: 0.55rem;
  justify-content: center;
}

.icon-btn {
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  border: 1px solid transparent;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  padding: 0;
}

.icon-btn__svg {
  display: block;
}

.icon-btn--accent {
  background: var(--accent-2);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.12);
}

.icon-btn--accent:hover:not(:disabled) {
  filter: brightness(1.05);
}

.icon-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  filter: saturate(0.6);
}

.is-processing #feedback-text,
.is-processing #btn-send {
  pointer-events: none;
}

.is-processing #feedback-text,
.is-processing #btn-send {
  opacity: 0.55;
  filter: saturate(0.7);
}

.btn__icon {
  flex: 0 0 auto;
}

.btn--sm {
  padding: 0.5rem 0.75rem;
  font-size: 0.8125rem;
}

.btn--block {
  width: 100%;
  padding: 0.9rem 1rem;
  font-weight: 600;
}

.output-block > * + * {
  margin-top: 1.25rem;
}

.iteration-badge-wrap {
  display: flex;
  justify-content: center;
}

.iteration-badge {
  display: inline-block;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--surface-muted);
  font-size: 0.75rem;
  font-weight: 500;
}

.summary-pre {
  margin: 0.75rem 0 0;
  max-height: none;
  overflow: visible;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: inherit;
  font-size: 0.875rem;
  line-height: 1.55;
  color: var(--text-muted);
}

.details-reasoning {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-muted);
  font-size: 0.875rem;
}

.details-reasoning__summary {
  cursor: pointer;
  padding: 0.65rem 1rem;
  font-weight: 500;
  color: var(--text-muted);
}

.details-reasoning__body {
  padding: 0 1rem 0.85rem;
  border-top: 1px solid var(--border);
  font-size: 0.75rem;
  color: var(--text-soft);
}

.details-label {
  margin: 0;
  font-weight: 500;
  color: var(--text-muted);
}

.details-label--spaced {
  margin-top: 0.75rem;
}

.details-text {
  margin: 0.25rem 0 0;
}

.btn-row {
  display: flex;
  gap: 0.85rem;
}

.btn-row .btn {
  flex: 1;
}

.feedback-panel {
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.feedback-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
  margin-bottom: 0.9rem;
}

.feedback-actions--primary {
  margin-top: 0.75rem;
  margin-bottom: 0;
}

.feedback-panel > * + * {
  margin-top: 0.75rem;
}

.feedback-textarea {
  display: block;
  width: 100%;
  padding: 0.65rem 0.75rem;
  font-family: inherit;
  font-size: 0.875rem;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  resize: vertical;
}

.feedback-textarea::placeholder {
  color: var(--text-soft);
}

.feedback-textarea:focus {
  outline: none;
  border-color: var(--text-soft);
  box-shadow: 0 0 0 3px rgba(113, 113, 122, 0.25);
}

.timeline-section {
  margin-top: 1rem;
}

.timeline-label {
  margin: 0 0 0.65rem;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-muted);
}

.timeline-scroll {
  position: relative;
  display: block;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0.25rem 12px 0.35rem 0;
  max-height: min(60vh, 760px);
}

.timeline-host {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding-left: 1.25rem;
}

.timeline-end {
  flex-shrink: 0;
  width: 1px;
  height: 1px;
}

.timeline-host::before {
  content: "";
  position: absolute;
  left: 0.55rem;
  top: 0.25rem;
  bottom: 0.25rem;
  width: 2px;
  border-radius: 999px;
  background: linear-gradient(
    180deg,
    rgba(124, 58, 237, 0.35),
    rgba(234, 234, 240, 0.06)
  );
}

.timeline-arrow {
  display: none;
}

.timeline-card {
  flex-shrink: 0;
  width: auto;
  padding: 1.25rem;
  border-radius: var(--radius);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  position: relative;
}

.timeline-card::before {
  content: "";
  position: absolute;
  left: -1.25rem;
  top: 1.1rem;
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: rgba(124, 58, 237, 0.65);
  border: 2px solid rgba(15, 16, 22, 0.95);
  box-shadow: 0 0 0 2px rgba(124, 58, 237, 0.18);
}

.timeline-card--latest {
  border-color: var(--text-muted);
  opacity: 1;
}

.timeline-card--active {
  background: rgba(124, 58, 237, 0.12);
  border-color: rgba(124, 58, 237, 0.25);
}

.timeline-card--active::before {
  background: rgba(124, 58, 237, 0.95);
}

.timeline-card--past {
  opacity: 0.78;
}

.timeline-card__badge {
  display: inline-block;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-muted);
  font-size: 0.625rem;
  font-weight: 500;
  color: var(--text-muted);
}

.timeline-card__summary {
  margin: 0.65rem 0 0;
  max-height: none;
  overflow: visible;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: inherit;
  font-size: 0.875rem;
  line-height: 1.6;
  color: var(--text-muted);
}

.timeline-card__feedback {
  margin: 0;
  padding: 0.65rem 0.85rem 0.65rem 1rem;
  border-left: 2px solid var(--accent-2);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  background: rgba(124, 58, 237, 0.07);
  font-size: 0.875rem;
  line-height: 1.6;
  color: var(--text-muted);
}

.timeline-card__feedback-label {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-soft);
}

.timeline-card__link {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  margin-top: 0.65rem;
  padding: 0.35rem 0.5rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(22, 24, 35, 0.5);
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
}

.timeline-card__link::before {
  content: "⤓";
  font-size: 0.85rem;
  color: var(--text-soft);
}

.timeline-card__details {
  margin-top: 0.65rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.625rem;
}

.timeline-card__details summary {
  cursor: pointer;
  padding: 0.45rem 0.5rem;
  font-weight: 500;
  color: var(--text-soft);
}

.timeline-card__details-body {
  padding: 0.4rem 0.5rem 0.55rem;
  border-top: 1px solid var(--border);
  color: var(--text-soft);
}

/* ── Ghost button ── */
.btn--ghost {
  background: transparent;
  color: var(--text-muted);
  border-color: transparent;
  box-shadow: none;
}

.btn--ghost:hover:not(:disabled) {
  background: rgba(234, 234, 240, 0.06);
  border-color: var(--border);
  color: var(--text);
}

/* ── Topbar settings button ── */
.topbar__settings {
  margin-right: 0.5rem;
  font-size: 0.8125rem;
  color: var(--text-muted);
}

/* ── Settings view ── */
.settings-view {
  position: fixed;
  inset: var(--topbar-h) 0 0 0;
  background: var(--bg);
  z-index: 20;
  overflow-y: auto;
}

.settings-shell {
  max-width: 640px;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
}

.settings-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 2rem;
}

.settings-title {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text);
}

.settings-section {
  margin-bottom: 2.5rem;
}

.settings-section__title {
  margin: 0 0 1rem;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

.settings-plan-card {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.25rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(17, 18, 24, 0.92), rgba(15, 16, 22, 0.92));
  margin-bottom: 1rem;
}

.settings-plan-card__info {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.settings-plan-badge {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  border: 1px solid rgba(124, 58, 237, 0.35);
  background: rgba(124, 58, 237, 0.12);
  font-size: 0.75rem;
  font-weight: 600;
  color: #c4b5fd;
  letter-spacing: 0.02em;
}

.settings-plan-desc {
  margin: 0;
  font-size: 0.8125rem;
  color: var(--text-soft);
  line-height: 1.5;
}

.settings-plan-actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  flex-shrink: 0;
}

.settings-usage {
  padding: 1rem 1.25rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-muted);
}

.settings-usage__label {
  margin: 0 0 0.6rem;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-muted);
}

.settings-usage__bar-wrap {
  height: 6px;
  border-radius: 999px;
  background: rgba(234, 234, 240, 0.08);
  overflow: hidden;
  margin-bottom: 0.5rem;
}

.settings-usage__bar {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(124, 58, 237, 0.85), rgba(124, 58, 237, 0.5));
  transition: width 0.4s ease;
}

.settings-usage__text {
  margin: 0;
  font-size: 0.75rem;
  color: var(--text-soft);
}

.settings-account-email {
  margin: 0 0 0.85rem;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.panel-shell__foot {
  flex: 0 0 auto;
  padding: 0.65rem 0.9rem;
  border-top: 1px solid var(--border);
}

.panel-shell__settings-btn {
  width: 100%;
  justify-content: flex-start;
  gap: 0.5rem;
  font-size: 0.8125rem;
  color: var(--text-muted);
  padding: 0.6rem 0.75rem;
}

.panel-shell__settings-btn:hover {
  color: var(--text);
  background: rgba(234, 234, 240, 0.06);
}

