/* Requested UI refinements. Loaded after the existing public visual layer;
   the administrator panel and all previously immutable assets stay intact. */

/* Map heading: allow its complete title and description to breathe rather
   than clipping their RTL glyphs against an unpadded edge. */
html[data-dg-design="editorial"] body.page-route-map .page-hero.map-hero {
  display: block !important;
  height: auto !important;
  min-height: 0 !important;
  padding: 18px 20px !important;
  overflow: visible !important;
}
html[data-dg-design="editorial"] body.page-route-map .map-hero h1 {
  display: block !important;
  max-width: 100% !important;
  margin: 0 !important;
  font-size: clamp(1.25rem, 3vw, 1.65rem) !important;
  line-height: 1.65 !important;
  white-space: normal !important;
  overflow-wrap: anywhere;
}
html[data-dg-design="editorial"] body.page-route-map .map-hero p {
  display: block !important;
  max-width: 100% !important;
  margin: 6px 0 0 !important;
  font-size: .9rem !important;
  line-height: 1.9 !important;
  white-space: normal !important;
  overflow-wrap: anywhere;
}

/* Recently viewed: align its header with its cards and avoid reserved blank
   content-visibility space when the list is empty or off-screen. */
html[data-dg-design="editorial"] body.page-route-home #recent-wrap[hidden] { display: none !important; }
html[data-dg-design="editorial"] body.page-route-home #recent-wrap {
  content-visibility: visible !important;
  contain-intrinsic-size: none !important;
  padding-block: 14px 4px !important;
}
html[data-dg-design="editorial"] body.page-route-home #recent-wrap .section-head {
  display: block !important;
  width: 100% !important;
  max-width: none !important;
  margin: 0 0 12px !important;
  padding: 0 !important;
  text-align: start;
}
html[data-dg-design="editorial"] body.page-route-home #recent-wrap .section-head > div {
  width: 100%;
  min-width: 0;
}
html[data-dg-design="editorial"] body.page-route-home #recent-wrap .eyebrow {
  border: 0 !important;
  padding: 0 !important;
}
html[data-dg-design="editorial"] body.page-route-home #recent-title {
  margin: 7px 0 0 !important;
  line-height: 1.65 !important;
  text-align: start;
}
html[data-dg-design="editorial"] body.page-route-home #recent-row { padding-block-end: 5px !important; }
html[data-dg-design="editorial"] body.page-route-home #recent-wrap:not([hidden]) + .scope-categories { padding-block-start: 18px !important; }

/* Count and guidance are separate lines in the directory header. */
html[data-dg-design="editorial"] body .dir-hero {
  height: auto !important;
  min-height: 0 !important;
  padding: 18px 20px !important;
}
html[data-dg-design="editorial"] body .dir-hero h1 {
  max-width: 100% !important;
  overflow-wrap: anywhere;
}
html[data-dg-design="editorial"] body .dir-hero :is(.dir-hero-count,.dir-hero-guidance) {
  display: block !important;
  max-width: 100% !important;
  color: #fff !important;
  font-size: .86rem !important;
  line-height: 1.8 !important;
  text-shadow: 0 1px 4px rgba(0,0,0,.85);
}
html[data-dg-design="editorial"] body .dir-hero .dir-hero-count { margin: 10px 0 0 !important; }
html[data-dg-design="editorial"] body .dir-hero .dir-hero-guidance { margin: 3px 0 0 !important; }
html[data-dg-design="editorial"] body.page-route-businesses .dir-meta {
  display: flex !important;
  flex-direction: column !important;
  align-items: flex-start !important;
  gap: 6px !important;
}

/* Profile navigation: consistent button widths and centred partial rows. */
html[data-dg-design="editorial"] body.biz-page .biz-section-nav {
  display: grid !important;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 7px;
}
html[data-dg-design="editorial"] body.biz-page .biz-section-nav a { width: auto; min-width: 0; }
@media (min-width: 361px) and (max-width: 760px) {
  html[data-dg-design="editorial"] body.biz-page .biz-section-nav { grid-template-columns: repeat(6, minmax(0,1fr)) !important; }
  html[data-dg-design="editorial"] body.biz-page .biz-section-nav a { grid-column: span 2; }
  html[data-dg-design="editorial"] body.biz-page .biz-section-nav a:nth-last-child(2):nth-child(3n + 1) { grid-column: 2 / span 2; }
  html[data-dg-design="editorial"] body.biz-page .biz-section-nav a:last-child:nth-child(3n + 2) { grid-column: 4 / span 2; }
  html[data-dg-design="editorial"] body.biz-page .biz-section-nav a:last-child:nth-child(3n + 1) { grid-column: 3 / span 2; }
}
@media (max-width: 360px) {
  html[data-dg-design="editorial"] body.biz-page .biz-section-nav { grid-template-columns: repeat(2, minmax(0,1fr)) !important; }
  html[data-dg-design="editorial"] body.biz-page .biz-section-nav a:last-child:nth-child(odd) { grid-column: 1 / -1; }
}

