/* ============================================================
   Sistem Pembelian Barang China - stylesheet internal app
   Palet netral korporat: slate/navy + putih, rapi dan minim dekorasi.
   ============================================================ */

:root {
    --color-bg: #f4f6f8;
    --color-surface: #ffffff;
    --color-border: #e2e6ea;
    --color-text: #1f2733;
    --color-text-muted: #667085;
    --color-primary: #1e3a5f;
    --color-primary-dark: #16293f;
    --color-primary-soft: #eaf0f7;
    --color-accent: #2f6fa8;
    --color-success: #1b7f4d;
    --color-success-bg: #e7f6ee;
    --color-warning: #9a6400;
    --color-warning-bg: #fdf3d9;
    --color-danger: #b3261e;
    --color-danger-bg: #fbe9e7;
    --radius: 8px;
    --shadow: 0 1px 2px rgba(16, 24, 40, 0.06), 0 1px 3px rgba(16, 24, 40, 0.08);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: "Segoe UI", Roboto, -apple-system, BlinkMacSystemFont, Arial, sans-serif;
    background: var(--color-bg);
    color: var(--color-text);
    font-size: 14px;
    line-height: 1.5;
}

a { color: var(--color-accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- Topbar ---------- */
.topbar {
    background: var(--color-primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    height: 56px;
}
.topbar .brand {
    font-weight: 600;
    font-size: 15px;
    letter-spacing: .2px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.topbar .brand .dot {
    width: 8px; height: 8px; border-radius: 50%;
    background: #7fb2e3;
}
.topbar .brand a { color: #fff; }
.topbar .user-box {
    display: flex;
    align-items: center;
    gap: 14px;
    font-size: 13px;
}
.topbar .user-box .role-badge {
    background: rgba(255,255,255,.15);
    padding: 2px 9px;
    border-radius: 999px;
    font-size: 11px;
    letter-spacing: .3px;
}
.topbar .user-box a { color: #cfe0f2; }
.topbar .user-box a:hover { color: #fff; }

/* ---------- Breadcrumb / subheader ---------- */
.subheader {
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    padding: 12px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
}
.breadcrumb { font-size: 13px; color: var(--color-text-muted); }
.breadcrumb a { color: var(--color-text-muted); }
.breadcrumb .sep { margin: 0 6px; }
.page-title { font-size: 18px; font-weight: 600; margin: 0; }

/* ---------- Layout ---------- */
.container {
    max-width: 1180px;
    margin: 24px auto;
    padding: 0 24px;
}
.container.narrow { max-width: 760px; }

.card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px;
    margin-bottom: 20px;
}
.card > h3, .card > h2 {
    margin-top: 0;
}

/* ---------- Home: 2 menu besar ---------- */
.home-hero {
    text-align: center;
    margin: 60px auto 40px;
}
.home-hero h1 { font-size: 22px; margin-bottom: 4px; }
.home-hero p { color: var(--color-text-muted); margin-top: 0; }

.menu-grid-big {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 24px;
    max-width: 640px;
    margin: 0 auto;
}
.menu-tile-big {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 12px;
    box-shadow: var(--shadow);
    padding: 40px 20px;
    text-align: center;
    display: block;
    color: var(--color-text);
    transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease;
}
.menu-tile-big:hover {
    text-decoration: none;
    transform: translateY(-2px);
    border-color: var(--color-accent);
    box-shadow: 0 4px 14px rgba(16,24,40,.12);
}
.menu-tile-big .icon { font-size: 34px; margin-bottom: 12px; }
.menu-tile-big .label { font-size: 17px; font-weight: 600; letter-spacing: .3px; }
.menu-tile-big .desc { font-size: 12.5px; color: var(--color-text-muted); margin-top: 6px; }

/* ---------- Submenu grid (Pembelian hub) ---------- */
.menu-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
}
.menu-tile {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 22px 16px;
    text-align: center;
    display: block;
    color: var(--color-text);
    box-shadow: var(--shadow);
}
.menu-tile:hover { text-decoration: none; border-color: var(--color-accent); }
.menu-tile .icon { font-size: 24px; margin-bottom: 8px; }
.menu-tile .label { font-weight: 600; font-size: 13.5px; }
.menu-tile.disabled { opacity: .55; cursor: not-allowed; }
.menu-tile .badge-soon {
    display: inline-block; margin-top: 6px; font-size: 10.5px;
    background: var(--color-warning-bg); color: var(--color-warning);
    padding: 2px 8px; border-radius: 999px;
}

/* ---------- Forms ---------- */
label { display: block; font-size: 12.5px; font-weight: 600; color: var(--color-text-muted); margin-bottom: 4px; text-transform: uppercase; letter-spacing: .3px; }
.form-group { margin-bottom: 16px; }
input[type=text], input[type=number], input[type=date], input[type=password], input[type=email], select, textarea {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #cfd6dd;
    border-radius: 6px;
    font-size: 13.5px;
    font-family: inherit;
    background: #fff;
    color: var(--color-text);
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--color-accent);
    box-shadow: 0 0 0 3px rgba(47,111,168,.15);
}
textarea { resize: vertical; min-height: 70px; }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.help-text { font-size: 11.5px; color: var(--color-text-muted); margin-top: 4px; text-transform: none; }

/* ---------- Buttons ---------- */
.btn {
    display: inline-block;
    border: 1px solid transparent;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
}
.btn-primary { background: var(--color-primary); color: #fff; }
.btn-primary:hover { background: var(--color-primary-dark); text-decoration: none; color: #fff; }
.btn-secondary { background: #fff; border-color: #cfd6dd; color: var(--color-text); }
.btn-secondary:hover { border-color: var(--color-accent); text-decoration: none; }
.btn-danger { background: var(--color-danger); color: #fff; }
.btn-sm { padding: 4px 10px; font-size: 12px; }

/* ---------- Table ---------- */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data th, table.data td {
    padding: 9px 10px;
    border-bottom: 1px solid var(--color-border);
    text-align: left;
    white-space: nowrap;
}
table.data th {
    background: #f8fafb;
    font-weight: 600;
    color: var(--color-text-muted);
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: .3px;
}
table.data tbody tr:hover { background: #fafbfc; }
table.data td.num { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- Badges / status ---------- */
.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 11px; font-weight: 600; letter-spacing: .2px; }
.badge-open, .badge-active { background: var(--color-success-bg); color: var(--color-success); }
.badge-warn { background: var(--color-warning-bg); color: var(--color-warning); }
.badge-danger, .badge-cancelled, .badge-reversed { background: var(--color-danger-bg); color: var(--color-danger); }
.badge-muted { background: #eef0f2; color: var(--color-text-muted); }

/* ---------- Alerts / flash ---------- */
.alert { padding: 10px 14px; border-radius: 6px; margin-bottom: 16px; font-size: 13px; }
.alert-success { background: var(--color-success-bg); color: var(--color-success); }
.alert-danger { background: var(--color-danger-bg); color: var(--color-danger); }
.alert-warning { background: var(--color-warning-bg); color: var(--color-warning); }

/* ---------- Stat tiles ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat-tile { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius); padding: 14px 16px; }
.stat-tile .stat-label { font-size: 11px; text-transform: uppercase; color: var(--color-text-muted); letter-spacing: .3px; }
.stat-tile .stat-value { font-size: 20px; font-weight: 700; margin-top: 4px; }
.stat-tile.warn .stat-value { color: var(--color-warning); }
.stat-tile.danger .stat-value { color: var(--color-danger); }

.text-muted { color: var(--color-text-muted); }
.text-right { text-align: right; }
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }
.flex-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

/* ============================================================
   THEME REFRESH (2026-10-09) -- palet biru-putih + font Inter,
   dipakai di SELURUH halaman (semua aturan di bawah ini sengaja
   ditulis SETELAH blok asli di atas supaya menang di cascade
   tanpa perlu mengedit/menghapus baris lama).
   ============================================================ */
:root {
    --color-bg: #f8fafc;
    --color-surface: #ffffff;
    --color-border: #e5e9f0;
    --color-text: #0f172a;
    --color-text-muted: #64748b;
    --color-primary: #2563eb;
    --color-primary-dark: #1d4ed8;
    --color-primary-soft: #eef4ff;
    --color-accent: #2563eb;
    --color-success: #15803d;
    --color-success-bg: #e6f6ec;
    --color-warning: #b45309;
    --color-warning-bg: #fef3c7;
    --color-danger: #dc2626;
    --color-danger-bg: #fee2e2;
    --radius: 10px;
    --shadow: 0 1px 2px rgba(16, 24, 40, 0.05), 0 1px 3px rgba(16, 24, 40, 0.06);
    --color-topbar-bg: #ffffff;
    --color-topbar-text: var(--color-text);
    --color-topbar-border: var(--color-border);
}

body { font-family: 'Inter', "Segoe UI", Roboto, -apple-system, BlinkMacSystemFont, Arial, sans-serif; }

/* Topbar lama (dipakai semua halaman selain 4 landing Pembelian/Report/
   Monitoring/Pengaturan) -- diputihkan supaya senada dengan sidebar baru. */
.topbar {
    background: var(--color-topbar-bg);
    color: var(--color-topbar-text);
    border-bottom: 1px solid var(--color-topbar-border);
}
.topbar .brand a { color: var(--color-topbar-text); }
.topbar .user-box { color: var(--color-text-muted); }
.topbar .user-box .role-badge { background: var(--color-primary-soft); color: var(--color-primary); }
.topbar .user-box a { color: var(--color-text-muted); }
.topbar .user-box a:hover { color: var(--color-primary); }

/* Lambang "SC" (atau singkatan lain dari APP_SHORT_NAME) -- dipakai sebagai
   pengganti bulatan polos selama belum ada file assets/img/logo.png. */
.brand-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 9px;
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
    color: #fff;
    font-weight: 700;
    font-size: 12.5px;
    letter-spacing: .3px;
    flex: 0 0 auto;
}

/* ---------- App shell (sidebar + topbar baru) ----------
   Dipakai KHUSUS oleh 4 halaman landing yang dibuka dari card Home:
   Pembelian, Report, Monitoring, Pengaturan -- lewat
   includes/section_header.php + includes/section_footer.php.
   Halaman lain (Home, login, dan semua halaman turunan di dalam tiap
   modul) tetap pakai shell lama (.topbar + .container) di atas,
   cuma ikut tema warna/font baru lewat variabel yang sama. */
.app-shell-body { margin: 0; background: var(--color-bg); }
.app-shell { display: flex; min-height: 100vh; align-items: stretch; }

.app-sidebar {
    width: 240px;
    flex: 0 0 240px;
    background: var(--color-surface);
    border-right: 1px solid var(--color-border);
    display: flex;
    flex-direction: column;
    padding: 18px 14px;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}
.app-sidebar-brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 22px; text-decoration: none; }
.app-sidebar-brand:hover { text-decoration: none; }
.app-sidebar-brand .brand-name { font-weight: 700; font-size: 14.5px; color: var(--color-text); }
.app-sidebar-nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: 8px;
    color: var(--color-text-muted);
    font-size: 13.5px;
    font-weight: 500;
    text-decoration: none;
}
.nav-item:hover { background: #f1f5f9; text-decoration: none; color: var(--color-text); }
.nav-item.active { background: var(--color-primary-soft); color: var(--color-primary); font-weight: 600; }
.nav-icon { font-size: 15px; width: 18px; text-align: center; flex: 0 0 auto; }
.nav-item-disabled { display: flex; align-items: center; gap: 10px; padding: 9px 12px; font-size: 13.5px; color: #c3c9d2; cursor: not-allowed; }
.app-sidebar-back {
    margin-top: 10px;
    padding: 12px 12px 4px;
    border-top: 1px solid var(--color-border);
    font-size: 12px;
    color: var(--color-text-muted);
    text-decoration: none;
    display: block;
}
.app-sidebar-back:hover { color: var(--color-primary); text-decoration: none; }

.app-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.app-topbar {
    height: 64px;
    flex: 0 0 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 0 28px;
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
}
.app-search {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: 999px;
    padding: 8px 16px;
    max-width: 420px;
    flex: 1;
}
.app-search input { border: none; background: transparent; outline: none; font-size: 13.5px; width: 100%; color: var(--color-text); padding: 0; text-transform: none; }
.app-search-icon { font-size: 13px; opacity: .55; }
.app-search-spacer { flex: 1; }
.app-topbar-actions { display: flex; align-items: center; gap: 14px; flex: 0 0 auto; }
.icon-btn {
    width: 36px; height: 36px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    background: var(--color-bg); font-size: 15px; text-decoration: none;
}
.icon-btn:hover { background: var(--color-primary-soft); text-decoration: none; }
.user-menu { position: relative; }
.user-menu summary { list-style: none; cursor: pointer; }
.user-menu summary::-webkit-details-marker { display: none; }
.avatar {
    width: 36px; height: 36px; border-radius: 50%;
    background: var(--color-primary); color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-weight: 600; font-size: 13px;
}
.user-menu-panel {
    position: absolute; right: 0; top: 44px;
    background: var(--color-surface); border: 1px solid var(--color-border);
    border-radius: 10px; box-shadow: 0 8px 24px rgba(16,24,40,.14);
    padding: 12px 14px; min-width: 170px; z-index: 20;
}
.user-menu-name { font-weight: 600; font-size: 13px; margin-bottom: 6px; color: var(--color-text); }
.user-menu-panel .role-badge { display: inline-block; background: var(--color-primary-soft); color: var(--color-primary); font-size: 10.5px; padding: 2px 8px; border-radius: 999px; margin-bottom: 10px; letter-spacing: .2px; }
.user-menu-panel a { display: block; font-size: 12.5px; color: var(--color-danger); }

.app-content { padding: 28px; max-width: 1280px; width: 100%; margin: 0 auto; }
.app-page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.app-page-head h1 { font-size: 21px; margin: 0; }
.app-page-subtitle { color: var(--color-text-muted); font-size: 13px; margin: 4px 0 0; }
.app-page-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.app-page-actions select {
    font-size: 13px; padding: 8px 12px; border-radius: 8px; border: 1px solid var(--color-border);
    background: var(--color-surface); color: var(--color-text);
}
.app-page-actions .range-label { font-size: 12px; color: var(--color-text-muted); }

@media (max-width: 860px) {
    .app-shell { flex-direction: column; }
    .app-sidebar { width: 100%; flex: 0 0 auto; height: auto; position: relative; flex-direction: row; align-items: center; overflow-x: auto; gap: 14px; }
    .app-sidebar-brand { padding: 4px 8px; }
    .app-sidebar-nav { flex-direction: row; flex: 0 0 auto; }
    .nav-item { white-space: nowrap; }
    .app-sidebar-back { display: none; }
    .app-content { padding: 16px; }
    .app-topbar { padding: 0 16px; }
    .dashboard-grid-2 { grid-template-columns: 1fr; }
}

/* ---------- Dashboard Pembelian ---------- */
.stat-card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin-bottom: 20px; }
.stat-card { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 20px; }
.stat-card-icon {
    width: 38px; height: 38px; border-radius: 10px; background: var(--color-primary-soft);
    display: flex; align-items: center; justify-content: center; font-size: 17px; margin-bottom: 14px;
}
.stat-card-label { font-size: 12.5px; color: var(--color-text-muted); }
.stat-card-value { font-size: 23px; font-weight: 700; margin-top: 4px; color: var(--color-text); }
.stat-card-delta { font-size: 11.5px; margin-top: 9px; display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.stat-card-delta.good { color: var(--color-success); }
.stat-card-delta.bad { color: var(--color-danger); }
.stat-card-delta.muted { color: var(--color-text-muted); }
.stat-card-delta .stat-delta-label { color: var(--color-text-muted); font-weight: 400; }

.dashboard-grid-2 { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; margin-bottom: 20px; align-items: start; }

.chart-card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; flex-wrap: wrap; gap: 8px; }
.chart-toggle-group { display: flex; gap: 2px; background: var(--color-bg); padding: 3px; border-radius: 999px; }
.chart-toggle-btn { padding: 5px 13px; border-radius: 999px; font-size: 12px; font-weight: 600; color: var(--color-text-muted); text-decoration: none; }
.chart-toggle-btn.active { background: var(--color-surface); color: var(--color-primary); box-shadow: 0 1px 2px rgba(16,24,40,.08); }
.chart-toggle-btn:hover { text-decoration: none; }

.trend-chart { width: 100%; height: auto; display: block; }
.chart-grid { stroke: var(--color-border); stroke-width: 1; }
.chart-axis-label { fill: var(--color-text-muted); font-size: 10px; font-family: inherit; }
.trend-area { fill: var(--color-primary); opacity: .12; }
.trend-line { fill: none; stroke: var(--color-primary); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.trend-end-dot { fill: var(--color-primary); stroke: #fff; stroke-width: 2; }
.chart-hit { fill: transparent; cursor: pointer; }
.chart-hit:hover { fill: var(--color-primary); opacity: .18; }

.supplier-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--color-border); }
.supplier-row:last-child { border-bottom: none; padding-bottom: 0; }
.supplier-row:first-child { padding-top: 0; }
.supplier-row-main { flex: 0 0 auto; min-width: 0; max-width: 130px; }
.supplier-row-name { font-size: 12.5px; font-weight: 600; color: var(--color-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.supplier-row-amount { flex: 0 0 auto; font-size: 11.5px; color: var(--color-text-muted); text-align: right; white-space: nowrap; }
.supplier-row-pct { flex: 0 0 34px; font-size: 11.5px; color: var(--color-text-muted); text-align: right; }
.supplier-track { flex: 1; height: 7px; border-radius: 999px; background: var(--color-primary-soft); overflow: hidden; min-width: 40px; }
.supplier-track-fill { height: 100%; border-radius: 999px; background: var(--color-primary); }

/* ---------- Combo Select (2026-10-19) ----------
   Dropdown yang bisa diketik buat nyari, pengganti <select> panjang (mis. daftar
   supplier) -- lihat combo_select() di includes/functions.php dan
   assets/js/combo-select.js. Base style input teks-nya sudah ikut rule
   input[type=text] di atas, di sini cuma nambah panel saran + state error. */
.combo-select { position: relative; }
.combo-select .combo-input:disabled { background: var(--color-bg); color: var(--color-text-muted); cursor: not-allowed; }
.combo-input-error { border-color: var(--color-danger) !important; box-shadow: 0 0 0 3px var(--color-danger-bg) !important; }
.combo-menu {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    z-index: 60;
    max-height: 260px;
    overflow-y: auto;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius, 8px);
    box-shadow: var(--shadow, 0 4px 14px rgba(16,24,40,.12));
}
.combo-menu.open { display: block; }
.combo-menu-item {
    padding: 8px 12px;
    font-size: 13.5px;
    color: var(--color-text);
    cursor: pointer;
    white-space: normal;
    overflow-wrap: break-word;
    line-height: 1.35;
}
.combo-menu-item:hover,
.combo-menu-item.active { background: var(--color-primary-soft); color: var(--color-primary-dark); }
.combo-menu-empty { padding: 8px 12px; font-size: 12.5px; color: var(--color-text-muted); }
