.sg-consent {
  --sg-consent-bg: #f7f8fa;
  --sg-consent-surface: #ffffff;
  --sg-consent-ink: #0b1220;
  --sg-consent-text: #404b63;
  --sg-consent-muted: #5a6577;
  --sg-consent-border: #d2d8e4;
  --sg-consent-border-soft: #e5e8ef;
  --sg-consent-accent: #0e7c7b;
  --sg-consent-accent-hover: #0c5e5d;
  color: var(--sg-consent-text);
  font-family: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.5;
  letter-spacing: 0;
}

.sg-consent *,
.sg-consent *::before,
.sg-consent *::after {
  box-sizing: border-box;
}

.sg-consent__banner {
  position: fixed;
  z-index: 2147483000;
  right: 0;
  bottom: 0;
  left: 0;
  margin: 0;
  border: 0;
  border-top: 1px solid var(--sg-consent-border);
  background: var(--sg-consent-surface);
  box-shadow: 0 -12px 36px rgba(11, 18, 32, 0.12);
}

.sg-consent__banner[hidden],
.sg-consent__reopen[hidden] {
  display: none;
}

.sg-consent__banner-inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 28px;
  align-items: center;
  width: min(100% - 40px, 1180px);
  margin: 0 auto;
  padding: 20px 0;
}

.sg-consent__message {
  min-width: 0;
}

.sg-consent__eyebrow {
  margin: 0 0 4px;
  color: var(--sg-consent-muted);
  font: 600 11px/1.4 "Spline Sans Mono", ui-monospace, monospace;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.sg-consent h2,
.sg-consent h3,
.sg-consent p {
  letter-spacing: 0;
}

.sg-consent h2 {
  margin: 0;
  color: var(--sg-consent-ink);
  font-size: 18px;
  font-weight: 700;
  line-height: 1.25;
}

.sg-consent__message > #sg-consent-copy {
  max-width: 78ch;
  margin: 7px 0 0;
  color: var(--sg-consent-text);
  font-size: 14px;
  line-height: 1.55;
}

.sg-consent__message > .sg-consent__status {
  margin-top: 8px;
  color: #8b2f2f;
  font-size: 13px;
  font-weight: 600;
}

.sg-consent a {
  color: var(--sg-consent-accent-hover);
  text-underline-offset: 2px;
}

