* { margin: 0; padding: 0; box-sizing: border-box; }

/* ── Animated background pattern ── */
.bg-anim {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}
.bg-anim-pattern {
  position: absolute;
  inset: -50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transform: rotate(-19.54deg);
}
.bg-anim-pattern > div {
  width: 300%;
  height: 300%;
  background-image: url(/content/bg-pattern.svg);
  background-size: 1000px;
  background-repeat: repeat;
  opacity: 0.15;
  animation: bg-slide 40s linear infinite;
}
@keyframes bg-slide {
  from { background-position: 0 0; }
  to   { background-position: -1000px 1000px; }
}

/* ── Global loading bar (visible while background fetches are in flight) ── */
#loadbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 3px;
  z-index: 9999;
  overflow: hidden;
  opacity: 0;
  transition: opacity 0.25s ease;
  pointer-events: none;
}
#loadbar.active { opacity: 1; }
#loadbar-fill {
  position: absolute;
  top: 0;
  height: 100%;
  width: 35%;
  background: #ec3750;
  border-radius: 0 2px 2px 0;
  animation: loadbar-slide 1.1s ease-in-out infinite;
}
@keyframes loadbar-slide {
  0%   { left: -35%; }
  100% { left: 100%; }
}
body {
  font-family: 'Bricolage Grotesque', 'DM Sans', system-ui, -apple-system, sans-serif;
  background: #f3e8d8;
  color: #000;
  min-height: 100vh;
}

.content-wrap {
  position: relative;
  z-index: 10;
}

.head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 32px 40px 0;
}
.head-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* ── Pipeline card ── */
.page {
  padding: 20px 40px;
  max-width: 780px;
  margin: 0 auto;
}
.card {
  background: #f3e8d8;
  border: 4px solid #000;
  border-radius: 20px;
  box-shadow: 4px 4px 0 0 #000;
  padding: 28px 32px;
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.card:hover {
  transform: scale(1.04);
}
.card-title {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 20px;
  font-family: 'Bricolage Grotesque', sans-serif;
}

.total-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 16px;
  padding-bottom: 16px;
  border-bottom: 2px solid #000;
}
.total-row .num {
  font-size: 44px;
  font-weight: 700;
  line-height: 1;
  font-family: 'DM Sans', sans-serif;
}
.total-row .desc {
  font-size: 16px;
  font-weight: 600;
  color: #444;
}

.bar-wrap {
  display: flex;
  height: 52px;
  border-radius: 10px;
  overflow: hidden;
  border: 2px solid #000;
  margin-bottom: 12px;
}
.bar-seg {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  transition: width 0.5s ease;
  text-shadow: 0 1px 3px rgba(0,0,0,0.5);
  position: relative;
}
.bar-seg:not(:last-child)::after {
  content: '';
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 2px;
  background: rgba(0,0,0,0.2);
}
.bar-seg span { position: relative; z-index: 1; }

.legend {
  display: flex;
  gap: 28px;
  flex-wrap: wrap;
}
.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
}
.dot {
  width: 12px;
  height: 12px;
  border-radius: 4px;
  border: 1.5px solid rgba(0,0,0,0.3);
  flex-shrink: 0;
}

.recent-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 2px solid #000;
}
.recent-row .recent-num {
  font-size: 24px;
  font-weight: 700;
  line-height: 1;
  font-family: 'DM Sans', sans-serif;
  color: #000;
}
.recent-row .desc {
  font-size: 14px;
  font-weight: 600;
  color: #444;
}
.recent-breakdown {
  font-size: 13px;
  font-weight: 600;
  color: #666;
}

.skel-bar {
  height: 52px;
  background: #ddd;
  border-radius: 10px;
  border: 2px solid #000;
  animation: pulse 1.5s infinite;
}
.skel-total {
  height: 44px;
  width: 100px;
  background: #ddd;
  border-radius: 8px;
  animation: pulse 1.5s infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 0.8; }
}

