/* ================================================================
   Design System — Stockist Natural Nusantara A.2102
   Emas minimalis natural: hijau emerald sebagai warna utama.
   ================================================================ */

:root {
    /* Brand — hijau emerald "natural" */
    --brand-900: #0a4d30;
    --brand-700: #0f6b43;
    --brand-600: #128052;
    --brand-500: #1a9a66;
    --brand-100: #d6f0e4;
    --brand-50: #eef9f3;
    --brand-25: #f6fbf8;

    /* Neutral */
    --text-primary: #1c2b24;
    --text-muted: #5f6f66;
    --border: #e3e9e5;
    --border-strong: #cdd8d1;
    --surface: #ffffff;
    --surface-soft: #f6faf7;

    /* Override Bootstrap agar seluruh komponen "success" memakai hijau brand */
    --bs-success: #128052;
    --bs-success-rgb: 18, 128, 82;
    --bs-success-bg-subtle: #e9f8f0;
    --bs-success-border-subtle: #c3e8d5;
    --bs-success-text-emphasis: #0f6b43;
    --bs-focus-ring-color: rgba(18, 128, 82, 0.22);

    /* Radius & shadow konsisten */
    --radius: 0.625rem;
    --radius-sm: 0.4rem;
    --radius-lg: 1rem;
    --shadow-sm: 0 1px 2px rgba(16, 40, 28, 0.05);
    --shadow-md: 0 8px 24px rgba(16, 40, 28, 0.08);

    /* Bootstrap bases */
    --bs-border-radius: var(--radius);
    --bs-border-radius-sm: var(--radius-sm);
    --bs-border-radius-lg: var(--radius-lg);

    /* Layout */
    --sidebar-width: 268px;
    --header-height: 60px;
}

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

html,
body {
    height: 100%;
}

body {
    margin: 0;
    background-color: var(--bg-body, #f4f7f5);
    color: var(--text-primary);
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    min-height: 100vh;
}

a {
    transition: color 0.15s ease;
}

/* ================================================================
   Komponen dasar Bootstrap yang disesuaikan
   ================================================================ */

.card {
    border-color: var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}

.card-header {
    background-color: #fbfdfc;
    border-bottom-color: var(--border);
    font-weight: 600;
}

.card-header.bg-white {
    background-color: var(--surface) !important;
    border-bottom-color: var(--border);
}

.table {
    --bs-table-header-bg: var(--surface-soft);
    font-size: 0.9rem;
}

.table > :not(caption) > * > * {
    border-bottom-color: var(--border);
    padding-top: 0.7rem;
    padding-bottom: 0.7rem;
}

.table thead th {
    color: var(--text-muted);
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    white-space: nowrap;
}

.table-hover > tbody > tr:hover > * {
    background-color: var(--brand-25);
}

.table-sm > :not(caption) > * > * {
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
}

.form-control,
.form-select {
    border-color: var(--border-strong);
    font-size: 0.925rem;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--brand-500);
    box-shadow: 0 0 0 0.25rem rgba(18, 128, 82, 0.13);
}

.form-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
}

.btn {
    font-weight: 500;
    --bs-btn-focus-box-shadow: 0 0 0 0.25rem rgba(18, 128, 82, 0.15);
}

.badge {
    font-weight: 600;
}

.alert {
    border-radius: var(--radius);
}

/* Pengaman: pesan sukses/peringatan flash terlihat jelas, tidak berkedip */
.alert-dismissible .btn-close {
    padding: 1rem 1rem;
}

/* ================================================================
   Sidebar (offcanvas di mobile, panel tetap di desktop)
   ================================================================ */

.sidebar {
    --bs-offcanvas-width: var(--sidebar-width);
    width: var(--sidebar-width);
    max-width: 86vw;
    background-color: var(--surface);
    border-right: 1px solid var(--border);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    min-height: var(--header-height);
    padding: 0.75rem 1rem;
    background: linear-gradient(135deg, var(--brand-700), var(--brand-500));
    color: #fff;
}

.brand-lockup {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    min-width: 0;
}

.brand-logo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 38px;
    height: 38px;
    border-radius: 11px;
    background-color: rgba(255, 255, 255, 0.16);
    color: #fff;
    font-size: 1.15rem;
}

.brand-name {
    font-weight: 700;
    color: inherit;
    line-height: 1.25;
    font-size: 0.95rem;
}

.brand-name.long {
    font-size: 0.88rem;
}

