:root {
  --font-sans: "Plus Jakarta Sans", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --bg-canvas: #f7f4ee;
  --bg-card: #ffffff;
  --bg-subtle: #faf8f5;
  --bg-input: #fdfbf8;
  --border-card: rgba(228, 219, 208, 0.85);
  --border-input: #e5ded5;
  --border-input-hover: #d5cbc0;
  --border-subtle: #efe8df;
  --ink-primary: #1c1613;
  --ink-secondary: #5e5349;
  --ink-muted: #8c8074;
  --ink-placeholder: #a89d92;
  --brand-primary: #b85d2a;
  --brand-hover: #9e4c1e;
  --brand-gradient-start: #c3622c;
  --brand-gradient-end: #a44f21;
  --brand-light: #fbf0e8;
  --brand-glow: rgba(184, 93, 42, 0.16);
  --brand-shadow: rgba(184, 93, 42, 0.35);
  --color-error: #9c2718;
  --bg-error: #fff5f3;
  --border-error: #f8d5ce;
  font-family: var(--font-sans);
  color: var(--ink-primary);
  background-color: var(--bg-canvas);
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  color-scheme: light;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  min-width: 320px;
  min-height: 100svh;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--bg-canvas);
  background-image:
    radial-gradient(ellipse 720px 500px at 50% 32%, rgba(217, 119, 54, 0.14) 0%, rgba(217, 119, 54, 0.03) 48%, transparent 70%),
    radial-gradient(circle 500px at 10% 15%, rgba(235, 185, 140, 0.18) 0%, transparent 45%),
    radial-gradient(circle 600px at 90% 85%, rgba(184, 93, 42, 0.08) 0%, transparent 45%);
  background-attachment: fixed;
  padding: 24px 16px;
  position: relative;
}

/* Glowing top ambient line */
body::before {
  content: "";
  position: fixed;
  inset: 0 0 auto 0;
  height: 4px;
  background: linear-gradient(90deg, #9e4c1e, #b85d2a 30%, #e2aa7c 50%, #b85d2a 70%, #9e4c1e);
  box-shadow: 0 2px 12px var(--brand-shadow);
  z-index: 100;
}

.login-shell {
  width: min(100%, 430px);
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Brand header with official Santo Horno logo */
.brand-header {
  margin-bottom: 20px;
  display: flex;
  justify-content: center;
  width: 100%;
}

.brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-decoration: none;
  color: inherit;
  transition: transform 0.2s ease;
}

.brand:hover {
  transform: translateY(-2px);
}

.brand-logo-wrap {
  width: 250px;
  height: 110px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.brand-logo {
  width: 280px;
  height: 280px;
  max-width: none;
  object-fit: contain;
  filter: drop-shadow(0 4px 12px rgba(184, 93, 42, 0.16));
  transition: transform 0.25s ease, filter 0.25s ease;
  user-select: none;
}

.brand:hover .brand-logo {
  transform: scale(1.04);
  filter: drop-shadow(0 8px 22px rgba(184, 93, 42, 0.28));
}

.brand-badge {
  display: inline-flex;
  align-items: center;
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 2.2px;
  color: var(--brand-primary);
  background: #fbf0e8;
  border: 1px solid rgba(184, 93, 42, 0.24);
  padding: 4px 14px;
  border-radius: 999px;
  box-shadow: 0 2px 8px rgba(184, 93, 42, 0.08);
  margin-top: 4px;
}

/* Card container */
.login-card {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: 24px;
  box-shadow:
    0 24px 60px -12px rgba(45, 27, 18, 0.12),
    0 8px 24px -4px rgba(45, 27, 18, 0.05),
    0 0 0 1px rgba(255, 255, 255, 0.8) inset;
  overflow: hidden;
  transition: box-shadow 0.3s ease;
}

.card-heading {
  padding: 34px 36px 0;
}

h1 {
  font-size: 32px;
  line-height: 1.15;
  letter-spacing: -1.2px;
  margin: 0;
  font-weight: 800;
  color: var(--ink-primary);
}

/* Form structure */
form {
  padding: 24px 36px 32px;
}

.form-group {
  margin-bottom: 20px;
}

label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: #332a23;
  margin-bottom: 8px;
  letter-spacing: -0.2px;
}

.field-control {
  position: relative;
  display: flex;
  align-items: center;
}

.field-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 19px;
  height: 19px;
  color: var(--ink-muted);
  pointer-events: none;
  transition: color 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.field-control:focus-within .field-icon {
  color: var(--brand-primary);
}

input {
  display: block;
  width: 100%;
  height: 50px;
  border: 1.5px solid var(--border-input);
  border-radius: 12px;
  padding: 0 14px 0 44px;
  font: inherit;
  font-size: 14.5px;
  font-weight: 500;
  color: var(--ink-primary);
  background: var(--bg-input);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

input::placeholder {
  color: var(--ink-placeholder);
  font-weight: 400;
}

input:hover {
  border-color: var(--border-input-hover);
  background: #ffffff;
}

input:focus {
  outline: none;
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 4px var(--brand-glow);
  background: #ffffff;
}

.password-field input {
  padding-right: 48px;
}

.password-toggle {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 38px;
  height: 38px;
  border: 0;
  background: transparent;
  color: var(--ink-muted);
  border-radius: 8px;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: color 0.15s ease, background-color 0.15s ease;
}

.password-toggle:hover {
  color: var(--brand-primary);
  background: var(--brand-light);
}

.session-hint {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink-muted);
  font-size: 12px;
  font-weight: 500;
  margin: 14px 0 22px;
  line-height: 1.4;
}

.session-hint svg {
  flex-shrink: 0;
  width: 15px;
  height: 15px;
  color: #9c8f83;
}

/* Submit button with glow and hover micro-interaction */
.submit-button {
  width: 100%;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: none;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--brand-gradient-start) 0%, var(--brand-primary) 55%, var(--brand-gradient-end) 100%);
  color: #ffffff;
  font: inherit;
  font-size: 14.5px;
  font-weight: 700;
  cursor: pointer;
  box-shadow:
    0 4px 14px var(--brand-shadow),
    0 1px 2px rgba(0, 0, 0, 0.08);
  transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
  letter-spacing: -0.2px;
}

