/* ═══════════════════════════════════════
   STORIED FLAVOURS — Shared Components
   ═══════════════════════════════════════ */

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 12px 24px;
  border-radius: var(--radius-md);
  font-size: var(--font-size-sm);
  font-weight: 600;
  white-space: nowrap;
  transition: all var(--duration-fast) var(--ease-out);
  line-height: 1.4;
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed !important;
  pointer-events: none;
  box-shadow: none !important;
  transform: none !important;
}

.btn-primary {
  background: var(--color-amber-dark);
  color: #FFFFFF;
  box-shadow: 0 4px 14px 0 rgba(0, 0, 0, 0.1);
  border: 1px solid transparent;
}
.btn-primary:hover {
  background: var(--color-sunflower-gold);
  color: var(--color-brown-900);
  box-shadow: 0 0 20px rgba(255, 193, 94, 0.4), 0 0 40px rgba(255, 193, 94, 0.2);
  transform: translateY(-2px) scale(1.03);
  border-color: rgba(255, 255, 255, 0.4);
}

.btn-secondary {
  background: var(--surface-card);
  color: var(--text-primary);
  border: 1px solid var(--border-medium);
}
.btn-secondary:hover {
  border-color: var(--color-brown-400);
  box-shadow: var(--shadow-sm);
}

.btn-outline {
  background: transparent;
  color: var(--text-primary);
  border: 1px solid var(--border-medium);
}
.btn-outline:hover {
  background: var(--surface-card);
  border-color: var(--color-brown-400);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  padding: 8px 16px;
}
.btn-ghost:hover {
  background: rgba(141, 110, 99, 0.08);
  color: var(--text-primary);
}

.btn-danger {
  background: var(--color-red);
  color: white;
}
.btn-danger:hover {
  background: #B91C1C;
}

.btn-lg {
  padding: 14px 32px;
  font-size: var(--font-size-base);
  border-radius: var(--radius-lg);
}

.btn-sm {
  padding: 6px 14px;
  font-size: var(--font-size-xs);
  border-radius: var(--radius-sm);
}

.btn-icon {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: var(--radius-md);
  font-size: 18px;
}

/* ── Voice Button ── */
.voice-button-wrapper {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 10;
}

.voice-btn {
  width: 40px;
  height: 40px;
  font-size: 18px;
  background: var(--surface-card);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-out);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.voice-btn:hover:not(:disabled) {
  background: var(--color-amber-light);
  border-color: var(--color-amber);
}

/* Button States */
.voice-btn[data-state="idle"] .voice-btn-icon {
  filter: grayscale(100%);
  opacity: 0.7;
}

.voice-btn[data-state="recording"] {
  background: var(--color-red);
  border-color: var(--color-red);
  color: white;
  animation: pulse 1.5s infinite;
}

.voice-btn[data-state="recording"] .voice-btn-icon::before {
  content: '🔴';
}

.voice-btn[data-state="processing"] .voice-btn-icon::before {
  content: '⏳';
}

.voice-btn[data-state="complete"] {
  background: var(--color-sage);
  border-color: var(--color-sage);
  color: white;
}

.voice-btn[data-state="complete"] .voice-btn-icon::before {
  content: '✓';
}

.voice-btn[data-state="error"] {
  background: var(--color-amber);
  border-color: var(--color-amber-dark);
  color: var(--color-brown-900);
}

.voice-btn[data-state="error"] .voice-btn-icon::before {
  content: '⚠️';
}

/* Disabled State (Unsupported Browser) */
.voice-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Pulse Animation for Recording */
@keyframes pulse {
  0%, 100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.7);
  }
  50% {
    transform: scale(1.05);
    box-shadow: 0 0 0 8px rgba(220, 38, 38, 0);
  }
}

/* Textarea Padding Adjustment */
.form-group {
  position: relative;
}

.form-textarea {
  padding-right: 56px; /* Space for voice button */
}

