/* ══════════════════════════════════════════════════════
   CSS Variables — адаптируются к теме Telegram
══════════════════════════════════════════════════════ */
:root {
  --bg:          var(--tg-theme-bg-color, #0f172a);
  --bg2:         var(--tg-theme-secondary-bg-color, #1e293b);
  --text:        var(--tg-theme-text-color, #f1f5f9);
  --hint:        var(--tg-theme-hint-color, #94a3b8);
  --accent:      var(--tg-theme-button-color, #3b82f6);
  --accent-text: var(--tg-theme-button-text-color, #ffffff);
  --link:        var(--tg-theme-link-color, #60a5fa);
  --border:      rgba(128, 128, 128, 0.35);
  --card:        rgba(255,255,255,0.05);
  --card-hover:  rgba(255,255,255,0.09);
  --danger:      #ef4444;
  --success:     #22c55e;
  --gold:        #f59e0b;
  --radius:      14px;
  --radius-sm:   8px;
  --shadow:      0 4px 24px rgba(0,0,0,0.3);
  --tab-height:  60px;
  --topbar-height: 52px;
}

/* ══════════════════════════════════════════════════════
   Reset + Base
══════════════════════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

.hidden { display: none !important; }

/* ══════════════════════════════════════════════════════
   Screens
══════════════════════════════════════════════════════ */
.screen {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  overflow: hidden;
}

/* ══════════════════════════════════════════════════════
   Top Bar
══════════════════════════════════════════════════════ */
.top-bar {
  height: var(--topbar-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  z-index: 10;
}

.top-bar-left  { display: flex; align-items: center; gap: 8px; }
.top-bar-right { display: flex; align-items: center; gap: 8px; }
.app-icon      { font-size: 22px; }
.app-title     { font-size: 18px; font-weight: 700; }
.top-bar-title {
  font-size: 16px;
  font-weight: 600;
  flex: 1;
  text-align: center;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  padding: 0 4px;
}

.back-btn {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 26px;
  line-height: 1;
  padding: 0 4px;
  cursor: pointer;
  width: 36px;
  flex-shrink: 0;
}

/* Credits chip */
.credits-chip {
  display: flex;
  align-items: center;
  gap: 4px;
  background: rgba(245,158,11,0.15);
  color: var(--gold);
  font-size: 13px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 20px;
  white-space: nowrap;
}
.credits-icon { font-size: 12px; }

/* ══════════════════════════════════════════════════════
   Garage Screen
══════════════════════════════════════════════════════ */
.screen-body {
  flex: 1;
  overflow-y: auto;
  padding: 12px 12px 80px;
  -webkit-overflow-scrolling: touch;
}

/* Car cards in garage */
.car-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 10px;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
  display: flex;
  align-items: center;
  gap: 14px;
}
.car-card:active { background: var(--card-hover); transform: scale(0.99); }

.car-card-icon {
  font-size: 32px;
  flex-shrink: 0;
}
.car-card-info { flex: 1; overflow: hidden; }
.car-card-name {
  font-size: 16px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.car-card-meta {
  font-size: 13px;
  color: var(--hint);
  margin-top: 2px;
}
.car-card-chevron {
  color: var(--hint);
  font-size: 20px;
  flex-shrink: 0;
}

/* FAB */
.fab-container {
  position: absolute;
  bottom: 20px;
  left: 0; right: 0;
  display: flex;
  justify-content: center;
  padding: 0 16px;
}
.fab {
  background: var(--accent);
  color: var(--accent-text);
  border: none;
  border-radius: 28px;
  padding: 14px 32px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: var(--shadow);
  width: 100%;
  max-width: 340px;
}

/* ══════════════════════════════════════════════════════
   Car App — tab shell
══════════════════════════════════════════════════════ */
.tab-body {
  flex: 1;
  overflow: hidden;
  position: relative;
}
.tab-pane {
  position: absolute;
  inset: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 8px;
}
.tab-inner {
  padding: 12px 12px calc(var(--tab-height) + 12px);
}

/* Section header */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.section-title {
  font-size: 18px;
  font-weight: 700;
}
.btn-inline {
  background: var(--accent);
  color: var(--accent-text);
  border: none;
  border-radius: 20px;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

/* ══════════════════════════════════════════════════════
   Tab Bar
══════════════════════════════════════════════════════ */
.tab-bar {
  height: var(--tab-height);
  display: flex;
  align-items: stretch;
  background: var(--bg);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  z-index: 10;
}
.tab-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  background: none;
  border: none;
  color: var(--hint);
  cursor: pointer;
  padding: 4px 0;
  transition: color 0.15s;
}
.tab-btn.active {
  color: var(--accent);
}
.tab-icon  { font-size: 20px; line-height: 1; }
.tab-label { font-size: 10px; font-weight: 500; }

/* ══════════════════════════════════════════════════════
   Chat List (Чаты tab)
══════════════════════════════════════════════════════ */
.chat-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 8px;
  cursor: pointer;
  transition: background 0.15s;
}
.chat-item:active { background: var(--card-hover); }
.chat-item-icon {
  font-size: 28px;
  flex-shrink: 0;
}
.chat-item-body { flex: 1; overflow: hidden; }
.chat-item-title {
  font-size: 15px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chat-item-meta {
  font-size: 12px;
  color: var(--hint);
  margin-top: 2px;
}
.chat-item-delete {
  background: none;
  border: none;
  color: var(--hint);
  font-size: 18px;
  padding: 4px 8px;
  cursor: pointer;
  flex-shrink: 0;
  border-radius: 8px;
}
.chat-item-delete:active { color: var(--danger); background: rgba(239,68,68,0.1); }

/* ══════════════════════════════════════════════════════
   Chat Detail Screen
══════════════════════════════════════════════════════ */
.messages-area {
  flex: 1;
  overflow-y: auto;
  padding: 12px 12px 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  -webkit-overflow-scrolling: touch;
}

/* Message bubbles */
.msg {
  display: flex;
  gap: 8px;
  max-width: 88%;
}
.msg-user {
  align-self: flex-end;
  flex-direction: row-reverse;
}
.msg-model {
  align-self: flex-start;
}
.msg-content {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.msg-bubble {
  padding: 10px 14px;
  border-radius: 18px;
  font-size: 14px;
  line-height: 1.5;
  word-break: break-word;
  white-space: pre-wrap;
}
.msg-user .msg-bubble {
  background: var(--accent);
  color: var(--accent-text);
  border-bottom-right-radius: 4px;
}
.msg-model .msg-bubble {
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--text);
  border-bottom-left-radius: 4px;
}
.msg-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 2px;
}
.msg-time {
  font-size: 11px;
  color: var(--hint);
}
.msg-user .msg-meta { justify-content: flex-end; }

/* AI Message Actions (Vertical Stack) */
.msg-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 8px;
  margin-bottom: 4px;
  width: 100%;
}
.msg-action-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  box-sizing: border-box;
  background: var(--bg-secondary, rgba(255, 255, 255, 0.05));
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
  word-break: break-word;
}
.msg-action-btn:hover, .msg-action-btn:active {
  background: rgba(59, 130, 246, 0.15);
  color: var(--accent);
  border-color: var(--accent);
}
.msg-action-btn svg {
  flex-shrink: 0;
}
.msg-action-btn.copied {
  background: rgba(34, 197, 94, 0.15);
  color: #22c55e;
  border-color: rgba(34, 197, 94, 0.4);
}
.btn-copy-icon {
  background: none;
  border: none;
  color: var(--hint);
  font-size: 11px;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 4px;
  opacity: 0.6;
  transition: opacity 0.15s;
}
.btn-copy-icon:hover, .btn-copy-icon:active {
  opacity: 1;
}



/* Typing indicator */
.typing-indicator {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  flex-shrink: 0;
}
.typing-bubble {
  display: flex;
  gap: 4px;
  background: var(--card);
  border: 1px solid var(--border);
  padding: 8px 12px;
  border-radius: 18px;
}
.typing-bubble span {
  width: 7px;
  height: 7px;
  background: var(--hint);
  border-radius: 50%;
  animation: typingDot 1.2s infinite;
}
.typing-bubble span:nth-child(2) { animation-delay: 0.2s; }
.typing-bubble span:nth-child(3) { animation-delay: 0.4s; }
@keyframes typingDot {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
  30%            { transform: translateY(-5px); opacity: 1; }
}
.typing-text { font-size: 13px; color: var(--hint); }

/* File preview bar */
.file-preview {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  background: var(--bg2);
  border-top: 1px solid var(--border);
  font-size: 13px;
  color: var(--hint);
  flex-shrink: 0;
}
.file-preview-icon { font-size: 16px; }
.file-preview-remove {
  margin-left: auto;
  background: none;
  border: none;
  color: var(--hint);
  cursor: pointer;
  font-size: 16px;
  padding: 2px 6px;
}

/* Chat input bar */
.chat-input-bar {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 8px 10px;
  background: var(--bg);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.attach-btn {
  color: var(--hint);
  font-size: 22px;
  padding: 4px;
  cursor: pointer;
  flex-shrink: 0;
  line-height: 1;
  margin-bottom: 4px;
}
.chat-textarea {
  flex: 1;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 10px 16px;
  color: var(--text);
  font-size: 15px;
  font-family: inherit;
  resize: none;
  max-height: 120px;
  overflow-y: auto;
  line-height: 1.4;
}
.chat-textarea:focus { outline: none; border-color: var(--accent); }
.chat-textarea::placeholder { color: var(--hint); }
.send-btn {
  background: var(--accent);
  color: var(--accent-text);
  border: none;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: opacity 0.15s;
}
.send-btn:disabled { opacity: 0.5; }

/* Pinned chat item styling */
.chat-item.pinned {
  border-left: 3px solid var(--accent);
  background: rgba(96, 165, 250, 0.08);
}
.chat-item.pinned .chat-item-title {
  font-weight: 700;
}
.chat-item.pinned .chat-item-title::before {
  content: '📌 ';
  font-size: 13px;
}

/* ══════════════════════════════════════════════════════
   Service Logbook (Expandable Cards & Editing)
══════════════════════════════════════════════════════ */
.service-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
}
.service-card:hover {
  border-color: var(--accent);
}
.service-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
.service-badge {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 12px;
  font-weight: 600;
}
.service-badge.ai {
  background: rgba(96, 165, 250, 0.15);
  color: var(--accent);
}
.service-badge.manual {
  background: rgba(156, 163, 175, 0.15);
  color: var(--hint);
}
.service-card-body {
  margin-top: 10px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  display: none;
  white-space: pre-wrap;
  word-break: break-word;
  padding-top: 10px;
  border-top: 1px dashed var(--border);
}
.service-card.expanded .service-card-body {
  display: block;
}
.service-card-chevron {
  transition: transform 0.2s ease;
  font-size: 12px;
  color: var(--hint);
}
.service-card.expanded .service-card-chevron {
  transform: rotate(180deg);
}

/* ══════════════════════════════════════════════════════
   Car Specs tab
══════════════════════════════════════════════════════ */
.car-specs-header {
  text-align: center;
  padding: 20px 0 16px;
}
.car-specs-bigname {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 4px;
}
.car-specs-year {
  font-size: 15px;
  color: var(--hint);
  margin-bottom: 4px;
}
.car-specs-vin {
  font-size: 12px;
  color: var(--hint);
  font-family: monospace;
  letter-spacing: 1px;
}
.specs-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 12px;
}
.spec-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
}
.spec-label { font-size: 11px; color: var(--hint); text-transform: uppercase; letter-spacing: 0.5px; }
.spec-value { font-size: 16px; font-weight: 600; margin-top: 4px; }

/* Delete car button */
.btn-delete-car {
  display: block;
  width: 100%;
  margin-top: 20px;
  padding: 13px;
  background: rgba(239,68,68,0.08);
  border: 1px solid rgba(239,68,68,0.3);
  border-radius: var(--radius-sm);
  color: var(--danger);
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  text-align: center;
  transition: background 0.15s;
}
.btn-delete-car:active { background: rgba(239,68,68,0.18); }

/* ══════════════════════════════════════════════════════
   Settings tab
══════════════════════════════════════════════════════ */
.settings-profile {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 12px;
}
.profile-avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-text);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 700;
  flex-shrink: 0;
}
.profile-name { font-size: 16px; font-weight: 600; }
.profile-username { font-size: 13px; color: var(--hint); margin-top: 2px; }

.settings-credits-card {
  background: linear-gradient(135deg, rgba(245,158,11,0.2), rgba(245,158,11,0.05));
  border: 1px solid rgba(245,158,11,0.3);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
  text-align: center;
}
.credits-label { font-size: 13px; color: var(--hint); }
.credits-big { font-size: 36px; font-weight: 800; color: var(--gold); margin: 4px 0 12px; }
.btn-topup {
  background: var(--gold);
  color: #000;
  border: none;
  border-radius: 20px;
  padding: 8px 24px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

/* Transactions list */
.txn-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 6px;
}
.txn-icon { font-size: 20px; flex-shrink: 0; }
.txn-body { flex: 1; overflow: hidden; }
.txn-desc {
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.txn-date { font-size: 11px; color: var(--hint); margin-top: 2px; }
.txn-amount {
  font-size: 14px;
  font-weight: 700;
  flex-shrink: 0;
}
.txn-amount.positive { color: var(--success); }
.txn-amount.negative { color: var(--danger); }

/* ══════════════════════════════════════════════════════
   Modals
══════════════════════════════════════════════════════ */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 100;
  display: flex;
  align-items: flex-end;
}
.modal-sheet {
  background: var(--bg);
  border-radius: 20px 20px 0 0;
  width: 100%;
  max-height: 92vh;
  overflow-y: auto;
  padding: 20px 20px 32px;
  animation: slideUp 0.25s ease;
}
@keyframes slideUp {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  font-size: 17px;
  font-weight: 700;
}
.modal-close {
  background: var(--card);
  border: none;
  color: var(--hint);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal-form { display: flex; flex-direction: column; gap: 12px; }

/* ══════════════════════════════════════════════════════
   Inputs & Buttons (shared)
══════════════════════════════════════════════════════ */
.input-group { display: flex; flex-direction: column; gap: 6px; }
.input-group label { font-size: 13px; color: var(--hint); }
.input-group input,
.input-group textarea,
.input-group select {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  color: var(--text);
  font-size: 15px;
  font-family: inherit;
  width: 100%;
}
.input-group input:focus,
.input-group textarea:focus {
  outline: none;
  border-color: var(--accent);
}
.input-group input::placeholder,
.input-group textarea::placeholder { color: var(--hint); }

.btn-primary {
  background: var(--accent);
  color: var(--accent-text);
  border: none;
  border-radius: var(--radius-sm);
  padding: 13px 24px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}
.btn-secondary {
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 13px 24px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}
.btn-full { width: 100%; }

/* Wizard */
.wizard-progress-bar {
  height: 3px;
  background: var(--border);
  border-radius: 2px;
  margin-bottom: 20px;
  overflow: hidden;
}
.wizard-progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  transition: width 0.3s ease;
}
.wizard-hint { font-size: 13px; color: var(--hint); margin-bottom: 12px; }
.wizard-slide { display: flex; flex-direction: column; gap: 14px; }
.wizard-slide.hidden { display: none; }
.wizard-slide.active { display: flex; }
.wizard-actions { display: flex; gap: 10px; margin-top: 6px; }
.wizard-actions .btn-primary,
.wizard-actions .btn-secondary { flex: 1; }

.year-display {
  text-align: center;
  font-size: 36px;
  font-weight: 800;
  color: var(--accent);
}
.year-slider {
  width: 100%;
  accent-color: var(--accent);
}
.year-input {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  color: var(--text);
  font-size: 15px;
  text-align: center;
  width: 100%;
}

/* Car preview card */
.car-preview-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
}
.preview-icon  { font-size: 40px; margin-bottom: 8px; }
.preview-title { font-size: 20px; font-weight: 700; }
.preview-year  { font-size: 14px; color: var(--hint); margin-top: 4px; }
.preview-vin   { font-size: 12px; color: var(--hint); font-family: monospace; margin-top: 4px; }
.preview-tech  {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 12px;
  font-size: 13px;
  color: var(--hint);
}

