/* Comptoir d'Atreia — feuille de style
   Principe : la couleur de qualité des objets est la vedette ; le reste reste sobre. */

@font-face {
  font-family: "Marcellus";
  src: url("../fonts/marcellus-latin-400-normal.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Marcellus";
  src: url("../fonts/marcellus-latin-ext-400-normal.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
  unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Source Sans 3";
  src: url("../fonts/source-sans-3-latin-wght-normal.woff2") format("woff2-variations");
  font-weight: 200 900;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Source Sans 3";
  src: url("../fonts/source-sans-3-latin-ext-wght-normal.woff2") format("woff2-variations");
  font-weight: 200 900;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Source Sans 3";
  src: url("../fonts/source-sans-3-latin-wght-italic.woff2") format("woff2-variations");
  font-weight: 200 900;
  font-style: italic;
  font-display: swap;
}

/* --- jetons : thème Abysse (sombre, par défaut) ------------------------------------ */
:root {
  color-scheme: dark;
  --bg: #0f1528;
  --panel: #161e36;
  --panel-2: #1c2643;
  --line: #283357;
  --line-strong: #3a4775;
  --text: #e8ebf5;
  --muted: #a3acc8;
  --faint: #8a93b3;
  --accent: #d7deff;
  --accent-ink: #121a33;
  --accent-hover: #ffffff;
  --focus: #9fb1ff;
  --gain: #5bd68f;
  --loss: #ff8080;
  --warn: #f6c35b;
  --g11: #bdc4d3;
  --g21: #6bd482;
  --g31: #62abff;
  --g41: #f3b740;
  --g51: #ff8a57;
  --g61: #c98bff;
  --g71: #49d3c4;
  --shadow: 0 18px 40px rgba(3, 6, 18, 0.55);
  --radius-s: 6px;
  --radius-m: 10px;
  --font-text: "Source Sans 3", "Segoe UI", system-ui, sans-serif;
  --font-display: "Marcellus", "Sitka Heading", Georgia, serif;
}

/* thème Élysée (clair) */
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #edf0f7;
  --panel: #ffffff;
  --panel-2: #f4f6fb;
  --line: #d8deeb;
  --line-strong: #b9c3d9;
  --text: #141b31;
  --muted: #4c5775;
  --faint: #5f6a89;
  --accent: #222d5c;
  --accent-ink: #ffffff;
  --accent-hover: #2f3d7a;
  --focus: #4057c9;
  --gain: #137a42;
  --loss: #c42b2b;
  --warn: #8f5d00;
  --g11: #5d6576;
  --g21: #1d8a3b;
  --g31: #1f6bd0;
  --g41: #9a6000;
  --g51: #c2410c;
  --g61: #7f3bd4;
  --g71: #0b7f75;
  --shadow: 0 14px 34px rgba(20, 30, 70, 0.16);
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    color-scheme: light;
    --bg: #edf0f7;
    --panel: #ffffff;
    --panel-2: #f4f6fb;
    --line: #d8deeb;
    --line-strong: #b9c3d9;
    --text: #141b31;
    --muted: #4c5775;
    --faint: #5f6a89;
    --accent: #222d5c;
    --accent-ink: #ffffff;
    --accent-hover: #2f3d7a;
    --focus: #4057c9;
    --gain: #137a42;
    --loss: #c42b2b;
    --warn: #8f5d00;
    --g11: #5d6576;
    --g21: #1d8a3b;
    --g31: #1f6bd0;
    --g41: #9a6000;
    --g51: #c2410c;
    --g61: #7f3bd4;
    --g71: #0b7f75;
    --shadow: 0 14px 34px rgba(20, 30, 70, 0.16);
  }
}

/* --- base ------------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 15px/1.5 var(--font-text);
  font-kerning: normal;
  min-height: 100vh;
}
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
::selection { background: color-mix(in srgb, var(--focus) 40%, transparent); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.num { font-variant-numeric: tabular-nums lining-nums; white-space: nowrap; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.gain { color: var(--gain); }
.loss { color: var(--loss); }
.warn { color: var(--warn); }
.nowrap { white-space: nowrap; }
.hidden { display: none !important; }

/* couleurs de qualité */
.g11 { --g: var(--g11); } .g21 { --g: var(--g21); } .g31 { --g: var(--g31); } .g41 { --g: var(--g41); }
.g51 { --g: var(--g51); } .g61 { --g: var(--g61); } .g71 { --g: var(--g71); } .g0 { --g: var(--muted); }
.gname { color: var(--g, var(--text)); }

