/*
 * Standalone pages in the MeAgenda panel look: account security (allauth MFA, e-mails,
 * password), terms of use and the 2FA login step. Loaded by templates/partials/_standalone_shell.html
 * (scoped .ma-shell) and, inside the panel, by partials/_lib_css.html (scoped .ma-lib).
 * (dlight-admin) classes are restyled here, the lib itself is not edited.
 * Tokens follow templates/base.html: night #0f172a, brand #5cbf3c, Inter + Poppins.
 */
.ma-shell,
.ma-lib {
  --ma-night: #0f172a;
  --ma-brand: #5cbf3c;
  --ma-brand-600: #4ba22f;
  --ma-brand-50: #f1f9ea;
  --ma-line: #e2e8f0;
  --ma-soft: #f1f5f9;
  --ma-muted: #64748b;
  /* Re-point the lib's theme variables so its buttons, badges and links use the brand. */
  --bs-primary: var(--ma-brand);
  --bs-primary-rgb: 92, 191, 60;
  --bs-hover-primary: var(--ma-brand-600);
  --bs-hover-primary-rgb: 75, 162, 47;
  --dl-on-primary: #fff;
  --dl-terms-ink: var(--ma-night);
  --dl-terms-muted: var(--ma-muted);
  --dl-terms-line: var(--ma-line);
  --dl-terms-soft: #f8fafc;
  --dl-terms-tint: var(--ma-brand-50);
  font-family: "Inter", system-ui, sans-serif;
}
.ma-shell {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background: #f8fafc;
  color: var(--ma-night);
  -webkit-font-smoothing: antialiased;
}