/* ══════════════════════════════════════════════════════
   Wizard sheet — высокий модал
══════════════════════════════════════════════════════ */
.wizard-sheet {
  max-height: 96vh;
}

/* ══════════════════════════════════════════════════════
   Picker (brand/model search + list)
══════════════════════════════════════════════════════ */
.picker-search-wrap {
  margin-bottom: 8px;
}
.picker-search-input {
  width: 100%;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 11px 14px;
  color: var(--text);
  font-size: 15px;
  font-family: inherit;
}
.picker-search-input:focus { outline: none; border-color: var(--accent); }
.picker-search-input::placeholder { color: var(--hint); }

.picker-sort-row {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}
.sort-btn {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 20px;
  color: var(--hint);
  font-size: 12px;
  padding: 5px 12px;
  cursor: pointer;
  transition: all 0.15s;
}
.sort-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-text);
}

.picker-brand-header {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 10px;
  color: var(--accent);
}

.picker-list {
  max-height: 320px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 12px;
  scrollbar-width: none;
}
.picker-list::-webkit-scrollbar { display: none; }

.picker-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  font-size: 15px;
  transition: background 0.1s;
  -webkit-tap-highlight-color: transparent;
}
.picker-item:last-child { border-bottom: none; }
.picker-item:active { background: var(--card-hover); }
.picker-item-left { display: flex; align-items: center; gap: 10px; }
.picker-item-pop  { font-size: 10px; background: rgba(59,130,246,0.15); color: var(--accent); border-radius: 10px; padding: 2px 7px; }
.picker-item-arrow { color: var(--hint); font-size: 18px; }
.picker-item-custom {
  font-style: italic;
  color: var(--hint);
  border-bottom: 1px solid var(--border);
}

