* { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --green: #0b6e4f; --green-dark: #085539; --green-light: #e6f4ee;
  --bg: #f4f6f5; --card: #ffffff; --text: #1c2b25; --muted: #6b7d75;
  --warn: #b7791f; --danger: #c0392b; --border: #dde5e1;
}
html { font-size: 16px; }
body {
  font-family: "Segoe UI", Tahoma, Arial, sans-serif;
  background: var(--bg); color: var(--text);
  min-height: 100vh; display: flex; flex-direction: column;
}
.app-header {
  background: linear-gradient(135deg, var(--green), var(--green-dark));
  color: #fff; padding: 14px 16px; position: sticky; top: 0; z-index: 20;
  box-shadow: 0 2px 8px rgba(0,0,0,.18);
}
.header-inner { display: flex; gap: 12px; align-items: center; max-width: 720px; margin: 0 auto; }
.logo {
  width: 46px; height: 46px; border-radius: 12px; flex: none;
  background: rgba(255,255,255,.16); border: 1.5px solid rgba(255,255,255,.5);
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; font-weight: 800;
}
.app-header h1 { font-size: 1.15rem; }
.subtitle { font-size: .72rem; opacity: .85; line-height: 1.5; }
.net-badge {
  position: absolute; top: 12px; left: 12px;
  font-size: .7rem; padding: 3px 10px; border-radius: 999px; font-weight: 700;
}
.net-badge.online { background: #d1f2e3; color: #085539; }
.net-badge.offline { background: #fde2e2; color: #8f1d1d; }
main { flex: 1; width: 100%; max-width: 720px; margin: 0 auto; padding: 16px; }
.view { display: none; }
.view.active { display: block; animation: fade .2s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px);} to { opacity: 1; transform: none;} }
h2 { font-size: 1.05rem; margin-bottom: 12px; color: var(--green-dark); }
.card {
  background: var(--card); border: 1px solid var(--border); border-radius: 14px;
  padding: 14px; margin-bottom: 14px; box-shadow: 0 1px 3px rgba(10,40,30,.05);
}
.card-title { font-size: .95rem; margin-bottom: 4px; color: var(--green-dark); }
.stats-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 10px; margin-bottom: 14px; }
.stat-card { background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 12px 6px; text-align: center; }
.stat-num { font-size: 1.5rem; font-weight: 800; color: var(--green-dark); }
.stat-num.ok { color: var(--green); }
.stat-num.warn { color: var(--warn); }
.stat-label { font-size: .72rem; color: var(--muted); margin-top: 2px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1.5px solid var(--green); background: #fff; color: var(--green-dark);
  border-radius: 12px; padding: 11px 14px; font-size: .95rem; font-weight: 700;
  cursor: pointer; font-family: inherit; transition: filter .15s;
}
.btn:active { filter: brightness(.92); }
.btn.primary { background: var(--green); color: #fff; }
.btn.danger { border-color: var(--danger); color: var(--danger); background: #fff; }
.btn.big { width: 100%; font-size: 1.1rem; padding: 15px; margin-bottom: 12px; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.btn-row .btn { flex: 1; min-width: 100px; }
.sticky-actions { position: sticky; bottom: 10px; }
.field-label { display: block; font-size: .82rem; font-weight: 700; margin: 12px 0 5px; color: var(--text); }
.field-label:first-child { margin-top: 0; }
.req { color: var(--danger); }
input[type=text], input[type=search], input[type=file], select, textarea {
  width: 100%; border: 1.5px solid var(--border); border-radius: 10px;
  padding: 10px 12px; font-size: .95rem; font-family: inherit; background: #fbfdfc; color: var(--text);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--green); border-color: var(--green); }
.barcode-row { display: flex; gap: 8px; }
.barcode-row input { flex: 1; }
.barcode-row .btn { flex: none; }
.scanner-box { margin-top: 10px; }
.scanner-box video { width: 100%; border-radius: 10px; background: #000; max-height: 320px; }
.hidden { display: none !important; }
.photo-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.photo-slot {
  border: 1.5px dashed var(--border); border-radius: 12px; padding: 10px;
  text-align: center; position: relative; cursor: pointer; background: #fbfdfc;
}
.photo-slot > span { font-size: .78rem; font-weight: 700; display: block; margin-bottom: 8px; }
.photo-slot .thumb {
  height: 90px; border-radius: 8px; background: var(--green-light);
  display: flex; align-items: center; justify-content: center; overflow: hidden;
  color: var(--muted); font-size: 1.4rem;
}
.photo-slot .thumb::before { content: "📷"; }
.photo-slot.has-photo .thumb::before { content: none; }
.photo-slot .thumb img { width: 100%; height: 100%; object-fit: cover; }
.photo-slot input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.photo-slot.has-photo { border-style: solid; border-color: var(--green); }
.gov-list { display: flex; flex-direction: column; gap: 10px; }
.gov-row { font-size: .85rem; }
.gov-row .gov-head { display: flex; justify-content: space-between; margin-bottom: 4px; font-weight: 700; }
.gov-row .gov-head .gov-count { color: var(--muted); font-weight: 600; }
.progress-track { height: 10px; border-radius: 999px; background: #e8efec; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 999px; background: var(--green); transition: width .4s; }
.progress-fill.over { background: #1a9e6f; }
.hint { font-size: .75rem; color: var(--muted); margin-bottom: 8px; line-height: 1.6; }
.search-box { margin-bottom: 12px; }
.items-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.item-row {
  background: var(--card); border: 1px solid var(--border); border-radius: 12px;
  padding: 10px 12px; display: flex; gap: 10px; align-items: center; cursor: pointer;
}
.item-row .item-thumb { width: 52px; height: 52px; border-radius: 8px; object-fit: cover; flex: none; background: var(--green-light); }
.item-row .item-info { flex: 1; min-width: 0; }
.item-row .item-name { font-weight: 700; font-size: .9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item-row .item-meta { font-size: .72rem; color: var(--muted); }
.sync-pill { font-size: .65rem; padding: 2px 8px; border-radius: 999px; flex: none; font-weight: 700; }
.sync-pill.synced { background: #d1f2e3; color: #085539; }
.sync-pill.pending { background: #fdf0d5; color: #8a5a00; }
.toast {
  position: fixed; bottom: 24px; right: 50%; transform: translateX(50%);
  background: #17352a; color: #fff; padding: 12px 20px; border-radius: 12px;
  font-size: .88rem; z-index: 50; box-shadow: 0 4px 16px rgba(0,0,0,.3); max-width: 90vw;
}
.app-footer { text-align: center; font-size: .72rem; color: var(--muted); padding: 14px; }
