/* SK Ops Dashboard — Sembang Kencang */

:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --surface-2: #f0f1f4;
  --border: #e2e4e9;
  --text: #1c1e26;
  --text-muted: #6b7280;
  --brand: #d6336c;
  --brand-soft: #fdeef4;
  --green: #16a34a;
  --green-soft: #e6f6ec;
  --yellow: #b45309;
  --yellow-soft: #fdf3dc;
  --red: #dc2626;
  --red-soft: #fdecec;
  --blue: #2563eb;
  --blue-soft: #e8effd;
  --purple: #7c3aed;
  --purple-soft: #f1ebfd;
  --teal: #0d9488;
  --teal-soft: #e2f5f2;
  --shadow: 0 1px 3px rgba(15, 23, 42, .08), 0 4px 14px rgba(15, 23, 42, .06);
  --radius: 12px;
  --sidebar-w: 224px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14161c;
    --surface: #1d2027;
    --surface-2: #262a33;
    --border: #333845;
    --text: #e8eaf0;
    --text-muted: #9aa1b0;
    --brand: #f06595;
    --brand-soft: #3a2230;
    --green: #4ade80;
    --green-soft: #16321f;
    --yellow: #fbbf24;
    --yellow-soft: #38300f;
    --red: #f87171;
    --red-soft: #3b1a1a;
    --blue: #60a5fa;
    --blue-soft: #1b2a45;
    --purple: #a78bfa;
    --purple-soft: #2a2140;
    --teal: #2dd4bf;
    --teal-soft: #12302c;
    --shadow: 0 1px 3px rgba(0, 0, 0, .4);
  }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
}

.hidden { display: none !important; }
.muted { color: var(--text-muted); }
.hide-sm { display: inline; }

/* ===== Layout ===== */

.layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 16px;
  border-bottom: 1px solid var(--border);
}

.brand-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--brand);
  color: #fff;
  font-weight: 800;
  font-size: 15px;
  flex: 0 0 auto;
}

.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-name { font-weight: 700; }
.brand-sub { font-size: 12px; color: var(--text-muted); }

.nav { padding: 10px 8px; display: flex; flex-direction: column; gap: 2px; flex: 1; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font: inherit;
  cursor: pointer;
  text-align: left;
}

.nav-item:hover { background: var(--surface-2); }
.nav-item.active { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.nav-ico { width: 20px; text-align: center; }
.nav-label { flex: 1; }

.nav-badge {
  background: var(--red);
  color: #fff;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  min-width: 20px;
  padding: 1px 6px;
  text-align: center;
}

.sidebar-foot {
  padding: 12px;
  border-top: 1px solid var(--border);
}

.foot-note {
  padding: 8px 4px 0;
  font-size: 11px;
  color: var(--text-muted);
}

.btn-block { width: 100%; }

/* Butang logout & tetapan ringkas di header (mobile sahaja) */
.logout-top,
.settings-top {
  display: none;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  margin-left: auto;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text-muted);
  font-size: 18px;
  cursor: pointer;
}

.logout-top:hover { color: var(--red); border-color: var(--red); }

.settings-top { font-size: 16px; }
.settings-top:hover,
.settings-top.active { color: var(--brand); border-color: var(--brand); background: var(--brand-soft); }

.main {
  flex: 1;
  min-width: 0;
  padding: 20px 24px 60px;
  max-width: 1100px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
  gap: 12px;
}

.page-title { margin: 0; font-size: 22px; }

/* ===== Error banner & toast ===== */

.error-banner {
  position: sticky;
  top: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: var(--red);
  color: #fff;
  padding: 9px 14px;
  font-weight: 600;
  font-size: 14px;
}

.toast-root {
  position: fixed;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 90;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
}

.toast {
  background: var(--text);
  color: var(--bg);
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 14px;
  box-shadow: var(--shadow);
  animation: toast-in .2s ease-out;
}

.toast.ok { background: var(--green); color: #fff; }
.toast.err { background: var(--red); color: #fff; }

@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ===== Cards (overview) ===== */

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow);
}

.card.clickable { cursor: pointer; }
.card.clickable:hover { border-color: var(--brand); }

.card-label {
  font-size: 12.5px;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .3px;
}

.card-value { font-size: 30px; font-weight: 800; line-height: 1.2; margin-top: 4px; }
.card-sub { font-size: 12.5px; color: var(--text-muted); margin-top: 2px; }

.card.alert { border-color: var(--red); background: var(--red-soft); }
.card.alert .card-value { color: var(--red); }

