/* ── Reset & Variables ──────────────────────────────────── */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg-void: #0a0a0c;
  --bg-surface: #141416;
  --bg-surface-strong: rgba(20, 20, 22, 0.96);
  --accent: #ffd700;
  --text-primary: #e8e8e8;
  --text-secondary: rgba(232, 232, 232, 0.68);
  --glow: rgba(255, 215, 0, 0.25);
  --success: #50c878;
  --danger: #ff6b6b;
  --rule: rgba(255, 255, 255, 0.06);
  --rule-strong: rgba(255, 255, 255, 0.1);
  --border-soft: rgba(255, 255, 255, 0.12);
  --shadow-soft: 0 20px 44px rgba(0, 0, 0, 0.34);
  --font-display:
    'SF Mono', 'Cascadia Code', 'Consolas', ui-monospace, monospace;
  --font-body:
    -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --font-sans: var(--font-body);
}

html,
body {
  height: 100%;
  width: 100%;
  background: var(--bg-void);
  color: var(--text-primary);
  font-family: var(--font-body);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  touch-action: manipulation;
}

button,
input,
textarea {
  font: inherit;
}
button {
  cursor: pointer;
}
[hidden] {
  display: none !important;
}

/* ── Presence Canvas (Living Background) ───────────────── */
.presence-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

/* ── App Shell ──────────────────────────────────────────── */
.app-shell {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  height: var(--app-height, 100dvh);
  max-width: 430px;
  margin: 0 auto;
  background: transparent;
}

@media (min-width: 500px) {
  .app-shell {
    border-left: 1px solid var(--rule-strong);
    border-right: 1px solid var(--rule-strong);
  }
}

/* ── Top Bar ────────────────────────────────────────────── */
.topbar-wrapper {
  position: relative;
  flex-shrink: 0;
  z-index: 10;
}

.topbar {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  padding-top: max(env(safe-area-inset-top), 12px);
  background: rgba(10, 10, 12, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--rule-strong);
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.08em;
  color: rgba(232, 232, 232, 0.5);
  overflow: hidden;
}
.topbar::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 60px;
  height: 1px;
  left: 0;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  animation: topbarScan 4s linear infinite;
  opacity: 0;
  transition: opacity 0.8s ease;
  will-change: transform;
}

body[data-presence-state='thinking'][data-connection-tone='success'] .topbar::after,
body[data-presence-state='recording'][data-connection-tone='success'] .topbar::after,
body[data-presence-state='thinking'][data-connection-tone='neutral'] .topbar::after,
body[data-presence-state='recording'][data-connection-tone='neutral'] .topbar::after {
  opacity: 1;
}

@keyframes topbarScan {
  0% { transform: translateX(-60px); }
  100% { transform: translateX(calc(100vw - 60px)); }
}

.topbar-brand {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--text-primary);
}

.topbar-status {
  display: flex;
  align-items: center;
  gap: 8px;
}

.topbar-indicator {
  width: 5px;
  height: 5px;
  background: var(--accent);
  border-radius: 50%;
  flex-shrink: 0;
  transition: background-color 0.18s ease;
}

.topbar-indicator[data-tone='success'] {
  background: var(--success);
  animation: statusBreathing 3s ease-in-out infinite;
  box-shadow: 0 0 6px rgba(80, 200, 120, 0.4);
}
@keyframes statusBreathing {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}

.topbar-indicator[data-tone='pending'] {
  background: rgba(255, 215, 0, 0.6);
}

.topbar-indicator[data-tone='error'] {
  background: var(--danger);
}

/* ── Status Line ───────────────────────────────────────────── */
.status-line {
  min-height: 0;
  max-height: 1.4rem;
  display: flex;
  align-items: center;
  padding: 0 16px;
  font-family: var(--font-display);
  font-size: 10px;
  font-weight: 400;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(232, 232, 232, 0.35);
  overflow: hidden;
  transition:
    max-height 0.22s ease,
    opacity 0.22s ease,
    transform 0.22s ease,
    margin 0.22s ease,
    color 0.18s ease;
  flex-shrink: 0;
}

.status-line[data-tone='success'],
.status-line[data-tone='live'] {
  color: var(--accent);
}

.status-line[data-tone='pending'],
.status-line[data-tone='warning'] {
  color: rgba(255, 215, 0, 0.6);
}

.status-line[data-tone='error'] {
  color: var(--danger);
}

.status-line[data-visible='false'] {
  max-height: 0;
  opacity: 0;
  transform: translateY(-0.16rem);
  margin: -0.05rem 0 0;
  pointer-events: none;
}

/* ── Connection Status Banner ──────────────────────────────── */
.connection-banner {
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-align: center;
  padding: 6px 16px;
  flex-shrink: 0;
  transform: translateY(-100%);
  max-height: 0;
  overflow: hidden;
  transition:
    transform 0.3s ease,
    max-height 0.3s ease,
    opacity 0.3s ease;
  opacity: 0;
}

.connection-banner.visible {
  transform: translateY(0);
  max-height: 32px;
  opacity: 1;
}

.connection-banner.connected {
  background: rgba(80, 200, 120, 0.1);
  color: #50c878;
  border-bottom: 1px solid rgba(80, 200, 120, 0.15);
}

.connection-banner.reconnecting {
  background: rgba(255, 215, 0, 0.08);
  color: var(--accent);
  border-bottom: 1px solid rgba(255, 215, 0, 0.1);
}

.connection-banner.offline {
  background: rgba(255, 80, 80, 0.08);
  color: #ff6b6b;
  border-bottom: 1px solid rgba(255, 80, 80, 0.1);
}

/* ── Update Banner ─────────────────────────────────────── */
.update-banner {
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-align: center;
  width: 100%;
  padding: 10px 16px;
  background: rgba(80, 200, 120, 0.1);
  color: #50c878;
  border: none;
  border-bottom: 1px solid rgba(80, 200, 120, 0.15);
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  transform: translateY(-100%);
  max-height: 0;
  transition:
    transform 0.3s ease,
    max-height 0.3s ease,
    opacity 0.3s ease;
  opacity: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
}

.update-banner.visible {
  transform: translateY(0);
  max-height: 48px;
  opacity: 1;
}

.update-banner:active {
  background: rgba(80, 200, 120, 0.18);
}

.update-banner:focus-visible {
  outline: 2px solid #50c878;
  outline-offset: -2px;
}

.update-banner-action {
  opacity: 0.7;
  font-size: 10px;
}

