/* =====================================================================
   PT. Wiguna Sarana Sejahtera - CRM Portal
   Lapis Blue (#1E3A8A / #274472) + White Tusk Cream (#FDFBF7)
   ===================================================================== */

body {
    font-family: 'Plus Jakarta Sans', sans-serif;
    background-color: #FDFBF7;
    color: #1F2937;
}

/* Charts must not grow unbounded inside a flex parent. */
.chart-container {
    position: relative;
    width: 100%;
    max-width: 100%;
    margin-left: auto;
    margin-right: auto;
    height: 280px;
    max-height: 360px;
}

@media (min-width: 768px) {
    .chart-container { height: 320px; }
}

/* Tables scroll inside their own box so the page never scrolls sideways. */
.table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: #F8F4EC; }
::-webkit-scrollbar-thumb { background: #CBD5E1; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #274472; }

.nav-btn.active {
    background-color: #274472;
    color: #ffffff;
    box-shadow: inset 3px 0 0 #FDFBF7;
}

/* Status and priority badges - shared by every table. */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.15rem 0.6rem;
    border-radius: 9999px;
    font-size: 0.7rem;
    font-weight: 600;
    line-height: 1.4;
    white-space: nowrap;
}

.badge-menang          { background: #DCFCE7; color: #166534; }
.badge-kalah           { background: #FEE2E2; color: #991B1B; }
.badge-negosiasi       { background: #DBEAFE; color: #1E40AF; }
.badge-belum-ada-harga { background: #FEF3C7; color: #92400E; }
.badge-tidak-aktif     { background: #F1F5F9; color: #475569; }

.badge-high   { background: #FEE2E2; color: #991B1B; }
.badge-medium { background: #FEF3C7; color: #92400E; }
.badge-low    { background: #E0F2FE; color: #075985; }
.badge-none   { background: #F1F5F9; color: #64748B; }

.badge-sudah-follow-up { background: #DCFCE7; color: #166534; }
.badge-belum-follow-up { background: #FEF3C7; color: #92400E; }

.badge-current-customer { background: #DCFCE7; color: #166534; }
.badge-potensi-customer { background: #DBEAFE; color: #1E40AF; }
.badge-other            { background: #F1F5F9; color: #475569; }

/* Modals */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    z-index: 60;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 1rem;
    overflow-y: auto;
}

.modal-backdrop[hidden] { display: none; }

.modal-panel {
    background: #ffffff;
    border-radius: 1rem;
    width: 100%;
    max-width: 40rem;
    margin: 2rem auto;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.35);
}

.form-label {
    display: block;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #374151;
    margin-bottom: 0.25rem;
}

.form-input {
    width: 100%;
    padding: 0.55rem 0.85rem;
    background: #FDFBF7;
    border: 1px solid #E5E7EB;
    border-radius: 0.75rem;
    font-size: 0.875rem;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.form-input:focus {
    outline: none;
    border-color: #1E3A8A;
    box-shadow: 0 0 0 1px #1E3A8A;
}

.btn-primary {
    background: #274472;
    color: #ffffff;
    font-weight: 600;
    padding: 0.6rem 1.1rem;
    border-radius: 0.75rem;
    font-size: 0.8rem;
    transition: background-color 0.15s;
}

.btn-primary:hover { background: #1E3A8A; }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }

.btn-secondary {
    background: #F1F5F9;
    color: #334155;
    font-weight: 600;
    padding: 0.6rem 1.1rem;
    border-radius: 0.75rem;
    font-size: 0.8rem;
}

.btn-secondary:hover { background: #E2E8F0; }

/* Toast notifications */
#toast-host {
    position: fixed;
    right: 1rem;
    bottom: 1rem;
    z-index: 80;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-width: min(24rem, calc(100vw - 2rem));
}

.toast {
    padding: 0.75rem 1rem;
    border-radius: 0.75rem;
    font-size: 0.8rem;
    font-weight: 500;
    color: #ffffff;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.2);
    animation: toast-in 0.2s ease-out;
    word-break: break-word;
}

.toast-success { background: #15803D; }
.toast-error   { background: #B91C1C; }
.toast-info    { background: #274472; }

@keyframes toast-in {
    from { opacity: 0; transform: translateY(0.5rem); }
    to   { opacity: 1; transform: translateY(0); }
}

.skeleton-row td {
    color: transparent;
    background: linear-gradient(90deg, #F8F4EC 25%, #EFE8D8 50%, #F8F4EC 75%);
    background-size: 200% 100%;
    animation: shimmer 1.2s infinite;
}

@keyframes shimmer {
    from { background-position: 200% 0; }
    to   { background-position: -200% 0; }
}

@media print {
    aside, header, .no-print { display: none !important; }
}