.card-rows { margin-top: 8px; display: flex; flex-direction: column; gap: 3px; }
.card-row { display: flex; justify-content: space-between; font-size: 13px; }
.card-row b { font-variant-numeric: tabular-nums; }

/* ===== Panels & tables ===== */

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.panel-head {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.panel-head h2 { margin: 0; font-size: 16px; }
.panel-body { padding: 0; }

.table-wrap { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

th, td {
  text-align: left;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

td.wrap { white-space: normal; min-width: 160px; }

th {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .4px;
  color: var(--text-muted);
  background: var(--surface-2);
}

tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--surface-2); }

td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

/* ===== Badges ===== */

.badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.6;
  white-space: nowrap;
}

.badge.green { background: var(--green-soft); color: var(--green); }
.badge.yellow { background: var(--yellow-soft); color: var(--yellow); }
.badge.red { background: var(--red-soft); color: var(--red); }
.badge.blue { background: var(--blue-soft); color: var(--blue); }
.badge.purple { background: var(--purple-soft); color: var(--purple); }
.badge.teal { background: var(--teal-soft); color: var(--teal); }
.badge.gray { background: var(--surface-2); color: var(--text-muted); }
.badge.brand { background: var(--brand-soft); color: var(--brand); }

/* ===== Buttons ===== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 8px;
  border: 1px solid transparent;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  background: var(--brand);
  color: #fff;
}

.btn:hover { filter: brightness(1.06); }
.btn:disabled { opacity: .55; cursor: not-allowed; }

.btn-sm { padding: 5px 11px; font-size: 13px; border-radius: 7px; }

.btn-light {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
}

.btn-green { background: var(--green); color: #fff; }
.btn-red { background: var(--red); color: #fff; }

.btn-ghost {
  background: transparent;
  color: var(--brand);
  border-color: transparent;
}

.btn-ghost:hover { background: var(--brand-soft); }

/* ===== Tabs / chips / toolbar ===== */

.tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 14px;
  border-bottom: 2px solid var(--border);
}

.tab {
  border: 0;
  background: transparent;
  font: inherit;
  font-weight: 600;
  color: var(--text-muted);
  padding: 9px 14px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
}

.tab:hover { color: var(--text); }
.tab.active { color: var(--brand); border-bottom-color: var(--brand); }

.tab-count {
  background: var(--red);
  color: #fff;
  border-radius: 999px;
  font-size: 11px;
  padding: 1px 7px;
  margin-left: 4px;
}

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }

.chip {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: 999px;
  padding: 5px 14px;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.chip:hover { border-color: var(--brand); }
.chip.active { background: var(--brand); border-color: var(--brand); color: #fff; }

.toolbar {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.toolbar-note { font-size: 12.5px; color: var(--text-muted); }

.field-inline { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; font-size: 14px; }

/* ===== Funnel (scouting) ===== */

.funnel {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: stretch;
  margin-bottom: 16px;
}

.funnel-step {
  flex: 1 1 100px;
  min-width: 104px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  cursor: pointer;
  text-align: center;
  font: inherit;
  box-shadow: var(--shadow);
}

.funnel-step:hover { border-color: var(--brand); }
.funnel-step.active { border-color: var(--brand); background: var(--brand-soft); }
.funnel-step.rejected-step { flex: 0 1 110px; opacity: .85; }

.funnel-count { display: block; font-size: 22px; font-weight: 800; }
.funnel-label { display: block; font-size: 11.5px; color: var(--text-muted); font-weight: 600; }
.funnel-step.active .funnel-label { color: var(--brand); }

/* ===== Approvals list ===== */

.stack { display: flex; flex-direction: column; gap: 10px; }

.approval-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 13px 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.approval-main { flex: 1 1 240px; min-width: 0; }
.approval-title { font-weight: 700; margin: 3px 0 2px; }
.approval-meta { font-size: 12.5px; color: var(--text-muted); }
.approval-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ===== Empty / loading / inline error states ===== */

.state {
  padding: 36px 20px;
  text-align: center;
  color: var(--text-muted);
}

.state .state-emoji { font-size: 34px; display: block; margin-bottom: 8px; }
.state.error { color: var(--red); }

.spinner {
  display: inline-block;
  width: 22px;
  height: 22px;
  border: 3px solid var(--border);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin .8s linear infinite;
  margin-bottom: 8px;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ===== Activity list ===== */

.activity { display: flex; gap: 12px; padding: 11px 16px; border-bottom: 1px solid var(--border); }
.activity:last-child { border-bottom: 0; }
.activity-ico { flex: 0 0 auto; font-size: 17px; margin-top: 1px; }
.activity-body { flex: 1; min-width: 0; }
.activity-text { font-size: 14px; }
.activity-meta { font-size: 12px; color: var(--text-muted); margin-top: 1px; }

/* ===== Kaunter Pertanyaan ===== */

.question-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 13px 16px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  flex-wrap: wrap;
}

.question-main { flex: 1 1 360px; min-width: 0; }
.question-top { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.question-time { color: var(--text-muted); font-size: 12.5px; flex: 0 0 auto; }
.question-meta { margin-top: 4px; font-size: 12.5px; }
.question-text {
  margin-top: 8px;
  color: var(--text);
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}
.question-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-left: auto; }

/* ===== Progress bars (referrals) ===== */

.prog { min-width: 130px; margin: 3px 0; }
.prog-top { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--text-muted); margin-bottom: 2px; }
.prog-track { height: 6px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.prog-fill { height: 100%; background: var(--yellow); border-radius: 999px; }
.prog-fill.done { background: var(--green); }

/* ===== Modal ===== */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(10, 12, 18, .55);
  z-index: 70;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
}

.modal {
  background: var(--surface);
  border-radius: 14px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, .3);
  width: 100%;
  max-width: 640px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
}

/* Variant besar (laporan / kandungan lebar) — desktop sahaja */
.modal.modal-lg { max-width: min(960px, 90vw); }

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}

