/* GITCAD corporate palette (see .ai/rules/ui.md) */
:root {
    --blue: #26A8E7;
    --blue-pastel: #D9F1FC;
    --orange: #EE7421;
    --orange-pastel: #FCE4D4;
    --purple: #59005E;
    --purple-pastel: #E8D8EA;
    --green: #93C64E;
    --green-pastel: #E7F2D7;
    --danger: #D63A3A;
    --danger-pastel: #FBE1E1;
    --text: #2b2f36;
    --muted: #6b7480;
    --border: #e3e7ec;
    --bg: #fafbfc;
}

* { box-sizing: border-box; }
/* The hidden attribute must always win over a component's own display
   (e.g. .product-grid { display: grid } kept every dashboard year panel
   visible at once). */
[hidden] { display: none !important; }

body {
    margin: 0;
    font-family: "Segoe UI", Roboto, Arial, sans-serif;
    color: var(--text);
    background: var(--bg);
    font-size: 14px;
    line-height: 1.5;
}

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

.topbar {
    background: #fff;
    border-bottom: 1px solid var(--border);
    padding: 14px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}

.topbar .brand { font-weight: 700; color: var(--purple); font-size: 16px; }
.topbar nav a { margin-right: 16px; color: var(--text); font-weight: 500; }
.topbar nav a:hover { color: var(--blue); text-decoration: none; }
.topbar .user { color: var(--muted); font-size: 13px; }

.ghost-banner {
    background: var(--orange-pastel);
    border-bottom: 1px solid var(--orange);
    color: #7a3c12;
    padding: 10px 24px;
    font-size: 13px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}
.ghost-banner a { font-weight: 600; }

.container { max-width: 1080px; margin: 0 auto; padding: 24px; }

h1 { font-size: 22px; margin: 0 0 4px; color: var(--purple); }
h2 { font-size: 17px; margin: 28px 0 10px; color: var(--text); }
.subtitle { color: var(--muted); margin: 0 0 20px; }

.card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 20px;
}
/* Headers stay on one line (see th { white-space: nowrap }); a table with
   many/wide columns scrolls horizontally within its own card instead of
   the whole page ever needing to. Skipped when the card has a row-menu
   dropdown (see below): overflow-x:auto also clips overflow-y, which would
   cut off the dropdown instead of letting it float over the row below. */
.card:has(table.data-table):not(:has(.row-menu)) { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .02em; white-space: nowrap; }
tr:last-child td { border-bottom: none; }

/* A cell with several action buttons (edit/reset/delete...): wrap with a
   consistent gap instead of relying on inline whitespace, which bunches
   wrapped buttons together with no breathing room. */
