:root {
  --bss-green: #0b3d20;
  --bss-green-mid: #114d29;
  --bss-green-dark: #072b16;
  --bss-green-light: #e7f0ea;
  --bss-gold: #c8a24a;
  --bss-gold-light: #f4e9d2;
  --bss-red: #b3261e;
  --bss-sidebar-w: 250px;
  --bss-radius: 0.6rem;
  --bss-shadow: 0 1px 3px rgba(15, 40, 25, 0.08), 0 1px 2px rgba(15, 40, 25, 0.06);
  --bss-shadow-lg: 0 8px 24px rgba(15, 40, 25, 0.12);
  font-variant-numeric: tabular-nums;
}

* { box-sizing: border-box; }

body {
  min-height: 100vh;
  background: #f3f5f4;
  font-family: "Segoe UI", system-ui, -apple-system, "Noto Sans Bengali", Roboto, Arial, sans-serif;
  color: #212a24;
}

a { transition: color .15s ease, background-color .15s ease; }

/* ---------- Top navbar ---------- */
.bss-navbar {
  background: linear-gradient(90deg, var(--bss-green-dark) 0%, var(--bss-green) 100%);
  box-shadow: var(--bss-shadow);
  position: sticky;
  top: 0;
  z-index: 1030;
  min-height: 58px;
}

.bss-brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--bss-gold);
  color: var(--bss-green-dark);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: .85rem;
  flex-shrink: 0;
}

.bss-brand-logo {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: contain;
  background: #fff;
  padding: 2px;
  flex-shrink: 0;
}

.bss-brand-text .title {
  font-weight: 600;
  font-size: .95rem;
  line-height: 1.15;
  color: #fff;
}

.bss-brand-text .subtitle {
  font-size: .7rem;
  color: rgba(255, 255, 255, 0.65);
  line-height: 1;
}

.bss-fy-form { gap: .35rem; }

/* Segmented "Western / Lakh-Crore" switch — a single #lakhCroreToggle
   checkbox (see static/js/app.js) styled as a two-option sliding pill
   instead of a plain switch, so the currently-active grouping reads at a
   glance rather than needing the on/off state interpreted via one label. */
.bss-numfmt-switch {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  margin: 0;
  cursor: pointer;
  user-select: none;
}
.bss-numfmt-icon { color: rgba(255, 255, 255, 0.55); font-size: .85rem; }
.bss-numfmt-input {
  position: absolute;
  width: 0;
  height: 0;
  opacity: 0;
  pointer-events: none;
}
.bss-numfmt-track {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  width: 128px;
  height: 26px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.22);
  transition: border-color .2s ease, box-shadow .2s ease;
}
.bss-numfmt-track:hover { border-color: rgba(255, 255, 255, 0.4); }
.bss-numfmt-input:focus-visible ~ .bss-numfmt-track { box-shadow: 0 0 0 .2rem rgba(200, 162, 74, .35); }
.bss-numfmt-thumb {
  position: absolute;
  z-index: 0;
  top: 2px;
  left: 2px;
  width: calc(50% - 3px);
  height: calc(100% - 4px);
  border-radius: 999px;
  background: linear-gradient(135deg, var(--bss-gold) 0%, #dab766 100%);
  box-shadow: 0 1px 3px rgba(0, 0, 0, .25);
  transition: transform .25s cubic-bezier(.4, 0, .2, 1);
}
.bss-numfmt-input:checked ~ .bss-numfmt-track .bss-numfmt-thumb { transform: translateX(100%); }
.bss-numfmt-opt {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .68rem;
  font-weight: 600;
  letter-spacing: .01em;
  color: rgba(255, 255, 255, 0.7);
  white-space: nowrap;
  transition: color .2s ease;
}
.bss-numfmt-input:not(:checked) ~ .bss-numfmt-track .bss-numfmt-opt:first-child { color: var(--bss-green-dark); font-weight: 700; }
.bss-numfmt-input:checked ~ .bss-numfmt-track .bss-numfmt-opt:last-child { color: var(--bss-green-dark); font-weight: 700; }
@media (max-width: 767.98px) {
  .bss-numfmt-track { width: 76px; }
}

.bss-fy-select {
  background-color: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.22);
  color: #fff;
  border-radius: 999px;
  font-size: .78rem;
  padding-top: .3rem;
  padding-bottom: .3rem;
  width: auto;
}
.bss-fy-select:hover { background-color: rgba(255, 255, 255, 0.18); }
.bss-fy-select:focus {
  background-color: rgba(255, 255, 255, 0.18);
  border-color: var(--bss-gold);
  box-shadow: 0 0 0 .2rem rgba(200, 162, 74, .25);
  color: #fff;
}
.bss-fy-select option { color: #1e2823; background: #fff; }

.bss-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--bss-gold);
  color: var(--bss-green-dark);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: .8rem;
}

