/* Final Brief Builder presentation overrides. Loaded after the legacy stylesheet. */

/* One collapse control per card, aligned with its status. */
.builder .form-section > .section-heading > .section-toggle {
  display: none !important;
}

.builder .form-section .section-heading-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-left: auto;
}

.builder .form-section .section-heading-actions > .section-toggle {
  display: grid;
  flex: 0 0 34px;
  width: 34px;
  min-height: 34px;
  place-items: center;
  margin: 0;
}

/* Modern circular completion card. */
.brief-progress {
  padding: 22px 24px 18px;
  background: linear-gradient(145deg, #ffffff, #f8fbff);
}

.brief-progress-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 118px;
  align-items: center;
  gap: 24px;
}

.brief-progress .brief-progress-copy {
  display: block;
  margin: 0;
}

.brief-progress .brief-progress-copy strong {
  max-width: none;
  padding-left: 42px;
  font-size: 15px;
  letter-spacing: 0.035em;
}

.brief-progress .brief-progress-copy strong::before {
  top: -5px;
  width: 31px;
  height: 31px;
  font-size: 14px;
}

.brief-progress #progressHint {
  max-width: 500px;
  margin: 15px 0 0;
  color: #5f6f84;
  font-size: 11px;
  line-height: 1.5;
}

.progress-ring {
  --progress: 0deg;
  position: relative;
  display: grid;
  width: 112px;
  height: 112px;
  place-content: center;
  justify-self: end;
  text-align: center;
  background: conic-gradient(from -45deg, #20b7e8 0deg, #2563eb var(--progress), #dce6f3 var(--progress), #dce6f3 360deg);
  border-radius: 50%;
  box-shadow: 0 9px 24px rgba(37, 99, 235, 0.16);
}

.progress-ring::before {
  position: absolute;
  inset: 10px;
  content: "";
  background: #fff;
  border-radius: 50%;
  box-shadow: inset 0 0 0 1px #e6edf6;
}

.progress-ring #progressValue,
.progress-ring small {
  position: relative;
  z-index: 1;
}

.progress-ring #progressValue {
  color: #14263e;
  font-size: 24px;
  font-weight: 850;
  line-height: 1;
  letter-spacing: -0.04em;
}

.progress-ring #progressValue::after {
  display: none;
}

.progress-ring small {
  margin-top: 5px;
  color: #708198;
  font-size: 8px;
  font-weight: 850;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.brief-progress .progress-track {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.brief-progress .phase-summary {
  margin-top: 17px;
  padding-top: 15px;
}

.brief-progress .start-options {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 18px;
  margin: 15px -24px -18px;
  padding: 15px 24px 16px;
  overflow: visible;
  background: #f3f7fd;
  border: 0;
  border-top: 1px solid #dce5f0;
  border-radius: 0 0 14px 14px;
  box-shadow: none;
}

.brief-progress .start-options::before {
  display: none;
}

.brief-progress .start-options .eyebrow {
  margin: 0 0 3px;
  color: #2563eb;
  font-size: 8px;
  letter-spacing: 0.13em;
}

.brief-progress .start-options h3 {
  display: block;
  margin: 0;
  color: #20324b;
  font-size: 12px;
  letter-spacing: 0;
  text-transform: none;
}

.brief-progress .start-options p:last-child {
  margin: 3px 0 0;
  color: #718096;
  font-size: 9px;
}

.brief-progress .start-option-actions {
  display: flex;
  gap: 8px;
}

.brief-progress .start-option-actions button {
  min-height: 36px;
  padding: 8px 11px;
  font-size: 10px;
  border-radius: 8px;
  white-space: nowrap;
}

body.dark-mode .brief-progress .start-options {
  background: #0d1b2e;
  border-top-color: #2b405c;
}

body.dark-mode .brief-progress .start-options h3 {
  color: #e8f0fb;
}

body.dark-mode .brief-progress {
  background: linear-gradient(145deg, #122138, #0e1b2e);
}

body.dark-mode .progress-ring::before {
  background: #122138;
  box-shadow: inset 0 0 0 1px #2c425f;
}

body.dark-mode .progress-ring #progressValue {
  color: #f2f7ff;
}

@media screen and (max-width: 620px) {
  .brief-progress-layout {
    grid-template-columns: minmax(0, 1fr) 88px;
    gap: 14px;
  }

  .progress-ring {
    width: 84px;
    height: 84px;
  }

  .progress-ring::before {
    inset: 8px;
  }

  .progress-ring #progressValue {
    font-size: 19px;
  }

  .brief-progress .brief-progress-copy strong {
    padding-left: 0;
    font-size: 13px;
  }

  .brief-progress .brief-progress-copy strong::before {
    display: none;
  }

  .brief-progress #progressHint {
    font-size: 10px;
  }

  .brief-progress .start-options {
    grid-template-columns: 1fr;
    gap: 10px;
    margin-right: -18px;
    margin-left: -18px;
    padding: 14px 18px 16px;
  }

  .brief-progress .start-option-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
}