/* ── Login button / user info ── */
.head-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
}
.auth-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* ── DEV user-override box ── */
.dev-box {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  border: 2px dashed #000;
  border-radius: 10px;
  background: #fff8ee;
}
.dev-tag {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  background: #000;
  color: #f3e8d8;
  padding: 2px 6px;
  border-radius: 5px;
}
.dev-box input {
  border: 2px solid #000;
  border-radius: 7px;
  padding: 5px 8px;
  font-family: 'DM Sans', monospace;
  font-size: 12px;
  width: 150px;
  background: #fff;
}
.dev-box button {
  border: 2px solid #000;
  border-radius: 7px;
  padding: 5px 10px;
  background: #f3e8d8;
  font-family: 'Bricolage Grotesque', sans-serif;
  font-weight: 700;
  font-size: 12px;
  cursor: pointer;
}
.dev-box button:hover { background: #ffe9c7; }
#dev-clear { padding: 5px 9px; line-height: 1; }
.hca-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  border: 3px solid #000;
  border-radius: 12px;
  background: #ec3750;
  color: #fff;
  font-family: 'Bricolage Grotesque', sans-serif;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s ease;
  box-shadow: 3px 3px 0 0 #000;
  text-decoration: none;
}
.hca-btn:hover { transform: scale(1.03); }
.hca-btn:active { transform: scale(0.97); box-shadow: 1px 1px 0 0 #000; }

.user-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  border: 3px solid #000;
  border-radius: 12px;
  background: #f3e8d8;
  box-shadow: 3px 3px 0 0 #000;
  font-weight: 600;
  font-size: 14px;
}
.logout-btn {
  background: none;
  border: 2px solid #000;
  border-radius: 8px;
  padding: 6px 12px;
  font-family: 'Bricolage Grotesque', sans-serif;
  font-weight: 600;
  font-size: 12px;
  cursor: pointer;
  transition: transform 0.15s ease;
}
.logout-btn:hover { transform: scale(1.05); }

