* {
  box-sizing: border-box;
}

body {
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  margin: 0;
  padding: 0.5rem;
  background: #f5f5f5;
  color: #1a1a1a;
  -webkit-text-size-adjust: 100%;
}

.container {
  max-width: 32rem;
  margin: 0 auto;
  background: #fff;
  padding: 1rem;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

@media (min-width: 480px) {
  body { padding: 1rem; }
  .container { padding: 1.5rem; }
}

/* model-bar and execution time styles removed; model selection now lives on profile page */

.app-header {
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

h1 {
  font-size: 1.35rem;
  font-weight: 600;
  margin: 0;
}

.greeting-text {
  margin: 0.15rem 0 0;
  font-size: 0.9rem;
  color: #4b5563;
}

.app-header-main {
  display: flex;
  flex-direction: column;
}

.app-header-menu {
  position: relative;
}

.menu-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  border-radius: 999px;
  border: 1px solid #d1d5db;
  background: #f9fafb;
  touch-action: manipulation;
}

.menu-toggle-icon {
  display: inline-block;
  width: 1.2rem;
  height: 1.2rem;
  position: relative;
}

.menu-toggle-icon span {
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
  border-radius: 999px;
  background: #111827;
  transition: transform 0.18s ease, opacity 0.18s ease, top 0.18s ease, bottom 0.18s ease;
}

.menu-toggle-icon span:nth-child(1) {
  top: 0.2rem;
}

.menu-toggle-icon span:nth-child(2) {
  top: 50%;
  transform: translateY(-50%);
}

.menu-toggle-icon span:nth-child(3) {
  bottom: 0.2rem;
}

.menu-toggle.is-open .menu-toggle-icon span:nth-child(1) {
  top: 50%;
  transform: translateY(-50%) rotate(45deg);
}

.menu-toggle.is-open .menu-toggle-icon span:nth-child(2) {
  opacity: 0;
}

.menu-toggle.is-open .menu-toggle-icon span:nth-child(3) {
  bottom: auto;
  top: 50%;
  transform: translateY(-50%) rotate(-45deg);
}

.menu-dropdown {
  position: absolute;
  right: 0;
  top: calc(100% + 0.35rem);
  min-width: 11rem;
  padding: 0.35rem 0;
  background: #111827;
  color: #f9fafb;
  border-radius: 10px;
  box-shadow: 0 18px 45px rgba(15, 23, 42, 0.28);
  z-index: 10;
}

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

.menu-item {
  width: 100%;
  padding: 0.55rem 0.9rem;
  border: none;
  background: transparent;
  color: inherit;
  text-align: left;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;
}

.menu-item:hover {
  background: rgba(249, 250, 251, 0.07);
}

.menu-item + .menu-item {
  border-top: 1px solid rgba(55, 65, 81, 0.75);
}

.menu-divider {
  height: 1px;
  background: rgba(55, 65, 81, 0.6);
  margin: 0.25rem 0;
}

.menu-label {
  padding: 0.35rem 0.9rem 0.15rem;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: rgba(156, 163, 175, 0.85);
  pointer-events: none;
}

.menu-tip-jar {
  color: #fbbf24 !important;
}

.menu-tip-jar:hover {
  background: rgba(251, 191, 36, 0.12) !important;
}

@media (min-width: 480px) {
  .app-header {
    align-items: flex-start;
  }
}

.section-title {
  margin: 0 0 0.5rem 0;
  font-size: 1.05rem;
  font-weight: 600;
  color: #1a1a1a;
}

.section-hint {
  margin: 0 0 0.75rem 0;
  font-size: 0.8rem;
  color: #666;
  line-height: 1.35;
}

/* Full-width email / phone (profile + admin edit modal) */
.field-contact-full .input-field-block {
  display: block;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  padding: 0.5rem 0.65rem;
  font-size: 1rem;
}
.field-contact-full .hint {
  display: block;
  margin-top: 0.35rem;
  font-size: 0.78rem;
  line-height: 1.35;
}
.modal-overlay[id*="Modal"] .modal-content .field-contact-full {
  margin-bottom: 0.85rem;
}

.form-section {
  margin-bottom: 0.75rem;
  padding: 0.75rem 1rem;
  background: #f8f9fa;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.form-section:last-of-type {
  margin-bottom: 0;
}

.field {
  margin-bottom: 0.75rem;
}

.field:last-child {
  margin-bottom: 0;
}

.sample-video-output .sample-video-player {
  display: block;
  max-width: 100%;
  margin-bottom: 0.5rem;
}

.label,
label:not(.radio) {
  display: block;
  font-weight: 500;
  margin-bottom: 0.25rem;
  font-size: 0.9rem;
}

.button-label {
  display: block;
  margin-bottom: 0.25rem;
}

input[type="text"],
input[type="email"],
input[type="tel"],
input[type="number"],
input[type="search"],
input[type="password"],
input[type="url"],
input[type="date"] {
  display: block;
  width: 100%;
  padding: 0.4rem 0.6rem;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 16px; /* iOS Safari: <16px focused inputs trigger page zoom */
}

textarea {
  display: block;
  width: 100%;
  min-height: 4em;
  padding: 0.4rem 0.6rem;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 16px;
  font-family: inherit;
  resize: vertical;
}

input[type="file"] {
  display: block;
  width: 100%;
  padding: 0.4rem;
  border: 1px solid #ccc;
  border-radius: 6px;
  background: #fff;
  font-size: 0.9rem;
}

.radio-group {
  display: flex;
  gap: 1rem;
  margin-top: 0.15rem;
}

.radio {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 400;
  cursor: pointer;
}

.radio input {
  margin: 0;
}

select {
  width: 100%;
  padding: 0.4rem 0.6rem;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 16px;
  background: #fff;
}

.btn-primary {
  padding: 0.5rem 0.75rem;
  min-height: 44px;
  font-size: 0.95rem;
  font-weight: 600;
  color: #fff;
  background: #0d6efd;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  touch-action: manipulation; /* iOS: reduce double-tap zoom delay on controls */
  -webkit-tap-highlight-color: transparent;
}

.btn-primary.btn-full {
  width: 100%;
}

.btn-primary:hover {
  background: #0b5ed7;
}

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

.btn-secondary {
  padding: 0.5rem 0.75rem;
  font-size: 0.95rem;
  background: #f3f4f6;
  color: #374151;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.btn-secondary:hover {
  background: #e5e7eb;
}

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

button[type="submit"] {
  width: 100%;
  padding: 0.6rem 0.75rem;
  min-height: 48px;
  font-size: 1rem;
  font-weight: 600;
  color: #fff;
  touch-action: manipulation;
  background: #0d6efd;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

button[type="submit"]:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

button[type="submit"]:hover {
  background: #0b5ed7;
}

.generate-error-msg {
  margin-top: 0.5rem;
  font-size: 0.9rem;
  color: #b91c1c;
}

.generate-error-msg[hidden] {
  display: none;
}

/* Speak page: numbered step blocks */
.speak-step {
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid #e5e7eb;
}

.speak-step:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.speak-step-label {
  margin: 0 0 0.25rem 0;
  font-size: 0.95rem;
  font-weight: 600;
  color: #1a1a1a;
}

.speak-step-hint {
  margin: 0 0 0.5rem 0;
  font-size: 0.85rem;
  line-height: 1.4;
  color: #555;
}

/* Speak page: collapsible options block */
.speak-options {
  margin: 0;
}

.speak-options-summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.speak-options-summary::before {
  content: '\25B6';
  font-size: 0.65rem;
  transition: transform 0.15s ease;
}

.speak-options[open] > .speak-options-summary::before {
  transform: rotate(90deg);
}

.speak-options-summary::-webkit-details-marker {
  display: none;
}

.optional {
  font-weight: 400;
  font-size: 0.8rem;
  color: #888;
}

.play-podcast-block {
  margin-top: 1rem;
}

.sample-play-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
}

.sample-play-buttons .btn-primary {
  flex: 0 1 auto;
}

.hint {
  display: block;
  font-size: 0.8rem;
  color: #555;
  margin-top: 0.15rem;
  margin-bottom: 0.35rem;
  line-height: 1.35;
}

.phone-verify-panel {
  margin-top: 0.65rem;
  padding: 0.65rem 0 0.15rem 0.75rem;
  border-left: 3px solid #3b82f6;
  background: #f8fafc;
  border-radius: 0 6px 6px 0;
}

.phone-verify-intro {
  margin: 0 0 0.5rem;
  font-size: 0.85rem;
  line-height: 1.45;
  color: #374151;
}

.phone-verify-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 0.35rem;
}

