html {
  scrollbar-gutter: stable;
}

html.modal-open {
  overflow: hidden;
}

.wrap {
  max-width: 1100px;
  margin: 16px auto;
  padding: 0 18px 32px;
}

.wrap > .card {
  padding: 18px;
  display: block;
}

/* The detail page root is not a clickable listing card.
   Suppress the directory hover lift: a non-none transform on this
   ancestor would scope position:fixed descendants (the modal overlay)
   to this element instead of the viewport. */
.wrap > .card:hover {
  transform: none;
}

.wrap .grid {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 18px;
  align-items: start;
}

.logo {
  width: 160px;
  height: 160px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--color-chip-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.logo .fallback {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  background: var(--color-chip-bg);
  border: 1px solid var(--color-border);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  letter-spacing: 0.6px;
}

.title {
  font-size: clamp(1.7rem, 2.6vw, 2.2rem);
  margin: 0 0 8px;
  line-height: 1.1;
}

.titleRow {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.detailHeaderBar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 10px;
}

.detailHeaderBar__actions {
  flex: 0 0 auto;
  min-width: 0;
}

.detailBreadcrumb {
  min-width: 0;
}

.detailBreadcrumb__list {
  list-style: none;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0;
  padding: 0;
  color: var(--muted);
  font-size: 13px;
}

.detailBreadcrumb__item {
  min-width: 0;
}

.detailBreadcrumb__item--separator {
  flex: 0 0 auto;
}

.detailBreadcrumb__link,
.detailBreadcrumb__current {
  display: inline-block;
  max-width: min(100%, 44ch);
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: top;
  white-space: nowrap;
}

.detailBreadcrumb__link {
  color: var(--muted);
  text-decoration: none;
}

.detailBreadcrumb__link:hover {
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.detailBreadcrumb__current {
  color: var(--text);
  font-weight: 600;
}

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

.chips {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--color-chip-bg);
  font-size: 13px;
  color: var(--color-chip-text);
}

.chip--new {
  color: var(--color-status-new-text);
  border-color: var(--color-status-new-border);
  background: var(--color-status-new-bg);
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  box-shadow: 0 8px 18px rgba(141, 219, 184, 0.18);
}

.titleBadge {
  flex-shrink: 0;
  margin-top: 4px;
}

.section {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.companyProfileText {
  color: var(--text);
  line-height: 1.7;
  white-space: pre-line;
}

.kv {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 10px 14px;
  margin-top: 10px;
}

.locationList {
  display: grid;
  gap: 12px;
  margin-top: 10px;
}

.locationCard {
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
}

.locationCard__title {
  font-weight: 700;
}

.locationHint {
  margin-top: 12px;
  font-size: 14px;
}

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

.v {
  color: var(--text);
}

.v a {
  color: var(--brand);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.wrap .actions {
  justify-content: flex-start;
  margin-top: 14px;
}

.claimBox,
.contactLeadBox {
  margin-top: 18px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.claimTitle,
.contactLeadTitle {
  font-weight: 700;
  margin-bottom: 6px;
}

.claimMsg {
  margin-top: 10px;
  font-size: 13px;
  color: var(--muted);
}

.claimMsg.ok {
  color: #166534;
}

.claimMsg.error {
  color: #b91c1c;
}

.contactLeadText {
  color: var(--muted);
  font-size: 14px;
  margin-bottom: 12px;
}

.contactLeadBox--restricted .actions {
  margin-top: 12px;
}

.modalOverlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.35);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 2000;
  will-change: transform;
}

.modalOverlay[hidden] {
  display: none !important;
}

.modalCard {
  width: min(100%, 640px);
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--panel);
  box-shadow: 0 14px 30px rgba(15, 23, 42, 0.1);
  padding: 18px;
  display: grid;
  gap: 14px;
  max-height: calc(100vh - 40px);
  max-height: calc(100dvh - 40px);
  overflow-y: auto;
  overscroll-behavior: contain;
}

.modalHeader {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.modalTitle {
  margin: 0;
  font-size: 22px;
  line-height: 1.2;
}

.iconBtn {
  appearance: none;
  border: 1px solid var(--border);
  background: #ffffff;
  color: var(--text);
  border-radius: 12px;
  min-width: 40px;
  height: 40px;
  cursor: pointer;
  font-size: 18px;
}

.iconBtn:hover {
  border-color: rgba(21, 88, 239, 0.28);
  background: var(--color-section-bg);
}

.iconBtn:focus-visible {
  outline: none;
  border-color: rgba(21, 88, 239, 0.4);
  box-shadow: 0 0 0 3px rgba(21, 88, 239, 0.16);
}

.leadForm {
  display: grid;
  gap: 14px;
}

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

.field {
  display: grid;
  gap: 6px;
}

.field--full {
  grid-column: 1 / -1;
}

.field textarea {
  width: 100%;
  border-radius: 13px;
  border: 1px solid var(--border);
  background: #ffffff;
  color: var(--text);
  padding: 11px 12px;
  font: inherit;
  outline: none;
  min-height: 140px;
  resize: vertical;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

.field textarea:focus {
  border-color: rgba(21, 88, 239, 0.62);
  box-shadow: 0 0 0 3px rgba(21, 88, 239, 0.16);
  background: #ffffff;
}

.field textarea[aria-invalid="true"],
.field input[aria-invalid="true"] {
  border-color: rgba(220, 38, 38, 0.7);
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.12);
}

.fieldNote {
  color: var(--muted);
  font-size: 12px;
}

.requiredMark {
  color: #dc2626;
  margin-left: 4px;
}

.stubNote {
  border: 1px dashed var(--border);
  border-radius: 14px;
  padding: 10px 12px;
  color: var(--muted);
  font-size: 13px;
  background: #ffffff;
}

.stubNote.ok {
  border-style: solid;
  border-color: rgba(34, 197, 94, 0.35);
  color: #166534;
  background: rgba(34, 197, 94, 0.08);
}

.stubNote.error {
  border-style: solid;
  border-color: rgba(220, 38, 38, 0.35);
  color: #b91c1c;
  background: rgba(220, 38, 38, 0.08);
}

#leadFormState:empty {
  display: none;
}

.error {
  border: 1px solid rgba(220, 38, 38, 0.35);
  background: rgba(220, 38, 38, 0.08);
  padding: 14px;
  border-radius: var(--radius);
  color: #991b1b;
}

.skeleton {
  opacity: 0.8;
  animation: pulse 1.25s ease-in-out infinite;
}

.small {
  font-size: 12px;
}

.hidden {
  display: none !important;
}

@keyframes pulse {
  0% { opacity: 0.55; }
  50% { opacity: 1; }
  100% { opacity: 0.55; }
}

@media (max-width: 720px) {
  .wrap .grid {
    grid-template-columns: 1fr;
  }

  .kv {
    grid-template-columns: 1fr;
  }

  .titleRow {
    flex-direction: column;
    align-items: flex-start;
  }

  .detailHeaderBar {
    gap: 8px;
  }

  .detailBreadcrumb__list {
    font-size: 12px;
  }

  .modalOverlay {
    align-items: flex-end;
    padding: 0;
  }

  .modalCard {
    width: 100%;
    border-radius: 16px 16px 0 0;
    padding: 18px 18px max(24px, env(safe-area-inset-bottom));
    max-height: 90vh;
    max-height: 90dvh;
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  .formGrid {
    grid-template-columns: 1fr;
  }
}
