:root {
    --ppsa-navy: #0f2744;
    --ppsa-navy-mid: #1a3d6b;
    --ppsa-navy-light: #2a5298;
    --ppsa-gold: #c8951a;
    --ppsa-gold-light: #f0b429;
    --ppsa-red: #c0392b;
    --ppsa-red-bg: #fdf0ef;
    --ppsa-green: #1a7a4a;
    --ppsa-green-bg: #f0faf4;
    --ppsa-amber: #8a5c00;
    --ppsa-amber-bg: #fef8e8;
    --ppsa-purple: #5b3da8;
    --ppsa-purple-bg: #f3f0fd;
    --ppsa-surface: #f5f6f8;
    --ppsa-border: #d8dde6;
    --ppsa-border-light: #eaecf0;
    --ppsa-text-secondary: #5a6478;
    --ppsa-text-tertiary: #8b95a8;
    --ppsa-radius: 8px;
    --ppsa-radius-lg: 12px;
    --sidebar-width: 230px;
    --topbar-height: 56px;
}

body {
    font-family: 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 14px;
    background: var(--ppsa-surface);
    color: #0f1923;
    min-height: 100vh;
    overflow-x: hidden;
}

.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--ppsa-navy) 0%, var(--ppsa-navy-mid) 50%, #0d1f35 100%);
    position: relative;
}
.login-wrapper::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 20% 80%, rgba(240,180,41,0.08) 0%, transparent 50%),
                radial-gradient(circle at 80% 20%, rgba(42,82,152,0.15) 0%, transparent 50%);
    pointer-events: none;
}
.login-brand-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto;
    background: rgba(255,255,255,0.9);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.app-sidebar {
    width: var(--sidebar-width);
    background: var(--ppsa-navy);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 1040;
    overflow-y: auto;
    transition: transform 0.25s ease;
}
.sidebar-brand {
    padding: 1.25rem 1.25rem 1rem;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}
.sidebar-logo-text {
    font-size: 12px;
    font-weight: 600;
    color: #fff;
    letter-spacing: 0.3px;
    line-height: 1.3;
}
.sidebar-logo-sub {
    font-size: 9.5px;
    color: rgba(255,255,255,0.4);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 1px;
}
.sidebar-section-label {
    font-size: 8.5px;
    color: rgba(255,255,255,0.3);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    padding: 0.9rem 1.25rem 0.2rem;
    font-weight: 600;
}
.sidebar-link {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 0.5rem 1.25rem;
    font-size: 12.5px;
    color: rgba(255,255,255,0.6);
    text-decoration: none;
    border-left: 2px solid transparent;
    transition: all 0.12s;
    font-weight: 400;
}
.sidebar-link:hover {
    color: #fff;
    background: rgba(255,255,255,0.06);
}
.sidebar-link.active {
    color: #fff;
    background: rgba(255,255,255,0.1);
    border-left-color: var(--ppsa-gold-light);
    font-weight: 500;
}
.sidebar-link i {
    font-size: 14px;
    width: 18px;
    text-align: center;
}
.sidebar-footer {
    padding: 1rem 1.25rem;
    border-top: 1px solid rgba(255,255,255,0.08);
    font-size: 10px;
}

.app-main {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-width: 0;
}

.app-topbar {
    height: var(--topbar-height);
    background: #fff;
    border-bottom: 1px solid var(--ppsa-border);
    padding: 0 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 1030;
}

.app-content {
    padding: 1.5rem;
}

.btn-navy {
    background: var(--ppsa-navy);
    color: #fff;
    border-color: var(--ppsa-navy);
}
.btn-navy:hover {
    background: var(--ppsa-navy-mid);
    border-color: var(--ppsa-navy-mid);
    color: #fff;
}
.btn-gold {
    background: var(--ppsa-gold);
    color: #fff;
    border-color: var(--ppsa-gold);
}
.btn-gold:hover {
    background: #a67c14;
    border-color: #a67c14;
    color: #fff;
}

