/* ConferVox base layer: fonts, reset, typography, forms, buttons, surfaces, feedback.
   Reads only the role tokens from tokens.css. Feature-specific blocks live in components.css,
   the workspace shell (header, side navigation) in management.css, the audience view in audience.css. */

/* ---------- Fonts (self-hosted, Latin subset) ---------- */
@font-face { font-family: "Inter"; font-style: normal; font-weight: 400; font-display: swap; src: url(/assets/fonts/inter-400.woff2) format("woff2"); }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 500; font-display: swap; src: url(/assets/fonts/inter-500.woff2) format("woff2"); }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 600; font-display: swap; src: url(/assets/fonts/inter-600.woff2) format("woff2"); }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 700; font-display: swap; src: url(/assets/fonts/inter-700.woff2) format("woff2"); }
@font-face { font-family: "Manrope"; font-style: normal; font-weight: 600; font-display: swap; src: url(/assets/fonts/manrope-600.woff2) format("woff2"); }
@font-face { font-family: "Manrope"; font-style: normal; font-weight: 700; font-display: swap; src: url(/assets/fonts/manrope-700.woff2) format("woff2"); }
@font-face { font-family: "Manrope"; font-style: normal; font-weight: 800; font-display: swap; src: url(/assets/fonts/manrope-800.woff2) format("woff2"); }

/* ---------- Reset and document ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-top: 5rem; scroll-padding-bottom: 8rem; }
body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 0.9375rem;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  overflow-wrap: break-word;
}
[data-theme] { color: var(--text); background: var(--bg); }
.wrap { max-width: 880px; margin: auto; padding: var(--space-6) var(--space-4); }
.hidden, [hidden] { display: none !important; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* ---------- Utilities: spacing and text flow, so pages never carry inline style ---------- */
.mt-2 { margin-top: var(--space-2); }
.mt-3 { margin-top: var(--space-3); }
.mt-4 { margin-top: var(--space-4); }
.scroll-x { overflow-x: auto; }
.scroll-target { scroll-margin-top: calc(var(--header-height) + var(--space-4)); }
.wrap-anywhere { overflow-wrap: anywhere; }
.pre-line { white-space: pre-line; }
.pre-wrap { white-space: pre-wrap; overflow-wrap: anywhere; margin: 0; }
.row-between { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--space-3); }
.section-rule { margin-top: var(--space-6); padding-top: var(--space-4); border-top: 1px solid var(--line); }
.subsection { margin: var(--space-6) 0 var(--space-2); }
.check-row { display: flex; align-items: center; gap: var(--space-2); }
.check-row-top { align-items: flex-start; }
.flush-bottom { margin-bottom: var(--space-2); }
.text-err { color: var(--err); font-weight: 600; }
.scroll-panel { max-height: 22.5rem; overflow: auto; }
.list-row { display: flex; gap: var(--space-3); justify-content: space-between; align-items: center; padding: var(--space-3) 0; border-bottom: 1px solid var(--line); }
.list-row-tight { padding: 0.375rem 0; }
.inline-actions { display: flex; gap: 0.375rem; flex-wrap: wrap; align-items: center; }
.card-narrow { max-width: 40rem; margin: var(--space-6) auto; }
.logo-sm { height: 2.25rem; margin-bottom: var(--space-6); }
hr { border: 0; border-top: 1px solid var(--line); margin: var(--space-6) 0; }

/* ---------- Typography: tracking and leading follow size ---------- */
h1, h2, h3, h4 { font-family: var(--font-display); color: var(--heading); text-wrap: balance; }
:where(h1, h2, h3, h4) { margin: 0; }
h1 { font-size: 1.5rem; font-weight: 800; line-height: 1.2; letter-spacing: -0.025em; }
h2 { font-size: 1.125rem; font-weight: 700; line-height: 1.3; letter-spacing: -0.02em; }
h3 { font-size: 1rem; font-weight: 700; line-height: 1.35; letter-spacing: -0.015em; }
h4 { font-size: 0.9375rem; font-weight: 700; line-height: 1.4; letter-spacing: -0.01em; }
p { margin: 0 0 var(--space-3); }
:where(div, p, ul, ol, form, table, details) + :where(h3, h4) { margin-top: var(--space-4); }
a { color: var(--accent-text); text-underline-offset: 0.2em; }
.muted { color: var(--text-muted); }
.code { font-family: var(--font-mono); font-size: 1.05rem; letter-spacing: 0.08em; }
footer { color: var(--text-muted); font-size: 0.875rem; padding: var(--space-3) 0; }

