/* ==========================================================================
   TMS sign-in pages (login, code, forgot / reset password)
   Brand panel: deep planning navy with a faint survey grid, the agency seal,
   and one signature animation: a task card travelling To-do → In progress → Done.
   ========================================================================== */
@font-face {
  font-family: "Bricolage Grotesque";
  font-style: normal;
  font-display: swap;
  font-weight: 200 800;
  font-stretch: 75% 100%;
  src: url("../vendor/bricolage/bricolage-grotesque-latin-standard-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Bricolage Grotesque";
  font-style: normal;
  font-display: swap;
  font-weight: 200 800;
  font-stretch: 75% 100%;
  src: url("../vendor/bricolage/bricolage-grotesque-latin-ext-standard-normal.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  --au-navy: #0e2a4f;
  --au-ink: #081a33;
  --au-gold: #d9a93f;
  --au-gold-soft: rgba(217, 169, 63, 0.16);
  --au-paper: #f4f6fa;
  --au-line: rgba(255, 255, 255, 0.09);
  --au-text: #dce6f4;
  --au-muted: #9fb2cf;
  --au-new: #94a3b8;
  --au-progress: #5b9cf5;
  --au-done: #3fb57a;
  --au-display: "Bricolage Grotesque", "Inter", system-ui, sans-serif;
  --au-ease: cubic-bezier(0.22, 1, 0.36, 1);
}

.auth-body { background: var(--au-paper); }
[data-bs-theme="dark"] .auth-body { background: var(--tms-bg); }

.auth-page { min-height: 100vh; min-height: 100dvh; display: grid; grid-template-columns: minmax(0, 1.12fr) minmax(0, 1fr); }

/* ---------------------------------------------------------------- Brand panel */
.auth-brand {
  position: relative; overflow: hidden; isolation: isolate;
  display: flex; flex-direction: column; gap: 32px;
  padding: clamp(28px, 4vw, 52px) clamp(28px, 4.5vw, 64px);
  color: var(--au-text);
  background:
    radial-gradient(900px 520px at 0% 0%, rgba(58, 110, 184, 0.45), transparent 62%),
    radial-gradient(700px 500px at 100% 100%, rgba(217, 169, 63, 0.10), transparent 60%),
    linear-gradient(160deg, var(--au-navy) 0%, var(--au-ink) 100%);
}
/* Survey grid: the planning-map texture of a regional development office. */
.auth-brand::before {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background-image:
    linear-gradient(var(--au-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--au-line) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(ellipse 85% 75% at 30% 40%, #000 30%, transparent 85%);
  -webkit-mask-image: radial-gradient(ellipse 85% 75% at 30% 40%, #000 30%, transparent 85%);
  opacity: 0.7;
}

/* Neutralize the older sign-in styles of app.css (versions before 2.0.5). */
.auth-brand::after { content: none; display: none; }
.auth-points { display: none; }

.ab-head { display: flex; align-items: center; gap: 14px; }
.ab-logo {
  width: 56px; height: 56px; flex-shrink: 0; border-radius: 16px; padding: 6px;
  display: grid; place-items: center; background: #fff;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.5), 0 0 0 6px var(--au-gold-soft), 0 10px 24px rgba(0, 0, 0, 0.25);
}
.ab-logo img { width: 100%; height: 100%; object-fit: contain; }
.ab-logo-mono { background: linear-gradient(150deg, #e9bf5e, #b8862f); color: var(--au-ink); font-weight: 800; font-size: 0.95rem; letter-spacing: -0.02em; }
.ab-agency { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.ab-agency strong { color: #fff; font-weight: 650; font-size: 0.98rem; }
.ab-agency span { color: var(--au-muted); font-size: 0.82rem; }

.ab-main { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 18px; max-width: 620px; }
.auth-brand .ab-title {
  font-family: var(--au-display); color: #fff; margin: 0;
  font-size: clamp(2.1rem, 3.6vw, 3.4rem); line-height: 1.02; font-weight: 700;
  letter-spacing: -0.035em; font-variation-settings: "wdth" 85;
  text-wrap: balance; max-width: 14ch;
}
.auth-brand .ab-lead { margin: 0; color: var(--au-muted); font-size: 1.02rem; line-height: 1.6; max-width: 52ch; }
.auth-brand .ab-foot-note { margin: 0; color: rgba(159, 178, 207, 0.7); font-size: 0.78rem; }

/* ----------------------------------------------------- The animated board */
.ab-board {
  --gap: 10px; --pad: 8px; --cycle: 12s;
  position: relative; container-type: inline-size;
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--gap);
  margin-top: 14px; padding: 12px; border-radius: 18px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.09);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 30px 60px -30px rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(6px);
}
.ab-col { --tone: var(--au-new); position: relative; display: flex; flex-direction: column; gap: 8px; padding: var(--pad); border-radius: 12px; background: rgba(8, 26, 51, 0.45); border-top: 3px solid var(--tone); min-height: 214px; }
.ab-col-progress { --tone: var(--au-progress); }
.ab-col-done { --tone: var(--au-done); }
.ab-col-head { display: flex; align-items: center; gap: 7px; color: #fff; font-size: 0.76rem; font-weight: 650; padding: 2px 2px 4px; white-space: nowrap; }
.ab-col-head i { width: 8px; height: 8px; border-radius: 50%; background: var(--tone); box-shadow: 0 0 0 3px color-mix(in srgb, var(--tone) 25%, transparent); }
.ab-col-head b { margin-left: auto; font-weight: 600; color: var(--au-muted); font-size: 0.72rem; background: rgba(255, 255, 255, 0.07); border-radius: 99px; padding: 1px 7px; }

.ab-card { display: flex; flex-direction: column; gap: 6px; padding: 10px; border-radius: 10px; background: #fff; color: #0f172a; box-shadow: 0 1px 0 rgba(15, 23, 42, 0.05); }
.ab-static { background: rgba(255, 255, 255, 0.92); }
.ab-dim { opacity: 0.55; }
.ab-line { display: block; height: 7px; border-radius: 4px; background: #d8e0ec; }
.ab-line.w80 { width: 80%; } .ab-line.w65 { width: 65%; } .ab-line.w55 { width: 55%; }
.ab-foot { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-top: 2px; }
.ab-chip { width: 42px; height: 14px; border-radius: 99px; background: #eef2f8; }
.ab-av { width: 20px; height: 20px; border-radius: 50%; background: hsl(var(--h, 210) 55% 88%); flex-shrink: 0; }
.ab-av-text { display: grid; place-items: center; font-size: 0.55rem; font-weight: 800; color: hsl(var(--h, 210) 50% 32%); }

/* Empty drop places at the top of each column (where the moving card lands). */
.ab-slot { height: 98px; border-radius: 10px; border: 1.5px dashed transparent; }
.ab-slot-2 { animation: ab-target-2 var(--cycle) var(--au-ease) infinite; }
.ab-slot-3 { animation: ab-target-3 var(--cycle) var(--au-ease) infinite; }

/* The card that moves through the process. */
.ab-mover {
  --col: calc((100cqw - 2 * var(--gap)) / 3); /* cqw = board content width (padding excluded) */
  --step: calc(var(--col) + var(--gap));
  position: absolute; z-index: 2;
  left: calc(12px + var(--pad)); top: calc(12px + 3px + var(--pad) + 26px + 8px);
  width: calc(var(--col) - 2 * var(--pad)); height: 98px;
  justify-content: space-between;
  border-left: 3px solid var(--au-gold);
  animation: ab-travel var(--cycle) var(--au-ease) infinite;
  will-change: transform;
}
.ab-mover-top { display: flex; align-items: center; gap: 6px; }
.ab-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--au-new); animation: ab-dot var(--cycle) linear infinite; }
.ab-id { font-size: 0.62rem; font-weight: 700; color: #64748b; background: #eef2f8; border-radius: 5px; padding: 1px 5px; }
.ab-check { margin-left: auto; width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; background: var(--au-done); color: #fff; font-size: 0.7rem; transform: scale(0); animation: ab-check var(--cycle) var(--au-ease) infinite; }
.ab-mover-title { display: block; flex-shrink: 0; font-size: 0.74rem; font-weight: 700; line-height: 1.35; padding-bottom: 1px; color: #0f172a; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ab-bar { height: 4px; border-radius: 4px; background: #e6ebf3; overflow: hidden; }
.ab-bar span { display: block; height: 100%; width: 0; background: var(--au-progress); border-radius: inherit; animation: ab-bar var(--cycle) linear infinite; }
.ab-due { font-size: 0.6rem; font-weight: 650; color: #475569; display: inline-flex; gap: 4px; align-items: center; white-space: nowrap; }

.ab-toast {
  position: absolute; right: 18px; bottom: -16px; z-index: 3;
  display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px 8px 10px;
  border-radius: 99px; background: #fff; color: #0f172a; font-size: 0.76rem; font-weight: 650;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
  opacity: 0; transform: translateY(8px) scale(0.96);
  animation: ab-toast var(--cycle) var(--au-ease) infinite;
}
.ab-toast i { color: var(--au-done); font-size: 0.95rem; }

@keyframes ab-travel {
  0%, 9%   { transform: translate(0, 0) rotate(0) scale(1); box-shadow: 0 1px 0 rgba(15, 23, 42, 0.05); opacity: 1; }
  13%      { transform: translate(0, -8px) rotate(-2deg) scale(1.04); box-shadow: 0 18px 30px rgba(0, 0, 0, 0.35); }
  29%      { transform: translate(var(--step), -8px) rotate(1.5deg) scale(1.04); box-shadow: 0 18px 30px rgba(0, 0, 0, 0.35); }
  33%, 52% { transform: translate(var(--step), 0) rotate(0) scale(1); box-shadow: 0 1px 0 rgba(15, 23, 42, 0.05); }
  56%      { transform: translate(var(--step), -8px) rotate(-2deg) scale(1.04); box-shadow: 0 18px 30px rgba(0, 0, 0, 0.35); }
  72%      { transform: translate(calc(var(--step) * 2), -8px) rotate(1.5deg) scale(1.04); box-shadow: 0 18px 30px rgba(0, 0, 0, 0.35); }
  76%, 93% { transform: translate(calc(var(--step) * 2), 0) rotate(0) scale(1); box-shadow: 0 1px 0 rgba(15, 23, 42, 0.05); opacity: 1; }
  97%      { transform: translate(calc(var(--step) * 2), 0) scale(0.96); opacity: 0; }
  98%      { transform: translate(0, 0) scale(0.96); opacity: 0; }
  100%     { transform: translate(0, 0) scale(1); opacity: 1; }
}
@keyframes ab-dot {
  0%, 31%  { background: var(--au-new); }
  33%, 74% { background: var(--au-progress); }
  76%, 100% { background: var(--au-done); }
}
@keyframes ab-bar {
  0%, 34%  { width: 0; background: var(--au-progress); }
  52%, 74% { width: 70%; background: var(--au-progress); }
  77%, 96% { width: 100%; background: var(--au-done); }
  98%, 100% { width: 0; }
}
@keyframes ab-check {
  0%, 75%  { transform: scale(0); }
  80%      { transform: scale(1.25); }
  84%, 94% { transform: scale(1); }
  97%, 100% { transform: scale(0); }
}
@keyframes ab-toast {
  0%, 78%  { opacity: 0; transform: translateY(8px) scale(0.96); }
  82%, 92% { opacity: 1; transform: none; }
  96%, 100% { opacity: 0; transform: translateY(-4px) scale(0.98); }
}
@keyframes ab-target-2 {
  0%, 11%, 35%, 100% { border-color: transparent; background: transparent; }
  15%, 31% { border-color: color-mix(in srgb, var(--au-progress) 70%, transparent); background: color-mix(in srgb, var(--au-progress) 10%, transparent); }
}
@keyframes ab-target-3 {
  0%, 54%, 78%, 100% { border-color: transparent; background: transparent; }
  58%, 74% { border-color: color-mix(in srgb, var(--au-done) 70%, transparent); background: color-mix(in srgb, var(--au-done) 10%, transparent); }
}

/* One page-load moment: the panel content settles in, then the board starts. */
.ab-head, .ab-title, .ab-lead, .ab-board { animation: au-rise 700ms var(--au-ease) both; }
.ab-title { animation-delay: 80ms; }
.ab-lead { animation-delay: 160ms; }
.ab-board { animation-name: au-rise-board; animation-delay: 240ms; animation-duration: 900ms; }
@keyframes au-rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes au-rise-board { from { opacity: 0; transform: translateY(22px) scale(0.98); } to { opacity: 1; transform: none; } }

/* ---------------------------------------------------------------- Form side */
.auth-form-wrap {
  position: relative; display: flex; flex-direction: column; justify-content: center; align-items: center;
  padding: 48px clamp(20px, 5vw, 72px) 28px; background: var(--au-paper);
}
[data-bs-theme="dark"] .auth-form-wrap { background: var(--tms-bg); }
.auth-mobile-head { display: none; }

.auth-card {
  width: 100%; max-width: 400px; padding: 0; background: transparent; border: 0; box-shadow: none;
  animation: au-rise 600ms var(--au-ease) 200ms both;
}
.auth-card .auth-title {
  font-family: var(--au-display); font-weight: 700; letter-spacing: -0.03em; font-variation-settings: "wdth" 90;
  font-size: clamp(1.7rem, 2.4vw, 2.1rem); line-height: 1.1; margin: 0 0 8px; color: var(--tms-text);
}
.auth-card h2 { font-family: var(--au-display); font-weight: 700; letter-spacing: -0.025em; }
.auth-sub { color: var(--tms-text-muted); margin: 0 0 28px; line-height: 1.55; max-width: 40ch; }

.auth-card .form-label { font-weight: 600; font-size: 0.875rem; color: var(--tms-text); }
.auth-card .form-control-lg {
  min-height: 52px; font-size: 1rem; border-radius: 12px; background: var(--tms-surface);
  border-color: var(--tms-border-strong); transition: border-color 160ms, box-shadow 160ms, background-color 160ms;
}
.auth-card .form-control-lg:hover { border-color: color-mix(in srgb, var(--tms-primary-interactive) 45%, var(--tms-border-strong)); }
.auth-card .form-control-lg:focus { border-color: var(--tms-primary-interactive); box-shadow: 0 0 0 4px color-mix(in srgb, var(--tms-primary-interactive) 16%, transparent); }

.field-icon { position: relative; }
.field-icon > i { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); color: var(--tms-text-muted); font-size: 1.05rem; pointer-events: none; transition: color 160ms; z-index: 1; }
.field-icon > .form-control { padding-left: 46px; }
.field-icon:focus-within > i { color: var(--tms-primary-interactive); }

.auth-card .btn-lg { min-height: 52px; border-radius: 12px; font-weight: 650; font-size: 1rem; }
.auth-submit, .auth-card .btn-primary.btn-lg {
  position: relative; overflow: hidden; display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  background: var(--au-navy); border-color: var(--au-navy);
  transition: background-color 180ms, transform 180ms var(--au-ease), box-shadow 180ms;
}
.auth-submit:hover, .auth-submit:focus-visible, .auth-card .btn-primary.btn-lg:hover, .auth-card .btn-primary.btn-lg:focus-visible { background: #133665; border-color: #133665; box-shadow: 0 10px 24px -10px rgba(14, 42, 79, 0.7); }
.auth-submit:active { transform: translateY(1px); }
.auth-submit i { transition: transform 220ms var(--au-ease); }
.auth-submit:hover i { transform: translateX(4px); }
/* A light sweep across the button on hover. */
.auth-submit::before {
  content: ""; position: absolute; inset: 0; transform: translateX(-120%);
  background: linear-gradient(100deg, transparent 30%, rgba(255, 255, 255, 0.22) 50%, transparent 70%);
}
.auth-submit:hover::before { transform: translateX(120%); transition: transform 700ms var(--au-ease); }
.auth-submit.is-loading::before { display: none; }
[data-bs-theme="dark"] .auth-submit, [data-bs-theme="dark"] .auth-card .btn-primary.btn-lg { background: var(--tms-primary-interactive); border-color: var(--tms-primary-interactive); }

.auth-note { display: flex; gap: 10px; align-items: flex-start; margin: 22px 0 0; padding: 12px 14px; border-radius: 12px; background: color-mix(in srgb, var(--tms-primary-interactive) 6%, transparent); color: var(--tms-text-muted); font-size: 0.82rem; line-height: 1.5; }
.auth-note i { color: var(--tms-primary-interactive); font-size: 1rem; margin-top: 1px; }
.auth-legal { margin: 36px 0 0; max-width: 400px; width: 100%; color: var(--tms-text-muted); font-size: 0.75rem; opacity: 0.85; }

.auth-step .auth-icon { width: 56px; height: 56px; border-radius: 16px; }

/* -------------------------------------------------------------- Responsive */
@media (max-width: 1199.98px) {
  .ab-col { min-height: 196px; }
  .ab-dim { display: none; }
}
@media (max-width: 991.98px) {
  .auth-page { grid-template-columns: 1fr; }
  .auth-brand { display: none; }
  .auth-form-wrap { justify-content: flex-start; padding: 0 0 32px; min-height: 100dvh; }
  .auth-mobile-head {
    display: flex; align-items: center; gap: 12px; width: 100%;
    padding: max(20px, env(safe-area-inset-top)) 20px 44px;
    margin-bottom: -24px; color: #fff;
    background:
      linear-gradient(var(--au-line) 1px, transparent 1px) 0 0 / 36px 36px,
      linear-gradient(90deg, var(--au-line) 1px, transparent 1px) 0 0 / 36px 36px,
      linear-gradient(160deg, var(--au-navy), var(--au-ink));
  }
  .auth-mobile-head .ab-logo { width: 46px; height: 46px; border-radius: 13px; padding: 5px; box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.12); }
  .auth-mobile-head .ab-agency strong { font-size: 0.95rem; }
  .auth-card {
    max-width: none; width: calc(100% - 32px); margin: 0 16px;
    padding: 26px 20px; border-radius: 18px; background: var(--tms-surface);
    border: 1px solid var(--tms-border); box-shadow: 0 18px 40px -22px rgba(8, 26, 51, 0.45);
  }
  .auth-legal { width: calc(100% - 32px); margin: 22px 16px 0; text-align: center; }
}

/* ----------------------------------------------------------- Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .ab-head, .ab-title, .ab-lead, .ab-board, .auth-card { animation: none; }
  .ab-mover, .ab-dot, .ab-bar span, .ab-check, .ab-toast, .ab-slot-2, .ab-slot-3 { animation: none; }
  .ab-mover { transform: translate(var(--step), 0); }
  .ab-dot { background: var(--au-progress); }
  .ab-bar span { width: 70%; }
  .auth-submit::before { display: none; }
}
