:root {
    --c-primary: #0B3C5D;
    --c-primary-600: #145A86;
    --c-teal: #1B998B;
    --c-coral: #FF6F59;
    --c-sand: #F7F5F0;
    --c-surface: #FFFFFF;
    --c-text: #1F2933;
    --c-muted: #6B7785;
    --c-border: #E3E7EC;
    --c-success: #2E9E5B;
    --c-warning: #E8A33D;
    --c-danger: #D64545;
}

body {
    font-family: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
    color: var(--c-text);
    background: var(--c-sand);
}

.text-primary-deep { color: var(--c-primary); }
.text-teal { color: var(--c-teal); }

.btn-primary-deep {
    background: var(--c-primary);
    border-color: var(--c-primary);
    color: #fff;
}
.btn-primary-deep:hover,
.btn-primary-deep:focus {
    background: var(--c-primary-600);
    border-color: var(--c-primary-600);
    color: #fff;
}

.btn-coral {
    background: var(--c-coral);
    border-color: var(--c-coral);
    color: #fff;
    font-weight: 600;
}
.btn-coral:hover,
.btn-coral:focus {
    background: #f25a43;
    border-color: #f25a43;
    color: #fff;
}

:focus-visible { outline: 2px solid var(--c-teal); outline-offset: 2px; }

/* Landing page */
.hero {
    background: linear-gradient(135deg, var(--c-primary) 0%, var(--c-primary-600) 55%, var(--c-teal) 100%);
    padding-bottom: 3rem;
}
.hero-logos {
  display: inline-flex; align-items: center; gap: 1.25rem; padding: 1.5rem 1.75rem;
  background: #fff; border-radius: 20px; box-shadow: 0 12px 32px rgba(0, 0, 0, .25);
}
.hero-logos img { max-height: 150px; width: auto; }
.hero-logos-divider { width: 1px; align-self: stretch; background: var(--c-border); }
.hero-logos-sm { gap: .75rem; padding: .6rem .9rem; border-radius: 14px; box-shadow: 0 6px 18px rgba(0, 0, 0, .2); }
.hero-logos-sm img { height: 52px; max-height: none; }
.hero-title { font-size: calc(1.45rem + 1.6vw); line-height: 1.2; }
.hero-lead { font-size: 1.15rem; }
@media (min-width: 1200px) { .hero-title { font-size: 2.6rem; } }
.stats-strip { margin-top: -2.5rem; position: relative; }

.stat-card { border: 0; border-radius: 12px; box-shadow: 0 1px 3px rgba(0, 0, 0, .06); }
.stat-icon {
    width: 44px; height: 44px; border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    background: rgba(27, 153, 139, .12); color: var(--c-teal); font-size: 1.25rem;
}
.stat-value { font-size: 1.6rem; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat-label { font-size: .8rem; color: var(--c-muted); }
.stat-note { font-size: .72rem; color: var(--c-muted); line-height: 1.2; }

.footer-public { background: var(--c-primary); color: #fff; }
.footer-logo { background: #fff; border-radius: 8px; padding: 4px; }
.footer-logo-link { display: inline-block; border-radius: 8px; transition: transform .15s, box-shadow .15s; }
.footer-logo-link:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(0, 0, 0, .25); }
.footer-logo-link:focus-visible { outline-color: #fff; }

.public .navbar .nav-link { color: var(--c-text); font-weight: 500; font-size: .9rem; }
.public .navbar .nav-link:hover { color: var(--c-primary-600); }
.navbar-brand { min-width: 0; }
.brand-text { white-space: normal; line-height: 1.2; }

.section { padding-top: 3.5rem; padding-bottom: 1rem; scroll-margin-top: 72px; }
.section-alt { background: var(--c-surface); padding-bottom: 3.5rem; margin-top: 3.5rem; border-top: 1px solid var(--c-border); border-bottom: 1px solid var(--c-border); }
.section-title { font-size: 1.5rem; font-weight: 700; color: var(--c-primary); margin-bottom: .5rem; }
.section-lead { color: var(--c-muted); max-width: 820px; margin-bottom: 1.5rem; text-wrap: pretty; }
.section-lead-full { max-width: none; text-align: justify; hyphens: auto; }

@media (max-width: 575.98px) {
    .brand-logo { height: 32px; width: auto; }
    .brand-text { font-size: .9rem; }
    .hero .container { padding-top: 2rem !important; padding-bottom: 2.5rem !important; }
    .hero-lead { font-size: 1rem; }
    .stats-strip { margin-top: -1.75rem; }
    .stat-card .card-body { padding: .75rem; gap: .6rem !important; }
    .stat-icon { width: 36px; height: 36px; font-size: 1rem; flex-shrink: 0; }
    .stat-value { font-size: 1.3rem; }
    .stat-label { font-size: .72rem; line-height: 1.25; }
    .section { padding-top: 2.5rem; }
    .section-alt { padding-bottom: 2.5rem; margin-top: 2.5rem; }
    .section-title { font-size: 1.3rem; }
    .section-lead-full { text-align: left; }
    .kategori-card .card-body { gap: 1rem !important; }
    .kategori-value { font-size: 2.4rem; min-width: 64px; }
}
@media (max-width: 359.98px) {
    .brand-text { display: none; }
}

.feature-card { border: 0; border-radius: 12px; box-shadow: 0 1px 3px rgba(0, 0, 0, .06); }
.feature-num {
    width: 28px; height: 28px; border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--c-primary); color: #fff; font-size: .8rem; font-weight: 700;
}

.step { position: relative; padding: 1.5rem; border-radius: 12px; background: var(--c-sand); height: 100%; }
.step-icon {
    width: 52px; height: 52px; border-radius: 14px; margin-bottom: .75rem;
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--c-coral); color: #fff; font-size: 1.5rem;
}
.step-label { font-size: .75rem; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--c-teal); }

