/* Tak-As Marketplace Web App */
:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-light: #dbeafe;
  --accent: #f59e0b;
  --success: #10b981;
  --danger: #ef4444;
  --bg: #f8fafc;
  --surface: #ffffff;
  --text: #0f172a;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(0,0,0,.08);
  --shadow-lg: 0 4px 16px rgba(0,0,0,.1);
  --nav-h: 60px;
  --topbar-h: 56px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

html[data-theme="dark"] {
  --bg: #0f172a;
  --surface: #1e293b;
  --text: #f8fafc;
  --text-muted: #94a3b8;
  --border: #64748b;
  --primary-light: #1e3a5f;
  --shadow: 0 1px 3px rgba(0,0,0,.35);
  color-scheme: dark;
}

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

[hidden] { display: none !important; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI',
    'Segoe UI Emoji', 'Apple Color Emoji', 'Noto Color Emoji', 'Twemoji Mozilla', sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  height: 100dvh;
}

.app {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  max-width: 480px;
  margin: 0 auto;
  background: var(--bg);
  position: relative;
}

/* Topbar */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--topbar-h);
  padding: 0 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  z-index: 10;
}
.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  font-size: 18px;
  color: var(--primary);
  cursor: pointer;
}
.brand-icon {
  width: 32px; height: 32px;
  background: var(--primary);
  color: #fff;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
}
.nav-item .nav-icon {
  font-size: 16px;
  line-height: 1;
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.nav-item.active .nav-icon {
  color: var(--primary);
}
.menu-item .menu-icon {
  font-size: 16px;
  width: 24px;
  text-align: center;
  color: var(--primary);
}
.auth-logo {
  width: 64px; height: 64px;
  background: var(--primary);
  color: #fff;
  border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  font-weight: 800;
  margin-bottom: 16px;
}
.empty-icon {
  font-size: 40px;
  margin-bottom: 8px;
  color: var(--text-muted);
}
.btn-icon i { pointer-events: none; }
.topbar-actions { display: flex; gap: 8px; align-items: center; }
.btn-icon {
  width: 36px; height: 36px;
  border: none; background: var(--bg);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: 18px;
  color: var(--text-muted);
  position: relative;
}
.notif-badge {
  position: absolute; top: 2px; right: 2px;
  min-width: 16px; height: 16px; padding: 0 4px;
  background: var(--danger); color: #fff;
  font-size: 10px; font-weight: 700; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
}

/* Screen */
.screen {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: calc(var(--nav-h) + var(--safe-bottom) + 8px);
}
.screen.no-nav { padding-bottom: 16px; }

/* Bottom Nav */
.bottom-nav:not([hidden]) {
  display: flex;
  position: fixed;
  bottom: 0; left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  height: calc(var(--nav-h) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  background: var(--surface);
  border-top: 1px solid var(--border);
  box-shadow: 0 -4px 16px rgba(15, 23, 42, .08);
  z-index: 30;
}
.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  border: none;
  background: transparent;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 500;
  padding: 6px 4px;
  margin: 4px 2px;
  border-radius: 12px;
  min-height: 48px;
  position: relative;
  transition: color .15s, background .15s, transform .1s;
  -webkit-tap-highlight-color: transparent;
}
.nav-item:active {
  transform: scale(0.94);
  background: var(--bg);
}
.nav-item.active {
  color: var(--primary);
  font-weight: 700;
  background: var(--primary-light);
}
.nav-item.active::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 28px;
  height: 3px;
  background: var(--primary);
  border-radius: 0 0 4px 4px;
}
.nav-item .nav-icon {
  font-size: 22px;
  line-height: 1;
  transition: transform .15s;
}
.nav-item.active .nav-icon {
  transform: scale(1.1);
}
.nav-item .nav-label {
  line-height: 1.1;
  letter-spacing: 0.01em;
}