/* Shared Brief Builder tool header — mirrors Statement Generator. */
@media screen and (min-width: 901px) {
  .app-topbar,
  body.sidebar-collapsed .app-topbar {
    position: fixed;
    top: 0;
    right: 0;
    left: 0;
    z-index: 40;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    min-height: 78px;
    padding: 12px clamp(18px, 4vw, 60px);
    color: #fff;
    background: linear-gradient(135deg, #06162e, #0a376f);
    border-bottom: 0;
    box-shadow: 0 8px 24px rgba(5, 25, 52, .18);
  }

  .app-topbar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #fff;
    font-family: Inter, "Segoe UI", Arial, sans-serif;
    font-size: inherit;
  }

  .app-topbar-brand:hover,
  .app-topbar-brand:focus-visible {
    opacity: .9;
  }

  .app-topbar-brand img {
    width: 48px;
    height: 48px;
    object-fit: contain;
    background: #fff;
    border-radius: 9px;
  }

  .app-topbar-brand-copy {
    display: grid;
    gap: 2px;
    width: auto;
    height: auto;
    background: transparent;
  }

  .app-topbar-brand-copy strong {
    color: #fff;
    font-size: 16px;
    font-weight: 850;
  }

  .app-topbar-brand-copy small {
    color: #b9cae0;
    font-size: 10px;
    font-weight: 500;
  }

  .app-topbar .stage-tabs {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
  }

  .app-topbar-actions {
    display: flex;
    align-items: center;
    gap: 9px;
  }

  .topbar-saved-briefs,
  .topbar-back-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-height: 42px;
    padding: 9px 13px;
    color: #fff;
    font-size: 12px;
    font-weight: 800;
    background: rgba(255, 255, 255, .1);
    border: 1px solid rgba(255, 255, 255, .23);
    border-radius: 10px;
    box-shadow: none;
    cursor: pointer;
  }

  .topbar-saved-briefs:hover,
  .topbar-back-link:hover {
    color: #fff;
    background: rgba(255, 255, 255, .17);
    border-color: rgba(255, 255, 255, .32);
  }

  .topbar-saved-briefs .saved-count {
    display: grid;
    min-width: 22px;
    height: 22px;
    padding: 0 5px;
    place-items: center;
    color: #071f41;
    font-size: 11px;
    background: #fff;
    border-radius: 99px;
  }

  .sidebar {
    top: 78px;
    height: calc(100vh - 78px);
  }

  body.sidebar-motion-ready .sidebar > .brand {
    display: none;
  }

  main,
  body.sidebar-collapsed main {
    height: calc(100vh - 78px);
    margin-top: 78px;
  }
}

@media screen and (max-width: 1080px) and (min-width: 901px) {
  .app-topbar,
  body.sidebar-collapsed .app-topbar {
    padding-inline: 24px;
  }

  .topbar-saved-briefs,
  .topbar-back-link {
    padding-inline: 11px;
  }
}

/* Layout correction: the shared header belongs to the workspace, not over the
   persistent Brief Builder sidebar. */
@media screen and (min-width: 901px) {
  .app-topbar {
    right: 0;
    left: 280px;
    min-width: 0;
    padding: 12px 26px 12px 28px;
  }

  body.sidebar-collapsed .app-topbar {
    left: 84px;
  }

  .app-topbar-brand {
    min-width: 190px;
    flex: 0 0 auto;
    white-space: nowrap;
  }

  .app-topbar-brand-copy,
  .app-topbar-brand-copy strong,
  .app-topbar-brand-copy small {
    white-space: nowrap;
  }

  .sidebar {
    top: 0;
    bottom: 0;
    height: 100vh;
    padding-top: 0;
  }

  .sidebar > .brand {
    display: flex;
  }

  main {
    height: calc(100vh - 78px);
    margin-top: 78px;
    margin-left: 280px;
  }

  body.sidebar-collapsed main {
    margin-left: 84px;
  }
}

/* Coordinated desktop sidebar motion. Layout, labels and controls now travel
   through one shared easing curve instead of switching display modes mid-frame. */
