/* ==========================================================================
   Base: reset, page defaults and small shared components
   (buttons, form fields, pills, switch, toast)
   ========================================================================== */

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

html, body {
  height: 100%;
  background: var(--bg-2);
  color: var(--text);
  font-family: var(--font);
  font-size: 13px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

[hidden] { display: none !important; }
button { font-family: var(--font); }

/* One visible focus ring for keyboard users, everywhere */
:focus-visible { outline: 2px solid var(--km-green); outline-offset: 2px; }
img { max-width: 100%; }


/* ---------- Buttons ----------
   Primary action = Kemenkes green everywhere. Pink is kept for highlights
   (active menu, key numbers, the main finding), never for buttons. */

.btn {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 6px 12px; border: none; border-radius: var(--rad);
  font-family: var(--font); font-size: 12px; font-weight: 500; white-space: nowrap;
  cursor: pointer; transition: all .12s;
}
.btn-ghost { background: transparent; color: var(--text-2); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--bg-3); border-color: var(--border-s); }
.btn-primary { background: var(--km-green); color: #fff; }
.btn-primary:hover { background: var(--km-green-d); }
.btn-lg { width: 100%; justify-content: center; padding: 11px 16px; font-size: 14px; font-weight: 600; border-radius: 8px; }
.btn-lg[disabled] { opacity: .45; cursor: not-allowed; }

/* Text-style button (pink link) */
.linkbtn {
  background: none; border: 0; padding: 0;
  color: var(--pink); font-size: 12px; font-weight: 600; text-decoration: none; cursor: pointer;
}


/* ---------- Form fields ---------- */

.lbl { display: flex; justify-content: space-between; margin-bottom: 5px; font-size: 12px; font-weight: 600; color: var(--text); }

.lg-input {
  width: 100%; padding: 10px 12px; outline: none;
  background: #fff; border: 1px solid var(--border-s); border-radius: 8px;
  font: inherit; font-size: 13.5px; color: var(--text);
}
.lg-input:focus { border-color: var(--km-green); box-shadow: 0 0 0 3px var(--km-green-m); }

.chk { display: flex; align-items: flex-start; gap: 8px; font-size: 12.5px; line-height: 1.45; color: var(--text-2); cursor: pointer; }
.chk input { margin-top: 2px; accent-color: var(--pink); }

.err  { font-size: 12px; color: var(--err); }
.hint { margin-top: 4px; font-size: 11px; color: var(--text-3); }


/* ---------- Pills ---------- */

/* Account role (user menu, settings) */
.role-pill { display: inline-block; margin-top: 1px; padding: 1px 6px; border-radius: 3px; font-size: 9.5px; font-weight: 700; letter-spacing: .04em; }
.role-pill.field  { background: var(--km-green-l); color: var(--km-green); }
.role-pill.policy { background: var(--km-teal-l);  color: var(--km-teal); }
.role-pill.admin  { background: var(--pink-l);     color: var(--pink); }

/* Record status (users and institutions tables) */
.status { padding: 2px 8px; border-radius: 10px; font-size: 11px; font-weight: 600; white-space: nowrap; }
.status.ok    { background: var(--km-green-l); color: var(--km-green); }
.status.wait  { background: #FEF6DC; color: #8A6A00; }
.status.off   { background: var(--bg-3); color: var(--text-3); }
.status.pilot { background: var(--pink-l); color: var(--pink); }


/* Confidence % colour (Data Kualitatif, dashboard findings) */
.conf-low  { color: var(--text-3); }
.conf-mid  { color: #B07F00; }
.conf-high { color: var(--pink); }


/* ---------- Toggle switch ---------- */

.switch { position: relative; flex-shrink: 0; width: 36px; height: 20px; }
.switch input { position: absolute; z-index: 1; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.switch i { position: absolute; inset: 0; background: var(--bg-4); border-radius: 10px; transition: background .15s; }
.switch i::after {
  content: ''; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px;
  background: #fff; border-radius: 50%; box-shadow: 0 1px 2px rgba(0, 0, 0, .2); transition: transform .15s;
}
.switch input:checked + i { background: var(--pink); }
.switch input:checked + i::after { transform: translateX(16px); }


/* ---------- Toast ---------- */

.toast {
  position: fixed; left: 50%; bottom: 24px; z-index: 900; transform: translateX(-50%);
  max-width: calc(100vw - 32px); padding: 10px 16px;
  background: var(--text); color: #fff; font-size: 12.5px; border-radius: 8px; box-shadow: var(--shadow-m);
}

/* Visually hidden, still read by screen readers */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
