:root {
  color-scheme: light;
  --bg: #fef9e7;
  --card: #ffffff;
  --text: #1f2933;
  --line: #d4d8dd;
  --accent: #175f3b;
  --pending-bg: #fef3c7;
  --pending-text: #92400e;
  --confirmed-bg: #dcfce7;
  --confirmed-text: #166534;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 1.5rem;
  background: var(--bg);
  color: var(--text);
  font-family: 'Nunito', Arial, sans-serif;
}

.page-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
  text-align: center;
}

.site-title {
  font-family: 'Pacifico', cursive;
  font-size: clamp(1.75rem, 5vw, 2.8rem);
  margin: 0;
  text-align: center;
  background: linear-gradient(135deg, #f59e0b 0%, #10b981 50%, #6366f1 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: floatTitle 4s ease-in-out infinite;
  filter: drop-shadow(0 2px 8px rgba(245, 158, 11, 0.3));
}

@keyframes floatTitle {
  0%, 100% { transform: translateY(0) rotate(-0.5deg); }
  50% { transform: translateY(-6px) rotate(0.5deg); }
}

.site-title {
  cursor: pointer;
}

.site-title:focus-visible {
  outline: 2px dashed var(--accent);
  outline-offset: 4px;
  border-radius: 0.25rem;
}

.wallet-status {
  margin: 0;
  font-size: 0.85rem;
  color: #475569;
}

/* About modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal-backdrop[hidden] {
  display: none;
}

.modal-box {
  position: relative;
  background: var(--card);
  border-radius: 0.75rem;
  padding: 2rem 2rem 1.75rem;
  max-width: 760px;
  width: 100%;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.22);
}

.modal-title {
  font-family: 'Pacifico', cursive;
  font-size: 1.4rem;
  color: var(--accent);
  margin: 0 0 0.75rem;
}

.modal-close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  border: none;
  background: transparent;
  font-size: 1.1rem;
  cursor: pointer;
  color: #64748b;
  line-height: 1;
  padding: 0.25rem 0.4rem;
  border-radius: 0.25rem;
  transition: color 0.15s, background 0.15s;
}

.modal-close:hover {
  color: var(--text);
  background: var(--line);
}

.about-slides-wrap {
  margin-bottom: 0.75rem;
}

.about-slides-embed {
  width: 100%;
  height: 420px;
  border: 1px solid var(--line);
  border-radius: 0.5rem;
}

.hero {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 0 0 1.5rem;
}

.hero-image {
  position: relative;
  z-index: 1;
  display: block;
  width: 300px;
  height: 300px;
  max-width: 100%;
  object-fit: contain;
  border-radius: 1rem;
  filter: drop-shadow(0 4px 18px rgba(23, 95, 59, 0.22));
  transition: filter 0.3s, transform 0.3s;
}

.hero-image:hover {
  filter: drop-shadow(0 8px 28px rgba(23, 95, 59, 0.38));
  transform: scale(1.02);
}

.bee {
  position: absolute;
  z-index: 2;
  font-size: 1.6rem;
  line-height: 1;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.18));
  pointer-events: none;
}

.bee-one {
  top: 12px;
  left: calc(50% - 220px);
  animation: buzzOne 4.2s ease-in-out infinite;
}

.bee-two {
  top: 52px;
  left: calc(50% + 160px);
  animation: buzzTwo 3.6s ease-in-out infinite;
}

@keyframes buzzOne {
  0%, 100% { transform: translate(0, 0) rotate(-8deg); }
  25% { transform: translate(16px, -10px) rotate(8deg); }
  50% { transform: translate(6px, 10px) rotate(-6deg); }
  75% { transform: translate(22px, -4px) rotate(10deg); }
}

@keyframes buzzTwo {
  0%, 100% { transform: translate(0, 0) scale(1) rotate(6deg); }
  30% { transform: translate(-18px, -12px) scale(1.04) rotate(-10deg); }
  60% { transform: translate(-10px, 8px) scale(0.98) rotate(8deg); }
  85% { transform: translate(-22px, -6px) scale(1.05) rotate(-6deg); }
}

.equation-section {
  text-align: center;
  margin: 0 0 2rem;
}

.equation {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 0.75rem 1.5rem;
  margin-bottom: 0.6rem;
}

.eq-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
}

.eq-label {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.eq-value {
  font-size: clamp(1.4rem, 4vw, 2.2rem);
  font-weight: 700;
  line-height: 1.1;
}

.eq-raised .eq-label { color: #16a34a; }
.eq-raised .eq-value {
  background: linear-gradient(135deg, #15803d, #4ade80);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  filter: drop-shadow(0 0 9px rgba(22, 163, 74, 0.45));
}

.eq-spent .eq-label { color: #dc2626; }
.eq-spent .eq-value {
  background: linear-gradient(135deg, #b91c1c, #fb923c);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  filter: drop-shadow(0 0 9px rgba(220, 38, 38, 0.4));
}

.eq-balance .eq-label { color: #4f46e5; }
.eq-balance .eq-value {
  background: linear-gradient(135deg, #3730a3, #6366f1, #c4b5fd);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: balanceGlow 3s ease-in-out infinite;
}

@keyframes balanceGlow {
  0%, 100% { filter: drop-shadow(0 0 7px rgba(99, 102, 241, 0.45)); }
  50% { filter: drop-shadow(0 0 20px rgba(99, 102, 241, 0.8)); }
}

.eq-op {
  font-size: 2rem;
  font-weight: 700;
  color: #94a3b8;
  line-height: 1.1;
  padding-bottom: 0.15rem;
}

.summary-note {
  font-size: 0.78rem;
  color: #64748b;
  margin: 0;
}

.ledger-heading {
  font-family: 'Pacifico', cursive;
  font-size: 1.3rem;
  color: var(--accent);
  margin: 0 0 0.75rem;
}

.ledger-heading-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.ledger-contract-link {
  font-family: 'Nunito', Arial, sans-serif;
  font-size: 0.82rem;
  font-weight: 700;
  color: #475569;
  text-decoration: none;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.1rem 0.55rem;
  max-width: 100%;
  white-space: nowrap;
}

.ledger-contract-link:hover {
  color: var(--accent);
  border-color: #9ca3af;
}

.ledger-contract-link:focus-visible {
  outline: 2px dashed var(--accent);
  outline-offset: 2px;
}

.filters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.8rem;
  margin-bottom: 1rem;
}

label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.9rem;
}

select,
input {
  border: 1px solid var(--line);
  border-radius: 0.35rem;
  padding: 0.45rem;
  font: inherit;
}

input[readonly] {
  background: #f8fafc;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  background: #fff;
  margin-bottom: 2rem;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  text-align: left;
  padding: 0.6rem;
  border-bottom: 1px solid var(--line);
  font-size: 0.9rem;
}

thead th {
  background: #fef3c7;
}

tbody tr:last-child td {
  border-bottom: none;
}

a {
  color: var(--accent);
}

.status-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 6.5rem;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.status-pending {
  background: var(--pending-bg);
  color: var(--pending-text);
}

.status-settled {
  background: var(--confirmed-bg);
  color: var(--confirmed-text);
}

.status-request,
.status-requested {
  background: #ede9fe;
  color: #5b21b6;
}

.status-committed {
  background: #dbeafe;
  color: #1e40af;
}

.status-canceled {
  background: #f1f5f9;
  color: #64748b;
}

.eq-ghost-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  min-height: 1.15rem;
  gap: 0.1rem;
  width: 100%;
}

.eq-ghost {
  font-size: 0.8rem;
  font-style: italic;
  line-height: 1.15;
  opacity: 0.45;
  letter-spacing: 0.01em;
}

.eq-ghost:empty {
  display: none;
}

.eq-ghost-pending {
  color: #64748b;
}

.eq-ghost-request {
  color: #7c3aed;
}


.entry-section {
  margin-bottom: 2rem;
}

.entry-helper {
  margin: 0 0 0.8rem;
  font-size: 0.85rem;
  color: #64748b;
}

.tx-status {
  margin: 0 0 0.8rem;
  font-size: 0.85rem;
}

.tx-status.info {
  color: #1d4ed8;
}

.tx-status.success {
  color: #166534;
}

.tx-status.error {
  color: #b91c1c;
}

.entry-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0.8rem;
}

.field-error {
  min-height: 1rem;
  font-size: 0.78rem;
  color: #b91c1c;
}

.field-note {
  font-size: 0.78rem;
  color: #64748b;
}

.entry-submit {
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
  border-radius: 0.35rem;
  padding: 0.6rem 1rem;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  align-self: end;
  min-height: 2.35rem;
}

.entry-submit:hover {
  filter: brightness(1.08);
}

button:disabled,
input:disabled,
select:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

.table-action {
  border: 1px solid var(--accent);
  background: #fff;
  color: var(--accent);
  border-radius: 0.35rem;
  padding: 0.35rem 0.65rem;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
}

.table-action:hover {
  background: #ecfdf5;
}

.actions-wrap {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.roadmap-section {
  width: calc(100% + 3rem);
  margin: 0 -1.5rem;
  padding: 0 1.5rem 0.4rem;
}

.roadmap-track-wrap {
  overflow-x: auto;
  padding-bottom: 0.6rem;
}

.roadmap-track {
  list-style: none;
  margin: 0;
  padding: 0;
  min-width: 900px;
  display: grid;
  grid-template-columns: repeat(8, minmax(120px, 1fr));
  gap: 1rem;
}

.roadmap-step {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding-top: 0.2rem;
}

.roadmap-step:not(:last-child)::after {
  content: '';
  position: absolute;
  top: 0.58rem;
  left: calc(50% + 0.5rem);
  width: calc(100% - 1rem);
  height: 2px;
  background: #cbd5e1;
  z-index: 0;
}

.roadmap-point {
  width: 1rem;
  height: 1rem;
  border-radius: 50%;
  background: #94a3b8;
  border: 2px solid #fff;
  box-shadow: 0 0 0 2px #cbd5e1;
  z-index: 1;
}

.roadmap-label {
  margin-top: 0.45rem;
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1.3;
}

.roadmap-step.is-current .roadmap-point {
  background: #16a34a;
  box-shadow: 0 0 0 2px #16a34a, 0 0 0 6px rgba(22, 163, 74, 0.2);
}

.roadmap-step.is-current .roadmap-label {
  color: #166534;
}

/* Right-side floating toolbar */
.right-toolbar {
  position: fixed;
  right: 0.75rem;
  top: 0.75rem;
  z-index: 30;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 0.75rem;
  padding: 0.5rem 0.4rem;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

.toolbar-metamask-icon {
  display: block;
  width: 1.6rem;
  height: 1.6rem;
  object-fit: contain;
}

.toolbar-item {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border: 2px solid transparent;
  background: transparent;
  border-radius: 0.5rem;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.15s;
}

.toolbar-item:hover {
  background: var(--bg);
  border-color: var(--accent);
  transform: scale(1.08);
}

.toolbar-item:focus-visible {
  outline: 2px dashed var(--accent);
  outline-offset: 2px;
}

.toolbar-item[aria-pressed="true"] {
  background: #ecfdf5;
  border-color: var(--accent);
}

/* Wallet info panel */
.wallet-view {
  margin: 2rem auto;
  max-width: 640px;
  padding: 0 1rem;
}

.wallet-view[hidden] {
  display: none;
}

.wallet-info-section {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 0.75rem;
  padding: 1.5rem 1.75rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.wallet-info-heading {
  font-family: 'Pacifico', cursive;
  font-size: 1.3rem;
  color: var(--accent);
  margin: 0 0 1rem;
}

.wallet-info-list {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.55rem 1rem;
  margin: 0 0 1.25rem;
  font-size: 0.9rem;
}

.wallet-info-list dt {
  font-weight: 700;
  color: #475569;
  white-space: nowrap;
}

.wallet-info-list dd {
  margin: 0;
  word-break: break-all;
  color: var(--text);
}

.wallet-connect-btn {
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
  border-radius: 0.35rem;
  padding: 0.6rem 1.25rem;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: filter 0.15s;
}

.wallet-connect-btn:hover {
  filter: brightness(1.08);
}

/* Labor & Services Payout panel */
.payout-view {
  margin: 2rem auto;
  max-width: 900px;
  padding: 0 1rem;
}

.payout-heading {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.4rem;
}

.payout-subheading {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.5rem;
}

.payout-intro {
  color: var(--muted);
  margin-bottom: 0.5rem;
  font-size: 0.95rem;
}

.payout-section {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 0.75rem;
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.25rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.payout-todo {
  display: none;
}

.payout-placeholder {
  color: var(--muted);
  font-size: 0.9rem;
  font-style: italic;
}

.payout-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
}

.payout-card {
  border: 1px solid var(--line);
  border-radius: 0.75rem;
  padding: 1rem;
  background: #fffef8;
}

.payout-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.85rem;
  margin: 1rem 0;
}

.payout-summary-card {
  border: 1px solid var(--line);
  border-radius: 0.75rem;
  background: #fff;
  padding: 0.85rem 1rem;
}

.payout-kpi-label {
  display: block;
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 0.2rem;
}

.payout-kpi {
  font-size: 1.25rem;
  color: var(--text);
}

.payout-note,
.payout-copy {
  font-size: 0.9rem;
  color: var(--muted);
}

.payout-note {
  border-left: 4px solid #f59e0b;
  background: #fff7ed;
  border-radius: 0.5rem;
  padding: 0.85rem 1rem;
}

.payout-note p:last-child,
.payout-copy:last-child {
  margin-bottom: 0;
}

.payout-form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.85rem;
}

.payout-field {
  display: grid;
  gap: 0.35rem;
}

.payout-field span,
.payout-checkbox span {
  font-size: 0.82rem;
  font-weight: 600;
  color: #475569;
}

.payout-field-full {
  grid-column: 1 / -1;
}

.payout-output {
  width: 100%;
  font: inherit;
  padding: 0.65rem;
  border-radius: 0.45rem;
  border: 1px solid var(--line);
  background: #f8fafc;
  min-height: 9rem;
}

.payout-status {
  min-height: 1.2rem;
  margin: 0.75rem 0 0;
  font-size: 0.85rem;
  color: #475569;
}

.payout-status.info {
  color: #1d4ed8;
}

.payout-status.success {
  color: #166534;
}

.payout-status.error {
  color: #b91c1c;
}

.payout-inline-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  align-items: center;
}

