/* ============================================================
   flo. — Cupping Scorecard (COE)
   Design system mengikuti flocoffee.id:
   - Background  : #FFFFFF
   - Teks        : #000000
   - Aksen       : netral #F4F1EC (krem lembut untuk bidang)
   - Tipografi   : Fraunces (serif dekoratif) + Poppins (headline)
                   + Inter (body) + Lato (sub-headline)
   - Radius      : 2px (tajam, minimal)
   ============================================================ */
:root {
  --bg: #ffffff;
  --ink: #000000;
  --muted: #6b6b6b;
  --line: #e5e5e5;
  --cream: #f4f1ec;
  --cream-deep: #ebe6de;
  --track: #d8d8d8;
  --serif: "Fraunces", Georgia, "Times New Roman", serif;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --headline: "Poppins", "Inter", -apple-system, sans-serif;
  --subheadline: "Lato", "Inter", -apple-system, sans-serif;
  --radius: 2px;
  --maxw: 1080px;
  --danger: #b3261e;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

/* PENTING: atribut [hidden] harus selalu menang (gotcha display:flex) */
[hidden] { display: none !important; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 32px 24px 72px; }

/* ── Header ─────────────────────────── */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding-bottom: 24px; border-bottom: 1px solid var(--line);
}
.brand {
  font-family: var(--headline); font-weight: 600; font-size: 22px;
  letter-spacing: -0.02em;
}
.brand .brand-sub { font-family: var(--subheadline); font-weight: 400; font-size: 12px; color: var(--muted); margin-left: 8px; letter-spacing: 0.04em; }
.topbar-right { display: flex; align-items: center; gap: 14px; }
.eyebrow {
  font-size: 11px; letter-spacing: 0.22em; text-transform: uppercase;
  color: var(--muted);
}
.btn-ghost-nav {
  border: 1px solid var(--ink); color: var(--ink); background: transparent;
  padding: 9px 20px; font-size: 13px; font-weight: 500; letter-spacing: 0.02em;
  border-radius: var(--radius); cursor: pointer; transition: all .2s;
}
.btn-ghost-nav:hover { background: var(--ink); color: #fff; }

.hero { padding: 40px 0 12px; }
.hero h1 {
  font-family: var(--headline); font-size: clamp(28px, 4vw, 40px);
  font-weight: 500; letter-spacing: -0.01em; line-height: 1.15;
}
.hero .sub { color: var(--muted); margin-top: 8px; max-width: 600px; font-size: 15px; }

/* ── Cards ──────────────────────────── */
.card {
  border-top: 1px solid var(--line);
  padding: 28px 0;
  margin-top: 8px;
}
.card-title {
  font-family: var(--headline); font-size: 15px; font-weight: 500;
  margin-bottom: 18px;
}

.meta-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px;
}
.field { display: flex; flex-direction: column; gap: 6px; }
.field span { font-size: 12px; color: var(--muted); }
input[type="text"], input[type="password"], input[type="date"], select, textarea {
  background: var(--cream);
  border: 1px solid transparent;
  border-radius: var(--radius);
  color: var(--ink);
  padding: 11px 13px;
  font: inherit;
  width: 100%;
  outline: none;
  transition: border-color .15s, background .15s;
}
select { cursor: pointer; }
input:focus, select:focus, textarea:focus { border-color: var(--ink); background: #fff; }
textarea { resize: vertical; }

/* ── Sliders ────────────────────────── */
.sliders {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
  gap: 26px 34px;
}
.slider-block { display: flex; flex-direction: column; gap: 8px; }
.slider-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.slider-head label { font-size: 14px; font-weight: 500; }
.slider-head .val {
  font-family: var(--subheadline); font-weight: 700; font-size: 16px;
  min-width: 40px; text-align: right;
}

input[type="range"] {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 6px; border-radius: 0;
  background: var(--track);
  outline: none; cursor: pointer;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 17px; height: 17px; border-radius: 50%;
  background: var(--ink);
  border: 3px solid #fff;
  box-shadow: 0 0 0 1px var(--ink);
  transition: transform .1s;
}
input[type="range"]::-webkit-slider-thumb:hover { transform: scale(1.15); }
input[type="range"]::-moz-range-thumb {
  width: 17px; height: 17px; border-radius: 50%;
  background: var(--ink); border: 3px solid #fff;
  box-shadow: 0 0 0 1px var(--ink);
}
input[type="range"]::-moz-range-track { background: transparent; }

.markers {
  display: flex; justify-content: space-between;
  font-size: 11px; color: var(--muted); padding: 0 2px;
}

.hint { font-size: 12px; color: var(--muted); margin-top: 6px; }

/* ── Autocomplete & chips ───────────── */
.autocomplete { position: relative; }
.suggestions {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 20;
  background: #fff; border: 1px solid var(--ink);
  border-radius: var(--radius); max-height: 260px; overflow-y: auto; display: none;
}
.suggestions.open { display: block; }
.suggestions div { padding: 9px 13px; cursor: pointer; font-size: 14px; border-bottom: 1px solid var(--line); }
.suggestions div:last-child { border-bottom: none; }
.suggestions div:hover, .suggestions div.active { background: var(--cream); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.chip {
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--ink); color: #fff;
  padding: 4px 11px; border-radius: var(--radius); font-size: 13px;
}
.chip button {
  background: none; border: none; color: inherit; cursor: pointer;
  font-size: 14px; line-height: 1; padding: 0;
}

/* ── Total & actions ────────────────── */
.total-card {
  border-top: 1px solid var(--line);
  padding: 32px 0;
  text-align: center;
}
.total-label { font-size: 11px; letter-spacing: 0.22em; text-transform: uppercase; color: var(--muted); }
.total-value {
  font-family: var(--serif); font-size: clamp(56px, 8vw, 76px);
  font-weight: 400; line-height: 1.1; margin: 8px 0 4px;
}
.total-breakdown { color: var(--muted); font-size: 13px; margin-bottom: 24px; }

.actions { display: flex; justify-content: center; gap: 12px; flex-wrap: wrap; }
.btn {
  display: inline-block;
  padding: 13px 30px;
  font-size: 14px; font-weight: 500; letter-spacing: 0.02em;
  border-radius: var(--radius); cursor: pointer;
  transition: all .2s; text-align: center;
}
.btn-dark { background: var(--ink); color: #fff; border: 1px solid var(--ink); }
.btn-dark:hover { background: #222; }
.btn-ghost { border: 1px solid var(--ink); color: var(--ink); background: transparent; }
.btn-ghost:hover { background: var(--ink); color: #fff; }
.btn-danger { border: 1px solid var(--danger); color: var(--danger); background: transparent; font-size: 12px; padding: 6px 14px; }
.btn-danger:hover { background: var(--danger); color: #fff; }

/* ── Riwayat ────────────────────────── */
.history-item {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 12px;
  background: #fff;
}
.history-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.history-head .h-sample { font-weight: 600; }
.history-head .h-date { font-size: 12px; color: var(--muted); }
.history-total { font-family: var(--serif); font-size: 30px; margin: 6px 0; }
.history-meta { font-size: 12px; color: var(--muted); }
.history-desc { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.history-desc .chip { font-size: 12px; padding: 2px 9px; }
.history-notes { margin-top: 8px; font-size: 13px; color: var(--muted); white-space: pre-wrap; }
.empty { color: var(--muted); text-align: center; padding: 24px 0; }

/* ── Modal ──────────────────────────── */
.overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.55);
  display: flex; align-items: center; justify-content: center; z-index: 50;
}
.modal {
  background: #fff; border: 1px solid var(--ink);
  border-radius: var(--radius); padding: 28px; width: min(380px, 90vw);
}
.modal h3 { font-family: var(--headline); font-weight: 500; margin-bottom: 4px; }
.modal .muted { color: var(--muted); font-size: 13px; margin-bottom: 16px; }
.modal-actions { display: flex; gap: 10px; margin-top: 14px; }
.modal-actions .btn { flex: 1; }
.error { color: var(--danger); font-size: 13px; margin-top: 10px; }

/* ── Toast ──────────────────────────── */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--ink); color: #fff;
  padding: 13px 22px; border-radius: var(--radius); z-index: 60;
  font-size: 14px; box-shadow: 0 6px 24px rgba(0,0,0,0.25);
}
.toast.err { background: var(--danger); }

.foot { text-align: center; color: var(--muted); font-size: 12px; margin-top: 40px; }

@media (max-width: 640px) {
  .wrap { padding: 24px 16px 56px; }
  .hero h1 { font-size: 26px; }
  .total-value { font-size: 52px; }
  .eyebrow { display: none; }
}
