:root {
    --p29-blue: #2b3e94;
    --p29-mid: #2286b0;
    --p29-cyan: #25d8c9;
    --p29-gradient: linear-gradient(160deg, #2b3e94 0%, #2286b0 48%, #25d8c9 100%);

    --primary: #2b3e94;
    --primary-dark: #1f2d6e;
    --secondary: #2286b0;
    --accent: #25d8c9;
    --background: #eef2f8;
    --surface: #ffffff;
    --text: #121826;
    --text-muted: #5a6578;
    --sidebar-bg: #000000;
    --sidebar-text: rgba(255, 255, 255, 0.78);
    --sidebar-text-active: #ffffff;
    --sidebar-width: 260px;
    --navbar-height: 64px;
    --radius: 0.5rem;
    --border: #d7dee9;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    background-color: var(--background);
    color: var(--text);
    font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
    min-height: 100vh;
}

a {
    color: var(--secondary);
    text-decoration: none;
}

a:hover {
    color: var(--primary);
}

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

.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    z-index: 1040;
    overflow-y: auto;
    padding: 1.25rem 0;
    transition: transform 0.25s ease;
    border-right: 1px solid rgba(37, 216, 201, 0.12);
}

.sidebar-brand {
    padding: 0 1.25rem 1.35rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    margin-bottom: 1rem;
}

.sidebar-brand a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--sidebar-text-active);
    font-weight: 700;
    font-size: 1.1rem;
    letter-spacing: 0.02em;
}

.sidebar-brand-logo {
    width: auto;
    height: 40px;
    object-fit: contain;
}

.sidebar-brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.15;
}

.sidebar-brand-text small {
    font-size: 0.7rem;
    font-weight: 500;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: rgba(37, 216, 201, 0.85);
}

.sidebar-brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 0.4rem;
    background: var(--p29-gradient);
    color: #fff;
    font-size: 0.85rem;
    font-weight: 700;
}

.sidebar-nav {
    list-style: none;
    margin: 0;
    padding: 0 0.75rem;
}

.sidebar-nav .nav-label {
    padding: 0.5rem 0.75rem;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: rgba(255, 255, 255, 0.4);
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.65rem 0.75rem;
    border-radius: var(--radius);
    color: var(--sidebar-text);
    margin-bottom: 0.15rem;
    font-size: 0.95rem;
    border-left: 3px solid transparent;
}

.sidebar-nav a:hover {
    background: rgba(37, 216, 201, 0.08);
    color: var(--sidebar-text-active);
}

.sidebar-nav a.active {
    background: linear-gradient(90deg, rgba(43, 62, 148, 0.45), rgba(37, 216, 201, 0.12));
    color: var(--sidebar-text-active);
    border-left-color: var(--accent);
}

.sidebar-nav a.disabled {
    opacity: 0.45;
    pointer-events: none;
}

.sidebar-nav a i {
    color: var(--accent);
    opacity: 0.9;
}

.topbar {
    position: fixed;
    top: 0;
    left: var(--sidebar-width);
    right: 0;
    height: var(--navbar-height);
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    z-index: 1030;
}

.topbar::before {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 2px;
    background: var(--p29-gradient);
    opacity: 0.85;
}

.topbar-title {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text);
}

.topbar-meta {
    color: var(--text-muted);
    font-size: 0.875rem;
}

.main-content {
    margin-left: var(--sidebar-width);
    padding-top: var(--navbar-height);
    min-height: 100vh;
}

.main-content > .container-fluid {
    padding: 1.5rem;
}

.page-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
}

.page-card h1 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.page-card p {
    color: var(--text-muted);
}

.rab-form .rab-section > p {
    margin-bottom: 0.85rem;
}

.page-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.page-toolbar .toolbar-title {
    margin: 0;
    align-self: center;
    font-size: 1.1rem;
    font-weight: 600;
}

.toolbar-filters {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    flex: 1 1 auto;
    min-width: 0;
}

.toolbar-filters .form-control {
    flex: 1 1 200px;
    min-width: 180px;
    max-width: 320px;
}

.toolbar-filters .suggest-wrap {
    position: relative;
    flex: 1 1 200px;
    min-width: 180px;
    max-width: 320px;
}