/* ── Standalone Audio Recorder ── */
.audio-recorder {
  background: var(--surface-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
}

.audio-recorder-controls {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.audio-recorder-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 10px 20px;
  border-radius: var(--radius-md);
  font-size: var(--font-size-sm);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.audio-recorder[data-state="recording"] .audio-recorder-btn {
  background: var(--color-red, #dc2626);
  border-color: var(--color-red, #dc2626);
  color: white;
  animation: pulse 1.5s infinite;
}

.audio-recorder-timer {
  font-family: monospace;
  font-size: var(--font-size-lg);
  font-weight: 600;
  color: var(--text-secondary);
  min-width: 80px;
}

.audio-recorder-timer.warning {
  color: var(--color-red, #dc2626);
  animation: pulse 1s infinite;
}

.audio-option-panel {
  animation: fadeIn 0.2s ease;
}

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

/* ── Form Fields ── */
.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.form-label {
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--text-secondary);
}

.form-input,
.form-textarea,
.form-select {
  width: 100%;
  padding: 12px 16px;
  background: var(--surface-elevated);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  font-size: var(--font-size-base);
  color: var(--text-primary);
  transition: border-color var(--duration-fast), box-shadow var(--duration-fast);
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
  border-color: var(--color-amber);
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.15);
}

.form-input::placeholder,
.form-textarea::placeholder {
  color: var(--color-brown-200);
}

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

.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238D6E63' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 40px;
}

.form-hint {
  font-size: var(--font-size-xs);
  color: var(--text-muted);
}

.form-error {
  font-size: var(--font-size-xs);
  color: var(--color-red);
}

/* ── Cards ── */
.card {
  background: var(--surface-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: box-shadow var(--duration-normal) var(--ease-out), transform var(--duration-normal) var(--ease-out);
}

.card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.card-img {
  width: 100%;
  height: 200px;
  object-fit: cover;
  background: var(--color-brown-100);
}

.card-body {
  padding: var(--space-5);
}

.card-title {
  font-size: var(--font-size-lg);
  font-weight: 700;
  margin-bottom: var(--space-1);
}

.card-subtitle {
  font-size: var(--font-size-sm);
  color: var(--text-muted);
  margin-bottom: var(--space-3);
}

.card-text {
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
  line-height: 1.6;
}

.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-5);
  border-top: 1px solid var(--border-light);
  font-size: var(--font-size-xs);
  color: var(--text-muted);
}

.card-authorship-cue {
  display: block;
  font-size: var(--font-size-xs);
  font-weight: 400;
  color: var(--text-muted);
  margin-top: 3px;
}

/* ── Badge ── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: var(--font-size-xs);
  font-weight: 600;
}

.badge-amber {
  background: var(--color-amber-light);
  color: var(--color-amber-dark);
}

.badge-sage {
  background: var(--color-sage-light);
  color: var(--color-sage);
}

.badge-rose {
  background: var(--color-dusty-rose-light);
  color: var(--color-dusty-rose);
}

.badge-terracotta {
  background: var(--color-terracotta-light);
  color: var(--color-terracotta);
}

/* ── Avatar ── */
.avatar {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  object-fit: cover;
  background: var(--color-terracotta-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: var(--color-terracotta);
  font-size: var(--font-size-sm);
  flex-shrink: 0;
}

.avatar-sm  { width: 32px; height: 32px; font-size: var(--font-size-xs); }
.avatar-lg  { width: 56px; height: 56px; font-size: var(--font-size-xl); }
.avatar-xl  { width: 80px; height: 80px; font-size: var(--font-size-3xl); }
.avatar-2xl { width: 120px; height: 120px; font-size: var(--font-size-5xl); }

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
}

/* ── Modal ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: var(--surface-overlay);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  transition: opacity var(--duration-normal);
  padding: var(--space-6);
}

.modal-overlay.active {
  opacity: 1;
}

.modal {
  background: var(--surface-elevated);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  transform: scale(0.95);
  transition: transform var(--duration-normal) var(--ease-out);
}

.modal-overlay.active .modal {
  transform: scale(1);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-6);
  border-bottom: 1px solid var(--border-light);
}

.modal-header h3 {
  font-size: var(--font-size-xl);
}

.modal-body {
  padding: var(--space-6);
}

.modal-footer {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: var(--space-3);
  padding: var(--space-6);
  border-top: 1px solid var(--border-light);
}

/* ── Warm Modal Variant ── */
.modal--warm {
  background: var(--color-cream);
  border: 1px solid var(--color-terracotta-light);
}

.modal--warm .modal-header {
  background: var(--color-vintage-grape);
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
  padding: var(--space-8) var(--space-6) var(--space-6);
  position: relative;
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
}

.modal--warm .modal-header h3 {
  font-size: var(--font-size-2xl);
  color: var(--text-inverse);
  font-weight: 800;
  letter-spacing: -0.02em;
}

.modal--warm .modal-header .modal-close {
  color: var(--text-inverse);
  opacity: 0.8;
}

.modal--warm .modal-header .modal-close:hover {
  opacity: 1;
}

.modal--warm .modal-body {
  padding: var(--space-8) var(--space-6);
}

.modal--warm .modal-footer {
  background: rgba(215, 204, 200, 0.1); /* Subtle warm tint */
  border-top: 1px solid var(--color-brown-100);
  padding: var(--space-6);
}

.modal--warm .form-label {
  color: var(--color-brown-700);
  font-weight: 700;
  margin-bottom: var(--space-2);
}

.modal--warm .form-input,
.modal--warm .form-textarea,
.modal--warm .form-select {
  background: var(--color-warm-white);
  border-color: var(--color-brown-200);
}

.modal--warm .form-input:focus,
.modal--warm .form-textarea:focus,
.modal--warm .form-select:focus {
  border-color: var(--color-terracotta);
  box-shadow: 0 0 0 3px rgba(194, 113, 79, 0.1);
}

/* Center-align footer buttons when there are multiple */
.modal-footer > * {
  flex-shrink: 0;
}

/* On very narrow screens, stack buttons vertically */
@media (max-width: 500px) {
  .modal-footer {
    flex-direction: column;
  }

  .modal-footer > * {
    width: 100%;
  }
}

/* ── Tabs ── */
.tabs {
  display: flex;
  gap: var(--space-1);
  border-bottom: 1px solid var(--border-light);
  padding-bottom: 0;
}

.tab {
  padding: var(--space-3) var(--space-5);
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color var(--duration-fast), border-color var(--duration-fast);
  cursor: pointer;
}

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

.tab.active {
  color: var(--color-amber-dark);
  border-bottom-color: var(--color-amber);
  font-weight: 600;
}

/* ── Search ── */
.search-box {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 10px 16px;
  background: var(--surface-elevated);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  transition: border-color var(--duration-fast), box-shadow var(--duration-fast);
}

.search-box:focus-within {
  border-color: var(--color-amber);
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.15);
}