/* ── Connecting Overlay (soft loading state) ───────────── */
.connecting-overlay {
  position: fixed;
  inset: 0;
  z-index: 29;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.5);
}

.connecting-overlay-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.2rem;
}

.connecting-spinner {
  width: 28px;
  height: 28px;
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: connectingSpin 0.8s linear infinite;
}

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

.connecting-text {
  margin: 0;
  font-family: var(--font-display);
  font-size: 10px;
  font-weight: 400;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(232, 232, 232, 0.5);
}

/* ── Startup Recovery ───────────────────────────────────── */
.startup-recovery {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 24px 16px;
  background: rgba(0, 0, 0, 0.5);
}

.startup-recovery-panel {
  width: min(100%, 28rem);
  display: grid;
  gap: 14px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 1.5rem;
  padding: 20px 18px;
  background: #0b0b0d;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.34);
}

.startup-recovery-panel h2 {
  color: var(--text-primary);
  font-size: 1.05rem;
  line-height: 1.3;
}

.startup-recovery-copy,
.startup-recovery-meta {
  margin: 0;
  color: rgba(232, 232, 232, 0.5);
  line-height: 1.55;
}

.startup-recovery-meta {
  font-size: 0.88rem;
  color: rgba(255, 255, 255, 0.42);
}

.startup-recovery-actions {
  display: grid;
  gap: 10px;
}

@media (min-width: 560px) {
  .startup-recovery-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* ── History Panel ──────────────────────────────────────── */
.history-panel {
  flex: 1;
  overflow: hidden;
}

.history-list {
  overflow-y: auto;
  overflow-x: hidden;
  height: 100%;
  padding: 8px 0 16px 0;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
}

.history-list::-webkit-scrollbar {
  width: 2px;
}
.history-list::-webkit-scrollbar-track {
  background: transparent;
}
.history-list::-webkit-scrollbar-thumb {
  background: rgba(255, 215, 0, 0.15);
}

/* ── Messages ───────────────────────────────────────────── */
.message {
  padding: 14px 16px;
  border-bottom: 1px solid var(--rule);
  font-size: 14px;
  line-height: 1.55;
}

.message.visible {
  opacity: 1;
  transform: translateY(0);
}

.message--system {
  font-family: var(--font-display);
  font-size: 11px;
  color: rgba(232, 232, 232, 0.5);
  letter-spacing: 0.08em;
  padding: 10px 16px;
}

/* ── Worker Chips ─────────────────────────────────────────── */
.worker-chip {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  padding: 6px 14px;
  border-bottom: none;
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.06em;
}

.worker-chip-indicator {
  width: 6px;
  height: 6px;
  margin-top: 5px;
  border-radius: 50%;
  flex-shrink: 0;
  background: rgba(232, 232, 232, 0.3);
  transition:
    background-color 0.18s ease,
    box-shadow 0.18s ease;
}

.worker-chip-name {
  color: rgba(232, 232, 232, 0.7);
  text-transform: uppercase;
  font-weight: 600;
  flex: 1;
  min-width: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.worker-chip-status {
  color: rgba(232, 232, 232, 0.4);
}

.worker-chip-elapsed {
  color: rgba(232, 232, 232, 0.3);
  font-variant-numeric: tabular-nums;
  min-width: 2.5em;
}

/* Status: pending */
.worker-chip[data-worker-status='pending'] .worker-chip-indicator {
  background: rgba(232, 232, 232, 0.25);
}
.worker-chip[data-worker-status='pending'] .worker-chip-name {
  color: rgba(232, 232, 232, 0.4);
}

/* Status: running / started */
.worker-chip[data-worker-status='running'] .worker-chip-indicator,
.worker-chip[data-worker-status='started'] .worker-chip-indicator {
  background: var(--accent);
  box-shadow: 0 0 0 3px rgba(255, 215, 0, 0.15);
  animation: worker-pulse 1.8s ease-in-out infinite;
}
.worker-chip[data-worker-status='running'] .worker-chip-name,
.worker-chip[data-worker-status='started'] .worker-chip-name {
  color: rgba(255, 215, 0, 0.85);
}
.worker-chip[data-worker-status='running'] .worker-chip-status,
.worker-chip[data-worker-status='started'] .worker-chip-status {
  color: rgba(255, 215, 0, 0.5);
}

/* Status: completed */
.worker-chip[data-worker-status='completed'] .worker-chip-indicator {
  background: var(--success);
  box-shadow: 0 0 0 3px rgba(80, 200, 120, 0.12);
}
.worker-chip[data-worker-status='completed'] .worker-chip-name {
  color: rgba(80, 200, 120, 0.85);
}
.worker-chip[data-worker-status='completed'] .worker-chip-status {
  color: rgba(80, 200, 120, 0.5);
}

/* Status: failed */
.worker-chip[data-worker-status='failed'] .worker-chip-indicator {
  background: var(--danger);
  box-shadow: 0 0 0 3px rgba(255, 107, 107, 0.12);
}
.worker-chip[data-worker-status='failed'] .worker-chip-name {
  color: rgba(255, 107, 107, 0.75);
}
.worker-chip[data-worker-status='failed'] .worker-chip-status {
  color: rgba(255, 107, 107, 0.45);
}

/* Status: cancelled */
.worker-chip[data-worker-status='cancelled'] .worker-chip-indicator {
  background: rgba(232, 232, 232, 0.2);
}
.worker-chip[data-worker-status='cancelled'] .worker-chip-name {
  color: rgba(232, 232, 232, 0.35);
  text-decoration: line-through;
}
.worker-chip[data-worker-status='cancelled'] .worker-chip-status {
  color: rgba(232, 232, 232, 0.25);
}

@keyframes worker-pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

.message--error {
  color: rgba(255, 107, 107, 0.7);
}

.message--user {
  text-align: right;
}

.message--user .message-label {
  color: var(--accent);
}

.message--assistant {
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 400;
  letter-spacing: 0;
  line-height: 1.6;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.04);
}

.message--user {
  border-left: 3px solid rgba(255, 215, 0, 0.3);
}

.message-label {
  display: block;
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(232, 232, 232, 0.5);
  margin-bottom: 6px;
}

.message--user .message-label {
  text-align: right;
}

.message-body {
  white-space: pre-wrap;
  word-break: break-word;
}

.voice-indicator {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: var(--font-display);
  font-size: 10px;
  letter-spacing: 0.08em;
  color: rgba(255, 215, 0, 0.5);
  margin-left: 6px;
  vertical-align: middle;
}

.voice-indicator::before {
  content: '';
  width: 6px;
  height: 6px;
  border: 1px solid var(--accent);
  opacity: 0.5;
}

/* ── History Actions (inline card/message action buttons) ── */
.history-actions {
  display: flex;
  gap: 0.45rem;
  margin-top: 0.75rem;
  flex-wrap: wrap;
}

/* ── Timestamp Separator ───────────────────────────────────── */
.timestamp-separator {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px 4px;
}

.timestamp-separator::before,
.timestamp-separator::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--rule);
}

