/* ==========================================================================
   BLACK BIRD · Ruang Pengelola & Audit (v15 Pure Monochrome Hitam-Putih)
   ========================================================================== */

[hidden] { display: none !important; }

/* ------------------------------------------------------------------ login */

.auth {
  display: grid;
  place-items: center;
  min-height: calc(100vh - 130px);
  padding: 24px 0;
}

.auth-card {
  width: min(390px, 100%);
  padding: 28px 26px;
  border: 1.5px solid var(--ink);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: 6px 6px 0 0 var(--ink);
}
.auth-card h1 {
  margin: 8px 0 0;
  font-size: 19px;
  font-weight: 800;
  color: var(--ink);
}
.auth-lede {
  margin: 6px 0 18px;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--muted);
}
.auth-form { display: grid; gap: 12px; }
.auth-form .btn { width: 100%; height: 38px; }
.auth-help {
  margin: 14px 0 0;
  font-size: 11.5px;
  line-height: 1.45;
  color: var(--faint);
}

/* ------------------------------------------------------------------ panel */

.admin-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px 20px;
  flex-wrap: wrap;
  padding: 14px 0 12px;
}
.admin-title-bar {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}
.admin-head h1 {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -.02em;
  color: var(--ink);
}
.admin-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }

.period-switch {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
  margin-bottom: 0;
}

.period-step { flex: none; width: 32px; height: 32px; border-radius: var(--radius-md); border-color: var(--ink); }
.period-step[disabled] { opacity: .3; cursor: not-allowed; }

.period-picker {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 6px 0 10px;
  height: 32px;
  border: 1.5px solid var(--ink);
  border-radius: var(--radius-md);
  background: var(--surface);
}
.period-picker svg { width: 14px; height: 14px; flex: none; color: var(--ink); }
.period-picker select {
  min-width: 155px;
  padding: 0 22px 0 0;
  border: 0;
  background: transparent url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 4.5 6 8l3.5-3.5' fill='none' stroke='%230a0a0a' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat right 4px center;
  color: var(--ink);
  font-size: 12.5px;
  font-weight: 700;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
}
.period-picker select:focus { outline: none; }

.period-badge {
  padding: 2px 8px;
  border: 1px solid var(--ink);
  border-radius: var(--radius-sm);
  background: var(--ink);
  color: #ffffff;
  font-size: 11px;
  font-weight: 700;
}

.period-note {
  margin: -4px 0 12px;
  padding: 8px 12px;
  border: 1px solid var(--ink);
  border-radius: var(--radius-md);
  background: var(--surface-3);
  color: var(--ink);
  font-size: 12px;
  font-weight: 600;
}

.admin-metrics { margin-bottom: 14px; }
.admin-metrics .metrics { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.admin-metrics .metric + .metric { border-left: 1px solid var(--ink-line); }

.admin-insights {
  margin-bottom: 14px;
  border: 1px solid var(--line-mid);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.admin-insights > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 16px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--line-mid);
  font-size: 13px;
  font-weight: 800;
  color: var(--ink);
  cursor: pointer;
  list-style: none;
}
.admin-insights > summary::-webkit-details-marker { display: none; }
.admin-insights > summary::after {
  content: "Tampilkan / Sembunyikan";
  font-size: 11px;
  font-weight: 700;
  color: var(--ink);
  text-decoration: underline;
}
.insights-body {
  display: grid;
  gap: 16px;
  padding: 14px 16px;
}
.insight-block {
  border: 1px solid var(--line-mid);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--surface);
}
.insight-title {
  padding: 10px 14px 2px;
  font-size: 13.5px;
  font-weight: 800;
  color: var(--ink);
}
.insight-sub {
  padding: 0 14px 10px;
  font-size: 12px;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
}
.admin-sched-grid {
  max-height: 460px;
  overflow-y: auto;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 60;
  width: min(380px, calc(100vw - 32px));
  padding: 10px 14px;
  border: 1.5px solid var(--ink);
  border-radius: var(--radius-md);
  background: var(--ink);
  color: #ffffff;
  box-shadow: 4px 4px 0 0 rgba(0, 0, 0, 0.25);
  font-size: 12.5px;
  font-weight: 700;
}

/* ------------------------------------------------------------------- tabs */

.tabs {
  display: flex;
  gap: 2px;
  margin-bottom: 14px;
  border-bottom: 1.5px solid var(--line-mid);
  overflow-x: auto;
}
.tabs button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 14px;
  border: 0;
  border-bottom: 2.5px solid transparent;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}
.tabs button:hover { color: var(--ink); }
.tabs button[aria-selected="true"] {
  border-bottom-color: var(--ink);
  color: var(--ink);
  font-weight: 800;
}
.tab-count {
  padding: 1px 6px;
  border-radius: var(--radius-sm);
  background: var(--surface-3);
  border: 1px solid var(--line-mid);
  font-size: 11px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}
