:root {
  color-scheme: light dark;
  font-family: 'Segoe UI', system-ui, sans-serif;
  background: #f3f4f8;
  color: #1f2933;
}

body {
  margin: 0;
  min-height: 100vh;
  background: linear-gradient(160deg, #fdfbfb 0%, #ebedee 100%);
  padding-bottom: 96px;
}

header {
  background: #0b7285;
  color: white;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
}

header h1 {
  margin: 0;
  font-size: 1.6rem;
  letter-spacing: 0.5px;
}

main {
  padding: 24px;
  max-width: 1200px;
  margin: 0 auto;
}

.hidden {
  display: none !important;
}

#authSection {
  background: white;
  border-radius: 12px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
  padding: 24px;
  max-width: 520px;
  margin: 40px auto;
}

.tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.tabs button {
  flex: 1;
  padding: 12px;
  border: none;
  border-radius: 8px;
  background: #d0ebff;
  color: #0b7285;
  cursor: pointer;
  font-weight: 600;
  transition: background 0.2s ease;
}

.tabs button.active {
  background: #0b7285;
  color: white;
}

.panel {
  display: none;
}

.panel.active {
  display: block;
}

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

.form.inline {
  flex-direction: row;
}

.form.inline input {
  flex: 1;
}

.form.small input,
.form.small textarea {
  font-size: 0.95rem;
}

label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.95rem;
}

input,
textarea,
select,
button {
  padding: 10px;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  font-size: 1rem;
  font-family: inherit;
}

button {
  background: #0b7285;
  color: white;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  border: none;
}

button:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(11, 114, 133, 0.25);
}

button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  box-shadow: none;
}

fieldset {
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  padding: 12px;
}

legend {
  padding: 0 4px;
  font-weight: 600;
}

fieldset label {
  width: 100%;
}

.checkbox {
  flex-direction: row;
  align-items: center;
  gap: 8px;
}

.checkbox input {
  width: 18px;
  height: 18px;
}

.hint {
  font-size: 0.8rem;
  color: #4a5568;
  margin-top: -4px;
}

.form-inline-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.link-button {
  background: none;
  border: none;
  padding: 0;
  color: #0b7285;
  font-weight: 600;
  cursor: pointer;
}

.link-button:hover {
  text-decoration: underline;
  box-shadow: none;
  transform: none;
}

.form-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.form-actions .secondary,
.secondary {
  background: #e2e8f0;
  color: #0b7285;
  border: 1px solid #cbd5e1;
}

.form-actions .secondary:hover,
.secondary:hover {
  box-shadow: 0 6px 18px rgba(148, 163, 184, 0.35);
  transform: translateY(-1px);
}

.auth-overlay {
  max-width: 520px;
  margin: 24px auto;
}

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

.card {
  background: white;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 4px 20px rgba(15, 23, 42, 0.08);
}

.card h2 {
  margin-top: 0;
  margin-bottom: 12px;
  color: #0b7285;
}

.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.result {
  margin-top: 16px;
}

.result .vehicle,
.result .owner {
  margin-bottom: 12px;
  padding: 12px;
  border-radius: 10px;
  background: #f1f5f9;
}

.vehicle-photo {
  display: block;
  max-width: 100%;
  border-radius: 12px;
  margin-top: 10px;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.12);
}

.error {
  color: #c92a2a;
}

.report {
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 10px;
  margin-top: 8px;
  background: #f8fafc;
}

.chat-layout {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 12px;
  min-height: 360px;
}

.chat-list {
  border-right: 1px solid #e2e8f0;
  padding-right: 12px;
  overflow-y: auto;
}

.chat-item {
  padding: 10px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s ease;
}

.chat-item-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.chat-item-text {
  flex: 1;
}

.chat-delete {
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
  padding: 4px;
  color: #c92a2a;
  transition: transform 0.15s ease;
}

.chat-delete:hover {
  transform: scale(1.1);
}

.chat-item.active {
  background: #d0ebff;
}

.chat-item.unread {
  border-left: 4px solid #c92a2a;
  background: #fff5f5;
}