/* ══════════════════════════════════════════════════════
   Drum (wheel) Year Picker — JS-controlled
══════════════════════════════════════════════════════ */
.drum-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  user-select: none;
  -webkit-user-select: none;
}
.drum-picker {
  position: relative;
  width: 100%;
  max-width: 260px;
  height: 228px; /* 5 items × 44px + 8px gap */
  overflow: hidden;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: var(--card);
  cursor: ns-resize;
  touch-action: none;
}
/* Fade overlays via mask-image — works in any theme */
.drum-picker {
  -webkit-mask-image: linear-gradient(
    to bottom,
    transparent 0%,
    black 28%,
    black 72%,
    transparent 100%
  );
  mask-image: linear-gradient(
    to bottom,
    transparent 0%,
    black 28%,
    black 72%,
    transparent 100%
  );
}
.drum-track {
  position: absolute;
  width: 100%;
  /* top is set by JS */
  transition: top 0.15s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}
.drum-track.dragging { transition: none; }

.drum-item {
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 400;
  color: var(--hint);
  transition: color 0.12s, font-size 0.12s, font-weight 0.12s;
  cursor: pointer;
}
.drum-item.active {
  color: var(--text);
  font-size: 26px;
  font-weight: 700;
}
.drum-item.near1 { color: var(--text); opacity: 0.65; font-size: 21px; font-weight: 500; }
.drum-item.near2 { opacity: 0.35; font-size: 19px; }

