:root {
  --bg: #0f1117;
  --surface: #181b24;
  --surface-raised: #1f2430;
  --border: #2a3142;
  --text: #eef1f8;
  --text-muted: #9aa3b8;
  --accent: #6c8cff;
  --accent-soft: rgba(108, 140, 255, 0.15);
  --accent-strong: #4f6ef7;
  --success: #3dd68c;
  --danger: #ff6b7a;
  --radius: 16px;
  --shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
  --font: "DM Sans", system-ui, sans-serif;
}

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

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  background:
    radial-gradient(ellipse 80% 50% at 50% -20%, rgba(108, 140, 255, 0.18), transparent),
    var(--bg);
  color: var(--text);
  line-height: 1.5;
}

.page {
  max-width: 960px;
  margin: 0 auto;
  padding: 2rem 1.25rem 3rem;
}

.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 2rem;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.875rem;
}

.logo-icon {
  font-size: 2rem;
  line-height: 1;
}

.logo h1 {
  margin: 0;
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

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

.header-nav {
  display: flex;
  gap: 0.5rem;
}

.nav-btn {
  padding: 0.5rem 1rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.nav-btn:hover {
  border-color: var(--accent);
  color: var(--text);
}

.nav-btn.active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}

.main {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

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

.hero h2 {
  margin: 0 0 0.5rem;
  font-size: 1.35rem;
  font-weight: 600;
}

.hero p {
  margin: 0;
  color: var(--text-muted);
}

/* Wizard steps */
.wizard-steps {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.25rem;
}

.wizard-step {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  padding: 0.75rem 0.5rem;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  opacity: 0.5;
  transition: all 0.2s;
}

.wizard-step.active {
  opacity: 1;
  border-color: var(--accent);
  background: var(--accent-soft);
}

.wizard-step.done {
  opacity: 0.85;
}

.wizard-step.done .step-num {
  background: var(--success);
}

.step-num {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--border);
  font-size: 0.8rem;
  font-weight: 700;
}

.wizard-step.active .step-num {
  background: var(--accent);
  color: white;
}

.step-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
}

.wizard-step.active .step-label {
  color: var(--text);
}

.panel-title {
  margin: 0 0 0.35rem;
  font-size: 1.15rem;
  font-weight: 600;
}

.panel-desc {
  margin: 0 0 1.25rem;
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* Dropzone */
.dropzone {
  position: relative;
  border: 2px dashed var(--border);
  border-radius: 12px;
  background: var(--surface-raised);
  padding: 1.75rem 1rem;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  overflow: hidden;
}

.dropzone-large {
  min-height: 220px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.dropzone:hover,
.dropzone:focus-within,
.dropzone.dragover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.dropzone-preview {
  cursor: default;
  margin-bottom: 0.85rem;
}

.dropzone-preview:hover,
.dropzone-preview:focus-within {
  border-color: var(--border);
  background: var(--surface-raised);
}

.dropzone-preview.dragover {
  border-color: var(--accent);
  background: var(--accent-soft);
  cursor: copy;
}

.receipt-pick-btn {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: center;
  text-align: center;
  cursor: pointer;
  margin: 0 0 0.75rem;
  box-sizing: border-box;
}

.receipt-pick-btn input {
  display: none;
}

.receipt-preview {
  max-width: 100%;
  max-height: 280px;
  border-radius: 8px;
  object-fit: contain;
}

.dropzone-icon {
  font-size: 2.5rem;
  display: block;
  margin-bottom: 0.5rem;
}

.dropzone-title {
  margin: 0;
  font-weight: 600;
  font-size: 0.95rem;
}

.dropzone-hint {
  margin: 0.25rem 0 0;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.file-name {
  margin: 0.75rem 0 1rem;
  font-size: 0.8rem;
  color: var(--accent);
  font-weight: 500;
  word-break: break-all;
}

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

/* Recorder */
.recorder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  padding: 1.5rem 0;
}

.record-btn {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  border: 3px solid var(--accent);
  background: var(--accent-soft);
  color: var(--text);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  transition: all 0.2s;
  user-select: none;
  -webkit-user-select: none;
}

.record-btn:hover:not(:disabled) {
  transform: scale(1.04);
  background: rgba(108, 140, 255, 0.25);
}

.record-btn.recording {
  border-color: var(--danger);
  background: rgba(255, 107, 122, 0.2);
  animation: pulse 1s ease infinite;
}

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

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.06); }
}

