/* ── Reset & Tokens ─────────────────────────────────────────────────────── */
:root {
  --bg:        #0a0a0f;
  --bg-card:   #12121a;
  --bg-raised: #1c1c2a;
  --bg-input:  #16161f;
  --accent:    #4f46e5;
  --accent2:   #7c3aed;
  --accent-lt: #818cf8;
  --green:     #10b981;
  --red:       #ef4444;
  --txt:       #eeeef5;
  --txt-dim:   #8888a8;
  --border:    #252535;
  --radius:    18px;
  --radius-sm: 12px;
  --shadow:    0 4px 24px rgba(0,0,0,.45);
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html {
  background: var(--bg);
  color: var(--txt);
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', sans-serif;
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  min-height: 100svh;
  overscroll-behavior-y: none;
}

/* ── Layout ─────────────────────────────────────────────────────────────── */
#app {
  max-width: 480px;
  margin: 0 auto;
  padding: 0 16px env(safe-area-inset-bottom, 24px);
  padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 32px);
}

.section {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.hidden { display: none !important; }

/* ── Header ─────────────────────────────────────────────────────────────── */
.header {
  padding: 24px 0 16px;
  text-align: center;
}

.logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 6px;
}

.logo-icon { font-size: 30px; line-height: 1; }

.logo-text {
  font-size: 30px;
  font-weight: 800;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, #818cf8 0%, #a78bfa 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.tagline {
  font-size: 13px;
  color: var(--txt-dim);
  letter-spacing: 0.2px;
  margin-bottom: 14px;
}

/* ── Nav tabs ────────────────────────────────────────────────────────────── */
.nav-tabs {
  display: flex;
  gap: 4px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 4px;
}

.tab-btn {
  flex: 1;
  padding: 9px 12px;
  border: none;
  border-radius: 9px;
  background: transparent;
  color: var(--txt-dim);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background .18s, color .18s;
  line-height: 1;
}

.tab-btn.active {
  background: var(--bg-raised);
  color: var(--txt);
}

.tab-btn:active { opacity: .75; }

/* ── Upload area ─────────────────────────────────────────────────────────── */
.upload-area {
  position: relative;
  background: var(--bg-card);
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  min-height: 210px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  overflow: hidden;
  transition: border-color .2s, background .2s;
}

.upload-area:active { background: var(--bg-raised); }

.upload-area.has-image {
  border-style: solid;
  border-color: var(--accent);
  min-height: 0;
  cursor: default;
  align-items: flex-start;
}

.upload-area.drag-over {
  border-color: var(--accent-lt);
  background: rgba(79,70,229,.08);
}

.upload-placeholder {
  text-align: center;
  padding: 36px 24px;
  pointer-events: none;
}

.upload-icon { font-size: 52px; margin-bottom: 14px; }

.upload-text {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 5px;
}

.upload-subtext {
  font-size: 13px;
  color: var(--txt-dim);
}

/* ── Photo grid ──────────────────────────────────────────────────────────── */
.photo-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 12px;
  width: 100%;
}

.photo-thumb {
  position: relative;
  aspect-ratio: 1;
  border-radius: 10px;
  overflow: hidden;
  background: var(--bg-raised);
}

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

.thumb-remove {
  position: absolute;
  top: 4px;
  right: 4px;
  background: rgba(0,0,0,.72);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 22px;
  height: 22px;
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background .15s;
  line-height: 1;
}

.thumb-remove:active { background: var(--red); }

.photo-add-tile {
  aspect-ratio: 1;
  border-radius: 10px;
  border: 2px dashed var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  cursor: pointer;
  color: var(--txt-dim);
  transition: border-color .2s, background .2s;
  user-select: none;
}

.photo-add-tile:active { background: var(--bg-raised); border-color: var(--accent-lt); }

.photo-add-plus { font-size: 22px; line-height: 1; }
.photo-add-label { font-size: 11px; font-weight: 600; }

/* ── Camera / Gallery buttons ────────────────────────────────────────────── */
.capture-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 15px 20px;
  border: none;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: transform .15s, opacity .15s, box-shadow .2s;
  -webkit-appearance: none;
}

.btn:active:not(:disabled) { transform: scale(0.97); }

.btn-primary {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent2) 100%);
  color: #fff;
  box-shadow: 0 4px 22px rgba(79,70,229,.4);
}

.btn-primary:disabled {
  opacity: .38;
  box-shadow: none;
  cursor: not-allowed;
}

.btn-secondary {
  background: var(--bg-raised);
  color: var(--txt);
  border: 1px solid var(--border);
}