/* Selection bar behind center item */
.drum-selector {
  position: absolute;
  top: 50%;
  left: 10px; right: 10px;
  height: 44px;
  transform: translateY(-50%);
  border-radius: 10px;
  background: rgba(255,255,255,0.05);
  border: 1.5px solid var(--accent);
  pointer-events: none;
  z-index: 1;
}
.year-drum-display {
  text-align: center;
  font-size: 30px;
  font-weight: 800;
  color: var(--accent);
  letter-spacing: 1px;
}

/* ══════════════════════════════════════════════════════
   Option cards (КПП + топливо)
══════════════════════════════════════════════════════ */
.detail-section { margin-bottom: 16px; }
.detail-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--hint);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}
.option-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
}
.option-card {
  background: var(--card);
  border: 1.5px solid var(--border);
  border-radius: 12px;
  padding: 10px 6px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text);
  transition: all 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.option-card:active { transform: scale(0.97); }
.option-card.selected {
  border-color: var(--accent);
  background: rgba(59,130,246,0.12);
  color: var(--accent);
}
.option-card .option-icon { font-size: 22px; line-height: 1; }
.option-card small { font-size: 10px; color: var(--hint); }
.option-card.selected small { color: var(--accent); opacity: 0.7; }

/* Чипы марки бензина (мультивыбор) */
.octane-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}
.octane-chip {
  background: var(--card);
  border: 1.5px solid var(--border);
  border-radius: 20px;
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  transition: all 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.octane-chip:active { transform: scale(0.96); }
.octane-chip.selected {
  border-color: var(--accent);
  background: rgba(59,130,246,0.12);
  color: var(--accent);
}

/* Extra fields в деталях */
.details-extras {
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.extras-row {
  display: flex;
  gap: 10px;
}
.flex-1 { flex: 1; }

/* ══════════════════════════════════════════════════════
   Year Spinner (старый — оставляем как запасной)
══════════════════════════════════════════════════════ */
.year-spinner {
  display: flex;
  align-items: center;
  gap: 0;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.spinner-btn {
  background: var(--bg2);
  border: none;
  color: var(--text);
  font-size: 22px;
  width: 52px;
  height: 52px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.1s;
  line-height: 1;
}
.spinner-btn:active { background: var(--accent); color: var(--accent-text); }
.year-number-input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text);
  font-size: 22px;
  font-weight: 700;
  text-align: center;
  padding: 12px 4px;
  -moz-appearance: textfield;
}
.year-number-input::-webkit-outer-spin-button,
.year-number-input::-webkit-inner-spin-button { -webkit-appearance: none; }
.year-number-input:focus { outline: none; }

/* Select input */
.select-input {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  color: var(--text);
  font-size: 15px;
  font-family: inherit;
  width: 100%;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%2394a3b8' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}
.select-input:focus { outline: none; border-color: var(--accent); }

/* Preview details chips */
.preview-details {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
  margin-top: 10px;
}
.preview-chip {
  font-size: 12px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 3px 10px;
  color: var(--hint);
}

/* ══════════════════════════════════════════════════════
   Chat UX improvements
══════════════════════════════════════════════════════ */
/* Hide textarea scrollbar */
.chat-textarea::-webkit-scrollbar { display: none; }
.chat-textarea { scrollbar-width: none; -ms-overflow-style: none; }

/* Send button loading state */
.send-btn.loading { opacity: 0.7; pointer-events: none; }
.send-spinner {
  width: 16px; height: 16px;
  border: 2px solid rgba(255,255,255,0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Error message in chat */
.msg-error {
  align-self: center;
  max-width: 90%;
}
.msg-error-bubble {
  background: rgba(239,68,68,0.1);
  border: 1px solid rgba(239,68,68,0.3);
  color: var(--danger);
  border-radius: 10px;
  padding: 8px 14px;
  font-size: 13px;
  text-align: center;
}

/* ══════════════════════════════════════════════════════
   Car Specs — секционный вид
══════════════════════════════════════════════════════ */
.spec-section {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 10px;
}
.spec-section-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--hint);
  padding: 10px 16px 6px;
  border-bottom: 1px solid var(--border);
}
.spec-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 16px;
  border-bottom: 1px solid var(--border);
}
.spec-row:last-child { border-bottom: none; }
.spec-key {
  font-size: 14px;
  color: var(--hint);
  flex-shrink: 0;
  margin-right: 12px;
}
.spec-val {
  font-size: 14px;
  font-weight: 500;
  text-align: right;
  word-break: break-word;
}

/* Chat welcome placeholder */
.chat-welcome {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px 24px;
  color: var(--hint);
  gap: 8px;
}
.chat-welcome-icon { font-size: 52px; margin-bottom: 4px; }
.chat-welcome p    { font-size: 16px; font-weight: 600; color: var(--text); }
.chat-welcome small { font-size: 13px; line-height: 1.5; }

/* ══════════════════════════════════════════════════════
   Empty state
══════════════════════════════════════════════════════ */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--hint);
}
.empty-icon { font-size: 48px; margin-bottom: 12px; }
.empty-state p { font-size: 15px; font-weight: 500; }
.empty-state small { font-size: 13px; display: block; margin-top: 6px; }

