:root {
    --cs-purple: #A424B7;
    --cs-navy: #1C3977;
    --cs-ink: #323234;
    --cs-bg: #f4f6fb;
    --cs-card: #ffffff;
    --cs-muted: #6b7280;
    --cs-border: #e5e7eb;
    --cs-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
    --cs-radius: 14px;
}

* {
    box-sizing: border-box;
}

body {
    font-family: 'Plus Jakarta Sans', 'Segoe UI', sans-serif;
    color: var(--cs-ink);
    background: var(--cs-bg);
    min-height: 100vh;
}

h1, h2, h3, h4, h5, h6,
.cs-topbar-title,
.cs-nav-link,
.cs-kpi-title,
.cs-kpi-value,
.cs-section-title {
    font-family: 'Montserrat', 'Segoe UI', sans-serif;
}

.cs-shell {
    display: flex;
    min-height: 100vh;
}

.cs-sidebar {
    width: 240px;
    background: var(--cs-navy);
    color: #fff;
    display: flex;
    flex-direction: column;
    padding: 20px 16px 24px;
    position: sticky;
    top: 0;
    height: 100vh;
    z-index: 1030;
}

.cs-sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 4px 8px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
    margin-bottom: 16px;
}

.cs-sidebar-brand img {
    width: 36px;
    height: 36px;
}

.cs-brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.1;
}

.cs-brand-text span:first-child {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    opacity: 0.8;
}

.cs-brand-text span:last-child {
    font-size: 18px;
    font-weight: 600;
}

.cs-nav {
    display: flex;
    flex-direction: column;
    gap: 8px;
    overflow-y: auto;
    padding-right: 4px;
}

.cs-nav a,
.cs-nav summary {
    color: #e5e7eb;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
}

.cs-nav a.active,
.cs-nav summary.active,
.cs-nav a:hover,
.cs-nav summary:hover {
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
}

.cs-nav details {
    border-radius: 10px;
}

.cs-nav details > summary {
    list-style: none;
}

.cs-progress {
    position: relative;
    width: 100%;
}

.cs-progress-marker {
    position: absolute;
    top: -2px;
    bottom: -2px;
    width: 2px;
    background: #111827;
    transform: translateX(-1px);
    z-index: 2;
}

.cs-live-badge {
    animation: cs-live-pulse 1.6s ease-in-out infinite;
}

@keyframes cs-live-pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(56, 189, 248, 0.5);
    }
    70% {
        box-shadow: 0 0 0 6px rgba(56, 189, 248, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(56, 189, 248, 0);
    }
}

.cs-nav details > summary::-webkit-details-marker {
    display: none;
}

.cs-nav details > summary::after {
    content: '\F282';
    font-family: 'bootstrap-icons';
    margin-left: auto;
    font-size: 12px;
    opacity: 0.7;
    transition: transform 0.2s ease;
}

.cs-nav details[open] > summary::after {
    transform: rotate(180deg);
}

.cs-nav details .cs-subnav {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 4px 0 8px 22px;
}

.cs-nav details .cs-subnav a {
    font-weight: 500;
    font-size: 13px;
    padding: 6px 10px;
    color: #d1d5db;
}

.cs-nav details .cs-subnav a.active,
.cs-nav details .cs-subnav a:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
}

.cs-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.cs-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 28px;
    background: #fff;
    border-bottom: 1px solid var(--cs-border);
    position: sticky;
    top: 0;
    z-index: 1020;
}

.cs-topbar-left {
    display: flex;
    align-items: center;
    gap: 14px;
}

.cs-nav-toggle {
    border: none;
    background: transparent;
    font-size: 22px;
    color: var(--cs-ink);
    display: none;
}

.cs-topbar-title {
    font-size: 20px;
    font-weight: 600;
}

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

.cs-topbar-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.cs-icon-btn {
    border: 1px solid var(--cs-border);
    background: #fff;
    border-radius: 10px;
    padding: 6px 8px;
    color: var(--cs-ink);
}

.cs-content {
    padding: 24px 28px 40px;
}

.cs-grid {
    display: grid;
    gap: 18px;
    grid-template-columns: repeat(12, 1fr);
}