.phone-verify-restore {
  font-size: 0.82rem;
}

.phone-verify-code-block {
  margin-top: 0.5rem;
  padding-top: 0.35rem;
  border-top: 1px solid #e5e7eb;
}

.phone-verify-next {
  margin-top: 0;
}

.phone-verify-feedback {
  margin-bottom: 0;
}

.results {
  margin-top: 0.75rem;
  padding: 0.75rem;
  border-radius: 6px;
  min-height: 2rem;
  font-size: 0.9rem;
}

.results.success {
  background: #d1e7dd;
  color: #0a3622;
}

.results.error {
  background: #f8d7da;
  color: #58151c;
}

.results:empty {
  display: none;
}

.person-photo-field.has-thumbnail {
  display: grid;
  grid-template-columns: 1fr 80px;
  grid-template-rows: auto auto;
  column-gap: 0.75rem;
  row-gap: 0.35rem;
}

.person-photo-field.has-thumbnail > label {
  grid-column: 1;
  grid-row: 1;
}

.person-photo-field.has-thumbnail input[type="file"] {
  grid-column: 1;
  grid-row: 2;
  min-width: 0;
}

.person-photo-field.has-thumbnail .thumbnail-wrap {
  grid-column: 2;
  grid-row: 1 / -1;
  align-self: stretch;
  min-height: 3.5rem;
  display: flex;
}

/* Video profiles table layout */
.profile-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 0.5rem;
  margin-bottom: 0.75rem;
  table-layout: fixed;
}

.profile-table th,
.profile-table td {
  border-bottom: 1px solid #e5e7eb;
  padding: 0.45rem 0.5rem;
  vertical-align: middle;
  font-size: 0.9rem;
}

.profile-table th {
  text-align: left;
  font-weight: 600;
  font-size: 0.8rem;
  color: #374151;
}

.profile-thumb-cell {
  width: 56px;
}

.profile-thumb-wrap {
  width: 48px;
  height: 48px;
  border-radius: 6px;
  border: 1px solid #e5e7eb;
  background: #fff;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.profile-thumb-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.profile-global-cell {
  width: 70px;
}

.profile-actions {
  white-space: nowrap;
}

.profile-actions a.action-link {
  display: inline-block;
  margin-right: 0.6rem;
  padding: 0;
  border: none;
  background: transparent;
  color: #0d6efd;
  text-decoration: underline;
  font-size: 0.85rem;
  line-height: 1.2;
  cursor: pointer;
}

.profile-actions a.action-link:last-of-type {
  margin-right: 0;
}