.timestamp-separator span {
  font-family: var(--font-display);
  font-size: 10px;
  font-weight: 400;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(232, 232, 232, 0.25);
  white-space: nowrap;
}

/* ── Timeline Card (mockup demo) ──────────────────────────── */
.card {
  margin: 10px 16px;
  padding: 0;
  background: rgba(30, 30, 34, 0.85);
  border: 1px solid var(--rule-strong);
  border-bottom: 1px solid var(--rule);
  clip-path: polygon(0 0, calc(100% - 14px) 0, 100% 14px, 100% 100%, 0 100%);
  opacity: 0;
  transform: translateY(-30px);
  will-change: transform, opacity;
}

.card.visible {
  opacity: 1;
  transform: translateY(0);
}

.card-event {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--rule);
  position: relative;
}

.card-event:last-child {
  border-bottom: none;
}

.card-event-time {
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 500;
  color: var(--accent);
  white-space: nowrap;
  min-width: 44px;
  position: relative;
  padding-left: 10px;
}

.card-event-time::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0.6;
}

.card-event-title {
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--text-primary);
}

.card-event-meta {
  font-family: var(--font-display);
  font-size: 10px;
  color: rgba(232, 232, 232, 0.25);
  margin-top: 2px;
}

/* ── Notification Card (Proactive Alerts) ─────────────────── */
.notif-card {
  margin: 10px 16px;
  background: rgba(30, 30, 34, 0.85);
  border: 1px solid var(--rule-strong);
  border-left: 2px solid var(--accent);
  overflow: hidden;
  opacity: 0;
  transform: translateY(-30px);
  will-change: transform, opacity;
}

.notif-card.visible {
  opacity: 1;
  transform: translateY(0);
}

.notif-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid var(--rule);
}

.notif-card-header-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.notif-card-icon {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
}

.notif-card-icon svg {
  width: 14px;
  height: 14px;
}

.notif-card-type {
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(232, 232, 232, 0.5);
}

.notif-card-time {
  font-family: var(--font-display);
  font-size: 10px;
  letter-spacing: 0.08em;
  color: rgba(232, 232, 232, 0.25);
}

.notif-card-body {
  padding: 12px 14px;
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-primary);
}

.notif-card-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px 14px 12px;
}

.notif-action {
  background: none;
  border: 1px solid var(--rule-strong);
  border-radius: 6px;
  padding: 9px 14px;
  min-height: 36px;
  font-family: var(--font-display);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(232, 232, 232, 0.5);
  cursor: pointer;
}

.notif-action:active {
  border-color: var(--accent);
  color: var(--accent);
}
.notif-action--primary {
  border-color: rgba(255, 215, 0, 0.3);
  color: var(--accent);
}

.notif-card.return-highlight {
  position: relative;
}

.notif-card.return-highlight::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--accent);
  animation: highlight-pulse 2s ease-out forwards;
}

.notif-card.return-highlight::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255, 215, 0, 0.04);
  animation: highlight-pulse 2s ease-out forwards;
  pointer-events: none;
}

@keyframes highlight-pulse {
  0% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}

/* ── Catch-Up Summary Card ──────────────────────────────── */
.catchup-card {
  margin: 10px 16px;
  background: rgba(30, 30, 34, 0.85);
  border: 1px solid rgba(255, 215, 0, 0.12);
  overflow: hidden;
  opacity: 0;
  transform: translateY(-30px);
  will-change: transform, opacity;
}

.catchup-card.visible {
  opacity: 1;
  transform: translateY(0);
}

.catchup-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid var(--rule);
  cursor: pointer;
  min-height: 44px;
}

.catchup-header-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.catchup-count {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(255, 215, 0, 0.12);
  color: var(--accent);
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.catchup-title {
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
}
.catchup-subtitle {
  font-family: var(--font-display);
  font-size: 10px;
  letter-spacing: 0.08em;
  color: rgba(232, 232, 232, 0.35);
  text-transform: uppercase;
}
.catchup-chevron {
  color: rgba(232, 232, 232, 0.25);
  transition: transform 0.2s;
  flex-shrink: 0;
}
.catchup-card.expanded .catchup-chevron {
  transform: rotate(180deg);
}
.catchup-items {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
}
.catchup-card.expanded .catchup-items {
  max-height: 400px;
}

.catchup-item {
  display: flex;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--rule);
  cursor: pointer;
  min-height: 44px;
}

.catchup-item:last-child {
  border-bottom: none;
}
.catchup-item:active {
  background: rgba(255, 255, 255, 0.02);
}

.catchup-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
  margin-top: 6px;
}
.catchup-dot.read {
  background: rgba(232, 232, 232, 0.15);
}

.catchup-item-text {
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-primary);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.catchup-item-meta {
  font-family: var(--font-display);
  font-size: 10px;
  letter-spacing: 0.08em;
  color: rgba(232, 232, 232, 0.25);
  margin-top: 2px;
}

/* "New since" temporal anchor banner */
.new-since-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 16px;
  background: rgba(255, 215, 0, 0.04);
  border-bottom: 1px solid rgba(255, 215, 0, 0.08);
}
.new-since-banner span {
  font-family: var(--font-display);
  font-size: 10px;
  font-weight: 400;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  opacity: 0.6;
  white-space: nowrap;
}
.new-since-banner::before,
.new-since-banner::after {
  content: '';
  flex: 1;
  height: 1px;
  background: rgba(255, 215, 0, 0.1);
}

/* ── Typing Indicator (Three-Dot Bounce) ───────────────── */
.typing-indicator {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--rule);
}
.typing-indicator-dots {
  display: flex;
  align-items: center;
  gap: 4px;
}
.typing-indicator-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0.4;
  animation: typingDotBounce 1.2s ease-in-out infinite;
}
.typing-indicator-dot:nth-child(2) {
  animation-delay: 0.15s;
}
.typing-indicator-dot:nth-child(3) {
  animation-delay: 0.3s;
}
@keyframes typingDotBounce {
  0%, 80%, 100% { opacity: 0.4; transform: translateY(0); }
  40% { opacity: 1; transform: translateY(-3px); }
}
.typing-indicator-tool {
  font-family: var(--font-display);
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(255, 215, 0, 0.5);
  min-height: 12px;
  max-width: calc(100vw - 48px);
  white-space: normal;
  word-break: break-word;
  line-height: 1.3;
}

