/* ============================================================================
   IDCraft Admin — Spark Admin adaptation layer
   Loaded AFTER assets/css/main.css. Bridges the panel's legacy ic-* / ap-*
   utility classes onto the Spark Admin visual language (dark-green sidebar,
   lime accent, warm canvas, rounded white cards).
   ========================================================================== */

:root {
  /* --- token bridge: legacy var names -> Spark palette --------------------- */
  --c-ink:            #0b130f;
  --c-ink-2:          #354039;
  --c-ink-3:          #6c7e75;
  --c-border:         #e9efef;
  --c-border-strong:  #d6dfdb;
  --c-surface-1:      #ffffff;
  --c-surface-2:      #f4f6f5;
  --c-surface-3:      #eef2f0;
  --c-accent:         #072f1f;
  --c-accent-2:       #b4f105;
  --c-accent-grad:      linear-gradient(135deg, #072f1f 0%, #0b3d29 100%);
  --c-accent-grad-soft: rgba(180, 241, 5, 0.16);
  --c-success:       #16a34a;
  --c-success-bg:    #dcfce7;
  --c-warning:       #f97316;
  --c-warning-bg:    #ffedd5;
  --c-danger:        #ef4444;
  --c-danger-bg:     #fee2e2;
  --c-info:          #0ea5e9;
  --c-info-bg:       #e0f2fe;

  --font-sans:    "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: "Plus Jakarta Sans", system-ui, sans-serif;

  --fs-2xs: 0.72rem;
  --fs-xs:  0.8rem;
  --fs-sm:  0.85rem;
  --fs-md:  0.925rem;
  --fs-lg:  1.15rem;
  --fw-medium:   500;
  --fw-semibold: 600;
  --fw-bold:     700;

  --space-3: 0.85rem;
  --space-4: 1.25rem;
  --space-5: 1.75rem;

  --radius-full: 999px;
  --shadow-accent: 0 12px 32px -12px rgba(5, 28, 18, 0.35);
  --card-pad: 1.5rem;
}

body {
  font-family: var(--font-sans);
  font-size: var(--fs-md);
  color: var(--c-ink);
}

/* ============================================================================
   Shell — Spark sidebar / navbar tweaks for the Django panel
   ========================================================================== */
.sidebar-wrapper { z-index: 1040; }

/* the panel has ~18 nav items across 5 groups — tighten so they fit one
   viewport before the scroll area kicks in */
.sidebar-wrapper { padding-top: 1.5rem; padding-bottom: 1.25rem; }
.sidebar-menu-section { margin-bottom: 1rem; }
.sidebar-menu-title { margin-bottom: 0.45rem; }
.sidebar-menu-item { margin-bottom: 0.15rem; }
.sidebar-menu-link { padding: 0.55rem 0.8rem; font-size: 0.9rem; }
.sidebar-menu-link i { font-size: 1rem; }

/* Sidebar nav scroll area sits on the dark forest panel: the global sage
   thumb barely shows there, so give it a light, clearly visible one and pull
   it flush to the sidebar edge instead of floating 1.5rem inside the padding. */
.sidebar-wrapper .flex-grow-1.overflow-y-auto {
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.34) transparent;
  margin-right: -0.6rem;   /* < the sidebar's 0.75rem min side padding */
  padding-right: 0.3rem;
}
.sidebar-wrapper .flex-grow-1.overflow-y-auto::-webkit-scrollbar-thumb {
  background-color: rgba(255, 255, 255, 0.34);
}
.sidebar-wrapper .flex-grow-1.overflow-y-auto::-webkit-scrollbar-thumb:hover {
  background-color: rgba(255, 255, 255, 0.55);
}

/* Sidebar profile sign-out button. It must NOT reuse .btn-desktop-toggle:
   that class paints a white navbar button (glaring inside the dark card) and
   admin-extra hides it under 1200px, which would strip the only sign-out
   control from the sidebar on tablets. */
.sidebar-signout {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.15rem;
  height: 2.15rem;
  padding: 0;
  border: 1px solid var(--border-dark-green);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}
.sidebar-signout:hover,
.sidebar-signout:focus-visible {
  background: var(--c-danger, #ef4444);
  border-color: transparent;
  color: #fff;
  outline: none;
}
body.sidebar-minimized .sidebar-profile .sidebar-signout,
body.sidebar-minimized .sidebar-profile form { display: none; }

.sidebar-menu-link .badge-soft {
  margin-left: auto;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.1rem 0.45rem;
  border-radius: 50rem;
  background: var(--brand-lime);
  color: var(--brand-forest-dark);
}

.navbar-custom {
  display: flex !important;
  gap: 1rem;
  grid-template-columns: none !important;
}
.navbar-search-wrapper { flex: 1 1 auto; max-width: 460px; margin: 0; }
.navbar-actions { margin-left: auto; }

/* keep the desktop collapse toggle visible (main.css hides it under 1200px) */
.btn-desktop-toggle { display: inline-flex; }
@media (max-width: 1199.98px) { .btn-desktop-toggle { display: none !important; } }

/* ============================================================================
   Page header  (.ic-page-head)
   ========================================================================== */
.ic-page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1.25rem;
  margin-bottom: 1.75rem;
}
.ic-page-head__main h1 {
  font-size: 1.7rem;
  font-weight: 800;
  letter-spacing: -0.025em;
  margin: 0.15rem 0 0.35rem;
}
.ic-eyebrow,
.ic-eyebrow--plain {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--brand-forest-medium);
  margin: 0;
}
.ic-eyebrow--plain { color: var(--text-muted-green); opacity: 0.85; }
.ic-eyebrow--pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.7rem;
  border-radius: var(--radius-full);
  background: var(--brand-lime-translucent, rgba(180, 241, 5, 0.16));
  color: var(--brand-forest-dark, #051c12);
  letter-spacing: 0.1em;
}
.ic-eyebrow--pill::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--c-accent);
}
.ic-lead {
  font-size: 0.9rem;
  color: var(--text-muted-green);
  margin: 0;
  max-width: 60ch;
}
.ic-page-head__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.ap-section-label,
.ic-section-label {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted-green);
  opacity: 0.75;
  margin: 1.75rem 0 0.85rem;
}

/* ============================================================================
   Cards  (.ic-card)
   ========================================================================== */
.ic-card {
  background: var(--card-background);
  border: none;
  border-radius: var(--radius-xxl);
  box-shadow: var(--shadow-md);
  padding: 1.5rem;
  position: relative;
  overflow: hidden;
}
.ic-card + .ic-card { margin-top: 1.25rem; }
.ic-card__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.1rem;
}
.ic-card__title {
  font-size: 1.05rem;
  font-weight: 700;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.ic-card__title i { color: var(--brand-forest-medium); font-size: 1rem; }
.ic-card__sub {
  font-size: 0.8rem;
  color: var(--text-muted-green);
  margin: 0.25rem 0 0;
}
.ic-card__body { font-size: 0.9rem; }
.ic-card__body > :last-child { margin-bottom: 0; }

/* ============================================================================
   Buttons  (.ic-btn)
   ========================================================================== */
.ic-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 700;
  line-height: 1.4;
  padding: 0.6rem 1.15rem;
  border-radius: var(--radius-lg);
  border: 1px solid transparent;
  background: var(--brand-forest-medium);
  color: #fff;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
.ic-btn:hover { background: var(--brand-forest-dark); color: #fff; transform: translateY(-1px); }
.ic-btn:active { transform: scale(0.98); }
.ic-btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--brand-lime-translucent); }
.ic-btn i { font-size: 0.95rem; }

