/* =====================================================================
   Duncan & Grove Yard PWA stylesheet — app-shell edition.

   Aesthetic: a tactile, craft-grade work app. Dark forest topbar with
   subtle wood-grain depth, warm cream surface, soft-shadow cards with
   rounded corners, pill chips, generous hit targets. Fraunces (display)
   pairs with Manrope (body) — distinctive, organic, anti-generic.
   Sharp where it matters (CTAs, hit zones), soft everywhere else.
   ===================================================================== */

:root {
  /* Canonical D&G palette. */
  --forest:        #2C3E2D;
  --forest-light:  #3a5240;
  --forest-deep:   #1f2c20;
  --oak:           #8B6914;
  --oak-light:     #C49A25;
  --oak-glow:      #E2B948;
  --cream:         #F5F0E8;
  --cream-deep:    #EBE3D5;
  --bark:          #4A3728;
  --sage:          #7A8C6E;
  --sage-soft:     #B5C2A8;
  --charcoal:      #1C1C1C;
  --mist:          #E8EDE5;
  --dg-red:        #C0392B;
  --white:         #ffffff;

  --success:       var(--sage);
  --success-light: #eafaf1;
  --warning:       #b07400;
  --warning-light: #fef9e7;
  --danger:        var(--dg-red);
  --danger-light:  #fdf2f2;

  --shadow-sm:     0 1px 2px rgba(28, 28, 28, 0.04);
  --shadow:        0 6px 20px -8px rgba(28, 28, 28, 0.12), 0 2px 4px rgba(28, 28, 28, 0.04);
  --shadow-md:     0 12px 32px -12px rgba(28, 28, 28, 0.18), 0 4px 8px rgba(28, 28, 28, 0.06);
  --shadow-lg:     0 -16px 40px -8px rgba(28, 28, 28, 0.18);
  --shadow-glow:   0 12px 32px -10px rgba(44, 62, 45, 0.45);

  --radius:        14px;
  --radius-sm:     10px;
  --radius-photo:  10px;
  --radius-pill:   999px;

  /* Type scale. */
  --fs-display: 32px;
  --fs-h1:      26px;
  --fs-title:   20px;
  --fs-body:    17px;
  --fs-meta:    13px;
  --fs-micro:   11px;

  --topbar-h:    64px;
  --hit-min:     56px;
  --hit-primary: 60px;
  --gutter:      18px;
  --gap:         14px;

  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-top:    env(safe-area-inset-top, 0px);

  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-out:    cubic-bezier(0.22, 0.61, 0.36, 1);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--cream);
  color: var(--charcoal);
  font-family: 'Manrope', system-ui, sans-serif;
  font-feature-settings: "ss01", "cv11";
  font-variant-numeric: tabular-nums;
  font-size: var(--fs-body);
  line-height: 1.45;
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overscroll-behavior-y: contain;
}
body { min-height: 100dvh; }
button { font: inherit; }
input { font: inherit; }
a { color: var(--forest); }

h1, h2, h3 { font-family: 'Fraunces', 'Playfair Display', Georgia, serif; font-weight: 500; letter-spacing: -0.01em; }

/* ── App shell ─────────────────────────────────────────────────── */
.app-shell {
  display: flex; flex-direction: column;
  min-height: 100dvh;
}

/* ── Topbar ────────────────────────────────────────────────────── */
.topbar {
  position: sticky; top: 0; z-index: 10;
  height: calc(var(--topbar-h) + var(--safe-top));
  padding-top: var(--safe-top);
  background: var(--forest);
  color: var(--cream);
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  padding: var(--safe-top) 16px 0;
  gap: 16px;
  border-bottom: 1px solid var(--forest-deep);
}
.topbar > * { position: relative; z-index: 1; }

.topbar__brand-mark {
  display: inline-flex; align-items: center; gap: 10px;
  font-family: 'Fraunces', serif;
  font-weight: 500;
  font-size: 20px;
  letter-spacing: 0.02em;
  color: var(--cream);
}
.topbar__logo {
  width: 32px; height: 32px;
  display: block;
  object-fit: contain;
}
.topbar__brand {
  font-size: var(--fs-micro);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(245, 240, 232, 0.55);
}
.topbar__crumb {
  font-size: var(--fs-micro);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(245, 240, 232, 0.7);
  text-align: center;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.topbar__user {
  justify-self: end;
  display: inline-flex; align-items: center; gap: 12px;
}
.topbar__avatar {
  width: 32px; height: 32px;
  background: var(--oak);
  color: var(--cream);
  font-weight: 700; font-size: 12px;
  font-family: 'Manrope', sans-serif;
  letter-spacing: 0.02em;
  border-radius: var(--radius-pill);
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.topbar__name {
  font-size: 14px;
  font-weight: 600;
  color: var(--cream);
  letter-spacing: 0.01em;
  max-width: 120px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.topbar__signout {
  width: 40px; height: 40px;
  border: 0;
  background: transparent;
  color: rgba(245, 240, 232, 0.75);
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--radius-pill);
  margin-right: -6px;
  transition: background 120ms, color 120ms;
}
.topbar__signout:hover { color: var(--cream); }
.topbar__signout:active { background: rgba(255,255,255,0.08); }
.topbar__signout svg { width: 22px; height: 22px; }
.topbar__back {
  width: 40px; height: 40px; border: 0; background: transparent;
  color: var(--cream); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  margin-left: -6px;
  border-radius: var(--radius-pill);
  transition: background 120ms;
}
.topbar__back:active { background: rgba(255,255,255,0.08); }
.topbar__back svg { width: 24px; height: 24px; }

/* ── Sync strip ────────────────────────────────────────────────── */
.syncstrip {
  margin: 14px var(--gutter) 6px;
  height: 28px;
  background: rgba(122, 140, 110, 0.12);
  color: var(--forest);
  font-size: var(--fs-micro);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-pill);
  font-weight: 600;
}
.syncstrip::before {
  content: "";
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--sage);
  margin-right: 8px;
  box-shadow: 0 0 0 0 rgba(122, 140, 110, 0.6);
  animation: pulse 2.4s ease-out infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(122, 140, 110, 0.6); }
  70% { box-shadow: 0 0 0 8px rgba(122, 140, 110, 0); }
  100% { box-shadow: 0 0 0 0 rgba(122, 140, 110, 0); }
}

