/* Intertek Petro Inventory — tema warna */
:root {
  --navy: #282F44;
  --navy-2: #3A4360;
  --gold: #E6AF2E;
  --yellow: #F5D061;
  --bg: #ECECEC;
  --card: #FFFFFF;
  --line: #DEDEDE;
  --line-2: #CDCDCD;
  --text: #282F44;
  --muted: #5A6178;
  --muted-2: #B9C2D0;
  --red: #B42318;
  --red-bg: #FEE4E2;
  --blue: #175CD3;
  --blue-bg: #EFF8FF;
  --gold-dark: #8A6410;
  --radius: 10px;
  font-family: 'IBM Plex Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font-size: 14px; }
h1, h2, h3 { margin: 0; }
a { color: var(--navy); }
button, input, select, textarea { font: inherit; color: inherit; }
.mono { font-family: 'IBM Plex Mono', ui-monospace, monospace; font-size: 13px; }
.muted { color: var(--muted); }
.hidden { display: none !important; }

/* ---------- Tombol & form ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: 8px; padding: 0 16px; min-height: 44px; font-weight: 600; cursor: pointer; white-space: nowrap; text-decoration: none; }
.btn-primary { background: var(--gold); color: var(--navy); }
.btn-primary:hover { background: #d9a225; }
.btn-dark { background: var(--navy); color: #fff; }
.btn-dark:hover { background: var(--navy-2); }
.btn-light { background: var(--bg); color: var(--navy); }
.btn-light:hover { background: #e0e0e0; }
.btn-link { background: none; border: 0; padding: 0; color: var(--navy); font-weight: 600; cursor: pointer; text-decoration: underline; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.inp { width: 100%; min-height: 44px; border: 1px solid var(--line-2); border-radius: 8px; padding: 0 12px; background: #fff; }
textarea.inp { padding: 10px 12px; min-height: 70px; }
.inp:focus, .btn:focus-visible, .chip:focus-visible, .nav-btn:focus-visible { outline: 3px solid var(--yellow); outline-offset: 1px; }
.lbl { display: block; font-size: 13px; font-weight: 600; color: var(--navy-2); margin-bottom: 6px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.form-grid .full { grid-column: 1 / -1; }
@media (max-width: 520px) { .form-grid { grid-template-columns: 1fr; } }

/* ---------- Kartu, tabel, pill ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.card-pad { padding: 20px; }
.card-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; padding: 16px 20px; }
.card-title { font-size: 16px; font-weight: 700; }
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); padding: 10px 14px; border-bottom: 1px solid var(--line); background: #F6F6F6; white-space: nowrap; }
.tbl td { padding: 11px 14px; border-bottom: 1px solid var(--bg); white-space: nowrap; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl td.wrap { white-space: normal; }
.pill { flex: none; align-self: flex-start; display: inline-block; font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 999px; white-space: nowrap; }
.pill-critical { background: var(--red-bg); color: var(--red); }
.pill-low { background: var(--yellow); color: var(--navy); }
.pill-near { background: var(--blue-bg); color: var(--blue); }
.pill-safe { background: var(--bg); color: var(--navy-2); }
.pill-in { background: var(--blue-bg); color: var(--blue); }
.pill-out { background: var(--yellow); color: var(--navy); }
.pill-adj { background: var(--bg); color: var(--navy-2); }
.pill-warning { background: var(--yellow); color: var(--navy); }
.pill-info { background: var(--blue-bg); color: var(--blue); }
.qty-in { color: var(--blue); font-weight: 600; }
.qty-out { color: var(--gold-dark); font-weight: 600; }
.chip { border: 1px solid var(--line-2); background: #fff; color: var(--navy-2); border-radius: 999px; padding: 0 14px; min-height: 36px; font-size: 13px; font-weight: 500; cursor: pointer; }
.chip.active { background: var(--navy); color: #fff; border-color: var(--navy); }
.empty { padding: 28px; text-align: center; color: var(--muted); }
.level-bar { height: 10px; background: var(--bg); border-radius: 99px; overflow: hidden; min-width: 140px; }
.level-bar > div { height: 100%; border-radius: 99px; }

/* ---------- Toast & modal ---------- */
#toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--navy); color: #fff; padding: 12px 18px; border-radius: 10px; box-shadow: 0 10px 30px #0003; z-index: 100; max-width: calc(100% - 32px); font-weight: 500; }
#toast.error { background: var(--red); }
.modal-back { position: fixed; inset: 0; background: #282F4499; display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 50; }
.modal { background: #fff; border-radius: 14px; width: 100%; max-width: 560px; max-height: calc(100vh - 32px); overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.scan-box { width: 100%; min-height: 240px; background: #111; border-radius: 12px; overflow: hidden; }
.scan-box video { width: 100% !important; }

/* ---------- Login ---------- */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; background: var(--navy); }
.login-card { background: #fff; border-radius: 14px; padding: 28px; width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 16px; }
.logo { width: 44px; height: 44px; border-radius: 9px; background: var(--gold); color: var(--navy); display: flex; align-items: center; justify-content: center; font-weight: 700; flex: none; }
.err { color: var(--red); font-size: 13px; }

/* ---------- Layout web admin ---------- */
.shell { display: flex; flex-wrap: wrap; min-height: 100vh; }
.sidebar { flex: 1 1 236px; max-width: 100%; background: var(--navy); color: #fff; padding: 22px 14px; display: flex; flex-direction: column; gap: 22px; }
.brand { display: flex; align-items: center; gap: 12px; padding: 0 6px; }
.brand b { display: block; font-size: 15px; }
.brand span { font-size: 12px; color: var(--muted-2); }
.nav { display: flex; flex-direction: column; gap: 4px; }
.nav-btn { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 14px; border: 0; border-radius: 8px; background: transparent; color: #ECECEC; font-size: 14px; cursor: pointer; text-align: left; min-height: 44px; text-decoration: none; }
.nav-btn:hover { background: var(--navy-2); }
.nav-btn.active { background: var(--gold); color: var(--navy); font-weight: 600; }
.nav-btn .badge { margin-left: auto; background: var(--yellow); color: var(--navy); font-size: 12px; font-weight: 700; padding: 1px 8px; border-radius: 99px; }
.nav-label { font-size: 11px; font-weight: 600; letter-spacing: .08em; color: var(--muted-2); padding: 0 14px; }
.side-foot { margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-top: 1px solid #ffffff22; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--navy-2); display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 600; flex: none; }
.main { flex: 999 1 560px; min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; padding: 18px 28px; background: #fff; border-bottom: 1px solid var(--line); position: relative; }
.topbar h1 { font-size: 22px; }
.topbar .sub { font-size: 13px; color: var(--muted); }
.content { padding: 24px 28px 40px; display: flex; flex-direction: column; gap: 20px; }
@media (max-width: 700px) { .content { padding: 16px; } .topbar { padding: 14px 16px; } }
.bell { position: relative; padding: 0 12px; }
.bell .dot { position: absolute; top: 4px; right: 2px; background: var(--red); color: #fff; font-size: 11px; font-weight: 700; border-radius: 99px; padding: 1px 6px; }
.notif-panel { position: absolute; right: 28px; top: 76px; width: 400px; max-width: calc(100% - 32px); z-index: 30; box-shadow: 0 12px 32px #28304433; max-height: 70vh; overflow-y: auto; }
.notif-row { display: flex; gap: 12px; padding: 10px 16px; border-top: 1px solid var(--bg); }
.notif-row.read { opacity: .6; }

.grid-kpi { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.kpi { padding: 18px; display: flex; flex-direction: column; gap: 6px; }
.kpi .k-label { font-size: 13px; color: var(--muted); }
.kpi .k-val { font-size: 30px; font-weight: 700; }
.kpi .k-sub { font-size: 12px; color: var(--muted); }
.grid-areas { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 16px; }
.area-card { overflow: hidden; display: flex; flex-direction: column; }
.area-card .bar { height: 6px; }
.row { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-start; }
.row > .grow-2 { flex: 2 1 520px; min-width: 0; }
.row > .grow-1 { flex: 1 1 320px; min-width: 0; }
.scan-drop { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; min-height: 120px; border: 2px dashed #98A2B3; border-radius: 10px; background: #F6F6F6; padding: 16px; text-align: center; }
.found { display: flex; gap: 12px; align-items: center; background: var(--blue-bg); border: 1px solid #B2DDFF; border-radius: 8px; padding: 12px; }
.found.warn { background: #FDF6DC; border-color: var(--yellow); }
.alert { display: flex; gap: 12px; align-items: flex-start; background: #FDF6DC; border: 1px solid var(--yellow); border-radius: 8px; padding: 12px 14px; font-size: 13px; }
.chart-box { position: relative; height: 260px; }

@media print { .no-print { display: none !important; } }