.btn-secondary:active { background: #22223a; }

.btn-outline {
  background: transparent;
  color: var(--accent-lt);
  border: 1px solid var(--accent);
  padding: 11px 18px;
  font-size: 14px;
  width: auto;
}

/* ── Fields ──────────────────────────────────────────────────────────────── */
.field-group {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.field-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .8px;
  text-transform: uppercase;
  color: var(--txt-dim);
}

.field-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.field-hint {
  font-size: 11px;
  color: var(--txt-dim);
  opacity: .7;
  margin-top: 2px;
}

/* ── Condition selector ──────────────────────────────────────────────────── */
.condition-select {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--txt);
  font-family: inherit;
  font-size: 15px;
  font-weight: 500;
  padding: 13px 36px 13px 14px;
  width: 100%;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='none' stroke='%238888a8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' d='M4 6l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px;
  transition: border-color .2s;
}

.condition-select:focus { border-color: var(--accent-lt); }

.condition-select option {
  background: var(--bg-card);
  color: var(--txt);
}

/* ── Mic button ──────────────────────────────────────────────────────────── */
.mic-btn {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 14px;
  transition: background .15s, transform .15s, box-shadow .2s;
  flex-shrink: 0;
}

.mic-btn:active { transform: scale(0.88); }

.mic-btn.listening {
  background: var(--red);
  border-color: var(--red);
  animation: micPulse 1.1s ease infinite;
}

@keyframes micPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239,68,68,.5); }
  55%       { box-shadow: 0 0 0 9px rgba(239,68,68,0); }
}

/* ── Starting price input ────────────────────────────────────────────────── */
.price-input-wrap {
  display: flex;
  align-items: center;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  transition: border-color .2s, box-shadow .2s;
}

.price-input-wrap:focus-within {
  border-color: var(--accent-lt);
}

.price-input-wrap.price-filled {
  border-color: var(--green);
  box-shadow: 0 0 0 2px rgba(16,185,129,.18);
}

.price-prefix {
  padding: 0 8px 0 14px;
  font-size: 20px;
  font-weight: 800;
  color: var(--green);
  user-select: none;
}

.price-input {
  background: transparent;
  border: none;
  color: var(--txt);
  font-family: inherit;
  font-size: 20px;
  font-weight: 700;
  padding: 13px 14px 13px 0;
  flex: 1;
  outline: none;
  min-width: 0;
}

.price-input::placeholder {
  color: var(--txt-dim);
  font-weight: 400;
  font-size: 15px;
}

/* ── Textarea ────────────────────────────────────────────────────────────── */
.textarea {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--txt);
  font-family: inherit;
  font-size: 15px;
  line-height: 1.5;
  padding: 13px 14px;
  resize: none;
  transition: border-color .2s;
}

.textarea:focus {
  outline: none;
  border-color: var(--accent-lt);
}

.textarea::placeholder { color: var(--txt-dim); }

/* ── Loading ─────────────────────────────────────────────────────────────── */
.loading-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 72px 24px;
  text-align: center;
  gap: 14px;
}

.spinner {
  width: 52px;
  height: 52px;
  border: 3px solid var(--border);
  border-top-color: var(--accent-lt);
  border-radius: 50%;
  animation: spin .75s linear infinite;
}

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

.loading-title {
  font-size: 19px;
  font-weight: 700;
}

.loading-sub {
  font-size: 14px;
  color: var(--txt-dim);
  line-height: 1.5;
}

.loading-steps {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 6px;
}

.step {
  font-size: 13px;
  color: var(--txt-dim);
  opacity: 0;
  animation: fadeStep .4s forwards;
}

.step:nth-child(1) { animation-delay: .8s; }
.step:nth-child(2) { animation-delay: 2.2s; }
.step:nth-child(3) { animation-delay: 4s; }

@keyframes fadeStep {
  to { opacity: 1; color: var(--accent-lt); }
}

/* ── Results ─────────────────────────────────────────────────────────────── */
.results-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 2px 0 4px;
}

.results-title {
  font-size: 20px;
  font-weight: 700;
}

.cards {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  opacity: 0;
  transform: translateY(12px);
  animation: slideUp .35s forwards;
}

.card:nth-child(1) { animation-delay: .04s; }
.card:nth-child(2) { animation-delay: .10s; }
.card:nth-child(3) { animation-delay: .16s; }
.card:nth-child(4) { animation-delay: .22s; }
.card:nth-child(5) { animation-delay: .28s; }
.card:nth-child(6) { animation-delay: .34s; }
.card:nth-child(7) { animation-delay: .40s; }