.search-box input {
  flex: 1;
  font-size: var(--font-size-sm);
}

.search-icon {
  color: var(--text-muted);
  font-size: 16px;
  flex-shrink: 0;
}

/* ── Empty State ── */
.empty-state {
  text-align: center;
  padding: var(--space-16) var(--space-8);
}

.empty-state-icon {
  font-size: 48px;
  margin-bottom: var(--space-4);
}

.empty-state h3 {
  margin-bottom: var(--space-2);
  color: var(--text-secondary);
}

.empty-state p {
  color: var(--text-muted);
  font-size: var(--font-size-sm);
  margin-bottom: var(--space-6);
}

/* ── Toast ── */
.toast-container {
  position: fixed;
  bottom: var(--space-6);
  right: var(--space-6);
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.toast {
  background: var(--surface-elevated);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: var(--space-4) var(--space-5);
  font-size: var(--font-size-sm);
  animation: slideInRight var(--duration-normal) var(--ease-out);
  max-width: 360px;
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.toast-success { border-left: 3px solid var(--color-sage); }
.toast-error   { border-left: 3px solid var(--color-red); }
.toast-info    { border-left: 3px solid var(--color-amber); }

/* ── Dropdown ── */
.dropdown {
  position: relative;
}

.dropdown-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: var(--surface-elevated);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  min-width: 200px;
  padding: var(--space-2);
  z-index: 500;
  opacity: 0;
  transform: translateY(-8px);
  pointer-events: none;
  transition: opacity var(--duration-fast), transform var(--duration-fast) var(--ease-out);
}

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

.dropdown-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-sm);
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
  cursor: pointer;
  transition: background var(--duration-fast);
  width: 100%;
  text-align: left;
}

.dropdown-item:hover {
  background: rgba(141, 110, 99, 0.06);
  color: var(--text-primary);
}

/* ── Wizard (multi-step) ── */
.wizard-progress {
  display: flex;
  align-items: center;
  gap: 0;
  margin-bottom: var(--space-8);
}

.wizard-step-indicator {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--font-size-xs);
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
}

.wizard-step-indicator.active {
  color: var(--color-amber-dark);
}

.wizard-step-indicator.completed {
  color: var(--color-sage);
}

.wizard-step-dot {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-full);
  border: 2px solid var(--border-medium);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--font-size-xs);
  font-weight: 700;
  flex-shrink: 0;
  transition: all var(--duration-fast);
}

.wizard-step-indicator.active .wizard-step-dot {
  border-color: var(--color-amber);
  background: var(--color-amber);
  color: white;
}

.wizard-step-indicator.completed .wizard-step-dot {
  border-color: var(--color-sage);
  background: var(--color-sage);
  color: white;
}

