/* ASCCOM brand layer on top of FastBootstrap 2.2.0.
   Maps ASCCOM Green + Montserrat onto Bootstrap's design tokens so every
   FastBootstrap component (buttons, forms, cards, tables, badges, alerts)
   picks up the brand automatically. Edit colors here, not per component. */
:root,
[data-bs-theme="light"] {
  --bs-font-sans-serif: Montserrat, Arial, sans-serif;
  --bs-body-font-family: Montserrat, Arial, sans-serif;
  --bs-body-color: #18352a;
  --bs-body-bg: #f5f8f5;
  --bs-secondary-color: #63766c;
  --bs-border-color: #dbe7dc;
  --bs-border-radius: 0.6rem;
  --bs-border-radius-lg: 1rem;
  --bs-primary: #008000;
  --bs-primary-rgb: 0, 128, 0;
  --bs-link-color: #008000;
  --bs-link-color-rgb: 0, 128, 0;
  --bs-link-hover-color: #006c00;
  --bs-link-hover-color-rgb: 0, 108, 0;
  --bs-focus-ring-color: rgba(0, 128, 0, 0.25);
}

/* Primary button = ASCCOM green */
.btn-primary {
  --bs-btn-bg: #008000;
  --bs-btn-border-color: #008000;
  --bs-btn-hover-bg: #006c00;
  --bs-btn-hover-border-color: #006c00;
  --bs-btn-active-bg: #005a00;
  --bs-btn-active-border-color: #005a00;
  --bs-btn-disabled-bg: #008000;
  --bs-btn-disabled-border-color: #008000;
  --bs-btn-focus-shadow-rgb: 0, 128, 0;
}
.btn-outline-secondary {
  --bs-btn-color: #18352a;
  --bs-btn-border-color: #cfdcd1;
  --bs-btn-hover-bg: #eaf5ea;
  --bs-btn-hover-color: #074c34;
  --bs-btn-hover-border-color: #b6d9b6;
  --bs-btn-active-bg: #dcefdc;
  --bs-btn-active-color: #074c34;
  --bs-btn-active-border-color: #b6d9b6;
}
.btn {
  font-weight: 600;
}

.form-control:focus,
.form-select:focus {
  border-color: #008000;
  box-shadow: 0 0 0 0.2rem rgba(0, 128, 0, 0.18);
}
.form-check-input:checked {
  background-color: #008000;
  border-color: #008000;
}
.form-check-input:focus {
  border-color: #008000;
  box-shadow: 0 0 0 0.2rem rgba(0, 128, 0, 0.18);
}
.progress {
  --bs-progress-height: 0.4rem;
  --bs-progress-bg: #e8efe6;
  --bs-progress-bar-bg: #008000;
}

/* Page shell for live (signed-in) screens */
body {
  background: var(--bs-body-bg);
}
.live-admin {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px 32px;
}
.portal-nav {
  background: #fff;
  border-bottom: 1px solid var(--bs-border-color);
  margin: 0 -24px 24px;
  padding: 12px 24px;
}
.portal-nav img {
  width: 120px;
  height: auto;
}
.portal-nav h1 {
  font-size: 1.1rem;
  letter-spacing: 0;
  margin: 0;
}
.portal-nav .eyebrow {
  font-size: 0.65rem;
  color: #008000;
}
.live-admin .card {
  border-radius: 1rem;
  border-color: var(--bs-border-color);
}
.live-admin .field {
  display: block;
  font-weight: 600;
  font-size: 0.86rem;
}
.live-admin .field .form-control,
.live-admin .field .form-select {
  margin-top: 0.35rem;
  font-weight: 400;
}
.live-admin .field .form-text {
  display: block;
  font-weight: 400;
  font-size: 0.75rem;
}
.live-admin [role="status"]:empty {
  display: none;
}
.live-admin [role="status"]:not(:empty) {
  margin: 0.75rem 0 0;
  font-size: 0.86rem;
  color: var(--bs-secondary-color);
}
.live-admin .table {
  --bs-table-bg: transparent;
  margin-bottom: 0;
}
.live-admin .table thead th {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--bs-secondary-color);
  background: #fafcf9;
  padding: 0.8rem 1rem;
  white-space: nowrap;
}
.live-admin .table td {
  padding: 1rem;
  overflow-wrap: anywhere;
}

