/* ============================================================================
   Valevix auth branding layer — injected in front of Authelia's SPA.
   Mirrors valevix.com design tokens (warm paper, serif, burnt-sienna accent).
   Loaded AFTER Authelia's own stylesheet; every declaration uses !important
   because Authelia's MUI/emotion styles are injected at runtime.
   ========================================================================== */

:root {
  color-scheme: light;
  --bg: #fbf7f1;
  --bg-soft: #f4ede2;
  --surface: #fffcf7;
  --border: #e8ddcc;
  --border-strong: #d6c6ae;
  --text: #1d1812;
  --text-muted: #6a5d4e;
  --text-faint: #9c8c78;
  --accent: #9c4a21;
  --accent-hover: #7e3a17;
  --accent-soft: #f7e9dd;
  --accent-contrast: #fff9f3;
  --danger-text: #a33a2a;
  --font-serif: "Noto Serif SC", "Songti SC", "STSong", "Source Han Serif SC", "SimSun", Georgia, "Times New Roman", serif;
  --radius-sm: 4px;
  --radius-md: 6px;
  --shadow-2: 0 2px 10px rgba(29, 24, 18, 0.055);
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #14110d;
    --bg-soft: #1b1712;
    --surface: #201b15;
    --border: #332b21;
    --border-strong: #4a3e2f;
    --text: #f2ebe1;
    --text-muted: #b9aa96;
    --text-faint: #877968;
    --accent: #d98a5c;
    --accent-hover: #e9a176;
    --accent-soft: #2c2117;
    --accent-contrast: #1b1510;
    --danger-text: #e08a76;
    --shadow-2: 0 2px 10px rgba(0, 0, 0, 0.35);
  }
}

html, body { background: var(--bg) !important; color: var(--text) !important; }
body, #root, .MuiTypography-root, .MuiButton-root, .MuiInputBase-root, .MuiFormLabel-root,
.MuiInputLabel-root, .MuiFormControlLabel-root, .MuiLink-root, .MuiMenuItem-root {
  font-family: var(--font-serif) !important;
}
body { -webkit-font-smoothing: antialiased; }

/* Language switcher bar — echoes the site header hairline. */
.MuiAppBar-root {
  background: var(--bg) !important;
  border-bottom: 1px solid var(--border) !important;
  box-shadow: none !important;
}
.MuiAppBar-root .MuiToolbar-root { min-height: 64px !important; }

/* Brand mark: Authelia's default glyph becomes the Valevix mark. */
svg.MuiBox-root {
  background-image: url("/__valevix/logo.svg") !important;
  background-repeat: no-repeat !important;
  background-position: center !important;
  background-size: contain !important;
  width: 64px !important;
  height: 64px !important;
  margin: 0 auto 8px !important;
}
svg.MuiBox-root > path { display: none !important; }

/* Login / 2FA / reset card */
.MuiContainer-maxWidthXs {
  background: var(--surface) !important;
  border: 1px solid var(--border) !important;
  border-radius: var(--radius-md) !important;
  box-shadow: var(--shadow-2) !important;
  padding: 32px 28px !important;
  margin-top: 24px !important;
}
.MuiTypography-h5, .MuiTypography-h4, .MuiTypography-h3, .MuiTypography-h6 {
  font-weight: 600 !important;
  letter-spacing: 0.01em !important;
  color: var(--text) !important;
}
.MuiTypography-h5 { font-size: 1.5rem !important; }
.MuiTypography-body1, .MuiTypography-body2, .MuiTypography-caption { color: var(--text-muted) !important; }

/* Text fields: boxed hairlines instead of MUI underlines */
.MuiInputBase-root {
  background: var(--bg) !important;
  border: 1px solid var(--border-strong) !important;
  border-radius: var(--radius-sm) !important;
  color: var(--text) !important;
  transition: border-color 0.16s, box-shadow 0.16s !important;
}
.MuiInputBase-root::before, .MuiInputBase-root::after { display: none !important; border: 0 !important; }
.MuiInputBase-root:hover { border-color: var(--accent) !important; }
.MuiInputBase-root.Mui-focused {
  border-color: var(--accent) !important;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent) !important;
}
.MuiInputBase-input { padding: 12px 13px !important; color: var(--text) !important; }
.MuiInputBase-input::placeholder { color: var(--text-faint) !important; opacity: 1 !important; }
.MuiOutlinedInput-notchedOutline { border: 0 !important; }
.MuiFormLabel-root, .MuiInputLabel-root { color: var(--text-muted) !important; }
/* Float the label fully above the field box (same layout as the register page)
   instead of MUI's standard "label sits on the border" treatment. */
