:root {
  --bg: #f4f7fb;
  --card: rgba(255,255,255,0.92);
  --card-soft: rgba(255,255,255,0.84);
  --card-border: rgba(255,255,255,0.74);
  --text: #0f172a;
  --muted: #475569;
  --line: rgba(148,163,184,0.22);
  --accent: #38bdf8;
  --accent-dark: #0ea5e9;
  --shadow: 0 30px 80px rgba(15, 23, 42, 0.18);
  --radius-xl: 30px;
  --radius-lg: 22px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background: #e9eff5;
}

body.root-page {
  min-height: 100svh;
  overflow: hidden;
  background-image: url("assets/background-login.webp");
  background-position: center bottom;
  background-repeat: no-repeat;
  background-size: cover;
}

body.portal-page {
  min-height: 100vh;
  background:
    radial-gradient(circle at top right, rgba(56,189,248,0.12), transparent 28%),
    radial-gradient(circle at left, rgba(14,165,233,0.09), transparent 26%),
    linear-gradient(to bottom, #ffffff 0%, #f8fafc 100%);
}

body.legal-page {
  min-height: 100vh;
  background:
    linear-gradient(to bottom, #ffffff 0%, #f8fafc 100%);
}

.page-shell {
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  padding: 12px 24px 18px;
}

.root-main {
  flex: 1;
  display: grid;
  place-items: center;
  position: relative;
}

.login-stage {
  position: relative;
  width: min(100%, 1080px);
  min-height: min(86svh, 760px);
  display: grid;
  place-items: center;
}

.hero-logo {
  position: absolute;
  z-index: 4;
  pointer-events: none;
  filter: drop-shadow(0 18px 36px rgba(15,23,42,0.16));
}

.hero-logo--slanted {
  top: -38px;
  left: max(-120px, calc(50% - 660px));
  width: min(86vw, 1020px);
  transform: rotate(-26deg);
  transform-origin: center center;
}

.header-logo {
  position: relative;
  display: block;
  width: min(480px, 58vw);
  min-height: 70px;
}

.brand-stack {
  position: relative;
  display: block;
  width: 100%;
}

.brand-stack--wide { display: block; }
.brand-stack--small { display: none; }

.brand-layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: auto;
  opacity: 0;
  transition: opacity 520ms ease;
}

.brand-stack > .brand-layer:first-child { position: relative; }
.brand-layer.is-active { opacity: 1; }

.login-card,
.portal-card,
.admin-panel {
  background: var(--card);
  border: 1px solid rgba(226,232,240,0.92);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.login-card {
  width: min(100%, 440px);
  padding: 42px 36px 34px;
  border-radius: var(--radius-xl);
  position: relative;
  z-index: 2;
}

.kicker,
.section-kicker,
.legal-kicker {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.login-title,
.legal-title,
.portal-hero h1 {
  margin: 0;
  font-size: clamp(2rem, 3.2vw, 2.9rem);
  line-height: 1.05;
  letter-spacing: -0.04em;
}

.login-copy,
.section-copy,
.legal-lead {
  margin: 18px 0 0;
  color: var(--muted);
  line-height: 1.75;
  font-size: 1rem;
}

.login-form,
.admin-form {
  margin-top: 28px;
  display: grid;
  gap: 14px;
}

.form-group {
  display: grid;
  gap: 8px;
}

.form-group label {
  font-size: 0.95rem;
  color: #334155;
  font-weight: 600;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  border: 1px solid rgba(148,163,184,0.35);
  background: rgba(255,255,255,0.92);
  border-radius: 18px;
  padding: 14px 16px;
  font-size: 1rem;
  color: var(--text);
  outline: none;
  transition: border-color 180ms ease, box-shadow 180ms ease, background 180ms ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: rgba(56,189,248,0.72);
  box-shadow: 0 0 0 4px rgba(56,189,248,0.14);
  background: rgba(255,255,255,0.98);
}

.login-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 6px;
}

.login-row--single {
  justify-content: center;
}

.login-button,
.mini-button {
  border: 0;
  border-radius: 18px;
  padding: 14px 22px;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dark) 100%);
  color: white;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 16px 40px rgba(14,165,233,0.28);
  transition: transform 180ms ease, box-shadow 180ms ease, filter 180ms ease;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.login-button:hover,
.mini-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 18px 44px rgba(14,165,233,0.32);
}

.mini-button {
  padding: 11px 16px;
  border-radius: 14px;
  font-size: 0.95rem;
  width: fit-content;
}

