/* ══════════════════════════════════════════════════════════════
   PRICE DB SECTION — "Your price book compounds over time"
   Browser mockup on the right, same shell language as AI / Receipt.
   A timeline scrubs from Year 0 (seeded labor DB) forward; receipts
   and estimates feed a growing material+labor database, then a future
   estimate auto-fills from it.
   ══════════════════════════════════════════════════════════════ */

/* ── Browser content shell ── */
.pdb-content {
  background: #f9fafb;
  position: relative;
  overflow: hidden;
  min-height: 440px;
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* ── Timeline scrubber ── */

/* ── Main body: ledger feed (left) + DB panel (right) ── */

/* feed column */
.pdb-feed-label {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #9ca3af;
  margin-bottom: 1px;
}

/* DB panel column */
.pdb-db {
  background: linear-gradient(180deg, var(--dark-1), oklch(20% 0.01 40));
  border-radius: 10px;
  padding: 13px 13px 11px;
  display: flex;
  flex-direction: column;
  gap: 9px;
  position: relative;
  overflow: hidden;
}
.pdb-db-head {
  display: flex;
  align-items: center;
  gap: 7px;
}
.pdb-db-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--amber);
  box-shadow: 0 0 8px var(--amber);
  flex-shrink: 0;
}
.pdb-db-title {
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.01em;
}
.pdb-db-seed {
  font-family: var(--font-mono);
  font-size: 8px;
  font-weight: 600;
  padding: 1px 5px;
  border-radius: 3px;
  background: rgba(217, 119, 6, 0.18);
  color: var(--amber-bright);
  margin-left: auto;
}

/* DB counters */
.pdb-counters {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
}
.pdb-counter {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 7px;
  padding: 7px 9px;
}
.pdb-counter-num {
  font-family: var(--font-mono);
  font-size: 18px;
  font-weight: 700;
  color: var(--amber-bright);
  line-height: 1;
  letter-spacing: -0.02em;
}
.pdb-counter-label {
  font-size: 8.5px;
  color: rgba(255, 255, 255, 0.5);
  margin-top: 4px;
  letter-spacing: 0.02em;
}

