:root {
  --consent-surface: var(--bone);
  --consent-ink: var(--ink);
  --consent-primary: var(--olive);
  --consent-border: var(--smoke);
}

.torre-consent-open { overflow: hidden; }
.torre-consent [hidden], .torre-consent-widget[hidden], .torre-consent-message[hidden] { display: none !important; }

.torre-consent {
  width: min(620px, calc(100% - 32px));
  max-width: 620px;
  max-height: calc(100vh - 32px);
  max-height: calc(100dvh - 32px);
  padding: 0;
  margin: auto;
  overflow: hidden;
  border: 1px solid var(--consent-border);
  border-radius: 8px;
  background: var(--consent-surface);
  color: var(--consent-ink);
  box-shadow: var(--shadow);
  font: inherit;
  line-height: 1.55;
}

.torre-consent[open] { display: flex; flex-direction: column; }
.torre-consent::backdrop { background: rgba(16, 21, 17, .62); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.torre-consent button { font: inherit; cursor: pointer; }
.torre-consent button:disabled { cursor: default; }
.torre-consent :focus-visible, .torre-consent-widget:focus-visible, [data-cookie-preferences]:focus-visible { outline: 3px solid var(--terracotta); outline-offset: 3px; }

.torre-consent-heading { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 24px 26px 20px; flex-shrink: 0; }
.torre-consent-brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.torre-consent-brand .brand-text { white-space: normal; font-size: 1.1rem; line-height: 1.2; }
.torre-consent-brand .brand-location { letter-spacing: 0; white-space: normal; font-size: .7rem; }
.torre-consent-brand .brand-mark { width: 44px; height: 44px; color: var(--olive); }
.torre-consent-close { display: grid; place-items: center; flex-shrink: 0; width: 40px; height: 40px; padding: 0; border: 1px solid var(--consent-border); border-radius: 6px; color: var(--consent-ink); background: transparent; }
.torre-consent-close span { font-size: 1.8rem; line-height: 1; }
.torre-consent-close:hover { background: var(--stone); }
.torre-consent-tabs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); padding: 0 26px; border-bottom: 1px solid var(--consent-border); flex-shrink: 0; }
.torre-consent-tabs button { padding: 12px 8px; border: 0; border-bottom: 2px solid transparent; background: transparent; color: var(--muted); font-size: .85rem; font-weight: 700; }
.torre-consent-tabs button[aria-selected="true"] { border-bottom-color: var(--olive); color: var(--olive); }
.torre-consent-body { min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 22px 26px; -webkit-overflow-scrolling: touch; }
.torre-consent h2 { margin: 0 0 16px; font-family: Georgia, "Times New Roman", serif; font-size: 1.8rem; font-weight: 500; line-height: 1.15; }
.torre-consent p { margin: 0 0 14px; font-size: .9rem; }
.torre-consent p:last-child { margin-bottom: 0; }
.torre-consent-note, .torre-consent-status { color: var(--muted); }
.torre-consent-category { display: grid; grid-template-columns: minmax(0, 1fr) 46px; align-items: start; gap: 18px; padding: 16px 0; border-bottom: 1px solid var(--consent-border); }
.torre-consent-category:first-child { padding-top: 0; }
.torre-consent-category h3 { margin: 0 0 4px; font-size: .95rem; line-height: 1.3; }
.torre-consent-category p { margin: 0 0 7px; color: var(--muted); font-size: .82rem; }
.torre-consent-state { color: var(--olive); font-size: .76rem; font-weight: 700; }
.torre-consent-locked { display: grid; place-items: center; width: 46px; height: 26px; color: var(--olive); font-size: 1rem; }
.torre-consent-category input { appearance: none; -webkit-appearance: none; position: relative; width: 46px; height: 26px; margin: 2px 0 0; border: 1px solid #9d9f96; border-radius: 20px; background: #d4d6cd; cursor: pointer; transition: background 150ms ease; }
.torre-consent-category input::before { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.18); transition: transform 150ms ease; }
.torre-consent-category input:checked { background: var(--consent-primary); border-color: var(--consent-primary); }
.torre-consent-category input:checked::before { transform: translateX(20px); }
.torre-consent-category input:disabled { cursor: default; }
.torre-consent-actions { display: flex; gap: 12px; padding: 0 26px 18px; flex-shrink: 0; }
.torre-consent-button { min-height: 44px; padding: 11px 18px; border: 1px solid var(--consent-primary); border-radius: 6px; font-size: .85rem !important; font-weight: 700 !important; line-height: 1.35; }
.torre-consent-actions .torre-consent-button { flex: 1; }
.torre-consent-primary { background: var(--consent-primary); color: var(--bone); }
.torre-consent-primary:hover { background: var(--olive-2); }
.torre-consent-secondary { background: transparent; color: var(--consent-primary); }
.torre-consent-secondary:hover { background: var(--stone); }
.torre-consent-button:disabled { border-color: var(--consent-border); color: var(--muted); background: var(--stone-2); }
.torre-consent-save { width: 100%; margin-top: 18px; }
.torre-consent-links { display: flex; justify-content: center; gap: 24px; padding: 12px 26px 16px; border-top: 1px solid var(--consent-border); font-size: .76rem; flex-shrink: 0; }
.torre-consent-links a, .torre-consent-body a { color: var(--olive); text-underline-offset: 3px; }
.torre-consent-widget { position: fixed; bottom: max(22px, env(safe-area-inset-bottom)); left: max(22px, env(safe-area-inset-left)); z-index: 60; display: grid; place-items: center; width: 46px; height: 46px; border: 1px solid var(--consent-border); border-radius: 6px; background: var(--bone); color: var(--olive); box-shadow: 0 6px 20px rgba(32,34,29,.16); cursor: pointer; }
.torre-consent-widget:hover { background: var(--stone-2); }
.torre-consent-widget .brand-icon { width: 29px; height: 29px; }
.torre-consent-message { position: fixed; bottom: max(88px, calc(env(safe-area-inset-bottom) + 68px)); left: 50%; z-index: 70; transform: translateX(-50%); width: max-content; max-width: calc(100% - 32px); padding: 13px 18px; border: 1px solid var(--consent-border); border-radius: 6px; background: var(--bone); color: var(--olive); font-size: .85rem; line-height: 1.4; box-shadow: var(--shadow); }
.site-footer [data-cookie-preferences] { display: block; padding: 0; margin: 0 0 8px; border: 0; background: transparent; color: var(--ink); font: inherit; cursor: pointer; text-align: left; }
.site-footer [data-cookie-preferences]:hover { color: var(--terracotta); }