/* ══════════════════════════════════════════════════════
   Adjustments & Additions (Antigravity modifications)
══════════════════════════════════════════════════════ */

/* Range slider styles */
.range-slider {
  width: 100%;
  height: 8px;
  background: rgba(128, 128, 128, 0.55);
  outline: none;
  border-radius: 4px;
  -webkit-appearance: none;
  margin: 12px 0;
  border: 1px solid var(--border);
}
.range-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,0.4);
  transition: transform 0.1s ease;
  border: 1.5px solid var(--accent-text, #ffffff);
}
.range-slider::-webkit-slider-thumb:active {
  transform: scale(1.15);
}
.slider-val-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  text-align: center;
  margin-top: 4px;
}

/* Chips grid styles */
.chips-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}
.chip-btn {
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 14px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}
.chip-btn:hover {
  background: var(--card-hover);
}
.chip-btn.selected {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-text);
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

/* Chat Three-dots dropdown menu styles */
.chat-menu-wrapper {
  position: relative;
}
.chat-menu-btn {
  background: none;
  border: none;
  color: var(--text);
  font-size: 24px;
  cursor: pointer;
  padding: 4px 8px;
  line-height: 1;
}
.chat-dropdown {
  position: absolute;
  top: 36px;
  right: 0;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
  z-index: 100;
  min-width: 170px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.chat-dropdown-item {
  background: none;
  border: none;
  color: var(--text);
  padding: 12px 16px;
  text-align: left;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  width: 100%;
  transition: background 0.2s ease;
}
.chat-dropdown-item:hover {
  background: var(--card-hover);
}
.chat-dropdown-item.danger {
  color: var(--danger);
  border-top: 1px solid var(--border);
}

/* Edit Car Form on Specs Tab */
.edit-car-form {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow-y: auto;
  max-height: calc(100vh - 140px);
}
.form-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
}
.form-card-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--hint);
  margin-bottom: 12px;
}
.btn-save-specs {
  background: var(--success);
  color: #fff;
  border: none;
  padding: 14px;
  border-radius: var(--radius);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  width: 100%;
  margin-top: 10px;
}
.btn-save-specs:hover {
  filter: brightness(1.1);
}
.btn-save-specs:disabled {
  background: var(--hint);
  cursor: not-allowed;
}

