:root {
  --primary: #0F5A28; --primary-dark: #072611; --primary-light: #E8F5E9;
  --bg: #F8FAFC; --surface: #fff; --border: #E2E8F0; --text: #0F172A; --muted: #64748B;
  --radius: 12px; --touch: 44px;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
}
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
body { background: var(--bg); color: var(--text); line-height: 1.5; min-height: 100dvh; display: flex; flex-direction: column; padding-bottom: env(safe-area-inset-bottom, 1rem); -webkit-text-size-adjust: 100%; }
button { font-family: inherit; }

.app-bar { background: var(--surface); border-bottom: 1px solid var(--border); padding: .75rem 1rem; padding-top: max(.75rem, env(safe-area-inset-top)); display: flex; align-items: center; gap: .6rem; position: sticky; top: 0; z-index: 100; }
.badge-kt { background: var(--primary); color: #fff; font-weight: 800; font-size: .9rem; padding: .25rem .5rem; border-radius: 6px; letter-spacing: .5px; }
.brand-title { font-weight: 700; font-size: 1rem; color: var(--primary-dark); }

.app-main { flex: 1 0 auto; width: 100%; max-width: 600px; margin: 0 auto; padding: 1rem; display: flex; flex-direction: column; gap: 1rem; }
.card { background: var(--surface); border-radius: var(--radius); border: 1px solid var(--border); padding: 1rem; box-shadow: 0 1px 3px rgba(0,0,0,.04); }
.field { display: flex; flex-direction: column; gap: .4rem; }
.field:not(:last-child) { margin-bottom: .9rem; }
.label { font-size: .78rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }

.search-wrap { position: relative; display: flex; align-items: center; }
.search-icon { position: absolute; left: .85rem; color: #94A3B8; pointer-events: none; width: 18px; height: 18px; }
.input-search { width: 100%; height: var(--touch); padding: .5rem 2.4rem .5rem 2.5rem; font-size: 1rem; border: 1.5px solid var(--border); border-radius: 10px; background: #fff; color: var(--text); outline: none; transition: border-color .2s; }
.input-search:focus, .select-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(15,90,40,.1); }
.btn-clear { position: absolute; right: .6rem; width: 24px; height: 24px; background: var(--border); color: #475569; border: 0; border-radius: 50%; font-size: .95rem; line-height: 1; display: none; align-items: center; justify-content: center; cursor: pointer; }

.chips-row { display: flex; gap: .4rem; overflow-x: auto; padding-top: .4rem; scrollbar-width: none; }
.chips-row::-webkit-scrollbar { display: none; }
.chip { font-size: .75rem; font-weight: 600; color: var(--primary-dark); background: #F1F5F9; padding: .45rem .75rem; border-radius: 99px; white-space: nowrap; cursor: pointer; border: 1px solid transparent; }
.chip:active { background: var(--primary-light); border-color: var(--primary); color: var(--primary); }

.seg-group { display: flex; gap: 3px; background: #F1F5F9; padding: 3px; border-radius: 10px; overflow-x: auto; scrollbar-width: none; }
.seg-group::-webkit-scrollbar { display: none; }
.seg-btn { flex: 1 0 auto; height: 38px; padding: 0 .8rem; border: 0; background: transparent; border-radius: 8px; font-size: .8rem; font-weight: 600; color: var(--muted); cursor: pointer; white-space: nowrap; }
.seg-btn.active { background: #fff; color: var(--primary-dark); font-weight: 700; box-shadow: 0 1px 3px rgba(0,0,0,.08); }

.select-input { width: 100%; height: var(--touch); padding: .5rem .6rem; font-size: 1rem; font-weight: 600; color: var(--text); background: #fff; border: 1.5px solid var(--border); border-radius: 10px; outline: none; }

.status { font-size: .8rem; font-weight: 600; color: var(--muted); padding: 0 .2rem; }
.list { list-style: none; display: flex; flex-direction: column; gap: .6rem; }
.item { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: .85rem .9rem; }
.item-top { display: flex; justify-content: space-between; align-items: flex-start; gap: .5rem; }
.kom { background: none; border: 0; color: var(--primary-dark); font-weight: 700; font-size: .95rem; text-align: left; padding: 0; min-height: 28px; cursor: pointer; text-decoration: underline; text-decoration-color: #0F5A2855; text-underline-offset: 3px; }
.pill { font-size: .68rem; font-weight: 700; padding: .15rem .55rem; border-radius: 99px; white-space: nowrap; border: 1px solid transparent; }
.pill.pestisida { background: #F0FDF4; color: #166534; border-color: #86EFAC; }
.pill.logam_berat { background: #F1F5F9; color: #334155; border-color: #CBD5E1; }
.pill.mikotoksin { background: #FFFBEB; color: #92400E; border-color: #FCD34D; }
.pill.mikroba { background: #FEF2F2; color: #991B1B; border-color: #FCA5A5; }
.item-mid { display: flex; justify-content: space-between; align-items: baseline; gap: .75rem; margin-top: .35rem; }
.hazard { font-size: .88rem; overflow-wrap: anywhere; }
.val { font-weight: 800; font-size: 1.05rem; color: var(--primary); white-space: nowrap; }
.val small { font-weight: 600; font-size: .72rem; color: var(--muted); }
.note { font-size: .75rem; color: var(--muted); margin-top: .35rem; line-height: 1.35; }

.pager { display: flex; align-items: center; justify-content: space-between; gap: .5rem; font-size: .8rem; color: var(--muted); }
.pager button, .btn-close { min-height: var(--touch); padding: 0 1rem; font-size: .85rem; font-weight: 600; border-radius: 10px; border: 1px solid var(--border); background: #F1F5F9; color: var(--primary-dark); cursor: pointer; }
.pager button:disabled { opacity: .4; }

dialog { width: 100%; max-width: 600px; height: 90dvh; margin: auto auto 0; padding: 0; border: 0; border-radius: 18px 18px 0 0; background: var(--bg); color: var(--text); display: none; flex-direction: column; }
dialog[open] { display: flex; }
dialog::backdrop { background: rgba(15,23,42,.5); }
.dlghead { display: flex; align-items: center; justify-content: space-between; padding: .5rem .75rem; background: var(--surface); border-bottom: 1px solid var(--border); border-radius: 18px 18px 0 0; }
.grab { width: 36px; height: 4px; background: var(--border); border-radius: 4px; }
#detail { overflow-y: auto; flex: 1; padding: 1rem; display: flex; flex-direction: column; gap: .75rem; overscroll-behavior: contain; padding-bottom: calc(1.5rem + env(safe-area-inset-bottom)); }
#detail h2 { font-size: 1.15rem; color: var(--primary-dark); }
.sub-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: .9rem; }
.sub-title { font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); margin-bottom: .5rem; }
.rowline { display: flex; justify-content: space-between; gap: .75rem; padding: .4rem 0; border-bottom: 1px solid #F1F5F9; font-size: .85rem; }
.rowline:last-child { border-bottom: 0; }
.hs { font-size: .82rem; padding: .3rem 0; border-bottom: 1px solid #F1F5F9; }
.hs b { color: var(--primary-dark); font-variant-numeric: tabular-nums; }

.app-footer { text-align: center; padding: 1.5rem 1rem .5rem; font-size: .75rem; color: var(--muted); }
.app-footer strong { color: var(--primary-dark); }

@media (min-width: 700px) { dialog { margin: auto; border-radius: 18px; height: 85vh; } .dlghead { border-radius: 18px 18px 0 0; } }