.wizard-step-line {
  flex: 1;
  height: 2px;
  background: var(--border-light);
  margin: 0 var(--space-2);
}

.wizard-step-line.completed {
  background: var(--color-sage);
}

.wizard-body {
  min-height: 300px;
}

.wizard-footer {
  display: flex;
  justify-content: space-between;
  margin-top: var(--space-8);
  padding-top: var(--space-6);
  border-top: 1px solid var(--border-light);
}

/* ── Love / Heart ── */
.love-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  color: var(--text-muted);
  font-size: var(--font-size-sm);
  cursor: pointer;
  transition: color var(--duration-fast);
}

.love-btn:hover,
.love-btn.active {
  color: var(--color-dusty-rose);
}

/* ── Filter chips ── */
.filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.chip {
  padding: 6px 14px;
  border-radius: var(--radius-full);
  font-size: var(--font-size-xs);
  font-weight: 500;
  background: var(--surface-card);
  border: 1px solid var(--border-light);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--duration-fast);
}

.chip:hover,
.chip.active {
  background: var(--color-amber-light);
  border-color: var(--color-amber);
  color: var(--color-amber-dark);
}

/* ── Bottom Sheet ── */
.bottomsheet-overlay {
  position: fixed;
  inset: 0;
  background: var(--surface-overlay);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  transition: opacity var(--duration-normal);
}

.bottomsheet-overlay.active {
  opacity: 1;
}

.bottomsheet {
  background: var(--surface-elevated);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  box-shadow: var(--shadow-xl);
  width: 100%;
  max-width: 480px;
  max-height: 85vh;
  overflow-y: auto;
  transform: translateY(100%);
  transition: transform var(--duration-normal) var(--ease-out);
}

.bottomsheet-overlay.active .bottomsheet {
  transform: translateY(0);
}

.bottomsheet-handle {
  width: 36px;
  height: 4px;
  background: var(--border-medium);
  border-radius: var(--radius-full);
  margin: var(--space-3) auto var(--space-2);
}

.bottomsheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-6);
  border-bottom: 1px solid var(--border-light);
}

.bottomsheet-header h3 {
  font-size: var(--font-size-lg);
}

.bottomsheet-body {
  padding: var(--space-5) var(--space-6);
}

.bottomsheet-footer {
  padding: var(--space-4) var(--space-6) var(--space-6);
}

@media (min-width: 769px) {
  .bottomsheet-overlay {
    align-items: center;
  }
  .bottomsheet {
    border-radius: var(--radius-xl);
    transform: translateY(20px);
  }
  .bottomsheet-overlay.active .bottomsheet {
    transform: translateY(0);
  }
  .bottomsheet-handle {
    display: none;
  }
}

/* ── Role Pills (extends badge) ── */
.badge-owner {
  background: var(--color-amber-light);
  color: var(--color-amber-dark);
}

.badge-steward {
  background: var(--color-sage-light);
  color: var(--color-sage);
}

.badge-contributor {
  background: var(--color-terracotta-light);
  color: var(--color-terracotta);
}

.badge-viewer {
  background: var(--color-brown-100);
  color: var(--color-brown-700);
}

.badge-brown {
  background: var(--color-brown-100);
  color: var(--color-brown-700);
}

/* ── Inline Banner ── */
.inline-banner {
  display: flex;
  gap: var(--space-3);
  padding: var(--space-4);
  border-radius: var(--radius-md);
  font-size: var(--font-size-sm);
}

.inline-banner-icon {
  flex-shrink: 0;
  font-size: 18px;
}

.inline-banner-title {
  font-weight: 600;
  margin-bottom: var(--space-1);
}

.inline-banner-body {
  color: var(--text-secondary);
  line-height: 1.5;
}

.inline-banner-info {
  background: var(--color-amber-light);
  border: 1px solid rgba(245, 158, 11, 0.2);
}

.inline-banner-warning {
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.15);
}

/* ── Radio List Item ── */
.radio-list-item {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-4);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: border-color var(--duration-fast), background var(--duration-fast);
}

.radio-list-item:hover {
  border-color: var(--border-medium);
  background: var(--surface-card);
}

.radio-list-item:has(input:checked) {
  border-color: var(--color-amber);
  background: var(--color-amber-light);
}

.radio-list-item input[type="radio"] {
  margin-top: 3px;
  accent-color: var(--color-amber);
}

.radio-list-item-content {
  flex: 1;
}

