/* =========================================================
   Tampilan Sistem PBM - PT APS
   Warna mengikuti logo APS:
   biru (lingkaran logo), hijau & merah (bagian bawah logo), abu-abu (cincin logo)
   ========================================================= */

:root {
    --aps-blue: #014784;
    --aps-blue-dark: #01396b;
    --aps-blue-darker: #002a52;
    --aps-green: #62af20;
    --aps-green-text: #3d7a12;
    --aps-green-soft: #eef6e3;
    --aps-red: #e30f1f;
    --aps-gray: #888a8c;
    --aps-gray-soft: #eef1f4;

    --pbm-bg: #f3f5f8;
    --pbm-surface: #ffffff;
    --pbm-border: #e2e7ee;
    --pbm-text: #1b2533;
    --pbm-muted: #667085;
    --pbm-radius: 12px;

    --bs-body-font-family: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
    --bs-body-color: var(--pbm-text);
    --bs-body-bg: var(--pbm-bg);
    --bs-primary: var(--aps-blue);
    --bs-primary-rgb: 1, 71, 132;
}

body {
    background: var(--pbm-bg);
    color: var(--pbm-text);
}

.btn-primary {
    --bs-btn-bg: var(--aps-blue);
    --bs-btn-border-color: var(--aps-blue);
    --bs-btn-hover-bg: var(--aps-blue-dark);
    --bs-btn-hover-border-color: var(--aps-blue-dark);
    --bs-btn-active-bg: var(--aps-blue-darker);
    --bs-btn-active-border-color: var(--aps-blue-darker);
    font-weight: 600;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--aps-blue);
    box-shadow: 0 0 0 .2rem rgba(1, 71, 132, .15);
}

/* Garis khas APS: merah | hijau seperti bagian bawah logo */
.aps-stripe {
    height: 4px;
    background: linear-gradient(90deg, var(--aps-red) 0 50%, var(--aps-green) 50% 100%);
}

/* ---------- Logo ---------- */
.brand-logo {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #fff;
    padding: 2px;
    object-fit: contain;
    flex-shrink: 0;
}

.brand-logo-lg {
    width: 96px;
    height: 96px;
    padding: 4px;
    box-shadow: 0 0 0 4px rgba(255, 255, 255, .12);
}

/* Cadangan kalau file logo belum ada */
.brand-mark {
    display: none;
    place-items: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #fff;
    color: var(--aps-blue);
    font-size: 1.2rem;
    flex-shrink: 0;
}

.brand-mark-lg {
    width: 96px;
    height: 96px;
    font-size: 2.4rem;
}

/* ---------- Kerangka halaman ---------- */
.app {
    display: flex;
    min-height: 100vh;
}

.main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.content {
    padding: 24px;
    max-width: 1200px;
    width: 100%;
}

/* ---------- Sidebar ---------- */
.sidebar {
    /* !important karena Bootstrap .offcanvas-lg membuat latar transparan di layar besar */
    background-color: var(--aps-blue-darker) !important;
    color: #dbe4ee;
    display: flex;
    flex-direction: column;
}

@media (min-width: 992px) {
    .sidebar {
        width: 256px;
        flex-shrink: 0;
        position: sticky;
        top: 0;
        height: 100vh;
    }
}

@media (max-width: 991.98px) {
    .sidebar.offcanvas-lg {
        --bs-offcanvas-width: 272px;
        --bs-offcanvas-bg: var(--aps-blue-darker);
    }
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px 20px 18px;
}

.brand-name {
    font-weight: 700;
    color: #fff;
    line-height: 1.2;
}

.brand-sub {
    font-size: .75rem;
    color: #a9bbd0;
}

.sidebar-nav {
    padding: 16px 12px;
    flex: 1;
    overflow-y: auto;
}

.nav-label {
    font-size: .7rem;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: #8ea3bb;
    padding: 0 10px 8px;
}

.nav-item-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    margin-bottom: 2px;
    border-radius: 8px;
    color: #cdd9e6;
    text-decoration: none;
    font-weight: 500;
    font-size: .925rem;
    border-left: 3px solid transparent;
}

.nav-item-link .bi {
    font-size: 1.05rem;
    width: 20px;
    text-align: center;
}

.nav-item-link:hover {
    background: rgba(255, 255, 255, .07);
    color: #fff;
}

.nav-item-link.active {
    background: var(--aps-blue);
    color: #fff;
    border-left-color: var(--aps-green);
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px 20px;
    border-top: 1px solid rgba(255, 255, 255, .08);
}

.avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--aps-blue);
    border: 2px solid var(--aps-green);
    color: #fff;
    display: grid;
    place-items: center;
    font-weight: 700;
    flex-shrink: 0;
}

.user-meta { min-width: 0; }

.user-name {
    color: #fff;
    font-weight: 600;
    font-size: .875rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-role {
    font-size: .75rem;
    color: #a8d672;
}

/* ---------- Topbar ---------- */
.topbar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 24px;
    background: var(--pbm-surface);
    border-bottom: 1px solid var(--pbm-border);
    position: sticky;
    top: 0;
    z-index: 10;
}

.topbar-title {
    font-size: 1.125rem;
    font-weight: 700;
    margin: 0;
}

.btn-icon {
    border: 1px solid var(--pbm-border);
    background: var(--pbm-surface);
    width: 38px;
    height: 38px;
    padding: 0;
    font-size: 1.25rem;
}

/* ---------- Komponen ---------- */
.welcome {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    background: var(--pbm-surface);
    border: 1px solid var(--pbm-border);
    border-left: 4px solid var(--aps-green);
    border-radius: var(--pbm-radius);
    padding: 22px 24px;
    margin-bottom: 20px;
}

