:root {
  --bg: #f4f4f4;
  --surface: #ffffff;
  --ink: #1c1c1c;
  --muted: #666666;
  --line: #d1d1d1;
  --soft: #f1f1f1;
  --soft-2: #e4e4e4;
  --accent: #1f1f1f;
  --accent-soft: #f7f7f7;
  --ok: #2f2f2f;
  --warn: #555555;
  --danger: #111111;
  --radius: 8px;
  --shadow: 0 12px 32px rgba(0, 0, 0, 0.07);
  color-scheme: light;
  font-family: Inter, Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
}

a {
  color: inherit;
  text-decoration: none;
}

.app-shell {
  display: grid;
  grid-template-columns: 280px 1fr;
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: auto;
  border-right: 1px solid var(--line);
  background: #111827;
  color: #f9fafb;
  padding: 20px;
}

.brand {
  display: grid;
  gap: 6px;
  margin-bottom: 24px;
}

.brand strong {
  font-size: 20px;
}

.brand span {
  color: #cbd5e1;
  font-size: 13px;
  line-height: 1.4;
}

.nav-group {
  margin: 18px 0;
}

.nav-title {
  color: #93a4ba;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  margin-bottom: 8px;
  text-transform: uppercase;
}

.nav-link {
  display: block;
  border-radius: 6px;
  color: #e5e7eb;
  font-size: 14px;
  padding: 8px 10px;
}

.nav-link:hover,
.nav-link.is-active {
  background: rgba(255, 255, 255, 0.1);
}

.content {
  padding: 28px;
}

.intro,
.screen {
  max-width: 1280px;
  margin: 0 auto 24px;
}

.intro {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
}

.intro h1,
.screen h2 {
  margin: 0 0 8px;
}

.intro p,
.screen p {
  color: var(--muted);
  line-height: 1.5;
  margin: 0;
}

.print-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.print-nav {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  padding: 12px;
}

.print-nav .print-button {
  justify-content: center;
  margin-top: 8px;
  width: 100%;
}

.print-button {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: #1f2933;
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  min-height: 38px;
  padding: 8px 12px;
}

.print-button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.print-button:hover {
  border-color: #777777;
  color: #111111;
}

.print-button.primary:hover {
  color: #fff;
}

.screen {
  display: none;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.screen.is-active {
  display: block;
}

.screen-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line);
  padding: 20px 24px;
}

.screen-meta {
  color: var(--muted);
  font-size: 13px;
}

.screen-print-actions {
  margin-top: 0;
}

.wireframe {
  padding: 24px;
}

.frame {
  border: 2px solid #c9c9c9;
  border-radius: var(--radius);
  background: #fbfcfe;
  padding: 16px;
}

.frame-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px dashed var(--line);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 16px;
  padding-bottom: 8px;
  text-transform: uppercase;
}

.row {
  display: grid;
  gap: 12px;
}

.row.two {
  grid-template-columns: 1fr 1fr;
}

.row.three {
  grid-template-columns: repeat(3, 1fr);
}

.row.four {
  grid-template-columns: repeat(4, 1fr);
}

.row.sidebar-layout {
  grid-template-columns: 280px 1fr;
}

.row.detail-layout {
  grid-template-columns: minmax(0, 1.15fr) minmax(320px, 0.85fr);
}

.row.admin-layout {
  grid-template-columns: 220px 1fr;
}

.block,
.small-block,
.hero,
.table,
.card,
.placeholder,
.cta,
.form-block,
.metric,
.note {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--soft);
  color: #303030;
  min-height: 56px;
  padding: 12px;
}

.hero {
  display: grid;
  gap: 14px;
  min-height: 180px;
}

.hero.large {
  min-height: 260px;
}

.small-block {
  min-height: 38px;
  padding: 8px 10px;
}

.placeholder {
  align-items: center;
  background: #ffffff;
  display: flex;
  justify-content: center;
  min-height: 120px;
  overflow: hidden;
  position: relative;
  text-align: center;
}

.photo-main {
  background:
    linear-gradient(90deg, rgba(0, 0, 0, 0.04) 1px, transparent 1px),
    linear-gradient(0deg, rgba(0, 0, 0, 0.04) 1px, transparent 1px),
    #ffffff;
  background-size: 28px 28px;
  min-height: 420px;
  padding: 22px;
}

.card-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(3, 1fr);
}