.chat-item:hover {
  background: #e2f0fb;
}

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

.contact-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}

.contact-actions button {
  align-self: flex-start;
}

.contact-requests {
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 16px;
  background: #f8fafc;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.requests-group h3 {
  margin: 0 0 6px;
  color: #0b7285;
}

.requests-group.secondary h3 {
  color: #475569;
}

.requests-group.secondary {
  border-top: 1px solid #e2e8f0;
  padding-top: 12px;
}

.request-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 10px 12px;
  background: white;
  margin-top: 8px;
  gap: 12px;
}

.request-card.compact {
  align-items: flex-start;
  flex-direction: column;
}

.request-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.request-info span {
  font-size: 0.85rem;
  color: #64748b;
}

.request-actions {
  display: flex;
  gap: 8px;
}

.request-actions button {
  border: none;
  border-radius: 8px;
  padding: 8px 12px;
  cursor: pointer;
  font-weight: 600;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.request-actions button[data-action="approve-request"] {
  background: #0b7285;
  color: white;
}

.request-actions button[data-action="reject-request"] {
  background: #fff0f0;
  color: #c92a2a;
  border: 1px solid #ffc9c9;
}

.request-actions button:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 12px rgba(15, 23, 42, 0.12);
}

.messages {
  flex: 1;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 12px;
  overflow-y: auto;
  background: #f8fafc;
}

.message {
  margin-bottom: 8px;
  max-width: 70%;
  padding: 8px 12px;
  border-radius: 12px;
  line-height: 1.4;
  word-wrap: break-word;
}

.message-author {
  font-size: 0.75rem;
  font-weight: 600;
  opacity: 0.75;
  margin-bottom: 4px;
}

.message.me .message-author {
  text-align: right;
  opacity: 0.9;
}

.message-body {
  white-space: pre-wrap;
}

.message.me {
  margin-left: auto;
  background: #0b7285;
  color: white;
}

.message.them {
  background: white;
  border: 1px solid #d1d9e6;
}

.toast {
  position: fixed;
  bottom: 104px;
  right: 24px;
  background: #0b7285;
  color: white;
  padding: 12px 16px;
  border-radius: 8px;
  box-shadow: 0 6px 18px rgba(11, 114, 133, 0.3);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.toast.hidden {
  opacity: 0;
  transform: translateY(16px);
  pointer-events: none;
}

#logoutBtn {
  padding: 8px 12px;
  font-size: 0.95rem;
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.flow-container {
  max-width: 860px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.view {
  display: none;
  flex-direction: column;
  gap: 16px;
}

.view.active {
  display: flex;
}

.view-header {
  text-align: center;
  background: #0b7285;
  color: #ffffff;
  padding: 18px;
  border-radius: 12px;
  box-shadow: 0 6px 18px rgba(11, 114, 133, 0.2);
}

.view-header h2,
.view-header p {
  color: #ffffff;
}

.view-header h2 {
  margin: 0;
}

.view-header p {
  margin: 8px 0 0;
  font-size: 0.95rem;
}

.view-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.view-footer {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.view-footer .flow-prev,
.view-footer .flow-next {
  flex: 1;
  border-radius: 10px;
  border: none;
  padding: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.view-footer .flow-prev {
  background: #f1f5f9;
  color: #0b7285;
}

.view-footer .flow-next {
  background: #0b7285;
  color: white;
}

.view-footer button:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.12);
}

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

.info-block {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 12px;
  font-size: 0.95rem;
}

.info-block p {
  margin: 6px 0;
}

.vehicle-card {
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 12px;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.06);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.vehicle-card:last-child {
  margin-bottom: 0;
}

.vehicle-card.active {
  border-color: #0b7285;
  box-shadow: 0 6px 18px rgba(11, 114, 133, 0.18);
}

.vehicle-card button {
  margin-top: 8px;
}

.chat-delete {
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
  padding: 4px;
  color: #c92a2a;
  transition: transform 0.15s ease;
}

.chat-delete:hover {
  transform: scale(1.1);
}

.chat-item.active .chat-delete {
  color: #ffffff;
}

.chat-item.unread .chat-delete {
  color: #c92a2a;
}

.chat-item-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.chat-item-text {
  flex: 1;
}

@media (max-width: 960px) {
  .chat-layout {
    grid-template-columns: 1fr;
  }
  .chat-list {
    border-right: none;
    border-bottom: 1px solid #e2e8f0;
    padding-bottom: 12px;
  }
}
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(12px);
  border-top: 1px solid rgba(148, 163, 184, 0.4);
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  padding: 8px 12px;
  z-index: 20;
  box-shadow: 0 -4px 18px rgba(15, 23, 42, 0.08);
}

.bottom-nav.hidden {
  display: none;
}

.bottom-nav__item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 6px;
  border: none;
  background: transparent;
  color: #475569;
  font-size: 0.85rem;
  cursor: pointer;
  transition: transform 0.2s ease, color 0.2s ease;
}