/* --- en-tête ---------------------------------------------------------------------- */
.top {
  position: sticky;
  top: 0;
  z-index: 30;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.top-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 10px 24px 0;
  display: grid;
  grid-template-columns: auto minmax(220px, 520px) 1fr;
  grid-template-areas: "brand search right" "nav nav mode";
  align-items: center;
  column-gap: 24px;
}
.top-right { grid-area: right; justify-self: end; display: flex; gap: 10px; align-items: center; }
.account-wrap { position: relative; }
.account {
  display: flex; align-items: center; gap: 8px;
  height: 38px; padding: 0 14px 0 5px;
  border: 1px solid var(--line); background: var(--panel); border-radius: 19px;
  cursor: pointer; white-space: nowrap; font-weight: 600;
}
.account:hover { border-color: var(--line-strong); }
.avatar {
  width: 28px; height: 28px; border-radius: 50%;
  display: grid; place-items: center;
  font-family: var(--font-display); font-size: 15px;
  background: color-mix(in srgb, var(--g41) 22%, var(--panel-2)); color: var(--g41);
}
.menu {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 60;
  min-width: 230px; background: var(--panel); border: 1px solid var(--line-strong);
  border-radius: var(--radius-m); box-shadow: var(--shadow); padding: 6px; display: grid;
}
.menu .m-head { padding: 8px 10px 10px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.menu .m-head b { display: block; font-size: 15px; }
.menu .m-head span { font-size: 13px; color: var(--muted); }
.menu a, .menu button {
  all: unset; display: block; padding: 8px 10px; border-radius: var(--radius-s); cursor: pointer; font-size: 14.5px;
}
.menu a:hover, .menu button:hover, .menu a:focus-visible, .menu button:focus-visible { background: var(--panel-2); }
.mode-switch {
  grid-area: mode; justify-self: end; align-self: center;
  display: inline-flex; border: 1px solid var(--line-strong); border-radius: 17px; overflow: hidden; margin-top: 6px;
}
.mode-switch button {
  border: 0; background: transparent; height: 32px; padding: 0 14px; cursor: pointer;
  color: var(--muted); font-weight: 600; font-size: 13.5px; white-space: nowrap;
}
.mode-switch button + button { border-left: 1px solid var(--line-strong); }
.mode-switch button[aria-pressed="true"] { background: var(--panel-2); color: var(--text); box-shadow: inset 0 -2px 0 var(--focus); }
.mode-switch button[data-mode="forecast"][aria-pressed="true"] { box-shadow: inset 0 -2px 0 var(--warn); }
body.booting .top-inner > :not(.brand), body.auth .top-inner > :not(.brand) { display: none; }
body.booting footer.foot { visibility: hidden; }
.brand {
  grid-area: brand;
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  font-family: var(--font-display);
  font-size: 21px;
  letter-spacing: 0.01em;
  white-space: nowrap;
}
.brand svg { width: 26px; height: 26px; color: var(--g41); flex: none; }
.search { grid-area: search; position: relative; }
.search input {
  width: 100%;
  height: 38px;
  padding: 0 40px 0 38px;
  border-radius: 19px;
  border: 1px solid var(--line-strong);
  background: var(--panel);
}
.search input::placeholder { color: var(--faint); }
.search input:not(:placeholder-shown) ~ kbd { display: none; }
.search .s-icon { position: absolute; left: 13px; top: 10px; width: 18px; height: 18px; color: var(--faint); pointer-events: none; }
.search kbd {
  position: absolute; right: 12px; top: 9px;
  font: 600 12px/18px var(--font-text);
  padding: 0 6px; border-radius: 4px;
  border: 1px solid var(--line-strong); color: var(--faint);
}
.market {
  display: flex; align-items: center; gap: 8px;
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 19px;
  height: 38px;
  padding: 0 14px;
  cursor: pointer;
  white-space: nowrap;
}
.market:hover { border-color: var(--line-strong); }
.market .m-label { color: var(--muted); font-size: 13px; }
.market .m-value { font-weight: 600; }
.nav { grid-area: nav; display: flex; gap: 4px; margin-top: 8px; overflow-x: auto; scrollbar-width: none; }
.nav a {
  position: relative;
  padding: 9px 12px 11px;
  text-decoration: none;
  color: var(--muted);
  font-weight: 500;
  white-space: nowrap;
}
.nav a:hover { color: var(--text); }
.nav a[aria-current="page"] { color: var(--text); }
.nav a[aria-current="page"]::after {
  content: ""; position: absolute; left: 12px; right: 12px; bottom: -1px;
  height: 2px; background: var(--focus); border-radius: 2px;
}
.progress-line { position: absolute; left: 0; bottom: -1px; height: 2px; background: var(--g41); transition: width .6s ease; }

/* liste de suggestions de recherche */
.suggest {
  position: absolute; left: 0; right: 0; top: calc(100% + 6px);
  background: var(--panel);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-m);
  box-shadow: var(--shadow);
  padding: 6px;
  max-height: min(70vh, 520px);
  overflow-y: auto;
  z-index: 50;
}
.suggest-item {
  display: grid; grid-template-columns: 34px 1fr auto; gap: 10px; align-items: center;
  padding: 6px 8px; border-radius: var(--radius-s); cursor: pointer;
}
.suggest-item[aria-selected="true"], .suggest-item:hover { background: var(--panel-2); }
.suggest-item .s-name { font-weight: 600; line-height: 1.2; }
.suggest-item .s-sub { font-size: 12.5px; color: var(--muted); line-height: 1.3; }
.suggest-item .s-price { font-size: 13px; color: var(--muted); text-align: right; }
.suggest-foot { padding: 8px; font-size: 13px; color: var(--muted); border-top: 1px solid var(--line); margin-top: 4px; }
.suggest-foot a { color: var(--text); }
.suggest-empty { padding: 12px 10px; color: var(--muted); font-size: 14px; }