/* Every label sits above its field (empty or filled), like the register page. */
.MuiInputLabel-root {
  transform: translate(0, -26px) !important;
  background: transparent !important;
  padding: 0 !important;
  border-radius: 0 !important;
  font-size: 0.9375rem !important;
  color: var(--text) !important;
}
.MuiInputLabel-root.Mui-focused { color: var(--accent) !important; }
.MuiInputLabel-root.Mui-error { color: var(--danger-text) !important; }
.MuiInputBase-root.Mui-error { border-color: var(--danger-text) !important; }
.MuiFormControl-root { margin-top: 18px !important; }
.MuiFormControlLabel-root { margin-top: 4px !important; }
.MuiFormLabel-root.Mui-focused { color: var(--accent) !important; }
.MuiFormHelperText-root { color: var(--text-faint) !important; }

/* Buttons — same language as valevix.com .btn / .btn-primary */
.MuiButton-root {
  border-radius: var(--radius-sm) !important;
  font-weight: 600 !important;
  letter-spacing: 0.02em !important;
  text-transform: none !important;
  font-size: 1.0625rem !important;
  box-shadow: none !important;
  transition: background 0.16s, border-color 0.16s, color 0.16s, transform 0.16s !important;
}
.MuiButton-containedPrimary {
  background: var(--accent) !important;
  color: var(--accent-contrast) !important;
  padding: 12px 26px !important;
}
.MuiButton-containedPrimary:hover { background: var(--accent-hover) !important; transform: translateY(-1px) !important; }
.MuiButton-outlinedPrimary, .MuiButton-outlined {
  border-color: var(--border-strong) !important;
  color: var(--text) !important;
}
.MuiButton-outlinedPrimary:hover, .MuiButton-outlined:hover {
  border-color: var(--accent) !important;
  color: var(--accent) !important;
  background: var(--accent-soft) !important;
}
.MuiButton-textPrimary, .MuiButton-text { color: var(--accent) !important; }
.MuiButton-textPrimary:hover, .MuiButton-text:hover { background: var(--accent-soft) !important; }
.MuiIconButton-root { color: var(--text-muted) !important; }
.MuiIconButton-root:hover { background: var(--accent-soft) !important; color: var(--accent) !important; }

/* Links, checkbox, alerts */
.MuiLink-root { color: var(--accent) !important; text-decoration: none !important; }
.MuiLink-root:hover { color: var(--accent-hover) !important; text-decoration: underline !important; }
.MuiCheckbox-root { color: var(--border-strong) !important; }
.MuiCheckbox-root.Mui-checked { color: var(--accent) !important; }
.MuiAlert-root {
  border-radius: var(--radius-sm) !important;
  border: 1px solid var(--border) !important;
  border-left: 3px solid var(--accent) !important;
  background: var(--accent-soft) !important;
  color: var(--text) !important;
}
.MuiAlert-standardError, .MuiAlert-filledError {
  border-left-color: var(--danger-text) !important;
  background: color-mix(in srgb, var(--danger-text) 12%, var(--surface)) !important;
  color: var(--danger-text) !important;
}
.MuiSvgIcon-root { color: inherit !important; }
.MuiDivider-root { border-color: var(--border) !important; }
.MuiPaper-root { background-image: none !important; }

/* ---------------------------------------------------------------------------
   Account menu - the Authelia "Settings" surface is intentionally removed.
   Account/security administration belongs to the Mailu mailbox backend, so the
   entry (and the divider it owns) is hidden from the account dropdown. The
   /settings route itself stays reachable by URL on purpose: it is the only
   remaining place to manage the administrator's TOTP device.
   The id below is what Authelia puts on that MenuItem, see
   web/src/components/AppBarItemAccountSettings.tsx (onClick handleSettingsClick).
   --------------------------------------------------------------------------- */
#account-menu-settings,
#account-menu-settings + .MuiDivider-root {
  display: none !important;
}