/* Admin stat cards */
.stat-card .stat-value {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.1;
  color: #008000;
}

/* Staff hero + credit cards */
.staff-welcome {
  border-radius: 1.25rem;
  box-shadow: 0 10px 30px rgba(0, 80, 0, 0.12);
}
.staff-credit.card {
  padding: 0;
}
.staff-credit.conditional {
  background: #f6f9f0;
  border-style: dashed;
}
.staff-credit-number {
  font-size: 2.4rem;
}

/* Leave history status badges */
.status-badge {
  font-weight: 600;
  font-size: 0.72rem;
  padding: 0.4rem 0.7rem;
  border-radius: 2rem;
  text-transform: capitalize;
}
.status-pending {
  background: #fff3db;
  color: #956113;
}
.status-approved {
  background: #eaf5ed;
  color: #227446;
}
.status-rejected {
  background: #ffeded;
  color: #ac4747;
}
.status-cancelled {
  background: #eff2ef;
  color: #63766c;
}

/* Native <dialog> used for the Google account panel */
dialog .btn {
  min-width: 7rem;
}

@media (max-width: 640px) {
  .live-admin {
    padding: 0 14px 24px;
  }
  .portal-nav {
    margin: 0 -14px 16px;
    padding: 10px 14px;
  }
  .portal-nav img {
    width: 88px;
  }
}

/* Login refinements */
.login .google {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.9rem;
  font-size: 1rem;
  padding: 0.8rem 1rem;
  border-radius: 0.6rem;
}
.login .google b {
  color: #4285f4;
  font-size: 1.3rem;
}
.login .demo-entry {
  background: #f5f8f4;
  padding: 0;
  border-radius: 0.9rem;
}
.login .demo-entry .btn {
  width: 100%;
}
.login .demo-entry .card-body {
  padding: 1.25rem;
}

/* Spacing polish for the employee workspace */
.leave-summary {
  margin: 1.5rem 0 0;
}
.staff-welcome h2 {
  margin: 0.4rem 0 0.5rem;
}
.staff-welcome .staff-chip {
  margin-top: 1rem;
}
.staff-toolbar,
#credits-title {
  margin-bottom: 0.25rem;
}
#staff-credits {
  margin-top: 0.5rem;
  margin-bottom: 1.5rem;
}
.staff-credit h3 {
  margin: 1.25rem 0 0.75rem;
}
.staff-credit-meta {
  margin: 1rem 0 0.75rem;
}
.leave-history {
  gap: 1rem;
}

/* Admin accounts table: stack each row as a card on phones and small tablets */
@media (max-width: 767.98px) {
  .live-admin .admin-table table {
    min-width: 0;
  }
  .live-admin #admin-table table,
  .live-admin #admin-table tbody,
  .live-admin #admin-table tr,
  .live-admin #admin-table td {
    display: block;
    width: 100%;
  }
  .live-admin #admin-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }
  .live-admin #admin-table tr {
    border: 1px solid var(--bs-border-color);
    border-radius: 0.9rem;
    background: #fff;
    padding: 0.35rem 0;
    margin-bottom: 0.9rem;
  }
  .live-admin #admin-table td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: 0.55rem 1rem;
    border: 0;
    text-align: right;
  }
  .live-admin #admin-table td::before {
    content: attr(data-label);
    flex: none;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--bs-secondary-color);
    text-align: left;
  }
  .live-admin #admin-table td[data-label="Name / email"] {
    display: block;
    text-align: left;
    padding-top: 0.8rem;
    border-bottom: 1px solid var(--bs-border-color);
    margin-bottom: 0.25rem;
  }
  .live-admin #admin-table td[data-label="Name / email"]::before,
  .live-admin #admin-table td.admin-actions-cell::before {
    display: none;
  }
  .live-admin #admin-table td.admin-actions-cell {
    display: flex;
    gap: 0.5rem;
    padding-bottom: 0.9rem;
  }
  .live-admin #admin-table td.admin-actions-cell .btn {
    flex: 1;
  }
}