.app-footer {
  text-align: center;
  padding: 10px 16px calc(var(--safe-bottom) + 8px);
  font-size: 11px;
  color: var(--text-muted);
  background: var(--bg);
  border-top: 1px solid var(--border);
}
.app-footer a {
  color: var(--text-muted);
  text-decoration: none;
  margin: 0 6px;
}
.app-footer a:hover { color: var(--primary); }
body:has(.bottom-nav:not([hidden])) .app-footer {
  display: none;
}
.legal-content { font-size: 14px; line-height: 1.6; }
.legal-content h2 { font-size: 18px; margin: 16px 0 8px; }

/* Page sections */
.page { padding: 16px; }
.page-title {
  font-size: 22px;
  font-weight: 800;
  margin-bottom: 4px;
}
.page-sub { color: var(--text-muted); font-size: 14px; margin-bottom: 16px; }

/* Search */
.search-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}
.search-input {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  background: var(--surface);
  color: var(--text);
  outline: none;
}
.search-input::placeholder { color: var(--text-muted); opacity: 1; }
.search-input:focus { border-color: var(--primary); }

/* Category chips */
.chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  margin-bottom: 16px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex-shrink: 0;
  padding: 6px 14px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: all .15s;
}
.chip.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

/* Item grid */
.item-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.item-card {
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform .15s, box-shadow .15s;
  position: relative;
}
.fav-btn {
  position: absolute; top: 8px; right: 8px; z-index: 2;
  width: 32px; height: 32px; border: none; border-radius: 50%;
  background: rgba(255,255,255,.92); font-size: 16px; cursor: pointer;
  box-shadow: 0 1px 4px rgba(0,0,0,.12);
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--text-muted);
}
.fav-btn i { pointer-events: none; }
.fav-btn.on { color: #ef4444; }
.filter-row {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 12px;
}
.filter-row select { font-size: 13px; }
.notif-item {
  padding: 12px; border-radius: var(--radius); background: var(--surface);
  box-shadow: var(--shadow); margin-bottom: 8px; font-size: 13px;
}
.notif-item.unread { border-left: 3px solid var(--primary); }
.item-card:active { transform: scale(.97); }
.item-card-img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  background: var(--border);
  display: block;
}
.item-card-img.placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  color: var(--text-muted);
}
.item-card-body { padding: 10px; }
.item-card-title {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 4px;
}
.item-card-meta {
  font-size: 11px;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.item-card-status {
  font-size: 11px;
  color: var(--primary);
  margin-bottom: 4px;
  font-weight: 600;
}
.listing-owner-panel {
  margin-top: 12px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-2, rgba(0,0,0,.02));
}
.listing-status-line {
  font-size: 13px;
  margin-bottom: 6px;
}
.item-card-price {
  font-size: 13px;
  font-weight: 700;
  color: var(--primary);
}
.trade-badge {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
  background: var(--primary-light);
  color: var(--primary);
}

/* Item detail */
.detail-img {
  width: 100%;
  aspect-ratio: 4/3;
  object-fit: cover;
  background: var(--border);
  border-radius: var(--radius);
  margin-bottom: 16px;
}
.detail-img.placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 48px;
  color: var(--text-muted);
}
.detail-gallery { margin-bottom: 16px; }
.detail-thumbs {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
}
.detail-thumb {
  width: 64px;
  height: 64px;
  object-fit: cover;
  border-radius: 8px;
  border: 2px solid transparent;
  cursor: pointer;
  flex-shrink: 0;
}
.detail-thumb.active { border-color: var(--primary); }
.detail-title { font-size: 20px; font-weight: 800; margin-bottom: 8px; }
.detail-price { font-size: 22px; font-weight: 800; color: var(--primary); margin-bottom: 12px; }
.detail-info {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}
.info-tag {
  padding: 4px 10px;
  border-radius: 6px;
  background: var(--bg);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
}
.detail-desc {
  font-size: 14px;
  line-height: 1.6;
  color: var(--text);
  margin-bottom: 20px;
}
.detail-owner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  background: var(--surface);
  border-radius: var(--radius);
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}
.owner-avatar {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--primary-light);
  color: var(--primary);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 16px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px 20px;
  border: none;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s;
  width: 100%;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:active { background: var(--primary-dark); }