@media (max-width: 520px) {
  .torre-consent { width: calc(100% - 24px); max-height: calc(100vh - 24px); max-height: calc(100dvh - 24px - env(safe-area-inset-top) - env(safe-area-inset-bottom)); }
  .torre-consent-heading { padding: 18px 16px 16px; gap: 8px; }
  .torre-consent-brand { gap: 9px; }
  .torre-consent-brand .brand-text { font-size: .95rem; }
  .torre-consent-brand .brand-location { font-size: .6rem; }
  .torre-consent-brand .brand-mark { width: 38px; height: 38px; }
  .torre-consent-tabs { padding: 0 16px; }
  .torre-consent-body { padding: 18px 16px; }
  .torre-consent h2 { font-size: 1.5rem; }
  .torre-consent-actions { gap: 8px; padding: 0 16px 16px; }
  .torre-consent-button { padding: 11px 9px; }
  .torre-consent-links { padding: 12px 16px; }
  .torre-consent-widget { left: max(14px, env(safe-area-inset-left)); bottom: max(16px, env(safe-area-inset-bottom)); }
}

@media (max-width: 350px) {
  .torre-consent-actions { flex-direction: column; }
  .torre-consent-close { width: 34px; height: 34px; }
}

@media (prefers-reduced-motion: reduce) {
  .torre-consent *, .torre-consent *::before { transition: none !important; }
}