.tabs button[aria-selected="true"] .tab-count {
  background: var(--ink);
  border-color: var(--ink);
  color: #ffffff;
}

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

/* ---------------------------------------------------------------- toolbar */

.toolbar {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  flex-wrap: wrap;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 8px;
}
.toolbar .search { flex: 1 1 220px; max-width: none; }
.toolbar-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-left: auto; }

.select { display: grid; gap: 3px; }
.select > span {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--muted);
}
.select select {
  height: 32px;
  padding: 0 26px 0 10px;
  border: 1px solid var(--ink);
  border-radius: var(--radius-md);
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 4.5 6 8l3.5-3.5' fill='none' stroke='%230a0a0a' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat right 8px center;
  color: var(--ink);
  font-size: 12.5px;
  font-weight: 600;
  appearance: none;
  -webkit-appearance: none;
}
.select select:focus { outline: none; box-shadow: var(--ring); }

/* ------------------------------------------------------------- group list */

.group-list { display: grid; }

.group-row {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(160px, auto) auto minmax(0, auto);
  align-items: center;
  gap: 8px 16px;
  padding: 9px 8px;
  border-bottom: 1px solid var(--line);
}
.group-row:last-child { border-bottom: 0; }
.group-row:hover { background: var(--surface-2); }

.g-main { min-width: 0; }
.g-name {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
}
.group-row.is-due-red {
  margin: 5px 0;
  padding: 10px 12px;
  border: 2px solid var(--money-red);
  border-left-width: 5px;
  border-radius: var(--radius-md);
  background: #fff5f5;
}
.group-row.is-paid-row {
  opacity: 0.72;
}
.g-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 6px;
  margin: 2px 0 0;
  font-size: 11.5px;
  color: var(--muted);
}
.g-meta .sep { color: var(--line-mid); }

.g-amount { text-align: right; }
.g-amount strong {
  display: block;
  font-size: 13.5px;
  font-weight: 800;
  color: var(--money-green);
  font-variant-numeric: tabular-nums;
}
.g-amount small {
  display: block;
  margin-top: 1px;
  font-size: 11px;
  font-weight: 600;
  color: var(--money-green-dark);
  font-variant-numeric: tabular-nums;
}

.g-status { justify-self: start; display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }

.proof-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  margin: 8px 0;
  padding: 8px 12px;
  border: 1px solid var(--line-mid);
  border-radius: var(--radius-md);
  background: var(--surface-2);
  font-size: 11.5px;
  font-weight: 600;
  color: var(--ink);
}
.proof-summary .sum { display: inline-flex; align-items: center; gap: 5px; }
.proof-summary .sum::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ink);
}

.g-actions { display: flex; align-items: center; gap: 4px; justify-self: end; }
.g-actions .btn { height: 26px; padding: 0 9px; font-size: 11.5px; }
.g-readonly {
  font-size: 11px;
  color: var(--faint);
}

/* --------------------------------------------------------------- arsip */

.archived {
  margin-top: 14px;
  border: 1px solid var(--line-mid);
  border-radius: var(--radius-md);
  background: var(--surface-2);
  overflow: hidden;
}
.archived > summary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  font-size: 12px;
  font-weight: 700;
  color: var(--ink);
  cursor: pointer;
  list-style: none;
}
.archived > summary::-webkit-details-marker { display: none; }
.archived > summary::after { content: "+"; margin-left: auto; font-size: 14px; color: var(--ink); }
.archived[open] > summary::after { content: "–"; }
.archived > summary .n {
  padding: 1px 6px;
  border-radius: var(--radius-sm);
  background: var(--ink);
  font-size: 11px;
  color: #ffffff;
}
.archived-list { padding: 0 12px 8px; }

.shortcuts {
  margin: 10px 2px 0;
  font-size: 11px;
  color: var(--faint);
}
.shortcuts kbd {
  display: inline-block;
  padding: 1px 5px;
  border: 1px solid var(--ink);
  border-radius: 3px;
  background: var(--surface);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  color: var(--ink);
}

/* --------------------------------------------- SMART AUDIT & ACTIVITY LOG */

.audit-kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  border: 1.5px solid var(--ink);
  border-radius: var(--radius-md);
  background: var(--ink);
  color: #ffffff;
  margin-bottom: 12px;
  overflow: hidden;
}
.audit-kpi-card {
  padding: 11px 14px;
}
.audit-kpi-card + .audit-kpi-card {
  border-left: 1px solid var(--ink-line);
}
.audit-kpi-card small {
  display: block;
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--ink-muted);
}
.audit-kpi-card strong {
  display: block;
  margin-top: 3px;
  font-size: 15px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: #ffffff;
}
.audit-kpi-card span {
  display: block;
  margin-top: 2px;
  font-size: 11px;
  color: #d4d4d8;
}

