/* ============================================================
   CBM Framework CSS — Bootstrap 5 Replacement (Pure CSS)
   Green + White brand theme
   ============================================================ */

/* ── 1. CSS Custom Properties ──────────────────────────────── */
:root {
  --color-primary:       #2e7d32;
  --color-primary-dark:  #1b5e20;
  --color-primary-light: #e8f5e9;
  --color-white:         #fff;
  --color-text:          #333;
  --color-muted:         #6c757d;
  --color-border:        #dee2e6;
  --color-bg-light:      #f8f9fa;
  --container-max:       1200px;
  --container-xl:        1400px;
  --gutter:              15px;
  --half-gutter:         7.5px;
  --radius:              8px;
  --transition:          0.2s ease;
  --sp-1: 0.25rem;
  --sp-2: 0.5rem;
  --sp-3: 1rem;
  --sp-4: 1.5rem;
  --sp-5: 3rem;
}

/* ── 2. Layout: Container ──────────────────────────────────── */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin-right: auto;
  margin-left: auto;
  padding-right: var(--gutter);
  padding-left: var(--gutter);
}
.container-fluid {
  width: 100%;
  padding-right: var(--gutter);
  padding-left: var(--gutter);
}
.container-xl {
  width: 100%;
  max-width: var(--container-xl);
  margin-right: auto;
  margin-left: auto;
  padding-right: var(--gutter);
  padding-left: var(--gutter);
}

/* ── 3. Grid Row ───────────────────────────────────────────── */
/*
   Uses Bootstrap 5's approach: negative margins on .row cancel the
   padding on columns, so percentage widths work correctly even with gutters.
   DO NOT use flexbox `gap` here — it adds extra space on top of widths
   and breaks percentage-based columns (3×33.33% + gaps > 100%).
*/
.row {
  display: flex;
  flex-wrap: wrap;
  margin-right: calc(-1 * var(--half-gutter));
  margin-left: calc(-1 * var(--half-gutter));
}

/* g-* classes: update gutter size via negative row margin + child padding */
.row.g-0                    { margin: 0; }
.row.g-0 > [class*="col-"]  { padding: 0; }

.row.g-1                    { margin: -2px; }
.row.g-1 > [class*="col-"]  { padding: 2px; }

.row.g-2                    { margin: -4px; }
.row.g-2 > [class*="col-"]  { padding: 4px; }

.row.g-3                    { margin: -8px; }
.row.g-3 > [class*="col-"]  { padding: 8px; }

.row.g-4                    { margin: -12px; }
.row.g-4 > [class*="col-"]  { padding: 12px; }

.row.g-5                    { margin: -24px; }
.row.g-5 > [class*="col-"]  { padding: 24px; }

/* ── 4. Grid Columns ───────────────────────────────────────── */
/* Base: all cols are full width (mobile-first) */
[class*="col-"] {
  box-sizing: border-box;
  padding-right: var(--half-gutter);
  padding-left: var(--half-gutter);
  width: 100%;
  min-width: 0;
}
/* Explicit col (no size) fills remaining space */
.col {
  flex: 1 0 0%;
  padding-right: var(--half-gutter);
  padding-left: var(--half-gutter);
  min-width: 0;
}
.col-auto { flex: 0 0 auto; width: auto; padding-right: var(--half-gutter); padding-left: var(--half-gutter); }

/* Base column widths (always apply) */
.col-1  { flex: 0 0 8.3333%;   max-width: 8.3333%; }
.col-2  { flex: 0 0 16.6667%;  max-width: 16.6667%; }
.col-3  { flex: 0 0 25%;       max-width: 25%; }
.col-4  { flex: 0 0 33.3333%;  max-width: 33.3333%; }
.col-5  { flex: 0 0 41.6667%;  max-width: 41.6667%; }
.col-6  { flex: 0 0 50%;       max-width: 50%; }
.col-7  { flex: 0 0 58.3333%;  max-width: 58.3333%; }
.col-8  { flex: 0 0 66.6667%;  max-width: 66.6667%; }
.col-9  { flex: 0 0 75%;       max-width: 75%; }
.col-10 { flex: 0 0 83.3333%;  max-width: 83.3333%; }
.col-11 { flex: 0 0 91.6667%;  max-width: 91.6667%; }
.col-12 { flex: 0 0 100%;      max-width: 100%; }

/* sm ≥ 576px */
@media (min-width: 576px) {
  .col-sm-1  { flex: 0 0 8.3333%;   max-width: 8.3333%; }
  .col-sm-2  { flex: 0 0 16.6667%;  max-width: 16.6667%; }
  .col-sm-3  { flex: 0 0 25%;       max-width: 25%; }
  .col-sm-4  { flex: 0 0 33.3333%;  max-width: 33.3333%; }
  .col-sm-5  { flex: 0 0 41.6667%;  max-width: 41.6667%; }
  .col-sm-6  { flex: 0 0 50%;       max-width: 50%; }
  .col-sm-7  { flex: 0 0 58.3333%;  max-width: 58.3333%; }
  .col-sm-8  { flex: 0 0 66.6667%;  max-width: 66.6667%; }
  .col-sm-9  { flex: 0 0 75%;       max-width: 75%; }
  .col-sm-10 { flex: 0 0 83.3333%;  max-width: 83.3333%; }
  .col-sm-11 { flex: 0 0 91.6667%;  max-width: 91.6667%; }
  .col-sm-12 { flex: 0 0 100%;      max-width: 100%; }
  .col-sm-auto { flex: 0 0 auto; width: auto; }
  .d-sm-none         { display: none !important; }
  .d-sm-block        { display: block !important; }
  .d-sm-flex         { display: flex !important; }
  .d-sm-inline-flex  { display: inline-flex !important; }
}