.payout-checkbox {
  display: flex;
  gap: 0.55rem;
  align-items: flex-start;
  grid-column: 1 / -1;
}

.payout-checkbox input {
  margin-top: 0.1rem;
}

.payout-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.payout-table th,
.payout-table td {
  padding: 0.55rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--line);
}

.payout-table th {
  font-weight: 600;
  background: var(--bg);
  white-space: nowrap;
}

.payout-empty {
  text-align: center;
  color: var(--muted);
  font-style: italic;
  padding: 1.25rem;
}

.payout-proof-links,
.payout-meta-stack {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

/* ---------- Utility ---------- */

.muted-text {
  color: #64748b;
  font-size: 0.82rem;
}

/* ---------- Danger action button ---------- */

.table-action-danger {
  border-color: #b91c1c;
  color: #b91c1c;
}

.table-action-danger:hover {
  background: #fef2f2;
}

/* ---------- Ledger notes column ---------- */

.note-wrap {
  display: flex;
  align-items: flex-start;
  gap: 0.3rem;
  max-width: 220px;
}

.note-preview {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: 0.85rem;
  line-height: 1.35;
  flex: 1;
  min-width: 0;
  word-break: break-word;
}

.note-expand-btn {
  flex-shrink: 0;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--accent);
  border-radius: 0.25rem;
  padding: 0.1rem 0.3rem;
  font-size: 0.7rem;
  line-height: 1;
  cursor: pointer;
  margin-top: 0.05rem;
}