/* ── Banners (offline / syncing) ──────────────────────────────── */
.banner {
  font-size: var(--fs-meta);
  margin: 0 var(--gutter) 8px;
  padding: 12px 14px;
  display: flex; align-items: center; gap: 10px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
}
.banner--warning {
  background: var(--warning-light); color: var(--warning);
  border-color: rgba(176, 116, 0, 0.18);
}
.banner--info {
  background: var(--mist); color: var(--forest);
  border-color: rgba(44, 62, 45, 0.12);
}
.banner svg { width: 18px; height: 18px; flex-shrink: 0; }

/* ── Login ─────────────────────────────────────────────────────── */
.login {
  min-height: 100dvh;
  background: var(--forest);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 32px 24px;
  position: relative;
  overflow: hidden;
  color: var(--cream);
}
.login__hero {
  position: relative; z-index: 1;
  display: flex; flex-direction: column; align-items: center; gap: 16px;
  margin-bottom: 36px;
}
.login__logo {
  width: 72px; height: 72px;
  display: block;
  object-fit: contain;
}
.login__brand {
  color: var(--cream);
  font-family: 'Fraunces', serif;
  font-weight: 400;
  font-size: 36px;
  letter-spacing: -0.01em;
  text-align: center;
}
.login__brand em { font-style: italic; color: var(--oak-light); }
.login__sub {
  color: rgba(245, 240, 232, 0.55);
  font-size: var(--fs-micro);
  letter-spacing: 0.28em;
  text-transform: uppercase;
  font-weight: 600;
}
.login__form {
  width: 100%; max-width: 380px;
  display: flex; flex-direction: column; gap: 10px;
  position: relative; z-index: 1;
  background: var(--forest-deep);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 20px;
  padding: 22px;
}
.login__input-row { position: relative; }
.login__input {
  width: 100%; height: 56px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.06);
  color: var(--cream);
  font-size: var(--fs-body); padding: 0 16px;
  outline-offset: 2px;
  transition: border-color 160ms, background 160ms;
}
.login__input::placeholder { color: rgba(245, 240, 232, 0.4); }
.login__input:focus {
  outline: none;
  border-color: var(--oak);
  background: rgba(255, 255, 255, 0.08);
}
.login__input--password { padding-right: 56px; }
.login__eye {
  position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
  width: 56px; height: 56px; border: 0; background: transparent;
  color: rgba(245, 240, 232, 0.6); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
}
.login__eye svg { width: 22px; height: 22px; }
.login__btn {
  height: var(--hit-primary); border: 0;
  border-radius: var(--radius-sm);
  background: var(--oak);
  color: var(--cream);
  font-weight: 700; font-size: var(--fs-body);
  letter-spacing: 0.01em;
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  transition: transform 100ms, background 160ms;
}
.login__btn:active { transform: scale(0.98); }
.login__btn[disabled] { opacity: 0.6; cursor: progress; }
.login__btn--google {
  background: rgba(255, 255, 255, 0.08);
  color: var(--cream);
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow: none;
  margin-top: 4px;
}
.login__error {
  color: #ff8a7a;
  font-size: 14px;
  min-height: 20px;
  font-weight: 500;
}
.login__error--shake { animation: shake 200ms ease-in-out; }
.login__caps {
  font-size: var(--fs-meta);
  color: var(--oak-light);
}
.login__helper {
  margin-top: 18px;
  color: rgba(245, 240, 232, 0.45);
  font-size: var(--fs-meta);
  text-align: center;
  letter-spacing: 0.05em;
  position: relative; z-index: 1;
}
.login__divider {
  margin: 8px 0 0;
  display: flex; align-items: center; gap: 12px;
  color: rgba(245, 240, 232, 0.4);
  font-size: var(--fs-micro);
  text-transform: uppercase; letter-spacing: 0.25em;
  font-weight: 600;
}
.login__divider::before,
.login__divider::after {
  content: ""; flex: 1; height: 1px;
  background: rgba(255,255,255,0.1);
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%      { transform: translateX(-6px); }
  40%      { transform: translateX(6px); }
  60%      { transform: translateX(-4px); }
  80%      { transform: translateX(4px); }
}