.mini-button--secondary {
  background: linear-gradient(135deg, #64748b 0%, #475569 100%);
  box-shadow: 0 16px 40px rgba(71,85,105,0.22);
}

.form-alert {
  margin-top: 18px;
  padding: 14px 16px;
  border-radius: 16px;
  background: rgba(254,226,226,0.92);
  border: 1px solid rgba(248,113,113,0.24);
  color: #991b1b;
  line-height: 1.6;
}

.form-alert--success {
  background: rgba(220,252,231,0.92);
  border-color: rgba(34,197,94,0.22);
  color: #166534;
  margin-bottom: 18px;
}

.form-alert--legal {
  margin-bottom: 18px;
}

.site-header {
  display: grid;
  grid-template-columns: 72px 1fr auto;
  align-items: center;
  gap: 18px;
  padding: 22px 24px 0;
}

.edit-pen {
  width: 48px;
  height: 48px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  color: white;
  background: linear-gradient(135deg, #38bdf8 0%, #0ea5e9 100%);
  text-decoration: none;
  box-shadow: 0 16px 36px rgba(14,165,233,0.22);
  font-size: 1.25rem;
  justify-self: start;
}

.edit-pen--back {
  font-size: 1.15rem;
}

.logout-link {
  text-decoration: none;
  color: #0f172a;
  font-weight: 700;
  padding: 12px 16px;
  border-radius: 999px;
  background: rgba(255,255,255,0.9);
  border: 1px solid rgba(226,232,240,0.92);
}

.portal-shell,
.admin-shell,
.legal-shell {
  width: min(1120px, calc(100% - 48px));
  margin: 0 auto;
  padding: 30px 0 64px;
}

.portal-hero {
  max-width: 760px;
  margin: 0 auto 28px;
  text-align: center;
}

.portal-hero--compact {
  margin-bottom: 20px;
}

.portal-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 22px;
}

.portal-card,
.admin-panel {
  border-radius: 28px;
  padding: 28px;
}

.portal-card h2,
.admin-panel h2,
.user-card h3 {
  margin: 0 0 14px;
  font-size: 1.35rem;
  letter-spacing: -0.03em;
}

.portal-card p,
.admin-panel p,
.user-card p {
  margin: 0 0 12px;
  line-height: 1.75;
  color: var(--muted);
}

.portal-card--admin {
  background: linear-gradient(180deg, rgba(255,255,255,0.96), rgba(239,246,255,0.96));
}

.inline-action {
  color: #0ea5e9;
  text-decoration: none;
  font-weight: 700;
}

.admin-grid {
  display: grid;
  grid-template-columns: minmax(320px, 380px) 1fr;
  gap: 22px;
  align-items: start;
}

.admin-panel--wide {
  min-width: 0;
}

.user-cards {
  display: grid;
  gap: 16px;
}

.user-card {
  padding: 22px;
  border-radius: 22px;
  background: rgba(248,250,252,0.92);
  border: 1px solid rgba(226,232,240,0.95);
}

.user-card__head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.user-role {
  border-radius: 999px;
  padding: 6px 10px;
  background: rgba(14,165,233,0.12);
  color: #0369a1;
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.user-meta {
  font-size: 0.94rem;
}

.admin-form--inline,
.admin-form--password {
  margin-top: 14px;
  background: rgba(255,255,255,0.82);
  padding: 16px;
  border-radius: 18px;
  border: 1px solid rgba(226,232,240,0.92);
}

.check-row {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-weight: 600;
  margin-bottom: 4px;
}

.footer-links {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 22px;
  padding: 14px 0 6px;
  flex-wrap: wrap;
}

.footer-links a {
  color: rgba(15,23,42,0.82);
  text-decoration: none;
  font-weight: 700;
}

.footer-links a:hover { color: #020617; }

.footer-links--root {
  padding-top: 0;
}

.legal-shell {
  max-width: 1040px;
  padding-top: 44px;
}

.legal-shell--narrow {
  max-width: 680px;
}

.legal-header {
  margin-bottom: 34px;
}

.legal-header a {
  color: var(--muted);
  text-decoration: none;
  font-weight: 700;
}

.legal-title {
  font-size: clamp(2rem, 4vw, 3.3rem);
}

.legal-lead {
  max-width: 760px;
}

.legal-section {
  margin-top: 32px;
  padding: 28px;
  background: rgba(255,255,255,0.86);
  border: 1px solid rgba(226,232,240,0.92);
  border-radius: 28px;
  box-shadow: 0 20px 50px rgba(15,23,42,0.08);
}

.legal-section h2 {
  margin-top: 0;
  margin-bottom: 12px;
  font-size: 1.35rem;
}

.legal-section p,
.legal-section li {
  line-height: 1.8;
  color: var(--muted);
}

.data-image {
  display: block;
  max-width: min(100%, 760px);
  border-radius: 18px;
  background: white;
  border: 1px solid rgba(226,232,240,0.92);
  padding: 12px;
}

@media (max-width: 900px) {
  body.root-page { overflow: auto; }
  .hero-logo--slanted {
    top: -10px;
    left: -12px;
    width: min(92vw, 680px);
    transform: rotate(-18deg);
  }
  .portal-grid,
  .admin-grid {
    grid-template-columns: 1fr;
  }
  .site-header {
    grid-template-columns: 56px 1fr;
  }
  .logout-link {
    grid-column: 1 / -1;
    justify-self: center;
  }
}

@media (max-width: 720px) {
  .page-shell { padding: 18px 14px 14px; }
  .login-card {
    padding: 28px 20px 22px;
    border-radius: 24px;
  }
  .brand-stack--wide { display: none; }
  .brand-stack--small { display: block; }
  .header-logo { width: min(260px, 62vw); min-height: 56px; }
  .hero-logo--slanted {
    left: -8px;
    top: 6px;
    width: min(92vw, 360px);
    transform: rotate(-14deg);
  }
}
