/* =========================================================================
   Sistem Confirmation Order — PT. Gemilang Jaya Garment
   Tema dashboard: sidebar collapsible, dark/light, responsive.
   ========================================================================= */

:root {
    --gjg-sidebar-w: 264px;
    --gjg-sidebar-w-mini: 76px;
    --gjg-topbar-h: 62px;
    --gjg-radius: 14px;
    --gjg-radius-sm: 9px;

    --gjg-brand: #4f46e5;
    --gjg-brand-2: #7c3aed;
    --gjg-accent: #06b6d4;

    --gjg-bg: #f1f3f9;
    --gjg-surface: #ffffff;
    --gjg-surface-2: #f8fafc;
    --gjg-border: #e4e7ee;
    --gjg-text: #1e2430;
    --gjg-muted: #6b7280;

    --gjg-sidebar-bg: #171c2b;
    --gjg-sidebar-text: #9aa4b8;
    --gjg-sidebar-active: #ffffff;
    --gjg-sidebar-hover: rgba(255, 255, 255, .06);

    --gjg-shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 4px 16px rgba(16, 24, 40, .06);
    --gjg-shadow-lg: 0 12px 40px rgba(16, 24, 40, .16);
}

[data-bs-theme="dark"] {
    --gjg-bg: #0e1219;
    --gjg-surface: #161b25;
    --gjg-surface-2: #1c222e;
    --gjg-border: #252c3a;
    --gjg-text: #e6e9ef;
    --gjg-muted: #8d97a8;

    --gjg-sidebar-bg: #10141d;
    --gjg-shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 16px rgba(0, 0, 0, .28);
    --gjg-shadow-lg: 0 12px 40px rgba(0, 0, 0, .5);
}

/* ── Dasar ─────────────────────────────────────────────────────────────── */

body {
    background: var(--gjg-bg);
    color: var(--gjg-text);
    font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: .9rem;
    -webkit-font-smoothing: antialiased;
}

::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(128, 138, 157, .38); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: rgba(128, 138, 157, .62); }

a { text-decoration: none; }

.text-muted-2 { color: var(--gjg-muted) !important; }

/* ── Halaman login ─────────────────────────────────────────────────────── */

.auth-wrap {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1fr 1fr;
    background: var(--gjg-surface);
}

.auth-hero {
    background: linear-gradient(140deg, var(--gjg-brand) 0%, var(--gjg-brand-2) 55%, #4338ca 100%);
    color: #fff;
    padding: 3rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: relative;
    overflow: hidden;
}

.auth-hero::after {
    content: "";
    position: absolute;
    width: 560px;
    height: 560px;
    right: -190px;
    bottom: -230px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .07);
}

.auth-hero .stat-line {
    display: flex;
    gap: 2rem;
    position: relative;
    z-index: 1;
}

.auth-form {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.auth-form-inner { width: 100%; max-width: 380px; }

@media (max-width: 991.98px) {
    .auth-wrap { grid-template-columns: 1fr; }
    .auth-hero { display: none; }
}

/* ── Sidebar ───────────────────────────────────────────────────────────── */

.gjg-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: var(--gjg-sidebar-w);
    background: var(--gjg-sidebar-bg);
    display: flex;
    flex-direction: column;
    z-index: 1040;
    transition: width .22s ease, transform .22s ease;
}

.gjg-sidebar .brand {
    height: var(--gjg-topbar-h);
    display: flex;
    align-items: center;
    gap: .7rem;
    padding: 0 1.15rem;
    color: #fff;
    flex-shrink: 0;
    border-bottom: 1px solid rgba(255, 255, 255, .06);
}

.gjg-sidebar .brand-mark {
    width: 38px;
    height: 38px;
    border-radius: 9px;
    flex-shrink: 0;
    object-fit: contain;
    /* Logo berlatar gelap; alas terang tipis menjaga tepinya tetap terbaca
       di atas sidebar yang juga gelap. */
    background: rgba(255, 255, 255, .92);
    padding: 2px;
}

.gjg-sidebar .brand-text { line-height: 1.15; overflow: hidden; white-space: nowrap; }
.gjg-sidebar .brand-text strong { display: block; font-size: .9rem; }
.gjg-sidebar .brand-text span { font-size: .68rem; color: var(--gjg-sidebar-text); }