.modal-head h3 { margin: 0; font-size: 17px; }

.modal-close {
  border: 0;
  background: transparent;
  font-size: 24px;
  line-height: 1;
  color: var(--text-muted);
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 6px;
}

.modal-close:hover { background: var(--surface-2); color: var(--text); }

.modal-body { padding: 16px 18px; overflow-y: auto; }

.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 13px 18px;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}

.modal-foot:empty { display: none; }

/* ===== Detail list (render JSON kemas) ===== */

.detail-dl { margin: 0; }
.detail-row { display: flex; gap: 12px; padding: 7px 0; border-bottom: 1px dashed var(--border); }
.detail-row:last-child { border-bottom: 0; }
.detail-row dt { flex: 0 0 138px; font-weight: 600; color: var(--text-muted); font-size: 13px; }
.detail-row dd { margin: 0; flex: 1; min-width: 0; overflow-wrap: anywhere; }
.detail-dl .detail-dl { padding-left: 10px; border-left: 2px solid var(--border); }
.detail-list { margin: 0; padding-left: 18px; }
.detail-list li { margin: 2px 0; }

/* ===== Forms ===== */

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-grid .full { grid-column: 1 / -1; }

.field { display: flex; flex-direction: column; gap: 4px; }
.field > span { font-size: 13px; font-weight: 600; color: var(--text-muted); }

input[type="text"], input[type="number"], input[type="date"], input[type="month"],
input[type="password"], select, textarea {
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  width: 100%;
}

input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--brand);
  outline-offset: 0;
  border-color: var(--brand);
}

textarea { resize: vertical; min-height: 70px; }

.checkbox-field { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 14px; padding-top: 20px; }
.checkbox-field input { width: 17px; height: 17px; accent-color: var(--brand); }

/* ===== Pager ===== */

.pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 11px;
  font-size: 13px;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
}

.pager button {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: 7px;
  padding: 4px 12px;
  cursor: pointer;
  font: inherit;
}

.pager button:disabled { opacity: .4; cursor: not-allowed; }
.pager button:not(:disabled):hover { border-color: var(--brand); }

/* ===== Markdown (laporan) ===== */

.md { font-size: 14px; line-height: 1.65; }
.md h1, .md h2, .md h3, .md h4 { margin: 14px 0 6px; line-height: 1.3; }
.md h1 { font-size: 20px; }
.md h2 { font-size: 17px; }
.md h3 { font-size: 15.5px; }
.md h4 { font-size: 14.5px; }
.md p { margin: 8px 0; }
.md ul, .md ol { margin: 8px 0; padding-left: 22px; }
.md li { margin: 3px 0; }
.md code {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 1px 5px;
  font-family: Consolas, "Courier New", monospace;
  font-size: 13px;
}
.md pre {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  overflow-x: auto;
}
.md pre code { background: none; border: 0; padding: 0; }
.md blockquote {
  margin: 8px 0;
  padding: 4px 14px;
  border-left: 3px solid var(--brand);
  color: var(--text-muted);
}
.md hr { border: 0; border-top: 1px solid var(--border); margin: 14px 0; }