/* ── Queue ─────────────────────────────────────────────────────── */
.queue {
  padding: 4px var(--gutter) calc(96px + var(--safe-bottom));
}
.queue__section-h {
  position: sticky;
  top: calc(var(--topbar-h) + var(--safe-top));
  background: var(--cream);
  width: 100%;
  box-sizing: border-box;
  height: 38px;
  margin-block: 14px 0;
  display: flex; align-items: center; gap: 10px;
  color: var(--bark);
  font-size: var(--fs-micro);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-weight: 700;
  z-index: 5;
}
.queue__section-count {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 22px; height: 22px;
  padding: 0 8px;
  background: rgba(74, 55, 40, 0.1);
  color: var(--bark);
  border-radius: var(--radius-pill);
  font-size: 11px; font-weight: 700;
  letter-spacing: 0.04em;
}
.queue__list {
  list-style: none; margin: 0; padding: 0;
  display: flex; flex-direction: column; gap: var(--gap);
}
.queue__list > li {
  animation: card-rise 360ms var(--ease-out) backwards;
}
.queue__list > li:nth-child(1) { animation-delay: 20ms; }
.queue__list > li:nth-child(2) { animation-delay: 60ms; }
.queue__list > li:nth-child(3) { animation-delay: 100ms; }
.queue__list > li:nth-child(4) { animation-delay: 140ms; }
.queue__list > li:nth-child(5) { animation-delay: 180ms; }
.queue__list > li:nth-child(n+6) { animation-delay: 220ms; }
@keyframes card-rise {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Card ──────────────────────────────────────────────────────── */
.card {
  display: block; width: 100%;
  background: var(--white);
  box-shadow: var(--shadow);
  text-decoration: none; color: inherit;
  border: 1px solid rgba(28, 28, 28, 0.05);
  border-radius: var(--radius);
  padding: 0;
  text-align: left;
  position: relative;
  cursor: pointer;
  overflow: hidden;
  transition: transform 140ms var(--ease-out), box-shadow 200ms;
}
.card__stripe { display: none; }

.card--locked {
  cursor: not-allowed;
  filter: grayscale(0.7);
}
.card--locked .card__inner { opacity: 0.55; }
.card--locked:hover { transform: none; box-shadow: var(--shadow); }
.card__lock {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 18px;
  background: rgba(28, 28, 28, 0.04);
  border-top: 1px solid rgba(28, 28, 28, 0.06);
  font-size: var(--fs-micro);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--bark);
  font-weight: 600;
  font-family: 'Manrope', sans-serif;
  opacity: 0.7;
}
.card__lock svg { width: 14px; height: 14px; flex: 0 0 14px; }

.task__locked-banner {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 14px 16px;
  background: rgba(28, 28, 28, 0.05);
  border-radius: var(--radius);
  margin-bottom: 4px;
  color: var(--bark);
}
.task__locked-banner svg { width: 22px; height: 22px; flex: 0 0 22px; margin-top: 2px; }
.task__locked-banner strong { display: block; font-weight: 700; margin-bottom: 2px; }
.task__locked-banner span { display: block; font-size: 14px; opacity: 0.75; }

.card--assemble-pending .card__lock { gap: 6px; }
.card--assemble-pending .card__lock span {
  letter-spacing: 0.10em;
  font-size: 11px;
  line-height: 1.4;
  white-space: normal;
}
/* Locked Assembled is now tappable (opens task page with prereq
   checklist) — restore pointer cursor that .card--locked turns off. */
.card--locked.card--assemble-pending { cursor: pointer; }

.prereq__list {
  list-style: none; padding: 0;
  margin: 4px 0 12px;
  display: flex; flex-direction: column; gap: 8px;
}
.prereq__row {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; border-radius: 10px;
  background: rgba(28, 28, 28, 0.04);
  font-family: 'Manrope', sans-serif;
  color: var(--bark);
  font-size: 14px;
}
.prereq__row--blocking { opacity: 0.85; }
.prereq__dot {
  width: 10px; height: 10px; border-radius: 50%;
  border: 1.5px solid var(--bark); background: transparent;
  flex: 0 0 10px;
}

