:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --secondary: #64748b;
  --success: #16a34a;
  --warning: #d97706;
  --danger: #dc2626;
  --bg: #f1f5f9;
  --card: #ffffff;
  --text: #0f172a;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
  --radius: 12px;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
}

.screen {
  display: none;
  min-height: 100vh;
}

.screen.active {
  display: block;
}

/* ===== LOGIN ===== */
#login-screen {
  display: none;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 100%);
  padding: 20px;
}

#login-screen.active {
  display: flex;
}

.login-card {
  background: white;
  border-radius: 20px;
  padding: 32px 28px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 25px 50px -12px rgba(0,0,0,0.25);
}

.logo {
  text-align: center;
  margin-bottom: 8px;
}

.logo i {
  font-size: 42px;
  color: var(--primary);
  margin-bottom: 8px;
}

.logo h1 {
  font-size: 28px;
  font-weight: 700;
  color: var(--text);
}

.subtitle {
  text-align: center;
  color: var(--text-muted);
  margin-bottom: 28px;
  font-size: 15px;
}

.role-selector {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.role-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 16px 12px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  background: white;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 14px;
  color: var(--text);
}

.role-btn i {
  font-size: 24px;
  color: var(--secondary);
}

.role-btn.active {
  border-color: var(--primary);
  background: #eff6ff;
  color: var(--primary);
}

.role-btn.active i {
  color: var(--primary);
}

.hint {
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 16px;
}

/* ===== HEADER ===== */
.header {
  background: white;
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 18px;
  color: var(--primary);
}

.header-left i {
  font-size: 22px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
}

#user-info {
  color: var(--text-muted);
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.icon-btn {
  background: none;
  border: none;
  font-size: 18px;
  color: var(--secondary);
  cursor: pointer;
  padding: 6px;
  border-radius: 8px;
}

.icon-btn:hover {
  background: var(--bg);
  color: var(--danger);
}

/* ===== TABS ===== */
.tabs {
  display: flex;
  flex-wrap: nowrap;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
  background: white;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 53px;
  z-index: 99;
  width: 100%;
  max-width: 100vw;
}

.tabs::-webkit-scrollbar {
  display: none;
}

.tab {
  flex: 1 0 auto;
  min-width: 72px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 12px;
  border: none;
  background: none;
  font-size: 11px;
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.2s;
  white-space: nowrap;
}

.tab i {
  font-size: 18px;
}

.tab.active {
  color: var(--primary);
  border-bottom: 2px solid var(--primary);
}

#admin-screen .tab {
  min-width: 64px;
  padding: 10px 10px;
  font-size: 10px;
}

/* Prevent page horizontal shake */
html, body {
  overflow-x: hidden;
  max-width: 100%;
  overscroll-behavior-x: none;
}

#app, .screen {
  overflow-x: hidden;
  max-width: 100vw;
}