/* ===== Visual polish: softer depth, gradients, motion ===== */
:root {
  --glow: 0 10px 30px rgba(0, 96, 32, 0.12);
  --glow-lg: 0 18px 44px rgba(0, 96, 32, 0.18);
}
body {
  background:
    radial-gradient(900px 420px at 8% -8%, #dff1dc 0, transparent 60%),
    radial-gradient(800px 380px at 100% 0, #e8f3d6 0, transparent 55%), #f4f8f4;
  background-attachment: fixed;
}

/* Frosted sticky top bar */
.portal-nav {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: saturate(160%) blur(12px);
  -webkit-backdrop-filter: saturate(160%) blur(12px);
  box-shadow: 0 1px 0 rgba(0, 80, 0, 0.06), 0 6px 20px rgba(0, 80, 0, 0.05);
  border-radius: 0 0 1rem 1rem;
}

/* Cards: lift on hover */
.live-admin .card {
  border: 1px solid rgba(0, 96, 32, 0.1);
  box-shadow: 0 2px 10px rgba(0, 60, 20, 0.05);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}
.live-admin .stat-card:hover,
.live-admin .staff-credit:hover {
  transform: translateY(-3px);
  box-shadow: var(--glow-lg);
  border-color: rgba(0, 128, 0, 0.35);
}

/* Buttons */
.btn-primary {
  background-image: linear-gradient(135deg, #12a312, #007a00 60%, #05611f);
  border: 0;
  box-shadow: 0 6px 16px rgba(0, 128, 0, 0.28);
  transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
}
.btn-primary:hover:not(:disabled) {
  transform: translateY(-1px);
  filter: brightness(1.06);
  box-shadow: 0 10px 22px rgba(0, 128, 0, 0.34);
}
.btn-primary:active:not(:disabled) {
  transform: translateY(0);
}
.btn-primary:disabled {
  background-image: none;
  box-shadow: none;
}
.btn {
  border-radius: 0.7rem;
}
.btn-outline-secondary {
  background: #fff;
}

/* Inputs */
.form-control,
.form-select {
  border-radius: 0.7rem;
  border-color: #d3e0d5;
  padding: 0.65rem 0.85rem;
}

/* Hero banner */
.staff-welcome {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(420px 260px at 92% -10%, rgba(190, 240, 120, 0.35), transparent 70%),
    radial-gradient(360px 240px at 0 120%, rgba(255, 255, 255, 0.12), transparent 70%),
    linear-gradient(125deg, #04421c 0%, #0a7a1c 55%, #29a52a 100%);
  box-shadow: var(--glow-lg);
}
.staff-welcome::after {
  content: "";
  position: absolute;
  right: -70px;
  bottom: -90px;
  width: 260px;
  height: 260px;
  border-radius: 50%;
  border: 36px solid rgba(255, 255, 255, 0.07);
  pointer-events: none;
}
.staff-welcome > * {
  position: relative;
  z-index: 1;
}
.staff-total {
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.22);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.staff-chip {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.3);
}

/* Credit cards: accent bar, gradient meter, tinted icon */
.staff-credit {
  position: relative;
  overflow: hidden;
}
.staff-credit::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 4px;
  background: linear-gradient(90deg, #008000, #8fd14f);
}
.staff-credit.conditional::before {
  background: linear-gradient(90deg, #b9a24a, #e6c96b);
}
.staff-symbol {
  background: linear-gradient(135deg, #e6f5e1, #f2fae4);
  box-shadow: inset 0 0 0 1px rgba(0, 128, 0, 0.12);
}
.staff-credit .progress-bar {
  background-image: linear-gradient(90deg, #008000, #7cc93f);
  border-radius: 1rem;
  transition: width 0.8s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.staff-credit-number {
  background: linear-gradient(135deg, #0a4d22, #1b8a2c);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.staff-credit-number small {
  -webkit-text-fill-color: #6b7d71;
}

/* Stat cards */
.stat-card .stat-value {
  background: linear-gradient(135deg, #006b1b, #4cb52f);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* Tables and history */
.live-admin .table-hover > tbody > tr:hover > * {
  background: #f1f8ee;
}
.leave-history-card {
  border-left: 4px solid #008000;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.leave-history-card:hover {
  transform: translateX(2px);
  box-shadow: var(--glow);
}
.leave-summary {
  background: linear-gradient(90deg, #eaf6e6, #f6fbf0);
  border: 1px solid #cfe6c8;
  border-left: 4px solid #008000;
  border-radius: 0.8rem;
}
.status-badge::before {
  content: "";
  display: inline-block;
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 50%;
  background: currentColor;
  margin-right: 0.4rem;
  vertical-align: 0.05em;
}

/* Login */
.login-brand {
  background:
    radial-gradient(520px 380px at 85% 8%, rgba(160, 225, 90, 0.28), transparent 70%),
    radial-gradient(480px 360px at 0 100%, rgba(0, 160, 70, 0.35), transparent 70%),
    linear-gradient(150deg, #052f1f, #074c34 55%, #0a6a3a);
}
.login-brand h1 span {
  background: linear-gradient(90deg, #b9ec86, #e5f7a8);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.login .google {
  background: #fff;
  box-shadow: 0 4px 14px rgba(0, 60, 20, 0.08);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.login .google:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(0, 60, 20, 0.14);
}

/* Dialog */
dialog {
  border-radius: 1.2rem;
  box-shadow: 0 30px 90px rgba(5, 38, 18, 0.35);
}
dialog[open] {
  animation: pop 0.22s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}

/* Motion (respects reduced-motion settings) */
@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@keyframes pop {
  from {
    opacity: 0;
    transform: scale(0.96) translateY(6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@media (prefers-reduced-motion: no-preference) {
  .live-admin .staff-welcome,
  .live-admin .card,
  .live-admin .leave-history-card {
    animation: rise 0.45s ease both;
  }
  #staff-credits > .col:nth-child(2) .card,
  #admin-stats > div:nth-child(2) .card {
    animation-delay: 0.06s;
  }
  #staff-credits > .col:nth-child(3) .card,
  #admin-stats > div:nth-child(3) .card {
    animation-delay: 0.12s;
  }
  #staff-credits > .col:nth-child(n + 4) .card {
    animation-delay: 0.18s;
  }
}
@media (prefers-reduced-motion: reduce) {
  .live-admin .card,
  .btn,
  .progress-bar {
    transition: none !important;
  }
}

/* Fix: keep room for the dropdown arrow (the rounded-input rule had removed the right padding) */
.form-select {
  padding-right: 2.5rem;
  background-position: right 0.85rem center;
}
.form-select-sm {
  padding: 0.4rem 2.25rem 0.4rem 0.75rem;
  min-width: 6.5rem;
  background-position: right 0.7rem center;
}

/* Admin table: alternating rows, green header, role chips */
.live-admin #admin-table .table thead th {
  background: linear-gradient(180deg, #eef7ea, #e4f1df);
  color: #2c5a3a;
  border-bottom: 2px solid #bcdcb8;
}
.live-admin #admin-table .table thead th:first-child {
  border-top-left-radius: 0.7rem;
}
.live-admin #admin-table .table thead th:last-child {
  border-top-right-radius: 0.7rem;
}
.live-admin #admin-table .table > tbody > tr > td {
  border-bottom: 1px solid #e6eee4;
}
.live-admin #admin-table .table > tbody > tr:nth-child(odd) > td {
  background: #ffffff;
}
.live-admin #admin-table .table > tbody > tr:nth-child(even) > td {
  background: #f3f9f0;
}
.live-admin #admin-table .table > tbody > tr:hover > td {
  background: #e3f2dc;
}
.live-admin #admin-table .table > tbody > tr:last-child > td {
  border-bottom: 0;
}
.role-chip {
  display: inline-block;
  padding: 0.2rem 0.65rem;
  border-radius: 2rem;
  font-size: 0.78rem;
  font-weight: 600;
  background: #eef2ee;
  color: #3f564a;
}
.role-chip.role-admin {
  background: #e7e3fa;
  color: #4b3fa0;
}
.role-chip.role-gm {
  background: #fde8d6;
  color: #9a4b12;
}
.role-chip.role-hr {
  background: #d9eefb;
  color: #17608f;
}
.role-chip.role-head {
  background: #fff1c9;
  color: #8a6410;
}
.role-chip.role-staff {
  background: #e3f3df;
  color: #2a6a2c;
}
@media (max-width: 767.98px) {
  .live-admin #admin-table .table > tbody > tr > td,
  .live-admin #admin-table .table > tbody > tr:nth-child(even) > td,
  .live-admin #admin-table .table > tbody > tr:hover > td {
    background: transparent;
    border-bottom: 0;
  }
  .live-admin #admin-table .table > tbody > tr:nth-child(even) {
    background: #f3f9f0;
  }
}

/* ===== Toasts, confirm dialog, inline result colors ===== */
#ui-toasts {
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  z-index: 3000;
  display: grid;
  gap: 0.6rem;
  width: min(380px, calc(100vw - 2rem));
  pointer-events: none;
}
.ui-toast {
  pointer-events: auto;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  border-radius: 0.9rem;
  background: #fff;
  color: #18352a;
  border: 1px solid #cfe6c8;
  border-left: 5px solid #008000;
  box-shadow: 0 14px 34px rgba(0, 50, 20, 0.22);
  font-size: 0.95rem;
  line-height: 1.45;
  cursor: pointer;
  animation: toast-in 0.28s cubic-bezier(0.2, 0.9, 0.3, 1.2);
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.ui-toast.is-leaving {
  opacity: 0;
  transform: translateX(16px);
}
.ui-toast-error {
  border-color: #f0c9c9;
  border-left-color: #b23b3b;
}
.ui-toast-icon {
  flex: none;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 0.85rem;
  color: #fff;
  background: #008000;
}
.ui-toast-error .ui-toast-icon {
  background: #b23b3b;
}
@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@media (max-width: 640px) {
  #ui-toasts {
    right: 1rem;
    left: 1rem;
    bottom: 1rem;
    width: auto;
  }
}
/* Success text is announced to screen readers but shown as a toast; errors stay visible inline too. */
.live-admin [role="status"][data-kind="success"] {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  margin: 0;
}
.live-admin [role="status"][data-kind="error"] {
  color: #a32f2f;
  background: #fdeeee;
  border: 1px solid #f2caca;
  border-radius: 0.7rem;
  padding: 0.65rem 0.9rem;
  font-weight: 500;
}
dialog.ui-confirm {
  width: min(440px, calc(100% - 30px));
  padding: 1.6rem;
}
dialog.ui-confirm h2 {
  margin-bottom: 0.5rem;
}
dialog.ui-confirm .dialog-actions {
  margin-top: 1.4rem;
}

/* ===== Readability: larger small-text and solid, higher-contrast numbers ===== */
.live-admin {
  font-size: 15px;
}
.staff-credit-label {
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  color: #3f5f48;
}
.staff-credit-meta {
  font-size: 0.85rem;
  color: #3f5a49;
}
.staff-credit .text-body-secondary,
.staff-credit .muted {
  font-size: 0.85rem;
  line-height: 1.55;
  color: #51655a;
}
.staff-credit-number {
  background: none;
  -webkit-background-clip: border-box;
  background-clip: border-box;
  color: #0a4d22;
}
.staff-credit-number small {
  font-size: 0.85rem;
  -webkit-text-fill-color: #51655a;
  color: #51655a;
}
.stat-card .stat-value {
  background: none;
  -webkit-background-clip: border-box;
  background-clip: border-box;
  color: #0a6a1f;
}
.stat-card .text-body-secondary {
  font-size: 0.8rem !important;
}
.staff-chip,
.staff-total span,
.staff-total small {
  font-size: 0.85rem;
}
.staff-total span,
.staff-total small,
.staff-welcome p {
  color: #f1f8ec;
}
.live-admin .table thead th {
  font-size: 0.75rem;
  color: #2c5a3a;
}
.live-admin .form-text,
.live-admin .field .form-text {
  font-size: 0.82rem;
  color: #51655a;
}
.live-admin .text-body-secondary,
.live-admin .muted {
  color: #51655a !important;
}
.status-badge,
.role-chip {
  font-size: 0.8rem;
}
.live-admin .small,
.live-admin small {
  font-size: 0.85rem;
}

/* ===== Admin: editor as a popup, filters, paging, skeleton, inactive rows ===== */
.admin-editor:not([hidden]) {
  position: fixed;
  inset: 0;
  z-index: 1050;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 4vh 1rem;
  overflow-y: auto;
  background: rgba(8, 45, 37, 0.5);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  animation: fade-in 0.18s ease both;
}
.admin-editor > .card-body {
  margin: auto;
  width: min(760px, 100%);
  background: #fff;
  border-radius: 1.2rem;
  box-shadow: 0 30px 90px rgba(5, 38, 18, 0.4);
  animation: pop 0.22s cubic-bezier(0.2, 0.9, 0.3, 1.2) both;
}
body:has(.admin-editor:not([hidden])) {
  overflow: hidden;
}
@keyframes fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
@media (max-width: 640px) {
  .admin-editor:not([hidden]) {
    padding: 0;
    align-items: flex-end;
  }
  .admin-editor > .card-body {
    margin: 0;
    width: 100%;
    max-height: 94vh;
    overflow-y: auto;
    border-radius: 1.2rem 1.2rem 0 0;
  }
}

.admin-filters .field {
  font-size: 0.8rem;
  color: #3f5a49;
}
#admin-clear {
  color: #008000;
  font-weight: 600;
  text-decoration: none;
}
#admin-pager .page-link {
  color: #2c5a3a;
  border-color: #d3e0d5;
  min-width: 2.2rem;
  text-align: center;
}
#admin-pager .page-item.active .page-link {
  background: #008000;
  border-color: #008000;
  color: #fff;
}
#admin-pager .page-item.disabled .page-link {
  color: #a5b4a9;
}