.actions-cell { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.actions-cell form.inline { display: inline-flex; }

/* The "Poste" cell on the machines tab (user.php) can span several lines
   (badge + "vu le" + hashes) while other cells in the same row stay short;
   the shared td { vertical-align: top } then leaves .actions-cell's own
   flex content visually higher than the "Poste" text beside it. Scoped to
   this one table so the global .actions-cell layout stays untouched
   elsewhere. */
.table-machines td { vertical-align: middle; }

.badge {
    display: inline-block;
    padding: 2px 9px;
    border-radius: 100px;
    font-size: 11.5px;
    font-weight: 600;
    white-space: nowrap;
}

/* Several badges in one cell (e.g. "Actif" + "Reset requis"): stack them
   with a little breathing room instead of squeezing onto the same line. */
td .badge {
    display: inline-flex;
    margin: 2px 4px 2px 0;
}
td.badges-stack, .badge-stack {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
}
.badge-blue { background: var(--blue-pastel); color: #0b6a9c; }
.badge-green { background: var(--green-pastel); color: #4c7422; }
.badge-orange { background: var(--orange-pastel); color: #a1490f; }
.badge-purple { background: var(--purple-pastel); color: var(--purple); }
.badge-danger { background: var(--danger-pastel); color: #9c2323; }
.badge-muted { background: #eef0f3; color: var(--muted); }

.btn {
    display: inline-block;
    background: var(--blue);
    color: #fff;
    border: none;
    border-radius: 7px;
    padding: 8px 14px;
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
}
.btn:hover { background: #1c8fc4; text-decoration: none; }
.btn-secondary { background: #fff; color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: #f2f4f6; }
.btn-danger { background: var(--danger); }
.btn-danger:hover { background: #b32d2d; }
.btn-sm { padding: 4px 10px; font-size: 12.5px; }

form.inline { display: inline; }

.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 4px; font-weight: 600; }
.field input, .field select, .field textarea {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: 7px;
    font-size: 14px;
    font-family: inherit;
    box-sizing: border-box;
}
.field textarea { resize: vertical; min-height: 60px; }
.field textarea:focus, .field input:focus, .field select:focus {
    outline: none;
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(38, 168, 231, 0.15);
}
.field-row { display: flex; gap: 12px; flex-wrap: wrap; }
.field-row .field { flex: 1; min-width: 160px; }

.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 18px; font-size: 13.5px; }
.flash-success { background: var(--green-pastel); color: #3f5e19; }
.flash-error { background: var(--danger-pastel); color: #7a1f1f; }
.flash-info { background: var(--blue-pastel); color: #0b5f8c; }

.empty { color: var(--muted); font-style: italic; padding: 10px 0; }

.footer {
    text-align: center;
    padding: 28px;
    color: #8a94a3;
    font-size: 12px;
}
.footer a {
    color: inherit;
    text-decoration: none;
    border-bottom: 1px dotted #a9b1bc;
}
.footer a:hover {
    color: var(--blue);
    border-bottom-color: var(--blue);
}

/* "Add new" row pinned to the top of a data-table (see data-pin-top in
   tables.js): a light tint marks it apart from the real data rows below. */
tr.new-row td { background: var(--bg); }

/* Sortable / filterable tables */
table.data-table th[data-sort]::after { content: ' \21C5'; color: var(--muted); font-size: 10px; }
table.data-table th.sorted-asc::after { content: ' \25B2'; color: var(--blue); }
table.data-table th.sorted-desc::after { content: ' \25BC'; color: var(--blue); }

.search-box {
    width: 100%;
    max-width: 320px;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 7px;
    font-size: 13.5px;
    margin-bottom: 14px;
}

/* Segmented control (radio group styled as pill buttons — e.g. release
   "Majeure/Mineure"). Markup: <div class="segmented"><input type="radio"
   id="x"><label for="x">...</label>...</div> — input immediately before its
   own label, both inside .segmented, so the :checked + label sibling
   selector below can style the active choice. */
.segmented { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.segmented input[type="radio"] { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.segmented label {
    padding: 8px 16px;
    cursor: pointer;
    font-size: 13.5px;
    font-weight: 600;
    color: var(--muted);
    background: #fff;
    user-select: none;
}
.segmented label:not(:last-child) { border-right: 1px solid var(--border); }
.segmented input[type="radio"]:checked + label { background: var(--blue); color: #fff; }
.segmented input[type="radio"]:focus-visible + label { outline: 2px solid var(--blue); outline-offset: -2px; }

/* Live user lookup (see app/js/user-search.js) */
.user-search { position: relative; }
.user-search-results {
    position: absolute;
    left: 0; right: 0;
    top: 100%;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-top: 4px;
    max-height: 260px;
    overflow-y: auto;
    box-shadow: 0 6px 18px rgba(20, 25, 35, .12);
    z-index: 20;
}
.user-search-result {
    display: block;
    width: 100%;
    text-align: left;
    padding: 8px 12px;
    border: none;
    border-bottom: 1px solid var(--border);
    background: #fff;
    cursor: pointer;
    font: inherit;
}
.user-search-result:last-child { border-bottom: none; }
.user-search-result:hover { background: var(--bg); }
.user-search-result small { color: var(--muted); }

/* Row menu: collapses many per-row action buttons into one "⋯" toggle,
   without losing their colors (a plain <select>-style dropdown couldn't). */
.row-menu { position: relative; display: inline-block; }
.row-menu > summary { list-style: none; }
.row-menu > summary::-webkit-details-marker { display: none; }
.row-menu-body {
    position: absolute;
    right: 0;
    top: calc(100% + 4px);
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 170px;
    box-shadow: 0 6px 18px rgba(20, 25, 35, .12);
    z-index: 20;
}
.row-menu-body form.inline { display: block; width: 100%; }
.row-menu-body .btn { width: 100%; text-align: center; }

/* Action bar: buttons that reveal a <details> form instead of a long page */
.action-bar { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 20px; }

/* Dashboard: counters next to "Gérer les entreprises" (was a card at the very
   bottom), and strong "Logiciels" / "Services" section titles. */
.dashboard-overview { align-items: center; gap: 16px; }
.dashboard-counts { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13.5px; }
.dashboard-counts strong { color: var(--text); }
.dashboard-section {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 36px 0 20px;
    padding-bottom: 12px;
    border-bottom: 3px solid var(--blue-pastel);
    font-size: 24px;
    font-weight: 700;
    color: var(--purple);
}
.dashboard-section .icon {
    box-sizing: content-box;
    padding: 8px;
    border-radius: 10px;
    background: var(--blue-pastel);
    color: var(--blue);
}

details.panel { margin-bottom: 20px; }
details.panel > summary {
    list-style: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
details.panel > summary::-webkit-details-marker { display: none; }
details.panel > summary.btn { display: inline-flex; }
details.panel[open] > summary.btn { background: #1c8fc4; }
details.panel .panel-body {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 20px;
    margin-top: 10px;
    max-width: 480px;
}

/* Tabs (server-rendered via ?tab=, no JS needed) */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 20px; flex-wrap: wrap; }
.tabs a {
    padding: 9px 16px;
    color: var(--muted);
    font-weight: 600;
    font-size: 13.5px;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
}
.tabs a:hover { color: var(--text); text-decoration: none; }
.tabs a.active { color: var(--blue); border-bottom-color: var(--blue); }

/* Accordion (license summary) */
details.accordion-item {
    border: 1px solid var(--border);
    border-radius: 10px;
    margin-bottom: 10px;
    background: #fff;
    overflow: hidden;
}
details.accordion-item > summary {
    list-style: none;
    cursor: pointer;
    padding: 14px 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    font-weight: 600;
}
details.accordion-item > summary::-webkit-details-marker { display: none; }
details.accordion-item > summary:hover { background: var(--bg); }
details.accordion-item .accordion-body { padding: 0 18px 16px; }

/* Pagination */
.pagination { display: flex; gap: 6px; align-items: center; margin-top: 16px; flex-wrap: wrap; }
.pagination a, .pagination span {
    padding: 5px 11px;
    border-radius: 6px;
    font-size: 13px;
    border: 1px solid var(--border);
}
.pagination a:hover { background: #f2f4f6; text-decoration: none; }
.pagination .current { background: var(--blue); color: #fff; border-color: var(--blue); }

/* Product tiles (dashboard: owned, coming soon, advertised). Locked
   tiles (product-tile-locked) intentionally carry no href anywhere except the
   mailto contact link — the whole point is to advertise without being
   clickable, per .ai/rules/ui.md's sober/pastel palette rules. */
.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 16px;
    margin-bottom: 28px;
}
.product-tile {
    display: flex;
    flex-direction: column;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
}
.product-tile:not(.product-tile-locked) { transition: box-shadow .15s, transform .15s; }
.product-tile:not(.product-tile-locked):hover { box-shadow: 0 8px 20px rgba(20, 25, 35, .09); transform: translateY(-2px); }

.product-tile-banner { display: flex; align-items: center; gap: 12px; padding: 16px 18px; }
.product-tile-software .product-tile-banner { background: linear-gradient(135deg, var(--blue-pastel), #fff 85%); }
.product-tile-service .product-tile-banner { background: linear-gradient(135deg, var(--blue-pastel), #fff 85%); }
/* Tile colours mean a STATE, the same on tiles and year tabs (2026-09-27):
   blue = yours, orange = available without licence, violet = « Bientôt ».
   Year tabs stay neutral (blue = selected, white = others): coloured tabs
   were judged confusing by a tester (2026-09-27).
   Owned services therefore turned blue too (violet is now « Bientôt »). */
.product-tile-locked .product-tile-banner { background: linear-gradient(135deg, var(--orange-pastel), #fff 85%); }

.product-tile-emblem {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 17px;
    color: #fff;
}
.product-tile-software .product-tile-emblem { background: var(--blue); }
.product-tile-service .product-tile-emblem { background: var(--blue); }
.product-tile-locked .product-tile-emblem { background: var(--orange); }
/* Official logo in place of the letter: white square, logo contained.
   (Selectors carry an extra class so they beat the per-state emblem colours.) */
.product-tile .product-tile-emblem.product-tile-logo,
.software-group-header .product-tile-emblem.product-tile-logo { background: #fff; border: 1px solid var(--border); padding: 4px; }
.product-tile-logo img { width: 100%; height: 100%; object-fit: contain; display: block; }

.product-tile-brand { font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); margin-bottom: 3px; }

/* One "brand" (software_code) grouping on the dashboard — e.g. all
   CADnorm modules for GstarCAD together, separate from the same modules for
   AutoCAD. Year tabs always render (see index.php), even for a single year. */
.software-group { margin-bottom: 28px; }
.software-group-header { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.software-group-header .product-tile-emblem { background: var(--blue); }
.software-group-header h4 { margin: 0; font-size: 15px; }
.software-group .product-grid { margin-bottom: 0; }
/* Year tabs: left-aligned right after the software name (they went unnoticed
   pushed to the far right), slightly larger so they read as the main switch. */
.year-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-left: 8px; }
.year-tab {
    border: 1px solid #b9d4ee;
    background: #fff;
    color: #0b6a9c;
    border-radius: 999px;
    padding: 5px 14px;
    font-size: 13.5px;
    font-weight: 700;
    cursor: pointer;
}
.year-tab:hover { background: var(--blue-pastel); }
.year-tab.active { background: var(--blue); border-color: var(--blue); color: #fff; }

/* Year pill on each software tile, so a tile read on its own stays unambiguous. */
/* The text column may shrink/wrap; the year pill never does, so it can't
   be pushed out of the tile. */
.product-tile-banner-text { min-width: 0; }
.product-tile-banner-text .badge { white-space: nowrap; }
.product-tile-year {
    flex-shrink: 0;
    margin-left: auto;
    align-self: flex-start;
    padding: 3px 10px;
    border-radius: 999px;
    background: #fff;
    border: 1px solid #b9d4ee;
    color: #0b6a9c;
    font-size: 13px;
    font-weight: 700;
}
.product-tile-locked .product-tile-year { border-color: #f3c9a8; color: #a1490f; }
.product-tile-soon .product-tile-year { border-color: #d3b8d6; color: var(--purple); }

.product-tile-body { padding: 16px 18px 18px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.product-tile-body h3 { margin: 0; font-size: 15.5px; }
.product-tile-desc { margin: 0; color: var(--muted); font-size: 13px; flex: 1; }
.product-tile-locked .product-tile-desc { color: #9aa1ab; }

.product-tile-cta { margin-top: 6px; text-align: center; }
.product-tile-cta svg { vertical-align: -2px; margin-right: 6px; }
.product-tile-cta-empty { margin: 6px 0 0; font-size: 12.5px; color: var(--muted); font-style: italic; }

.product-tile-locked-note { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); margin: 0; }
.product-tile-locked-note svg { flex-shrink: 0; color: var(--orange); }

.product-tile-contact { margin-top: auto; padding-top: 6px; font-size: 12.5px; color: var(--muted); text-align: center; line-height: 1.4; }
.product-tile-contact a { font-weight: 600; }

/* "Coming soon" teaser tile (catalog Statut « À venir »): locked like an
   advertised tile, but violet-accented and dashed so it reads as "not yet". */
.product-tile-soon { border-style: dashed; border-color: #d3b8d6; }
.product-tile-soon .product-tile-banner { background: linear-gradient(135deg, var(--purple-pastel), #fff 85%); }
.product-tile-soon .product-tile-emblem { background: var(--purple); color: #fff; }
.product-tile-soon .product-tile-desc { color: var(--muted); }
.product-tile-soon-note { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--purple); margin: 0; font-weight: 600; }

/* ---- Icons (app/includes/icons.php ui_icon()) ---- */
.icon { flex-shrink: 0; vertical-align: -3px; }
.badge .icon { vertical-align: -2px; }
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}
/* Icon-only button: its label lives in title + .sr-only text. */
.btn-icon { display: inline-flex; align-items: center; justify-content: center; padding: 5px 8px; line-height: 1; }
.btn-icon .icon { vertical-align: middle; }
.btn.is-disabled { opacity: .45; cursor: not-allowed; }
.btn-secondary.is-disabled:hover { background: #fff; }

/* Icon-only segmented control (catalog row "Statut"): each state keeps its
   own meaning color — green available, orange coming soon, grey inactive. */
.segmented-icons label { padding: 4px 8px; display: inline-flex; align-items: center; color: #aab1bb; }
.segmented-icons input[type="radio"]:checked + label.seg-active { background: var(--green-pastel); color: #4c7422; }
.segmented-icons input[type="radio"]:checked + label.seg-coming_soon { background: var(--purple-pastel); color: var(--purple); }
.segmented-icons input[type="radio"]:checked + label.seg-inactive { background: #eef0f3; color: #4d5562; }
.segmented-icons input[type="radio"]:disabled + label { opacity: .35; cursor: not-allowed; }

/* Icon checkbox toggle (e.g. "Visible sur le dashboard"): eye / crossed eye. */
.icon-toggle {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 28px;
    margin-left: 4px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #fff;
    color: #aab1bb;
    cursor: pointer;
    vertical-align: middle;
}
.icon-toggle input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.icon-toggle .icon-toggle-on { display: none; }
.icon-toggle input:checked ~ .icon-toggle-on { display: inline-flex; }
.icon-toggle input:checked ~ .icon-toggle-off { display: none; }
.icon-toggle:has(input:checked) { background: var(--blue-pastel); border-color: #b9dff3; color: #0b6a9c; }
.icon-toggle:has(input:focus-visible) { outline: 2px solid var(--blue); outline-offset: 1px; }

/* ---- Chip picker (catalog generator): every existing value visible at
   once, click to select (one or several), "+ Autre" reveals an input to
   type a new one. ---- */
.chips { display: flex; flex-wrap: wrap; gap: 7px; align-items: center; }
.chip, .chip-add-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 13px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: #fff;
    color: var(--text);
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.2;
    cursor: pointer;
    box-shadow: 0 1px 2px rgba(20, 25, 35, .04);
    transition: background .12s, border-color .12s, color .12s;
}
.chip:hover { border-color: #9fd3ef; background: #f5fbfe; }
.chip[aria-pressed="true"] { background: var(--blue-pastel); border-color: var(--blue); color: #0b5f8c; }
.chip[aria-pressed="true"]::before { content: "\2713"; font-weight: 700; }
.chip:focus-visible, .chip-add-toggle:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.chip-add-toggle { border-style: dashed; background: transparent; color: var(--muted); box-shadow: none; font-weight: 500; }
.chip-add-toggle:hover { color: #0b6a9c; border-color: var(--blue); }
.chip-input {
    width: 140px;
    padding: 6px 13px;
    border: 1px solid var(--blue);
    border-radius: 999px;
    background: #fff;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    box-shadow: 0 0 0 3px rgba(38, 168, 231, .15);
}
.chip-input-year { width: 90px; }
.chip-input:focus { outline: none; }

/* ---- Catalog generator ("+ Nouveau logiciel") ---- */
details.panel.panel-wide[open] { flex-basis: 100%; }
details.panel.panel-wide[open] > summary { display: none; }
.generator {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: 0 12px 32px rgba(20, 25, 35, .08);
    overflow: hidden;
}
.generator-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    padding: 18px 22px;
    border-bottom: 1px solid var(--border);
    background: linear-gradient(135deg, var(--blue-pastel), #fff 70%);
}
.generator-head h3 { margin: 0 0 3px; font-size: 16px; color: var(--text); }
.generator-head p { margin: 0; color: var(--muted); font-size: 13px; }
.btn-close { border: none; background: transparent; font-size: 22px; line-height: 1; color: var(--muted); cursor: pointer; padding: 2px 8px; border-radius: 7px; }
.btn-close:hover { background: rgba(20, 25, 35, .06); color: var(--text); }
.generator-body { display: grid; grid-template-columns: minmax(0, 1fr) 330px; }
.generator-steps { padding: 4px 22px 10px; }
.gen-step { padding: 16px 0; border-bottom: 1px solid #eef1f4; }
.gen-step:last-child { border-bottom: none; }
.gen-step-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0 28px; border-bottom: 1px solid #eef1f4; }
.gen-step-row .gen-step { border-bottom: none; }
.gen-step-head { display: flex; align-items: center; gap: 10px; margin-bottom: 11px; flex-wrap: wrap; }
.gen-step-num {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--blue-pastel);
    color: #0b6a9c;
    font-size: 12px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.gen-step-head h4 { margin: 0; font-size: 14px; }
.gen-step-hint { color: var(--muted); font-size: 12px; }
.gen-inline-name { display: flex; align-items: center; gap: 10px; margin-top: 12px; font-size: 12px; color: var(--muted); }
.gen-inline-name[hidden] { display: none; }
.gen-inline-name span { white-space: nowrap; }
.gen-inline-name input {
    flex: 1;
    min-width: 0;
    max-width: 260px;
    border: none;
    border-bottom: 1px dashed #c3cad3;
    padding: 4px 2px;
    font-family: inherit;
    font-size: 13.5px;
    font-weight: 600;
    color: var(--text);
    background: transparent;
}
.gen-inline-name input:focus { outline: none; border-bottom: 1px solid var(--blue); }

.option-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.option-card {
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 11px 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #fff;
    cursor: pointer;
    transition: border-color .12s, background .12s;
}
.option-card input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.option-card-icon { color: #aab1bb; margin-top: 1px; }
.option-card-body strong { display: block; font-size: 13.5px; }
.option-card-body small { display: block; color: var(--muted); font-size: 12px; line-height: 1.35; margin-top: 2px; }
.option-card:hover { border-color: #c3cad3; }
.option-card:has(input:focus-visible) { outline: 2px solid var(--blue); outline-offset: 1px; }
.option-inactive:has(input:checked) { border-color: #9aa3ae; background: #f4f5f7; }
.option-inactive:has(input:checked) .option-card-icon { color: #4d5562; }
.option-coming_soon:has(input:checked) { border-color: var(--purple); background: var(--purple-pastel); }
.option-coming_soon:has(input:checked) .option-card-icon { color: var(--purple); }
.option-active:has(input:checked) { border-color: var(--green); background: var(--green-pastel); }
.option-active:has(input:checked) .option-card-icon { color: #4c7422; }

.generator-preview { background: var(--bg); border-left: 1px solid var(--border); padding: 18px; display: flex; flex-direction: column; gap: 10px; min-height: 100%; }
.gen-preview-title { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.gen-count { display: flex; align-items: baseline; gap: 8px; }
.gen-count strong { font-size: 34px; line-height: 1; color: var(--blue); }
.gen-count span { font-weight: 600; }
.gen-count-sub { margin: 0; color: var(--muted); font-size: 12.5px; }
.bulk-list { list-style: none; margin: 0; padding: 0; max-height: 330px; overflow: auto; display: flex; flex-direction: column; gap: 6px; }
.bulk-list li { background: #fff; border: 1px solid var(--border); border-radius: 9px; padding: 7px 10px; }
.bulk-list code { display: block; font-size: 11px; color: var(--muted); margin-bottom: 2px; }
.bulk-list input {
    width: 100%;
    border: 1px solid transparent;
    border-radius: 5px;
    padding: 2px 4px;
    margin-left: -5px;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    background: transparent;
}
.bulk-list input:hover { border-color: var(--border); }
.bulk-list input:focus { outline: none; border-color: var(--blue); background: #fff; }
.bulk-existing { font-size: 12.5px; color: var(--muted); }
.bulk-existing summary { cursor: pointer; }
.bulk-existing ul { margin: 6px 0 0; padding-left: 18px; }
.bulk-existing code { font-size: 11.5px; }
.gen-actions { margin-top: auto; padding-top: 6px; display: flex; flex-direction: column; gap: 8px; }
.gen-actions .btn { width: 100%; padding: 10px 14px; text-align: center; }
.gen-confirm { display: flex; flex-direction: column; gap: 8px; padding: 12px; border: 1px solid #f3c6a5; border-radius: 10px; background: var(--orange-pastel); }
.gen-confirm[hidden] { display: none; }
.gen-confirm p { margin: 0; font-size: 13px; color: #7a3a0c; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

@media (max-width: 900px) {
    .generator-body { grid-template-columns: 1fr; }
    .generator-preview { border-left: none; border-top: 1px solid var(--border); }
    .gen-step-row { grid-template-columns: 1fr; }
    .option-cards { grid-template-columns: 1fr; }
}

/* ---- Accordion lists (licenses.php families, company.php licences):
   filter / open-close-all / URL fragment handled by app/js/tables.js ---- */
.accordion-toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.accordion-toolbar .search-box { margin-bottom: 0; }
/* Headings between accordions (catalogue: one per software). */
.accordion-group + .accordion-group { margin-top: 26px; }
.accordion-group-title {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 0 10px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--blue-pastel);
    font-size: 18px;
    color: var(--purple);
}
.accordion-group-title img { width: 26px; height: 26px; object-fit: contain; }
.accordion-group-title .muted { font-weight: 400; margin-left: 4px; }
/* Services catalogue: one table per site, same column widths everywhere. */
.catalog-site-table { table-layout: fixed; width: 100%; }
.catalog-site-table .col-code { width: 28%; }
.catalog-site-table .col-name { width: 30%; }
.catalog-site-table .col-url { width: 16%; }
.catalog-site-table .col-status { width: 19%; }
.catalog-site-table .col-actions { width: 7%; }
.catalog-site-table code { word-break: break-all; }
.accordion-title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; min-width: 0; }
.accordion-title > .icon { color: var(--muted); transition: transform .15s; }
details[open] > summary .accordion-title > .icon { transform: rotate(90deg); }
.accordion-sub { font-weight: 400; font-size: 12.5px; color: var(--muted); }
.accordion-meta { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }

.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 28px 0 10px; }
.section-head h2 { margin: 0; }
.view-switch { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; background: #fff; }
.view-switch a { display: inline-flex; align-items: center; gap: 6px; padding: 6px 14px; font-size: 13px; font-weight: 600; color: var(--muted); }
.view-switch a + a { border-left: 1px solid var(--border); }
.view-switch a:hover { text-decoration: none; color: var(--text); }
.view-switch a.active { background: var(--blue-pastel); color: #0b5f8c; }

.license-list { list-style: none; margin: 0; padding: 0; }
.license-list > li { display: flex; align-items: center; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--border); }
.license-list > li:last-child { border-bottom: none; }
.license-list-main { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.license-list-main small { color: var(--muted); font-size: 11.5px; }
.license-list-date { color: var(--muted); font-size: 12px; white-space: nowrap; }
.inline-grant { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 10px; padding-top: 12px; border-top: 1px dashed var(--border); }
.inline-grant select { flex: 1; min-width: 220px; max-width: 480px; padding: 6px 8px; border: 1px solid var(--border); border-radius: 7px; font-family: inherit; font-size: 13px; background: #fff; }
.inline-grant-note { margin: 10px 0 0; font-size: 12.5px; color: var(--muted); }
.btn-danger-ghost { background: #fff; color: var(--danger); border: 1px solid #f0c4c4; }
.btn-danger-ghost:hover { background: var(--danger-pastel); }

/* ---- Live saving (catalog rows) + toasts ---- */
.save-state { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; border-radius: 50%; font-size: 12px; font-weight: 700; color: transparent; }
.save-state.is-saving { color: var(--muted); animation: save-pulse 1s ease-in-out infinite; }
.save-state.is-saved { color: #4c7422; background: var(--green-pastel); }
.save-state.is-error { color: #fff; background: var(--danger); cursor: help; }
@keyframes save-pulse { 50% { opacity: .3; } }
.inline-input.is-invalid { border-color: var(--danger); box-shadow: 0 0 0 3px rgba(214, 58, 58, .12); }
.toast-stack { position: fixed; right: 18px; bottom: 18px; z-index: 100; display: flex; flex-direction: column; gap: 8px; max-width: min(420px, calc(100vw - 36px)); }
.toast { display: flex; align-items: flex-start; gap: 10px; padding: 11px 14px; border-radius: 10px; font-size: 13.5px; box-shadow: 0 8px 24px rgba(20, 25, 35, .14); background: #fff; border-left: 4px solid var(--green); }
.toast-error { border-left-color: var(--danger); }
.toast span { flex: 1; }
.toast-close { border: none; background: transparent; font-size: 18px; line-height: 1; color: var(--muted); cursor: pointer; }

/* ---- Catalog (licenses.php): families accordion + inline-edited rows ---- */
.inline-input {
    width: 100%;
    padding: 5px 8px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-family: inherit;
    font-size: 13.5px;
    background: #fff;
}
.inline-input:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(38, 168, 231, .15); }
.inline-input-sub { margin-top: 4px; padding: 4px 8px; font-size: 12.5px; color: #4d5562; }
.catalog-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 12px; color: var(--muted); margin: 0 0 12px; }
.catalog-legend span { display: inline-flex; align-items: center; gap: 5px; }
.catalog-legend-note { margin-left: auto; color: #4c7422; }
/* No overflow clipping: the row "⋯" menu must float over the next rows. */
details.accordion-item.catalog-family { overflow: visible; }
.catalog-family > summary { flex-wrap: wrap; border-radius: 10px; }
.catalog-family[open] > summary { border-radius: 10px 10px 0 0; border-bottom: 1px solid var(--border); margin-bottom: 6px; }
.catalog-table td { vertical-align: middle; }
.catalog-table .catalog-code-cell code { white-space: nowrap; }
.catalog-name-cell { min-width: 260px; }
.catalog-status-cell, .catalog-release-cell { white-space: nowrap; }
.catalog-release-cell small { display: block; margin-top: 3px; font-size: 11.5px; color: var(--muted); }
.catalog-loader-row > td { background: #f5fafd; }
.catalog-child .catalog-code-cell code::before { content: "\221F\00a0"; color: #aab1bb; }
/* Buttons wrapped in a div (not a flex <td>) so the cell keeps its
   table-cell vertical alignment like its neighbours. */
.catalog-actions { width: 1%; }
.catalog-table .actions-cell { flex-wrap: nowrap; }
.row-menu-body.row-menu-body-wide { min-width: 250px; }
.row-menu-body .btn .icon { margin-right: 4px; }
.row-menu-section { display: flex; flex-direction: column; gap: 6px; padding-top: 6px; border-top: 1px solid var(--border); }
.row-menu-hint { margin: 0; font-size: 12px; font-weight: 400; color: var(--muted); line-height: 1.4; white-space: normal; }

/* TOTP enrollment */
.totp-secret {
    font-family: "Consolas", monospace;
    font-size: 16px;
    letter-spacing: 2px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px 14px;
    word-break: break-all;
    margin: 10px 0;
}
.backup-codes {
    font-family: "Consolas", monospace;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 14px 18px;
    columns: 2;
    gap: 20px;
    margin: 10px 0;
}

/* ---- Small utilities / user page "Utilisation des produits" ---- */
.muted { color: var(--muted); }
.small { font-size: 12px; }
.card-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 0 0 10px; font-size: 14.5px; }
.card-title small { font-weight: 400; font-size: 12.5px; }
.usage-table td { vertical-align: middle; }

/* ---- Packs de licences (licenses.php, software tab): list + editor ---- */
.chip:disabled { opacity: .45; cursor: not-allowed; background: #f4f5f7; }
.packs-card { padding: 0; overflow: hidden; }
.packs-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.packs-head h3 { display: flex; align-items: center; gap: 8px; margin: 0 0 3px; font-size: 15px; }
.packs-head p { margin: 0; max-width: 620px; }
.packs-card > .empty { padding: 14px 20px; margin: 0; }
.pack-list { list-style: none; margin: 0; padding: 0; }
.pack-item { display: flex; align-items: center; gap: 14px; padding: 12px 20px; border-bottom: 1px solid var(--border); }
.pack-item:last-child { border-bottom: none; }
.pack-main { flex: 1; min-width: 0; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
.pack-years { flex-basis: 100%; display: flex; flex-wrap: wrap; gap: 5px; margin-top: 4px; }
.year-badge { padding: 2px 9px; border-radius: 999px; background: var(--blue-pastel); color: #0b5f8c; font-size: 12px; font-weight: 600; }
.pack-actions { display: flex; gap: 6px; }
.pack-editor { border-top: 1px solid var(--border); background: var(--bg); padding: 4px 20px 16px; }
.pack-editor-head { display: flex; justify-content: space-between; align-items: center; padding-top: 12px; }
.pack-editor-head h4 { margin: 0; font-size: 15px; }
.pack-lock-note { margin: 10px 0 0; padding: 9px 12px; border-radius: 8px; background: var(--orange-pastel); color: #7a3a0c; font-size: 13px; }
.pack-pickers { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.pack-picker-label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.pack-editor .gen-step { border-bottom-color: var(--border); }
.pack-editor-foot { display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex-wrap: wrap; padding-top: 14px; }
.pack-editor-foot > .muted { flex: 1; min-width: 200px; }
@media (max-width: 760px) {
    .pack-pickers { grid-template-columns: 1fr; }
    .pack-item { flex-wrap: wrap; }
}

/* ---- Release import (licenses.php) + release upload options ---- */
.import-body { padding: 18px 22px 20px; display: flex; flex-direction: column; gap: 16px; }
.dropzone {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 26px 16px;
    border: 2px dashed #b9dff3;
    border-radius: 12px;
    background: #f7fbfe;
    color: #0b6a9c;
    text-align: center;
    cursor: pointer;
    transition: background .12s, border-color .12s;
}
.dropzone:hover, .dropzone.is-over { background: var(--blue-pastel); border-color: var(--blue); }
.dropzone input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.dropzone .muted { color: var(--muted); }
.import-options { display: flex; gap: 24px; flex-wrap: wrap; align-items: flex-end; }
.import-note { flex: 1; min-width: 240px; }
.import-table { background: #fff; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.import-table td { vertical-align: middle; }
.import-table code { font-size: 12px; }
.import-table tr.import-send td.import-result { color: #0b5f8c; }
.import-table tr.import-skip td { color: var(--muted); }
.import-table tr.import-refuse td.import-result, .import-table tr.import-failed td.import-result { color: var(--danger); }
.import-table tr.import-done td.import-result { color: #4c7422; font-weight: 600; }
.import-progress { display: block; height: 4px; margin-top: 6px; border-radius: 4px; background: var(--border); overflow: hidden; }
.import-progress > span { display: block; height: 100%; width: 0; background: var(--blue); transition: width .2s; }
.import-foot { display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.import-foot > .muted { flex: 1; min-width: 220px; }
.is-running .dropzone, .is-running .import-options, .is-running .advanced-option { opacity: .5; pointer-events: none; }

/* Toggle switch (replaces a bare checkbox). */
.switch { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; font-size: 13px; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.switch-track { position: relative; width: 34px; height: 20px; border-radius: 999px; background: #d6dae0; transition: background .15s; flex-shrink: 0; }
.switch-track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .2); transition: transform .15s; }
.switch input:checked + .switch-track { background: var(--blue); }
.switch input:checked + .switch-track::after { transform: translateX(14px); }
.switch input:focus-visible + .switch-track { outline: 2px solid var(--blue); outline-offset: 2px; }

/* A deliberately discreet, greyed "exception" option (e.g. .zip releases). */
.advanced-option { font-size: 12.5px; color: var(--muted); }
.advanced-option > summary { cursor: pointer; width: max-content; }
.advanced-option .switch { margin-top: 8px; opacity: .7; }
.advanced-option .switch:has(input:checked) { opacity: 1; color: #a1490f; }
.advanced-option small { color: var(--muted); }

/* Pack editor: a year that already belongs to another pack (allowed). */
.chip.chip-shared { border-style: dashed; }

/* Release clean-up page (releases-cleanup.php). */
.cleanup-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-bottom: 16px; }
.cleanup-stat { display: flex; flex-direction: column; gap: 4px; margin-bottom: 0; }
.cleanup-stat strong { font-size: 22px; color: var(--text); }
.cleanup-stat-accent { border-color: #f3c6a5; background: var(--orange-pastel); }
.cleanup-rules summary { cursor: pointer; }
.cleanup-rules ul { margin: 10px 0 6px; padding-left: 20px; font-size: 13.5px; }
.cleanup-actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 20px; }
.cleanup-step { display: flex; gap: 12px; align-items: flex-start; }
.cleanup-step p { margin: 4px 0 10px; }
.cleanup-step .gen-confirm { margin-top: 10px; }

