/* Pombly — design system taken from the website mockup:
   cream canvas, ink text, crimson primary, dark navy footer, rounded cards. */
:root {
  --cream: #faf6ee;
  --card: #fffdf8;
  --ink: #1f2933;
  --muted: #6b7280;
  --line: #e8e0d0;
  --crimson: #c8374a;
  --crimson-dark: #a92a3c;
  --navy: #131b26;
  --gold: #f5c33b;
  --green: #2e7d4f;
  --green-bg: #e9f3ea;
  --blue: #2b6cb0;
  --orange: #d97b29;
  --red: #c0392b;
  --grey: #9aa1a9;
  --radius: 12px;
  --font: Calibri, Arial, "Helvetica Neue", Helvetica, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--cream); color: var(--ink);
  font-family: var(--font); font-size: 16px; line-height: 1.55;
}
.wrap { max-width: 1040px; margin: 0 auto; padding: 0 20px; }
a { color: var(--crimson-dark); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 2.3rem; line-height: 1.15; margin: 0.4em 0; }
h2 { font-size: 1.5rem; margin: 1.4em 0 0.5em; }
h3 { font-size: 1.15rem; margin: 1em 0 0.4em; }
.muted { color: var(--muted); font-size: 0.92rem; }
.small { font-size: 0.85rem; }

/* nav */
.topnav { background: var(--cream); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 50; }
.nav-inner { display: flex; align-items: center; gap: 18px; padding: 12px 20px; flex-wrap: wrap; }
.logo { font-weight: 800; font-size: 1.35rem; color: var(--ink); letter-spacing: -0.3px; display: flex; align-items: center; }
.logo img { height: 42px; display: block; }
.logo .dot { color: var(--crimson); }
.logo:hover { text-decoration: none; }
.photo { width: 100%; border-radius: 12px; border: 1px solid var(--line); display: block; }
.navlinks { display: flex; gap: 14px; flex-wrap: wrap; flex: 1; }
.navlinks a { color: var(--ink); font-size: 0.95rem; }
.nav-auth { display: flex; gap: 8px; align-items: center; }

