:root {
  --ink: #102019;
  --muted: #627269;
  --line: #dce7e0;
  --panel: #ffffff;
  --soft: #f3f8f5;
  --green: #27e879;
  --green-dark: #0d6b3a;
  --navy: #071d16;
  --danger: #a82c2c;
  --shadow: 0 16px 40px rgba(10, 44, 29, .08);
}

* { box-sizing: border-box; }
html { color-scheme: light; }
body { margin: 0; background: #f7faf8; color: var(--ink); font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; font-size: 16px; line-height: 1.55; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
button, .button { cursor: pointer; }

.topbar { min-height: 72px; padding: 0 4vw; display: flex; align-items: center; justify-content: space-between; background: var(--navy); color: #fff; border-bottom: 1px solid rgba(255,255,255,.12); position: sticky; top: 0; z-index: 20; }
.brand { display: flex; align-items: center; gap: .7rem; font-size: 1.05rem; letter-spacing: -.02em; }
.brand strong { color: var(--green); }
.brand-mark { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 10px; color: var(--navy); background: var(--green); font-size: 1.7rem; font-weight: 900; }
.topnav { display: flex; align-items: center; gap: 1.2rem; font-size: .9rem; }
.topnav a, .link-button { opacity: .84; transition: opacity .2s; }
.topnav a:hover, .link-button:hover { opacity: 1; }
.topnav .nav-cta { padding: .55rem .9rem; border-radius: 8px; color: var(--navy); background: var(--green); opacity: 1; font-weight: 800; }
.inline-form { display: inline; }
.link-button { border: 0; background: transparent; color: inherit; padding: 0; }

.shell { width: min(1180px, 92vw); margin: 0 auto; min-height: calc(100vh - 142px); padding: 3.2rem 0 5rem; }
footer { min-height: 70px; padding: 0 4vw; display: flex; align-items: center; justify-content: space-between; background: var(--navy); color: #b9c9c0; font-size: .85rem; }
footer a { color: #e8f2ec; }

h1, h2, h3 { line-height: 1.12; letter-spacing: -.035em; margin: 0 0 .75rem; }
h1 { font-size: clamp(2.25rem, 5vw, 4.8rem); }
h2 { font-size: 1.3rem; }
p { margin: 0 0 1rem; }
.muted { color: var(--muted); }
.eyebrow { display: block; color: var(--green-dark); font-size: .75rem; font-weight: 900; letter-spacing: .14em; margin-bottom: .75rem; }
.lead { color: #33453b; font-size: 1.08rem; }

.hero { display: grid; grid-template-columns: 1.25fr .75fr; gap: 5vw; align-items: center; min-height: 64vh; }
.hero h1 { max-width: 840px; }
.hero > div > p { max-width: 720px; color: var(--muted); font-size: 1.12rem; }
.flow-card { background: var(--navy); color: #fff; padding: 1.5rem; border-radius: 22px; box-shadow: var(--shadow); }
.flow-card div { display: grid; grid-template-columns: 54px 1fr; align-items: center; padding: 1.1rem 0; border-bottom: 1px solid rgba(255,255,255,.12); }
.flow-card div:last-child { border-bottom: 0; }
.flow-card b { color: var(--green); }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); padding: 1.5rem; }
.auth-wrap { display: grid; grid-template-columns: .9fr 1.1fr; gap: 5vw; align-items: start; max-width: 1040px; margin: 2rem auto; }
.auth-copy { padding-top: 2rem; }
.auth-copy h1 { font-size: clamp(2.5rem, 5vw, 4.6rem); }
.auth-copy > p { color: var(--muted); font-size: 1.05rem; }
.form-panel { padding: clamp(1.5rem, 4vw, 2.5rem); }
.form-panel.wide { max-width: 940px; }
.form-panel h2 { margin-bottom: 1.5rem; }
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
label { display: grid; gap: .45rem; margin-bottom: 1rem; font-size: .88rem; font-weight: 750; color: #263a30; }
input, select, textarea { width: 100%; border: 1px solid #cbd9d0; border-radius: 9px; padding: .78rem .85rem; background: #fff; color: var(--ink); outline: none; }
input:focus, select:focus, textarea:focus { border-color: #1aa85a; box-shadow: 0 0 0 3px rgba(39,232,121,.15); }
textarea { resize: vertical; }
fieldset { border: 0; padding: 0; margin: 0 0 1rem; }
legend { margin-bottom: .55rem; font-size: .88rem; font-weight: 750; }
.choice-row { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
.choice { display: block; margin: 0; }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice span { min-height: 88px; display: grid; align-content: center; gap: .2rem; padding: 1rem; border: 1px solid #cbd9d0; border-radius: 10px; }
.choice small { color: var(--muted); font-weight: 500; }
.choice input:checked + span { border-color: #15a756; background: #ecfff4; box-shadow: inset 0 0 0 1px #15a756; }
.consent { grid-template-columns: 20px 1fr; align-items: start; font-weight: 500; }
.consent input { width: 18px; height: 18px; margin-top: 3px; }
.fine-print, .form-links { color: var(--muted); font-size: .83rem; }
.form-links { display: flex; justify-content: space-between; margin-top: 1rem; }
.form-links a { color: var(--green-dark); font-weight: 750; }
.role-guide { display: grid; gap: .75rem; margin-top: 1.5rem; }
.role-guide div { display: grid; gap: .2rem; padding: 1rem; border-left: 3px solid var(--green); background: #fff; }
.role-guide span { color: var(--muted); font-size: .9rem; }

.button { display: inline-flex; min-height: 44px; padding: .7rem 1rem; align-items: center; justify-content: center; border-radius: 9px; border: 1px solid transparent; font-weight: 800; transition: transform .15s, box-shadow .15s; }
.button:hover { transform: translateY(-1px); }
.button.primary { background: var(--green); color: #062014; box-shadow: 0 8px 22px rgba(18, 190, 93, .2); }
.button.secondary { background: #fff; color: var(--ink); border-color: #c8d7ce; }
.button.danger { background: #fff1f1; color: var(--danger); border-color: #e8b7b7; }
.button.full { width: 100%; }
.actions { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: 1.5rem; }
.actions form { margin: 0; }

.alert { padding: .9rem 1rem; margin-bottom: 1rem; border-radius: 10px; border: 1px solid; }
.alert-success { background: #edfff5; border-color: #a8e6c2; color: #096434; }
.alert-error { background: #fff1f1; border-color: #ecc1c1; color: #8d2020; }
.alert-info { background: #eef7ff; border-color: #bdd9ef; color: #174c73; }
.center-card { max-width: 650px; margin: 5vh auto; text-align: center; padding: clamp(2rem, 6vw, 4rem); }
.center-card.narrow { max-width: 560px; text-align: left; }
.center-card h1 { font-size: clamp(2rem, 4vw, 3.3rem); }
.success-icon { width: 58px; height: 58px; display: grid; place-items: center; margin: 0 auto 1rem; border-radius: 50%; background: var(--green); font-size: 1.6rem; font-weight: 900; }

.page-head { display: flex; align-items: end; justify-content: space-between; gap: 2rem; margin-bottom: 2rem; }
.page-head h1 { font-size: clamp(2.2rem, 4vw, 3.8rem); }
.page-head p { color: var(--muted); }
.metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; margin-bottom: 1.5rem; }
.metric { display: grid; padding: 1.35rem; border: 1px solid var(--line); border-radius: 14px; background: #fff; }
.metric strong { font-size: 2rem; color: var(--green-dark); }
.metric span { color: var(--muted); font-size: .9rem; }
.dashboard-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.action-card { min-height: 210px; display: flex; flex-direction: column; justify-content: end; transition: transform .2s, border-color .2s; }
.action-card:hover { transform: translateY(-3px); border-color: #67cf94; }
.action-card p { color: var(--muted); }
.card-icon { color: var(--green-dark); font-size: 2rem; margin-bottom: auto; }

.filter-tabs { display: flex; gap: .35rem; padding: .35rem; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.filter-tabs a { padding: .55rem .8rem; border-radius: 7px; color: var(--muted); font-size: .86rem; font-weight: 750; }
.filter-tabs a.active { background: var(--navy); color: #fff; }
.listing-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; }
.listing-card { padding: 1.4rem; border: 1px solid var(--line); border-radius: 15px; background: #fff; box-shadow: 0 8px 24px rgba(10,44,29,.05); }
.listing-card h2 { margin-top: 1rem; }
.listing-card > p { color: var(--muted); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.listing-top, .listing-footer { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.listing-top { font-size: .78rem; }
.listing-footer { padding-top: 1rem; margin-top: 1rem; border-top: 1px solid var(--line); color: var(--muted); font-size: .88rem; }
.listing-footer a { color: var(--green-dark); font-weight: 800; }
.tags { display: flex; flex-wrap: wrap; gap: .4rem; }
.tags span { padding: .28rem .5rem; background: var(--soft); border-radius: 6px; color: #3b5044; font-size: .75rem; }
.status { display: inline-flex; width: fit-content; padding: .28rem .55rem; border-radius: 999px; font-size: .72rem; font-weight: 850; text-transform: capitalize; }
.status-demand, .status-approved, .status-accepted { background: #dffff0; color: #08703a; }
.status-supply, .status-sent { background: #eaf3ff; color: #285b94; }
.status-pending, .status-pending_admin, .status-pending_email { background: #fff5d8; color: #805b04; }
.status-rejected, .status-suspended { background: #ffeaea; color: #9a2727; }
.status-archived, .status-withdrawn { background: #edf0ee; color: #5c6861; }

.detail-layout { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 1rem; align-items: start; }
.detail-main { padding: clamp(1.5rem, 4vw, 3rem); }
.detail-main h1 { font-size: clamp(2.25rem, 5vw, 4rem); margin-top: 1rem; }
.detail-aside { position: sticky; top: 92px; }
.detail-list { display: grid; gap: 0; margin: 1.5rem 0; }
.detail-list div { display: grid; grid-template-columns: 150px 1fr; gap: 1rem; padding: .8rem 0; border-bottom: 1px solid var(--line); }
.detail-list dt { color: var(--muted); font-size: .82rem; font-weight: 700; }
.detail-list dd { margin: 0; font-weight: 700; }
.form-page { max-width: 960px; margin: 0 auto; }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 14px; background: #fff; box-shadow: var(--shadow); }
table { width: 100%; border-collapse: collapse; min-width: 760px; }
th, td { padding: .95rem 1rem; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: var(--soft); color: var(--muted); font-size: .76rem; letter-spacing: .06em; text-transform: uppercase; }
td { font-size: .9rem; }
td small { display: block; color: var(--muted); margin-top: .25rem; }
.admin-actions { display: flex; flex-wrap: wrap; gap: .35rem; }
.admin-actions button { padding: .35rem .55rem; border: 1px solid var(--line); border-radius: 6px; background: #fff; font-size: .75rem; font-weight: 750; }

.proposal-list { display: grid; gap: 1rem; }
.proposal { max-width: 900px; }
.proposal-head { display: flex; justify-content: space-between; gap: 1rem; }
.accepted-box { display: flex; align-items: center; flex-wrap: wrap; gap: .75rem; padding: 1rem; background: #effcf5; border: 1px solid #bce8cf; border-radius: 10px; }
.accepted-box .button { margin-left: auto; }
.messages { display: grid; gap: .75rem; margin: 1rem 0 1.5rem; }
.message { padding: 1rem; border-radius: 10px; background: var(--soft); }
.message p { margin: .4rem 0; }
.message small { color: var(--muted); }
.empty { grid-column: 1 / -1; text-align: center; padding: 3rem; }
.legal { max-width: 820px; margin: 0 auto; padding: clamp(1.5rem, 5vw, 3rem); }
.legal h1 { font-size: 3rem; }
.legal h2 { margin-top: 2rem; }

@media (max-width: 900px) {
  .topbar { padding: .75rem 4vw; align-items: flex-start; }
  .topnav { max-width: 62vw; justify-content: flex-end; flex-wrap: wrap; gap: .65rem 1rem; }
  .hero, .auth-wrap, .detail-layout { grid-template-columns: 1fr; }
  .hero { padding: 2rem 0; }
  .detail-aside { position: static; }
  .dashboard-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 680px) {
  .shell { width: min(94vw, 1180px); padding-top: 2rem; }
  .brand span:last-child { display: none; }
  .topnav { max-width: calc(100vw - 86px); font-size: .8rem; }
  .topnav a:not(.nav-cta) { display: none; }
  .field-grid, .choice-row, .metrics, .dashboard-grid, .listing-grid { grid-template-columns: 1fr; }
  .page-head { align-items: flex-start; flex-direction: column; }
  .filter-tabs { width: 100%; overflow-x: auto; }
  .filter-tabs a { white-space: nowrap; }
  .detail-list div { grid-template-columns: 1fr; gap: .2rem; }
  footer { align-items: flex-start; flex-direction: column; justify-content: center; gap: .3rem; }
}