/* md ≥ 768px */
@media (min-width: 768px) {
  .col-md-1  { flex: 0 0 8.3333%;   max-width: 8.3333%; }
  .col-md-2  { flex: 0 0 16.6667%;  max-width: 16.6667%; }
  .col-md-3  { flex: 0 0 25%;       max-width: 25%; }
  .col-md-4  { flex: 0 0 33.3333%;  max-width: 33.3333%; }
  .col-md-5  { flex: 0 0 41.6667%;  max-width: 41.6667%; }
  .col-md-6  { flex: 0 0 50%;       max-width: 50%; }
  .col-md-7  { flex: 0 0 58.3333%;  max-width: 58.3333%; }
  .col-md-8  { flex: 0 0 66.6667%;  max-width: 66.6667%; }
  .col-md-9  { flex: 0 0 75%;       max-width: 75%; }
  .col-md-10 { flex: 0 0 83.3333%;  max-width: 83.3333%; }
  .col-md-11 { flex: 0 0 91.6667%;  max-width: 91.6667%; }
  .col-md-12 { flex: 0 0 100%;      max-width: 100%; }
  .col-md-auto { flex: 0 0 auto; width: auto; }
  .d-md-none         { display: none !important; }
  .d-md-block        { display: block !important; }
  .d-md-flex         { display: flex !important; }
  .d-md-inline-flex  { display: inline-flex !important; }
}

/* lg ≥ 992px */
@media (min-width: 992px) {
  .col-lg-1  { flex: 0 0 8.3333%;   max-width: 8.3333%; }
  .col-lg-2  { flex: 0 0 16.6667%;  max-width: 16.6667%; }
  .col-lg-3  { flex: 0 0 25%;       max-width: 25%; }
  .col-lg-4  { flex: 0 0 33.3333%;  max-width: 33.3333%; }
  .col-lg-5  { flex: 0 0 41.6667%;  max-width: 41.6667%; }
  .col-lg-6  { flex: 0 0 50%;       max-width: 50%; }
  .col-lg-7  { flex: 0 0 58.3333%;  max-width: 58.3333%; }
  .col-lg-8  { flex: 0 0 66.6667%;  max-width: 66.6667%; }
  .col-lg-9  { flex: 0 0 75%;       max-width: 75%; }
  .col-lg-10 { flex: 0 0 83.3333%;  max-width: 83.3333%; }
  .col-lg-11 { flex: 0 0 91.6667%;  max-width: 91.6667%; }
  .col-lg-12 { flex: 0 0 100%;      max-width: 100%; }
  .col-lg-auto { flex: 0 0 auto; width: auto; }
  .d-lg-none         { display: none !important; }
  .d-lg-block        { display: block !important; }
  .d-lg-flex         { display: flex !important; }
  .d-lg-inline-flex  { display: inline-flex !important; }
  .d-lg-inline       { display: inline !important; }
}

/* xl ≥ 1200px */
@media (min-width: 1200px) {
  .col-xl-1  { flex: 0 0 8.3333%;   max-width: 8.3333%; }
  .col-xl-2  { flex: 0 0 16.6667%;  max-width: 16.6667%; }
  .col-xl-3  { flex: 0 0 25%;       max-width: 25%; }
  .col-xl-4  { flex: 0 0 33.3333%;  max-width: 33.3333%; }
  .col-xl-5  { flex: 0 0 41.6667%;  max-width: 41.6667%; }
  .col-xl-6  { flex: 0 0 50%;       max-width: 50%; }
  .col-xl-8  { flex: 0 0 66.6667%;  max-width: 66.6667%; }
  .col-xl-9  { flex: 0 0 75%;       max-width: 75%; }
  .col-xl-12 { flex: 0 0 100%;      max-width: 100%; }
  .col-xl-auto { flex: 0 0 auto; width: auto; }
  .d-xl-none  { display: none !important; }
  .d-xl-block { display: block !important; }
  .d-xl-flex  { display: flex !important; }
}

/* ── 5. Display Utilities ──────────────────────────────────── */
.d-none         { display: none !important; }
.d-block        { display: block !important; }
.d-inline       { display: inline !important; }
.d-inline-block { display: inline-block !important; }
.d-flex         { display: flex !important; }
.d-inline-flex  { display: inline-flex !important; }
.d-grid         { display: grid !important; }
.d-table        { display: table !important; }
.d-table-cell   { display: table-cell !important; }

/* ── 6. Flex Utilities ─────────────────────────────────────── */
.flex-row          { flex-direction: row !important; }
.flex-column       { flex-direction: column !important; }
.flex-row-reverse  { flex-direction: row-reverse !important; }
.flex-wrap         { flex-wrap: wrap !important; }
.flex-nowrap       { flex-wrap: nowrap !important; }
.flex-grow-0       { flex-grow: 0 !important; }
.flex-grow-1       { flex-grow: 1 !important; }
.flex-shrink-0     { flex-shrink: 0 !important; }
.flex-shrink-1     { flex-shrink: 1 !important; }
.flex-fill         { flex: 1 1 auto !important; }

.justify-content-start   { justify-content: flex-start !important; }
.justify-content-end     { justify-content: flex-end !important; }
.justify-content-center  { justify-content: center !important; }
.justify-content-between { justify-content: space-between !important; }
.justify-content-around  { justify-content: space-around !important; }
.justify-content-evenly  { justify-content: space-evenly !important; }