.toolbar-filters .suggest-wrap .form-control {
    max-width: none;
    width: 100%;
}

.suggest-list {
    position: absolute;
    z-index: 30;
    top: calc(100% + 2px);
    left: 0;
    right: 0;
    margin: 0;
    padding: 0.25rem 0;
    list-style: none;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 0.45rem;
    box-shadow: 0 0.5rem 1.25rem rgba(16, 24, 40, 0.1);
    max-height: 16rem;
    overflow: auto;
}

.suggest-item {
    display: block;
    width: 100%;
    padding: 0.4rem 0.7rem;
    border: 0;
    background: transparent;
    text-align: left;
    cursor: pointer;
}

.suggest-item:hover,
.suggest-item.is-active {
    background: #eef1fb;
}

.suggest-item code {
    font-size: 0.78rem;
}

.suggest-item .suggest-name {
    display: block;
    color: #4b5563;
    font-size: 0.82rem;
    line-height: 1.3;
}

.searchable-select {
    position: relative;
}

.searchable-select-native {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.suggest-empty {
    padding: 0.45rem 0.7rem;
    color: #6b7280;
    font-size: 0.85rem;
}

.product-thumb {
    display: block;
    object-fit: contain;
    background: #f8f9fb;
}

.product-thumb-sm,
.product-thumb-placeholder.product-thumb-sm {
    width: 40px;
    height: 40px;
}

.product-thumb-md,
.product-thumb-placeholder.product-thumb-md {
    width: 96px;
    height: 96px;
}

.product-thumb-lg {
    width: auto;
    height: auto;
    max-width: 280px;
    max-height: 280px;
}

.product-thumb-placeholder.product-thumb-lg {
    width: 180px;
    height: 180px;
}

.product-image-trigger {
    cursor: zoom-in;
}

.product-image-trigger .product-thumb {
    display: block;
}

.product-image-modal-img {
    max-width: 100%;
    max-height: 80vh;
    width: auto;
    height: auto;
    object-fit: contain;
}

.toolbar-filters .form-select {
    flex: 0 0 auto;
    width: auto;
    min-width: 150px;
}

.toolbar-filters .btn {
    flex: 0 0 auto;
}

.toolbar-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-left: auto;
}

@media (max-width: 575.98px) {
    .toolbar-filters,
    .toolbar-actions {
        width: 100%;
    }

    .toolbar-filters .form-control,
    .toolbar-filters .form-select,
    .toolbar-filters .suggest-wrap {
        max-width: none;
        width: 100%;
    }

    .toolbar-filters .btn,
    .toolbar-actions .btn {
        flex: 1 1 auto;
    }

    .toolbar-actions {
        justify-content: flex-start;
        margin-left: 0;
    }
}

.badge-phase {
    display: inline-block;
    background: linear-gradient(90deg, rgba(43, 62, 148, 0.12), rgba(37, 216, 201, 0.16));
    color: var(--primary);
    border-radius: 999px;
    padding: 0.25rem 0.75rem;
    font-size: 0.8rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 1035;
}

.sidebar-toggle {
    display: none;
    border: 1px solid var(--border);
    background: var(--surface);
    border-radius: var(--radius);
    width: 40px;
    height: 40px;
    align-items: center;
    justify-content: center;
    color: var(--text);
}

@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(-100%);
    }

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

    .sidebar-backdrop.is-visible {
        display: block;
    }

    .topbar {
        left: 0;
    }

    .main-content {
        margin-left: 0;
    }

    .sidebar-toggle {
        display: inline-flex;
    }
}