.radio-list-item-label {
  font-weight: 600;
  font-size: var(--font-size-sm);
}

.radio-list-item-desc {
  font-size: var(--font-size-xs);
  color: var(--text-muted);
  margin-top: var(--space-1);
  line-height: 1.4;
}

/* ── Checkbox List Item ── */
.checkbox-list-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: var(--font-size-sm);
  transition: background var(--duration-fast);
}

.checkbox-list-item:hover {
  background: var(--surface-card);
}

.checkbox-list-item input[type="checkbox"] {
  accent-color: var(--color-amber);
}

/* ── Tooltip ── */
.tooltip-wrapper {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
}

.tooltip-trigger {
  color: var(--text-muted);
  cursor: help;
  font-size: var(--font-size-sm);
}

.tooltip-text {
  display: none;
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--color-brown-900);
  color: var(--text-inverse);
  font-size: var(--font-size-xs);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  white-space: normal;
  width: max-content;
  max-width: 260px;
  z-index: 600;
  line-height: 1.4;
}

.tooltip-wrapper:hover .tooltip-text,
.tooltip-trigger:focus + .tooltip-text {
  display: block;
}

/* ── Permission Denied ── */
.permission-denied {
  text-align: center;
  padding: var(--space-10) var(--space-6);
  background: var(--surface-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
}

.permission-denied-icon {
  font-size: 48px;
  margin-bottom: var(--space-4);
}

.permission-denied h3 {
  margin-bottom: var(--space-2);
  color: var(--text-secondary);
}

.permission-denied p {
  color: var(--text-muted);
  font-size: var(--font-size-sm);
}

/* ── Toggle Switch ── */
.toggle {
  width: 44px;
  height: 24px;
  border-radius: var(--radius-full);
  background: var(--border-medium);
  cursor: pointer;
  position: relative;
  transition: background var(--duration-fast);
  flex-shrink: 0;
}

.toggle::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  border-radius: var(--radius-full);
  background: white;
  box-shadow: var(--shadow-sm);
  transition: transform var(--duration-fast);
}

.toggle.on {
  background: var(--color-amber);
}

.toggle.on::after {
  transform: translateX(20px);
}

/* ── Responsive helpers ── */
@media (max-width: 768px) {
  .container {
    padding: 0 var(--space-5);
  }
  h1 { font-size: var(--font-size-3xl); }
  h2 { font-size: var(--font-size-2xl); }
}

/* ── Inline Help Trigger (.ihl) ── */
/*
 * Lightweight contextual "Need help?" link used throughout the product.
 * Rendered by js/components/inline-help-trigger.js.
 * Two variants: subtle (default, with ? badge) and muted (text-only, minimal).
 */

.ihl {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  text-decoration: none;
  cursor: pointer;
  transition: color 0.15s ease, opacity 0.15s ease;
  padding: var(--space-1) 0;
  border-radius: var(--radius-sm);
  line-height: 1.4;
}

.ihl:focus-visible {
  outline: 2px solid var(--border-focus);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

/* Subtle variant — small ? badge + label */
.ihl--subtle {
  font-size: var(--font-size-xs);
  color: var(--text-muted);
}
.ihl--subtle .ihl-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  border: 1.5px solid var(--color-brown-200);
  font-size: 9px;
  font-weight: 700;
  color: var(--text-muted);
  flex-shrink: 0;
  line-height: 1;
}
.ihl--subtle:hover {
  color: var(--text-secondary);
}
.ihl--subtle:hover .ihl-icon {
  border-color: var(--color-brown-400);
  color: var(--text-secondary);
}

/* Muted variant — text link only, very low visual weight */
.ihl--muted {
  font-size: var(--font-size-xs);
  color: var(--color-brown-200);
}
.ihl--muted .ihl-icon {
  display: none;
}
.ihl--muted:hover {
  color: var(--text-muted);
}

/* Responsive: ensure comfortable tap target on mobile */
@media (max-width: 768px) {
  .ihl {
    padding: var(--space-2) 0;
    min-height: 36px;
  }
}

/* ─────────────────────────────────────────
   CAM Trigger (.cam-trigger)
   Contextual "Ask CAM" inline button.
   Two variants: subtle (default) and muted.
   ───────────────────────────────────────── */

.cam-trigger {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: var(--space-1) 0;
  text-decoration: none;
  transition: opacity 0.15s ease, color 0.15s ease;
  font-family: inherit;
  line-height: 1;
}