/* ===== CONTENT ===== */
.content {
  padding: 16px;
  padding-bottom: 90px;
  max-width: 800px;
  margin: 0 auto;
  overflow-x: hidden;
  width: 100%;
  box-sizing: border-box;

  width: 100%;
  box-sizing: border-box;
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

.filters {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 8px;
  margin-bottom: 16px;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.filters input {
  width: 100%;
  min-width: 0;
  padding: 10px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  box-sizing: border-box;
}

.filters .btn {
  flex-shrink: 0;
  min-width: 42px;
  padding: 10px 12px;
}

@media (max-width: 360px) {
  .filters {
    grid-template-columns: 1fr 1fr;
  }
  .filters .btn {
    grid-column: 1 / -1;
  }
}

/* ===== CARDS ===== */
.cards-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.card {
  background: white;
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

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

.card-route {
  font-size: 17px;
  font-weight: 600;
  color: var(--text);
}

.card-route i {
  color: var(--primary);
  font-size: 14px;
  margin: 0 6px;
}

.card-price {
  font-size: 18px;
  font-weight: 700;
  color: var(--success);
  white-space: nowrap;
}

.card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.card-meta span {
  display: flex;
  align-items: center;
  gap: 4px;
}

.card-cargo {
  font-size: 14px;
  margin-bottom: 12px;
  color: var(--text);
}

.card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.card-author {
  font-size: 13px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.rating-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #fef3c7;
  color: #92400e;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}

.rating-badge i {
  color: #f59e0b;
  font-size: 11px;
}

.status-badge {
  font-size: 12px;
  padding: 3px 10px;
  border-radius: 20px;
  font-weight: 500;
}

.status-open { background: #dbeafe; color: #1e40af; }
.status-in_progress { background: #fef3c7; color: #92400e; }
.status-completed { background: #dcfce7; color: #166534; }
.status-cancelled { background: #fee2e2; color: #991b1b; }

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 18px;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-primary {
  background: var(--primary);
  color: white;
}

.btn-primary:hover {
  background: var(--primary-dark);
}

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

.btn-success {
  background: var(--success);
  color: white;
}

.btn-warning {
  background: var(--warning);
  color: white;
}

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

.btn-sm {
  padding: 6px 12px;
  font-size: 13px;
}

.btn-block {
  width: 100%;
}

.btn-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ===== FAB ===== */
.fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  border: none;
  font-size: 24px;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.4);
  cursor: pointer;
  z-index: 50;
  display: none;
  align-items: center;
  justify-content: center;
}

.fab.visible {
  display: flex;
}

.fab:hover {
  background: var(--primary-dark);
  transform: scale(1.05);
}

/* ===== FORMS ===== */
.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 6px;
  color: var(--text);
}

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 15px;
  font-family: inherit;
  transition: border-color 0.15s;
}

.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.static-value {
  font-weight: 600;
  font-size: 16px;
  padding: 8px 0;
}

/* ===== MODAL ===== */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 200;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
}

.modal.active {
  display: flex;
}

.modal-content {
  background: white;
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  border-radius: 20px 20px 0 0;
  padding: 24px;
  animation: slideUp 0.25s ease;
}

.modal-lg {
  max-width: 600px;
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.modal-header h2 {
  font-size: 20px;
}

.close-modal {
  background: none;
  border: none;
  font-size: 28px;
  color: var(--text-muted);
  cursor: pointer;
  line-height: 1;
}

/* ===== STAR RATING ===== */
.star-rating {
  display: flex;
  gap: 8px;
  font-size: 32px;
  color: #d1d5db;
  cursor: pointer;
}

.star-rating i {
  transition: color 0.15s, transform 0.15s;
}

.star-rating i:hover,
.star-rating i.active {
  color: #f59e0b;
}

.star-rating i:hover {
  transform: scale(1.15);
}

/* ===== RATINGS LIST ===== */
.driver-card {
  display: flex;
  align-items: center;
  gap: 16px;
}

.driver-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: linear-gradient(135deg, #3b82f6, #1d4ed8);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 600;
  flex-shrink: 0;
}

.driver-info {
  flex: 1;
}

.driver-name {
  font-weight: 600;
  font-size: 16px;
  margin-bottom: 4px;
}

.driver-stats {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  color: var(--text-muted);
}

.stars-display {
  color: #f59e0b;
  letter-spacing: 1px;
}

.review-item {
  background: #f8fafc;
  border-radius: 8px;
  padding: 12px;
  margin-top: 10px;
  border-left: 3px solid #f59e0b;
}

.review-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 6px;
  font-size: 13px;
}

.review-author {
  font-weight: 500;
}

.review-date {
  color: var(--text-muted);
}

.review-text {
  font-size: 14px;
  color: var(--text);
}

/* ===== EMPTY STATE ===== */
.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-muted);
}

.empty-state i {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.4;
}

.empty-state h3 {
  font-size: 18px;
  margin-bottom: 8px;
  color: var(--text);
}

/* ===== SECTION ===== */
.section-header {
  margin-bottom: 16px;
}

.section-header h2 {
  font-size: 20px;
  margin-bottom: 4px;
}

.muted {
  color: var(--text-muted);
  font-size: 14px;
}

/* ===== RESPONSES ===== */
.response-item {
  background: #f8fafc;
  border-radius: 10px;
  padding: 14px;
  margin-bottom: 10px;
  border: 1px solid var(--border);
}

.response-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.response-driver {
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

.response-price {
  font-weight: 700;
  color: var(--success);
}

.response-comment {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 10px;
}

/* ===== UTILS ===== */
.hidden {
  display: none !important;
}

@media (min-width: 600px) {
  .modal {
    align-items: center;
    padding: 20px;
  }
  
  .modal-content {
    border-radius: 16px;
  }
}

/* ===== LANGUAGE SWITCHER ===== */
.lang-switcher {
  display: flex;
  gap: 4px;
  background: var(--bg);
  border-radius: 8px;
  padding: 3px;
}

.lang-btn {
  border: none;
  background: transparent;
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
}

.lang-btn.active {
  background: white;
  color: var(--primary);
  box-shadow: 0 1px 2px rgba(0,0,0,0.08);
}

.login-lang {
  justify-content: center;
  margin-bottom: 20px;
  background: #f1f5f9;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
}

.header-right .lang-switcher {
  margin-right: 4px;
}

/* ===== ROLE THEMES ===== */
body.role-shipper {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --role-accent: #2563eb;
  --role-soft: #eff6ff;
  --header-bg: linear-gradient(135deg, #1e40af 0%, #3b82f6 100%);
}

body.role-driver {
  --primary: #059669;
  --primary-dark: #047857;
  --role-accent: #059669;
  --role-soft: #ecfdf5;
  --header-bg: linear-gradient(135deg, #065f46 0%, #10b981 100%);
}

body.role-shipper .header,
body.role-driver .header {
  background: var(--header-bg);
  border-bottom: none;
}

body.role-shipper .header-left,
body.role-shipper .header-right,
body.role-shipper .app-name,
body.role-shipper #user-info,
body.role-driver .header-left,
body.role-driver .header-right,
body.role-driver .app-name,
body.role-driver #user-info {
  color: white;
}

body.role-shipper .header .icon-btn,
body.role-driver .header .icon-btn {
  color: rgba(255,255,255,0.9);
}

body.role-shipper .header .icon-btn:hover,
body.role-driver .header .icon-btn:hover {
  background: rgba(255,255,255,0.15);
  color: white;
}

body.role-shipper .header .lang-btn,
body.role-driver .header .lang-btn {
  color: rgba(255,255,255,0.8);
}

body.role-shipper .header .lang-btn.active,
body.role-driver .header .lang-btn.active {
  background: rgba(255,255,255,0.25);
  color: white;
  box-shadow: none;
}

body.role-shipper .header .lang-switcher,
body.role-driver .header .lang-switcher {
  background: rgba(255,255,255,0.15);
}

body.role-shipper .tabs {
  background: white;
  border-bottom: 2px solid #dbeafe;
}

body.role-driver .tabs {
  background: white;
  border-bottom: 2px solid #d1fae5;
}

body.role-shipper .tab.active {
  color: #2563eb;
  border-bottom-color: #2563eb;
}

body.role-driver .tab.active {
  color: #059669;
  border-bottom-color: #059669;
}

body.role-shipper .fab {
  background: #2563eb;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.45);
}

body.role-driver .fab {
  background: #059669;
  box-shadow: 0 4px 14px rgba(5, 150, 105, 0.45);
}

body.role-shipper .btn-primary {
  background: #2563eb;
}

body.role-shipper .btn-primary:hover {
  background: #1d4ed8;
}

body.role-driver .btn-primary {
  background: #059669;
}

body.role-driver .btn-primary:hover {
  background: #047857;
}

body.role-shipper .card-price {
  color: #2563eb;
}

body.role-driver .card-price {
  color: #059669;
}

.role-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  margin: -16px -16px 16px -16px;
  font-size: 14px;
  font-weight: 600;
}

body.role-shipper .role-banner {
  background: var(--role-soft);
  color: #1e40af;
  border-bottom: 1px solid #bfdbfe;
}

body.role-driver .role-banner {
  background: var(--role-soft);
  color: #065f46;
  border-bottom: 1px solid #a7f3d0;
}

.role-banner i {
  font-size: 18px;
}

/* Role badges on login */
.role-btn[data-role="shipper"].active {
  border-color: #2563eb;
  background: #eff6ff;
  color: #2563eb;
}

.role-btn[data-role="shipper"].active i {
  color: #2563eb;
}

.role-btn[data-role="driver"].active {
  border-color: #059669;
  background: #ecfdf5;
  color: #059669;
}

.role-btn[data-role="driver"].active i {
  color: #059669;
}

/* Hide Netlify badge / iframe */
iframe[src*="netlify"],
div[data-netlify-badge],
a[href*="netlify.com"][target="_blank"] {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

/* Extra safety for floating badges */
body > a[href*="netlify"],
body > div:has(a[href*="netlify.com"]) {
  display: none !important;
}

/* ===== CHAT ===== */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 12px 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 220px;
  max-height: 50vh;
}

.chat-bubble {
  max-width: 80%;
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.4;
  word-break: break-word;
}

.chat-bubble.mine {
  align-self: flex-end;
  background: var(--primary);
  color: white;
  border-bottom-right-radius: 4px;
}

.chat-bubble.theirs {
  align-self: flex-start;
  background: #f1f5f9;
  color: var(--text);
  border-bottom-left-radius: 4px;
}

.chat-meta {
  font-size: 11px;
  opacity: 0.7;
  margin-top: 4px;
}

.chat-form {
  display: flex;
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.chat-form input {
  flex: 1;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 24px;
  font-size: 15px;
}

.chat-form input:focus {
  outline: none;
  border-color: var(--primary);
}

.contact-line {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 6px;
  flex-wrap: wrap;
}

.contact-line a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
}

/* Date input fix for iOS */
input[type="date"] {
  min-height: 44px;
  -webkit-appearance: none;
  appearance: none;
  background: white;
  color: var(--text);
  line-height: 1.2;
}

input[type="date"]::-webkit-date-and-time-value {
  text-align: left;
  min-height: 1.2em;
}

/* Tabs on small screens */
.tabs .tab span {
  font-size: 11px;
}

.sort-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  font-size: 13px;
  color: var(--text-muted);
}

.sort-row select {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  background: white;
  color: var(--text);
}

/* ===== AUTH UI ===== */
.login-top-controls {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 16px;
}

.auth-tab {
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text-muted);
  font-weight: 600;
  cursor: pointer;
}