.align-items-start    { align-items: flex-start !important; }
.align-items-end      { align-items: flex-end !important; }
.align-items-center   { align-items: center !important; }
.align-items-baseline { align-items: baseline !important; }
.align-items-stretch  { align-items: stretch !important; }

.align-self-start   { align-self: flex-start !important; }
.align-self-end     { align-self: flex-end !important; }
.align-self-center  { align-self: center !important; }
.align-self-stretch { align-self: stretch !important; }

.align-content-start   { align-content: flex-start !important; }
.align-content-center  { align-content: center !important; }
.align-content-between { align-content: space-between !important; }
.align-content-around  { align-content: space-around !important; }

/* Gap */
.gap-0 { gap: 0 !important; }
.gap-1 { gap: 0.25rem !important; }
.gap-2 { gap: 0.5rem !important; }
.gap-3 { gap: 1rem !important; }
.gap-4 { gap: 1.5rem !important; }
.gap-5 { gap: 3rem !important; }

/* ── 7. Spacing Utilities ──────────────────────────────────── */
/* Margin */
.m-0  { margin: 0 !important; }
.m-1  { margin: 0.25rem !important; }
.m-2  { margin: 0.5rem !important; }
.m-3  { margin: 1rem !important; }
.m-4  { margin: 1.5rem !important; }
.m-5  { margin: 3rem !important; }
.m-auto { margin: auto !important; }

.mt-0 { margin-top: 0 !important; }
.mt-1 { margin-top: 0.25rem !important; }
.mt-2 { margin-top: 0.5rem !important; }
.mt-3 { margin-top: 1rem !important; }
.mt-4 { margin-top: 1.5rem !important; }
.mt-5 { margin-top: 3rem !important; }
.mt-auto { margin-top: auto !important; }

.mb-0 { margin-bottom: 0 !important; }
.mb-1 { margin-bottom: 0.25rem !important; }
.mb-2 { margin-bottom: 0.5rem !important; }
.mb-3 { margin-bottom: 1rem !important; }
.mb-4 { margin-bottom: 1.5rem !important; }
.mb-5 { margin-bottom: 3rem !important; }
.mb-auto { margin-bottom: auto !important; }

.ms-0 { margin-left: 0 !important; }
.ms-1 { margin-left: 0.25rem !important; }
.ms-2 { margin-left: 0.5rem !important; }
.ms-3 { margin-left: 1rem !important; }
.ms-4 { margin-left: 1.5rem !important; }
.ms-5 { margin-left: 3rem !important; }
.ms-auto { margin-left: auto !important; }

.me-0 { margin-right: 0 !important; }
.me-1 { margin-right: 0.25rem !important; }
.me-2 { margin-right: 0.5rem !important; }
.me-3 { margin-right: 1rem !important; }
.me-4 { margin-right: 1.5rem !important; }
.me-5 { margin-right: 3rem !important; }
.me-auto { margin-right: auto !important; }

.mx-0    { margin-right: 0 !important; margin-left: 0 !important; }
.mx-1    { margin-right: 0.25rem !important; margin-left: 0.25rem !important; }
.mx-2    { margin-right: 0.5rem !important; margin-left: 0.5rem !important; }
.mx-3    { margin-right: 1rem !important; margin-left: 1rem !important; }
.mx-4    { margin-right: 1.5rem !important; margin-left: 1.5rem !important; }
.mx-5    { margin-right: 3rem !important; margin-left: 3rem !important; }
.mx-auto { margin-right: auto !important; margin-left: auto !important; }

.my-0 { margin-top: 0 !important; margin-bottom: 0 !important; }
.my-1 { margin-top: 0.25rem !important; margin-bottom: 0.25rem !important; }
.my-2 { margin-top: 0.5rem !important; margin-bottom: 0.5rem !important; }
.my-3 { margin-top: 1rem !important; margin-bottom: 1rem !important; }
.my-4 { margin-top: 1.5rem !important; margin-bottom: 1.5rem !important; }
.my-5 { margin-top: 3rem !important; margin-bottom: 3rem !important; }

/* Padding */
.p-0  { padding: 0 !important; }
.p-1  { padding: 0.25rem !important; }
.p-2  { padding: 0.5rem !important; }
.p-3  { padding: 1rem !important; }
.p-4  { padding: 1.5rem !important; }
.p-5  { padding: 3rem !important; }

.pt-0 { padding-top: 0 !important; }
.pt-1 { padding-top: 0.25rem !important; }
.pt-2 { padding-top: 0.5rem !important; }
.pt-3 { padding-top: 1rem !important; }
.pt-4 { padding-top: 1.5rem !important; }
.pt-5 { padding-top: 3rem !important; }

.pb-0 { padding-bottom: 0 !important; }
.pb-1 { padding-bottom: 0.25rem !important; }
.pb-2 { padding-bottom: 0.5rem !important; }
.pb-3 { padding-bottom: 1rem !important; }
.pb-4 { padding-bottom: 1.5rem !important; }
.pb-5 { padding-bottom: 3rem !important; }

.ps-0 { padding-left: 0 !important; }
.ps-1 { padding-left: 0.25rem !important; }
.ps-2 { padding-left: 0.5rem !important; }
.ps-3 { padding-left: 1rem !important; }
.ps-4 { padding-left: 1.5rem !important; }
.ps-5 { padding-left: 3rem !important; }