.car-card {
  align-content: start;
  background: #ffffff;
  color: #1f1f1f;
  display: grid;
  gap: 10px;
  min-height: 250px;
  padding: 10px;
}

.car-visual {
  align-items: center;
  background:
    linear-gradient(90deg, rgba(0, 0, 0, 0.05) 1px, transparent 1px),
    linear-gradient(0deg, rgba(0, 0, 0, 0.05) 1px, transparent 1px),
    #f8f8f8;
  background-size: 22px 22px;
  border: 1px solid var(--line);
  border-radius: 5px;
  display: flex;
  justify-content: center;
  min-height: 118px;
  overflow: hidden;
  position: relative;
}

.car-visual::before {
  background: #ffffff;
  border: 1px solid #bdbdbd;
  border-radius: 999px;
  content: "";
  height: 24px;
  left: 10px;
  position: absolute;
  top: 10px;
  width: 76px;
}

.car-outline {
  align-items: center;
  display: flex;
  height: 58px;
  justify-content: center;
  position: relative;
  width: min(78%, 220px);
}

.car-outline span,
.car-outline i {
  display: none;
}

.car-svg {
  display: block;
  height: auto;
  max-height: 100%;
  opacity: 0.92;
  width: 100%;
}

.car-info {
  display: grid;
  gap: 6px;
}

.car-info strong {
  font-size: 15px;
  line-height: 1.25;
}

.car-info .car-price {
  color: #111111;
  font-size: 18px;
  font-weight: 800;
}

.car-specs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.car-specs span {
  background: #f4f4f4;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: #424242;
  font-size: 11px;
  padding: 4px 7px;
}

