/* Shared consent/permission surface. All colors and typography inherit DTC tokens. */
html.browser-preferences-modal-open { overflow: hidden; }
body .browser-preferences-footer {
  clear: both;
  padding: 8px var(--ui-space) calc(16px + env(safe-area-inset-bottom));
  text-align: center;
  font: 14px/1.65 var(--ui-font);
  color: var(--ui-muted);
}
body #browser-preferences-open {
  min-height: 44px;
  padding: 8px 12px;
  border: 1px solid transparent;
  border-radius: var(--ui-control-radius);
  background: transparent;
  color: var(--brand-blue);
  font: inherit;
  text-decoration: underline;
  text-underline-offset: 4px;
}
body #browser-preferences-open:hover { background: var(--ui-tint); }
body .browser-preferences-storage { margin: 8px auto 0; max-width: 640px; }
body dialog.browser-preferences-dialog {
  box-sizing: border-box;
  width: min(640px, calc(100% - 24px));
  max-width: calc(100vw - 24px - env(safe-area-inset-left) - env(safe-area-inset-right));
  max-height: calc(var(--ui-viewport-height, 100dvh) - 24px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
  padding: 0;
  margin: auto;
  overflow: hidden;
  border: 1px solid var(--ui-line);
  border-radius: var(--ui-radius);
  background: var(--ui-surface);
  color: var(--ui-ink);
  font: 16px/1.65 var(--ui-font);
  text-align: start;
  box-shadow: var(--ui-shadow);
}
body dialog.browser-preferences-dialog[open] { display: flex; flex-direction: column; }
body dialog.browser-preferences-dialog::backdrop { background: rgb(25 39 62 / 42%); }
body .browser-preferences-heading {
  flex: 0 0 auto;
  padding: 20px 24px 12px;
  border-top: 4px solid var(--brand-blue);
  background: var(--ui-surface);
}
body .browser-preferences-heading h2 { margin: 0; font: 700 24px/1.45 var(--ui-title-font); }
body .browser-preferences-heading p { margin: 8px 0 0; color: var(--ui-muted); font-size: 14px; }
body .browser-preferences-body {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 0 24px;
  scrollbar-gutter: stable;
}
body .browser-preferences-section { padding: 16px 0; margin: 0; border-top: 1px solid var(--ui-line); }
body .browser-preferences-section h3 { margin: 0 0 6px; font: 700 17px/1.5 var(--ui-title-font); }
body .browser-preferences-section p { margin: 0; }
body .browser-preferences-section a { display: inline-block; color: var(--brand-blue); padding-block: 9px; min-height: 44px; text-underline-offset: 4px; }
body .browser-preferences-section a:hover { color: var(--ui-focus); }
body .browser-preferences-scope { color: var(--ui-muted); font-size: 14px; padding-top: 10px; }
body .browser-preferences-status { min-height: 1.65em; margin-top: 10px; color: var(--ui-ink); font-size: 14px; }
body .browser-preferences-links, body .browser-preferences-utilities { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-top: 10px; }
body .browser-preferences-links a { min-height: 44px; }
body .browser-preferences-utilities button, body .browser-preferences-confirmation button {
  min-height: 44px; padding: 8px 12px; border: 1px solid var(--ui-line);
  border-radius: var(--ui-control-radius); color: var(--brand-blue); background: var(--ui-surface);
  font: 600 16px/1.5 var(--ui-font); cursor: pointer;
}
body .browser-preferences-utilities button:hover, body .browser-preferences-confirmation button:hover { background: var(--ui-tint); }
body .browser-preferences-utilities button:active, body .browser-preferences-confirmation button:active { background: var(--ui-line); }
body .browser-preferences-utilities button:disabled, body .browser-preferences-confirmation button:disabled { opacity: .6; cursor: wait; }
body .browser-preferences-confirmation { margin-top: 14px; padding: 14px; background: var(--ui-tint); border: 1px solid var(--ui-line); border-radius: var(--ui-control-radius); }
body .browser-preferences-confirmation button { margin: 12px 0 0 8px; }
body #browser-preferences-confirm-disable { color: var(--ui-danger); border-color: var(--ui-danger); }
body .browser-preferences-section [hidden] { display: none; }
body .browser-preferences-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  flex: 0 0 auto;
  padding: 16px 24px 20px;
  border-top: 1px solid var(--ui-line);
  background: var(--ui-surface);
}
body .browser-preferences-actions button {
  min-height: 48px;
  padding: 10px 14px;
  border: 1px solid var(--brand-blue);
  border-radius: var(--ui-control-radius);
  background: var(--ui-surface);
  color: var(--brand-blue);
  font: 700 16px/1.5 var(--ui-font);
  cursor: pointer;
  transition: background-color 150ms ease, color 150ms ease;
}
body #browser-preferences-enable { background: var(--brand-blue); color: var(--ui-surface); }
body .browser-preferences-actions button:not(:disabled):hover { background: var(--ui-tint); color: var(--ui-ink); }
body .browser-preferences-actions button:not(:disabled):active { background: var(--ui-line); color: var(--ui-ink); }
body .browser-preferences-actions button:disabled { cursor: wait; opacity: .6; }
body .browser-preferences-actions button[aria-busy="true"] { border-style: dashed; }
body .browser-preferences-actions button[hidden], body .browser-preferences-storage[hidden] { display: none; }
body .browser-preferences-actions:has(button[hidden]) { grid-template-columns: 1fr; }
body .browser-preferences-dialog :is(button, a):focus-visible, body #browser-preferences-open:focus-visible {
  outline: 3px solid var(--ui-focus);
  outline-offset: 3px;
}
body .browser-preferences-news { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--ui-line); }
body .browser-preferences-news label { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; min-height: 44px; font-size: 14px; }
body .browser-preferences-news input { flex: 0 0 auto; width: 20px; height: 20px; margin: 4px 0; accent-color: var(--brand-blue); }
body .browser-preferences-news input:focus-visible { outline: 3px solid var(--ui-focus); outline-offset: 3px; }
body #browser-preferences-save-news { min-height: 44px; padding: 8px 12px; border: 1px solid var(--ui-line); border-radius: var(--ui-control-radius); background: var(--ui-surface); color: var(--brand-blue); font: 600 16px/1.5 var(--ui-font); cursor: pointer; }
body #browser-preferences-save-news:hover { background: var(--ui-tint); }
body #browser-preferences-save-news:active { background: var(--ui-line); }
body #browser-preferences-save-news:disabled { opacity: .6; cursor: not-allowed; }
/* Entry cards are non-modal, with no backdrop/focus trap. Footer space keeps
   last-page content reachable; the page's own height/scroll owner is untouched. */