.pe-0 { padding-right: 0 !important; }
.pe-1 { padding-right: 0.25rem !important; }
.pe-2 { padding-right: 0.5rem !important; }
.pe-3 { padding-right: 1rem !important; }
.pe-4 { padding-right: 1.5rem !important; }
.pe-5 { padding-right: 3rem !important; }

.px-0 { padding-right: 0 !important; padding-left: 0 !important; }
.px-1 { padding-right: 0.25rem !important; padding-left: 0.25rem !important; }
.px-2 { padding-right: 0.5rem !important; padding-left: 0.5rem !important; }
.px-3 { padding-right: 1rem !important; padding-left: 1rem !important; }
.px-4 { padding-right: 1.5rem !important; padding-left: 1.5rem !important; }
.px-5 { padding-right: 3rem !important; padding-left: 3rem !important; }

.py-0 { padding-top: 0 !important; padding-bottom: 0 !important; }
.py-1 { padding-top: 0.25rem !important; padding-bottom: 0.25rem !important; }
.py-2 { padding-top: 0.5rem !important; padding-bottom: 0.5rem !important; }
.py-3 { padding-top: 1rem !important; padding-bottom: 1rem !important; }
.py-4 { padding-top: 1.5rem !important; padding-bottom: 1.5rem !important; }
.py-5 { padding-top: 3rem !important; padding-bottom: 3rem !important; }

/* ── 8. Text Utilities ─────────────────────────────────────── */
.text-start   { text-align: left !important; }
.text-center  { text-align: center !important; }
.text-end     { text-align: right !important; }