/* ---------- Forms ---------- */
label { display: block; font-weight: 600; font-size: 0.875rem; margin: var(--space-3) 0 var(--space-1); color: var(--text); }
input, select, textarea, button { font: inherit; color: inherit; }
input:where(:not([type="checkbox"], [type="radio"])), :where(select, textarea) {
  width: 100%;
  min-height: var(--tap);
  padding: 0.5rem 0.875rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-field);
  background: var(--surface);
  color: var(--text);
}
input::placeholder, textarea::placeholder { color: var(--text-muted); }
input[type="checkbox"], input[type="radio"] { width: 1.125rem; height: 1.125rem; min-height: 0; padding: 0; accent-color: var(--action); }
input:disabled, select:disabled, textarea:disabled { opacity: 0.6; cursor: not-allowed; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius-md); padding: var(--space-3) var(--space-4); margin: var(--space-4) 0; min-width: 0; }
legend { font-weight: 600; padding: 0 var(--space-2); }

/* ---------- Actions ----------
   button            primary: one per area
   button.secondary  neutral alternative
   button.ghost      quiet text action
   button.danger     critical: outline only, filled only inside a confirmation dialog
   The skin applies under .app-ui (every page except the participant view, which styles its own controls). */
:where(.app-ui button) {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  min-height: var(--tap);
  margin-top: var(--space-3);
  padding: 0.375rem 1rem;
  border: 1px solid var(--action);
  border-radius: var(--radius-sm);
  background: var(--action);
  color: var(--on-action);
  font-weight: 600; font-size: 0.875rem; line-height: 1.2;
  text-align: center; cursor: pointer;
  box-shadow: var(--shadow-btn);
  transition: background-color var(--duration-fast), transform var(--duration-press) ease-out;
}
:where(.app-ui button):hover { background: var(--action-hover); border-color: var(--action-hover); }
:where(.app-ui button):active { transform: scale(0.97); }
:where(.app-ui button.secondary) { background: var(--btn2-bg); border-color: var(--btn2-line); color: var(--btn2-fg); box-shadow: none; }
:where(.app-ui button.secondary):hover { background: var(--btn2-hover); border-color: var(--btn2-line); }
:where(.app-ui button.ghost) { background: transparent; border-color: transparent; color: var(--accent-text); box-shadow: none; }
:where(.app-ui button.ghost):hover { background: var(--btn2-hover); border-color: transparent; }
:where(.app-ui button.danger) { background: transparent; border-color: var(--err-icon); color: var(--err); box-shadow: none; }
:where(.app-ui button.danger):hover { background: var(--err-bg); border-color: var(--err-icon); }
:where(.app-ui button.danger-solid) { background: var(--err-solid); border-color: var(--err-solid); color: #fff; box-shadow: none; }
:where(.app-ui button[disabled]), :where(.app-ui button[aria-disabled="true"]) {
  opacity: 0.55; cursor: not-allowed; box-shadow: none; transform: none;
}
:where(.app-ui button[disabled]):hover { background: var(--action); }
:where(.app-ui button.secondary[disabled]):hover { background: var(--btn2-bg); }
.channel { display: flex; width: 100%; margin: var(--space-2) 0; justify-content: flex-start; text-align: left; }

/* ---------- Surfaces ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  margin: var(--space-4) 0;
  box-shadow: var(--shadow-sm);
}
.card .card { box-shadow: none; background: var(--surface-raised); border-radius: var(--radius-md); }
.card > :first-child { margin-top: 0; }
.card > :last-child { margin-bottom: 0; }
.panel-note, .help-panel { margin: var(--space-4) 0; padding: var(--space-3) var(--space-4); border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface-raised); }
.help-panel summary { cursor: pointer; font-weight: 600; }
.help-panel li { margin: var(--space-2) 0; }
details.advanced { margin: var(--space-6) 0; border: 1px solid var(--line); border-radius: var(--radius-md); padding: 0 var(--space-4) var(--space-4); }
details.advanced summary { cursor: pointer; font-family: var(--font-display); font-weight: 700; padding: var(--space-4) 0; color: var(--heading); min-height: var(--tap); }

/* ---------- Feedback: status, completion, warning, error ---------- */
.notice, .error, .warning, .success {
  padding: var(--space-3) var(--space-4);
  border: 1px solid;
  border-radius: var(--radius-md);
  line-height: 1.5;
}
.notice  { background: var(--info-bg); border-color: var(--info-line); color: var(--info); }
.success { background: var(--ok-bg);   border-color: var(--ok-line);   color: var(--ok); }
.warning { background: var(--warn-bg); border-color: var(--warn-line); color: var(--warn); }
.error   { background: var(--err-bg);  border-color: var(--err-line);  color: var(--err); }

/* Status is always symbol or text plus colour, never colour alone. */
.status {
  display: inline-flex; align-items: center; gap: 0.375rem; flex: 0 0 auto; max-width: 100%;
  padding: 0.25rem 0.625rem 0.25rem 0.5rem;
  border: 1px solid transparent; border-radius: var(--radius-full);
  font-size: 0.8125rem; font-weight: 600; line-height: 1.3;
}
.status.ok   { color: var(--ok);   background: var(--ok-bg);   border-color: var(--ok-line); }
.status.info { color: var(--info); background: var(--info-bg); border-color: var(--info-line); }
.status.warn { color: var(--warn); background: var(--warn-bg); border-color: var(--warn-line); }
.status.err  { color: var(--err);  background: var(--err-bg);  border-color: var(--err-line); }
.status.unk  { color: var(--unk);  background: var(--unk-bg);  border-color: var(--unk-line); border-style: dashed; }
.status.off  { color: var(--text-muted); background: transparent; border-color: var(--line-strong); }
.status.live { color: #fff; background: var(--midnight); border-color: var(--midnight); }
[data-theme="dark"] .status.live { color: #c8f6fb; background: rgba(37, 214, 232, 0.14); border-color: rgba(37, 214, 232, 0.45); }
.dot { width: 0.5rem; height: 0.5rem; border-radius: 50%; background: var(--cyan); flex: none; }

/* ---------- Dialogs ---------- */
dialog { width: min(40rem, calc(100% - 1.5rem)); max-height: 90vh; overflow: auto; color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: var(--space-6); box-shadow: var(--shadow-xl); }
dialog::backdrop { background: var(--scrim); }

/* ---------- Preview banner (super admin viewing as another account) ---------- */
.preview-banner { position: sticky; top: 0; z-index: 100; display: flex; flex-wrap: wrap; gap: var(--space-3); align-items: center; justify-content: center; padding: var(--space-3) var(--space-4); border-radius: 0; }
.preview-banner strong { overflow-wrap: anywhere; }
.preview-banner button { margin: 0; }

/* ---------- Tables ---------- */
table { width: 100%; border-collapse: collapse; margin-top: var(--space-3); }
th, td { text-align: left; padding: 0.625rem var(--space-3); border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 0.75rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-muted); }

/* ---------- Language toggle ---------- */
.lang-switch { display: inline-flex; gap: 2px; padding: 3px; border-radius: var(--radius-full); background: var(--btn2-bg); border: 1px solid var(--btn2-line); }
.lang-switch button {
  min-height: 0; margin: 0; padding: 0.25rem 0.75rem; border: 0; border-radius: var(--radius-full);
  background: transparent; color: var(--text-muted); box-shadow: none;
  font-size: 0.76rem; font-weight: 700; letter-spacing: 0.02em;
}
.theme-switch button { display: inline-flex; align-items: center; gap: 0.35rem; }
.theme-switch svg { width: 14px; height: 14px; flex: none; }
.lang-switch button:hover { background: transparent; color: var(--text); }
.lang-switch button.active, .lang-switch button[aria-pressed="true"] { background: var(--action); color: var(--on-action); }

/* ---------- Site header (public pages; the workspace shell extends it in management.css) ---------- */
.site-header { background: var(--bg); color: var(--text); border-bottom: 1px solid var(--line); }
.site-header .wrap { max-width: 1160px; padding-block: var(--space-4); display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); }
.brand { display: flex; align-items: center; gap: var(--space-2); text-decoration: none; color: inherit; }
.brand-logo { height: 38px; width: auto; display: block; }
.app-nav { margin-left: auto; display: flex; align-items: center; gap: var(--space-4); }
.app-nav a { color: var(--text-secondary); text-decoration: none; font-size: 0.875rem; font-weight: 600; white-space: nowrap; }
.app-nav a:hover { color: var(--cyan); }
.app-nav .admin-link { border: 1px solid var(--line-strong); border-radius: var(--radius-sm); padding: 0.5rem 0.75rem; }
.mobile-app-menu { display: none; }
.mobile-app-menu summary {
  display: flex; align-items: center; justify-content: center; width: 44px; height: 44px; padding: 10px;
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm); color: var(--text); cursor: pointer; list-style: none;
}
.mobile-app-menu summary::-webkit-details-marker { display: none; }
.mobile-app-menu summary svg { width: 22px; height: 22px; }
.mobile-menu-label { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.mobile-app-nav {
  position: absolute; top: calc(100% - 8px); left: var(--space-4); right: var(--space-4); z-index: 110;
  display: grid; gap: var(--space-1); padding: var(--space-2);
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius-md); box-shadow: var(--shadow-xl);
}
.mobile-app-nav a { display: block; min-height: 44px; padding: var(--space-3); color: var(--text-secondary); text-decoration: none; font-weight: 600; overflow-wrap: anywhere; border-radius: var(--radius-sm); }
.mobile-app-nav a:hover { background: var(--btn2-hover); }
@media (max-width: 800px) {
  .app-nav { display: none; }
  .site-header .wrap { position: relative; flex-wrap: nowrap; gap: var(--space-2); }
  .brand { min-width: 0; flex: 0 1 180px; }
  .brand-logo { width: 100%; height: 34px; object-fit: contain; object-position: left; }
  .lang-switch { margin-left: auto; flex-shrink: 0; }
  .mobile-app-menu { display: block; flex: 0 0 44px; }
}