.submit-button svg {
  transition: transform 0.2s ease;
}

.submit-button:hover {
  filter: brightness(1.04);
  transform: translateY(-1px);
  box-shadow: 0 8px 22px var(--brand-shadow);
}

.submit-button:hover svg {
  transform: translateX(3px);
}

.submit-button:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px var(--brand-shadow);
}

.submit-button:disabled {
  opacity: 0.65;
  cursor: wait;
  transform: none;
  box-shadow: none;
}

/* Accessible focus rings */
button:focus-visible,
a:focus-visible {
  outline: 3px solid var(--brand-primary);
  outline-offset: 3px;
}

/* Error banner */
.error-message {
  font-size: 13px;
  line-height: 1.5;
  color: var(--color-error);
  background: var(--bg-error);
  border: 1px solid var(--border-error);
  border-radius: 10px;
  padding: 11px 14px;
  margin: 0 0 18px;
  font-weight: 500;
}

.error-message[hidden] {
  display: none;
}

/* Card footer with administrative help note */
.card-footer {
  padding: 16px 24px;
  text-align: center;
  background: var(--bg-subtle);
  border-top: 1px solid var(--border-subtle);
  color: var(--ink-secondary);
  font-size: 12px;
  font-weight: 500;
}

/* Mobile responsive styles */
@media (max-width: 480px) {
  body {
    padding: 16px 12px;
  }
  .login-shell {
    width: 100%;
  }
  .brand-logo-wrap {
    width: 210px;
    height: 95px;
  }
  .brand-logo {
    width: 240px;
    height: 240px;
  }
  .card-heading {
    padding: 26px 24px 0;
  }
  form {
    padding: 20px 24px 26px;
  }
  h1 {
    font-size: 28px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition: none !important;
    animation: none !important;
  }
}