@media screen and (min-width: 901px) {
  body.sidebar-motion-ready {
    --sidebar-motion-duration: 360ms;
    --sidebar-motion-ease: cubic-bezier(.22, 1, .36, 1);
  }

  body.sidebar-motion-ready .sidebar,
  body.sidebar-motion-ready .app-topbar,
  body.sidebar-motion-ready main,
  body.sidebar-motion-ready .sidebar > .brand,
  body.sidebar-motion-ready .sidebar .brand img,
  body.sidebar-motion-ready .sidebar .brand > div,
  body.sidebar-motion-ready .sidebar-toggle,
  body.sidebar-motion-ready .sidebar-toggle span,
  body.sidebar-motion-ready .new-brief-button,
  body.sidebar-motion-ready .new-brief-button span,
  body.sidebar-motion-ready .workflow-nav,
  body.sidebar-motion-ready .nav-group,
  body.sidebar-motion-ready .nav-group-title,
  body.sidebar-motion-ready .workflow-nav a,
  body.sidebar-motion-ready .guided-step-number,
  body.sidebar-motion-ready .guided-step > span,
  body.sidebar-motion-ready .guided-step > i,
  body.sidebar-motion-ready .tool-nav-icon,
  body.sidebar-motion-ready .tool-nav-link > span,
  body.sidebar-motion-ready .document-nav,
  body.sidebar-motion-ready .saved-briefs,
  body.sidebar-motion-ready .privacy {
    transition-duration: var(--sidebar-motion-duration);
    transition-timing-function: var(--sidebar-motion-ease);
  }

  body.sidebar-motion-ready .sidebar {
    transition-property: width, padding, gap, box-shadow;
  }

  body.sidebar-motion-ready .app-topbar {
    transition-property: left, padding;
  }

  body.sidebar-motion-ready main {
    transition-property: margin-left;
  }

  body.sidebar-transitioning .sidebar,
  body.sidebar-transitioning .app-topbar,
  body.sidebar-transitioning main {
    will-change: width, left, margin-left;
  }

  /* Keep the flex order stable so controls do not teleport during collapse. */
  body.sidebar-motion-ready.sidebar-collapsed .sidebar-toggle,
  body.sidebar-motion-ready.sidebar-collapsed .sidebar > .brand,
  body.sidebar-motion-ready.sidebar-collapsed .new-brief-button {
    order: initial;
  }

  .sidebar > .brand {
    max-height: 230px;
    transition-property: max-height, min-height, padding, margin, gap, border-color;
  }

  body.sidebar-motion-ready.sidebar-collapsed .sidebar > .brand {
    max-height: 78px;
  }

  body.sidebar-motion-ready .sidebar .brand img {
    flex: 0 0 auto;
    transition-property: width, height, padding, border-radius;
  }

  body.sidebar-motion-ready .sidebar .brand > div {
    max-width: 240px;
    max-height: 90px;
    overflow: hidden;
    opacity: 1;
    transform: translateY(0);
    visibility: visible;
    transition-property: max-width, max-height, opacity, transform, visibility;
  }

  body.sidebar-motion-ready.sidebar-collapsed .sidebar .brand > div {
    display: block;
    max-width: 0;
    max-height: 0;
    opacity: 0;
    transform: translateY(-5px);
    visibility: hidden;
  }

  body.sidebar-motion-ready .sidebar-toggle {
    overflow: hidden;
    white-space: nowrap;
    transition-property: width, min-height, margin, padding, color, background-color, border-radius, box-shadow;
  }

  body.sidebar-motion-ready .sidebar-toggle span:last-child,
  body.sidebar-motion-ready .new-brief-button span:last-child,
  body.sidebar-motion-ready .nav-group-title,
  body.sidebar-motion-ready .guided-step > span,
  body.sidebar-motion-ready .guided-step > i,
  body.sidebar-motion-ready .tool-nav-link > span {
    max-width: 220px;
    overflow: hidden;
    opacity: 1;
    visibility: visible;
    transition-property: max-width, opacity, transform, visibility;
  }

  body.sidebar-motion-ready.sidebar-collapsed .sidebar-toggle span:last-child,
  body.sidebar-motion-ready.sidebar-collapsed .new-brief-button span:last-child,
  body.sidebar-motion-ready.sidebar-collapsed .nav-group-title,
  body.sidebar-motion-ready.sidebar-collapsed .guided-step > span,
  body.sidebar-motion-ready.sidebar-collapsed .guided-step > i,
  body.sidebar-motion-ready.sidebar-collapsed .tool-nav-link > span {
    display: inherit;
    max-width: 0;
    opacity: 0;
    transform: translateX(-6px);
    visibility: hidden;
  }

  body.sidebar-motion-ready .new-brief-button {
    transition-property: width, min-height, margin, padding, gap, border-radius;
  }

  body.sidebar-motion-ready .workflow-nav {
    transition-property: gap, width;
  }

  body.sidebar-motion-ready .nav-group {
    transition-property: gap, padding, border-color;
  }

  body.sidebar-motion-ready .workflow-nav a {
    overflow: hidden;
    transition-property: width, min-height, margin, padding, gap, color, background-color, border-color, border-radius, box-shadow;
  }

  body.sidebar-motion-ready .guided-step-number,
  body.sidebar-motion-ready .tool-nav-icon {
    transition-property: width, height, margin, font-size, transform;
  }

  body.sidebar-motion-ready .document-nav,
  body.sidebar-motion-ready .saved-briefs,
  body.sidebar-motion-ready .privacy {
    max-height: 360px;
    overflow: hidden;
    opacity: 1;
    visibility: visible;
    transition-property: max-height, margin, padding, opacity, visibility;
  }

  body.sidebar-motion-ready.sidebar-collapsed .document-nav,
  body.sidebar-motion-ready.sidebar-collapsed .saved-briefs,
  body.sidebar-motion-ready.sidebar-collapsed .privacy {
    display: block;
    max-height: 0;
    margin-block: 0;
    padding-block: 0;
    opacity: 0;
    visibility: hidden;
  }
}