/* Inactive accounts fade back but keep their buttons usable */
.live-admin #admin-table tr.row-inactive > td:not(.admin-actions-cell) {
  opacity: 0.55;
}
.live-admin #admin-table tr.row-inactive:hover > td {
  opacity: 1;
}

/* Loading skeleton */
.skeleton-list {
  display: grid;
  gap: 0.6rem;
  padding: 0.25rem 0;
}
.skeleton-row {
  display: grid;
  grid-template-columns: 2.2fr 1.2fr 1.6fr 0.8fr;
  gap: 1rem;
  align-items: center;
  padding: 0.9rem 1rem;
  border-radius: 0.8rem;
  background: #f6faf4;
}
.sk {
  display: block;
  height: 0.85rem;
  border-radius: 0.5rem;
  background: linear-gradient(90deg, #e3eee0 25%, #f4faf1 50%, #e3eee0 75%);
  background-size: 200% 100%;
  animation: shimmer 1.3s linear infinite;
}
.sk-wide {
  width: 85%;
}
.sk-mid {
  width: 70%;
}
.sk-pill {
  width: 3.5rem;
  height: 1.2rem;
  border-radius: 2rem;
}
@keyframes shimmer {
  from {
    background-position: 200% 0;
  }
  to {
    background-position: -200% 0;
  }
}
@media (max-width: 640px) {
  .skeleton-row {
    grid-template-columns: 1fr 1fr;
  }
}
@media (prefers-reduced-motion: reduce) {
  .sk {
    animation: none;
  }
}

/* ===== Mobile: keep form actions and the end of long popups reachable ===== */
/* The browser's bottom bar can cover the last ~3.5rem of the page, so a popup that
   reaches the screen edge cannot be scrolled fully into view. The popup now stops above
   that zone, and the Save/Cancel row stays pinned to the bottom of the scrolling card. */
@media (max-width: 640px) {
  :root {
    --sheet-gap: calc(3.5rem + env(safe-area-inset-bottom, 0px));
  }
  .admin-editor:not([hidden]) {
    box-sizing: border-box;
    height: 100vh;
    height: 100dvh;
    padding: 0 0.5rem var(--sheet-gap);
    align-items: flex-end;
  }
  .admin-editor > .card-body {
    margin: 0;
    width: 100%;
    max-height: calc(100vh - var(--sheet-gap) - 1.5rem);
    max-height: calc(100dvh - var(--sheet-gap) - 1.5rem);
    overflow-y: auto;
    overscroll-behavior: contain;
    border-radius: 1.2rem;
  }
  .admin-editor form .d-flex.gap-2.mt-3 {
    position: sticky;
    bottom: 0;
    z-index: 2;
    margin-inline: -1.5rem;
    margin-bottom: -1.5rem;
    padding: 0.75rem 1.5rem;
    background: #fff;
    border-top: 1px solid #e1e9e1;
  }
  .admin-editor form .d-flex.gap-2.mt-3 .btn {
    flex: 1;
  }
  dialog.leave-dialog {
    height: calc(100vh - var(--sheet-gap));
    height: calc(100dvh - var(--sheet-gap));
    border-radius: 0 0 1.2rem 1.2rem;
    padding-bottom: 1.1rem;
  }
  dialog.leave-dialog .dialog-actions {
    position: sticky;
    bottom: -1.1rem;
    margin-inline: -1.1rem;
    margin-bottom: -1.1rem;
    padding: 0.75rem 1.1rem;
    background: #fff;
    border-top: 1px solid #e1e9e1;
  }
}