.bss-navbar .btn-toggle-sidebar {
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(255, 255, 255, 0.08);
}
.bss-navbar .btn-toggle-sidebar:hover { background: rgba(255, 255, 255, 0.18); }

.bss-navbar-ibas-link {
  align-items: center;
  gap: .35rem;
  background-color: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.22);
  color: #fff;
  border-radius: .375rem;
  padding: .3rem .65rem;
  font-size: .8rem;
  font-weight: 600;
  text-decoration: none;
  transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}
.bss-navbar-ibas-link:hover { background-color: rgba(255, 255, 255, 0.18); color: #fff; }
.bss-navbar-ibas-link.active { background-color: var(--bss-gold); border-color: var(--bss-gold); color: var(--bss-green-dark); }

/* ---------- Sidebar ---------- */
.bss-sidebar {
  background: linear-gradient(180deg, var(--bss-green) 0%, var(--bss-green-dark) 100%);
  width: var(--bss-sidebar-w);
  flex-shrink: 0;
  color: #eef3ef;
  position: sticky;
  top: 58px;
  height: calc(100vh - 58px);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, .25) transparent;
}
.bss-sidebar::-webkit-scrollbar { width: 6px; }
.bss-sidebar::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .2); border-radius: 3px; }

.bss-sidebar .nav-link {
  color: #cfe0d5;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .55rem 1rem;
  font-size: .875rem;
  border-left: 3px solid transparent;
  border-radius: 0;
}

.bss-sidebar .nav-link i { font-size: 1rem; width: 1.1rem; text-align: center; opacity: .85; }

.bss-sidebar .nav-link:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.06);
}

.bss-sidebar .nav-link.active {
  color: #fff;
  background: rgba(200, 162, 74, 0.18);
  border-left-color: var(--bss-gold);
  font-weight: 600;
}

.bss-sidebar .nav-section-title {
  font-size: .68rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--bss-gold);
  padding: 1rem 1rem .3rem;
  opacity: .9;
}

/* ---------- Layout / responsive ---------- */
.bss-app-body { min-height: calc(100vh - 58px); }
.bss-main { flex-grow: 1; padding: 1.5rem; min-width: 0; }

@media (max-width: 991.98px) {
  .bss-sidebar {
    position: fixed;
    left: 0;
    top: 58px;
    height: calc(100vh - 58px);
    z-index: 1040;
    transform: translateX(-100%);
    transition: transform .25s ease;
    box-shadow: var(--bss-shadow-lg);
  }
  .bss-sidebar.show { transform: translateX(0); }
  .bss-sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 58px 0 0 0;
    background: rgba(0, 0, 0, .35);
    z-index: 1035;
  }
  .bss-sidebar-backdrop.show { display: block; }
  .bss-main { padding: 1rem; }
}

@media (min-width: 992px) {
  .btn-toggle-sidebar { display: none !important; }
}

/* ---------- Page header ---------- */
.bss-page-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  margin-bottom: 1.25rem;
}

.bss-page-header .icon-badge {
  width: 42px;
  height: 42px;
  border-radius: var(--bss-radius);
  background: var(--bss-green-light);
  color: var(--bss-green);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  flex-shrink: 0;
}