.cs-card {
    background: var(--cs-card);
    border-radius: var(--cs-radius);
    box-shadow: var(--cs-shadow);
    padding: 18px;
    grid-column: span 4;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.cs-card--wide {
    grid-column: span 12;
}

.cs-card--tall {
    grid-column: span 6;
}

.cs-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.cs-card-header h3 {
    font-size: 16px;
    margin: 0 0 4px;
    font-weight: 600;
}

.cs-card-subtitle {
    margin: 0;
    color: var(--cs-muted);
    font-size: 12px;
}

.cs-card-chip {
    background: #f1f5f9;
    color: var(--cs-ink);
    border-radius: 999px;
    padding: 4px 10px;
    font-size: 11px;
    font-weight: 600;
}

.cs-chart-wrap {
    width: 100%;
    min-height: 200px;
}

.cs-chart-wrap--pie {
    max-height: 320px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cs-chart-wrap--pie canvas {
    max-height: 280px;
}

.cs-metric {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.cs-metric-value {
    font-size: 26px;
    font-weight: 700;
    color: var(--cs-navy);
}

.cs-metric-label {
    font-size: 12px;
    color: var(--cs-muted);
}

.cs-metric-delta {
    font-size: 12px;
    font-weight: 600;
    color: #16a34a;
}

.cs-metric-delta.cs-negative {
    color: #dc2626;
}

.cs-table {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.cs-form {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.cs-form-grid {
    display: grid;
    gap: 16px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.cs-form-wide {
    grid-column: span 2;
}

.cs-form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.cs-card--calendar {
    grid-column: span 9;
}

.cs-card--sidebar {
    grid-column: span 3;
    padding: 14px;
}

.cs-mkt-calendar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.cs-mkt-calendar-nav {
    display: flex;
    align-items: center;
    gap: 12px;
}

.cs-mkt-calendar-month {
    font-weight: 600;
    font-size: 16px;
}

.cs-mkt-calendar-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.cs-mkt-calendar-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 8px;
    font-size: 12px;
    color: var(--cs-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.cs-mkt-calendar-week {
    margin-top: 10px;
}

.cs-mkt-calendar-spans {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 6px;
}

.cs-mkt-calendar-days {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 8px;
}

.cs-mkt-calendar-day {
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    padding: 10px;
    min-height: 110px;
    background: #f8fafc;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.cs-mkt-calendar-day.is-outside {
    opacity: 0.4;
}

.cs-mkt-calendar-date {
    font-weight: 600;
    font-size: 12px;
    color: #1f2937;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.cs-mkt-calendar-events {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.cs-calendar-add {
    display: inline-flex;
    width: 18px;
    height: 18px;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    border: 1px solid #e2e8f0;
    color: #334155;
    background: #fff;
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    line-height: 1;
    opacity: 0;
    transition: opacity 0.15s ease;
}

.cs-mkt-calendar-day:hover .cs-calendar-add {
    opacity: 1;
}

.cs-mkt-calendar-empty {
    display: block;
    height: 10px;
}

.cs-event {
    border: none;
    border-radius: 10px;
    padding: 6px 8px;
    font-size: 11px;
    font-weight: 600;
    text-align: left;
    display: flex;
    flex-direction: column;
    gap: 2px;
    color: #1f2937;
}

.cs-event:focus {
    outline: 2px solid rgba(59, 130, 246, 0.4);
}

.cs-event--span {
    justify-content: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cs-event-meta {
    font-size: 10px;
    font-weight: 500;
    color: rgba(15, 23, 42, 0.7);
}

.cs-event--holiday-us {
    background: #e0f2fe;
    color: #0c4a6e;
}

.cs-event--holiday-gifting {
    background: #fef3c7;
    color: #92400e;
}

.cs-event--promotion {
    background: #ffedd5;
    color: #9a3412;
}

.cs-event--email-scheduled {
    background: #dcfce7;
    color: #166534;
}

.cs-event--email-planned {
    background: #ffe4e6;
    color: #9f1239;
}

.cs-event.is-hidden {
    display: none;
}

.cs-legend {
    display: grid;
    gap: 8px;
}

.cs-legend-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 12px;
    font-weight: 600;
}

.cs-legend-swatch {
    width: 12px;
    height: 12px;
    border-radius: 6px;
}

.cs-toggle-group {
    margin-top: 18px;
    display: grid;
    gap: 10px;
}

.cs-toggle-group h4 {
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--cs-muted);
    margin-bottom: 0;
}

.cs-toggle-row {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    font-size: 13px;
}

.cs-modal-subtitle {
    font-size: 12px;
    color: var(--cs-muted);
    margin: 0;
}

.cs-modal-section {
    margin-bottom: 14px;
    font-size: 13px;
}

.cs-planned-item {
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 10px;
    margin-top: 10px;
    background: #f8fafc;
}

.cs-planned-item strong {
    display: block;
    margin-bottom: 6px;
}

.cs-email-body {
    border-radius: 12px;
    background: #f8fafc;
    padding: 12px;
    border: 1px solid #e2e8f0;
    max-height: 260px;
    overflow: auto;
}

.cs-table-row {
    display: grid;
    grid-template-columns: 1.4fr 0.9fr 1fr 0.6fr;
    gap: 12px;
    font-size: 13px;
}

.cs-table-header {
    font-weight: 600;
    color: var(--cs-muted);
    border-bottom: 1px solid var(--cs-border);
    padding-bottom: 6px;
}

.cs-table-empty {
    color: var(--cs-muted);
    font-size: 13px;
    text-align: center;
    padding: 12px 0;
}

.cs-filter-select .form-select {
    min-width: 180px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 13px;
}

.card {
    border: none;
    border-radius: var(--cs-radius);
    box-shadow: var(--cs-shadow);
}

.cs-kpi-card {
    padding: 16px 18px;
    height: 100%;
}

.cs-kpi-title {
    font-size: 13px;
    font-weight: 600;
    text-transform: none;
    color: var(--cs-muted);
    margin-bottom: 6px;
}

.cs-kpi-value {
    font-size: 26px;
    font-weight: 700;
    color: var(--cs-purple);
    margin-bottom: 4px;
}

.cs-kpi-value.cs-kpi-value--dark {
    color: var(--cs-ink);
}

.cs-kpi-subtitle {
    font-size: 12px;
    color: var(--cs-muted);
}

.cs-kpi-delta {
    font-size: 12px;
    font-weight: 600;
    color: #16a34a;
    margin-left: 6px;
}

.cs-kpi-delta.cs-negative {
    color: #dc2626;
}

.cs-inline-filters {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.cs-section-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 12px;
}

.cs-pill {
    border: 1px solid var(--cs-border);
    background: #fff;
    border-radius: 12px;
    padding: 8px 12px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 13px;
    color: var(--cs-ink);
}

.cs-topbar-select {
    border: 1px solid var(--cs-border);
    border-radius: 12px;
    padding: 8px 12px;
    font-weight: 600;
    font-size: 13px;
    background: #fff;
    min-width: 160px;
}

.cs-date-range {
    position: relative;
    display: inline-block;
}

.cs-date-btn {
    border: 1px solid var(--cs-border);
    background: #fff;
    border-radius: 12px;
    padding: 8px 12px;
    font-weight: 600;
    font-size: 13px;
    color: var(--cs-ink);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.cs-date-panel {
    position: absolute;
    top: calc(100% + 10px);
    left: 0;
    background: #fff;
    border-radius: 16px;
    border: 1px solid var(--cs-border);
    min-width: 760px;
    display: none;
    z-index: 1050;
}

.cs-date-panel.open {
    display: flex;
}

.cs-date-sidebar {
    width: 220px;
    border-right: 1px solid var(--cs-border);
    padding: 12px;
    max-height: 440px;
    overflow-y: auto;
}

.cs-date-option {
    width: 100%;
    border: none;
    background: transparent;
    text-align: left;
    padding: 8px 10px;
    border-radius: 8px;
    font-weight: 600;
    color: var(--cs-ink);
    font-size: 13px;
}

.cs-date-option.active {
    background: #f1f5f9;
}

.cs-date-divider {
    height: 1px;
    background: var(--cs-border);
    margin: 8px 0;
}

.cs-date-main {
    flex: 1;
    padding: 16px;
}

.cs-date-mobile-select {
    display: none;
    margin-bottom: 10px;
}

.cs-date-tabs {
    display: inline-flex;
    background: #f3f4f6;
    border-radius: 999px;
    padding: 4px;
    gap: 4px;
}

.cs-date-tab {
    border: none;
    background: transparent;
    padding: 6px 16px;
    border-radius: 999px;
    font-weight: 600;
    color: #4b5563;
    font-size: 13px;
}

.cs-date-tab.active {
    background: #fff;
    color: #111827;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

.cs-date-tab-pane {
    display: none;
}

.cs-date-tab-pane.active {
    display: block;
}

.cs-date-header {
    margin: 16px 0 12px;
}

.cs-date-display {
    display: flex;
    align-items: center;
    gap: 10px;
}

.cs-date-input {
    border: 1px solid #d1d5db;
    border-radius: 10px;
    padding: 10px 12px;
    min-width: 190px;
    font-weight: 600;
    color: #111827;
    font-size: 13px;
}

.cs-date-arrow {
    color: #9ca3af;
}

.cs-date-calendars {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.cs-calendar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.cs-calendar-title {
    font-weight: 600;
}

.cs-calendar-nav {
    border: none;
    background: transparent;
    font-size: 18px;
}

.cs-calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 6px;
    text-align: center;
}

.cs-calendar-day {
    font-size: 12px;
    color: #6b7280;
}

.cs-calendar-date {
    border-radius: 999px;
    padding: 6px 0;
    font-weight: 600;
    cursor: pointer;
    font-size: 12px;
}

.cs-calendar-date.in-range {
    background: #eef2ff;
}

.cs-calendar-date.selected {
    background: #111827;
    color: #fff;
}

.cs-calendar-date.disabled {
    color: #d1d5db;
    cursor: default;
}

.cs-calendar-disabled .cs-calendar-date {
    pointer-events: none;
    color: #9ca3af;
}

.cs-calendar-disabled .cs-calendar-date.selected {
    background: #e5e7eb;
    color: #6b7280;
}

.cs-rolling-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 20px 0 12px;
}

.cs-rolling-row input {
    width: 100px;
}

.cs-date-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 18px;
}

.cs-date-timezone {
    margin-right: auto;
    color: #94a3b8;
    font-size: 0.62rem;
    font-weight: 500;
}

.cs-date-actions .btn-link {
    color: #6b7280;
    text-decoration: none;
}

.cs-select {
    border: 1px solid #d1d5db;
    border-radius: 10px;
    padding: 8px 12px;
    background: #fff;
    font-weight: 500;
}

.cs-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.4);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    z-index: 1010;
}

.cs-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

body.cs-auth .cs-sidebar,
body.cs-auth .cs-topbar {
    display: none;
}

body.cs-auth .cs-content {
    padding: 60px 24px;
}

@media (max-width: 992px) {
    .cs-card {
        grid-column: span 6;
    }

    .cs-card--wide,
    .cs-card--tall {
        grid-column: span 12;
    }

    .cs-card--calendar,
    .cs-card--sidebar {
        grid-column: span 12;
    }

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

    .cs-form-wide {
        grid-column: span 1;
    }
    .cs-sidebar {
        position: fixed;
        left: 0;
        top: 0;
        transform: translateX(-100%);
        transition: transform 0.2s ease;
        height: 100vh;
    }

    .cs-sidebar.open {
        transform: translateX(0);
    }

    .cs-nav-toggle {
        display: inline-flex;
    }

    .cs-topbar {
        padding: 12px 16px;
        gap: 10px;
        flex-wrap: wrap;
    }

    .cs-topbar-controls {
        width: 100%;
        justify-content: flex-start;
    }

    .cs-content {
        padding: 20px 16px 32px;
    }

    .cs-date-panel {
        min-width: 0;
        width: calc(100vw - 32px);
        max-width: 100vw;
        left: 16px;
        right: 16px;
        top: calc(100% + 12px);
        max-height: 80vh;
        overflow: hidden;
    }

    .cs-date-sidebar {
        display: none;
    }

    .cs-date-calendars {
        grid-template-columns: 1fr;
    }

    .cs-date-mobile-select {
        display: block;
    }

    .cs-calendar[data-offset="1"] {
        display: none;
    }

    .cs-date-main {
        padding: 14px;
        max-height: 80vh;
        overflow-y: auto;
    }
}

@media (max-width: 576px) {
    .cs-grid {
        grid-template-columns: 1fr;
    }

    .cs-card {
        grid-column: span 1;
        padding: 16px;
    }

    .cs-table-row {
        grid-template-columns: 1fr;
        gap: 4px;
    }

    .cs-kpi-value {
        font-size: 22px;
    }

    .cs-date-panel {
        position: fixed;
        inset: 16px;
        width: auto;
        max-height: none;
        top: 16px;
    }

    .cs-date-header {
        margin: 12px 0 8px;
    }

    .cs-date-display {
        flex-direction: column;
        align-items: stretch;
    }

    .cs-date-input {
        min-width: 0;
        width: 100%;
    }

    .cs-date-actions {
        position: sticky;
        bottom: 0;
        background: #fff;
        padding: 12px 0 4px;
        margin-top: 12px;
    }
}