.record-icon {
  font-size: 2rem;
}

.record-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
}

.record-timer {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.record-wave {
  display: flex;
  gap: 4px;
  align-items: center;
  height: 24px;
}

.record-wave span {
  width: 4px;
  height: 8px;
  background: var(--accent);
  border-radius: 2px;
  animation: wave 0.8s ease infinite;
}

.record-wave span:nth-child(2) { animation-delay: 0.1s; }
.record-wave span:nth-child(3) { animation-delay: 0.2s; }
.record-wave span:nth-child(4) { animation-delay: 0.3s; }
.record-wave span:nth-child(5) { animation-delay: 0.4s; }

@keyframes wave {
  0%, 100% { height: 8px; }
  50% { height: 24px; }
}

.audio-preview {
  text-align: center;
  margin-bottom: 1rem;
}

.preview-label {
  margin: 0 0 0.5rem;
  font-size: 0.875rem;
  color: var(--success);
  font-weight: 600;
}

.audio-preview audio {
  width: 100%;
  max-width: 360px;
}

.text-fallback {
  margin: 1rem 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.75rem 1rem;
  background: var(--surface-raised);
}

.text-fallback summary {
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-muted);
}

.text-fallback .recorder {
  margin-top: 0.75rem;
}

.split-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.split-form-label {
  margin: 0.25rem 0 0;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
}

.split-people {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.split-person {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.3fr) auto;
  gap: 0.5rem;
  align-items: center;
}

.split-person input {
  width: 100%;
  min-width: 0;
  padding: 0.7rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-raised);
  color: var(--text);
  font-family: inherit;
  font-size: 16px;
}

.split-form .edit-field input {
  font-size: 16px;
}

.split-shared-field {
  margin-top: 0.25rem;
}

.split-remove:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

@media (max-width: 560px) {
  .split-person {
    grid-template-columns: 1fr;
  }

  .split-remove {
    justify-self: start;
  }
}

/* Processing steps */
.processing-steps {
  margin-top: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.proc-step {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.proc-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--border);
  flex-shrink: 0;
}

.proc-step.active {
  color: var(--text);
}

.proc-step.active .proc-dot {
  background: var(--accent);
  animation: pulse-dot 0.8s ease infinite;
}

.proc-step.done {
  color: var(--success);
}

.proc-step.done .proc-dot {
  background: var(--success);
}

.proc-step.error {
  color: var(--danger);
}

.proc-step.error .proc-dot {
  background: var(--danger);
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* Buttons */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.9rem 1.5rem;
  border: none;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: white;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s, opacity 0.15s;
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-1px);
}

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

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.9rem 1.5rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-raised);
  color: var(--text);
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.2s;
}

.btn-secondary:hover {
  border-color: var(--accent);
}

.btn-row {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 0.75rem;
  margin-top: 1rem;
}

.btn-text {
  background: none;
  border: none;
  color: var(--accent);
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  padding: 0.25rem 0;
}

.btn-text:hover {
  text-decoration: underline;
}

.btn-text.danger {
  color: var(--danger);
}

.btn-icon {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1rem;
  padding: 0.25rem 0.5rem;
  border-radius: 6px;
}

.btn-icon:hover {
  color: var(--danger);
  background: rgba(255, 107, 122, 0.1);
}

.btn-new-split {
  margin-top: 1rem;
}

.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

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

.hidden {
  display: none !important;
}

.error-banner {
  margin-top: 1rem;
  padding: 0.875rem 1rem;
  border-radius: 10px;
  background: rgba(255, 107, 122, 0.12);
  border: 1px solid rgba(255, 107, 122, 0.35);
  color: #ffb3bc;
  font-size: 0.9rem;
}

.review-flags {
  margin: 0 0 1rem;
  padding: 0.875rem 1rem;
  border-radius: 10px;
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.4);
  color: #fcd34d;
  font-size: 0.88rem;
}

.review-flags ul {
  margin: 0.35rem 0 0;
  padding-left: 1.1rem;
}

.review-flags li + li {
  margin-top: 0.25rem;
}

/* Review & edit */
.edit-event {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.edit-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.edit-field label {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
}

.edit-field input,
.edit-field select {
  width: 100%;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-raised);
  color: var(--text);
  font-family: inherit;
  font-size: 0.95rem;
}

