/* ==========================================
   CTRA ERP — Application Styles
   Aligned with login.css + dashboard.css
========================================== */

:root {
    --primary: #2F80ED;
    --primary-light: #58A6FF;
    --primary-hover: #1C6FE5;
    --success: #27AE60;
    --warning: #F2C94C;
    --danger: #EB5757;
    --background: #08111F;
    --background2: #101C2F;
    --background3: #17263D;
    --card: rgba(20, 30, 48, .88);
    --border: rgba(255, 255, 255, .08);
    --text: #F5F7FA;
    --text-light: #A7B4C7;
    --radius: 22px;
    --transition: .3s ease;
    --shadow: 0 30px 80px rgba(0, 0, 0, .45);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background:
        radial-gradient(circle at top right, #1A4D91 0%, transparent 30%),
        radial-gradient(circle at bottom left, #10203D 0%, transparent 40%),
        var(--background);
    color: var(--text);
    min-height: 100vh;
}

/* ===========================
   LOGIN
=========================== */

#loginPage {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 30px;
}

.lbox {
    width: 430px;
    max-width: 100%;
    background: rgba(24, 35, 54, .92);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    border-radius: 28px;
    padding: 45px;
    box-shadow: var(--shadow);
}

.llogo {
    text-align: center;
    margin-bottom: 40px;
}

td code { color: var(--primary-light); font-weight: 600; }

.llogo h1 {
    font-size: 32px;
    font-weight: 800;
    margin-bottom: 8px;
}

.llogo p {
    color: var(--text-light);
    font-size: 15px;
    letter-spacing: .5px;
}

.fg {
    margin-bottom: 24px;
}

.fg label {
    display: block;
    margin-bottom: 10px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-light);
}

.fg .input {
    display: flex;
    align-items: center;
    background: var(--background2);
    border: 1px solid #2A3A56;
    border-radius: 14px;
    transition: .25s;
    overflow: hidden;
}

.fg .input:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(47, 128, 237, .18);
}

.fg .input i {
    width: 55px;
    text-align: center;
    color: var(--text-light);
    font-size: 17px;
}

.fg .input input {
    flex: 1;
    border: none;
    outline: none;
    background: none;
    color: white;
    font-size: 15px;
    padding: 16px 18px 16px 0;
    font-family: inherit;
}

.fg .input input::placeholder {
    color: #6E7D92;
}

.fg input:not(.fg .input input),
.fg select,
.fg textarea {
    width: 100%;
    background: var(--background3);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 12px 16px;
    color: var(--text);
    font-size: 14px;
    font-family: inherit;
    transition: .25s;
}

.fg input:focus,
.fg select:focus,
.fg textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(47, 128, 237, .15);
}

.fg textarea {
    resize: vertical;
    min-height: 80px;
}

#loginHint {
    margin-top: 35px;
    text-align: center;
    color: var(--text-light);
    font-size: 13px;
    opacity: .75;
}

/* ===========================
   BUTTONS
=========================== */

.btn {
    padding: 12px 22px;
    border: none;
    border-radius: 14px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 700;
    transition: .25s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-family: inherit;
}

.btn-pr {
    background: var(--primary);
    color: #fff;
}

.btn-pr:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 12px 25px rgba(47, 128, 237, .35);
}

.btn-suc {
    background: var(--success);
    color: #fff;
}

.btn-suc:hover {
    background: #2ecc71;
    transform: translateY(-2px);
}

.btn-dan {
    background: var(--danger);
    color: #fff;
}

.btn-dan:hover {
    opacity: .9;
    transform: translateY(-1px);
}

.btn-warn {
    background: var(--warning);
    color: #1a1a1a;
}

.btn-out {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-light);
}

.btn-out:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.btn-sm {
    padding: 10px 16px;
    font-size: 13px;
    border-radius: 12px;
}

.btn-full {
    width: 100%;
}

.login-btn {
    margin-top: 10px;
    padding: 17px;
    font-size: 16px;
}

/* ===========================
   APP LAYOUT
=========================== */