/* ---------- Account menu and view switch (workspace header) ---------- */
.account-menu { display: none; }
.management-header .account-menu { display: block; }
.account-nav { flex: 1; display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: var(--space-3); min-width: 0; }
.account-nav a { color: var(--text); font-size: 0.875rem; font-weight: 600; text-decoration: none; }
.account-nav a[aria-current="page"] { color: var(--cyan); text-decoration: underline; text-underline-offset: 5px; }
.account-status { font-size: 0.8125rem; color: var(--text-muted); }
.account-view { margin: 0; min-width: 0; display: flex; align-items: center; gap: var(--space-2); font-size: 0.8125rem; }
.account-view select { width: 240px; max-width: 100%; font-size: 0.8125rem; }
.account-message { color: var(--text); font-size: 0.875rem; flex-basis: 100%; text-align: right; }
.account-message:empty { display: none; }
.product-update-link { display: inline-flex; align-items: center; gap: var(--space-2); font-size: 0.8125rem; text-decoration: none; }
.product-unread { padding: 2px 7px; border-radius: var(--radius-full); background: var(--tint); color: var(--tint-text); font-size: 0.7rem; font-weight: 700; }
.product-version { color: var(--text-muted); }
.management-header { position: sticky; top: 0; z-index: 101; }
.management-header .wrap { flex-wrap: wrap; }
.management-header .app-nav, .management-header .mobile-app-menu { display: none; }
#user-preview-banner { top: var(--header-height) !important; }
@media (max-width: 760px) {
  .management-header .brand { order: 0; }
  .management-header .lang-switch { order: 1; margin-left: auto; }
  .management-header .account-nav { order: 2; flex-basis: 100%; justify-content: flex-start; gap: var(--space-3); }
  .account-view { flex-basis: 100%; }
  .account-view select { flex: 1; min-width: 0; width: auto; }
  .account-status { margin-left: auto; }
  .account-message { text-align: left; }
}

/* ---------- Motion, transparency and contrast preferences ----------
   Reduced motion keeps feedback but swaps movement for a short cross-fade. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; }
  button, button:active { transform: none !important; transition: background-color var(--duration-fast); }
}
@media (prefers-contrast: more) {
  :root, [data-theme] { --line: var(--line-strong); }
  .card, .status { border-color: var(--line-strong); }
}