/* --- mise en page ----------------------------------------------------------------- */
main { max-width: 1280px; margin: 0 auto; padding: 28px 24px 80px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
h1, h2, h3 { font-weight: 400; margin: 0; }
h1 { font-family: var(--font-display); font-size: 31px; line-height: 1.15; letter-spacing: 0.005em; }
h2 { font-family: var(--font-display); font-size: 19px; line-height: 1.25; }
h3 { font-size: 15px; font-weight: 600; }
.lede { color: var(--muted); margin: 6px 0 0; max-width: 70ch; }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; }
.grid-item { display: grid; grid-template-columns: minmax(300px, 380px) minmax(0, 1fr); gap: 20px; align-items: start; }
.stack { display: grid; gap: 20px; align-content: start; }
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
  padding: 18px 20px;
  min-width: 0;
}
.panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.panel-head .hint { font-size: 13px; color: var(--muted); }
.panel.flat { background: transparent; border-style: dashed; }

/* --- boutons et champs ------------------------------------------------------------ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 36px; padding: 0 16px;
  border-radius: var(--radius-s);
  border: 1px solid var(--line-strong);
  background: var(--panel-2);
  color: var(--text);
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}
.btn:hover { border-color: var(--focus); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); padding: 0 10px; }
.btn.ghost:hover { color: var(--text); border-color: var(--line); }
.btn.danger:hover { color: var(--loss); border-color: var(--loss); }
.btn.small { height: 30px; padding: 0 10px; font-size: 13.5px; }
.btn svg { width: 16px; height: 16px; flex: none; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.icon-btn {
  display: inline-grid; place-items: center;
  width: 30px; height: 30px; border-radius: var(--radius-s);
  border: 1px solid transparent; background: transparent; color: var(--faint); cursor: pointer;
}
.icon-btn:hover { color: var(--text); border-color: var(--line); }
.icon-btn svg { width: 16px; height: 16px; }
.star { color: var(--faint); }
.star[aria-pressed="true"] { color: var(--g41); }
.star[aria-pressed="true"] svg { fill: currentColor; }

.field { display: grid; gap: 5px; min-width: 0; align-content: start; }
.field > span { font-size: 13px; color: var(--muted); }
.field .help { font-size: 12.5px; color: var(--faint); min-height: 18px; }
.field .help.ok { color: var(--muted); }
.field .help.bad { color: var(--loss); }
.input, select.input, textarea.input {
  width: 100%;
  height: 38px;
  padding: 0 11px;
  border-radius: var(--radius-s);
  border: 1px solid var(--line-strong);
  background: var(--bg);
  min-width: 0;
}
textarea.input { height: auto; padding: 8px 11px; resize: vertical; }
.input:focus { border-color: var(--focus); outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 25%, transparent); }
.input.big { height: 46px; font-size: 21px; font-weight: 600; font-variant-numeric: tabular-nums; }
.input[aria-invalid="true"] { border-color: var(--loss); }
.input:disabled { opacity: .5; cursor: not-allowed; }
.row { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.row > .field { flex: 1 1 120px; }
.form-grid { display: grid; gap: 12px; }
.form-grid.cols-2 { grid-template-columns: 1fr 1fr; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 14px; color: var(--muted); }
.check input { width: 16px; height: 16px; accent-color: var(--focus); }
.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: var(--radius-s); overflow: hidden; }
.seg button {
  border: 0; background: transparent; height: 34px; padding: 0 14px; cursor: pointer; color: var(--muted); font-weight: 600;
}
.seg button + button { border-left: 1px solid var(--line-strong); }
.seg button[aria-pressed="true"] { background: var(--panel-2); color: var(--text); box-shadow: inset 0 -2px 0 var(--focus); }
details.more summary { cursor: pointer; color: var(--muted); font-size: 13.5px; list-style: none; }
details.more summary::-webkit-details-marker { display: none; }
details.more summary::before { content: "+ "; }
details.more[open] summary::before { content: "− "; }
details.more[open] summary { margin-bottom: 10px; }

/* --- icônes d'objets -------------------------------------------------------------- */
.ico {
  --size: 34px;
  position: relative;
  width: var(--size); height: var(--size); flex: none;
  border-radius: 8px;
  background: color-mix(in srgb, var(--g, var(--muted)) 14%, var(--panel-2));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--g, var(--muted)) 55%, transparent);
  display: inline-grid; place-items: center; overflow: hidden;
}
.ico img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ico .letter { font-family: var(--font-display); color: var(--g, var(--muted)); font-size: calc(var(--size) * 0.48); line-height: 1; }
.ico.l { --size: 72px; border-radius: 12px; box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--g, var(--muted)) 70%, transparent), 0 0 32px -8px color-mix(in srgb, var(--g, var(--muted)) 60%, transparent); }
.ico.s { --size: 28px; border-radius: 6px; }

