:root {
  color-scheme: light;
  font-family: Inter, system-ui, sans-serif;
  background: #eef2ff;
  color: #0f172a;
  --bg-surface: #eef2ff;
  --bg-panel: #ffffff;
  --bg-muted: #f8fafc;
  --border: #dbe2ef;
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;
  --primary: #083300; /* requested dark green */
  --primary-strong: #0a4800;
  --accent: #f59e0b;
  --success: #16a34a;
  --danger: #dc2626;
  --radius: 1.5rem;
  --radius-sm: 0.9rem;
  --shadow: 0 24px 80px rgba(15, 23, 42, 0.08);
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg-surface);
}

body {
  color: var(--text-primary);
}

button,
input,
select {
  font: inherit;
}

.page-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  padding: 2rem 1.5rem;
  background: linear-gradient(140deg, #4338ca 0%, #2563eb 100%);
  color: white;
}

.brand {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.brand-mark {
  width: 3rem;
  height: 3rem;
  border-radius: 1rem;
  background: rgba(255,255,255,0.18);
  display: grid;
  place-items: center;
  font-weight: 900;
  letter-spacing: 0.04em;
}

.brand-title {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 700;
}

.brand-subtitle {
  margin: 0.35rem 0 0;
  color: rgba(255,255,255,0.8);
  max-width: 34rem;
}

.user-action {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.user-action.hidden {
  display: none;
}

.page-main {
  flex: 1;
  width: min(1400px, calc(100% - 3rem));
  margin: 0 auto;
  padding: 1rem 0; /* reduced vertical padding to avoid initial scroll */
}

.auth-shell,
.app-content {
  width: 100%;
}

.auth-card {
  width: 100%;
  max-width: none;
  margin: 0;
  background: #ffffff;
  border-radius: 2rem;
  box-shadow: 0 40px 120px rgba(15, 23, 42, 0.08);
  padding: 2rem; /* slightly reduced padding */
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

/* Auth grid: left visual, right card */
.auth-grid {
  display: grid;
  grid-template-columns: 1fr 1fr; /* equal-width columns */
  gap: 2rem;
  align-items: stretch;
  min-height: calc(100vh - 2rem); /* keep grid within viewport to avoid initial scroll */
}

.visual-column {
  border-radius: var(--radius);
  min-height: auto; /* allow visual to scale to available grid height */
  height: 100%;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  box-shadow: var(--shadow);
  overflow: hidden;
}
/* Visual column uses embedded image asset */
.visual-column img.visual-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  border-radius: var(--radius);
  display: block;
}

.maido-logo-img { height: 60px; width: auto; display: block; margin: 0 auto; }
.maido-word-fallback { display: none; align-items: center; gap: 0.5rem; }
.maido-word { font-weight: 800; font-size: 1.45rem; }
.maido-slice { color: var(--accent); margin-left: 4px }

/* Fields */
.field.input-with-icon { display: grid; gap: 0.5rem; }
.icon-and-input { display: flex; align-items: center; gap: 0.75rem; }
.icon { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 8px; background: rgba(15,23,42,0.03); }
.icon svg { display:block }
.field.input-with-icon input { border: none; width: 100%; padding: 0; background: transparent; }
.icon-and-input { display: flex; align-items: center; gap: 0.75rem; padding: 0.95rem 0.9rem; border: 1.5px solid var(--border); border-radius: 0.25rem; background: #ffffff; transition: border-color 0.2s ease, box-shadow 0.2s ease; }
.icon-and-input:focus-within { border-color: var(--border); box-shadow: none; }
/* Remove default focus outline inside inputs to avoid inner green ring */
.icon-and-input input:focus { outline: none; }
.field .required { color: var(--danger); margin-left: 4px; font-weight:600 }
.input-error { border-color: rgba(220,38,38,0.8) !important; }

/* Neutralize the browser's autofill background so saved values keep
   the same white field instead of Chrome's blue-tinted highlight. */
.icon-and-input input:-webkit-autofill,
.icon-and-input input:-webkit-autofill:hover,
.icon-and-input input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--text-primary);
  -webkit-box-shadow: 0 0 0 1000px #ffffff inset;
  box-shadow: 0 0 0 1000px #ffffff inset;
  transition: background-color 9999s ease-in-out 0s;
}

/* Primary button states */
button.primary {
  border-radius: 0.5rem;
  padding: 1rem 1.2rem;
  background: #083300;
  color: white;
  border: none;
  font-size: 1rem;
  font-weight: 700;
}
button.primary:hover:not([disabled]) {
  background: #062500;
}
button.primary[disabled] {
  background: #083300;
  color: white;
  cursor: not-allowed;
  box-shadow: none;
}

.action-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}
.remember {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-secondary);
  font-size: 0.95rem;
  white-space: nowrap;
}
.remember input {
  width: 16px;
  height: 16px;
}
button.link.small {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.95rem;
  text-decoration: underline;
  padding: 0;
  white-space: nowrap;
}