.brand-tagline {
    color: inherit;
    opacity: 0.82;
    font-size: 0.66rem;
    line-height: 1.2;
}

.sidebar .offcanvas-body {
    background-color: var(--surface);
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--border);
}

.sidebar-user .avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background-color: var(--brand-100);
    color: var(--brand-700);
    font-weight: 700;
    font-size: 0.9rem;
}

.sidebar-user .role-pill {
    display: inline-block;
    margin-top: 2px;
    padding: 1px 8px;
    border-radius: 999px;
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    background-color: var(--brand-50);
    color: var(--brand-700);
    border: 1px solid var(--brand-100);
}

.sidebar-nav {
    padding: 0.75rem 0.65rem;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.55rem 0.8rem;
    border-radius: var(--radius-sm);
    color: #3d4d44;
    font-size: 0.9rem;
    font-weight: 500;
    text-decoration: none;
    position: relative;
}

.sidebar-link:hover {
    background-color: var(--surface-soft);
    color: var(--brand-700);
}

.sidebar-link.active {
    background-color: var(--brand-50);
    color: var(--brand-700);
    font-weight: 600;
}

.sidebar-link.active::before {
    content: "";
    position: absolute;
    left: 0;
    top: 20%;
    bottom: 20%;
    width: 3px;
    border-radius: 0 4px 4px 0;
    background-color: var(--brand-500);
}

.sidebar-link i {
    font-size: 1.05rem;
    width: 1.25rem;
    text-align: center;
    opacity: 0.9;
}

.sidebar-logout {
    color: #b42318;
}

.sidebar-logout:hover {
    background-color: #fdf0ef;
    color: #b42318;
}

.sidebar-footer {
    border-top: 1px solid var(--border);
    padding: 0.5rem;
}

/* ================================================================
   Layout utama (admin/kasir)
   ================================================================ */

.app-wrapper {
    width: 100%;
    min-width: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.app-header {
    width: 100%;
    min-width: 0;
    min-height: var(--header-height);
    background-color: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 1020;
}

.app-header h1 {
    min-width: 0;
    margin: 0;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.app-header-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background-color: var(--surface);
    color: var(--text-primary);
}

.app-header-toggle:hover {
    background-color: var(--surface-soft);
    color: var(--brand-700);
}

.app-content {
    width: 100%;
    min-width: 0;
    flex: 1 0 auto;
}

.app-content .row > * {
    min-width: 0;
}

.app-footer {
    width: 100%;
    padding: 1rem 1rem;
    background-color: var(--surface);
    border-top: 1px solid var(--border);
    color: var(--text-muted);
}

/* ================================================================
   Kartu statistik (dashboard)
   ================================================================ */

.stat-card .card-body {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 1.1rem 1.1rem;
}

.stat-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 46px;
    height: 46px;
    border-radius: 13px;
    font-size: 1.25rem;
    background-color: var(--brand-50);
    color: var(--brand-700);
}

.stat-icon.warn {
    background-color: #fef7e6;
    color: #a16207;
}

.stat-icon.danger {
    background-color: #feece9;
    color: #b42318;
}

.stat-icon.info {
    background-color: #e8f3fb;
    color: #075985;
}

.stat-value {
    font-size: 1.25rem;
    font-weight: 700;
    line-height: 1.1;
    color: var(--text-primary);
}

.stat-label {
    font-size: 0.76rem;
    color: var(--text-muted);
    margin-top: 2px;
}

/* ================================================================
   Beranda / Navbar member
   ================================================================ */

.app-navbar {
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
}

.app-navbar .navbar-brand {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--brand-700);
}

.app-navbar .navbar-brand .brand-logo {
    width: 34px;
    height: 34px;
    font-size: 1rem;
    background: linear-gradient(135deg, var(--brand-700), var(--brand-500));
}

.app-navbar .navbar-toggler {
    border-color: var(--border);
    border-radius: var(--radius-sm);
}

.app-navbar .nav-link {
    font-weight: 500;
    color: #3d4d44;
    border-radius: var(--radius-sm);
    padding: 0.45rem 0.7rem;
    font-size: 0.9rem;
}

.app-navbar .nav-link:hover {
    color: var(--brand-700);
}

.app-navbar .nav-link.active {
    color: var(--brand-700);
    background-color: var(--brand-50);
    font-weight: 600;
}

.app-member-content {
    min-height: calc(100vh - var(--header-height) - 90px);
}

/* ================================================================
   Halaman auth (login & register)
   ================================================================ */