.badge-status {
    font-size: 10px;
    padding: 3px 10px;
    border-radius: 20px;
    font-weight: 500;
    white-space: nowrap;
}
.badge-active      { background: #dbeafe; color: #1e40af; }
.badge-new         { background: var(--ppsa-amber-bg); color: var(--ppsa-amber); }
.badge-pending     { background: #fce7f3; color: #831843; }
.badge-favourable  { background: var(--ppsa-green-bg); color: var(--ppsa-green); }
.badge-unfavourable{ background: var(--ppsa-red-bg); color: var(--ppsa-red); }
.badge-settled     { background: var(--ppsa-purple-bg); color: var(--ppsa-purple); }
.badge-closed      { background: var(--ppsa-surface); color: var(--ppsa-text-secondary); }

.badge-strat-pending {
    font-size: 9px;
    padding: 2px 7px;
    background: var(--ppsa-red-bg);
    color: var(--ppsa-red);
    border-radius: 12px;
}
.badge-strat-approved {
    font-size: 9px;
    padding: 2px 7px;
    background: var(--ppsa-green-bg);
    color: var(--ppsa-green);
    border-radius: 12px;
}

.metric-card {
    background: #fff;
    border: 1px solid var(--ppsa-border);
    border-radius: var(--ppsa-radius-lg);
    padding: 1rem 1.125rem;
    transition: box-shadow 0.15s;
}
.metric-card:hover { box-shadow: 0 2px 8px rgba(15,39,68,0.06); }
.metric-label {
    font-size: 9.5px;
    color: var(--ppsa-text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.35px;
    font-weight: 600;
    margin-bottom: 4px;
}
.metric-value {
    font-size: 22px;
    font-weight: 600;
    font-family: 'IBM Plex Mono', monospace;
    line-height: 1;
}
.metric-value.navy  { color: var(--ppsa-navy-light); }
.metric-value.red   { color: var(--ppsa-red); }
.metric-value.green { color: var(--ppsa-green); }
.metric-value.amber { color: var(--ppsa-amber); }
.metric-sub {
    font-size: 10px;
    color: var(--ppsa-text-tertiary);
    margin-top: 3px;
}

.detail-header {
    background: var(--ppsa-navy);
    color: #fff;
    border-radius: var(--ppsa-radius-lg);
    padding: 1.25rem 1.5rem;
    margin-bottom: 1rem;
}
.detail-header .ref-id {
    font-size: 10px;
    color: rgba(255,255,255,0.45);
    font-family: 'IBM Plex Mono', monospace;
    margin-bottom: 6px;
}
.detail-header .parties {
    font-size: 17px;
    font-weight: 600;
    line-height: 1.3;
    margin-bottom: 8px;
}
.detail-chip {
    background: rgba(255,255,255,0.1);
    font-size: 10.5px;
    padding: 2px 10px;
    border-radius: 20px;
    color: rgba(255,255,255,0.85);
    display: inline-block;
    margin-right: 4px;
    margin-bottom: 4px;
}

.detail-tabs .nav-link {
    font-size: 12.5px;
    padding: 10px 18px;
    color: var(--ppsa-text-secondary);
    border: none;
    border-bottom: 2px solid transparent;
    font-weight: 500;
}
.detail-tabs .nav-link:hover { color: #0f1923; }
.detail-tabs .nav-link.active {
    color: var(--ppsa-navy-light);
    border-bottom-color: var(--ppsa-navy-light);
    background: transparent;
}

.wizard-steps {
    display: flex;
    background: #fff;
    border: 1px solid var(--ppsa-border);
    border-radius: var(--ppsa-radius-lg);
    overflow: hidden;
    margin-bottom: 1.25rem;
}
.wizard-step {
    flex: 1;
    text-align: center;
    padding: 0.65rem 0.75rem;
    font-size: 12px;
    color: var(--ppsa-text-tertiary);
    border-right: 1px solid var(--ppsa-border);
    position: relative;
}
.wizard-step:last-child { border-right: none; }
.wizard-step.done    { background: var(--ppsa-green-bg); color: var(--ppsa-green); }
.wizard-step.current { background: #eff5fd; color: var(--ppsa-navy-light); font-weight: 600; }
.wizard-step .step-num { font-size: 10px; display: block; margin-bottom: 1px; }

.fin-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
    margin-bottom: 1rem;
}
.fin-cell {
    background: var(--ppsa-surface);
    border-radius: var(--ppsa-radius);
    padding: 0.75rem 0.875rem;
}
.fin-lbl {
    font-size: 9.5px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: var(--ppsa-text-tertiary);
    font-weight: 600;
    margin-bottom: 4px;
}
.fin-val {
    font-size: 15px;
    font-weight: 600;
    font-family: 'IBM Plex Mono', monospace;
}

.progress-thin { height: 6px; border-radius: 3px; }
.progress-thin .progress-bar { border-radius: 3px; }

.steps-list { list-style: none; padding: 0; margin: 0; }
.step-item {
    display: flex;
    gap: 0.75rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--ppsa-border-light);
}
.step-item:last-child { border-bottom: none; }
.step-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--ppsa-navy-light);
    flex-shrink: 0;
    margin-top: 5px;
}
.step-note { font-size: 12.5px; }
.step-meta {
    font-size: 10px;
    color: var(--ppsa-text-tertiary);
    margin-top: 2px;
    font-family: 'IBM Plex Mono', monospace;
}

.stat-bar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.35rem 0;
}
.stat-name { font-size: 12px; min-width: 130px; }
.stat-count {
    font-size: 12px;
    font-weight: 600;
    min-width: 28px;
    text-align: right;
    font-family: 'IBM Plex Mono', monospace;
}
.stat-bar-inner {
    flex: 1;
    height: 7px;
    background: var(--ppsa-surface);
    border-radius: 4px;
    overflow: hidden;
}
.stat-bar-fill {
    height: 100%;
    background: var(--ppsa-navy-light);
    border-radius: 4px;
}