.audit-toolbar { align-items: flex-end; }
.audit-list {
  display: grid;
}

.audit-date-divider {
  padding: 8px 10px;
  background: var(--surface-3);
  border-top: 1px solid var(--line-mid);
  border-bottom: 1px solid var(--line-mid);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--ink);
}
.audit-date-divider:first-child { border-top: 0; }

.audit-item {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) auto;
  gap: 10px 12px;
  align-items: start;
  padding: 10px 10px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.audit-item:last-child { border-bottom: 0; }
.audit-item:hover { background: var(--surface-2); }

.audit-icon {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  background: var(--ink);
  color: #ffffff;
}
.audit-icon svg { width: 14px; height: 14px; }

.audit-body { min-width: 0; display: grid; gap: 4px; }
.audit-head-line {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 8px;
}
.audit-title {
  margin: 0;
  font-size: 13px;
  font-weight: 800;
  color: var(--ink);
}
.audit-entity-tag {
  padding: 1px 6px;
  border-radius: var(--radius-sm);
  background: var(--surface-3);
  border: 1px solid var(--line-mid);
  color: var(--ink);
  font-size: 11.5px;
  font-weight: 700;
}
.audit-period-tag {
  font-size: 11.5px;
  color: var(--faint);
}
.audit-detail {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
}

.audit-diff-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 2px;
}
.audit-diff-box {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-mid);
  background: var(--surface-2);
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
}
.audit-diff-box small {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
}
.audit-diff-box small::after { content: ":"; }
.audit-diff-vals {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-weight: 700;
}
.audit-val-old {
  color: var(--money-red);
  text-decoration: line-through;
  font-weight: 700;
}
.audit-val-arrow { color: var(--muted); font-size: 11px; }
.audit-val-new { color: var(--money-green); font-weight: 800; }