.profile-actions a.action-link:hover {
  color: #0b5ed7;
}

/* Voice sample playback control */
.voice-select-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.voice-select-row select {
  flex: 1;
}

.voice-sample-btn {
  width: 2.1rem;
  height: 2.1rem;
  border-radius: 6px;
  border: 1px solid #d1d5db;
  background: #f3f4f6;
  color: #111827;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
}

.voice-sample-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.editor-actions {
  display: flex;
  gap: 0.5rem;
}

.editor-actions #saveAvatarBtn,
.editor-actions #cancelAvatarBtn {
  flex: 1;
}

/* Make the editor thumbnail compact to match the table */
#avatarEditorSection .thumbnail-wrap {
  width: 48px;
  min-height: 3rem;
}

#avatarEditorSection .thumbnail-wrap .thumbnail {
  min-height: 3rem;
}

.optional {
  font-weight: 400;
  color: #666;
  font-size: 0.85em;
}

.required {
  font-weight: 400;
  color: #666;
  font-size: 0.85em;
}

.thumbnail-wrap {
  width: 80px;
  min-height: 3.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  border: 1px solid #e5e7eb;
  background: #fff;
  overflow: hidden;
}

.thumbnail-wrap:empty {
  display: none;
}

.thumbnail-wrap:empty {
  display: none;
}

.video-profile-select-row {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.video-profile-thumb-wrap {
  width: 48px;
  height: 48px;
  min-height: 48px;
  border-radius: 6px;
}

.video-profile-thumb-wrap .thumbnail {
  width: 100%;
  height: 100%;
  min-height: 48px;
}

.thumbnail-wrap .thumbnail {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 3.5rem;
  object-fit: cover;
}

.file-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.25rem 0.75rem;
  margin-top: 0.5rem;
}

.file-list:empty {
  display: none;
}

.file-list-item {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.85rem;
  min-width: 0;
}

.file-list-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-list-remove {
  flex-shrink: 0;
  width: 1.5rem;
  height: 1.5rem;
  padding: 0;
  border: none;
  border-radius: 4px;
  background: #e5e7eb;
  color: #374151;
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
}

.file-list-remove:hover {
  background: #d1d5db;
  color: #1f2937;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal[hidden] {
  display: none;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
}

.modal-content {
  position: relative;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  max-width: 20rem;
  width: 100%;
  max-height: 85vh;
  overflow: auto;
}

.full-image-modal-content {
  max-width: 56rem;
  padding: 1rem;
}

.full-image-modal-close {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  width: 2rem;
  height: 2rem;
  border-radius: 999px;
  border: none;
  background: rgba(17, 24, 39, 0.08);
  color: #111827;
  cursor: pointer;
  font-size: 1.25rem;
  line-height: 1;
}

.full-image-modal-img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 80vh;
  object-fit: contain;
  margin: 0 auto;
}

.modal-title {
  margin: 0;
  padding: 1rem 1rem 0.5rem;
  font-size: 1.1rem;
  font-weight: 600;
}

.modal-body {
  padding: 0 1rem 1rem;
  font-size: 0.9rem;
}

.confirm-section {
  margin: 0 0 0.75rem 0;
}

.confirm-section:last-child {
  margin-bottom: 0;
}

.confirm-filename {
  word-break: break-word;
}

.confirm-file-list {
  margin: 0.25rem 0 0;
  padding-left: 1.25rem;
  word-break: break-word;
}

.confirm-file-list li {
  margin-bottom: 0.25rem;
}

.confirm-prompt {
  margin-top: 0.25rem;
  padding: 0.75rem;
  background: #f3f4f6;
  border-radius: 6px;
  font-size: 0.85rem;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}

.identify-prompt-modal-body {
  padding: 0.75rem;
  background: #f3f4f6;
  border-radius: 6px;
  font-size: 0.9rem;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}

.loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(255, 255, 255, 0.85);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
}

.loading-overlay[hidden] {
  display: none;
}

body.loading-cursor {
  cursor: wait;
}

body.loading-cursor * {
  cursor: wait !important;
}

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid #e5e7eb;
  border-top-color: #0d6efd;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.loading-text {
  margin: 0;
  font-size: 1rem;
  color: #374151;
}

.identify-prompt-wrap {
  margin-top: 0.75rem;
}

.identify-prompt-label {
  display: block;
  font-weight: 500;
  margin-bottom: 0.35rem;
  font-size: 0.9rem;
}

.identify-prompt-text {
  padding: 0.75rem;
  background: #f3f4f6;
  border-radius: 6px;
  font-size: 0.85rem;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}

.ancestor-names-wrap {
  margin-top: 0.75rem;
}

.ancestor-select-label {
  display: block;
  font-weight: 500;
  margin-bottom: 0.35rem;
  font-size: 0.9rem;
}

.ancestor-names-list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  max-height: 12rem;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.ancestor-name-option {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.9rem;
  cursor: pointer;
}

.ancestor-name-option input {
  margin: 0;
}

.identify-response-error {
  margin: 0;
  color: #b91c1c;
  font-size: 0.95rem;
}

.error-modal-body {
  color: #b91c1c;
  font-size: 0.95rem;
  line-height: 1.45;
}

/* Dev/troubleshooting only: remove .identify-prompt-* for production */
.identify-prompt-block {
  margin-bottom: 1rem;
  padding: 0.75rem;
  background: #f8f9fa;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
}

.identify-prompt-label {
  margin: 0 0 0.35rem 0;
  font-weight: 600;
  font-size: 0.9rem;
}

