* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Roboto', sans-serif;
    transition: all 0.3s ease;
}
html, body {
    width: 100%;
    height: 100%;
    overflow-x: hidden;
    background-color: var(--background-color);
    color: var(--text-color);
}
body {
    display: flex;
    flex-direction: row;
    font-size: 14px;
    line-height: 1.5;
}

:root {
    --primary-color: #ff6f61;
    --secondary-color: #28a745;
    --accent-color: #f7b733;
    --background-color: #f5f5f7;
    --panel-bg: #ffffff;
    --text-color: #111827;
    --panel-shadow: rgba(0,0,0,0.08);
    --sidebar-width: 260px;
    --transition-speed: 0.4s;
    --toast-bg: #ff6f61;
    --kpi-bg: linear-gradient(135deg, #ff6f61, #f7b733);
}
[data-theme="dark"] {
    --primary-color: #ff6f61;
    --secondary-color: #28a745;
    --accent-color: #f7b733;
    --background-color: #121212;
    --panel-bg: #1f1f1f;
    --text-color: #e5e7eb;
    --panel-shadow: rgba(0,0,0,0.4);
    --toast-bg: #ff6f61;
}

header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 70px;
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 25px;
    color: #fff;
    box-shadow: 0 6px 20px rgba(0,0,0,0.3);
    z-index: 1000;
    border-bottom-left-radius: 12px;
    border-bottom-right-radius: 12px;
}
header h1 {
    font-size: 1.6rem;
    font-weight: 700;
    letter-spacing: 1px;
    text-shadow: 0 1px 3px rgba(0,0,0,0.3);
}
header .controls {
    display: flex;
    align-items: center;
    gap: 18px;
}
header .controls button {
    background: rgba(255,255,255,0.2);
    border: none;
    border-radius: 8px;
    padding: 8px 12px;
    cursor: pointer;
    color: #fff;
    font-size: 1.3rem;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
    transition: all 0.3s ease;
}
header .controls button:hover {
    background: rgba(255,255,255,0.35);
    transform: scale(1.1);
}
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 54px;
    height: 28px;
}
.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}
.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: 0.4s;
    border-radius: 34px;
}

.kpi-card p {
    line-height: 1.00;
}


.slider:before {
    position: absolute;
    content: "";
    height: 24px;
    width: 24px;
    left: 2px;
    bottom: 2px;
    background-color: #fff;
    transition: 0.4s;
    border-radius: 50%;
}
input:checked + .slider {
    background-color: var(--secondary-color);
}
input:checked + .slider:before {
    transform: translateX(26px);
}

.sidebar {
    position: fixed;
    top: 70px;
    left: 0;
    width: var(--sidebar-width);
    height: 100%;
    max-width: 90vw;
    background-color: var(--panel-bg);
    box-shadow: 2px 0 25px var(--panel-shadow);
    padding: 25px 20px;
    overflow-y: auto;
    transition: transform var(--transition-speed) ease;
    border-top-right-radius: 12px;
}
.sidebar nav a {
    display: block;
    text-decoration: none;
    color: var(--text-color);
    font-weight: 500;
    margin: 12px 0;
    padding: 10px 15px;
    border-radius: 10px;
    transition: all 0.3s ease;
}
.sidebar nav a:hover {
    background: var(--primary-color);
    color: #fff;
    transform: scale(1.03);
}

.main {
    margin-left: var(--sidebar-width);
    padding: 90px 25px 25px 25px;
    flex: 1;
    min-width: calc(100% - var(--sidebar-width));
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem; /* safer spacing than grid-gap */
}
.kpi-card {
    background: var(--kpi-bg);
    color: #fff;
    font-weight: 600;
    text-align: center;
    box-shadow: 0 6px 20px var(--panel-shadow);
    border-radius: 14px;
    padding: 25px;
    transition: all 0.3s ease;
display: flex;
flex-direction: column;
height: auto;
min-height: 120px; /* optional, ensures cards aren't too short */

}
.kpi-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0,0,0,0.35);
}
.kpi-card h2 { font-size: 1rem; margin-bottom: 10px; }
.kpi-card p { font-size: 1.5rem; font-weight: 700; }

