/* ===== Tema "Kartu Stok Apotik" — dipakai bersama di semua halaman ===== */

:root {
--bg: #F7FAF8;
--surface: #FFFFFF;
--surface-2: #FBFDFC;
--green: #0F6E5D;
--green-dark: #0B5347;
--green-tint: #E4F3EE;
--ink: #132B24;
--muted: #6B7770;
--border: #E1E8E4;
--amber: #B8752E;
--amber-bg: #FBF0E2;
--red: #A83A3A;
--red-bg: #FBEBEB;
--radius: 12px;
}

{ box-sizing: border-box; }

body {
margin: 0;
background: var(--bg);
color: var(--ink);
font-family: 'IBM Plex Sans', -apple-system, Segoe UI, Roboto, sans-serif;
-webkit-font-smoothing: antialiased;
padding: 16px;
padding-top: max(16px, env(safe-area-inset-top, 0px));
padding-bottom: max(16px, env(safe-area-inset-bottom, 0px));
}

.mono { font-family: 'IBM Plex Mono', monospace; }

.wrap { max-width: 760px; margin: 0 auto; }

/* ---------- Header hijau dengan simbol palang ---------- */
.topbar {
background: var(--green);
color: #fff;
padding: 16px 18px 14px;
border-radius: var(--radius);
margin-bottom: 16px;
}
.topbar .brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 16px; }
.topbar .cross { width: 16px; height: 16px; position: relative; flex-shrink: 0; }
.topbar .cross::before, .topbar .cross::after { content: ''; position: absolute; background: #fff; border-radius: 2px; }
.topbar .cross::before { width: 16px; height: 4.5px; top: 5.75px; left: 0; }
.topbar .cross::after { width: 4.5px; height: 16px; top: 0; left: 5.75px; }
.topbar .sub { font-size: 11.5px; opacity: 0.88; margin-top: 4px; }
.topbar a.back { color: #fff; opacity: 0.85; font-size: 12.5px; text-decoration: none; display: inline-block; margin-bottom: 8px; }

/* ---------- Filter & pencarian ---------- */
.filters { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 8px; }
.filters label { font-size: 11.5px; color: var(--muted); display: block; margin-bottom: 3px; }

/* Input umum selain type=number agar tidak konflik dengan .qtybox */
select, input[type=text], input[type=date], input[type=password], input[type=file] {
width: 100%; height: 40px; border: 1px solid var(--border); border-radius: 9px;
padding: 0 11px; font-size: 13.5px; background: var(--surface); font-family: inherit; color: var(--ink);
}

/* Input number standar */
input[type=number] {
height: 40px; border: 1px solid var(--border); border-radius: 9px;
padding: 0 11px; font-size: 13.5px; background: var(--surface); font-family: inherit; color: var(--ink);
}

.searchrow { display: flex; gap: 8px; margin-bottom: 8px; }
.searchrow input { flex: 1; }
button, .btn {
height: 40px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface);
padding: 0 16px; font-size: 13.5px; cursor: pointer; font-family: inherit; color: var(--ink);
text-decoration: none; display: inline-flex; align-items: center; justify-content: center;
}
.btn-primary { background: var(--green); border-color: var(--green); color: #fff; font-weight: 600; }
.info, .note { font-size: 11.5px; color: var(--muted); margin: 4px 0 12px; }

/* ---------- Kartu outlet (dengan garis aksen hijau di atas) ---------- */
.card {
background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
padding: 13px 15px; margin-bottom: 9px; position: relative; overflow: hidden;
text-decoration: none; color: inherit; display: block;
}
.card::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px; background: var(--green); }
.card .name { font-size: 14px; font-weight: 600; margin: 0 0 3px; }
.card .sub { font-size: 11.5px; color: var(--muted); margin: 0; }
.card .row { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }

/* ---------- Badge / pill status ---------- */
.pill, .badge, .status {
font-size: 11px; font-weight: 500; padding: 3px 10px; border-radius: 20px;
white-space: nowrap; display: inline-flex; align-items: center; gap: 4px;
}
.pill::before, .badge::before, .status::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex-shrink: 0; }
.pill.done, .badge.done, .status.done, .pill.tidak { background: var(--green-tint); color: var(--green-dark); }
.pill.pending, .badge.pending, .status.pending, .pill.none { background: #F0F2F0; color: var(--muted); }
.pill.warn, .badge.warn, .pill.partial, .pill.ragu { background: var(--amber-bg); color: var(--amber); }
.pill.danger, .badge.danger, .pill.ya { background: var(--red-bg); color: var(--red); }

/* ---------- Item produk (form pengisian) ---------- */
.item, .visitcard {
background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
padding: 4px 16px; margin-bottom: 14px;
}
.item-row { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--border); gap: 10px; }
.item-row:last-child { border-bottom: none; }
.item-row .infocol { flex: 1; min-width: 0; }
.item-row .pname { font-size: 13px; font-weight: 500; margin: 0 0 2px; }
.item-row .pinfo { font-size: 11px; color: var(--muted); }
.item-row .pinfo b { color: var(--ink); font-weight: 600; }