.wire-note {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.table {
  display: grid;
  gap: 8px;
  min-height: 260px;
}

.table-row {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1fr 0.9fr 0.8fr;
  gap: 8px;
}

.table-row > span {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 4px;
  min-height: 34px;
  padding: 8px;
}

.form-block {
  background: #ffffff;
  display: grid;
  gap: 8px;
  min-height: 92px;
  position: relative;
}

.form-block::before {
  color: #777777;
  content: "поле формы";
  display: block;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.form-block::after {
  background:
    linear-gradient(90deg, #f7f7f7, #ffffff);
  border: 1px solid #c9c9c9;
  border-radius: 5px;
  content: "";
  display: block;
  height: 36px;
  width: 100%;
}

.cta {
  background: #f7f7f7;
  border-color: #a9a9a9;
  color: #111111;
  font-weight: 700;
  text-align: center;
}

.cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.cta-row .cta,
.cta-row .small-block {
  flex: 1 1 140px;
}

.toolbar {
  align-items: center;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px;
}

.toolbar .small-block {
  flex: 1 1 120px;
}

.status {
  border-radius: 999px;
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  padding: 4px 8px;
}

.status.ok {
  background: #eeeeee;
  color: var(--ok);
}

.status.warn {
  background: #e5e5e5;
  color: var(--warn);
}

.status.danger {
  background: #dcdcdc;
  color: var(--danger);
}

.label {
  color: var(--muted);
  display: block;
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 6px;
  text-transform: uppercase;
}

.flow-links {
  background: #f8fafc;
  border-top: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 16px 24px;
}

.flow-links a {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: #334155;
  font-size: 13px;
  padding: 8px 12px;
}

.flow-links a:hover {
  border-color: #777777;
  color: #111111;
}

.stack {
  display: grid;
  gap: 12px;
}

.note {
  background: #f6f6f6;
  border-color: #c7c7c7;
  color: #3b3b3b;
}

.gallery-shell {
  align-items: center;
  display: grid;
  gap: 14px;
  grid-template-columns: 44px 1fr 44px;
  height: 100%;
  min-height: 376px;
  width: 100%;
}

.gallery-stage {
  align-items: center;
  display: grid;
  gap: 18px;
  justify-items: center;
}

.gallery-arrow {
  align-items: center;
  background: #ffffff;
  border: 1px solid #bdbdbd;
  border-radius: 50%;
  color: #222222;
  display: flex;
  font-size: 28px;
  font-weight: 700;
  height: 42px;
  justify-content: center;
  width: 42px;
}

.large-car {
  height: 112px;
  width: min(78%, 520px);
}

.gallery-caption {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: #333333;
  font-size: 13px;
  padding: 10px 12px;
  text-align: center;
}

.thumb-strip {
  display: grid;
  gap: 8px;
  grid-column: 1 / -1;
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

.thumb-strip span {
  background: #ffffff;
  border: 1px solid #c9c9c9;
  border-radius: 5px;
  display: block;
  height: 48px;
  position: relative;
}

.thumb-strip span::before {
  background: url("../assets/car-placeholder.svg") center / 76% auto no-repeat;
  bottom: 0;
  content: "";
  left: 0;
  position: absolute;
  right: 0;
  top: 0;
}

.map-preview {
  align-items: stretch;
  background:
    linear-gradient(90deg, rgba(0, 0, 0, 0.08) 1px, transparent 1px),
    linear-gradient(0deg, rgba(0, 0, 0, 0.08) 1px, transparent 1px),
    #ffffff;
  background-size: 34px 34px;
  display: grid;
  min-height: 240px;
  padding: 0;
}

.map-preview::before,
.map-preview::after {
  background: #d8d8d8;
  content: "";
  position: absolute;
}

.map-preview::before {
  height: 18px;
  left: -20px;
  right: -20px;
  top: 50%;
  transform: rotate(-10deg);
}

.map-preview::after {
  bottom: -20px;
  left: 58%;
  top: -20px;
  width: 18px;
  transform: rotate(18deg);
}

.map-pin {
  align-items: center;
  background: #111111;
  border-radius: 50% 50% 50% 0;
  color: #ffffff;
  display: flex;
  font-size: 10px;
  font-weight: 800;
  height: 34px;
  justify-content: center;
  left: 48%;
  position: absolute;
  top: 42%;
  transform: rotate(-45deg);
  width: 34px;
  z-index: 2;
}

.map-pin span {
  transform: rotate(45deg);
}

.map-label {
  align-self: end;
  background: rgba(255, 255, 255, 0.92);
  border-top: 1px solid var(--line);
  color: #333333;
  font-size: 12px;
  padding: 10px 12px;
  position: relative;
  z-index: 3;
}

.upload-preview {
  align-items: stretch;
  background: #ffffff;
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(4, 1fr);
  min-height: 180px;
  padding: 12px;
}

.upload-preview span {
  align-items: center;
  background: #f6f6f6;
  border: 1px dashed #9b9b9b;
  border-radius: 6px;
  color: #555555;
  display: flex;
  font-size: 12px;
  justify-content: center;
  min-height: 70px;
  text-align: center;
}

pre {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  line-height: 1.5;
  overflow: auto;
  padding: 12px;
  white-space: pre-wrap;
}

pre code {
  background: transparent;
  color: inherit;
  padding: 0;
}

.mobile-frame {
  border: 10px solid #111827;
  border-radius: 28px;
  margin: 0 auto;
  max-width: 390px;
  overflow: hidden;
  padding: 10px;
}

.mobile-frame .frame-title {
  justify-content: center;
}

.map-line {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.map-node {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 10px;
}

.arrow {
  color: var(--muted);
}

@media (max-width: 1100px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    height: auto;
    position: static;
  }

  .row.sidebar-layout,
  .row.detail-layout,
  .row.admin-layout,
  .row.two,
  .row.three,
  .row.four,
  .card-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .content {
    padding: 12px;
  }

  .screen-header {
    display: grid;
  }

  .wireframe {
    padding: 14px;
  }

  .table-row {
    grid-template-columns: 1fr;
  }
}

@media print {
  @page {
    margin: 10mm;
    size: A4;
  }

  body {
    background: #fff;
  }

  .sidebar,
  .intro,
  .flow-links,
  .print-toolbar {
    display: none !important;
  }

  .app-shell {
    display: block;
  }

  .content {
    padding: 0;
  }

  .screen {
    border: 0;
    border-radius: 0;
    box-shadow: none;
    margin: 0;
    max-width: none;
    overflow: visible;
  }

  body.print-current .screen {
    display: none !important;
  }

  body.print-current .screen.is-active {
    display: block !important;
  }

  body.print-all .screen {
    break-after: page;
    display: block !important;
    page-break-after: always;
  }

  body.print-all .screen:last-of-type {
    break-after: auto;
    page-break-after: auto;
  }

  .screen-header {
    padding: 0 0 12px;
  }

  .wireframe {
    padding: 12px 0 0;
  }

  .frame,
  .mobile-frame {
    break-inside: avoid;
    box-shadow: none;
  }
}
