/* ------------------------------------------------------------------
   Donations admin — ledger aesthetic on the same brand: navy rail,
   paper canvas, white cards, tabular numerals.
   ------------------------------------------------------------------ */

.admin-shell {
  display: flex;
  min-height: 100vh;
  background: var(--paper);
}

/* ---- Nav rail ---- */

.admin-rail {
  flex: none;
  width: 248px;
  background: linear-gradient(180deg, var(--navy-900), var(--navy-950));
  color: var(--ink-on-navy-dim);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.admin-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 18px 16px;
  text-decoration: none;
  border-bottom: 1px solid rgb(255 255 255 / 0.1);
}
.admin-brand img {
  width: 34px;
  height: 34px;
}
.admin-brand .name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1rem;
  color: var(--white);
  line-height: 1.2;
}
.admin-brand .sub {
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold-300);
}

.rail-section {
  padding: 16px 12px 4px;
}
.rail-label {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-on-navy-faint);
  padding: 0 10px 8px;
}
.rail-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 8px;
  color: var(--ink-on-navy-dim);
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 500;
}
.rail-link:hover {
  background: rgb(255 255 255 / 0.07);
  color: var(--white);
}
.rail-link.active {
  background: rgb(255 255 255 / 0.1);
  color: var(--white);
  box-shadow: inset 3px 0 0 var(--gold-500);
}
.rail-link svg {
  flex: none;
  opacity: 0.8;
}

.rail-foot {
  margin-top: auto;
  padding: 16px 18px;
  border-top: 1px solid rgb(255 255 255 / 0.1);
  font-size: 0.85rem;
}
.rail-foot .user {
  color: var(--white);
  font-weight: 600;
  margin-bottom: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.rail-foot a {
  color: var(--ink-on-navy-faint);
  text-decoration: none;
}
.rail-foot a:hover {
  color: var(--white);
}
/* "web 1.0.412+e3f9a1c" over "api 1.0.412+e3f9a1c": which build of each half
   this session is on. One stamp per line so a mismatch reads at a glance. */
.rail-foot .build-stamp {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 0.74rem;
  color: var(--ink-on-navy-faint);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

@media (max-width: 900px) {
  .admin-shell {
    flex-direction: column;
  }
  .admin-rail {
    width: 100%;
    height: auto;
    position: static;
  }
  .rail-section {
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
  }
  .rail-label {
    width: 100%;
  }
  .rail-foot {
    margin-top: 0;
  }
  .rail-foot .build-stamp {
    flex-direction: row;
    gap: 14px;
  }
}

/* ---- Content area ---- */

.admin-main {
  flex: 1;
  min-width: 0;
  padding: 32px clamp(16px, 4vw, 44px) 64px;
}

.admin-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 26px;
}
.admin-head h1 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.8rem;
  color: var(--navy-800);
  line-height: 1.15;
}
.admin-head .desc {
  margin-top: 6px;
  color: var(--ink-muted);
  font-size: 0.92rem;
  max-width: 44rem;
}
.admin-head .actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* ---- Buttons ---- */

.abtn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 0.88rem;
  padding: 9px 16px;
  border-radius: 9px;
  text-decoration: none;
  border: 1px solid transparent;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.abtn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
.abtn-primary {
  background: var(--navy-800);
  color: var(--ink-on-navy);
}
.abtn-primary:hover:not(:disabled) {
  background: var(--navy-700);
}
.abtn-ghost {
  border-color: var(--line-strong);
  color: var(--navy-800);
  background: var(--white);
}
.abtn-ghost:hover:not(:disabled) {
  border-color: var(--navy-600);
}
.abtn-danger {
  border-color: transparent;
  background: var(--danger-bg);
  color: var(--danger);
}
.abtn-danger:hover:not(:disabled) {
  background: #f0d4d4;
}
.abtn-sm {
  padding: 6px 12px;
  font-size: 0.82rem;
}

/* ---- Cards & stat tiles ---- */

.acard {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow-1);
}
.acard h2 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.15rem;
  color: var(--navy-800);
  margin-bottom: 14px;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}