.btn-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
}
.btn-accent { background: var(--accent); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-sm { padding: 8px 14px; font-size: 13px; width: auto; }
.btn-group { display: flex; gap: 8px; margin-top: 12px; }
.btn-group .btn { flex: 1; }

/* Forms */
.form-group { margin-bottom: 14px; }
.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 4px;
  color: var(--text);
}
.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  background: var(--surface);
  color: var(--text);
  outline: none;
  font-family: inherit;
}
.form-input::placeholder,
.form-textarea::placeholder {
  color: var(--text-muted);
  opacity: 1;
}
.form-select {
  appearance: auto;
  -webkit-appearance: menulist;
  cursor: pointer;
  background-color: var(--surface);
  color: var(--text);
}
.form-select option,
.form-select optgroup {
  background: var(--surface);
  color: var(--text);
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--primary);
}
.form-textarea { resize: vertical; min-height: 80px; }

/* Native text fields / selects that might miss form-* class */
input[type="text"],
input[type="search"],
input[type="email"],
input[type="password"],
input[type="tel"],
input[type="number"],
input[type="url"],
input:not([type]),
select,
textarea {
  color: var(--text);
  background-color: var(--surface);
}
input[type="text"]::placeholder,
input[type="search"]::placeholder,
input[type="email"]::placeholder,
input[type="password"]::placeholder,
input[type="tel"]::placeholder,
input[type="number"]::placeholder,
input[type="url"]::placeholder,
input:not([type])::placeholder,
textarea::placeholder {
  color: var(--text-muted);
  opacity: 1;
}

/* Auth */
.auth-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: calc(100dvh - var(--topbar-h) - var(--footer-h, 48px));
  padding: 24px 20px 40px;
}
.auth-logo {
  width: 64px; height: 64px;
  background: var(--primary);
  color: #fff;
  border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  font-size: 28px;
  font-weight: 800;
  margin-bottom: 16px;
}
.auth-title { font-size: 24px; font-weight: 800; margin-bottom: 4px; }
.auth-sub { color: var(--text-muted); font-size: 14px; margin-bottom: 24px; }
.auth-form { width: 100%; max-width: 340px; }
.auth-form .btn-primary { margin-top: 4px; }
.auth-link {
  text-align: center;
  margin-top: 14px;
  font-size: 14px;
  color: var(--text-muted);
}
.auth-link a { color: var(--primary); font-weight: 600; text-decoration: none; }