/* ---------- top bar (same as the panel header) ---------- */
.ma-bar { position: sticky; top: 0; z-index: 40; background: var(--ma-night); color: #fff; }
.ma-bar__inner {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  max-width: 80rem; height: 3.5rem; margin: 0 auto; padding: 0 1rem;
}
.ma-brand { display: inline-flex; align-items: center; gap: .5rem; color: #fff; text-decoration: none; flex-shrink: 0; }
.ma-brand:hover { color: #fff; }
.ma-brand__mark { width: 1.5rem; height: 1.5rem; }
.ma-brand__word { font-family: "Poppins", "Inter", sans-serif; font-weight: 800; font-size: 1.125rem; letter-spacing: -.025em; line-height: 1; }
.ma-brand__word b { color: var(--ma-brand); font-weight: 800; }
.ma-brand__word small { margin-left: .125rem; font-size: .55em; font-weight: 600; vertical-align: top; color: #94a3b8; letter-spacing: 0; }
.ma-bar__actions { display: flex; align-items: center; gap: .25rem; font-size: .875rem; font-weight: 500; min-width: 0; }
.ma-bar__form { margin: 0; }
.ma-bar__link {
  display: inline-block; padding: .5rem .75rem; border: 0; border-radius: .5rem; background: transparent;
  color: #cbd5e1; font: inherit; text-decoration: none; cursor: pointer; transition: background .15s, color .15s;
}
.ma-bar__link:hover, .ma-bar__link:focus-visible { background: rgba(255, 255, 255, .06); color: #fff; }
.ma-bar__user { max-width: 12rem; overflow: hidden; padding: 0 .5rem; color: #94a3b8; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 575px) { .ma-bar__user { display: none; } }

/* ---------- page frame ---------- */
.ma-main { flex: 1; width: 100%; max-width: 80rem; margin: 0 auto; padding: 1.5rem 1rem; }
.ma-messages { display: flex; flex-direction: column; gap: .5rem; margin-bottom: 1rem; }
.ma-footer { padding: 1.5rem 1rem; text-align: center; font-size: .75rem; color: #94a3b8; }
.ma-footer p { margin: 0 0 .25rem; }
.ma-footer a { color: inherit; text-decoration: none; }
.ma-footer a:hover { color: var(--ma-brand); }

.ma-eyebrow { margin: 0 0 .5rem; font-family: "Poppins", sans-serif; font-size: .75rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: #94a3b8; }

/* Account: side menu + one white sheet (no card inside the sheet). */
.ma-account__grid { display: grid; gap: 1rem; align-items: start; }
@media (min-width: 992px) { .ma-account__grid { grid-template-columns: 230px minmax(0, 1fr); gap: 2rem; } }
.ma-account__menu .dl-actions { display: flex; flex-direction: row; flex-wrap: wrap; gap: .25rem !important; }
@media (min-width: 992px) { .ma-account__menu .dl-actions { flex-direction: column; flex-wrap: nowrap; } }
.ma-shell .ma-account__menu .dl-actions .btn.dl-btn {
  --dl-btn-bg: transparent; --dl-btn-border: transparent; --dl-btn-color: #475569;
  --dl-btn-hover-bg: #fff; --dl-btn-hover-border: var(--ma-line); --dl-btn-hover-color: var(--ma-night);
  width: auto; justify-content: flex-start; gap: .625rem; min-height: 2.5rem; padding: .5rem .75rem;
  font-size: .875rem; font-weight: 500;
}
@media (min-width: 992px) { .ma-shell .ma-account__menu .dl-actions .btn.dl-btn { width: 100%; } }
.ma-shell .ma-account__menu .dl-actions .btn.dl-btn:not(:has(i)) { padding-left: 2.375rem; }
.ma-account__menu .dl-actions .btn i { width: 1rem; color: #94a3b8; text-align: center; }
.ma-account__content, .ma-entrance__card, .ma-terms__sheet {
  background: #fff; border: 1px solid #f1f5f9; border-radius: 1rem; box-shadow: 0 1px 2px rgba(15, 23, 42, .05);
  padding: 1.25rem; display: flex; flex-direction: column; gap: 1.5rem;
}
@media (min-width: 768px) { .ma-account__content { padding: 2rem; } }

/* Entrance (2FA step): narrow centered sheet. */
.ma-entrance .ma-main { display: flex; align-items: flex-start; justify-content: center; padding-top: 2.5rem; }
.ma-entrance__card { width: 100%; max-width: 26rem; padding: 1.75rem; }

/* Terms: reading sheet. */
.ma-terms .ma-main { max-width: 56rem; }
.ma-terms__sheet { display: block; padding: 1.25rem; }
@media (min-width: 768px) { .ma-terms__sheet { padding: 2.5rem 2.75rem; } }

/* ---------- lib elements restyled (standalone shell and in-panel .ma-lib) ---------- */
:is(.ma-shell, .ma-lib) h1, :is(.ma-shell, .ma-lib) .dl-auth-title, :is(.ma-shell, .ma-lib) .dl-terms__title {
  font-family: "Poppins", "Inter", sans-serif; font-size: 1.5rem; font-weight: 700; letter-spacing: -.01em; color: var(--ma-night); line-height: 1.25;
}
:is(.ma-shell, .ma-lib) .dl-terms__title { font-size: clamp(1.5rem, 2.6vw, 1.875rem); }
:is(.ma-shell, .ma-lib) h2, :is(.ma-shell, .ma-lib) h3, :is(.ma-shell, .ma-lib) .h6 { font-family: "Poppins", "Inter", sans-serif; color: var(--ma-night); }
:is(.ma-shell, .ma-lib) p, :is(.ma-shell, .ma-lib) .text-sm { font-size: .875rem; line-height: 1.6; }
:is(.ma-shell, .ma-lib) .text-secondary, :is(.ma-shell, .ma-lib) .text-xs { color: var(--ma-muted) !important; }
:is(.ma-shell, .ma-lib) a { color: var(--ma-brand-600); }
:is(.ma-shell, .ma-lib) a.btn, :is(.ma-shell, .ma-lib) a.ma-bar__link, :is(.ma-shell, .ma-lib) a.ma-brand { text-decoration: none; }
:is(.ma-shell, .ma-lib) .ma-bar a.ma-bar__link { color: #cbd5e1; }
:is(.ma-shell, .ma-lib) .ma-bar a.ma-bar__link:hover { color: #fff; }
:is(.ma-shell, .ma-lib) .ma-bar a.ma-brand { color: #fff; }

/* Sections of the account pages: flat blocks split by a line, not cards. */
:is(.ma-shell, .ma-lib) .dl-auth-panel { margin: 0; padding: 0 0 1.5rem; border: 0; border-bottom: 1px solid #f1f5f9; border-radius: 0; background: transparent; box-shadow: none; }
:is(.ma-shell, .ma-lib) .dl-auth-panel:last-child { padding-bottom: 0; border-bottom: 0; }
:is(.ma-shell, .ma-lib) .dl-auth-panel .h6 { font-size: 1rem; font-weight: 700; }

/* Buttons = panel .btn */
:is(.ma-shell, .ma-lib) .btn.dl-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem; min-height: 42px; padding: .625rem 1rem;
  border-radius: .75rem; font-family: "Inter", sans-serif; font-size: .875rem; font-weight: 600; text-transform: none; letter-spacing: 0; box-shadow: none;
}
:is(.ma-shell, .ma-lib) .btn.dl-btn--primary {
  --dl-btn-bg: var(--ma-brand); --dl-btn-border: var(--ma-brand); --dl-btn-hover-bg: var(--ma-brand-600); --dl-btn-hover-border: var(--ma-brand-600);
  background-image: linear-gradient(to bottom, var(--ma-brand), var(--ma-brand-600)); box-shadow: 0 10px 15px -3px rgba(92, 191, 60, .25), 0 4px 6px -4px rgba(92, 191, 60, .25);
}
:is(.ma-shell, .ma-lib) .btn.dl-btn--secondary { --dl-btn-bg: #fff; --dl-btn-border: var(--ma-line); --dl-btn-color: #475569; --dl-btn-hover-bg: #f8fafc; --dl-btn-hover-border: var(--ma-line); --dl-btn-hover-color: var(--ma-night); }
:is(.ma-shell, .ma-lib) .btn.dl-btn--danger { --dl-btn-color: #dc2626; --dl-btn-border: #fecaca; --dl-btn-hover-bg: #dc2626; --dl-btn-hover-border: #dc2626; }
:is(.ma-shell, .ma-lib) .btn.dl-auth-link { color: var(--ma-brand-600); font-weight: 600; }
:is(.ma-shell, .ma-lib) .btn.dl-btn--primary.is-waiting { opacity: .55; }
:is(.ma-shell, .ma-lib) .dl-auth-form__actions .btn { width: 100%; }
:is(.ma-shell, .ma-lib) .dl-auth-panel .btn.dl-btn { width: auto; }
@media (max-width: 575px) { :is(.ma-shell, .ma-lib) .dl-auth-panel .btn.dl-btn { width: 100%; } }

/* Fields = panel .field (label above, no floating label) */
:is(.ma-shell, .ma-lib) .input-group.input-group-dynamic { display: flex; flex-direction: column; align-items: stretch; flex-wrap: nowrap; }
:is(.ma-shell, .ma-lib) .input-group.input-group-dynamic .form-label {
  position: static; transform: none; margin: 0 0 .375rem; padding: 0; font-size: .875rem !important; font-weight: 600; color: var(--ma-night) !important; pointer-events: auto;
}
:is(.ma-shell, .ma-lib) .input-group.input-group-dynamic::after, :is(.ma-shell, .ma-lib) .input-group.input-group-dynamic::before { display: none; }
:is(.ma-shell, .ma-lib) .form-control, :is(.ma-shell, .ma-lib) .input-group.input-group-dynamic .form-control, :is(.ma-shell, .ma-lib) .input-group.input-group-dynamic.is-focused .form-control {
  width: 100%; min-height: 42px; padding: .625rem .75rem !important; border: 1px solid var(--ma-line) !important; border-radius: .75rem; background: #fff !important; background-image: none !important;
  font-size: .875rem; color: var(--ma-night); box-shadow: 0 1px 2px rgba(15, 23, 42, .05);
}
:is(.ma-shell, .ma-lib) .form-control:focus { outline: none; border-color: var(--ma-brand); box-shadow: 0 0 0 3px rgba(92, 191, 60, .25); }
:is(.ma-shell, .ma-lib) .form-check-input:checked { background-color: var(--ma-brand); border-color: var(--ma-brand); }

/* Callouts and tables */
:is(.ma-shell, .ma-lib) .dl-callout { border-radius: .75rem; font-size: .875rem; }
:is(.ma-shell, .ma-lib) .table { font-size: .875rem; }
:is(.ma-shell, .ma-lib) .table th { font-size: .75rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--ma-muted); }

/* ---------- terms pieces ---------- */
:is(.ma-shell, .ma-lib) .dl-terms { gap: 1.75rem; }
:is(.ma-shell, .ma-lib) .dl-terms__heading { padding-bottom: 1.5rem; }
:is(.ma-shell, .ma-lib) .dl-terms__badge { background: var(--ma-brand-50); color: #3a8024; }
:is(.ma-shell, .ma-lib) .dl-terms__body { font-size: .9375rem; max-width: 46rem; }
:is(.ma-shell, .ma-lib) .dl-terms__body h2 { font-size: 1.25rem; }
:is(.ma-shell, .ma-lib) .dl-terms__body h3 { font-size: 1.0625rem; }
:is(.ma-shell, .ma-lib) .dl-terms__body a { color: var(--ma-brand-600); }
:is(.ma-shell, .ma-lib) .dl-terms-update { border-radius: 1rem; }
:is(.ma-shell, .ma-lib) .dl-terms-update__icon { border-radius: .75rem; }

/* The lib sets its ink tokens on .dl-terms too; keep the panel tokens. */
:is(.ma-shell, .ma-lib).dl-terms-page, :is(.ma-shell, .ma-lib) .dl-terms {
  --dl-terms-ink: var(--ma-night); --dl-terms-muted: var(--ma-muted); --dl-terms-line: var(--ma-line);
  --dl-terms-soft: #f8fafc; --dl-terms-tint: var(--ma-brand-50);
}

/* ---------- in-panel only: the few Bootstrap helpers the lib's markup uses ----------
 * The full Bootstrap/Material CSS is NOT loaded in the panel (its utilities clash with
 * Tailwind's), so the helpers used by the account/terms pages are defined here. */
.ma-lib .d-flex { display: flex; }
.ma-lib .d-none { display: none; }
.ma-lib .flex-column { flex-direction: column; }
.ma-lib .flex-wrap { flex-wrap: wrap; }
.ma-lib .align-items-center { align-items: center; }
.ma-lib .justify-content-between { justify-content: space-between; }
.ma-lib .w-100 { width: 100%; }
.ma-lib .text-center { text-align: center; }
.ma-lib .mb-0 { margin-bottom: 0; }
.ma-lib .mb-1 { margin-bottom: .25rem; }
.ma-lib .mb-2 { margin-bottom: .5rem; }
.ma-lib .mb-3 { margin-bottom: 1rem; }
.ma-lib .mt-3 { margin-top: 1rem; }
.ma-lib .mt-n3 { margin-top: -1rem; }
.ma-lib .font-weight-bold { font-weight: 700; }
.ma-lib .font-weight-normal { font-weight: 400; }
.ma-lib .h5 { font-family: "Poppins", "Inter", sans-serif; font-size: 1.125rem; font-weight: 700; color: var(--ma-night); }
.ma-lib .h6 { font-size: 1rem; font-weight: 700; }
.ma-lib .text-danger { color: #dc2626 !important; }
.ma-lib .text-success { color: #3a8024 !important; }
.ma-lib .list-unstyled { list-style: none; padding: 0; margin: 0; }
.ma-lib p, .ma-lib h1, .ma-lib h2, .ma-lib h3, .ma-lib h4, .ma-lib h5, .ma-lib h6 { margin: 0; }
.ma-lib .dl-terms__body p, .ma-lib .dl-terms__body ul, .ma-lib .dl-terms__body ol { margin: 0 0 1rem; }
.ma-lib .dl-terms__body ul, .ma-lib .dl-terms__body ol { padding-left: 1.5rem; }
.ma-lib .dl-terms__body ul { list-style: disc; }
.ma-lib .dl-terms__body ol { list-style: decimal; }
.ma-lib .badge { display: inline-flex; align-items: center; padding: .25rem .625rem; border-radius: 9999px; font-size: .75rem; font-weight: 600; }
.ma-lib .badge.bg-primary, .ma-lib .badge.bg-success { background: var(--ma-brand-50); color: #3a8024; }
.ma-lib .form-check { display: flex; align-items: flex-start; gap: .5rem; }
.ma-lib .form-check-input { flex-shrink: 0; width: 1.125rem; height: 1.125rem; margin-top: .125rem; accent-color: var(--ma-brand); }
.ma-lib .form-check-label { font-size: .875rem; }
.ma-lib .table { width: 100%; border-collapse: collapse; }
.ma-lib .table th, .ma-lib .table td { padding: .5rem .5rem .5rem 0; text-align: left; border-bottom: 1px solid #f1f5f9; vertical-align: middle; }
.ma-lib .btn { cursor: pointer; text-decoration: none; }
.ma-lib .dl-auth-panel .dl-actions, .ma-lib .dl-auth-panel .d-flex { gap: .5rem; }
.ma-lib .badge.bg-primary, .ma-lib .badge.bg-success { background: var(--ma-brand-50) !important; color: #3a8024 !important; }
@media (min-width: 576px) { .ma-lib .d-flex.flex-column:not(.dl-auth-manage) { align-items: flex-start; } }
