/* ============================================================
   Tema Aplikasi SAW — dirancang untuk pengguna lansia (70-80 th)
   Prinsip: huruf besar, kontras tinggi, tombol besar, sederhana.
   ============================================================ */

:root {
    --font: 19px;                 /* dasar besar */
    --biru: #1c5fa8;
    --biru-tua: #14457a;
    --teks: #1a1a1a;
    --abu: #5a5a5a;
    --garis: #c9c9c9;
    --bg: #f4f6f9;
    --kartu: #ffffff;
    --merah: #b3261e;
    --kuning: #fff4d6;
    --hijau: #e6f4ea;
    --radius: 10px;
}

* { box-sizing: border-box; }

html { font-size: var(--font); }

body {
    margin: 0;
    font-family: "Segoe UI", Tahoma, Arial, sans-serif;
    color: var(--teks);
    background: var(--bg);
    line-height: 1.5;
}

/* ── Topbar ── */
.topbar {
    display: flex;
    align-items: center;
    gap: .75rem;
    background: var(--biru);
    color: #fff;
    padding: .6rem 1rem;
}
.brand { font-size: 1.4rem; font-weight: 700; }
.brand-sub { font-size: .95rem; opacity: .9; }
.topbar .logout { margin-left: auto; }
.menu-toggle {
    display: none;
    font-size: 1.6rem; background: transparent; border: 0; color: #fff; cursor: pointer;
}