.bss-page-header h4 { margin: 0; font-weight: 600; }
.bss-page-header .subtitle { color: #667; font-size: .85rem; margin: 0; }

/* ---------- Cards / KPIs ---------- */
.card {
  border: 1px solid rgba(15, 40, 25, .08);
  border-radius: var(--bss-radius);
  box-shadow: var(--bss-shadow);
}

.kpi-card {
  border: 1px solid rgba(15, 40, 25, .08);
  border-radius: var(--bss-radius);
  transition: transform .15s ease, box-shadow .15s ease;
  position: relative;
  overflow: hidden;
}
.kpi-card:hover { transform: translateY(-2px); box-shadow: var(--bss-shadow-lg); }
.kpi-card .kpi-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
}
.kpi-card .kpi-value { font-size: 1.5rem; font-weight: 700; line-height: 1.2; }
.kpi-card .kpi-label { font-size: .78rem; color: #667; text-transform: uppercase; letter-spacing: .03em; }

.kpi-icon.bg-green { background: var(--bss-green-light); color: var(--bss-green); }
.kpi-icon.bg-gold { background: var(--bss-gold-light); color: #8a6a1c; }
.kpi-icon.bg-blue { background: #e6f0fb; color: #1a5aa6; }
.kpi-icon.bg-red { background: #fbeaea; color: var(--bss-red); }

/* ---------- Tables ---------- */
.table {
  --bs-table-bg: #fff;
  font-size: .875rem;
}
.table thead th {
  background: var(--bss-green-light);
  color: var(--bss-green-dark);
  font-weight: 600;
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .03em;
  border-bottom: none;
  white-space: nowrap;
}
.table-responsive { border-radius: var(--bss-radius); overflow-x: auto; box-shadow: var(--bss-shadow); }
.table tbody tr:hover { background: var(--bss-green-light); }

/* ---------- Frozen leading columns (wide worksheets, e.g. Revised Demand) ----------
   Each frozen column gets a fixed width AND a `left` offset computed from that
   same width, so the sticky columns line up pixel-for-pixel across every row
   type (header / body / subtotal / grand total). A mismatched offset is what
   lets a scrolled-past column peek through at the seam — this is why widths
   here are locked (width = min-width = max-width), not just suggested. */
.bss-frozen-table { --bss-frz-1: 46px; --bss-frz-2: 100px; --bss-frz-3: 220px; }
.bss-frozen-table .bss-frozen-col { position: sticky; z-index: 3; background-color: #fff; }
.bss-frozen-table thead .bss-frozen-col { background-color: var(--bss-green-light); vertical-align: middle; z-index: 4; }
.bss-frozen-table .bss-subtotal-row .bss-frozen-col { background-color: #e9ecef; }
.bss-frozen-table .bss-grandtotal-row .bss-frozen-col { background-color: var(--bss-green-light); }
.bss-frozen-table .bss-frozen-1 { left: 0; width: var(--bss-frz-1); min-width: var(--bss-frz-1); max-width: var(--bss-frz-1); }
.bss-frozen-table .bss-frozen-2 { left: var(--bss-frz-1); width: var(--bss-frz-2); min-width: var(--bss-frz-2); max-width: var(--bss-frz-2); }
.bss-frozen-table .bss-frozen-3 {
  left: calc(var(--bss-frz-1) + var(--bss-frz-2));
  width: var(--bss-frz-3);
  min-width: var(--bss-frz-3);
  max-width: var(--bss-frz-3);
  white-space: normal;
  overflow-wrap: anywhere;
}
/* Subtotal/grand-total rows merge the Code+Description columns into one
   colspan cell — same left offset as .bss-frozen-2, width follows naturally
   from the two columns it spans. */
.bss-frozen-table .bss-frozen-2-3 { left: var(--bss-frz-1); white-space: normal; }
/* Right-edge divider marking the frozen/scrollable boundary, applied to
   whichever cell is rightmost among the frozen columns in a given row. */
.bss-frozen-table .bss-frozen-edge { box-shadow: 4px 0 6px -3px rgba(0, 0, 0, .25); }

/* ---------- Buttons ---------- */
.btn-success { background: var(--bss-green); border-color: var(--bss-green); }
.btn-success:hover { background: var(--bss-green-mid); border-color: var(--bss-green-mid); }
.btn-outline-success { color: var(--bss-green); border-color: var(--bss-green); }
.btn-outline-success:hover { background: var(--bss-green); border-color: var(--bss-green); }
.btn, .form-control, .form-select { border-radius: .45rem; }
.btn { font-size: .875rem; }

/* ---------- Cycle stepper ---------- */
.cycle-progress-wrap {
  display: flex;
  align-items: center;
  gap: .75rem;
  margin-bottom: .85rem;
}
.cycle-progress-wrap .progress {
  flex-grow: 1;
  height: 8px;
  border-radius: 999px;
  background: rgba(15, 40, 25, .08);
}
.cycle-progress-wrap .progress-bar {
  background: linear-gradient(90deg, var(--bss-green) 0%, var(--bss-gold) 100%);
  border-radius: 999px;
}
.cycle-progress-wrap .progress-label {
  font-size: .78rem;
  font-weight: 600;
  color: var(--bss-green-dark);
  white-space: nowrap;
}

.cycle-stepper {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: .6rem;
}

@media (max-width: 575.98px) {
  .cycle-stepper { grid-template-columns: repeat(2, 1fr); }
}

.cycle-step {
  padding: .7rem .8rem;
  border-radius: var(--bss-radius);
  background: #fff;
  border: 1px solid rgba(15, 40, 25, .08);
  border-left: 4px solid #cbd3ce;
  font-size: .78rem;
  box-shadow: var(--bss-shadow);
  position: relative;
  transition: transform .15s ease, box-shadow .15s ease;
  display: flex;
  flex-direction: column;
  gap: .35rem;
  min-height: 84px;
}
.cycle-step:hover { transform: translateY(-2px); box-shadow: var(--bss-shadow-lg); }

.cycle-step .step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #e9ecef;
  color: #495057;
  font-size: .7rem;
  font-weight: 700;
  flex-shrink: 0;
}
.cycle-step .step-title {
  display: flex;
  align-items: flex-start;
  gap: .45rem;
  font-weight: 600;
  color: #1e2823;
  line-height: 1.25;
}
.cycle-step .step-meta { margin-left: 1.7rem; color: #7a877e; }

.cycle-step.status-PENDING { opacity: .8; }
.cycle-step.status-DONE { border-left-color: #0f5132; background: var(--bss-green-light); }
.cycle-step.status-DONE .step-num { background: #0f5132; color: #fff; }
.cycle-step.status-DONE .step-title { color: var(--bss-green-dark); }
.cycle-step.status-IN_PROGRESS { border-left-color: var(--bss-gold); background: var(--bss-gold-light); }
.cycle-step.status-IN_PROGRESS .step-num { background: var(--bss-gold); color: #402f00; }

/* ---------- Badges ---------- */
.badge { font-weight: 600; font-size: .72rem; letter-spacing: .01em; }

/* ---------- Login ---------- */
.bss-login-wrap {
  min-height: 100vh;
  background:
    radial-gradient(circle at 15% 20%, rgba(200,162,74,.18), transparent 40%),
    linear-gradient(135deg, var(--bss-green-dark) 0%, var(--bss-green) 55%, #0e4a27 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}
.bss-login-card {
  width: 100%;
  max-width: 380px;
  border-radius: 1rem;
  box-shadow: var(--bss-shadow-lg);
  border: none;
  overflow: hidden;
}
.bss-login-mark {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--bss-gold);
  color: var(--bss-green-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  margin: 0 auto 1rem;
  overflow: hidden;
}

.bss-login-mark img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #fff;
  padding: 4px;
}

/* ---------- Stat chips (small KPI-style summary row) ---------- */
.bss-stat-chip {
  display: flex;
  align-items: center;
  gap: .65rem;
  flex: 1 1 170px;
  background: #f8faf8;
  border: 1px solid rgba(15, 40, 25, .08);
  border-radius: 10px;
  padding: .6rem .9rem;
}
.bss-stat-chip .icon {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.05rem;
  flex-shrink: 0;
}
.bss-stat-chip .icon.c-blue { background: #e6f0fb; color: #1a5aa6; }
.bss-stat-chip .icon.c-gold { background: var(--bss-gold-light); color: #8a6a1c; }
.bss-stat-chip .icon.c-green { background: var(--bss-green-light); color: var(--bss-green); }
.bss-stat-chip .icon.c-muted { background: #eef0ee; color: #6a776a; }
.bss-stat-chip .value { font-size: 1.15rem; font-weight: 700; line-height: 1.15; }
.bss-stat-chip .label { font-size: .72rem; color: #667; text-transform: uppercase; letter-spacing: .03em; }

.bss-stat-chip.is-clickable {
  cursor: pointer;
  user-select: none;
  transition: border-color .12s ease, box-shadow .12s ease, background-color .12s ease;
}
.bss-stat-chip.is-clickable:hover { border-color: rgba(15, 40, 25, .18); background: #f4f6f4; }
.bss-stat-chip.is-clickable:focus-visible { outline: 2px solid var(--bss-green); outline-offset: 1px; }
.bss-stat-chip.is-clickable.active { border-color: var(--bss-green); background: var(--bss-green-light); box-shadow: 0 0 0 1px var(--bss-green) inset; }

/* ---------- Grouped column headers (wide working-sheet tables) ---------- */
.bss-group-header th { font-size: .72rem; text-transform: uppercase; letter-spacing: .02em; color: #556; }
th.bss-group-history, td.bss-group-history { background: #eef0f4; }
th.bss-group-current, td.bss-group-current { background: #e6f0fb; }
th.bss-group-forecast, td.bss-group-forecast { background: var(--bss-gold-light); }
th.bss-group-alt, td.bss-group-alt { background: var(--bss-green-light); }
th.bss-group-manual { background: #fff4d6; }
.bss-editable-cell { background: #fffaf0; }
.bss-editable-cell input { background: #fff; }

/* ---------- List filter bar (status chips + dropdown filters) ---------- */
.bss-filter-bar {
  background: #f8faf8;
  border: 1px solid rgba(15, 40, 25, .08);
  border-radius: var(--bss-radius);
  padding: .75rem .9rem;
}
.bss-filter-row { display: flex; align-items: center; flex-wrap: wrap; gap: .5rem; }
.bss-filter-row + .bss-filter-row { margin-top: .65rem; padding-top: .65rem; border-top: 1px dashed rgba(15, 40, 25, .1); }

.bss-status-chip {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  border: 1px solid rgba(15, 40, 25, .12);
  background: #fff;
  border-radius: 999px;
  padding: .3rem .75rem;
  font-size: .8rem;
  font-weight: 600;
  color: #445;
  cursor: pointer;
  transition: border-color .12s ease, background-color .12s ease, color .12s ease;
}
.bss-status-chip .dot { width: 8px; height: 8px; border-radius: 50%; background: #9aa; flex-shrink: 0; }
.bss-status-chip .dot-all { background: linear-gradient(135deg, var(--bss-green), var(--bss-gold)); }
.bss-status-chip .dot-uploaded, .bss-status-chip .dot-mapped { background: #6c757d; }
.bss-status-chip .dot-committed { background: var(--bss-green); }
.bss-status-chip .dot-rolled_back { background: var(--bss-red); }
.bss-status-chip .count { color: #778; font-weight: 700; }
.bss-status-chip:hover { border-color: rgba(15, 40, 25, .25); background: #f4f6f4; }
.bss-status-chip.active { border-color: var(--bss-green); background: var(--bss-green-light); color: var(--bss-green); }
.bss-status-chip.active .count { color: var(--bss-green); }

.bss-filter-field { display: flex; align-items: center; gap: .4rem; }
.bss-filter-field label { font-size: .78rem; color: #667; font-weight: 600; margin: 0; white-space: nowrap; }
.bss-filter-field select { min-width: 130px; }

.bss-filter-chips { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .65rem; }
.bss-filter-chip {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  background: var(--bss-green-light);
  color: var(--bss-green);
  border-radius: 999px;
  padding: .2rem .55rem;
  font-size: .75rem;
  font-weight: 600;
}
.bss-filter-chip i { cursor: pointer; opacity: .7; }
.bss-filter-chip i:hover { opacity: 1; }

/* ---------- Bulk-action bar (multi-select send) ---------- */
.bss-bulk-bar {
  display: flex;
  align-items: center;
  gap: .75rem;
  background: var(--bss-green-light);
  border: 1px solid rgba(11, 61, 32, .18);
  border-radius: var(--bss-radius);
  padding: .5rem .9rem;
  color: var(--bss-green);
  font-weight: 600;
  font-size: .85rem;
}

/* ---------- FC × Economic Code matrix ---------- */
.bss-fc-matrix-wrap {
  border: 1px solid rgba(15, 40, 25, .08);
  border-radius: 10px;
  overflow-x: auto;
  overflow-y: visible;
}
.bss-fc-matrix {
  margin-bottom: 0;
  table-layout: fixed;
}
.bss-fc-matrix thead th {
  background: #f8faf8;
  font-size: .74rem;
  text-transform: uppercase;
  letter-spacing: .03em;
  color: #556;
  vertical-align: middle;
  z-index: 3;
}
.bss-fc-matrix thead th:first-child { z-index: 4; }
.bss-fc-matrix th:first-child,
.bss-fc-matrix td:first-child {
  position: sticky;
  left: 0;
  background: #fff;
  box-shadow: 2px 0 4px rgba(0, 0, 0, .05);
}
.bss-fc-matrix td:first-child { z-index: 1; }
.bss-fc-matrix th:first-child { z-index: 4; }
.bss-fc-matrix tbody tr:hover td { background: #f4faf5; }
.bss-fc-matrix tbody tr:hover td:first-child { background: #f4faf5; }
.bss-fc-matrix .code-cell .code { font-weight: 600; color: #1b2a1e; }
.bss-fc-matrix .code-cell .desc { font-size: .78rem; color: #78877c; }
.bss-fc-matrix .group-row td {
  background: #eef2ee !important;
  font-weight: 700;
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: #45543f;
  padding: .4rem .75rem;
  position: static;
  box-shadow: none;
}
.bss-fc-matrix .group-row .badge { font-size: .68rem; vertical-align: middle; }
.bss-fc-matrix .fc-cell, .bss-fc-matrix .row-toggle, .bss-fc-matrix .fc-col-toggle {
  width: 1.15em;
  height: 1.15em;
  cursor: pointer;
}
.bss-fc-matrix .fc-head-code { font-size: .76rem; font-weight: 700; color: #33422f; }
.bss-fc-matrix .fc-head-name { font-size: .62rem; color: #8a978a; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; margin: 0 auto; }
.bss-fc-matrix .fc-head-count { font-size: .62rem; font-weight: 600; color: var(--bss-green); margin-top: 1px; }
.bss-fc-copy-tool {
  background: #f8faf8;
  border: 1px solid rgba(15, 40, 25, .08);
  border-radius: 8px;
  padding: .5rem .75rem;
}
.bss-fc-matrix .code-cell { white-space: normal; word-break: break-word; }

@media (max-width: 767.98px) {
  .bss-fc-matrix-wrap { max-height: none !important; overflow: visible; border: none; max-width: 100%; }
  .bss-fc-matrix thead { display: none; }
  .bss-fc-matrix, .bss-fc-matrix tbody, .bss-fc-matrix tr, .bss-fc-matrix td {
    display: block;
    width: 100%;
    max-width: 100%;
    table-layout: auto;
    box-sizing: border-box;
  }
  .bss-fc-matrix th:first-child, .bss-fc-matrix td:first-child {
    position: static;
    box-shadow: none;
  }
  .bss-fc-matrix tbody tr.code-row {
    border: 1px solid rgba(15, 40, 25, .1);
    border-radius: 10px;
    margin-bottom: .65rem;
    padding: .65rem .8rem;
    background: #fff;
  }
  .bss-fc-matrix .group-row {
    border-radius: 8px;
    margin: 1rem 0 .5rem;
  }
  .bss-fc-matrix .group-row:first-child { margin-top: 0; }
  .bss-fc-matrix td.code-cell {
    padding: 0 0 .5rem;
    margin-bottom: .35rem;
    border-bottom: 1px solid #eef0ee;
  }
  .bss-fc-matrix td.fc-cell-td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: .38rem 0;
    border-top: 1px solid #f2f4f2;
  }
  .bss-fc-matrix td.fc-cell-td::before {
    content: attr(data-label);
    font-size: .82rem;
    color: #556;
  }
  .bss-fc-matrix td.row-toggle-td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: .5rem;
    margin-top: .25rem;
    border-top: 1px solid #f2f4f2;
    font-size: .8rem;
    font-weight: 600;
    color: #556;
  }
  .bss-fc-matrix td.row-toggle-td::before { content: "All FCs for this code"; }
}

/* ---------- Dashboard month calendar ---------- */
.bss-calendar-card {
  overflow: hidden;
  box-shadow: var(--bss-shadow-lg);
}
.bss-calendar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: .5rem;
  padding: .75rem 1rem;
  background: linear-gradient(180deg, #fff 0%, #f8faf8 100%);
  border-bottom: 1px solid rgba(15, 40, 25, .08);
}
.bss-calendar-title {
  font-weight: 700;
  font-size: 1.05rem;
  color: #1b2a1e;
  letter-spacing: .01em;
}
.bss-calendar-legend { font-size: .74rem; color: #667; }
.bss-calendar-legend .legend-item { display: inline-flex; align-items: center; gap: .35rem; }
.bss-calendar-legend .dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.bss-calendar-legend .dot.status-done { background: var(--bss-green); }
.bss-calendar-legend .dot.status-pending { background: #9aa79e; }
.bss-calendar-legend .dot.type-checklist { background: var(--bss-gold); }

.bss-calendar-body {
  display: flex;
  align-items: stretch;
}
.bss-calendar-main {
  flex: 1 1 auto;
  min-width: 0;
}
.bss-calendar-side {
  flex: 0 0 220px;
  border-left: 1px solid rgba(15, 40, 25, .08);
  padding: .85rem .9rem;
  background: #fbfcfb;
}
.bss-calendar-side-title {
  font-size: .78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: #45543f;
  margin-bottom: .6rem;
}

.bss-calendar-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  background: #f8faf8;
  border-bottom: 1px solid rgba(15, 40, 25, .08);
}
.bss-calendar-weekdays div {
  text-align: center;
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: #667;
  padding: .5rem 0;
}
.bss-calendar-weekdays div.weekend { color: var(--bss-gold); font-weight: 700; }

.bss-calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
}
.bss-calendar-day {
  min-height: 92px;
  border-right: 1px solid #eef0ee;
  border-bottom: 1px solid #eef0ee;
  padding: .3rem .35rem;
  cursor: pointer;
  transition: background-color .12s ease;
  position: relative;
}
.bss-calendar-day:nth-child(7n) { border-right: none; }
.bss-calendar-day:hover { background: #f4faf5; }
.bss-calendar-day.weekend { background: #fdfaf3; }
.bss-calendar-day.weekend:hover { background: #faf3e2; }
.bss-calendar-day.other-month { background: #fafbfa; }
.bss-calendar-day.other-month.weekend { background: #fbf9f4; }
.bss-calendar-day.other-month .day-num { color: #c3c9c3; }
.bss-calendar-day.selected { box-shadow: inset 0 0 0 2px var(--bss-green); background: #f4faf5; }
.bss-calendar-day .day-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  font-size: .78rem;
  font-weight: 600;
  color: #45543f;
  border-radius: 50%;
}
.bss-calendar-day.today .day-num { background: var(--bss-green); color: #fff; box-shadow: 0 0 0 3px var(--bss-green-light); }
.bss-calendar-day .day-events { margin-top: 2px; display: flex; flex-direction: column; gap: 2px; }
.bss-calendar-event {
  font-size: .66rem;
  line-height: 1.3;
  padding: 1px 5px 1px 6px;
  border-radius: 4px;
  border-left: 2px solid transparent;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.bss-calendar-event.status-done { background: var(--bss-green-light); color: var(--bss-green); border-left-color: var(--bss-green); }
.bss-calendar-event.status-pending { background: #eef0ee; color: #556; border-left-color: #9aa79e; }
.bss-calendar-event.status-checklist { background: var(--bss-gold-light); color: #8a6a1c; border-left-color: var(--bss-gold); }
.bss-calendar-event.more { background: transparent; color: #8a978a; font-weight: 600; padding-left: 2px; border-left: none; }

.bss-calendar-detail {
  border-top: 1px solid rgba(15, 40, 25, .08);
  padding: .75rem 1rem;
  font-size: .82rem;
  color: #556;
  background: #fbfcfb;
}
.bss-calendar-detail-date { font-weight: 700; color: #1b2a1e; font-size: .84rem; }
.bss-calendar-detail .bss-calendar-event { font-size: .76rem; padding: 3px 8px 3px 9px; white-space: normal; }

/* Week view: same grid/cell classes as month, just one row with more vertical room per day */
.bss-calendar-grid.week-view .bss-calendar-day { min-height: 260px; }
.bss-calendar-grid.week-view .bss-calendar-event { white-space: normal; }

/* Agenda view: flat chronological list, no grid */
.bss-calendar-agenda { max-height: 480px; overflow-y: auto; padding: .5rem 1rem 1rem; }
.bss-agenda-date-header {
  font-size: .76rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .03em;
  color: #45543f;
  padding: .75rem 0 .3rem;
  border-bottom: 1px solid #eef0ee;
  margin-bottom: .4rem;
}
.bss-agenda-date-header:first-child { padding-top: .25rem; }
.bss-agenda-date-header.is-today { color: var(--bss-green); }
.bss-agenda-item { margin-bottom: .3rem; }
.bss-agenda-item .bss-calendar-event { font-size: .8rem; padding: 5px 10px 5px 11px; white-space: normal; display: inline-block; }

#calViewSwitch .btn.active { background: var(--bss-green); border-color: var(--bss-green); color: #fff; }

.bss-upcoming-item {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .4rem 0;
  border-bottom: 1px solid #eef0ee;
  cursor: pointer;
}
.bss-upcoming-item:last-child { border-bottom: none; }
.bss-upcoming-item:hover .bss-upcoming-text { color: var(--bss-green); }
.bss-upcoming-date {
  flex-shrink: 0;
  width: 36px;
  text-align: center;
  border-radius: 6px;
  background: #fff;
  border: 1px solid rgba(15, 40, 25, .1);
  overflow: hidden;
  line-height: 1.1;
}
.bss-upcoming-date .mon { display: block; font-size: .58rem; text-transform: uppercase; background: var(--bss-green); color: #fff; padding: 1px 0; letter-spacing: .03em; }
.bss-upcoming-date .day { display: block; font-size: .82rem; font-weight: 700; color: #1b2a1e; padding: 2px 0; }
.bss-upcoming-text { font-size: .74rem; color: #45543f; line-height: 1.3; transition: color .12s ease; }
.bss-upcoming-text .status-done-ic { color: var(--bss-green); }
.bss-upcoming-text .status-pending-ic { color: #9aa79e; }
.bss-upcoming-text .status-checklist-ic { color: var(--bss-gold); }

@media (max-width: 991.98px) {
  .bss-calendar-body { flex-direction: column; }
  .bss-calendar-side { flex: 1 1 auto; border-left: none; border-top: 1px solid rgba(15, 40, 25, .08); }
}

@media (max-width: 767.98px) {
  .bss-calendar-day { min-height: 64px; padding: .2rem; }
  .bss-calendar-day .day-num { width: 18px; height: 18px; font-size: .7rem; }
  .bss-calendar-event { font-size: 0; padding: 0; height: 5px; width: 5px; border-radius: 50%; margin: 0 auto; border-left: none; }
  .bss-calendar-event.more { display: none; }
  .bss-calendar-weekdays div { font-size: .62rem; }

  /* Week view has only 7 cells (not 42), so there's room to keep events readable
     instead of collapsing to dots like the month grid does. */
  .bss-calendar-grid.week-view .bss-calendar-day { min-height: 140px; padding: .3rem; }
  .bss-calendar-grid.week-view .bss-calendar-day .day-num { width: 22px; height: 22px; font-size: .78rem; }
  .bss-calendar-grid.week-view .bss-calendar-event {
    font-size: .62rem; padding: 1px 5px 1px 6px; height: auto; width: auto; border-radius: 4px; margin: 0; border-left: 2px solid transparent;
  }
  .bss-calendar-grid.week-view .bss-calendar-event.status-done { border-left-color: var(--bss-green); }
  .bss-calendar-grid.week-view .bss-calendar-event.status-pending { border-left-color: #9aa79e; }
  .bss-calendar-grid.week-view .bss-calendar-event.status-checklist { border-left-color: var(--bss-gold); }
  .bss-calendar-grid.week-view .bss-calendar-event.more { display: block; font-size: .6rem; }
}

/* ---------- Misc ---------- */
.empty-state { text-align: center; padding: 3rem 1rem; color: #7a877e; }
.empty-state i { font-size: 2.25rem; color: #c6d1ca; }
.text-gold { color: var(--bss-gold); }
.bg-green-light { background: var(--bss-green-light); }

@media print {
  .bss-sidebar, .bss-navbar, .no-print, .bss-sidebar-backdrop { display: none !important; }
  .bss-main { padding: 0; }
  /* DataTables chrome (search/length/pagination/info) is JS-added, so it has
     no .no-print class to key off of — hide it by its own DataTables
     classes instead. app.js switches each table to "show all rows" just
     before print (see beforeprint/afterprint), so pagination controls
     would otherwise cut a printed table down to just the visible page. */
  .dataTables_filter, .dataTables_length, .dataTables_paginate, .dataTables_info, .dataTables_processing { display: none !important; }
  .dataTables_scrollBody { max-height: none !important; overflow: visible !important; }
  .dataTables_scrollHead, .dataTables_scrollFoot { overflow: visible !important; }
}
