/* Akiwacu iPaie & RH — styles des écrans
 * Le "shell" Sage i7 est dans sage.css ; ce fichier aligne le contenu,
 * la connexion et les fenêtres sur le style d'Akiwacu iCompta.
 */
:root {
    /* Palette Sage i7 / iCompta */
    --sage-green: #34b233;
    --sage-green-hover: #41a940;
    --sage-green-dark: #249c23;
    --sage-green-deep: #0b8809;
    --sage-teal: #00886b;
    --sage-teal-dark: #01755c;
    --sage-bg: #e0e1dd;
    --sage-text: #4d4f53;
    --sage-line: #b3b3b3;
    --sage-panel: #f6f6f4;
    --sage-border: #c9c9c4;

    /* Anciens alias conservés pour les vues historiques */
    --ip-blue: var(--sage-green);
    --ip-blue-dark: var(--sage-green-dark);
    --ip-orange: #e8821e;
    --ip-border: var(--sage-border);
    --ip-text: var(--sage-text);
}

* { box-sizing: border-box; }

/* ---------------- Pages autonomes (connexion / choix de société) ---------------- */
body.login-body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: system-ui, "Segoe UI", Roboto, sans-serif;
    font-size: 13px;
    color: var(--sage-text);
    background:
        linear-gradient(135deg, rgba(13,106,67,.75) 0%, rgba(6,47,30,.85) 100%),
        url('../images/backround-color.png') center/cover no-repeat fixed;
}

.login-card {
    width: 100%;
    max-width: 400px;
    padding: 0;
    overflow: hidden;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 18px 50px rgba(0,0,0,.4);
    text-align: left;
}
.login-head {
    background: #0d6a43;
    color: #fff;
    text-align: center;
    padding: 28px 20px 18px;
}
.login-head .logo { font-size: 2.6rem; }
.login-head .logo img { height: 72px; width: auto; max-width: 100%; }
.login-head h1 {
    font-size: 1.35rem;
    margin: 6px 0 0;
    font-weight: 700;
    letter-spacing: .5px;
}
.login-head small { opacity: .85; }