.note-expand-btn:hover {
  background: #ecfdf5;
  border-color: var(--accent);
}

/* ---------- Revision history detail row ---------- */

.detail-row td,
.detail-cell {
  background: #f8fafc;
  border-top: none;
  padding: 0.75rem 1.1rem 1rem;
}

.revision-heading {
  margin: 0 0 0.5rem;
  font-size: 0.82rem;
  font-weight: 700;
  color: #475569;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.revision-timeline {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.revision-item {
  border-left: 3px solid var(--accent);
  padding: 0.4rem 0.75rem;
  background: #fff;
  border-radius: 0 0.35rem 0.35rem 0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.revision-item-header {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.2rem;
}

.revision-reason {
  font-size: 0.88rem;
  color: var(--text);
  margin-bottom: 0.2rem;
  line-height: 1.4;
}

.revision-meta {
  font-size: 0.78rem;
  color: #64748b;
}

@media (max-width: 640px) {
  .modal-box {
    padding: 1.75rem 1rem 1.25rem;
  }

  .about-slides-embed {
    height: 280px;
  }

  .bee-one {
    left: 1.25rem;
    top: 10px;
  }

  .bee-two {
    left: auto;
    right: 1.25rem;
    top: 42px;
  }

  .roadmap-section {
    width: calc(100% + 2rem);
    margin: 0 -1rem;
    padding: 0 1rem 0.4rem;
  }

  .right-toolbar {
    top: 0.5rem;
    right: 0.5rem;
  }
}
