/* FreeFolk look (freefolk.co): white page, black ink, light grey panels, black pill buttons, Baloo Tammudu 2.
   FreeFolk Coin (FFC) takes the gold and green of its emblem; euros stay neutral grey. Fonts and images are
   served from this origin only (CSP: font-src/img-src 'self'). */
@font-face {
  font-family: 'FreeFolk Body'; font-style: normal; font-weight: 400 800; font-display: swap;
  src: url('/assets/fonts/BalooTammudu2-latin.woff2') format('woff2');
}
:root {
  --ink: #000; --muted: #5f6368; --paper: #fff; --panel: #ecf0f3; --card: #ecf0f3; --line: #d5dade; --highlight: #cccccc;
  --coin-gold: #c4922d; --coin-gold-soft: #f6ead0; --coin-green: #1f4a2c; --fiat: #3f454b; --fiat-soft: #e1e5e9;
  --ok: #1f4a2c; --ok-soft: #dcefe2; --warn: #7a5510; --warn-soft: #f6ead0; --red: #a3312b; --red-soft: #f7dedc;
  font-family: 'FreeFolk Body', Arial, Helvetica, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--paper); color: var(--ink); line-height: 1.45; font-size: 17px; }
h1, h2, h3 { font-weight: 800; letter-spacing: -0.01em; line-height: 1.15; }
h1 { font-size: 2.3rem; margin: 0.5rem 0 0.7rem; }
h2 { font-size: 1.25rem; margin: 0 0 0.6rem; }
h3 { font-size: 1.1rem; margin: 0.5rem 0 0.2rem; }
strong, b { font-weight: 700; }
a { color: var(--ink); text-decoration: underline; }
a:hover { text-decoration: none; }
code { font-size: 0.8rem; word-break: break-all; }