body .browser-preferences-entry {
  position: fixed; inset-inline: 12px; bottom: calc(12px + env(safe-area-inset-bottom));
  box-sizing: border-box; width: min(480px, calc(100% - 24px)); margin-inline: auto;
  max-height: min(55dvh, 420px); overflow-y: auto; overscroll-behavior: contain;
  padding: 16px; border: 1px solid var(--ui-line); border-top: 3px solid var(--brand-blue);
  border-radius: var(--ui-radius); color: var(--ui-ink); background: var(--ui-surface);
  font: 14px/1.65 var(--ui-font); text-align: start; box-shadow: var(--ui-shadow);
  z-index: var(--ui-entry-layer, 410);
}
body .browser-preferences-entry h2 { margin: 0 0 6px; font: 700 18px/1.45 var(--ui-title-font); }
body .browser-preferences-entry p { margin: 0; }
body .browser-preferences-entry .browser-preferences-status:empty { display: none; }
body .browser-preferences-entry .browser-preferences-status:not(:empty) { margin-top: 8px; }
body .browser-preferences-entry a { display: inline-flex; min-height: 44px; align-items: center; color: var(--brand-blue); text-underline-offset: 3px; }
body .browser-preferences-entry-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
body .browser-preferences-entry-actions button { flex: 1 1 auto; min-height: 44px; padding: 8px 12px; border: 1px solid var(--brand-blue); border-radius: var(--ui-control-radius); color: var(--brand-blue); background: var(--ui-surface); font: 700 16px/1.5 var(--ui-font); cursor: pointer; }
body #browser-preferences-entry-enable { color: var(--ui-surface); background: var(--brand-blue); }
body .browser-preferences-entry :is(button, a):not(:disabled):hover { background: var(--ui-tint); color: var(--ui-ink); }
body .browser-preferences-entry button:not(:disabled):active { background: var(--ui-line); color: var(--ui-ink); }
body .browser-preferences-entry button:disabled { opacity: .6; cursor: wait; }
body .browser-preferences-entry :is(button, a):focus-visible { outline: 3px solid var(--ui-focus); outline-offset: 3px; }
body .browser-preferences-entry[hidden], body .browser-preferences-entry [hidden], body .browser-preferences-news[hidden], body #browser-preferences-devices[hidden] { display: none; }
body .parent-session-list { list-style: none; padding: 0; margin: 12px 0; }
body .parent-session-item { border: 1px solid var(--ui-line); border-radius: var(--ui-control-radius); padding: 12px; margin-top: 8px; }
body .parent-session-actions { display: flex; flex-wrap: wrap; gap: 8px; }
body dialog.browser-preferences-inline { position: static; max-height: none; margin: 12px auto; }
@media (max-width: 500px) {
  body .browser-preferences-heading { padding: 16px 16px 12px; }
  body .browser-preferences-heading h2 { font-size: 21px; }
  body .browser-preferences-body { padding-inline: 16px; }
  body .browser-preferences-actions { grid-template-columns: 1fr; padding: 12px 16px 16px; }
}
@media (prefers-reduced-motion: reduce) {
  body .browser-preferences-actions button { transition: none; }
}
@media (forced-colors: active) {
  body dialog.browser-preferences-dialog, body .browser-preferences-actions button, body #browser-preferences-open { border: 1px solid ButtonText; }
}
@media print {
  /* Preferences are not part of financial, attendance or contract printouts. */
  body .browser-preferences-footer, body dialog.browser-preferences-dialog, body .browser-preferences-entry, body .browser-preferences-entry-space { display: none !important; }
}