.text-muted   { color: var(--color-muted) !important; }
.text-white   { color: #fff !important; }
.text-dark    { color: #212529 !important; }
.text-primary { color: var(--color-primary) !important; }
.text-success { color: #198754 !important; }
.text-danger  { color: #dc3545 !important; }
.text-warning { color: #ffc107 !important; }
.text-info    { color: #0dcaf0 !important; }
.text-body    { color: var(--color-text) !important; }

.text-decoration-none     { text-decoration: none !important; }
.text-decoration-underline { text-decoration: underline !important; }
.text-uppercase   { text-transform: uppercase !important; }
.text-lowercase   { text-transform: lowercase !important; }
.text-capitalize  { text-transform: capitalize !important; }
.text-truncate    { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.text-nowrap      { white-space: nowrap !important; }
.text-break       { word-wrap: break-word !important; word-break: break-word !important; }

.fw-light    { font-weight: 300 !important; }
.fw-normal   { font-weight: 400 !important; }
.fw-medium   { font-weight: 500 !important; }
.fw-semibold { font-weight: 600 !important; }
.fw-bold     { font-weight: 700 !important; }
.fw-bolder   { font-weight: 800 !important; }

.fst-italic { font-style: italic !important; }
.fst-normal { font-style: normal !important; }

.fs-1 { font-size: 2.5rem !important; }
.fs-2 { font-size: 2rem !important; }
.fs-3 { font-size: 1.75rem !important; }
.fs-4 { font-size: 1.5rem !important; }
.fs-5 { font-size: 1.25rem !important; }
.fs-6 { font-size: 1rem !important; }

.lh-1    { line-height: 1 !important; }
.lh-sm   { line-height: 1.25 !important; }
.lh-base { line-height: 1.5 !important; }
.lh-lg   { line-height: 2 !important; }

.small { font-size: 0.875rem !important; }

/* ── 9. Sizing ─────────────────────────────────────────────── */
.w-25   { width: 25% !important; }
.w-50   { width: 50% !important; }
.w-75   { width: 75% !important; }
.w-100  { width: 100% !important; }
.w-auto { width: auto !important; }
.mw-100 { max-width: 100% !important; }
.vw-100 { width: 100vw !important; }
.min-vw-100 { min-width: 100vw !important; }

.h-25   { height: 25% !important; }
.h-50   { height: 50% !important; }
.h-75   { height: 75% !important; }
.h-100  { height: 100% !important; }
.h-auto { height: auto !important; }
.mh-100 { max-height: 100% !important; }
.vh-100 { height: 100vh !important; }
.min-vh-100 { min-height: 100vh !important; }

/* ── 10. Position Utilities ────────────────────────────────── */
.position-static   { position: static !important; }
.position-relative { position: relative !important; }
.position-absolute { position: absolute !important; }
.position-fixed    { position: fixed !important; }
.position-sticky   { position: sticky !important; top: 0; }

.top-0    { top: 0 !important; }
.top-50   { top: 50% !important; }
.top-100  { top: 100% !important; }
.bottom-0 { bottom: 0 !important; }
.bottom-50 { bottom: 50% !important; }
.bottom-100 { bottom: 100% !important; }
.start-0  { left: 0 !important; }
.start-50 { left: 50% !important; }
.start-100 { left: 100% !important; }
.end-0    { right: 0 !important; }
.end-50   { right: 50% !important; }
.end-100  { right: 100% !important; }

.translate-middle   { transform: translate(-50%, -50%) !important; }
.translate-middle-x { transform: translateX(-50%) !important; }
.translate-middle-y { transform: translateY(-50%) !important; }

/* ── 11. Border Utilities ──────────────────────────────────── */
.border         { border: 1px solid var(--color-border) !important; }
.border-0       { border: 0 !important; }
.border-top     { border-top: 1px solid var(--color-border) !important; }
.border-bottom  { border-bottom: 1px solid var(--color-border) !important; }
.border-start   { border-left: 1px solid var(--color-border) !important; }
.border-end     { border-right: 1px solid var(--color-border) !important; }
.border-primary { border-color: var(--color-primary) !important; }
.border-white   { border-color: #fff !important; }

.rounded        { border-radius: var(--radius) !important; }
.rounded-sm     { border-radius: 4px !important; }
.rounded-lg     { border-radius: 12px !important; }
.rounded-circle { border-radius: 50% !important; }
.rounded-pill   { border-radius: 50rem !important; }
.rounded-0      { border-radius: 0 !important; }

/* ── 12. Shadow ────────────────────────────────────────────── */
.shadow-sm { box-shadow: 0 .125rem .25rem rgba(0,0,0,.075) !important; }
.shadow    { box-shadow: 0 .5rem 1rem rgba(0,0,0,.15) !important; }
.shadow-lg { box-shadow: 0 1rem 3rem rgba(0,0,0,.175) !important; }
.shadow-none { box-shadow: none !important; }

/* ── 13. Overflow ──────────────────────────────────────────── */
.overflow-auto   { overflow: auto !important; }
.overflow-hidden { overflow: hidden !important; }
.overflow-visible { overflow: visible !important; }
.overflow-scroll { overflow: scroll !important; }

/* ── 14. Visibility ────────────────────────────────────────── */
.visible   { visibility: visible !important; }
.invisible { visibility: hidden !important; }
.visually-hidden,
.visually-hidden-focusable:not(:focus):not(:focus-within) {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0,0,0,0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

/* ── 15. Images ────────────────────────────────────────────── */
.img-fluid {
  max-width: 100%;
  height: auto;
  display: block;
}
.img-thumbnail {
  max-width: 100%;
  height: auto;
  padding: 0.25rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
}

/* ── 16. Button Base ───────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 1.25rem;
  font-size: 1rem;
  font-weight: 500;
  line-height: 1.5;
  text-align: center;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  border: 1px solid transparent;
  border-radius: var(--radius);
  transition: color var(--transition), background-color var(--transition),
              border-color var(--transition), box-shadow var(--transition);
  -webkit-user-select: none;
  user-select: none;
  vertical-align: middle;
}
.btn:disabled,
.btn.disabled { opacity: 0.65; pointer-events: none; }
.btn-sm { padding: 0.25rem 0.75rem; font-size: 0.875rem; }
.btn-lg { padding: 0.75rem 1.75rem; font-size: 1.125rem; }

.btn-primary {
  background-color: var(--color-primary);
  border-color: var(--color-primary);
  color: #fff;
}
.btn-primary:hover {
  background-color: var(--color-primary-dark);
  border-color: var(--color-primary-dark);
  color: #fff;
}

.btn-outline-primary {
  background-color: transparent;
  border-color: var(--color-primary);
  color: var(--color-primary);
}
.btn-outline-primary:hover {
  background-color: var(--color-primary);
  color: #fff;
}

.btn-secondary {
  background-color: #6c757d;
  border-color: #6c757d;
  color: #fff;
}
.btn-outline-secondary {
  background-color: transparent;
  border-color: #6c757d;
  color: #6c757d;
}
.btn-outline-secondary:hover {
  background-color: #6c757d;
  color: #fff;
}

.btn-link {
  background: none;
  border: none;
  color: var(--color-primary);
  text-decoration: underline;
  padding: 0;
}
.btn-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  opacity: 0.5;
  padding: 0.25rem 0.5rem;
  line-height: 1;
}
.btn-close:hover { opacity: 1; }
.btn-close::before { content: "×"; }

/* ── 17. Form Controls ─────────────────────────────────────── */
.form-control {
  display: block;
  width: 100%;
  padding: 0.5rem 0.75rem;
  font-size: 1rem;
  font-weight: 400;
  line-height: 1.5;
  color: #212529;
  background-color: #fff;
  background-clip: padding-box;
  border: 1px solid #ced4da;
  border-radius: var(--radius);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
  box-sizing: border-box;
}
.form-control:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 0.2rem rgba(46, 125, 50, 0.25);
}
.form-control::placeholder { color: var(--color-muted); opacity: 1; }
.form-control:disabled,
.form-control[readonly] { background-color: #e9ecef; opacity: 1; }

.form-control-sm  { padding: 0.25rem 0.5rem; font-size: 0.875rem; }
.form-control-lg  { padding: 0.75rem 1rem; font-size: 1.125rem; }

.form-select {
  display: block;
  width: 100%;
  padding: 0.5rem 2.25rem 0.5rem 0.75rem;
  font-size: 1rem;
  line-height: 1.5;
  color: #212529;
  background-color: #fff;
  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='%23343a40' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  background-size: 16px 12px;
  border: 1px solid #ced4da;
  border-radius: var(--radius);
  outline: none;
  appearance: none;
  box-sizing: border-box;
}
.form-select:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 0.2rem rgba(46, 125, 50, 0.25);
}

.form-label {
  display: inline-block;
  margin-bottom: 0.5rem;
  font-weight: 500;
}

.form-text {
  margin-top: 0.25rem;
  font-size: 0.875rem;
  color: var(--color-muted);
}

.form-check {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}
.form-check-input {
  width: 1rem;
  height: 1rem;
  margin-top: 0.25rem;
  flex-shrink: 0;
}
.form-check-label { cursor: pointer; }

.input-group {
  display: flex;
  align-items: stretch;
  width: 100%;
}
.input-group .form-control { flex: 1; border-radius: 0; }
.input-group .form-control:first-child { border-radius: var(--radius) 0 0 var(--radius); }
.input-group .form-control:last-child  { border-radius: 0 var(--radius) var(--radius) 0; }
.input-group .btn { border-radius: 0; }
.input-group .btn:last-child { border-radius: 0 var(--radius) var(--radius) 0; }

.was-validated .form-control:invalid,
.form-control.is-invalid { border-color: #dc3545; }
.was-validated .form-control:valid,
.form-control.is-valid { border-color: #198754; }
.invalid-feedback { color: #dc3545; font-size: 0.875rem; margin-top: 0.25rem; }
.valid-feedback   { color: #198754; font-size: 0.875rem; margin-top: 0.25rem; }

/* ── 18. Navbar (custom site nav shell) ────────────────────── */
/* Bootstrap .navbar classes used for structure */
.navbar {
  position: relative;
  display: flex;
  align-items: center;
  padding: 0;
  flex-wrap: wrap;
}
.navbar .container-fluid {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  flex-wrap: nowrap;
}
.navbar-brand {
  display: flex;
  align-items: center;
  text-decoration: none;
  font-weight: 700;
  color: inherit;
}
.navbar-toggler {
  background: none;
  border: 1px solid rgba(0,0,0,.15);
  border-radius: var(--radius);
  padding: 0.4rem 0.75rem;
  cursor: pointer;
  line-height: 1;
}
.navbar-toggler-icon {
  display: inline-block;
  width: 1.5em;
  height: 1.5em;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%280,0,0,.75%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-size: 100%;
  vertical-align: middle;
}
.navbar-nav { display: flex; list-style: none; margin: 0; padding: 0; }
.nav-item { position: relative; }
.nav-link {
  display: flex;
  align-items: center;
  padding: 0.5rem 0.75rem;
  text-decoration: none;
  color: #333;
  transition: color var(--transition);
  white-space: nowrap;
}
.nav-link:hover { color: var(--color-primary); }
.nav-link.active { color: var(--color-primary); font-weight: 600; }

/* ── 19. Dropdown ──────────────────────────────────────────── */
.dropdown { position: relative; }
.dropdown-toggle::after {
  content: "";
  display: inline-block;
  margin-left: 0.3em;
  vertical-align: middle;
  border-top: 0.3em solid;
  border-right: 0.3em solid transparent;
  border-bottom: 0;
  border-left: 0.3em solid transparent;
}
.dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  z-index: 1000;
  min-width: 180px;
  padding: 0.5rem 0;
  background-color: #fff;
  border: 1px solid rgba(0,0,0,.1);
  border-radius: var(--radius);
  box-shadow: 0 4px 16px rgba(0,0,0,.12);
  list-style: none;
  margin: 0;
}
.dropdown-menu.show { display: block; }
.dropdown-item {
  display: block;
  width: 100%;
  padding: 0.5rem 1rem;
  clear: both;
  font-weight: 400;
  color: #333;
  text-align: inherit;
  text-decoration: none;
  white-space: nowrap;
  background-color: transparent;
  border: 0;
  cursor: pointer;
}
.dropdown-item:hover,
.dropdown-item:focus {
  color: var(--color-primary);
  background-color: var(--color-primary-light);
}
.dropdown-divider {
  height: 0;
  margin: 0.5rem 0;
  overflow: hidden;
  border-top: 1px solid var(--color-border);
}

/* ── 20. Offcanvas (Mobile Sidebar) ────────────────────────── */
.offcanvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 280px;
  height: 100vh;
  transform: translateX(-100%);
  transition: transform 0.3s ease;
  background-color: #fff;
  z-index: 1055;
  overflow-y: auto;
  box-shadow: 4px 0 16px rgba(0,0,0,.2);
}
.offcanvas.show { transform: translateX(0); }
.offcanvas-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--color-border);
}
.offcanvas-title { font-weight: 600; margin: 0; }
.offcanvas-body  { padding: 1rem 1.25rem; }

/* Backdrop for offcanvas */
#menuBackdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1050;
  cursor: pointer;
}
#menuBackdrop.show { display: block; }

/* ── 21. Collapse ──────────────────────────────────────────── */
.collapse     { display: none; }
.collapse.show { display: block; }
.collapsing {
  height: 0;
  overflow: hidden;
  transition: height 0.2s ease;
}

/* ── 22. Nav Tabs ──────────────────────────────────────────── */
.nav-tabs {
  display: flex;
  flex-wrap: wrap;
  border-bottom: 2px solid var(--color-border);
  list-style: none;
  margin: 0;
  padding: 0;
  gap: 0;
}
.nav-tabs .nav-item { margin-bottom: -2px; }
.nav-tabs .nav-link {
  display: block;
  padding: 0.6rem 1.25rem;
  margin-bottom: 0;
  color: var(--color-muted);
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  cursor: pointer;
  font-weight: 500;
  text-decoration: none;
  transition: color var(--transition), border-color var(--transition);
  white-space: nowrap;
}
.nav-tabs .nav-link:hover { color: var(--color-primary); }
.nav-tabs .nav-link.active {
  color: var(--color-primary);
  border-bottom-color: var(--color-primary);
  font-weight: 600;
}
.tab-content > .tab-pane          { display: none; }
.tab-content > .tab-pane.active   { display: block; }
.tab-content > .tab-pane.show     { display: block; }
.tab-content > .tab-pane.fade     { opacity: 0; transition: opacity 0.15s linear; }
.tab-content > .tab-pane.fade.show { opacity: 1; }

/* ── 23. Nav (generic) ─────────────────────────────────────── */
.nav {
  display: flex;
  flex-wrap: wrap;
  padding-left: 0;
  margin-bottom: 0;
  list-style: none;
}
.nav .nav-link {
  padding: 0.5rem 1rem;
  color: var(--color-primary);
  text-decoration: none;
}
.nav .nav-link:hover { color: var(--color-primary-dark); }

/* ── 24. Card ──────────────────────────────────────────────── */
.card {
  position: relative;
  display: flex;
  flex-direction: column;
  background-color: #fff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  overflow: hidden;
}
.card-body  { flex: 1 1 auto; padding: 1rem; }
.card-title { margin-bottom: 0.5rem; font-weight: 600; }
.card-text  { margin-bottom: 0.75rem; color: var(--color-muted); }
.card-img-top { width: 100%; height: auto; display: block; }
.card-header {
  padding: 0.75rem 1rem;
  background-color: var(--color-bg-light);
  border-bottom: 1px solid var(--color-border);
}
.card-footer {
  padding: 0.75rem 1rem;
  background-color: var(--color-bg-light);
  border-top: 1px solid var(--color-border);
}

/* ── 25. Badge ─────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.25em 0.5em;
  font-size: 0.75em;
  font-weight: 600;
  line-height: 1;
  color: #fff;
  text-align: center;
  white-space: nowrap;
  vertical-align: baseline;
  border-radius: var(--radius);
  background-color: var(--color-primary);
}
.badge.rounded-pill { border-radius: 50rem; }

/* ── 26. Alert ─────────────────────────────────────────────── */
.alert {
  position: relative;
  padding: 1rem;
  margin-bottom: 1rem;
  border: 1px solid transparent;
  border-radius: var(--radius);
}
.alert-success  { color: #0f5132; background-color: #d1e7dd; border-color: #badbcc; }
.alert-danger   { color: #842029; background-color: #f8d7da; border-color: #f5c2c7; }
.alert-warning  { color: #664d03; background-color: #fff3cd; border-color: #ffecb5; }
.alert-info     { color: #055160; background-color: #cff4fc; border-color: #b6effb; }
.alert-primary  { color: #1b5e20; background-color: #e8f5e9; border-color: #c8e6c9; }

/* ── 27. Breadcrumb ────────────────────────────────────────── */
.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  padding: 0;
  margin-bottom: 1rem;
  list-style: none;
  gap: 0.25rem;
  align-items: center;
}
.breadcrumb-item { display: inline-flex; align-items: center; }
.breadcrumb-item + .breadcrumb-item::before {
  content: "/";
  margin-right: 0.25rem;
  color: var(--color-muted);
}
.breadcrumb-item.active { color: var(--color-muted); }
.breadcrumb-item a { color: var(--color-primary); text-decoration: none; }
.breadcrumb-item a:hover { text-decoration: underline; }

/* ── 28. Pagination ────────────────────────────────────────── */
.pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  padding: 0;
  margin: 0;
  list-style: none;
  gap: 0.25rem;
}
.page-item { }
.page-link {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  padding: 0 0.5rem;
  color: var(--color-primary);
  text-decoration: none;
  background-color: #fff;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  transition: background-color var(--transition), color var(--transition);
}
.page-link:hover { background-color: var(--color-primary-light); color: var(--color-primary-dark); }
.page-item.active .page-link {
  background-color: var(--color-primary);
  border-color: var(--color-primary);
  color: #fff;
}
.page-item.disabled .page-link {
  color: var(--color-muted);
  pointer-events: none;
  background-color: #fff;
}

/* ── 29. Spinner ───────────────────────────────────────────── */
.spinner-border {
  display: inline-block;
  width: 2rem;
  height: 2rem;
  vertical-align: text-bottom;
  border: 0.25em solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spinner-border 0.75s linear infinite;
}
.spinner-border-sm { width: 1rem; height: 1rem; border-width: 0.2em; }
@keyframes spinner-border {
  to { transform: rotate(360deg); }
}
.spinner-grow {
  display: inline-block;
  width: 2rem;
  height: 2rem;
  vertical-align: text-bottom;
  background-color: currentColor;
  border-radius: 50%;
  opacity: 0;
  animation: spinner-grow 0.75s linear infinite;
}
@keyframes spinner-grow {
  0%  { transform: scale(0); }
  50% { opacity: 1; transform: none; }
}

/* ── 30. Table ─────────────────────────────────────────────── */
.table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1rem;
}
.table th,
.table td {
  padding: 0.75rem;
  border-bottom: 1px solid var(--color-border);
  text-align: left;
}
.table thead th { font-weight: 600; border-bottom: 2px solid var(--color-border); }
.table-striped tbody tr:nth-of-type(odd) { background-color: rgba(0,0,0,.03); }
.table-hover tbody tr:hover { background-color: rgba(0,0,0,.05); }
.table-responsive { overflow-x: auto; }

/* ── 31. List Utilities ────────────────────────────────────── */
.list-unstyled { list-style: none; padding-left: 0; margin-bottom: 0; }
.list-inline    { list-style: none; padding-left: 0; }
.list-inline-item { display: inline-block; }
.list-inline-item:not(:last-child) { margin-right: 0.5rem; }

/* ── 32. Background Utilities ──────────────────────────────── */
.bg-primary     { background-color: var(--color-primary) !important; color: #fff; }
.bg-secondary   { background-color: #6c757d !important; color: #fff; }
.bg-success     { background-color: #198754 !important; color: #fff; }
.bg-danger      { background-color: #dc3545 !important; color: #fff; }
.bg-warning     { background-color: #ffc107 !important; color: #212529; }
.bg-info        { background-color: #0dcaf0 !important; color: #212529; }
.bg-light       { background-color: #f8f9fa !important; color: #212529; }
.bg-dark        { background-color: #212529 !important; color: #fff; }
.bg-white       { background-color: #fff !important; }
.bg-transparent { background-color: transparent !important; }

/* ── 33. Float & Clear ─────────────────────────────────────── */
.float-start { float: left !important; }
.float-end   { float: right !important; }
.float-none  { float: none !important; }
.clearfix::after { display: block; clear: both; content: ""; }

/* ── 34. Cursor ────────────────────────────────────────────── */
.cursor-pointer { cursor: pointer !important; }

/* ── 35. Misc Utilities ────────────────────────────────────── */
.pe-none { pointer-events: none !important; }
.pe-auto { pointer-events: auto !important; }
.user-select-none { user-select: none !important; }
.user-select-all  { user-select: all !important; }

/* ratio / embed-responsive */
.ratio { position: relative; width: 100%; }
.ratio::before { display: block; padding-top: var(--ratio-padding); content: ""; }
.ratio > * { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }
.ratio-16x9 { --ratio-padding: 56.25%; }
.ratio-4x3  { --ratio-padding: 75%; }
.ratio-1x1  { --ratio-padding: 100%; }
.embed-responsive { position: relative; width: 100%; }
.embed-responsive-item,
.embed-responsive iframe {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  border: 0;
}
.embed-responsive-16by9::before { padding-top: 56.25%; display: block; content: ""; }

/* ── 36. Print ─────────────────────────────────────────────── */
@media print {
  .d-print-none   { display: none !important; }
  .d-print-block  { display: block !important; }
  .d-print-inline { display: inline !important; }
}

/* ── 37. (reserved) ───────────────────────────────────────── */

/* ── 38. Bootstrap 4 Legacy Utilities ─────────────────────── */
/* Bootstrap 4 used mr-/ml-/pr-/pl- instead of me-/ms-/pe-/ps- */
.mr-0 { margin-right: 0 !important; }
.mr-1 { margin-right: 0.25rem !important; }
.mr-2 { margin-right: 0.5rem !important; }
.mr-3 { margin-right: 1rem !important; }
.mr-4 { margin-right: 1.5rem !important; }
.mr-5 { margin-right: 3rem !important; }
.mr-auto { margin-right: auto !important; }
.ml-0 { margin-left: 0 !important; }
.ml-1 { margin-left: 0.25rem !important; }
.ml-2 { margin-left: 0.5rem !important; }
.ml-3 { margin-left: 1rem !important; }
.ml-4 { margin-left: 1.5rem !important; }
.ml-5 { margin-left: 3rem !important; }
.ml-auto { margin-left: auto !important; }
.pl-0 { padding-left: 0 !important; }
.pl-1 { padding-left: 0.25rem !important; }
.pl-2 { padding-left: 0.5rem !important; }
.pl-3 { padding-left: 1rem !important; }
.pl-4 { padding-left: 1.5rem !important; }
.pl-5 { padding-left: 3rem !important; }
.pr-0 { padding-right: 0 !important; }
.pr-1 { padding-right: 0.25rem !important; }
.pr-2 { padding-right: 0.5rem !important; }
.pr-3 { padding-right: 1rem !important; }
.pr-4 { padding-right: 1.5rem !important; }
.pr-5 { padding-right: 3rem !important; }

/* ── 39. Navbar Bootstrap Compat ──────────────────────────── */
.navbar-light .navbar-toggler { color: rgba(0,0,0,.5); border-color: rgba(0,0,0,.1); }
.navbar-expand-lg { flex-wrap: nowrap; }
@media (min-width: 992px) {
  .navbar-expand-lg { flex-wrap: nowrap; justify-content: flex-start; }
  .navbar-expand-lg .navbar-nav { flex-direction: row; }
  .navbar-expand-lg .navbar-toggler { display: none; }
  .navbar-expand-lg .navbar-collapse { display: flex !important; flex-basis: auto; }
}

/* ── 40. Responsive Display Overrides (MUST BE LAST) ──────── */
/*
   These MUST come after the base .d-none rule (section 5) so that
   responsive show utilities (.d-lg-flex etc.) correctly win the
   cascade at their respective breakpoints.
*/
@media (min-width: 576px) {
  .d-sm-none        { display: none !important; }
  .d-sm-block       { display: block !important; }
  .d-sm-inline      { display: inline !important; }
  .d-sm-inline-block { display: inline-block !important; }
  .d-sm-flex        { display: flex !important; }
  .d-sm-inline-flex { display: inline-flex !important; }
}
@media (min-width: 768px) {
  .d-md-none        { display: none !important; }
  .d-md-block       { display: block !important; }
  .d-md-inline      { display: inline !important; }
  .d-md-inline-block { display: inline-block !important; }
  .d-md-flex        { display: flex !important; }
  .d-md-inline-flex { display: inline-flex !important; }
}
@media (min-width: 992px) {
  .d-lg-none        { display: none !important; }
  .d-lg-block       { display: block !important; }
  .d-lg-inline      { display: inline !important; }
  .d-lg-inline-block { display: inline-block !important; }
  .d-lg-flex        { display: flex !important; }
  .d-lg-inline-flex { display: inline-flex !important; }
}
@media (min-width: 1200px) {
  .d-xl-none        { display: none !important; }
  .d-xl-block       { display: block !important; }
  .d-xl-inline      { display: inline !important; }
  .d-xl-flex        { display: flex !important; }
  .d-xl-inline-flex { display: inline-flex !important; }
}