.auth-body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
    background:
        radial-gradient(1200px 500px at 10% -10%, rgba(26, 154, 102, 0.12), transparent 55%),
        radial-gradient(1000px 420px at 110% 110%, rgba(15, 107, 67, 0.10), transparent 55%),
        var(--bg-body, #f4f7f5);
}

.auth-wrap {
    width: 100%;
    max-width: 408px;
}

.auth-brand {
    text-align: center;
    margin-bottom: 1.5rem;
}

.auth-brand .brand-logo {
    width: 56px;
    height: 56px;
    font-size: 1.6rem;
    border-radius: 16px;
    margin: 0 auto 0.8rem;
    background: linear-gradient(135deg, var(--brand-700), var(--brand-500));
    box-shadow: var(--shadow-md);
}

.auth-brand .brand-name {
    display: block;
    font-size: 1.25rem;
    color: var(--brand-900);
    line-height: 1.3;
}

.auth-brand .brand-tagline {
    margin-top: 0.35rem;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.auth-card {
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    overflow: hidden;
}

.auth-foot {
    margin-top: 1.25rem;
    text-align: center;
}

/* ================================================================
   Empty state
   ================================================================ */

.empty-state {
    color: var(--text-muted);
    font-size: 0.9rem;
    text-align: center;
    padding: 2.5rem 1rem;
}

/* ================================================================
   Mobile & tablet (off-canvas default)
   ================================================================ */

@media (max-width: 991.98px) {
    body {
        overflow-x: hidden;
    }

    .app-content {
        padding-top: 1rem;
        padding-bottom: 1rem;
    }

    .app-footer {
        text-align: center;
    }
}

@media (max-width: 575.98px) {
    .stat-value {
        font-size: 1.1rem;
    }

    .stat-icon {
        width: 40px;
        height: 40px;
        font-size: 1.05rem;
    }
}

/* ================================================================
   Desktop
   ================================================================ */

@media (min-width: 992px) {
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        width: var(--sidebar-width) !important;
        max-width: var(--sidebar-width);
        transform: none !important;
        visibility: visible !important;
        z-index: 1030;
    }

    .app-wrapper {
        margin-left: var(--sidebar-width);
    }
}

/* ================================================================
   Struk cetak (kasir)
   ================================================================ */

.print-only {
    display: none;
}

.struk {
    width: 80mm;
    margin: 0 auto;
    padding: 8px;
    font-family: Consolas, Monaco, monospace;
    font-size: 11px;
    line-height: 1.35;
    color: #000;
    background: #fff;
}

.struk-header {
    text-align: center;
    margin-bottom: 4px;
}

.struk-toko {
    font-size: 13px;
    font-weight: 700;
    line-height: 1.25;
}

.struk-sub {
    font-size: 9px;
    color: #444;
}

.struk-line {
    border-top: 1px dashed #000;
    margin: 4px 0;
}

.struk table {
    width: 100%;
    border-collapse: collapse;
}

.struk-meta td,
.struk-total td {
    vertical-align: top;
    padding: 1px 0;
}

.struk-meta td:first-child {
    white-space: nowrap;
    padding-right: 4px;
}

.struk-total td:first-child {
    font-weight: 700;
    padding-right: 4px;
}

.struk-items td {
    padding: 1px 0;
}

.struk-items tr:first-child td {
    padding-top: 2px;
}

.struk-qty {
    color: #333;
}

.struk-right {
    text-align: right;
    white-space: nowrap;
}

.struk-footer {
    text-align: center;
    margin-top: 2px;
}

/* ================================================================
   Laporan — kop cetak
   ================================================================ */

.report-head {
    border-bottom: 2px solid var(--brand-700);
    padding-bottom: 0.6rem;
    margin-bottom: 1rem;
}

.report-head .brand-name {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--brand-900);
    margin-bottom: 0.15rem;
}

.report-head .report-title {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* ================================================================
   Print
   ================================================================ */

@media print {
    body {
        background: #fff !important;
    }

    .sidebar,
    .app-header,
    .app-footer,
    .app-navbar,
    .print-hidden,
    .d-print-none {
        display: none !important;
    }

    .app-wrapper {
        margin-left: 0 !important;
        display: block !important;
    }

    .app-content {
        padding: 0 !important;
    }

    .card,
    .card-header {
        border: 0 !important;
        box-shadow: none !important;
        border-radius: 0 !important;
    }

    .print-only {
        display: block !important;
    }
}