/* ── Stop / Cancel Generation Button ─────────────────────── */
.stop-btn {
  display: none;
  margin: 0 auto 8px;
  padding: 8px 20px;
  border: 1px solid rgba(255, 80, 80, 0.4);
  border-radius: 20px;
  background: rgba(255, 80, 80, 0.08);
  color: #ff6b6b;
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  transition:
    opacity 0.2s ease,
    background 0.15s ease;
  min-height: 36px;
  min-width: 44px;
}

.stop-btn.visible {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  animation: fade-in 0.2s ease;
}

.stop-btn:active {
  background: rgba(255, 80, 80, 0.15);
  border-color: rgba(255, 80, 80, 0.6);
}

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

/* ── Empty State (Welcome Screen) ────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
  text-align: center;
  flex: 1;
  animation: emptyStateEntrance 0.8s ease both;
}
@keyframes emptyStateEntrance {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.empty-state-title {
  font-family: var(--font-body);
  font-size: 22px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 6px;
  position: relative;
}
.empty-state-title::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 200px;
  height: 200px;
  background: radial-gradient(circle, rgba(255, 215, 0, 0.06) 0%, transparent 70%);
  pointer-events: none;
  z-index: -1;
}
.empty-state-subtitle {
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(232, 232, 232, 0.35);
  margin-bottom: 32px;
}
.empty-state-prompts {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  max-width: 300px;
}

.empty-state-prompt {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--rule-strong);
  border-radius: 12px;
  padding: 14px 16px;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 400;
  text-align: left;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition:
    background 0.15s ease,
    border-color 0.15s ease;
}
.empty-state-prompt::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 215, 0, 0.04), transparent);
  animation: promptShimmer 6s ease-in-out infinite;
  animation-delay: var(--shimmer-delay, 0s);
}
.empty-state-prompt:nth-child(2)::after { --shimmer-delay: 2s; }
.empty-state-prompt:nth-child(3)::after { --shimmer-delay: 4s; }
@keyframes promptShimmer {
  0%, 100% { left: -100%; }
  50% { left: 100%; }
}
.empty-state-prompt:active {
  background: rgba(255, 215, 0, 0.06);
  border-color: rgba(255, 215, 0, 0.2);
}
.empty-state.hiding {
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

/* ── Regenerate Button ───────────────────────────────────── */
.regenerate-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin: 6px 16px 2px;
  padding: 6px 12px;
  background: none;
  border: 1px solid var(--rule);
  border-radius: 16px;
  color: rgba(232, 232, 232, 0.35);
  font-family: var(--font-display);
  font-size: 10px;
  font-weight: 400;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  transition:
    color 0.15s ease,
    border-color 0.15s ease;
}

.regenerate-btn:active {
  color: var(--accent);
  border-color: rgba(255, 215, 0, 0.2);
}
.regenerate-btn svg {
  width: 12px;
  height: 12px;
}

/* ── Control Panel (Footer) ─────────────────────────────── */
.control-panel {
  flex-shrink: 0;
  background: #0a0a0c;
  border-top: 1px solid var(--rule-strong);
  padding: 12px 16px;
  padding-bottom: max(env(safe-area-inset-bottom), 12px);
}

/* ── Prompt Suggestion (legacy single-pill) ───────────────── */
.prompt-suggestion-row {
  display: flex;
  padding: 0 0 8px 0;
}

.prompt-suggestion-button {
  max-width: 100%;
  border: 1px solid rgba(255, 215, 0, 0.16);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  color: rgba(255, 215, 0, 0.92);
  padding: 0.38rem 0.78rem;
  font-size: 0.74rem;
  font-weight: 600;
  line-height: 1.2;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition:
    border-color 0.18s ease,
    color 0.18s ease,
    background-color 0.18s ease;
}

.prompt-suggestion-button:hover,
.prompt-suggestion-button:focus-visible {
  border-color: rgba(255, 215, 0, 0.28);
  background: rgba(255, 215, 0, 0.08);
  color: var(--text-primary);
}

/* ── Suggestion Chips ────────────────────────────────────── */
.suggestions {
  display: flex;
  gap: 8px;
  padding: 0 0 10px 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  opacity: 0;
  transform: translateY(6px);
  transition:
    opacity 0.3s,
    transform 0.3s;
  pointer-events: none;
}

.suggestions::-webkit-scrollbar {
  display: none;
}
.suggestions.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.suggestion-chip {
  flex-shrink: 0;
  padding: 8px 14px;
  border: 1px solid var(--rule-strong);
  border-radius: 20px;
  background: transparent;
  color: rgba(232, 232, 232, 0.6);
  font-family: var(--font-body);
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
  transition:
    border-color 0.15s,
    color 0.15s,
    background 0.15s;
}

.suggestion-chip:active {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(255, 215, 0, 0.06);
}

/* ── Composer ───────────────────────────────────────────── */
.composer {
  position: relative;
  margin-bottom: 10px;
}

.composer-input {
  width: 100%;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--rule-strong);
  border-radius: 0;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 16px;
  padding: 10px 88px 10px 12px;
  outline: none;
  caret-color: var(--accent);
  transition: border-color 0.2s;
  resize: none;
  overflow-y: hidden;
  min-height: 42px;
  max-height: 160px;
  line-height: 1.4;
}

.composer-input::placeholder {
  color: rgba(232, 232, 232, 0.35);
  font-family: var(--font-display);
  font-size: 12px;
  letter-spacing: 0.08em;
}

.composer-input:focus {
  border-color: rgba(255, 215, 0, 0.3);
}

.composer-input-wrap {
  flex: 1;
  position: relative;
}

.composer-input-wrap::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  width: 0;
  height: 1px;
  background: var(--accent);
  transition:
    width 0.3s ease,
    left 0.3s ease;
}

.composer-input-wrap:focus-within::after {
  width: 100%;
  left: 0;
}

.composer-tool {
  position: absolute;
  top: 1px;
  bottom: 1px;
  width: 40px;
  background: transparent;
  border: none;
  border-left: 1px solid var(--rule);
  color: rgba(232, 232, 232, 0.46);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition:
    color 0.2s,
    background 0.15s,
    transform 0.1s ease;
}

.composer-tool:hover {
  color: var(--accent);
}

