/* ==========================================================================
   AVEX Masonry portal — design system
   White canvas, espresso brown from the AVEX mark, warm amber accent.
   Plus Jakarta Sans for display, Inter for everything else.
   ========================================================================== */

:root {
  /* Taken from the AVEX mark: espresso brown and the warm amber from the
     wedges. Amber is a fill colour, not a text colour — it has nowhere near
     enough contrast on white — so anything readable uses --accent-strong. */

  /* surfaces */
  --bg: #ffffff;
  --surface: #ffffff;
  --surface-2: #faf8f6;
  --surface-3: #f3eeea;
  --line: #ece5df;
  --line-strong: #dacfc6;

  /* type */
  --ink: #2e1512;
  --text: #4a3a35;
  --muted: #8a7a73;

  /* brand */
  --accent: #e8963c;
  --accent-strong: #a85f12;
  --accent-hover: #d4842c;
  --accent-soft: #fdf3e8;
  --ring: rgba(232, 150, 60, 0.3);

  /* status */
  --green: #0b7d57;
  --green-soft: #e8f6f0;
  --amber: #a85f12;
  --amber-soft: #fdf3e8;
  --red: #b23b2c;
  --red-soft: #fbeceb;

  /* geometry */
  --r-sm: 9px;
  --r: 13px;
  --r-lg: 18px;
  --r-pill: 100px;

  --shadow-sm: 0 1px 2px rgba(46, 21, 18, 0.06);
  --shadow: 0 1px 2px rgba(46, 21, 18, 0.05), 0 4px 16px rgba(46, 21, 18, 0.06);
  --shadow-lg: 0 2px 4px rgba(46, 21, 18, 0.05), 0 18px 44px rgba(46, 21, 18, 0.10);

  --display: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

* { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: 15.5px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "cv05" 1, "cv11" 1;
}

h1, h2, h3, .display {
  font-family: var(--display);
  color: var(--ink);
  letter-spacing: -0.025em;
  font-weight: 700;
  margin: 0;
}

h1 { font-size: 1.6rem; line-height: 1.2; }
h2 { font-size: 1rem; }
p  { margin: 0 0 .75rem; }

a {
  color: var(--accent-strong);
  text-decoration: none;
  text-underline-offset: 3px;
}
a:hover { text-decoration: underline; }

hr { border: 0; border-top: 1px solid var(--line); margin: 1.5rem 0; }

::selection { background: var(--ink); color: #fff; }

.wrap { max-width: 1040px; margin: 0 auto; padding: 0 20px; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.mono  { font-family: var(--mono); font-size: .9em; }
.nowrap { white-space: nowrap; }
.pad { padding: 1.25rem 0; }
.pad-b { margin-bottom: .85rem; }
.inline { display: inline; }
.end { display: flex; align-items: flex-end; }
.tnum { font-variant-numeric: tabular-nums; }

/* ------------------------------- brand ---------------------------------- */

.brand { display: flex; align-items: center; gap: .6rem; }

/*
 * The logo file is a tall lockup on white with a lot of margin. In the top
 * bar only the M is wanted, so the image is used as a background and shifted
 * so just that part shows. Numbers are derived from where the mark sits in
 * the 1240x1030 artwork.
 */
.brand-mark {
  display: block; flex: none;
  width: 52px; height: 35px;
  background-image: url("/avex-logo.jpg");
  background-repeat: no-repeat;
  background-size: 184px 155px;
  background-position: -73px -47px;
}

.brand-name {
  font-family: var(--display);
  font-weight: 700; font-size: .84rem;
  text-transform: uppercase; letter-spacing: .12em;
  color: var(--ink);
}
.brand-name em {
  font-style: normal; font-weight: 500; color: var(--muted);
  text-transform: none; letter-spacing: .02em;
  margin-left: .3rem;
}

/*
 * The full lockup, trimmed of the artwork's surrounding margin.
 *
 * The content sits at x 255-1070, y 315-687 inside the 1240x1030 file. At a
 * rendered width of 353px that scales to 232x106, offset -73 and -90 — the
 * numbers below are those, and the smaller variants are the same ratios.
 */
.auth-logo-plate {
  width: 232px; height: 106px; overflow: hidden;
  margin: 0 auto 1.6rem;
}
.auth-logo-plate .auth-logo {
  display: block;
  width: 353px; height: auto;
  margin: -90px 0 0 -73px;
  max-width: none;
}
.auth-logo-plate-sm { width: 185px; height: 85px; margin-bottom: 1.3rem; }
.auth-logo-plate-sm .auth-logo { width: 282px; margin: -72px 0 0 -58px; }

/* ------------------------------ top bar --------------------------------- */

.topbar {
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20;
}
.topbar-in {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; min-height: 62px;
}

.mainnav { display: flex; align-items: center; gap: .15rem; flex-wrap: wrap; }
.mainnav a {
  padding: .4rem .75rem; border-radius: var(--r-pill);
  color: var(--muted); font-size: .9rem; font-weight: 500;
  transition: background .15s var(--ease), color .15s var(--ease);
}
.mainnav a:hover { background: var(--surface-3); color: var(--ink); text-decoration: none; }
.mainnav a.on { background: var(--ink); color: #fff; font-weight: 600; }
.mainnav .logout { margin-left: .35rem; }

/* ------------------------------- auth ----------------------------------- */

.auth-wrap {
  min-height: 100vh; display: grid; place-items: center; padding: 32px 20px;
  background:
    radial-gradient(900px 520px at 50% -10%, var(--accent-soft), transparent 70%),
    var(--bg);
}

/* ------------------------- split sign-in page ---------------------------- */

.auth-split { min-height: 100vh; display: grid; grid-template-columns: 1fr; }
@media (min-width: 900px) {
  .auth-split { grid-template-columns: 1.05fr 1fr; }
}

.auth-panel {
  position: relative; overflow: hidden;
  background: var(--ink);
  display: flex; align-items: center; justify-content: center;
  padding: 48px 32px;
}

/*
 * Angled bands echoing the wedges in the mark. Kept very low contrast —
 * it should read as texture behind the logo, not as a pattern competing
 * with it.
 */
.auth-panel::before {
  content: ""; position: absolute; inset: -20%;
  background: repeating-linear-gradient(
    -24deg,
    rgba(232, 150, 60, 0.07) 0 2px,
    transparent 2px 26px
  );
}
/* A warm pool of light behind the logo so it is not floating on flat brown. */
.auth-panel::after {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(660px 420px at 50% 42%, rgba(232, 150, 60, 0.17), transparent 68%);
}

.auth-panel-in { position: relative; z-index: 1; text-align: center; max-width: 380px; }

/* The artwork is on white, so it sits on its own plate against the brown. */
.auth-panel .auth-logo-plate {
  background: var(--bg);
  border-radius: var(--r-lg);
  padding: 22px 26px;
  width: 284px; height: 150px;
  margin-bottom: 0;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.3);
}
.auth-panel .auth-logo-plate .auth-logo { width: 353px; margin: -90px 0 0 -73px; }

.auth-form-side {
  display: flex; align-items: center; justify-content: center;
  padding: 48px 24px; background: var(--bg);
}
.auth-form-side .auth-card {
  box-shadow: none; border: 0; padding: 0; max-width: 360px;
}

/*
 * Phone and tablet: the split has stacked, so the brown panel is no longer
 * a panel — it is a slab of colour above the form taking up screen a phone
 * does not have. Everything but the logo comes off, and the logo sits on
 * the white page by itself.
 */
@media (max-width: 899px) {
  /* Rows hug their content instead of the stacked grid sharing the viewport
     between them, which otherwise drops the logo into the middle of nowhere. */
  .auth-split { align-content: start; }
  .auth-panel {
    background: none;
    padding: 40px 24px 4px;
    align-items: flex-end;
  }
  .auth-panel::before, .auth-panel::after { display: none; }
  /* No plate here, so the box IS the crop window: it has to match the
     artwork exactly or the mark gets clipped and sits off-centre. At a
     282px-wide image the logo occupies 185 x 85, offset 58 across and 72
     down. Same numbers as .auth-logo-plate-sm. */
  .auth-panel .auth-logo-plate {
    background: none; box-shadow: none;
    width: 187px; height: 87px; padding: 0; margin: 0 auto;
  }
  /* The exact crop is 185x85 at -72/-58. One extra pixel on every side, so
     rounding can never shave the A or the top of the mark. */
  .auth-panel .auth-logo-plate .auth-logo { width: 282px; margin: -71px 0 0 -57px; }
  .auth-form-side { padding: 18px 22px 44px; align-items: flex-start; }
}
.auth-card {
  width: 100%; max-width: 396px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 34px 30px;
  box-shadow: var(--shadow-lg);
}
.auth-card h1 { margin-top: 1.4rem; font-size: 1.65rem; }
.auth-card h1 + p { margin-top: .35rem; }
.auth-foot {
  margin: 1.5rem 0 0; padding-top: 1.1rem;
  border-top: 1px solid var(--line);
  font-size: .85rem;
}

/* ------------------------------- forms ---------------------------------- */

label {
  display: block; font-size: .82rem; font-weight: 600; color: var(--ink);
  margin: 1rem 0 .35rem; letter-spacing: -0.005em;
}
label .muted { font-weight: 400; letter-spacing: 0; }

input[type="text"], input[type="email"], input[type="password"], input[type="number"],
input[type="date"], input:not([type]), select, textarea {
  width: 100%; padding: .62rem .8rem;
  font: inherit; font-size: .94rem;
  color: var(--ink); background: var(--surface);
  border: 1px solid var(--line-strong); border-radius: var(--r-sm);
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}
textarea { resize: vertical; line-height: 1.55; }
::placeholder { color: #b3a49c; }

input:hover, select:hover, textarea:hover { border-color: #c6b8ad; }

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3.5px var(--ring);
}
input[disabled] { background: var(--surface-2); color: var(--muted); }

select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%238a7a73' stroke-width='1.6' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right .7rem center;
  padding-right: 2rem;
}

.chk {
  display: flex; align-items: flex-start; gap: .55rem;
  font-weight: 400; font-size: .88rem; color: var(--text);
  margin: .7rem 0 0;
}
.chk input { width: auto; margin-top: .22rem; accent-color: var(--accent); }

.radio-row { display: flex; gap: 1.5rem; flex-wrap: wrap; margin-bottom: .75rem; }
.radio-row label {
  display: flex; align-items: center; gap: .45rem;
  margin: 0; font-weight: 500; font-size: .9rem;
}
.radio-row input { width: auto; accent-color: var(--accent); }

.stack > button { margin-top: 1.35rem; }
.grid2 { display: grid; gap: 0 1.15rem; grid-template-columns: 1fr; }
@media (min-width: 640px) { .grid2 { grid-template-columns: 1fr 1fr; } }

.grid3 { display: grid; gap: 0 .8rem; grid-template-columns: 1fr 1fr 1fr; }

/* ------------------------------ buttons --------------------------------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: .6rem 1.05rem;
  font: inherit; font-size: .89rem; font-weight: 600; line-height: 1.25;
  letter-spacing: -0.005em;
  cursor: pointer; white-space: nowrap;
  color: var(--ink); background: var(--surface);
  border: 1px solid var(--line-strong); border-radius: var(--r-sm);
  transition: background .15s var(--ease), border-color .15s var(--ease),
              color .15s var(--ease), transform .08s var(--ease);
}
.btn:hover { background: var(--surface-2); border-color: #c6b8ad; text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: none; box-shadow: 0 0 0 3.5px var(--ring); }

.btn-primary {
  background: var(--ink); border-color: var(--ink); color: #fff;
  box-shadow: var(--shadow-sm);
}
.btn-primary:hover { background: #45241f; border-color: #45241f; color: #fff; }

.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--surface-3); color: var(--ink); border-color: transparent; }

.btn-danger { color: var(--red); border-color: #e8c7c1; background: var(--surface); }
.btn-danger:hover { background: var(--red-soft); border-color: var(--red); color: var(--red); }

.btn-sm { padding: .34rem .68rem; font-size: .8rem; border-radius: 7px; }
.btn-block { width: 100%; margin-top: 1.5rem; padding: .7rem 1rem; font-size: .95rem; }

.mv {
  font: inherit; font-size: .7rem; line-height: 1; cursor: pointer;
  padding: .34rem .42rem; color: var(--muted);
  background: var(--surface); border: 1px solid var(--line-strong);
  border-radius: 6px;
  transition: all .12s var(--ease);
}
.mv:hover { color: #fff; background: var(--ink); border-color: var(--ink); }
.mv:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--ring); }
.moves { display: flex; gap: 3px; }

/* ------------------------------- cards ---------------------------------- */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
}
.card-quiet { box-shadow: none; background: var(--surface-2); border-color: transparent; }
.card-danger { border-color: #eed4cf; background: #fffbfa; }

.card-title {
  font-family: var(--font);
  font-size: .71rem; text-transform: uppercase; letter-spacing: .1em;
  color: var(--muted); font-weight: 600;
  margin: 0 0 .9rem;
}
.count {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 20px; margin-left: .45rem; padding: 0 .4rem; height: 20px;
  background: var(--surface-3); border-radius: var(--r-pill);
  font-size: .72rem; letter-spacing: 0; color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* ------------------------------- flashes -------------------------------- */

.flash {
  display: flex; align-items: center; gap: .6rem;
  padding: .8rem 1rem; border-radius: var(--r);
  margin: 1.1rem 0; font-size: .9rem; font-weight: 500;
  border: 1px solid var(--line);
  background: var(--surface-2); color: var(--text);
}
.flash::before {
  content: ""; width: 7px; height: 7px; border-radius: 50%;
  background: var(--muted); flex: none;
}
.flash-ok  { background: var(--green-soft); border-color: #c3e6d6; color: #0a5540; }
.flash-ok::before { background: var(--green); }
.flash-err { background: var(--red-soft); border-color: #eec9c4; color: #872c20; }
.flash-err::before { background: var(--red); }

.warn {
  padding: .85rem 1rem; border-radius: var(--r);
  background: var(--amber-soft); border: 1px solid #f0dcbc;
  font-size: .9rem; color: #7c4a12;
}

/* =========================== CLIENT PORTAL =============================== */

.portal { padding-top: 34px; padding-bottom: 72px; }

.portal-head { margin-bottom: 24px; }
.portal-head h1 {
  font-size: clamp(1.8rem, 5vw, 2.2rem);
  font-weight: 800; letter-spacing: -0.035em;
}
.portal-head > .muted { margin-top: .3rem; font-size: .95rem; }
.scope {
  margin-top: .65rem; color: var(--text); font-size: .95rem;
  max-width: 62ch;
}

.switcher { display: flex; align-items: center; gap: .6rem; margin-top: 1.1rem; }
.switcher label { margin: 0; }
.switcher select { width: auto; min-width: 220px; }

/* tabs -------------------------------------------------------------------- */

/* Plain links, not JavaScript: the tab survives a refresh, works with the
   back button, and the progress poll cannot knock the client off the tab
   they are reading. */
.tabs {
  display: flex; gap: 4px;
  margin-bottom: 22px;
  padding: 4px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }

.tab {
  flex: 1 1 0; min-width: max-content;
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
  padding: .6rem 1.1rem;
  border-radius: var(--r-pill);
  font-size: .92rem; font-weight: 600; white-space: nowrap;
  color: var(--muted); text-decoration: none;
  transition: background .15s var(--ease), color .15s var(--ease);
}
.tab:hover { color: var(--ink); text-decoration: none; }
.tab.on {
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 1px 3px rgba(0, 0, 0, .09);
}

.tab-count {
  display: inline-block; min-width: 1.35em;
  padding: .05rem .38rem;
  font-size: .72rem; font-weight: 700; line-height: 1.5;
  text-align: center;
  color: var(--accent-strong); background: var(--accent-soft);
  border-radius: var(--r-pill);
}

.empty {
  margin: 0; padding: 1.6rem 0;
  color: var(--muted); font-size: .95rem; text-align: center;
}

/* hero -------------------------------------------------------------------- */

.hero {
  position: relative; overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 30px 26px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
}
.hero::before {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(620px 240px at 0% 0%, var(--accent-soft), transparent 68%);
  pointer-events: none;
}
.hero > * { position: relative; }

.hero-label,
.stat-label {
  font-size: .71rem; text-transform: uppercase; letter-spacing: .1em;
  color: var(--muted); font-weight: 600;
}

.hero-stage {
  font-family: var(--display);
  font-size: clamp(1.9rem, 6vw, 2.5rem);
  font-weight: 800; letter-spacing: -0.04em; line-height: 1.08;
  color: var(--ink);
  margin: .4rem 0 1.35rem;
}

.bar {
  height: 10px; border-radius: var(--r-pill);
  background: var(--surface-3); overflow: hidden;
}
.bar-fill {
  height: 100%; border-radius: var(--r-pill);
  background: linear-gradient(90deg, #f2b872, var(--accent));
  transition: width .6s var(--ease);
}
.hero-meta {
  margin-top: .7rem; font-size: .85rem; color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* stat cards -------------------------------------------------------------- */

.stats { display: grid; gap: 20px; grid-template-columns: 1fr; margin-bottom: 20px; }
@media (min-width: 640px) { .stats { grid-template-columns: 1fr 1fr; } }

.stat {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); padding: 24px; box-shadow: var(--shadow);
}
.stat-value {
  font-family: var(--display);
  font-size: 2.45rem; font-weight: 800; letter-spacing: -0.045em;
  line-height: 1.05; color: var(--accent-strong);
  margin: .3rem 0 .35rem;
  font-variant-numeric: tabular-nums;
}
.stat-value-sm {
  font-size: 1.4rem; letter-spacing: -0.03em; color: var(--ink);
  line-height: 1.25;
}
.stat-of { font-size: 1.1rem; font-weight: 600; color: var(--muted); letter-spacing: -0.02em; }
.stat-note { font-size: .85rem; color: var(--muted); }

/* Where you are, as a filling bar rather than a number. */
.band {
  display: flex; gap: 5px; list-style: none;
  margin: .7rem 0 .6rem; padding: 0;
}
.band-step {
  flex: 1; height: 6px; border-radius: var(--r-pill);
  background: var(--surface-3);
}
.band-step.on { background: var(--accent); }

.band-date {
  display: inline-block; margin-bottom: .45rem;
  font-size: .82rem; font-weight: 700; letter-spacing: -0.01em;
  color: var(--accent-strong); background: var(--accent-soft);
  padding: .22rem .6rem; border-radius: var(--r-pill);
}
/* Work actually happening reads green, not "pending" amber. */
.band-date-live { color: var(--green); background: var(--green-soft); }

.note-body { margin: 0; color: var(--text); }

/* timeline ---------------------------------------------------------------- */

/* duration / anticipated finish ------------------------------------------- */

.est { margin-bottom: .9rem; }
.est-row {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 1rem; padding: .6rem 0; border-bottom: 1px solid var(--line);
}
.est-row:last-child { border-bottom: 0; }
.est-label {
  font-size: .73rem; text-transform: uppercase; letter-spacing: .09em;
  color: var(--muted); font-weight: 600; white-space: nowrap;
}
.est-value {
  font-family: var(--display); font-weight: 700; font-size: 1.05rem;
  letter-spacing: -0.02em; color: var(--ink); text-align: right;
}
.est-note { font-size: .84rem; color: var(--muted); margin: 0; }

.timeline { list-style: none; margin: 0; padding: 0; }
.tl {
  display: flex; align-items: center; gap: .85rem;
  padding: .5rem 0; position: relative; font-size: .95rem;
}
.tl::before {
  content: ""; position: absolute; left: 6px; top: 0; bottom: 0;
  width: 2px; background: var(--line);
}
.tl:first-child::before { top: 50%; }
.tl:last-child::before  { bottom: 50%; }

.tl-dot {
  width: 14px; height: 14px; border-radius: 50%; flex: none; z-index: 1;
  background: var(--surface); border: 2px solid var(--line-strong);
}
.tl-done .tl-dot { background: var(--accent); border-color: var(--accent); }
.tl-current .tl-dot {
  background: var(--surface); border-color: var(--accent); border-width: 3px;
  box-shadow: 0 0 0 5px var(--ring);
}
.tl-body { display: flex; flex-direction: column; gap: .1rem; flex: 1; }
.tl-name { line-height: 1.35; }
.tl-done .tl-name     { color: var(--muted); }
.tl-current .tl-name  { font-weight: 700; color: var(--ink); font-family: var(--display); letter-spacing: -0.02em; }
.tl-upcoming .tl-name { color: #a89a93; }

.tl-date {
  font-size: .78rem; font-weight: 600; letter-spacing: .01em;
  color: var(--accent-strong);
}
.tl-upcoming .tl-date { color: var(--muted); font-weight: 500; }

.tl-tag {
  font-size: .66rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em;
  color: var(--accent-strong); background: var(--accent-soft);
  padding: .2rem .5rem; border-radius: var(--r-pill);
}

/* project log ------------------------------------------------------------- */

.updates { list-style: none; margin: 0; padding: 0; }
.updates li {
  padding: .85rem 0; border-bottom: 1px solid var(--line); font-size: .95rem;
}
.updates li:first-child { padding-top: 0; }
.updates li:last-child { border-bottom: 0; padding-bottom: 0; }
.upd-date {
  display: block; font-size: .74rem; color: var(--muted);
  font-weight: 600; text-transform: uppercase; letter-spacing: .06em;
  margin-bottom: .2rem;
}

details summary {
  cursor: pointer; font-size: .88rem; color: var(--accent-strong);
  font-weight: 600; list-style: none;
}
details summary::-webkit-details-marker { display: none; }
details summary::before { content: "+ "; font-weight: 700; }
details[open] summary::before { content: "− "; }
details[open] summary { margin-bottom: .6rem; }

.portal-foot {
  margin-top: 40px; padding-top: 24px; border-top: 1px solid var(--line);
  font-size: .9rem; color: var(--muted);
}

/* ============================== ADMIN ==================================== */

.admin { padding-top: 30px; padding-bottom: 72px; }

.pagehead {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 1rem; flex-wrap: wrap; margin-bottom: 22px;
}
.pagehead h1 { font-size: 1.75rem; font-weight: 800; letter-spacing: -0.035em; }
.pagehead .muted { margin: .25rem 0 0; font-size: .92rem; }
.head-actions { display: flex; gap: .5rem; flex-wrap: wrap; }

/* tables ------------------------------------------------------------------ */

.tablewrap { overflow-x: auto; margin: 0 -6px; padding: 0 6px; }
.tbl { width: 100%; border-collapse: collapse; font-size: .91rem; }
.tbl th {
  text-align: left; font-size: .69rem; text-transform: uppercase;
  letter-spacing: .09em; color: var(--muted); font-weight: 600;
  padding: 0 .55rem .55rem; border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.tbl td {
  padding: .8rem .55rem; border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.tbl tbody tr { transition: background .12s var(--ease); }
.tbl tbody tr:hover { background: var(--surface-2); }
.tbl tr:last-child td { border-bottom: 0; }

.tbl .pos {
  font-family: var(--display); font-weight: 800; font-size: 1rem;
  color: var(--ink); font-variant-numeric: tabular-nums;
  letter-spacing: -0.03em;
}
.tbl .moves-cell { width: 1%; }

.row-title {
  font-family: var(--display); font-weight: 700; font-size: .96rem;
  color: var(--ink); letter-spacing: -0.02em;
}
.row-title:hover { color: var(--accent-strong); text-decoration: none; }

.row-eye {
  display: inline-block; margin-left: .5rem;
  font-size: .72rem; font-weight: 600; color: var(--muted);
  border-bottom: 1px dotted var(--line-strong);
}
.row-eye:hover { color: var(--accent-strong); text-decoration: none; }
.row-off { opacity: .5; }
.sel { min-width: 180px; }

/* pills ------------------------------------------------------------------- */

.pill {
  display: inline-block; padding: .2rem .6rem; border-radius: var(--r-pill);
  font-size: .74rem; font-weight: 600; letter-spacing: -0.005em;
  background: var(--surface-3); color: var(--muted);
}
.pill-active   { color: var(--green); background: var(--green-soft); }
.pill-on_hold  { color: var(--amber); background: var(--amber-soft); }
.pill-complete { color: var(--muted); background: var(--surface-3); }

/* admin log list ---------------------------------------------------------- */

.upd-list { list-style: none; margin: 1.5rem 0 0; padding: 0; }
.upd-row {
  display: flex; gap: 1rem; align-items: flex-start; justify-content: space-between;
  padding: .9rem 0; border-bottom: 1px solid var(--line); flex-wrap: wrap;
}
.upd-row:last-child { border-bottom: 0; padding-bottom: 0; }
.upd-row.is-hidden { opacity: .55; }
.upd-main { flex: 1 1 280px; }
.upd-text { font-size: .93rem; margin-bottom: .25rem; color: var(--ink); }
.upd-actions { display: flex; gap: .4rem; }

/* credentials hand-off ---------------------------------------------------- */

.cred {
  margin: 1.25rem 0 1.75rem;
  border: 1px solid var(--line); border-radius: var(--r);
  overflow: hidden;
}
.cred > div {
  display: flex; gap: 1rem; padding: .8rem 1rem;
  border-bottom: 1px solid var(--line); flex-wrap: wrap;
  background: var(--surface-2);
}
.cred > div:last-child { border-bottom: 0; }
.cred-k {
  min-width: 118px; font-size: .71rem; text-transform: uppercase;
  letter-spacing: .09em; color: var(--muted); font-weight: 600;
  padding-top: .18rem;
}
.cred-v { font-size: 1rem; word-break: break-all; color: var(--ink); font-weight: 500; }
.cred-v.mono { font-family: var(--mono); font-size: 1.05rem; color: var(--accent-strong); font-weight: 600; }

/* client documents --------------------------------------------------------- */

.hero-done {
  display: inline-block; margin: -.7rem 0 1.1rem;
  font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .07em;
  color: var(--green); background: var(--green-soft);
  padding: .22rem .6rem; border-radius: var(--r-pill);
}

.docs { list-style: none; margin: 0; padding: 0; }
.docs li { margin-bottom: .5rem; }
.docs li:last-child { margin-bottom: 0; }

.doc-link {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: .85rem 1rem;
  border: 1px solid var(--line-strong); border-radius: var(--r);
  background: var(--surface); color: var(--ink); text-decoration: none;
  transition: border-color .15s var(--ease), background .15s var(--ease);
}
.doc-link:hover { border-color: var(--accent); background: var(--accent-soft); text-decoration: none; }
.doc-name { font-weight: 600; font-size: .95rem; }
.doc-name::before { content: "\\1F4C4"; margin-right: .5rem; }
.doc-date { font-size: .82rem; color: var(--muted); white-space: nowrap; }

.doc-group + .doc-group, .shot-group + .shot-group { margin-top: 1.6rem; }
.group-title {
  font-family: var(--font);
  font-size: .78rem; font-weight: 600; color: var(--muted);
  text-transform: uppercase; letter-spacing: .08em;
  margin: 0 0 .6rem;
}

/* photos ------------------------------------------------------------------ */

.shots {
  display: grid; gap: 10px;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
}
/* Each thumbnail is a link that opens the full-size image in a new tab —
   far better on a phone than scrolling a column of full-width photos. */
.shot { display: block; margin: 0; color: inherit; text-decoration: none; }
.shot img {
  width: 100%; aspect-ratio: 4 / 3; object-fit: cover;
  border-radius: var(--r); border: 1px solid var(--line);
  background: var(--surface-3); display: block;
  transition: border-color .15s var(--ease), transform .15s var(--ease);
}
.shot:hover img { border-color: var(--accent); transform: translateY(-2px); }
.shot-cap {
  display: block;
  font-size: .78rem; color: var(--muted); margin-top: .35rem; line-height: 1.35;
}

/* photo admin -------------------------------------------------------------- */

.shot-admin {
  display: grid; gap: 14px;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
}
.shot-tile img {
  width: 100%; aspect-ratio: 4 / 3; object-fit: cover;
  border-radius: var(--r); border: 1px solid var(--line);
  background: var(--surface-3); display: block;
}
.shot-tile.is-hidden img { opacity: .5; }
.shot-meta { display: flex; align-items: center; gap: .4rem; margin: .45rem 0 .2rem; }
.shot-actions { display: flex; gap: .35rem; margin-top: .45rem; }

input[type="file"] {
  width: 100%; padding: .55rem .7rem; font: inherit; font-size: .9rem;
  border: 1px dashed var(--line-strong); border-radius: var(--r-sm);
  background: var(--surface-2); color: var(--text);
}

/* QC check ---------------------------------------------------------------- */

.qc-stats { margin-bottom: 20px; }
.stat-ok  { color: var(--green); }
.stat-bad { color: var(--accent-strong); }
.tbl .right, th.right { text-align: right; }
.diff-bad { color: var(--red); font-weight: 600; }

.pill-qc-match     { color: var(--green); background: var(--green-soft); }
.pill-qc-mismatch  { color: var(--red);   background: var(--red-soft); }
.pill-qc-missing   { color: var(--amber); background: var(--amber-soft); }
.pill-qc-unchecked { color: var(--muted); background: var(--surface-3); }

.sync-note {
  display: inline-block; margin-top: .3rem;
  font-size: .72rem; font-weight: 600; letter-spacing: .02em;
  color: var(--amber); background: var(--amber-soft);
  padding: .12rem .45rem; border-radius: var(--r-pill);
}

/* live client view --------------------------------------------------------- */

.live {
  display: grid; gap: 24px; align-items: start;
  grid-template-columns: 1fr;
}
@media (min-width: 900px) {
  .live { grid-template-columns: minmax(0, 1fr) 400px; }
  /* The preview sticks while you work down a long form. */
  .live-view { position: sticky; top: 86px; }
}

.live-edit { margin-bottom: 0; }

.phone {
  border: 1px solid var(--line-strong);
  border-radius: 22px;
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.phone-top {
  display: flex; align-items: center; gap: .5rem;
  padding: .7rem 1rem;
  background: var(--ink);
  font-size: .75rem; font-weight: 600; letter-spacing: .03em;
  color: #fff;
}
.phone-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); flex: none; }
.phone-label { opacity: .85; }

.phone-screen {
  padding: 22px 18px 26px;
  background: var(--bg);
  max-height: 72vh; overflow-y: auto;
}
.phone-screen .portal-head h1 { font-size: 1.45rem; }
.phone-screen .portal-head { margin-bottom: 18px; }
.phone-screen .hero { padding: 20px 18px; }
.phone-screen .hero-stage { font-size: 1.7rem; }
.phone-screen .card, .phone-screen .stat { padding: 18px 16px; }

/* The stat pair must stack in a narrow pane — the media query that drives
   it keys off the window, not this column. */
.live-preview .stats { grid-template-columns: 1fr; gap: 16px; }

/* import ------------------------------------------------------------------ */

.steps { margin: 0; padding-left: 1.25rem; font-size: .93rem; }
.steps li { margin-bottom: .45rem; }
.steps li:last-child { margin-bottom: 0; }
.btn-spaced { margin-top: 1.25rem; }
.tbl td input[type="checkbox"] { width: auto; accent-color: var(--accent); }

/* stages ------------------------------------------------------------------ */

.wording {
  padding: 1rem 0;
  border-top: 1px solid var(--line);
}
.wording:first-of-type { border-top: 0; padding-top: 0; }
.wording-head {
  font-family: var(--display); font-weight: 700; font-size: .95rem;
  color: var(--ink); letter-spacing: -0.02em;
}
.wording-head .muted { font-family: var(--font); font-weight: 400; font-size: .82rem; }

.stage-list { list-style: none; margin: 0 0 1.25rem; padding: 0; }
.stage-row {
  display: flex; align-items: center; gap: .55rem; flex-wrap: wrap;
  padding: .5rem 0; border-bottom: 1px solid var(--line);
}
.stage-row:last-child { border-bottom: 0; }
.stage-form { display: flex; align-items: center; gap: .55rem; flex: 1 1 280px; }
.stage-form input { flex: 1; }
.stage-form .muted.mono { min-width: 1.4rem; text-align: right; }

/* --------------------------- admin density -------------------------------
 * The console is a working tool, not a page to be read — it wants more rows
 * on screen and a quieter type scale than the customer-facing portal, where
 * the bigger sizes are doing a job. Everything here is scoped to
 * body.admin so none of it can reach the client side.
 *
 * Note rem is relative to <html>, not <body>, so shrinking the base size
 * does not cascade into rem-sized rules. Each one is restated below.
 * ------------------------------------------------------------------------ */

body.admin { font-size: 14px; }

body.admin .admin { padding-top: 24px; }

body.admin .pagehead { margin-bottom: 18px; }
body.admin .pagehead h1 { font-size: 1.35rem; }
body.admin .pagehead .muted { font-size: .81rem; }

body.admin .mainnav a { padding: .34rem .62rem; font-size: .81rem; }
body.admin .topbar-in { min-height: 54px; }

body.admin .card { padding: 19px 20px; }
body.admin .card-title { font-size: .9rem; }

/* The queue table is where the size really told: 38 rows at 143px each. */
body.admin .tbl { font-size: .83rem; }
body.admin .tbl th { font-size: .64rem; padding: 0 .5rem .45rem; }
body.admin .tbl td { padding: .55rem .5rem; }
body.admin .tbl .pos { font-size: .88rem; }
body.admin .row-title { font-size: .87rem; }
body.admin .row-eye { font-size: .67rem; margin-left: .4rem; }
body.admin .sel { min-width: 152px; }

body.admin .pill { font-size: .69rem; padding: .16rem .5rem; }
body.admin .btn { font-size: .83rem; }
body.admin .btn-sm { font-size: .75rem; padding: .3rem .6rem; }

body.admin label { font-size: .78rem; }
body.admin input, body.admin select, body.admin textarea { font-size: .87rem; }
body.admin .small, body.admin .muted.small { font-size: .78rem; }

/*
 * ...but the console's scale stops at the edge of the client preview. That
 * panel exists to show exactly what the customer sees, so it keeps the
 * portal's own sizes — otherwise the one screen you check your wording on
 * is the one screen that lies to you.
 */
body.admin .phone-screen { font-size: 15.5px; }
body.admin .phone-screen .card, body.admin .phone-screen .stat { padding: 18px 16px; }
body.admin .phone-screen .card-title { font-size: .73rem; }
body.admin .phone-screen .pill { font-size: .74rem; padding: .2rem .6rem; }
body.admin .phone-screen .small, body.admin .phone-screen .muted.small { font-size: .85rem; }
body.admin .phone-screen .btn { font-size: .89rem; }

/* ------------------------------ responsive ------------------------------- */

@media (max-width: 560px) {
  .topbar-in { min-height: 56px; }
  .mainnav a { padding: .35rem .6rem; font-size: .85rem; }
  .card, .hero, .stat { padding: 20px 18px; border-radius: 15px; }
  .portal { padding-top: 24px; }
  .auth-card { padding: 28px 22px; }
}

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

/* ----- progress widths (CSP-safe: no inline style attributes) ----- */

.bar-fill.p0{width:0%}
.bar-fill.p1{width:1%}
.bar-fill.p2{width:2%}
.bar-fill.p3{width:3%}
.bar-fill.p4{width:4%}
.bar-fill.p5{width:5%}
.bar-fill.p6{width:6%}
.bar-fill.p7{width:7%}
.bar-fill.p8{width:8%}
.bar-fill.p9{width:9%}
.bar-fill.p10{width:10%}
.bar-fill.p11{width:11%}
.bar-fill.p12{width:12%}
.bar-fill.p13{width:13%}
.bar-fill.p14{width:14%}
.bar-fill.p15{width:15%}
.bar-fill.p16{width:16%}
.bar-fill.p17{width:17%}
.bar-fill.p18{width:18%}
.bar-fill.p19{width:19%}
.bar-fill.p20{width:20%}
.bar-fill.p21{width:21%}
.bar-fill.p22{width:22%}
.bar-fill.p23{width:23%}
.bar-fill.p24{width:24%}
.bar-fill.p25{width:25%}
.bar-fill.p26{width:26%}
.bar-fill.p27{width:27%}
.bar-fill.p28{width:28%}
.bar-fill.p29{width:29%}
.bar-fill.p30{width:30%}
.bar-fill.p31{width:31%}
.bar-fill.p32{width:32%}
.bar-fill.p33{width:33%}
.bar-fill.p34{width:34%}
.bar-fill.p35{width:35%}
.bar-fill.p36{width:36%}
.bar-fill.p37{width:37%}
.bar-fill.p38{width:38%}
.bar-fill.p39{width:39%}
.bar-fill.p40{width:40%}
.bar-fill.p41{width:41%}
.bar-fill.p42{width:42%}
.bar-fill.p43{width:43%}
.bar-fill.p44{width:44%}
.bar-fill.p45{width:45%}
.bar-fill.p46{width:46%}
.bar-fill.p47{width:47%}
.bar-fill.p48{width:48%}
.bar-fill.p49{width:49%}
.bar-fill.p50{width:50%}
.bar-fill.p51{width:51%}
.bar-fill.p52{width:52%}
.bar-fill.p53{width:53%}
.bar-fill.p54{width:54%}
.bar-fill.p55{width:55%}
.bar-fill.p56{width:56%}
.bar-fill.p57{width:57%}
.bar-fill.p58{width:58%}
.bar-fill.p59{width:59%}
.bar-fill.p60{width:60%}
.bar-fill.p61{width:61%}
.bar-fill.p62{width:62%}
.bar-fill.p63{width:63%}
.bar-fill.p64{width:64%}
.bar-fill.p65{width:65%}
.bar-fill.p66{width:66%}
.bar-fill.p67{width:67%}
.bar-fill.p68{width:68%}
.bar-fill.p69{width:69%}
.bar-fill.p70{width:70%}
.bar-fill.p71{width:71%}
.bar-fill.p72{width:72%}
.bar-fill.p73{width:73%}
.bar-fill.p74{width:74%}
.bar-fill.p75{width:75%}
.bar-fill.p76{width:76%}
.bar-fill.p77{width:77%}
.bar-fill.p78{width:78%}
.bar-fill.p79{width:79%}
.bar-fill.p80{width:80%}
.bar-fill.p81{width:81%}
.bar-fill.p82{width:82%}
.bar-fill.p83{width:83%}
.bar-fill.p84{width:84%}
.bar-fill.p85{width:85%}
.bar-fill.p86{width:86%}
.bar-fill.p87{width:87%}
.bar-fill.p88{width:88%}
.bar-fill.p89{width:89%}
.bar-fill.p90{width:90%}
.bar-fill.p91{width:91%}
.bar-fill.p92{width:92%}
.bar-fill.p93{width:93%}
.bar-fill.p94{width:94%}
.bar-fill.p95{width:95%}
.bar-fill.p96{width:96%}
.bar-fill.p97{width:97%}
.bar-fill.p98{width:98%}
.bar-fill.p99{width:99%}
.bar-fill.p100{width:100%}
