/* =========================================================================
   Green Futures — Admin dashboard UI
   ========================================================================= */
:root {
  --admin-bg: #f5f7f6;
  --admin-panel: #ffffff;
  --admin-ink: #16241e;
  --admin-muted: #63756c;
  --admin-border: #e7ece9;
  --admin-brand: #1f6b4a;
  --admin-brand-dark: #154d36;
  --admin-accent: #e8935a;
  --admin-sidebar-1: #14281f;
  --admin-sidebar-2: #0f1f18;
  --admin-radius: 16px;
  --admin-radius-sm: 10px;
  --admin-shadow-sm: 0 1px 2px rgba(16, 36, 28, .06), 0 1px 3px rgba(16, 36, 28, .04);
  --admin-shadow-md: 0 6px 20px rgba(16, 36, 28, .08);
  --admin-shadow-lg: 0 24px 60px rgba(16, 36, 28, .18);
  --admin-ease: cubic-bezier(.4, 0, .2, 1);
  --admin-spring: cubic-bezier(.34, 1.56, .64, 1);
}

* { -webkit-tap-highlight-color: transparent; }

body.admin-body {
  background: var(--admin-bg);
  color: var(--admin-ink);
  font-family: var(--font-body, "Inter", system-ui, -apple-system, sans-serif);
  font-feature-settings: "cv11", "ss01";
  -webkit-font-smoothing: antialiased;
}

.admin-body a { color: var(--admin-brand); text-decoration: none; }
.admin-body a:hover { color: var(--admin-brand-dark); }

/* Lucide icons: consistent sizing / alignment */
[data-lucide] { width: 18px; height: 18px; stroke-width: 2; vertical-align: -3px; }
.icon-sm [data-lucide], [data-lucide].icon-sm { width: 15px; height: 15px; }
.icon-lg [data-lucide], [data-lucide].icon-lg { width: 22px; height: 22px; }

::selection { background: rgba(31, 107, 74, .18); }

/* ---- Shell -------------------------------------------------------------- */
.admin-shell { display: flex; min-height: 100vh; }

.admin-sidebar {
  width: 258px; flex-shrink: 0;
  position: fixed; inset: 0 auto 0 0; z-index: 1040;
  background: linear-gradient(185deg, var(--admin-sidebar-1), var(--admin-sidebar-2));
  color: #c6d5cd;
  overflow-y: auto;
  transition: transform .32s var(--admin-ease);
  border-right: 1px solid rgba(255, 255, 255, .04);
}
.admin-sidebar::-webkit-scrollbar { width: 6px; }
.admin-sidebar::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .12); border-radius: 3px; }

.admin-main {
  flex: 1; margin-left: 258px; min-width: 0;
  display: flex; flex-direction: column;
}

.admin-brand {
  display: flex; align-items: center;
  padding: 1.35rem 1.35rem;
  border-bottom: 1px solid rgba(255, 255, 255, .06);
}
.admin-brand .brand-logo { height: 32px; }