.divider {
  text-align: center;
  color: var(--text-muted);
  margin: 1.75rem 0 1rem;
  font-size: 0.95rem;
}
.social-row {
  display: flex;
  gap: 0.9rem;
}
.social {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 0.95rem 1.1rem;
  border-radius: 0.5rem;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  color: var(--text-primary);
  font-weight: 600;
  width: 100%;
}

.social-icon {
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border-radius: 0.7rem;
  background: white;
  color: #334155;
  font-size: 0.95rem;
}

.sign-up-copy,
.auth-footer {
  margin: 1rem 0 0;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.sign-up-copy a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
}

.auth-footer {
  margin-top: 0.75rem;
  font-size: 0.85rem;
  color: #94a3b8;
}
/* If the project still uses the docs/figma path, the server route will also serve those images. */
/* .visual-column { background-image: url("/assets/figma-login/1.%20Sign%20in%20-%20Empty.png"); } */

.maido-logo {
  display: block;
  margin: 0 auto;
}

.maido-word {
  font-weight: 800;
  font-size: 1.45rem;
  letter-spacing: 0.06em;
}

.maido-slice {
  display: inline-block;
  transform: translateY(2px);
}

.auth-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 2rem;
}

.auth-logo {
  width: 3rem;
  height: 3rem;
  background: var(--primary);
  color: white;
  border-radius: 1rem;
  display: grid;
  place-items: center;
  font-size: 1.1rem;
  font-weight: 800;
}

.eyebrow {
  margin: 0 0 0.35rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-size: 0.75rem;
  color: var(--accent);
}

h1 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: #111827;
}

.auth-copy {
  margin: 0 0 1.5rem;
  color: var(--text-secondary);
  line-height: 1.7;
}

.auth-message {
  border-radius: 0.5rem;
  padding: 1rem 1.25rem;
  margin-bottom: 1rem;
  font-weight: 600;
}

.auth-message.hidden {
  display: none;
}

.auth-message.error {
  background: rgba(220,38,38,0.08);
  color: var(--danger);
  border: 1px solid rgba(220,38,38,0.2);
}

.auth-message.success {
  background: rgba(22,163,74,0.12);
  color: var(--success);
  border: 1px solid rgba(22,163,74,0.2);
}

.auth-view {
  display: grid;
  gap: 1rem;
}

/* Constrain the form content so action-row aligns with input width */
.auth-view {
  width: 100%;
  max-width: 520px; /* keeps inputs & action-row the same width */
  margin-left: auto;
  margin-right: auto;
}

/* Ensure the action row lines up exactly with the inputs */
.action-row {
  width: 100%;
  max-width: 520px;
  margin: 0 auto 1rem;
  padding: 0;
}

.action-row .remember {
  flex: 0 0 auto;
}

.action-row #forgotPassword {
  margin-left: auto; /* push to right edge of the action-row */
  text-align: right;
}

.auth-view.hidden {
  display: none;
}

.field {
  display: grid;
  gap: 0.5rem;
}