.edit-participants {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 1rem;
}

.edit-participant-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem;
  background: var(--surface-raised);
}

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

.edit-participant-name {
  flex: 1;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: 1rem;
  font-weight: 700;
}

.edit-participant-total {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--success);
  white-space: nowrap;
}

.edit-items {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.edit-item-row {
  display: grid;
  grid-template-columns: 1fr 90px 36px;
  gap: 0.5rem;
  align-items: center;
}

.edit-item-name,
.edit-item-cost {
  padding: 0.45rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: 0.875rem;
}

.edit-participant-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
  font-size: 0.85rem;
  color: var(--text-muted);
}

.edit-participant-footer label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.edit-tax-share {
  width: 80px;
  padding: 0.4rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
}

/* Results */
.event-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
}

.eyebrow {
  margin: 0 0 0.25rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent);
}

.event-header h2 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 700;
}

.event-meta {
  margin: 0.35rem 0 0;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.dot {
  margin: 0 0.35rem;
}

.grand-total-badge {
  text-align: right;
  padding: 0.75rem 1rem;
  border-radius: 12px;
  background: var(--accent-soft);
  border: 1px solid rgba(108, 140, 255, 0.25);
}

.grand-total-badge .label {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 0.15rem;
}

.grand-total-badge .amount {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--accent);
}

.receipt-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.receipt-summary-edit {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

@media (max-width: 640px) {
  .receipt-summary-edit {
    grid-template-columns: 1fr;
  }
}

.receipt-summary-edit input[readonly] {
  color: var(--text-muted);
  cursor: default;
}

.field-amount {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
}

.split-note {
  margin: 0 0 1.25rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.auto-split-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.auto-tag {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.1rem 0.4rem;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
}


@media (max-width: 640px) {
  .receipt-summary,
  .receipt-summary.compact {
    grid-template-columns: 1fr 1fr;
  }

  .edit-row {
    grid-template-columns: 1fr;
  }

  .edit-item-row {
    grid-template-columns: 1fr 80px 32px;
  }

  .btn-row {
    grid-template-columns: 1fr;
  }
}

.summary-item {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  font-size: 0.875rem;
}

.summary-item span:first-child {
  color: var(--text-muted);
}

.summary-item span:last-child {
  font-weight: 600;
}

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

.share-bar {
  margin-top: 0.5rem;
}

.share-buttons {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.share-buttons .btn-secondary {
  flex: 1;
  min-width: 140px;
}

.share-toast {
  margin: 0.75rem 0 0;
  font-size: 0.875rem;
  color: var(--success);
  font-weight: 600;
}

.participants-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr));
  gap: 1rem;
  align-items: stretch;
}

@media (max-width: 540px) {
  .participants-grid {
    grid-template-columns: 1fr;
  }
}

.participant-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  animation: fadeUp 0.4s ease;
}

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

.participant-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
  flex-shrink: 0;
  margin-bottom: 0.875rem;
}

.participant-name {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 700;
}

.participant-total {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--success);
}

.items-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  flex: 1 1 auto;
  min-height: 0;
}

.items-list li {
  display: flex;
  justify-content: space-between;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.items-list li span:last-child {
  color: var(--text);
  font-weight: 500;
}

.participant-card-bottom {
  margin-top: auto;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding-top: 0.875rem;
  border-top: 1px solid var(--border);
}

.participant-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.participant-footer strong {
  color: var(--text);
}

.btn-copy-person {
  display: block;
  width: 100%;
  text-align: center;
  padding: 0.5rem 0.75rem;
  border-radius: 8px;
  background: var(--surface-raised);
  border: 1px solid var(--border);
  transition: border-color 0.2s, background 0.2s;
}

.btn-copy-person:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  text-decoration: none;
}

/* History */
.history-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.history-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-raised);
}