.auth-body {
    min-height: 100vh;
    background:
        radial-gradient(ellipse at top right, rgba(37, 216, 201, 0.22), transparent 42%),
        radial-gradient(ellipse at bottom left, rgba(43, 62, 148, 0.45), transparent 48%),
        linear-gradient(160deg, #05070f 0%, #0b1224 55%, #121a2e 100%);
}

.auth-main {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

.auth-card {
    width: 100%;
    max-width: 420px;
    background: var(--surface);
    border: 1px solid rgba(37, 216, 201, 0.2);
    border-radius: 0.85rem;
    padding: 2rem;
    box-shadow:
        0 0 0 1px rgba(43, 62, 148, 0.08),
        0 18px 48px rgba(0, 0, 0, 0.35);
}

.auth-brand {
    display: flex;
    align-items: center;
    gap: 0.85rem;
}

.auth-brand-logo {
    width: 54px;
    height: 60px;
    padding: 8px;
    border-radius: 0.55rem;
    background: var(--p29-gradient);
    object-fit: contain;
}

.auth-brand strong {
    color: var(--primary);
}

.btn-primary {
    --bs-btn-bg: var(--primary);
    --bs-btn-border-color: var(--primary);
    --bs-btn-hover-bg: var(--primary-dark);
    --bs-btn-hover-border-color: var(--primary-dark);
    --bs-btn-active-bg: var(--primary-dark);
    --bs-btn-active-border-color: var(--primary-dark);
    --bs-btn-focus-shadow-rgb: 43, 62, 148;
}

.btn-outline-secondary {
    --bs-btn-color: var(--text-muted);
    --bs-btn-border-color: var(--border);
    --bs-btn-hover-bg: #f3f6fb;
    --bs-btn-hover-border-color: var(--secondary);
    --bs-btn-hover-color: var(--primary);
}

.quick-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.15rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-weight: 600;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.quick-link:hover {
    border-color: var(--accent);
    color: var(--primary);
    box-shadow: 0 4px 16px rgba(43, 62, 148, 0.1);
}

.quick-link i {
    font-size: 1.25rem;
    color: var(--secondary);
}

.table thead th {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    border-bottom-width: 1px;
}

.form-label {
    font-weight: 600;
    font-size: 0.875rem;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 0.2rem rgba(37, 216, 201, 0.2);
}

.pagination .page-link {
    color: var(--primary);
}

.pagination .page-item.active .page-link {
    background: var(--primary);
    border-color: var(--primary);
}

.rab-section {
    padding: 1.15rem 0 0.15rem;
    border-top: 1px solid var(--border);
    margin-top: 0.35rem;
}

.rab-section:first-of-type {
    border-top: 0;
    padding-top: 0;
    margin-top: 0;
}

.rab-section-title {
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--primary);
    margin: 0 0 0.2rem;
}

.scheme-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.65rem;
}