/* ── Projects island ── */
.island {
  margin-top: 20px;
  background: #f3e8d8;
  border: 4px solid #000;
  border-radius: 20px;
  box-shadow: 4px 4px 0 0 #000;
  padding: 0;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s ease, padding 0.3s ease;
}
.island.open {
  max-height: 2000px;
  padding: 24px 28px;
  overflow-y: auto;
  transition: max-height 0.4s ease, padding 0.3s ease, transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.island.open:hover {
  transform: scale(1.02);
}
.island-title {
  font-size: 18px;
  font-weight: 700;
  font-family: 'Bricolage Grotesque', sans-serif;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.project-item {
  padding: 12px 16px;
  border: 2px solid #000;
  border-radius: 12px;
  margin-bottom: 8px;
  background: #fff8ee;
}
.project-item:last-child { margin-bottom: 0; }
.project-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.project-info { min-width: 0; flex: 1; }
.project-title {
  font-weight: 700;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.project-link {
  color: inherit;
  text-decoration: none;
}
.project-link:hover {
  color: #ec3750;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.project-meta {
  font-size: 11px;
  color: #666;
  font-weight: 500;
  margin-top: 2px;
}
.project-status {
  flex-shrink: 0;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
}
/* ── Reviewer feedback + timeline ── */
.project-feedback {
  margin-top: 10px;
  padding: 8px 10px;
  border: 2px solid #000;
  border-radius: 8px;
  background: #fff;
  font-size: 12.5px;
  line-height: 1.4;
}
.feedback-label {
  display: block;
  font-weight: 700;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #666;
  margin-bottom: 3px;
}
.feedback-text { color: #222; }
.timeline-toggle {
  margin-top: 8px;
  background: none;
  border: none;
  padding: 2px 0;
  font-family: 'Bricolage Grotesque', sans-serif;
  font-weight: 700;
  font-size: 12px;
  color: #000;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.timeline {
  margin-top: 8px;
  padding-left: 14px;
  border-left: 2px solid #000;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
/* The [hidden] attribute alone can't hide a flex box — this rule makes the
   Show/Hide timeline toggle actually collapse it. */
.timeline[hidden] { display: none; }
.tl-event { position: relative; }
.tl-event::before {
  content: '';
  position: absolute;
  left: -21px;
  top: 3px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 2px solid #000;
  background: #d1d5db;
}
.tl-event.tl-approved::before { background: #22c55e; }
.tl-event.tl-rejected::before { background: #e05632; }
.tl-event.tl-submitted::before,
.tl-event.tl-resubmitted::before { background: #facc15; }
.tl-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}
.tl-type {
  font-weight: 700;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.tl-meta { font-size: 11px; color: #666; font-weight: 500; }
.tl-feedback {
  font-size: 12px;
  color: #333;
  margin-top: 3px;
  line-height: 1.4;
}
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  border: 2px solid #000;
}
.badge-pending    { background: #facc15; color: #000; }
.badge-approved   { background: #ffa936; color: #000; }
.badge-rejected   { background: #e05632; color: #fff; }
.badge-in-review  { background: #ab47bc; color: #fff; }
.badge-fraud      { background: #ef5350; color: #fff; }
.badge-finalized  { background: #42a5f5; color: #fff; }
.badge-unsubmitted { background: #d1d5db; color: #000; }
.badge-status-approved { background: #22c55e; color: #fff; }
.badge-status-pending  { background: #facc15; color: #000; }
.badge-status-rejected { background: #e05632; color: #fff; }
.badge-claimed {
  background: #f3e8d8;
  color: #000;
  border-style: dashed;
}
.badge-claimed::before {
  content: '\25CF';
  font-size: 8px;
  margin-right: 5px;
  color: #f5a623;
  vertical-align: middle;
}
.island-empty {
  padding: 24px;
  text-align: center;
  color: #666;
  font-weight: 600;
}
.island-loading {
  padding: 24px;
  text-align: center;
  color: #666;
}
.island-error {
  padding: 16px;
  text-align: center;
  color: #c62828;
  font-weight: 600;
}

/* ── Event blobs ── */
.events-card {
  margin-top: 20px;
}
.events-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
}
.event-blob {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 120px;
  padding: 16px 20px 14px;
  border: 3px solid #000;
  border-radius: 20px;
  background: #fff8ee;
  box-shadow: 3px 3px 0 0 #000;
  gap: 2px;
}
.event-blob-name {
  font-family: 'Bricolage Grotesque', sans-serif;
  font-weight: 700;
  font-size: 13px;
  text-align: center;
  line-height: 1.2;
  margin-bottom: 4px;
}
.event-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1;
}
.event-stat + .event-stat {
  margin-top: 4px;
}
.event-stat-num {
  font-size: 22px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.event-stat-num-sm {
  font-size: 16px;
  color: #444;
}
.event-stat-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  color: #666;
  letter-spacing: 0.05em;
  margin-top: 1px;
}
.events-skel {
  height: 16px;
  background: #ddd;
  border-radius: 6px;
  animation: pulse 1.5s infinite;
  margin-bottom: 8px;
}

.footer {
  text-align: center;
  padding: 32px 40px 40px;
  font-size: 13px;
  font-weight: 500;
  color: #888;
}
.footer-link {
  color: #ec3750;
  font-weight: 700;
  text-decoration: none;
}
.footer-link:hover { text-decoration: underline; }
.footer-sep { margin: 0 8px; color: #bbb; }

@media (max-width: 600px) {
  .head { padding: 20px 16px 0; flex-wrap: wrap; gap: 12px; }
  .page { padding: 16px; }
  .card { padding: 20px; }
  .total-row .num { font-size: 32px; }
  .bar-wrap { height: 42px; }
  .bar-seg { font-size: 13px; }
  .island.open { padding: 16px; }
  .project-item { flex-direction: column; align-items: flex-start; }
  .project-status { justify-content: flex-start; max-width: 100%; width: 100%; flex-wrap: wrap; }
  .head-right { align-items: stretch; width: 100%; }
  .dev-box input { flex: 1; width: auto; }
}

/* ── Priority review button ── */
.priority-btn {
  margin-left: auto;
  padding: 6px 14px;
  border: 2px solid #000;
  border-radius: 10px;
  background: #ec3750;
  color: #fff;
  font-family: 'Bricolage Grotesque', sans-serif;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s ease;
  box-shadow: 2px 2px 0 0 #000;
  white-space: nowrap;
}
.priority-btn:hover { transform: scale(1.04); }
.priority-btn:active { transform: scale(0.96); box-shadow: 1px 1px 0 0 #000; }
.priority-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

/* ── Per-project footer row: timeline toggle (left) + ship-cancel (right) ── */
.project-foot {
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.project-foot .timeline-toggle {
  margin-top: 0;
}
.project-foot .cancel-ship-btn {
  margin-left: auto;
}
.cancel-ship-btn {
  padding: 4px 12px;
  border: 2px solid #000;
  border-radius: 8px;
  background: #fff;
  color: #000;
  font-family: 'Bricolage Grotesque', sans-serif;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s ease;
  box-shadow: 2px 2px 0 0 #000;
  white-space: nowrap;
}
.cancel-ship-btn:hover { transform: scale(1.04); }
.cancel-ship-btn:active { transform: scale(0.96); box-shadow: 1px 1px 0 0 #000; }

/* ── Priority review modal ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}
.modal-card {
  background: #f3e8d8;
  border: 4px solid #000;
  border-radius: 20px;
  box-shadow: 6px 6px 0 0 #000;
  padding: 28px 32px;
  max-width: 520px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
}
.modal-title {
  font-family: 'Bricolage Grotesque', sans-serif;
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 6px;
}
.modal-desc {
  font-size: 13px;
  color: #555;
  margin-bottom: 20px;
  line-height: 1.4;
}
.modal-card label {
  display: block;
  font-weight: 700;
  font-size: 13px;
  margin-bottom: 5px;
  margin-top: 16px;
}
.modal-card label:first-of-type { margin-top: 0; }
.modal-card select,
.modal-card textarea {
  width: 100%;
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  border: 2px solid #000;
  border-radius: 10px;
  padding: 10px 12px;
  background: #fff;
  color: #000;
  outline: none;
}
.modal-card select:focus,
.modal-card textarea:focus {
  box-shadow: 0 0 0 3px rgba(236,55,80,0.3);
}
.modal-card textarea { resize: vertical; min-height: 80px; }
.char-count {
  display: block;
  text-align: right;
  font-size: 11px;
  color: #888;
  margin-top: 3px;
  font-weight: 500;
}
.modal-error {
  background: #fde8e8;
  border: 2px solid #e05632;
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 600;
  color: #c62828;
  margin-top: 16px;
}
.modal-success {
  text-align: center;
  padding: 20px 0;
}
.modal-success p {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 16px;
}
.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 20px;
}
.btn-primary {
  padding: 10px 22px;
  border: 2px solid #000;
  border-radius: 10px;
  background: #ec3750;
  color: #fff;
  font-family: 'Bricolage Grotesque', sans-serif;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s ease;
  box-shadow: 2px 2px 0 0 #000;
}
.btn-primary:hover { transform: scale(1.04); }
.btn-primary:active { transform: scale(0.96); box-shadow: 1px 1px 0 0 #000; }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn-secondary {
  padding: 10px 22px;
  border: 2px solid #000;
  border-radius: 10px;
  background: #f3e8d8;
  color: #000;
  font-family: 'Bricolage Grotesque', sans-serif;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s ease;
  box-shadow: 2px 2px 0 0 #000;
}
.btn-secondary:hover { background: #ffe9c7; transform: scale(1.04); }
.btn-secondary:active { transform: scale(0.96); box-shadow: 1px 1px 0 0 #000; }

/* ── Priority Review Stats ── */
.pr-stats-card {
  margin-top: 20px;
}
.pr-stats-section-label {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #888;
  margin-bottom: 10px;
}

/* ── Admin: Priority Review Queue ── */
.admin-card {
  margin-top: 20px;
  max-height: 500px;
  overflow-y: auto;
}

/* ── Admin: User Management ── */
.admin-card-desc {
  font-size: 13px;
  color: #666;
  margin-bottom: 16px;
  line-height: 1.4;
}
.admin-user-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  font-size: 13px;
  font-family: 'DM Sans', monospace;
  border: 2px solid #000;
  border-radius: 10px;
  margin-bottom: 8px;
  background: #fff8ee;
}
.admin-user-row:last-child {
  margin-bottom: 0;
}
.admin-user-id {
  flex: 1;
  font-weight: 600;
}
.admin-remove-btn {
  background: none;
  border: 2px solid #e74c3c;
  color: #e74c3c;
  border-radius: 8px;
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}
.admin-remove-btn:hover {
  background: #e74c3c;
  color: #fff;
}
.admin-add-row {
  display: flex;
  gap: 8px;
  margin-top: 16px;
  align-items: center;
}
.admin-input {
  flex: 1;
  min-width: 0;
  padding: 8px 12px;
  border: 2px solid #000;
  border-radius: 10px;
  font-size: 13px;
  font-family: 'DM Sans', monospace;
  background: #fff;
}
.admin-input:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(236,55,80,0.3);
}
.admin-btn {
  padding: 8px 16px;
  border: 2px solid #000;
  border-radius: 10px;
  font-family: 'Bricolage Grotesque', sans-serif;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
  box-shadow: 2px 2px 0 0 #000;
  white-space: nowrap;
}
.admin-btn:hover {
  transform: scale(1.02);
}
.admin-btn:active {
  transform: scale(0.98);
  box-shadow: 1px 1px 0 0 #000;
}
.admin-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}
.admin-btn-primary {
  background: #ec3750;
  color: #fff;
}
.admin-btn-secondary {
  background: #f3e8d8;
  color: #000;
}
.admin-btn-secondary:hover {
  background: #ffe9c7;
}
.session-id-form {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.session-id-status {
  margin-top: 10px;
  font-size: 12px;
  font-weight: 600;
}
.session-id-status.success {
  color: #22c55e;
}
.session-id-status.error {
  color: #e74c3c;
}
.admin-section-label {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #888;
  margin-bottom: 10px;
  margin-top: 16px;
}
.admin-section-label:first-child {
  margin-top: 0;
}
.admin-empty {
  padding: 20px;
  text-align: center;
  color: #888;
  font-size: 13px;
}
