@import url("../fonts.css");

/* =========================================================
   PHOENIX INVEST — Design tokens
   Charte PAM : brun profond, or, crème, terracotta
   ========================================================= */
:root {
  --brown-950: #2E1605;
  --brown-900: #3E1F08;
  --brown-800: #4A270B;
  --brown:     #552D0E;
  --brown-600: #6D3D19;
  --brown-500: #8A5630;
  --terracotta:#B8642E;
  --gold:      #CDA043;
  --gold-300:  #E3C07A;
  --gold-100:  #F6E7C8;
  --cream:     #FEFAF8;
  --cream-50:  #FEFCFA;
  --cream-100: #F9F2EA;
  --cream-200: #F2E7DB;
  --line:      #EADCCD;
  --line-soft: #F3E9DE;
  --ink:       #2B1B10;
  --ink-soft:  #5A4638;
  --muted:     #86705F;
  --muted-2:   #A3907F;
  --success:   #2F7D5D;
  --success-bg:#E8F3ED;
  --warn:      #B07C22;
  --warn-bg:   #FBF0D9;
  --danger:    #A8442F;
  --danger-bg: #F9E6E1;
  --info:      #3A6B8A;
  --info-bg:   #E7EFF5;

  --serif: "Fraunces", Georgia, "Times New Roman", serif;
  --sans: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;

  --r-xs: 4px;
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 18px;
  --r-xl: 26px;
  --r-full: 999px;

  --sh-1: 0 1px 2px rgba(59, 31, 8, .05), 0 1px 1px rgba(59, 31, 8, .03);
  --sh-2: 0 6px 20px -8px rgba(59, 31, 8, .18), 0 2px 6px rgba(59, 31, 8, .05);
  --sh-3: 0 22px 50px -22px rgba(46, 22, 5, .35), 0 6px 14px rgba(46, 22, 5, .07);
  --sh-gold: 0 10px 30px -12px rgba(205, 160, 67, .55);

  --max: 1180px;
  --tap: 44px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--cream);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
