/* =====================================================================
   Sign-up / login page. Calmer than the rest of the app: softer aurora,
   no grid, higher-contrast secondary text, form first on small screens.
   ===================================================================== */

body.auth-page { --text-3: #949cc0; --side-text: rgb(255 255 255 / 0.86); }
:root[data-theme='light'] body.auth-page { --text-2: #3f4b5e; --text-3: #5d6b80; }

/* calm backdrop */
.auth-page .aurora::before,
.auth-page .aurora::after,
.auth-page .aurora i { animation: none; opacity: 0.22; }
.auth-page .aurora i { opacity: 0.12; }
:root[data-theme='light'] .auth-page .aurora::before,
:root[data-theme='light'] .auth-page .aurora::after { opacity: 0.3; }

.auth-page a:not(.logo):not(.btn) { color: rgb(var(--p-light)); }
.auth-page a:not(.logo):not(.btn):hover { color: var(--cyan-2); }
:root[data-theme='light'] .auth-page a:not(.logo):not(.btn) { color: #047857; }
:root[data-theme='light'] .auth-page a:not(.logo):not(.btn):hover { color: #0e7490; }
.auth-page .logo, .auth-page .logo:hover { color: var(--text); }

/* layout */
.auth {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 0.92fr);
  gap: 24px;
  padding: 24px;
  max-width: 1360px;
  margin-inline: auto;
}
.auth-main { display: grid; place-items: center; padding: 16px; min-width: 0; }
.auth-card {
  width: min(460px, 100%);
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding: 30px 32px 26px;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sm);
}
:root[data-theme='light'] .auth-page .auth-card { background: rgb(255 255 255 / 0.78); border-color: rgb(15 23 42 / 0.09); }
.auth-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }

.auth-form { display: flex; flex-direction: column; gap: 18px; }
.auth-head h1 { font-size: 26px; font-weight: 900; line-height: 1.4; }
.auth-head p { color: var(--text-2); font-size: 15px; margin-top: 4px; }

/* tabs */
.auth-tabs { display: grid; grid-template-columns: 1fr 1fr; background: var(--inset); border: 1px solid var(--border); border-radius: 12px; padding: 4px; }
.auth-tabs button { border: 0; background: none; min-height: 40px; border-radius: 9px; font-weight: 700; font-size: 14.5px; color: var(--text-2); transition: background 0.15s, color 0.15s; }
.auth-tabs button:hover { color: var(--text); }
.auth-tabs button.active { background: var(--surface-3); color: var(--text); box-shadow: inset 0 1px 0 var(--ov-2), var(--shadow-xs); }
:root[data-theme='light'] .auth-tabs { background: rgb(15 23 42 / 0.05); border-color: rgb(15 23 42 / 0.07); }
:root[data-theme='light'] .auth-tabs button.active { background: #fff; box-shadow: 0 1px 3px rgb(15 23 42 / 0.12); }
.auth-tabs[hidden] { display: none; }

.auth-fields { display: flex; flex-direction: column; gap: 16px; }

/* labels & help */
.field-label { font-size: 14px; font-weight: 700; color: var(--text); }
.field-label-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.text-link { font-size: 13.5px; font-weight: 600; }
.field-help { color: var(--text-3); font-size: 13px; }
.field-error { color: #fda4af; font-size: 13px; font-weight: 600; display: flex; gap: 6px; align-items: center; }
.field-error::before { content: '!'; display: inline-grid; place-items: center; width: 16px; height: 16px; border-radius: 50%; background: #e11d48; color: #fff; font-size: 11px; font-weight: 900; flex-shrink: 0; }
:root[data-theme='light'] .field-error { color: #be123c; }
.input[aria-invalid='true'] { border-color: rgb(244 63 94 / 0.75); }
.input[aria-invalid='true']:focus { box-shadow: 0 0 0 3px rgb(244 63 94 / 0.3); border-color: rgb(244 63 94 / 0.9); }
.field[hidden], .field-help[hidden], .field-error[hidden] { display: none; }

/* LTR inputs (email, password) inside the RTL form: keep the icon on the
   right and the text clear of it. */
.auth-page .input-icon .input[dir='ltr'] { padding-right: 44px; padding-left: 15px; }
.auth-page .input-icon .input[dir='ltr']:placeholder-shown { text-align: right; }
.auth-page .input-icon .input[dir='ltr']::placeholder { font-family: var(--font); }
.auth-page .password-wrap .input { padding-left: 50px; }
.pw-toggle {
  position: absolute;
  left: 5px;
  top: 50%;
  transform: translateY(-50%);
  width: 38px;
  height: 36px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 9px;
  background: none;
  color: var(--text-2);
}
.pw-toggle:hover { background: var(--surface-2); color: var(--text); }
.pw-toggle .icon { position: static; transform: none; color: inherit; }
.pw-toggle:focus-visible { box-shadow: var(--ring); }

/* account type */
.role-pick { border: 0; margin: 0; padding: 0; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.role-pick legend { padding: 0; margin-bottom: 8px; }
.role-pick[hidden] { display: none; }
.role-options { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.role-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  padding: 14px;
  border-radius: 14px;
  border: 1.5px solid var(--border-strong);
  background: var(--inset);
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.role-card:hover { border-color: var(--ov-4); }
.role-radio { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; pointer-events: none; }
.role-card:has(.role-radio:focus-visible) { box-shadow: var(--ring); }
.role-icon { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--surface-2); color: var(--text-2); }
.role-text { display: flex; flex-direction: column; gap: 2px; }
.role-text b { font-size: 15px; }
.role-text span { font-size: 12.5px; line-height: 1.6; color: var(--text-2); }
.role-check {
  position: absolute;
  top: 12px;
  left: 12px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1.5px solid var(--border-strong);
  display: grid;
  place-items: center;
  color: transparent;
}
.role-card.active,
.role-card:has(.role-radio:checked) { border: 2px solid rgb(var(--p)); padding: 13.5px; background: rgb(var(--p) / 0.1); }
.role-card.active .role-icon { background: rgb(var(--p) / 0.18); color: var(--p-pale); }
.role-card.active .role-check { background: rgb(var(--p)); border-color: rgb(var(--p)); color: #fff; }
.role-card.active .role-text b { color: var(--text); }
:root[data-theme='light'] .role-card.active { background: rgb(var(--p) / 0.08); }

/* messages & actions */
.auth-page .form-error { line-height: 1.7; }
.auth-page .form-error[hidden], .auth-page .form-notice[hidden] { display: none; }
:root[data-theme='light'] .auth-page .form-error { background: #fff1f2; border-color: #fecdd3; }
:root[data-theme='light'] .auth-page .form-notice { background: #ecfdf5; border-color: #a7f3d0; }
.error-list { margin: 0; padding-inline-start: 18px; }
.inline-link { border: 0; background: none; padding: 0; color: inherit; font-weight: 800; text-decoration: underline; text-underline-offset: 3px; border-radius: 4px; }
.auth-page .btn-primary { box-shadow: 0 6px 18px -8px rgb(var(--p-deep) / 0.7); }
.auth-page .btn-primary:hover { box-shadow: 0 8px 22px -8px rgb(var(--p-deep) / 0.8); filter: brightness(1.06); }
.auth-page .btn-primary:disabled[aria-busy='true'] { opacity: 0.85; }
#auth-submit { gap: 10px; }
.auth-page .btn[hidden] { display: none; }
.auth-legal { text-align: center; font-size: 13px; color: var(--text-2); line-height: 1.8; }
.auth-legal[hidden] { display: none; }
.auth-legal a, .guest-box a:not(.btn) { text-decoration: underline; text-underline-offset: 3px; }

/* guest join */
.guest-box {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 12px;
  align-items: start;
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px dashed var(--border-strong);
  background: var(--ov-1);
}
.guest-box[hidden] { display: none; }
.guest-icon { grid-row: 1 / 3; width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: rgb(var(--a) / 0.14); color: var(--cyan-2); }
:root[data-theme='light'] .guest-icon { color: #0e7490; }
.guest-text h2 { font-size: 15px; font-weight: 800; }
.guest-text p { font-size: 13.5px; color: var(--text-2); }
.guest-link { grid-column: 2; justify-self: start; margin-top: 8px; height: 38px; padding: 0 14px; font-size: 14px; border-radius: 10px; }
.auth-page .guest-link { color: var(--text); }

/* side panel — same deep emerald/teal block in both themes, white text */
.auth-side {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-xl);
  padding: 44px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 32px;
  color: #fff;
  background: linear-gradient(160deg, #064e3b 0%, #065f56 50%, #0e4f63 100%);
  border: 1px solid rgb(255 255 255 / 0.08);
}
.auth-side::after { content: ''; position: absolute; inset: auto auto -30% -30%; width: 460px; height: 460px; border-radius: 50%; background: radial-gradient(circle, rgb(255 255 255 / 0.07), transparent 65%); pointer-events: none; }
.auth-side .logo, .auth-side .logo:hover { color: #fff; position: relative; z-index: 1; }
.auth-quote { position: relative; z-index: 1; max-width: 470px; }
.auth-quote h2 { font-size: 32px; line-height: 1.5; margin-bottom: 14px; font-weight: 900; color: #fff; }
.auth-quote p { color: var(--side-text, rgb(255 255 255 / 0.86)); font-size: 16px; line-height: 1.9; }
.auth-points { list-style: none; margin: 28px 0 0; padding: 0; display: grid; gap: 14px; }
.auth-points li { display: flex; gap: 10px; align-items: flex-start; color: rgb(255 255 255 / 0.94); font-size: 15px; line-height: 1.7; }
.auth-points .icon { color: #5eead4; margin-top: 3px; }
.side-foot { position: relative; z-index: 1; font-size: 13.5px; color: rgb(255 255 255 / 0.75); }

/* responsive */
@media (max-width: 1020px) {
  .auth { grid-template-columns: minmax(0, 1fr); padding: 16px; gap: 16px; }
  .auth-main { padding: 0; }
  /* short summary below the form, never in front of it */
  .auth-side { width: min(460px, 100%); justify-self: center; padding: 22px 24px; gap: 12px; border-radius: var(--radius-lg); }
  .auth-side::after, .side-logo, #side-desc, .side-foot { display: none; }
  .auth-quote h2 { font-size: 18px; margin-bottom: 0; }
  .auth-points { margin-top: 12px; gap: 8px; }
  .auth-points li { font-size: 14px; }
}
@media (max-width: 640px) {
  .auth { padding: 12px; }
  .auth-card { padding: 22px 18px 20px; gap: 18px; border-radius: var(--radius-lg); }
  .auth-head h1 { font-size: 23px; }
  .role-options { gap: 8px; }
  .role-card { padding: 12px; }
  .role-card.active, .role-card:has(.role-radio:checked) { padding: 11.5px; }
  .role-check { top: 10px; left: 10px; }
}
@media (max-width: 360px) {
  .role-options { grid-template-columns: 1fr; }
}

/* The green side panel would swallow the green half of the logo: give it a white tile there. */
.side-logo .logo-mark { background: #fff; border-radius: 10px; padding: 4px; }
.role-card.disabled { opacity: 0.55; cursor: not-allowed; }