.audit-meta-col {
  display: flex;
  align-items: center;
  gap: 8px;
}
.audit-time {
  font-size: 11.5px;
  color: var(--faint);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.audit-actor {
  padding: 1px 7px;
  border: 1px solid var(--ink);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-size: 11px;
  font-weight: 700;
  color: var(--ink);
  white-space: nowrap;
}
.audit-actor[data-actor="admin"] { background: var(--ink); color: #ffffff; }
.audit-more { display: grid; justify-items: center; gap: 6px; padding-top: 12px; }
.audit-more p { font-size: 11.5px; color: var(--faint); }

/* ------------------------------------------------------------------ form */

.form-error { margin: 0; font-size: 12px; color: var(--ink); font-weight: 700; }
.sheet-form .form-error:empty { display: none; }

.field textarea {
  width: 100%;
  min-height: 84px;
  padding: 8px 10px;
  border: 1px solid var(--ink);
  border-radius: var(--radius-md);
  background: var(--surface);
  font: inherit;
  font-size: 13px;
  line-height: 1.45;
  color: var(--ink);
  resize: vertical;
}
.field textarea:focus { outline: none; box-shadow: var(--ring); }

.field-pair { display: grid; grid-template-columns: minmax(96px, .6fr) minmax(0, 1.4fr); gap: 10px; }
.dialog-note {
  margin: 0;
  padding: 8px 10px;
  border: 1px solid var(--line-mid);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  font-size: 12px;
  color: var(--muted);
}
.amount-preview { margin: -2px 0 0; font-size: 13px; font-weight: 800; color: var(--money-green); font-variant-numeric: tabular-nums; }

.clipboard-helper { position: fixed; top: -1000px; left: -1000px; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.confirm-text { margin: 0; font-size: 13.5px; color: var(--ink); }

.btn.danger {
  background: var(--money-red);
  color: #ffffff;
  border-color: var(--money-red);
}
.btn.danger:hover:not(:disabled) { background: var(--money-red-dark); }

dialog.compact { width: min(420px, calc(100vw - 24px)); }
dialog.wide { width: min(680px, calc(100vw - 24px)); }

/* ---------------------------------------------------------------- impor */

.import-preview {
  display: grid;
  gap: 6px;
  padding: 10px;
  border: 1px solid var(--line-mid);
  border-radius: var(--radius-md);
  background: var(--surface-2);
}
.import-summary { font-size: 12px; font-weight: 600; color: var(--muted); }
.import-summary b { color: var(--ink); }
.import-list {
  display: grid;
  gap: 4px;
  max-height: 200px;
  overflow-y: auto;
  font-size: 11.5px;
}
.import-list li {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) auto;
  gap: 8px;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--line);
}
.import-list li[data-bad="1"] { border-style: dashed; border-color: var(--ink); background: var(--surface-3); }
.import-list .no { color: var(--faint); font-variant-numeric: tabular-nums; }
.import-list .nm { color: var(--ink); font-weight: 600; }
.import-list .why { color: var(--ink); font-size: 11px; text-align: right; font-weight: 700; }
.import-count { font-size: 11.5px; color: var(--muted); }

/* ------------------------------------------------------- pemeriksaan bukti */

.check-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.check-head h2 {
  margin: 0 0 2px;
  font-size: 14.5px;
  font-weight: 800;
  color: var(--ink);
}
.ai-note {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
  max-width: 72ch;
}
.ai-note.is-off { color: var(--ink); font-weight: 700; }

.check-toolbar { align-items: flex-end; }

.check-progress { display: grid; gap: 4px; margin: 10px 0 4px; }
.check-progress .bar {
  max-width: none;
  height: 6px;
  border-radius: 999px;
  background: var(--line-mid);
  overflow: hidden;
}
.check-progress .bar > span {
  display: block;
  width: 0;
  height: 100%;
  background: var(--ink);
}
.check-progress-text {
  margin: 0;
  font-size: 11.5px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

#checkSummary { margin: 8px 0 4px; }
#checkSummary:empty { display: none; }

.check-list { display: grid; margin-top: 6px; }
.check-item {
  display: grid;
  gap: 4px;
  padding: 10px 8px;
  border-bottom: 1px solid var(--line);
}
.check-item:last-child { border-bottom: 0; }

.ci-head { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.ci-name { font-size: 13px; font-weight: 700; color: var(--ink); }
.ci-amount {
  font-size: 12.5px;
  font-weight: 800;
  color: var(--money-green);
  font-variant-numeric: tabular-nums;
}
.ci-head .pill { margin-left: auto; }
.ci-note { margin: 0; font-size: 12px; color: var(--muted); }
.ci-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}
.ci-meta { font-size: 11px; color: var(--faint); }
.ci-actions { display: flex; flex-wrap: wrap; gap: 4px; margin-left: auto; }
.ci-actions .btn { height: 26px; padding: 0 8px; font-size: 11px; }
.ci-actions .btn.is-active { border-color: var(--ink); background: var(--ink); color: #ffffff; }
.check-more { display: flex; justify-content: center; padding-top: 10px; }

/* ---------------------------------------------------------------- responsif */

@media (max-width: 780px) {
  .admin-metrics .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .admin-metrics .metric + .metric { border-left: 0; }
  .admin-metrics .metric:nth-child(even) { border-left: 1px solid var(--ink-line); }
  .admin-metrics .metric:nth-child(n + 3) { border-top: 1px solid var(--ink-line); }
  .group-row { grid-template-columns: minmax(0, 1fr) auto; }
  .g-amount { grid-column: 1; grid-row: 2; text-align: left; }
  .g-status { grid-column: 1; grid-row: 3; }
  .g-actions { grid-column: 2; grid-row: 1 / span 3; }
  .audit-item { grid-template-columns: 28px minmax(0, 1fr); }
  .audit-meta-col { grid-column: 2; }
  .audit-kpi-card + .audit-kpi-card { border-left: 0; border-top: 1px solid var(--ink-line); }
}

@media (max-width: 680px) {
  .admin-head {
    padding: 12px 0 10px;
    gap: 10px;
  }
  .admin-title-bar {
    width: 100%;
    justify-content: space-between;
  }
  .period-switch {
    width: 100%;
    justify-content: space-between;
  }
  .period-picker {
    flex: 1 1 auto;
  }
  .period-picker select {
    width: 100%;
    min-width: 0;
  }
  .admin-actions {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
  }
  .admin-actions .btn {
    width: 100%;
    height: 34px;
  }
  .toolbar .search {
    flex: 1 1 100%;
  }
  .select {
    flex: 1 1 calc(50% - 4px);
  }
  .select select {
    width: 100%;
  }
  .toolbar-actions {
    margin-left: 0;
    width: 100%;
    display: flex;
    gap: 6px;
  }
  .toolbar-actions .btn {
    flex: 1 1 auto;
    height: 34px;
  }
  .group-row {
    grid-template-columns: 1fr;
    gap: 8px;
    padding: 12px 8px;
  }
  .g-amount {
    grid-column: 1;
    grid-row: auto;
    text-align: left;
  }
  .g-status {
    grid-column: 1;
    grid-row: auto;
  }
  .g-actions {
    grid-column: 1;
    grid-row: auto;
    justify-self: stretch;
    display: flex;
    gap: 6px;
  }
  .g-actions .btn {
    flex: 1 1 auto;
    height: 32px;
  }
  .field-pair { grid-template-columns: 1fr; }
  .audit-item {
    grid-template-columns: 1fr;
    gap: 6px;
    padding: 12px 10px;
  }
  .audit-icon { display: none; }
  .audit-meta-col {
    grid-column: 1;
    justify-content: space-between;
  }
}