.sg-consent__actions,
.sg-consent__panel-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.sg-consent__button,
.sg-consent__icon-button,
.sg-consent__reopen {
  appearance: none;
  border: 1px solid var(--sg-consent-border);
  border-radius: 5px;
  cursor: pointer;
  font: 600 14px/1.1 Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

.sg-consent__button {
  min-height: 44px;
  padding: 10px 15px;
  white-space: nowrap;
}

.sg-consent__button:disabled {
  cursor: wait;
  opacity: 0.58;
}

.sg-consent__button--primary {
  border-color: var(--sg-consent-accent);
  background: var(--sg-consent-accent);
  color: #ffffff;
}

.sg-consent__button--primary:hover {
  border-color: var(--sg-consent-accent-hover);
  background: var(--sg-consent-accent-hover);
}

.sg-consent__button--neutral {
  background: var(--sg-consent-ink);
  border-color: var(--sg-consent-ink);
  color: #ffffff;
}

.sg-consent__button--plain {
  background: transparent;
  color: var(--sg-consent-ink);
}

.sg-consent__button--plain:hover {
  border-color: var(--sg-consent-muted);
  background: var(--sg-consent-bg);
}

.sg-consent :where(button, input, a):focus-visible {
  outline: 2px solid var(--sg-consent-accent);
  outline-offset: 3px;
}

.sg-consent__reopen {
  position: fixed;
  z-index: 2147482000;
  right: 16px;
  bottom: 14px;
  min-height: 34px;
  padding: 7px 10px;
  background: rgba(255, 255, 255, 0.96);
  color: var(--sg-consent-text);
  box-shadow: 0 4px 16px rgba(11, 18, 32, 0.1);
  font-size: 12px;
  transition: opacity 160ms ease;
}

body.sg-chat-open .sg-consent__reopen,
body.menu-open .sg-consent__reopen {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

body.sg-consent-open .mobile-cta-bar {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(calc(120% + env(safe-area-inset-bottom)));
}

.sg-consent__dialog {
  width: min(640px, calc(100% - 32px));
  max-height: min(760px, calc(100dvh - 32px));
  margin: auto;
  padding: 0;
  overflow: auto;
  border: 1px solid var(--sg-consent-border);
  border-radius: 6px;
  background: var(--sg-consent-surface);
  color: var(--sg-consent-text);
  box-shadow: 0 24px 70px rgba(11, 18, 32, 0.28);
}

.sg-consent__dialog::backdrop {
  background: rgba(11, 18, 32, 0.52);
}

.sg-consent__panel {
  margin: 0;
  padding: 26px;
}

.sg-consent__panel-head {
  display: flex;
  gap: 20px;
  align-items: flex-start;
  justify-content: space-between;
}

.sg-consent__icon-button {
  display: grid;
  flex: none;
  width: 44px;
  height: 44px;
  place-items: center;
  padding: 0;
  background: var(--sg-consent-bg);
  color: var(--sg-consent-ink);
  font-size: 24px;
  font-weight: 400;
}

.sg-consent__intro {
  margin: 14px 0 22px;
  color: var(--sg-consent-muted);
  font-size: 14px;
}

.sg-consent__option {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 20px;
  align-items: center;
  padding: 18px 0;
  border-top: 1px solid var(--sg-consent-border-soft);
}

.sg-consent__option h3,
.sg-consent__option label > span {
  display: block;
  margin: 0;
  color: var(--sg-consent-ink);
  font-size: 15px;
  font-weight: 700;
  line-height: 1.3;
}

.sg-consent__option p,
.sg-consent__option small {
  display: block;
  margin: 5px 0 0;
  color: var(--sg-consent-muted);
  font-size: 13px;
  line-height: 1.5;
}

.sg-consent__required {
  color: var(--sg-consent-muted);
  font: 600 11px/1.3 "Spline Sans Mono", ui-monospace, monospace;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}

.sg-consent__toggle {
  position: relative;
  width: 44px;
  height: 44px;
  margin: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  cursor: pointer;
  appearance: none;
}

.sg-consent__toggle::before {
  position: absolute;
  top: 10px;
  left: 0;
  width: 44px;
  height: 24px;
  border: 1px solid var(--sg-consent-border);
  border-radius: 999px;
  background: var(--sg-consent-border);
  content: "";
  transition: background 150ms ease, border-color 150ms ease;
}

.sg-consent__toggle::after {
  position: absolute;
  top: 14px;
  left: 4px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 1px 4px rgba(11, 18, 32, 0.28);
  content: "";
  transition: transform 150ms ease;
}

.sg-consent__toggle:checked {
  background: transparent;
}

.sg-consent__toggle:checked::before {
  border-color: var(--sg-consent-accent);
  background: var(--sg-consent-accent);
}

.sg-consent__toggle:checked::after {
  transform: translateX(20px);
}

.sg-consent__toggle:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.sg-consent__panel-actions {
  justify-content: flex-end;
  padding-top: 22px;
  border-top: 1px solid var(--sg-consent-border-soft);
}

@media (max-width: 760px) {
  .sg-consent__banner-inner {
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
    width: min(100% - 32px, 620px);
  }

  .sg-consent__actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .sg-consent__button {
    min-width: 0;
    white-space: normal;
  }
}

@media (max-width: 1119px) {
  .sg-consent__reopen {
    right: auto;
    bottom: calc(14px + env(safe-area-inset-bottom));
    left: 14px;
    min-height: 44px;
    padding: 10px 12px;
  }

  /* design-step1 v1.1: one primary floating surface — was lifted to 78px above
     the CTA bar; now yields while the CTA is visible (same pattern as chat/menu).
     Reopen stays available near hero, #products, #contact and on /privacy.
     :not(:focus-visible) keeps it visible (and focus intact) if a keyboard user
     already has it focused the moment the CTA bar appears. */
  body.mobile-cta-visible:not(.menu-open) .sg-consent__reopen:not(:focus-visible) {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
  }
}

@media (max-width: 520px) {
  .sg-consent__banner-inner {
    max-height: calc(100dvh - 16px);
    overflow: auto;
    padding: 16px 0;
  }

  .sg-consent__actions,
  .sg-consent__panel-actions {
    grid-template-columns: minmax(0, 1fr);
  }

  .sg-consent__actions {
    display: grid;
  }

  .sg-consent__panel {
    padding: 20px;
  }

  .sg-consent__option {
    gap: 14px;
  }

  .sg-consent__panel-actions {
    display: grid;
  }

  .sg-consent__reopen {
    right: auto;
    bottom: calc(10px + env(safe-area-inset-bottom));
    left: 10px;
  }

  /* design-step1 v1.1: yields to the CTA bar (see 1119px block above). */
  body.mobile-cta-visible:not(.menu-open) .sg-consent__reopen:not(:focus-visible) {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .sg-consent__toggle::before,
  .sg-consent__toggle::after,
  .sg-consent__reopen {
    transition: none;
  }
}