.composer-tool:active {
  color: var(--accent);
  background: rgba(255, 215, 0, 0.08);
  transform: scale(0.9);
}

.composer-tool svg {
  width: 17px;
  height: 17px;
}

.composer-camera {
  right: 45px;
}

.composer-send {
  position: absolute;
  right: 1px;
  top: 1px;
  bottom: 1px;
  width: 44px;
  background: transparent;
  border: none;
  border-left: 1px solid var(--rule);
  color: rgba(232, 232, 232, 0.5);
  font-family: var(--font-display);
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition:
    color 0.2s,
    background 0.15s;
}

.composer-send:hover {
  color: var(--accent);
}
.composer-send:active {
  color: var(--accent);
  background: rgba(255, 215, 0, 0.08);
  transform: scale(0.9);
  transition: transform 0.1s ease;
}

.composer.sweep::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 60px;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 215, 0, 0.15),
    transparent
  );
  animation: send-sweep 0.2s linear forwards;
  pointer-events: none;
}

@keyframes send-sweep {
  0% {
    left: -60px;
  }
  100% {
    left: 100%;
  }
}

/* ── Voice Button ───────────────────────────────────────── */
.voice-btn {
  position: relative;
  width: 100%;
  aspect-ratio: 3 / 1;
  max-height: 64px;
  background: rgba(255, 255, 255, 0.02);
  border: 2px solid rgba(255, 215, 0, 0.2);
  border-radius: 6px;
  cursor: pointer;
  overflow: hidden;
  transition:
    border-color 0.2s,
    background 0.2s;
  -webkit-tap-highlight-color: transparent;
}

.voice-btn:hover {
  background: rgba(255, 215, 0, 0.03);
}
.voice-btn:active {
  background: rgba(255, 215, 0, 0.06);
}

.voice-btn.recording {
  border-color: var(--accent);
  background: rgba(255, 215, 0, 0.05);
  box-shadow: 0 0 20px rgba(255, 215, 0, 0.08);
}

.voice-btn.processing {
  border-color: rgba(255, 215, 0, 0.4);
}
.voice-btn canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.voice-btn-icon {
  position: absolute;
  bottom: 8px;
  right: 12px;
  width: 18px;
  height: 18px;
  pointer-events: none;
  opacity: 0.4;
  transition: opacity 0.2s;
}

.voice-btn.recording .voice-btn-icon {
  opacity: 1;
}
.voice-btn.processing .voice-btn-icon {
  opacity: 0.6;
}

.voice-btn-labels {
  position: absolute;
  bottom: 6px;
  left: 12px;
  display: flex;
  flex-direction: column;
  pointer-events: none;
}

.voice-btn-label {
  font-family: var(--font-display);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(232, 232, 232, 0.35);
  transition: color 0.15s ease, opacity 0.15s ease;
}

.voice-btn-subtitle {
  font-family: var(--font-display);
  font-size: 9px;
  font-weight: 400;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(232, 232, 232, 0.2);
}

.voice-btn.recording .voice-btn-label {
  color: var(--accent);
}
.voice-btn.recording .voice-btn-subtitle {
  color: rgba(255, 215, 0, 0.5);
}

/* ── Scroll-to-Bottom FAB ──────────────────────────────── */
.scroll-bottom-fab {
  position: absolute;
  bottom: 8px;
  right: 16px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(20, 20, 24, 0.9);
  border: 1px solid var(--rule-strong);
  color: var(--accent);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 5;
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition:
    opacity 0.2s,
    transform 0.2s;
}

.scroll-bottom-fab.visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}
.scroll-bottom-fab:active {
  background: rgba(255, 215, 0, 0.1);
}
.scroll-bottom-fab svg {
  width: 16px;
  height: 16px;
}

/* ── Streaming Cursor ────────────────────────────────────── */
.streaming-cursor {
  display: inline-block;
  width: 2px;
  height: 1em;
  background: var(--accent);
  margin-left: 2px;
  vertical-align: text-bottom;
  animation: cursor-blink 0.6s step-end infinite;
}

@keyframes cursor-blink {
  50% {
    opacity: 0;
  }
}

/* ── Message Actions (Long-Press) ─────────────────────────── */
.message-actions {
  display: none;
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  z-index: 50;
  background: #1a1a1e;
  border: 1px solid var(--rule-strong);
  border-radius: 10px;
  padding: 4px;
  gap: 2px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.6);
}

.message-actions.visible {
  display: flex;
  animation: fade-in 0.15s ease;
}

.message-actions button {
  background: none;
  border: none;
  color: var(--text-primary);
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 8px 14px;
  border-radius: 8px;
  cursor: pointer;
  white-space: nowrap;
  min-height: 36px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.message-actions button:active {
  background: rgba(255, 255, 255, 0.06);
}

.message.action-target {
  background: rgba(255, 255, 255, 0.02);
  outline: 1px solid rgba(255, 215, 0, 0.1);
}

/* ══════════════════════════════════════════════════════════════
   PRODUCTION CARD SYSTEM (reskinned from teal to gold)
   ══════════════════════════════════════════════════════════════ */

.card-shell {
  width: min(100%, 33rem);
  align-self: stretch;
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 1rem;
  overflow: hidden;
  transition: border-color 0.2s ease;
}

.card-shell:hover {
  border-color: rgba(255, 255, 255, 0.2);
}

.history-entry-user {
  display: flex;
  justify-content: flex-end;
}

.history-entry-user .card-shell {
  border-left: 3px solid rgba(255, 215, 0, 0.3);
}

.card-shell .card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 0.85rem 0.35rem;
  border-bottom: none;
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(232, 232, 232, 0.5);
}

.card-header-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-shrink: 0;
}

.card-title-wrap {
  min-width: 0;
  display: grid;
  gap: 0.18rem;
}

.card-title {
  margin: 0;
  color: rgba(255, 255, 255, 0.8);
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.15;
}

