/* ===============================================================
   AFRIKTECK KONTA — Composants UI (dashboard & vues internes)
   Charte AFRIKTECK : green #107c41, slate, Inter.
   Namespace .dkt-* / .dash-* (aucun conflit avec style.css).
   =============================================================== */

/* ---------- Hero (accueil) ---------- */
.dash-hero {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
    padding: 26px 28px;
    border-radius: 18px;
    color: #fff;
    background: linear-gradient(135deg, #107c41 0%, #0f766e 100%);
    box-shadow: 0 12px 32px rgba(16, 124, 65, 0.22);
    overflow: hidden;
}
.dash-hero::after {
    content: "";
    position: absolute; right: -60px; top: -60px; width: 220px; height: 220px;
    border-radius: 50%; background: rgba(255, 255, 255, 0.10);
}
.dash-hero__main { position: relative; z-index: 1; min-width: 0; }
.dash-hero__eyebrow { font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; opacity: 0.9; }
.dash-hero__title { font-size: 24px; font-weight: 800; letter-spacing: -0.02em; margin: 6px 0 4px; color: #fff; }
.dash-hero__sub { font-size: 13px; opacity: 0.92; margin: 0; }
.dash-hero__actions { position: relative; z-index: 1; display: flex; gap: 10px; flex-wrap: wrap; }

.dkt-btn {
    display: inline-flex; align-items: center; gap: 8px;
    font-size: 13px; font-weight: 700; text-decoration: none;
    padding: 10px 16px; border-radius: 10px; border: 1px solid transparent;
    transition: all .15s ease;
}
.dkt-btn--light { background: #fff; color: #0c5e32; box-shadow: 0 4px 12px rgba(0,0,0,.12); }
.dkt-btn--light:hover { transform: translateY(-1px); text-decoration: none; color: #0c5e32; }
.dkt-btn--ghost { background: rgba(255,255,255,.16); color: #fff; border-color: rgba(255,255,255,.35); }
.dkt-btn--ghost:hover { background: rgba(255,255,255,.24); text-decoration: none; color: #fff; }

/* ---------- KPI ---------- */
.dash-kpis {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 14px;
    margin: 18px 0 6px;
}
.dash-kpi {
    display: flex; align-items: center; gap: 14px;
    background: #fff; border: 1px solid #e2e8f0; border-radius: 14px;
    padding: 16px 18px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
    transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.dash-kpi:hover { transform: translateY(-2px); box-shadow: 0 10px 24px rgba(15,23,42,.08); border-color: #cbd5e1; }
.dash-kpi__icon {
    width: 44px; height: 44px; flex: none; border-radius: 12px;
    display: grid; place-items: center; color: #fff;
}
.dash-kpi__icon.k--green  { background: linear-gradient(135deg, #16a34a, #107c41); }
.dash-kpi__icon.k--teal   { background: linear-gradient(135deg, #14b8a6, #0f766e); }
.dash-kpi__icon.k--amber  { background: linear-gradient(135deg, #f59e0b, #d97706); }
.dash-kpi__icon.k--slate  { background: linear-gradient(135deg, #475569, #334155); }
.dash-kpi__icon.k--violet { background: linear-gradient(135deg, #6d28d9, #a78bfa); }
.dash-kpi__body { min-width: 0; }
.dash-kpi__label { font-size: 11px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: #64748b; }
.dash-kpi__value { font-size: 20px; font-weight: 800; color: #0f172a; font-variant-numeric: tabular-nums; line-height: 1.2; margin-top: 2px; }
.dash-kpi__sub { font-size: 11px; color: #94a3b8; margin-top: 2px; }

/* ---------- Sections / modules ---------- */
.dash-section {
    font-size: 13px; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase;
    color: #64748b; margin: 26px 0 12px;
}
.module-icon.dkt-mod {
    width: 48px; height: 48px; border-radius: 12px; font-size: 0;
    display: grid; place-items: center; color: #fff; margin-bottom: 14px;
}
.dkt-mod--green  { background: linear-gradient(135deg, #16a34a, #107c41); }
.dkt-mod--teal   { background: linear-gradient(135deg, #14b8a6, #0f766e); }
.dkt-mod--amber  { background: linear-gradient(135deg, #f59e0b, #d97706); }
.dkt-mod--slate  { background: linear-gradient(135deg, #475569, #334155); }
.dkt-mod--violet { background: linear-gradient(135deg, #6d28d9, #a78bfa); }

@media (max-width: 640px) {
    .dash-hero { padding: 20px; }
    .dash-hero__title { font-size: 20px; }
    .dash-kpi { padding: 14px; }
}

/* ---------- Graphiques comptabilité ---------- */
.dash-charts {
    display: grid;
    grid-template-columns: 1.4fr 1fr;
    gap: 14px;
    margin: 18px 0;
}
.dkt-card { background: #fff; border: 1px solid #e2e8f0; border-radius: 14px; box-shadow: 0 1px 2px rgba(15,23,42,.04); overflow: hidden; }
.dkt-card__head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 18px; border-bottom: 1px solid #eef2f7; }
.dkt-card__head h3 { font-size: 14px; font-weight: 700; color: #0f172a; margin: 0; display: flex; align-items: center; gap: 8px; }
.dkt-card__head h3 i { color: #107c41; }
.dkt-card__tag { font-size: 10.5px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: #64748b; background: #f1f5f9; padding: 3px 9px; border-radius: 999px; }
.dkt-card__body { padding: 16px 18px; }
.dkt-chart { width: 100%; height: auto; display: block; }
.dkt-hbar { margin-bottom: 12px; }
.dkt-hbar:last-child { margin-bottom: 0; }
.dkt-hbar__label { font-size: 12px; font-weight: 600; color: #334155; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 4px; }
.dkt-hbar__track { height: 8px; background: #f1f5f9; border-radius: 999px; overflow: hidden; }
.dkt-hbar__track span { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, #16a34a, #107c41); }
.dkt-hbar__val { font-size: 11.5px; font-weight: 700; color: #0f766e; font-variant-numeric: tabular-nums; text-align: right; margin-top: 2px; }
.dkt-empty { padding: 22px 10px; text-align: center; color: #94a3b8; font-size: 12.5px; }
@media (max-width: 900px) { .dash-charts { grid-template-columns: 1fr; } }

/* ---------- En-tête de page standardisé ---------- */
.dkt-page-head {
    display: flex; align-items: flex-end; justify-content: space-between;
    gap: 16px; flex-wrap: wrap; margin-bottom: 18px;
}
.dkt-page-head__title {
    font-size: 22px; font-weight: 800; letter-spacing: -0.02em; color: #0f172a;
    margin: 0; display: flex; align-items: center; gap: 10px; line-height: 1.15;
}
.dkt-page-head__title i, .dkt-page-head__title svg { color: #107c41; }
.dkt-page-head__sub { font-size: 13px; color: #64748b; margin-top: 4px; }
.dkt-page-head__actions { display: flex; gap: 8px; flex-wrap: wrap; }
.dkt-page-head + .page-actions { margin-top: -6px; }

/* pastille de statut générique */
.dkt-dot { display:inline-block; width:7px; height:7px; border-radius:50%; vertical-align:middle; margin-right:6px; }
.dkt-dot--ok { background:#107c41; } .dkt-dot--warn { background:#d97706; } .dkt-dot--off { background:#94a3b8; }

/* ---------- Cartes d'espaces comptables ---------- */
.dkt-org-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.dkt-org {
    background: #fff; border: 1px solid #e2e8f0; border-radius: 16px; padding: 18px;
    box-shadow: 0 1px 2px rgba(15,23,42,.04); display: flex; flex-direction: column; gap: 14px;
    transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.dkt-org:hover { box-shadow: 0 10px 24px rgba(15,23,42,.08); border-color: #cbd5e1; transform: translateY(-2px); }
.dkt-org.is-active { border-color: #107c41; box-shadow: 0 0 0 3px rgba(16,124,65,.12); }
.dkt-org__head { display: flex; align-items: center; gap: 12px; }
.dkt-org__logo { width: 46px; height: 46px; flex: none; border-radius: 12px; display: grid; place-items: center; background: #f1f5f9; color: #107c41; overflow: hidden; }
.dkt-org__logo img { width: 100%; height: 100%; object-fit: contain; }
.dkt-org__name { font-size: 15px; font-weight: 800; color: #0f172a; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dkt-org__meta { font-size: 11.5px; color: #64748b; }
.dkt-org__rows { display: flex; flex-direction: column; gap: 6px; }
.dkt-org__rows > div { display: flex; justify-content: space-between; gap: 10px; font-size: 12px; border-bottom: 1px dashed #eef2f7; padding-bottom: 5px; }
.dkt-org__rows > div:last-child { border-bottom: 0; padding-bottom: 0; }
.dkt-org__rows span { color: #64748b; }
.dkt-org__rows b { color: #334155; font-weight: 600; text-align: right; overflow: hidden; text-overflow: ellipsis; }
.dkt-org__actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: auto; padding-top: 12px; border-top: 1px solid #eef2f7; }

/* ---------- Harmonisation en-têtes hérités (.page-header-card / .page-title) ---------- */
.page-header-card {
    background: transparent;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    padding: 0;
    margin: 0 0 18px;
    align-items: flex-end;
    gap: 16px;
}
.page-title {
    font-size: 22px;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: #0f172a;
    text-align: left;
    flex: 1 1 auto;
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
}
.page-title i { color: #107c41; margin-right: 0; }
.page-header-card .page-subtitle { text-align: left; }
.page-actions { justify-content: flex-start; flex: 0 0 auto; }
.container > .page-title { margin-bottom: 16px; }

/* ---------- Ligne de réduction/frais (preview facture) ---------- */
.total-reduction .total-label,
.total-reduction .total-value { color: #d93025; font-weight: 700; }

/* ---------- Masquage des données sensibles ---------- */
.mask-cell { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; vertical-align: middle; }
.mask-cell__value { min-width: 0; }
.mask-cell__value.is-masked {
    position: relative;
    display: inline-block;
    width: 88px;
    height: 15px;
    border-radius: 6px;
    overflow: hidden;
    vertical-align: middle;
    background: repeating-linear-gradient(45deg, #d7dfe9 0, #d7dfe9 5px, #eef2f7 5px, #eef2f7 10px);
    box-shadow: inset 0 0 0 1px #e2e8f0;
}
.mask-cell__value.is-masked::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .85), transparent);
    transform: translateX(-100%);
    animation: maskShimmer 2.6s ease-in-out infinite;
}
@keyframes maskShimmer { to { transform: translateX(100%); } }
.mask-cell__eye {
    flex: none;
    width: 22px;
    height: 22px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: #94a3b8;
    cursor: pointer;
    display: grid;
    place-items: center;
    font-size: 11px;
    line-height: 1;
    transition: background .15s ease, color .15s ease;
}
.mask-cell__eye:hover { color: #107c41; background: #ecfdf5; }
.mask-cell__eye[aria-pressed="true"] { color: #107c41; }

/* ---------- Info-bulles (remplace le rendu CSS rogné) ---------- */
.info-tooltip::before,
.info-tooltip::after { content: none !important; display: none !important; }
.info-tooltip { cursor: help; color: #94a3b8; display: inline-flex; align-items: center; margin-left: 6px; transition: color .15s ease; }
.info-tooltip:hover, .info-tooltip:focus { color: #107c41; outline: none; }
.info-tooltip i { font-size: 13px; }

.kt-tooltip {
    position: fixed;
    z-index: 200000;
    max-width: 300px;
    background: #0f172a;
    color: #f8fafc;
    font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 12.5px;
    font-weight: 400;
    line-height: 1.5;
    text-align: left;
    padding: 10px 13px;
    border-radius: 10px;
    box-shadow: 0 14px 34px rgba(15, 23, 42, .30);
    opacity: 0;
    transform: translateY(4px);
    pointer-events: none;
    transition: opacity .15s ease, transform .15s ease;
}
.kt-tooltip.is-visible { opacity: 1; transform: none; }
.kt-tooltip::after {
    content: "";
    position: absolute;
    left: var(--kt-arrow, 50%);
    transform: translateX(-50%);
    border: 6px solid transparent;
    top: 100%;
    border-top-color: #0f172a;
}
.kt-tooltip--below::after {
    top: auto;
    bottom: 100%;
    border-top-color: transparent;
    border-bottom-color: #0f172a;
}

/* ===============================================================
   Catalogue articles & prestations — liste, badges, modales
   =============================================================== */

/* ---------- Table compacte ---------- */
.dkt-table { width: 100%; border-collapse: collapse; }
.dkt-table th, .dkt-table td { padding: 12px 18px; text-align: left; border-bottom: 1px solid #eef2f7; font-size: 13.5px; vertical-align: middle; }
.dkt-table thead th { font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: #64748b; background: #f8fafc; white-space: nowrap; }
.dkt-table tbody tr { transition: background .12s ease; }
.dkt-table tbody tr:hover { background: #f8fafc; }
.dkt-table tbody tr:last-child td { border-bottom: 0; }
.dkt-table td.num, .dkt-table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.dkt-table td.act, .dkt-table th.act { text-align: right; white-space: nowrap; }
.dkt-table tr.row-alert { background: #fffaf0; }
.dkt-table tr.row-alert:hover { background: #fff5e6; }

.dkt-name { font-weight: 700; color: #0f172a; }
.dkt-desc { display: block; font-size: 12px; color: #94a3b8; margin-top: 2px; }

/* ---------- Pastilles stock / statut ---------- */
.dkt-stock { display: inline-flex; align-items: center; gap: 6px; font-weight: 800; font-size: 12.5px; padding: 4px 11px; border-radius: 999px; font-variant-numeric: tabular-nums; }
.dkt-stock--ok { background: #dcfce7; color: #15803d; }
.dkt-stock--low { background: #fef3c7; color: #b45309; }
.dkt-stock--zero { background: #fee2e2; color: #b91c1c; }

.dkt-pill { display: inline-flex; align-items: center; font-size: 10.5px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; padding: 4px 10px; border-radius: 999px; }
.dkt-pill--ok { background: #dcfce7; color: #15803d; }
.dkt-pill--warn { background: #fef3c7; color: #b45309; }
.dkt-pill--danger { background: #fee2e2; color: #b91c1c; }
.dkt-pill--neutral { background: #f1f5f9; color: #475569; }

/* ---------- Modale générique ---------- */
.dkt-modal {
    display: none; position: fixed; inset: 0; z-index: 1000;
    background: rgba(15, 23, 42, .55); overflow-y: auto; padding: 24px 14px;
}
.dkt-modal__dialog {
    background: #fff; width: 100%; max-width: 540px; margin: 4vh auto;
    border-radius: 16px; box-shadow: 0 24px 60px rgba(15, 23, 42, .30);
    overflow: hidden; animation: dktPop .18s ease;
}
.dkt-modal__dialog--lg { max-width: 900px; }
.dkt-modal__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid #eef2f7; }
.dkt-modal__head h3 { margin: 0; font-size: 16px; font-weight: 800; color: #0f172a; display: flex; align-items: center; gap: 10px; }
.dkt-modal__head h3 i { color: #107c41; }
.dkt-modal__close { border: 0; background: #f1f5f9; color: #475569; width: 34px; height: 34px; border-radius: 10px; font-size: 20px; line-height: 1; cursor: pointer; display: grid; place-items: center; transition: .15s ease; }
.dkt-modal__close:hover { background: #e2e8f0; color: #0f172a; }
.dkt-modal__body { padding: 20px; max-height: 68vh; overflow-y: auto; }
.dkt-modal__foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 20px; border-top: 1px solid #eef2f7; background: #f8fafc; }
@keyframes dktPop { from { transform: translateY(10px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- Cartes facture (modale) ---------- */
.dkt-invoice-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.dkt-invoice { border: 1px solid #e2e8f0; border-radius: 14px; padding: 14px; background: #fff; cursor: pointer; transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease; }
.dkt-invoice:hover { border-color: #107c41; box-shadow: 0 10px 24px rgba(15, 23, 42, .08); transform: translateY(-2px); }
.dkt-invoice__top { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.dkt-invoice__num { font-weight: 800; color: #107c41; font-size: 13.5px; }
.dkt-invoice__row { display: flex; justify-content: space-between; gap: 10px; font-size: 12.5px; color: #64748b; padding: 3px 0; }
.dkt-invoice__row b { color: #334155; font-weight: 600; }
.dkt-invoice__foot { margin-top: 10px; padding-top: 10px; border-top: 1px dashed #eef2f7; font-size: 12.5px; font-weight: 700; color: #107c41; }

/* ---------- Barre d'info (modale lignes) ---------- */
.dkt-infobar { display: flex; flex-wrap: wrap; gap: 8px 24px; padding: 12px 16px; background: #f8fafc; border: 1px solid #eef2f7; border-radius: 12px; margin-bottom: 16px; font-size: 12.5px; color: #64748b; }
.dkt-infobar b { color: #0f172a; }

/* ---------- Champs de formulaire ---------- */
.dkt-form .dkt-field { margin-bottom: 16px; }
.dkt-form .dkt-field:last-child { margin-bottom: 0; }
.dkt-form label { display: block; font-size: 12.5px; font-weight: 700; color: #334155; margin-bottom: 6px; }
.dkt-form .dkt-hint { display: block; font-size: 11.5px; color: #94a3b8; margin-top: 5px; }
.dkt-input { width: 100%; padding: 10px 12px; border: 1px solid #cbd5e1; border-radius: 10px; font-size: 14px; font-family: inherit; color: #0f172a; background: #fff; transition: border-color .15s ease, box-shadow .15s ease; box-sizing: border-box; }
.dkt-input:focus { outline: none; border-color: #107c41; box-shadow: 0 0 0 3px rgba(16, 124, 65, .12); }
.dkt-input[readonly] { background: #f1f5f9; color: #475569; }
.dkt-input-wrap { display: flex; }
.dkt-input-wrap .dkt-input { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.dkt-input-suffix { display: flex; align-items: center; padding: 0 13px; background: #f1f5f9; border: 1px solid #cbd5e1; border-left: 0; border-radius: 0 10px 10px 0; font-weight: 800; color: #475569; font-size: 13px; }
.dkt-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

/* ---------- Chargement ---------- */
.dkt-spinner { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 42px; color: #94a3b8; font-size: 13px; }
.dkt-spinner__ring { width: 36px; height: 36px; border: 3px solid #e2e8f0; border-top-color: #107c41; border-radius: 50%; animation: dktSpin .8s linear infinite; }
@keyframes dktSpin { to { transform: rotate(360deg); } }

/* ---------- Toast ---------- */
.dkt-toast { position: fixed; top: 20px; right: 20px; z-index: 1200; display: flex; align-items: center; gap: 10px; padding: 13px 18px; border-radius: 12px; color: #fff; font-weight: 600; font-size: 13.5px; box-shadow: 0 12px 30px rgba(15, 23, 42, .22); animation: dktSlideIn .25s ease; }
.dkt-toast--success { background: #107c41; }
.dkt-toast--error { background: #d93025; }
.dkt-toast.is-out { animation: dktSlideOut .25s ease forwards; }
@keyframes dktSlideIn { from { transform: translateX(110%); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes dktSlideOut { to { transform: translateX(110%); opacity: 0; } }

@media (max-width: 640px) {
    .dkt-modal__dialog { margin: 2vh auto; }
    .dkt-modal__body { max-height: 74vh; padding: 16px; }
    .dkt-grid-2 { grid-template-columns: 1fr; }
    .dkt-table th, .dkt-table td { padding: 10px 12px; }
}