@keyframes slideUp {
  to { opacity: 1; transform: translateY(0); }
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.card-head-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.card-label {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1.1px;
  text-transform: uppercase;
  color: var(--accent-lt);
}

/* ── Edit button ─────────────────────────────────────────────────────────── */
.edit-btn {
  background: none;
  border: none;
  color: var(--txt-dim);
  font-size: 13px;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 6px;
  transition: background .15s, color .15s;
  line-height: 1;
}

.edit-btn:hover { background: var(--bg-raised); color: var(--accent-lt); }

.edit-btn.editing {
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  font-size: 12px;
  padding: 4px 8px;
}

.card-value[contenteditable="true"] {
  outline: none;
  border-radius: 8px;
  border: 1px solid var(--accent-lt);
  padding: 8px 10px;
  margin: -8px -10px;
  background: var(--bg-input);
  cursor: text;
}

/* ── Copy button ─────────────────────────────────────────────────────────── */
.copy-btn {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  color: var(--txt-dim);
  padding: 5px 14px;
  border-radius: 20px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all .2s;
}

.copy-btn.copied {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
}

.copy-btn:active { transform: scale(0.95); }

.card-value {
  font-size: 15px;
  line-height: 1.65;
  color: var(--txt);
  white-space: pre-wrap;
  word-break: break-word;
}

.card-value.is-title {
  font-size: 16px;
  font-weight: 600;
}

.card-value.is-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent2) 100%);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  padding: 5px 14px;
  border-radius: 20px;
  letter-spacing: .3px;
}

.card-value.is-badge::before { content: '🏷️'; }

.card-value.is-price {
  font-size: 32px;
  font-weight: 800;
  color: var(--green);
  letter-spacing: -.5px;
}

.card-sub {
  margin-top: 7px;
  font-size: 13px;
  color: var(--txt-dim);
  line-height: 1.55;
}

/* ── Platform share ──────────────────────────────────────────────────────── */
.platform-share-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 4px;
}

.platform-share-title {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--txt-dim);
}

.platform-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.platform-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 13px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--txt);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color .18s, background .18s, transform .12s;
  text-align: left;
}

.platform-btn:active { transform: scale(0.98); background: var(--bg-raised); }

.platform-btn.copied { border-color: var(--green); }

.platform-icon {
  font-size: 20px;
  line-height: 1;
  flex-shrink: 0;
}

.platform-name { flex: 1; }

.platform-copy-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--txt-dim);
  padding: 4px 12px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--bg-raised);
  transition: background .2s, border-color .2s, color .2s;
  flex-shrink: 0;
}

.platform-btn.copied .platform-copy-label {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
}

/* ── History ─────────────────────────────────────────────────────────────── */
.history-head {
  padding: 2px 0 4px;
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.history-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  cursor: pointer;
  transition: border-color .18s, background .18s;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.history-item:active {
  background: var(--bg-raised);
  border-color: var(--accent);
}

.history-item-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--txt);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.history-item-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: var(--txt-dim);
}

.history-price {
  font-size: 13px;
  font-weight: 700;
  color: var(--green);
}

.history-empty {
  text-align: center;
  padding: 56px 24px;
  color: var(--txt-dim);
  font-size: 15px;
  line-height: 1.6;
}

/* ── Toast ───────────────────────────────────────────────────────────────── */
#toast {
  position: fixed;
  bottom: max(28px, env(safe-area-inset-bottom, 28px));
  left: 50%;
  transform: translateX(-50%) translateY(0);
  background: var(--green);
  color: #fff;
  padding: 12px 26px;
  border-radius: 30px;
  font-size: 15px;
  font-weight: 700;
  white-space: nowrap;
  z-index: 999;
  pointer-events: none;
  animation: toastPop .3s cubic-bezier(.22,1,.36,1);
}

#toast.error { background: var(--red); }

@keyframes toastPop {
  from { opacity: 0; transform: translateX(-50%) translateY(14px) scale(.9); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
}

/* ── Responsive tweak for larger phones ─────────────────────────────────── */
@media (min-width: 390px) {
  .logo-text { font-size: 32px; }
}

/* ── Auth pages ──────────────────────────────────────────────────────────── */
.auth-page {
  min-height: 100svh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px calc(24px + env(safe-area-inset-bottom, 0px));
  background: var(--bg);
}

.auth-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px 24px;
  width: 100%;
  max-width: 400px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.auth-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.auth-title {
  font-size: 22px;
  font-weight: 700;
  text-align: center;
}

.auth-error {
  background: rgba(239, 68, 68, .14);
  border: 1px solid rgba(239, 68, 68, .4);
  color: #f87171;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  line-height: 1.5;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.auth-input {
  display: block;
  width: 100%;
  background: var(--bg-input);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--txt);
  font-size: 15px;
  padding: 12px 14px;
  outline: none;
  font-family: inherit;
  transition: border-color .18s;
  -webkit-appearance: none;
}