#app {
    display: none;
    min-height: 100vh;
    gap: 0;
}

#app.active-layout {
    display: flex;
}

#sb {
    width: 280px;
    margin: 20px 0 20px 20px;
    border-radius: 30px;
    background: var(--card);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, .07);
    display: flex;
    flex-direction: column;
    padding: 25px;
    flex-shrink: 0;
    overflow-y: auto;
    transition: var(--transition);
}

.sb-logo {
    text-align: center;
    padding-bottom: 28px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 28px;
}

.sb-logo .brand-title {
    font-size: 24px;
    font-weight: 800;
    line-height: 1.2;
}

.sb-logo .brand-sub {
    color: var(--text-light);
    font-size: 14px;
    margin-top: 6px;
}

.sb-sec {
    margin-bottom: 8px;
}

.sb-ttl {
    padding: 10px 6px 8px;
    font-size: 11px;
    font-weight: 700;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 1.4px;
    opacity: .85;
}

.sb-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 15px 18px;
    border-radius: 16px;
    cursor: pointer;
    color: var(--text-light);
    font-size: 14px;
    font-weight: 600;
    transition: .25s;
    user-select: none;
    margin-bottom: 4px;
}

.sb-item i {
    width: 22px;
    text-align: center;
    font-size: 17px;
}

.sb-item:hover {
    background: rgba(47, 128, 237, .15);
    color: white;
}

.sb-item.active {
    background: linear-gradient(135deg, #2F80ED, #58A6FF);
    color: white;
    box-shadow: 0 10px 25px rgba(47, 128, 237, .35);
}

.sb-badge {
    margin-left: auto;
    background: var(--danger);
    color: #fff;
    border-radius: 20px;
    padding: 2px 8px;
    font-size: 11px;
    font-weight: 700;
    min-width: 20px;
    text-align: center;
}

.sb-footer {
    margin-top: auto;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

.user-box {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px;
    background: rgba(255, 255, 255, .05);
    border-radius: 18px;
    margin-bottom: 16px;
}

.avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, #2F80ED, #58A6FF);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 18px;
    flex-shrink: 0;
}

.user-box h4 {
    font-size: 15px;
    font-weight: 700;
}

.user-box p {
    font-size: 12px;
    color: var(--text-light);
    margin-top: 3px;
}

.logout-btn {
    width: 100%;
    border: none;
    padding: 14px;
    border-radius: 15px;
    background: #E74C3C;
    color: white;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-family: inherit;
    font-size: 14px;
}

.logout-btn:hover {
    transform: translateY(-2px);
    background: #D63031;
}

#main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    padding: 20px 20px 20px 10px;
    overflow: visible;
}

#tb {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 22px 30px;
    background: rgba(20, 30, 48, .75);
    backdrop-filter: blur(20px);
    border-radius: var(--radius);
    margin-bottom: 28px;
    border: 1px solid var(--border);
    gap: 20px;
    flex-shrink: 0;
    flex-wrap: wrap;
    position: relative;
    z-index: 200;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 16px;
    flex: 1;
    min-width: 200px;
}

.menu-toggle {
    width: 48px;
    height: 48px;
    border: none;
    border-radius: 14px;
    background: rgba(255, 255, 255, .06);
    color: white;
    cursor: pointer;
    transition: .25s;
    display: none;
}

.menu-toggle:hover {
    background: var(--primary);
}

#tbTitle {
    font-size: 28px;
    font-weight: 800;
    line-height: 1.2;
}

#tbSubtitle {
    color: #A5B3C7;
    margin-top: 5px;
    font-size: 14px;
}

.topbar-center {
    flex: 1;
    display: flex;
    justify-content: center;
    min-width: 200px;
}

.search-box {
    display: flex;
    align-items: center;
    background: var(--background3);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 0 18px;
    height: 50px;
    width: 100%;
    max-width: 380px;
}

.search-box i {
    color: #9AA7BC;
}