.auth-tab.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.btn-link {
  display: block;
  width: 100%;
  margin-top: 10px;
  background: none;
  border: none;
  color: var(--primary);
  font-size: 13px;
  cursor: pointer;
  text-align: center;
}

.theme-toggle-btn {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
}

/* ===== DARK THEME ===== */
body.theme-dark {
  --bg: #0f172a;
  --card: #1e293b;
  --text: #f1f5f9;
  --text-muted: #94a3b8;
  --border: #334155;
  --shadow: 0 1px 3px rgba(0,0,0,0.4);
}

body.theme-dark #login-screen {
  background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 100%);
}

body.theme-dark .login-card,
body.theme-dark .card,
body.theme-dark .modal-content,
body.theme-dark .header,
body.theme-dark .tabs {
  background: var(--card);
  color: var(--text);
}

body.theme-dark .form-group input,
body.theme-dark .form-group textarea,
body.theme-dark .form-group select,
body.theme-dark .filters input,
body.theme-dark .sort-row select,
body.theme-dark .chat-form input {
  background: #0f172a;
  color: var(--text);
  border-color: var(--border);
}

body.theme-dark .chat-bubble.theirs {
  background: #334155;
  color: var(--text);
}

body.theme-dark .response-item,
body.theme-dark .review-item {
  background: #0f172a;
}