@media (prefers-reduced-motion: reduce) {
  body.sidebar-motion-ready .sidebar,
  body.sidebar-motion-ready .app-topbar,
  body.sidebar-motion-ready main,
  body.sidebar-motion-ready .sidebar * {
    transition-duration: 1ms !important;
  }
}

/* Simple sidebar handoff: conceal the contents while the existing compact rail
   slides into place, then reveal the finished layout. */
@media screen and (min-width: 901px) {
  .sidebar > * {
    transition: opacity 140ms ease, transform 180ms ease;
  }

  body.sidebar-switching .sidebar > * {
    pointer-events: none;
    opacity: 0;
    transform: translateX(-8px);
  }

  body.sidebar-switching .sidebar {
    overflow-x: hidden;
  }
}

@media (prefers-reduced-motion: reduce) {
  .sidebar > * {
    transition: none !important;
  }
}

/* Persistent compact navigation rail. Desktop collapse keeps navigation and
   the reopen control available instead of removing the sidebar completely. */
@media screen and (min-width: 901px) {
  .sidebar,
  .app-topbar,
  main {
    transition: width .22s ease, padding .22s ease, left .22s ease, margin-left .22s ease;
  }

  body.sidebar-collapsed .sidebar {
    width: 84px;
    padding: 14px 10px 18px;
    gap: 10px;
    overflow-x: hidden;
    transform: none;
  }

  body.sidebar-collapsed .app-topbar {
    left: 84px;
  }

  body.sidebar-collapsed main {
    margin-left: 84px;
  }

  body.sidebar-collapsed .sidebar-reveal {
    display: none;
  }

  body.sidebar-collapsed .sidebar-toggle {
    order: -3;
    display: grid;
    align-self: center;
    width: 36px;
    min-height: 36px;
    margin: 0 0 4px;
    padding: 0;
    place-items: center;
    color: #172033;
    background: #e5e7eb;
    border: 0;
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .18);
  }

  body.sidebar-collapsed .sidebar-toggle:hover {
    color: #071425;
    background: #fff;
  }

  body.sidebar-collapsed .sidebar-toggle span:first-child {
    font-size: 27px;
    line-height: 1;
    transform: translateY(-1px);
  }

  body.sidebar-collapsed .sidebar-toggle span:last-child {
    display: none;
  }

  body.sidebar-collapsed .sidebar > .brand {
    order: -2;
    display: flex;
    min-height: auto;
    margin: 0;
    padding: 6px 0 14px;
    justify-content: center;
    border-bottom: 1px solid rgba(255, 255, 255, .1);
  }

  body.sidebar-collapsed .brand img {
    width: 44px;
    height: 44px;
    padding: 4px;
    border-radius: 11px;
  }

  body.sidebar-collapsed .brand > div,
  body.sidebar-collapsed .new-brief-button span:last-child,
  body.sidebar-collapsed .nav-group-title,
  body.sidebar-collapsed .guided-step > span,
  body.sidebar-collapsed .guided-step > i,
  body.sidebar-collapsed .tool-nav-link > span,
  body.sidebar-collapsed .document-nav,
  body.sidebar-collapsed .saved-briefs,
  body.sidebar-collapsed .privacy {
    display: none;
  }

  body.sidebar-collapsed .new-brief-button {
    order: -1;
    width: 48px;
    min-height: 44px;
    margin: 0 auto 4px;
    padding: 0;
    border-radius: 12px;
  }

  body.sidebar-collapsed .new-brief-button span:first-child {
    margin: 0;
    font-size: 20px;
  }

  body.sidebar-collapsed .workflow-nav {
    display: grid;
    gap: 12px;
    width: 100%;
  }

  body.sidebar-collapsed .nav-group {
    display: grid;
    gap: 6px;
    padding: 4px 0 12px;
    border-bottom: 1px solid rgba(255, 255, 255, .1);
  }

  body.sidebar-collapsed .workflow-nav a {
    display: grid;
    width: 52px;
    min-height: 48px;
    margin: 0 auto;
    padding: 0;
    place-items: center;
    border-radius: 12px;
  }

  body.sidebar-collapsed .workflow-nav a:hover {
    background: rgba(255, 255, 255, .08);
  }

  body.sidebar-collapsed .workflow-nav a.active {
    color: #fff;
    background: rgba(255, 255, 255, .1);
    border-color: rgba(255, 255, 255, .08);
    box-shadow: inset 3px 0 0 var(--ds-blue-600, #0b5ed7);
  }

  body.sidebar-collapsed .guided-step-number {
    position: static;
    width: 30px;
    height: 30px;
    margin: 0;
    font-size: 12px;
  }

  body.sidebar-collapsed .tool-nav-icon {
    width: 27px;
    height: 27px;
    flex: none;
  }

  body.sidebar-collapsed .guided-step::after,
  body.sidebar-collapsed .guided-stepper::before {
    display: none;
  }
}

