/* ============================================================================
   fe-consent — styles. Everything is scoped under .fe-cmp so it cannot leak
   into the page, and nothing here loads a webfont: the CMP inherits whatever
   the page already has and falls back to system fonts.

   Brand tokens are the FieldEdge palette. Contrast was checked against WCAG
   2.2 AA before use: Field Green #0D5C45 on Off-white #F8F7F4 is 8.4:1, and
   white on Field Green is 8.0:1. Emerald #1D9E75 is 2.6:1 on off-white, so it
   is used for borders and focus rings only, never for text or button labels.
   ============================================================================ */

.fe-cmp {
  --fe-green: #0D5C45;
  --fe-emerald: #1D9E75;
  --fe-mint: #9FE1CB;
  --fe-ink: #0D1A14;
  --fe-paper: #F8F7F4;
  --fe-line: rgba(13, 26, 20, .16);
  --fe-radius: 10px;
  --fe-font: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --fe-display: "Archivo Narrow", "Arial Narrow", var(--fe-font);
  font-family: var(--fe-font);
  color: var(--fe-ink);
  box-sizing: border-box;
}
.fe-cmp *, .fe-cmp *::before, .fe-cmp *::after { box-sizing: inherit; }

/* ------------------------------------------------------------------ banner */
.fe-cmp-banner {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 2147483000;
  background: var(--fe-paper);
  border-top: 3px solid var(--fe-green);
  box-shadow: 0 -10px 34px rgba(13, 26, 20, .18);
  padding: 16px max(16px, env(safe-area-inset-left)) calc(16px + env(safe-area-inset-bottom));
  animation: fe-cmp-up .22s ease-out;
}
@keyframes fe-cmp-up { from { transform: translateY(100%); } to { transform: none; } }
@media (prefers-reduced-motion: reduce) { .fe-cmp-banner { animation: none; } }

