:root {
    --brand-blue: #4357ff;
    --brand-blue-dark: #082653;
    --brand-cyan: #13a8f2;
    --brand-green: #23c773;
    --brand-red: #ff5c6c;
    --ink: #101828;
    --muted: #8a94a6;
    --line: rgba(148, 163, 184, 0.2);
    --surface: rgba(255, 255, 255, 0.92);
    --shadow-soft: 0 26px 70px rgba(28, 39, 88, 0.11);
    --shadow-hover: 0 32px 90px rgba(67, 87, 255, 0.16);
}

* {
    letter-spacing: 0;
}

body {
    background:
        linear-gradient(90deg, rgba(67, 87, 255, 0.035) 1px, transparent 1px),
        linear-gradient(180deg, rgba(67, 87, 255, 0.025) 1px, transparent 1px),
        #f5f7fb;
    background-size: 48px 48px;
    color: var(--ink);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.animated-grid {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.animated-grid::before {
    content: "";
    position: absolute;
    inset: -30% 0;
    background: linear-gradient(115deg, transparent 0%, rgba(67, 87, 255, 0.08) 48%, transparent 55%);
    animation: scan-line 12s linear infinite;
}

@keyframes scan-line {
    from { transform: translateX(-42%); }
    to { transform: translateX(42%); }
}

.app-shell {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: 292px minmax(0, 1fr);
    min-height: 100vh;
    gap: 28px;
    padding: 24px;
}

.soft-sidebar {
    position: sticky;
    top: 24px;
    height: calc(100vh - 48px);
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border: 1px solid rgba(255, 255, 255, 0.74);
    border-radius: 30px;
    box-shadow: var(--shadow-soft);
    overflow: hidden;
}

.brand-lockup {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 22px;
}

.brand-logo {
    width: 52px;
    height: 52px;
    border-radius: 16px;
    object-fit: cover;
    box-shadow: 0 18px 36px rgba(8, 38, 83, 0.18);
}

.brand-name {
    color: var(--ink);
    font-weight: 850;
    line-height: 1;
}

.brand-subtitle {
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    margin-top: 5px;
    text-transform: uppercase;
}

.nav-section {
    padding: 8px 18px 0;
}

.nav-label {
    display: block;
    padding: 14px 12px 8px;
    color: #a3adbd;
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
}

.nav-link {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 46px;
    padding: 12px 14px;
    margin-bottom: 7px;
    color: #667085;
    border-radius: 17px;
    font-size: 14px;
    font-weight: 750;
    transition: transform 180ms ease, color 180ms ease, background 180ms ease, box-shadow 180ms ease;
}

.nav-link:hover {
    color: var(--brand-blue);
    background: rgba(67, 87, 255, 0.07);
    transform: translateX(3px);
}

.nav-link.active {
    color: #fff;
    background: linear-gradient(135deg, #4558ff, #233bdc);
    box-shadow: 0 18px 34px rgba(67, 87, 255, 0.32);
}

.nav-link.active::after {
    content: "";
    position: absolute;
    right: 14px;
    width: 7px;
    height: 7px;
    border-radius: 999px;
    background: #fff;
    box-shadow: 0 0 0 7px rgba(255, 255, 255, 0.12);
}

.sidebar-upgrade {
    margin: auto 18px 18px;
    padding: 18px;
    border-radius: 24px;
    color: #fff;
    background: linear-gradient(145deg, #0b2a5b, #081a3a);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12), 0 20px 40px rgba(8, 38, 83, 0.2);
}

.main-panel {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.topbar {
    min-height: 74px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    background: rgba(255, 255, 255, 0.82);
    border: 1px solid rgba(255, 255, 255, 0.76);
    border-radius: 28px;
    box-shadow: var(--shadow-soft);
    padding: 14px 18px 14px 24px;
    backdrop-filter: blur(18px);
}

.page-title {
    color: var(--ink);
    font-size: 24px;
    font-weight: 850;
}

.page-kicker {
    color: var(--muted);
    font-size: 13px;
    margin-top: 3px;
}

.header-action {
    width: 42px;
    height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #667085;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 12px 26px rgba(28, 39, 88, 0.08);
}

.user-chip {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #fff;
    border-radius: 18px;
    padding: 8px 12px 8px 8px;
    box-shadow: 0 12px 26px rgba(28, 39, 88, 0.08);
}

.avatar {
    width: 38px;
    height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    background: linear-gradient(135deg, #4558ff, #13a8f2);
    border-radius: 14px;
    font-weight: 850;
}

.content-area {
    padding-bottom: 24px;
}

.soft-card,
.bg-white.rounded-xl {
    background: var(--surface) !important;
    border: 1px solid rgba(255, 255, 255, 0.8) !important;
    border-radius: 28px !important;
    box-shadow: var(--shadow-soft) !important;
}

.soft-card {
    position: relative;
    overflow: hidden;
    transition: transform 220ms ease, box-shadow 220ms ease;
}

.soft-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-hover);
}

.metric-card {
    min-height: 178px;
    padding: 24px;
}

.metric-icon {
    width: 46px;
    height: 46px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 16px;
    color: #fff;
    background: linear-gradient(135deg, #4558ff, #13a8f2);
    box-shadow: 0 16px 26px rgba(67, 87, 255, 0.25);
}

.metric-value {
    color: var(--ink);
    font-size: 30px;
    font-weight: 900;
    line-height: 1;
    margin-top: 22px;
}

.metric-label,
.muted-label {
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.trend-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    border-radius: 999px;
    padding: 5px 9px;
    font-size: 11px;
    font-weight: 850;
}

.trend-pill.positive {
    color: #07834a;
    background: rgba(35, 199, 115, 0.14);
}

.trend-pill.negative {
    color: #cf2336;
    background: rgba(255, 92, 108, 0.14);
}

.chart-bars {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 16px;
    align-items: end;
    height: 220px;
    padding-top: 16px;
}

.bar-stack {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.bar-track {
    position: relative;
    width: 100%;
    max-width: 38px;
    height: 170px;
    border-radius: 999px;
    background: #e9ecf4;
    overflow: hidden;
}

.bar-fill {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    min-height: 8px;
    border-radius: 999px;
    background: linear-gradient(180deg, #13a8f2, #4558ff);
    animation: grow-bar 900ms ease both;
}

@keyframes grow-bar {
    from { height: 0; }
}

.radial-card {
    display: grid;
    grid-template-columns: 150px minmax(0, 1fr);
    gap: 18px;
    align-items: center;
}

.radial-chart {
    width: 142px;
    height: 142px;
    transform: rotate(-90deg);
}

.radial-chart .track {
    fill: none;
    stroke: #e8ebf3;
    stroke-width: 13;
}

.radial-chart .progress {
    fill: none;
    stroke: url(#radialGradient);
    stroke-width: 13;
    stroke-linecap: round;
    stroke-dasharray: 320;
    animation: draw-ring 1100ms ease both;
}

@keyframes draw-ring {
    from { stroke-dashoffset: 320; }
}

.activity-row {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr) auto;
    gap: 14px;
    align-items: center;
    padding: 14px;
    border-radius: 18px;
    transition: background 160ms ease, transform 160ms ease;
}

.activity-row:hover {
    background: rgba(67, 87, 255, 0.06);
    transform: translateX(2px);
}

.status-pill {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 6px 10px;
    font-size: 11px;
    font-weight: 850;
    background: #eef1f8;
    color: #667085;
}

.status-pill.facture {
    background: rgba(67, 87, 255, 0.12);
    color: #3144e7;
}

.status-pill.devis {
    background: rgba(19, 168, 242, 0.13);
    color: #057eb8;
}

.quick-action {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px;
    border-radius: 22px;
    color: var(--ink);
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(148, 163, 184, 0.16);
    transition: transform 180ms ease, box-shadow 180ms ease;
}

.quick-action:hover {
    transform: translateY(-3px);
    box-shadow: 0 18px 40px rgba(28, 39, 88, 0.1);
}

.soft-button,
.bg-globalblue {
    background: linear-gradient(135deg, #4558ff, #233bdc) !important;
    box-shadow: 0 16px 32px rgba(67, 87, 255, 0.24) !important;
}

input,
select,
textarea {
    border-radius: 16px !important;
}

table {
    border-collapse: separate !important;
    border-spacing: 0;
}

.data-table th {
    color: #a3adbd;
    font-size: 11px;
    font-weight: 850;
    text-transform: uppercase;
}

.data-table td {
    border-top: 1px solid rgba(148, 163, 184, 0.14);
}

.login-shell {
    position: relative;
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
    overflow: hidden;
}

.login-shell::before {
    content: "";
    position: absolute;
    width: 140%;
    height: 140%;
    background:
        linear-gradient(120deg, transparent 0 40%, rgba(67, 87, 255, 0.09) 42%, transparent 48%),
        repeating-linear-gradient(90deg, rgba(67, 87, 255, 0.05) 0 1px, transparent 1px 58px);
    animation: scan-line 15s linear infinite;
}

.login-card {
    position: relative;
    z-index: 1;
    width: min(460px, 100%);
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.82);
    border-radius: 34px;
    box-shadow: var(--shadow-soft);
    padding: 34px;
    backdrop-filter: blur(18px);
}

@media (max-width: 980px) {
    .app-shell {
        grid-template-columns: 1fr;
        padding: 16px;
    }

    .soft-sidebar {
        position: relative;
        top: 0;
        height: auto;
    }

    .nav-section {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
    }

    .nav-label,
    .sidebar-upgrade {
        display: none;
    }

    .radial-card {
        grid-template-columns: 1fr;
    }
}
