/* Cookie notice + preference panel.
   Design-system rules that apply here: brand chrome is MONOCHROME (--accent),
   because ice cyan and coral are reserved for PnL and value direction, and a
   consent box is chrome, not data. Both themes come free via the tokens. */

.xz-cc {
  position: fixed;
  left: var(--space-6); bottom: var(--space-6);
  z-index: 900;
  max-width: 460px;
}

.xz-cc-card,
.xz-cc-panel {
  background: var(--surface-1);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg), var(--edge-light);
  padding: var(--space-5);
}

.xz-cc-card { animation: xz-cc-rise var(--dur-slow) var(--ease-out); }

@keyframes xz-cc-rise {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}

.xz-cc-title {
  font-family: var(--font-display); font-weight: 600; font-size: 14px;
  color: var(--text-primary); margin: 0 0 var(--space-2);
}

.xz-cc-copy {
  font-size: 12.5px; line-height: 1.65;
  color: var(--text-secondary); margin: 0 0 var(--space-4);
}

.xz-cc-actions {
  display: flex; flex-wrap: wrap; gap: var(--space-2);
  margin-bottom: var(--space-3);
}

/* Accept and reject share this class on purpose: EU guidance requires refusing
   to be exactly as easy as agreeing, so they must not differ in visual weight.
   Only the tertiary "Manage" action gets the quieter ghost variant. */
.xz-cc-btn {
  font-family: inherit; font-size: 12px; font-weight: 600;
  padding: 8px 16px; border-radius: var(--radius-md);
  border: 1px solid var(--accent);
  background: var(--accent); color: var(--accent-contrast);
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease-standard),
              border-color var(--dur-fast) var(--ease-standard);
}
.xz-cc-btn:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.xz-cc-btn:active { background: var(--accent-press); border-color: var(--accent-press); }
.xz-cc-btn:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }

.xz-cc-btn-ghost {
  background: transparent; color: var(--text-primary);
  border-color: var(--border-strong);
}
.xz-cc-btn-ghost:hover { background: var(--surface-3); border-color: var(--border-strong); }
.xz-cc-btn-ghost:active { background: var(--surface-3); border-color: var(--border-strong); }

.xz-cc-fine {
  font-family: var(--font-mono); font-size: 10.5px;
  color: var(--text-tertiary); margin: 0;
}
.xz-cc-fine a { color: var(--text-secondary); text-decoration: none; }
.xz-cc-fine a:hover { color: var(--text-primary); text-decoration: underline; }

/* ---- preference panel ---- */

.xz-cc-scrim {
  position: fixed; inset: 0; z-index: 950;
  background: var(--backdrop);
  display: flex; align-items: center; justify-content: center;
  padding: var(--space-5);
}

.xz-cc-panel {
  width: 100%; max-width: 520px;
  max-height: 82vh; overflow-y: auto;
  animation: xz-cc-rise var(--dur-base) var(--ease-out);
}
.xz-cc-panel:focus { outline: none; }

.xz-cc-list { list-style: none; margin: 0 0 var(--space-4); padding: 0; }
.xz-cc-list li {
  padding: var(--space-3) 0;
  border-top: 1px solid var(--border-subtle);
}

.xz-cc-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--space-3);
}

.xz-cc-cat {
  font-family: var(--font-display); font-weight: 600; font-size: 13px;
  color: var(--text-primary);
}

.xz-cc-badge {
  font-family: var(--font-mono); font-size: 9.5px; letter-spacing: .08em;
  text-transform: uppercase; color: var(--text-tertiary);
  border: 1px solid var(--border-default); border-radius: var(--radius-pill);
  padding: 3px 9px; white-space: nowrap;
}

.xz-cc-desc {
  font-size: 12px; line-height: 1.6; color: var(--text-secondary);
  margin: var(--space-1) 0 0; padding-right: 56px;
}

/* switch (only rendered for optional categories) */
.xz-cc-switch { display: inline-flex; cursor: pointer; flex: none; }
.xz-cc-switch input {
  position: absolute; opacity: 0; width: 0; height: 0;
}
.xz-cc-track {
  width: 38px; height: 21px; border-radius: var(--radius-pill);
  background: var(--surface-3); border: 1px solid var(--border-strong);
  position: relative; transition: background var(--dur-fast) var(--ease-standard);
}
.xz-cc-track::after {
  content: ""; position: absolute; top: 2px; left: 2px;
  width: 15px; height: 15px; border-radius: 50%;
  background: var(--text-tertiary);
  transition: transform var(--dur-fast) var(--ease-standard),
              background var(--dur-fast) var(--ease-standard);
}
.xz-cc-switch input:checked + .xz-cc-track {
  background: var(--accent); border-color: var(--accent);
}
.xz-cc-switch input:checked + .xz-cc-track::after {
  transform: translateX(17px); background: var(--accent-contrast);
}
.xz-cc-switch input:focus-visible + .xz-cc-track {
  outline: 2px solid var(--focus-ring); outline-offset: 2px;
}

/* footer triggers. Two homes: .foot-links on the marketing/legal pages, and
   .foot-legal on the desk pages, so a signed-in user can withdraw a permission
   as easily as they gave it (an EU requirement, not a nicety). */
.foot-links button {
  font: inherit; color: var(--text-secondary);
  background: none; border: none; padding: 0; cursor: pointer;
}
.foot-links button:hover { color: var(--text-primary); }

.foot-legal { display: inline-flex; gap: 14px; margin-left: 14px; }
.foot-legal a, .foot-legal button {
  font: inherit; letter-spacing: inherit; color: var(--text-tertiary);
  background: none; border: none; padding: 0; cursor: pointer;
  text-decoration: none;
}
.foot-legal a:hover, .foot-legal button:hover { color: var(--text-secondary); }

@media (max-width: 560px) {
  .xz-cc { left: var(--space-3); right: var(--space-3); bottom: var(--space-3); max-width: none; }
  .xz-cc-actions .xz-cc-btn { flex: 1 1 auto; }
}

@media (prefers-reduced-motion: reduce) {
  .xz-cc-card, .xz-cc-panel { animation: none; }
  .xz-cc-btn, .xz-cc-track, .xz-cc-track::after { transition: none; }
}