.panel {
    background-color: var(--panel-bg);
    border-radius: 14px;
    padding: 30px;                      /* increased for spacing */
    box-shadow: 0 6px 20px var(--panel-shadow);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    height: auto;
    min-height: 180px;
    transition: all 0.3s ease;
}

.panel:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
}

.panel h2 {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 18px;
    color: var(--text-color);
    word-wrap: break-word;
    white-space: normal;
}

.toast {
    position: fixed;
    bottom: 25px;
    right: 25px;
    background: var(--toast-bg);
    color: #fff;
    padding: 15px 25px;
    border-radius: 10px;
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.5s ease, transform 0.5s ease;
    z-index: 9999;
}
.toast.show {
    opacity: 1;
    transform: translateY(0);
}


#task-list {
    list-style: none;
    padding-left: 0;
}
#task-list li {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid rgba(0,0,0,0.05);
    font-weight: 500;
}
#task-list li button.task-complete {
    background: var(--secondary-color);
    color: #fff;
    border: none;
    padding: 5px 10px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
}
#task-list li button.task-complete:hover { transform: scale(1.1); }

.slide-panel {
    position: fixed;
    top: 70px;
    right: -380px;
    width: 90%
    max-width: 380px;
    height: 100%;
    background-color: var(--panel-bg);
    box-shadow: -5px 0 25px var(--panel-shadow);
    padding: 25px;
    transition: right 0.4s ease;
    border-top-left-radius: 12px;
    z-index: 1000;
    overflow-y: auto;
}
.slide-panel.show { right: 0; }
.slide-panel h2 { margin-bottom: 25px; font-size: 1.3rem; }

canvas.sparkline, canvas.gauge {
    width: 100% !important;
    height: auto !important;  /* allow responsive height */
    max-height: 150px;         /* optional */
    display: block;
}
canvas.gauge {
    max-height: 150px !important;
}


@media (max-width: 1024px) {
    .main { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
}
@media (max-width: 768px) {
    header .controls { gap: 12px; }
    .sidebar { transform: translateX(-100%); }
    .kpi-card, .panel {
    min-height: auto;   /* allow content to define height */
    height: auto;
    display: flex;
    flex-direction: column;
    justify-content: flex-start; /* text starts at top */
    padding: 25px; /* keep existing padding or increase if needed */
}

}

    .sidebar.show { transform: translateX(0); }
    .main { margin-left: 0; padding-top: 120px; }
}

.panel {
    opacity: 0;
    transform: translateY(20px);
    animation: panelFadeIn 0.8s forwards;
}
@keyframes panelFadeIn {
    to { opacity: 1; transform: translateY(0); }
}
/* Staggered delays */
.panel:nth-child(1) { animation-delay: 0.1s; }
.panel:nth-child(2) { animation-delay: 0.2s; }
.panel:nth-child(3) { animation-delay: 0.3s; }
.panel:nth-child(4) { animation-delay: 0.4s; }
.panel:nth-child(5) { animation-delay: 0.5s; }
.panel:nth-child(6) { animation-delay: 0.6s; }
.panel:nth-child(7) { animation-delay: 0.7s; }
.panel:nth-child(8) { animation-delay: 0.8s; }


@media (max-width: 768px) {

    body {
        font-size: 13px;
    }

    /* Header cleanup */
    header {
        height: 60px;
        padding: 0 14px;
    }

    header h1 {
        font-size: 1.1rem;
    }

    header .controls button {
        padding: 6px 8px;
        font-size: 1.1rem;
    }

    /* Main layout */
    .main {
        margin-left: 0;
        padding: 80px 14px 14px;
        grid-template-columns: 1fr;
        grid-gap: 16px;
    }

    /* KPI cards become compact cards */
    .kpi-card {
        padding: 14px;
        border-radius: 12px;
    }

    .kpi-card h2 {
        font-size: 0.85rem;
        margin-bottom: 6px;
    }

    .kpi-card p {
        font-size: 1.2rem;
    }

    /* Panels */
    .panel {
        padding: 16px;
        border-radius: 12px;
    }

    .panel h2 {
        font-size: 1rem;
        margin-bottom: 12px;
    }

    

    /* Sidebar */
    .sidebar {
        width: 240px;
    }
}

.sales-overview,
.user-activity {
  transform: translateY(-16px) !important;
}