/* The form itself used overflow:clip, cutting off both sides of the focused
   input outline. Leave the parent card padding to contain the complete ring. */
html[data-dg-design="editorial"] body.biz-page #qa .qa-question-form { overflow: visible !important; }

/* Remove only the decorative line beside the profile kicker. */
html[data-dg-design="editorial"] body.biz-page .biz-profile-kicker::before { content: none !important; display: none !important; }

/* Restore the old, full-size image geometry in the business directory. The
   existing category-art label is retained so an illustration is not mistaken
   for an owner's actual photograph. */
html[data-dg-design="editorial"] body [data-dir-grid] .biz-card-symbol-label {
  inset-inline-start: auto !important;
  inset-inline-end: 10px !important;
  width: max-content;
  max-width: calc(100% - 20px);
  padding: 3px 8px !important;
  font-size: .68rem !important;
}
html[data-dg-design="editorial"] body [data-dir-grid] .biz-card .biz-thumb:not(.has-photo) .biz-thumb-art {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  background: transparent !important;
}
html[data-dg-design="editorial"] body [data-dir-grid] .biz-card .biz-thumb:not(.has-photo) .biz-thumb-art img {
  width: 100% !important;
  height: 100% !important;
  border: 0 !important;
  border-radius: 12px !important;
  box-shadow: none !important;
  object-fit: cover !important;
}
@media (max-width: 760px) {
  html[data-dg-design="editorial"] body [data-dir-grid] .biz-card .biz-thumb:not(.has-photo) .biz-thumb-art img {
    position: absolute !important;
    inset: 0 !important;
    object-fit: contain !important;
  }
}
@media (min-width: 761px) {
  html[data-dg-design="editorial"] body [data-dir-grid] .biz-card .biz-thumb:not(.has-photo) .biz-thumb-art img {
    position: static !important;
    inset: auto !important;
  }
}
@media (min-width: 380px) and (max-width: 760px) {
  html[data-dg-design="editorial"] body [data-dir-grid] .biz-card {
    grid-template-columns: minmax(0,1fr) !important;
    grid-template-areas: "media" "body" !important;
  }
  html[data-dg-design="editorial"] body [data-dir-grid] .biz-card > .card-media {
    grid-area: media !important;
    align-self: auto !important;
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    margin: 0 !important;
    border-radius: 0 !important;
    aspect-ratio: 16 / 9 !important;
  }
  html[data-dg-design="editorial"] body [data-dir-grid] .biz-card > .card-body { grid-area: body !important; }
}

/* Owner deals: the existing site select component is used only for these two
   fields. Native selects remain in the form for submission and no-JS fallback. */
html[data-dg-design="editorial"] body .owner-shell form[action="/my/deal/new"] .dg-select-trigger {
  min-height: 48px;
  border: 1px solid var(--dg-formal-line) !important;
  border-radius: 12px !important;
  background: var(--dg-formal-paper) !important;
  color: var(--dg-formal-ink) !important;
}
html[data-dg-design="editorial"] body .owner-shell form[action="/my/deal/new"] .dg-select-trigger:focus-visible {
  outline: 3px solid #bd852f !important;
  outline-offset: 2px;
}
html[data-dg-design="editorial"] body .owner-shell form[action="/my/deal/new"] .dg-select-val {
  min-width: 0;
  overflow-wrap: anywhere;
  line-height: 1.7;
  text-align: start;
}
html[data-dg-design="editorial"] body .owner-shell form[action="/my/deal/new"] .dg-select-panel {
  background: var(--dg-formal-paper) !important;
  border-color: var(--dg-formal-line) !important;
}
html[data-dg-design="editorial"] body .owner-shell form[action="/my/deal/new"] .dg-select-opt {
  min-height: 44px;
  color: var(--dg-formal-ink);
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}
html[data-dg-design="editorial"] body .owner-shell form[action="/my/deal/new"] .dg-select-opt:focus-visible {
  outline: 2px solid #bd852f;
  outline-offset: -2px;
}
@media (max-width: 900px) {
  html[data-dg-design="editorial"]:has(body.page-route-my form[action="/my/deal/new"]) {
    scroll-padding-block-start: 116px;
    scroll-padding-block-end: calc(84px + env(safe-area-inset-bottom));
  }
  html[data-dg-design="editorial"] body .owner-shell form[action="/my/deal/new"] .dg-select-list {
    max-height: min(240px, max(100px, calc(100vh - 330px)));
  }
}
