:root {
  --petrol:     #223035;
  --petrol-700: #2c3d43;
  --petrol-600: #3a4f55;
  --sage:       #91acac;
  --sage-deep:  #6f9293;
  --mist:       #c6d0d6;
  --paper:      #ffffff;
  --paper-soft: #f6f8f8;
  --ink:        #1c282c;
  --muted:      #66767b;
  --line:       rgba(34, 48, 53, 0.14);
  --line-light: rgba(255, 255, 255, 0.16);
  --font: "DM Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

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

html { -webkit-text-size-adjust: 100%; }

body.login-body {
  min-height: 100vh;
  min-height: 100svh;
  font-family: var(--font);
  color: var(--ink);
  background: var(--petrol);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  overflow-x: hidden;
}

::selection { background: var(--sage); color: var(--petrol); }
:focus-visible { outline: 2px solid var(--sage-deep); outline-offset: 3px; border-radius: 4px; }

/* ---------- Lewy panel (petrol, jak hero na stronie) ---------- */
.login-hero {
  position: relative;
  color: #fff;
  padding: clamp(32px, 6vw, 72px);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
  isolation: isolate;
}

/* zdjęcie w tle */
.login-hero::before {
  content: "";
  position: absolute; inset: 0; z-index: -2;
  background: var(--petrol) url("login-bg.jpg") center / cover no-repeat;
}

/* nakładka petrolowa — czytelność tekstu, spójny kolor */
.login-hero::after {
  content: "";
  position: absolute; inset: 0; z-index: -1;
  background:
    linear-gradient(180deg, rgba(34,48,53,0.6) 0%, rgba(34,48,53,0.5) 45%, rgba(34,48,53,0.9) 100%),
    linear-gradient(90deg, rgba(34,48,53,0.85) 0%, rgba(34,48,53,0.5) 55%, rgba(34,48,53,0.2) 100%);
}

.login-hero__brand { display: inline-flex; align-items: center; }
.login-hero__brand img {
  display: block;
  height: 34px;
  width: auto;
  /* logo jest czarne — na ciemnym tle odwracamy na białe */
  filter: invert(1) brightness(1.4);
}

.login-hero__content { max-width: 540px; margin: clamp(48px, 10vh, 120px) 0; }

.login-hero__title {
  font-weight: 500;
  font-size: clamp(2rem, 4.2vw, 3.3rem);
  line-height: 1.08;
  letter-spacing: -0.02em;
}
.login-hero__title em { font-style: normal; color: var(--sage); }

.login-hero__foot {
  display: flex; flex-wrap: wrap; gap: 8px 24px;
  font-size: 0.82rem; color: rgba(255,255,255,0.5);
}
.login-hero__foot a { color: inherit; text-decoration: none; border-bottom: 1px solid transparent; transition: color .3s, border-color .3s; }
.login-hero__foot a:hover { color: #fff; border-color: var(--sage); }

/* ---------- Prawy panel (biała karta z formularzem) ---------- */
.login-panel {
  background: var(--paper);
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(32px, 6vw, 72px) clamp(20px, 5vw, 64px);
}

.login-card { width: 100%; max-width: 400px; min-width: 0; }

.login-card__logo { display: none; height: 30px; width: auto; margin-bottom: 40px; }

.login-card h1 {
  font-weight: 500;
  font-size: clamp(1.7rem, 2.6vw, 2.1rem);
  line-height: 1.1;
  letter-spacing: -0.02em;
  color: var(--petrol);
}
.login-card__hint { margin-top: 10px; color: var(--muted); font-size: 0.98rem; line-height: 1.6; }

.login-form { margin-top: 36px; display: flex; flex-direction: column; gap: 22px; }

.field { display: flex; flex-direction: column; gap: 8px; }
.field label { font-size: 0.85rem; font-weight: 500; color: var(--petrol-600); }

.field__control { position: relative; display: flex; align-items: center; }
.field__control input {
  width: 100%;
  font-family: var(--font);
  font-size: 1rem;
  color: var(--ink);
  background: var(--paper-soft);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 52px 14px 16px;
  transition: border-color .3s, background .3s, box-shadow .3s;
  appearance: none;
}
.field__control input::placeholder { color: rgba(28,40,44,0.35); }
.field__control input:focus {
  outline: none;
  border-color: var(--sage-deep);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(145,172,172,0.22);
}

.field__toggle {
  position: absolute; right: 6px;
  width: 38px; height: 38px;
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent; border: 0; border-radius: 10px; cursor: pointer;
  color: var(--muted);
  transition: color .3s, background .3s;
}
.field__toggle:hover { color: var(--petrol); background: rgba(34,48,53,0.06); }
.field__toggle svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.field__toggle .icon-off { display: none; }
.field__toggle[aria-pressed="true"] .icon-on { display: none; }
.field__toggle[aria-pressed="true"] .icon-off { display: block; }

/* Przycisk — pill, jak .btn--solid na stronie */
.btn {
  --bh: 54px;
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%;
  height: var(--bh); padding: 0 26px;
  font-family: var(--font);
  font-weight: 500; font-size: 1rem;
  border-radius: 100px; border: 1px solid transparent; cursor: pointer;
  transition: transform .4s var(--ease), background .3s, color .3s, box-shadow .3s;
  white-space: nowrap;
}
.btn svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; transition: transform .4s var(--ease); }
.btn:hover svg { transform: translateX(4px); }
.btn--solid { background: var(--petrol); color: #fff; }
.btn--solid:hover { background: var(--petrol-600); transform: translateY(-2px); box-shadow: 0 16px 30px -16px rgba(34,48,53,0.6); }
.btn--solid:active { transform: translateY(0); }

.login-card__note {
  margin-top: 28px;
  font-size: 0.85rem; color: var(--muted);
  display: flex; align-items: center; gap: 10px;
}
.login-card__note svg { width: 16px; height: 16px; flex: none; fill: none; stroke: var(--sage-deep); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* Komunikat błędu (jeśli backend przekaże `error`) */
.login-alert {
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(255,154,154,0.14);
  border: 1px solid rgba(255,154,154,0.5);
  color: #8a2f2f;
  font-size: 0.92rem;
}

/* ---------- Responsywność ---------- */
@media (max-width: 900px) {
  body.login-body { grid-template-columns: minmax(0, 1fr); background: var(--paper); }
  .login-hero { display: none; }
  .login-panel { min-height: 100vh; min-height: 100svh; align-items: flex-start; padding-top: clamp(40px, 10vh, 96px); }
  .login-card__logo { display: block; }
}

@media (prefers-reduced-motion: reduce) {
  .btn, .btn svg, .field__control input { transition: none; }
}
