
* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: #f5f6f8;
    color: #20242c;
}

/* Sidebar */

.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 240px;
    height: 100vh;
    background: #171c27;
    color: #ffffff;
    padding: 28px 18px;
    display: flex;
    flex-direction: column;
}

.logo {
    font-size: 19px;
    font-weight: 700;
    padding: 0 10px;
    margin-bottom: 45px;
}

nav {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

nav a {
    color: #aeb5c3;
    text-decoration: none;
    padding: 12px 14px;
    border-radius: 8px;
    font-size: 14px;
    transition: background 0.2s, color 0.2s;
}

nav a:hover,
nav a.active {
    background: #293347;
    color: #ffffff;
}

.sidebar-footer {
    margin-top: auto;
    padding: 10px;
    color: #778195;
    font-size: 12px;
}

/* Main content */

.main-content {
    margin-left: 240px;
    padding: 42px 38px;
    min-height: 100vh;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 28px;
}

.eyebrow {
    color: #7c8493;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1.2px;
}

h1 {
    font-size: 30px;
    margin: 8px 0;
}

.subtitle {
    color: #7c8493;
    font-size: 14px;
}

/* Status */

.status {
    background: #ffffff;
    border: 1px solid #e7e9ed;
    padding: 10px 14px;
    border-radius: 20px;
    font-size: 12px;
    color: #596273;
}

.status-dot {
    display: inline-block;
    width: 7px;
    height: 7px;
    background: #28a879;
    border-radius: 50%;
    margin-right: 6px;
}

/* Date filters */

.filter-section {
    background: #ffffff;
    border: 1px solid #e9ebef;
    border-radius: 12px;
    padding: 18px 22px;
    margin-bottom: 22px;
}

.filter-form {
    display: flex;
    align-items: flex-end;
    gap: 14px;
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.filter-group label {
    font-size: 12px;
    color: #747d8c;
}

.filter-group input {
    padding: 10px 12px;
    border: 1px solid #dfe3e9;
    border-radius: 7px;
    font-family: inherit;
    font-size: 13px;
    color: #20242c;
    background: #ffffff;
}

.apply-button,
.reset-button {
    padding: 11px 17px;
    border-radius: 7px;
    font-size: 13px;
    cursor: pointer;
    text-decoration: none;
}

.apply-button {
    border: none;
    background: #293f60;
    color: #ffffff;
}

.apply-button:hover {
    background: #1e304b;
}

.reset-button {
    color: #596273;
    border: 1px solid #dfe3e9;
    background: #ffffff;
}

/* KPI cards */

.metrics-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 18px;
    margin-bottom: 22px;
}

.metric-card {
    background: #ffffff;
    border: 1px solid #e9ebef;
    border-radius: 12px;
    padding: 22px;
    transition: box-shadow 0.2s, transform 0.2s;
}

.metric-card:hover {
    box-shadow: 0 5px 18px rgba(0, 0, 0, 0.05);
    transform: translateY(-2px);
}

.metric-label {
    color: #747d8c;
    font-size: 13px;
    min-height: 36px;
    margin: 0;
}

.metric-value {
    font-size: 27px;
    font-weight: 700;
    margin: 16px 0 6px;
    overflow-wrap: anywhere;
}

.metric-detail {
    color: #7c8493;
    font-size: 12px;
    margin: 0;
}

/* Chart cards */

.chart-card {
    background: #ffffff;
    border: 1px solid #e9ebef;
    border-radius: 12px;
    padding: 22px;
    margin-bottom: 22px;
    min-width: 0;
    overflow: hidden;
}

.section-heading {
    margin-bottom: 12px;
}

.section-heading h2 {
    font-size: 18px;
    margin: 0 0 7px;
}

.section-heading p {
    color: #7c8493;
    font-size: 13px;
    margin: 0;
}

/* Chart heading and individual granularity buttons */

.chart-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
}

.chart-period-buttons {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 4px;
    background: #f1f3f7;
    border: 1px solid #e8ebf0;
    border-radius: 9px;
}