/* buttons */
.btn {
  display: inline-block; border: 1.5px solid transparent; border-radius: 999px;
  padding: 10px 22px; font-weight: 700; font-size: 0.98rem; cursor: pointer;
  font-family: var(--font); text-align: center;
}
.btn:hover { text-decoration: none; }
.btn-sm { padding: 6px 16px; font-size: 0.88rem; }
.btn-primary { background: var(--crimson); color: #fff; }
.btn-primary:hover { background: var(--crimson-dark); }
.btn-dark { background: var(--navy); color: #fff; }
.btn-dark:hover { background: #223044; }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--ink); }
.btn-ghost:hover { background: #f0e9db; }
.btn-danger { background: #fff; color: var(--crimson-dark); border-color: var(--crimson); }
.btn-danger:hover { background: #fbeaec; }

/* cards & layout */
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px 22px; margin: 14px 0;
}
.grid { display: grid; gap: 14px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 760px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } }

.hero { padding: 48px 0 28px; }
.hero h1 { font-size: 2.9rem; }
.eyebrow {
  display: inline-block; border: 1px solid var(--line); border-radius: 999px;
  background: var(--card); padding: 3px 14px; font-size: 0.82rem; color: var(--muted);
}
.banner {
  background: #fdf3d7; border-bottom: 1px solid #eeddad; padding: 8px 0;
  font-size: 0.9rem; text-align: center;
}
.stat-num { font-size: 2.1rem; font-weight: 800; color: var(--crimson); }
.step-circle {
  width: 34px; height: 34px; border-radius: 50%; background: var(--crimson); color: #fff;
  display: inline-flex; align-items: center; justify-content: center; font-weight: 800;
}

/* forms */
label { display: block; font-weight: 700; font-size: 0.92rem; margin: 12px 0 4px; }
input[type=text], input[type=email], input[type=password], input[type=number],
input[type=date], select, textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px;
  font-family: var(--font); font-size: 0.98rem; background: #fff; color: var(--ink);
}
textarea { min-height: 96px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--gold); border-color: var(--gold); }
.form-narrow { max-width: 460px; }

/* tables */
table { width: 100%; border-collapse: collapse; font-size: 0.94rem; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: #f4eddd; font-size: 0.85rem; }
tr.highlight td { background: #fdeeee; }

/* badges */
.badge {
  display: inline-block; border-radius: 999px; padding: 2px 12px;
  font-size: 0.8rem; font-weight: 700;
}
.badge-gold { background: var(--gold); color: var(--navy); }
.badge-green { background: var(--green-bg); color: var(--green); }
.badge-red { background: #fbeaec; color: var(--crimson-dark); }
.badge-grey { background: #ece9e1; color: var(--muted); }
.badge-blue { background: #e3edf7; color: var(--blue); }
.badge-orange { background: #fbeedd; color: var(--orange); }

/* colour swatches (nation tiers) */
.sw { display: inline-block; width: 14px; height: 14px; border-radius: 4px; vertical-align: -2px; margin-right: 6px; }
.sw-Blue { background: var(--blue); } .sw-Green { background: var(--green); }
.sw-Orange { background: var(--orange); } .sw-Red { background: var(--red); }
.sw-Grey { background: var(--grey); }

/* flash messages */
.flashes { margin-top: 14px; }
.flash { border-radius: 8px; padding: 10px 16px; margin: 6px 0; font-weight: 600; }
.flash-ok { background: var(--green-bg); color: var(--green); border: 1px solid #bcd9c2; }
.flash-error { background: #fbeaec; color: var(--crimson-dark); border: 1px solid #eec4ca; }

/* dashboard tabs */
.tabs { display: flex; gap: 6px; margin: 20px 0 4px; flex-wrap: wrap; }
.tabs a {
  padding: 9px 18px; border-radius: 999px 999px 0 0; background: #f0e9db; color: var(--ink);
  font-weight: 700; font-size: 0.92rem; border: 1px solid var(--line); border-bottom: none;
}
.tabs a.active { background: var(--card); color: var(--crimson-dark); }
.tabs a:hover { text-decoration: none; background: var(--card); }

/* calendar */
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal-head { font-weight: 800; font-size: 0.8rem; color: var(--muted); text-align: center; }
.cal-day {
  min-height: 86px; background: var(--card); border: 1px solid var(--line);
  border-radius: 8px; padding: 6px; font-size: 0.82rem;
}
.cal-day.empty { background: transparent; border: none; }
.cal-day.today { outline: 2px solid var(--gold); }
.cal-daynum { font-weight: 800; color: var(--muted); }
.cal-event {
  display: block; background: #fbeaec; color: var(--crimson-dark); border-radius: 6px;
  padding: 2px 6px; margin-top: 4px; font-weight: 600; line-height: 1.25;
}

/* pipeline board */
.board { display: flex; align-items: flex-start; gap: 10px; overflow-x: auto; padding-bottom: 6px; }
.board-col {
  background: #f4eddd; border-radius: 10px; padding: 8px;
  flex: 0 0 auto; width: 176px; min-width: 150px; max-width: 460px;
  resize: horizontal; overflow: auto;   /* drag the bottom-right corner to resize */
}
.board-col h4 { margin: 4px 4px 8px; font-size: 0.85rem; }
.board-card {
  background: var(--card); border: 1px solid var(--line); border-radius: 8px;
  padding: 8px 10px; margin-bottom: 8px; font-size: 0.82rem;
}
.board-card .btn { width: 100%; margin-top: 6px; }
details.board-card > summary { cursor: pointer; list-style: none; position: relative; padding-right: 14px; }
details.board-card > summary::-webkit-details-marker { display: none; }
details.board-card > summary::after {
  content: "▸"; position: absolute; right: 0; top: 0; color: #b0a688; transition: transform 0.15s;
}
details.board-card[open] > summary::after { transform: rotate(90deg); }
.board-card-details { margin-top: 7px; padding-top: 7px; border-top: 1px dashed var(--line); }
@media (max-width: 900px) { .board { flex-wrap: wrap; } .board-col { width: 46%; } }

/* footer */
.footer { background: var(--navy); color: #cbd4de; margin-top: 56px; padding: 28px 0 34px; font-size: 0.9rem; }
.footer strong { color: #fff; }
.footlinks { display: flex; gap: 16px; flex-wrap: wrap; margin: 10px 0; }
.footlinks a { color: #cbd4de; }
.footer .muted { color: #7d8896; }

/* modal (locked contributor popup) */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(19,27,38,0.55); z-index: 100;
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.modal {
  background: var(--card); border-radius: var(--radius); max-width: 520px;
  padding: 26px 28px; box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

/* map */
#world-map { width: 100%; height: 460px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.map-legend { display: flex; gap: 18px; flex-wrap: wrap; margin-top: 10px; font-size: 0.88rem; }

/* misc */
.split { display: flex; gap: 20px; align-items: flex-start; flex-wrap: wrap; }
.split > * { flex: 1 1 300px; }
.center { text-align: center; }
.mt0 { margin-top: 0; }
.inline-form { display: inline; }
img.proof-thumb { max-width: 140px; border-radius: 8px; border: 1px solid var(--line); }
.postcard-preview {
  background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 18px;
  font-style: italic; box-shadow: 3px 4px 0 #e8e0d0;
}

/* ---------- V03: toasts, pulse, insights ---------- */
#toasts { position: fixed; right: 18px; bottom: 18px; z-index: 999; display: flex;
          flex-direction: column; gap: 8px; max-width: 340px; }
.toast { background: #1d1a14; color: #faf6ee; padding: 12px 16px; border-radius: 10px;
         font-size: 14px; line-height: 1.4; box-shadow: 0 8px 24px rgba(0,0,0,.25);
         opacity: 0; transform: translateY(12px); transition: all .35s ease; }
.toast.show { opacity: 1; transform: translateY(0); }
.toast-ok { border-left: 4px solid var(--gold, #c9a24b); }

@keyframes pombly-pulse { 0% { box-shadow: 0 0 0 0 rgba(201,162,75,.55); }
                          100% { box-shadow: 0 0 0 16px rgba(201,162,75,0); } }
.card.pulse { animation: pombly-pulse .9s ease-out 2; }

.charts-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
               gap: 16px; margin-top: 16px; }
.charts-grid .card { min-height: 300px; }
.charts-grid canvas { max-height: 260px; }
.stat-row { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 14px; }
.stat-box { background: #fff; border: 1px solid #e5ddca; border-radius: 12px;
            padding: 14px 20px; flex: 1; min-width: 140px; }
.stat-box .big { font-size: 26px; font-weight: 700; }

/* ---------- V04: tiers, i18n, address book, page blocks ---------- */

/* four-across card rows used by "How it works" and "Who Pombly is for" */
.grid-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 1020px) { .grid-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 620px)  { .grid-4 { grid-template-columns: 1fr; } }

/* warm icon badge on the "Who Pombly is for" cards */
.icon-badge {
  display: inline-flex; align-items: center; justify-content: center;
  width: 42px; height: 42px; border-radius: 12px; font-size: 21px;
  background: #f3e6cd; border: 1px solid #e3d3b0; margin-bottom: 6px;
}

/* language switcher in the top bar */
.lang-form { display: inline-block; margin-right: 6px; }
.lang-form select {
  margin: 0; padding: 6px 10px; font-size: 0.85rem; width: auto;
  border-radius: 999px; border: 1px solid var(--line); background: var(--card);
}

/* mission page pie chart */
.pie {
  width: 190px; height: 190px; border-radius: 50%; margin: 6px auto 14px;
  box-shadow: 0 6px 18px rgba(0,0,0,.12);
}

/* dense editing tables in the ops console */
table.dense th, table.dense td { padding: 5px 7px; font-size: 0.86rem; vertical-align: top; }
table.dense input, table.dense select, table.dense textarea { margin: 0; padding: 5px 7px; font-size: 0.86rem; }
td.neg, .neg { color: var(--crimson, #b3452f); font-weight: 600; }
.pay-due { color: var(--crimson, #b3452f); }

/* several images on one event */
.event-gallery { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.event-gallery img { width: 100%; border-radius: 8px; border: 1px solid var(--line); }

/* ops-added video blocks */
.video-wrap { position: relative; padding-bottom: 56.25%; height: 0; overflow: hidden; border-radius: 10px; }
.video-wrap iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

/* ops order pipeline columns */
.pipeline { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; margin-top: 16px; }
.pipe-col { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; }
.pipe-col h3 { margin: 0 0 10px; font-size: 0.95rem; }
.pipe-card { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 10px; margin-bottom: 10px; font-size: 0.86rem; }
.pipe-card form { margin-top: 6px; }

/* photos used across the public pages */
img.photo { width: 100%; border-radius: var(--radius); display: block; }

/* ---------- V05: console filters, collapsible orders, editors ---------- */

/* filter rows above tables */
.filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; }
.filters label { margin-top: 0; }
.filters input, .filters select { margin-bottom: 0; }

/* column show/hide checkboxes */
.col-toggles { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; font-size: 0.88rem; }
.col-toggles label { font-weight: 400; margin: 0; display: inline-flex; align-items: center; gap: 6px; }
.col-toggles input { width: auto; margin: 0; }

/* second row of tabs inside a console tab */
.tabs.subtabs { margin-top: 4px; }
.tabs.subtabs a { font-size: 0.85rem; }

/* pipeline columns scroll after three cards */
.pipe-scroll { max-height: 430px; overflow-y: auto; padding-right: 4px; }
.pipe-scroll::-webkit-scrollbar { width: 8px; }
.pipe-scroll::-webkit-scrollbar-thumb { background: #d8cfb8; border-radius: 4px; }

/* collapsed order card: country, member, contributor only */
details.pipe-card { padding: 0; }
details.pipe-card > summary {
  cursor: pointer; padding: 9px 10px; list-style: none; display: block;
}
details.pipe-card > summary::-webkit-details-marker { display: none; }
details.pipe-card > summary::after {
  content: '›'; float: right; transform: rotate(90deg); opacity: .5;
}
details.pipe-card[open] > summary::after { transform: rotate(270deg); }
details.pipe-card[open] > summary { border-bottom: 1px solid var(--line); }
.pipe-id { font-weight: 700; margin-right: 6px; }
.pipe-line { display: block; line-height: 1.35; }
.pipe-detail { padding: 10px; }
.pipe-detail form { margin-top: 6px; }

/* two-column wording editors (page layout, translations) */
table.content-edit { width: 100%; }
table.content-edit td, table.content-edit th { padding: 7px 8px; vertical-align: top; }
table.content-edit td.content-label { width: 34%; font-size: 0.86rem; }
table.content-edit textarea, table.content-edit input[type=text] { width: 100%; margin: 0; }

/* translation progress bar */
.meter { background: #eee5d2; border-radius: 999px; height: 12px; overflow: hidden; }
.meter span { display: block; height: 100%; background: var(--green, #2f7a4f); }

/* ---------- right-to-left languages (Arabic) ---------- */
[dir="rtl"] { text-align: right; }
[dir="rtl"] .nav-inner, [dir="rtl"] .navlinks, [dir="rtl"] .nav-auth,
[dir="rtl"] .tabs, [dir="rtl"] .map-legend, [dir="rtl"] .footlinks { direction: rtl; }
[dir="rtl"] table th, [dir="rtl"] table td { text-align: right; }
[dir="rtl"] .sw { margin-right: 0; margin-left: 6px; }
[dir="rtl"] ol, [dir="rtl"] ul { padding-right: 22px; padding-left: 0; }
[dir="rtl"] details.pipe-card > summary::after { float: left; }
[dir="rtl"] .center, [dir="rtl"] .card.center { text-align: center; }

/* order details stack label above value so nothing collides in a narrow column */
.pipe-detail dl { margin: 0 0 8px; }
.pipe-detail dt {
  font-size: 0.74rem; text-transform: uppercase; letter-spacing: .04em;
  color: #8a8168; margin-top: 7px;
}
.pipe-detail dd { margin: 1px 0 0; overflow-wrap: anywhere; }
