/* Colectif client portal — warm linen and cinnamon, one light theme by design. */
:root {
  color-scheme: light;
  --bg: #EFEBE5;
  --surface: #F9F7F3;
  --inset: #F3EFE9;
  --ink: #2F2A25;
  --muted: #6E665D;
  --line: #DDD5CA;
  --bronze: #9F6F62;
  --bronze-deep: #7E5448;
  --rust: #A35F4F;
  --rust-deep: #7D3E33;
  --sage: #56715C;
  --amber: #9A6B1E;
  --c1: #6F6553; --c2: #B6A687; --c3: #D9CEB8;
  --display: "Cormorant Garamond", "Playfair Display", Georgia, serif;
  --body: "Jost", "Avenir Next", "Helvetica Neue", Arial, sans-serif;
  --shadow: 0 1px 2px rgba(60,45,30,.06), 0 6px 18px rgba(60,45,30,.07);
}
* { box-sizing: border-box }
html, body { margin: 0 }
body { background: var(--bg); color: var(--ink); font-family: var(--body); font-size: 15px; line-height: 1.5; min-height: 100vh; }
[hidden] { display: none !important }
.num { font-variant-numeric: tabular-nums }
button, input, select { font: inherit; }
:focus-visible { outline: 2px solid var(--bronze); outline-offset: 2px; }
a { color: var(--bronze-deep); }