/* ── Privileged worker picker ────────────────────────────────────── */
.picker-bar {
  display: flex; flex-direction: column; gap: 8px;
  padding: 10px var(--gutter);
  background: rgba(122, 140, 110, 0.08);
  border-bottom: 1px solid rgba(28, 28, 28, 0.06);
  font-family: 'Manrope', sans-serif;
}
.picker-bar--active { background: rgba(199, 154, 88, 0.18); }
.picker-bar__head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px;
  min-height: 18px;
}
.picker-bar__label {
  font-size: var(--fs-micro);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--bark);
  opacity: 0.7;
  font-weight: 600;
}
.picker-bar__btn {
  width: 100%;
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px;
  background: var(--white);
  border: 1px solid rgba(28, 28, 28, 0.08);
  border-radius: 10px;
  padding: 12px 14px;
  font-family: inherit;
  font-size: 15px;
  color: var(--bark);
  font-weight: 500;
  cursor: pointer;
  min-height: 44px;
  text-align: left;
}
.picker-bar__btn > span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.picker-bar__btn svg { width: 18px; height: 18px; opacity: 0.5; flex: 0 0 18px; }
.picker-bar__clear {
  background: transparent;
  border: 0;
  color: var(--bark);
  font-family: inherit;
  font-size: var(--fs-micro);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-weight: 700;
  padding: 4px 0;
  cursor: pointer;
}

/* ── Queue filter tabs ──────────────────────────────────────────── */
.filter-tabs {
  display: flex; gap: 6px;
  padding: 12px var(--gutter) 2px;
  font-family: 'Manrope', sans-serif;
  -webkit-overflow-scrolling: touch;
  overflow-x: auto;
  scrollbar-width: none;
}
.filter-tabs::-webkit-scrollbar { display: none; }
.filter-tabs:empty { display: none; }
.filter-tab {
  flex: 1 1 0; min-width: max-content;
  padding: 10px 14px;
  border: 0;
  border-radius: var(--radius-pill);
  background: var(--cream-deep);
  color: var(--bark);
  font: 700 11.5px/1 'Manrope', sans-serif;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  white-space: nowrap;
  cursor: pointer;
  min-height: 40px;
  opacity: 0.78;
  transition:
    background-color 140ms var(--ease-out),
    color 140ms var(--ease-out),
    opacity 140ms var(--ease-out),
    transform 140ms var(--ease-out),
    box-shadow 140ms var(--ease-out);
}
.filter-tab:hover {
  opacity: 1;
  background: rgba(122, 140, 110, 0.18);
}
.filter-tab:active { transform: scale(0.97); }
.filter-tab--active {
  background: var(--forest);
  color: var(--cream);
  opacity: 1;
}
.filter-tab--active:hover { background: var(--forest-light); }

.picker-search__input {
  width: 100%; box-sizing: border-box;
  padding: 12px 14px;
  margin: 8px 0 12px;
  border: 1px solid rgba(28, 28, 28, 0.12);
  border-radius: 10px;
  font-family: 'Manrope', sans-serif;
  font-size: 16px;
  color: var(--bark);
  background: var(--white);
}
.picker-list {
  list-style: none; padding: 0; margin: 0;
  max-height: 50vh; overflow-y: auto;
  display: flex; flex-direction: column; gap: 6px;
}
.picker-list__item {
  width: 100%;
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid rgba(28, 28, 28, 0.06);
  border-radius: 10px;
  background: var(--white);
  font-family: 'Manrope', sans-serif;
  font-size: 15px;
  color: var(--bark);
  cursor: pointer;
  text-align: left;
}
.picker-list__item--active {
  border-color: var(--forest);
  background: rgba(122, 140, 110, 0.10);
}
.picker-list__item--loading,
.picker-list__item--empty {
  opacity: 0.7;
  cursor: default;
  justify-content: flex-start;
}
.picker-list__name { font-weight: 500; }
.picker-list__team {
  font-size: var(--fs-micro);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  opacity: 0.65;
  font-weight: 600;
}

/* ── Read-only banner on the task page ───────────────────────────── */
.viewing-banner {
  display: flex; align-items: center; gap: 8px;
  padding: 10px var(--gutter);
  background: rgba(199, 154, 88, 0.20);
  border-bottom: 1px solid rgba(199, 154, 88, 0.35);
  color: var(--bark);
  font-family: 'Manrope', sans-serif;
  font-size: var(--fs-micro);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-weight: 700;
}
.viewing-banner svg { width: 16px; height: 16px; flex: 0 0 16px; }

.card__inner {
  padding: 18px 18px 14px;
  display: flex; flex-direction: column; gap: 14px;
}