.card-meta {
  color: rgba(232, 232, 232, 0.35);
  font-family: var(--font-display);
  font-size: 0.62rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.card-toggle {
  flex-shrink: 0;
  border: 0;
  border-radius: 999px;
  padding: 0.1rem;
  background: transparent;
  color: rgba(255, 255, 255, 0.3);
  font-size: 0.95rem;
  line-height: 1;
}

.action-badge {
  border: 0;
  border-radius: 999px;
  padding: 0.3rem 0.68rem;
  background: rgba(255, 215, 0, 0.14);
  color: var(--accent);
  font-size: 0.61rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  transition:
    background-color 0.18s ease,
    color 0.18s ease,
    transform 0.18s ease;
}

.action-badge:hover,
.action-badge:focus-visible {
  background: rgba(255, 215, 0, 0.22);
  color: var(--text-primary);
  transform: translateY(-1px);
}

.card-summary {
  display: none;
  padding: 0 0.85rem 0.8rem;
  color: rgba(255, 255, 255, 0.96);
  font-size: 0.88rem;
  font-weight: 600;
  line-height: 1.4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-summary:empty {
  display: none !important;
}
.card-shell[data-collapsed='true'] .card-summary {
  display: block;
}

.card-shell[data-collapsed='true'] {
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(255, 255, 255, 0.14);
  border-radius: 0.85rem;
}

.card-shell[data-collapsed='true'] .card-header {
  padding: 0.55rem 0.75rem 0.15rem;
}
.card-shell[data-collapsed='true'] .card-title {
  font-size: 0.64rem;
  color: rgba(255, 255, 255, 0.46);
}
.card-shell[data-collapsed='true'] .card-meta {
  font-size: 0.56rem;
}
.card-shell[data-collapsed='true'] .card-body,
.card-shell[data-collapsed='true'] .card-caption,
.card-shell[data-collapsed='true'] .card-actions {
  display: none;
}
.card-shell[data-collapsed='true'] .card-toggle {
  transform: rotate(-90deg);
  color: rgba(255, 255, 255, 0.24);
}
.card-shell[data-collapsed='true'] .action-badge {
  padding: 0.26rem 0.6rem;
  font-size: 0.58rem;
}

.card-body {
  padding: 0.6rem 0.85rem 0.95rem;
}

.card-caption {
  margin: 0;
  padding: 0 0.85rem 0.85rem;
  color: rgba(232, 232, 232, 0.5);
  font-size: 0.9rem;
  line-height: 1.45;
}

.card-actions {
  padding: 0 0.85rem 0.95rem;
  margin-top: 0;
}

.card-image-wrap {
  border-radius: 0.9rem;
  overflow: hidden;
  background: rgba(10, 10, 12, 0.82);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.card-image {
  width: 100%;
  display: block;
  object-fit: cover;
}

.card-markdown {
  color: var(--text-primary);
  line-height: 1.5;
}
.card-markdown > :first-child {
  margin-top: 0;
}
.card-markdown > :last-child {
  margin-bottom: 0;
}

.card-markdown a,
.card-document-link {
  color: var(--accent);
  text-decoration: none;
}

.card-markdown a:hover,
.card-markdown a:focus-visible,
.card-document-link:hover,
.card-document-link:focus-visible {
  text-decoration: underline;
}

.card-markdown p,
.card-markdown ul,
.card-markdown ol,
.card-markdown pre,
.card-markdown blockquote {
  margin: 0 0 0.85rem;
}

.card-markdown ul,
.card-markdown ol {
  padding-left: 1.2rem;
}

.card-markdown code {
  font-family: var(--font-display);
  font-size: 0.88em;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 0.45rem;
  padding: 0.08rem 0.3rem;
}

.card-markdown pre {
  overflow-x: auto;
  padding: 0.8rem 0.9rem;
  border-radius: 0.85rem;
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.card-markdown pre code {
  background: transparent;
  padding: 0;
}

.card-markdown blockquote {
  border-left: 3px solid rgba(255, 215, 0, 0.35);
  padding-left: 0.8rem;
  color: rgba(232, 232, 232, 0.5);
}

.card-document {
  display: grid;
  gap: 0.45rem;
  padding: 0.9rem;
  border-radius: 0.9rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.card-document-title {
  font-size: 0.98rem;
  font-weight: 700;
  line-height: 1.25;
}
.card-document-meta {
  color: rgba(232, 232, 232, 0.5);
  font-size: 0.88rem;
  line-height: 1.4;
}

.card-link-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  min-height: 2.1rem;
  border-radius: 999px;
  padding: 0.42rem 0.82rem;
  background: rgba(255, 215, 0, 0.12);
  border: 1px solid rgba(255, 215, 0, 0.22);
  color: var(--accent);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-decoration: none;
  transition:
    transform 0.18s ease,
    background-color 0.18s ease,
    border-color 0.18s ease,
    color 0.18s ease;
}

.card-link-pill:hover,
.card-link-pill:focus-visible {
  background: rgba(255, 215, 0, 0.18);
  border-color: rgba(255, 215, 0, 0.36);
  color: var(--text-primary);
  transform: translateY(-1px);
}

/* Card type variants: URL, Video, GIF */
.card-url,
.card-video,
.card-gif {
  display: grid;
  gap: 0.8rem;
  padding: 0.95rem;
  border-radius: 1rem;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(10, 10, 12, 0.24)),
    rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.card-url-preview,
.card-video-frame,
.card-gif-frame {
  position: relative;
  overflow: hidden;
  border-radius: 0.92rem;
  background: rgba(10, 10, 12, 0.84);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.card-url-preview {
  aspect-ratio: 16 / 9;
}
.card-video-frame {
  aspect-ratio: 16 / 9;
}
.card-gif-frame {
  aspect-ratio: 4 / 3;
}

.card-url-image,
.card-video-image,
.card-gif-image {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}
.card-url-content,
.card-video-content,
.card-gif-content {
  display: grid;
  gap: 0.55rem;
}

.card-url-brand {
  display: flex;
  align-items: center;
  gap: 0.72rem;
}

.card-url-favicon,
.card-url-logo {
  width: 2rem;
  height: 2rem;
  flex-shrink: 0;
  border-radius: 0.62rem;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.08);
}

.card-url-favicon {
  display: block;
  object-fit: cover;
}

.card-url-logo {
  display: grid;
  place-items: center;
  color: rgba(255, 255, 255, 0.88);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.card-url-brand-copy {
  min-width: 0;
  display: grid;
  gap: 0.18rem;
}
.card-url-site,
.card-url-domain,
.card-video-meta,
.card-gif-summary {
  min-width: 0;
  line-height: 1.35;
}
.card-url-site {
  color: rgba(255, 255, 255, 0.9);
  font-size: 0.82rem;
  font-weight: 700;
}
.card-url-domain,
.card-video-meta,
.card-gif-summary {
  color: rgba(232, 232, 232, 0.5);
  font-size: 0.8rem;
}
.card-url-title,
.card-video-title,
.card-gif-title {
  color: var(--text-primary);
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.24;
}
.card-url-description {
  margin: 0;
  color: rgba(232, 232, 232, 0.5);
  font-size: 0.88rem;
  line-height: 1.5;
}

.card-video-frame::after,
.card-gif-frame::after {
  content: '';
  position: absolute;
  inset: auto 0 0;
  height: 55%;
  background: linear-gradient(
    180deg,
    rgba(10, 10, 12, 0),
    rgba(10, 10, 12, 0.86)
  );
  pointer-events: none;
}

.card-video-placeholder,
.card-gif-placeholder {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  padding: 1rem;
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.92rem;
  text-align: center;
}

.card-video-play,
.card-video-badge,
.card-gif-badge {
  position: absolute;
  z-index: 1;
  border-radius: 999px;
  padding: 0.34rem 0.66rem;
}

.card-video-play {
  left: 0.72rem;
  bottom: 0.72rem;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: rgba(255, 255, 255, 0.92);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.card-video-badge,
.card-gif-badge {
  top: 0.72rem;
  right: 0.72rem;
  background: rgba(10, 10, 12, 0.62);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: rgba(255, 255, 255, 0.82);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* Card Timeline */
.card-timeline {
  display: grid;
  gap: 0.75rem;
  padding: 0.95rem;
  border-radius: 1rem;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(10, 10, 12, 0.26)),
    rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.card-timeline-headline {
  margin: 0;
  color: rgba(255, 255, 255, 0.76);
  font-size: 0.84rem;
  font-weight: 600;
  line-height: 1.45;
}
.card-timeline-list {
  display: grid;
  gap: 0.65rem;
}

.card-timeline-event {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: start;
  gap: 0.68rem;
  padding: 0.78rem 0.82rem;
  border-radius: 0.92rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.card-timeline-event[data-current='true'] {
  background: rgba(255, 215, 0, 0.08);
  border-color: rgba(255, 215, 0, 0.24);
}

.card-timeline-marker {
  width: 0.62rem;
  height: 0.62rem;
  margin-top: 0.34rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.22);
  box-shadow: 0 0 0 0.26rem rgba(255, 255, 255, 0.05);
}

.card-timeline-event[data-tone='accent'] .card-timeline-marker {
  background: var(--accent);
  box-shadow: 0 0 0 0.26rem rgba(255, 215, 0, 0.16);
}
.card-timeline-event[data-tone='amber'] .card-timeline-marker {
  background: rgba(255, 196, 107, 0.96);
  box-shadow: 0 0 0 0.26rem rgba(255, 196, 107, 0.14);
}
.card-timeline-event[data-tone='rose'] .card-timeline-marker {
  background: rgba(255, 142, 174, 0.96);
  box-shadow: 0 0 0 0.26rem rgba(255, 142, 174, 0.14);
}

.card-timeline-copy {
  display: grid;
  gap: 0.18rem;
}
.card-timeline-time {
  color: rgba(232, 232, 232, 0.35);
  font-family: var(--font-display);
  font-size: 0.66rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.card-timeline-title {
  color: var(--text-primary);
  font-size: 0.94rem;
  font-weight: 700;
  line-height: 1.3;
}
.card-timeline-subtitle {
  color: rgba(232, 232, 232, 0.5);
  font-size: 0.84rem;
  line-height: 1.45;
}

.card-timeline-chip {
  align-self: center;
  border-radius: 999px;
  padding: 0.28rem 0.58rem;
  background: rgba(255, 215, 0, 0.12);
  border: 1px solid rgba(255, 215, 0, 0.22);
  color: var(--accent);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* Card Briefing */
.card-briefing {
  display: grid;
  gap: 0.85rem;
  padding: 1rem;
  border-radius: 1rem;
  background:
    radial-gradient(
      circle at top right,
      rgba(255, 215, 0, 0.12),
      transparent 42%
    ),
    linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(10, 10, 12, 0.28)),
    rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.card-briefing-greeting {
  margin: 0;
  color: var(--text-primary);
  font-size: 0.98rem;
  font-weight: 700;
  line-height: 1.45;
}

.card-briefing-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(8.5rem, 100%), 1fr));
  gap: 0.6rem;
}

.card-briefing-tile {
  display: grid;
  gap: 0.32rem;
  min-width: 0;
  padding: 0.8rem 0.75rem;
  border-radius: 0.92rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.card-briefing-tile-top {
  display: flex;
  align-items: center;
  justify-content: flex-start;
}

.card-briefing-icon {
  width: fit-content;
  border-radius: 999px;
  padding: 0.2rem 0.42rem;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.68);
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.card-briefing-value {
  color: var(--text-primary);
  font-size: 1.12rem;
  font-weight: 700;
  line-height: 1.1;
}
.card-briefing-label {
  color: rgba(232, 232, 232, 0.5);
  font-size: 0.78rem;
  line-height: 1.35;
}
.card-briefing-timeline {
  display: grid;
  gap: 0.42rem;
  padding: 0.25rem 0 0.05rem;
}
.card-briefing-bar {
  display: flex;
  gap: 0.24rem;
}

.card-briefing-block {
  min-width: 0;
  height: 0.65rem;
  border-radius: 999px;
  background: rgba(255, 215, 0, 0.18);
}

.card-briefing-block[data-tone='busy'] {
  background: rgba(255, 196, 107, 0.7);
}
.card-briefing-block[data-tone='warn'] {
  background: rgba(255, 142, 174, 0.72);
}

.card-briefing-timeline-labels {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  color: rgba(232, 232, 232, 0.35);
  font-family: var(--font-display);
  font-size: 0.62rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* ══════════════════════════════════════════════════════════════
   SHEETS, BUTTONS, FORMS (reskinned from teal to gold)
   ══════════════════════════════════════════════════════════════ */

.primary-button,
.secondary-button,
.mini-button {
  border-radius: 999px;
  padding: 0.75rem 1rem;
  border: 1px solid transparent;
  transition:
    transform 140ms ease,
    border-color 140ms ease,
    background 140ms ease,
    color 140ms ease;
}

.primary-button {
  background: linear-gradient(
    180deg,
    rgba(255, 215, 0, 0.94),
    rgba(223, 183, 0, 0.9)
  );
  color: #0a0a0c;
  font-weight: 700;
}

.secondary-button {
  background: rgba(255, 255, 255, 0.04);
  color: rgba(255, 255, 255, 0.7);
  border-color: rgba(255, 255, 255, 0.08);
}

.topbar .secondary-button {
  padding: 0.45rem 0.8rem;
  font-size: 0.7rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.menu-button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.menu-button svg {
  width: 1.25rem;
  height: 1.25rem;
  fill: currentColor;
}

.menu-button:hover,
.menu-button:focus-visible {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
}

.menu-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  z-index: 100;
  min-width: 11rem;
  padding: 0.35rem;
  border: 1px solid var(--border-soft);
  border-radius: 0.75rem;
  background: var(--bg-surface-strong);
  backdrop-filter: blur(22px);
  box-shadow: var(--shadow-soft);
  opacity: 0;
  transform: scale(0.96) translateY(-4px);
  transform-origin: top right;
  pointer-events: none;
  transition:
    opacity 0.15s ease,
    transform 0.15s ease;
}

.menu-dropdown[hidden] {
  display: none !important;
}

.menu-dropdown.open {
  opacity: 1;
  transform: scale(1) translateY(0);
  pointer-events: auto;
}

.menu-item {
  display: block;
  width: 100%;
  padding: 0.6rem 0.75rem;
  border: none;
  border-radius: 0.5rem;
  background: transparent;
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.85rem;
  text-align: left;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.menu-item:hover,
.menu-item:focus-visible {
  background: rgba(255, 255, 255, 0.08);
}

.menu-version {
  padding: 0.45rem 0.75rem 0.35rem;
  margin-top: 0.2rem;
  border-top: 1px solid var(--rule);
  color: rgba(255, 255, 255, 0.3);
  font-family: var(--font-display);
  font-size: 0.65rem;
  letter-spacing: 0.04em;
  text-align: center;
  user-select: all;
}

.menu-version:empty {
  display: none;
}

.mini-button {
  padding: 0.34rem 0.74rem;
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.mini-button-primary {
  background: rgba(255, 215, 0, 0.14);
  border-color: rgba(255, 215, 0, 0.16);
  color: var(--accent);
}

.mini-button-secondary {
  background: rgba(255, 255, 255, 0.045);
  color: rgba(255, 255, 255, 0.68);
  border-color: rgba(255, 255, 255, 0.07);
}

.sheet {
  position: fixed;
  inset: 0;
  display: grid;
  align-items: end;
  z-index: 20;
}

.sheet[hidden] {
  display: none !important;
}

.sheet-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  background: rgba(0, 0, 0, 0.5);
}

.sheet-panel {
  position: relative;
  border-radius: 1.5rem 1.5rem 0 0;
  padding: 0 1rem 1.1rem;
  display: grid;
  gap: 0.85rem;
  background: #0b0b0d;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.sheet-panel h2 {
  margin: 0;
  font-size: clamp(1.2rem, 4vw, 1.5rem);
  line-height: 1.1;
  font-weight: 700;
}

.sheet-handle {
  width: 2.25rem;
  height: 0.25rem;
  margin: 0.7rem auto 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
}

.sheet-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.85rem;
}

.sheet-copy {
  margin: 0;
  color: rgba(232, 232, 232, 0.5);
  line-height: 1.5;
}

.sheet-meta {
  margin: -0.1rem 0 0;
  color: rgba(255, 255, 255, 0.42);
  font-family: var(--font-display);
  font-size: 0.66rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.sheet-actions {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.sheet-footer {
  padding-top: 0.15rem;
}

.sheet-link {
  color: var(--accent);
  font-size: 0.95rem;
  text-decoration: none;
}

.sheet-link:hover,
.sheet-link:focus-visible {
  text-decoration: underline;
}

.sheet-link-button {
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  font: inherit;
  text-align: inherit;
}

.eyebrow {
  margin: 0 0 0.35rem;
  color: var(--accent);
  font-family: var(--font-display);
  font-size: 0.66rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.field-label {
  color: rgba(232, 232, 232, 0.5);
  font-size: 0.9rem;
}

.field-input {
  width: 100%;
  border-radius: 0.95rem;
  border: 1px solid var(--rule-strong);
  background: rgba(10, 10, 12, 0.92);
  color: var(--text-primary);
  padding: 0.8rem 0.95rem;
}

.field-input:focus {
  outline: 2px solid rgba(255, 215, 0, 0.55);
  outline-offset: 2px;
}

.approval-sheet-panel {
  border-top-color: rgba(255, 215, 0, 0.18);
}

.approval-preview {
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 1.1rem;
  padding: 0.95rem 1rem;
  background: rgba(255, 255, 255, 0.045);
}

.approval-preview .sheet-copy {
  color: rgba(255, 255, 255, 0.82);
}

.approval-actions {
  display: flex;
  gap: 0.65rem;
}

.approval-actions > * {
  flex: 1;
}

.camera-sheet {
  z-index: 30;
}

.camera-sheet-panel {
  padding-bottom: max(env(safe-area-inset-bottom), 1rem);
}

.camera-preview-wrap {
  overflow: hidden;
  border-radius: 1rem;
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.08);
  aspect-ratio: 4 / 3;
}

.camera-preview {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.camera-actions {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.75rem;
  padding-bottom: 0.15rem;
}

.camera-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.76);
  cursor: pointer;
  transition:
    background-color 0.18s ease,
    border-color 0.18s ease,
    color 0.18s ease,
    transform 0.12s ease;
}

.camera-action:active {
  transform: scale(0.94);
}

.camera-action svg {
  width: 1.25rem;
  height: 1.25rem;
}

.camera-action-secondary {
  width: 2.6rem;
  height: 2.6rem;
}

.camera-action-primary {
  width: 4rem;
  height: 4rem;
  border-color: rgba(255, 215, 0, 0.28);
  background: rgba(255, 215, 0, 0.12);
  color: var(--accent);
}

.camera-action:hover,
.camera-action:focus-visible {
  border-color: rgba(255, 215, 0, 0.32);
  color: var(--text-primary);
}

/* ── Accessibility ─────────────────────────────────────── */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ── Desktop Breakpoint ────────────────────────────────── */
@media (min-width: 720px) {
  .sheet {
    align-items: center;
    justify-items: center;
  }

  .sheet-panel {
    width: min(32rem, calc(100vw - 2rem));
    border-radius: 1.5rem;
  }
}

/* ── Reduced Motion ─────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  /* Disable spatial motion animations but keep opacity/color transitions */
  .typing-indicator-dot,
  .topbar::after,
  .empty-state-prompt::after {
    animation: none !important;
  }
  .typing-indicator-dot {
    opacity: 0.6 !important;
  }
  .topbar-indicator[data-tone='success'] {
    animation: none !important;
  }
  .topbar::after,
  .empty-state-prompt::after {
    display: none !important;
  }
  .presence-canvas {
    display: none !important;
  }
}