.welcome h2 {
    font-size: 1.35rem;
    font-weight: 700;
    margin-bottom: 4px;
}

.eyebrow {
    font-size: .75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--aps-green-text);
    margin-bottom: 4px;
}

.panel {
    background: var(--pbm-surface);
    border: 1px solid var(--pbm-border);
    border-radius: var(--pbm-radius);
    padding: 20px 24px;
    margin-bottom: 20px;
}

.panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
}

.panel-head h3 {
    font-size: 1rem;
    font-weight: 700;
    margin: 0;
}

.form-panel { max-width: 640px; }

.stat-card {
    background: var(--pbm-surface);
    border: 1px solid var(--pbm-border);
    border-top: 3px solid var(--aps-blue);
    border-radius: var(--pbm-radius);
    padding: 16px 20px;
}

.stat-label {
    font-size: .8rem;
    color: var(--pbm-muted);
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.role-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 999px;
    background: var(--aps-gray-soft);
    color: var(--aps-blue);
    font-size: .8rem;
    font-weight: 600;
}

.table > :not(caption) > * > * {
    padding: .75rem .75rem;
}

.table thead th {
    font-size: .75rem;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--pbm-muted);
    font-weight: 600;
    background: #f8fafc;
}

/* Alur kerja di dashboard */
.flow {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 12px;
}

.flow li {
    display: flex;
    gap: 12px;
    padding: 14px;
    border: 1px solid var(--pbm-border);
    border-radius: 10px;
}

.flow li.is-mine {
    border-color: var(--aps-green);
    background: var(--aps-green-soft);
}

.flow-step {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--aps-gray-soft);
    color: var(--aps-blue);
    display: grid;
    place-items: center;
    font-weight: 700;
    font-size: .85rem;
    flex-shrink: 0;
}

.flow li.is-mine .flow-step {
    background: var(--aps-green-text);
    color: #fff;
}

.flow-title { font-weight: 600; }

.flow-desc {
    font-size: .85rem;
    color: var(--pbm-muted);
}

.feature-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.feature-list li {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 0;
    border-bottom: 1px solid var(--pbm-border);
}

.feature-list li:last-child { border-bottom: 0; }

.feature-list .bi {
    color: var(--aps-green);
    font-size: .7rem;
}

/* ---------- Halaman login ---------- */
.login-wrap {
    display: grid;
    grid-template-columns: 1.1fr 1fr;
    min-height: 100vh;
}

.login-side {
    position: relative;
    background:
        linear-gradient(160deg, rgba(0, 42, 82, .97), rgba(1, 71, 132, .93)),
        repeating-linear-gradient(90deg, transparent 0 46px, rgba(255, 255, 255, .03) 46px 48px);
    color: #dbe4ee;
    display: flex;
    align-items: center;
    padding: 48px;
}

.login-side .aps-stripe {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
}

.login-side-inner { max-width: 460px; }

.login-company {
    margin-top: 20px;
    font-size: .8rem;
    font-weight: 600;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: #a8d672;
}

.login-side h1 {
    color: #fff;
    font-size: 1.9rem;
    font-weight: 700;
    margin: 6px 0 12px;
    line-height: 1.25;
}

.login-side p { color: #bccbdb; }

.flow-mini {
    list-style: none;
    padding: 0;
    margin: 28px 0 0;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.flow-mini li {
    padding: 6px 12px;
    border: 1px solid rgba(255, 255, 255, .2);
    border-radius: 999px;
    font-size: .8rem;
    color: #fff;
}

.flow-mini li + li::before {
    content: "\2192";
    margin-right: 8px;
    color: var(--aps-green);
}

.login-form-side {
    display: grid;
    place-items: center;
    padding: 32px 16px;
}

.login-card {
    width: 100%;
    max-width: 380px;
}

.login-card h2 {
    font-weight: 700;
    font-size: 1.6rem;
}

@media (max-width: 860px) {
    .login-wrap { grid-template-columns: 1fr; }
    .login-side { padding: 32px 20px 36px; }
    .login-side h1 { font-size: 1.4rem; }
    .brand-logo-lg, .brand-mark-lg { width: 72px; height: 72px; }
    .content { padding: 16px; }
    .topbar { padding: 12px 16px; }
}

/* ---------- Tambahan: menu berkelompok, tabel data, detail manifest ---------- */
.nav-label + .nav-item-link { margin-top: 0; }
.sidebar-nav .nav-label:not(:first-child) { margin-top: 14px; }

.toolbar {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.toolbar .search {
    display: flex;
    gap: 8px;
    flex: 1;
    max-width: 420px;
}

.num {
    text-align: right;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.cell-wrap {
    max-width: 320px;
    white-space: normal;
}

.text-mono {
    font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
    font-size: .875rem;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 14px 24px;
    margin: 0;
}

.info-grid dt {
    font-size: .75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--pbm-muted);
}

.info-grid dd {
    margin: 2px 0 0;
    font-weight: 500;
}

.table tfoot td {
    font-weight: 700;
    background: #f8fafc;
}

.empty-state {
    text-align: center;
    padding: 32px 16px;
    color: var(--pbm-muted);
}

.empty-state .bi {
    font-size: 2rem;
    display: block;
    margin-bottom: 8px;
}

.form-section-title {
    font-size: .8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--aps-blue);
    margin: 8px 0 12px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--pbm-border);
}

.form-wide { max-width: 920px; }

/* Kotak "Hitung tarif otomatis" di form invoice */
.kotak-tarif {
    background: var(--aps-green-soft);
    border: 1px solid #cfe5b5;
    border-radius: 10px;
    padding: 14px 16px;
}
