/* ============================================================
   Employee portal — registration / login / dashboard
   Uses the main site's design tokens (css/style.css loaded first)
   ============================================================ */

.auth-body {
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 40px 20px 60px;
  background:
    radial-gradient(circle at 12% 8%, rgba(198,40,40,.12), transparent 45%),
    radial-gradient(circle at 88% 92%, rgba(198,40,40,.10), transparent 45%),
    radial-gradient(circle at 50% 45%, rgba(255,255,255,.9), transparent 70%),
    var(--bg-2);
}

.auth-wrap { width: 100%; max-width: 900px; }
.auth-brand {
  display: flex;
  justify-content: center;
  margin-bottom: 24px;
}
.auth-brand img {
  height: 56px;
  width: auto;
  filter: drop-shadow(0 4px 10px rgba(16,24,40,.12));
}

.auth-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow);
  padding: 0 40px 36px;
  overflow: hidden;
}

/* Gradient header band inside each card */
.auth-card::before {
  content: "";
  display: block;
  margin: 0 -40px 26px;
  height: 6px;
  background: linear-gradient(90deg, var(--red), #8E1414, var(--red));
}

.auth-card-narrow { max-width: 460px; margin: 0 auto; }

.auth-card h1 {
  font: 600 26px/1.25 var(--font-head);
  color: var(--ink);
  letter-spacing: -.4px;
  margin-bottom: 8px;
  text-align: center;
}
.auth-sub {
  text-align: center;
  font-size: 13.5px;
  color: var(--muted);
  margin-bottom: 26px;
}
.auth-ok {
  background: #EAF7EF;
  border: 1px solid #BFE5CD;
  color: #1E7A44;
  font-size: 13.5px;
  border-radius: 10px;
  padding: 12px 16px;
  margin-bottom: 20px;
  text-align: center;
}
.auth-error {
  background: var(--red);
  border: 1px solid var(--red-hover);
  color: #fff;
  font-size: 13.5px;
  font-weight: 500;
  border-radius: 10px;
  padding: 12px 16px;
  margin-bottom: 20px;
  text-align: center;
  box-shadow: 0 6px 16px -8px rgba(198,40,40,.55);
}

/* ---------- Section titles ---------- */
.form-section-title {
  display: flex;
  align-items: center;
  gap: 12px;
  font: 600 13px var(--font-head);
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--red);
  margin: 26px 0 16px;
}
.form-section-title:first-of-type { margin-top: 0; }
.form-section-title::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--red-200);
}

/* ---------- Form layout ---------- */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px 20px;
  margin-bottom: 6px;
}
.field { display: flex; flex-direction: column; }
.field.span-2 { grid-column: span 2; }

.field label {
  font: 600 12.5px var(--font-body);
  color: var(--ink-2);
  margin-bottom: 7px;
}
/* Required-field marker — red asterisk attached to the label text */
.req { color: var(--red, #C62828); font-weight: 700; margin-left: 1px; }
.auth-card label .req { color: #E00000; } /* asterisk always bright red */
.auth-card label .opt { color: #98A2B3; font-weight: 500; font-size: 11.5px; }
.field input,
.field select,
.field textarea {
  font: 400 14px/1.4 var(--font-body);
  color: var(--ink);
  background: #FBFCFD;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  padding: 11px 14px;
  transition: border-color .2s, box-shadow .2s, background .2s;
  width: 100%;
}
.field textarea { resize: vertical; min-height: 84px; }

/* Show/hide password wrapper */
.pw-wrap { position: relative; display: block; }
.pw-wrap input { padding-right: 46px; }
.pw-toggle {
  position: absolute; top: 50%; right: 6px; transform: translateY(-50%);
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; padding: 0; border: 0; border-radius: 9px;
  background: transparent; color: var(--muted); cursor: pointer;
  transition: background .15s, color .15s;
}
.pw-toggle svg { width: 19px; height: 19px; display: block; }
.pw-toggle:hover { color: var(--ink); background: rgba(16, 24, 40, .07); }
.pw-toggle:active { transform: translateY(-50%) scale(.92); }
.pw-toggle:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }

/* ---------- Registration success modal ---------- */
[hidden] { display: none !important; }
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(16, 24, 40, .55);
  display: grid; place-items: center; padding: 20px; z-index: 100;
}
.modal {
  background: #fff; border-radius: 16px;
  box-shadow: 0 20px 50px -12px rgba(16, 24, 40, .35);
  padding: 30px 26px; width: 100%; max-width: 400px;
  text-align: center; display: grid; gap: 12px; justify-items: center;
}
.modal-icon {
  width: 56px; height: 56px; border-radius: 50%;
  background: var(--ok-bg, #E7F6ED); color: var(--ok, #0B7A3B);
  display: grid; place-items: center;
}
.modal-icon svg { width: 28px; height: 28px; display: block; }
.modal h3 { font: 700 20px/1.3 var(--font-head, var(--font-body)); color: var(--ink); }
.modal-text { color: var(--ink-2); font-size: 14px; line-height: 1.55; margin: 0; }
.modal .btn { margin-top: 4px; }
.field input::placeholder,
.field textarea::placeholder { color: #98A2B3; }
.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  background: #fff;
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(198,40,40,.12);
}
.field input[type="file"] {
  padding: 9px 12px;
  font-size: 13px;
  color: var(--ink-2);
}

/* Red error / green valid states (JS-driven) */
.field input.invalid,
.field select.invalid,
.field textarea.invalid {
  border-color: var(--red);
  background: #FFF7F7;
}
.field input.valid,
.field select.valid,
.field textarea.valid { border-color: #8FC7A6; background: #fff; }

.field-error {
  display: none;
  font-size: 12px;
  font-weight: 500;
  color: var(--red);
  margin-top: 6px;
}
.field-error:not(:empty) { display: block; }
.field-error::before { content: "⚠ "; }

/* ---------- Submit ---------- */
.auth-card .btn-block { margin-top: 22px; font-size: 15px; padding: 15px 24px; }

.auth-alt {
  text-align: center;
  font-size: 13.5px;
  color: var(--muted);
  margin-top: 18px;
}
.auth-alt a { color: var(--red); font-weight: 600; }
.auth-alt a:hover { text-decoration: underline; }

/* ---------- Login form ---------- */
#loginForm .field { margin-bottom: 18px; }

/* ---------- Dashboard ---------- */
.dash-head {
  display: flex;
  align-items: center;
  gap: 18px;
  padding-top: 4px;
  margin-bottom: 26px;
}
.dash-head h1 { text-align: left; margin-bottom: 4px; }
.dash-head .auth-sub { text-align: left; margin-bottom: 0; }
.dash-photo {
  width: 76px; height: 76px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--red-100);
  box-shadow: var(--shadow-sm);
  flex: none;
}
.dash-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 26px;
}
.dash-item {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  background: #FBFCFD;
}
.dash-item span { font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); }
.dash-item strong { font-size: 14px; color: var(--ink); word-break: break-word; }
.dash-item a { color: var(--red); }

/* ---------- Mobile ---------- */
@media (max-width: 640px) {
  .auth-body { padding: 24px 14px 40px; }
  .auth-card { padding: 0 20px 26px; }
  .auth-card::before { margin: 0 -20px 22px; }
  .form-grid { grid-template-columns: 1fr; }
  .field.span-2 { grid-column: span 1; }
  .dash-grid { grid-template-columns: 1fr; }
  .dash-head { flex-direction: column; text-align: center; }
  .dash-head h1 { text-align: center; font-size: 20px; }
  .dash-head .auth-sub { text-align: center; }
}