/* DB capacity bar */
.pdb-cap {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.pdb-cap-row {
  display: flex;
  justify-content: space-between;
  font-size: 8.5px;
  color: rgba(255, 255, 255, 0.55);
}
.pdb-cap-track {
  height: 5px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 3px;
  overflow: hidden;
}
.pdb-cap-fill {
  height: 100%;
  width: 22%;
  background: linear-gradient(90deg, var(--amber-deep), var(--amber));
  border-radius: 3px;
  transition: width 0.7s cubic-bezier(0.4, 0, 0.2, 1);
}

/* DB recent-rows preview */
.pdb-rows {
  display: flex;
  flex-direction: column;
  gap: 0;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  padding-top: 7px;
}
.pdb-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 3px 0;
  font-size: 9.5px;
  opacity: 0;
  transform: translateX(8px);
  transition: opacity 0.35s ease, transform 0.35s ease;
}
.pdb-row.show { opacity: 1; transform: translateX(0); }
.pdb-row-name { color: rgba(255, 255, 255, 0.8); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pdb-row-price { font-family: var(--font-mono); font-weight: 600; color: var(--amber-bright); flex-shrink: 0; margin-left: 8px; }
.pdb-row.fresh .pdb-row-price { animation: pdbFlash 1s ease; }

@keyframes pdbFlash {
  0% { color: #fff; text-shadow: 0 0 10px var(--amber); }
  100% { color: var(--amber-bright); text-shadow: none; }
}

/* ── Finale: future estimate auto-fills from DB ── */

@media (max-width: 720px) {
  .pdb-db { order: -1; }
  .pdb-content { min-height: 0; }
}

/* ══════════════════════════════════════════════════════════════
   STAGE 1 — receipt scanning into the DB
   ══════════════════════════════════════════════════════════════ */
.pdb-stage { min-height: 0; }



  90% { opacity: 1; }
  100% { top: 100%; opacity: 0; }
}

/* ══════════════════════════════════════════════════════════════
   STAGE 2 — estimate builds, auto-fills from DB
   ══════════════════════════════════════════════════════════════ */

.pdb-est-head { display: flex; flex-direction: column; gap: 8px; }
.pdb-est-head-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.pdb-est-title { font-size: 12px; font-weight: 700; color: var(--ink); }

.pdb-scope {
  display: flex;
  align-items: baseline;
  gap: 8px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 7px;
  padding: 7px 10px;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.3s ease, transform 0.3s ease;
  min-height: 30px;
}
.pdb-scope.show { opacity: 1; transform: translateY(0); }
.pdb-scope-label {
  font-family: var(--font-mono);
  font-size: 8.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #9ca3af;
  flex-shrink: 0;
}
.pdb-scope-type {
  font-size: 11.5px;
  color: var(--ink);
  font-weight: 500;
  line-height: 1.3;
}
.pdb-scope-type::after {
  content: "";
  display: inline-block;
  width: 1px;
  height: 12px;
  background: var(--amber);
  margin-left: 2px;
  vertical-align: -2px;
  animation: pdbCaret 0.8s step-end infinite;
}
@keyframes pdbCaret { 50% { opacity: 0; } }

.pdb-est-list { display: flex; flex-direction: column; gap: 7px; }
.pdb-eline {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 9px 11px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.4s ease, transform 0.4s cubic-bezier(0.25, 1, 0.5, 1);
}
.pdb-eline.show { opacity: 1; transform: translateY(0); }
.pdb-eline-main { min-width: 0; flex: 1; }
.pdb-eline-name { font-size: 12px; font-weight: 600; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pdb-eline-src {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 9.5px;
  color: var(--amber-dim);
  margin-top: 3px;
  font-weight: 500;
}
.pdb-eline-src svg { flex-shrink: 0; }
.pdb-eline-cols { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.pdb-eline-cell { display: flex; flex-direction: column; align-items: flex-end; gap: 1px; }
.pdb-eline-k { font-family: var(--font-mono); font-size: 7.5px; font-weight: 700; letter-spacing: 0.04em; color: #9ca3af; }
.pdb-eline-v { font-family: var(--font-mono); font-size: 11px; font-weight: 600; color: var(--ink-2); }
.pdb-eline-total {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
  min-width: 56px;
  text-align: right;
}

.pdb-est-sub {
  margin-top: auto;
  background: var(--dark-1);
  border-radius: 8px;
  padding: 11px 13px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  opacity: 0;
  transform: translateY(6px);
}
.pdb-est-sub-label { font-size: 11px; color: rgba(255, 255, 255, 0.7); }
.pdb-est-sub-val { font-family: var(--font-mono); font-size: 16px; font-weight: 700; color: var(--amber-bright); }

@media (max-width: 720px) {
  .pdb-eline { flex-direction: column; align-items: stretch; gap: 8px; }
  .pdb-eline-cols { justify-content: space-between; }
}

/* ══════════════════════════════════════════════════════════════
   STAGE 1 — DATABASE POV : jobs stream into the cylinder
   ══════════════════════════════════════════════════════════════ */
.pdb-accrue {
  display: grid;
  grid-template-columns: 1fr 0.82fr;
  gap: 14px;
  min-height: 0;
}
.pdb-accrue-left { display: flex; flex-direction: column; gap: 8px; min-width: 0; }

/* job card that announces each incoming job */
.pdb-jobcard {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 9px;
  padding: 9px 11px;
  display: flex;
  align-items: center;
  gap: 10px;
  position: relative;
  overflow: hidden;
}
.pdb-jobcard-icon {
  width: 30px; height: 30px;
  border-radius: 8px;
  background: var(--amber-pale);
  color: var(--amber-dim);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.pdb-jobcard-text { flex: 1; min-width: 0; }
.pdb-jobcard-name {
  font-size: 12.5px; font-weight: 700; color: var(--ink);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  transition: opacity 0.25s ease;
}
.pdb-jobcard-sub {
  font-size: 10px; color: var(--ink-3); margin-top: 1px;
  transition: opacity 0.25s ease;
}
.pdb-stamp {
  font-family: var(--font-mono);
  font-size: 8.5px; font-weight: 800; letter-spacing: 0.04em;
  color: var(--amber-dim);
  border: 1.5px solid var(--amber);
  border-radius: 5px;
  padding: 2px 6px;
  flex-shrink: 0;
  opacity: 0;
  transform: scale(0.7) rotate(-8deg);
}
.pdb-stamp.show { animation: pdbStamp 0.6s cubic-bezier(0.34,1.4,0.64,1) forwards; }
@keyframes pdbStamp {
  0% { opacity: 0; transform: scale(1.6) rotate(-12deg); }
  60% { opacity: 1; transform: scale(0.92) rotate(-6deg); }
  100% { opacity: 1; transform: scale(1) rotate(-5deg); }
}

/* flyzone holds the price pills mid-flight */
.pdb-flyzone { position: relative; flex: 1; min-height: 96px; }
.pdb-fly {
  position: absolute;
  display: flex; align-items: center; gap: 6px;
  background: rgba(255,255,255,0.96);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 4px 8px;
  white-space: nowrap;
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
  opacity: 0;
  transform: scale(0.85);
  transition: opacity 0.3s ease, transform 0.3s cubic-bezier(0.34,1.3,0.64,1);
  pointer-events: none;
  z-index: 10;
}
.pdb-fly.in { opacity: 1; transform: scale(1); }
.pdb-fly-tag {
  font-family: var(--font-mono); font-size: 7px; font-weight: 800;
  letter-spacing: 0.04em; padding: 1px 4px; border-radius: 3px;
}
.pdb-fly.mat .pdb-fly-tag { background: rgba(217,119,6,0.12); color: var(--amber-dim); }
.pdb-fly.labor .pdb-fly-tag { background: rgba(79,70,229,0.12); color: #4f46e5; }
.pdb-fly-name { font-size: 10px; font-weight: 600; color: var(--ink-2); }
.pdb-fly-price { font-family: var(--font-mono); font-size: 10.5px; font-weight: 800; color: var(--amber-dim); }

/* the recent-prices ticker (reuses .pdb-rows / .pdb-row from earlier) */
.pdb-accrue-left .pdb-rows { border-top: none; padding-top: 4px; }
.pdb-accrue-left .pdb-row-name { color: var(--ink-2); }
.pdb-accrue-left .pdb-row-price { color: var(--amber-dim); }
.pdb-accrue-left .pdb-row-price.lab { color: #4f46e5; }

/* DB cylinder */
.pdb-cyl { display: flex; flex-direction: column; align-items: center; margin: 2px 0 4px; }
.pdb-cyl-lid {
  width: 86px; height: 14px;
  background: linear-gradient(180deg, var(--amber-bright), var(--amber));
  border-radius: 50% / 100%;
  position: relative;
  z-index: 2;
  transition: transform 0.2s cubic-bezier(0.34,1.4,0.64,1);
  box-shadow: 0 2px 6px rgba(217,119,6,0.3);
}
.pdb-cyl-body {
  width: 86px; height: 78px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.12);
  border-top: none;
  border-radius: 0 0 43px 43px / 0 0 16px 16px;
  margin-top: -7px;
  position: relative;
  overflow: hidden;
}
.pdb-cyl-fill {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 22%;
  background: linear-gradient(180deg, var(--amber), var(--amber-deep));
  transition: height 0.6s cubic-bezier(0.4,0,0.2,1), box-shadow 0.3s ease;
}
.pdb-cyl-fill::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 5px;
  background: var(--amber-bright); opacity: 0.7;
}
.pdb-cyl-rings {
  position: absolute; inset: 0;
  background-image: repeating-linear-gradient(180deg, transparent 0 18px, rgba(255,255,255,0.05) 18px 19px);
  pointer-events: none;
}

/* ══════════════════════════════════════════════════════════════
   STAGE 2 — instant estimate (display + status + skeleton + flash)
   ══════════════════════════════════════════════════════════════ */
.pdb-stage2 { display: none; flex-direction: column; gap: 10px; min-height: 0; }

.pdb-est-status {
  font-family: var(--font-mono);
  font-size: 8.5px; font-weight: 700; letter-spacing: 0.03em;
  padding: 2px 8px; border-radius: 99px;
  background: #f3f4f6; color: #9ca3af;
  border: 1px solid #e5e7eb;
  white-space: nowrap;
  transition: all 0.3s ease;
}
.pdb-est-status.ready {
  background: rgba(16,122,87,0.12); color: #0f7a57; border-color: rgba(16,122,87,0.25);
}

.pdb-eline { position: relative; overflow: hidden; }
.pdb-skel {
  border-radius: 3px;
  background: linear-gradient(90deg,#f3f4f6 25%,#e9eaec 50%,#f3f4f6 75%);
  background-size: 200% 100%;
  animation: pdbShimmer 1s infinite;
}
.pdb-flash {
  position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(217,119,6,0.10), transparent);
  animation: pdbFlashSweep 0.6s ease forwards;
  pointer-events: none;
}

/* labor-tagged price in the ticker */
.pdb-row-price.lab { color: #818cf8; }

@media (max-width: 720px) {
  .pdb-accrue { grid-template-columns: 1fr; }
  .pdb-db { order: -1; }
}
