:root {
  --bg: #f6f7f5;
  --surface: #ffffff;
  --surface-2: #f0f2ee;
  --text: #1c211d;
  --muted: #5d665f;
  --border: #dde2dc;
  --accent: #1f7a4d;
  --accent-text: #ffffff;
  --ok: #1f7a4d;
  --ok-bg: #e5f3ea;
  --warn: #a35c00;
  --warn-bg: #fdf0dc;
  --idle: #5d665f;
  --idle-bg: #eceeea;
  --bad: #b3261e;
  --bad-bg: #fbe9e7;
  --g-organik: #2e9d5b;
  --g-non-organik: #2f6fd6;
  --g-unknown: #9b51e0;
  --g-dropped: #8a918b;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(20, 30, 20, 0.06), 0 4px 16px rgba(20, 30, 20, 0.05);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121513;
    --surface: #1a1e1b;
    --surface-2: #222723;
    --text: #e7ebe7;
    --muted: #9aa49c;
    --border: #2e3530;
    --accent: #4cc283;
    --accent-text: #0d1a12;
    --ok: #5fd193;
    --ok-bg: #173323;
    --warn: #f0b35c;
    --warn-bg: #3a2b14;
    --idle: #9aa49c;
    --idle-bg: #252a26;
    --bad: #f28b82;
    --bad-bg: #3b1d1b;
    --g-organik: #5fd193;
    --g-non-organik: #6fa3ff;
    --g-unknown: #c08bff;
    --g-dropped: #7d867f;
    --shadow: none;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2;
      stroke-linecap: round; stroke-linejoin: round; flex: none; }
.icon-lg { width: 36px; height: 36px; stroke-width: 1.6; }

h1, h2, h3, p { margin: 0; }
h1 { font-size: 18px; font-weight: 650; letter-spacing: -0.01em; }
h2 { font-size: 16px; font-weight: 650; margin-bottom: 6px; }
h3 { font-size: 13px; font-weight: 600; color: var(--muted); text-transform: uppercase;
     letter-spacing: 0.04em; margin: 22px 0 8px; }

.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  max-width: 1120px; margin: 0 auto; padding: 20px 16px 8px;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px;
  background: var(--accent); color: var(--accent-text);
}
.subtitle { color: var(--muted); font-size: 13px; }

.pill { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px;
        border-radius: 999px; font-size: 13px; border: 1px solid var(--border);
        background: var(--surface); white-space: nowrap; }
.pill .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--idle); }
.pill-ok .dot { background: var(--ok); }
.pill-bad .dot { background: var(--bad); }

.layout {
  display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 16px;
  max-width: 1120px; margin: 0 auto; padding: 8px 16px;
}
@media (max-width: 860px) { .layout { grid-template-columns: 1fr; } }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
        padding: 20px; box-shadow: var(--shadow); min-width: 0; }
.hint { color: var(--muted); }
.small { font-size: 13px; }

.dropzone {
  position: relative; margin: 16px 0 12px; border: 1.5px dashed var(--border);
  border-radius: 12px; background: var(--surface-2); min-height: 260px;
  display: grid; place-items: center; cursor: pointer; overflow: hidden;
  transition: border-color 0.15s, background 0.15s;
}
.dropzone:hover, .dropzone:focus-visible, .dropzone.drag { border-color: var(--accent); outline: none; }
.drop-empty { display: grid; justify-items: center; gap: 6px; text-align: center;
              padding: 24px; color: var(--muted); }
.drop-empty strong { color: var(--text); }
.preview { display: block; width: 100%; height: auto; max-height: 70vh; object-fit: contain; }
.busy { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center;
        gap: 8px; background: color-mix(in srgb, var(--surface) 72%, transparent);
        font-weight: 600; }
.spin { animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.btn { display: inline-flex; align-items: center; gap: 8px; padding: 9px 14px;
       border-radius: 10px; border: 1px solid var(--border); background: var(--surface);
       color: var(--text); font: inherit; font-weight: 600; cursor: pointer; }
.btn:hover { border-color: var(--accent); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn:focus-visible, .icon-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.segmented { border: 0; padding: 0; margin: 18px 0 6px; display: flex; flex-wrap: wrap; gap: 6px; }
.segmented legend { font-size: 13px; font-weight: 600; margin-bottom: 6px; padding: 0; }
.segmented label { position: relative; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented span { display: inline-block; padding: 7px 12px; border-radius: 9px;
                  border: 1px solid var(--border); cursor: pointer; font-size: 14px; }
.segmented input:checked + span { background: var(--accent); border-color: var(--accent);
                                  color: var(--accent-text); font-weight: 600; }
.segmented input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

.toggle { display: flex; align-items: center; gap: 8px; margin-top: 14px; font-size: 14px;
          cursor: pointer; }
.toggle input { accent-color: var(--accent); width: 16px; height: 16px; }

.result-empty { display: grid; justify-items: center; gap: 8px; padding: 48px 12px;
                color: var(--muted); text-align: center; }

.verdict { display: flex; gap: 14px; align-items: flex-start; padding: 16px; margin-top: 10px;
           border-radius: 12px; background: var(--idle-bg); color: var(--idle); }
.verdict .verdict-icon svg { width: 30px; height: 30px; }
.verdict-label { font-size: 22px; font-weight: 700; letter-spacing: -0.01em; }
.verdict-reason { color: var(--text); margin-top: 2px; }
.verdict.terpilah { background: var(--ok-bg); color: var(--ok); }
.verdict.tercampur { background: var(--warn-bg); color: var(--warn); }

.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px;
        border-radius: 999px; background: var(--surface-2); font-size: 13px; }
.chip i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

.composter { display: flex; gap: 8px; align-items: flex-start; margin-top: 14px;
             font-size: 14px; color: var(--muted); }

.objects { width: 100%; border-collapse: collapse; font-size: 14px; }
.objects th { text-align: left; font-weight: 600; color: var(--muted); font-size: 12px;
              border-bottom: 1px solid var(--border); padding: 6px 4px; }
.objects td { border-bottom: 1px solid var(--border); padding: 7px 4px; }
.objects .num { text-align: right; font-variant-numeric: tabular-nums; }
.objects td.none { color: var(--muted); text-align: center; padding: 14px 4px; }
.swatch { display: inline-block; width: 10px; height: 10px; border-radius: 3px;
          margin-right: 6px; vertical-align: baseline; }

#dropped-note { margin-top: 10px; }
.meta { margin-top: 14px; font-size: 12px; color: var(--muted); }

.error { display: flex; gap: 10px; margin-top: 12px; padding: 14px; border-radius: 12px;
         background: var(--bad-bg); color: var(--bad); }
.error p { color: var(--text); }

.footer { max-width: 1120px; margin: 0 auto; padding: 12px 16px 32px; color: var(--muted);
          font-size: 12px; display: grid; gap: 2px; }

.camera { border: 1px solid var(--border); border-radius: var(--radius); padding: 16px;
          background: var(--surface); color: var(--text); width: min(640px, calc(100vw - 32px)); }
.camera::backdrop { background: rgba(0, 0, 0, 0.55); }
.camera-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.camera video { width: 100%; border-radius: 10px; background: #000; display: block; margin-bottom: 12px; }
.icon-btn { border: 0; background: transparent; color: var(--text); cursor: pointer; padding: 6px;
            border-radius: 8px; display: grid; place-items: center; }

[hidden] { display: none !important; }