.tb-search {
    flex: 1;
    border: none;
    background: none;
    color: white;
    margin-left: 12px;
    outline: none;
    font-size: 15px;
    font-family: inherit;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.sel {
    background: var(--background3);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 12px 14px;
    color: var(--text);
    font-size: 14px;
    font-family: inherit;
    cursor: pointer;
    transition: .25s;
}

.sel:focus {
    outline: none;
    border-color: var(--primary);
}

#content {
    flex: 1;
    overflow-y: auto;
    padding-right: 6px;
    position: relative;
    z-index: 1;
}

.view {
    display: none;
    animation: fadeIn .35s ease;
}

.view.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ===========================
   SECTION HEADERS
=========================== */

.sh {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.sh h2 {
    font-size: 22px;
    font-weight: 800;
}

.sh h2 i {
    margin-right: 4px;
}

.sh .acts {
    margin-left: auto;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* ===========================
   GRID & CARDS
=========================== */

.grid {
    display: grid;
    gap: 22px;
}

.g2 { grid-template-columns: repeat(2, 1fr); }
.g3 { grid-template-columns: repeat(3, 1fr); }
.g4 { grid-template-columns: repeat(4, 1fr); }
.gc2 { grid-column: span 2; }
.gc3 { grid-column: span 3; }
.gc4 { grid-column: span 4; }

.card {
    background: var(--card);
    border: 1px solid rgba(255, 255, 255, .06);
    backdrop-filter: blur(15px);
    border-radius: var(--radius);
    padding: 26px;
    transition: var(--transition);
}

.card:hover {
    border-color: rgba(47, 128, 237, .35);
}

/* KPI cards in dashboard grids */
.g4 > .card {
    position: relative;
    overflow: hidden;
    min-height: 130px;
}

.g4 > .card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, #2F80ED, #58A6FF);
}

.g4 > .card:hover {
    transform: translateY(-6px);
    box-shadow: 0 15px 35px rgba(0, 0, 0, .25);
}

.card-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-light);
    margin-bottom: 14px;
    text-transform: uppercase;
    letter-spacing: .6px;
}

.kpi-val {
    font-size: 2.2rem;
    font-weight: 800;
    line-height: 1.1;
    margin-bottom: 8px;
}

.kpi-val.blue { color: var(--primary-light); }
.kpi-val.green { color: var(--success); }
.kpi-val.yellow { color: var(--warning); }
.kpi-val.red { color: var(--danger); }

.kpi-sub {
    font-size: 13px;
    color: var(--text-light);
}

.kpi-sub .up { color: #57D38C; font-weight: 700; }
.kpi-sub .down { color: var(--danger); font-weight: 700; }

body.read-only .acts .btn-suc,
body.read-only .acts .btn-dan { display: none !important; }

/* Chart cards */
.g2 .card,
.g3 .card {
    min-height: 340px;
    display: flex;
    flex-direction: column;
}

.chart-wrap {
    position: relative;
    flex: 1;
    min-height: 220px;
    margin-top: 8px;
}

.chart-wrap.tall {
    min-height: 260px;
}

/* Table panels */
.view > .card,
.view .card:has(table) {
    padding: 28px;
}

.tbl-top {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 18px;
    flex-wrap: wrap;
}

.tbl-top h3 {
    font-size: 18px;
    font-weight: 700;
    flex: 1;
}

.tbl-top .tb-search {
    background: var(--background3);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 12px 16px;
    color: var(--text);
    font-family: inherit;
}

/* ===========================
   TABLES
=========================== */

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

th {
    padding: 14px 16px;
    text-align: left;
    color: var(--text-light);
    font-weight: 700;
    font-size: 12px;
    border-bottom: 1px solid var(--border);
    background: rgba(23, 38, 61, .6);
    text-transform: uppercase;
    letter-spacing: .5px;
    white-space: nowrap;
}

td {
    padding: 16px;
    border-bottom: 1px solid rgba(255, 255, 255, .05);
    vertical-align: middle;
}

tr:last-child td {
    border-bottom: none;
}

tbody tr {
    transition: .2s;
}

tbody tr:hover td {
    background: rgba(47, 128, 237, .06);
}

td code {
    color: var(--primary-light);
    font-weight: 600;
}

/* ===========================
   STATUS BADGES
=========================== */

.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 6px 14px;
    border-radius: 50px;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}