/* Packages */
.package-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
  border: 2px solid transparent;
  cursor: pointer;
  transition: border-color .15s;
}
.package-card:hover { border-color: var(--primary-light); }
.package-card.featured { border-color: var(--primary); }
.package-card.subscription { border-color: #7c3aed; background: linear-gradient(180deg, #faf5ff 0%, var(--surface) 40%); }
.package-tag {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .03em;
  color: #6d28d9;
  background: #ede9fe;
  padding: 3px 8px;
  border-radius: 6px;
  margin-bottom: 8px;
}
.sub-badge {
  font-size: 10px;
  font-weight: 700;
  background: #ede9fe;
  color: #6d28d9;
  padding: 2px 6px;
  border-radius: 6px;
  margin-left: 4px;
}
.sub-banner {
  padding: 12px 14px;
  border-radius: var(--radius);
  margin-bottom: 14px;
  font-size: 13px;
}
.sub-banner.active {
  background: #ede9fe;
  border: 1px solid #c4b5fd;
  color: #5b21b6;
}
.sub-banner.expired {
  background: #f1f5f9;
  border: 1px solid var(--border);
  color: var(--text-muted);
}
.sub-banner-title { font-weight: 700; margin-bottom: 2px; }
.sub-banner-sub { font-size: 12px; opacity: .9; }
.package-title { font-size: 16px; font-weight: 700; margin-bottom: 4px; }
.package-desc { font-size: 13px; color: var(--text-muted); margin-bottom: 8px; }
.package-price { font-size: 22px; font-weight: 800; color: var(--primary); }
.package-meta { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

/* Offers list */
.offer-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 10px;
  box-shadow: var(--shadow);
}
.offer-status {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
}
.offer-status.pending { background: #fef3c7; color: #92400e; }
.offer-status.accepted { background: #d1fae5; color: #065f46; }
.offer-status.rejected { background: #fee2e2; color: #991b1b; }
.offer-status.shipped { background: #dbeafe; color: #1e40af; }
.offer-status.delivered { background: #e0e7ff; color: #3730a3; }
.offer-status.completed { background: #d1fae5; color: #065f46; }
.offer-status.cancelled { background: #f1f5f9; color: #475569; }

.offer-status-chips { margin-top: 8px; margin-bottom: 4px; }
.chip-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  margin-left: 4px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  background: rgba(0,0,0,.08);
}
.chip.active .chip-count { background: rgba(255,255,255,.25); }

.offer-status-hint {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
  line-height: 1.35;
  max-width: 220px;
}

.offer-card-highlight {
  border-left: 3px solid var(--primary);
}
.offer-card-completed { border-left-color: #059669; }
.offer-card-accepted { border-left-color: #2563eb; }
.offer-card-shipped { border-left-color: #1d4ed8; }
.offer-card-delivered { border-left-color: #7c3aed; }

/* Trade timeline */
.trade-timeline {
  margin: 0 0 16px;
  padding: 14px 14px 4px;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.tl-item {
  display: flex;
  gap: 12px;
  padding-bottom: 14px;
  position: relative;
}
.tl-item:not(:last-child)::before {
  content: '';
  position: absolute;
  left: 7px;
  top: 18px;
  bottom: 0;
  width: 2px;
  background: var(--border);
}
.tl-item.done::before { background: var(--success); opacity: .35; }
.tl-item.done.success::before { background: var(--success); opacity: .5; }
.tl-item.active::before { background: linear-gradient(var(--primary), var(--border)); }
.tl-dot {
  width: 16px; height: 16px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: var(--surface);
  flex-shrink: 0;
  margin-top: 2px;
  z-index: 1;
}
.tl-item.done .tl-dot { border-color: var(--success); background: var(--success); }
.tl-item.done.error .tl-dot { border-color: var(--danger); background: var(--danger); }
.tl-item.done.muted .tl-dot { border-color: var(--text-muted); background: var(--text-muted); }
.tl-item.active .tl-dot { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light); }
.tl-item.pending .tl-dot { border-color: var(--border); }
.tl-label { font-size: 14px; font-weight: 600; }
.tl-sub { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.tl-date { font-size: 11px; color: var(--text-muted); margin-top: 3px; }

.payment-pending-banner {
  padding: 12px 14px;
  margin-bottom: 12px;
  background: var(--primary-light);
  border: 1px solid #bfdbfe;
  border-radius: var(--radius);
  font-size: 13px;
  color: #1e40af;
  display: flex;
  align-items: center;
  gap: 10px;
}
.payment-pending-banner .spinner {
  width: 18px; height: 18px;
  border-width: 2px;
  flex-shrink: 0;
}

.addr-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-muted);
}
.empty-icon { font-size: 48px; margin-bottom: 12px; }
.empty-title { font-size: 16px; font-weight: 600; margin-bottom: 4px; color: var(--text); }
.empty-sub { font-size: 14px; margin-bottom: 16px; }

/* Toast & alerts */
.toast {
  position: fixed;
  top: calc(var(--safe-top, 0px) + 72px);
  left: 50%;
  transform: translateX(-50%);
  color: #fff;
  padding: 14px 22px;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 600;
  z-index: 200;
  max-width: 92%;
  text-align: center;
  box-shadow: 0 8px 24px rgba(0,0,0,.2);
  animation: toastIn .3s ease;
}
.toast-success { background: #16a34a; }
.toast-error { background: #dc2626; }
.toast-warning { background: #d97706; }
.toast-info { background: #2563eb; }

.page-alert {
  margin: 12px 0 16px;
  padding: 14px 16px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.5;
  border: 1px solid transparent;
}
.page-alert-success { background: #ecfdf5; border-color: #86efac; color: #166534; }
.page-alert-error { background: #fef2f2; border-color: #fecaca; color: #991b1b; }
.page-alert-warning { background: #fffbeb; border-color: #fde68a; color: #92400e; }
.page-alert-info { background: #eff6ff; border-color: #bfdbfe; color: #1e40af; }

.modal-alert {
  padding: 24px 20px;
  text-align: center;
  max-width: 360px;
  margin: 0 auto;
}
.modal-alert-icon {
  width: 48px; height: 48px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; font-weight: 700; margin: 0 auto 12px;
}
.modal-alert-success .modal-alert-icon { background: #dcfce7; color: #16a34a; }
.modal-alert-error .modal-alert-icon { background: #fee2e2; color: #dc2626; }
.modal-alert-info .modal-alert-icon { background: #dbeafe; color: #2563eb; }
.modal-alert-title { font-size: 18px; font-weight: 700; margin-bottom: 8px; }
.modal-alert-msg { font-size: 14px; color: var(--text-muted); margin-bottom: 16px; white-space: pre-wrap; }

/* Centered app dialogs */
.app-dialog-overlay:not([hidden]) {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, .55);
  z-index: 120;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  backdrop-filter: blur(2px);
}
.app-dialog-overlay[hidden] { display: none !important; }
.app-dialog { width: 100%; max-width: 380px; animation: dialogIn .2s ease; }
@keyframes dialogIn {
  from { opacity: 0; transform: scale(.96) translateY(8px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}
.app-dialog-card {
  background: var(--surface);
  border-radius: 16px;
  padding: 22px 20px 18px;
  box-shadow: 0 20px 50px rgba(0,0,0,.25);
  text-align: center;
}
.app-dialog-icon {
  width: 52px; height: 52px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; font-weight: 800; margin: 0 auto 12px;
}
.app-dialog-success .app-dialog-icon { background: #dcfce7; color: #16a34a; }
.app-dialog-error .app-dialog-icon { background: #fee2e2; color: #dc2626; }
.app-dialog-warning .app-dialog-icon { background: #fef3c7; color: #d97706; }
.app-dialog-info .app-dialog-icon, .app-dialog-question .app-dialog-icon { background: #dbeafe; color: #2563eb; }
.app-dialog-title { font-size: 18px; font-weight: 800; margin: 0 0 8px; }
.app-dialog-msg { font-size: 14px; color: var(--text-muted); margin: 0 0 16px; white-space: pre-wrap; line-height: 1.5; }
.app-dialog-actions { display: flex; gap: 8px; }
.app-dialog-actions .btn { flex: 1; }
.app-dialog-list {
  list-style: none; margin: 0 0 14px; padding: 0; text-align: left;
  max-height: 220px; overflow-y: auto;
}
.app-dialog-list li {
  padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px;
  margin-bottom: 8px; font-size: 14px; background: var(--bg);
}
@keyframes toastIn {
  from { opacity: 0; transform: translateX(-50%) translateY(10px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* Overlay / Sheet */
.overlay:not([hidden]) {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 50;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  max-width: 480px;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
}
.overlay[hidden] {
  pointer-events: none;
}
.sheet {
  background: var(--surface);
  border-radius: 16px 16px 0 0;
  width: 100%;
  max-width: 480px;
  max-height: 85dvh;
  overflow-y: auto;
  padding: 20px;
  animation: sheetUp .25s ease;
}
@keyframes sheetUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}
.sheet-title {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 16px;
}

/* Credits badge */
.credits-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  background: var(--primary-light);
  color: var(--primary);
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}

/* Loading */
.spinner {
  display: flex;
  justify-content: center;
  padding: 32px;
}
.spinner::after {
  content: '';
  width: 28px; height: 28px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Profile */
.profile-header {
  text-align: center;
  padding: 24px 16px;
  background: var(--surface);
  border-radius: var(--radius);
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}
.profile-avatar {
  width: 72px; height: 72px;
  border-radius: 50%;
  background: var(--primary-light);
  color: var(--primary);
  display: flex; align-items: center; justify-content: center;
  font-size: 28px; font-weight: 800;
  margin: 0 auto 12px;
}
.profile-name { font-size: 18px; font-weight: 700; }
.profile-email { font-size: 13px; color: var(--text-muted); }
.menu-list { list-style: none; }
.menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--surface);
  border-radius: var(--radius);
  margin-bottom: 8px;
  cursor: pointer;
  box-shadow: var(--shadow);
  font-size: 14px;
  font-weight: 500;
}
.menu-item .menu-icon { font-size: 20px; width: 24px; text-align: center; }
.menu-item .menu-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.menu-item .menu-title { font-size: 14px; font-weight: 600; color: var(--text); line-height: 1.25; }
.menu-item .menu-sub { font-size: 12px; font-weight: 400; color: var(--text-muted); line-height: 1.3; }
.menu-item .menu-arrow { margin-left: auto; color: var(--text-muted); }

/* Image upload preview */
.img-preview-grid {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.img-preview {
  width: 72px; height: 72px;
  border-radius: 8px;
  object-fit: cover;
  border: 1px solid var(--border);
}
.img-preview-wrap {
  position: relative;
  width: 72px;
  height: 72px;
  flex-shrink: 0;
}
.img-preview-wrap .img-preview {
  width: 100%;
  height: 100%;
}
.img-preview-remove {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: none;
  background: var(--danger, #ef4444);
  color: #fff;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}
.img-upload-btn {
  width: 72px; height: 72px;
  border: 2px dashed var(--border);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 24px;
  color: var(--text-muted);
}

/* Address picker (ürün ekleme) */
.address-picker-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  gap: 8px;
}
.address-picker-head .form-label { margin: 0; }
.address-picker-list { display: flex; flex-direction: column; gap: 10px; }
.address-pick-card {
  display: flex;
  gap: 12px;
  padding: 14px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.address-pick-card.selected {
  border-color: var(--primary);
  background: var(--primary-light);
}
.address-pick-radio {
  font-size: 18px;
  color: var(--primary);
  line-height: 1.2;
  flex-shrink: 0;
}
.address-pick-title { font-weight: 700; font-size: 14px; margin-bottom: 4px; }
.address-pick-line { font-size: 13px; line-height: 1.45; }
.address-pick-line.muted { color: var(--text-muted); }
.empty-address-hint {
  padding: 16px;
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}

.guest-banner {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 16px; margin-bottom: 16px;
  background: var(--primary-light); border-radius: var(--radius);
  border: 1px solid #bfdbfe;
}

.btn-outline {
  background: transparent; color: var(--primary); border: 1px solid var(--primary);
}

.trust-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #22c55e;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  margin-left: 4px;
  vertical-align: middle;
}

#mapContainer {
  position: relative;
  z-index: 1;
}
#mapContainer .leaflet-container {
  height: 100%;
  width: 100%;
  background: var(--surface);
}

.mode-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}
.mode-tab {
  flex: 1;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text-muted);
  font-weight: 600;
  cursor: pointer;
}
.mode-tab.active {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-light);
}
.spec-input-row {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 8px;
  margin-bottom: 8px;
}
.specs-table {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-top: 8px;
}
.spec-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}
.spec-row:last-child { border-bottom: none; }
.spec-key { color: var(--text-muted); }
.spec-val { font-weight: 600; text-align: right; }
.detail-section { margin: 16px 0; }
.section-title { font-size: 15px; font-weight: 700; margin-bottom: 8px; }
.review-card {
  padding: 12px;
  background: var(--surface);
  border-radius: var(--radius);
  margin-bottom: 8px;
  box-shadow: var(--shadow);
}
.review-head { font-size: 14px; }
.review-body { font-size: 13px; margin-top: 6px; line-height: 1.5; }
.review-date { font-size: 11px; color: var(--text-muted); margin-top: 6px; }
.star-picker { display: flex; gap: 4px; margin: 8px 0; }
.star-btn {
  border: none;
  background: none;
  font-size: 22px;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0 2px;
  line-height: 1;
}
.star-btn i { pointer-events: none; }
.star-btn.on, .star-btn:hover { color: #f59e0b; }
.qty-badge, .qty-tag {
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 6px;
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 700;
}
.detail-rating { margin-bottom: 8px; color: #f59e0b; font-size: 15px; }
.profile-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
  font-size: 12px;
  color: var(--text-muted);
}
.profile-stats span {
  padding: 4px 8px;
  background: var(--surface);
  border-radius: 8px;
}
.profile-bio {
  margin-top: 10px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
}

.hidden { display: none !important; }

/* Offer detail — tabbed layout */
.offer-detail-page {
  display: flex;
  flex-direction: column;
  padding-bottom: 8px;
  min-height: calc(100dvh - 120px);
}
.offer-detail-head {
  flex-shrink: 0;
  margin-bottom: 12px;
}
.offer-detail-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
}
.offer-complaint-btn {
  color: var(--danger) !important;
  border-color: #fecaca !important;
  flex-shrink: 0;
}
.offer-quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}
.offer-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 12px;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--bg);
  padding: 4px 0;
}
.offer-tab {
  flex: 1;
  padding: 10px 8px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  position: relative;
}
.offer-tab.active {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-light);
}
.tab-badge {
  position: absolute;
  top: 4px;
  right: 6px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--danger);
}
.offer-tab-panels {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.offer-chat-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 420px;
}
.offer-chat-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  font-weight: 600;
  font-size: 14px;
}
.offer-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 8px 4px;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  min-height: 300px;
  max-height: calc(100dvh - 340px);
}
.offer-chat-empty {
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
  padding: 32px 16px;
}
.chat-bubble {
  margin-bottom: 10px;
  padding: 10px 12px;
  background: var(--bg);
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.45;
}
.chat-bubble.system {
  background: #fff7ed;
  border-left: 3px solid #f59e0b;
  color: #92400e;
}
.chat-meta {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.offer-chat-compose {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.offer-chat-compose .form-input { flex: 1; }
.offer-chat-compose .btn { width: auto; flex-shrink: 0; padding-left: 16px; padding-right: 16px; }
.offer-details-panel,
.offer-process-panel {
  padding-bottom: 16px;
}
.offer-product-block {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow);
}
.offer-product-row {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}
.offer-product-thumb {
  width: 72px;
  height: 72px;
  border-radius: 10px;
  object-fit: cover;
  flex-shrink: 0;
}
.offer-product-thumb.placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--border);
  font-size: 28px;
}
.offer-product-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text-muted);
  font-weight: 600;
}
.offer-product-title {
  font-size: 16px;
  font-weight: 700;
  margin-top: 2px;
}
.offer-product-link {
  font-size: 12px;
  color: var(--primary);
  display: inline-block;
  margin-top: 4px;
}
.offer-product-extra {
  margin-top: 10px;
  font-size: 13px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}
.offer-product-extra span {
  color: var(--text-muted);
  margin-right: 6px;
}
.offer-product-price {
  margin-top: 10px;
  font-size: 18px;
  font-weight: 800;
  color: var(--primary);
}
.offer-product-message {
  margin-top: 10px;
  font-size: 13px;
  padding: 10px;
  background: var(--bg);
  border-radius: 8px;
  line-height: 1.5;
}
.offer-detail-exchange {
  display: grid;
  gap: 10px;
}
.offer-exchange-arrow {
  text-align: center;
  font-size: 20px;
  color: var(--primary);
  font-weight: 700;
}
.offer-terms-summary {
  margin-top: 12px;
  padding: 10px 12px;
  background: #eff6ff;
  border-radius: 8px;
  font-size: 14px;
}
.offer-terms-summary-label {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.offer-payment-line {
  margin-top: 10px;
  padding: 10px 12px;
  background: #fef3c7;
  border: 1px solid #fcd34d;
  border-radius: 8px;
  font-size: 13px;
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
}
.payment-obligation-banner {
  border-left: 3px solid var(--primary);
}
.offer-product-warn {
  margin-top: 10px;
  font-size: 12px;
  color: #b45309;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 8px;
  padding: 8px 10px;
}
.offer-terms-badge {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 8px;
  padding: 8px 10px;
  background: var(--bg);
  border-radius: 8px;
}
.offer-terms-thumb {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  object-fit: cover;
}
.offer-terms-icon { font-size: 22px; }
.offer-terms-label {
  font-size: 10px;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 600;
}
.offer-terms-value {
  font-size: 13px;
  font-weight: 700;
  color: var(--primary);
}
.process-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 10px;
  box-shadow: var(--shadow);
}
.process-card.highlight {
  border: 1px solid var(--primary);
}
.process-card.success {
  border: 1px solid #86efac;
  background: #ecfdf5;
}
.process-card.warn {
  border: 1px solid #fde68a;
  background: #fffbeb;
}
.process-card-title {
  font-weight: 700;
  font-size: 15px;
  margin-bottom: 6px;
}
.process-card-desc {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 10px;
}
.process-card.actions .btn-group {
  margin-top: 4px;
}
.process-guide {
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 12px;
  font-size: 13px;
  line-height: 1.55;
}
.process-guide p { margin: 0 0 8px; color: var(--text-muted); }
.process-guide p:last-child { margin-bottom: 0; }
.process-guide-title {
  font-weight: 700;
  font-size: 14px;
  margin-bottom: 8px;
  color: var(--text);
}
.process-guide.highlight {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
}
.process-guide.info {
  background: var(--surface);
  border: 1px solid var(--border);
}
.process-guide.success {
  background: #ecfdf5;
  border: 1px solid #86efac;
}
.process-guide-meta {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 6px !important;
}
.process-action-block { margin-top: 4px; }
.process-action-block.with-divider {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px dashed var(--border);
}
.process-action-label {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--primary);
  margin-bottom: 6px;
}
.trade-step-bar {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
}
.trade-step-bar-head { font-size: 14px; margin-bottom: 10px; }
.trade-step-track {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}
.trade-step-node {
  text-align: center;
  font-size: 11px;
  color: var(--text-muted);
}
.trade-step-node span {
  display: inline-flex;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  align-items: center;
  justify-content: center;
  background: var(--border);
  font-weight: 700;
  margin-bottom: 4px;
}
.trade-step-node.active span { background: var(--primary); color: #fff; }
.trade-step-node.done span { background: #059669; color: #fff; }
.trade-step-blocker {
  margin-top: 10px;
  font-size: 13px;
  color: #b45309;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 8px;
  padding: 8px 10px;
}
.shipment-status {
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--bg);
  margin-top: 8px;
}
.shipment-status.done { border-left: 3px solid #059669; }
.shipment-status.pending { border-left: 3px solid #f59e0b; }
.shipment-status-title { font-weight: 600; font-size: 13px; }
.shipment-status-meta { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.process-card.info { border: 1px solid #bfdbfe; background: #eff6ff; }
.cooling-pay-card .cooling-pay-wait {
  text-align: center;
  margin: 12px 0 14px;
  padding: 12px;
  border-radius: var(--radius);
  background: rgba(245, 158, 11, 0.12);
  border: 1px dashed rgba(245, 158, 11, 0.45);
}
.cooling-pay-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: 100%;
  min-height: 52px;
}
.cooling-pay-timer-inline {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.08em;
  font-variant-numeric: tabular-nums;
  color: #fef3c7;
  line-height: 1.1;
}
.cooling-pay-btn-label {
  font-size: 14px;
  font-weight: 600;
}
.cooling-pay-timer {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: 0.06em;
  font-variant-numeric: tabular-nums;
  color: #b45309;
}
.cooling-pay-hint {
  margin-top: 6px;
  font-size: 13px;
  color: var(--text-muted);
}
.cooling-pay-card .btn[disabled] {
  opacity: 0.55;
  cursor: not-allowed;
}