/* --- Table markdown (GFM) --- */
.md-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 10px 0;
  border: 1px solid var(--border);
  border-radius: 8px;
}
.md-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
  line-height: 1.45;
}
.md-table th, .md-table td {
  padding: 7px 11px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--border);
}
.md-table th {
  font-weight: 700;
  background: var(--surface-2);
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}
.md-table tbody tr:nth-child(even) { background: var(--surface-2); }
.md-table tbody tr:last-child td { border-bottom: 0; }

/* ===== Report list ===== */

.report-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 16px;
  border: 0;
  border-bottom: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  font: inherit;
  cursor: pointer;
  text-align: left;
}

.report-item:last-child { border-bottom: 0; }
.report-item:hover { background: var(--surface-2); }
.report-title { flex: 1; font-weight: 600; min-width: 0; }
.report-meta { font-size: 12.5px; color: var(--text-muted); white-space: nowrap; }

/* ===== Tetapan ===== */

.settings-stack {
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 560px;
}

.panel-pad { padding: 16px 18px; }

#pw-form {
  display: flex;
  flex-direction: column;
  gap: 13px;
  align-items: flex-start;
}

#pw-form .field { width: 100%; }
#pw-form input { max-width: 380px; }

.field-hint {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 400;
}

#pw-submit { margin-top: 2px; min-height: 44px; }

.form-msg {
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 13px;
}

.form-msg.err {
  background: var(--red-soft);
  color: var(--red);
  border: 1px solid var(--red);
}

.form-msg.ok {
  background: var(--green-soft);
  color: var(--green);
  border: 1px solid var(--green);
}

.settings-warn {
  margin-top: 7px;
  padding: 8px 11px;
  border: 1px solid var(--yellow);
  border-radius: 8px;
  background: var(--yellow-soft);
  color: var(--yellow);
  font-size: 12.5px;
  font-weight: 600;
}

/* ===== Login page ===== */

.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 20px 16px;
}

.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 28px 22px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.login-brand { text-align: center; margin-bottom: 4px; }

.login-brand .brand-logo {
  width: 52px;
  height: 52px;
  font-size: 20px;
  border-radius: 14px;
  margin: 0 auto 10px;
  display: flex;
}

.login-title { margin: 0; font-size: 20px; }
.login-sub { margin: 2px 0 0; color: var(--text-muted); font-size: 13.5px; }

.login-error {
  background: var(--red-soft);
  color: var(--red);
  border: 1px solid var(--red);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 14px;
  font-weight: 600;
}

.login-card input {
  min-height: 48px;
  font-size: 16px; /* elak auto-zoom iOS */
}

.login-btn {
  width: 100%;
  min-height: 48px;
  font-size: 15px;
  margin-top: 4px;
}

/* ===== Responsive (phone 360-430px & tablet kecil) ===== */