/* Perbaikan spesifik untuk kotak input qty agar tetap kecil dan sejajar */
input.qtybox[type=number] {
width: 110px !important;
flex-shrink: 0;
text-align: right;
}

.visitcard { padding: 16px; margin-top: 6px; }
.visitcard .label { font-size: 11.5px; color: var(--muted); display: block; margin-bottom: 4px; }
.visitcard select, .visitcard input { margin-bottom: 10px; }

.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 10px; }
.grid label { font-size: 11px; color: var(--muted); display: block; margin-bottom: 3px; }

.submitbar { position: sticky; bottom: 0; background: var(--bg); padding: 12px 0; }
.submitbar button { width: 100%; height: 46px; border: none; border-radius: 10px; background: var(--green); color: #fff; font-size: 14.5px; font-weight: 600; }

.divider, hr.divider { border: none; border-top: 1px dashed var(--border); margin: 14px 0; }

/* ---------- Riwayat kunjungan ---------- */
.kunjungan, .visitentry {
background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
padding: 14px 16px; margin-bottom: 12px;
}
.kunjungan.terbaru, .visitentry.latest { border-color: var(--green); box-shadow: 0 0 0 2px rgba(15,110,93,0.08); }
.khead, .ve-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 10px; gap: 10px; }
.khead .waktu, .ve-time { font-size: 13.5px; font-weight: 600; margin: 0; }
.khead .oleh, .ve-by { font-size: 11px; color: var(--muted); margin: 2px 0 0; }
.tag-terbaru { font-size: 10px; background: var(--green-tint); color: var(--green-dark); padding: 2px 8px; border-radius: 20px; font-weight: 600; }
.hapusbtn, .ve-del { font-size: 11px; padding: 5px 10px; border: 1px solid #EAC5C5; border-radius: 8px; background: var(--red-bg); color: var(--red); cursor: pointer; }
.infobar { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.infobar span { font-size: 10.5px; padding: 3px 9px; border-radius: 20px; background: #F0F2F0; color: var(--muted); }
.infobar .ya { background: var(--red-bg); color: var(--red); }
.infobar .tidak { background: var(--green-tint); color: var(--green-dark); }
.infobar .ragu { background: var(--amber-bg); color: var(--amber); }

.fotogrid { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.fotogrid img, .thumb { width: 48px; height: 48px; border-radius: 8px; object-fit: cover; border: 1px solid var(--border); }

/* ---------- Tabel (laporan) ---------- */
.cards { display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; }
@media (max-width: 700px) { .cards { grid-template-columns: repeat(3, 1fr); } }
.cards .card2 { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; text-align: center; }
.cards .num { font-size: 18px; font-weight: 700; margin: 0; font-family: 'IBM Plex Mono', monospace; }
.cards .lbl { font-size: 9.5px; color: var(--muted); margin: 4px 0 0; }

table { width: 100%; border-collapse: collapse; background: var(--surface); font-size: 12.5px; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; }
th { background: var(--surface-2); color: var(--muted); font-weight: 600; font-size: 10.5px; text-transform: uppercase; }
tr:last-child td { border-bottom: none; }
.tablewrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 8px; background: var(--surface); }
td.mono, .item-table td.mono { font-family: 'IBM Plex Mono', monospace; }

h1 { font-size: 19px; font-weight: 700; margin: 0 0 14px; }
h2 { font-size: 13.5px; font-weight: 600; margin: 26px 0 8px; color: var(--green-dark); }

.msg, .err { padding: 10px 14px; border-radius: 9px; font-size: 13.5px; margin-bottom: 14px; }
.msg { background: var(--green-tint); color: var(--green-dark); }
.err { background: var(--red-bg); color: var(--red); }

.empty { text-align: center; color: var(--muted); padding: 36px 0; font-size: 13px; }