:root {
    --bg: #f6f8fc;
    --surface: #ffffff;
    --ink: #182235;
    --muted: #6e7b91;
    --primary: #3657ff;
    --primary-dark: #263ec8;
    --success: #1f9d66;
    --sidebar: #131a34;
    --sidebar-2: #202a52;
    --border: rgba(20, 34, 70, 0.08);
    --shadow: 0 12px 32px rgba(18, 25, 54, 0.08);
}

* { box-sizing: border-box; }

html {
    font-size: 14px;
}

body {
    margin: 0;
    background: radial-gradient(circle at top right, rgba(54, 87, 255, .08), transparent 30%), var(--bg);
    color: var(--ink);
    font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 0.94rem;
    font-weight: 400;
    line-height: 1.5;
    letter-spacing: -0.005em;
}

h1, h2, h3, h4, h5, h6 {
    color: var(--ink);
    font-weight: 650;
    letter-spacing: -0.025em;
}

p {
    color: var(--muted);
}

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

.sidebar {
    width: 260px;
    min-height: 100vh;
    position: sticky;
    top: 0;
    background: linear-gradient(165deg, var(--sidebar), var(--sidebar-2));
    color: white;
    padding: 22px;
    box-shadow: 14px 0 34px rgba(18, 25, 54, .16);
}

.brand {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-bottom: 30px;
}

.brand-icon,
.login-logo {
    height: 42px;
    width: 42px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, #6fe1ff, #3657ff);
    color: white;
    font-size: 20px;
    box-shadow: 0 10px 20px rgba(54, 87, 255, .28);
}

.brand-title {
    font-size: 1.16rem;
    font-weight: 650;
    letter-spacing: -0.01em;
}

.brand-subtitle {
    color: rgba(255,255,255,.58);
    font-size: 0.78rem;
    font-weight: 400;
}

.sidebar-nav {
    display: grid;
    gap: 7px;
}

.sidebar-nav .nav-link {
    color: rgba(255,255,255,.72);
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 10px 12px;
    border-radius: 12px;
    font-size: 0.92rem;
    font-weight: 500;
    transition: all .2s ease;
}

.sidebar-nav .nav-link i {
    font-size: 1rem;
}

.sidebar-nav .nav-link:hover,
.sidebar-nav .nav-link.active {
    color: #fff;
    background: rgba(255,255,255,.11);
    transform: translateX(2px);
}

.sidebar-footer {
    margin-top: auto;
    background: rgba(255,255,255,.075);
    padding: 14px;
    border-radius: 16px;
    font-size: 0.9rem;
}

.main-content {
    flex: 1;
    min-width: 0;
}

.content-wrapper {
    padding: 24px;
    max-width: 1440px;
    margin: 0 auto;
}

.mobile-nav {
    background: rgba(255,255,255,.9);
    backdrop-filter: blur(15px);
    border-bottom: 1px solid var(--border);
}

