:root {
    --brand:       #00489a;
    --brand-dark:  #003578;
    --brand-light: #eaf1fb;
    --brand-mid:   #ccdff5;
}

/* ── Base ───────────────────────────────────────────────────── */
body {
    background: #f0f3f7;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: #1a1a2e;
}

/* ── Navbar ─────────────────────────────────────────────────── */
.navbar {
    background: var(--brand) !important;
    padding: 0.85rem 1.75rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.18);
}
.navbar-brand {
    font-weight: 700;
    font-size: 1.1rem;
    letter-spacing: 0.4px;
    color: #fff !important;
}

/* ── Cards ──────────────────────────────────────────────────── */
.card {
    border: none;
    border-radius: 12px;
    box-shadow: 0 1px 5px rgba(0,0,0,0.07), 0 4px 12px rgba(0,0,0,0.04);
    overflow: hidden;
}

/* ── Semester card header ────────────────────────────────────── */
.sem-card-header {
    background: var(--brand-light);
    border-bottom: 1px solid var(--brand-mid);
    padding: 0.7rem 1rem;
    cursor: pointer;
    user-select: none;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    transition: background 0.15s;
}
.sem-card-header:hover {
    background: #d8eaf8;
}

/* ── Collapse chevron ────────────────────────────────────────── */
.collapse-icon {
    color: var(--brand);
    flex-shrink: 0;
    display: flex;
    transition: transform 0.2s ease;
}
.collapsed .collapse-icon {
    transform: rotate(-90deg);
}

/* ── Semester name & badge ───────────────────────────────────── */
.sem-name {
    font-size: 0.95rem;
    font-weight: 700;
    color: #0d1f3c;
}
.sem-badge {
    background: var(--brand) !important;
    font-size: 0.72rem;
    font-weight: 600;
    padding: 0.28em 0.65em;
    border-radius: 6px;
    letter-spacing: 0.3px;
}

/* ── Cell grid ───────────────────────────────────────────────── */
.sem-grid {
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 0.6rem 1.25rem 1.1rem;
}
.sem-group-label {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--brand);
    margin-top: 10px;
    padding-bottom: 3px;
    border-bottom: 1px solid var(--brand-mid);
    width: 100%;
}
.sem-group-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 24px;
    align-items: center;
    padding: 2px 0;
}

.cell-label {
    min-width: 72px;
    text-align: right;
    white-space: nowrap;
    font-size: 0.8rem;
    font-weight: 600;
    color: #4a5568;
}
.cell-input {
    width: 68px;
    text-align: center;
    font-weight: 700;
    font-size: 0.88rem;
    border: 1.5px solid var(--brand-mid);
    border-radius: 7px;
    padding: 4px 6px;
    color: var(--brand);
    background: #fff;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.cell-input:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(0,72,154,0.14);
}

.cell-tip-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 13px;
    height: 13px;
    font-size: 0.6rem;
    font-weight: 700;
    line-height: 1;
    border-radius: 50%;
    border: 1.5px solid var(--brand);
    color: var(--brand);
    cursor: help;
    vertical-align: middle;
    margin-left: 2px;
    opacity: 0.7;
    transition: opacity 0.15s;
}
.cell-tip-icon:hover { opacity: 1; }

/* ── Semester body (credits + notes side by side) ───────────── */
.sem-body-flex {
    display: flex;
    align-items: stretch;
}
.sem-credits-col {
    flex-shrink: 0;
}
.sem-notes-col {
    flex: 1;
    border-left: 1.5px solid var(--brand-mid);
    display: flex;
    flex-direction: column;
}
.sem-notes-inner {
    flex: 1;
    padding: 0.6rem 1.25rem 1rem;
    display: flex;
    flex-direction: column;
}
.sem-notes {
    flex: 1;
    resize: none;
    border: 1.5px solid var(--brand-mid);
    border-radius: 8px;
    padding: 0.55rem 0.75rem;
    font-size: 0.83rem;
    font-family: inherit;
    color: #1a1a2e;
    background: #fafcff;
    min-height: 140px;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.sem-notes:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(0,72,154,0.14);
}
.sem-notes::placeholder {
    color: #9aadbe;
    font-style: italic;
    font-size: 0.8rem;
}

/* ── Section subtitles ───────────────────────────────────────── */
.section-subtitle {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.7px;
    color: var(--brand);
    border-bottom: 1.5px solid var(--brand-mid);
    margin: 0 1.25rem 0;
    padding: 0.6rem 0 0.4rem;
}

/* ── Profile state table ─────────────────────────────────────── */
.profile-table-wrapper {
    margin: 0.6rem 1.25rem 1.25rem;
    overflow-x: auto;
}
.profile-table {
    font-size: 0.8rem;
    border-color: var(--brand-mid);
    min-width: 480px;
}
.profile-table th, .profile-table td {
    text-align: center;
    vertical-align: middle;
    border-color: var(--brand-mid);
}

/* Corner empty cell */
.pt-corner {
    background: transparent;
    border-color: transparent !important;
    border-right-color: var(--brand-mid) !important;
}

