/* Copyright (c) 2026 LB IT Cloud SAS. All rights reserved.
   Proprietary source of the LB IT Cloud website. See LICENSE.

   Lifted out of advisor.html, for the same reason as advisor.js: what the browser
   executes and renders comes from files this origin served. */

/* ---------------------------------------------------------------
     Licence advisor
     --------------------------------------------------------------- */
  /* ONE COLUMN. Julien, 31/08/2026: *« j'aimerais bien que les recommandations soient
     en dessous de vos profils »*. Side by side, the recommendation was a narrow column
     of three-figure lines squeezed next to the panel that produces them; underneath it
     gets the full width, and the reading order matches the thinking order — describe
     the profiles, then read what they cost. */
  /* The tagline sits between the name and the explanation: bigger than body copy,
     smaller than the title, and in the brand blue so the eye takes the three lines in
     the right order. */
  .tagline {
    font-family: var(--display); font-size: 21px; font-weight: 700; color: var(--brand);
    margin-top: 10px; line-height: 1.25;
  }
  @media (max-width: 700px) { .tagline { font-size: 18px; } }

  .advisor { display: grid; grid-template-columns: 1fr; gap: 22px; margin-top: 36px; align-items: start; }
  .panel {
    background: var(--panel); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow);
  }
  .panel .head {
    display: flex; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line);
    flex-wrap: wrap;
  }
  .panel .head h3 { font-size: 16px; font-weight: 700; }
  .panel .body { padding: 18px 20px 22px; }
  .panel .head .right { margin-left: auto; display: flex; gap: 8px; align-items: center; }

  /* IDENTIFYING A PROFILE AT A GLANCE was the complaint: five rows of the same grey.
     Each one now carries a coloured rule down its left edge and a tinted name, cycling
     through the four accents by position — no attribute in the markup, so a profile
     added at runtime is coloured like the rest. The card also sits on `--panel` against
     the body's `--ground`, which is the contrast that was missing. */
  .prof {
    border: 1px solid var(--line); border-left: 4px solid var(--a1-line);
    border-radius: 12px; margin-bottom: 12px; background: var(--panel);
    box-shadow: 0 1px 2px rgba(20, 32, 58, .04);
  }
  #profileList .prof:nth-child(4n+2) { border-left-color: var(--a2-line); }
  #profileList .prof:nth-child(4n+3) { border-left-color: var(--a3-line); }
  #profileList .prof:nth-child(4n+4) { border-left-color: var(--a4-line); }
  #profileList .prof:nth-child(4n+1) .nm { color: var(--a1); }
  #profileList .prof:nth-child(4n+2) .nm { color: var(--a2); }
  #profileList .prof:nth-child(4n+3) .nm { color: var(--a3); }
  #profileList .prof:nth-child(4n+4) .nm { color: var(--a4); }
  .prof.open { border-color: var(--brand); border-left-width: 4px; }
  /* A GRID, NOT A WRAPPING FLEX ROW. As a flex row every profile took a different shape:
     a short description sat on one line while a long one squeezed into a narrow column
     beside the licence name, and nothing lined up between profiles. Three bands, placed
     by area so the markup order need not change: what it is called and how many people,
     then what it contains, then the licence it earns. */
  .prof .row {
    display: grid; gap: 7px 12px; align-items: center; padding: 14px 16px; cursor: pointer;
    grid-template-columns: minmax(0, 1fr) auto auto;
    grid-template-areas:
      "nm      heads chev"
      "who     who   who"
      "verdict verdict verdict";
  }
  .prof .nm { grid-area: nm; }
  .prof .who { grid-area: who; }
  .prof .heads { grid-area: heads; }
  .prof .chev { grid-area: chev; }
  .prof .verdict { grid-area: verdict; justify-self: start; }
  .prof .row:hover { background: var(--ground-2); }
  .prof .nm { font-weight: 700; font-size: 15.5px; letter-spacing: -.01em; }
  /* ink-2, not ink-3: this line is what the profile IS, not a footnote about it. */
  .prof .who { font-size: 13px; color: var(--ink-2); min-width: 0; }
  .prof .heads {
    display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink-2);
  }
  .prof .heads input {
    width: 78px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px;
    background: var(--panel); text-align: right; font-variant-numeric: tabular-nums;
  }
  /* The licence is the ANSWER, so it gets a chip of its own rather than a nowrap label
     that used to push the description sideways. It wraps now: some of these names are
     "Office 365 E5 + Enterprise Mobility + Security E5". */
  .prof .verdict {
    font-weight: 700; font-size: 14px; color: var(--brand); white-space: normal;
    background: var(--brand-soft); border: 1px solid var(--brand-line);
    border-radius: 8px; padding: 5px 10px; line-height: 1.35;
  }
  #profileList .prof:nth-child(4n+1) .verdict { color: var(--a1); background: var(--a1-soft); border-color: var(--a1-line); }
  #profileList .prof:nth-child(4n+2) .verdict { color: var(--a2); background: var(--a2-soft); border-color: var(--a2-line); }
  #profileList .prof:nth-child(4n+3) .verdict { color: var(--a3); background: var(--a3-soft); border-color: var(--a3-line); }
  #profileList .prof:nth-child(4n+4) .verdict { color: var(--a4); background: var(--a4-soft); border-color: var(--a4-line); }
  .prof .chev { font-size: 12px; color: var(--ink-3); white-space: nowrap; }
  .prof:hover .chev { color: var(--brand); }
  /* THE OPEN AREA IS TINTED, and in the profile's own accent, so "which profile am I
     editing" is answered by the colour of the surface rather than by remembering which
     row was clicked. The questions sit on white cards inside it: tint outside, cards
     inside, which is the whole trick for telling a container from its contents. */
  .prof .qs { display: none; padding: 0 14px 16px; border-top: 1px solid var(--line); }
  .prof.open .qs { display: block; background: var(--a1-soft); }
  #profileList .prof:nth-child(4n+2).open .qs { background: var(--a2-soft); }
  #profileList .prof:nth-child(4n+3).open .qs { background: var(--a3-soft); }
  #profileList .prof:nth-child(4n+4).open .qs { background: var(--a4-soft); }

  /* The name, as a header rather than a fourteenth field. */
  .qhead {
    display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
    padding: 14px 0 4px;
  }
  .qhead label { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .09em; color: var(--ink-3); }
  .qhead .pname {
    flex: 1; min-width: 200px; padding: 9px 12px; border: 1px solid var(--line);
    border-radius: 9px; background: var(--panel); font-weight: 700; font-size: 14.5px;
  }
  .qhead .pname:focus { outline: none; border-color: var(--brand); }

  /* Five groups, named. The rule under the title does the separating; a box around each
     group as well would be a box inside a tint inside a card. */
  .qgroup { margin-top: 18px; }
  .qgroup h4 {
    font-size: 11.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .09em;
    color: var(--ink-2); padding-bottom: 7px; margin-bottom: 12px;
    border-bottom: 1px solid var(--line);
  }
  /* 280 rather than 250: at 250 the longest options were cut mid-word ("Des règles d'accès
     conditionnel s'…"), and a choice you cannot read is not a choice. */
  .qgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 12px; }
  .q {
    background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
    padding: 12px 13px 13px;
  }
  .q label { display: block; font-size: 13px; font-weight: 700; margin-bottom: 7px; line-height: 1.35; }
  .q select {
    width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 9px;
    background: var(--panel); font-size: 13.5px; appearance: none;
    background-image: linear-gradient(45deg, transparent 50%, var(--ink-3) 50%), linear-gradient(135deg, var(--ink-3) 50%, transparent 50%);
    background-position: calc(100% - 16px) 17px, calc(100% - 11px) 17px;
    background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; padding-right: 30px;
  }
  .q select:focus { outline: none; border-color: var(--brand); }
  .q .note { font-size: 11.5px; color: var(--ink-3); margin-top: 5px; line-height: 1.45; }

  .presets { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
  .preset {
    border: 1px solid var(--line); border-radius: 999px; padding: 6px 13px; font-size: 13px;
    color: var(--ink-2); background: var(--panel);
  }
  .preset:hover { border-color: var(--brand); color: var(--brand); }

  .result { border-top: 1px solid var(--line); padding-top: 16px; margin-top: 4px; }
  .lineitem {
    display: block; padding: 12px 0; border-bottom: 1px solid var(--line); font-size: 14px;
  }
  /* Three figures, named. "2 856 €" alone is ambiguous — per seat? per month?
     for the year? — and a reader who has to guess which one it is cannot check
     the arithmetic, which is the only reason to show it at all. */
  .figs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 10px; }
  .fig { border-left: 2px solid var(--brand-line); padding-left: 10px; }
  .fig b { display: block; font-weight: 700; font-variant-numeric: tabular-nums; font-size: 15px; }
  .fig span { display: block; font-size: 11px; color: var(--ink-3); line-height: 1.3; margin-top: 2px; }
  @media (max-width: 480px) { .figs { grid-template-columns: 1fr; gap: 6px; } }

  .orgin {
    width: 150px; padding: 6px 9px; border: 1px solid var(--line); border-radius: 8px;
    background: var(--panel); font-size: 12.5px;
  }
  .orgin:focus { outline: none; border-color: var(--brand); }

  /* The warning is not a footnote. It says what the figures are and what they
     are not, in the same panel as the figures, because that is where somebody
     decides to forward them to a reseller. */
  .notice {
    margin-top: 16px; padding: 14px 16px; border-radius: 11px;
    background: var(--warn-bg); border: 1px solid color-mix(in srgb, var(--warn) 35%, transparent);
  }
  .notice b { display: block; font-size: 13px; color: var(--warn); margin-bottom: 5px; }
  .notice p { font-size: 12.5px; color: var(--ink-2); line-height: 1.5; }

  .lineitem .who { font-weight: 600; }
  /* The same cycle as the profiles above, so a line in the recommendation and the profile
     it came from wear the same colour. That is the whole point of the accents here: they
     are an index, not decoration. Selected on .lineitem itself — they are not inside a
     `.result` wrapper, which is why the first attempt coloured nothing. */
  .lineitem { border-left: 4px solid var(--a1-line); padding-left: 12px; }
  .lineitem:nth-of-type(4n+2) { border-left-color: var(--a2-line); }
  .lineitem:nth-of-type(4n+3) { border-left-color: var(--a3-line); }
  .lineitem:nth-of-type(4n+4) { border-left-color: var(--a4-line); }
  .lineitem:nth-of-type(4n+1) .who { color: var(--a1); }
  .lineitem:nth-of-type(4n+2) .who { color: var(--a2); }
  .lineitem:nth-of-type(4n+3) .who { color: var(--a3); }
  .lineitem:nth-of-type(4n+4) .who { color: var(--a4); }
  .lineitem .sku { font-size: 13px; color: var(--ink-2); }
  .lineitem .why { font-size: 12px; color: var(--ink-3); }
  .lineitem .why b { color: var(--ink-2); font-weight: 600; }

  /* The total is the line somebody reads out loud, so it says what each number
     is on its own line. Run together — "6 203 € par mois · soit 74 434 € par
     an" — the two figures fight, and the one that matters depends on who is
     asking: a monthly rate for the person paying it, a yearly one for the
     person approving it. */
  .totals {
    margin-top: 20px; padding: 16px 18px; border-radius: 12px;
    background: var(--brand-soft); border: 1px solid var(--brand-line);
  }
  .trow { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
  .trow + .trow { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--brand-line); }
  .totals .n {
    font-family: var(--display); font-size: 32px; font-weight: 800; color: var(--brand);
    font-variant-numeric: tabular-nums; line-height: 1.05;
  }
  .totals .n2 {
    font-family: var(--display); font-size: 21px; font-weight: 700; color: var(--ink);
    font-variant-numeric: tabular-nums;
  }
  .totals .u { font-size: 13.5px; color: var(--ink-2); }

  .compare {
    margin-top: 16px; padding: 14px 16px; border-radius: 11px; background: var(--ok-bg);
    font-size: 13.5px; color: var(--ok); border: 1px solid color-mix(in srgb, var(--ok) 30%, transparent);
  }
  .compare b { font-weight: 700; }
  .compare.flat { background: var(--warn-bg); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 30%, transparent); }
  .disclaim {
    margin-top: 14px; font-size: 12px; color: var(--ink-3); line-height: 1.5;
    border-left: 3px solid var(--line); padding-left: 12px;
  }

  table.prices { width: 100%; border-collapse: collapse; font-size: 13px; }
  table.prices th {
    text-align: left; font-weight: 600; color: var(--ink-2); padding: 8px 6px;
    border-bottom: 1px solid var(--line);
  }
  table.prices td { padding: 6px; border-bottom: 1px solid var(--line); }
  table.prices td:last-child { text-align: right; }
  table.prices input {
    width: 84px; padding: 5px 8px; border: 1px solid var(--line); border-radius: 7px;
    background: var(--panel); text-align: right; font-variant-numeric: tabular-nums; font-size: 13px;
  }
  table.prices input:focus { outline: none; border-color: var(--brand); }
  .pricewrap { max-height: 340px; overflow-y: auto; }

  /* One line while it is closed, so it costs nothing at the top of the panel. */
  .pricesbar { border: 1px solid var(--line); border-radius: 10px; margin-bottom: 16px; }
  .pricestoggle {
    display: flex; align-items: center; width: 100%; padding: 9px 13px; gap: 8px;
    font-size: 13px; font-weight: 600; color: var(--ink-2); text-align: left;
  }
  .pricestoggle:hover { color: var(--brand); }
  .pricestoggle .car { margin-left: auto; color: var(--ink-3); }
  .pricesbar > div { padding: 0 13px 13px; }

  /* The two columns became one below 900px in the old single-page layout; the
     rule moved with the tool, or the panel keeps its 1.25fr on a phone and the
     page scrolls sideways. */
  @media (max-width: 900px) {
    .advisor { grid-template-columns: 1fr; }
    .prof .row { gap: 8px; }
  }
