@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Plus+Jakarta+Sans:wght@600;700;800&display=swap');

:root {
    --rp-navy: #0B1E38;
    --rp-navy-light: #132E52;
    --rp-navy-brand: #003366;
    --rp-orange: #F7941D;
    --rp-orange-hover: #E07D0B;
    --rp-orange-soft: rgba(247, 148, 29, 0.12);
    --rp-bg: #F4F6FA;
    --rp-surface: #FFFFFF;
    --rp-border: #E5E9F2;
    --rp-text: #0F172A;
    --rp-muted: #64748B;
    --rp-sidebar-w: 264px;
    --rp-topbar-h: 68px;
    --rp-radius: 14px;
    --rp-radius-sm: 10px;
}

* {
    box-sizing: border-box;
}

html, body {
    height: 100%;
    margin: 0;
    padding: 0;
    background-color: var(--rp-bg);
    color: var(--rp-text);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6, .rp-heading {
    font-family: 'Plus Jakarta Sans', 'Inter', sans-serif;
    letter-spacing: -0.02em;
}

.tabular-nums {
    font-variant-numeric: tabular-nums;
}

/* =========================================
   App Shell Layout
   ========================================= */
.rp-shell {
    display: flex;
    min-height: 100vh;
}

.rp-sidebar {
    width: var(--rp-sidebar-w);
    background: linear-gradient(180deg, #09182E 0%, #0D2240 100%);
    color: #CBD5E1;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 1030;
    display: flex;
    flex-direction: column;
    border-right: 1px solid rgba(255, 255, 255, 0.06);
    transition: transform 0.25s ease;
}

.rp-sidebar-brand {
    padding: 20px 20px 18px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
    text-decoration: none;
}

.rp-sidebar-logo-box {
    width: 40px;
    height: 40px;
    border-radius: 11px;
    background: rgba(255, 255, 255, 0.96);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 5px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.22);
    flex-shrink: 0;
}

.rp-sidebar-logo-box img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.rp-brand-title {
    color: #FFFFFF;
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-weight: 700;
    font-size: 16px;
    line-height: 1.15;
}

.rp-brand-sub {
    color: #94A3B8;
    font-size: 11px;
    font-weight: 500;
}

.rp-sidebar-nav {
    flex: 1;
    padding: 18px 14px;
    overflow-y: auto;
}

.rp-nav-section {
    font-size: 10.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #64748B;
    padding: 14px 12px 6px;
}

.rp-nav-section:first-child {
    padding-top: 2px;
}

.rp-nav-link {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 10px 12px;
    margin-bottom: 3px;
    border-radius: 10px;
    color: #CBD5E1;
    text-decoration: none;
    font-weight: 500;
    font-size: 13.5px;
    transition: all 0.16s ease;
    position: relative;
}

.rp-nav-link i {
    font-size: 16px;
    opacity: 0.85;
    width: 20px;
    text-align: center;
}

.rp-nav-link:hover {
    background: rgba(255, 255, 255, 0.07);
    color: #FFFFFF;
}

.rp-nav-link.active {
    background: linear-gradient(90deg, rgba(247, 148, 29, 0.2) 0%, rgba(247, 148, 29, 0.06) 100%);
    color: #FFFFFF;
    font-weight: 600;
}

.rp-nav-link.active::before {
    content: "";
    position: absolute;
    left: 0;
    top: 8px;
    bottom: 8px;
    width: 3px;
    border-radius: 0 3px 3px 0;
    background: var(--rp-orange);
}

.rp-nav-link.active i {
    color: var(--rp-orange);
    opacity: 1;
}

.rp-sidebar-footer {
    padding: 14px;
    border-top: 1px solid rgba(255, 255, 255, 0.07);
    background: rgba(0, 0, 0, 0.14);
}

.rp-user-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.05);
}

.rp-avatar {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--rp-orange), #FB923C);
    color: #FFFFFF;
    font-weight: 700;
    font-size: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.rp-avatar-sm {
    width: 34px;
    height: 34px;
    border-radius: 9px;
    background: #EFF4FF;
    color: var(--rp-navy-brand);
    font-weight: 700;
    font-size: 12.5px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.rp-main {
    margin-left: var(--rp-sidebar-w);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.rp-topbar {
    height: var(--rp-topbar-h);
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--rp-border);
    padding: 0 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 1010;
}

.rp-content {
    padding: 26px 28px 40px;
    flex: 1;
    max-width: 1440px;
    width: 100%;
    margin: 0 auto;
}

/* Mobile Sidebar */
.rp-sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    z-index: 1025;
}