.ic-btn--accent { background: var(--brand-forest-medium); color: #fff; }
.ic-btn--accent:hover { background: var(--brand-forest-dark); box-shadow: 0 6px 18px var(--brand-lime-translucent); }

.ic-btn--ghost {
  background: #fff;
  border-color: rgba(11, 19, 15, 0.1);
  color: var(--brand-forest-dark);
}
.ic-btn--ghost:hover { background: #f2f5f4; border-color: var(--brand-forest-medium); color: var(--brand-forest-dark); }

.ic-btn--danger { background: var(--sys-red); color: #fff; }
.ic-btn--danger:hover { background: #dc2626; }

.ic-btn--sm { padding: 0.4rem 0.8rem; font-size: 0.775rem; border-radius: var(--radius-md); }
.ic-btn[disabled], .ic-btn:disabled { opacity: 0.55; pointer-events: none; }
.ic-btn.w-100 { width: 100%; }

/* Bootstrap fallback buttons occasionally used in templates */
.btn-primary { background: var(--brand-forest-medium); border-color: var(--brand-forest-medium); }
.btn-primary:hover { background: var(--brand-forest-dark); border-color: var(--brand-forest-dark); }

/* ============================================================================
   Forms  (.ic-field / .ic-input / .ic-select / .ic-label)
   ========================================================================== */
.ic-form-grid,
.ic-stat-grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 1rem; }
.ic-field { grid-column: span 12; display: flex; flex-direction: column; gap: 0.4rem; }
.ic-field--9 { grid-column: span 9; }
.ic-field--6 { grid-column: span 6; }
.ic-field--4 { grid-column: span 4; }
.ic-field--3 { grid-column: span 3; }
.ic-field--search { grid-column: span 4; }
@media (max-width: 768px) {
  .ic-field--9, .ic-field--6, .ic-field--4, .ic-field--3, .ic-field--search { grid-column: span 12; }
}

.ic-label {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-main);
}
.ic-help, .ic-hint {
  font-size: 0.72rem;
  color: var(--text-muted-green);
  line-height: 1.45;
}
.ic-error {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--sys-red);
}

.ic-input,
.ic-select,
input.form-control,
select.form-select,
textarea.form-control {
  display: block;
  width: 100%;
  padding: 0.6rem 0.9rem;
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-main);
  background: #fff;
  border: 1px solid rgba(11, 19, 15, 0.12);
  border-radius: var(--radius-lg);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.ic-select {
  appearance: none;
  padding-right: 2.1rem;
  min-width: 0;
  text-overflow: ellipsis;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23072F1F' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 0.8rem center;
  background-size: 11px 9px;
}
.ic-input { min-width: 0; }
/* multi-column form grids inside a narrow bootstrap column go 2-up, not 3+ */
.col-xl-4 .ic-form-grid .ic-field,
.col-lg-4 .ic-form-grid .ic-field,
.col-xl-3 .ic-form-grid .ic-field { grid-column: span 6; }
.col-xl-4 .ic-form-grid .ic-field--search,
.col-lg-4 .ic-form-grid .ic-field--search,
.col-xl-4 .ic-form-grid .ic-field--12,
.col-xl-3 .ic-form-grid .ic-field--search { grid-column: span 12; }
@media (max-width: 1400px) {
  .ic-card .ic-form-grid .ic-field--4,
  .ic-card .ic-form-grid .ic-field--3 { grid-column: span 6; }
}
.ic-input:focus,
.ic-select:focus,
textarea:focus,
input:focus {
  outline: 0;
  border-color: var(--brand-forest-medium);
  box-shadow: 0 0 0 3px rgba(7, 47, 31, 0.09);
}
.ic-input::placeholder { color: var(--text-muted-green); opacity: 0.55; }
.ic-input:disabled, .ic-input[readonly] {
  background: #f6f8f7; color: var(--text-muted-green); cursor: not-allowed;
}
.ic-input--color { padding: 0.3rem; height: 42px; cursor: pointer; }
textarea.ic-input { min-height: 96px; resize: vertical; }

.form-check-input {
  width: 1.05rem; height: 1.05rem; margin-top: 0.15rem;
  accent-color: var(--brand-forest-medium);
}
.ic-check {
  display: inline-flex; align-items: center; gap: 0.5rem;
  font-size: 0.85rem; font-weight: 600; color: var(--text-main);
  cursor: pointer; min-height: 38px;
}
.ic-check input { width: 16px; height: 16px; accent-color: var(--brand-forest-medium); }
.ic-field--check { justify-content: flex-end; gap: 0.25rem; }

.ic-form-section {
  border-top: 1px solid var(--border-light);
  margin-top: 1.5rem;
  padding-top: 1.25rem;
}
.ic-form-section:first-child { border-top: 0; margin-top: 0; padding-top: 0; }

/* ============================================================================
   Toolbar  (.ic-toolbar)
   ========================================================================== */
.ic-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.75rem;
  padding: 1.25rem;
  background: var(--card-background);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sm);
  margin-bottom: 1.25rem;
}
.ic-toolbar .ic-field { flex: 1 1 170px; min-width: 140px; grid-column: unset; }
.ic-toolbar__actions {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; margin-left: auto;
}