/* Service history mileage display */
.service-record-mileage {
  font-size: 12px;
  color: var(--accent);
  font-weight: 600;
  margin-top: 2px;
}

/* Typing indicator text fade-out animation */
.typing-text {
  transition: opacity 0.25s ease-in-out;
  opacity: 1;
}
.typing-text.fade-out {
  opacity: 0;
}

/* ══════════════════════════════════════════════════════
   Wallet Screen Styles (Dedicated Balance Page)
   ══════════════════════════════════════════════════════ */
.wallet-card {
  background: linear-gradient(135deg, rgba(245,158,11,0.12) 0%, rgba(59,130,246,0.12) 100%);
  border: 2px solid var(--gold);
  border-radius: var(--radius);
  padding: 24px 20px;
  text-align: center;
  margin-bottom: 20px;
  box-shadow: 0 8px 32px rgba(245,158,11,0.15);
}
.wallet-balance-title {
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--hint);
  letter-spacing: 1px;
}
.wallet-balance-value {
  font-size: 38px;
  font-weight: 800;
  color: var(--gold);
  margin-top: 8px;
  text-shadow: 0 0 10px rgba(245,158,11,0.3);
}

.wallet-section-title {
  font-size: 16px;
  font-weight: 700;
  margin: 22px 0 12px;
  color: var(--text);
  border-left: 3px solid var(--accent);
  padding-left: 8px;
}

