:root {
  --navy: #062b50;
  --navy-deep: #031e39;
  --blue: #0878d1;
  --accent: #08b99a;
  --accent-soft: #dff8f1;
  --ink: #102a43;
  --muted: #657b8f;
  --line: #d9e5ee;
  --surface: #ffffff;
  --danger: #b42318;
  --shadow: 0 28px 70px rgba(4, 36, 66, .19);
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  color: var(--ink);
  background: #eaf3f8;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

body.role-patient { --accent: #08a88a; --accent-soft: #ddf7f0; }
body.role-clinique { --accent: #0a7bd8; --accent-soft: #e3f2ff; }
body.role-pharmacie { --accent: #00a58e; --accent-soft: #ddf7f1; }

a { color: inherit; }

.login-shell {
  width: min(1460px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(450px, .92fr);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.presentation-panel {
  position: relative;
  min-height: 760px;
  overflow: hidden;
  isolation: isolate;
  padding: 42px clamp(34px, 5vw, 76px);
  color: #fff;
  background:
    radial-gradient(circle at 82% 20%, rgba(42, 186, 239, .31), transparent 27%),
    radial-gradient(circle at 12% 86%, rgba(0, 211, 174, .22), transparent 29%),
    linear-gradient(135deg, var(--navy-deep) 0%, var(--navy) 54%, #064b72 100%);
}

.presentation-panel::before,
.presentation-panel::after {
  content: "";
  position: absolute;
  z-index: -1;
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 50%;
}

.presentation-panel::before { width: 560px; height: 560px; right: -260px; top: 80px; }
.presentation-panel::after { width: 340px; height: 340px; left: -170px; bottom: -120px; }

.login-brand {
  position: relative;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  gap: 13px;
  color: #fff;
  text-decoration: none;
}

.login-logo {
  width: 46px;
  height: 46px;
  display: inline-grid;
  place-items: center;
  flex: 0 0 46px;
  border-radius: 14px;
  color: #fff;
  background: var(--accent);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .18);
  font-size: 30px;
  font-weight: 400;
  line-height: 1;
}

.login-brand b { display: block; font-size: 20px; letter-spacing: .04em; }
.login-brand small { display: block; margin-top: 2px; color: rgba(255, 255, 255, .7); font-size: 11px; }

.presentation-copy {
  position: relative;
  z-index: 3;
  width: min(600px, 88%);
  margin-top: clamp(72px, 10vh, 120px);
}

.login-eyebrow,
.welcome {
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .14em;
}

.presentation-copy h1 {
  max-width: 570px;
  margin: 15px 0 20px;
  color: #fff;
  font-size: clamp(38px, 4vw, 62px);
  line-height: 1.03;
  letter-spacing: -.045em;
}

.presentation-copy > p {
  max-width: 550px;
  margin: 0;
  color: rgba(255, 255, 255, .79);
  font-size: clamp(16px, 1.4vw, 19px);
  line-height: 1.68;
}

.presentation-copy ul {
  margin: 26px 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 11px;
}

.presentation-copy li { display: flex; align-items: center; gap: 11px; font-weight: 650; }
.presentation-copy li span {
  width: 24px;
  height: 24px;
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: var(--accent);
  font-size: 13px;
}

.login-person {
  position: absolute;
  z-index: 2;
  right: clamp(-68px, -3vw, -22px);
  bottom: 0;
  width: min(47%, 430px);
  max-height: 71%;
  object-fit: contain;
  object-position: right bottom;
  filter: drop-shadow(-16px 18px 24px rgba(0, 0, 0, .23));
}

.network-badge {
  position: absolute;
  z-index: 4;
  left: clamp(34px, 5vw, 76px);
  bottom: 42px;
  max-width: 270px;
  display: grid;
  grid-template-columns: 40px 1fr;
  column-gap: 11px;
  padding: 13px 17px;
  border: 1px solid rgba(255, 255, 255, .18);
  border-radius: 16px;
  background: rgba(255, 255, 255, .11);
  box-shadow: 0 16px 36px rgba(0, 0, 0, .12);
  backdrop-filter: blur(12px);
}

.network-badge > span { grid-row: 1 / 3; font-size: 28px; }
.network-badge b { font-size: 13px; }
.network-badge small { margin-top: 2px; color: rgba(255, 255, 255, .66); font-size: 10px; }

.form-panel {
  min-width: 0;
  display: flex;
  flex-direction: column;
  padding: 34px clamp(30px, 5vw, 72px) 24px;
  background: #fff;
}

.space-switcher {
  align-self: flex-end;
  display: inline-flex;
  gap: 5px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f5f9fc;
}

.space-switcher a {
  padding: 9px 15px;
  border-radius: 999px;
  color: #547086;
  text-decoration: none;
  font-size: 13px;
  font-weight: 750;
  transition: .2s ease;
}

.space-switcher a:hover { color: var(--ink); background: #fff; }
.space-switcher a.active { color: #fff; background: var(--accent); box-shadow: 0 7px 18px color-mix(in srgb, var(--accent) 28%, transparent); }

.form-wrap {
  width: min(470px, 100%);
  margin: auto;
  padding: 50px 0 36px;
}

.form-icon {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  margin-bottom: 23px;
  border-radius: 16px;
  color: #fff;
  background: var(--accent);
  box-shadow: 0 12px 28px color-mix(in srgb, var(--accent) 28%, transparent);
  font-size: 34px;
}

.form-wrap .welcome { margin: 0 0 9px; }
.form-wrap h2 { margin: 0; font-size: clamp(31px, 3vw, 43px); line-height: 1.08; letter-spacing: -.035em; }
.form-intro { margin: 12px 0 31px; color: var(--muted); line-height: 1.6; }

.login-alert {
  margin: 0 0 20px;
  padding: 13px 15px;
  border: 1px solid #fecdca;
  border-radius: 11px;
  color: var(--danger);
  background: #fff4f3;
  font-size: 14px;
}

.form-wrap form { display: grid; gap: 20px; }
.form-wrap form > label { display: grid; gap: 8px; font-size: 13px; font-weight: 750; }

.login-field {
  min-height: 56px;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #fbfdfe;
  transition: .2s ease;
}

.login-field:focus-within { border-color: var(--accent); background: #fff; box-shadow: 0 0 0 4px var(--accent-soft); }
.login-field > span { color: var(--accent); font-size: 13px; }
.login-field input { min-width: 0; flex: 1; border: 0; outline: 0; color: var(--ink); background: transparent; font: inherit; font-weight: 500; }
.login-field input::placeholder { color: #9aacba; }

.toggle-password {
  border: 0;
  padding: 7px 3px;
  color: var(--accent);
  background: transparent;
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
}

.login-options { display: flex; justify-content: space-between; gap: 14px; margin-top: -3px; color: var(--muted); font-size: 13px; }
.login-options label { display: flex; align-items: center; gap: 7px; cursor: pointer; }
.login-options input { accent-color: var(--accent); }
.login-options a, .register-link a { color: var(--accent); font-weight: 750; text-decoration: none; }
.login-options a:hover, .register-link a:hover { text-decoration: underline; }

.login-submit {
  min-height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  border: 0;
  border-radius: 13px;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 72%, #004b8d));
  box-shadow: 0 14px 30px color-mix(in srgb, var(--accent) 25%, transparent);
  cursor: pointer;
  font: inherit;
  font-weight: 800;
  text-decoration: none;
  transition: transform .2s ease, box-shadow .2s ease;
}

.login-submit:hover { transform: translateY(-2px); box-shadow: 0 18px 35px color-mix(in srgb, var(--accent) 30%, transparent); }
.login-submit span { font-size: 20px; }
.register-link { margin: 24px 0 0; padding-top: 22px; border-top: 1px solid #edf2f5; color: var(--muted); text-align: center; font-size: 13px; }

.form-panel footer { margin-top: auto; color: #8b9ba8; text-align: center; font-size: 11px; }
.form-panel footer a { text-decoration: none; }

.dashboard-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(circle at 70% 20%, #d9f4ed, transparent 28%), #eaf3f8; }
.dashboard-card { width: min(620px, 100%); padding: clamp(34px, 6vw, 62px); border-radius: 25px; background: #fff; box-shadow: var(--shadow); text-align: center; }
.dashboard-card .login-logo { margin: 0 auto 20px; }
.dashboard-card .welcome { margin: 0 0 8px; }
.dashboard-card h1 { margin: 0 0 12px; font-size: clamp(31px, 5vw, 46px); }
.dashboard-card > p { color: var(--muted); }
.dashboard-note { margin: 28px 0; padding: 18px; border-radius: 14px; color: #44657c; background: #eff7fa; line-height: 1.6; }
.dashboard-link { width: min(260px, 100%); margin: 0 auto; }

@media (max-width: 1020px) {
  .login-shell { grid-template-columns: minmax(0, .9fr) minmax(420px, 1.1fr); }
  .presentation-panel { padding-inline: 38px; }
  .presentation-copy { width: 100%; margin-top: 75px; }
  .presentation-copy h1 { font-size: 42px; }
  .login-person { width: 52%; opacity: .72; }
  .network-badge { left: 38px; }
}

@media (max-width: 780px) {
  .login-shell { display: block; }
  .presentation-panel { min-height: 570px; padding: 28px 26px; }
  .presentation-copy { width: 76%; margin-top: 56px; }
  .presentation-copy h1 { font-size: clamp(34px, 9vw, 46px); }
  .presentation-copy > p { font-size: 15px; }
  .presentation-copy ul { gap: 8px; font-size: 13px; }
  .login-person { right: -45px; width: 48%; max-height: 60%; opacity: .86; }
  .network-badge { left: 26px; bottom: 24px; }
  .form-panel { min-height: 650px; padding: 24px 22px 20px; }
  .space-switcher { align-self: center; }
  .form-wrap { padding: 52px 0 42px; }
}

@media (max-width: 520px) {
  .presentation-panel { min-height: 620px; }
  .presentation-copy { width: 100%; }
  .presentation-copy > p { width: 84%; }
  .login-person { width: 61%; opacity: .58; }
  .network-badge { max-width: 245px; }
  .space-switcher { width: 100%; display: grid; grid-template-columns: repeat(3, 1fr); }
  .space-switcher a { padding-inline: 6px; text-align: center; }
  .login-options { align-items: flex-start; flex-direction: column; }
}

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