.bottom-nav__item .icon {
  font-size: 1.25rem;
}

.bottom-nav__item.active {
  color: #0b7285;
  font-weight: 600;
}

.bottom-nav__item:hover {
  transform: translateY(-2px);
}

.bottom-nav__item.has-unread {
  color: #0b7285;
  font-weight: 700;
  position: relative;
}

.bottom-nav__item.has-unread::after {
  content: '';
  position: absolute;
  top: 6px;
  right: 18px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #ff4d6d;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.95);
}

.message-popup {
  position: fixed;
  bottom: 96px;
  right: 24px;
  max-width: 320px;
  z-index: 30;
  opacity: 0;
  transform: translateY(16px);
  transition: transform 0.25s ease, opacity 0.25s ease;
}

.message-popup:not(.hidden) {
  opacity: 1;
  transform: translateY(0);
}

.message-popup__content {
  background: white;
  border-radius: 14px;
  padding: 16px;
  box-shadow: 0 18px 38px rgba(15, 23, 42, 0.18);
  border: 1px solid rgba(148, 163, 184, 0.35);
}

.message-popup__title {
  margin: 0 0 6px;
  font-weight: 700;
  color: #0b7285;
}

.message-popup__text {
  margin: 0;
  color: #1f2933;
  line-height: 1.4;
  font-size: 0.95rem;
}

.message-popup__actions {
  display: flex;
  gap: 8px;
  margin-top: 14px;
}

.message-popup__actions button {
  flex: 1;
}

.message-popup__dismiss {
  background: #e2e8f0;
  color: #0b7285;
}

.message-popup__dismiss:hover {
  box-shadow: 0 6px 18px rgba(148, 163, 184, 0.35);
}

@media (max-width: 768px) {
  main {
    padding: 16px;
  }

  .card {
    padding: 16px;
  }

  .view {
    gap: 14px;
  }

  .form.inline {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .form.inline button {
    width: 100%;
  }

  .form-inline-actions {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .contact-requests {
    padding: 12px;
  }

  .requests-group h3 {
    font-size: 0.95rem;
  }

  .message-popup {
    left: 16px;
    right: 16px;
    bottom: 112px;
  }

  .message-popup__actions {
    flex-direction: column;
  }

  .bottom-nav__item.has-unread::after {
    right: 14px;
  }

  .toast {
    right: 16px;
    left: 16px;
    bottom: 112px;
  }

  .chat-item-content {
    gap: 6px;
  }

  .chat-delete {
    font-size: 1rem;
    padding: 2px;
  }
}

@media (max-width: 540px) {
  body {
    padding-bottom: 92px;
  }

  header {
    flex-direction: column;
    gap: 8px;
    text-align: center;
  }

  #authSection {
    margin: 24px auto;
    padding: 20px 16px;
  }

  .view-footer {
    flex-direction: column;
  }

  .view-footer button {
    width: 100%;
  }

  .chat-layout {
    gap: 16px;
  }

  .bottom-nav__item span {
    font-size: 0.8rem;
  }
}
