/* ============================================================
   Doc Chaser — UnitUp brand system
   Navy + vibrant blue, light-blue tints, rounded, soft shadows,
   bold geometric type. Modern, lively, trustworthy-but-fun.
   ============================================================ */
:root {
  --navy:      #15233d;
  --navy-soft: #223351;
  --blue:      #2563eb;
  --blue-600:  #1d4ed8;
  --blue-400:  #4c8dff;
  --blue-100:  #dbe7ff;
  --blue-50:   #eef4ff;
  --ink:       #33425a;
  --muted:     #6b7789;
  --bg:        #f5f8fe;
  --card:      #ffffff;
  --border:    #e5ebf5;
  --border-strong: #d3dcec;

  --ok-bg: #e4f6ec;  --ok-fg: #12844a;
  --warn-bg: #fdf1d6; --warn-fg: #9a6b00;
  --miss-bg: #fde6e2; --miss-fg: #c0392b;

  --radius:    16px;
  --radius-sm: 11px;
  --pill:      999px;
  --shadow-sm: 0 2px 8px rgba(21, 35, 61, .05);
  --shadow:    0 6px 22px rgba(21, 35, 61, .08);
  --shadow-lg: 0 14px 40px rgba(21, 35, 61, .13);
  --ring:      0 0 0 3px rgba(37, 99, 235, .18);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Plus Jakarta Sans", system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(1200px 380px at 50% -140px, #e6f0ff 0%, rgba(230,240,255,0) 70%),
    var(--bg);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  /* Safety net: nothing should ever force horizontal scroll (the old wide,
     non-wrapping topnav did on phones — see the .nav-toggle breakpoint below). */
  overflow-x: hidden;
}

/* ------------------------------- topbar ------------------------------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 1rem;
  padding: .7rem 1.25rem;
  /* Tall enough that the absolutely-centered signature credit (up to ~55px)
     never gets clipped top/bottom by the bar. */
  min-height: 68px;
  background: rgba(255, 255, 255, .82);
  backdrop-filter: saturate(160%) blur(10px);
  border-bottom: 1px solid var(--border);
}
.brand-block { display: flex; flex-direction: column; gap: .1rem; }
.brand { display: flex; align-items: center; gap: .55rem; text-decoration: none; }
.brand-row1 { display: flex; align-items: center; gap: .55rem; }
.logo-mark { display: block; border-radius: 10px; box-shadow: 0 4px 12px rgba(37,99,235,.35); }
.wordmark { font-weight: 800; font-size: 1.28rem; letter-spacing: -.02em; }
.wm-unit { color: var(--navy); }
.wm-up   { color: var(--blue); }
.brand-sub {
  margin-left: .1rem; padding: .12rem .5rem;
  background: var(--blue-50); color: var(--blue-600);
  font-size: .68rem; font-weight: 700; border-radius: var(--pill);
  text-transform: uppercase; letter-spacing: .04em;
  width: fit-content;
}
/* Signature credit — pinned to the EXACT horizontal+vertical center of the
   header, independent of the flex flow (position: sticky on .topbar gives this
   its containing block), so growing the logo never widens/crowds the brand or
   nav on either side. */
.sig-link {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  display: inline-flex; align-items: center; gap: 4px;
  text-decoration: none; opacity: .58; transition: opacity .2s;
  overflow: hidden; line-height: 0; width: fit-content; white-space: nowrap;
}
.sig-link:hover { opacity: .95; }
.sig-label { font-size: .42rem; font-weight: 600; letter-spacing: .02em; color: var(--muted); line-height: 1; }
.sig-img { height: 55px; width: auto; display: block; mix-blend-mode: multiply; }
.sig-link::after {
  content: ""; position: absolute; top: 0; left: -45%; width: 38%; height: 100%;
  background: linear-gradient(110deg, transparent, rgba(255, 255, 255, .9), transparent);
  transform: skewX(-20deg); animation: sigShine 8s ease-in-out infinite;
}
@keyframes sigShine { 0% { left: -45%; } 9% { left: 135%; } 100% { left: 135%; } }

.topnav { margin-left: auto; display: flex; align-items: center; gap: .3rem; }
.topnav a {
  color: var(--navy-soft); text-decoration: none; font-size: .92rem; font-weight: 600;
  padding: .42rem .8rem; border-radius: var(--pill); transition: background .15s, color .15s;
}
.topnav a:hover { background: var(--blue-50); color: var(--blue-600); }
.lang-switch { display: inline-flex; align-items: center; margin-left: .35rem;
  border: 1px solid var(--border-strong); border-radius: var(--pill); overflow: hidden; }
.lang-switch a { padding: .3rem .6rem; font-size: .78rem; font-weight: 800; text-decoration: none;
  color: var(--muted); transition: background .15s, color .15s; }