.auth-input:focus { border-color: var(--accent); }

.auth-submit { width: 100%; margin-top: 4px; }

.auth-link {
  text-align: center;
  font-size: 14px;
  color: var(--txt-dim);
}

.auth-link a {
  color: var(--accent-lt);
  text-decoration: none;
  font-weight: 600;
}

/* ── Header user / logout ────────────────────────────────────────────────── */
.header-user {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 12px;
}

.header-username {
  font-size: 13px;
  color: var(--txt-dim);
  font-weight: 500;
}

.btn-logout {
  font-size: 12px;
  font-weight: 600;
  color: var(--txt-dim);
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 5px 14px;
  cursor: pointer;
  font-family: inherit;
  transition: color .18s, border-color .18s;
}

.btn-logout:hover {
  color: var(--txt);
  border-color: var(--txt-dim);
}

/* ── eBay Post Section ───────────────────────────────────────────────────── */
.ebay-post-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 2px 0;
}

.ebay-post-meta {
  display: flex;
  align-items: center;
  gap: 10px;
}

.ebay-mode-tag {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .5px;
  text-transform: uppercase;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  color: var(--txt-dim);
  padding: 3px 8px;
  border-radius: 10px;
}

.ebay-settings-link {
  font-size: 12px;
  color: var(--accent-lt);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  font-family: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.btn-ebay {
  background: #f5a623;
  color: #111;
  font-weight: 700;
  width: 100%;
  font-size: 16px;
}

.btn-ebay:hover { background: #e09515; }

.btn-ebay:disabled {
  background: #c47d10;
  color: #555;
  opacity: .8;
}

.btn-ebay.ebay-posted {
  background: var(--green);
  color: #fff;
}

/* ── Modal ───────────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .72);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 200;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: var(--radius) var(--radius) 0 0;
  width: 100%;
  max-width: 480px;
  max-height: 92svh;
  overflow-y: auto;
  padding: 20px 20px calc(24px + env(safe-area-inset-bottom, 0px));
  display: flex;
  flex-direction: column;
  gap: 16px;
  animation: modalSlide .28s cubic-bezier(.22,1,.36,1);
}

.modal-compact { max-height: 70svh; }

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

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-head h3 {
  font-size: 18px;
  font-weight: 700;
}

.modal-close {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--txt);
  font-size: 14px;
  flex-shrink: 0;
  transition: background .15s;
}

.modal-close:hover { background: var(--bg-input); }

.modal-desc {
  font-size: 14px;
  color: var(--txt-dim);
  line-height: 1.55;
}

.modal-desc a {
  color: var(--accent-lt);
  text-decoration: none;
}

.modal-fields {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.modal-input {
  display: block;
  width: 100%;
  background: var(--bg-input);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--txt);
  font-size: 14px;
  padding: 10px 12px;
  outline: none;
  font-family: inherit;
  transition: border-color .18s;
}

.modal-input:focus { border-color: var(--accent); }

.modal-input::placeholder { color: var(--txt-dim); opacity: .7; }

.modal-textarea {
  resize: vertical;
  min-height: 76px;
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  font-size: 11px;
  line-height: 1.5;
}

.field-hint-inline {
  font-size: 11px;
  font-weight: 400;
  color: var(--txt-dim);
}

.modal-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* ── Toggle switch ───────────────────────────────────────────────────────── */
.toggle-row {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.toggle-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  user-select: none;
}

.toggle-wrap {
  position: relative;
  width: 48px;
  height: 28px;
  flex-shrink: 0;
}

.toggle-wrap input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-track {
  position: absolute;
  inset: 0;
  background: var(--bg-raised);
  border: 1.5px solid var(--border);
  border-radius: 14px;
  transition: background .2s, border-color .2s;
}

.toggle-track::before {
  content: '';
  position: absolute;
  left: 3px;
  top: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--txt-dim);
  transition: transform .2s, background .2s;
}

.toggle-wrap input:checked + .toggle-track {
  background: var(--accent);
  border-color: var(--accent);
}

.toggle-wrap input:checked + .toggle-track::before {
  transform: translateX(20px);
  background: #fff;
}

.toggle-hint {
  font-size: 12px;
  color: var(--txt-dim);
}

/* ── Success modal body ──────────────────────────────────────────────────── */
.modal-success-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 8px 0 4px;
  text-align: center;
}

