/* Consensus — institutional, understated, no costume. */

:root {
  --paper: #f7f6f2;
  --card: #ffffff;
  --ink: #1c2733;
  --muted: #6b7280;
  --line: #e2e0d8;
  --accent: #1e3a5f;
  --accent-soft: #eef2f7;
  --pos: #2f6b3a;
  --neg: #8a3324;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 16px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 1.25rem; }

/* header */
.site-header {
  background: var(--accent);
  color: #fff;
  border-bottom: 3px solid #16293f;
}
.header-row {
  display: flex; align-items: center; gap: 1.5rem; min-height: 3.4rem;
  flex-wrap: wrap; padding-top: .4rem; padding-bottom: .4rem;
}
.wordmark {
  font-family: Georgia, "Times New Roman", serif;
  letter-spacing: .28em;
  font-size: 1.05rem;
  color: #fff;
  font-weight: 700;
}
.wordmark:hover { text-decoration: none; }
.site-header nav { display: flex; gap: 1.1rem; flex: 1; }
.site-header nav a { color: #d8e1ec; font-size: .95rem; }
.site-header nav a:hover { color: #fff; text-decoration: none; }
.header-user { display: flex; align-items: center; gap: .9rem; }
.header-user a { color: #d8e1ec; font-size: .95rem; }
.user-chip {
  background: rgba(255,255,255,.12);
  padding: .25rem .7rem;
  border-radius: 999px;
  color: #fff !important;
  font-variant-numeric: tabular-nums;
}

/* layout basics */
main { padding: 3rem 0 3rem; min-height: 60vh; }
h1 { font-family: Georgia, serif; font-size: 1.7rem; margin: 0 0 .3rem; }
h2 { font-family: Georgia, serif; font-size: 1.2rem; margin: 2rem 0 .7rem; }
h3 { font-size: 1rem; margin: 1.4rem 0 .5rem; }
.page-head { margin-bottom: 1.4rem; }
.lede { color: var(--muted); margin: .2rem 0 0; }
.muted { color: var(--muted); }
.fine { color: var(--muted); font-size: .84rem; }
.pos { color: var(--pos); }
.neg { color: var(--neg); }

/* flashes & notices */
.flash {
  padding: .6rem .9rem; border-radius: 6px; margin-bottom: .9rem;
  border: 1px solid var(--line); background: var(--card); font-size: .95rem;
}
.flash-ok { border-left: 4px solid var(--pos); }
.flash-err { border-left: 4px solid var(--neg); }
.notice {
  background: var(--card); border: 1px solid var(--line);
  border-radius: 8px; padding: .9rem 1.1rem; margin-bottom: 1.2rem;
}
.notice-resolved { border-left: 4px solid var(--pos); }
.notice-voided { border-left: 4px solid var(--neg); }

/* chips */
.chip {
  display: inline-block; font-size: .72rem; text-transform: uppercase;
  letter-spacing: .07em; padding: .12rem .55rem; border-radius: 999px;
  vertical-align: middle;
}
.chip-open { background: #e5efe7; color: var(--pos); }
.chip-closed, .chip-draft { background: #efece3; color: #7a6a33; }
.chip-resolved { background: var(--accent-soft); color: var(--accent); }
.chip-voided { background: #f6e8e3; color: var(--neg); }

/* market cards */
.market-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1rem;
}
.market-card {
  display: block; background: var(--card); border: 1px solid var(--line);
  border-radius: 10px; padding: 1rem 1.1rem; color: var(--ink);
  transition: box-shadow .12s;
}
.market-card:hover { text-decoration: none; box-shadow: 0 2px 10px rgba(28,39,51,.08); }
.market-card-title { font-weight: 600; margin-bottom: .7rem; line-height: 1.35; }
.market-card-meta {
  display: flex; justify-content: space-between; gap: .5rem;
  color: var(--muted); font-size: .82rem; margin-top: .8rem;
}

/* price rows / bars */
.price-row { display: flex; align-items: center; gap: .6rem; margin: .3rem 0; }
.price-label { flex: 0 0 44%; font-size: .9rem; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; }
.price-bar-track {
  flex: 1; height: 8px; background: var(--accent-soft);
  border-radius: 4px; overflow: hidden; display: inline-block;
}
.price-bar-track.wide { width: 140px; margin-right: .7rem; vertical-align: middle; }
.price-bar { display: block; height: 100%; border-radius: 4px; }
.price-value { flex: 0 0 3.6rem; text-align: right; font-variant-numeric: tabular-nums;
  font-size: .9rem; font-weight: 600; }
.price-more { color: var(--muted); font-size: .8rem; margin-top: .2rem; }
.swatch {
  display: inline-block; width: 10px; height: 10px; border-radius: 3px;
  margin-right: .35rem; vertical-align: baseline;
}

/* market page */
.market-meta { display: flex; align-items: center; gap: .9rem; color: var(--muted);
  font-size: .9rem; flex-wrap: wrap; }
.market-columns { display: grid; grid-template-columns: 1fr 300px; gap: 1.6rem; }
@media (max-width: 820px) { .market-columns { grid-template-columns: 1fr; } }

.outcomes-table, .data-table {
  width: 100%; border-collapse: collapse; background: var(--card);
  border: 1px solid var(--line); border-radius: 8px; overflow: hidden;
  font-size: .93rem;
}
.outcomes-table th, .outcomes-table td,
.data-table th, .data-table td {
  padding: .55rem .8rem; border-bottom: 1px solid var(--line); text-align: left;
}
.outcomes-table tr:last-child td, .data-table tr:last-child td { border-bottom: 0; }
.outcomes-table thead th, .data-table thead th {
  background: var(--accent-soft); font-size: .78rem; text-transform: uppercase;
  letter-spacing: .05em; color: var(--accent);
}
th.num, td.num { text-align: right; font-variant-numeric: tabular-nums; }

.chart-block { margin-top: 1.1rem; background: var(--card);
  border: 1px solid var(--line); border-radius: 8px; padding: .8rem; }
.price-chart { width: 100%; height: auto; display: block; }
.gridline { stroke: var(--line); stroke-width: 1; }

.resolution-block {
  margin-top: 1.3rem; background: var(--card); border: 1px solid var(--line);
  border-left: 4px solid var(--accent); border-radius: 8px; padding: .9rem 1.1rem;
}
.resolution-block h3 { margin-top: 0; }
.resolution-block p { margin: .4rem 0; font-size: .93rem; }

/* trade panel */
.trade-panel {
  background: var(--card); border: 1px solid var(--line); border-radius: 10px;
  padding: 1rem 1.1rem; position: sticky; top: 1rem;
}
.trade-panel h3 { margin: .2rem 0 .6rem; }
.trade-panel h3 + form { margin-bottom: 1rem; }
.trade-form label { display: block; font-size: .85rem; color: var(--muted);
  margin-bottom: .6rem; }
.trade-form select, .trade-form input {
  display: block; width: 100%; margin-top: .25rem; padding: .45rem .55rem;
  border: 1px solid var(--line); border-radius: 6px; font-size: .95rem;
  background: #fff; color: var(--ink);
}
.quote { min-height: 1.2em; margin: .2rem 0 .5rem; }

/* buttons & forms */
.btn {
  display: inline-block; background: var(--accent); color: #fff; border: 0;
  padding: .5rem 1.1rem; border-radius: 6px; font-size: .95rem; cursor: pointer;
}
.btn:hover { background: #16293f; text-decoration: none; }
.btn-small { padding: .3rem .8rem; font-size: .85rem; }
.btn-danger { background: var(--neg); }
.btn-danger:hover { background: #6d2114; }
.linklike {
  background: none; border: 0; padding: 0; color: inherit; cursor: pointer;
  font: inherit; text-decoration: underline; opacity: .85;
}
.inline-form { display: inline; }

/* stats */
.stat-row { display: flex; gap: 1rem; flex-wrap: wrap; margin: 1rem 0 1.5rem; }
.stat {
  background: var(--card); border: 1px solid var(--line); border-radius: 10px;
  padding: .8rem 1.2rem; min-width: 10rem;
}
.stat-label { font-size: .78rem; text-transform: uppercase; letter-spacing: .06em;
  color: var(--muted); }
.stat-value { font-size: 1.45rem; font-weight: 650; font-variant-numeric: tabular-nums; }

/* auth */
.auth-box { max-width: 26rem; margin: 2rem auto; background: var(--card);
  border: 1px solid var(--line); border-radius: 10px; padding: 1.6rem 1.8rem; }
.auth-box label { display: block; font-size: .88rem; color: var(--muted);
  margin: .9rem 0; }
.auth-box input {
  display: block; width: 100%; margin-top: .3rem; padding: .5rem .6rem;
  border: 1px solid var(--line); border-radius: 6px; font-size: 1rem;
}
.auth-box .btn { width: 100%; margin-top: .6rem; }

/* admin */
.admin-market {
  background: var(--card); border: 1px solid var(--line); border-radius: 8px;
  padding: .8rem 1rem; margin-bottom: .8rem;
}
.admin-market-head { display: flex; align-items: center; gap: .8rem; flex-wrap: wrap; }
.admin-market-actions { display: flex; align-items: flex-start; gap: .6rem;
  margin-top: .6rem; flex-wrap: wrap; }
.admin-resolve summary { list-style: none; }
.admin-resolve summary::-webkit-details-marker { display: none; }
.admin-resolve form {
  margin-top: .6rem; padding: .8rem; background: var(--accent-soft);
  border-radius: 8px; max-width: 28rem;
}
.admin-resolve label { display: block; font-size: .85rem; color: var(--muted);
  margin-bottom: .6rem; }
.admin-resolve select, .admin-resolve textarea {
  display: block; width: 100%; margin-top: .25rem; padding: .4rem .5rem;
  border: 1px solid var(--line); border-radius: 6px; font: inherit;
}
.market-form { max-width: 40rem; }
.market-form label { display: block; font-size: .88rem; color: var(--muted);
  margin: 1rem 0; }
.market-form input, .market-form textarea, .market-form select {
  display: block; width: 100%; margin-top: .3rem; padding: .5rem .6rem;
  border: 1px solid var(--line); border-radius: 6px; font: inherit;
}

/* footer */
.site-footer {
  border-top: 1px solid var(--line); background: var(--card);
  padding: 1.1rem 0 1.4rem; color: var(--muted); font-size: .85rem;
}
.site-footer .wrap { display: flex; justify-content: space-between; gap: 1rem;
  flex-wrap: wrap; }
.footer-fine { font-size: .8rem; }

/* audit trail */
.audit-detail { max-width: 28rem; word-break: break-all; font-family: ui-monospace, monospace; font-size: 0.72rem; }
.log-tail { background: #14181d; color: #cdd5df; padding: 1rem; border-radius: 6px; font-size: 0.72rem; overflow-x: auto; max-height: 24rem; overflow-y: auto; }