.cam-trigger:focus-visible {
  outline: 2px solid var(--border-focus, #c85a1f);
  outline-offset: 3px;
  border-radius: var(--radius-sm, 3px);
}

/* Subtle — small badge + label */
.cam-trigger--subtle {
  font-size: var(--font-size-xs);
  color: var(--text-muted);
}
.cam-trigger--subtle .cam-trigger-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  border: 1.5px solid currentColor;
  font-size: 9px;
  flex-shrink: 0;
  line-height: 1;
  color: var(--color-terracotta, #c85a1f);
  border-color: var(--color-terracotta, #c85a1f);
}
.cam-trigger--subtle .cam-trigger-text {
  color: var(--color-terracotta, #c85a1f);
}
.cam-trigger--subtle:hover {
  opacity: 0.75;
}

/* Muted — text only, very low visual weight */
.cam-trigger--muted {
  font-size: var(--font-size-xs);
  color: var(--color-brown-200, #9a7b6a);
}
.cam-trigger--muted .cam-trigger-icon {
  display: none;
}
.cam-trigger--muted:hover {
  color: var(--text-muted);
}

/* Responsive: comfortable tap target on mobile */
@media (max-width: 768px) {
  .cam-trigger {
    padding: var(--space-2) 0;
    min-height: 36px;
  }
}

/* ── Offline indicator ───────────────────────────────────────────────────── */

#offline-indicator {
  position: fixed;
  bottom: var(--space-6);
  left: 50%;
  transform: translateX(-50%);
  z-index: 3000;
  background: var(--surface-sidebar);
  color: #FAF7F2;
  font-size: var(--font-size-sm);
  border-radius: var(--radius-pill);
  padding: var(--space-2) var(--space-5);
  display: flex;
  align-items: center;
  gap: var(--space-2);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
  transition: opacity 0.3s ease, transform 0.3s ease;
  white-space: nowrap;
  pointer-events: none;
}

#offline-indicator.offline-indicator-hidden {
  opacity: 0;
  transform: translateX(-50%) translateY(8px);
}

.offline-indicator-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-amber);
  flex-shrink: 0;
}

/* ── Install CTA banner ──────────────────────────────────────────────────── */

.install-cta-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 2000; /* above sidebar/topbar, below modals */
  background: var(--surface-elevated);
  border-top: 1px solid var(--border-light);
  box-shadow: 0 -4px 24px rgba(62, 39, 35, 0.09);
  padding: var(--space-4) var(--space-5);
  padding-bottom: calc(var(--space-4) + env(safe-area-inset-bottom, 0px));
  transform: translateY(100%);
  opacity: 0;
  transition: transform 0.32s cubic-bezier(0.16, 1, 0.3, 1),
              opacity 0.32s ease;
  will-change: transform;
}

.install-cta-banner.install-cta-visible {
  transform: translateY(0);
  opacity: 1;
}

.install-cta-inner {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  max-width: 480px;
  margin: 0 auto;
}

.install-cta-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  flex-shrink: 0;
  object-fit: contain;
}

.install-cta-text {
  flex: 1;
  min-width: 0;
}

.install-cta-title {
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.3;
}

.install-cta-body {
  font-size: var(--font-size-xs);
  color: var(--text-muted);
  margin-top: 2px;
  line-height: 1.4;
}

.install-cta-actions {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  gap: var(--space-3);
}

.install-cta-btn-primary {
  white-space: nowrap;
}

.install-cta-btn-dismiss {
  background: none;
  border: none;
  padding: 0;
  font-size: var(--font-size-xs);
  color: var(--text-muted);
  cursor: pointer;
  white-space: nowrap;
  line-height: 1;
}

.install-cta-btn-dismiss:hover {
  color: var(--text-secondary);
}

/* Desktop: float as a card above the bottom-right corner */
@media (min-width: 769px) {
  .install-cta-banner {
    left: auto;
    right: var(--space-6);
    bottom: var(--space-6);
    width: 360px;
    border-radius: var(--radius-lg);
    border-top: 1px solid var(--border-light);
    padding: var(--space-5);
    transform: translateY(calc(100% + var(--space-6)));
  }

  .install-cta-banner.install-cta-visible {
    transform: translateY(0);
  }

  .install-cta-inner {
    max-width: none;
    margin: 0;
    flex-wrap: wrap;
    gap: var(--space-3);
  }

  .install-cta-text {
    width: 100%;
    order: 2;
  }

  .install-cta-icon {
    order: 1;
  }

  .install-cta-actions {
    order: 3;
    width: 100%;
    justify-content: flex-end;
    gap: var(--space-4);
  }
}