body.theme-dark .role-btn {
  background: #0f172a;
  color: var(--text);
}

body.theme-dark .btn-secondary {
  background: #334155;
  color: var(--text);
  border-color: #475569;
}

/* Toast notifications */
#toast-container {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(92vw, 360px);
  pointer-events: none;
}

.toast {
  background: #0f172a;
  color: white;
  padding: 12px 16px;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.25);
  font-size: 14px;
  animation: toastIn 0.25s ease;
  pointer-events: auto;
}

body.theme-dark .toast {
  background: #334155;
}

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

.stars-input {
  display: flex;
  gap: 8px;
  font-size: 28px;
  color: #f59e0b;
  cursor: pointer;
}

.terms-check {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 13px;
  color: var(--text-muted);
  margin: 12px 0;
  line-height: 1.4;
}

.terms-check input {
  margin-top: 3px;
}

.btn-link.inline {
  display: inline;
  width: auto;
  margin: 0;
  padding: 0 4px;
  font-size: 13px;
}

.terms-body {
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  max-height: 50vh;
  overflow-y: auto;
  margin-bottom: 12px;
  white-space: pre-line;
}

.admin-reply-box {
  margin-top: 10px;
  display: flex;
  gap: 8px;
}

.admin-reply-box input {
  flex: 1;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
}