/* --- listes d'objets --------------------------------------------------------------- */
.item-list { display: grid; }
.item-row {
  display: grid;
  grid-template-columns: 40px minmax(0, 2.4fr) minmax(0, 1.2fr) minmax(110px, 0.9fr) 36px;
  gap: 14px; align-items: center;
  padding: 9px 12px;
  border-bottom: 1px solid var(--line);
  text-decoration: none;
}
.item-row:last-child { border-bottom: 0; }
.item-row:hover { background: var(--panel-2); }
.item-row .ir-name { font-weight: 600; line-height: 1.25; overflow-wrap: anywhere; }
.item-row .ir-en { font-size: 13px; color: var(--muted); line-height: 1.3; overflow-wrap: anywhere; }
.item-row .ir-cat { font-size: 13.5px; color: var(--muted); }
.item-row .ir-price { text-align: right; font-size: 14px; }
.item-row .ir-price small { display: block; color: var(--faint); font-size: 12px; }
.tag { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; color: var(--muted); }
.tag.bound { color: var(--faint); }
.tag svg { width: 13px; height: 13px; }

/* filtres du catalogue */
.filters { display: grid; grid-template-columns: minmax(200px, 1.6fr) repeat(2, minmax(150px, 1fr)); gap: 12px; margin-bottom: 12px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 14px; }
.chip {
  height: 30px; padding: 0 12px;
  border-radius: 15px;
  border: 1px solid color-mix(in srgb, var(--g, var(--line-strong)) 55%, transparent);
  background: transparent;
  color: var(--g, var(--muted));
  font-weight: 600; font-size: 13.5px; cursor: pointer;
}
.chip[aria-pressed="true"] { background: color-mix(in srgb, var(--g, var(--focus)) 18%, transparent); border-color: var(--g, var(--focus)); }
.list-foot { display: flex; justify-content: space-between; align-items: center; padding: 14px 12px 4px; color: var(--muted); font-size: 14px; gap: 12px; flex-wrap: wrap; }

/* --- tableau de bord ---------------------------------------------------------------- */
.ledger {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  border: 1px solid var(--line); border-radius: var(--radius-m);
  background: var(--panel);
  margin-bottom: 20px;
}
.ledger > div { padding: 16px 20px; min-width: 0; }
.ledger > div + div { border-left: 1px solid var(--line); }
.ledger .l-label { font-size: 13.5px; color: var(--muted); }
.ledger .l-value { font-size: 28px; font-weight: 600; line-height: 1.2; margin: 4px 0 2px; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ledger .l-sub { font-size: 13px; color: var(--faint); }
.alert-row {
  display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; gap: 12px; align-items: center;
  padding: 10px 0; border-bottom: 1px solid var(--line); text-decoration: none;
}
.alert-row:last-child { border-bottom: 0; }
.alert-row .a-what { font-size: 13.5px; }
.alert-row .a-what b { font-weight: 600; }
.signal { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; font-size: 13.5px; }
.signal::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; flex: none; }
.signal.buy { color: var(--gain); }
.signal.sell { color: var(--warn); }
.signal.npc { color: var(--g71); }
.signal.stale { color: var(--faint); }
.mini-list { display: grid; }
.mini-row { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 7px 0; border-bottom: 1px solid var(--line); text-decoration: none; font-size: 14px; }
.mini-row:last-child { border-bottom: 0; }
.mini-row .m-main { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.empty { color: var(--muted); font-size: 14px; padding: 6px 0; max-width: 60ch; }
.steps { margin: 0; padding: 0; list-style: none; display: grid; gap: 12px; counter-reset: step; }
.steps li { display: grid; grid-template-columns: 30px 1fr; gap: 12px; align-items: start; counter-increment: step; }
.steps li::before {
  content: counter(step);
  width: 28px; height: 28px; border-radius: 50%;
  display: grid; place-items: center;
  border: 1px solid var(--line-strong);
  font-family: var(--font-display); color: var(--g41);
}
.steps b { display: block; font-weight: 600; }
.steps span { color: var(--muted); font-size: 14px; }

/* état du catalogue */
.import-card { display: grid; gap: 10px; }
.bar { height: 6px; border-radius: 3px; background: var(--panel-2); overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--g41); border-radius: 3px; transition: width .6s ease; }
.banner {
  display: flex; gap: 14px; align-items: center; justify-content: space-between; flex-wrap: wrap;
  border: 1px solid var(--line); border-left: 3px solid var(--g41);
  background: var(--panel); border-radius: var(--radius-m);
  padding: 12px 16px; margin-bottom: 20px; font-size: 14px;
}
.banner.error { border-left-color: var(--loss); }