.history-item-main {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.history-item-main strong {
  font-size: 1rem;
}

.history-item-main span {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.history-total {
  font-weight: 700 !important;
  color: var(--accent) !important;
}

.history-item-actions {
  display: flex;
  gap: 0.75rem;
}

.history-empty {
  text-align: center;
  color: var(--text-muted);
  padding: 2rem 0;
}

.history-link {
  font-size: 0.8rem !important;
  color: var(--accent) !important;
}

.calendar-bind-card {
  margin-bottom: 1.25rem;
}

.event-create {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 1rem;
}

.event-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.event-item {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-raised);
}

.event-item-main {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 0;
}

.event-item-main span,
.event-notes {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.event-splits {
  margin: 0.5rem 0 0;
  padding-left: 1.1rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.event-splits .muted {
  list-style: none;
  margin-left: -1.1rem;
}

.chat-card {
  display: flex;
  flex-direction: column;
  min-height: 420px;
}

.chat-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0.75rem 0 1rem;
}

.chip {
  border: 1px solid var(--border);
  background: var(--surface-raised);
  color: var(--text-muted);
  border-radius: 999px;
  padding: 0.4rem 0.75rem;
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
}

.chip:hover {
  border-color: var(--accent);
  color: var(--text);
}

.chat-log {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  max-height: 360px;
  overflow-y: auto;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg);
  margin-bottom: 0.875rem;
  white-space: pre-wrap;
}

.chat-bubble {
  max-width: 92%;
  padding: 0.7rem 0.85rem;
  border-radius: 12px;
  font-size: 0.9rem;
  line-height: 1.45;
}

.chat-bubble.bot {
  align-self: flex-start;
  background: var(--surface-raised);
  border: 1px solid var(--border);
}

.chat-bubble.user {
  align-self: flex-end;
  background: var(--accent-soft);
  border: 1px solid var(--accent);
}

.chat-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.5rem;
}

.chat-form input {
  width: 100%;
  padding: 0.7rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-raised);
  color: var(--text);
  font-family: inherit;
  font-size: 16px;
}

@media (max-width: 640px) {
  .header-nav {
    width: 100%;
  }

  .event-item {
    flex-direction: column;
  }
}

.footer {
  margin-top: 2.5rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.8rem;
}

.footer p {
  margin: 0;
}

.header-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.6rem;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.user-chip #user-chip-name {
  font-weight: 700;
  color: var(--text);
}

.auth-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.25rem;
}

.auth-screen.hidden {
  display: none;
}

.auth-card {
  width: 100%;
  max-width: 420px;
}

.auth-card h2 {
  margin: 0 0 0.5rem;
}

.auth-tabs {
  display: flex;
  gap: 0.5rem;
  margin: 1rem 0;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.auth-error {
  margin-top: 0.75rem;
  color: var(--danger);
  font-size: 0.875rem;
}

.auth-google-btn {
  width: 100%;
  margin: 0.75rem 0 0.25rem;
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 1rem 0 0.25rem;
  color: var(--text-muted);
  font-size: 0.8rem;
}

.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

.profile-form textarea {
  width: 100%;
  resize: vertical;
  min-height: 3.5rem;
  font: inherit;
  padding: 0.65rem 0.75rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-2, var(--bg));
  color: var(--text);
}

#profile-saved {
  color: var(--success, #2f9e44);
  margin: 0.5rem 0 0;
}

.profile-pay-section {
  margin-top: 1.25rem;
}

.payment-profiles-list {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  margin: 0.75rem 0 1rem;
}

.payment-profile-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.85rem;
  background: var(--surface-2, transparent);
}

.payment-profile-card .profile-pay-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.65rem;
}

.payment-profile-card .default-pay-label {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.share-pay-field {
  margin-bottom: 0.85rem;
}

.settle-pay-card {
  margin: 1rem 0 1.25rem;
  padding: 1rem 0 0;
  border-top: 1px solid var(--border);
}

.settle-friend-row {
  display: grid;
  gap: 0.65rem;
  margin-bottom: 0.75rem;
}

.settle-friend-row .btn-secondary {
  justify-self: start;
}

.settle-manual {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  margin-top: 0.5rem;
}

.field-hint {
  margin: 0.35rem 0 0;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.payer-field {
  margin: 1rem 0 1.25rem;
}

.payer-banner {
  margin: 0.85rem 0 0;
  padding: 0.75rem 0.9rem;
  border-radius: 10px;
  background: var(--accent-soft);
  border: 1px solid var(--accent);
  font-size: 0.9rem;
  font-weight: 600;
}

.payer-tag {
  display: inline-block;
  margin-left: 0.35rem;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  background: var(--accent-soft);
  color: var(--accent);
  vertical-align: middle;
}

.settle-line {
  margin: 0.35rem 0 0.65rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.settle-line.payer {
  color: var(--success);
  font-weight: 600;
}