@media (max-width: 760px) {

  .layout { flex-direction: column; }

  /* --- Header atas ringkas: brand + logout --- */
  .sidebar {
    width: 100%;
    flex: none;
    height: auto;
    position: sticky;
    top: 0;
    z-index: 50;
    border-right: 0;
    border-bottom: 1px solid var(--border);
    flex-direction: row;
    align-items: center;
  }

  .brand { flex: 1; padding: 8px 12px; border-bottom: 0; }
  .brand-logo { width: 34px; height: 34px; font-size: 13px; border-radius: 9px; }
  .logout-top { display: inline-flex; margin-left: 8px; }
  .sidebar-foot { display: none; }

  /* Tetapan: akses via gear di header — kekalkan bottom nav 6 item */
  .settings-top { display: inline-flex; margin-left: auto; }
  .nav-item-tetapan { display: none; }

  /* --- Bottom navigation bar --- */
  .nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 55;
    flex-direction: row;
    gap: 0;
    padding: 4px 2px calc(4px + env(safe-area-inset-bottom));
    background: var(--surface);
    border-top: 1px solid var(--border);
    box-shadow: 0 -2px 12px rgba(0, 0, 0, .08);
  }

  .nav-item {
    position: relative;
    flex: 1 1 0;
    min-width: 0;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 6px 2px;
    min-height: 52px;
    text-align: center;
    border-radius: 10px;
  }

  .nav-ico { display: block; width: auto; font-size: 19px; line-height: 1.1; }

  .nav-label {
    flex: none;
    font-size: 10.5px;
    font-weight: 600;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .nav-badge {
    position: absolute;
    top: 2px;
    left: 50%;
    transform: translateX(6px);
    min-width: 17px;
    padding: 1px 5px;
    font-size: 10px;
  }

  /* --- Main content: clearance untuk bottom nav --- */
  .main { padding: 14px 12px calc(84px + env(safe-area-inset-bottom)); }
  .page-title { font-size: 19px; }
  .hide-sm { display: none; }

  .toast-root {
    bottom: calc(72px + env(safe-area-inset-bottom));
    width: calc(100% - 24px);
  }

  /* --- Kad summary: 2 kolum --- */
  .cards { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .card { padding: 12px; }
  .card-value { font-size: 24px; }
  .card:has(.card-rows) { grid-column: 1 / -1; }

  /* --- Tap targets min 44px --- */
  .btn { min-height: 44px; }
  .btn-sm { min-height: 44px; padding: 8px 14px; font-size: 14px; }
  .tab { min-height: 44px; }
  .chip { min-height: 44px; padding: 8px 16px; font-size: 14px; }
  .pager button { min-height: 44px; padding: 8px 16px; }
  .modal-close { min-width: 44px; min-height: 44px; }
  .funnel-step { min-width: 88px; min-height: 44px; padding: 10px 8px; }
  .funnel-count { font-size: 18px; }
  .report-item { min-height: 44px; }

  input[type="text"], input[type="number"], input[type="date"], input[type="month"],
  input[type="password"], select, textarea {
    min-height: 44px;
    font-size: 16px; /* elak auto-zoom iOS */
  }

  .checkbox-field { padding-top: 0; min-height: 44px; }
  .checkbox-field input { width: 22px; height: 22px; }

  /* --- Table -> card list (semua table: Hosts, Scouting, Referrals) --- */
  .table-wrap { overflow-x: visible; }

  .table-wrap table,
  .table-wrap tbody,
  .table-wrap tr,
  .table-wrap td { display: block; width: 100%; }

  .table-wrap thead { display: none; }

  .table-wrap tr {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
  }

  .table-wrap tr:last-child { border-bottom: 0; }
  .table-wrap tbody tr:hover { background: transparent; }

  .table-wrap td {
    border: 0;
    padding: 4px 0;
    white-space: normal;
    font-size: 14px;
  }

  .table-wrap td[data-label] {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 2px 10px;
  }

  .table-wrap td[data-label]::before {
    content: attr(data-label);
    flex: 0 0 auto;
    margin-right: auto;
    font-size: 11.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .4px;
    color: var(--text-muted);
  }

  .table-wrap td .prog { flex: 1 1 100%; min-width: 0; }
  .table-wrap td.wrap { min-width: 0; }
  .table-wrap td:not([data-label]) { padding-top: 8px; }
  .table-wrap td:not([data-label]) .btn { width: 100%; }

  /* --- Approvals: butang penuh senang tekan --- */
  .approval-actions { width: 100%; }
  .approval-actions .btn { flex: 1 1 auto; }

  .question-top { flex-direction: column; gap: 2px; }
  .question-actions { width: 100%; margin-left: 0; }
  .question-actions .btn { flex: 1 1 auto; }

  /* --- Modal -> bottom sheet --- */
  .modal-backdrop { align-items: flex-end; padding: 0; }

  .modal, .modal.modal-lg {
    max-width: none;
    max-height: 92vh;
    max-height: 92dvh;
    border-radius: 16px 16px 0 0;
    animation: sheet-up .22s ease-out;
  }

  .modal-foot { padding-bottom: calc(13px + env(safe-area-inset-bottom)); }
  .modal-foot .btn { flex: 1 1 auto; min-height: 48px; }

  /* --- Lain-lain --- */
  .detail-row { flex-direction: column; gap: 2px; }
  .detail-row dt { flex: none; }
  .form-grid { grid-template-columns: 1fr; }

  /* --- Tetapan --- */
  #pw-form input { max-width: none; }
  #pw-submit { width: 100%; min-height: 48px; }
}

@keyframes sheet-up {
  from { transform: translateY(28%); opacity: .6; }
  to { transform: translateY(0); opacity: 1; }
}

/* ----- Discord Mapping form (F6) ----- */
.map-group { margin-bottom: 16px; padding: 14px 16px; }
.map-group-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.map-group-head h3 { margin: 0; font-size: 15px; }
.map-row { display: flex; align-items: center; gap: 10px; padding: 10px 2px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.map-row:last-child { border-bottom: none; }
.map-host { font-weight: 600; min-width: 190px; word-break: break-all; }
.map-meta { color: var(--muted); font-size: 12.5px; flex: 1; min-width: 140px; }
.map-input { flex: 1; min-width: 160px; }
.map-actions { display: flex; gap: 8px; margin-left: auto; }
@media (max-width: 760px) {
  .map-host { min-width: 0; width: 100%; }
  .map-input { width: 100%; }
  .map-actions { margin-left: 0; width: 100%; }
  .map-actions .btn { flex: 1; min-height: 44px; }
}
