/* ============================================
   PMT REPORT - Corporate Analytics Dashboard
   ============================================ */

/* --- Reset & Base --- */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --slate-white: #F8F9FA;
    --deep-slate: #212529;
    --cool-gray: #6C757D;
    --ice-blue: #E3F2FD;
    --corporate-blue: #1565C0;
    --success-green: #2E7D32;
    --warm-amber: #F57F17;
    --skeleton-base: #e0e0e0;
    --skeleton-highlight: #f0f0f0;

    --font-primary: 'DM Sans', sans-serif;
    --body-size: 0.9375rem;
    --title-size: clamp(1.4rem, 2.5vw, 2.2rem);
    --line-height: 1.6;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-primary);
    font-size: var(--body-size);
    font-weight: 400;
    line-height: var(--line-height);
    color: var(--cool-gray);
    background-color: var(--slate-white);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* --- Skeleton Loading Animation --- */
@keyframes shimmer {
    0% {
        background-position: -400px 0;
    }
    100% {
        background-position: 400px 0;
    }
}

[data-skeleton].is-loading {
    position: relative;
    overflow: hidden;
}

[data-skeleton].is-loading > * {
    visibility: hidden;
}

[data-skeleton].is-loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, var(--skeleton-base) 25%, var(--skeleton-highlight) 50%, var(--skeleton-base) 75%);
    background-size: 800px 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 6px;
}

[data-skeleton] {
    transition: opacity 0.4s ease;
}

/* --- Header --- */
#header {
    background-color: var(--deep-slate);
    color: #ffffff;
    padding: 0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.header-inner {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1.25rem 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.header-title {
    font-size: 1.125rem;
    font-weight: 700;
    letter-spacing: 0.15em;
    color: #ffffff;
}

.header-date {
    font-size: 0.8125rem;
    font-weight: 400;
    color: var(--cool-gray);
    letter-spacing: 0.02em;
}

/* --- Layout: 12-Column Grid --- */
#layout {
    max-width: 1400px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 3fr 9fr;
    gap: 0;
    min-height: calc(100vh - 60px);
}

/* --- Sidebar --- */
#sidebar {
    position: sticky;
    top: 60px;
    height: calc(100vh - 60px);
    overflow-y: auto;
    padding: 1.5rem;
    background-color: #ffffff;
    border-right: 1px solid #e9ecef;
    z-index: 10;
}

.sidebar-section {
    margin-bottom: 2rem;
}

.sidebar-heading {
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--cool-gray);
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #e9ecef;
}

/* --- Sidebar Metric Cards --- */
.metric-card {
    background-color: var(--slate-white);
    border-radius: 6px;
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.25rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    min-height: 60px;
}

.metric-label {
    font-size: 0.6875rem;
    font-weight: 500;
    color: var(--cool-gray);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    width: 100%;
}

.metric-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--deep-slate);
}

.metric-change {
    font-size: 0.75rem;
    font-weight: 700;
    margin-left: auto;
}

.metric-change.positive {
    color: var(--success-green);
}

.metric-change.warning {
    color: var(--warm-amber);
}

/* --- Sidebar Navigation --- */
#sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--cool-gray);
    text-decoration: none;
    border-radius: 4px;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.nav-link::before {
    content: '';
    display: inline-block;
    width: 8px;
    height: 8px;
    background-color: transparent;
    border: 1px solid var(--cool-gray);
    flex-shrink: 0;
}

.nav-link:hover {
    background-color: var(--ice-blue);
    color: var(--corporate-blue);
}

.nav-link.active {
    background-color: var(--ice-blue);
    color: var(--corporate-blue);
    font-weight: 700;
}

.nav-link.active::before {
    background-color: var(--corporate-blue);
    border-color: var(--corporate-blue);
}

/* --- Sidebar Status --- */
.status-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--success-green);
    animation: pulse-dot 2s infinite;
}

@keyframes pulse-dot {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

.status-text {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--success-green);
}

