html {
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

body {
  font-family: Inter, Arial, sans-serif;
}

.theme-toggle {
  position: fixed;
  top: max(0.75rem, env(safe-area-inset-top, 0px));
  right: max(0.75rem, env(safe-area-inset-right, 0px));
  z-index: 50;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 999px;
  border: 1px solid #52525b;
  background: #262626;
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.35);
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.theme-toggle:hover {
  transform: scale(1.06);
  border-color: #65a30d;
}

.btn-messenger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.55rem 1rem;
  border-radius: 0.75rem;
  font-weight: 700;
  font-size: 0.9rem;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.btn-messenger:hover {
  transform: translateY(-1px);
}

.btn-messenger-wa {
  background: #25d366;
  color: #fff;
  box-shadow: 0 6px 12px rgba(37, 211, 102, 0.35);
}

.btn-messenger-wa:hover {
  background: #1ebe57;
}

.btn-messenger-tg {
  background: #229ed9;
  color: #fff;
  box-shadow: 0 6px 12px rgba(34, 158, 217, 0.35);
}

.btn-messenger-tg:hover {
  background: #1c8cbe;
}

.page-bg {
  background:
    radial-gradient(circle at 10% 10%, rgba(132, 204, 22, 0.14), transparent 30%),
    radial-gradient(circle at 90% 20%, rgba(194, 65, 12, 0.12), transparent 35%),
    #1f1f1f;
}

.card {
  background: #262626;
  border: 1px solid #3f3f46;
  border-radius: 1rem;
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.35);
}

.metric-card {
  background: #303030;
  border-color: #4b5563;
  transition: all 0.2s ease;
}

.metric-card:hover {
  transform: scale(1.02);
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.45);
  border-color: #65a30d;
}

.card-main {
  background: #202020;
  border: 1px solid #3f3f46;
  border-radius: 1rem;
  box-shadow: 0 12px 26px rgba(0, 0, 0, 0.45);
}

.hero-image {
  background-image: linear-gradient(rgba(0, 0, 0, 0.25), rgba(0, 0, 0, 0.2)), url("https://images.unsplash.com/photo-1590674899484-d5640e854abe?auto=format&fit=crop&w=1400&q=80");
  background-size: cover;
  background-position: center;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  background: #3f6212;
  color: #ecfccb;
  font-size: 0.75rem;
  font-weight: 700;
}

.field {
  width: 100%;
  background: #171717;
  border: 1px solid #52525b;
  border-radius: 0.75rem;
  padding: 0.75rem 0.85rem;
  color: #f5f5f4;
  transition: all 0.2s ease;
}

.field:focus {
  outline: none;
  border-color: #4d7c0f;
  box-shadow: 0 0 0 3px rgba(77, 124, 15, 0.18);
}

.btn-primary,
.btn-accent {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  padding: 0.8rem 1.1rem;
  border-radius: 0.75rem;
  font-weight: 700;
  transition: all 0.2s ease;
  box-shadow: 0 8px 14px rgba(28, 25, 23, 0.12);
}

.btn-primary {
  background: #65a30d;
  color: #fff;
}

.btn-primary:hover {
  background: #4d7c0f;
  transform: scale(1.02);
}

.btn-accent {
  background: #c2410c;
  color: #fff;
}

.btn-accent:hover {
  background: #9a3412;
  transform: scale(1.02);
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

/* Светлая тема */
[data-theme="light"] .page-bg {
  background:
    radial-gradient(circle at 10% 10%, rgba(132, 204, 22, 0.12), transparent 32%),
    radial-gradient(circle at 90% 20%, rgba(194, 65, 12, 0.08), transparent 36%),
    #fafaf9;
}

html[data-theme="light"] body.page-bg.text-stone-100 {
  color: #1c1917 !important;
}

[data-theme="light"] .card {
  background: #ffffff;
  border-color: #e7e5e4;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .metric-card {
  background: #f5f5f4;
  border-color: #d6d3d1;
}

[data-theme="light"] .metric-card:hover {
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.12);
  border-color: #65a30d;
}

[data-theme="light"] .card-main {
  background: #ffffff;
  border-color: #e7e5e4;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .field {
  background: #ffffff;
  border-color: #d6d3d1;
  color: #1c1917;
}

[data-theme="light"] .field:focus {
  border-color: #4d7c0f;
  box-shadow: 0 0 0 3px rgba(77, 124, 15, 0.2);
}

[data-theme="light"] .badge {
  background: #d9f99d;
  color: #365314;
}

[data-theme="light"] .text-stone-100,
[data-theme="light"] .text-stone-200,
[data-theme="light"] .text-stone-300,
[data-theme="light"] .text-stone-400 {
  color: #44403c !important;
}

[data-theme="light"] h1,
[data-theme="light"] h2,
[data-theme="light"] h3,
[data-theme="light"] h4,
[data-theme="light"] .font-semibold:not(.text-stone-300):not(.text-stone-400) {
  color: #1c1917;
}