/* collapsible overflow filters (wired by admin-shell.js) */
.ic-toolbar__more {
  display: contents;
}
.ic-toolbar__more[hidden] { display: none; }
.ic-toolbar__more-toggle {
  display: inline-flex; align-items: center; gap: 0.4rem;
  padding: 0.4rem 0.85rem;
  align-self: flex-end;
  border: 1px dashed rgba(11, 19, 15, 0.22);
  border-radius: var(--radius-md);
  background: transparent;
  font-size: 0.78rem; font-weight: 700;
  color: var(--brand-forest-dark);
  cursor: pointer;
}
.ic-toolbar__more-toggle:hover { border-color: var(--brand-forest-medium); background: #f2f5f4; }
.ic-toolbar__more-toggle .bi { transition: transform 0.18s ease; }
.ic-toolbar__more-toggle.is-open .bi { transform: rotate(180deg); }

/* active-filter chips */
.ic-filter-chips {
  display: flex; flex-wrap: wrap; gap: 0.4rem;
  margin: 0 0 1rem;
}
.ic-filter-chips:empty { display: none; }
.ic-filter-chip {
  display: inline-flex; align-items: center; gap: 0.4rem;
  padding: 0.3rem 0.4rem 0.3rem 0.75rem;
  border-radius: var(--radius-full);
  background: var(--brand-lime-translucent, rgba(180, 241, 5, 0.16));
  color: var(--brand-forest-dark);
  font-size: 0.75rem; font-weight: 700;
  text-decoration: none;
}
.ic-filter-chip span { opacity: 0.7; font-weight: 600; }
.ic-filter-chip b { font-weight: 800; }
.ic-filter-chip i {
  display: grid; place-items: center;
  width: 16px; height: 16px; border-radius: 50%;
  background: rgba(5, 28, 18, 0.14);
  font-size: 0.7rem;
}
.ic-filter-chip:hover i { background: var(--sys-red); color: #fff; }
.ic-filter-chip--clear {
  background: transparent;
  border: 1px solid rgba(11, 19, 15, 0.16);
  padding-left: 0.75rem;
}

/* ============================================================================
   Stat tiles  (.ic-stat)
   ========================================================================== */
.ic-stat {
  grid-column: span 3;
  background: var(--card-background);
  border-radius: var(--radius-xxl);
  box-shadow: var(--shadow-md);
  padding: 1.4rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
@media (max-width: 992px) { .ic-stat { grid-column: span 6; } }
@media (max-width: 576px) { .ic-stat { grid-column: span 12; } }
.ic-stat__icon {
  width: 40px; height: 40px; border-radius: var(--radius-md);
  display: grid; place-items: center; font-size: 1.1rem;
  background: var(--brand-lime-translucent); color: var(--brand-forest-medium);
  margin-bottom: 0.35rem;
}
.ic-stat__label { font-size: 0.8rem; color: var(--text-muted-green); font-weight: 500; }
.ic-stat__value { font-size: 1.9rem; font-weight: 800; letter-spacing: -0.03em; line-height: 1.05; }
.ic-stat--success .ic-stat__icon { background: var(--sys-green-bg); color: var(--sys-green); }
.ic-stat--warning .ic-stat__icon { background: var(--sys-orange-bg); color: var(--sys-orange); }
.ic-stat--danger  .ic-stat__icon { background: var(--sys-red-bg);    color: var(--sys-red); }
.ic-stat--info    .ic-stat__icon { background: #e0f2fe;              color: #0369a1; }
.ic-stat--success .ic-stat__value { color: #157f3b; }
.ic-stat--warning .ic-stat__value { color: #b45309; }
.ic-stat--danger  .ic-stat__value { color: #b91c1c; }
.ic-stat--info    .ic-stat__value { color: #0369a1; }

/* ============================================================================
   Badges / status pills  (.ic-badge)
   ========================================================================== */
.ic-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.65rem;
  font-size: 0.72rem;
  font-weight: 700;
  border-radius: 50rem;
  background: rgba(11, 19, 15, 0.06);
  color: var(--text-main);
  line-height: 1.4;
  white-space: nowrap;
}
.ic-badge::before {
  content: "";
  width: 6px; height: 6px; border-radius: 50rem;
  background: currentColor;
  flex: none;
}
.ic-badge--success { background: var(--sys-green-bg); color: #157f3b; }
.ic-badge--warning { background: var(--sys-orange-bg); color: #b45309; }
.ic-badge--danger  { background: var(--sys-red-bg);   color: #b91c1c; }
.ic-badge--info    { background: #e0f2fe;             color: #0369a1; }
.ic-badge--accent  { background: var(--brand-lime-translucent); color: var(--brand-forest-dark); }

/* ============================================================================
   Tables  (.ic-table / .ic-table-wrap)
   ========================================================================== */
.ic-table-wrap {
  background: #fff;
  border: 1px solid rgba(11, 19, 15, 0.06);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sm);
  overflow-x: auto;
}
.ic-table { width: 100%; border-collapse: collapse; font-size: 0.82rem; }
.ic-table thead th {
  background: #f8faf9;
  color: var(--text-muted-green);
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  text-align: left;
  padding: 0.7rem 0.85rem;
  border-bottom: 1px solid rgba(11, 19, 15, 0.08);
  white-space: nowrap;
}
.ic-table tbody td {
  padding: 0.7rem 0.85rem;
  border-bottom: 1px solid rgba(11, 19, 15, 0.05);
  vertical-align: top;
  line-height: 1.4;
}
.ic-table tbody tr:last-child td { border-bottom: 0; }
.ic-table tbody tr:hover { background: rgba(180, 241, 5, 0.05); }
/* first data line in a stacked cell aligns with single-line cells */
.ic-table tbody td > :first-child { margin-top: 0; }
.ic-table tbody td .text-muted.small,
.ic-table tbody td small { font-size: 0.72rem; }

/* sticky header for tall tables */
.ic-table-wrap { max-height: none; }
.ic-table-wrap.is-scrollable { max-height: 72vh; overflow-y: auto; }
.ic-table-wrap.is-scrollable .ic-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  box-shadow: inset 0 -1px 0 rgba(11, 19, 15, 0.08);
}

.table-media { display: flex; align-items: center; gap: 0.7rem; }
.product-thumb, .avatar-fallback {
  width: 38px; height: 38px; border-radius: var(--radius-lg); flex: none;
  object-fit: cover;
}
.avatar-fallback {
  display: grid; place-items: center;
  background: var(--brand-forest-medium); color: #fff;
  font-weight: 700; font-size: 0.9rem;
}
.object-actions { display: inline-flex; gap: 0.35rem; flex-wrap: wrap; justify-content: flex-end; }
.text-tight { white-space: nowrap; }

/* card-style responsive table fallback */
.ic-table-cards { display: grid; gap: 0.75rem; }
.ic-row-card {
  background: #fff; border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm); padding: 1rem 1.15rem;
}
.ic-row-card__head { display: flex; justify-content: space-between; gap: 0.75rem; margin-bottom: 0.6rem; }
.ic-row-card__title { font-weight: 700; }
.ic-row-card__sub { font-size: 0.78rem; color: var(--text-muted-green); }
.ic-row-card__fields { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem 1rem; font-size: 0.8rem; }
.ic-row-card__field span { display: block; color: var(--text-muted-green); font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.04em; }
.ic-row-card__actions { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.85rem; }

/* ============================================================================
   Empty state  (.ic-empty)
   ========================================================================== */
.ic-empty {
  text-align: center;
  padding: 2.5rem 1.25rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}
.ic-empty__icon {
  font-size: 2.25rem;
  color: var(--brand-forest-medium);
  opacity: 0.35;
}
.ic-empty h3 { font-size: 1.05rem; font-weight: 700; margin: 0.25rem 0 0; }
.ic-empty p { color: var(--text-muted-green); font-size: 0.85rem; margin: 0; }
.ic-empty__actions { margin-top: 0.75rem; display: flex; gap: 0.5rem; flex-wrap: wrap; justify-content: center; }

/* ============================================================================
   Pagination
   ========================================================================== */
.ic-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  padding: 1.1rem 1.25rem;
  border-top: 1px solid var(--border-light);
  margin-top: auto;
}
.ic-pagination__status {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted-green);
}

.pagination { display: flex; gap: 0.3rem; padding-left: 0; list-style: none; margin: 1.25rem 0 0; }
.pagination .page-link,
.pagination a,
.pagination span {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 36px; height: 36px; padding: 0 0.6rem;
  border-radius: var(--radius-md);
  border: 1px solid rgba(11, 19, 15, 0.08);
  background: #fff;
  color: var(--brand-forest-dark);
  font-size: 0.8rem; font-weight: 600;
  text-decoration: none;
  transition: all 0.15s ease;
}
.pagination .page-link:hover,
.pagination a:hover { background: #f2f5f4; border-color: var(--brand-forest-medium); }
.pagination .active .page-link,
.pagination .active span,
.pagination [aria-current="page"] {
  background: var(--brand-forest-medium) !important;
  border-color: var(--brand-forest-medium) !important;
  color: #fff !important;
}
.pagination .disabled .page-link,
.pagination .disabled span { opacity: 0.45; pointer-events: none; }

/* ============================================================================
   Alerts (bootstrap) — soften to Spark
   ========================================================================== */
.alert {
  border: 1px solid transparent;
  border-radius: var(--radius-lg);
  padding: 0.85rem 1.1rem;
  font-size: 0.85rem;
  font-weight: 500;
}
.alert-success { background: #f0fdf4; border-color: #bbf7d0; color: #166534; }
.alert-danger  { background: #fef2f2; border-color: #fecaca; color: #991b1b; }
.alert-warning { background: #fffbeb; border-color: #fde68a; color: #92400e; }
.alert-info    { background: #f0f9ff; border-color: #bae6fd; color: #075985; }

/* ============================================================================
   Toast messenger  (rendered by admin-shell.js from [data-ic-message])
   ========================================================================== */
.admin-toast-stack {
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  z-index: 1090;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  max-width: min(360px, calc(100vw - 2rem));
}
.admin-toast {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  padding: 0.85rem 1rem;
  border-radius: var(--radius-lg);
  background: #fff;
  border: 1px solid rgba(11, 19, 15, 0.08);
  box-shadow: var(--shadow-lg);
  font-size: 0.85rem;
  color: var(--text-main);
  transform: translateX(120%);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease;
}
.admin-toast.is-shown { transform: translateX(0); }
.admin-toast.is-hiding { transform: translateX(120%); opacity: 0; }
.admin-toast__icon { font-size: 1.05rem; line-height: 1.3; flex: none; }
.admin-toast--success .admin-toast__icon { color: var(--sys-green); }
.admin-toast--error   .admin-toast__icon { color: var(--sys-red); }
.admin-toast--warning .admin-toast__icon { color: var(--sys-orange); }
.admin-toast--info    .admin-toast__icon { color: #0ea5e9; }
.admin-toast__close {
  margin-left: auto; background: none; border: 0; cursor: pointer;
  color: var(--text-muted-green); font-size: 0.9rem; padding: 0 0 0 0.5rem;
}

/* ============================================================================
   Confirm modal
   ========================================================================== */
.admin-modal {
  position: fixed; inset: 0; z-index: 1095;
  display: flex; align-items: center; justify-content: center;
  padding: 1.5rem;
  background: rgba(5, 28, 18, 0.5);
  -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
  opacity: 0; visibility: hidden; transition: opacity 0.2s ease, visibility 0.2s ease;
}
.admin-modal.is-open { opacity: 1; visibility: visible; }
.admin-modal__card {
  background: #fff;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  padding: 1.6rem;
  width: 100%;
  max-width: 400px;
  transform: translateY(12px);
  transition: transform 0.2s ease;
}
.admin-modal.is-open .admin-modal__card { transform: translateY(0); }
.admin-modal__title { font-size: 1.1rem; font-weight: 700; margin: 0 0 0.5rem; }
.admin-modal__msg { font-size: 0.88rem; color: var(--text-muted-green); margin: 0 0 1.25rem; }
.admin-modal__actions { display: flex; justify-content: flex-end; gap: 0.5rem; }

/* ============================================================================
   Dashboard widgets  (.ap-* + donut / hbar / activity)
   ========================================================================== */
.ap-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
  margin-bottom: 1.25rem;
}
@media (max-width: 992px) { .ap-kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .ap-kpi-grid { grid-template-columns: 1fr; } }

.ap-kpi { padding: 1.4rem; }
.ap-kpi__label { font-size: 0.8rem; color: var(--text-muted-green); font-weight: 500; }
.ap-kpi__main { display: flex; align-items: flex-end; justify-content: space-between; gap: 0.75rem; margin-top: 0.6rem; }
.ap-kpi__figure { display: flex; flex-direction: column; gap: 0.3rem; }
.ap-kpi__value { font-size: 1.95rem; font-weight: 800; letter-spacing: -0.03em; line-height: 1; }
.ap-kpi__delta {
  display: inline-flex; align-items: center; gap: 0.2rem;
  font-size: 0.75rem; font-weight: 700;
}
.ap-kpi__delta.is-pos { color: var(--sys-green); }
.ap-kpi__delta.is-neg { color: var(--sys-red); }
.ap-kpi__delta.is-flat { color: var(--text-muted-green); }
.ap-kpi__spark { width: 96px; height: 34px; overflow: visible; }
.ap-kpi__spark polyline {
  fill: none;
  stroke: var(--brand-forest-medium);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}

.ap-chart__total { font-size: 0.8rem; font-weight: 700; color: var(--text-muted-green); }
.ap-bars {
  display: flex;
  align-items: flex-end;
  gap: 0.5rem;
  height: 190px;
  padding-top: 0.5rem;
}
.ap-bar {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  height: 100%;
  justify-content: flex-end;
}
.ap-bar__fill {
  width: 100%;
  max-width: 34px;
  border-radius: 6px 6px 0 0;
  background: var(--brand-forest-medium);
  height: calc(var(--h, 0) * 1%);
  min-height: 4px;
  transition: height 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}
.ap-bar.is-peak .ap-bar__fill { background: var(--brand-lime); }
.ap-bar__cap { font-size: 0.68rem; color: var(--text-muted-green); font-weight: 600; }
.ap-chart__foot {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 0.5rem; margin-top: 1rem;
  padding-top: 0.85rem; border-top: 1px solid var(--border-light);
}
.ap-legend { display: flex; gap: 1rem; flex-wrap: wrap; font-size: 0.72rem; font-weight: 600; color: var(--text-muted-green); }
.ap-legend i { display: inline-block; width: 8px; height: 8px; border-radius: 50rem; margin-right: 0.3rem; vertical-align: middle; }
.ap-legend i.is-year { background: var(--brand-forest-medium); }
.ap-legend i.is-peak { background: var(--brand-lime); }
.ap-chart__yoy { font-size: 0.72rem; font-weight: 700; }
.ap-chart__yoy.is-pos { color: var(--sys-green); }
.ap-chart__yoy.is-neg { color: var(--sys-red); }
.ap-chart__yoy.is-flat { color: var(--text-muted-green); }

.ap-feed { display: flex; flex-direction: column; gap: 0.85rem; }
.ap-feed__item { display: flex; align-items: center; gap: 0.65rem; font-size: 0.82rem; }
.ap-feed__dot { width: 8px; height: 8px; border-radius: 50rem; flex: none; }
.ap-feed__text { flex: 1; color: var(--text-main); }
.ap-feed__time { font-size: 0.7rem; color: var(--text-muted-green); white-space: nowrap; }

/* donut + legend */
.chart-donut-layout { display: flex; align-items: center; gap: 1.25rem; flex-wrap: wrap; }
.chart-donut-layout.compact { gap: 1rem; }
.donut-chart {
  width: 132px; height: 132px; flex: none;
  border-radius: 50%;
  background: var(--donut-gradient, conic-gradient(var(--brand-forest-medium) 0 100%));
  display: grid; place-items: center;
  position: relative;
}
.donut-chart::after {
  content: "";
  position: absolute; inset: 20px;
  border-radius: 50%;
  background: #fff;
}
.donut-chart > span {
  position: relative; z-index: 1;
  font-size: 1.35rem; font-weight: 800;
}
.donut-small { width: 104px; height: 104px; }
.donut-small::after { inset: 16px; }
.legend-list { display: flex; flex-direction: column; gap: 0.55rem; font-size: 0.8rem; flex: 1; min-width: 150px; }
.legend-list > div { display: flex; align-items: center; gap: 0.5rem; }
.legend-list strong { margin-left: auto; }
.legend-list small { color: var(--text-muted-green); }
.legend-dot { width: 9px; height: 9px; border-radius: 50rem; flex: none; }

.readiness-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.75rem; margin-top: 1rem; }
.readiness-grid > div {
  background: #f8faf9; border-radius: var(--radius-md);
  padding: 0.7rem 0.85rem; text-align: center;
}
.readiness-grid span { display: block; font-size: 0.7rem; color: var(--text-muted-green); text-transform: uppercase; letter-spacing: 0.04em; }
.readiness-grid strong { font-size: 1.1rem; font-weight: 800; }

/* horizontal bar list */
.hbar-list { display: flex; flex-direction: column; gap: 0.85rem; }
.hbar-row { display: grid; grid-template-columns: minmax(90px, 140px) 1fr auto; gap: 0.75rem; align-items: center; font-size: 0.82rem; }
.hbar-label { color: var(--text-main); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar-track { height: 10px; border-radius: 50rem; background: #eef2f0; overflow: hidden; }
.hbar-track > span { display: block; height: 100%; border-radius: 50rem; background: var(--brand-forest-medium); }

/* action / activity lists */
.action-stack { display: flex; flex-direction: column; gap: 0.5rem; }
.action-card {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.75rem 0.9rem;
  border-radius: var(--radius-lg);
  background: #f8faf9;
  text-decoration: none;
  color: var(--text-main);
  font-size: 0.82rem; font-weight: 600;
  transition: background 0.15s ease;
}
.action-card:hover { background: rgba(180, 241, 5, 0.12); color: var(--text-main); }
.action-card span { display: flex; align-items: center; gap: 0.5rem; }
.action-card strong { font-size: 1rem; font-weight: 800; }

.activity-list { display: flex; flex-direction: column; gap: 0.85rem; }
.activity-item { display: flex; gap: 0.65rem; }
.activity-dot { width: 8px; height: 8px; border-radius: 50rem; margin-top: 0.35rem; flex: none; }
.activity-item > div { flex: 1; }
.activity-item p { margin: 0; }

.ws-avatar {
  display: inline-grid; place-items: center;
  width: 34px; height: 34px; border-radius: var(--radius-lg);
  background: var(--brand-forest-medium); color: #fff;
  font-weight: 700; font-size: 0.85rem; position: relative;
}
.ws-avatar__status {
  position: absolute; right: -1px; bottom: -1px;
  width: 9px; height: 9px; border-radius: 50rem;
  background: var(--sys-green); border: 2px solid #fff;
}

/* generic helpers referenced by templates */
.text-muted { color: var(--text-muted-green) !important; }

/* ============================================================================
   Advanced UX layer — command palette, shortcuts, bulk bar, sortable tables,
   scroll-to-top. Driven entirely by admin-shell.js.
   ========================================================================== */

kbd {
  display: inline-block;
  min-width: 1.5em;
  padding: 0.12em 0.45em;
  font-family: var(--font-sans);
  font-size: 0.72em;
  font-weight: 700;
  line-height: 1.4;
  text-align: center;
  color: var(--text-main);
  background: #fff;
  border: 1px solid rgba(11, 19, 15, 0.16);
  border-bottom-width: 2px;
  border-radius: 6px;
  white-space: nowrap;
}

/* --- navbar Ctrl-K hint ---------------------------------------------------- */
.navbar-search-wrapper { position: relative; }
.navbar-search-kbd {
  position: absolute;
  right: 3.1rem;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  opacity: 0.6;
  background: var(--brand-forest-light, #eef2f0);
  border-color: transparent;
}
@media (max-width: 640px) { .navbar-search-kbd { display: none; } }

.btn-quick-action .dropdown-toggle::after,
.btn-quick-action.dropdown-toggle::after { margin-left: 0.35rem; }

/* breadcrumb divider — override the mirror-corrupted fallback in the
   vendored bootstrap.min.css regardless of which copy is served */
.breadcrumb { --bs-breadcrumb-divider: "/"; }

/* --- sortable table headers + clickable rows ----------------------------- */
.ic-table thead th.is-sortable,
.table-custom thead th.is-sortable {
  cursor: pointer;
  user-select: none;
  padding-right: 1.6rem;
  position: relative;
}
.ic-table thead th.is-sortable::after,
.table-custom thead th.is-sortable::after {
  content: "\F283";
  font-family: "bootstrap-icons";
  position: absolute;
  right: 0.7rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.7rem;
  opacity: 0.25;
  transition: opacity 0.15s ease;
}
.ic-table thead th.is-sortable:hover::after { opacity: 0.55; }
.ic-table thead th.is-sorted-asc::after  { content: "\F235"; opacity: 0.9; color: var(--brand-forest-medium); }
.ic-table thead th.is-sorted-desc::after { content: "\F229"; opacity: 0.9; color: var(--brand-forest-medium); }

.ic-table tbody tr.is-clickable { cursor: pointer; }
.ic-table tbody tr.is-clickable:hover { background: rgba(180, 241, 5, 0.09); }

/* --- sticky bulk-selection bar ----------------------------------------- */
.bulk-bar {
  position: fixed;
  left: 50%;
  bottom: 1.5rem;
  z-index: 1085;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 320px;
  max-width: calc(100vw - 2rem);
  padding: 0.7rem 0.9rem 0.7rem 1.15rem;
  background: var(--brand-forest-dark, #051c12);
  color: #fff;
  border-radius: var(--radius-full);
  box-shadow: 0 18px 44px -14px rgba(5, 28, 18, 0.55);
  transform: translate(-50%, 160%);
  transition: transform 0.32s cubic-bezier(0.16, 1, 0.3, 1);
}
.bulk-bar.is-shown { transform: translate(-50%, 0); }
.bulk-bar__count { font-weight: 700; font-size: 0.85rem; }
.bulk-bar__spacer { flex: 1; }
.bulk-bar .ic-btn--ghost {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.2);
  color: #fff;
}
.bulk-bar .ic-btn--ghost:hover { background: rgba(255, 255, 255, 0.22); color: #fff; }

/* --- scroll to top --------------------------------------------------------- */
.scrolltop-btn {
  position: fixed;
  right: 1.4rem;
  bottom: 1.4rem;
  z-index: 1080;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: var(--brand-forest-medium);
  color: #fff;
  font-size: 1.05rem;
  box-shadow: var(--shadow-lg);
  cursor: pointer;
  opacity: 0;
  transform: translateY(16px) scale(0.9);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.scrolltop-btn.is-shown { opacity: 1; transform: none; pointer-events: auto; }
.scrolltop-btn:hover { background: var(--brand-forest-dark); }
@media (max-width: 640px) { .scrolltop-btn { bottom: 5.2rem; } }

/* --- command palette ---------------------------------------------------- */
.cmdk {
  position: fixed;
  inset: 0;
  z-index: 1100;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 12vh 1rem 1rem;
  background: rgba(5, 28, 18, 0.45);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.16s ease, visibility 0.16s ease;
}
.cmdk.is-open { opacity: 1; visibility: visible; }
.cmdk__panel {
  width: 100%;
  max-width: 560px;
  background: #fff;
  border-radius: var(--radius-xl);
  box-shadow: 0 32px 80px -20px rgba(5, 28, 18, 0.5);
  overflow: hidden;
  transform: translateY(-10px) scale(0.985);
  transition: transform 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}
.cmdk.is-open .cmdk__panel { transform: none; }
.cmdk__search {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.95rem 1.1rem;
  border-bottom: 1px solid var(--border-light);
}
.cmdk__search > i { color: var(--text-muted-green); font-size: 1rem; }
.cmdk__input {
  flex: 1;
  border: 0;
  outline: 0;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-main);
  background: transparent;
}
.cmdk__list { list-style: none; margin: 0; padding: 0.4rem; max-height: 46vh; overflow-y: auto; }
.cmdk__item {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.6rem 0.75rem;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  cursor: pointer;
}
.cmdk__item > i { color: var(--brand-forest-medium); font-size: 0.95rem; width: 1.1rem; text-align: center; }
.cmdk__item.is-active { background: var(--brand-lime-translucent, rgba(180, 241, 5, 0.16)); }
.cmdk__label { flex: 1; font-weight: 600; }
.cmdk__hint { font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted-green); }
.cmdk__empty { padding: 1.4rem; text-align: center; color: var(--text-muted-green); font-size: 0.85rem; }
.cmdk__foot {
  display: flex;
  gap: 1rem;
  padding: 0.6rem 1.1rem;
  border-top: 1px solid var(--border-light);
  font-size: 0.72rem;
  color: var(--text-muted-green);
}
.cmdk__foot kbd { font-size: 0.62rem; }

/* --- shortcuts help sheet -------------------------------------------------- */
.shortcuts-modal {
  position: fixed;
  inset: 0;
  z-index: 1100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: rgba(5, 28, 18, 0.5);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.18s ease, visibility 0.18s ease;
}
.shortcuts-modal.is-open { opacity: 1; visibility: visible; }
.shortcuts-card {
  width: 100%;
  max-width: 440px;
  background: #fff;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  padding: 1.4rem 1.5rem 1.5rem;
}
.shortcuts-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.9rem; }
.shortcuts-head h2 { font-size: 1.05rem; font-weight: 700; margin: 0; }
.shortcuts-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.5rem 0;
  font-size: 0.85rem;
  border-top: 1px solid var(--border-light);
}
.shortcuts-row:first-of-type { border-top: 0; }
.shortcuts-keys { display: inline-flex; align-items: center; gap: 0.3rem; }
.shortcuts-then { font-size: 0.7rem; color: var(--text-muted-green); }

@media (prefers-reduced-motion: reduce) {
  .cmdk, .cmdk__panel, .shortcuts-modal, .bulk-bar, .scrolltop-btn, .admin-toast, .admin-modal, .admin-modal__card {
    transition: none !important;
  }
}

/* ============================================================================
   Modal forms  (.ic-modal)  — data-modal-form dialogs, see admin-shell.js
   ========================================================================== */
dialog.ic-modal {
  padding: 0;
  border: 0;
  background: transparent;
  max-width: min(920px, 94vw);
  width: 100%;
  max-height: 92vh;
  overflow: visible;
}
dialog.ic-modal::backdrop {
  background: rgba(5, 28, 18, 0.55);
  backdrop-filter: blur(2px);
}
.ic-modal__frame {
  position: relative;
  background: var(--card-background, #fff);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  max-height: 92vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.ic-modal__body {
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 1.5rem 1.6rem 1.7rem;
  /* Long add / edit forms scroll inside the dialog without a visible bar. */
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.ic-modal__body::-webkit-scrollbar { display: none; width: 0; height: 0; }

/* Scrollbars are hidden everywhere in the admin panel, exactly as in the
   workspace (idcraft-shell.css): every page, form, modal and table still
   scrolls with the wheel, touch, keyboard and trackpad -- only the bar is
   not drawn. */
* { scrollbar-width: none; -ms-overflow-style: none; }
*::-webkit-scrollbar { display: none; width: 0; height: 0; }
/* the fetched fragment leads with an .ic-page-head — tighten it for a dialog */
.ic-modal__body .ic-page-head { margin-bottom: 1rem; }
.ic-modal__body .ic-page-head__actions { display: none; }        /* "Back" lives on the X */
.ic-modal__body > form > .ic-form-section:first-child,
.ic-modal__body .ic-card.ic-form-section { box-shadow: none; }
.ic-modal__x {
  position: absolute;
  top: 0.6rem;
  right: 0.7rem;
  z-index: 2;
  width: 2rem;
  height: 2rem;
  border: 0;
  border-radius: var(--radius-md);
  background: transparent;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--text-muted-green);
  cursor: pointer;
}
.ic-modal__x:hover { background: var(--border-light); color: var(--text-main); }
.ic-modal__loading {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 2.5rem 1rem;
  justify-content: center;
  color: var(--text-muted-green);
  font-weight: 600;
}
.ic-modal__spin {
  display: inline-block;
  width: 1rem;
  height: 1rem;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: ic-modal-spin 0.7s linear infinite;
  vertical-align: -2px;
}
@keyframes ic-modal-spin { to { transform: rotate(360deg); } }
@media (max-width: 640px) {
  .ic-modal__body { padding: 1.15rem 1rem 1.3rem; }
}
@media (prefers-reduced-motion: reduce) {
  .ic-modal__spin { animation-duration: 2s; }
}

/* ── Bulk photo upload ─────────────────────────────────────────────────── */
.bp-drop {
  border: 2px dashed var(--c-border, #d5d8dd);
  border-radius: 12px;
  padding: 1.6rem 1rem;
  text-align: center;
  transition: border-color .15s, background .15s;
  cursor: pointer;
}
.bp-drop.is-drag { border-color: var(--brand-forest-medium, #1a9454); background: rgba(26,148,84,.06); }
.bp-drop__icon { font-size: 1.9rem; color: var(--brand-forest-medium, #1a9454); }
.bp-drop__title { font-weight: 600; margin: .35rem 0 .1rem; }
.bp-drop__hint { color: var(--text-muted-green, #6b7280); font-size: .82rem; margin: 0 0 .7rem; }
.bp-drop__btns { display: flex; gap: .5rem; flex-wrap: wrap; justify-content: center; }

.bp-progress { margin-top: 1rem; }
.bp-progress__text { margin: .5rem 0 0; font-size: .85rem; }
.bp-bar {
  height: 12px; border-radius: 999px; overflow: hidden;
  background: var(--c-surface-2, #eef0f2);
}
.bp-bar__fill {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--brand-forest-medium, #1a9454), #37c07f);
  transition: width .25s ease;
}

/* per-file report thumbnails */
.bp-report-table td { vertical-align: middle; }
.bp-thumb-cell { width: 64px; }
.bp-thumb {
  display: flex; align-items: center; justify-content: center;
  width: 46px; height: 46px; border-radius: 8px; overflow: hidden;
  background: var(--c-surface-2, #eef0f2); border: 1px solid var(--c-border, #e2e5e9);
}
.bp-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.bp-thumb--empty { color: var(--text-muted-green, #9aa4b0); font-size: 1rem; }

/* manual "assign to…" picker on unmatched report rows */
.bp-detail-cell { min-width: 220px; }
.bp-assign { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.bp-assign select { max-width: 320px; }
.ic-select--sm { padding: 4px 8px; font-size: .82rem; min-height: 30px; }
.bp-assign__status { font-size: .78rem; color: var(--text-muted-green, #6b7280); }

/* ═══════════ People pages: List ⇄ Cards view (students / staff) ═══════════ */
.ap-viewbar { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-top: 1px solid var(--c-border, #e2e5e9); }
.ap-viewbar__label { font-size: .74rem; font-weight: 700; color: var(--text-muted-green, #6b7280); text-transform: uppercase; letter-spacing: .06em; }
.ap-seg { display: inline-flex; background: var(--c-surface-2, #eef2f0); border-radius: 9px; padding: 3px; gap: 2px; }
.ap-seg button {
  border: 0; background: transparent; font: inherit; font-size: .8rem; font-weight: 700;
  color: var(--text-muted-green, #6b7280); padding: 5px 13px; border-radius: 7px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px;
}
.ap-seg button.is-active { background: #fff; color: var(--text-main, #0b130f); box-shadow: 0 1px 3px rgba(0,0,0,.09); }

.ap-views[data-view="list"] .ap-cards-wrap { display: none; }
.ap-views[data-view="cards"] .ap-list-wrap { display: none; }
@media (max-width: 767px) {
  .ap-views .ap-list-wrap { display: none !important; }
  .ap-views .ap-cards-wrap { display: block !important; }
  .ap-viewbar { display: none; }
}

.ap-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; padding: 14px; }
.ap-card {
  border: 1px solid var(--c-border, #e2e5e9); border-radius: 14px; background: #fff;
  padding: 13px; display: flex; flex-direction: column; gap: 9px; position: relative;
  transition: border-color .14s ease, box-shadow .14s ease, transform .12s ease;
}
.ap-card:hover { border-color: var(--c-accent, #072f1f); box-shadow: 0 8px 22px -12px rgba(7,47,31,.28); transform: translateY(-2px); }
.ap-card__sel { position: absolute; top: 9px; right: 9px; z-index: 2; }
.ap-card__sel input { width: 17px; height: 17px; accent-color: var(--c-accent, #072f1f); cursor: pointer; }
.ap-card__top { display: flex; align-items: center; gap: 11px; }
.ap-card__av, .ap-card .avatar-fallback {
  width: 58px; height: 58px; border-radius: 13px; object-fit: cover; flex: none;
  background: var(--c-surface-2, #eef2f0); display: grid; place-items: center;
  font-weight: 800; font-size: 1.2rem; color: var(--text-muted-green, #6b7280);
}
.ap-card__nm { font-weight: 800; font-size: .9rem; line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ap-card__sub { font-size: .74rem; color: var(--text-muted-green, #6b7280); }
.ap-card__det { display: grid; gap: 3px; font-size: .74rem; color: var(--text-main, #0b130f);
  padding: 7px 0; border-top: 1px dashed var(--c-border, #e2e5e9); }
.ap-card__det span { display: flex; align-items: center; gap: 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ap-card__det i { color: var(--text-muted-green, #9aa4b0); flex: none; }
.ap-card__meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.ap-card__act { display: flex; gap: 5px; margin-top: 2px; flex-wrap: wrap; }
.ap-card__act .ic-btn { padding: 4px 9px; font-size: .74rem; }

/* class-wise group headers (students page, when one school is in focus) */
.ap-cards--grouped { align-items: start; }
.ap-group {
  grid-column: 1 / -1; display: flex; align-items: center; gap: 8px;
  font-size: .7rem; font-weight: 800; text-transform: uppercase; letter-spacing: .08em;
  color: var(--text-muted-green, #6b7280); padding: 10px 2px 4px; margin-top: 4px;
  border-bottom: 1px solid var(--c-border, #e2e5e9);
}
.ap-group i { color: var(--c-accent, #072f1f); }
.ap-group__n {
  font-family: ui-monospace, "SFMono-Regular", monospace; font-size: .68rem; font-weight: 800;
  color: var(--c-accent, #072f1f); background: var(--c-accent-soft, rgba(180,241,5,.16));
  border-radius: 999px; padding: 1px 8px; letter-spacing: 0;
}
tr.ap-grouprow td {
  background: var(--c-surface-2, #eef2f0); font-size: .7rem; font-weight: 800;
  text-transform: uppercase; letter-spacing: .08em; color: var(--text-muted-green, #6b7280);
  padding: 8px 12px; position: sticky; top: 0; z-index: 1;
}
tr.ap-grouprow td i { color: var(--c-accent, #072f1f); }

/* collapsible "log a card event" controls in the bulk bar */
.ap-logevent { display: inline-block; }
.ap-logevent > summary {
  list-style: none; cursor: pointer; font-size: .82rem; font-weight: 700;
  color: var(--text-main, #0b130f); padding: 5px 11px; border: 1px solid var(--c-border, #e2e5e9);
  border-radius: 8px; display: inline-flex; align-items: center; gap: 6px;
}
.ap-logevent > summary::-webkit-details-marker { display: none; }
.ap-logevent[open] > summary { background: var(--c-surface-2, #eef2f0); }
.ap-logevent__body {
  display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
  margin-top: 8px; padding: 10px; border: 1px solid var(--c-border, #e2e5e9); border-radius: 10px;
  background: var(--c-surface-2, #f6f8f7);
}

/* class quick-filter chips (students, when one school is in focus) */
.ap-classbar { display: flex; flex-wrap: wrap; gap: 6px; padding: 10px 12px; border-top: 1px solid var(--c-border, #e2e5e9); }
.ap-chip {
  display: inline-flex; align-items: center; gap: 5px; padding: 4px 11px; border-radius: 999px;
  border: 1px solid var(--c-border, #e2e5e9); background: #fff; text-decoration: none;
  font-size: .78rem; font-weight: 700; color: var(--text-main, #0b130f); white-space: nowrap;
}
.ap-chip:hover { border-color: var(--c-accent, #072f1f); }
.ap-chip b { font-weight: 800; color: var(--text-muted-green, #6b7280); font-size: .72rem; }
.ap-chip.is-active { background: var(--c-accent, #072f1f); border-color: transparent; color: #fff; }
.ap-chip.is-active b { color: rgba(255,255,255,.75); }

/* photo badge on avatars (students + staff, list + cards) — opens the photo manager */
.ap-av-wrap { position: relative; display: inline-flex; flex: none; line-height: 0; }
.ap-photo-edit {
  position: absolute; right: -6px; bottom: -6px; width: 24px; height: 24px; padding: 0; border-radius: 50%; cursor: pointer;
  border: 2px solid var(--card-background, #fff); background: var(--c-accent-2, #b4f105); color: #08130c;
  display: grid; place-items: center; text-decoration: none; opacity: .9; box-shadow: 0 2px 6px rgba(0, 0, 0, .18);
  transition: opacity .12s ease, transform .12s ease;
}
.ap-av-wrap--sm .ap-photo-edit { width: 20px; height: 20px; right: -5px; bottom: -5px; }
.ap-photo-edit i { font-size: .62rem; }
.ap-card:hover .ap-photo-edit, tr:hover .ap-photo-edit, .ap-av-wrap:hover .ap-photo-edit, .ap-photo-edit:focus-visible { opacity: 1; }
.ap-photo-edit:hover { transform: scale(1.12); }
/* the shared photo field inside the student / staff forms */
.ap-photo-field {
  max-width: 580px; padding: .85rem; border: 1px solid var(--c-border); border-radius: var(--radius-md, 12px);
  background: var(--c-surface-2);
}

/* ═══════════ Students page — modern layout pass ═══════════ */
.ap-panel { padding: 0; overflow: visible; }

/* compact KPI strip */
.ap-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin: 14px 0 0; }
.ap-kpi {
  background: #fff; border: 1px solid var(--c-border, #e2e5e9); border-radius: 12px;
  padding: 12px 14px; display: flex; flex-direction: column; gap: 2px; border-left: 3px solid var(--c-border, #e2e5e9);
}
.ap-kpi--ok   { border-left-color: #1a9454; }
.ap-kpi--warn { border-left-color: #d97706; }
.ap-kpi--bad  { border-left-color: #d93025; }
.ap-kpi__label { font-size: .68rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted-green, #6b7280); }
.ap-kpi__value { font-size: 1.5rem; font-weight: 800; line-height: 1.1; color: var(--text-main, #0b130f); }
.ap-kpi__sub { font-size: .72rem; color: var(--text-muted-green, #6b7280); }

/* filter toolbar */
.ap-filters { padding: 14px 16px; gap: 10px 12px; border-bottom: 1px solid var(--c-border, #e2e5e9); }
.ap-filters .ic-field { min-width: 140px; }
.ap-filters .ic-field--search { min-width: 240px; flex: 1 1 260px; }
.ap-filters .ic-label { font-size: .66rem; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted-green, #6b7280); margin-bottom: 3px; }

/* one merged control bar (view toggle + selection actions) */
.ap-actionbar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 10px 16px; border-bottom: 1px solid var(--c-border, #e2e5e9);
}
.ap-actionbar__hint { font-size: .76rem; color: var(--text-muted-green, #6b7280); }
.ap-actionbar__spacer { flex: 1 1 auto; }

/* dropdown menus (Set status / Log event) */
.ap-menu { position: relative; display: inline-block; }
.ap-menu > summary { list-style: none; cursor: pointer; }
.ap-menu > summary::-webkit-details-marker { display: none; }
.ap-menu > summary .bi-chevron-down { font-size: .62rem; margin-left: 2px; transition: transform .15s; }
.ap-menu[open] > summary .bi-chevron-down { transform: rotate(180deg); }
.ap-menu__pop {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 40;
  display: flex; flex-direction: column; gap: 4px; min-width: 190px;
  background: #fff; border: 1px solid var(--c-border, #e2e5e9); border-radius: 10px;
  padding: 8px; box-shadow: 0 12px 32px -10px rgba(7,47,31,.28);
}
.ap-menu__pop .ic-btn { justify-content: flex-start; }
.ap-menu__pop--wide { min-width: 230px; }
.ap-menu__pop--wide .ic-select { width: 100%; min-height: 32px; }

/* denser list table */
.ap-table td, .ap-table th { padding: 8px 12px; vertical-align: middle; }
.ap-table th { font-size: .66rem; text-transform: uppercase; letter-spacing: .05em; }
.ap-table .ap-th-check { width: 34px; }
.ap-table .ap-th-tools, .ap-table .ap-td-tools { text-align: right; white-space: nowrap; }
.ap-table .table-media { gap: 10px; }
.ap-table small { font-size: .72rem; }

/* ============================================================================
   Compact KPI strip  (.ic-kpis / .ic-kpi)
   ----------------------------------------------------------------------------
   The .ic-stat tile above is a 1.4rem-padded, 1.9rem-value card that fits at
   most four across — fine for a handful of headline numbers, far too tall
   once a page needs eight of them. This is the information-dense variant:
   auto-fit so a wide desktop gets 5-6 across, a tablet 2-3, a phone 1-2, with
   no fixed 12-column spans to fight. Same palette, ~40% the height.
   ========================================================================== */
.ic-kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(158px, 1fr));
  gap: 0.65rem;
  margin-bottom: 1rem;
}
.ic-kpi {
  position: relative;
  overflow: hidden;
  background: var(--card-background, #fff);
  border: 1px solid var(--c-border, #e6eae8);
  border-radius: var(--radius-lg, 14px);
  box-shadow: var(--shadow-sm, 0 2px 8px rgba(11, 19, 15, 0.02));
  padding: 0.6rem 0.75rem 0.65rem;
  min-width: 0;
}
/* 3px status rail, the same language the workspace cc-kpi uses */
.ic-kpi::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: var(--brand-lime, #b4f105);
}
.ic-kpi--ok::before      { background: var(--sys-green, #22c55e); }
.ic-kpi--warning::before { background: var(--sys-orange, #f97316); }
.ic-kpi--danger::before  { background: var(--sys-red, #ef4444); }
.ic-kpi--info::before    { background: #0ea5e9; }
.ic-kpi--muted::before   { background: var(--text-muted-green, #6c7e75); }
.ic-kpi__label {
  font-size: 0.62rem; font-weight: 800; letter-spacing: 0.07em;
  text-transform: uppercase; color: var(--text-muted-green, #6c7e75);
  display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ic-kpi__value {
  display: block; font-size: 1.35rem; font-weight: 800; letter-spacing: -0.03em;
  line-height: 1.15; margin-top: 1px; color: var(--text-main, #0b130f);
}
.ic-kpi__value small { font-size: 0.52em; font-weight: 600; color: var(--text-muted-green, #6c7e75); letter-spacing: 0; }
.ic-kpi__sub {
  display: block; font-size: 0.68rem; color: var(--text-muted-green, #6c7e75);
  line-height: 1.4; margin-top: 1px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ic-kpi__sub.is-ok      { color: #157f3b; font-weight: 600; }
.ic-kpi__sub.is-warning { color: #b45309; font-weight: 600; }
.ic-kpi__sub.is-danger  { color: #b91c1c; font-weight: 600; }

/* Inline usage meter — used in KPI cards and in table cells */
.ic-meter { height: 5px; border-radius: 999px; background: #eef1ef; overflow: hidden; margin-top: 6px; }
.ic-meter > i { display: block; height: 100%; border-radius: inherit; background: var(--brand-lime, #b4f105); }
.ic-meter--ok > i      { background: var(--sys-green, #22c55e); }
.ic-meter--warn > i    { background: var(--sys-orange, #f97316); }
.ic-meter--bad > i     { background: var(--sys-red, #ef4444); }
.ic-meter--none > i    { background: #cfd8d3; }

/* Table cell: "4.2 GB / 10 GB" + meter, kept to one narrow column */
.ic-usecell { min-width: 118px; }
.ic-usecell__top { display: flex; align-items: baseline; gap: 5px; font-size: 0.75rem; white-space: nowrap; }
.ic-usecell__top b { font-weight: 700; }
.ic-usecell__top span { color: var(--text-muted-green, #6c7e75); font-size: 0.7rem; }
.ic-usecell__pct { margin-left: auto; font-size: 0.68rem; font-weight: 700; color: var(--text-muted-green, #6c7e75); }
.ic-usecell__pct.is-warn { color: #b45309; }
.ic-usecell__pct.is-bad  { color: #b91c1c; }

/* Stacked composition bar (storage by category) + its legend */
.ic-stack { display: flex; height: 9px; border-radius: 999px; overflow: hidden; background: #eef1ef; }
.ic-stack > i { display: block; height: 100%; }
.ic-stack > i:nth-child(1) { background: #0b3d29; }
.ic-stack > i:nth-child(2) { background: #b4f105; }
.ic-stack > i:nth-child(3) { background: #0ea5e9; }
.ic-stack > i:nth-child(4) { background: #9fb0a8; }
.ic-stacklegend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 10px; font-size: 0.74rem; }
.ic-stacklegend > span { display: inline-flex; align-items: center; gap: 6px; color: var(--text-muted-green, #6c7e75); }
.ic-stacklegend b { color: var(--text-main, #0b130f); font-weight: 700; }
.ic-stacklegend i { width: 8px; height: 8px; border-radius: 3px; display: inline-block; flex: none; }
.ic-stacklegend > span:nth-child(1) i { background: #0b3d29; }
.ic-stacklegend > span:nth-child(2) i { background: #b4f105; }
.ic-stacklegend > span:nth-child(3) i { background: #0ea5e9; }
.ic-stacklegend > span:nth-child(4) i { background: #9fb0a8; }

/* Honest empty state for charts with no measured history yet */
.ic-nodata {
  display: grid; place-items: center; gap: 6px; min-height: 160px; padding: 1rem;
  text-align: center; color: var(--text-muted-green, #6c7e75); font-size: 0.78rem; line-height: 1.55;
}
.ic-nodata i.bi { font-size: 1.6rem; opacity: 0.4; }
.ic-nodata code { font-size: 0.72rem; background: #f1f4f2; padding: 1px 6px; border-radius: 4px; }

/* Chart canvases need an explicit box — canvas has no intrinsic height */
.ic-canvas { position: relative; height: clamp(190px, 26vw, 260px); }