.identify-prompt-text {
  margin: 0 0 0.5rem 0;
  padding: 0.5rem;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 4px;
  font-size: 0.8rem;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 12rem;
  overflow-y: auto;
}

.identify-vector-label {
  margin: 0;
  font-size: 0.85rem;
  color: #555;
}

#identifiedPeopleSection .ancestor-select-label {
  margin-bottom: 0.5rem;
}

#identifiedPeopleSection .ancestor-names-list {
  max-height: 14rem;
  overflow-y: auto;
}

.modal-actions {
  display: flex;
  gap: 0.5rem;
  padding: 1rem;
  border-top: 1px solid #e5e7eb;
}

.modal-actions .btn-secondary {
  flex: 1;
  padding: 0.5rem 0.75rem;
  font-size: 0.95rem;
  background: #f3f4f6;
  color: #374151;
  border: none;
  border-radius: 6px;
  cursor: pointer;
}

.modal-actions .btn-primary {
  flex: 1;
  padding: 0.5rem 0.75rem;
  font-size: 0.95rem;
  background: #0d6efd;
  color: #fff;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
}

.auth-methods-tabs {
  display: inline-flex;
  padding: 0.12rem;
  border-radius: 999px;
  background: #f3f4f6;
  border: 1px solid #e5e7eb;
  margin-bottom: 0.75rem;
}

.auth-tab {
  border: none;
  background: transparent;
  padding: 0.4rem 0.9rem;
  font-size: 0.9rem;
  border-radius: 999px;
  color: #4b5563;
  cursor: pointer;
}

.auth-tab.active {
  background: #0d6efd;
  color: #ffffff;
}

/* Login refresh with tip-jar palette */
.login-card {
  background: linear-gradient(180deg, #fffdf9 0%, #fff7ed 100%);
  border-color: #fed7aa;
  box-shadow: 0 10px 26px rgba(217, 119, 6, 0.12);
}
.login-card .section-title {
  color: #9a3412;
}
.login-card .section-hint {
  color: #7c2d12;
}
.login-card .auth-methods-tabs {
  background: #fff1df;
  border: 1px solid #fdba74;
  border-radius: 10px;
  padding: 0.2rem;
}
.login-card .auth-tab {
  border-radius: 8px;
  border: 1px solid transparent;
}
.login-card .auth-tab.active {
  background: linear-gradient(180deg, #fcd34d 0%, #f59e0b 100%);
  color: #7c2d12;
  border-color: #d97706;
}

/* Login: larger email / phone fields; primary actions full width */
.login-card #loginEmail,
.login-card #loginPhone {
  display: block;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  padding: 0.75rem 1rem;
  min-height: 3.25rem;
  font-size: 1.0625rem;
  line-height: 1.35;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  background: #fff;
}
.login-card #authPhoneBlock #loginPhoneCode {
  display: block;
  width: 100%;
  box-sizing: border-box;
  padding: 0.65rem 1rem;
  min-height: 3rem;
  font-size: 1.0625rem;
  border-radius: 8px;
}
.login-card #authLoggedOutBlock .field .btn-primary.btn-full {
  width: 100%;
  display: block;
  min-height: 3rem;
  padding: 0.65rem 1rem;
  font-size: 1rem;
}

/* App version footer */
body {
  padding-bottom: calc(2.5rem + env(safe-area-inset-bottom, 0px));
}

.app-footer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 0.35rem 0.75rem calc(0.35rem + env(safe-area-inset-bottom, 0px));
  text-align: center;
  font-size: 0.75rem;
  color: #6b7280;
  background: rgba(245, 245, 245, 0.92);
  border-top: 1px solid #e5e7eb;
  z-index: 1000;
  pointer-events: none; /* avoid interfering with page interactions */
}

.app-footer #appVersion {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

/* ─── Tip Jar Banner ─── */
.tip-jar-banner {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1.15rem;
  margin-top: 1rem;
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 50%, #fcd34d 100%);
  border: 1px solid #f59e0b;
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.15);
}

.tip-jar-icon {
  font-size: 1.75rem;
  flex-shrink: 0;
}

.tip-jar-text {
  flex: 1;
  min-width: 0;
}

.tip-jar-text strong {
  display: block;
  font-size: 0.95rem;
  color: #92400e;
  margin-bottom: 0.15rem;
}

.tip-jar-text p {
  margin: 0;
  font-size: 0.82rem;
  color: #78350f;
  line-height: 1.35;
}

.tip-jar-btn {
  flex-shrink: 0;
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: #fff;
  background: #d97706;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s;
}

.tip-jar-btn:hover {
  background: #b45309;
}

@media (max-width: 480px) {
  .tip-jar-banner { flex-direction: column; text-align: center; }
  .tip-jar-btn { width: 100%; }
}

/* ─── Speak: start over (full width, below steps 1–3) ─── */
.speak-start-over-wrap {
  margin-top: 0.5rem;
  margin-bottom: 0.25rem;
}

/* Speak: tip jar fixed above version footer so step 4 (tall video) doesn’t hide it below the fold */
body.page-speak {
  padding-bottom: calc(7.5rem + env(safe-area-inset-bottom, 0px));
}

body.page-speak .tip-jar-banner {
  position: fixed;
  left: max(0.5rem, env(safe-area-inset-left, 0px));
  right: max(0.5rem, env(safe-area-inset-right, 0px));
  bottom: calc(2.35rem + env(safe-area-inset-bottom, 0px));
  margin-top: 0;
  margin-left: auto;
  margin-right: auto;
  max-width: 32rem;
  z-index: 900;
  border-radius: 10px 10px 0 0;
  box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.08);
}