[data-theme="light"] .border-stone-700 {
  border-color: #d6d3d1 !important;
}

[data-theme="light"] .bg-stone-800 {
  background-color: #e7e5e4 !important;
}

[data-theme="light"] .bg-stone-900 {
  background-color: #f5f5f4 !important;
}

[data-theme="light"] .text-lime-400 {
  color: #3f6212 !important;
}

[data-theme="light"] .text-red-400 {
  color: #b91c1c !important;
}

[data-theme="light"] .theme-toggle {
  background: #ffffff;
  border-color: #d6d3d1;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
}

/* Карточки заявок на главной — hover без «черноты» */
html[data-theme="dark"] .order-card-btn:hover {
  background-color: #3f3f46 !important;
  border-color: #57534e !important;
}

html[data-theme="light"] .order-card-btn:hover {
  background-color: #e7e5e4 !important;
  border-color: #d6d3d1 !important;
}

html[data-theme="light"] .order-card-btn .text-stone-400 {
  color: #78716c !important;
}

/* Админ: строка таблицы — hover отдельно от Tailwind hover:bg-stone-800 (в светлой теме давал почти чёрный) */
.admin-table-row {
  background-color: transparent;
}

html[data-theme="dark"] .admin-table-row:hover {
  background-color: rgba(63, 63, 70, 0.55);
}

html[data-theme="light"] .admin-table-row:hover {
  background-color: #f5f5f4;
}

.admin-page {
  overflow-x: hidden;
  max-width: 100vw;
}

.admin-page main {
  max-width: 100%;
  overflow-x: hidden;
  box-sizing: border-box;
}

.admin-scroll-hint {
  display: none;
  font-size: 0.7rem;
  color: #a8a29e;
  margin-bottom: 0.35rem;
  line-height: 1.3;
}

.admin-table-wrap {
  display: block;
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: visible;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  scrollbar-gutter: stable;
  touch-action: pan-x;
  border: 1px solid #3f3f46;
  border-radius: 0.5rem;
  background: rgba(24, 24, 27, 0.35);
}

.admin-table-wrap table {
  width: max-content;
  min-width: 100%;
}

@media (max-width: 1024px) {
  .admin-scroll-hint {
    display: block;
  }

  .admin-page .card-main,
  .admin-page .card {
    padding: 0.85rem !important;
  }

  .admin-page h1 {
    font-size: 1.2rem;
    line-height: 1.3;
  }

  .admin-page h2 {
    font-size: 1rem;
  }

  .admin-table-wrap table {
    min-width: 920px;
    font-size: 0.72rem;
  }

  .admin-table-wrap th,
  .admin-table-wrap td {
    padding: 0.35rem 0.45rem !important;
    vertical-align: top;
  }

  .admin-contact-btn {
    min-height: 34px;
    padding: 0.3rem 0.45rem !important;
    font-size: 0.62rem !important;
  }

  .btn-complete {
    font-size: 0.62rem;
    padding: 0.28rem 0.4rem;
    white-space: normal;
    max-width: 5.5rem;
    line-height: 1.2;
  }

  .admin-page .order-price {
    width: 4.25rem !important;
    min-width: 0;
    padding: 0.3rem 0.35rem !important;
    font-size: 0.7rem;
  }

  .admin-page .driver-select {
    max-width: 7rem;
    min-width: 5.5rem;
    padding: 0.3rem 0.25rem !important;
    font-size: 0.68rem;
  }

  .admin-page #pushBlock {
    font-size: 0.8rem;
  }

  .admin-page .theme-toggle {
    width: 2.25rem;
    height: 2.25rem;
    font-size: 1rem;
  }
}

@media (max-width: 640px) {
  .admin-page main {
    padding-left: 0.5rem !important;
    padding-right: 0.5rem !important;
  }

  .admin-nav-link {
    padding: 0.35rem 0.55rem;
    font-size: 0.72rem;
  }

  .admin-page .filter-btn {
    flex: 1 1 auto;
    text-align: center;
  }

  .admin-contact-btn {
    min-height: 32px;
    align-items: center;
  }

  .admin-page .admin-stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

html[data-theme="light"] .admin-table-wrap {
  background: rgba(245, 245, 244, 0.8);
  border-color: #d6d3d1;
}

.status-badge {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 600;
}

.status-badge-active {
  background: rgba(245, 158, 11, 0.2);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.35);
}

.status-badge-done {
  background: rgba(132, 204, 22, 0.15);
  color: #a3e635;
  border: 1px solid rgba(132, 204, 22, 0.35);
}

.btn-complete {
  border-radius: 0.5rem;
  padding: 0.35rem 0.65rem;
  font-size: 0.75rem;
  font-weight: 600;
  background: #3f6212;
  color: #ecfccb;
  border: 1px solid #65a30d;
  cursor: pointer;
  white-space: nowrap;
}