/* Group headers — row 1 */
.pt-group {
    font-weight: 700;
    font-size: 0.78rem;
    color: #fff;
    line-height: 1.2;
}
.pt-tc      { background: #2e5fa3; }
.pt-branche { background: #2e7a68; }
.pt-global  { background: #7a5c2e; }

/* Standalone cols spanning all 3 rows */
.pt-lone {
    background: #4a5a6a;
    color: #fff;
    font-weight: 700;
    font-size: 0.75rem;
    vertical-align: middle !important;
}

/* Sub-headers — row 2 (Base, Fil, Dont) */
.pt-sub {
    font-size: 0.72rem;
    font-weight: 700;
}
.pt-sub.pt-branche { background: #d4ede8; color: #1f5448; }

/* Column labels — row 3 */
.pt-col {
    font-size: 0.7rem;
    font-weight: 600;
}
.pt-col.pt-tc      { background: #dce8f8; color: #1e3f72; }
.pt-col.pt-branche { background: #d4ede8; color: #1f5448; }
.pt-col.pt-global  { background: #f0e6d4; color: #5a3d10; }

/* Row labels */
.pt-row-label {
    font-weight: 700;
    font-size: 0.78rem;
    text-align: left;
    white-space: nowrap;
    color: #333;
    background: #f8f9fa;
}

/* Manquants row */
.pt-row-missing td {
    color: #b02a37;
    font-weight: 600;
    background: rgba(176, 42, 55, 0.04);
}
.pt-row-missing .pt-row-label {
    color: #b02a37;
}

/* ── Diplomation table ───────────────────────────────────────── */
.dip-header {
    background: var(--brand);
    color: #fff;
    font-weight: 600;
    font-size: 0.9rem;
    padding: 0.7rem 1rem;
}

/* ── Index option cards ──────────────────────────────────────── */
.option-card {
    border: 1.5px solid var(--brand-mid);
    border-radius: 12px;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.option-card:hover {
    border-color: var(--brand);
    box-shadow: 0 4px 16px rgba(0,72,154,0.1);
}
.option-icon {
    font-size: 2rem;
    line-height: 1;
}
.btn-outline-brand {
    color: var(--brand);
    border: 1.5px solid var(--brand);
    border-radius: 8px;
    padding: 0.55rem 1.25rem;
    font-weight: 600;
    background: transparent;
    text-decoration: none;
    display: inline-block;
    text-align: center;
    transition: background 0.15s, color 0.15s;
}
.btn-outline-brand:hover { background: var(--brand); color: #fff; }

/* ── Upload page ─────────────────────────────────────────────── */
.upload-card {
    border-top: 4px solid var(--brand) !important;
    border-radius: 12px;
}
.upload-zone {
    border: 2px dashed var(--brand-mid);
    border-radius: 10px;
    padding: 2rem 1.5rem;
    text-align: center;
    background: var(--brand-light);
    transition: border-color 0.15s, background 0.15s;
}
.upload-zone:hover {
    border-color: var(--brand);
    background: #daeaf8;
}
.upload-zone input[type="file"] {
    display: none;
}
.upload-icon {
    font-size: 2.5rem;
    line-height: 1;
    margin-bottom: 0.5rem;
    color: var(--brand);
}
.upload-zone label {
    cursor: pointer;
    display: block;
}
.file-name {
    font-size: 0.85rem;
    color: #555;
    margin-top: 0.5rem;
}

/* ── FAB ─────────────────────────────────────────────────────── */
.fab-container {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.6rem;
    z-index: 1050;
}
.fab-main {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: var(--brand);
    color: #fff;
    border: none;
    font-size: 1.8rem;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(0,72,154,0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease, background 0.15s;
}
.fab-main:hover { background: var(--brand-dark); }
.fab-main--open { transform: rotate(45deg); }

.fab-options {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.5rem;
    transition: opacity 0.18s ease, transform 0.18s ease;
}
.fab-options--hidden {
    opacity: 0;
    pointer-events: none;
    transform: translateY(6px);
}

.fab-option {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    text-decoration: none;
}
.fab-option-label {
    background: #fff;
    color: #1a1a2e;
    padding: 0.3rem 0.8rem;
    border-radius: 8px;
    font-size: 0.82rem;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
    white-space: nowrap;
}
.fab-option-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--brand);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    box-shadow: 0 2px 8px rgba(0,72,154,0.25);
    flex-shrink: 0;
}

/* ── Buttons ─────────────────────────────────────────────────── */
.btn-brand {
    background: var(--brand);
    color: #fff;
    border: none;
    font-weight: 600;
    border-radius: 8px;
    padding: 0.55rem 1.25rem;
    transition: background 0.15s;
}
.btn-brand:hover { background: var(--brand-dark); color: #fff; }

.btn-back {
    font-size: 0.82rem;
    color: var(--brand);
    border: 1.5px solid var(--brand);
    border-radius: 8px;
    padding: 0.3rem 0.8rem;
    font-weight: 500;
    background: transparent;
    transition: background 0.15s, color 0.15s;
}
.btn-back:hover { background: var(--brand); color: #fff; }