/* Payment tiers */
.payment-tiers {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.payment-tier-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  transition: all 0.15s ease;
}
.payment-tier-card:active {
  background: var(--card-hover);
  transform: scale(0.99);
  border-color: var(--accent);
}
.payment-tier-left {
  display: flex;
  align-items: center;
  gap: 12px;
}
.payment-tier-icon {
  font-size: 24px;
}
.payment-tier-info {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}
.payment-tier-title {
  font-size: 15px;
  font-weight: 600;
}
.payment-tier-desc {
  font-size: 12px;
  color: var(--hint);
}
.payment-tier-price {
  font-size: 16px;
  font-weight: 700;
  color: var(--accent);
}

/* Payment methods grid inside modal */
.payment-methods-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-top: 14px;
}
.payment-method-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
  text-align: center;
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
  transition: all 0.15s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.payment-method-card:active {
  background: var(--card-hover);
  border-color: var(--accent);
  transform: scale(0.97);
}

.promo-form-row {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
}
.promo-input {
  flex: 1;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  color: var(--text);
  font-size: 15px;
  text-transform: uppercase;
}
.promo-input:focus {
  outline: none;
  border-color: var(--accent);
}
.btn-promo-activate {
  background: var(--accent);
  color: var(--accent-text);
  border: none;
  border-radius: var(--radius-sm);
  padding: 0 20px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
}
.btn-promo-activate:active {
  opacity: 0.9;
}