.lang-switch a.on { background: var(--blue); color: #fff; }
.lang-switch a:not(.on):hover { background: var(--blue-50); color: var(--blue-600); }
/* Hamburger toggle — hidden on wide screens, shown only under the mobile
   breakpoint below where the topnav collapses into a dropdown. */
.nav-toggle {
  display: none; flex-direction: column; justify-content: center; gap: 4px;
  width: 34px; height: 34px; padding: 0; margin-left: auto;
  background: transparent; border: none; box-shadow: none; cursor: pointer;
}
.nav-toggle:hover { background: transparent; transform: none; box-shadow: none; }
.nav-toggle span {
  display: block; width: 100%; height: 2.5px; border-radius: 2px;
  background: var(--navy); transition: transform .2s, opacity .2s;
}
.nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(6.5px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-6.5px) rotate(-45deg); }
.nav-user { font-size: .82rem; font-weight: 700; color: var(--navy); margin-left: .3rem;
  max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-logout { font-size: .82rem; font-weight: 600; color: var(--muted); text-decoration: none; }
.nav-logout:hover { color: var(--miss-fg); }
.panel.login-panel { max-width: 440px; margin: 4rem auto; text-align: center; }
.btn-google { background: #fff; color: var(--navy); border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-sm); font-size: 1rem; padding: .7rem 1.3rem; margin-top: .5rem; }
.btn-google:hover { background: var(--blue-50); color: var(--blue-600); transform: translateY(-1px); }

/* ------------------------------ layout ------------------------------ */
.container { max-width: 860px; margin: 0 auto; padding: 1.75rem 1.15rem 5rem; }
/* Frosted surface for text that would otherwise sit directly on the moving
   marble (new-case, archive header, QR capture, loose hints). Keeps the marble
   faintly visible through it while staying readable. */
.panel {
  background: rgba(255, 255, 255, .74);
  backdrop-filter: blur(9px) saturate(1.1);
  -webkit-backdrop-filter: blur(9px) saturate(1.1);
  border: 1px solid rgba(255, 255, 255, .65);
  border-radius: var(--radius); box-shadow: var(--shadow-sm);
  padding: 1.1rem 1.3rem; margin: 1rem 0;
}
.panel > :first-child { margin-top: 0; }
.panel > :last-child { margin-bottom: 0; }
/* Title box — a distinct frosted header with a soft blue EDGE GLOW (modern-app
   look), set apart from the plain .panel boxes for contrast. */
.titlebar {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
  background: rgba(255, 255, 255, .56);
  backdrop-filter: blur(11px) saturate(1.2);
  -webkit-backdrop-filter: blur(11px) saturate(1.2);
  border: 1px solid rgba(118, 160, 255, .45);
  border-radius: var(--radius); padding: .8rem 1.35rem; margin-bottom: 1.3rem;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .55),
              0 6px 20px rgba(21, 35, 61, .07),
              0 0 24px rgba(76, 141, 255, .30);
}
.titlebar.block { display: block; }
.titlebar h1 { margin: 0; text-shadow: none; }
.titlebar p { margin: .35rem 0 0; }
h1 { font-size: 1.75rem; font-weight: 800; letter-spacing: -.025em; color: var(--navy);
  margin: .3rem 0 .35rem; text-shadow: 0 1px 10px rgba(255, 255, 255, .85), 0 1px 2px rgba(255, 255, 255, .9); }
h2 { font-size: 1.2rem; font-weight: 700; letter-spacing: -.015em; color: var(--navy); }
.container > .muted, .hub-head + .muted { text-shadow: 0 1px 6px rgba(255, 255, 255, .8); }
h3 { font-size: 1.05rem; font-weight: 700; color: var(--navy); }
a { color: var(--blue-600); }
.muted { color: var(--muted); }
.small { font-size: .8rem; }
hr { border: none; border-top: 1px solid var(--border); margin: 1.75rem 0; }

/* --------------------------- forms & inputs --------------------------- */
.stack { display: flex; flex-direction: column; gap: 1rem; margin-top: 1rem; }
label { display: flex; flex-direction: column; gap: .35rem; font-weight: 600; color: var(--navy-soft); font-size: .92rem; }
input, select, textarea {
  font: inherit; padding: .62rem .75rem;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: #fff; color: var(--ink); transition: border-color .15s, box-shadow .15s;
}
input::placeholder, textarea::placeholder { color: #9aa4b4; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--blue); box-shadow: var(--ring); }
textarea { width: 100%; resize: vertical; }
input[type="checkbox"] { accent-color: var(--blue); width: 18px; height: 18px; }
input[type="file"] {
  padding: .5rem; background: var(--blue-50); border: 1px dashed var(--blue-100);
  border-radius: var(--radius-sm); cursor: pointer; font-size: .9rem;
}

/* ------------------------------ buttons ------------------------------ */
button, .btn {
  font: inherit; font-weight: 700; cursor: pointer;
  padding: .62rem 1.05rem; border-radius: var(--radius-sm); border: none;
  background: var(--blue); color: #fff; letter-spacing: -.01em;
  box-shadow: 0 4px 14px rgba(37, 99, 235, .28);
  transition: transform .12s ease, box-shadow .15s, background .15s;
}
button:hover, .btn:hover { background: var(--blue-600); transform: translateY(-1px); box-shadow: 0 7px 20px rgba(37, 99, 235, .34); }
button:active, .btn:active { transform: translateY(0); }
.btn-secondary {
  background: #fff; color: var(--navy); border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-sm);
}
.btn-secondary:hover { background: var(--blue-50); color: var(--blue-600); border-color: var(--blue-100); box-shadow: var(--shadow-sm); }
.btn-danger { background: #fff; color: #c0392b; border: 1px solid #e7c3bd; box-shadow: none; padding: .45rem .8rem; }
.btn-danger:hover { background: #fdecea; color: #a5281b; box-shadow: none; }
button[disabled] { opacity: .45; cursor: not-allowed; box-shadow: none; }
button[disabled]:hover { transform: none; background: var(--blue); }
.btn-secondary[disabled]:hover { background: #fff; color: var(--navy); }
.inline-form { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; margin-top: .7rem; }
.inline-form input { flex: 1; min-width: 170px; }

/* ------------------------------ cards ------------------------------ */
.applicant-card {
  background: rgba(255, 255, 255, .72);
  backdrop-filter: blur(9px) saturate(1.08); -webkit-backdrop-filter: blur(9px) saturate(1.08);
  border: 1px solid rgba(255, 255, 255, .6); border-radius: var(--radius);
  padding: 1.15rem 1.25rem; margin: 1.1rem 0; box-shadow: var(--shadow);
}
.applicant-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.applicant-head h2, .applicant-head h3 { margin: .2rem 0; }
.role-tag {
  font-size: .68rem; background: var(--blue-50); color: var(--blue-600);
  padding: .12rem .5rem; border-radius: var(--pill); font-weight: 700;
  vertical-align: middle; text-transform: uppercase; letter-spacing: .03em;
}

/* --------------------------- intake fieldsets --------------------------- */
.intake-form fieldset {
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  margin: .95rem 0; padding: .5rem 1.05rem 1rem;
}
.intake-form legend {
  font-weight: 800; font-size: .72rem; text-transform: uppercase; letter-spacing: .06em;
  color: var(--blue-600); padding: 0 .45rem;
}
.grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: .85rem; }
.grid label { font-weight: 500; }
.grid label.checkbox { flex-direction: row; align-items: center; gap: .55rem; font-weight: 600; color: var(--navy-soft); }
.grid label.checkbox input { width: auto; }
.full { grid-column: 1 / -1; }
.add-applicant { margin: 1rem 0 1.5rem; }

/* --------------------------- capture / docs --------------------------- */
.capture-strip {
  display: flex; align-items: center; gap: .85rem; flex-wrap: wrap;
  margin-top: 1rem; padding-top: .9rem; border-top: 1px dashed var(--border-strong);
  font-size: .9rem; font-weight: 600;
}
.sig-pad {
  width: 100%; max-width: 620px; height: 190px;
  border: 2px dashed var(--blue-100); border-radius: var(--radius-sm);
  background: linear-gradient(#fff, #fbfdff); touch-action: none; display: block;
}
.qr-wrap {
  width: 244px; max-width: 100%; margin: 1rem 0; padding: 14px;
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm);
}
.qr-wrap svg { width: 100%; height: auto; display: block; }
.status-row { display: flex; gap: 1rem; margin: 1rem 0; flex-wrap: wrap; font-weight: 600; }
.done      { color: var(--ok-fg); font-weight: 700; }
.pending   { color: var(--miss-fg); }
.later     { color: var(--warn-fg); font-weight: 700; }
.done-tag  { color: var(--ok-fg); font-size: .8rem; font-weight: 700; }
.later-tag { color: var(--warn-fg); font-size: .8rem; font-weight: 700; }
.later-opt { font-weight: 500; margin-top: .5rem; }
.done-banner { color: var(--ok-fg); font-weight: 800; font-size: 1.1rem; }
.capture-form section {
  margin: .5rem 0; padding: 1rem 1.1rem; background: rgba(255, 255, 255, .72);
  backdrop-filter: blur(9px) saturate(1.08); -webkit-backdrop-filter: blur(9px) saturate(1.08);
  border: 1px solid rgba(255, 255, 255, .6); border-radius: var(--radius); box-shadow: var(--shadow-sm);
}
.capture-form section h2 { margin-top: 0; font-size: 1.05rem; }
.doc-tag-slot:empty { display: none; }
/* Instant-upload camera button (agent's own-device capture only). */
.btn-camera {
  display: inline-flex; align-items: center; gap: .4rem;
  background: var(--blue-50); color: var(--blue-600); border: 1px dashed var(--blue-400);
  font-size: .88rem; margin: .3rem 0; box-shadow: none;
}
.btn-camera:hover { background: var(--blue-100); transform: none; box-shadow: none; }
.btn-camera[disabled] { opacity: .6; }
.camera-upload-status { margin-left: .5rem; }

/* ------------------------------ settings ------------------------------ */
table.agents { width: 100%; border-collapse: collapse; margin: .6rem 0; }
table.agents td { padding: .5rem .5rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.agents tr:last-child td { border-bottom: none; }

/* -------------------------------- hub -------------------------------- */
.hub-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(310px, 1fr)); gap: 1.15rem; margin-top: 1.25rem; }
.card {
  background: rgba(255, 255, 255, .72);
  backdrop-filter: blur(9px) saturate(1.08); -webkit-backdrop-filter: blur(9px) saturate(1.08);
  border: 1px solid rgba(255, 255, 255, .6); border-radius: var(--radius);
  padding: 1.15rem 1.2rem; box-shadow: var(--shadow);
  transition: transform .14s ease, box-shadow .18s ease, border-color .18s;
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: rgba(76, 141, 255, .4); }
.card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: .5rem; }
/* Big, high-contrast name + a distinct phone chip so an agent scanning the hub
   reads who + number at a glance. */
.card-title { display: flex; flex-direction: column; gap: .35rem; min-width: 0; }
.card-name {
  font-size: 1.42rem; font-weight: 800; line-height: 1.05; margin: 0;
  color: var(--navy); letter-spacing: -.02em;
}
.card-phone {
  display: inline-flex; align-items: center; gap: .4rem; align-self: flex-start;
  font-size: 1.02rem; font-weight: 800; letter-spacing: .01em;
  font-variant-numeric: tabular-nums; text-decoration: none;
  color: var(--blue-600); background: var(--blue-50);
  border: 1px solid var(--blue-100); border-radius: var(--pill);
  padding: .22rem .6rem;
}
.card-phone svg { flex-shrink: 0; opacity: .85; }
.card-phone:hover { background: var(--blue-100); }
.card-email {
  display: inline-flex; align-items: center; gap: .38rem; align-self: flex-start;
  font-size: .88rem; font-weight: 600; color: var(--navy-soft); text-decoration: none;
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.card-email svg { flex-shrink: 0; opacity: .6; }
.card-email:hover { color: var(--blue-600); text-decoration: underline; }
.card-top-right { display: flex; align-items: center; gap: .4rem; flex-shrink: 0; }
.card-top-right form { margin: 0; line-height: 0; }
.trash-btn {
  background: #fff; color: #c0392b; border: 1px solid #e7c3bd;
  padding: .3rem; border-radius: 8px; box-shadow: none; display: inline-flex; line-height: 0;
}
.trash-btn:hover { background: #fdecea; color: #a5281b; transform: none; box-shadow: none; }
.card-meta { margin: .45rem 0 .7rem; font-size: .9rem; color: var(--ink); }
.badge {
  font-size: .7rem; font-weight: 800; padding: .26rem .6rem; border-radius: var(--pill);
  white-space: nowrap; text-transform: uppercase; letter-spacing: .03em;
}
.badge.ok   { background: var(--ok-bg);   color: var(--ok-fg); }
.badge.later{ background: var(--warn-bg); color: var(--warn-fg); }
.badge.miss { background: var(--miss-bg); color: var(--miss-fg); }
.badge.pend { background: #eef1f6; color: var(--muted); }
.case-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .7rem; }

/* ------------------------------- demo mode ------------------------------- */
.demo-banner {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: center; gap: 1rem; flex-wrap: wrap;
  background: linear-gradient(90deg, #1d4ed8, #4c8dff); color: #fff;
  font-size: .84rem; font-weight: 600; padding: .5rem 1rem; text-align: center;
  box-shadow: 0 2px 10px rgba(21, 35, 61, .18);
}
.demo-banner a {
  color: #fff; text-decoration: underline; font-weight: 700; white-space: nowrap;
}
.login-or {
  display: flex; align-items: center; gap: .8rem; margin: 1.3rem 0 1rem; color: var(--muted);
  font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; font-weight: 700;
}
.login-or::before, .login-or::after {
  content: ""; flex: 1; height: 1px; background: var(--border);
}
.btn-demo {
  background: linear-gradient(135deg, #12844a, #23b26b); color: #fff;
  font-size: 1rem; padding: .7rem 1.3rem; width: 100%;
}
.btn-demo:hover { background: linear-gradient(135deg, #0f7040, #1e9e5e); transform: translateY(-1px); }
/* Distinct "finish the application" button — visually unlike the plain buttons
   so it clearly signals the end of the intake and the send-to-client step. */
.btn-finish {
  background: linear-gradient(135deg, #12844a, #23b26b);
  color: #fff; font-size: 1.02rem; font-weight: 800; letter-spacing: .01em;
  padding: .8rem 1.4rem; border: none; border-radius: var(--radius-sm);
  box-shadow: 0 8px 22px rgba(18, 132, 74, .32); cursor: pointer;
}
.btn-finish:hover {
  background: linear-gradient(135deg, #0f7040, #1fa460);
  transform: translateY(-1px); box-shadow: 0 10px 26px rgba(18, 132, 74, .4);
}
.person-phone {
  margin-left: .4rem; font-size: .8rem; font-weight: 600; color: var(--blue-600);
  text-decoration: none; white-space: nowrap;
}
.person-phone:hover { text-decoration: underline; }
.card-notes { display: flex; flex-direction: column; gap: .45rem; margin: .6rem 0; }
.card-notes textarea { font-size: .88rem; }
.card-actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.card-actions button { padding: .48rem .8rem; font-size: .88rem; }
.small-btn { align-self: flex-start; padding: .32rem .65rem !important; font-size: .8rem !important; box-shadow: none !important; }

/* --------------------- client-facing welcome (mobile) --------------------- */
.welcome {
  background: linear-gradient(135deg, #2563eb 0%, #4c8dff 100%);
  color: #fff; border-radius: var(--radius); padding: 1.2rem 1.25rem;
  margin: .5rem 0 1.25rem; box-shadow: 0 10px 26px rgba(37, 99, 235, .28);
}
.welcome-hi { margin: 0 0 .35rem; font-size: 1.35rem; font-weight: 800; letter-spacing: -.02em; }
.welcome-sub { margin: 0; font-size: .95rem; line-height: 1.5; color: rgba(255, 255, 255, .92); }
.welcome-bldg {
  margin: .7rem 0 0; font-size: .78rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .05em; color: rgba(255, 255, 255, .8);
}
/* Auto-hiding welcome: collapses away after JS adds .fade-out, revealing form. */
.welcome[data-autohide] {
  overflow: hidden;
  transition: opacity .5s ease, transform .5s ease, max-height .55s ease,
              margin .5s ease, padding .5s ease;
  max-height: 340px;
}
.welcome[data-autohide].fade-out {
  opacity: 0; transform: translateY(-8px);
  max-height: 0; margin-top: 0; margin-bottom: 0;
  padding-top: 0; padding-bottom: 0;
}

/* ---------------------- micro-animations (feel alive) ---------------------- */
@keyframes fadeInUp { from { opacity: 0; transform: translateY(9px); } to { opacity: 1; transform: none; } }
@keyframes popIn { 0% { opacity: 0; transform: scale(.8); } 60% { transform: scale(1.06); } 100% { opacity: 1; transform: scale(1); } }

.container { animation: fadeInUp .4s ease both; }
.card { animation: fadeInUp .45s cubic-bezier(.2,.7,.3,1) both; }
.cards .card:nth-child(1) { animation-delay: .03s; }
.cards .card:nth-child(2) { animation-delay: .08s; }
.cards .card:nth-child(3) { animation-delay: .13s; }
.cards .card:nth-child(4) { animation-delay: .18s; }
.cards .card:nth-child(5) { animation-delay: .23s; }
.cards .card:nth-child(6) { animation-delay: .28s; }
.badge { animation: popIn .4s ease both; }
.welcome { animation: fadeInUp .5s cubic-bezier(.2,.7,.3,1) both; }
.done-tag, .later-tag { display: inline-block; animation: popIn .35s ease both; }
.logo-mark { transition: transform .25s ease; }
.brand:hover .logo-mark { transform: rotate(-6deg) scale(1.06); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important; animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
}

/* ---------------------- expandable hub card (people) ---------------------- */
.card-people { margin: .4rem 0 .7rem; }
.card-people > summary {
  cursor: pointer; list-style: none; font-size: .85rem; font-weight: 700;
  color: var(--blue-600); padding: .3rem 0; user-select: none;
}
.card-people > summary::-webkit-details-marker { display: none; }
.card-people > summary::before { content: "▸ "; display: inline-block; transition: transform .15s; }
.card-people[open] > summary::before { transform: rotate(90deg); }
.people-list { list-style: none; padding: 0; margin: .3rem 0 0; display: flex; flex-direction: column; gap: .5rem; }
.people-list li {
  display: flex; flex-wrap: wrap; align-items: center; gap: .5rem;
  padding: .5rem .65rem; background: var(--blue-50); border-radius: var(--radius-sm); font-size: .85rem;
}
.person-name { font-weight: 700; color: var(--navy); margin-right: auto; }

/* -------------------- looped "shiny glass" sweep on send -------------------- */
.btn-shine { position: relative; overflow: hidden; }
.btn-shine::after {
  content: ""; position: absolute; top: 0; left: -75%; width: 45%; height: 100%;
  background: linear-gradient(120deg, transparent, rgba(255, 255, 255, .55), transparent);
  transform: skewX(-20deg); animation: shine 2.6s ease-in-out infinite; pointer-events: none;
}
@keyframes shine { 0% { left: -75%; } 55%, 100% { left: 130%; } }

/* ---------------------- send celebration (emoji rain) ---------------------- */
.confetti-emoji {
  position: fixed; top: -8vh; z-index: 9999; pointer-events: none;
  animation-name: fall; animation-timing-function: cubic-bezier(.3,.2,.6,1); animation-fill-mode: forwards;
  will-change: transform, opacity;
}
@keyframes fall {
  0%   { transform: translateY(-10vh) rotate(0deg);   opacity: 0; }
  10%  { opacity: 1; }
  100% { transform: translateY(112vh) rotate(340deg); opacity: .95; }
}
@media (prefers-reduced-motion: reduce) {
  .btn-shine::after { animation: none; display: none; }
}

/* ---------------------- per-person document checklist ---------------------- */
.doc-checklist { list-style: none; padding: 0; margin: .8rem 0 .6rem; display: flex; flex-direction: column; gap: .5rem; }
.doc-row { display: flex; align-items: center; gap: .6rem; padding: .55rem .7rem;
  background: var(--blue-50); border-radius: var(--radius-sm); flex-wrap: wrap; }
.doc-status { font-weight: 800; width: 1.2rem; text-align: center; }
.doc-name { font-weight: 600; color: var(--navy); margin-right: auto; }
.doc-action { display: flex; align-items: center; gap: .4rem; margin: 0; }
.doc-action input[type="file"] { max-width: 190px; font-size: .8rem; padding: .3rem; }
/* One upload form per applicant: a Browse per document + a single Upload button. */
.doc-upload { margin: 0; }
.doc-file { max-width: 210px; font-size: .8rem; padding: .3rem; }
.doc-upload-btn { margin-top: .55rem; }
/* Hub "Upload docs" button once everything's collected. */
.btn-done, .btn-done:hover {
  background: var(--ok-bg); color: var(--ok-fg);
  border: 1px solid #b7e6c9; box-shadow: none;
}
.doc-action .checkbox { flex-direction: row; align-items: center; gap: .4rem; font-weight: 600; color: var(--navy-soft); }

/* ------------------------- Certn credit bubble ------------------------- */
.has-certn .applicant-head { flex-wrap: wrap; }
.has-certn .applicant-head h3 { margin-right: auto; }
.certn-bubble {
  display: inline-flex; align-items: center; gap: .4rem; margin: 0;
  padding: .28rem .5rem .28rem .45rem; background: #fff;
  border: 1.5px solid var(--border-strong); border-radius: var(--pill);
  box-shadow: var(--shadow-sm); transition: border-color .2s, background .2s;
}
.certn-bubble.on { border-color: #2bb673; background: #e9f8f0; animation: certnPop .45s cubic-bezier(.3, 1.35, .5, 1) both; }
@keyframes certnPop { 0% { transform: scale(.82); } 55% { transform: scale(1.1); } 100% { transform: scale(1); } }
.certn-bubble.on .certn-dot { animation: certnGlow 1.8s ease-in-out; }
@keyframes certnGlow {
  0% { box-shadow: inset 0 0 0 2px #fff, 0 0 0 rgba(35, 178, 107, 0); }
  30% { box-shadow: inset 0 0 0 2px #fff, 0 0 12px rgba(35, 178, 107, .9); }
  100% { box-shadow: inset 0 0 0 2px #fff, 0 0 8px rgba(35, 178, 107, .6); }
}
.certn-toggle {
  display: inline-flex; flex-direction: row; align-items: center; gap: .4rem;
  cursor: pointer; font-weight: 700; font-size: .82rem; color: var(--navy-soft);
  white-space: nowrap;
}
.certn-toggle input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.certn-dot {
  flex: 0 0 auto; width: 14px; height: 14px; border-radius: 50%; background: #cfd6e2;
  box-shadow: inset 0 0 0 2px #fff; transition: background .2s, box-shadow .2s;
}
.certn-bubble.on .certn-dot { background: #23b26b; box-shadow: inset 0 0 0 2px #fff, 0 0 8px rgba(35,178,107,.6); }
.certn-bubble.on .certn-toggle { color: #12844a; }
.certn-score {
  display: none; width: 74px; padding: .26rem .4rem; font-size: .82rem;
  border-radius: var(--pill); text-align: center;
}
.certn-bubble.on .certn-score { display: inline-block; }
.certn-save {
  display: none; padding: .26rem .6rem !important; font-size: .78rem !important; box-shadow: none !important;
}
.certn-bubble.dirty .certn-save { display: inline-flex; }

/* Address autocomplete dropdown (Photon/OSM) under an address input. */
.addr-suggest {
  position: absolute; top: 100%; left: 0; right: 0; z-index: 30;
  margin-top: 2px; background: #fff; border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm); box-shadow: var(--shadow); overflow: hidden;
  max-height: 260px; overflow-y: auto;
}
.addr-opt {
  padding: .5rem .7rem; font-size: .88rem; color: var(--navy); cursor: pointer;
  font-weight: 500; border-bottom: 1px solid var(--border);
}
.addr-opt:last-child { border-bottom: none; }
.addr-opt:hover, .addr-opt.on { background: var(--blue-50); color: var(--blue-600); }

/* Loading veil shown while a send completes (after the confetti). */
#app-loading {
  position: fixed; inset: 0; z-index: 50; display: flex; align-items: center;
  justify-content: center; background: rgba(21, 35, 61, .32);
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  animation: fadeIn .2s ease;
}
.app-loading-box {
  background: #fff; border-radius: var(--radius); padding: 1.6rem 2rem;
  box-shadow: var(--shadow-lg); text-align: center; color: var(--navy);
  font-weight: 700; font-size: .98rem;
}
.app-loading-box p { margin: .9rem 0 0; }
.app-spinner {
  width: 42px; height: 42px; margin: 0 auto; border-radius: 50%;
  border: 4px solid var(--blue-100); border-top-color: var(--blue-600);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* Auto-save confirmation flash (notes + certn) — hidden until a save lands. */
.autosave-flag {
  opacity: 0; transition: opacity .2s; font-size: .72rem; font-weight: 700;
  color: #12844a; letter-spacing: .01em; pointer-events: none; white-space: nowrap;
}
.autosave-flag.show { opacity: .85; }

/* ------------ flowing liquid-marble background (WebGL, liquid-bg.js) ------------ */
#bg-canvas {
  position: fixed; inset: 0; width: 100vw; height: 100vh;
  z-index: -1; display: block; pointer-events: none;
}

/* ------------------------------ archive filters ------------------------------ */
.archive-filters { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; margin: 1rem 0 1.4rem; }
.archive-filters input[type="search"] { flex: 1; min-width: 160px; }
.archive-filters .clear-link { font-size: .85rem; font-weight: 600; }

/* -------------------------------- archive -------------------------------- */
/* One big translucent "vault" that engulfs every archived client, so the rows
   read as sitting inside one calm surface instead of floating on the marble.
   Cooler/bluer tint than the plain .panel boxes for contrast. */
.archive-vault {
  background: linear-gradient(180deg, rgba(219, 231, 255, .34), rgba(238, 244, 255, .26));
  backdrop-filter: blur(13px) saturate(1.25);
  -webkit-backdrop-filter: blur(13px) saturate(1.25);
  border: 1px solid rgba(219, 231, 255, .7);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: .5rem 1.35rem 1.35rem;
}
.archive-vault .year-group:first-child { margin-top: .6rem; }
.year-group { margin: 1.5rem 0; }
.year-label {
  font-size: 1.7rem; font-weight: 800; color: var(--navy); letter-spacing: -.02em;
  padding-bottom: .3rem; border-bottom: 3px solid var(--blue-100); margin-bottom: .6rem;
  text-shadow: 0 1px 10px rgba(255, 255, 255, .9);
}
.month-group { margin: 1rem 0 1.2rem; }
.month-label {
  font-size: .78rem; font-weight: 800; text-transform: uppercase; letter-spacing: .08em;
  color: var(--blue-600); margin: .8rem 0 .4rem;
  display: inline-block; background: rgba(255, 255, 255, .7); backdrop-filter: blur(6px);
  padding: .2rem .55rem; border-radius: var(--pill);
}
.archive-stack { display: flex; flex-direction: column; gap: .35rem; }
/* Inner rows are flatter (no drop shadow, lighter fill) because the vault
   already provides the frosted surface — they read as rows, not floating cards. */
.arch-card {
  background: rgba(255, 255, 255, .5);
  border: 1px solid rgba(255, 255, 255, .55); border-radius: var(--radius-sm);
  overflow: hidden; transition: background .15s, border-color .15s;
}
.arch-card:hover { background: rgba(255, 255, 255, .72); border-color: var(--blue-100); }
.arch-card[open] { background: rgba(255, 255, 255, .66); }
.arch-card > summary {
  display: flex; align-items: center; gap: .8rem; cursor: pointer; list-style: none;
  padding: .6rem .9rem; font-size: .92rem;
}
.arch-card > summary::-webkit-details-marker { display: none; }
.arch-card > summary::before { content: "▸"; color: var(--blue-400); font-size: .8rem; transition: transform .15s; }
.arch-card[open] > summary::before { transform: rotate(90deg); }
.arch-name { font-weight: 700; color: var(--navy); }
.arch-bldg { color: var(--ink); margin-right: auto; }
.arch-date { color: var(--muted); font-size: .82rem; white-space: nowrap; }
.arch-body { padding: 0 .9rem .9rem 2rem; border-top: 1px solid var(--border); }
.arch-actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.arch-body p { margin: .6rem 0; }
.arch-people { list-style: none; padding: 0; margin: .5rem 0; display: flex; flex-direction: column; gap: .35rem; }
.arch-people li { font-weight: 600; color: var(--navy); }
@media (max-width: 480px) {
  .arch-card > summary { flex-wrap: wrap; }
  .arch-bldg { margin-right: 0; width: 100%; font-size: .85rem; }
}

/* (signature credit now lives under the brand wordmark in the header — see
   .brand-block / .sig-link near the top of this file) */

/* ------------------------------ notice ------------------------------ */
.notice {
  background: var(--warn-bg); border: 1px solid #f0dfa8; color: #7a5a00;
  padding: .8rem 1rem; border-radius: var(--radius-sm); margin: 1rem 0; font-size: .92rem;
}

/* ---------------------------- responsive ---------------------------- */
@media (max-width: 560px) {
  .grid { grid-template-columns: 1fr; }
  /* "Doc Chaser" drops to its own line under "UnitUp" instead of disappearing —
     there's no room for it inline once the icon+wordmark are on screen.
     align-items: flex-start (not stretch) keeps the pill sized to its own text
     instead of stretching across the whole header. */
  .brand { flex-direction: column; align-items: flex-start; gap: .2rem; }
  .brand-sub { margin-left: 0; }
  /* Phone only: drop the "created by" text, keep just the signature logo. */
  .sig-label { display: none; }
  .container { padding: 1.25rem .9rem 4rem; }
  h1 { font-size: 1.5rem; }
}

/* Hamburger menu: below this width the full link row (Hub / New case / Archive
   / Settings / lang / user / logout) doesn't fit and used to force the whole
   page to scroll sideways. Collapse it into a toggleable dropdown instead. */
@media (max-width: 780px) {
  .nav-toggle { display: flex; }
  .topnav {
    display: none; position: absolute; top: 100%; left: 0; right: 0;
    margin-left: 0; flex-direction: column; align-items: stretch; gap: .2rem;
    background: rgba(255, 255, 255, .97); backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--border); box-shadow: var(--shadow);
    padding: .6rem .9rem 1rem;
  }
  .topnav.open { display: flex; }
  .topnav a { padding: .65rem .9rem; border-radius: var(--radius-sm); }
  .lang-switch, .nav-user, .nav-logout { margin-left: 0; }
  .lang-switch { align-self: flex-start; margin-top: .3rem; }
  .nav-user { margin-top: .5rem; max-width: none; }
}

/* Phone-width blur reduction: WebKit/iOS Safari has to recomposite every
   backdrop-filter blur behind these frosted panels on every animated frame of
   the marble, and that cost is what actually stalls the animation on a phone —
   not weak hardware (even a modern iPhone can trip the perf watchdog in
   liquid-bg.js at full blur). Roughly halving the radii here cuts that cost
   well before the watchdog needs to freeze the marble, giving capable phones a
   real shot at running the full 60fps animation. Still looks frosted, just
   slightly crisper. (Paired with a lower WebGL RENDER_SCALE on touch devices —
   see liquid-bg.js.) */
@media (max-width: 600px) {
  .topbar { backdrop-filter: saturate(160%) blur(5px); }
  .panel, .titlebar { backdrop-filter: blur(5px) saturate(1.1); -webkit-backdrop-filter: blur(5px) saturate(1.1); }
  .applicant-card, .capture-form section, .card {
    backdrop-filter: blur(5px) saturate(1.08); -webkit-backdrop-filter: blur(5px) saturate(1.08);
  }
  .archive-vault { backdrop-filter: blur(7px) saturate(1.25); -webkit-backdrop-filter: blur(7px) saturate(1.25); }
}