.scheme-option {
    display: block;
    margin: 0;
    padding: 0.85rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: #f7f9fc;
    cursor: pointer;
    height: 100%;
    transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.scheme-option-title {
    display: block;
    font-weight: 700;
    color: var(--text);
}

.scheme-option-desc {
    display: block;
    margin-top: 0.15rem;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.btn-check:checked + .scheme-option {
    border-color: var(--primary);
    background: #eef1fb;
    box-shadow: 0 0 0 3px rgba(43, 62, 148, 0.12);
}

.btn-check:focus-visible + .scheme-option {
    box-shadow: 0 0 0 0.2rem rgba(37, 216, 201, 0.35);
}

.rab-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.65rem;
}

.rab-stat {
    background: #f7f9fc;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.7rem 0.85rem;
}

.rab-stat span {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 0.15rem;
}

.rab-stat strong {
    font-size: 0.95rem;
}

.rab-stat-formula {
    display: block;
    margin-top: 0.3rem;
    font-size: 0.7rem;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    line-height: 1.35;
    color: #6b7280;
    word-break: break-word;
}

.rab-stat-fee .rab-stat-formula {
    color: #3d7a6e;
}

.rab-stats-breakdown {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.rab-preview-groups {
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
}

.rab-preview-group-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 0.4rem;
}

.rab-stats-margins {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.rab-stats-charges {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.rab-stat-total {
    background: #eef1fb;
    border-color: #c5cce3;
}

@media (max-width: 991.98px) {
    .rab-stats-margins,
    .rab-stats-charges {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

.rab-stat-fee {
    background: #e8f8f4;
    border-color: #9ad8cc;
}

.rab-stat-fee span {
    color: #1a6b5c;
}

.rab-form-actions {
    padding-top: 1.25rem;
    margin-top: 1.25rem;
    border-top: 1px solid var(--border);
}

.rab-field-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
    max-width: 52rem;
}

.rab-field .form-label {
    display: block;
    margin-bottom: 0.35rem;
}

.rab-field .input-group {
    width: 100%;
}

.rab-field .form-control.is-locked {
    background-color: #eef1f5;
    color: #6b7785;
    cursor: not-allowed;
    pointer-events: none;
}

.rab-items-table,
.rab-pass-table {
    table-layout: fixed;
    width: 100%;
}

.rab-items-table th,
.rab-items-table td,
.rab-pass-table th,
.rab-pass-table td {
    vertical-align: middle;
}

.rab-col-sku { width: 7.5rem; }
.rab-col-type { width: 5.5rem; }
.rab-col-qty { width: 4rem; }
.rab-col-money { width: 8.5rem; }

.rab-item-totals {
    max-width: none;
    grid-template-columns: repeat(6, minmax(0, 1fr));
}

@media (max-width: 991.98px) {
    .rab-item-totals {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}
.rab-col-check { width: 6.75rem; }
.rab-col-input { width: 8.5rem; }

.rab-fee-pic-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    cursor: pointer;
    user-select: none;
}

.rab-fee-pic-toggle-input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.rab-fee-pic-toggle-ui {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.2rem 0.55rem 0.2rem 0.28rem;
    border: 1px solid #9ad8cc;
    border-radius: 0;
    background: #f3fbf9;
    color: #1a6b5c;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.7);
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.rab-fee-pic-toggle-mark {
    position: relative;
    width: 1.05rem;
    height: 1.05rem;
    border-radius: 0;
    border: 1.5px solid #6bb8aa;
    background: #fff;
    flex: 0 0 auto;
}

.rab-fee-pic-toggle-mark i {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.78rem;
    line-height: 1;
    opacity: 0;
    transform: scale(0.7);
    transition: opacity 0.12s ease, transform 0.12s ease, color 0.12s ease;
}

.rab-fee-pic-toggle-mark .bi-dash-lg {
    font-size: 0.7rem;
}

.rab-fee-pic-toggle-text {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    line-height: 1;
    white-space: nowrap;
}

.rab-fee-pic-toggle:hover .rab-fee-pic-toggle-ui {
    border-color: #1a6b5c;
    background: #e8f8f4;
}

.rab-fee-pic-toggle-input:focus-visible + .rab-fee-pic-toggle-ui {
    box-shadow: 0 0 0 3px rgba(26, 107, 92, 0.18);
}

.rab-fee-pic-toggle-input:checked + .rab-fee-pic-toggle-ui {
    background: #1a6b5c;
    border-color: #1a6b5c;
    color: #fff;
    box-shadow: none;
}

.rab-fee-pic-toggle-input:checked + .rab-fee-pic-toggle-ui .rab-fee-pic-toggle-mark {
    background: #fff;
    border-color: #fff;
}

.rab-fee-pic-toggle-input:checked + .rab-fee-pic-toggle-ui .bi-check-lg {
    opacity: 1;
    transform: scale(1);
    color: #1a6b5c;
}

.rab-fee-pic-toggle-input:indeterminate + .rab-fee-pic-toggle-ui {
    background: #d8f3ec;
    border-color: #3d9d8c;
    color: #14574b;
}

.rab-fee-pic-toggle-input:indeterminate + .rab-fee-pic-toggle-ui .rab-fee-pic-toggle-mark {
    background: #1a6b5c;
    border-color: #1a6b5c;
}

.rab-fee-pic-toggle-input:indeterminate + .rab-fee-pic-toggle-ui .bi-dash-lg {
    opacity: 1;
    transform: scale(1);
    color: #fff;
}

.rab-items-table .rab-is-titipan {
    display: block;
    margin: 0 auto;
    float: none;
    position: static;
}

.rab-items-table .form-control,
.rab-pass-table .form-control {
    min-width: 0;
    width: 100%;
}

.rab-pass-table .rab-col-pass-money { width: 11rem; }
.rab-pass-table .rab-col-pass-action { width: 3rem; }

@media (max-width: 991.98px) {
    .rab-field-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        max-width: none;
    }
}

@media (max-width: 767.98px) {
    .scheme-grid,
    .rab-stats,
    .rab-field-grid {
        grid-template-columns: 1fr;
    }
}