.sidebar-meta {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.sidebar-meta span {
    font-size: 0.75rem;
    color: var(--cool-gray);
}

/* --- Main Content --- */
#content {
    padding: 2rem;
    background-color: var(--slate-white);
}

/* --- Content Sections --- */
.content-section {
    margin-bottom: 3rem;
}

.section-title {
    font-size: var(--title-size);
    font-weight: 700;
    color: var(--deep-slate);
    margin-bottom: 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--corporate-blue);
    display: inline-block;
}

/* --- Panel Grid --- */
.panel-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.25rem;
}

/* --- Data Panels --- */
.data-panel {
    background-color: #ffffff;
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    position: relative;
    transform: translateZ(0);
    transition: box-shadow 0.2s ease;
    min-height: 120px;
}

.data-panel:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

.data-panel.wide {
    grid-column: span 2;
}

.panel-heading {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--cool-gray);
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #e9ecef;
}

.panel-text {
    font-size: var(--body-size);
    color: var(--cool-gray);
    line-height: var(--line-height);
}

/* --- Big Numbers --- */
.big-number {
    font-size: 2.25rem;
    font-weight: 700;
    color: var(--deep-slate);
    line-height: 1.2;
    margin-bottom: 0.25rem;
}

.big-number-change {
    font-size: 0.8125rem;
    font-weight: 700;
    margin-bottom: 1rem;
}

.big-number-change.positive {
    color: var(--success-green);
}

.big-number-change.warning {
    color: var(--warm-amber);
}

/* --- Bar Charts --- */
.bar-chart {
    position: relative;
    height: 200px;
    display: flex;
    flex-direction: column;
}

.bar-chart.short {
    height: 150px;
}

.chart-gridlines {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 24px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    pointer-events: none;
}

.gridline {
    width: 100%;
    height: 1px;
    background-color: var(--deep-slate);
    opacity: 0.05;
}

.chart-bars {
    flex: 1;
    display: flex;
    align-items: flex-end;
    gap: 0.75rem;
    padding-bottom: 24px;
    position: relative;
    z-index: 1;
}

.chart-bars.dense {
    gap: 0.35rem;
}

.bar-group {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100%;
    justify-content: flex-end;
}

.bar {
    width: 100%;
    max-width: 48px;
    height: var(--bar-height);
    background-color: var(--corporate-blue);
    border-radius: 3px 3px 0 0;
    position: relative;
    transition: background-color 0.2s ease;
}

.chart-bars.dense .bar {
    max-width: 32px;
}

.bar:hover {
    background-color: #1976D2;
}

.bar-label {
    position: absolute;
    bottom: -20px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.625rem;
    color: var(--cool-gray);
    white-space: nowrap;
}

.chart-axis {
    width: 100%;
    height: 1px;
    background-color: var(--deep-slate);
    opacity: 0.15;
    position: absolute;
    bottom: 24px;
    left: 0;
}

/* --- Mini Bars (Sparkline-like) --- */
.mini-bars {
    display: flex;
    align-items: flex-end;
    gap: 3px;
    height: 40px;
    margin-top: 0.75rem;
}

.mini-bar {
    flex: 1;
    height: var(--bar-height);
    background-color: var(--corporate-blue);
    border-radius: 2px 2px 0 0;
    opacity: 0.7;
}

.mini-bar:last-child {
    opacity: 1;
}

/* --- Line Charts --- */
.line-chart-container {
    position: relative;
    width: 100%;
}

.line-chart {
    width: 100%;
    height: 150px;
}

.chart-line {
    fill: none;
    stroke: var(--corporate-blue);
    stroke-width: 2;
    vector-effect: non-scaling-stroke;
}

.chart-line-fill {
    fill: var(--ice-blue);
    stroke: none;
    opacity: 0.5;
}

.chart-caption {
    font-size: 0.8125rem;
    color: var(--cool-gray);
    margin-top: 0.5rem;
    text-align: right;
}

.chart-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 0.5rem;
}