.field span {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.field-error {
  color: var(--danger);
  font-size: 0.9rem;
  margin-top: 0.25rem;
}

.field-error.hidden {
  display: none;
}

.validation-summary {
  display: grid;
  gap: 0.3rem;
  color: var(--text-secondary);
  font-size: 0.95rem;
  margin-top: -0.5rem;
  margin-bottom: 0.8rem;
}

.validation-summary .rule {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.validation-summary .rule::before {
  content: '•';
  width: 1em;
  color: var(--text-secondary);
}

.validation-summary .rule.valid {
  color: var(--success);
}

.validation-summary .rule.invalid {
  color: var(--text-secondary);
}


/* Create Account / Sign up specific styles
   Card uses panel background; only the primary button is the dark green (#083300) */
.signup-card {
  background: var(--bg-panel);
  color: var(--text-primary);
  border-radius: 1.25rem;
  padding: 2rem;
  box-shadow: 0 30px 80px rgba(8,51,0,0.06);
}
.signup-card .auth-brand img, .signup-card h1, .signup-card .auth-copy {
  color: inherit;
}
.signup-card .icon-and-input {
  background: #ffffff;
  border: 1px solid var(--border);
}
.signup-card .icon { background: rgba(15,23,42,0.03); }
.signup-card input { color: var(--text-primary); }
.signup-card input::placeholder { color: var(--text-muted); }
.signup-card .primary { background: var(--primary); color: white; }
.signup-card .primary:hover { background: #062500; }

input,
select,
button {
  width: 100%;
  border-radius: 0.5rem;
  border: 1.5px solid var(--border);
}

input,
select {
  padding: 1rem 1.1rem;
  background: white;
  color: var(--text-primary);
}

.field.error .icon-and-input {
  border-color: #dc2626;
}

.field.error .icon {
  background: rgba(220, 38, 38, 0.08);
}

.field-error {
  color: #dc2626;
  font-size: 0.95rem;
  margin-top: 0.45rem;
  display: block;
}

.field-error.hidden {
  display: none;
}

button {
  padding: 1rem 1.1rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

button.primary {
  background: var(--primary);
  color: white;
  border: none;
}

button.primary:hover {
  background: var(--primary-strong);
  transform: translateY(-1px);
}

button.ghost,
button.link {
  background: transparent;
  color: var(--primary);
  border: none;
  padding: 0;
}

button.ghost:hover,
button.link:hover {
  text-decoration: underline;
}

.auth-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
}

.security-question {
  padding: 1rem 1.1rem;
  border-radius: 0.5rem;
  background: var(--bg-muted);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.page-controls {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 1rem;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  background: rgba(59,130,246,0.12);
  color: var(--primary-strong);
  border-radius: 999px;
  font-weight: 600;
}

.role-switch {
  display: flex;
  gap: 1rem;
  align-items: center;
  flex-wrap: wrap;
  padding: 1rem;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.role-switch label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
}

.role-switch .note {
  color: var(--text-muted);
}

main {
  margin: 0;
}

.panel {
  margin-bottom: 1.75rem;
}

.panel.hidden {
  display: none;
}

.panel-block {
  background: var(--bg-panel);
  padding: 1.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-top: 1.25rem;
}

.panel-block h3 {
  margin-top: 0;
}

.card-row {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.card {
  background: linear-gradient(180deg, #2563eb 0%, #4338ca 100%);
  color: white;
  padding: 1.4rem;
  border-radius: 1.25rem;
  min-height: 110px;
}

.form-grid {
  display: grid;
  gap: 0.875rem;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  align-items: end;
}

input,
select {
  outline: none;
}

input:focus,
select:focus,
button:focus {
  outline: 2px solid rgba(16,185,129,0.18);
  outline-offset: 2px;
}

.data-grid {
  display: grid;
  gap: 0.75rem;
  margin-top: 1rem;
}

.data-row {
  background: var(--bg-muted);
  padding: 1rem;
  border-radius: 1rem;
  border: 1px solid rgba(148,163,184,0.24);
}

.data-row strong {
  display: block;
  margin-bottom: 0.5rem;
}

footer {
  text-align: center;
  color: var(--text-muted);
  padding: 1.5rem;
}

@media (max-width: 720px) {
  .auth-card,
  .page-main {
    width: calc(100% - 2rem);
  }

  .app-header {
    padding: 1.5rem 1rem;
  }

  .page-controls {
    justify-content: center;
  }
  .auth-grid {
    grid-template-columns: 1fr;
  }
  .visual-column { display: none; }
}

@media (max-width: 480px) {
  .page-main {
    width: 100%;
    padding: 0;
  }
  .auth-grid {
    min-height: 100vh;
  }
  .auth-card {
    width: 100%;
    min-height: 100vh;
    border-radius: 0;
    box-shadow: none;
    padding: 2rem 1.25rem;
  }
}

/* ================================================================
   Centred auth layout — screens 6–9 (no split, no visual panel)
   ================================================================ */
body.auth-centered {
  background: #ffffff;
  position: relative;
}

/* Wavy background from Figma — inverted to light lines on white */
body.auth-centered::before {
  content: '';
  position: fixed;
  inset: 0;
  background: url('src/images/background.png') center / cover no-repeat;
  filter: invert(1);
  opacity: 0.07;
  pointer-events: none;
  z-index: 0;
}

body.auth-centered .page-main {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: none;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 2rem 1rem;
}
body.auth-centered .auth-grid {
  display: block;
  min-height: unset;
}
body.auth-centered .visual-column {
  display: none;
}
body.auth-centered .auth-card {
  margin: 0 auto;           /* horizontally centre the card within its block parent */
  max-width: 460px;
  width: 100%;
  height: auto;
  justify-content: flex-start;
  padding: 2.5rem 2rem;
}

/* Centre heading and description text; keep field labels left-aligned */
body.auth-centered h1          { text-align: center; }
body.auth-centered .auth-copy  { text-align: center; }
body.auth-centered .auth-sub   { text-align: center; }
body.auth-centered .field span { text-align: left; }

/* ================================================================
   Sign-up: photo on right, form on left
   ================================================================ */
.auth-grid.visual-right .auth-card {
  order: -1;
}

/* ================================================================
   Password show/hide eye toggle
   ================================================================ */
.eye-toggle {
  background: none;
  border: none;
  padding: 4px;
  width: auto;
  min-width: unset;
  border-radius: 6px;
  cursor: pointer;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  flex-shrink: 0;
  outline: none;
}
.eye-toggle:hover {
  color: var(--text-secondary);
}
.eye-toggle:focus-visible {
  outline: 2px solid rgba(16, 185, 129, 0.3);
}

/* Allow input to shrink when eye-toggle shares the row */
.icon-and-input input {
  flex: 1;
  min-width: 0;
  width: auto;
}

/* ================================================================
   Success illustration wrapper
   ================================================================ */
.success-icon-wrap {
  display: flex;
  justify-content: center;
  margin: 0.5rem 0 1.75rem;
}

/* ================================================================
   Back To Login — outline block button (forgot-password page)
   ================================================================ */
.btn-outline-block {
  display: block;
  width: 100%;
  padding: 1rem 1.2rem;
  border: 1.5px solid var(--border);
  border-radius: 0.5rem;
  background: transparent;
  color: var(--text-primary);
  font-size: 1rem;
  font-weight: 700;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.btn-outline-block:hover {
  border-color: #94a3b8;
  background: #f8fafc;
}

/* ================================================================
   Sign-up subtitle line
   ================================================================ */
.auth-sub {
  margin: 0;
  color: var(--text-secondary);
  font-size: 0.95rem;
  text-align: center;
}

/* ================================================================
   Scroll-reduction micro-fixes
   Spacing-only tweaks — no layout or hierarchy changes.
   Targets standard laptop viewports (900–1080px height).
   ================================================================ */

/* Logo: slightly smaller to save vertical room; width: auto preserves aspect ratio */
.maido-logo-img { height: 48px; width: auto; }

/* Brand cluster: tighter gap and margin */
.auth-brand { gap: 0.4rem; margin-bottom: 1.25rem; }

/* Headings: trim a touch of weight without changing the visual hierarchy */
h1 { font-size: 1.15rem; }

/* Descriptive copy below heading: halve the bottom gap */
.auth-copy { margin: 0 0 0.75rem; }

/* Form fields: reduce vertical padding inside each input wrapper */
.icon-and-input { padding: 0.72rem 1rem; }

/* Form layout: tighten the gap between fields */
.auth-view { gap: 0.75rem; }

/* Remember Me / Forgot Password row: tighter bottom margin */
.action-row { margin-bottom: 0.5rem; }
.action-row { max-width: 520px; }   /* restate constraint — still no layout change */

/* Primary buttons: tighter vertical padding */
button.primary { padding: 0.8rem 1.2rem; }

/* Outline Back-To-Login link-button: match primary vertical rhythm */
.btn-outline-block { padding: 0.8rem 1.2rem; }

/* Social buttons: tighter vertical padding */
.social { padding: 0.75rem 1.1rem; }

/* "Or login with" divider: pull it closer to fields and social buttons */
.divider { margin: 0.9rem 0 0.75rem; }

/* Footer copy links: reduce stacking margin */
.sign-up-copy { margin-top: 0.5rem; }
.auth-footer   { margin-top: 0.2rem; }

/* Error / success banners: reduce padding and margin */
.auth-message { padding: 0.65rem 1rem; margin-bottom: 0.65rem; }

/* Inline password rules: tighten gap */
.validation-summary { margin-top: -0.25rem; margin-bottom: 0.5rem; gap: 0.2rem; }

/* Success page: smaller illustration + tighter wrap margin */
.success-icon-wrap { margin: 0 0 1rem; }
.success-icon-wrap svg { width: 84px; height: 84px; }

/* Centred-layout card: reduce top/bottom padding, keep margin auto */
body.auth-centered .auth-card { margin: 0 auto; padding: 1.5rem 2rem; }

/* ================================================================
   Visible text cursor — placed last, highest specificity (0,3,1)
   so it beats .field.input-with-icon input (0,2,1) unconditionally.
   font-size is the reliable cross-browser control for caret height.
   ================================================================ */
.field.input-with-icon .icon-and-input input {
  font-size: 1.0625rem;
  caret-color: #0f172a;
}