.card__head {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: start;
  column-gap: 12px;
  row-gap: 0;
}
.card__refs {
  display: flex; flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.card__project-ref {
  font-family: 'Fraunces', serif;
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.1;
  color: var(--charcoal);
}
.card__sku {
  font-family: 'Manrope', sans-serif;
  font-size: 13px;
  font-weight: 600;
  color: var(--bark);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-feature-settings: "tnum";
  opacity: 0.75;
}

.card__task-pill {
  flex-shrink: 0;
  align-self: start;
  margin-top: 4px;
  display: inline-flex; align-items: center;
  padding: 5px 10px;
  border-radius: var(--radius-pill);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-family: 'Manrope', sans-serif;
  white-space: nowrap;
  background: var(--mist);
  color: var(--bark);
  border: 1px solid rgba(28, 28, 28, 0.06);
}

.card__item {
  font-size: 14.5px;
  color: var(--charcoal);
  display: -webkit-box; -webkit-line-clamp: 2;
  -webkit-box-orient: vertical; overflow: hidden;
  line-height: 1.4;
  opacity: 0.85;
}
.card__foot {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
  padding-top: 12px;
  border-top: 1px solid rgba(28, 28, 28, 0.06);
  min-height: 24px;
}
.card__project-name {
  font-size: 12px;
  color: var(--bark);
  opacity: 0.55;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  font-weight: 500;
  letter-spacing: 0.02em;
  flex: 1; min-width: 0;
}
.card__meta {
  display: flex; flex-wrap: nowrap; gap: 6px;
  flex-shrink: 0;
}

/* ── Chips ─────────────────────────────────────────────────────── */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px;
  background: rgba(74, 55, 40, 0.06);
  border-radius: var(--radius-pill);
  font-size: var(--fs-meta);
  color: var(--bark);
  font-weight: 600;
  letter-spacing: 0.02em;
}
.chip svg { width: 14px; height: 14px; }
.chip__dot {
  width: 8px; height: 8px;
  border-radius: 50%;
}
.chip__dot--p1 { background: var(--dg-red); box-shadow: 0 0 0 3px rgba(192, 57, 43, 0.15); }
.chip__dot--p4 { background: var(--oak); box-shadow: 0 0 0 3px rgba(139, 105, 20, 0.15); }
.chip__dot--p7 { background: var(--sage); box-shadow: 0 0 0 3px rgba(122, 140, 110, 0.15); }
.chip__dot--p0 { background: var(--mist); }
.card:active {
  transform: scale(0.985);
  box-shadow: var(--shadow-sm);
}
@media (prefers-reduced-motion: reduce) {
  .card:active { transform: none; }
  .queue__list > li { animation: none; }
}

/* ── Empty state ───────────────────────────────────────────────── */
.empty {
  margin-top: 64px;
  text-align: center;
  color: var(--bark);
  display: flex; flex-direction: column; align-items: center; gap: 14px;
  padding: 32px;
}
.empty__icon {
  width: 72px; height: 72px;
  border-radius: 50%;
  background: var(--mist);
  display: grid; place-items: center;
  color: var(--sage);
}
.empty__icon svg { width: 32px; height: 32px; }
.empty__title {
  font-family: 'Fraunces', serif;
  font-size: 22px; font-weight: 500;
  color: var(--charcoal);
  letter-spacing: -0.01em;
}
.empty__sub { font-size: 15px; opacity: 0.75; max-width: 240px; }

/* ── Task detail ───────────────────────────────────────────────── */
.task {
  padding-bottom: calc(180px + var(--safe-bottom));
}
.task__hero {
  background: var(--white);
  margin: var(--gutter);
  padding: 18px 18px 14px;
  position: relative;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid rgba(28, 28, 28, 0.04);
  overflow: hidden;
  display: flex; flex-direction: column; gap: 12px;
}
.task__hero-stripe { display: none; }

.task__hero-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 10px;
}
.task__refs {
  display: flex; flex-direction: column;
  gap: 4px;
  font-family: 'Fraunces', serif;
  letter-spacing: -0.01em;
  line-height: 1.1;
  min-width: 0;
}
.task__project-ref {
  font-size: 28px;
  font-weight: 600;
  color: var(--charcoal);
}
.task__sku {
  font-size: 18px;
  font-weight: 500;
  color: var(--bark);
  font-family: 'Manrope', sans-serif;
  font-feature-settings: "tnum";
  letter-spacing: 0.01em;
}

.task__task-pill {
  flex-shrink: 0;
  display: inline-flex; align-items: center;
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  font-size: var(--fs-micro);
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-family: 'Manrope', sans-serif;
  white-space: nowrap;
  background: var(--mist);
  color: var(--bark);
  border: 1px solid rgba(28, 28, 28, 0.06);
}