.fe-cmp-banner-in {
  max-width: 1160px; margin: 0 auto;
  display: flex; align-items: center; gap: 18px 24px; flex-wrap: wrap;
}
.fe-cmp-banner-copy { flex: 1 1 420px; min-width: 0; }
.fe-cmp-h { font-family: var(--fe-display); font-weight: 700; font-size: 16px; margin: 0 0 4px; }
.fe-cmp-p { font-size: 13.5px; line-height: 1.5; margin: 0; color: #26332C; }
.fe-cmp-a { color: var(--fe-green); text-decoration: underline; text-underline-offset: 2px; }
.fe-cmp-a:hover { color: var(--fe-ink); }

/* Buttons. Reject / Customize / Accept are deliberately the SAME width,
   weight and height — see the EDPB guidance on dark patterns. Only the
   background of the primary differs; the hit area and type size do not. */
.fe-cmp-actions { display: flex; gap: 10px; flex: 0 0 auto; flex-wrap: wrap; }
.fe-cmp-btn {
  font: 600 13.5px/1 var(--fe-font);
  min-height: 44px; padding: 0 18px;
  border-radius: var(--fe-radius); cursor: pointer;
  border: 1.5px solid var(--fe-green);
  background: transparent; color: var(--fe-green);
}
.fe-cmp-btn-equal { min-width: 132px; justify-content: center; display: inline-flex; align-items: center; }
.fe-cmp-btn:hover { background: rgba(13, 92, 69, .08); }
.fe-cmp-btn-primary { background: var(--fe-green); color: #fff; }
.fe-cmp-btn-primary:hover { background: #0A4A37; }
.fe-cmp-btn-ghost { border-style: dashed; }
.fe-cmp :focus-visible { outline: 3px solid var(--fe-emerald); outline-offset: 2px; }

.fe-cmp-lang {
  background: none; border: 0; cursor: pointer; padding: 6px 8px;
  font: 600 12px/1 var(--fe-font); color: var(--fe-green);
  text-decoration: underline; text-underline-offset: 3px;
}

/* ------------------------------------------------------------------- panel */
.fe-cmp-overlay {
  position: fixed; inset: 0; z-index: 2147483100;
  background: rgba(13, 26, 20, .55);
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
}
body.fe-cmp-locked { overflow: hidden; }
.fe-cmp-panel {
  background: var(--fe-paper); border-radius: 14px;
  width: min(760px, 100%); max-height: min(86vh, 900px); overflow-y: auto;
  padding: 22px 24px 24px; box-shadow: 0 24px 60px rgba(0, 0, 0, .3);
}
.fe-cmp-panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.fe-cmp-h2 { font-family: var(--fe-display); font-weight: 700; font-size: 22px; margin: 0 0 6px; }
.fe-cmp-h2:focus { outline: none; }
.fe-cmp-x { background: none; border: 0; font-size: 26px; line-height: 1; cursor: pointer; color: var(--fe-ink); padding: 2px 6px; }

.fe-cmp-cats { margin: 16px 0 4px; display: grid; gap: 10px; }
.fe-cmp-cat { border: 1px solid var(--fe-line); border-radius: var(--fe-radius); padding: 14px 16px; background: #fff; }
.fe-cmp-cat-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.fe-cmp-cat-l { font-weight: 700; font-size: 14.5px; margin: 0 0 2px; }
.fe-cmp-cat-d { font-size: 13px; color: #46554D; margin: 0; }
.fe-cmp-lock { font-size: 12px; font-weight: 700; color: var(--fe-green); background: var(--fe-mint); padding: 6px 10px; border-radius: 999px; white-space: nowrap; }

/* real button with role=switch, not a div */
.fe-cmp-switch {
  flex: 0 0 auto; width: 52px; height: 30px; border-radius: 999px; cursor: pointer;
  border: 1.5px solid var(--fe-line); background: #E4E7E5; position: relative; transition: background .15s, border-color .15s;
}
.fe-cmp-switch span { position: absolute; top: 3px; left: 3px; width: 21px; height: 21px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.3); transition: transform .15s; }
.fe-cmp-switch[aria-checked="true"] { background: var(--fe-green); border-color: var(--fe-green); }
.fe-cmp-switch[aria-checked="true"] span { transform: translateX(22px); }
@media (prefers-reduced-motion: reduce) { .fe-cmp-switch, .fe-cmp-switch span { transition: none; } }

.fe-cmp-det { margin-top: 12px; }
.fe-cmp-det summary { cursor: pointer; font-size: 12.5px; font-weight: 700; color: var(--fe-green); }
.fe-cmp-tablewrap { overflow-x: auto; margin-top: 10px; }
.fe-cmp-table { width: 100%; border-collapse: collapse; font-size: 12px; min-width: 520px; }
.fe-cmp-table th, .fe-cmp-table td { text-align: left; vertical-align: top; padding: 7px 10px; border-bottom: 1px solid var(--fe-line); }
.fe-cmp-table th { font-family: var(--fe-display); text-transform: uppercase; letter-spacing: .05em; font-size: 11px; color: var(--fe-green); }

.fe-cmp-receipt { font-size: 11.5px; color: #5A675F; margin: 14px 0 0; }
.fe-cmp-id { background: rgba(13,92,69,.1); padding: 1px 6px; border-radius: 4px; font-family: ui-monospace, Menlo, Consolas, monospace; }
.fe-cmp-actions-panel { margin-top: 16px; }

/* ------------------------------------------------------- iframe placeholder */
.fe-cmp-placeholder {
  border: 1px dashed var(--fe-green); border-radius: var(--fe-radius);
  background: var(--fe-paper); padding: 20px; text-align: center;
}
.fe-cmp-ph-t { font-family: var(--fe-display); font-weight: 700; margin: 0 0 4px; }
.fe-cmp-ph-b { font-size: 13px; color: #46554D; margin: 0 0 12px; }

/* --------------------------------------------------------------- dark mode */
@media (prefers-color-scheme: dark) {
  .fe-cmp {
    --fe-paper: #12201A;
    --fe-ink: #ECF2EE;
    --fe-line: rgba(236, 242, 238, .22);
  }
  .fe-cmp-banner { background: var(--fe-paper); }
  .fe-cmp-p, .fe-cmp-cat-d, .fe-cmp-ph-b { color: #B9C7C0; }
  .fe-cmp-cat { background: #16281F; }
  .fe-cmp-panel { background: var(--fe-paper); }
  .fe-cmp-btn { color: var(--fe-mint); border-color: var(--fe-mint); }
  .fe-cmp-btn:hover { background: rgba(159, 225, 203, .12); }
  .fe-cmp-btn-primary { background: var(--fe-mint); color: #0A2018; border-color: var(--fe-mint); }
  .fe-cmp-btn-primary:hover { background: #B6EBDA; }
  .fe-cmp-a, .fe-cmp-lang, .fe-cmp-det summary, .fe-cmp-table th { color: var(--fe-mint); }
  .fe-cmp-lock { background: rgba(159, 225, 203, .2); color: var(--fe-mint); }
  .fe-cmp-switch { background: #2A3B33; }
}

/* ------------------------------------------------------------------ mobile */
@media (max-width: 720px) {
  .fe-cmp-banner-in { gap: 14px; }
  .fe-cmp-actions { width: 100%; }
  .fe-cmp-btn-equal { flex: 1 1 0; min-width: 0; padding: 0 10px; }
  .fe-cmp-lang { align-self: flex-start; padding-left: 0; }
  .fe-cmp-panel { padding: 18px 16px 20px; max-height: 92vh; }
  .fe-cmp-cat-top { flex-wrap: wrap; }
}
@media (max-width: 360px) {
  .fe-cmp-btn { font-size: 12.5px; padding: 0 6px; }
}

@media print { .fe-cmp-banner, .fe-cmp-overlay { display: none !important; } }