.faq-item {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  transition: border-color 0.2s ease;
  flex-shrink: 0;
}
.faq-item-question {
  padding: 14px 16px;
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
}
.faq-item-question > span:first-child {
  flex: 1;
  word-break: break-word;
}
.faq-item-question:hover {
  color: var(--accent);
}
.faq-item-icon {
  font-size: 14px;
  color: var(--hint);
  transition: transform 0.2s ease;
  flex-shrink: 0;
}
.faq-item.open .faq-item-icon {
  transform: rotate(180deg);
}
.faq-item-answer {
  padding: 0 16px 14px 16px;
  font-size: 13px;
  color: var(--hint);
  line-height: 1.5;
  display: none;
  word-wrap: break-word;
  overflow-wrap: anywhere;
  word-break: break-word;
  white-space: normal;
}
.faq-item.open .faq-item-answer {
  display: block;
}

/* ══════════════════════════════════════════════════════
   Loading States & Spinners
   ══════════════════════════════════════════════════════ */
.loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 44px 20px;
  text-align: center;
  animation: fadeIn 0.3s ease;
}

.spinner-lg {
  width: 38px;
  height: 38px;
  border: 3px solid rgba(255, 255, 255, 0.1);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-bottom: 12px;
}

.loading-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}

.loading-sub {
  font-size: 12px;
  color: var(--hint);
}

