/* Mezura EPC Portal — auth + /me styles. Uses tokens from brand.css. */

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--mezura-charcoal);
  background: var(--mezura-navy);
}

a { color: var(--mezura-navy); }
a:hover { color: var(--mezura-green); }

.hidden { display: none !important; }

/* ───────── Auth (login + register + invalid invite) ───────── */

.auth-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
  background:
    radial-gradient(ellipse at top, rgba(38, 203, 32, 0.08), transparent 60%),
    var(--mezura-navy);
}

.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--mezura-white);
  border-radius: 12px;
  padding: 2.5rem 2rem 2rem;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
  text-align: center;
}

.auth-logo {
  height: 36px;
  width: auto;
  margin: 0 auto 0.25rem;
  display: block;
}

.auth-tagline {
  margin: 0 0 1.75rem;
  color: var(--mezura-charcoal);
  font-size: 0.85rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  opacity: 0.7;
}

.auth-title {
  margin: 0 0 1.5rem;
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--mezura-navy);
}

.auth-subtitle {
  margin: -1rem 0 1.5rem;
  font-size: 0.95rem;
  color: var(--mezura-charcoal);
}

.auth-field {
  display: block;
  text-align: left;
  margin-bottom: 1rem;
}

.auth-field span {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--mezura-navy);
}

.auth-field input {
  width: 100%;
  padding: 0.7rem 0.85rem;
  font-size: 1rem;
  border: 1px solid #d8dbe3;
  border-radius: 6px;
  background: var(--mezura-white);
  color: var(--mezura-charcoal);
  transition: border-color 120ms ease, box-shadow 120ms ease;
}

.auth-field input:focus {
  outline: none;
  border-color: var(--mezura-navy);
  box-shadow: 0 0 0 3px rgba(42, 52, 80, 0.15);
}

.auth-field input[readonly] {
  background: #f4f5f8;
  color: #6b7080;
}

.auth-field-password {
  position: relative;
  display: block;
}

.auth-field-password input {
  /* leave room for the toggle button */
  padding-right: 2.5rem;
}

.password-toggle {
  position: absolute;
  top: 50%;
  right: 0.5rem;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 4px;
  color: #8a90a2;
  cursor: pointer;
  transition: color 120ms ease, background-color 120ms ease;
}

.password-toggle:hover {
  color: var(--mezura-navy);
  background: rgba(42, 52, 80, 0.06);
}

.password-toggle:focus-visible {
  outline: 2px solid rgba(42, 52, 80, 0.4);
  outline-offset: 1px;
}

.btn-primary {
  display: block;
  width: 100%;
  padding: 0.8rem 1rem;
  margin-top: 0.5rem;
  font-size: 1rem;
  font-weight: 600;
  color: var(--mezura-white);
  background: var(--mezura-green);
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background-color 120ms ease, transform 60ms ease;
}

.btn-primary:hover { background: #1fb01a; }
.btn-primary:active { transform: translateY(1px); }
.btn-primary:focus { outline: 3px solid rgba(38, 203, 32, 0.35); outline-offset: 2px; }

.auth-error {
  margin: 0.75rem 0 0;
  padding: 0.6rem 0.75rem;
  font-size: 0.9rem;
  color: #8a1f1f;
  background: #fbe8e8;
  border-radius: 6px;
  text-align: left;
}

.auth-foot {
  margin: 1.25rem 0 0;
  font-size: 0.85rem;
  color: var(--mezura-charcoal);
}
.auth-foot a { text-decoration: none; }
.auth-foot-muted { opacity: 0.65; }

/* ───────── /me ───────── */

.me-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--mezura-navy);
  color: var(--mezura-white);
}

.me-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.25rem 2rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.me-logo {
  height: 28px;
  width: auto;
}

.me-card {
  margin: 4rem auto;
  width: 100%;
  max-width: 520px;
  padding: 2.5rem 2rem;
  background: var(--mezura-white);
  color: var(--mezura-charcoal);
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
  text-align: center;
}

.me-title {
  margin: 0 0 0.25rem;
  font-size: 1.6rem;
  font-weight: 600;
  color: var(--mezura-navy);
}

.me-email {
  margin: 0 0 1.5rem;
  color: var(--mezura-charcoal);
  opacity: 0.8;
}

.me-roles { margin: 0 0 1.5rem; }

.role-badge {
  display: inline-block;
  padding: 0.25rem 0.7rem;
  margin: 0.15rem;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--mezura-white);
  background: var(--mezura-green);
  border-radius: 999px;
}

.me-meta {
  margin: 0;
  font-size: 0.85rem;
  color: var(--mezura-charcoal);
  opacity: 0.6;
}

.btn-ghost {
  padding: 0.55rem 1rem;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--mezura-white);
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 6px;
  cursor: pointer;
  transition: background-color 120ms ease, border-color 120ms ease;
}

.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--mezura-green);
}

.me-nav {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
}

.me-nav a.btn-ghost {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  color: var(--mezura-white);
}