.status-badge.actif,
.status-badge.accepté,
.status-badge.livrée,
.status-badge.confirmée {
    background: #1E5631;
    color: #8EF0B2;
}

.status-badge.prospect,
.status-badge.brouillon,
.status-badge.livraison {
    background: rgba(47, 128, 237, .2);
    color: #8EC5FF;
}

.status-badge.inactif,
.status-badge.refusé,
.status-badge.annulée {
    background: #5A2323;
    color: #FFB4B4;
}

.status-badge.envoyé,
.status-badge.en_production {
    background: #6A5516;
    color: #FFD666;
}

.status-badge.expiré {
    background: rgba(139, 148, 158, .2);
    color: var(--text-light);
}

.role-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.role-badge.admin {
    background: rgba(235, 87, 87, .15);
    color: #FF8A8A;
}

.role-badge.manager {
    background: rgba(242, 201, 76, .15);
    color: #FFD666;
}

.role-badge.utilisateur {
    background: rgba(47, 128, 237, .15);
    color: #8EC5FF;
}

.role-badge.lecture {
    background: rgba(167, 180, 199, .15);
    color: var(--text-light);
}

.pill {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    background: rgba(47, 128, 237, .2);
    color: var(--primary-light);
    margin-left: 6px;
}

/* ===========================
   ALERTS
=========================== */

.alert-item {
    background: rgba(20, 30, 48, .9);
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 20px 22px;
    display: flex;
    gap: 16px;
    align-items: flex-start;
    border-left: 4px solid;
    margin-bottom: 14px;
    transition: .25s;
}

.alert-item:hover {
    transform: translateX(4px);
    border-color: rgba(47, 128, 237, .3);
}

.alert-item.warn { border-left-color: var(--warning); }
.alert-item.danger { border-left-color: var(--danger); }
.alert-item.info { border-left-color: var(--primary); }

.alert-icon { font-size: 22px; padding-top: 2px; }
.alert-icon.warn { color: var(--warning); }
.alert-icon.danger { color: var(--danger); }
.alert-icon.info { color: var(--primary-light); }

.alert-body h4 {
    font-size: 15px;
    font-weight: 700;
    margin-bottom: 5px;
}

.alert-body p {
    font-size: 13px;
    color: var(--text-light);
    line-height: 1.5;
}

/* ===========================
   MODALS
=========================== */

.mov {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .75);
    backdrop-filter: blur(6px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.mov.open {
    display: flex;
}

.modal {
    background: rgba(20, 30, 48, .98);
    border: 1px solid var(--border);
    border-radius: 24px;
    padding: 30px;
    width: 680px;
    max-width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow);
}

.modal h3 {
    font-size: 20px;
    font-weight: 800;
    margin-bottom: 22px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 14px;
}

.form-row.full {
    grid-template-columns: 1fr;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 22px;
    padding-top: 18px;
    border-top: 1px solid var(--border);
}

/* ===========================
   PROGRESS
=========================== */

.prog {
    height: 8px;
    background: var(--background3);
    border-radius: 6px;
    overflow: hidden;
    margin-top: 6px;
}

.prog-fill {
    height: 100%;
    border-radius: 6px;
    background: var(--primary);
    transition: width .4s ease;
}

.prog-fill.green { background: var(--success); }
.prog-fill.red { background: var(--danger); }
.prog-fill.yellow { background: var(--warning); }

/* ===========================
   MISC
=========================== */

.action-btns {
    display: flex;
    gap: 6px;
}

.empty-state {
    text-align: center;
    padding: 50px;
    color: var(--text-light);
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 14px;
    display: block;
}

.toast {
    position: fixed;
    bottom: 28px;
    right: 28px;
    padding: 14px 24px;
    border-radius: 14px;
    font-size: 14px;
    font-weight: 600;
    z-index: 9999;
    display: none;
    animation: toastIn .3s ease;
    box-shadow: 0 8px 30px rgba(0, 0, 0, .4);
}