.success-icon { font-size: 52px; line-height: 1; }

.success-detail {
  font-size: 14px;
  color: var(--txt-dim);
}

.success-note {
  font-size: 12px;
  color: var(--txt-dim);
  font-style: italic;
}

/* ── User menu dropdown ──────────────────────────────────────────────────── */
.user-menu {
  position: relative;
}

.user-menu-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  color: var(--txt-dim);
  font-weight: 500;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 5px 12px;
  cursor: pointer;
  font-family: inherit;
  transition: color .18s, border-color .18s;
}

.user-menu-btn:hover {
  color: var(--txt);
  border-color: var(--txt-dim);
}

.user-menu-caret {
  font-size: 10px;
  opacity: .65;
  margin-left: 2px;
}

.user-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  min-width: 168px;
  z-index: 100;
  box-shadow: var(--shadow);
  overflow: hidden;
  animation: dropdownFade .15s ease;
}

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

.user-dropdown-item {
  display: block;
  width: 100%;
  padding: 11px 16px;
  font-size: 14px;
  font-weight: 500;
  color: var(--txt);
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  text-decoration: none;
  text-align: left;
  transition: background .15s;
}

.user-dropdown-item:hover { background: var(--bg-raised); }

.user-dropdown-item--logout { color: var(--red); }

.user-dropdown-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 0;
}

/* ── eBay connected badge (header) ───────────────────────────────────────── */
.ebay-badge {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .3px;
  background: rgba(16, 185, 129, .12);
  border: 1px solid rgba(16, 185, 129, .38);
  color: var(--green);
  padding: 4px 10px;
  border-radius: 20px;
  white-space: nowrap;
}

/* ── eBay OAuth section (modal) ──────────────────────────────────────────── */
.ebay-oauth-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.oauth-divider-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.oauth-divider {
  flex: 1;
  border: none;
  border-top: 1px solid var(--border);
}

.oauth-divider-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .8px;
  text-transform: uppercase;
  color: var(--txt-dim);
  white-space: nowrap;
}

.ebay-oauth-connected-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(16, 185, 129, .08);
  border: 1px solid rgba(16, 185, 129, .28);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
}

.ebay-connected-badge {
  font-size: 13px;
  font-weight: 700;
  color: var(--green);
}

.btn-link-danger {
  background: none;
  border: none;
  color: var(--red);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  padding: 0;
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* ── Settings page ───────────────────────────────────────────────────────── */
.settings-page {
  max-width: 480px;
  margin: 0 auto;
  padding: 0 16px calc(env(safe-area-inset-bottom, 0px) + 48px);
}

.settings-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 0 16px;
}

.settings-back {
  font-size: 14px;
  color: var(--accent-lt);
  text-decoration: none;
  font-weight: 600;
}

.settings-back:hover { opacity: .8; }

.settings-nav-title {
  font-size: 16px;
  font-weight: 700;
}

.settings-flash {
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  line-height: 1.5;
  margin-bottom: 4px;
}

.settings-flash--success {
  background: rgba(16, 185, 129, .12);
  border: 1px solid rgba(16, 185, 129, .35);
  color: #34d399;
}

.settings-flash--error {
  background: rgba(239, 68, 68, .12);
  border: 1px solid rgba(239, 68, 68, .35);
  color: #f87171;
}

.settings-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 14px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.settings-card--danger { border-color: rgba(239, 68, 68, .3); }

.settings-section-title {
  font-size: 16px;
  font-weight: 700;
}

.settings-section-title--danger { color: var(--red); }

.settings-current-value {
  font-size: 13px;
  color: var(--txt-dim);
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
}

.settings-warning {
  background: rgba(251, 191, 36, .1);
  border: 1px solid rgba(251, 191, 36, .32);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 13px;
  color: #fbbf24;
  line-height: 1.5;
}

.settings-danger-desc {
  font-size: 13px;
  color: var(--txt-dim);
  line-height: 1.55;
}

.settings-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.auth-input--danger { border-color: rgba(239, 68, 68, .4); }
.auth-input--danger:focus { border-color: var(--red); }

.btn-danger {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 15px 20px;
  border: none;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  background: var(--red);
  color: #fff;
  transition: opacity .15s;
}

.btn-danger:hover { opacity: .88; }