.btn-complete:hover:not(:disabled) {
  background: #4d7c0f;
}

.btn-complete:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.admin-row-completed {
  opacity: 0.72;
}

/* Админ: заявка карточкой — помещается по ширине экрана, без горизонтальной прокрутки.
   Кнопка смены статуса стоит рядом с кнопками связи. */
.order-row {
  border: 1px solid #3f3f46;
  background: rgba(41, 37, 36, 0.6);
  border-radius: 0.75rem;
  padding: 0.7rem 0.8rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.875rem;
  overflow-wrap: anywhere;
}

html[data-theme="light"] .order-row {
  border-color: #e7e5e4;
  background: #ffffff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}

.order-row-completed {
  opacity: 0.68;
}

.order-row-line {
  line-height: 1.35;
}

.order-row-label {
  color: #a8a29e;
  font-size: 0.78rem;
}

html[data-theme="light"] .order-row-label {
  color: #78716c;
}

.analytics-chart {
  padding: 0.25rem 0;
}

.analytics-bar-wrap {
  height: 100%;
  justify-content: flex-end;
}

.analytics-bar {
  background: linear-gradient(180deg, #a3e635 0%, #65a30d 100%);
  min-height: 4px;
}

.admin-nav-link {
  display: inline-block;
  padding: 0.4rem 0.85rem;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: #a8a29e;
  border: 1px solid transparent;
}

.admin-nav-link:hover {
  color: #ecfccb;
  background: rgba(63, 63, 70, 0.5);
}

.admin-nav-link-active {
  color: #ecfccb;
  background: #3f6212;
  border-color: #65a30d;
}

.legal-doc h1 {
  line-height: 1.25;
}

.legal-section {
  margin-bottom: 1.25rem;
}

.legal-section h2 {
  font-size: 1.05rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: #e7e5e4;
}

.legal-section p,
.legal-section li {
  color: #d6d3d1;
  line-height: 1.6;
  margin-bottom: 0.5rem;
}

.legal-section ul {
  list-style: disc;
  padding-left: 1.25rem;
}

.legal-section code {
  font-size: 0.85em;
  background: #3f3f46;
  padding: 0.1rem 0.35rem;
  border-radius: 0.25rem;
}

.consent-row {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  padding: 0.75rem 0;
}

.consent-row input[type="checkbox"] {
  margin-top: 0.2rem;
  width: 1.1rem;
  height: 1.1rem;
  accent-color: #65a30d;
  flex-shrink: 0;
}

.consent-row label {
  font-size: 0.875rem;
  color: #d6d3d1;
  line-height: 1.45;
}

.consent-row a {
  color: #a3e635;
  text-decoration: underline;
}

.cookie-banner {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 60;
  padding: 0.75rem;
  padding-bottom: max(0.75rem, env(safe-area-inset-bottom, 0px));
  background: rgba(23, 23, 23, 0.96);
  border-top: 1px solid #3f3f46;
  box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.45);
}

.cookie-banner.hidden {
  display: none;
}

.cookie-banner__inner {
  max-width: 56rem;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

@media (min-width: 640px) {
  .cookie-banner__inner {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
}

.cookie-banner__text {
  font-size: 0.875rem;
  color: #d6d3d1;
  line-height: 1.45;
  margin: 0;
}

.cookie-banner__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  flex-shrink: 0;
}

.has-cookie-banner main {
  padding-bottom: 6rem;
}

.legal-footer-links {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid #3f3f46;
}

.mobile-call-bar {
  display: none;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 55;
  gap: 0.6rem;
  padding: 0.6rem 0.75rem;
  padding-bottom: max(0.6rem, env(safe-area-inset-bottom, 0px));
  background: rgba(23, 23, 23, 0.97);
  border-top: 1px solid #3f3f46;
  box-shadow: 0 -8px 20px rgba(0, 0, 0, 0.4);
}

[data-theme="light"] .mobile-call-bar {
  background: rgba(255, 255, 255, 0.97);
  border-color: #e7e5e4;
}

@media (max-width: 640px) {
  .mobile-call-bar {
    display: flex;
    padding: 0.45rem 0.6rem;
    padding-bottom: max(0.45rem, env(safe-area-inset-bottom, 0px));
    gap: 0.5rem;
  }

  .mobile-call-bar .btn-primary,
  .mobile-call-bar .btn-messenger {
    padding: 0.6rem 0.75rem;
    font-size: 0.85rem;
  }

  body:has(#mobileCallBar) main {
    padding-bottom: 4.5rem;
  }

  .field {
    padding: 0.6rem 0.75rem;
    font-size: 0.95rem;
  }

  section .btn-primary,
  section .btn-accent {
    padding: 0.65rem 0.9rem;
    font-size: 0.92rem;
  }

  .card-main,
  .card {
    padding: 1.1rem !important;
  }

  main {
    padding-left: 0.75rem !important;
    padding-right: 0.75rem !important;
  }
}