.toast.success { background: var(--success); color: #fff; }
.toast.error { background: var(--danger); color: #fff; }
.toast.info { background: var(--primary); color: #fff; }

@keyframes toastIn {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, .12);
    border-radius: 6px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(47, 128, 237, .4);
}

/* ===========================
   RESPONSIVE
=========================== */

@media (max-width: 1200px) {
    .g4 { grid-template-columns: repeat(2, 1fr); }
    .g3 { grid-template-columns: 1fr; }
    .g2 { grid-template-columns: 1fr; }
    .gc2, .gc3, .gc4 { grid-column: span 1; }
}

@media (max-width: 900px) {
    #app {
        flex-direction: column;
    }

    #sb {
        width: calc(100% - 40px);
        margin: 20px;
        max-height: none;
    }

    #sb.collapsed {
        display: none;
    }

    #main {
        padding: 0 20px 20px;
    }

    .menu-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .topbar-center {
        order: 3;
        width: 100%;
    }

    .search-box {
        max-width: none;
    }

    #tb {
        padding: 18px;
    }

    #tbTitle {
        font-size: 22px;
    }
}

@media (max-width: 600px) {
    .g4 { grid-template-columns: 1fr; }
    .form-row { grid-template-columns: 1fr; }
    .lbox { padding: 35px 25px; }
    .topbar-right { width: 100%; }
    .topbar-right .btn { flex: 1; }
}

/* ==========================================
   ENHANCED UI v3
========================================== */

:root {
    --space-sm: 10px;
    --space-md: 18px;
    --space-lg: 28px;
    --glow-blue: 0 12px 40px rgba(47, 128, 237, .22);
    --glow-green: 0 12px 40px rgba(39, 174, 96, .18);
}

.mb { margin-bottom: var(--space-md); }

.logo-wrap {
    margin-bottom: 18px;
}

.logo-wrap img {
    height: 80px;
    display: block;
    margin: 0 auto;
    filter: drop-shadow(0 8px 20px rgba(0, 0, 0, .35));
}

.logo-wrap.sm { margin-bottom: 12px; }
.logo-wrap.sm img { height: 58px; }

.sb-logo .logo-wrap { margin-bottom: 14px; }

.login-tag {
    display: inline-block;
    margin-top: 12px;
    padding: 6px 14px;
    border-radius: 50px;
    background: rgba(47, 128, 237, .15);
    color: var(--primary-light);
    font-size: 12px;
    font-weight: 700;
}

.remember-me {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-light);
    margin: -8px 0 16px;
    cursor: pointer;
}

.sb-item.active {
    position: relative;
    background: linear-gradient(135deg, rgba(47, 128, 237, .35), rgba(88, 166, 255, .2));
    color: #fff;
    box-shadow: var(--glow-blue);
}

.sb-item.active::before {
    content: "";
    position: absolute;
    left: 0;
    top: 12px;
    bottom: 12px;
    width: 4px;
    border-radius: 4px;
    background: #fff;
}

.sb-badge {
    animation: badgePop .4s ease;
}

.sb-badge.pulse { animation: badgePulse 2s infinite; }

@keyframes badgePop {
    0% { transform: scale(.5); }
    70% { transform: scale(1.15); }
    100% { transform: scale(1); }
}

@keyframes badgePulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(235, 87, 87, .5); }
    50% { box-shadow: 0 0 0 8px rgba(235, 87, 87, 0); }
}

/* KPI cards */
.kpi-card {
    display: flex;
    gap: 16px;
    align-items: flex-start;
    background: var(--card);
    border: 1px solid rgba(255, 255, 255, .07);
    border-radius: var(--radius);
    padding: 22px;
    transition: .3s;
    position: relative;
    overflow: hidden;
}

.kpi-card::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,.04), transparent 60%);
    pointer-events: none;
}

.kpi-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 18px 45px rgba(0, 0, 0, .28);
}