.chart-labels span {
    font-size: 0.625rem;
    color: var(--cool-gray);
}

/* --- Data Tables --- */
.data-table {
    display: flex;
    flex-direction: column;
}

.table-row {
    display: flex;
    align-items: center;
    padding: 0.625rem 0;
    border-bottom: 1px solid #f0f0f0;
}

.table-row:last-child {
    border-bottom: none;
}

.table-cell {
    font-size: 0.8125rem;
}

.table-cell.label {
    flex: 1;
    color: var(--deep-slate);
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.table-cell.label::before {
    content: '';
    display: inline-block;
    width: 8px;
    height: 8px;
    background-color: var(--corporate-blue);
    flex-shrink: 0;
}

.table-cell.value {
    width: 60px;
    text-align: right;
    font-weight: 700;
    color: var(--deep-slate);
}

.table-cell.change {
    width: 50px;
    text-align: right;
    font-weight: 700;
    font-size: 0.75rem;
}

.table-cell.change.positive {
    color: var(--success-green);
}

.table-cell.change.warning {
    color: var(--warm-amber);
}

/* --- Horizontal Bars --- */
.horizontal-bars {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.h-bar-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.h-bar-label {
    width: 100px;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--deep-slate);
    flex-shrink: 0;
}

.h-bar-track {
    flex: 1;
    height: 20px;
    background-color: var(--slate-white);
    border-radius: 3px;
    overflow: hidden;
}

.h-bar-fill {
    height: 100%;
    width: var(--bar-width);
    background-color: var(--corporate-blue);
    border-radius: 3px;
    transition: width 0.6s ease;
}

.h-bar-value {
    width: 36px;
    font-size: 0.8125rem;
    font-weight: 700;
    color: var(--deep-slate);
    text-align: right;
}

/* --- Summary Content --- */
.summary-content p {
    margin-bottom: 1rem;
    color: var(--cool-gray);
    line-height: var(--line-height);
}

.summary-content p:last-child {
    margin-bottom: 0;
}

/* --- Risk List --- */
.risk-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.risk-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    font-size: 0.8125rem;
    color: var(--cool-gray);
    line-height: 1.5;
}

.risk-marker {
    width: 8px;
    height: 8px;
    margin-top: 0.375rem;
    flex-shrink: 0;
    background-color: var(--corporate-blue);
}

.risk-item.warning .risk-marker {
    background-color: var(--warm-amber);
}

/* --- Targets List --- */
.targets-list {
    display: flex;
    flex-direction: column;
}

.target-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.625rem 0;
    border-bottom: 1px solid #f0f0f0;
}

.target-item:last-child {
    border-bottom: none;
}

.target-metric {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--deep-slate);
}

.target-value {
    font-size: 0.9375rem;
    font-weight: 700;
    color: var(--corporate-blue);
}

/* --- Footer --- */
#footer {
    background-color: var(--slate-white);
    border-top: 1px solid #e9ecef;
    padding: 1.5rem 2rem;
}

.footer-inner {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.footer-text {
    font-size: 0.75rem;
    color: var(--cool-gray);
}

/* --- Responsive --- */
@media (max-width: 1024px) {
    #layout {
        grid-template-columns: 1fr;
    }

    #sidebar {
        position: relative;
        top: auto;
        height: auto;
        border-right: none;
        border-bottom: 1px solid #e9ecef;
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 1rem;
        padding: 1rem;
    }

    .sidebar-section {
        margin-bottom: 0;
    }

    #content {
        padding: 1.5rem;
    }
}

@media (max-width: 768px) {
    #sidebar {
        grid-template-columns: 1fr;
    }

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

    .data-panel.wide {
        grid-column: span 1;
    }

    .header-inner {
        padding: 1rem;
    }

    .footer-inner {
        flex-direction: column;
        gap: 0.5rem;
        text-align: center;
    }

    .h-bar-label {
        width: 80px;
        font-size: 0.75rem;
    }
}
