:root {
    --systar-red: rgb(218, 41, 28);
    --systar-red-light: rgb(232, 80, 65);
    --systar-red-hover: rgb(180, 30, 20);
    --text: #222;
    --text-muted: #555;
    --border: #ccc;
    --border-focus: #d9342b;
    --bg: #fff;
    --bg-soft: #fafafa;
}

* { box-sizing: border-box; }

/* Make every radio button and checkbox use the Systar red accent (the dot
   inside an active radio, the tick inside a checked checkbox), instead of
   the browser's default blue. Individual pages can still override this if
   they need a different colour on a specific control. */
input[type="radio"],
input[type="checkbox"] { accent-color: var(--systar-red); }

html, body {
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", Helvetica, Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", "Noto Sans Arabic", sans-serif;
    color: var(--text);
    background: var(--bg);
    font-size: 14px;
}

h1, h2, h3 { margin: 0 0 16px 0; font-weight: 600; }

.btn {
    display: inline-block;
    padding: 8px 18px;
    font-size: 14px;
    font-weight: 700;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.15s;
    font-family: inherit;
}
.btn-primary {
    background: var(--systar-red);
    color: #fff;
}
.btn-primary:hover { background: var(--systar-red-hover); }
.btn-icon { font-weight: 700;
    width: 32px;
    height: 32px;
    padding: 0;
    border: 1px solid var(--border);
    background: #f0f0f0;
    color: #000;
    font-size: 18px;
    line-height: 1;
    border-radius: 4px;
    cursor: pointer;
}
.btn-icon:hover { background: #e5e5e5; }

input[type="text"] {
    width: 100%;
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: 3px;
    font-size: 14px;
    font-family: inherit;
}
input[type="text"]:focus {
    outline: none;
    border-color: var(--border-focus);
}

/* ============================================================
   .systar-input — Canonical Systar text input.
   USE THIS CLASS on every <input type="text">, <input type="search">,
   <input type="number">, <input type="email">, <select>, <textarea>
   across the site so every entry field has the same height,
   padding, border, radius and font. Do NOT redefine height,
   min-height, padding or font-size in local stylesheets — apply
   .systar-input instead. If a context needs the input to flex
   inside a row, set `flex:1` (or width) on the surrounding wrapper
   rule, not on .systar-input itself.
   ============================================================ */
input.systar-input,
select.systar-input,
textarea.systar-input {
    box-sizing: border-box;
    height: 28px;
    padding: 3px 10px;
    border: 1px solid var(--border, #ccc);
    border-radius: 3px;
    font-size: 14px;
    font-family: inherit;
    line-height: 1.2;
    background: #fff;
    color: #000;
}
input.systar-input:focus,
select.systar-input:focus,
textarea.systar-input:focus {
    outline: none;
    border-color: var(--border-focus, #888);
}
input.systar-input::placeholder,
textarea.systar-input::placeholder {
    color: #999;
}
textarea.systar-input {
    height: auto;
    min-height: 60px;
    line-height: 1.35;
    padding: 6px 10px;
}

.page {
    max-width: 720px;
    margin: 80px auto;
    padding: 0 24px;
    text-align: center;
}
.page h1 { font-size: 28px; color: var(--systar-red); }
.page p { color: #000; margin-bottom: 32px; }

.universe-form {
    max-width: 880px;
    margin: 40px auto;
    padding: 32px 36px;
    background: #fff;
    border: 1px solid #eee;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}
.universe-form h2 {
    font-size: 20px;
    margin-bottom: 24px;
}
.universe-name-row {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 28px;
}
.universe-name-row label {
    color: var(--systar-red);
    font-weight: 600;
    white-space: nowrap;
}
.universe-name-row input {
    max-width: 280px;
}

.axes-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 8px 6px;
    margin-bottom: 16px;
}
.axes-table th {
    color: var(--systar-red);
    font-weight: 600;
    text-align: left;
    padding: 4px 0;
}
.axes-table th:last-child { width: 40px; }
.axes-table td { vertical-align: middle; }
.axes-table td:last-child { width: 40px; text-align: center; }

/* « + » footer cell that sits directly below the « − » column. The
   column is 40 px wide (last-child rule above), so centering keeps
   the add and remove buttons visually aligned in the same vertical
   strip. */
.add-row { text-align: center; padding: 4px 0 0 0; }

/* ============================================================
   .systar-list — CANONICAL list table style.
   Use this class on EVERY <table> that presents a list of
   clickable items (universes, systems, sub-systems, units,
   carrousel-universes, etc.).
   Editing this single block changes the look of every list
   in Systar at once — that is the whole point. Do NOT put
   list-specific colors / borders / hover behaviours in the
   individual pages : add them here so they propagate.
   ============================================================ */
.systar-list {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.systar-list thead th {
    text-align: left;
    border-bottom: 1.5px solid var(--systar-red);
    color: var(--systar-red);
    font-weight: 700;
    padding: 6px 8px;
    background: #fff;
    white-space: nowrap;            /* never let header text wrap */
}
/* Sortable headers : a small ↕ indicator is shown by default
   (faded), then turns into ↑ or ↓ in the active red colour when the
   column is the current sort key. Pages call applySystarSortIndicator
   (or inline equivalents) on render to set the .sort-asc / .sort-desc
   class on the active header. */
.systar-list thead th[data-sort] {
    cursor: pointer;
    padding-right: 24px;
    position: relative;
}
.systar-list thead th[data-sort]::after {
    content: "↕";
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    color: #c98f8a;                 /* faded systar red, but visible */
    font-size: 15px;
    font-weight: 700;
}
.systar-list thead th[data-sort].sort-asc::after {
    content: "↑";
    color: var(--systar-red);
    font-weight: 700;
    font-size: 16px;
}
.systar-list thead th[data-sort].sort-desc::after {
    content: "↓";
    color: var(--systar-red);
    font-weight: 700;
    font-size: 16px;
}
.systar-list tbody td {
    border-bottom: 1px solid #eee;
    padding: 6px 8px;
    vertical-align: middle;
    color: #000;
}
/* Date-style cells should never wrap — they hold short, single-line
   timestamps and wrapping makes the row tall and unreadable. Pages
   add the `.nowrap` class on the relevant <td>. */
.systar-list tbody td.nowrap,
.systar-list tbody td.date-cell {
    white-space: nowrap;
}
.systar-list tbody tr {
    cursor: pointer;
}
.systar-list tbody tr:hover {
    /* Systar list-row hover : light salmon-red, identical
       across every list in the app. */
    background: #ffd7d2;
}
/* Last column reserved for a small action button (typically
   the delete cross). Narrow + centered. */
.systar-list th:last-child,
.systar-list td:last-child {
    width: 40px;
    text-align: center;
}
/* Canonical small action button inside a list row (delete,
   info, etc.). Any element in the last column with class
   .systar-list-action will look and behave the same way. */
.systar-list .systar-list-action {
    background: transparent;
    border: 1px solid #aaa;
    color: #666;
    border-radius: 4px;
    font-weight: 700;
    font-size: 12px;
    padding: 2px 7px;
    cursor: pointer;
    line-height: 1;
}
.systar-list .systar-list-action:hover {
    background: var(--systar-red);
    color: #fff;
    border-color: var(--systar-red);
}
/* Search bar that sits above a Systar list. The list table is
   typically preceded by an input + count badge in this layout. */
.systar-list-search {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-bottom: 16px;
}
.systar-list-search input[type="text"] {
    flex: 1;
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
}
.systar-list-search .systar-list-count {
    color: #777;
    font-size: 13px;
    white-space: nowrap;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 24px;
}

/* ============================================================
   .systar-modal — modale standard Systar (overlay sombre +
   boîte centrée). Utilisée par la modale frinertie ; à
   réutiliser pour toute future modale au lieu de re-styler.
   ============================================================ */
.systar-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}
.systar-modal {
    background: #fff;
    border: 1.5px solid var(--systar-red);
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
    width: min(560px, 90vw);
    max-height: 88vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.systar-modal-header {
    padding: 16px 22px 12px 22px;
    border-bottom: 1px solid #eee;
    text-align: center;
}
.systar-modal-title {
    margin: 0;
    color: var(--systar-red);
    font-size: 20px;
    font-weight: 700;
}
.systar-modal-subtitle {
    margin: 4px 0 0 0;
    color: #000;
    font-size: 14px;
    font-weight: 600;
}
.systar-modal-context {
    margin: 6px 0 0 0;
    color: #666;
    font-size: 13px;
    font-style: italic;
}
.systar-modal-body {
    padding: 16px 22px;
    overflow-y: auto;
    flex: 1 1 auto;
}
.systar-modal-footer {
    padding: 12px 22px;
    border-top: 1px solid #eee;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    background: #fafafa;
}

/* ===== Frinertie modale — contenu spécifique ===== */
.frinertie-name-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}
.frinertie-name-row label {
    flex: 0 0 160px;
    font-weight: 700;
    color: #000;
    font-size: 13px;
}
.frinertie-name-row input {
    flex: 1 1 auto;
    padding: 6px 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 13px;
}
.frinertie-block-title {
    margin: 14px 0 6px 0;
    color: var(--systar-red);
    font-size: 14px;
    font-weight: 700;
    border-bottom: 1px solid #eee;
    padding-bottom: 4px;
}
.frinertie-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    margin-bottom: 6px;
}
.frinertie-table thead th {
    text-align: left;
    color: var(--systar-red);
    font-weight: 700;
    padding: 4px 6px;
    border-bottom: 1px solid #eee;
}
.frinertie-table tbody td {
    padding: 4px 6px;
    vertical-align: middle;
}
.frinertie-table tbody td.frinertie-label {
    font-weight: 600;
    color: #000;
}
.frinertie-table input {
    width: 100%;
    box-sizing: border-box;
    padding: 4px 6px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 13px;
}

/* ===== Bandeau de succès (post-création) ===== */
.systar-success-banner {
    background: #e7f7e3;
    border: 1px solid #5ca150;
    color: #1f6f17;
    padding: 10px 14px;
    border-radius: 6px;
    margin-bottom: 16px;
    font-size: 13px;
    font-weight: 600;
    text-align: center;
}

/* === Systar — En-tête commun (titre + onglets) === */
.systar-frame {
    max-width: 920px;
    margin: 24px auto;
    background: #fff;
    border: 0.5px solid #e5e5e5;
    border-radius: 8px;
    overflow: hidden;
}

.systar-header {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 0.5px solid #e5e5e5;
}
.systar-header .systar-title {
    text-align: center;
}
.systar-header .systar-title-name {
    font-family: Helvetica, Arial, sans-serif;
    font-weight: 700;
    color: #000;
    font-size: 40px;
    letter-spacing: -0.5px;
}
.systar-header .systar-title-r {
    font-size: 20px;
    color: #000;
    margin-left: 3px;
    vertical-align: sub;
}
.systar-header .systar-back {
    text-align: right;
}
.systar-header .systar-back a {
    color: rgb(218, 41, 28);
    text-decoration: none;
    font-weight: 700;
    font-size: 16px;
}

.systar-tabs {
    display: flex;
    border-bottom: 1.5px solid #999;
    border-top:    1.5px solid #999;
    border-left:   1.5px solid #999;
    border-right:  1.5px solid #999;
    border-radius: 4px;
}
.systar-tabs .systar-tab {
    flex: 1;
    text-align: center;
    padding: 14px 16px;
    cursor: pointer;
    font-weight: 700;
    font-size: 24px;
    color: rgb(218, 41, 28);   /* Systar red — labels match the brand accent */
    background: #f0f0f0;
    border-right: 1.5px solid #999;
    user-select: none;
}
.systar-tabs .systar-tab:last-child { border-right: none; }
.systar-tabs .systar-tab:hover { background: #e5e5e5; }
.systar-tabs .systar-tab.active {
    background: var(--systar-red-light);
    color: #fff;
}

.systar-content {
    padding: 32px 24px;
    min-height: 280px;
}

/* === Systar — Boutons d'en-tête (Systar site / documentation) === */
.systar-header .systar-left { text-align: left; }
.systar-header .systar-right { text-align: right; }

.systar-link-btn {
    display: inline-block;
    padding: 6px 14px;
    border: 1px solid rgb(218, 41, 28);
    border-radius: 4px;
    color: rgb(218, 41, 28);
    background: #f0f0f0;
    text-decoration: none;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    transition: background-color 0.15s, color 0.15s;
}
.systar-link-btn:hover {
    background: var(--systar-red-light);
    color: #fff;
}

/* "Quit Systar" footer button + Home / Back navigation buttons: neutral
   grey instead of Systar red. These are utility / navigation actions, not
   primary calls-to-action, so the brand red would over-emphasise them.
   Grey keeps them discreet and consistent across every page. */
.systar-quit-btn,
.systar-back-btn,
.systar-link-btn[data-i18n="header.home"],
.systar-link-btn[data-i18n="header.back"],
.systar-link-btn[data-i18n="header.close"],
.systar-link-btn[href="bureau.html"] {
    border-color: #000;
    color: #000;
}
.systar-quit-btn:hover,
.systar-back-btn:hover,
.systar-link-btn[data-i18n="header.home"]:hover,
.systar-link-btn[data-i18n="header.back"]:hover,
.systar-link-btn[data-i18n="header.close"]:hover,
.systar-link-btn[href="bureau.html"]:hover {
    background: #000;
    color: #fff;
    border-color: #000;
}

/* "Systar site" and "Systar documentation" — discrete external links
   in the top-left of every page header. Black text + black border
   (no Systar red here, they're not actions). Same height as the
   Quit Systar button so the header keeps its visual baseline. */
.systar-link-btn[data-i18n="header.systarSite"],
.systar-link-btn[data-i18n="header.systarDocumentation"],
.systar-link-btn[data-i18n="header.examplesList"] {
    border-color: #000;
    color: #000;
    height: 36px;
    display: inline-flex;
    align-items: center;
    box-sizing: border-box;
    vertical-align: middle;
}
.systar-link-btn[data-i18n="header.systarSite"]:hover,
.systar-link-btn[data-i18n="header.systarDocumentation"]:hover,
.systar-link-btn[data-i18n="header.examplesList"]:hover {
    background: #000;
    color: #fff;
    border-color: #000;
}

/* === Systar — Pied de page (langue + Quit) === */
.systar-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 20px;
    /* No top border — keep the footer flush with the page content
       above (Quit Systar button sits without a separator line). */
}
.systar-footer-left { position: relative; }
.systar-footer-right { text-align: right; }

/* Bouton globe */
.systar-lang-btn {
    color: #000;
    width: 36px;
    height: 36px;
    /* Same width and style as the black navigation buttons
       (Home / Back / Close / Quit Systar / Systar site /
       Systar documentation): 1px solid #000. */
    border: 1px solid #000;
    border-radius: 50%;
    background: #f0f0f0;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}
.systar-lang-btn:hover {
    background: #000;
    color: #fff;
}

/* Menu déroulant des langues */
.systar-lang-menu {
    position: absolute;
    top: 44px;
    right: 0;
    left: auto;
    background: #fff;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    min-width: 160px;
    display: none;
    z-index: 10;
}
.systar-lang-menu.open { display: block; }
.systar-lang-item {
    padding: 10px 16px;
    cursor: pointer;
    font-weight: 700;
    font-size: 14px;
    color: #000;
}
.systar-lang-item:hover {
    background: var(--systar-red-light);
    color: #fff;
}

/* === Support RTL (arabe, hébreu, etc.) === */
[dir="rtl"] .systar-tabs .systar-tab { border-right: none; border-left: 1.5px solid #999; }
[dir="rtl"] .systar-tabs .systar-tab:last-child { border-left: none; }
[dir="rtl"] .systar-tabs .systar-tab:first-child { border-left: 1.5px solid #999; }

/* In RTL the language button moves to the LEFT side of the header — anchor the
   dropdown to its LEFT edge so it extends rightwards into the page instead of
   sliding off-screen past the left border. */
[dir="rtl"] .systar-lang-menu { left: 0; right: auto; }
[dir="rtl"] .systar-quit-btn { margin-left: 0; margin-right: 8px; }

/* Les flèches "←" / "→" sont géographiquement opposées en RTL —
   le navigateur ne les inverse pas automatiquement, à l'utilisateur de fournir
   les bons caractères dans les fichiers de traduction. */

/* === Header : garder les boutons coll\u00e9s aux bords m\u00eame en RTL === */
[dir="rtl"] .systar-header .systar-left {
    text-align: right;
}
[dir="rtl"] .systar-header .systar-right {
    text-align: left;
}

/* En RTL, le navigateur inverse les colonnes de la grid 1fr auto 1fr.
   Il faut donc inverser les text-align pour que les boutons restent coll\u00e9s aux bords. */
[dir="rtl"] .systar-header .systar-left { text-align: right; }
[dir="rtl"] .systar-header .systar-right { text-align: left; }
[dir="rtl"] .systar-footer-left { /* conserve son alignement gauche en RTL */ }
[dir="rtl"] .systar-footer-right { /* conserve son alignement droite en RTL */ }

/* === Table de l'unenxologie : framing pour bien distinguer lignes/colonnes === */
#unenxologySection h2 {
    text-align: center;
}
#unenxologySection .axes-table {
    border-collapse: collapse;
    border: 1px solid #ccc;
}
#unenxologySection .axes-table th,
#unenxologySection .axes-table td {
    border: 1px solid #ddd;
    padding: 8px 12px;
}
#unenxologySection .axes-table th {
    background: #f5f5f5;
}
#unenxologySection .axes-table tbody tr:nth-child(even) {
    background: #fafafa;
}




/* === Unenxologie : header blanc, gris à partir de la ligne 0 === */
#unenxologySection .axes-table thead th { background: #ffffff !important; }

#unenxologySection .axes-table tbody tr.enj-0 td { background: #f0f0f0; }
#unenxologySection .axes-table tbody tr.enj-1 td { background: #e0e0e0; }
#unenxologySection .axes-table tbody tr.enj-2 td { background: #d0d0d0; }
#unenxologySection .axes-table tbody tr.enj-3 td { background: #c0c0c0; }
#unenxologySection .axes-table tbody tr.enj-4 td { background: #b0b0b0; }
#unenxologySection .axes-table tbody tr.enj-5 td { background: #a0a0a0; }
#unenxologySection .axes-table tbody tr.enj-6 td { background: #909090; }
#unenxologySection .axes-table tbody tr.enj-7 td { background: #808080; }

/* Indentation du label selon enjectence */
#unenxologySection .axes-table tbody tr.enj-0 td:nth-child(4) { padding-left: 12px; }
#unenxologySection .axes-table tbody tr.enj-1 td:nth-child(4) { padding-left: 28px; }
#unenxologySection .axes-table tbody tr.enj-2 td:nth-child(4) { padding-left: 44px; }
#unenxologySection .axes-table tbody tr.enj-3 td:nth-child(4) { padding-left: 60px; }
#unenxologySection .axes-table tbody tr.enj-4 td:nth-child(4) { padding-left: 76px; }
#unenxologySection .axes-table tbody tr.enj-5 td:nth-child(4) { padding-left: 92px; }
#unenxologySection .axes-table tbody tr.enj-6 td:nth-child(4) { padding-left: 108px; }
#unenxologySection .axes-table tbody tr.enj-7 td:nth-child(4) { padding-left: 124px; }

/* Footer-left : aligner les boutons (langue + déductions) côte à côte */
.systar-footer-left {
    display: flex;
    align-items: center;
    gap: 8px;
}