.kpi-card.accent-blue { border-top: 3px solid var(--primary); }
.kpi-card.accent-green { border-top: 3px solid var(--success); }
.kpi-card.accent-yellow { border-top: 3px solid var(--warning); }
.kpi-card.accent-red { border-top: 3px solid var(--danger); }

.kpi-icon {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
    background: rgba(47, 128, 237, .15);
    color: var(--primary-light);
}

.accent-green .kpi-icon { background: rgba(39, 174, 96, .15); color: #57D38C; }
.accent-yellow .kpi-icon { background: rgba(242, 201, 76, .15); color: #FFD666; }
.accent-red .kpi-icon { background: rgba(235, 87, 87, .15); color: #FF9B9B; }

.kpi-body { flex: 1; min-width: 0; }
.kpi-card .kpi-val { font-size: 1.85rem; }

.hero-chart {
    border: 1px solid rgba(47, 128, 237, .2);
    box-shadow: var(--glow-blue);
}

.chart-wrap.hero { min-height: 300px; }

/* Insight strip */
.insight-strip {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    padding: 14px 18px;
    margin-bottom: var(--space-md);
    border-radius: 18px;
    background: linear-gradient(135deg, rgba(47, 128, 237, .12), rgba(39, 174, 96, .08));
    border: 1px solid rgba(47, 128, 237, .2);
    font-size: 14px;
    color: var(--text-light);
    animation: fadeIn .4s ease;
}

.insight-strip.insight-alert {
    background: linear-gradient(135deg, rgba(235, 87, 87, .12), rgba(242, 201, 76, .08));
    border-color: rgba(235, 87, 87, .25);
}

.insight-strip .insight-emoji { font-size: 20px; }
.insight-strip strong { color: var(--text); }

.insight-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 50px;
    background: rgba(255, 255, 255, .06);
    border: 1px solid rgba(255, 255, 255, .08);
    cursor: pointer;
    transition: .2s;
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
}

.insight-chip:hover {
    background: rgba(47, 128, 237, .2);
    border-color: var(--primary);
    transform: translateY(-1px);
}

.insight-chip.warn { border-color: rgba(242, 201, 76, .4); }
.insight-chip.danger { border-color: rgba(235, 87, 87, .4); }

/* Page bar & breadcrumb */
.page-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: var(--space-md);
    flex-wrap: wrap;
}

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    color: var(--text-light);
}

.breadcrumb span:first-child {
    cursor: pointer;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    background: rgba(255, 255, 255, .05);
    transition: .2s;
}

.breadcrumb span:first-child:hover { background: rgba(47, 128, 237, .2); color: #fff; }
.breadcrumb .fa-chevron-right { font-size: 10px; opacity: .5; }
.breadcrumb span:last-child { font-weight: 700; color: var(--text); }

/* Tables */
.table-card { padding: 0; overflow: hidden; }
.table-card .tbl-top { padding: 20px 22px 0; }
.table-scroll { overflow-x: auto; max-height: 520px; overflow-y: auto; }

.data-table thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    backdrop-filter: blur(8px);
}

.data-table tbody tr {
    cursor: pointer;
}

.data-table tbody tr.row-actions td:last-child {
    cursor: default;
}

.tbl-filter {
    min-width: 200px;
    background: var(--background3);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 12px 16px;
    color: var(--text);
    font-family: inherit;
}

.workflow-btns {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}

.btn-ghost {
    padding: 6px 10px;
    border: none;
    border-radius: 10px;
    background: rgba(47, 128, 237, .12);
    color: var(--primary-light);
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    transition: .2s;
    font-family: inherit;
}

.btn-ghost:hover { background: rgba(47, 128, 237, .25); transform: scale(1.05); }

/* Search dropdown */
.search-wrap {
    position: relative;
    width: 100%;
    max-width: 380px;
    z-index: 210;
}

.search-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: rgba(20, 30, 48, .98);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: 0 24px 80px rgba(0, 0, 0, .55), var(--shadow);
    max-height: 320px;
    overflow-y: auto;
    z-index: 10050;
    animation: dropIn .25s ease;
}

.search-dropdown.open { display: block; }