/* ───────── Registration page (full-form) ───────── */

.reg-header {
  background: var(--mezura-navy);
  padding: 18px 32px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  text-align: center;
}
.reg-brand {
  display: inline-block;
  text-decoration: none;
}
.reg-brand-logo { height: 32px; width: auto; display: block; margin: 0 auto; }

.reg-shell {
  max-width: 920px;
  margin: 0 auto;
  padding: 28px 20px 60px;
  background: transparent;
}

.reg-card {
  background: #ffffff;
  border-radius: 12px;
  padding: 24px 28px;
  margin-bottom: 18px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.18);
  text-align: left;
  color: var(--mezura-charcoal);
}

.reg-welcome { padding: 28px 32px; }
.reg-welcome-title { margin: 0 0 10px; font-size: 1.35rem; font-weight: 700; color: var(--mezura-navy); line-height: 1.3; }
.reg-welcome-sub   { margin: 0; font-size: 0.95rem; color: var(--mezura-charcoal); opacity: 0.85; line-height: 1.55; }

.reg-invite-ack {
  background: var(--mezura-green);
  border: 1px solid var(--mezura-green);
  color: #ffffff;
  font-size: 0.95rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
}
.reg-invite-ack strong { color: #ffffff; }
/* MEPC-069 — Red border on required fields that fail client-side validation
   when the user submits the registration form. Cleared on input/focus. */
.reg-field input.field-error,
.reg-field select.field-error,
.reg-field textarea.field-error {
  border: 2px solid #ef4444 !important;
}
.reg-invite-dot {
  width: 8px; height: 8px; border-radius: 999px; background: #ffffff;
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.35);
}

.reg-section-title {
  margin: 0 0 6px;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--mezura-navy);
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.reg-section-sub {
  margin: 0 0 18px;
  font-size: 0.88rem;
  color: var(--mezura-charcoal);
  opacity: 0.75;
  line-height: 1.5;
}
.reg-subsection-title {
  margin: 22px 0 12px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  color: var(--mezura-navy);
  opacity: 0.85;
  text-transform: uppercase;
  border-top: 1px solid #e3e6ee;
  padding-top: 18px;
}

.reg-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 18px;
}
.reg-field { display: flex; flex-direction: column; }
.reg-field-full { grid-column: 1 / -1; }

.reg-label {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--mezura-navy);
  margin-bottom: 6px;
}

.reg-field input,
.reg-field select {
  width: 100%;
  padding: 0.6rem 0.75rem;
  font-size: 0.95rem;
  color: var(--mezura-charcoal);
  background: #ffffff;
  border: 1px solid #d8dbe3;
  border-radius: 6px;
  transition: border-color 120ms ease, box-shadow 120ms ease;
}
.reg-field input:focus,
.reg-field select:focus {
  outline: none;
  border-color: var(--mezura-green);
  box-shadow: 0 0 0 3px rgba(38, 203, 32, 0.18);
}
.reg-field input[readonly] { background: #f4f5f7; cursor: not-allowed; }

.reg-help {
  margin-top: 4px;
  font-size: 0.75rem;
  color: var(--mezura-charcoal);
  opacity: 0.6;
}

.reg-field .auth-field-password { width: 100%; }

.reg-submit {
  display: block;
  width: 100%;
  padding: 14px 20px;
  font-size: 0.92rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: #06200a;
  background: var(--mezura-green);
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  margin-top: 4px;
}
.reg-submit:hover { background: #1fb01b; }

.reg-footer {
  margin-top: 28px;
  font-size: 0.78rem;
  color: rgba(255, 255, 255, 0.6);
  letter-spacing: 0.04em;
  text-align: center;
}

@media (max-width: 700px) {
  .reg-grid { grid-template-columns: 1fr; }
}

/* ── Success modal ── */
.reg-modal {
  position: fixed; inset: 0; z-index: 200;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0, 0, 0, 0.6);
  padding: 1rem;
}
.reg-modal-card {
  width: 100%; max-width: 460px;
  background: #ffffff; border-radius: 14px;
  padding: 32px 32px 28px;
  text-align: center;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.4);
}
.reg-modal-title { margin: 0 0 6px; font-size: 1.5rem; font-weight: 700; color: var(--mezura-navy); }
.reg-modal-sub   { margin: 0 0 18px; font-size: 1.05rem; color: var(--mezura-charcoal); }
.reg-modal-body  { margin: 0 0 12px; font-size: 0.92rem; color: var(--mezura-charcoal); line-height: 1.55; }
.reg-modal-muted { color: rgba(0, 0, 0, 0.55); font-size: 0.85rem; }
.reg-modal-done {
  margin-top: 16px;
  width: 100%;
  background: var(--mezura-green);
  color: #06200a;
  border: 0;
  padding: 12px 20px;
  font-weight: 700;
  letter-spacing: 0.1em;
  border-radius: 8px;
  cursor: pointer;
}
.reg-modal-done:hover { background: #1fb01b; }