.support-reply {
  margin-top: 10px;
  padding: 10px;
  background: var(--bg);
  border-radius: 8px;
  font-size: 13px;
  border-left: 3px solid var(--primary);
}

.card {
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.tab-icon-wrap {
  position: relative;
  display: inline-flex;
}

.tab-badge {
  position: absolute;
  top: -6px;
  right: -10px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: #dc2626;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
}

.tab-badge.hidden {
  display: none;
}

.chat-unread-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: #dc2626;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
}

.toast {
  transition: transform 0.2s ease, opacity 0.2s ease;
  touch-action: pan-y;
  cursor: grab;
}

.toast.swiping {
  transition: none;
}

.toast.dismiss {
  opacity: 0;
  transform: translateX(120%);
}

.chat-thread-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}

.templates-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}
.template-chip {
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12px;
  cursor: pointer;
}
.template-chip:hover { border-color: var(--primary); color: var(--primary); }
.chat-safety {
  background: #fef3c7;
  color: #92400e;
  font-size: 12px;
  padding: 8px 12px;
  border-radius: 8px;
  margin-bottom: 8px;
}
body.theme-dark .chat-safety {
  background: #78350f;
  color: #fde68a;
}
.deal-status {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  background: #e2e8f0;
  color: #334155;
}
.deal-status.agreed { background: #dbeafe; color: #1d4ed8; }
.deal-status.in_transit { background: #ffedd5; color: #c2410c; }
.deal-status.completed { background: #dcfce7; color: #15803d; }
.safety-banner {
  background: #fee2e2;
  color: #991b1b;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 13px;
  margin-bottom: 12px;
}
body.theme-dark .safety-banner {
  background: #7f1d1d;
  color: #fecaca;
}


.photos-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}
.photos-preview img {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--border);
}
.ad-photos-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  margin: 8px 0;
}
.ad-photos-row img {
  width: 88px;
  height: 88px;
  object-fit: cover;
  border-radius: 8px;
  flex-shrink: 0;
}
.badge-verified {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #dbeafe;
  color: #1d4ed8;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  margin-left: 6px;
}
body.theme-dark .badge-verified {
  background: #1e3a8a;
  color: #93c5fd;
}
.badge-boost {
  background: #fef3c7;
  color: #b45309;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
}
body.theme-dark .badge-boost {
  background: #78350f;
  color: #fde68a;
}
.card.boosted {
  border: 1px solid #f59e0b;
  box-shadow: 0 0 0 1px rgba(245, 158, 11, 0.15);
}
.onboard-body {
  font-size: 15px;
  line-height: 1.5;
  margin-bottom: 16px;
  white-space: pre-line;
}
.onboard-dots {
  display: flex;
  gap: 6px;
  justify-content: center;
  margin-bottom: 12px;
}
.onboard-dots span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--border);
}
.onboard-dots span.active {
  background: var(--primary);
}