.kategori-card { border: 0; border-radius: 12px; color: #fff; }
.kategori-alam { background: linear-gradient(135deg, var(--c-primary), var(--c-primary-600)); }
.kategori-budidaya { background: linear-gradient(135deg, #12786d, var(--c-teal)); }
.kategori-value { font-size: 3rem; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; min-width: 90px; text-align: center; }
.kategori-card p { opacity: .85; }

/* Login */
.auth-wrap { min-height: 100vh; display: flex; }
.auth-visual {
    flex: 1 1 55%; flex-direction: column; justify-content: space-between;
    padding: 4rem; color: #fff;
    background: linear-gradient(150deg, var(--c-primary) 0%, var(--c-primary-600) 55%, var(--c-teal) 100%);
}
.auth-visual h1 { font-size: 2rem; }
.auth-visual .hero-logos img { max-height: 96px; }
.auth-form { flex: 1 1 45%; display: flex; align-items: center; justify-content: center; padding: 2rem 1rem; background: var(--c-surface); }
.auth-card { width: 100%; max-width: 400px; }
.recaptcha-wrap { margin-bottom: 1.25rem; min-height: 78px; }
/* Kunci uji Google menempelkan peringatan merah di atas kotak. Tutup bagian itu. */
.recaptcha-uji { position: relative; width: 304px; max-width: 100%; }
.recaptcha-uji::before {
    content: "";
    position: absolute;
    z-index: 2;
    left: 2px;
    top: 2px;
    width: calc(100% - 4px);
    height: 20px;
    background: #f9f9f9;
    pointer-events: none;
}
@media (max-width: 400px) {
    .recaptcha-wrap { transform: scale(.88); transform-origin: 0 0; margin-bottom: .4rem; }
}

/* Aplikasi (setelah login) */
.app { --sidebar-w: 260px; }
/* .offcanvas-lg memaksa background transparan di ≥lg, jadi warna diletakkan di .sidebar-inner */
.sidebar { color: #fff; }
.sidebar-inner { background: var(--c-primary); display: flex; flex-direction: column; height: 100%; min-height: 100%; }
@media (min-width: 992px) {
    .sidebar { position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w); z-index: 1030; }
    .main { margin-left: var(--sidebar-w); }
}
@media (max-width: 991.98px) {
    .sidebar.offcanvas-lg { --bs-offcanvas-width: var(--sidebar-w); }
}
.sidebar-brand { display: flex; align-items: center; gap: .6rem; padding: 1rem 1rem; border-bottom: 1px solid rgba(255, 255, 255, .1); }
.sidebar-brand img { background: #fff; border-radius: 8px; padding: 2px; height: 36px; width: auto; flex-shrink: 0; }
.sidebar-brand > div { min-width: 0; }
.sidebar-nav { flex: 1; overflow-y: auto; padding: .75rem 0; }
.sidebar-link {
    display: flex; align-items: center; gap: .75rem;
    padding: .6rem 1.25rem; color: rgba(255, 255, 255, .82);
    text-decoration: none; font-size: .9rem; font-weight: 500;
    background: none; border: 0; border-left: 3px solid transparent; text-align: left; width: 100%;
}
.sidebar-link:hover { color: #fff; background: rgba(255, 255, 255, .06); }
.sidebar-link.active { color: #fff; background: var(--c-primary-600); border-left-color: var(--c-coral); }
.sidebar-sublink { padding-left: 2.25rem; font-size: .85rem; }
.sidebar-toggle .chevron { font-size: .75rem; transition: transform .2s; }
.sidebar-toggle.collapsed .chevron { transform: rotate(-90deg); }
.sidebar-footer { border-top: 1px solid rgba(255, 255, 255, .1); padding: .5rem 0; margin: 0; }

.main { min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
    position: sticky; top: 0; z-index: 1020;
    display: flex; align-items: center; gap: .75rem;
    padding: .75rem 1.5rem; background: var(--c-surface);
    box-shadow: 0 1px 3px rgba(0, 0, 0, .06);
}
.topbar-title {
    font-size: 1.15rem; font-weight: 700; margin: 0; color: var(--c-primary);
    min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.topbar .dropdown { flex-shrink: 0; }
.lonceng-tombol { width: 2.5rem; height: 2.5rem; padding: 0; }
.lonceng-badge {
    position: absolute; top: .1rem; right: .05rem;
    min-width: 1.05rem; height: 1.05rem; padding: 0 .25rem;
    border-radius: 999px; background: var(--c-coral); color: #fff;
    font-size: .65rem; font-weight: 700; line-height: 1.05rem; text-align: center;
}
.lonceng-menu { width: min(22rem, calc(100vw - 1.5rem)); max-height: 24rem; overflow: auto; }
.lonceng-item { white-space: normal; padding: .65rem .9rem; border-top: 1px solid #eef2f5; }
.lonceng-item:hover { background: #f4f8fb; }
.topbar-user { white-space: nowrap; }
.avatar {
    width: 30px; height: 30px; border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--c-teal); color: #fff; font-weight: 700; font-size: .85rem;
}
img.avatar { object-fit: contain; background: #fff; padding: 2px; }
.content { flex: 1; padding: 1.5rem; width: 100%; max-width: 1400px; }
.app-footer { padding: 1rem 1.5rem; font-size: .8rem; color: var(--c-muted); }
@media (max-width: 575.98px) {
    .content { padding: .75rem; }
    .topbar { padding: .6rem .75rem; gap: .5rem; }
    .topbar-title { font-size: 1rem; }
    .content .card-header { padding: .75rem 1rem; }
    .content .card-body { padding: .85rem; }
    .content .card-header .btn { padding: .3rem .65rem; font-size: .85rem; }
    .dt-container .row { --bs-gutter-y: .5rem; }
    .dt-container .dt-search input { width: 100% !important; margin-left: 0 !important; }
    .dt-container .dt-search label { display: block; margin-bottom: .25rem; }
    .dt-container .dt-paging .pagination { flex-wrap: wrap; justify-content: center; }
    .dt-container .dt-info { text-align: center; font-size: .8rem; }
    .alert { font-size: .9rem; }
}

.role-badge { font-weight: 600; padding: .45em .75em; }
.role-admin { background: var(--c-primary); }
.role-sekretariat { background: var(--c-primary-600); }
.role-anggota { background: var(--c-teal); }
.role-mitra { background: #6C5CE7; }
.role-unit { background: var(--c-success); }
.role-bpk { background: var(--c-coral); }
.role-dit_ksg { background: #1F6F8B; }

.tone-primary { background: rgba(11, 60, 93, .1); color: var(--c-primary); }
.tone-teal { background: rgba(27, 153, 139, .12); color: var(--c-teal); }
.tone-warning { background: rgba(232, 163, 61, .15); color: #b67a1c; }
.tone-success { background: rgba(46, 158, 91, .12); color: var(--c-success); }
.tone-coral { background: rgba(255, 111, 89, .14); color: #e0533d; }

.card-header { border-bottom-color: var(--c-border); }
.table thead th { background: var(--c-sand); color: var(--c-primary); font-weight: 600; font-size: .85rem; white-space: nowrap; }
.table tbody td,
.table tbody td .small { font-size: .85rem; }
.num { font-variant-numeric: tabular-nums; }
dl dt { color: var(--c-muted); font-weight: 500; font-size: .75rem; }
dl dd { margin-bottom: .6rem; }

.empty-state { text-align: center; padding: 3rem 1rem; }
.empty-state > .bi { font-size: 3rem; color: var(--c-warning); }

/* ---------- Profil ---------- */
.profil-avatar { width: 72px; height: 72px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 2rem; }
img.profil-avatar { object-fit: contain; background: #fff; padding: 6px; border: 1px solid var(--c-border); }
.profil-card .card-body { background: linear-gradient(180deg, rgba(27, 153, 139, .08), transparent); border-radius: 12px 12px 0 0; }
.profil-card h2 { overflow-wrap: anywhere; }
.profil-stat { background: var(--c-sand); border-radius: 10px; padding: .6rem .25rem; font-variant-numeric: tabular-nums; }
.profil-section { font-size: .8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--c-primary); padding-bottom: .5rem; margin-bottom: 1rem; border-bottom: 1px solid var(--c-border); }
.profil-readonly dd { overflow-wrap: anywhere; }

/* ---------- Stok ---------- */
.rekap-item { background: var(--c-sand); border-radius: 10px; padding: .9rem 1rem; }
.rekap-nilai { font-size: 1.25rem; font-weight: 700; line-height: 1.15; }
.rekap-jumlah { display: flex; flex-wrap: wrap; gap: .35rem 1.25rem; margin-top: .9rem; padding-top: .75rem; border-top: 1px dashed var(--c-border); font-size: .9rem; }
.stok-baru > td { background: rgba(232, 163, 61, .08); vertical-align: top; padding-top: .6rem; padding-bottom: .6rem; }
.stok-baru .ts-wrapper { min-width: 220px; }
.stok-baru .ts-wrapper.single:not(.has-items) .ts-control > input {
    opacity: 1 !important;
    position: relative !important;
    left: auto !important;
    width: 100% !important;
    min-width: 0;
}
.stok-baru .ts-wrapper.single:not(.has-items) .ts-control > input::placeholder {
    color: var(--c-muted);
    opacity: 1;
}
.stok-tambah { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1rem; padding-top: .9rem; border-top: 1px dashed var(--c-border); margin-top: -1px; }
@media (max-width: 575.98px) {
    .stok-tambah .btn { width: 100%; }
    .stok-baru .ts-wrapper { min-width: 160px; }
    .stok-tabel th, .stok-tabel td { padding-left: .35rem; padding-right: .35rem; }
}
.stok-perusahaan { cursor: pointer; }
table[data-datatable] tfoot td {
    background: var(--c-sand);
    border-top: 2px solid var(--c-border);
    font-weight: 700;
}
.stok-verifikasi { width: 7.5rem; }
.stok-verifikasi::placeholder { color: var(--c-muted); }
.stok-tabs { gap: .25rem; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
.stok-tabs .nav-link { color: var(--c-primary); font-weight: 600; font-size: .9rem; white-space: nowrap; background: var(--c-surface); border: 1px solid var(--c-border); }
.stok-tabs .nav-link.active { background: var(--c-primary); border-color: var(--c-primary); color: #fff; }

/* ---------- Form ---------- */
.ts-wrapper.is-invalid .ts-control { border-color: var(--bs-form-invalid-border-color); }
.ts-dropdown { z-index: 1060; }
.ts-wrapper.single .ts-control { flex-wrap: nowrap; padding-right: 2.25rem !important; }
.ts-wrapper.single .ts-control > .item { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.table .btn-sm { --bs-btn-padding-x: .45rem; }
.table .btn:disabled { opacity: .35; }

/* ---------- Perhitungan BMP 2027 ---------- */
.tabel-bmp th { font-weight: 600; vertical-align: middle; }
.tabel-bmp .kode { font: 500 .65rem/1.2 var(--bs-font-monospace); color: var(--bs-secondary-color); }