@media (min-width: 480px) {
  body.page-speak {
    padding-bottom: calc(8rem + env(safe-area-inset-bottom, 0px));
  }
  body.page-speak .tip-jar-banner {
    left: max(1rem, env(safe-area-inset-left, 0px));
    right: max(1rem, env(safe-area-inset-right, 0px));
  }
}

/* My Stories share modal: avoid iOS focus-zoom on small font readonly URL */
#shareUrlInput {
  font-size: 16px;
}

/* ─── My Stories: sort + collapsible filters ─── */
.stories-sort-row label {
  display: block;
  margin-bottom: 0.25rem;
  font-weight: 600;
}
.stories-sort-row select {
  max-width: 20rem;
  width: 100%;
}
.stories-filters-panel {
  margin: 1rem 0 1.25rem;
  padding: 0.5rem 0.85rem;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
}
.stories-filters-summary {
  cursor: pointer;
  font-weight: 600;
  list-style-position: outside;
  padding: 0.35rem 0;
}
.stories-filters-summary::-webkit-details-marker,
.stories-filters-summary::marker {
  color: #6b7280;
}
.stories-filters-summary-hint {
  font-weight: 400;
  color: #6b7280;
  font-size: 0.9rem;
}
.stories-filters-body {
  padding-top: 0.5rem;
  border-top: 1px solid #e5e7eb;
  margin-top: 0.35rem;
}
.stories-date-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: flex-end;
}
.stories-date-row .stories-date-field {
  flex: 1 1 10rem;
  min-width: 10rem;
  margin-bottom: 0;
}
.stories-filter-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.25rem;
}

/* ─── Analyze Feedback (admin cards) ─── */
.feedback-admin-section .section-hint {
  margin-bottom: 1rem;
}
.feedback-admin-filters-panel {
  margin-bottom: 1.25rem;
  padding: 0.65rem 1rem;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  overflow: hidden; /* contain date/search controls that used to spill past card */
}
.feedback-admin-filters-summary {
  cursor: pointer;
  font-weight: 600;
  padding: 0.25rem 0;
  list-style-position: outside;
}
.feedback-admin-filters-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  padding-top: 0.75rem;
  margin-top: 0.35rem;
  border-top: 1px solid #e5e7eb;
}
/* Grid items must shrink; date inputs have intrinsic min-width and break narrow layouts without this */
.feedback-admin-filters-grid > .field {
  min-width: 0;
  margin-bottom: 0;
}
.feedback-admin-filters-grid input[type="date"],
.feedback-admin-filters-grid input[type="text"],
.feedback-admin-filters-grid select {
  display: block;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  padding: 0.45rem 0.6rem;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 16px;
  background: #fff;
}
.feedback-admin-search-field {
  grid-column: 1 / -1;
}
@media (min-width: 640px) {
  .feedback-admin-filters-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .feedback-admin-search-field {
    grid-column: 1 / -1;
  }
}
@media (min-width: 960px) {
  .feedback-admin-filters-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .feedback-admin-search-field {
    grid-column: 1 / -1;
  }
}
.feedback-admin-filter-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
  padding-top: 0.75rem;
  border-top: 1px solid #e5e7eb;
}
.feedback-admin-message {
  margin: 0.5rem 0 0.75rem;
}
.feedback-admin-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1rem;
  margin-bottom: 0.75rem;
  padding: 0.5rem 0.65rem;
  background: #fffbeb;
  border: 1px solid #fcd34d;
  border-radius: 8px;
}
.feedback-admin-select-all {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
}
.feedback-admin-toolbar-hint {
  margin: 0;
}
.feedback-card-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  list-style: none;
  margin: 0;
  padding: 0;
}
.feedback-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 1rem 1.1rem;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}
.feedback-card--done {
  opacity: 0.92;
  background: #fafafa;
}
.feedback-card--empty {
  text-align: center;
  color: #6b7280;
  padding: 2rem 1rem;
}
.feedback-card__top {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  margin-bottom: 0.5rem;
}
.feedback-card__select {
  flex-shrink: 0;
  padding-top: 0.15rem;
}
.feedback-card__headline {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.75rem;
}
.feedback-card__date {
  font-weight: 600;
  font-size: 0.95rem;
  color: #111827;
  white-space: nowrap;
}
.feedback-status {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
}
.feedback-status--open {
  background: #fef3c7;
  color: #92400e;
}
.feedback-status--ack {
  background: #d1fae5;
  color: #065f46;
}
.feedback-card__pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 0.65rem;
}
.feedback-pill {
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.2rem 0.55rem;
  border-radius: 6px;
  text-transform: capitalize;
}
.feedback-pill--urgent {
  background: #fee2e2;
  color: #991b1b;
}
.feedback-pill--high {
  background: #ffedd5;
  color: #9a3412;
}
.feedback-pill--normal {
  background: #e0e7ff;
  color: #3730a3;
}
.feedback-pill--low {
  background: #f3f4f6;
  color: #4b5563;
}
.feedback-pill--cat-bug {
  background: #fecaca;
  color: #7f1d1d;
}
.feedback-pill--cat-complaint {
  background: #fde68a;
  color: #78350f;
}
.feedback-pill--cat-compliment {
  background: #bbf7d0;
  color: #14532d;
}
.feedback-pill--cat-enhancement {
  background: #bae6fd;
  color: #0c4a6e;
}
.feedback-pill--cat-other {
  background: #e5e7eb;
  color: #374151;
}
.feedback-card__user {
  font-size: 0.88rem;
  color: #4b5563;
  margin-bottom: 0.75rem;
  line-height: 1.4;
  word-break: break-word;
}
.feedback-card__user-label {
  font-weight: 600;
  color: #6b7280;
  margin-right: 0.25rem;
}
.feedback-card__comment {
  border-top: 1px solid #f3f4f6;
  padding-top: 0.75rem;
}
.feedback-card__comment-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #9ca3af;
  margin-bottom: 0.35rem;
}
.feedback-card__comment-text {
  font-size: 0.95rem;
  line-height: 1.55;
  color: #1f2937;
  white-space: pre-wrap;
  word-wrap: break-word;
  overflow-wrap: anywhere;
  max-height: none;
}
.feedback-card__meta-foot {
  font-size: 0.78rem;
  color: #9ca3af;
  margin-top: 0.5rem;
  text-transform: capitalize;
}
.feedback-card__actions {
  margin-top: 1rem;
  padding-top: 0.75rem;
  border-top: 1px solid #f3f4f6;
}
.feedback-card__ack-btn {
  width: 100%;
}