/* Top bar */
.bar-top { background: var(--surface); border-bottom: 1px solid var(--line); }
.bar-top .in { max-width: 1240px; margin: 0 auto; padding: 16px 24px; display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
.client-mark { font-family: var(--display); font-weight: 600; font-size: 26px; letter-spacing: .01em; line-height: 1.1; }
.powered { display: flex; align-items: center; gap: 16px; color: var(--muted); font-size: 14px; flex-wrap: wrap; }
.powered b { font-family: var(--display); font-weight: 600; font-size: 20px; color: var(--ink); letter-spacing: .02em; }
/* The Colectif logo (black, from colectif.com) */
.logo { display: block; height: 30px; width: auto; }
.logo-md { display: block; height: 26px; width: auto; }
.logo-sm { height: 15px; width: auto; margin-left: 5px; }
#poweredBy { display: inline-flex; align-items: center; }
.powered .sep { width: 1px; height: 26px; background: var(--line); }
.btn-out { background: var(--surface); border: 1px solid var(--line); border-radius: 3px; padding: 8px 16px; cursor: pointer; color: var(--ink); box-shadow: 0 1px 2px rgba(60,45,30,.06); text-decoration: none; font-size: 14px; }
.btn-out:hover { border-color: var(--bronze); }

.team-bar { background: #2F2A25; color: #EFE8DD; font-size: 13.5px; }
.team-bar .in { max-width: 1240px; margin: 0 auto; padding: 8px 24px; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.team-bar select { background: #3C352F; color: #F5EFE6; border: 1px solid #5A5047; border-radius: 3px; padding: 4px 8px; max-width: 100%; }
.team-bar a, .team-bar button { color: #E6D5B8; background: none; border: 0; padding: 0; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; font-size: 13.5px; }
.team-bar .grow { flex: 1 }

.wrap { max-width: 1240px; margin: 0 auto; padding: 44px 24px 72px; display: grid; gap: 36px; }
.hero { text-align: center; display: grid; gap: 8px; }
.hero h1 { font-family: var(--display); font-weight: 500; font-size: clamp(36px, 5.2vw, 58px); line-height: 1.05; margin: 0; text-wrap: balance; }
.hero p { margin: 0; color: var(--muted); font-size: 18px; }
.years { display: flex; justify-content: center; gap: 6px; flex-wrap: wrap; margin-top: 6px; }

.kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 16px; }
.kpi { background: var(--surface); border-radius: 4px; box-shadow: var(--shadow); padding: 18px 16px 20px; text-align: center; display: grid; gap: 10px; align-content: start; }
.kpi .l { font-size: 14.5px; color: var(--muted); padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.kpi .v { font-family: var(--display); font-size: 40px; line-height: 1; font-weight: 500; }
.kpi .v small { font-size: 22px; }
.kpi .s { font-size: 12.5px; color: var(--muted); }
.rule { height: 1px; background: var(--line); }

.grid { display: grid; grid-template-columns: minmax(0, .95fr) minmax(0, 2fr) minmax(0, 1.1fr); gap: 22px; align-items: start; }
.col { display: grid; gap: 22px; min-width: 0; }
.panel { background: var(--surface); border-radius: 4px; box-shadow: var(--shadow); padding: 20px 22px 22px; display: grid; gap: 16px; min-width: 0; }
.panel h2 { font-family: var(--display); font-weight: 500; font-size: 25px; margin: 0; padding-bottom: 12px; border-bottom: 1px solid var(--line); }

.coll { display: grid; gap: 12px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 3px; padding: 14px 14px 14px 16px; display: grid; grid-template-columns: minmax(0, 1fr) 54px; gap: 12px; align-items: center; box-shadow: 0 1px 2px rgba(60,45,30,.05); }
.card h3 { font-family: var(--display); font-weight: 600; font-size: 20px; margin: 0; line-height: 1.15; padding-bottom: 6px; border-bottom: 1px solid var(--line); }
.card p { margin: 6px 0 0; font-size: 13.5px; color: var(--muted); }
.card svg { width: 54px; height: 54px; }

.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg button { border: 1px solid var(--line); background: var(--surface); color: var(--muted); border-radius: 999px; padding: 5px 14px; font-size: 13px; cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--bronze); border-color: var(--bronze); color: #fff; }
.seg button:disabled { opacity: .45; cursor: default; }

.tbl { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
thead th { background: var(--inset); font-weight: 500; text-align: left; padding: 11px 12px; white-space: nowrap; font-size: 13.5px; }
td { padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
#inv td:first-child { white-space: nowrap; }
#inv td, #inv th { padding-inline: 9px; }
td.r, th.r { text-align: center; font-variant-numeric: tabular-nums; }
th.hl, td.hl { background: rgba(159,111,98,.10); }
.tier { display: block; font-size: 12px; color: var(--muted); }
.pill { display: inline-block; font-size: 12px; padding: 4px 12px; border-radius: 999px; white-space: nowrap; color: #fff; }
.p-low { background: var(--rust); }
.p-out { background: var(--rust-deep); }
.p-ok { background: transparent; color: var(--sage); border: 1px solid currentColor; }
.p-watch { background: transparent; color: var(--amber); border: 1px solid currentColor; }
.note { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; padding: 2px 4px 0; }
.note::before { content: ""; margin-top: 6px; border-left: 8px solid var(--bronze); border-top: 5px solid transparent; border-bottom: 5px solid transparent; }

.actions { display: flex; gap: 12px; flex-wrap: wrap; }
.btn { background: var(--bronze); color: #fff; border: 0; border-radius: 3px; padding: 12px 22px; font-size: 16px; font-weight: 500; cursor: pointer; box-shadow: 0 2px 6px rgba(80,60,30,.18); flex: 1 1 auto; text-align: center; text-decoration: none; }
.btn:hover, .btn[aria-expanded="true"] { background: var(--bronze-deep); }
.btn:disabled { opacity: .6; cursor: default; }
.drawer { background: var(--surface); border-left: 3px solid var(--bronze); border-radius: 3px; padding: 16px 18px; display: grid; gap: 10px; box-shadow: var(--shadow); }
.drawer h3 { margin: 0; font-family: var(--display); font-size: 22px; font-weight: 600; }
.drawer p, .drawer ol { margin: 0; font-size: 14px; max-width: 64ch; }
.drawer ol { padding-left: 20px; display: grid; gap: 4px; }
.copyrow { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.copyrow code { font-family: var(--body); font-size: 14px; background: var(--inset); border: 1px solid var(--line); padding: 5px 10px; border-radius: 3px; user-select: all; }
.ghost { background: transparent; border: 1px solid var(--line); color: var(--ink); border-radius: 3px; padding: 6px 12px; font-size: 13px; cursor: pointer; }
.ghost:hover { border-color: var(--bronze); }

.insight { background: var(--surface); border: 1px solid var(--line); border-radius: 3px; padding: 14px 14px 12px; display: grid; gap: 10px; }
.insight h3 { margin: 0; font-size: 14.5px; font-weight: 500; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.charts { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 12px; align-items: end; }
.charts svg { width: 100%; height: auto; display: block; overflow: visible; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 13px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 11px; height: 11px; display: inline-block; }

.rows { display: grid; }
.rowline { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 2px; border-bottom: 1px solid var(--line); font-size: 15px; flex-wrap: wrap; }
.rowline:last-child { border-bottom: 0; }
.dl { background: var(--c1); color: #fff; border: 0; border-radius: 3px; padding: 8px 14px; font-size: 14px; cursor: pointer; display: inline-flex; gap: 8px; align-items: center; }
.dl:hover { background: #564E40; }
.dl svg { width: 14px; height: 14px; }
.msg { font-size: 12.5px; color: var(--muted); }

.ship-tools { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; justify-content: space-between; }
.ship-tools input, .ship-tools select, .field input, .field select { font-size: 14px; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 3px; padding: 8px 12px; }
.ship-tools .f { display: flex; gap: 10px; flex-wrap: wrap; flex: 1 1 420px; min-width: 0; }
.ship-tools input { flex: 1 1 220px; min-width: 0; }
.count { font-size: 13px; color: var(--muted); }
a.trk { color: var(--bronze-deep); font-variant-numeric: tabular-nums; font-size: 13.5px; text-decoration: none; border-bottom: 1px solid rgba(126,84,72,.35); }
a.trk:hover { border-bottom-color: currentColor; }
.carrier { display: block; font-size: 12px; color: var(--muted); }
.st { font-size: 12.5px; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; }
.st::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.st-D { color: var(--sage); } .st-T, .st-S { color: var(--bronze-deep); } .st-W { color: var(--rust); } .st-P { color: var(--amber); }
.more { justify-self: center; background: transparent; border: 1px solid var(--bronze); color: var(--bronze-deep); border-radius: 3px; padding: 8px 20px; cursor: pointer; }
.empty { text-align: center; padding: 24px; color: var(--muted); }
.banner { background: #F6E9D6; border: 1px solid #E5CFAE; color: #5C4520; border-radius: 3px; padding: 10px 14px; font-size: 14px; }
footer { text-align: center; font-size: 13px; color: var(--muted); }

/* Loading + centered screens (sign-in, picker) */
.center { min-height: 100vh; display: grid; place-items: center; padding: 32px 16px; }
.box { background: var(--surface); box-shadow: var(--shadow); border-radius: 4px; padding: 40px 36px; width: min(440px, 100%); display: grid; gap: 18px; }
.box .mark { font-family: var(--display); font-weight: 600; letter-spacing: .28em; color: var(--bronze-deep); font-size: 20px; }
.box h1 { font-family: var(--display); font-weight: 500; font-size: 34px; line-height: 1.1; margin: 0; }
.box p { margin: 0; color: var(--muted); }
.field { display: grid; gap: 6px; font-size: 14px; }
.field input, .field select { font-size: 16px; padding: 11px 12px; width: 100%; }
.err { color: var(--rust-deep); font-size: 14px; }
.skeleton { color: var(--muted); text-align: center; padding: 80px 16px; font-size: 16px; }

.picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.picker a { background: var(--surface); box-shadow: var(--shadow); border-radius: 4px; padding: 20px; text-decoration: none; color: var(--ink); display: grid; gap: 4px; border: 1px solid transparent; }
.picker a:hover { border-color: var(--bronze); }
.picker b { font-family: var(--display); font-size: 24px; font-weight: 600; }
.picker span { color: var(--muted); font-size: 13px; }

@media (max-width: 1060px) {
  .grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .grid .c-mid { grid-column: 1 / -1; order: -1; }
  .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 700px) {
  .grid { grid-template-columns: minmax(0, 1fr); }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .kpis .kpi:last-child { grid-column: 1 / -1; }
  .kpi .v { font-size: 34px; }
  .powered .who, .powered .sep { display: none; }
  .wrap, .bar-top .in, .team-bar .in { padding-left: 16px; padding-right: 16px; }
  .box { padding: 32px 22px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important } }