@media (max-width: 991.98px) {
    .rp-sidebar {
        transform: translateX(-100%);
    }
    .rp-sidebar.open {
        transform: translateX(0);
    }
    .rp-sidebar-backdrop.show {
        display: block;
    }
    .rp-main {
        margin-left: 0;
    }
    .rp-topbar {
        padding: 0 16px;
    }
    .rp-content {
        padding: 20px 16px 32px;
    }
}

/* =========================================
   Language Switcher Pill
   ========================================= */
.rp-lang-switch {
    display: inline-flex;
    align-items: center;
    background: #F1F5F9;
    border: 1px solid #E2E8F0;
    border-radius: 999px;
    padding: 3px;
    gap: 2px;
}

.rp-lang-switch a {
    font-size: 11.5px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 999px;
    text-decoration: none;
    color: #64748B;
    transition: all 0.15s ease;
}

.rp-lang-switch a.active {
    background: #FFFFFF;
    color: var(--rp-navy);
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.12);
}

/* =========================================
   Cards, KPIs, Tables, Forms
   ========================================= */
.rp-card {
    background: var(--rp-surface);
    border: 1px solid var(--rp-border);
    border-radius: var(--rp-radius);
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.03);
}

.rp-card-header {
    padding: 18px 22px;
    border-bottom: 1px solid var(--rp-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.rp-card-body {
    padding: 22px;
}

.rp-kpi {
    background: var(--rp-surface);
    border: 1px solid var(--rp-border);
    border-radius: var(--rp-radius);
    padding: 20px 22px;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    height: 100%;
}

.rp-kpi:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px -10px rgba(15, 23, 42, 0.1);
}

.rp-kpi-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.rp-kpi-icon.navy { background: #EBF2FF; color: #0B3D91; }
.rp-kpi-icon.orange { background: #FFF4E5; color: #D97706; }
.rp-kpi-icon.green { background: #ECFDF5; color: #059669; }
.rp-kpi-icon.indigo { background: #EEF2FF; color: #4F46E5; }

.rp-kpi-label {
    font-size: 12.5px;
    font-weight: 500;
    color: var(--rp-muted);
    margin-bottom: 6px;
}

.rp-kpi-value {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 26px;
    font-weight: 800;
    color: var(--rp-text);
    line-height: 1.15;
}

.rp-kpi-meta {
    font-size: 12px;
    color: var(--rp-muted);
    margin-top: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

/* Modern Table */
.rp-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 0;
}

.rp-table thead th {
    background: #F8FAFC;
    color: #64748B;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 13px 18px;
    border-bottom: 1px solid var(--rp-border);
    white-space: nowrap;
}

.rp-table tbody td {
    padding: 15px 18px;
    border-bottom: 1px solid #F1F5F9;
    vertical-align: middle;
    color: #1E293B;
}

.rp-table tbody tr:last-child td {
    border-bottom: none;
}

.rp-table tbody tr:hover {
    background-color: #FAFBFD;
}

/* Buttons */
.btn-rp-primary {
    background: var(--rp-orange);
    color: #FFFFFF;
    border: none;
    font-weight: 600;
    border-radius: 10px;
    padding: 9px 16px;
    font-size: 13.5px;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    transition: all 0.15s ease;
}

.btn-rp-primary:hover {
    background: var(--rp-orange-hover);
    color: #FFFFFF;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(247, 148, 29, 0.28);
}

.btn-rp-navy {
    background: var(--rp-navy);
    color: #FFFFFF;
    border: none;
    font-weight: 600;
    border-radius: 10px;
    padding: 9px 16px;
    font-size: 13.5px;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    transition: all 0.15s ease;
}

.btn-rp-navy:hover {
    background: var(--rp-navy-light);
    color: #FFFFFF;
}

.btn-rp-outline {
    background: #FFFFFF;
    color: #334155;
    border: 1px solid #DCE3EE;
    font-weight: 600;
    border-radius: 10px;
    padding: 8px 14px;
    font-size: 13px;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    transition: all 0.15s ease;
}

.btn-rp-outline:hover {
    background: #F8FAFC;
    border-color: #CBD5E1;
    color: #0F172A;
}

/* Status Pills */
.rp-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 11px;
    border-radius: 999px;
    font-size: 11.5px;
    font-weight: 600;
    white-space: nowrap;
}

.rp-badge::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

.rp-badge-new { background: #FEF3C7; color: #B45309; }
.rp-badge-qualified, .rp-badge-completed, .rp-badge-active { background: #DCFCE7; color: #15803D; }
.rp-badge-rejected, .rp-badge-inactive { background: #FEE2E2; color: #B91C1C; }
.rp-badge-info, .rp-badge-indiscussion { background: #DBEAFE; color: #1D4ED8; }
.rp-badge-finalizing { background: #EDE9FE; color: #6D28D9; }
.rp-badge-draft { background: #F1F5F9; color: #475569; }
.rp-badge-datacollection { background: #FFEDD5; color: #C2410C; }

.rp-source-tag {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    border-radius: 7px;
    font-size: 11.5px;
    font-weight: 600;
    background: #F1F5F9;
    color: #334155;
    border: 1px solid #E2E8F0;
}

.rp-source-tag.website {
    background: #EFF6FF;
    color: #1D4ED8;
    border-color: #BFDBFE;
}

/* Form Controls */
.form-control, .form-select {
    border-radius: 10px;
    border: 1px solid #D8E0EC;
    padding: 9px 13px;
    font-size: 13.5px;
    color: var(--rp-text);
}

.form-control:focus, .form-select:focus {
    border-color: var(--rp-orange);
    box-shadow: 0 0 0 3px rgba(247, 148, 29, 0.16);
}

.form-label {
    font-size: 13px;
    font-weight: 600;
    color: #334155;
    margin-bottom: 6px;
}

/* SOP Stepper */
.rp-stepper {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
}

@media (max-width: 767.98px) {
    .rp-stepper {
        grid-template-columns: repeat(2, 1fr);
    }
}

.rp-step {
    background: #F8FAFC;
    border: 1px solid var(--rp-border);
    border-radius: 11px;
    padding: 12px 14px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.rp-step.done {
    background: #F0FDF4;
    border-color: #BBF7D0;
}

.rp-step.current {
    background: #FFF7ED;
    border-color: var(--rp-orange);
    box-shadow: 0 0 0 3px rgba(247, 148, 29, 0.12);
}

.rp-step-num {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    font-size: 12px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #E2E8F0;
    color: #475569;
    flex-shrink: 0;
}

.rp-step.done .rp-step-num {
    background: #16A34A;
    color: #FFFFFF;
}

.rp-step.current .rp-step-num {
    background: var(--rp-orange);
    color: #FFFFFF;
}

/* Audit Log Timeline */
.rp-timeline {
    position: relative;
    padding-left: 22px;
}

.rp-timeline::before {
    content: "";
    position: absolute;
    left: 7px;
    top: 6px;
    bottom: 6px;
    width: 2px;
    background: #E2E8F0;
}

.rp-timeline-item {
    position: relative;
    padding-bottom: 16px;
}

.rp-timeline-item:last-child {
    padding-bottom: 0;
}

.rp-timeline-dot {
    position: absolute;
    left: -19px;
    top: 5px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--rp-orange);
    border: 2px solid #FFFFFF;
    box-shadow: 0 0 0 2px #FED7AA;
}

/* Alerts */
.rp-alert {
    border-radius: 12px;
    border: 1px solid transparent;
    padding: 13px 18px;
    font-size: 13.5px;
    font-weight: 500;
}

.needs-preview {
    max-width: 280px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    font-size: 12.5px;
    color: #475569;
    line-height: 1.45;
}

/* Compatibility brand utilities for SOP 3 / SOP 4 / SOP 5 views */
.btn-rapiora-orange {
    background-color: var(--rp-orange) !important;
    border: none;
    color: #FFFFFF !important;
    font-weight: 600;
    border-radius: 10px;
}

.btn-rapiora-orange:hover {
    background-color: var(--rp-orange-hover) !important;
    color: #FFFFFF !important;
}

.text-navy {
    color: var(--rp-navy-brand) !important;
}

.bg-rapiora-navy {
    background-color: var(--rp-navy) !important;
    color: #FFFFFF;
}