@media screen and (max-width: 1120px) and (min-width: 901px) {
  .app-topbar-brand img {
    width: 42px;
    height: 42px;
  }

  .app-topbar-brand {
    min-width: 0;
  }

  .topbar-back-link {
    font-size: 0;
  }

  .topbar-back-link span {
    font-size: 15px;
  }
}

@media print {
  .brief-progress {
    display: none !important;
  }
}

/* More legible, distinctive top-down map icon palette. */
.map-topdown-icons {
  gap: 10px;
}

.map-topdown-icons button {
  position: relative;
  min-height: 64px;
  padding: 10px 10px 10px 58px;
  overflow: hidden;
  color: #173a63;
  font-size: 11px;
  font-weight: 800;
  background: linear-gradient(145deg, #fff, #f5f8fc);
  border: 1px solid #cbd9ea;
  border-radius: 11px;
  box-shadow: 0 2px 5px rgba(21, 58, 99, 0.05);
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.map-topdown-icons button:hover,
.map-topdown-icons button:focus-visible {
  color: #0b4f9c;
  background: #f8fbff;
  border-color: #77a9df;
  box-shadow: 0 6px 14px rgba(20, 87, 160, 0.12);
  transform: translateY(-1px);
}

.map-topdown-icons button::before {
  top: 50%;
  left: 17px;
  width: 27px;
  height: 42px;
  background: #1769aa;
  border: 2px solid #d8e9fa;
  border-radius: 10px 10px 7px 7px;
  box-shadow: inset 0 0 0 5px #bfe0f5, 0 2px 5px rgba(16, 54, 98, 0.2);
  clip-path: polygon(22% 0, 78% 0, 100% 18%, 94% 82%, 75% 100%, 25% 100%, 6% 82%, 0 18%);
  transform: translateY(-50%);
}

.map-topdown-icons button::after {
  position: absolute;
  top: 50%;
  left: 23px;
  width: 15px;
  height: 5px;
  content: "";
  background: linear-gradient(90deg, #ef4444 0 48%, #fff 48% 52%, #2563eb 52%);
  border-radius: 2px;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.75);
  transform: translateY(-50%);
}

.map-topdown-icons button[data-map-icon-type="Highway Patrol"]::before {
  background: #1f2937;
  border-color: #f8fafc;
  box-shadow: inset 0 0 0 5px #d8dee7, inset 0 0 0 7px #f2c94c, 0 2px 5px rgba(16, 24, 40, 0.22);
}

.map-topdown-icons button[data-map-icon-type="SUV"]::before {
  width: 31px;
  background: #475569;
  border-radius: 8px;
  box-shadow: inset 0 0 0 5px #94a3b8, 0 2px 5px rgba(16, 24, 40, 0.22);
}

.map-topdown-icons button[data-map-icon-type="Truck"]::before {
  width: 32px;
  height: 44px;
  background: linear-gradient(#475569 0 34%, #d8e0e9 34% 100%);
  border-color: #f8fafc;
  border-radius: 7px 7px 4px 4px;
  box-shadow: inset 0 -5px 0 #64748b, 0 2px 5px rgba(16, 24, 40, 0.22);
  clip-path: none;
}

.map-topdown-icons button[data-map-icon-type="Truck"]::after {
  top: calc(50% - 7px);
}

.map-topdown-icons button[data-map-icon-type="Motorbike"]::before {
  width: 16px;
  height: 41px;
  background: linear-gradient(#1f2937 0 17%, #94a3b8 17% 36%, #334155 36% 64%, #94a3b8 64% 83%, #1f2937 83%);
  border: 0;
  border-radius: 8px;
  box-shadow: 0 2px 5px rgba(16, 24, 40, 0.22);
  clip-path: none;
}

.map-topdown-icons button[data-map-icon-type="Motorbike"]::after {
  left: 18px;
  width: 25px;
  height: 3px;
  background: #475569;
  box-shadow: none;
}

.map-topdown-icons button[data-map-icon-type="Pedestrian"]::before {
  width: 28px;
  height: 42px;
  background: radial-gradient(circle at 50% 14%, #0f172a 0 13%, transparent 14%), linear-gradient(62deg, transparent 43%, #0f172a 44% 54%, transparent 55%) 0 12px / 100% 28px no-repeat;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  clip-path: none;
}

.map-topdown-icons button[data-map-icon-type="Pedestrian"]::after {
  display: none;
}

.map-topdown-icons button[data-map-icon-type="House"]::before {
  width: 36px;
  height: 36px;
  background: #8b5e3c;
  border: 2px solid #f8e9d8;
  border-radius: 4px;
  box-shadow: inset 0 0 0 8px #d8a46f, 0 2px 5px rgba(72, 43, 20, 0.2);
  clip-path: polygon(50% 0, 100% 35%, 90% 35%, 90% 100%, 10% 100%, 10% 35%, 0 35%);
}

.map-topdown-icons button[data-map-icon-type="House"]::after {
  left: 28px;
  width: 8px;
  height: 13px;
  background: #6b4226;
  box-shadow: none;
  transform: translate(-50%, 5px);
}

.map-topdown-icons button[data-map-icon-type="CCTV camera"]::before {
  width: 35px;
  height: 22px;
  background: #087f5b;
  border: 2px solid #c9f2e3;
  border-radius: 6px;
  box-shadow: inset -7px 0 0 #065f46, 0 2px 5px rgba(6, 95, 70, 0.22);
  clip-path: polygon(0 0, 78% 0, 100% 28%, 78% 58%, 78% 100%, 0 100%);
}

.map-topdown-icons button[data-map-icon-type="CCTV camera"]::after {
  top: calc(50% + 15px);
  left: 24px;
  width: 20px;
  height: 3px;
  background: #087f5b;
  box-shadow: none;
  transform: rotate(-55deg);
}

body.dark-mode .map-topdown-icons button {
  color: #dcecff;
  background: #13243a;
  border-color: #35516f;
}

@media screen and (max-width: 520px) {
  .map-topdown-icons {
    grid-template-columns: 1fr;
  }
}

/* Crisp, scale-consistent previews that mirror the symbols placed on the map. */
.map-topdown-icons button {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  text-align: left;
}

.map-topdown-icons button span { min-width: 0; }

.map-topdown-icons button::before,
.map-topdown-icons button::after { display: none !important; }

.map-icon-preview {
  width: 42px;
  height: 58px;
  flex: 0 0 42px;
  overflow: visible;
  filter: drop-shadow(0 2px 2px rgba(16, 24, 40, .2));
}

.map-icon-preview * { vector-effect: non-scaling-stroke; }
.map-icon-preview .vehicle,
.map-icon-preview .truck-box,
.map-icon-preview .truck-cab,
.map-icon-preview .house-body,
.map-icon-preview .camera-body,
.map-icon-preview .camera-lens {
  stroke: #fff;
  stroke-width: 2;
  stroke-linejoin: round;
}
.map-icon-preview .police { fill: #1976b9; }
.map-icon-preview .highway { fill: #202b3c; }
.map-icon-preview .suv { fill: #53657b; }
.map-icon-preview .glass { fill: #bcd2e8; stroke: #344054; stroke-width: 1; }
.map-icon-preview .bonnet { fill: transparent; stroke: #344054; stroke-width: 1; }
.map-icon-preview .centre-stripe { fill: #eef6fd; }
.map-icon-preview .hwp-stripe { fill: #f6c744; }
.map-icon-preview .light { stroke: #fff; stroke-width: 1; }
.map-icon-preview .red { fill: #ef4444; }
.map-icon-preview .blue { fill: #2563eb; }
.map-icon-preview .roof-rail { fill: none; stroke: #29384b; stroke-width: 2; }
.map-icon-preview .tyre { fill: #172033; }
.map-icon-preview .bike { fill: #58677d; stroke: #fff; stroke-width: 2; }
.map-icon-preview .bike-seat { fill: #1f2937; }
.map-icon-preview .handlebars { fill: none; stroke: #263447; stroke-width: 4; stroke-linecap: round; }
.map-icon-preview .truck-box { fill: #dce5ef; }
.map-icon-preview .truck-cab { fill: #52647a; }
.map-icon-preview .truck-glass { fill: #bcd2e8; }
.map-icon-preview .truck-divider { stroke: #344054; stroke-width: 2; }
.map-icon-preview .person { fill: #172033; }
.map-icon-preview .person-line { fill: none; stroke: #172033; stroke-width: 7; stroke-linecap: round; stroke-linejoin: round; }
.map-icon-preview .house-roof { fill: #b86f37; stroke: #fff; stroke-width: 2; stroke-linejoin: round; }
.map-icon-preview .house-body { fill: #d99a63; }
.map-icon-preview .house-room { fill: #9a6035; }
.map-icon-preview .house-door { fill: #654126; }
.map-icon-preview .camera-body,
.map-icon-preview .camera-lens { fill: #087f5b; }
.map-icon-preview .camera-glass { fill: #baf0dc; stroke: #065f46; stroke-width: 2; }
.map-icon-preview .camera-arm { fill: none; stroke: #087f5b; stroke-width: 6; stroke-linecap: round; stroke-linejoin: round; }

body.dark-mode .map-icon-preview { filter: drop-shadow(0 2px 3px rgba(0, 0, 0, .45)); }

/* Compact workspace chrome: keeps drafting controls close to the content and
   gives the preview rail a single, calm control surface. */
@media screen and (min-width: 901px) {
  .app-topbar {
    min-height: 58px;
    padding: 0 24px;
    grid-template-columns: minmax(190px, 1fr) auto minmax(190px, 1fr);
    border-bottom-color: #d7deea;
    box-shadow: 0 1px 0 rgba(15, 23, 42, 0.025);
  }

  .stage-tabs {
    gap: 6px;
    align-self: center;
    padding: 4px;
    background: #f1f5fb;
    border: 1px solid #dce4f0;
    border-radius: 12px;
  }

  .stage-tabs a {
    min-height: 38px;
    padding: 0 19px;
    font-size: 11px;
    letter-spacing: .09em;
    border-radius: 8px;
  }

  .stage-tabs a.active {
    background: #fff;
    box-shadow: 0 2px 7px rgba(15, 23, 42, .08);
  }

  .stage-tabs a.active::after {
    right: 18px;
    bottom: 3px;
    left: 18px;
    height: 2px;
    border-radius: 999px;
  }

  main {
    height: calc(100vh - 58px);
    margin-top: 58px;
  }

  .builder {
    padding-top: 22px;
  }

  .panel-head {
    grid-template-columns: minmax(210px, 1fr) auto;
    align-items: center;
    gap: 20px;
    margin-bottom: 16px;
    padding-bottom: 0;
  }

  .panel-head h2 {
    max-width: none;
    font-size: clamp(26px, 2.1vw, 34px);
    line-height: 1.05;
    letter-spacing: -.035em;
  }

  .panel-head .eyebrow {
    margin-bottom: 6px;
  }

  .panel-head .save-state {
    display: inline-flex;
    margin-top: 8px;
    padding: 4px 9px;
    color: #526278;
    font-size: 11px;
    font-style: normal;
    background: rgba(255, 255, 255, .7);
    border: 1px solid #d7e0ec;
    border-radius: 999px;
  }

  .panel-head-actions {
    display: grid;
    grid-template-columns: auto auto;
    gap: 8px;
    padding: 8px;
    background: rgba(255, 255, 255, .72);
    border: 1px solid #d3ddeb;
    border-radius: 14px;
    box-shadow: 0 5px 16px rgba(15, 23, 42, .06);
  }

  .panel-head-actions .theme-toggle,
  .panel-head-actions .save-brief-button,
  .panel-head-actions .print-button {
    min-width: 0;
    min-height: 42px;
    padding: 9px 15px;
    font-size: 12px;
    border-radius: 9px;
  }

  .panel-head-actions .theme-toggle {
    grid-row: 1 / span 2;
    width: 72px;
    flex-direction: column;
    gap: 2px;
    padding-inline: 8px;
    border: 0;
    background: transparent;
  }

  .panel-head-actions .theme-toggle:hover {
    background: #edf3fc;
  }

  .panel-head-actions .save-brief-button,
  .panel-head-actions .print-button {
    width: 122px;
  }
}

.app-topbar-actions {
  gap: 8px;
}

.autosave-pill {
  min-height: 40px;
  padding: 6px 11px;
  gap: 9px;
  color: #1d2c42;
  background: transparent;
  border-color: transparent;
  border-radius: 10px;
}

.autosave-pill > span:last-child {
  display: grid;
  gap: 0;
  line-height: 1.15;
}

.autosave-pill strong {
  font-size: 11px;
  font-weight: 800;
}

.autosave-pill small {
  color: #708096;
  font-size: 9px;
  font-weight: 650;
}

.autosave-indicator {
  width: 9px;
  height: 9px;
  flex: 0 0 9px;
  background: #16a365;
  border: 2px solid #d8f6e8;
  border-radius: 50%;
  box-shadow: 0 0 0 3px #ecfbf4;
}

.preview {
  padding-top: 22px;
}

.toolbar {
  position: sticky;
  z-index: 8;
  top: 12px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  width: min(100%, 760px);
  max-width: none;
  min-height: 0;
  margin-bottom: 18px;
  padding: 10px 11px 10px 14px;
  border-color: rgba(159, 177, 205, .78);
  border-radius: 14px;
  box-shadow: 0 8px 26px rgba(30, 64, 115, .12);
  backdrop-filter: blur(14px);
}

.preview-toolbar-copy {
  display: flex !important;
  align-items: center;
  gap: 11px;
  min-width: 0;
}

.live-preview-label {
  flex: 0 0 auto;
  padding-right: 11px;
  border-right: 1px solid #d9e1ec;
}

.preview-title-group {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.preview-title-group strong,
.preview-title-group .preview-page-count {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.preview-toolbar-actions {
  flex-wrap: nowrap;
  gap: 7px;
}

.zoom-controls {
  min-height: 38px;
  padding: 0 3px;
  border-radius: 9px;
}

.zoom-controls button {
  border-radius: 7px;
}

.toolbar .hide-preview-button,
.toolbar .print-button {
  min-height: 38px;
  padding-inline: 13px;
  white-space: nowrap;
  border-radius: 9px;
}

body.dark-mode .autosave-pill {
  color: #e4edf8;
  background: transparent;
  border-color: transparent;
}

body.dark-mode .autosave-pill small {
  color: #93a4ba;
}

body.dark-mode .panel-head-actions {
  background: rgba(15, 23, 42, .72);
  border-color: #31425a;
}

body.dark-mode .panel-head .save-state {
  color: #b9c7d8;
  background: rgba(15, 23, 42, .58);
  border-color: #354861;
}

@media screen and (max-width: 1180px) and (min-width: 901px) {
  .app-topbar {
    grid-template-columns: auto 1fr auto;
  }

  .stage-tabs {
    justify-self: center;
  }

  .stage-tabs a {
    padding-inline: 12px;
  }

  .autosave-pill small,
  .app-topbar-brand b,
  .app-topbar-brand > span {
    display: none;
  }

  .panel-head {
    grid-template-columns: 1fr;
  }

  .panel-head-actions {
    display: flex;
    justify-self: start;
  }

  .panel-head-actions .theme-toggle {
    width: auto;
    flex-direction: row;
  }

  .toolbar {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .preview-toolbar-actions {
    justify-content: flex-start;
  }
}

@media screen and (max-width: 620px) {
  .preview {
    padding: 14px 10px 44px;
  }

  .toolbar {
    position: static;
    grid-template-columns: 1fr;
    gap: 9px;
    padding: 10px;
  }

  .preview-toolbar-actions {
    display: grid;
    grid-template-columns: 1fr auto;
  }

  .toolbar .print-button {
    grid-column: 1 / -1;
  }
}

/* Final shell geometry. Keep last so older mockup rules cannot pull the
   workspace underneath the header again. */
@media screen and (min-width: 901px) {
  .app-topbar {
    right: 0;
    left: 280px;
    min-height: 78px;
    padding: 12px 26px 12px 28px;
  }

  body.sidebar-collapsed .app-topbar {
    left: 84px;
  }

  .app-topbar-brand-copy,
  .app-topbar-brand > .app-topbar-brand-copy {
    display: grid;
    width: auto;
    height: auto;
    gap: 2px;
    white-space: nowrap;
    background: transparent;
  }

  .sidebar {
    top: 0;
    bottom: 0;
    height: 100vh;
    padding-top: 0;
  }

  .sidebar > .brand {
    display: flex;
  }

  main {
    height: calc(100vh - 78px);
    margin-top: 78px;
    margin-left: 280px;
  }

  body.sidebar-collapsed main {
    margin-left: 84px;
  }
}