.search-hit {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    cursor: pointer;
    transition: .15s;
    border-bottom: 1px solid rgba(255, 255, 255, .04);
}

.search-hit:hover { background: rgba(47, 128, 237, .12); }
.search-hit-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(47, 128, 237, .15);
    color: var(--primary-light);
    font-size: 14px;
}

.search-hit small { display: block; color: var(--text-light); font-size: 11px; margin-top: 2px; }

@keyframes dropIn {
    from { opacity: 0; transform: translateY(-6px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Notifications */
.notif-wrap {
    position: relative;
    z-index: 210;
}

.notif-btn {
    position: relative;
    width: 50px;
    height: 50px;
    border: none;
    border-radius: 16px;
    background: rgba(255, 255, 255, .06);
    color: #fff;
    cursor: pointer;
    font-size: 18px;
    transition: .25s;
}

.notif-btn:hover {
    background: rgba(47, 128, 237, .25);
    transform: scale(1.05);
}

.notif-btn.has-alerts i { animation: bellWiggle 1s ease infinite; }

@keyframes bellWiggle {
    0%, 100% { transform: rotate(0); }
    15% { transform: rotate(12deg); }
    30% { transform: rotate(-10deg); }
    45% { transform: rotate(8deg); }
    60% { transform: rotate(-6deg); }
}

.notif-count {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 50px;
    background: linear-gradient(135deg, #EB5757, #FF8A8A);
    color: #fff;
    font-size: 11px;
    font-weight: 800;
    display: none;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(235, 87, 87, .5);
    animation: badgePop .4s ease;
}

.notif-count.show { display: flex; }
.notif-count.bounce { animation: countBounce .6s ease; }

@keyframes countBounce {
    0%, 100% { transform: scale(1); }
    40% { transform: scale(1.3); }
}

.notif-ring {
    position: absolute;
    inset: -2px;
    border-radius: 18px;
    border: 2px solid transparent;
    pointer-events: none;
}

.notif-ring.active {
    border-color: rgba(235, 87, 87, .6);
    animation: ringPulse 2s infinite;
}

@keyframes ringPulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0; transform: scale(1.15); }
}

.notif-panel {
    display: none;
    position: absolute;
    top: calc(100% + 12px);
    right: 0;
    width: 360px;
    max-width: 90vw;
    background: rgba(20, 30, 48, .98);
    border: 1px solid var(--border);
    border-radius: 22px;
    box-shadow: 0 24px 80px rgba(0, 0, 0, .55), var(--shadow);
    z-index: 10050;
    overflow: hidden;
    animation: dropIn .3s ease;
}

.notif-panel.open { display: block; }

.notif-panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px;
    border-bottom: 1px solid var(--border);
    background: linear-gradient(135deg, rgba(47, 128, 237, .1), transparent);
}

.notif-panel-head h3 {
    font-size: 16px;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 8px;
}

.notif-panel-head h3 i { color: var(--warning); }

.notif-mark {
    border: none;
    background: none;
    color: var(--primary-light);
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    padding: 6px 10px;
    border-radius: 8px;
    transition: .2s;
    font-family: inherit;
}

.notif-mark:hover { background: rgba(47, 128, 237, .15); }

.notif-list { max-height: 340px; overflow-y: auto; padding: 8px; }

.notif-item {
    display: flex;
    gap: 12px;
    padding: 14px;
    border-radius: 14px;
    margin-bottom: 6px;
    cursor: pointer;
    transition: .2s;
    border: 1px solid transparent;
    position: relative;
}

.notif-item:hover {
    background: rgba(255, 255, 255, .04);
    border-color: rgba(47, 128, 237, .2);
    transform: translateX(3px);
}

.notif-item.unread { background: rgba(47, 128, 237, .08); }
.notif-item.unread::after {
    content: "";
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--primary);
}

.notif-item-emoji {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}

.notif-item-emoji.warn { background: rgba(242, 201, 76, .15); }
.notif-item-emoji.danger { background: rgba(235, 87, 87, .15); }
.notif-item-emoji.info { background: rgba(47, 128, 237, .15); }