/* Header: white, black ink, navigation as pills; the active one is a black pill. */
.ffm-top { display: flex; align-items: center; gap: 0.6rem 0.7rem; flex-wrap: wrap; padding: 0.7rem 1.2rem; background: #fff; color: var(--ink);
  border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.ffm-top a { color: var(--ink); text-decoration: none; }
.ffm-brand { display: inline-flex; align-items: center; gap: 0.5rem; font-size: 1.3rem; font-weight: 800; letter-spacing: -0.02em; color: var(--ink) !important; }
.ffm-top nav { display: flex; gap: 0.15rem; flex-wrap: wrap; }
.ffm-top nav a { padding: 0.35rem 0.6rem 0.2rem; border-radius: 2rem; font-size: 0.9rem; font-weight: 600; white-space: nowrap; }
.ffm-top nav a:hover { background: var(--panel); }
.ffm-top nav a.active { background: #000; color: #fff; }
.ffm-top select { border-radius: 2rem; border: 1px solid var(--line); padding: 0.25rem 0.6rem; }
.ffm-flag { width: 1.5em; height: 1em; flex: none; border-radius: 2px; box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.15); }
.ffm-lang { position: relative; }
.ffm-lang-toggle { display: flex; align-items: center; gap: 0.45rem; background: var(--panel); color: var(--ink); font-weight: 600; padding: 0.35rem 0.8rem 0.25rem; border-radius: 2rem; }
.ffm-lang-toggle:hover:not(:disabled) { background: var(--highlight); }
.ffm-lang-chevron { font-size: 0.75rem; opacity: 0.8; }
.ffm-lang-menu { position: absolute; right: 0; top: calc(100% + 0.35rem); z-index: 20; min-width: 13rem; margin: 0; padding: 0.35rem; list-style: none;
  background: #fff; color: var(--ink); border: 1px solid var(--line); border-radius: 1rem; box-shadow: 0 10px 28px rgba(0, 0, 0, 0.18); }
.ffm-lang-menu li { display: flex; align-items: center; gap: 0.6rem; padding: 0.4rem 0.7rem 0.3rem; border-radius: 2rem; cursor: pointer; font-size: 0.95rem; }
.ffm-lang-menu li:hover, .ffm-lang-menu li:focus { background: var(--panel); outline: none; }
.ffm-lang-menu li.active { font-weight: 700; }
.ffm-lang-check { margin-left: auto; }
@media (max-width: 640px) { .ffm-lang-name { display: none; } }
.ffm-top .ffm-muted { color: var(--muted); font-size: 0.9rem; }
.ffm-spacer { flex: 1; }
.ffm-main { max-width: 1120px; margin: 0 auto; padding: 1.4rem 1.4rem 3rem; }
.ffm-narrow { max-width: 760px; margin: 0 auto; }
.ffm-brand-logo { width: 34px; height: 34px; flex: none; }
.ffm-foot { display: flex; align-items: center; justify-content: center; gap: 0.9rem; text-align: left; color: #fff; background: #000; font-size: 0.9rem; padding: 1.1rem 1.2rem 0.9rem; }
.ffm-foot img { width: 44px; height: 44px; flex: none; }

/* Landing */
.ffm-hero { padding: 1.6rem 0 0.4rem; }
.ffm-hero-logo { display: block; width: 150px; height: 150px; margin: 0 0 0.6rem; }
@media (max-width: 760px) { .ffm-hero-logo { width: 110px; height: 110px; } }
.ffm-hero h1 { font-size: 3.4rem; letter-spacing: -0.03em; }
.ffm-hero-small h1 { font-size: 2.4rem; }
.ffm-tagline { font-size: 1.2rem; color: var(--muted); margin-top: 0; }
.ffm-coin-intro { display: flex; align-items: center; gap: 0.9rem; background: var(--panel); border-radius: 1rem; padding: 0.8rem 1rem 0.6rem; margin: 1rem 0; }
.ffm-coin-intro img { width: 72px; height: 72px; flex: none; }
.ffm-coin-intro p { margin: 0; }
.ffm-login { max-width: 980px; margin: 2rem auto; padding: 0 1.4rem; display: grid; grid-template-columns: 1.2fr 1fr; gap: 2rem; align-items: start; }
@media (max-width: 760px) { .ffm-login, .ffm-detail-grid { grid-template-columns: 1fr !important; } .ffm-hero h1 { font-size: 2.4rem; } }

/* Panels and forms */
.ffm-card { background: var(--card); border: 0; border-radius: 1rem; padding: 1.1rem 1.2rem 0.9rem; margin-bottom: 1rem; }
.ffm-form { display: flex; flex-direction: column; gap: 0.8rem; }
.ffm-form label, .ffm-consideration label { display: flex; flex-direction: column; gap: 0.25rem; font-size: 0.95rem; font-weight: 700; }
input, textarea, select { font: inherit; padding: 0.55rem 0.75rem 0.4rem; border: 2px solid transparent; border-radius: 0.75rem; background: #fff; color: var(--ink); }
input:focus, textarea:focus, select:focus { outline: none; border-color: #000; }
textarea { min-height: 5.5rem; resize: vertical; }
.ffm-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }

/* Buttons: black pills with white bold text that shrink slightly on hover, as on freefolk.co. */
button { font: inherit; font-weight: 700; cursor: pointer; border: 0; border-radius: 2rem; padding: 0.6rem 1.25rem 0.45rem; background: #000; color: #fff;
  transition: transform 0.25s ease; }
button:hover:not(:disabled) { transform: scale(0.97); }
button:disabled { opacity: 0.45; cursor: default; }
button.ffm-secondary { background: #fff; color: #000; box-shadow: inset 0 0 0 2px #000; }
button.ffm-link { background: none; color: inherit; text-decoration: underline; padding: 0.2rem 0.3rem; font-weight: 400; border-radius: 0; }
button.ffm-link:hover:not(:disabled) { transform: none; text-decoration: none; }
.ffm-actions { display: flex; gap: 0.6rem; flex-wrap: wrap; align-items: center; justify-content: space-between; }

.ffm-muted { color: var(--muted); }
.ffm-note { color: var(--muted); font-size: 0.9rem; margin: 0.3rem 0; }
.ffm-error { color: var(--red); background: var(--red-soft); border-radius: 0.75rem; padding: 0.5rem 0.8rem 0.35rem; margin: 0.3rem 0; }
.ffm-ok { color: var(--ok); background: var(--ok-soft); border-radius: 0.75rem; padding: 0.5rem 0.8rem 0.35rem; }
.ffm-back { display: inline-block; margin-bottom: 0.5rem; text-decoration: none; font-weight: 600; }

/* Marketplace */
.ffm-search { display: flex; gap: 0.5rem; margin: 0.6rem 0; }
.ffm-search input { flex: 1; background: var(--panel); }
.ffm-filters { display: flex; gap: 0.4rem; align-items: center; flex-wrap: wrap; margin-bottom: 1rem; }
.ffm-filters select { background: var(--panel); border-radius: 2rem; }
.ffm-chip { background: var(--panel); color: var(--ink); border: 0; border-radius: 2rem; padding: 0.35rem 0.95rem 0.2rem; font-weight: 600; }
.ffm-chip.active { background: #000; color: #fff; }
.ffm-chip:hover:not(.active) { background: var(--highlight) !important; }

.ffm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 1rem; }
.ffm-listing { text-decoration: none; color: inherit; display: flex; flex-direction: column; gap: 0.25rem; margin: 0; transition: transform 0.25s ease; }
.ffm-listing:hover { transform: scale(0.98); }
.ffm-listing p { margin: 0; font-size: 0.9rem; }
.ffm-thumb, .ffm-photo { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 0.75rem; background: #dfe4e8; }
.ffm-noimage { display: flex; align-items: center; justify-content: center; color: #a5adb4; font-size: 2rem; }
.ffm-photos { display: grid; gap: 0.5rem; margin-bottom: 0.8rem; }
.ffm-avatar { width: 56px; height: 56px; border-radius: 50%; object-fit: cover; background: #dfe4e8; flex: none; }
.ffm-owner { display: flex; gap: 0.8rem; align-items: center; }
.ffm-owner p { margin: 0.2rem 0 0; }
.ffm-direction { align-self: flex-start; font-size: 0.74rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.06em; padding: 0.2rem 0.6rem 0.05rem; border-radius: 2rem; }
.ffm-direction-OFFER { background: #000; color: #fff; }
.ffm-direction-WANTED { background: #fff; color: #000; box-shadow: inset 0 0 0 2px #000; }
.ffm-detail-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 1.4rem; align-items: start; }
.ffm-description { white-space: pre-wrap; }

/* Each leg keeps its own colour and its own unit. They sit side by side, joined by "+". */
.ffm-legs { display: inline-flex; gap: 0.35rem; align-items: center; flex-wrap: wrap; margin: 0.25rem 0; }
.ffm-leg { display: inline-flex; align-items: center; gap: 0.3rem; font-weight: 800; padding: 0.2rem 0.7rem 0.05rem; border-radius: 2rem; white-space: nowrap; }
.ffm-leg-FIAT { background: var(--fiat-soft); color: var(--fiat); }
.ffm-leg-OSTRIS { background: var(--coin-gold-soft); color: var(--coin-green); box-shadow: inset 0 0 0 1px var(--coin-gold); }
.ffm-leg-OSTRIS::before { content: ''; width: 1.05em; height: 1.05em; margin-top: -0.15em; background: url('/assets/ffc-coin.png') center / contain no-repeat; }
.ffm-plus { font-weight: 800; color: var(--muted); }
.ffm-badges { display: inline-flex; gap: 0.3rem; flex-wrap: wrap; }
.ffm-badge { font-size: 0.76rem; font-weight: 700; padding: 0.15rem 0.6rem 0.02rem; border-radius: 2rem; border: 1px solid; }
.ffm-badge-ostris { color: var(--coin-green); border-color: var(--coin-gold); background: var(--coin-gold-soft); }
.ffm-badge-fiat { color: var(--fiat); border-color: #b9c0c6; background: var(--fiat-soft); }
.ffm-badge-mixed { color: #000; border-color: #000; background: #fff; }
.ffm-badge-none { color: var(--muted); border-color: var(--line); }
.ffm-fee { font-size: 0.88rem; color: var(--muted); margin-right: 0.8rem; }
.ffm-fees { margin: 0.5rem 0 0; font-size: 0.88rem; }

.ffm-consideration { border: 2px solid #000; border-radius: 1rem; padding: 0.7rem 0.9rem; display: flex; flex-direction: column; gap: 0.6rem; margin: 0; background: #fff; }
.ffm-consideration legend { font-weight: 800; padding: 0 0.4rem; }
.ffm-modes { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.ffm-modes label { flex-direction: row; align-items: center; gap: 0.35rem; border: 0; border-radius: 2rem; padding: 0.35rem 0.9rem 0.2rem; font-weight: 600; cursor: pointer; background: var(--panel); }
.ffm-modes label.active { background: #000; color: #fff; }
/* The radio stays for keyboard and screen readers; the pill shows the choice. */
.ffm-modes input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.ffm-modes label:focus-within { outline: 2px solid #000; outline-offset: 2px; }
.ffm-preview-role::first-letter { text-transform: uppercase; }
.ffm-amount { display: flex; align-items: center; gap: 0.5rem; }
.ffm-amount input { flex: 1; min-width: 0; background: var(--panel); }

/* Negotiations and agreements */
.ffm-list { display: flex; flex-direction: column; }
.ffm-rowlink { display: flex; gap: 1rem; align-items: center; justify-content: space-between; flex-wrap: wrap; text-decoration: none; color: inherit; margin-bottom: 0.6rem; transition: transform 0.25s ease; }
.ffm-rowlink:hover { transform: scale(0.99); }
.ffm-leg-states { display: flex; gap: 1rem; flex-wrap: wrap; }
.ffm-thread { list-style: none; padding: 0; margin: 0; }
.ffm-thread li.mine { border-left: 5px solid #000; }
.ffm-thread li.theirs { border-left: 5px solid var(--coin-gold); }
.ffm-thread p { margin: 0.25rem 0; }

.ffm-status { display: inline-block; font-size: 0.8rem; font-weight: 800; padding: 0.15rem 0.65rem 0.02rem; border-radius: 2rem; background: #dfe4e8; color: var(--ink); }
.ffm-status-COMPLETED, .ffm-status-COMMITTED, .ffm-status-EXECUTED, .ffm-status-ACCEPTED { background: var(--ok-soft); color: var(--ok); }
.ffm-status-FAILED, .ffm-status-CANCELLED, .ffm-status-DECLINED { background: var(--red-soft); color: var(--red); }
.ffm-status-PROCESSING, .ffm-status-AWAITING_SIGNATURES, .ffm-status-PARTIALLY_EXECUTED, .ffm-status-OPEN { background: var(--warn-soft); color: var(--warn); }
.ffm-status-PARTIALLY_EXECUTED_WITH_FAILURE { background: #f9e0cf; color: #9a4a22; }
.ffm-summary { display: flex; flex-direction: column; gap: 0.4rem; align-items: flex-start; }
.ffm-summary .ffm-leg { font-size: 1.45rem; }
.ffm-legcard header { display: flex; align-items: center; gap: 0.8rem; flex-wrap: wrap; margin-bottom: 0.3rem; }
.ffm-legcard header h2 { margin: 0; flex: 1; }
.ffm-legcard button { margin: 0.3rem 0.4rem 0.3rem 0; }
.ffm-checkout { border: 2px dashed #000; border-radius: 1rem; padding: 0.7rem 0.9rem; margin: 0.6rem 0; background: #fff; }
.ffm-checkout .ffm-actions { justify-content: flex-start; }
.ffm-events { margin: 0; padding-left: 1.2rem; font-size: 0.92rem; }
.ffm-audit { display: grid; grid-template-columns: max-content 1fr; gap: 0.3rem 1rem; margin: 0.7rem 0 0; font-size: 0.88rem; }
.ffm-audit dt { color: var(--muted); }
.ffm-audit dd { margin: 0; }
details summary { cursor: pointer; font-weight: 700; }
.ffm-table { width: 100%; border-collapse: collapse; margin: 0.5rem 0; }
.ffm-table th, .ffm-table td { text-align: left; padding: 0.45rem 0.5rem 0.3rem; border-bottom: 1px solid var(--line); font-size: 0.95rem; }
.ffm-modal { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.6); display: flex; align-items: center; justify-content: center; padding: 1rem; z-index: 10; }
.ffm-modal .ffm-card { max-width: 640px; width: 100%; max-height: 90vh; overflow: auto; margin: 0; background: #fff; }

/* MVP 0.2 — what each number means: provenance labels, references, details and structured terms */
.ffm-provenance { display: inline-block; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.02em; text-transform: uppercase; padding: 0.15rem 0.55rem 0.05rem;
  border-radius: 2rem; border: 1px solid var(--line); background: #fff; color: var(--muted); margin-right: 0.35rem; vertical-align: middle; cursor: help; }
.ffm-provenance-ASKED, .ffm-provenance-PROPOSED { border-style: dashed; }
.ffm-provenance-AGREED { border-color: #000; color: #000; }
.ffm-provenance-COMMITTED { background: #000; color: #fff; border-color: #000; }
.ffm-provenance-REFERENCE, .ffm-provenance-SEED, .ffm-provenance-OBSERVED { border-color: var(--coin-gold); color: var(--coin-green); }
.ffm-legend { margin: 0.4rem 0 1rem; font-size: 0.9rem; }
.ffm-legend summary { cursor: pointer; color: var(--muted); }
.ffm-legend dl { display: grid; grid-template-columns: max-content 1fr; gap: 0.4rem 0.8rem; margin: 0.6rem 0 0; }
.ffm-legend dd { margin: 0; color: var(--muted); }
.ffm-reference h2 { margin-top: 0; }
.ffm-reference-row { border-top: 1px solid var(--line); padding: 0.6rem 0; display: flex; flex-wrap: wrap; gap: 0.3rem 0.6rem; align-items: baseline; }
.ffm-reference-row p { flex-basis: 100%; margin: 0.1rem 0; }
.ffm-reference-kind { color: var(--muted); }
.ffm-reference-freedom { font-weight: 600; border-top: 1px solid var(--line); padding-top: 0.6rem; margin-bottom: 0; }
.ffm-fieldset { border: 1px solid var(--line); border-radius: 1rem; padding: 0.8rem 1rem; display: flex; flex-direction: column; gap: 0.7rem; }
.ffm-fieldset legend { font-weight: 700; padding: 0 0.4rem; }
.ffm-dimensions { display: flex; flex-wrap: wrap; gap: 0.6rem; }
.ffm-dimensions .ffm-note { flex-basis: 100%; }
.ffm-details { display: grid; grid-template-columns: max-content 1fr; gap: 0.3rem 1rem; margin: 0.6rem 0; }
.ffm-details dt { color: var(--muted); }
.ffm-details dd { margin: 0; overflow-wrap: anywhere; }
.ffm-private { border: 1px dashed var(--muted); border-radius: 1rem; padding: 0.6rem 1rem; margin: 0.6rem 0; }
.ffm-private p { margin: 0.3rem 0; white-space: pre-wrap; }
.ffm-open { background: var(--coin-gold-soft); border-radius: 0.8rem; padding: 0.5rem 0.8rem; }
.ffm-check { display: flex !important; flex-direction: row !important; gap: 0.5rem; align-items: flex-start; }
.ffm-check input { margin-top: 0.3rem; }
.ffm-availability { display: inline-block; font-size: 0.8rem; font-weight: 700; padding: 0.15rem 0.6rem 0.05rem; border-radius: 2rem; background: var(--panel); }
.ffm-availability-IN_CONVERSATION { background: var(--coin-gold-soft); }
.ffm-availability-COMMITTED { background: #000; color: #fff; }

/* Second login step (Shell/Core MFA) */
.ffm-mfa-secret { display: flex; flex-direction: column; gap: 0.3rem; background: var(--panel); border-radius: 1rem; padding: 0.8rem 1rem; }
.ffm-mfa-secret code { font-size: 1.15rem; letter-spacing: 0.08em; overflow-wrap: anywhere; }
.ffm-recovery { columns: 2; padding-left: 1.4rem; }
.ffm-recovery code { font-size: 1.05rem; }
.ffm-qr { width: min(13rem, 100%); height: auto; align-self: center; border-radius: 0.5rem; background: #fff; }

/* Obligation board (MVP 0.3): one card per obligation, each with its own status. */
.ffm-board { margin: 1.2rem 0; }
.ffm-board > h2 { margin-bottom: 0.2rem; }
.ffm-board-grid { display: grid; gap: 0.8rem; margin: 0.8rem 0; }
.ffm-obligation header { display: flex; align-items: center; gap: 0.8rem; flex-wrap: wrap; margin-bottom: 0.3rem; }
.ffm-obligation header h3 { margin: 0; flex: 1; }
.ffm-obligation .ffm-events { margin: 0.4rem 0; }
.ffm-superseded { opacity: 0.6; }
.ffm-declare { margin-top: 0.6rem; padding-top: 0.6rem; border-top: 1px solid rgba(0, 0, 0, 0.08); }
.ffm-declare textarea { min-height: 3.2rem; }
.ffm-declare button { justify-self: start; width: auto; padding-inline: 1.4rem; }