/* --- fiche objet -------------------------------------------------------------------- */
.item-head { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 20px; align-items: start; margin-bottom: 22px; }
.item-head h1 { font-size: 32px; color: var(--g, var(--text)); overflow-wrap: anywhere; }
.item-head .en { color: var(--muted); margin-top: 2px; }
.facts { display: flex; flex-wrap: wrap; gap: 8px 26px; margin: 12px 0 0; }
.facts div { display: grid; gap: 1px; }
.facts dt { font-size: 12.5px; color: var(--faint); }
.facts dd { margin: 0; font-weight: 600; font-size: 14.5px; }
.item-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.desc { color: var(--muted); font-size: 14px; margin: 12px 0 0; max-width: 75ch; }
.note-line { font-size: 13px; color: var(--faint); margin-top: 8px; }

/* la balance : où se situe un prix par rapport au marché */
.balance { display: grid; gap: 16px; }
.balance-top { display: grid; grid-template-columns: minmax(150px, 220px) minmax(0, 1fr); gap: 20px; align-items: end; }
.verdict { min-height: 64px; }
.verdict .v-title { font-family: var(--font-display); font-size: 26px; line-height: 1.15; }
.verdict .v-text { color: var(--muted); font-size: 14.5px; margin-top: 3px; }
.verdict.good .v-title { color: var(--gain); }
.verdict.fair .v-title { color: var(--text); }
.verdict.dear .v-title { color: var(--warn); }
.verdict.bad .v-title { color: var(--loss); }
.verdict.none .v-title { color: var(--muted); font-size: 20px; }
.scale { position: relative; height: 92px; margin: 2px 6px 0; }
.scale .track { position: absolute; left: 0; right: 0; top: 46px; height: 2px; background: var(--line-strong); border-radius: 1px; }
.scale .range { position: absolute; top: 40px; height: 14px; border-radius: 7px; background: color-mix(in srgb, var(--focus) 22%, transparent); border: 1px solid color-mix(in srgb, var(--focus) 45%, transparent); }
.scale .tick { position: absolute; top: 34px; width: 0; height: 26px; border-left: 2px solid var(--muted); }
.scale .tick.median { border-left-color: var(--text); top: 30px; height: 34px; border-left-width: 3px; }
.scale-legend { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 13px; color: var(--muted); margin-top: -6px; }
.scale-legend:empty { display: none; }
.scale-legend .lg { display: inline-flex; align-items: center; gap: 6px; }
.scale-legend .lg::before { content: ""; width: 0; height: 12px; border-left: 2px solid var(--muted); }
.scale-legend .lg.median::before { border-left: 3px solid var(--text); }
.scale-legend .lg.npc::before { border-left: 2px dashed var(--g71); }
.scale-legend .lg.tbuy::before { border-left-color: var(--gain); }
.scale-legend .lg.tsell::before { border-left-color: var(--warn); }
.scale-legend .lg.range::before { width: 14px; height: 8px; border: 1px solid color-mix(in srgb, var(--focus) 45%, transparent); background: color-mix(in srgb, var(--focus) 22%, transparent); border-radius: 4px; }
.scale-legend b { color: var(--text); font-weight: 600; }
.scale .tick.npc { border-left-style: dashed; border-left-color: var(--g71); }
.scale .tick.tbuy { border-left-color: var(--gain); }
.scale .tick.tsell { border-left-color: var(--warn); }
.scale .tick-label {
  position: absolute; top: 66px; transform: translateX(-50%);
  font-size: 12px; color: var(--muted); white-space: nowrap; text-align: center; line-height: 1.25;
}
.scale .tick-label b { display: block; color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.scale .pin {
  position: absolute; top: 4px; transform: translateX(-50%);
  display: grid; justify-items: center; gap: 2px;
  transition: left .45s cubic-bezier(.2, .8, .2, 1);
  color: var(--text); z-index: 2;
}
.scale .pin b { font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; padding: 1px 7px; border-radius: 9px; background: var(--pin, var(--text)); color: var(--bg); white-space: nowrap; }
.scale .pin i { width: 14px; height: 14px; transform: rotate(45deg); background: var(--pin, var(--text)); margin-top: 6px; box-shadow: 0 0 0 3px var(--panel); }
.balance-math { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px 20px; border-top: 1px solid var(--line); padding-top: 14px; }
.balance-math:empty { display: none; }
.balance-math div { display: grid; gap: 1px; }
.balance-math dt { font-size: 12.5px; color: var(--faint); }
.balance-math dd { margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; }

/* statistiques en ligne */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px 20px; margin-bottom: 14px; }
.stats div { display: grid; gap: 1px; }
.stats dt { font-size: 12.5px; color: var(--faint); }
.stats dd { margin: 0; font-size: 18px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.stats dd small { font-size: 12.5px; font-weight: 400; color: var(--muted); margin-left: 4px; }

/* graphiques */
.chart { position: relative; width: 100%; }
.chart svg { display: block; width: 100%; overflow: visible; }
.chart .axis text { fill: var(--faint); font-size: 11.5px; font-family: var(--font-text); }
.chart .grid line { stroke: var(--line); stroke-width: 1; }
.chart .median-line { fill: none; stroke: var(--focus); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .dot { fill: var(--panel); stroke: var(--focus); stroke-width: 1.6; }
.chart .dot.out { stroke: var(--loss); stroke-dasharray: 2 2; stroke-width: 1.8; }
.chart .ref { stroke-width: 1.5; stroke-dasharray: 5 4; }
.chart .ref.tbuy { stroke: var(--gain); }
.chart .ref.tsell { stroke: var(--warn); }
.chart .ref.npc { stroke: var(--g71); }
.chart .ref-label { font-size: 11.5px; font-family: var(--font-text); paint-order: stroke; stroke: var(--panel); stroke-width: 4px; stroke-linejoin: round; }
.chart .ref-label.tbuy { fill: var(--gain); }
.chart .ref-label.tsell { fill: var(--warn); }
.chart .ref-label.npc { fill: var(--g71); }
.chart .cross { stroke: var(--line-strong); stroke-width: 1; }
.chart .fc-band { fill: color-mix(in srgb, var(--warn) 16%, transparent); stroke: none; }
.chart .fc-line { fill: none; stroke: var(--warn); stroke-width: 2; stroke-dasharray: 6 4; }
.chart .fc-dot { fill: var(--warn); }
.chart .today { stroke: var(--line-strong); stroke-width: 1; stroke-dasharray: 2 3; }
.chart .fc-label { fill: var(--warn); font-size: 11.5px; font-family: var(--font-text); paint-order: stroke; stroke: var(--panel); stroke-width: 4px; }
.chart-tip {
  position: absolute; pointer-events: none; z-index: 5;
  background: var(--panel-2); border: 1px solid var(--line-strong); border-radius: var(--radius-s);
  padding: 6px 9px; font-size: 13px; box-shadow: var(--shadow); white-space: nowrap;
}
.chart-empty { display: grid; place-items: center; height: 180px; color: var(--muted); font-size: 14px; border: 1px dashed var(--line); border-radius: var(--radius-s); text-align: center; padding: 16px; }
.bars rect.pos { fill: var(--gain); }
.bars rect.neg { fill: var(--loss); }
.bars rect.zero { fill: var(--line-strong); }
.bars line { stroke: var(--line-strong); }

/* --- tableaux ------------------------------------------------------------------------ */
.table-wrap { overflow-x: auto; margin: 0 -20px; padding: 0 20px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th {
  text-align: left; font-weight: 600; font-size: 13px; color: var(--muted);
  padding: 8px 10px; border-bottom: 1px solid var(--line-strong); white-space: nowrap;
}
th.r, td.r { text-align: right; }
td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr.link { cursor: pointer; }
tbody tr.link:hover td { background: var(--panel-2); }
th button.sort { all: unset; cursor: pointer; }
th button.sort:focus-visible { outline: 2px solid var(--focus); }
th[aria-sort="ascending"] button::after { content: " ↑"; }
th[aria-sort="descending"] button::after { content: " ↓"; }
.cell-item { display: flex; align-items: center; gap: 10px; min-width: 200px; }
.cell-item .ci-name { font-weight: 600; line-height: 1.25; }
.side { font-weight: 600; font-size: 13px; }
.side.buy { color: var(--g31); }
.side.sell { color: var(--warn); }
.side.loot { color: var(--g71); }
.totals { display: flex; flex-wrap: wrap; gap: 8px 28px; font-size: 14px; color: var(--muted); margin: 4px 0 12px; }
.totals b { color: var(--text); font-variant-numeric: tabular-nums; }
.totals b.gain { color: var(--gain); }
.totals b.loss { color: var(--loss); }

/* --- réglages ------------------------------------------------------------------------ */
.settings { display: grid; gap: 20px; max-width: 900px; }
.settings.wide { max-width: 1120px; }
.settings .panel p { margin: 0 0 12px; color: var(--muted); font-size: 14px; max-width: 75ch; }
.settings .actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 4px; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 18px; font-size: 14px; margin-bottom: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 600; }
code { font-family: Consolas, "Cascadia Mono", monospace; font-size: 13px; background: var(--panel-2); padding: 1px 5px; border-radius: 4px; }
pre.sample { background: var(--panel-2); border-radius: var(--radius-s); padding: 10px 12px; font-size: 13px; overflow-x: auto; margin: 0 0 12px; }

/* --- fenêtres, popovers, notifications ----------------------------------------------- */
dialog {
  border: 1px solid var(--line-strong); border-radius: var(--radius-m);
  background: var(--panel); color: var(--text);
  padding: 22px; width: min(520px, calc(100vw - 32px));
  box-shadow: var(--shadow);
}
dialog::backdrop { background: rgba(5, 8, 20, 0.6); }
dialog h2 { margin-bottom: 14px; }
dialog .d-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }
dialog p { color: var(--muted); margin: 0 0 8px; }
.popover {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 60;
  width: 300px; background: var(--panel); border: 1px solid var(--line-strong);
  border-radius: var(--radius-m); box-shadow: var(--shadow); padding: 16px;
  display: grid; gap: 12px;
}
.market-wrap { position: relative; }

/* --- écrans de connexion ------------------------------------------------------------- */
.auth-wrap { min-height: calc(100vh - 220px); display: grid; place-items: center; padding: 24px 0; }
.auth-card { width: min(440px, 100%); display: grid; gap: 18px; }
.auth-card .auth-mark { width: 44px; height: 44px; color: var(--g41); }
.auth-card h1 { font-size: 28px; }
.auth-card p { margin: 0; color: var(--muted); }
.auth-card .switch { font-size: 14px; color: var(--muted); }
.auth-card .switch button { all: unset; color: var(--text); text-decoration: underline; cursor: pointer; }
.auth-card .switch button:focus-visible { outline: 2px solid var(--focus); }
.form-error { color: var(--loss); font-size: 14px; min-height: 20px; }
.form-error:empty { display: none; }

/* --- administration ------------------------------------------------------------------ */
.code-box {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  border: 1px dashed var(--g41); border-radius: var(--radius-m); padding: 14px 16px; margin-bottom: 14px;
  background: color-mix(in srgb, var(--g41) 8%, transparent);
}
.code-box .code { font-size: 26px; font-weight: 700; letter-spacing: 0.12em; font-variant-numeric: tabular-nums; }
.role { font-size: 12.5px; font-weight: 600; padding: 2px 8px; border-radius: 10px; border: 1px solid var(--line-strong); color: var(--muted); }
.role.admin { color: var(--g41); border-color: color-mix(in srgb, var(--g41) 50%, transparent); }
.status { font-size: 13px; font-weight: 600; }
.status.active { color: var(--gain); }
.status.used { color: var(--muted); }
.status.off { color: var(--faint); }
.by { font-size: 13px; color: var(--muted); white-space: nowrap; }
.by.me { color: var(--focus); font-weight: 600; }
.mode-note { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.mode-note b { color: var(--text); font-weight: 600; }
.base-switch { display: flex; align-items: center; gap: 10px 16px; flex-wrap: wrap; margin-bottom: 14px; }
.base-switch .seg button { height: 36px; }
.seg .count { font-weight: 400; font-size: 12.5px; color: var(--muted); margin-left: 4px; font-variant-numeric: tabular-nums; }
td .acts { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
td .acts .btn.small { height: 28px; font-size: 13px; }
.share-text { font-size: 13.5px; line-height: 1.45; min-height: 74px; }
.admin-intro { color: var(--muted); font-size: 14px; margin: 0 0 14px; max-width: 75ch; }

/* --- prévision (fiche objet) ----------------------------------------------------------- */
.forecast-box {
  border: 1px solid color-mix(in srgb, var(--warn) 40%, transparent);
  border-left: 3px solid var(--warn);
  border-radius: var(--radius-s);
  background: color-mix(in srgb, var(--warn) 7%, transparent);
  padding: 12px 14px; margin-bottom: 14px;
}
.forecast-box .fc-head { display: flex; align-items: baseline; gap: 6px 12px; flex-wrap: wrap; margin-bottom: 4px; }
.forecast-box .fc-k { font-size: 13px; color: var(--muted); font-weight: 600; }
.forecast-box .fc-head b { font-size: 22px; font-variant-numeric: tabular-nums; }
.forecast-box .fc-change { font-size: 14px; font-weight: 600; }
.forecast-box p { margin: 0; font-size: 13.5px; color: var(--muted); max-width: 75ch; }
.forecast-box p b { color: var(--text); font-weight: 600; }

/* --- choix du mode de prix (réglages) -------------------------------------------------- */
.mode-pick { border: 0; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; min-width: 0; }
.mode-pick legend { font-size: 13px; color: var(--muted); margin-bottom: 6px; padding: 0; }
.mode-pick label {
  display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: 8px; row-gap: 3px; align-items: center; align-content: start;
  border: 1px solid var(--line-strong); border-radius: var(--radius-s); padding: 10px 12px; cursor: pointer;
  background: var(--bg);
}
.mode-pick label:hover { border-color: var(--focus); }
.mode-pick label:has(input:checked) { border-color: var(--focus); box-shadow: inset 0 0 0 1px var(--focus); }
.mode-pick input { width: 16px; height: 16px; margin: 0; accent-color: var(--focus); }
.mode-pick b { font-size: 14.5px; }
.mode-pick small { grid-column: 2; font-size: 13px; color: var(--muted); line-height: 1.35; }
.toasts { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); display: grid; gap: 8px; z-index: 100; width: max-content; max-width: calc(100vw - 32px); }
.toast {
  background: var(--panel-2); border: 1px solid var(--line-strong); border-left: 3px solid var(--gain);
  border-radius: var(--radius-s); padding: 10px 14px; box-shadow: var(--shadow); font-size: 14px;
  animation: toast-in .25s ease;
}
.toast.error { border-left-color: var(--loss); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.skeleton { color: var(--muted); padding: 40px 0; }
.error-panel { border-left: 3px solid var(--loss); }
footer.foot { max-width: 1280px; margin: 0 auto; padding: 0 24px 28px; font-size: 12.5px; color: var(--faint); }
footer.foot a { color: var(--muted); }

/* --- adaptatif ------------------------------------------------------------------------ */
@media (max-width: 1080px) {
  .grid-item { grid-template-columns: 1fr; }
  .grid-item > .stack:first-child { order: 0; }
  .ledger { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ledger > div:nth-child(3) { border-left: 0; }
  .ledger > div:nth-child(n + 3) { border-top: 1px solid var(--line); }
}
@media (max-width: 860px) {
  .top-inner { grid-template-columns: 1fr auto; grid-template-areas: "brand right" "search search" "mode mode" "nav nav"; row-gap: 10px; padding: 10px 16px 0; }
  .mode-switch { justify-self: stretch; margin-top: 0; }
  .mode-switch button { flex: 1; padding: 0 8px; }
  .account .a-name { display: none; }
  .account { padding: 0 5px; }
  main { padding: 20px 16px 64px; }
  .grid-2 { grid-template-columns: 1fr; }
  .filters { grid-template-columns: 1fr 1fr; }
  .filters > :first-child { grid-column: 1 / -1; }
  .item-row { grid-template-columns: 36px minmax(0, 1fr) auto 32px; }
  .item-row .ir-cat { display: none; }
  .item-head { grid-template-columns: auto minmax(0, 1fr); }
  .item-actions { grid-column: 1 / -1; justify-content: flex-start; }
  .balance-top { grid-template-columns: 1fr; }
  .form-grid.cols-2 { grid-template-columns: 1fr; }
  .mode-pick { grid-template-columns: 1fr; }
  .market .m-label { display: none; }
  .search kbd { display: none; }
  footer.foot { padding: 0 16px 24px; }
}
@media (max-width: 520px) {
  .ledger { grid-template-columns: 1fr; }
  .ledger > div + div { border-left: 0; border-top: 1px solid var(--line); }
  .item-head h1 { font-size: 26px; }
  .ico.l { --size: 56px; }
  h1 { font-size: 26px; }
  .brand span { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