.gjg-nav {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: .85rem .7rem 1.5rem;
}

.gjg-nav .nav-head {
    font-size: .66rem;
    text-transform: uppercase;
    letter-spacing: .09em;
    color: #5d6678;
    padding: 1rem .65rem .4rem;
    white-space: nowrap;
}

.gjg-nav a {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .58rem .68rem;
    margin-bottom: .12rem;
    border-radius: var(--gjg-radius-sm);
    color: var(--gjg-sidebar-text);
    font-size: .855rem;
    white-space: nowrap;
    transition: background .15s, color .15s;
}

.gjg-nav a i { font-size: 1.05rem; width: 21px; text-align: center; flex-shrink: 0; }

.gjg-nav a:hover { background: var(--gjg-sidebar-hover); color: #dfe4ee; }

.gjg-nav a.active {
    background: linear-gradient(90deg, var(--gjg-brand), var(--gjg-brand-2));
    color: var(--gjg-sidebar-active);
    box-shadow: 0 4px 14px rgba(79, 70, 229, .35);
}

.gjg-nav a .badge-soft {
    margin-left: auto;
    font-size: .66rem;
    background: rgba(255, 255, 255, .1);
    padding: .12rem .42rem;
    border-radius: 99px;
}

/* Mode mini (desktop) */
body.sidebar-mini .gjg-sidebar { width: var(--gjg-sidebar-w-mini); }
body.sidebar-mini .gjg-sidebar .brand-text,
body.sidebar-mini .gjg-nav .nav-head,
body.sidebar-mini .gjg-nav a span,
body.sidebar-mini .gjg-nav a .badge-soft { display: none; }
body.sidebar-mini .gjg-nav a { justify-content: center; padding: .6rem; }
body.sidebar-mini .gjg-main { margin-left: var(--gjg-sidebar-w-mini); }

/* ── Area utama ────────────────────────────────────────────────────────── */

.gjg-main {
    margin-left: var(--gjg-sidebar-w);
    min-height: 100vh;
    transition: margin-left .22s ease;
    display: flex;
    flex-direction: column;
}

.gjg-topbar {
    height: var(--gjg-topbar-h);
    background: var(--gjg-surface);
    border-bottom: 1px solid var(--gjg-border);
    display: flex;
    align-items: center;
    gap: .8rem;
    padding: 0 1.1rem;
    position: sticky;
    top: 0;
    z-index: 1030;
}

.gjg-content { padding: 1.35rem; flex: 1; }

.icon-btn {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    border: 1px solid transparent;
    background: transparent;
    color: var(--gjg-muted);
    display: grid;
    place-items: center;
    font-size: 1.08rem;
    transition: background .15s, color .15s;
}

.icon-btn:hover { background: var(--gjg-surface-2); color: var(--gjg-text); }

.avatar-mini {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--gjg-brand), var(--gjg-accent));
    color: #fff;
    display: grid;
    place-items: center;
    font-size: .74rem;
    font-weight: 600;
    flex-shrink: 0;
}

@media (max-width: 991.98px) {
    .gjg-sidebar { transform: translateX(-100%); box-shadow: var(--gjg-shadow-lg); }
    body.sidebar-open .gjg-sidebar { transform: translateX(0); }
    .gjg-main, body.sidebar-mini .gjg-main { margin-left: 0; }
    .gjg-content { padding: .9rem; }

    .sidebar-backdrop {
        position: fixed;
        inset: 0;
        background: rgba(9, 12, 20, .5);
        z-index: 1035;
        opacity: 0;
        pointer-events: none;
        transition: opacity .2s;
    }
    body.sidebar-open .sidebar-backdrop { opacity: 1; pointer-events: auto; }
}

/* ── Kartu ─────────────────────────────────────────────────────────────── */

.card {
    background: var(--gjg-surface);
    border: 1px solid var(--gjg-border);
    border-radius: var(--gjg-radius);
    box-shadow: var(--gjg-shadow);
}

.card-header {
    background: transparent;
    border-bottom: 1px solid var(--gjg-border);
    padding: .95rem 1.15rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: .6rem;
    flex-wrap: wrap;
}