/* Ancien bloc conservé pour compatibilité */
.login-brand {
    width: 62px; height: 62px;
    margin: 0 auto 12px;
    border-radius: 50%;
    background: #e8f4e9;
    color: var(--sage-green-dark);
    display: flex; align-items: center; justify-content: center;
    font-size: 30px;
}
.login-card h4 { margin: 0; color: var(--sage-green-dark); font-weight: 600; }
.login-card .form-label { font-size: 12px; font-weight: 600; color: #5a5b5e; text-align: left; }

/* La connexion reprend le vert plus soutenu d'iCompta ;
 * dans l'application, .btn-sage reste le vert Sage i7 de sage.css. */
.login-body .btn-sage {
    background: #0d6a43;
    border-color: #0d6a43;
    color: #fff;
}
.login-body .btn-sage:hover,
.login-body .btn-sage:focus {
    background: #094d31;
    border-color: #094d31;
    color: #fff;
}
.login-body .form-control:focus {
    border-color: #0d6a43;
    box-shadow: 0 0 0 .25rem rgba(13,106,67,.25);
}
.login-footer { margin-top: 18px; color: #b0bec5; font-size: 11px; }

.company-choice {
    display: flex; align-items: center; gap: 12px;
    width: 100%; margin-bottom: 8px;
    padding: 12px;
    border: 1px solid var(--sage-border);
    border-radius: 0;
    background: #fff;
    font: inherit;
    text-align: left;
    text-decoration: none;
    color: var(--sage-text);
    cursor: pointer;
}
.company-choice:hover { background: #eef6ed; border-color: #0d6a43; }
.company-choice span { flex: 1; text-align: left; }
.company-choice small { display: block; color: #7c7c78; }

/* ---------------- En-têtes de page ---------------- */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 16px;
    gap: 12px;
}
.page-title,
.sage-page-title {
    color: var(--sage-green);
    font-size: 24px;
    font-weight: normal;
    margin: 0;
}
.page-title i { color: var(--sage-green); margin-right: 8px; }
.page-subtitle { color: #7c7c78; font-size: 12px; margin: 3px 0 0; }
.page-actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* Cartes, panneaux et KPI : carrés, sans ombre, verts */
.card,
.crud-card,
.panel {
    border-radius: 0;
    border-color: var(--sage-border);
    box-shadow: none;
}
.card-header,
.crud-toolbar,
.panel-head {
    background: #efefec;
    border-bottom: 1px solid #d5d5d0;
    font-size: 12.5px;
    font-weight: bold;
    padding: 6px 10px;
}
.card-footer { background: #f6f6f2; }

.kpi-card { border: 1px solid var(--sage-border); position: relative; overflow: hidden; }
.kpi-card .card-body { padding: 14px 16px; }
.kpi-label { color: #77776f; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; }
.kpi-value { font-size: 22px; font-weight: normal; color: var(--sage-green-dark); margin-top: 4px; }
.kpi-icon { position: absolute; right: 12px; top: 12px; font-size: 34px; color: #eef6ed; }

.alert-item {
    display: flex;
    gap: 9px;
    padding: 8px 0;
    border-bottom: 1px solid #eeeeea;
    font-size: 12px;
}
.alert-item:last-child { border-bottom: none; }

/* ---------------- Tableaux CRUD ---------------- */
.crud-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    flex-wrap: wrap;
}
.search-box { max-width: 320px; }
.crud-toolbar-right { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.crud-table,
.table-sage { font-size: 12.5px; }
.crud-table thead th,
.table-sage thead th {
    background: #ecece8;
    color: #3c3d40;
    font-weight: bold;
    white-space: nowrap;
    border-bottom: 1px solid var(--sage-border);
    border-right: 1px solid #dedeD9;
    padding: 5px 8px;
}
.crud-table tbody td,
.table-sage td { padding: 4px 8px; border-bottom: 1px solid #eeeeea; border-right: 1px solid #f2f2ee; vertical-align: middle; }
.crud-table tbody tr:hover,
.table-sage tbody tr:hover { background: #f2f8f1; }
.crud-table .btn-sm { padding: 2px 7px; font-size: 11px; }

/* ---------------- Boutons et contrôles ---------------- */
.btn { border-radius: 0; font-size: 12.5px; }
.btn-primary,
.btn-success {
    background-color: var(--sage-green-dark);
    border-color: var(--sage-green-deep);
}
.btn-primary:hover,
.btn-primary:focus,
.btn-success:hover,
.btn-success:focus {
    background-color: var(--sage-green-deep);
    border-color: var(--sage-green-deep);
}
.btn-outline-primary {
    color: #3c3d40;
    background: #f7f7f5;
    border-color: #9a9a95;
}
.btn-outline-primary:hover { background: #e7e8e3; color: #000; }
.form-control,
.form-select { border-color: #bdbdb8; border-radius: 0; }
.form-control:focus,
.form-select:focus {
    border-color: var(--sage-green);
    box-shadow: 0 0 0 2px rgba(52,178,51,.15);
}

/* ---------------- Fenêtre générique #winTrait (style MDI i7) ---------------- */
#winTrait .modal-dialog.modal-xl {
    width: min(97vw, 1840px);
    max-width: none;
    margin: 1.5vh auto;
}
#winTrait .modal-content {
    background: #f4f4f4;
    border: 6px solid #4c4e51;
    border-radius: 0;
    box-shadow: 0 10px 40px rgba(0,0,0,.35);
    max-height: 97dvh;
    overflow: hidden;
}
#winTrait .modal-header {
    background: #4c4e51;
    color: #fff;
    border: 0;
    border-radius: 0;
    padding: 5px 10px;
}
#winTrait .modal-title {
    color: #fff;
    font: 12px Arial, Helvetica, sans-serif;
    font-weight: normal;
}
#winTrait .modal-header .btn-close { filter: invert(1); }
#winTrait .modal-body {
    background: #fbfcfb;
    padding: 10px;
    font-size: 12.5px;
}
#winTrait .modal-body table thead th {
    background: #4c4e51;
    color: #fff;
    font-weight: normal;
}
#winTrait .modal-footer {
    background: #f3f3f3;
    border-top: 1px solid var(--sage-border);
    border-radius: 0;
    padding: 8px 10px;
}
#winTrait .modal-footer .btn-secondary {
    background: #f7f7f5;
    border-color: #9a9a95;
    color: #3c3d40;
}

/* ---------------- Toasts ---------------- */
.toast-host { position: fixed; right: 18px; bottom: 40px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; }
.toast-msg {
    padding: 10px 16px;
    border-radius: 0;
    border: 1px solid rgba(255,255,255,.25);
    color: #fff;
    font-size: 12.5px;
    box-shadow: 0 4px 12px rgba(0,0,0,.2);
    animation: toastIn .2s ease-out;
}
.toast-success { background: #2e7d32; }
.toast-danger { background: #c62828; }
@keyframes toastIn { from { opacity: 0; transform: translateX(20px); } }

/* ---------------- Fiche du personnel (style Sage i7) ---------------- */
.fiche-editor .fiche-ident {
    display: flex; align-items: center; gap: 14px;
    background: linear-gradient(90deg, rgba(46,125,50,.08), transparent);
    border-bottom: 1px solid #e3e3df;
}
.fiche-avatar { font-size: 42px; color: var(--sage-green); line-height: 1; }
.fiche-ident-main { flex: 1 1 auto; }
.fiche-ident-name { font-size: 16px; font-weight: 700; color: #2f3032; }
.fiche-ident-sub { display: flex; align-items: center; gap: 10px; margin-top: 2px; }
.fiche-ident-actions { display: flex; gap: 6px; }
.fiche-tabs { border-bottom: 2px solid var(--sage-green); flex-wrap: wrap; }
.fiche-tabs .nav-link {
    border: 0; border-radius: 0; color: #5b5c5e; font-size: 12.5px; padding: 6px 12px;
}
.fiche-tabs .nav-link i { margin-right: 5px; color: var(--sage-green); }
.fiche-tabs .nav-link.active {
    color: #1f2021; font-weight: 600; background: #f3f6f2;
    border-bottom: 2px solid var(--sage-green); margin-bottom: -2px;
}
.fiche-panes { min-height: 320px; }
.fiche-panes .form-label { font-size: 11.5px; color: #6c6d6f; margin-bottom: 2px; font-weight: 600; }
.fiche-panes h6 { color: var(--sage-green); font-weight: 700; }

.bulletin-sheet thead th { background: #f3f6f2; font-size: 11px; text-transform: uppercase; letter-spacing: .02em; }
.bulletin-sheet td { font-size: 12.5px; }
.bulletin-sheet code { font-size: 11px; }

/* ---------------- Carrières (timeline) ---------------- */
.career-timeline { padding-left: 14px; }
.career-item { display: flex; gap: 12px; padding: 10px 0 10px 18px; border-left: 2px solid #e3e3df; margin-left: 12px; position: relative; }
.career-item:last-child { border-left-color: transparent; }
.career-dot { position: absolute; left: -13px; top: 8px; width: 24px; height: 24px; border-radius: 50%; background: #f3f6f2; border: 2px solid var(--sage-green); display: flex; align-items: center; justify-content: center; color: var(--sage-green); font-size: 12px; }
.career-content { flex: 1; }

/* ---------------- Recrutement (kanban) ---------------- */
.rc-board { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 8px; }
.rc-col { flex: 0 0 230px; background: #f3f4f2; border: 1px solid #e3e3df; border-radius: 4px; display: flex; flex-direction: column; }
.rc-col-head { padding: 6px 10px; font-size: 12px; font-weight: 700; border-radius: 4px 4px 0 0; display: flex; justify-content: space-between; align-items: center; }
.rc-col-body { padding: 8px; display: flex; flex-direction: column; gap: 8px; min-height: 80px; }
.rc-card { background: #fff; border: 1px solid #dfe3df; border-left: 3px solid var(--sage-green); border-radius: 3px; padding: 8px; font-size: 12px; box-shadow: 0 1px 2px rgba(0,0,0,.04); }

/* ---------------- Menus verrouillés tant qu'aucune société n'est ouverte (comme iCompta) ---------------- */
.sage-app.no-company .sage-menubar,
.sage-app.no-company .sage-toolbar,
.sage-app.no-company .sage-sidebar {
    opacity: .5;
    pointer-events: none;
    user-select: none;
    filter: grayscale(.4);
}
.sage-app.no-company .sage-menubar { position: relative; }
.sage-app.no-company .sage-menubar::after {
    content: "\F47A  Ouvrez une société pour accéder aux menus";
    font-family: "bootstrap-icons", inherit;
    position: absolute; right: 12px; top: 0; bottom: 0;
    display: flex; align-items: center; gap: 6px;
    font-size: 11px; color: #9a6b00; font-weight: 600; pointer-events: none;
}

/* ---------------- Calendrier des congés ---------------- */
.cv-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cv-head { font-size: 11px; font-weight: 700; color: #5b5c5e; text-align: center; margin-bottom: 4px; }
.cv-cell { min-height: 68px; border: 1px solid #e3e3df; border-radius: 3px; padding: 2px; background: #fff; }
.cv-cell.cv-we { background: #f6f7f5; }
.cv-cell.cv-empty { border: 0; background: transparent; }
.cv-day { font-size: 11px; color: #888; text-align: right; padding: 0 2px; }
.cv-chip { font-size: 10px; color: #fff; border-radius: 3px; padding: 1px 4px; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cv-chip.cv-pending { opacity: .55; border: 1px dashed rgba(255,255,255,.8); }

/* ---------------- Divers ---------------- */
.badge { font-size: 10px; font-weight: 600; }

@media (max-width: 900px) {
    .page-header { flex-direction: column; }
}
@media print {
    .intui-top, .sage-menubar, .sage-toolbar, .sage-sidebar, .sage-status,
    .page-actions, .modal-footer, .toast-host { display: none !important; }
    .sage-content { padding: 0; overflow: visible; }
}

/* ---------------- Ergonomie Sage i7 : Options / Fenêtre / G.A. ---------------- */
.sage-context-menu {
    position: fixed;
    z-index: 1080;
    display: none;
    min-width: 230px;
    padding: 4px;
    background: #fff;
    border: 1px solid #c9c9c2;
    border-radius: 3px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .18);
    font-size: 12px;
}
.sage-context-menu.show { display: block; }
.sage-context-menu button {
    display: block;
    width: 100%;
    padding: 5px 8px;
    border: 0;
    background: transparent;
    text-align: left;
    color: #263238;
}
.sage-context-menu button:hover { background: #e8f1fa; }
.sage-context-menu button small { float: right; color: #8a8a84; }
.scm-sep { height: 1px; margin: 4px 2px; background: #e3e3df; }

body.sage-chain-mode .sage-toolbar::after {
    content: "Création en chaîne";
    margin-left: 8px;
    font-size: 10px;
    font-weight: 700;
    color: #0d6efd;
}
body.sage-select-mode .sage-content table tbody tr { cursor: cell !important; }
body[data-win-mode="cascade"] .sage-content > .card { margin-left: 14px; margin-top: 8px; }
body[data-win-mode="cascade"] .sage-content > .card:nth-child(2) { margin-left: 28px; }
body[data-win-mode="mosaic"] .sage-content { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 12px; align-content: start; }
.sage-sidebar.reorganized { filter: saturate(1.4); }
.sage-sidebar.reorganized .grp { letter-spacing: .08em; text-transform: uppercase; }

#gaTabs .nav-link { font-size: 13px; }
#gaModelsBody tr, #gaSelectionsBody tr { cursor: pointer; }
#gaModelsBody tr.selected, #gaSelectionsBody tr.selected,
.sage-content table tbody tr.selected { background: #e8f1fa; }
.tree-card .tree-count { font-size: 10px; }
.snap-card { transition: transform .12s ease, box-shadow .12s ease; }
.snap-card:hover { transform: translateY(-2px); box-shadow: 0 .5rem 1rem rgba(0,0,0,.12); }