/* ── Layout ── */
.shell { display: flex; min-height: calc(100vh - 56px); }
.sidebar {
    width: 230px; background: #fff; border-right: 1px solid var(--garis);
    padding: .5rem; flex-shrink: 0;
}
.nav-link {
    display: block; padding: .85rem 1rem; margin: .2rem 0;
    color: var(--teks); text-decoration: none; border-radius: var(--radius);
    font-size: 1.05rem;
}
.nav-link:hover { background: #eef3fa; }
.nav-link.active { background: var(--biru); color: #fff; font-weight: 700; }

.content { flex: 1; padding: 1.25rem 1.75rem; max-width: 1100px; }
.page-title { font-size: 1.7rem; margin: .2rem 0 1rem; }
.section-title { font-size: 1.3rem; margin: 1.5rem 0 .6rem; }

/* ── Tombol ── */
.btn {
    display: inline-block; cursor: pointer; text-decoration: none;
    background: #e9eef5; color: var(--teks); border: 1px solid var(--garis);
    padding: .6rem 1.1rem; border-radius: var(--radius); font-size: 1rem;
}
.btn:hover { background: #dde6f1; }
.btn-primary { background: var(--biru); color: #fff; border-color: var(--biru-tua); }
.btn-primary:hover { background: var(--biru-tua); }
.btn-danger { background: var(--merah); color: #fff; border-color: var(--merah); }
.btn-ghost { background: transparent; color: #fff; border-color: rgba(255,255,255,.6); }
.btn-lg { padding: .9rem 1.6rem; font-size: 1.15rem; }
.btn-sm { padding: .35rem .7rem; font-size: .9rem; }
.btn-block { width: 100%; }

/* ── Kartu ringkasan ── */
.actions { margin-bottom: 1rem; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1rem; }
.card { background: var(--kartu); border: 1px solid var(--garis); border-radius: var(--radius); padding: 1.1rem; }
.card-warn { background: var(--kuning); }
.card-label { color: var(--abu); font-size: .95rem; }
.card-value { font-size: 1.6rem; font-weight: 700; margin-top: .3rem; }

/* ── Tabel ── */
.table { width: 100%; border-collapse: collapse; background: #fff; margin-top: .5rem; }
.table th, .table td { border: 1px solid var(--garis); padding: .7rem .8rem; text-align: left; }
.table thead th { background: #eef3fa; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table .aksi { white-space: nowrap; }
.table .aksi form { display: inline; }
.table-narrow { max-width: 600px; }
.row-off { color: var(--abu); background: #fafafa; }
.row-minus { background: #fbe3e1; }                 /* stok minus: latar merah muda */
.row-minus .stok-cell { color: #b3261e; font-weight: 700; }
.row-low { background: #fff7e0; }                   /* stok menipis (<=5): kuning lembut */
.row-low .stok-cell { font-weight: 700; }

/* ── Toolbar & pencarian ── */
.toolbar, .actions { display: flex; gap: 1rem; flex-wrap: wrap; align-items: center; margin-bottom: 1rem; }
.search { margin-left: auto; display: flex; gap: .5rem; }

/* ── Form ── */
.form-card { background: #fff; border: 1px solid var(--garis); border-radius: var(--radius); padding: 1.5rem; max-width: 760px; }
.form-row { margin-bottom: 1rem; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; }
label { display: block; font-weight: 600; margin-bottom: .35rem; }
.input-lg, input[type=text], input[type=password], select {
    width: 100%; padding: .75rem .9rem; font-size: 1.05rem;
    border: 2px solid var(--garis); border-radius: var(--radius); background: #fff;
}
.input-lg:focus, input:focus, select:focus { outline: 3px solid #bcd4f0; border-color: var(--biru); }
.num { text-align: right; }
.form-check label { font-weight: 400; }
.form-actions { display: flex; gap: 1rem; margin-top: 1rem; }
.field-error { color: var(--merah); font-size: .95rem; margin-top: .3rem; }

/* ── Flash ── */
.flash { padding: .9rem 1.1rem; border-radius: var(--radius); margin: .5rem 0 1rem; font-size: 1.05rem; }
.flash-sukses { background: var(--hijau); border: 1px solid #9ccfae; }
.flash-error  { background: #fbe3e1; border: 1px solid #e3a6a1; color: #7a1c16; }

/* ── Halaman login ── */
.centered { display: flex; align-items: center; justify-content: center; min-height: 100vh; flex-direction: column; background: var(--biru); padding: 1rem; }
.login-card { background: #fff; padding: 2rem; border-radius: 14px; width: 100%; max-width: 380px; box-shadow: 0 10px 30px rgba(0,0,0,.2); }
.login-title { font-size: 1.5rem; margin: 0 0 .2rem; }
.login-sub { color: var(--abu); margin: 0 0 1.3rem; }
.login-card label { margin-top: .8rem; }

/* ── Placeholder & error ── */
.placeholder, .error-page { background: #fff; border: 1px solid var(--garis); border-radius: var(--radius); padding: 1.5rem; }
.placeholder-badge { display: inline-block; background: var(--kuning); border: 1px solid #e3cf8f; padding: .25rem .7rem; border-radius: 999px; font-size: .9rem; }
.muted { color: var(--abu); }
.error-page { max-width: 480px; text-align: center; }

/* ── Tambahan: penjualan ── */
.tebal { font-weight: 700; }
.badge { display: inline-block; padding: .2rem .6rem; border-radius: 999px; font-size: .9rem; }
.badge-ok { background: var(--hijau); border: 1px solid #9ccfae; }
.badge-warn { background: var(--kuning); border: 1px solid #e3cf8f; }
.badge-danger { background: #fbe3e1; border: 1px solid #e3a6a1; color: #7a1c16; }
/* Form penjualan dibuat selebar area konten + kolom proporsional */
.form-wide { max-width: 100%; }
.table-input { table-layout: fixed; }
.table-input th:nth-child(1), .table-input td:nth-child(1) { width: 44%; }   /* Barang */
.table-input th:nth-child(2), .table-input td:nth-child(2) { width: 14%; }   /* Qty */
.table-input th:nth-child(3), .table-input td:nth-child(3) { width: 20%; }   /* Harga */
.table-input th:nth-child(4), .table-input td:nth-child(4) { width: 16%; }   /* Subtotal */
.table-input th:nth-child(5), .table-input td:nth-child(5) { width: 6%; }    /* hapus */
.table-input td { vertical-align: middle; }
.table-input .input-lg { margin: 0; width: 100%; }
.table-input .produk { width: 100%; }
.table-input tfoot td { background: #f7f9fc; }
.grand span { font-size: 1.25rem; }
.card-value.sm { font-size: 1.1rem; }
.push-right { margin-left: auto; }
#tambahBaris { margin: .5rem 0 1rem; }

/* ── Filter bar (daftar penjualan) ── */
.filter-bar { display: flex; gap: 1rem; flex-wrap: wrap; align-items: flex-end;
    background: #fff; border: 1px solid var(--garis); border-radius: var(--radius); padding: 1rem; margin-bottom: 1rem; }
.filter-field { display: flex; flex-direction: column; min-width: 240px; }
.filter-field label { margin-bottom: .3rem; }
.filter-actions { display: flex; gap: .5rem; align-items: flex-end; }

/* ── Combo box pencarian ── */
.combo-wrap { position: relative; }
.combo-panel { position: absolute; z-index: 30; left: 0; right: 0; top: 100%;
    background: #fff; border: 2px solid var(--biru); border-top: 0;
    max-height: 300px; overflow-y: auto; border-radius: 0 0 var(--radius) var(--radius);
    box-shadow: 0 8px 20px rgba(0,0,0,.15); }
.combo-item { padding: .65rem .9rem; cursor: pointer; font-size: 1.05rem; }
.combo-item:hover { background: #eef3fa; }
.combo-empty { padding: .65rem .9rem; color: var(--abu); }

/* ── Header tabel yang bisa di-sort ── */
.table thead th .sort-link,
.table thead th.sort-link,
.sort-link { color: inherit; text-decoration: none; display: inline-block; white-space: nowrap; }
.sort-link:hover { text-decoration: underline; }
.table thead th a.sort-link { font-weight: 700; }

/* ── Pagination ── */
.pager { margin-top: 1rem; }
.pager-form { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; }
.pager-select { padding: .4rem .5rem; font-size: 1rem; border: 2px solid var(--garis); border-radius: var(--radius); }
.pager-info { color: var(--abu); }
.pager-jump { display: inline-flex; align-items: center; gap: .4rem; }
.page-input { width: 5rem; padding: .4rem .5rem; font-size: 1rem; border: 2px solid var(--garis); border-radius: var(--radius); text-align: center; }
.btn.is-disabled { opacity: .45; pointer-events: none; }

/* ── Laporan ── */
.report-card { text-decoration: none; color: inherit; transition: background .15s; }
.report-card:hover { background: #eef3fa; }
.laporan-periode { margin: .5rem 0 1rem; font-size: 1.05rem; }

/* ── Cetak laporan (browser print): sembunyikan navigasi & tombol ── */
@media print {
    .topbar, .sidebar, .toolbar, .filter-bar, .pager, .no-print { display: none !important; }
    .shell { display: block; }
    .content { padding: 0; max-width: none; }
    .page-title { margin: 0 0 .3rem; }
    .cards { gap: .4rem; }
    .card { border: 1px solid #999; }
    .table th, .table td { padding: .3rem .5rem; }
    a[href]::after { content: ""; }
}

/* ── Responsif (HP/tablet) ── */
@media (max-width: 780px) {
    .menu-toggle { display: block; }
    .sidebar { position: fixed; top: 56px; left: 0; bottom: 0; z-index: 20; transform: translateX(-100%); transition: transform .2s; box-shadow: 2px 0 12px rgba(0,0,0,.15); }
    .sidebar.open { transform: translateX(0); }
    .content { padding: 1rem; }
    .search { margin-left: 0; width: 100%; }
}