.card-body { padding: 1.15rem; }

/* Kartu KPI */
.kpi {
    display: flex;
    align-items: flex-start;
    gap: .9rem;
    padding: 1.1rem 1.15rem;
}

.kpi-icon {
    width: 46px;
    height: 46px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    font-size: 1.28rem;
    flex-shrink: 0;
}

.kpi-label {
    font-size: .715rem;
    text-transform: uppercase;
    letter-spacing: .055em;
    color: var(--gjg-muted);
    font-weight: 600;
}

.kpi-value { font-size: 1.42rem; font-weight: 700; line-height: 1.25; letter-spacing: -.015em; }
.kpi-sub { font-size: .74rem; color: var(--gjg-muted); }

.soft-primary { background: rgba(79, 70, 229, .12); color: #4f46e5; }
.soft-success { background: rgba(22, 163, 74, .12); color: #16a34a; }
.soft-warning { background: rgba(217, 119, 6, .13); color: #d97706; }
.soft-danger  { background: rgba(220, 38, 38, .12); color: #dc2626; }
.soft-info    { background: rgba(6, 182, 212, .13); color: #0891b2; }
.soft-purple  { background: rgba(124, 58, 237, .12); color: #7c3aed; }

/* ── Tabel ─────────────────────────────────────────────────────────────── */

.table { --bs-table-bg: transparent; color: var(--gjg-text); margin-bottom: 0; }

.table > thead > tr > th {
    background: var(--gjg-surface-2);
    border-bottom: 1px solid var(--gjg-border);
    font-size: .715rem;
    text-transform: uppercase;
    letter-spacing: .045em;
    color: var(--gjg-muted);
    font-weight: 700;
    white-space: nowrap;
    padding: .68rem .8rem;
}

.table > tbody > tr > td {
    border-bottom: 1px solid var(--gjg-border);
    padding: .68rem .8rem;
    vertical-align: middle;
}

.table-hover > tbody > tr:hover > * { background: var(--gjg-surface-2); }

/* Tabel rekap dengan rowspan — garis pemisah antar CO dipertegas */
.table-rekap tbody tr.group-start > td { border-top: 2px solid var(--gjg-border); }
.table-rekap td.cell-group { background: var(--gjg-surface-2); vertical-align: middle; }
.table-rekap tr.row-sum td { font-weight: 600; background: rgba(79, 70, 229, .045); }
.table-rekap tr.row-hpp td { font-weight: 700; background: rgba(79, 70, 229, .09); }

.table-sm > :not(caption) > * > * { padding: .45rem .6rem; }

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

/* Bungkus tabel lebar supaya body halaman tidak ikut geser */
.table-scroll { overflow-x: auto; }

/* ── Form ──────────────────────────────────────────────────────────────── */

.form-label { font-size: .78rem; font-weight: 600; margin-bottom: .32rem; color: var(--gjg-text); }
.form-label .req { color: #dc2626; }

.form-control, .form-select {
    background: var(--gjg-surface);
    border: 1px solid var(--gjg-border);
    color: var(--gjg-text);
    border-radius: var(--gjg-radius-sm);
    font-size: .865rem;
    padding: .48rem .72rem;
}

.form-control:focus, .form-select:focus {
    background: var(--gjg-surface);
    color: var(--gjg-text);
    border-color: var(--gjg-brand);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, .14);
}

.form-control::placeholder { color: var(--gjg-muted); opacity: .72; }

.input-group-text {
    background: var(--gjg-surface-2);
    border-color: var(--gjg-border);
    color: var(--gjg-muted);
    font-size: .8rem;
}

.form-text { font-size: .74rem; color: var(--gjg-muted); }

/* ── Tombol ────────────────────────────────────────────────────────────── */

.btn { border-radius: var(--gjg-radius-sm); font-size: .855rem; font-weight: 500; padding: .46rem .9rem; }
.btn-sm { padding: .3rem .62rem; font-size: .785rem; }

.btn-primary {
    background: linear-gradient(135deg, var(--gjg-brand), var(--gjg-brand-2));
    border: none;
    box-shadow: 0 3px 10px rgba(79, 70, 229, .28);
}

.btn-primary:hover, .btn-primary:focus {
    background: linear-gradient(135deg, #4338ca, #6d28d9);
    box-shadow: 0 5px 16px rgba(79, 70, 229, .38);
}

.btn-light-soft {
    background: var(--gjg-surface-2);
    border: 1px solid var(--gjg-border);
    color: var(--gjg-text);
}

.btn-light-soft:hover { background: var(--gjg-border); color: var(--gjg-text); }

/* ── Badge & chip ──────────────────────────────────────────────────────── */

.badge { font-weight: 600; font-size: .7rem; padding: .32em .6em; border-radius: 6px; }

.chip {
    display: inline-flex;
    align-items: center;
    gap: .34rem;
    padding: .18rem .55rem;
    border-radius: 99px;
    background: var(--gjg-surface-2);
    border: 1px solid var(--gjg-border);
    font-size: .74rem;
}

.color-dot {
    width: 13px;
    height: 13px;
    border-radius: 50%;
    border: 1px solid var(--gjg-border);
    display: inline-block;
    flex-shrink: 0;
}

/* ── Timeline CO ───────────────────────────────────────────────────────── */

.co-stepper {
    display: flex;
    gap: 0;
    overflow-x: auto;
    padding: .4rem 0 .2rem;
}

.co-step { flex: 1 1 0; min-width: 148px; position: relative; padding: 0 .5rem; text-align: center; }

.co-step::before {
    content: "";
    position: absolute;
    top: 19px;
    left: -50%;
    width: 100%;
    height: 2px;
    background: var(--gjg-border);
    z-index: 0;
}

.co-step:first-child::before { display: none; }
.co-step.done::before, .co-step.current::before { background: var(--gjg-brand); }

.co-step .dot {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--gjg-surface);
    border: 2px solid var(--gjg-border);
    color: var(--gjg-muted);
    display: grid;
    place-items: center;
    margin: 0 auto .5rem;
    position: relative;
    z-index: 1;
    font-size: 1rem;
}

.co-step.done .dot { background: var(--gjg-brand); border-color: var(--gjg-brand); color: #fff; }

.co-step.current .dot {
    background: var(--gjg-surface);
    border-color: var(--gjg-brand);
    color: var(--gjg-brand);
    box-shadow: 0 0 0 4px rgba(79, 70, 229, .16);
}

.co-step .st-name { font-size: .79rem; font-weight: 600; }
.co-step .st-date { font-size: .72rem; color: var(--gjg-muted); }
.co-step .st-gap { font-size: .68rem; color: var(--gjg-muted); }

/* Riwayat vertikal */
.co-log { list-style: none; margin: 0; padding: 0 0 0 1.15rem; border-left: 2px solid var(--gjg-border); }
.co-log li { position: relative; padding: 0 0 1.05rem .55rem; }

.co-log li::before {
    content: "";
    position: absolute;
    left: -1.52rem;
    top: .28rem;
    width: 11px;
    height: 11px;
    border-radius: 50%;
    background: var(--gjg-brand);
    border: 2px solid var(--gjg-surface);
}

/* ── Panel breakdown HPP ───────────────────────────────────────────────── */

.hpp-line {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 1rem;
    padding: .42rem 0;
    border-bottom: 1px dashed var(--gjg-border);
}

.hpp-line:last-child { border-bottom: none; }
.hpp-line .lbl { color: var(--gjg-muted); font-size: .82rem; }
.hpp-line .val { font-weight: 600; font-variant-numeric: tabular-nums; }
.hpp-line.sum { border-top: 1px solid var(--gjg-border); border-bottom: none; padding-top: .6rem; }
.hpp-line.total { font-size: 1.02rem; }
.hpp-line.total .val { color: var(--gjg-brand); font-weight: 700; }
.hpp-line.indent .lbl { padding-left: 1rem; }

/* ── Upload gambar ─────────────────────────────────────────────────────── */

.img-drop {
    border: 2px dashed var(--gjg-border);
    border-radius: var(--gjg-radius);
    padding: 1.4rem;
    text-align: center;
    color: var(--gjg-muted);
    cursor: pointer;
    transition: border-color .15s, background .15s;
}

.img-drop:hover, .img-drop.dragover { border-color: var(--gjg-brand); background: rgba(79, 70, 229, .04); }
.img-preview { max-height: 190px; border-radius: var(--gjg-radius-sm); object-fit: contain; }

/* ── Penyesuaian plugin pihak ketiga ───────────────────────────────────── */

.ts-wrapper.single .ts-control,
.ts-wrapper.multi .ts-control {
    background: var(--gjg-surface);
    border-color: var(--gjg-border);
    color: var(--gjg-text);
    border-radius: var(--gjg-radius-sm);
    font-size: .865rem;
    padding: .44rem .72rem;
}

.ts-dropdown {
    background: var(--gjg-surface);
    border-color: var(--gjg-border);
    color: var(--gjg-text);
    box-shadow: var(--gjg-shadow-lg);
    border-radius: var(--gjg-radius-sm);
}

.ts-dropdown .active { background: rgba(79, 70, 229, .12); color: var(--gjg-text); }
.ts-dropdown .optgroup-header { color: var(--gjg-muted); font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; }

div.dt-container .dt-paging .dt-paging-button { border-radius: 8px !important; font-size: .8rem; }
div.dt-container .dt-search input, div.dt-container .dt-length select { border-radius: var(--gjg-radius-sm); }
div.dt-container { font-size: .865rem; }
table.dataTable > tbody > tr.selected > * { box-shadow: inset 0 0 0 9999px rgba(79, 70, 229, .1); }

.litepicker { --litepicker-day-color-hover: var(--gjg-brand); font-size: .84rem; }

.modal-content { background: var(--gjg-surface); border: 1px solid var(--gjg-border); border-radius: var(--gjg-radius); }
.modal-header, .modal-footer { border-color: var(--gjg-border); }

.dropdown-menu {
    background: var(--gjg-surface);
    border-color: var(--gjg-border);
    border-radius: var(--gjg-radius-sm);
    box-shadow: var(--gjg-shadow-lg);
    font-size: .86rem;
}

.dropdown-item { color: var(--gjg-text); border-radius: 7px; padding: .42rem .7rem; }
.dropdown-item:hover, .dropdown-item:focus { background: var(--gjg-surface-2); color: var(--gjg-text); }
.dropdown-divider { border-color: var(--gjg-border); }

.tippy-box { font-size: .78rem; }

.notyf__toast { border-radius: var(--gjg-radius-sm); }

/* ── Cetak nota ────────────────────────────────────────────────────────── */

@media print {
    .gjg-sidebar,
    .gjg-topbar,
    .sidebar-backdrop,
    .no-print { display: none !important; }

    .gjg-main { margin-left: 0 !important; }
    .gjg-content { padding: 0 !important; }

    body { background: #fff !important; color: #000 !important; font-size: 11pt; }

    .card { border: none !important; box-shadow: none !important; }

    .nota { padding: 0 !important; }
    .nota .table > thead > tr > th { background: #f1f1f1 !important; color: #000 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    .nota .table th, .nota .table td { border: 1px solid #999 !important; }

    @page { size: A4; margin: 12mm; }
}

/* ── Layout nota ───────────────────────────────────────────────────────── */

.nota { background: #fff; color: #111; padding: 1.6rem; }
.nota .nota-title { font-size: 1.28rem; font-weight: 700; letter-spacing: .04em; }
.nota .nota-meta td { padding: .12rem .4rem .12rem 0; font-size: .84rem; }
.nota .table th, .nota .table td { border: 1px solid #d5d8de; font-size: .8rem; }
.nota .table > thead > tr > th { background: #f3f4f6; color: #374151; }
.nota .sign-box { height: 74px; }

/* ── Utilitas ──────────────────────────────────────────────────────────── */

.fs-xs { font-size: .74rem; }
.fs-sm { font-size: .82rem; }
.w-52 { width: 52px; }
.cursor-pointer { cursor: pointer; }
.min-w-0 { min-width: 0; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.empty-state { text-align: center; padding: 2.6rem 1rem; color: var(--gjg-muted); }
.empty-state i { font-size: 2.5rem; opacity: .35; display: block; margin-bottom: .6rem; }