.team-card {
    background: var(--ppsa-surface);
    border-radius: var(--ppsa-radius);
    padding: 0.875rem;
    border: 1px solid var(--ppsa-border-light);
}
.team-card .team-label {
    font-size: 9.5px;
    text-transform: uppercase;
    letter-spacing: 0.35px;
    color: var(--ppsa-text-tertiary);
    font-weight: 600;
    margin-bottom: 0.65rem;
    padding-bottom: 0.4rem;
    border-bottom: 1px solid var(--ppsa-border-light);
}

tr.clickable { cursor: pointer; }
tr.clickable:hover { background: #eff5fd !important; }

.mono { font-family: 'IBM Plex Mono', monospace; }
.text-gold { color: var(--ppsa-gold) !important; }
.text-gold-light { color: var(--ppsa-gold-light) !important; }
.text-navy { color: var(--ppsa-navy) !important; }
.bg-gold-subtle { background: rgba(200,149,26,0.15) !important; }
.bg-gold-transparent { background: rgba(200,149,26,0.25) !important; }
.text-xs { font-size: 10.5px; }

.search-input-icon { position: relative; }
.search-input-icon .form-control { padding-left: 2.2rem; }
.search-input-icon .search-icon {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--ppsa-text-tertiary);
    pointer-events: none;
}

.empty-state {
    padding: 3rem;
    text-align: center;
    color: var(--ppsa-text-tertiary);
}

@media (max-width: 991.98px) {
    .app-sidebar { transform: translateX(-100%); }
    .app-sidebar.show { transform: translateX(0); }
    .app-main { margin-left: 0; }
    .fin-grid { grid-template-columns: 1fr; }
}