.chart-period-buttons a {
    display: inline-block;
    padding: 7px 16px;
    min-width: 58px;
    text-align: center;
    text-decoration: none;
    color: #7b8494;
    font-size: 12px;
    font-weight: 600;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.chart-period-buttons a:hover {
    color: #293f60;
    background: #e5eaf1;
}

.chart-period-buttons a.active {
    background: #ffffff;
    color: #293f60;
    box-shadow: 0 1px 4px rgba(25, 40, 65, 0.12);
}

/* Responsive layout */

@media (max-width: 1100px) {
    .metrics-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 650px) {
    .sidebar {
        position: static;
        width: 100%;
        height: auto;
    }

    .logo {
        margin-bottom: 20px;
    }

    .main-content {
        margin-left: 0;
        padding: 25px 18px;
    }

    .page-header {
        align-items: flex-start;
        gap: 15px;
        flex-direction: column;
    }

    .metrics-grid {
        grid-template-columns: 1fr;
    }

    .filter-form {
        align-items: stretch;
        flex-direction: column;
    }

    .filter-group input {
        width: 100%;
    }

    .chart-heading {
        align-items: flex-start;
        flex-direction: column;
    }
}

/* Select filters */

.filter-group select {
    min-width: 145px;
    max-width: 220px;
    padding: 10px 12px;
    border: 1px solid #dfe3e9;
    border-radius: 7px;
    background: #ffffff;
    color: #20242c;
    font-family: inherit;
    font-size: 13px;
}

/* Analytics table */

.table-wrapper {
    width: 100%;
    overflow-x: auto;
}

.analytics-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    white-space: nowrap;
}

.analytics-table th {
    padding: 14px 16px;
    text-align: left;
    color: #747d8c;
    font-weight: 600;
    background: #f7f8fa;
    border-bottom: 1px solid #e9ebef;
}

.analytics-table td {
    padding: 14px 16px;
    border-bottom: 1px solid #edf0f3;
}

.analytics-table tbody tr:hover {
    background: #f8f9fb;
}

.analytics-table tbody tr:last-child td {
    border-bottom: none;
}


/* Custom month picker */

.month-picker {
    position: relative;
    width: 180px;
}

.month-picker-trigger {
    width: 100%;
    height: 41px;
    padding: 0 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;

    background: #ffffff;
    border: 1px solid #dfe3e9;
    border-radius: 8px;

    color: #293140;
    font-family: inherit;
    font-size: 13px;
    text-align: left;
    cursor: pointer;

    transition: border-color 0.2s, box-shadow 0.2s;
}

.month-picker-trigger:hover {
    border-color: #aeb9c9;
}

.month-picker.open .month-picker-trigger {
    border-color: #3984c6;
    box-shadow: 0 0 0 3px rgba(57, 132, 198, 0.10);
}

.month-picker-icon {
    color: #7c8493;
    font-size: 18px;
    line-height: 1;
}

/* Popup */

.month-picker-popup {
    display: none;
    position: absolute;
    top: calc(100% + 9px);
    left: 0;
    width: 260px;
    padding: 15px;

    background: #ffffff;
    border: 1px solid #e8ebf0;
    border-radius: 12px;

    box-shadow: 0 12px 35px rgba(27, 39, 57, 0.14);

    z-index: 100;
}

.month-picker.open .month-picker-popup {
    display: block;
    animation: picker-appear 0.15s ease-out;
}

@keyframes picker-appear {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Year navigation */

.month-picker-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 15px;
    padding: 0 3px;
}

.picker-year {
    font-size: 15px;
    font-weight: 700;
    color: #293140;
}

.year-nav {
    width: 30px;
    height: 30px;

    border: none;
    border-radius: 7px;
    background: transparent;

    color: #697487;
    font-size: 23px;
    line-height: 1;
    cursor: pointer;

    transition: background 0.2s, color 0.2s;
}

.year-nav:hover {
    background: #f1f3f7;
    color: #293f60;
}

/* Month grid */

.month-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 7px;
}

.month-option {
    height: 39px;

    border: 1px solid transparent;
    border-radius: 7px;

    background: #f6f7f9;
    color: #596273;

    font-family: inherit;
    font-size: 12px;
    font-weight: 500;

    cursor: pointer;
    transition: all 0.15s;
}

.month-option:hover {
    background: #eaf0f7;
    color: #293f60;
    border-color: #dce5f0;
}

.month-option.selected {
    background: #293f60;
    color: #ffffff;
    border-color: #293f60;
    font-weight: 600;
}