.admin-nav { padding: .6rem .6rem 2.5rem; }
.admin-nav .nav-section {
  font-size: .66rem; text-transform: uppercase; letter-spacing: .12em;
  color: #6d8378; padding: 1.15rem .85rem .4rem; font-weight: 600;
}
.admin-nav a {
  position: relative;
  display: flex; align-items: center; gap: .72rem;
  padding: .62rem .85rem; margin: 1px 0;
  border-radius: var(--admin-radius-sm);
  color: #b9cabf; font-size: .9rem; font-weight: 500;
  transition: background .18s var(--admin-ease), color .18s var(--admin-ease), transform .18s var(--admin-ease), padding .18s var(--admin-ease);
}
.admin-nav a [data-lucide] { color: #8fa79a; transition: color .18s var(--admin-ease), transform .3s var(--admin-spring); flex-shrink: 0; }
.admin-nav a:hover {
  background: rgba(255, 255, 255, .055); color: #fff;
  padding-left: 1.05rem;
}
.admin-nav a:hover [data-lucide] { color: #fff; transform: scale(1.12); }
.admin-nav a.active {
  background: linear-gradient(120deg, var(--admin-brand), #237a54);
  color: #fff; font-weight: 600;
  box-shadow: 0 8px 20px rgba(31, 107, 74, .35);
}
.admin-nav a.active [data-lucide] { color: #fff; }
.admin-nav a.active::before {
  content: ""; position: absolute; left: -.6rem; top: 50%; transform: translateY(-50%);
  width: 4px; height: 60%; border-radius: 0 4px 4px 0; background: var(--admin-accent);
}

/* ---- Topbar ----------------------------------------------------------- */
.admin-topbar {
  background: rgba(255, 255, 255, .82);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--admin-border);
  padding: .85rem 1.6rem;
  display: flex; align-items: center; gap: 1rem;
  position: sticky; top: 0; z-index: 1030;
}
.admin-topbar .page-title {
  font-family: var(--font-heading, "Poppins", sans-serif);
  font-weight: 600; font-size: 1.05rem; letter-spacing: -.01em;
}
.admin-topbar .btn-light {
  border: 1px solid var(--admin-border); background: #fff;
  transition: transform .15s var(--admin-ease), box-shadow .15s var(--admin-ease), background .15s;
}
.admin-topbar .btn-light:hover { transform: translateY(-1px); box-shadow: var(--admin-shadow-sm); background: #fff; }

.admin-content { padding: 1.75rem 1.6rem 3rem; max-width: 1240px; width: 100%; }

/* ---- Cards ----------------------------------------------------------- */
.admin-card {
  background: var(--admin-panel);
  border: 1px solid var(--admin-border);
  border-radius: var(--admin-radius);
  box-shadow: var(--admin-shadow-sm);
  transition: box-shadow .25s var(--admin-ease), transform .25s var(--admin-ease), border-color .25s;
}
.admin-card:hover { box-shadow: var(--admin-shadow-md); }
.admin-card .admin-card-head {
  padding: .95rem 1.25rem; border-bottom: 1px solid var(--admin-border);
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  font-family: var(--font-heading, "Poppins", sans-serif);
}
.admin-card .admin-card-head > span:first-child {
  font-weight: 600; display: inline-flex; align-items: center; gap: .5rem;
}
.admin-card .admin-card-head [data-lucide] { color: var(--admin-brand); }
.admin-card .admin-card-body { padding: 1.25rem; }

/* Stat tiles */
.stat-tile {
  position: relative; overflow: hidden;
  padding: 1.1rem 1.15rem;
  display: flex; flex-direction: column; gap: .1rem;
  min-width: 0;
}
.stat-tile::after {
  content: ""; position: absolute; right: -34px; top: -34px;
  width: 80px; height: 80px; border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, rgba(31, 107, 74, .1), transparent 70%);
  transition: transform .4s var(--admin-ease);
  pointer-events: none;
}
.stat-tile:hover { transform: translateY(-3px); }
.stat-tile:hover::after { transform: scale(1.4); }
.stat-tile .stat-ico {
  width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center;
  background: rgba(31, 107, 74, .1); color: var(--admin-brand); margin-bottom: .5rem;
  transition: transform .4s var(--admin-spring);
}
.stat-tile:hover .stat-ico { transform: scale(1.12) rotate(-6deg); }
.stat-tile .stat-value {
  font-size: clamp(1.1rem, 1.5vw, 1.4rem); font-weight: 700; letter-spacing: -.02em;
  font-family: var(--font-heading, "Poppins", sans-serif);
  font-variant-numeric: tabular-nums;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  line-height: 1.2;
}
.stat-tile .stat-label { color: var(--admin-muted); font-size: .76rem; font-weight: 500; }

/* ---- Tables --------------------------------------------------------- */
/* A card that holds a table edge-to-edge: clip rounded corners, no body padding. */
.admin-card > .table-responsive { border-radius: 0 0 var(--admin-radius) var(--admin-radius); overflow: hidden; }
.admin-card > .table-responsive:first-child { border-radius: var(--admin-radius); }

.admin-body .table {
  --bs-table-bg: transparent;
  margin-bottom: 0;
  border-collapse: separate;
  border-spacing: 0;
  font-size: .9rem;
}
.admin-body .table thead th {
  font-size: .7rem; text-transform: uppercase; letter-spacing: .07em;
  color: var(--admin-muted); font-weight: 700;
  border: 0; border-bottom: 1px solid var(--admin-border);
  padding: .8rem 1.35rem;
  background: #fbfcfb;
  white-space: nowrap;
}
.admin-body .table tbody td {
  padding: .85rem 1.35rem;
  border: 0; border-bottom: 1px solid #eef2f0;
  vertical-align: middle;
  color: var(--admin-ink);
}
.admin-body .table tbody tr { transition: background .15s var(--admin-ease), box-shadow .15s var(--admin-ease); }
.admin-body .table tbody tr:hover { background: #f6faf8; }
.admin-body .table tbody tr:last-child td { border-bottom: 0; }
.admin-body .table tbody tr td:first-child, .admin-body .table thead th:first-child { padding-left: 1.35rem; }
.admin-body .table a.fw-semibold { color: var(--admin-brand); }
.admin-body .table .btn-sm { padding: .3rem .6rem; font-size: .8rem; border-radius: 8px; }
.admin-body .table td .d-inline + .d-inline, .admin-body .table td form.d-inline { margin-left: .35rem; }
/* Actions column: without this, table auto-layout lets a long text
   column (e.g. Body) squeeze this one below what Edit+Delete need,
   wrapping them onto separate lines instead of sitting inline. */
.admin-body .table th.text-end, .admin-body .table td.text-end { white-space: nowrap; }

/* filter / toolbar row above a table */
.table-toolbar { padding: 1rem 1.35rem; border-bottom: 1px solid var(--admin-border); }
.table-toolbar .form-control, .table-toolbar .form-select { border-radius: 9px; }

/* bulk-selection action bar above a table */
.bulk-toolbar { display: flex; align-items: center; gap: .75rem; padding: .75rem 1.35rem; background: #f2f8f4; border-bottom: 1px solid var(--admin-border); }
.bulk-toolbar .form-select { border-radius: 9px; }

.empty-row td { text-align: center; color: var(--admin-muted); padding: 2.75rem 1rem !important; }

.badge-status { text-transform: capitalize; font-weight: 600; letter-spacing: .01em; }
.admin-body .badge { padding: .42em .72em; border-radius: 8px; font-weight: 600; }
.admin-body .badge.bg-success { background: #e9f6ef !important; color: #17603f; }
.admin-body .badge.bg-secondary { background: #eef2f0 !important; color: #5b6b63; }
.admin-body .badge.bg-warning { background: #fdf3e0 !important; color: #a5771a; }
.admin-body .badge.bg-danger { background: #fdecec !important; color: #b23434; }
.admin-body .badge.bg-info { background: #e5f2f7 !important; color: #2a6f88; }
.admin-body .badge.bg-light { background: #f2f5f3 !important; color: #5b6b63; border: 1px solid var(--admin-border); }
.admin-body .badge.bg-primary-subtle { background: #e9f2ee !important; color: #1f6b4a; border: 1px solid #cfe4d9 !important; }

/* ---- Pagination --------------------------------------------------- */
.admin-body .pagination { margin: 1rem 0 0; gap: .3rem; flex-wrap: wrap; }
.admin-body .page-link {
  border: 1px solid var(--admin-border); border-radius: 9px !important;
  color: var(--admin-ink); padding: .4rem .7rem; font-size: .85rem; font-weight: 600;
  transition: background .15s var(--admin-ease), color .15s, border-color .15s, transform .15s var(--admin-ease);
}
.admin-body .page-link:hover { background: #f2f6f4; border-color: #cfe0d8; transform: translateY(-1px); }
.admin-body .page-item.active .page-link { background: var(--admin-brand); border-color: var(--admin-brand); color: #fff; }
.admin-body .page-item.disabled .page-link { opacity: .45; }
.pager { padding: .8rem 1.35rem 1rem; border-top: 1px solid var(--admin-border); }
.pager .pagination { margin-top: 0; }
.pager p, .pager .text-sm { font-size: .82rem; color: var(--admin-muted); margin: 0; }

/* ---- Buttons ------------------------------------------------------- */
.admin-body .btn {
  border-radius: 10px; font-weight: 600; letter-spacing: .005em;
  display: inline-flex; align-items: center; gap: .4rem;
  transition: transform .14s var(--admin-ease), box-shadow .18s var(--admin-ease), background-color .18s, border-color .18s, opacity .18s;
}
.admin-body .btn:active { transform: scale(.96); }
.admin-body .btn-brand {
  background: linear-gradient(120deg, var(--admin-brand), #237a54);
  border: none; color: #fff; box-shadow: 0 6px 16px rgba(31, 107, 74, .25);
}
.admin-body .btn-brand:hover { color: #fff; transform: translateY(-2px); box-shadow: 0 10px 24px rgba(31, 107, 74, .34); }
.admin-body .btn-brand-outline {
  background: #fff; border: 1.5px solid var(--admin-border); color: var(--admin-ink);
}
.admin-body .btn-brand-outline:hover { border-color: var(--admin-brand); color: var(--admin-brand); transform: translateY(-2px); box-shadow: var(--admin-shadow-sm); }
.admin-body .btn-outline-danger:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(220, 53, 69, .2); }
.admin-body .btn.is-loading { pointer-events: none; opacity: .75; }
.admin-body .btn.is-loading .btn-label { opacity: .5; }
.admin-body .btn .spinner {
  width: 15px; height: 15px; border: 2px solid currentColor; border-right-color: transparent;
  border-radius: 50%; animation: admin-spin .6s linear infinite; display: none;
}
.admin-body .btn.is-loading .spinner { display: inline-block; }

/* square icon-only button */
.admin-body .btn-icon {
  width: 32px; height: 32px; padding: 0;
  display: inline-grid; place-items: center;
}
.admin-body .btn-icon [data-lucide] { width: 15px; height: 15px; }

/* Active | Trash segmented control */
.trash-toggle .btn { font-weight: 600; }
.trash-toggle .badge { font-size: .68rem; padding: .18em .45em; }
@keyframes admin-spin { to { transform: rotate(360deg); } }

/* ---- Forms --------------------------------------------------------- */
.admin-body .form-control,
.admin-body .form-select {
  border-radius: 10px;
  border: 1.5px solid var(--admin-border);
  padding: .58rem .8rem;
  background-color: #fdfefe;
  transition: border-color .16s var(--admin-ease), box-shadow .16s var(--admin-ease), background-color .16s;
}
.admin-body .form-control::placeholder { color: #9fb0a8; }
.admin-body .form-control:hover, .admin-body .form-select:hover { border-color: #cfe0d8; }
.admin-body .form-control:focus,
.admin-body .form-select:focus {
  border-color: var(--admin-brand);
  background-color: #fff;
  box-shadow: 0 0 0 4px rgba(31, 107, 74, .12);
}
.admin-body .form-control.form-control-sm, .admin-body .form-select-sm { padding: .38rem .6rem; }
.admin-body .form-control-lg { padding: .7rem .9rem; border-radius: 12px; }
.admin-body textarea.form-control { line-height: 1.6; }

.admin-body .form-label {
  font-weight: 600; font-size: .82rem; letter-spacing: .01em;
  color: var(--admin-ink); margin-bottom: .4rem;
}
.admin-body .form-text { font-size: .8rem; color: var(--admin-muted); margin-top: .35rem; }
.admin-body .input-group-text { background: #f4f7f5; border: 1.5px solid var(--admin-border); border-radius: 10px; color: var(--admin-muted); }

/* form field grouping */
.form-section { padding: 1.25rem; }
.form-section + .form-section { border-top: 1px solid var(--admin-border); }
.form-section-title {
  font-family: var(--font-heading, "Poppins", sans-serif);
  font-weight: 600; font-size: .95rem; margin-bottom: .25rem;
  display: flex; align-items: center; gap: .45rem;
}
.form-section-hint { color: var(--admin-muted); font-size: .84rem; margin-bottom: 1rem; }

/* Settings — vertical rail + content */
.settings-card { max-width: 940px; overflow: hidden; }
.settings-layout { display: flex; align-items: stretch; }
.settings-rail {
  flex: 0 0 232px; border-right: 1px solid var(--admin-border);
  padding: .75rem; display: flex; flex-direction: column; gap: .15rem;
  background: #fbfcfb;
}
.settings-rail .nav-link {
  width: 100%; text-align: left; border: 0; background: transparent;
  border-radius: 10px; padding: .62rem .75rem; font-size: .88rem; font-weight: 600;
  color: var(--admin-muted); display: flex; align-items: center; gap: .55rem;
  transition: background .15s var(--admin-ease), color .15s var(--admin-ease);
}
.settings-rail .nav-link [data-lucide] { color: inherit; flex-shrink: 0; }
.settings-rail .nav-link:hover { background: #eef3f0; color: var(--admin-ink); }
.settings-rail .nav-link.active { background: rgba(31, 107, 74, .12); color: var(--admin-brand); }

.settings-body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.settings-body .tab-content { flex: 1; }
.settings-pane { padding: 1.35rem 1.5rem; }
.settings-pane-head {
  font-family: var(--font-heading, "Poppins", sans-serif);
  font-weight: 600; font-size: 1rem; margin-bottom: 1.1rem;
  padding-bottom: .7rem; border-bottom: 1px solid var(--admin-border);
}
.settings-body .tab-pane.fade { transition: opacity .16s var(--admin-ease); }
.settings-body .form-actions { border-radius: 0; }

@media (max-width: 767.98px) {
  .settings-layout { flex-direction: column; }
  .settings-rail {
    flex: none; flex-direction: row; overflow-x: auto;
    border-right: 0; border-bottom: 1px solid var(--admin-border);
    padding: .6rem;
  }
  .settings-rail .nav-link { white-space: nowrap; }
  .settings-rail .nav-link span { display: none; }
  .settings-rail .nav-link.active span { display: inline; }
}

/* sticky save bar at the bottom of a form card */
.form-actions {
  position: sticky; bottom: 0;
  display: flex; align-items: center; gap: .75rem;
  padding: .95rem 1.25rem;
  background: rgba(255, 255, 255, .9);
  backdrop-filter: blur(8px);
  border-top: 1px solid var(--admin-border);
  border-radius: 0 0 var(--admin-radius) var(--admin-radius);
}
.form-actions .spacer { flex: 1; }

/* checkboxes / switches */
.admin-body .form-check-input {
  border: 1.5px solid #c3d2cb; cursor: pointer;
  transition: background-color .16s var(--admin-ease), border-color .16s, background-position .16s var(--admin-ease);
}
.admin-body .form-check-input:checked { background-color: var(--admin-brand); border-color: var(--admin-brand); }
.admin-body .form-check-input:focus { box-shadow: 0 0 0 4px rgba(31, 107, 74, .12); border-color: var(--admin-brand); }
.admin-body .form-switch .form-check-input { width: 2.4em; height: 1.3em; margin-top: .1em; }
.admin-body .form-check-label { font-size: .9rem; }

/* a bordered toggle row used for permission / role pickers */
.check-tile {
  display: flex; align-items: flex-start; gap: .6rem;
  padding: .6rem .75rem; border: 1.5px solid var(--admin-border); border-radius: 11px;
  margin-bottom: .5rem; transition: border-color .15s var(--admin-ease), background .15s;
  cursor: pointer;
}
.check-tile:hover { border-color: #cfe0d8; background: #f8fbf9; }
.check-tile:has(.form-check-input:checked) { border-color: var(--admin-brand); background: #f1f8f4; }
.check-tile .form-check-input { margin-top: .15rem; }

/* ---- Report chips ------------------------------------------------- */
.report-chip {
  display: flex; align-items: center; gap: .7rem;
  padding: .7rem .85rem;
  border: 1px solid var(--admin-border); border-radius: 12px;
  background: #fbfdfc; height: 100%;
}
.report-chip-ico {
  width: 32px; height: 32px; border-radius: 9px; flex-shrink: 0;
  display: grid; place-items: center;
  background: rgba(31, 107, 74, .1); color: var(--admin-brand);
}
.report-chip-value { font-weight: 700; font-size: 1rem; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.report-chip-label { font-size: .74rem; color: var(--admin-muted); }

.admin-body table tfoot td { border-top: 2px solid var(--admin-brand); background: #fbfcfb; padding: .8rem 1.35rem; }

/* ---- Tom Select (donor multi-select) ---------------------------------- */
.admin-body .ts-wrapper { font-size: .9rem; }
.admin-body .ts-control {
  border: 1.5px solid var(--admin-border); border-radius: 10px;
  padding: .4rem .6rem; min-height: 44px; background: #fdfefe;
  box-shadow: none;
}
.admin-body .ts-wrapper.focus .ts-control {
  border-color: var(--admin-brand); box-shadow: 0 0 0 4px rgba(31, 107, 74, .12);
}
.admin-body .ts-control .item {
  background: #eef7f1; color: #16603f; border: 1px solid #cfe4d9;
  border-radius: 8px; padding: .1rem .1rem .1rem .5rem; font-weight: 600;
}
.admin-body .ts-control .item .remove { border-left-color: #cfe4d9; color: #16603f; }
.admin-body .ts-control .item .remove:hover { background: #dcefe4; }
.admin-body .ts-dropdown {
  border: 1px solid var(--admin-border); border-radius: 12px;
  box-shadow: var(--admin-shadow-md); margin-top: 4px; overflow: hidden;
}
.admin-body .ts-dropdown .option { padding: .55rem .8rem; }
.admin-body .ts-dropdown .active { background: #eef7f1; color: #16603f; }

/* ---- Image upload field ------------------------------------------- */
.image-field { --img-accent: var(--admin-brand); }
.image-drop {
  position: relative;
  border: 1.5px dashed #c6d5cd;
  border-radius: 14px;
  background: #fbfdfc;
  padding: 1.1rem;
  min-height: 150px;
  display: flex; align-items: center; justify-content: center;
  text-align: center;
  cursor: pointer;
  transition: border-color .18s var(--admin-ease), background .18s var(--admin-ease), box-shadow .18s var(--admin-ease);
  outline: none;
}
.image-drop:hover { border-color: var(--img-accent); background: #f4faf6; }
.image-drop:focus-visible { box-shadow: 0 0 0 4px rgba(31, 107, 74, .14); border-color: var(--img-accent); }
.image-drop.is-dragging {
  border-color: var(--img-accent); background: #eef7f1;
  box-shadow: 0 0 0 4px rgba(31, 107, 74, .12);
}
.image-drop.has-image { cursor: default; padding: .9rem; }

.image-prompt { display: flex; flex-direction: column; align-items: center; gap: .35rem; color: var(--admin-ink); }
.image-prompt-ico {
  width: 46px; height: 46px; border-radius: 13px; display: grid; place-items: center;
  background: rgba(31, 107, 74, .1); color: var(--img-accent); margin-bottom: .3rem;
  transition: transform .3s var(--admin-spring);
}
.image-drop:hover .image-prompt-ico, .image-drop.is-dragging .image-prompt-ico { transform: scale(1.08) translateY(-1px); }
.image-browse { color: var(--img-accent); font-weight: 700; text-decoration: underline; }

.image-preview { position: relative; width: 100%; display: flex; justify-content: center; }
.image-preview img {
  max-width: 100%; max-height: 200px; border-radius: 10px;
  border: 1px solid var(--admin-border);
  box-shadow: var(--admin-shadow-sm);
  animation: admin-pop .3s var(--admin-spring);
  object-fit: contain; background: #fff;
}
.image-badge {
  position: absolute; left: 50%; bottom: -10px; transform: translateX(-50%);
  background: var(--admin-ink); color: #fff;
  font-size: .68rem; font-weight: 600; letter-spacing: .02em;
  padding: .18rem .55rem; border-radius: 999px; white-space: nowrap;
}
.image-badge.is-new { background: var(--img-accent); }

.image-actions {
  position: absolute; top: .6rem; right: .6rem;
  display: flex; gap: .4rem;
}
.image-actions .btn {
  background: rgba(255, 255, 255, .96); backdrop-filter: blur(4px);
  box-shadow: var(--admin-shadow-sm);
}
.image-actions .btn:hover { background: #fff; }

@media (max-width: 575.98px) {
  .image-actions { position: static; justify-content: center; margin-top: .7rem; }
}

/* ---- Charts (fixed-height holders stop Chart.js resize loops) ------ */
.chart-holder { position: relative; width: 100%; }
.chart-holder.tall { height: 300px; }
.chart-holder.mid { height: 240px; }
.chart-holder.short { height: 210px; }
.chart-fallback { display: none; text-align: center; color: var(--admin-muted); padding: 2rem 1rem; font-size: .88rem; }
.chart-holder.failed .chart-fallback { display: block; }
.chart-holder.failed canvas { display: none; }

/* Alerts */
.admin-body .alert { border: 1px solid transparent; border-radius: 12px; animation: admin-slide-down .35s var(--admin-ease); }
.admin-body .alert-success { background: #e9f6ef; border-color: #c6e7d5; color: #17603f; }
.admin-body .alert-danger { background: #fdecec; border-color: #f6cfcf; color: #a12b2b; }

/* ---- Charts -------------------------------------------------------- */
.chart-box { position: relative; }
.chart-box canvas { animation: admin-fade .5s var(--admin-ease); }
.chart-legend { display: flex; flex-wrap: wrap; gap: .5rem .95rem; margin-top: .75rem; }
.chart-legend span { display: inline-flex; align-items: center; gap: .4rem; font-size: .8rem; color: var(--admin-muted); }
.chart-legend .dot { width: 9px; height: 9px; border-radius: 50%; }

/* ---- Confirm modal ---------------------------------------------------- */
.admin-modal-backdrop {
  position: fixed; inset: 0; z-index: 1090;
  background: rgba(16, 36, 28, .48); backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center; padding: 1.25rem;
  opacity: 0; pointer-events: none; transition: opacity .2s var(--admin-ease);
}
.admin-modal-backdrop.show { opacity: 1; pointer-events: auto; }
.admin-modal {
  width: 100%; max-width: 420px; background: #fff; border-radius: 18px;
  box-shadow: var(--admin-shadow-lg); padding: 1.6rem;
  transform: translateY(14px) scale(.96); opacity: 0;
  transition: transform .28s var(--admin-spring), opacity .2s var(--admin-ease);
}
.admin-modal-backdrop.show .admin-modal { transform: translateY(0) scale(1); opacity: 1; }
.admin-modal .modal-ico {
  width: 46px; height: 46px; border-radius: 13px; display: grid; place-items: center;
  background: rgba(31, 107, 74, .12); color: var(--admin-brand); margin-bottom: .9rem;
}
.admin-modal.is-danger .modal-ico { background: rgba(220, 53, 69, .12); color: #dc3545; }
.admin-modal h5 { font-family: var(--font-heading, "Poppins", sans-serif); font-weight: 600; margin-bottom: .35rem; }
.admin-modal p { color: var(--admin-muted); font-size: .92rem; margin-bottom: 1.2rem; }
.admin-modal .admin-modal-reason { text-align: left; margin: -.3rem 0 1.2rem; }
.admin-modal .admin-modal-reason .form-label { font-size: .82rem; font-weight: 600; margin-bottom: .3rem; }
.admin-modal .admin-modal-reason textarea { font-size: .9rem; }
.admin-modal .modal-actions { display: flex; gap: .6rem; justify-content: flex-end; }

/* ---- Login --------------------------------------------------------- */
.admin-login-shell { min-height: 100vh; display: grid; }

.admin-login-brand { display: none; }

.admin-login-panel {
  display: grid; place-items: center; padding: 2rem 1rem;
  background: radial-gradient(1200px 600px at 20% -10%, #2c8f66, transparent),
              linear-gradient(160deg, #14281f, #1f6b4a);
}

.admin-login-card {
  width: 100%; max-width: 428px; background: #fff; border-radius: 22px;
  padding: 2.4rem; box-shadow: var(--admin-shadow-lg);
  animation: admin-pop .45s var(--admin-spring);
}

.admin-login-card #togglePassword { cursor: pointer; }
.admin-login-card .input-group-text { border-left: none; }
.admin-login-card .input-group .form-control { border-left: none; }
.admin-login-card .input-group .input-group-text:first-child { border-left: 1.5px solid var(--admin-border); border-right: none; }
.admin-login-card .form-text.text-end { font-size: .78rem; }

@media (min-width: 992px) {
  .admin-login-shell { grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); }

  .admin-login-brand {
    display: flex; flex-direction: column; justify-content: center;
    position: relative; overflow: hidden; padding: 3.5rem 4rem; color: #fff;
    background: radial-gradient(900px 500px at 15% -10%, #2c8f66, transparent),
                linear-gradient(165deg, #14281f, #1f6b4a 65%, #237a54);
  }
  .admin-login-brand::before,
  .admin-login-brand::after {
    content: ""; position: absolute; border-radius: 50%; pointer-events: none;
  }
  .admin-login-brand::before { width: 22rem; height: 22rem; top: -8rem; right: -6rem; background: rgba(255, 255, 255, .06); }
  .admin-login-brand::after { width: 16rem; height: 16rem; bottom: -6rem; left: -4rem; background: rgba(232, 147, 90, .14); }

  .admin-login-brand-inner { position: relative; z-index: 1; max-width: 420px; }

  .admin-login-headline {
    font-size: 1.9rem; line-height: 1.25; margin-bottom: 1rem;
    font-family: var(--font-heading, "Poppins"); font-weight: 600;
  }
  .admin-login-sub { color: rgba(255, 255, 255, .78); margin-bottom: 2.25rem; }

  .admin-login-points { list-style: none; padding: 0; margin: 0; display: grid; gap: .9rem; }
  .admin-login-points li { display: flex; align-items: center; gap: .75rem; font-size: .92rem; color: rgba(255, 255, 255, .92); }
  .admin-login-points .pt-icon {
    width: 34px; height: 34px; border-radius: 10px; flex-shrink: 0;
    background: rgba(255, 255, 255, .12); display: inline-flex; align-items: center; justify-content: center;
  }

  .admin-login-panel { background: #fff; padding: 2rem 3rem; }
  .admin-login-card {
    box-shadow: none; padding: 0; max-width: 400px;
    animation: admin-fade .5s var(--admin-ease);
  }
}

/* ---- Motion utilities ------------------------------------------------ */
@keyframes admin-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes admin-pop { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes admin-slide-down { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }

.reveal { opacity: 0; transform: translateY(12px); }
.reveal.in { opacity: 1; transform: none; transition: opacity .5s var(--admin-ease), transform .5s var(--admin-ease); }

.admin-content > *:not(.reveal) { animation: admin-fade .4s var(--admin-ease); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
  .reveal { opacity: 1; transform: none; }
}

/* ---- Responsive --------------------------------------------------- */
/* (higher specificity than the generic ".admin-body .btn { display: inline-flex }"
   rule above, which would otherwise win on desktop and leave the hamburger showing) */
.admin-topbar .btn.admin-sidebar-toggle { display: none; }
.admin-scrim {
  position: fixed; inset: 0; background: rgba(16, 36, 28, .4); z-index: 1039;
  opacity: 0; pointer-events: none; transition: opacity .25s var(--admin-ease);
}
@media (max-width: 991.98px) {
  .admin-sidebar { transform: translateX(-100%); box-shadow: var(--admin-shadow-lg); }
  .admin-sidebar.open { transform: translateX(0); }
  .admin-main { margin-left: 0; }
  .admin-topbar .btn.admin-sidebar-toggle { display: inline-flex; }
  .admin-scrim.show { opacity: 1; pointer-events: auto; }
}

/* ---- Public consent banner (kept here, shared stylesheet) ---------- */
.consent-banner {
  position: fixed; right: 1.25rem; left: auto; bottom: 1.25rem; z-index: 1080;
  width: calc(100% - 2.5rem); max-width: 380px; margin: 0;
  background: #173a29; color: #eef4f1;
  border-radius: 16px; padding: 1.15rem 1.25rem;
  box-shadow: 0 24px 55px rgba(0, 0, 0, .35);
  animation: admin-slide-up .4s var(--admin-ease);
}
@media (max-width: 520px) {
  .consent-banner { right: 1rem; left: 1rem; width: auto; max-width: none; }
}
@keyframes admin-slide-up { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
.consent-banner a { color: #cfea6a; text-decoration: underline; }
.consent-banner .consent-actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .85rem; }
.consent-banner .btn { border-radius: 999px; font-weight: 600; }
.consent-banner[hidden] { display: none; }