h1, h2, h3, h4 { margin: 0; font-weight: 600; line-height: 1.15; letter-spacing: -.015em; }
h1 { font-family: var(--serif); font-size: clamp(30px, 4vw, 46px); font-weight: 600; letter-spacing: -.025em; }
h2 { font-family: var(--serif); font-size: clamp(23px, 2.6vw, 31px); font-weight: 600; letter-spacing: -.02em; }
h3 { font-size: 17px; font-weight: 600; }
h4 { font-size: 14px; font-weight: 600; }
p { margin: 0; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
img { max-width: 100%; display: block; }
ul { margin: 0; padding: 0; list-style: none; }
:focus-visible { outline: 2px solid var(--terracotta); outline-offset: 2px; }
::selection { background: var(--gold-100); color: var(--brown-900); }

/* --- Typo utilitaires --- */
.serif { font-family: var(--serif); }
.eyebrow {
  font-size: 10.5px; font-weight: 600; letter-spacing: .16em; text-transform: uppercase;
  color: var(--terracotta);
}
.eyebrow.gold { color: var(--gold); }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.xs { font-size: 11.5px; }
.strong { font-weight: 600; }
.num { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }
.up { color: var(--success); }
.down { color: var(--danger); }
.center { text-align: center; }
.nowrap { white-space: nowrap; }

/* --- Layout --- */
.container { width: 100%; max-width: var(--max); margin: 0 auto; padding: 0 24px; }
.row { display: flex; align-items: center; gap: 12px; }
.row.between { justify-content: space-between; }
.row.wrap { flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.grid { display: grid; gap: 18px; }
.grid > * { min-width: 0; }
.grid.c2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.c3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.c4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.sidebar { grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); }
@media (max-width: 940px) {
  .grid.c4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.c3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.sidebar { grid-template-columns: 1fr; }
}
@media (max-width: 620px) {
  .grid.c2, .grid.c3, .grid.c4 { grid-template-columns: 1fr; }
  .container { padding: 0 16px; }
}

/* --- Cartes --- */
.card {
  background: #fff;
  border: 1px solid var(--line-soft);
  border-radius: var(--r-lg);
  padding: 20px;
  box-shadow: var(--sh-1);
}
.card.flat { box-shadow: none; background: var(--cream-50); }
.card.pad-lg { padding: 26px; }
.card.dark { background: var(--brown); border-color: var(--brown-800); color: var(--cream); }
.card.dark .muted { color: #C9B4A2; }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 16px; }
.card-head h3 { font-family: var(--serif); font-size: 18px; font-weight: 600; }

/* --- Boutons --- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 42px; padding: 0 18px;
  border: 1px solid transparent; border-radius: var(--r-full);
  background: var(--brown); color: var(--cream);
  font-size: 13.5px; font-weight: 500; letter-spacing: .01em;
  transition: background .18s, color .18s, border-color .18s, transform .12s, box-shadow .18s;
  white-space: nowrap;
}
.btn:hover { background: var(--brown-600); box-shadow: var(--sh-2); }
.btn:active { transform: translateY(1px); }
.btn.gold { background: var(--gold); color: var(--brown-950); font-weight: 600; }
.btn.gold:hover { background: var(--gold-300); box-shadow: var(--sh-gold); }
.btn.ghost { background: transparent; border-color: var(--line); color: var(--brown); }
.btn.ghost:hover { background: var(--cream-100); border-color: var(--brown-500); box-shadow: none; }
.btn.quiet { background: transparent; color: var(--ink-soft); }
.btn.quiet:hover { background: var(--cream-100); box-shadow: none; }
.btn.danger { background: var(--danger); }
.btn.sm { min-height: 34px; padding: 0 13px; font-size: 12.5px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; box-shadow: none; }
.link { color: var(--terracotta); font-weight: 500; border-bottom: 1px solid transparent; }
.link:hover { border-color: currentColor; }

/* --- Badges / états --- */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: var(--r-full);
  font-size: 11px; font-weight: 600; letter-spacing: .02em;
  background: var(--cream-200); color: var(--ink-soft);
  white-space: nowrap;
}
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.ok { background: var(--success-bg); color: var(--success); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.err { background: var(--danger-bg); color: var(--danger); }
.badge.info { background: var(--info-bg); color: var(--info); }
.badge.gold { background: var(--gold-100); color: #7A5412; }
.badge.dark { background: rgba(255,255,255,.12); color: var(--cream); }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 13px; border-radius: var(--r-full);
  border: 1px solid var(--line); background: #fff;
  font-size: 12.5px; color: var(--ink-soft); cursor: pointer;
  transition: all .15s;
}
.chip:hover { border-color: var(--brown-500); }
.chip.active { background: var(--brown); border-color: var(--brown); color: var(--cream); }

/* --- Formulaires --- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label { font-size: 12.5px; font-weight: 500; color: var(--ink-soft); }
.input, .select, .textarea {
  width: 100%; min-height: 44px; padding: 10px 13px;
  background: #fff; border: 1px solid var(--line); border-radius: var(--r-sm);
  font-size: 14px; transition: border-color .15s, box-shadow .15s;
}
.input:focus, .select:focus, .textarea:focus {
  outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(205,160,67,.18);
}
.input::placeholder { color: var(--muted-2); }
.input.lg { min-height: 52px; font-size: 17px; font-weight: 500; }
.hint { font-size: 11.5px; color: var(--muted); }
.hint.err { color: var(--danger); }
.search { position: relative; }
.search .input { padding-left: 38px; }
.search svg { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--muted-2); }

/* --- Tableaux --- */
.table-wrap { overflow-x: auto; border-radius: var(--r-md); }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
table.tbl th {
  text-align: left; padding: 10px 12px; font-size: 11px; font-weight: 600;
  letter-spacing: .06em; text-transform: uppercase; color: var(--muted);
  border-bottom: 1px solid var(--line); background: var(--cream-50);
  white-space: nowrap; position: sticky; top: 0; z-index: 1;
}
table.tbl td { padding: 12px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
table.tbl tr:last-child td { border-bottom: none; }
table.tbl tbody tr { transition: background .12s; }
table.tbl tbody tr:hover { background: var(--cream-50); }
table.tbl tbody tr.clickable { cursor: pointer; }
table.tbl td.right, table.tbl th.right { text-align: right; }
table.tbl .ident { font-weight: 500; color: var(--ink); }

/* --- Divers --- */
.divider { height: 1px; background: var(--line-soft); border: 0; margin: 18px 0; }
.demo-flag {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 10.5px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase;
  color: #8A6A21; background: var(--gold-100);
  padding: 3px 9px; border-radius: var(--r-xs);
}
.skeleton {
  background: linear-gradient(90deg, var(--cream-200) 25%, var(--cream-100) 50%, var(--cream-200) 75%);
  background-size: 200% 100%; animation: sk 1.4s infinite; border-radius: var(--r-sm);
}
@keyframes sk { to { background-position: -200% 0; } }
.hide { display: none !important; }
.only-mobile { display: none; }
@media (max-width: 720px) {
  .only-mobile { display: block; }
  .no-mobile { display: none !important; }
}

/* --- Toast --- */
#toasts {
  position: fixed; z-index: 9999; right: 18px; bottom: 18px;
  display: flex; flex-direction: column; gap: 10px; max-width: 360px;
}
.toast {
  display: flex; gap: 11px; align-items: flex-start;
  background: var(--brown-950); color: var(--cream);
  padding: 13px 16px; border-radius: var(--r-md);
  box-shadow: var(--sh-3); font-size: 13px;
  animation: toastIn .25s ease-out;
}
.toast .ico { color: var(--gold); flex: none; margin-top: 1px; }
.toast.ok .ico { color: #7FD3A9; }
.toast.err .ico { color: #F1A18F; }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px); } }

/* --- Modale --- */
.modal-back {
  position: fixed; inset: 0; z-index: 9000;
  background: rgba(46,22,5,.48); backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center; padding: 20px;
  animation: fade .18s ease-out;
}
.modal {
  background: var(--cream); border-radius: var(--r-xl);
  width: min(560px, 100%); max-height: 90vh; overflow: auto;
  box-shadow: var(--sh-3); border: 1px solid var(--line);
  animation: pop .2s cubic-bezier(.2,.8,.3,1);
}
.modal-head { padding: 22px 24px 0; display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; }
.modal-body { padding: 16px 24px 24px; }
.modal-foot { padding: 0 24px 24px; display: flex; gap: 10px; justify-content: flex-end; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: scale(.97) translateY(8px); } }

/* --- Barres de progression --- */
.progress { height: 6px; background: var(--cream-200); border-radius: var(--r-full); overflow: hidden; }
.progress > span { display: block; height: 100%; background: linear-gradient(90deg, var(--terracotta), var(--gold)); border-radius: inherit; transition: width .5s ease; }

/* --- Scrollbar discrète --- */
* { scrollbar-width: thin; scrollbar-color: var(--cream-200) transparent; }
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: #E2D2C2; border-radius: 99px; border: 2px solid var(--cream); }