.task__item  {
  font-size: var(--fs-body);
  color: var(--bark);
  line-height: 1.4;
}
.task__foot {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px;
  padding-top: 10px;
  border-top: 1px solid rgba(28, 28, 28, 0.06);
}
.task__project-name {
  font-size: var(--fs-meta);
  color: var(--bark);
  opacity: 0.55;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  font-weight: 500;
  flex: 1; min-width: 0;
}
/* ── Drawing pack row ──────────────────────────────────────────── */
.task__pack {
  padding: 4px var(--gutter) 16px;
}
.task__pack h3 {
  margin: 0 0 12px;
  font-size: var(--fs-micro);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--bark);
  font-weight: 700;
  font-family: 'Manrope', sans-serif;
  opacity: 0.7;
}
.pack-row {
  width: 100%;
  display: flex; align-items: center; gap: 14px;
  padding: 14px 16px;
  background: var(--white);
  border: 1px solid rgba(28, 28, 28, 0.06);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  text-align: left;
  cursor: pointer;
  font: inherit;
  color: var(--charcoal);
  transition: transform 120ms var(--ease-out), box-shadow 200ms;
}
.pack-row:active { transform: scale(0.99); box-shadow: none; }
.pack-row__icon {
  width: 40px; height: 40px;
  background: var(--mist);
  border-radius: var(--radius-sm);
  display: grid; place-items: center;
  color: var(--forest);
  flex-shrink: 0;
}
.pack-row__icon svg { width: 22px; height: 22px; }
.pack-row__body {
  flex: 1;
  display: flex; flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.pack-row__name {
  font-size: 15px;
  font-weight: 600;
  color: var(--charcoal);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.pack-row__sub {
  font-size: var(--fs-meta);
  color: var(--bark);
  opacity: 0.7;
}
.pack-row__chev {
  color: var(--sage);
  flex-shrink: 0;
  display: inline-flex;
}
.pack-row__chev svg { width: 22px; height: 22px; }

.pack-empty {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px;
  background: var(--mist);
  border: 1px dashed rgba(74, 55, 40, 0.18);
  border-radius: var(--radius);
  color: var(--bark);
  font-size: 14px;
  font-weight: 500;
}
.pack-empty__icon {
  width: 32px; height: 32px;
  display: grid; place-items: center;
  color: var(--sage);
  flex-shrink: 0;
}
.pack-empty__icon svg { width: 22px; height: 22px; opacity: 0.7; }
.pack-empty--error {
  background: var(--warning-light);
  border-color: rgba(176, 116, 0, 0.25);
  color: var(--warning);
}
.pack-empty--error .pack-empty__icon { color: var(--warning); }

/* ── Camera viewfinder ─────────────────────────────────────────── */
.camera {
  position: fixed; inset: 0;
  z-index: 250;
  background: #000;
  display: flex;
  overflow: hidden;
}
.camera__video {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  background: #000;
}
.camera__bar {
  position: absolute; left: 0; right: 0;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px;
  z-index: 1;
  pointer-events: none;
}
.camera__bar > * { pointer-events: auto; }
.camera__bar--top {
  top: 0;
  padding-top: calc(14px + var(--safe-top));
  background: linear-gradient(180deg, rgba(0,0,0,0.5), transparent);
}
.camera__bar--bottom {
  bottom: 0;
  padding-bottom: calc(28px + var(--safe-bottom));
  justify-content: center;
  background: linear-gradient(0deg, rgba(0,0,0,0.5), transparent);
}
.camera__btn {
  width: 44px; height: 44px;
  border: 0;
  background: rgba(0, 0, 0, 0.45);
  color: var(--white);
  border-radius: var(--radius-pill);
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.camera__btn:active { background: rgba(0, 0, 0, 0.7); }
.camera__btn svg { width: 22px; height: 22px; }
.camera__shutter {
  width: 76px; height: 76px;
  border: 4px solid var(--white);
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  display: grid; place-items: center;
  padding: 0;
  transition: transform 100ms;
}
.camera__shutter:active { transform: scale(0.92); }
.camera__shutter-inner {
  width: 60px; height: 60px;
  background: var(--white);
  border-radius: 50%;
  display: block;
  transition: transform 100ms;
}
.camera__shutter:active .camera__shutter-inner { transform: scale(0.85); }

/* ── PDF viewer overlay ────────────────────────────────────────── */
.pdfview {
  position: fixed; inset: 0;
  z-index: 200;
  background: var(--charcoal);
  display: flex; flex-direction: column;
}
.pdfview__bar {
  height: calc(56px + var(--safe-top));
  padding-top: var(--safe-top);
  padding-left: 8px; padding-right: 16px;
  background: var(--forest);
  color: var(--cream);
  display: flex; align-items: center; gap: 8px;
  border-bottom: 1px solid var(--forest-deep);
  flex-shrink: 0;
}
.pdfview__close {
  width: 44px; height: 44px;
  border: 0; background: transparent;
  color: var(--cream); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--radius-pill);
}
.pdfview__close:active { background: rgba(255,255,255,0.08); }
.pdfview__close svg { width: 24px; height: 24px; }
.pdfview__title {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.01em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  flex: 1;
}
.pdfview__body {
  flex: 1;
  position: relative;
  background: var(--charcoal);
  display: flex;
}
.pdfview__frame {
  flex: 1;
  width: 100%; height: 100%;
  border: 0;
  background: var(--charcoal);
}
.pdfview__loading,
.pdfview__error {
  margin: auto;
  color: var(--cream);
  font-size: 14px;
  letter-spacing: 0.05em;
  text-align: center;
  padding: 24px;
  opacity: 0.85;
}
.pdfview__error { color: #ff8a7a; }

.task__photos {
  padding: 4px var(--gutter) 16px;
}
.task__photos h3 {
  margin: 0 0 12px;
  font-size: var(--fs-micro);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--bark);
  font-weight: 700;
  font-family: 'Manrope', sans-serif;
  opacity: 0.7;
}
.task__photos h3 + .photostrip { margin-bottom: 18px; }
.sheet__note {
  margin: 4px 0 14px;
  color: var(--bark);
  opacity: 0.75;
  font-size: 14px;
  line-height: 1.45;
}
.photostrip {
  display: flex; gap: 10px;
  overflow-x: auto;
  padding: 4px 0 8px;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.photostrip::-webkit-scrollbar { display: none; }
.thumb {
  width: 110px; height: 110px;
  flex-shrink: 0;
  border-radius: var(--radius-photo);
  border: 1px solid rgba(28, 28, 28, 0.06);
  background: var(--mist) center/cover no-repeat;
  position: relative;
  cursor: pointer;
  scroll-snap-align: start;
  box-shadow: var(--shadow-sm);
  transition: transform 140ms var(--ease-out);
}
.thumb:active { transform: scale(0.96); }
.thumb__ring {
  position: absolute; inset: 0;
  border: 2px solid var(--oak);
  border-top-color: transparent;
  border-radius: var(--radius-photo);
  animation: spin 700ms linear infinite;
}
.thumb__retry {
  position: absolute; inset: 0;
  background: rgba(192, 57, 43, 0.7);
  color: var(--white);
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-photo);
}
.thumb__placeholder {
  width: 110px; height: 110px;
  border: 1.5px dashed rgba(122, 140, 110, 0.4);
  border-radius: var(--radius-photo);
  display: flex; align-items: center; justify-content: center;
  color: var(--sage);
  font-size: var(--fs-meta);
  font-weight: 600;
  letter-spacing: 0.04em;
  flex-direction: column; gap: 6px;
  background: rgba(122, 140, 110, 0.05);
}
.thumb__placeholder svg { width: 28px; height: 28px; opacity: 0.7; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Sticky bottom action bar ──────────────────────────────────── */
.task__actions {
  position: fixed; bottom: 0; left: 0; right: 0;
  background: var(--cream);
  border-top: 1px solid rgba(28, 28, 28, 0.08);
  padding: 14px var(--gutter) max(14px, var(--safe-bottom));
  display: flex; flex-direction: column; gap: 10px;
  z-index: 9;
}

.btn {
  height: var(--hit-primary);
  border: 0;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: var(--fs-body);
  letter-spacing: 0.01em;
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  cursor: pointer;
  width: 100%;
  font-family: 'Manrope', sans-serif;
  transition: transform 100ms, box-shadow 200ms, opacity 160ms;
}
.btn:active { transform: scale(0.985); }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }
.btn--primary {
  background: var(--forest);
  color: var(--cream);
}
.btn--secondary {
  background: var(--white);
  color: var(--forest);
  border: 1px solid rgba(44, 62, 45, 0.18);
}
.btn--danger {
  background: var(--dg-red); color: var(--white);
}
.btn svg { width: 22px; height: 22px; }

/* ── Sheet (review / confirm) ──────────────────────────────────── */
.sheet-backdrop {
  position: fixed; inset: 0;
  background: rgba(28, 28, 28, 0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 50;
  animation: fade-in 200ms var(--ease-out);
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0;
  background: var(--cream);
  border-radius: 24px 24px 0 0;
  box-shadow: var(--shadow-lg);
  z-index: 51;
  padding: 22px var(--gutter) max(20px, var(--safe-bottom));
  max-height: 90dvh;
  display: flex; flex-direction: column; gap: 14px;
  animation: sheet-up 320ms var(--ease-spring);
}
.sheet::before {
  /* grabber handle */
  content: "";
  position: absolute;
  top: 8px; left: 50%; transform: translateX(-50%);
  width: 44px; height: 5px;
  border-radius: var(--radius-pill);
  background: rgba(28, 28, 28, 0.18);
}
@keyframes sheet-up {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}
.sheet h2 {
  margin: 6px 0 0;
  font-family: 'Fraunces', serif;
  font-size: 22px; font-weight: 500;
  letter-spacing: -0.01em;
}
.sheet__preview {
  width: 100%;
  max-height: 50dvh;
  object-fit: contain;
  border-radius: var(--radius-sm);
  background: var(--mist);
  box-shadow: var(--shadow-sm);
}
.sheet__preview--full { max-height: 70dvh; }
.sheet__caption {
  width: 100%; height: 56px; padding: 0 16px;
  border: 1px solid rgba(74, 55, 40, 0.15);
  border-radius: var(--radius-sm);
  background: var(--white);
  font-size: var(--fs-body);
  outline-offset: 2px;
}
.sheet__caption:focus {
  outline: 2px solid var(--oak-light);
  border-color: var(--oak);
}
.sheet__row {
  display: grid;
  /* Auto-flow column with 1fr columns means a row with one button
     stretches it to full width, two splits 1:1, three splits 1:1:1.
     Previously a single-button row (e.g. the photo viewer's Close
     when Delete isn't applicable) sat half-width on the left. */
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 10px;
  margin-top: 4px;
}
.sheet__msg {
  margin: 0;
  color: var(--bark);
  font-size: 15px;
  line-height: 1.45;
}
.sheet__msg strong {
  color: var(--charcoal);
  font-weight: 600;
}
.sheet--confirm {
  padding-top: 28px;
  padding-bottom: max(20px, var(--safe-bottom));
}

/* ── Toast ─────────────────────────────────────────────────────── */
.toasts {
  position: fixed;
  left: 16px; right: 16px;
  bottom: max(20px, calc(var(--safe-bottom) + 96px));
  display: flex; flex-direction: column; gap: 8px;
  z-index: 100;
  pointer-events: none;
}
.toast {
  background: var(--charcoal); color: var(--cream);
  padding: 14px 18px;
  font-size: var(--fs-meta);
  font-weight: 600;
  letter-spacing: 0.02em;
  border-radius: var(--radius-sm);
  pointer-events: auto;
  box-shadow: var(--shadow-md);
  animation: toast-up 280ms var(--ease-spring);
  border: 1px solid rgba(255,255,255,0.06);
}
.toast--warning {
  background: var(--warning);
  color: var(--white);
}
.toast--danger {
  background: var(--dg-red);
  color: var(--white);
}
.toast--info {
  background: var(--forest);
  color: var(--cream);
}
@keyframes toast-up {
  from { transform: translateY(20px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}

/* ── Skeleton ──────────────────────────────────────────────────── */
.skeleton {
  background: var(--cream-deep);
  animation: pulse-fade 1.4s ease-in-out infinite;
  height: 110px;
  border-radius: var(--radius);
  border: 1px solid rgba(28, 28, 28, 0.04);
}
@keyframes pulse-fade {
  0%, 100% { opacity: 0.55; }
  50%      { opacity: 0.9; }
}
@media (prefers-reduced-motion: reduce) {
  .skeleton, .thumb__ring, .toast, .sheet, .syncstrip::before { animation: none; opacity: 1; }
}

/* ── Assembled delegation ─────────────────────────────────────── */
/* Leader-only row above the Assembled action buttons. Hosts either the
   active delegate chip or the "+ Delegate" affordance. Sits inside
   .task__actions so the flex layout there gives it natural spacing
   from the buttons below. */
.delegation {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 14px;
  background: rgba(122, 140, 110, 0.10);
  border: 1px solid rgba(122, 140, 110, 0.28);
  border-radius: var(--radius-sm);
}
.delegation--hint {
  flex-direction: row;
  align-items: center;
  gap: 6px;
  background: rgba(199, 154, 88, 0.12);
  border-color: rgba(199, 154, 88, 0.30);
  color: var(--bark);
  font-family: 'Manrope', sans-serif;
  font-size: var(--fs-meta);
}
.delegation__hint-label {
  font-size: var(--fs-micro);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-weight: 700;
  opacity: 0.75;
}
.delegation__label {
  font-size: var(--fs-micro);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--bark);
  opacity: 0.75;
}
.delegation__loading {
  font-size: var(--fs-meta);
  color: var(--bark);
  opacity: 0.7;
}
.delegation__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.delegation__add {
  align-self: flex-start;
}

/* Delegate chip — initials avatar + name + close affordance. Tapping
   anywhere on the chip triggers the revoke confirm sheet; the close
   glyph is a hint, not a separate hit target. */
.dchip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px 6px 6px;
  background: var(--white);
  border: 1px solid rgba(28, 28, 28, 0.12);
  border-radius: var(--radius-pill);
  font-family: 'Manrope', sans-serif;
  font-size: var(--fs-meta);
  color: var(--bark);
  cursor: pointer;
  min-height: 36px;
}
.dchip:hover { border-color: var(--forest); }
.dchip__avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--forest);
  color: var(--white);
  font-size: var(--fs-micro);
  font-weight: 700;
  letter-spacing: 0.04em;
}
.dchip__name { font-weight: 500; }
.dchip__close {
  font-size: 18px;
  line-height: 1;
  opacity: 0.5;
  margin-left: 2px;
}

/* Queue-card delegate badge. Oak-tinted pill that lives in card__meta
   beside CURRENT / due chips. Reads "[share-icon] [initials]" so the
   leader sees at a glance that the Assembled has been handed off and
   to whom. Oak palette deliberately contrasts the forest CURRENT pill
   so the two never blur together. Leader-only — the server only
   attaches delegated_to to the leader's queue row. */
.card__delegate {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 4px 3px 8px;
  border-radius: var(--radius-pill);
  background: rgba(139, 105, 20, 0.10);
  border: 1px solid rgba(139, 105, 20, 0.28);
  color: var(--oak);
  flex-shrink: 0;
}
.card__delegate-arrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 13px; height: 13px;
  opacity: 0.85;
}
.card__delegate-arrow svg { width: 13px; height: 13px; }
.card__delegate-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px; height: 22px;
  padding: 0 5px;
  border-radius: var(--radius-pill);
  background: linear-gradient(180deg, var(--oak-light) 0%, var(--oak) 100%);
  color: var(--cream);
  font-family: 'Manrope', sans-serif;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.06em;
  line-height: 1;
  box-shadow: 0 1px 2px rgba(28, 28, 28, 0.18) inset,
              0 1px 2px -1px rgba(139, 105, 20, 0.4);
}

/* ── A11y utility ─────────────────────────────────────────────── */
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}