.hero-card {
    background: linear-gradient(135deg, #3657ff, #6e5df5 55%, #23c6e8);
    color: white;
    border-radius: 24px;
    padding: 26px 28px;
    box-shadow: var(--shadow);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
}

.hero-card h1 {
    color: white;
    font-size: clamp(1.75rem, 3vw, 2.65rem);
    font-weight: 650;
    letter-spacing: -0.035em;
    margin-bottom: 6px;
}

.hero-card p {
    color: rgba(255,255,255,.82);
    max-width: 740px;
    margin: 0;
    font-size: 0.96rem;
}

.eyebrow {
    text-transform: uppercase;
    letter-spacing: .12em;
    font-size: 0.72rem;
    font-weight: 650;
    opacity: .78;
    margin-bottom: 5px;
}

.page-title {
    font-size: clamp(1.55rem, 2vw, 2.15rem);
    font-weight: 650;
    letter-spacing: -0.03em;
    margin-bottom: 4px;
}

.soft-card,
.stat-card {
    border: 1px solid var(--border);
    border-radius: 18px;
    box-shadow: var(--shadow);
    background: rgba(255,255,255,.94);
    backdrop-filter: blur(10px);
}

.card-header {
    border-bottom: 1px solid var(--border);
    padding: 15px 18px;
}

.card-header h5,
.card-header .h5 {
    font-size: 1.02rem;
    font-weight: 650;
}

.card-header small {
    font-size: 0.82rem;
}

.card-body {
    padding: 18px;
}

.card-footer {
    border-top: 1px solid var(--border);
    padding: 14px 18px;
}

.stat-card {
    padding: 17px;
    height: 100%;
    position: relative;
    overflow: hidden;
}

.stat-card::after {
    content: "";
    position: absolute;
    right: -38px;
    top: -38px;
    width: 105px;
    height: 105px;
    border-radius: 50%;
    background: rgba(54, 87, 255, .07);
}

.stat-icon {
    height: 38px;
    width: 38px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    color: white;
    font-size: 16px;
    margin-bottom: 13px;
}

.bg-blue { background: #3657ff; }
.bg-green { background: #1f9d66; }
.bg-purple { background: #7b61ff; }
.bg-orange { background: #fa8b2b; }

.stat-label {
    color: var(--muted);
    font-size: 0.76rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .045em;
}

.stat-value {
    font-size: clamp(1.25rem, 2vw, 1.72rem);
    font-weight: 650;
    letter-spacing: -0.035em;
    margin-top: 5px;
    line-height: 1.2;
}

.stat-hint {
    color: var(--muted);
    font-size: 0.82rem;
    margin-top: 4px;
}

.campaign-mini-card {
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 15px;
    margin-bottom: 12px;
    background: white;
}

.campaign-title {
    color: var(--ink);
    font-size: 0.98rem;
    font-weight: 600;
    text-decoration: none;
}

.campaign-title:hover {
    color: var(--primary);
}

.progress {
    height: 7px;
    border-radius: 999px;
    background: #e9edf8;
}

.progress-bar {
    background: linear-gradient(90deg, #3657ff, #23c6e8);
    border-radius: 999px;
}

.action-tile {
    padding: 14px;
    border-radius: 15px;
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 11px;
    text-decoration: none;
    color: var(--ink);
    font-size: 0.92rem;
    font-weight: 550;
    background: white;
    transition: all .2s ease;
}

.action-tile i {
    color: var(--primary);
    font-size: 18px;
}

.action-tile:hover {
    transform: translateY(-2px);
    box-shadow: 0 9px 24px rgba(18,25,54,.07);
    color: var(--primary);
}

.table {
    --bs-table-bg: transparent;
    font-size: 0.88rem;
}

.table thead th {
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .045em;
    font-size: 0.72rem;
    font-weight: 650;
    border-bottom: 1px solid var(--border);
    padding-top: 0.85rem;
    padding-bottom: 0.85rem;
}

.table tbody td {
    border-color: var(--border);
    padding-top: 0.78rem;
    padding-bottom: 0.78rem;
    vertical-align: middle;
}

.metric-table td,
.metric-table th {
    padding: .72rem .9rem;
}

.info-row {
    display: flex;
    justify-content: space-between;
    gap: 15px;
    padding: 9px 0;
    border-bottom: 1px dashed var(--border);
    font-size: 0.9rem;
}

.info-row:last-child {
    border-bottom: 0;
}

.info-row span {
    color: var(--muted);
}

.info-row strong {
    text-align: right;
    font-weight: 600;
}

.form-control,
.form-select {
    border-radius: 11px;
    border: 1px solid #dfe5f2;
    padding: 9px 12px;
    font-size: 0.92rem;
    font-weight: 400;
}

.form-control-lg,
.form-select-lg {
    min-height: 42px;
    padding: 9px 12px;
    font-size: 0.95rem;
    border-radius: 12px;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 .18rem rgba(54, 87, 255, .13);
}

.form-label,
label {
    font-size: 0.84rem;
    font-weight: 600;
    color: #3a465d;
    margin-bottom: 5px;
}

.field-wrap ul.errorlist {
    list-style: none;
    padding: 0;
    margin: 6px 0 0;
    color: #dc3545;
    font-size: 0.8rem;
}

.btn {
    border-radius: 11px;
    font-size: 0.9rem;
    font-weight: 600;
    padding: 0.52rem 0.9rem;
}

.btn-sm {
    font-size: 0.8rem;
    padding: 0.38rem 0.7rem;
}

.btn-lg {
    font-size: 0.95rem;
    padding: 0.62rem 1.05rem;
    border-radius: 12px;
}

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

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

.badge {
    font-size: 0.76rem;
    font-weight: 600;
    padding: 0.42em 0.65em;
}

.small,
small {
    font-size: 0.82rem;
}

.fw-semibold {
    font-weight: 600 !important;
}

.sticky-offset {
    top: 18px;
}

.empty-state {
    text-align: center;
    padding: 32px 20px;
    color: var(--muted);
}

.empty-state i {
    font-size: 36px;
    color: #b5bfd4;
    display: block;
    margin-bottom: 10px;
}

.empty-state h5 {
    color: var(--ink);
    font-size: 1.05rem;
    font-weight: 650;
}

.login-body {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 20px;
    background: radial-gradient(circle at top left, rgba(54, 87, 255, .18), transparent 33%), radial-gradient(circle at bottom right, rgba(35, 198, 232, .14), transparent 30%), #f4f7fb;
}

.login-card {
    width: min(100%, 410px);
    padding: 28px;
    border-radius: 24px;
    background: rgba(255,255,255,.94);
    border: 1px solid var(--border);
    backdrop-filter: blur(18px);
}

.login-card h1 {
    font-size: 1.55rem;
    font-weight: 650;
}

.glass-alert {
    border-radius: 14px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    font-size: 0.9rem;
}

.text-bg-primary {
    background-color: rgba(54, 87, 255, .12)!important;
    color: #243cce!important;
}

.text-bg-success {
    background-color: rgba(31,157,102,.14)!important;
    color: #107346!important;
}

.text-bg-warning {
    background-color: rgba(250,139,43,.16)!important;
    color: #a85a11!important;
}

.text-bg-danger {
    background-color: rgba(220,53,69,.12)!important;
    color: #b02a37!important;
}

.text-bg-light {
    color: #30405f!important;
    background-color: #eef3ff!important;
}

@media (max-width: 991px) {
    html {
        font-size: 13.5px;
    }

    .content-wrapper {
        padding: 18px;
    }

    .hero-card {
        flex-direction: column;
        align-items: flex-start;
        border-radius: 20px;
        padding: 22px;
    }
}

/* Enhanced campaign listing */
.list-summary-card {
    height: 100%;
    padding: 16px 17px;
    border-radius: 18px;
    border: 1px solid var(--border);
    background: linear-gradient(180deg, rgba(255,255,255,.98), rgba(255,255,255,.88));
    box-shadow: 0 10px 24px rgba(18,25,54,.06);
}

.list-summary-value {
    margin-top: 5px;
    font-size: clamp(1.05rem, 1.5vw, 1.45rem);
    line-height: 1.25;
    font-weight: 650;
    letter-spacing: -0.03em;
    color: var(--ink);
}

.campaign-filter-card {
    position: sticky;
    top: 14px;
    z-index: 5;
}

.input-icon-wrap {
    position: relative;
}

.input-icon-wrap i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--muted);
    pointer-events: none;
}

.input-icon-wrap .form-control {
    padding-left: 36px;
}

.status-chip-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.status-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 11px;
    border-radius: 999px;
    border: 1px solid #dfe5f2;
    background: #fff;
    color: #46556f;
    text-decoration: none;
    font-size: 0.82rem;
    font-weight: 600;
    transition: all .18s ease;
}

.status-chip:hover,
.status-chip.active {
    border-color: rgba(54,87,255,.35);
    background: rgba(54,87,255,.08);
    color: var(--primary);
}

.campaign-card {
    border: 1px solid var(--border);
    border-radius: 20px;
    background: rgba(255,255,255,.96);
    box-shadow: var(--shadow);
    padding: 18px;
    transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}

.campaign-card:hover {
    transform: translateY(-3px);
    border-color: rgba(54,87,255,.24);
    box-shadow: 0 18px 36px rgba(18,25,54,.10);
}

.campaign-card-title {
    color: var(--ink);
    font-size: 1rem;
    line-height: 1.35;
    font-weight: 650;
    text-decoration: none;
    letter-spacing: -0.015em;
}

.campaign-card-title:hover {
    color: var(--primary);
}

.campaign-meta {
    color: var(--muted);
    font-size: 0.82rem;
}

.campaign-metric-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-top: 14px;
}

.campaign-metric-grid > div {
    border: 1px solid rgba(20,34,70,.07);
    border-radius: 14px;
    background: #f9fbff;
    padding: 10px 11px;
    min-width: 0;
}

.campaign-metric-grid span {
    display: block;
    color: var(--muted);
    font-size: 0.73rem;
    font-weight: 650;
    text-transform: uppercase;
    letter-spacing: .04em;
    margin-bottom: 4px;
}

.campaign-metric-grid strong {
    display: block;
    color: var(--ink);
    font-size: 0.94rem;
    font-weight: 650;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.campaign-card-footer {
    margin-top: 15px;
    padding-top: 13px;
    border-top: 1px dashed var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.min-w-0 {
    min-width: 0;
}

.dropdown-menu {
    border: 1px solid var(--border);
    border-radius: 14px;
    font-size: 0.88rem;
}

.dropdown-item {
    padding: 8px 12px;
}

@media (max-width: 575px) {
    .campaign-filter-card {
        position: static;
    }

    .campaign-metric-grid {
        grid-template-columns: 1fr;
    }

    .campaign-card-footer {
        align-items: flex-start;
        flex-direction: column;
    }
}

/* v6 clarity improvements */
.input-group-text {
    border-color: #dfe5f2;
    background: #f5f7fb;
    color: #64748b;
    font-size: 0.84rem;
    font-weight: 600;
    border-radius: 0 11px 11px 0;
}

.input-group .form-control {
    border-radius: 11px 0 0 11px;
}

.form-control:disabled,
.form-control[readonly] {
    background-color: #f3f6fb;
    color: #60708a;
    cursor: not-allowed;
}

.timeline-help-box {
    display: flex;
    gap: 10px;
    padding: 12px 13px;
    border-radius: 14px;
    background: rgba(54, 87, 255, .07);
    color: #344054;
    font-size: 0.86rem;
    line-height: 1.45;
}

.timeline-help-box i {
    color: var(--primary);
    font-size: 1rem;
    margin-top: 1px;
}

.report-goal-card {
    border-radius: 22px;
    padding: 22px 24px;
    background: linear-gradient(135deg, #182235, #3657ff);
    color: white;
    box-shadow: var(--shadow);
}

.report-goal-card h2 {
    color: white;
    font-size: clamp(1.15rem, 2vw, 1.65rem);
    font-weight: 650;
    line-height: 1.32;
    margin-bottom: 8px;
}

.report-goal-card p,
.report-goal-card .eyebrow {
    color: rgba(255,255,255,.78);
}

.chart-compact {
    position: relative;
    height: 300px;
    width: 100%;
}

.report-table tbody td {
    padding-top: 0.68rem;
    padding-bottom: 0.68rem;
}

.unit-guide-row {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    padding: 9px 0;
    border-bottom: 1px dashed var(--border);
    font-size: 0.9rem;
}

.unit-guide-row span {
    color: var(--muted);
}

.unit-guide-row strong {
    color: var(--ink);
    font-weight: 650;
    white-space: nowrap;
}

@media (max-width: 575px) {
    .chart-compact {
        height: 360px;
    }
}

/* v7 report readability improvements */
.report-kpi-card .stat-value {
    font-size: clamp(1.15rem, 1.7vw, 1.55rem);
    line-height: 1.15;
    letter-spacing: -0.03em;
}

.report-table thead th {
    white-space: nowrap;
}

.metric-group-row td {
    background: #f4f7ff !important;
    color: #42526d;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    padding: 0.55rem 0.8rem !important;
    border-top: 1px solid rgba(54,87,255,.12);
    border-bottom: 1px solid rgba(54,87,255,.12);
}

.chart-compact-sm {
    height: 240px;
}

.report-table .progress {
    height: 7px;
    background-color: #e9eef8;
}

.text-bg-light {
    color: #475569!important;
    background-color: #eef3ff!important;
}

@media (max-width: 575px) {
    .chart-compact-sm {
        height: 280px;
    }
}

/* v9 report health and clarity updates */
.calculated-end-date-field {
    pointer-events: none;
    user-select: none;
}

.health-donut-wrap {
    display: grid;
    place-items: center;
    min-height: 190px;
}

.health-donut {
    width: 176px;
    height: 176px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    box-shadow: inset 0 0 0 1px rgba(20,34,70,.06), 0 18px 38px rgba(18,25,54,.08);
}

.health-donut-center {
    width: 112px;
    height: 112px;
    border-radius: 50%;
    background: #fff;
    display: grid;
    place-items: center;
    align-content: center;
    box-shadow: inset 0 0 0 1px rgba(20,34,70,.08);
}

.health-donut-center span {
    color: var(--ink);
    font-size: 1.45rem;
    font-weight: 700;
    line-height: 1;
    letter-spacing: -0.04em;
}

.health-donut-center small {
    margin-top: 6px;
    color: var(--muted);
    font-size: .78rem;
    font-weight: 650;
}

.health-legend {
    display: grid;
    gap: 9px;
}

.health-legend > div {
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: space-between;
    padding: 9px 10px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #fbfcff;
    color: #475569;
    font-size: .86rem;
}

.health-legend > div strong {
    margin-left: auto;
    color: var(--ink);
}

.legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex: 0 0 auto;
}

.action-summary-box {
    display: flex;
    gap: 12px;
    align-items: center;
    padding: 13px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: linear-gradient(180deg, rgba(255,255,255,.98), rgba(246,248,252,.9));
}

.action-summary-icon {
    height: 38px;
    width: 38px;
    border-radius: 13px;
    display: grid;
    place-items: center;
    flex: 0 0 auto;
}

.focus-list {
    display: grid;
    gap: 10px;
}

.focus-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px dashed var(--border);
}

.focus-item:last-child {
    border-bottom: 0;
}

.focus-item strong {
    display: block;
    font-size: .88rem;
    font-weight: 650;
}

.focus-item span:not(.badge) {
    display: block;
    color: var(--muted);
    font-size: .8rem;
    margin-top: 2px;
}
