/* Admin dashboard */
.adm-shell {
  max-width: 1100px; margin: 0 auto; padding-block: 34px 60px;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}
.adm-head { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 10px; }
.adm-head h1 { font-size: 30px; }
.adm-head .adm-sub { color: var(--muted); font-size: 14px; }

.adm-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; margin: 22px 0; }
.stat {
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  padding: 16px 18px;
}
.stat .v { font-family: var(--font-display); font-size: 30px; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat .l { font-size: 13px; color: var(--muted); }
.stat.gold .v { color: var(--gold); }

.adm-filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 16px; }
.adm-filters .chip {
  border: 1px solid var(--line); background: var(--surface); color: var(--muted);
  border-radius: 999px; padding: 5px 15px; font: inherit; font-size: 13.5px; cursor: pointer;
}
.adm-filters .chip.on { background: var(--gold); border-color: var(--gold); color: var(--on-gold); font-weight: 700; }
.adm-search {
  flex: 1; min-width: 180px; background: var(--surface); border: 1px solid var(--line);
  border-radius: 999px; padding: 7px 16px; font: inherit; font-size: 14px; color: var(--ink);
}

.adm-table { display: flex; flex-direction: column; gap: 8px; }
.adm-row {
  display: grid; grid-template-columns: 30px 95px 1fr 86px 96px 118px 110px; gap: 10px; align-items: center;
  background: var(--surface); border: 1px solid var(--line); border-radius: 11px;
  padding: 11px 14px; cursor: pointer; text-align: start; font: inherit; color: var(--ink);
  transition: border-color .15s;
}
.adm-row .sel { display: flex; }
.adm-row .sel input { width: 16px; height: 16px; accent-color: var(--gold); cursor: pointer; }
.adm-thead { cursor: default; background: var(--navy); color: var(--on-navy); border-color: var(--navy); }
.adm-thead .th {
  background: none; border: none; color: var(--on-navy); font: inherit; font-size: 13px;
  font-weight: 600; cursor: pointer; text-align: start; padding: 0;
}
.adm-thead .th.on { color: var(--gold-soft); }
.adm-sel, .adm-date {
  background: var(--surface); border: 1px solid var(--line); border-radius: 999px;
  padding: 5px 12px; font: inherit; font-size: 13px; color: var(--ink);
}
.adm-dates { display: flex; gap: 6px; }
.adm-pager { display: flex; gap: 6px; margin-top: 14px; flex-wrap: wrap; }
.adm-pager .chip { border: 1px solid var(--line); background: var(--surface); color: var(--muted); border-radius: 999px; padding: 4px 12px; font: inherit; font-size: 13px; cursor: pointer; }
.adm-pager .chip.on { background: var(--gold); border-color: var(--gold); color: var(--on-gold); font-weight: 700; }
.adm-history { display: flex; flex-direction: column; gap: 5px; margin-top: 10px; }
.hist-row { display: flex; gap: 14px; font-size: 13px; border-bottom: 1px dashed var(--line); padding-bottom: 4px; }
.hist-when { color: var(--muted); flex: none; font-variant-numeric: tabular-nums; }
.badge.pay-none { background: var(--bg); color: var(--muted); }
.badge.pay-pending { background: color-mix(in srgb, var(--warn) 15%, var(--bg)); color: var(--warn); }
.badge.pay-masav { background: var(--navy-2); color: var(--on-navy); }
.badge.pay-paid { background: color-mix(in srgb, var(--good) 18%, var(--bg)); color: var(--good); }
.adm-row:hover { border-color: var(--gold-soft); }
.adm-row .ref { font-variant-numeric: tabular-nums; font-weight: 600; font-size: 13px; direction: ltr; }
.adm-row .who { font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.adm-row .who small { display: block; font-weight: 400; color: var(--muted); }
.adm-row .amt { font-variant-numeric: tabular-nums; text-align: end; }
.adm-row .when { font-size: 12.5px; color: var(--muted); }

.badge { display: inline-block; border-radius: 999px; padding: 3px 12px; font-size: 12px; font-weight: 700; text-align: center; }
.badge.new { background: color-mix(in srgb, var(--gold) 15%, var(--bg)); color: var(--gold); }
.badge.in_review { background: color-mix(in srgb, var(--warn) 15%, var(--bg)); color: var(--warn); }
.badge.approved { background: color-mix(in srgb, var(--good) 15%, var(--bg)); color: var(--good); }
.badge.declined { background: color-mix(in srgb, var(--bad) 13%, var(--bg)); color: var(--bad); }
.badge.org { background: var(--navy-2); color: var(--on-navy); }
.badge.ind { background: color-mix(in srgb, var(--gold) 20%, var(--bg)); color: var(--gold); }
.badge.dup { background: var(--bad); color: #fff; margin-inline-start: 8px; }
.adm-dup-note { margin: 14px 0 4px; padding: 12px 16px; border-radius: 10px; font-weight: 600;
  background: color-mix(in srgb, var(--bad) 10%, var(--bg)); color: var(--bad);
  border: 1px solid color-mix(in srgb, var(--bad) 35%, var(--bg)); }
.adm-dup-note a { color: var(--bad); text-decoration: underline; font-weight: 700; }

.adm-empty, .adm-gate {
  text-align: center; color: var(--muted); background: var(--surface);
  border: 1px dashed var(--line); border-radius: 14px; padding: 48px 20px; margin-top: 10px;
}
.adm-gate h2 { font-size: 22px; margin-bottom: 8px; color: var(--ink); }

.adm-login { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 18px; }
.adm-login input {
  background: var(--bg); border: 1px solid var(--line); border-radius: 999px;
  padding: 9px 18px; font: inherit; color: var(--ink); min-width: 220px; text-align: center;
}

/* detail drawer */
.adm-detail-back { background: none; border: none; color: var(--gold); font: inherit; cursor: pointer; padding: 0; margin-bottom: 14px; }
.adm-detail {
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
  box-shadow: var(--shadow); padding: 26px 24px;
}
.adm-dhead { display: flex; justify-content: space-between; align-items: flex-start; flex-wrap: wrap; gap: 12px; border-bottom: 1px solid var(--line); padding-bottom: 14px; }
.adm-dhead h2 { font-size: 24px; }
.adm-dhead .ref { color: var(--muted); font-size: 13px; direction: ltr; display: inline-block; }
.adm-dgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 6px 22px; margin-top: 14px; }
.adm-dsec { font-family: var(--font-display); color: var(--gold); font-size: 16.5px; font-weight: 700; grid-column: 1 / -1; margin-top: 14px; border-bottom: 1px solid var(--line); padding-bottom: 4px; }
.kv { display: flex; gap: 8px; font-size: 14px; min-width: 0; }
.kv .k { color: var(--muted); flex: none; max-width: 55%; }
.kv .v { font-weight: 600; overflow-wrap: anywhere; }
.kv.full { grid-column: 1 / -1; flex-direction: column; gap: 2px; }
.adm-sig { max-width: 300px; border: 1px solid var(--line); border-radius: 8px; background: #fff; margin-top: 6px; }
.adm-photo { width: 130px; height: 130px; object-fit: cover; border-radius: 50%; border: 2px solid var(--gold-soft); margin-top: 6px; }
.adm-files a { display: inline-block; margin-inline-end: 12px; font-size: 14px; }

.adm-actions { border-top: 1px solid var(--line); margin-top: 20px; padding-top: 16px; }
.adm-actions h3 { font-size: 16px; margin-bottom: 10px; }
.status-btns { display: flex; flex-wrap: wrap; gap: 8px; }
.status-btns button {
  border: 1px solid var(--line); background: var(--bg); color: var(--ink); border-radius: 999px;
  padding: 7px 18px; font: inherit; font-size: 14px; cursor: pointer;
}
.status-btns button.on { background: var(--gold); border-color: var(--gold); color: var(--on-gold); font-weight: 700; }
.adm-notes { width: 100%; min-height: 80px; margin-top: 12px; background: var(--bg); border: 1px solid var(--line); border-radius: 9px; padding: 10px 12px; font: inherit; font-size: 14px; color: var(--ink); resize: vertical; }
.adm-save { margin-top: 10px; }
.adm-saved { color: var(--good); font-size: 13.5px; margin-inline-start: 10px; }

@media (max-width: 820px) {
  .adm-row { grid-template-columns: 26px 1fr 100px 110px; }
  .adm-row .when, .adm-row .amt, .adm-row .badge.org, .adm-row .badge.ind { display: none; }
  .adm-thead .th:nth-of-type(1), .adm-thead .th:nth-of-type(3), .adm-thead .th:nth-of-type(6) { display: none; }
}