/* ─── Story Cards (My Stories) ─── */
.story-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.story-card {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  transition: box-shadow 0.15s;
}

.story-card:hover {
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.story-badge {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 8px;
  font-size: 1.1rem;
}

.story-badge.podcast { background: #dbeafe; }
.story-badge.video { background: #ede9fe; }

.story-info {
  flex: 1;
  min-width: 0;
}

.story-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: #1a1a1a;
  margin: 0 0 0.1rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.story-meta {
  font-size: 0.78rem;
  color: #6b7280;
}

.story-actions {
  display: flex;
  gap: 0.4rem;
  flex-shrink: 0;
}

.story-actions button {
  padding: 0.35rem 0.6rem;
  font-size: 0.8rem;
  border-radius: 6px;
  border: 1px solid #d1d5db;
  background: #f9fafb;
  cursor: pointer;
  color: #374151;
}

.story-actions button:hover {
  background: #e5e7eb;
}

.story-actions .share-btn {
  border-color: #93c5fd;
  background: #eff6ff;
  color: #1d4ed8;
}
.story-actions .share-btn:hover {
  background: #dbeafe;
}

.story-actions .btn-story-delete {
  border-color: #fecaca;
  background: #fef2f2;
  color: #b91c1c;
}
.story-actions .btn-story-delete:hover {
  background: #fee2e2;
}

.share-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}
.modal-header h3 { margin: 0; font-size: 1.05rem; }
.modal-close {
  border: none;
  background: transparent;
  font-size: 1.5rem;
  cursor: pointer;
  color: #6b7280;
  line-height: 1;
  padding: 0 0.25rem;
}

/* Tip Jar standalone page — warm flow, stacked cards */
.tip-jar-page.form-section {
  background: linear-gradient(180deg, #fffdfb 0%, #fff7ed 38%, #faf8f5 100%);
  border: 1px solid rgba(251, 191, 36, 0.22);
  border-radius: 16px;
  padding: 0.85rem 0.85rem 1.1rem;
  box-shadow: 0 4px 32px rgba(180, 83, 9, 0.06);
}

.tip-jar-page {
  max-width: 42rem;
  margin-left: auto;
  margin-right: auto;
  padding-bottom: 0;
  background: transparent;
}

.tip-jar-flow {
  display: flex;
  flex-direction: column;
  gap: 1.35rem;
}

.tip-jar-page-header {
  text-align: center;
  padding: 0.5rem 0 0.15rem;
}

.tip-jar-hero-title {
  margin: 0 0 1rem !important;
  font-size: clamp(1.65rem, 4.5vw, 2.05rem);
  font-weight: 700;
  color: #9a3412;
  letter-spacing: -0.025em;
  line-height: 1.2;
}

.tip-jar-hero-line {
  width: min(5.5rem, 40vw);
  height: 4px;
  margin: 0 auto;
  border-radius: 999px;
  background: linear-gradient(90deg, #fbbf24, #fb923c, #f472b6);
  box-shadow: 0 2px 12px rgba(251, 146, 60, 0.35);
}

.tip-jar-card {
  border-radius: 14px;
  padding: 1rem 1.15rem;
  box-shadow:
    0 4px 22px rgba(180, 83, 9, 0.07),
    0 1px 3px rgba(0, 0, 0, 0.04);
  border: 1px solid rgba(251, 191, 36, 0.32);
  transition: box-shadow 0.28s ease;
}

.tip-jar-card:hover {
  box-shadow:
    0 10px 36px rgba(180, 83, 9, 0.11),
    0 2px 8px rgba(0, 0, 0, 0.05);
}

.tip-jar-card--welcome {
  background: linear-gradient(165deg, #fffbeb 0%, #ffedd5 50%, #fff7ed 100%);
}

.tip-jar-card--support {
  background: linear-gradient(180deg, #fffefb 0%, #fffaf5 100%);
  border-color: rgba(234, 179, 8, 0.28);
  padding-left: 1.1rem;
  position: relative;
  overflow: hidden;
}

.tip-jar-card--support::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 5px;
  background: linear-gradient(180deg, #fcd34d, #f59e0b, #ea580c);
  border-radius: 14px 0 0 14px;
}

.tip-jar-card--gratitude {
  background: linear-gradient(145deg, #fff1f2 0%, #fef9c3 55%, #fffbeb 100%);
  border-color: rgba(244, 63, 94, 0.14);
}

.tip-jar-lead {
  font-size: 1.05rem;
  line-height: 1.62;
  color: #431407;
  margin: 0 0 0.65rem;
}

.tip-jar-invite {
  margin: 0;
  line-height: 1.58;
  color: #7c2d12;
  font-size: 1rem;
}

.tip-jar-support-heading {
  margin: 0 0 0.55rem;
  padding-left: 0.2rem;
  color: #92400e;
  font-size: 1rem;
}

.tip-jar-support-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.tip-jar-support-list li {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  padding: 0.4rem 0;
  margin: 0;
  line-height: 1.55;
  color: #44403c;
  border-bottom: 1px solid rgba(251, 191, 36, 0.2);
}

.tip-jar-support-list li:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.tip-jar-support-list li:first-child {
  padding-top: 0;
}

.tip-jar-support-list li::before {
  content: "\2713";
  flex: 0 0 1.45rem;
  width: 1.45rem;
  height: 1.45rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.68rem;
  font-weight: 800;
  color: #fff;
  line-height: 1;
  border-radius: 50%;
  background: linear-gradient(145deg, #fbbf24, #ea580c);
  margin-top: 0.1rem;
  box-shadow: 0 2px 8px rgba(234, 88, 12, 0.28);
}

.tip-jar-optional {
  margin: 0 0 0.45rem;
  color: #9f1239;
  font-size: 1.02rem;
}

.tip-jar-closing {
  margin: 0;
  line-height: 1.68;
  color: #57534e;
  font-size: 0.98rem;
}

.tip-jar-future-panel {
  margin-top: 0;
  padding: 1rem 1.15rem;
  border-radius: 14px;
  border: 2px dashed rgba(245, 158, 11, 0.42);
  background: linear-gradient(180deg, #fffbeb 0%, #ffffff 70%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    0 4px 20px rgba(251, 191, 36, 0.08);
}

.tip-jar-future-panel h3 {
  margin: 0 0 0.45rem;
  color: #78350f;
  font-size: 1.1rem;
}

.tip-jar-future-panel p {
  margin: 0 0 0.65rem;
  color: #57534e;
  font-size: 0.95rem;
  line-height: 1.6;
}

.tip-jar-future-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
  align-items: center;
  opacity: 0.65;
  pointer-events: none;
  user-select: none;
}

.tip-jar-future-controls input {
  padding: 0.5rem 0.65rem;
  border: 1px solid #d6d3d1;
  border-radius: 8px;
  width: 6.5rem;
}

.tip-jar-future-badge {
  display: inline-block;
  margin-left: 0.45rem;
  padding: 0.22rem 0.55rem;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-radius: 6px;
  background: linear-gradient(135deg, #fef3c7, #fde68a);
  color: #92400e;
  border: 1px solid rgba(245, 158, 11, 0.35);
}

@media (max-width: 520px) {
  .tip-jar-card {
    padding: 0.9rem 1rem;
  }
  .tip-jar-card--support {
    padding-left: 0.95rem;
  }
  .tip-jar-future-panel {
    padding: 0.9rem 1rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .tip-jar-card {
    transition: none;
  }
}

.story-player {
  margin-top: 0.5rem;
  padding: 0.5rem;
  background: #f8f9fa;
  border-radius: 6px;
}

.story-player audio,
.story-player video,
.story-player iframe {
  display: block;
  width: 100%;
  max-width: 100%;
  border-radius: 4px;
}

.story-empty {
  text-align: center;
  padding: 2rem 1rem;
  color: #9ca3af;
  font-size: 0.95rem;
}

/* ─── Admin impersonation banner ─── */
.impersonation-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 5000;
  background: linear-gradient(90deg, #fef3c7, #fde68a);
  border-bottom: 2px solid #f59e0b;
  box-shadow: 0 2px 12px rgba(245, 158, 11, 0.25);
  padding: 0.5rem 0.75rem;
  font-size: 0.9rem;
  color: #78350f;
}
.impersonation-bar-inner {
  max-width: 56rem;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.impersonation-bar-text { flex: 1; min-width: 12rem; }
.impersonation-bar-btn { flex-shrink: 0; }
body.has-impersonation-bar {
  padding-top: 3.25rem;
}

/* ─── Friendly Generation Loading Overlay ─── */
.generating-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: linear-gradient(160deg, rgba(255,255,255,0.97) 0%, rgba(248,250,252,0.98) 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 2rem;
  text-align: center;
}

.generating-overlay[hidden] {
  display: none;
}

.generating-spinner {
  width: 48px;
  height: 48px;
  border: 4px solid #e5e7eb;
  border-top-color: #6366f1;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

.generating-headline {
  font-size: 1.2rem;
  font-weight: 600;
  color: #1e293b;
  margin: 0;
}

.generating-estimate {
  font-size: 0.88rem;
  color: #64748b;
  margin: 0;
}

.generating-elapsed {
  font-size: 0.95rem;
  font-weight: 500;
  color: #475569;
  margin: 0;
  font-variant-numeric: tabular-nums;
}

.generating-tip {
  font-size: 0.88rem;
  color: #94a3b8;
  font-style: italic;
  margin: 0;
  min-height: 1.4em;
  transition: opacity 0.5s ease;
}

.generating-escape {
  font-size: 0.78rem;
  color: #94a3b8;
  margin-top: 0.75rem;
  max-width: 20rem;
  line-height: 1.4;
}

.generating-escape strong {
  color: #64748b;
}

.generating-dismiss-btn {
  margin-top: 0.5rem;
  font-size: 0.95rem;
  padding: 0.55rem 1.1rem;
}

/* Speak: review modal shows full DB-resolved prompts */
.modal-content--prompt-review {
  max-width: min(44rem, 96vw);
  width: 100%;
}

.modal-body--prompt-review {
  text-align: left;
  max-height: min(72vh, 36rem);
  overflow-y: auto;
}

.confirm-prompt-preview {
  margin-top: 1rem;
  padding-top: 0.75rem;
  border-top: 1px solid #e5e7eb;
}

.confirm-prompt-sub {
  font-weight: 400;
  font-size: 0.78rem;
  color: #64748b;
}

.confirm-prompt-pre {
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 0.75rem;
  line-height: 1.45;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 0.65rem 0.75rem;
  margin: 0.35rem 0 1rem;
  max-height: min(28vh, 14rem);
  overflow: auto;
}

.confirm-preview-note {
  font-size: 0.78rem;
  color: #64748b;
  line-height: 1.4;
  margin: 0 0 0.5rem;
}

/* ─── Cost Analysis Cards ─── */
.cost-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-top: 0.75rem;
}

@media (max-width: 480px) {
  .cost-cards { grid-template-columns: 1fr; }
}

.cost-card {
  padding: 0.75rem 1rem;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
}

.cost-card-title {
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #6b7280;
  margin: 0 0 0.35rem;
}

.cost-card-value {
  font-size: 1.35rem;
  font-weight: 700;
  color: #1e293b;
  margin: 0 0 0.15rem;
}

.cost-card-detail {
  font-size: 0.78rem;
  color: #9ca3af;
  margin: 0;
}

.cost-forecast {
  margin-top: 1rem;
  padding: 0.75rem 1rem;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 8px;
  font-size: 0.88rem;
  line-height: 1.5;
  white-space: pre-wrap;
}

/* ─── Admin Users Page ─── */
.user-card {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  margin-bottom: 0.5rem;
  background: #fff;
  transition: box-shadow 0.15s, border-color 0.15s;
}
.user-card:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.06); }
.user-card.selected { border-color: #3b82f6; background: #eff6ff; }
.user-card-check { flex: 0 0 auto; }
.user-card-info { flex: 1; min-width: 0; }
.user-card-name { font-weight: 600; font-size: 0.95rem; color: #1e293b; }
.user-card-contact { font-size: 0.82rem; color: #6b7280; margin-top: 0.15rem; word-break: break-all; }
.user-card-meta { font-size: 0.75rem; color: #9ca3af; margin-top: 0.1rem; }
.user-card-actions { flex: 0 0 auto; display: flex; gap: 0.35rem; flex-wrap: wrap; }
.badge-admin { display: inline-block; font-size: 0.68rem; font-weight: 600; color: #fff; background: #6366f1; border-radius: 4px; padding: 0.1rem 0.35rem; vertical-align: middle; margin-left: 0.3rem; }
.btn-sm { font-size: 0.78rem !important; padding: 0.25rem 0.5rem !important; }
.btn-tab { font-size: 0.82rem !important; padding: 0.35rem 0.7rem !important; border-radius: 6px; }
.btn-tab.active { box-shadow: 0 1px 3px rgba(0,0,0,0.1); }

.merge-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0.75rem;
  margin: 0.75rem 0;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
}

/* ─── Merge Compare ─── */
.merge-compare {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin: 1rem 0;
}
@media (max-width: 480px) { .merge-compare { grid-template-columns: 1fr; } }
.merge-user-card {
  padding: 0.75rem;
  border: 2px solid #e5e7eb;
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
  transition: border-color 0.15s;
}
.merge-user-card.merge-primary { border-color: #3b82f6; background: #eff6ff; }
.merge-user-radio { margin-bottom: 0.5rem; }
.merge-user-name { font-weight: 600; font-size: 0.95rem; margin-bottom: 0.25rem; }
.merge-user-detail { font-size: 0.82rem; color: #6b7280; }

/* ─── Audit Log ─── */
.audit-row {
  padding: 0.6rem 0.75rem;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  margin-bottom: 0.4rem;
  background: #fff;
}
.audit-action { font-size: 0.88rem; margin-bottom: 0.15rem; }
.audit-meta { font-size: 0.75rem; color: #9ca3af; margin-bottom: 0.25rem; }
.audit-detail { font-size: 0.78rem; color: #6b7280; }
.audit-detail code {
  font-size: 0.72rem;
  background: #f3f4f6;
  padding: 0.1rem 0.3rem;
  border-radius: 3px;
  word-break: break-all;
}

/* ─── Delete Account Zone ─── */
.delete-zone {
  margin-top: 2rem;
  border: 2px solid #fca5a5;
  border-radius: 10px;
  padding: 1.25rem;
  background: #fef2f2;
}
.delete-zone-title { color: #dc2626; }
.btn-danger {
  padding: 0.5rem 0.75rem;
  font-size: 0.95rem;
  border: none;
  border-radius: 6px;
  background: #dc2626;
  color: #fff;
  cursor: pointer;
  font-weight: 600;
  touch-action: manipulation;
}
.btn-danger:hover { background: #b91c1c; }
.btn-danger:disabled { opacity: 0.6; cursor: not-allowed; }

/* ─── Merge Prompt (Profile) ─── */
.merge-prompt {
  margin-top: 1rem;
  padding: 1rem;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 8px;
}
.merge-prompt-content h3 { margin: 0 0 0.5rem; color: #92400e; }

/* ─── Admin Modal Overlay (users page) ─── */
/* [hidden] must win: generic rule above set display:flex and overrode the hidden attribute. */
.modal-overlay[id*="Modal"][hidden],
.modal-overlay[id*="mergeModal"][hidden] {
  display: none !important;
}
.modal-overlay[id*="Modal"]:not([hidden]),
.modal-overlay[id*="mergeModal"]:not([hidden]) {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1rem;
}
.modal-overlay .modal-content {
  max-width: 420px;
  padding: 1.5rem;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.15);
}