.stat-tile {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow-1);
}
.stat-tile .k {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
.stat-tile .v {
  margin-top: 6px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.7rem;
  color: var(--navy-800);
  font-variant-numeric: tabular-nums lining-nums;
}
.stat-tile .n {
  margin-top: 2px;
  font-size: 0.8rem;
  color: var(--ink-muted);
}

/* ---- Ranked bar rows (dashboard roll-up) ---- */

.bar-rows {
  display: grid;
  gap: 12px;
}
.bar-row .bar-line {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.88rem;
  margin-bottom: 4px;
}
.bar-row .bar-label {
  color: var(--ink);
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.bar-row .bar-value {
  color: var(--ink-muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.bar-row .bar-track {
  height: 8px;
  border-radius: 4px;
  background: var(--paper-warm);
  overflow: hidden;
}
.bar-row .bar-fill {
  height: 100%;
  border-radius: 4px;
  background: var(--navy-700);
  min-width: 3px;
}

/* ---- Tables ---- */

.table-scroll {
  overflow-x: auto;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-1);
}
.atable {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
.atable th {
  text-align: left;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--ink-faint);
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.atable td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.atable tbody tr:last-child td {
  border-bottom: none;
}
.atable tbody tr:hover {
  background: var(--paper);
}
.atable .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.atable a {
  color: var(--navy-700);
  font-weight: 600;
  text-decoration: none;
}
.atable a:hover {
  text-decoration: underline;
}

.empty-state {
  padding: 40px;
  text-align: center;
  color: var(--ink-faint);
}

/* ---- Status pills ---- */

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 999px;
  padding: 3px 10px;
  white-space: nowrap;
}
.pill::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}
.pill-draft {
  background: var(--status-draft-bg);
  color: var(--status-draft-fg);
}
.pill-ready {
  background: var(--status-ready-bg);
  color: var(--status-ready-fg);
}
.pill-processed {
  background: var(--status-processed-bg);
  color: var(--status-processed-fg);
}
.pill-kind {
  background: var(--navy-050);
  color: var(--navy-700);
}
.pill-kind::before {
  display: none;
}

/* ---- Filters ---- */

.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
}
.filter-row select,
.filter-row input {
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: var(--white);
  padding: 8px 12px;
  font-size: 0.88rem;
  color: var(--ink);
}

/* ---- Forms ---- */

.form-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}
.form-grid .full {
  grid-column: 1 / -1;
}
.field label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: 6px;
}
.field input,
.field select,
.field textarea {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: var(--white);
  padding: 9px 12px;
  font-size: 0.92rem;
  color: var(--ink);
}
.field textarea {
  resize: vertical;
  min-height: 84px;
}
.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: 2px solid var(--navy-600);
  outline-offset: 0;
  border-color: var(--navy-600);
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 22px;
  align-items: center;
}

/* A checkbox with its text as the label. Not a .field, so the full-width
   input rule above does not stretch the box. */
.check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 0.92rem;
  color: var(--ink);
  cursor: pointer;
}
.check input {
  flex: none;
  width: 16px;
  height: 16px;
  margin-top: 3px;
  accent-color: var(--navy-600);
}

.form-error {
  background: var(--danger-bg);
  color: var(--danger);
  border-radius: 9px;
  padding: 10px 14px;
  font-size: 0.88rem;
  margin-top: 14px;
}
.form-success {
  background: var(--status-processed-bg);
  color: var(--status-processed-fg);
  border-radius: 9px;
  padding: 10px 14px;
  font-size: 0.88rem;
  margin-top: 14px;
}

.sig-preview {
  border: 1px dashed var(--line-strong);
  border-radius: 9px;
  padding: 12px;
  background: var(--white);
  max-width: 320px;
}
.sig-preview img {
  max-height: 90px;
  margin-inline: auto;
}

/* ---- Sign-in gate ---- */

.gate {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(160deg, var(--navy-800), var(--navy-950));
  padding: 24px;
}
.gate-card {
  background: var(--white);
  border-radius: 16px;
  box-shadow: var(--shadow-2);
  padding: 44px 40px;
  max-width: 420px;
  width: 100%;
  text-align: center;
}
.gate-card img {
  width: 56px;
  height: 56px;
  margin: 0 auto 16px;
}
.gate-card h1 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.5rem;
  color: var(--navy-800);
}
.gate-card p {
  margin-top: 10px;
  color: var(--ink-muted);
  font-size: 0.92rem;
}
.gate-card .abtn {
  margin-top: 24px;
  width: 100%;
  justify-content: center;
}

/* ---- Field validation (Blazor's ValidationMessage and input states) ---- */

.validation-message {
  color: var(--danger);
  font-size: 0.8rem;
  margin-top: 5px;
}
.field input.invalid,
.field select.invalid,
.field textarea.invalid {
  border-color: var(--danger);
}