/* Custom day / month / year date picker */
.date-picker { position: relative; width: 180px; }
.date-picker-trigger { width: 100%; height: 41px; padding: 0 12px; display: flex; align-items: center; justify-content: space-between; background: #fff; border: 1px solid #dfe3e9; border-radius: 8px; color: #293140; font-family: inherit; font-size: 13px; text-align: left; cursor: pointer; transition: border-color .2s, box-shadow .2s; }
.date-picker-trigger:hover { border-color: #aeb9c9; }
.date-picker.open .date-picker-trigger { border-color: #3984c6; box-shadow: 0 0 0 3px rgba(57,132,198,.10); }
.date-picker-icon { color: #7c8493; font-size: 18px; line-height: 1; }
.date-picker-popup { display: none; position: absolute; top: calc(100% + 9px); left: 0; width: 280px; padding: 15px; background: #fff; border: 1px solid #e8ebf0; border-radius: 12px; box-shadow: 0 12px 35px rgba(27,39,57,.14); z-index: 100; }
.date-picker.open .date-picker-popup { display: block; animation: picker-appear .15s ease-out; }
.date-picker-header { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.calendar-prev, .calendar-next { width: 30px; height: 30px; border: 0; border-radius: 7px; background: transparent; color: #697487; font-size: 23px; line-height: 1; cursor: pointer; }
.calendar-prev:hover, .calendar-next:hover { background: #f1f3f7; color: #293f60; }
.calendar-title { flex: 1; border: 0; background: transparent; color: #293140; font-family: inherit; font-size: 14px; font-weight: 700; cursor: pointer; padding: 6px; border-radius: 6px; }
.calendar-title:hover { background: #f1f3f7; }
.calendar-weekdays, .calendar-days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; text-align: center; }
.calendar-weekdays { margin-bottom: 6px; color: #8992a0; font-size: 11px; font-weight: 600; }
.calendar-weekdays span { padding: 5px 0; }
.calendar-day, .calendar-empty { width: 32px; height: 32px; }
.calendar-day { border: 1px solid transparent; border-radius: 7px; background: #f6f7f9; color: #596273; font-family: inherit; font-size: 12px; cursor: pointer; }
.calendar-day:hover, .calendar-month-option:hover { background: #eaf0f7; color: #293f60; border-color: #dce5f0; }
.calendar-day.selected, .calendar-month-option.selected { background: #293f60; color: #fff; border-color: #293f60; font-weight: 600; }
.calendar-month-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; }
.calendar-month-option { height: 39px; border: 1px solid transparent; border-radius: 7px; background: #f6f7f9; color: #596273; font-family: inherit; font-size: 12px; cursor: pointer; }
@media (max-width: 650px) { .date-picker { width: 100%; } .date-picker-popup { width: min(280px, calc(100vw - 60px)); } }


/* Acquisition page date inputs */
.filter-group input[type="date"] {
    min-width: 165px;
    height: 41px;
    padding: 9px 11px;
    border: 1px solid #dfe3e9;
    border-radius: 7px;
    background: #ffffff;
    color: #20242c;
    font-family: inherit;
    font-size: 13px;
}


/* Acquisition period comparison */
.period-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 12px;
    margin-bottom: 14px;
}
.period-card {
    border: 1px solid #e3e7ed;
    border-radius: 10px;
    padding: 14px;
    background: #fbfcfd;
}
.period-card-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    color: #293140;
    font-size: 13px;
}
.period-date-fields {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}
.period-date-fields .filter-group {
    flex: 1;
    min-width: 130px;
}
.period-date-fields input[type="date"] {
    width: 100%;
    min-width: 0;
    height: 40px;
}
.remove-period {
    border: 0;
    background: transparent;
    color: #a34b4b;
    font: inherit;
    font-size: 12px;
    cursor: pointer;
}
.remove-period:hover { text-decoration: underline; }
.comparison-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 12px;
}
.filter-divider {
    border-top: 1px solid #edf0f3;
    margin: 18px 0;
}
.source-filter select {
    min-width: 260px;
    max-width: 420px;
    min-height: 110px;
}
.filter-hint {
    color: #858d9b;
    font-size: 11px;
    margin-top: 3px;
}
.period-metrics {
    margin: 14px 0 0;
}
@media (max-width: 650px) {
    .period-list { grid-template-columns: 1fr; }
    .source-filter select { max-width: 100%; width: 100%; }
}