.notif-item-body h4 { font-size: 13px; font-weight: 700; margin-bottom: 4px; }
.notif-item-body p { font-size: 12px; color: var(--text-light); line-height: 1.4; }

.notif-empty {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-light);
}

.notif-empty .emoji { font-size: 40px; margin-bottom: 10px; }

.notif-panel-foot { padding: 12px 16px 16px; border-top: 1px solid var(--border); }

.tb-dash-tools { display: flex; align-items: center; gap: 12px; }

/* Status badges with dot */
.status-badge::before {
    content: "";
    width: 7px;
    height: 7px;
    border-radius: 50%;
    margin-right: 7px;
    background: currentColor;
    opacity: .85;
}

/* Toasts */
.toast-stack {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    border-radius: 16px;
    font-size: 14px;
    font-weight: 600;
    box-shadow: 0 12px 40px rgba(0, 0, 0, .35);
    pointer-events: auto;
    animation: toastSlide .35s cubic-bezier(.34, 1.56, .64, 1);
    max-width: 380px;
    border: 1px solid rgba(255, 255, 255, .1);
}

.toast i { font-size: 18px; flex-shrink: 0; }

@keyframes toastSlide {
    from { opacity: 0; transform: translateX(40px) scale(.9); }
    to { opacity: 1; transform: translateX(0) scale(1); }
}

.toast.success { background: linear-gradient(135deg, #1E7A45, #27AE60); color: #fff; }
.toast.error { background: linear-gradient(135deg, #C0392B, #EB5757); color: #fff; }
.toast.info { background: linear-gradient(135deg, #1C5FBD, #2F80ED); color: #fff; }
.toast.warn { background: linear-gradient(135deg, #B8860B, #F2C94C); color: #1a1a1a; }

/* Alert items enhanced */
.alert-item {
    border-radius: 20px;
    cursor: pointer;
    align-items: center;
}

.alert-item .alert-emoji {
    width: 52px;
    height: 52px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    flex-shrink: 0;
}

.alert-item.warn .alert-emoji { background: rgba(242, 201, 76, .15); }
.alert-item.danger .alert-emoji { background: rgba(235, 87, 87, .15); }
.alert-item.info .alert-emoji { background: rgba(47, 128, 237, .15); }

.alert-action {
    margin-left: auto;
    padding: 8px 14px;
    border-radius: 12px;
    background: rgba(47, 128, 237, .15);
    color: var(--primary-light);
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
    transition: .2s;
}

.alert-item:hover .alert-action { background: var(--primary); color: #fff; }

.empty-slot:empty { display: none; }

.empty-state {
    padding: 48px 24px;
    border-radius: 18px;
    background: rgba(255, 255, 255, .02);
    margin: 16px 22px 22px;
}

.empty-state .empty-emoji { font-size: 48px; margin-bottom: 12px; }
.empty-state h4 { font-size: 16px; margin-bottom: 8px; }
.empty-state p { font-size: 13px; margin-bottom: 16px; }

/* Tour */
.tour-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .7);
    backdrop-filter: blur(6px);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.tour-overlay.open { display: flex; }

.tour-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 28px;
    padding: 40px;
    max-width: 420px;
    text-align: center;
    animation: fadeIn .4s ease;
    box-shadow: var(--shadow);
}

.tour-emoji { font-size: 56px; margin-bottom: 16px; }
.tour-card h3 { font-size: 22px; margin-bottom: 12px; }
.tour-card p { color: var(--text-light); margin-bottom: 24px; line-height: 1.6; }

/* Modal */
.mov.open .modal { animation: modalIn .3s ease; }

@keyframes modalIn {
    from { opacity: 0; transform: scale(.95) translateY(10px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-quick {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px dashed var(--border);
    text-align: center;
}

.form-section {
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: var(--primary-light);
    margin: 8px 0 12px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border);
}

.fg label .req { color: var(--danger); margin-left: 2px; }
.fg input.invalid, .fg select.invalid { border-color: var(--danger) !important; }
.field-error { font-size: 11px; color: var(--danger); margin-top: 4px; }
