:root {
  --side: #b3121f;
  --side-2: #8f0d18;
  --amber: #d62828;
  --amber-soft: #fdeaea;
  --green: #d62828;
  --green-soft: #fdeaea;
  --red: #d9534f;
  --red-soft: #fdeaea;
  --blue: #455a64;
  --blue-soft: #eceff1;
  --bg: #fbf4f4;
  --card: #fff;
  --ink: #2a1a1a;
  --muted: #7a6a6a;
  --line: #f0dede;
  --sw: 270px;
  --grad: linear-gradient(135deg, #ff6b6b 0%, #e63946 45%, #b3121f 100%);
  --grad-soft: linear-gradient(135deg, #fff 0%, #ffe3e3 100%);
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: 'Segoe UI', system-ui, -apple-system, Roboto, sans-serif;
  font-size: 0.8125rem; /* ~13px compact modern look */
  line-height: 1.4;
}

/* Sidebar */
.sidebar {
  width: var(--sw);
  background: linear-gradient(165deg, #ff5d62 0%, #e02a37 30%, #b3121f 65%, #6f0912 100%);
  color: #ffdede;
}

/* Smooth scroll + scrollbar visible only while scrolling */
.sidebar,
.sidebar nav {
  scroll-behavior: smooth;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: transparent transparent;
  overflow-y: auto;
}

.sidebar.is-scrolling {
  scrollbar-color: #ffffff88 transparent;
}

.sidebar::-webkit-scrollbar {
  width: 6px;
}

.sidebar::-webkit-scrollbar-track {
  background: transparent;
}

.sidebar::-webkit-scrollbar-thumb {
  background: transparent;
  border-radius: 10px;
  transition: background 0.3s;
}

.sidebar.is-scrolling::-webkit-scrollbar-thumb {
  background: #ffffff88;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1.2rem 1.1rem;
  color: #fff;
  text-decoration: none;
}

.brand-logo,
.brand img {
  width: 50px;
  height: 50px;
  object-fit: contain;
  background: transparent;
  filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.25));
  flex-shrink: 0;
}

.brand i {
  background: var(--grad-soft);
  color: #c8161f;
  box-shadow: 0 4px 10px #0003;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-size: 1.3rem;
  flex-shrink: 0;
}

.brand-text {
  line-height: 1.2;
  word-break: break-word;
}

.brand-name {
  font-size: 1.1rem;
  font-weight: 700;
  color: #ffffff;
  line-height: 1.25;
  word-break: break-word;
}

.brand-tagline {
  font-size: 0.68rem;
  color: #ffd0d0;
  font-weight: 400;
  display: block;
  margin-top: 2px;
}

.menu-title {
  font-size: 0.78rem;
  padding: 1rem 1.4rem 0.4rem;
  color: #ffb3b3;
}

.side-link {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  margin: 0.15rem 0.8rem;
  padding: 0.65rem 0.9rem;
  border-radius: 10px;
  color: #ffe3e3;
  text-decoration: none;
  font-size: 0.95rem;
  transition: background 0.15s;
}

.side-link i {
  font-size: 1.15rem;
  width: 22px;
  text-align: center;
}

.side-link:hover {
  background: linear-gradient(90deg, #ffffff2e, #ffffff0d);
  color: #fff;
}

.side-link.active {
  background: var(--grad-soft);
  color: #c8161f;
  font-weight: 600;
  box-shadow: 0 4px 12px #0003;
}

.side-link .badge {
  margin-left: auto;
  background: #ffffff22;
  font-weight: 500;
}

.side-link.active .badge {
  background: #fdeaea;
  color: #c8161f;
}

.side-foot {
  margin: auto 0.8rem 1rem;
  padding: 0.9rem;
  border-radius: 12px;
  background: linear-gradient(135deg, #00000040, #00000015);
  border: 1px solid #ffffff22;
  font-size: 0.85rem;
}

@media (min-width: 992px) {
  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
  }
  .main {
    margin-left: var(--sw);
  }
}

.offcanvas.sidebar {
  display: flex;
  flex-direction: column;
}

.offcanvas.sidebar .btn-close {
  filter: invert(1);
}

/* Navbar */
.topbar {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 100;
  padding: 0.7rem 1.2rem;
}

.search {
  position: relative;
  flex: 1;
  max-width: 460px;
}

.search > i,
.search .search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
  z-index: 2;
}

.search-results i {
  position: static !important;
  transform: none !important;
}

.search input {
  padding-left: 2.5rem;
  border-radius: 12px;
  background: var(--bg);
  border: 1px solid transparent;
  height: 44px;
}

.search input:focus {
  background: #fff;
  border-color: var(--amber);
  box-shadow: 0 0 0 0.2rem #d6282833;
}

.search-results {
  position: absolute;
  top: 50px;
  left: 0;
  right: 0;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.12);
  display: none;
  overflow: hidden;
  z-index: 200;
  max-height: 380px;
  overflow-y: auto;
}

.search-results a,
.search-results .search-result-item {
  display: flex;
  gap: 0.65rem;
  align-items: center;
  padding: 0.65rem 0.9rem;
  color: var(--ink);
  text-decoration: none;
  font-size: 0.92rem;
  transition: background 0.15s ease;
}

.search-results a:hover,
.search-results .search-result-item:hover {
  background: #fdf2f2;
}

.search-results a:last-child,
.search-results .search-result-item:last-child {
  border-bottom: 0 !important;
}

.tag {
  font-size: 0.72rem;
  padding: 0.2rem 0.55rem;
  border-radius: 20px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  flex-shrink: 0;
}

.tag.c {
  background: linear-gradient(135deg, #ffeaea, #ffd0d0);
  color: #b3121f;
}

.tag.s {
  background: var(--blue-soft);
  color: var(--blue);
}

.icon-btn {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  border: 0;
  background: var(--bg);
  position: relative;
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  vertical-align: middle;
}

.icon-btn .dot {
  position: absolute;
  top: 9px;
  right: 10px;
  width: 9px;
  height: 9px;
  background: var(--red);
  border-radius: 50%;
  border: 2px solid #fff;
}

.avatar {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: var(--grad);
  box-shadow: 0 4px 10px #d6282840;
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.95rem;
  line-height: 1;
  vertical-align: middle;
}

/* Cards */
.cardx {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 1.2rem;
  box-shadow: 0 2px 10px #b3121f0d;
  position: relative;
  overflow: hidden;
}

.cardx::before {
  content: '';
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  background: linear-gradient(90deg, #ff6b6b, #d62828, #8f0d18);
}

.stat {
  display: flex;
  gap: 0.9rem;
  align-items: center;
  height: 100%;
  min-height: 106px;
}

.stat > div:last-child {
  min-width: 0;
  flex: 1;
}

.stat small {
  color: var(--muted);
  font-size: 0.8rem;
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.25;
  margin-bottom: 2px;
}

.stat h4 {
  margin: 0;
  font-weight: 700;
  font-size: clamp(1.15rem, 1.4vw, 1.45rem);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
}

.trend {
  font-size: 0.78rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  line-height: 1;
  margin-top: 3px;
}

.up {
  color: #1e7e34;
}

.down {
  color: var(--red);
}

/* Bar chart */
.chart {
  display: flex;
  align-items: flex-end;
  gap: clamp(0.3rem, 1.6vw, 1.1rem);
  height: 260px;
  padding: 0 0.2rem;
  border-bottom: 1px solid var(--line);
  position: relative;
  background: repeating-linear-gradient(to top, transparent 0, transparent 51px, var(--line) 51px, var(--line) 52px);
}

.grp {
  flex: 1;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 3px;
  height: 100%;
  position: relative;
}

.bar {
  width: 100%;
  max-width: 22px;
  border-radius: 6px 6px 0 0;
  height: 0;
  transition: height 0.8s cubic-bezier(0.2, 0.8, 0.2, 1);
  position: relative;
}

.bar.sale {
  background: linear-gradient(180deg, #ff6b6b, #b3121f);
}

.bar.buy {
  background: linear-gradient(180deg, #ffd0d0, #f08b8b);
}

.bar:hover::after {
  content: attr(data-v);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: #fff;
  font-size: 0.72rem;
  padding: 0.15rem 0.45rem;
  border-radius: 6px;
  white-space: nowrap;
  margin-bottom: 4px;
}

.labels {
  display: flex;
  gap: clamp(0.3rem, 1.6vw, 1.1rem);
  padding: 0.5rem 0.2rem 0;
  font-size: 0.78rem;
  color: var(--muted);
}

.labels span {
  flex: 1;
  text-align: center;
}

.legend i {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 3px;
  margin-right: 0.35rem;
}

/* Table */
.table {
  --bs-table-bg: transparent;
  margin: 0;
}

.table th {
  font-size: 0.75rem;
  color: var(--muted);
  font-weight: 600;
  border-bottom-color: var(--line);
  padding: 0.55rem 0.65rem;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}

.table td {
  vertical-align: middle;
  border-color: var(--line);
  font-size: 0.8125rem;
  padding: 0.5rem 0.65rem;
}

.st {
  padding: 0.2rem 0.6rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
}

.st.paid {
  background: #e6f4ea;
  color: #1e7e34;
}

.st.due {
  background: var(--red-soft);
  color: var(--red);
}

.st.part {
  background: #fff1e0;
  color: #b45f06;
}

.person {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--line);
}

.person:last-child {
  border: 0;
}

.person .av {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 0.85rem;
  flex: none;
}

.btn-amber {
  background: var(--grad);
  border: 0;
  color: #fff;
  box-shadow: 0 4px 12px #d6282840;
  font-weight: 600;
  border-radius: 10px;
}

.btn-amber:hover {
  background: linear-gradient(135deg, #e63946, #a30f1b);
  color: #fff;
}

/* ==========================================================================
   DataTables & Export Buttons Theme Styling (Red Gradient Theme)
   ========================================================================== */
.dt-buttons,
div.dt-buttons,
.btn-group.dt-buttons {
  display: inline-flex !important;
  flex-wrap: wrap !important;
  gap: 0.4rem !important;
  background: transparent !important;
  box-shadow: none !important;
  border: 0 !important;
  padding: 0 !important;
}

.dt-buttons .btn,
.dt-buttons .dt-btn,
.dt-buttons button.dt-button {
  background: linear-gradient(135deg, #ff6b6b 0%, #e63946 45%, #b3121f 100%) !important;
  color: #ffffff !important;
  border: 0 !important;
  border-radius: 8px !important;
  font-size: 0.82rem !important;
  font-weight: 600 !important;
  padding: 0.42rem 0.85rem !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 0.45rem !important;
  box-shadow: 0 3px 10px rgba(214, 40, 40, 0.25) !important;
  transition: all 0.2s ease !important;
}

.dt-buttons .btn *,
.dt-buttons .dt-btn *,
.dt-buttons button.dt-button * {
  color: #ffffff !important;
}

.dt-buttons .btn:hover,
.dt-buttons .dt-btn:hover,
.dt-buttons button.dt-button:hover {
  background: linear-gradient(135deg, #e63946 0%, #b3121f 60%, #8f0d18 100%) !important;
  color: #ffffff !important;
  transform: translateY(-1px);
  box-shadow: 0 5px 14px rgba(214, 40, 40, 0.35) !important;
}

.dt-buttons .btn:active,
.dt-buttons .dt-btn:active {
  transform: translateY(0);
}

/* DataTables Filter Input & Length Select */
div.dataTables_wrapper div.dataTables_filter input {
  border-radius: 10px !important;
  border: 1px solid var(--line) !important;
  padding: 0.38rem 0.75rem !important;
  font-size: 0.88rem !important;
  margin-left: 0.4rem !important;
  background-color: #ffffff !important;
  transition: border-color 0.2s, box-shadow 0.2s !important;
}

div.dataTables_wrapper div.dataTables_filter input:focus {
  border-color: var(--amber) !important;
  outline: 0 !important;
  box-shadow: 0 0 0 0.2rem rgba(214, 40, 40, 0.15) !important;
}

div.dataTables_wrapper div.dataTables_length select {
  border-radius: 10px !important;
  border: 1px solid var(--line) !important;
  padding: 0.38rem 1.8rem 0.38rem 0.65rem !important;
  font-size: 0.88rem !important;
  background-color: #ffffff !important;
}

div.dataTables_wrapper div.dataTables_length select:focus {
  border-color: var(--amber) !important;
  outline: 0 !important;
  box-shadow: 0 0 0 0.2rem rgba(214, 40, 40, 0.15) !important;
}

/* ==========================================================================
   Themed Pagination (Red Gradient Theme)
   ========================================================================== */
.pagination {
  --bs-pagination-color: #b3121f !important;
  --bs-pagination-hover-color: #8f0d18 !important;
  --bs-pagination-hover-bg: #fdeaea !important;
  --bs-pagination-hover-border-color: #ffc2c2 !important;
  --bs-pagination-focus-color: #8f0d18 !important;
  --bs-pagination-focus-bg: #fdeaea !important;
  --bs-pagination-focus-box-shadow: 0 0 0 0.25rem rgba(214, 40, 40, 0.25) !important;
  --bs-pagination-active-color: #ffffff !important;
  --bs-pagination-active-bg: #b3121f !important;
  --bs-pagination-active-border-color: #b3121f !important;
  gap: 0.25rem !important;
  margin-bottom: 0 !important;
}

.pagination .page-item .page-link,
div.dataTables_wrapper div.dataTables_paginate ul.pagination .page-item .page-link {
  color: #4a2a2a !important;
  background: #ffffff !important;
  border: 1px solid var(--line) !important;
  border-radius: 8px !important;
  font-size: 0.85rem !important;
  font-weight: 600 !important;
  padding: 0.38rem 0.75rem !important;
  margin: 0 !important;
  transition: all 0.2s ease !important;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.03) !important;
}

.pagination .page-item .page-link:hover,
div.dataTables_wrapper div.dataTables_paginate ul.pagination .page-item .page-link:hover {
  background: #fdeaea !important;
  border-color: #fca5a5 !important;
  color: #b3121f !important;
}

.pagination .page-item.active .page-link,
.pagination .page-item.active > .page-link,
div.dataTables_wrapper div.dataTables_paginate ul.pagination .page-item.active .page-link,
div.dataTables_wrapper div.dataTables_paginate ul.pagination li.active a,
div.dataTables_wrapper div.dataTables_paginate ul.pagination li.active span {
  background: linear-gradient(135deg, #ff6b6b 0%, #e63946 45%, #b3121f 100%) !important;
  background-color: #d62828 !important;
  border-color: #b3121f !important;
  color: #ffffff !important;
  box-shadow: 0 4px 12px rgba(214, 40, 40, 0.35) !important;
  font-weight: 700 !important;
}

.pagination .page-item.disabled .page-link,
div.dataTables_wrapper div.dataTables_paginate ul.pagination .page-item.disabled .page-link {
  color: #bfa8a8 !important;
  background-color: #faf5f5 !important;
  border-color: var(--line) !important;
  opacity: 0.65;
  box-shadow: none !important;
}

/* ==========================================================================
   Select2 Theme Styling (Red Gradient Theme)
   ========================================================================== */
.select2-container--bootstrap-5 .select2-selection,
.select2-container--default .select2-selection--single {
  border: 1px solid var(--line) !important;
  border-radius: 8px !important;
  min-height: 38px !important;
  padding: 4px 10px !important;
  background-color: #ffffff !important;
  font-size: 0.88rem !important;
  transition: border-color 0.2s, box-shadow 0.2s !important;
}

.select2-container--bootstrap-5.select2-container--focus .select2-selection,
.select2-container--bootstrap-5.select2-container--open .select2-selection,
.select2-container--default.select2-container--focus .select2-selection--single,
.select2-container--default.select2-container--open .select2-selection--single {
  border-color: var(--amber) !important;
  box-shadow: 0 0 0 0.2rem rgba(214, 40, 40, 0.15) !important;
}

.select2-dropdown {
  border: 1px solid var(--line) !important;
  border-radius: 8px !important;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1) !important;
  overflow: hidden !important;
  z-index: 1055 !important;
}

.select2-container--bootstrap-5 .select2-dropdown .select2-results__option--highlighted,
.select2-container--default .select2-results__option--highlighted[aria-selected] {
  background: linear-gradient(135deg, #ff6b6b 0%, #e63946 45%, #b3121f 100%) !important;
  color: #ffffff !important;
}

.select2-container--bootstrap-5 .select2-dropdown .select2-results__option--selected,
.select2-container--default .select2-results__option--selected {
  background-color: #fdeaea !important;
  color: var(--side-2) !important;
  font-weight: 600 !important;
}

.select2-container--bootstrap-5 .select2-search__field:focus,
.select2-container--default .select2-search--dropdown .select2-search__field:focus {
  border-color: var(--amber) !important;
  outline: 0 !important;
  box-shadow: 0 0 0 0.2rem rgba(214, 40, 40, 0.15) !important;
}

/* ==========================================================================
   Global Listing Pages Element Sizing & Compact Typography
   ========================================================================== */
h1.h3 {
  font-size: 1.25rem !important;
}

h2, .h2 {
  font-size: 1.15rem !important;
}

h3, .h3 {
  font-size: 1.05rem !important;
}

h5, .h5 {
  font-size: 0.92rem !important;
}

h6, .h6 {
  font-size: 0.82rem !important;
}

/* Listing KPI cards & headers */
.card h3,
.card .h3 {
  font-size: 1.15rem !important;
}

.card .small,
.card small {
  font-size: 0.75rem !important;
}

/* Badges */
.badge {
  font-size: 0.72rem !important;
  font-weight: 600;
  padding: 0.25rem 0.55rem;
}

/* Form controls & Buttons on Listing pages */
.btn-sm {
  font-size: 0.78rem !important;
  padding: 0.3rem 0.65rem !important;
}

.btn {
  font-size: 0.8125rem;
}

.form-control,
.form-select {
  font-size: 0.8125rem;
}

.form-control-sm,
.form-select-sm {
  font-size: 0.78rem !important;
  padding: 0.28rem 0.55rem !important;
}

/* DataTables elements */
div.dataTables_wrapper div.dataTables_info {
  font-size: 0.78rem !important;
  padding-top: 0.5rem !important;
}

div.dataTables_wrapper div.dataTables_length label,
div.dataTables_wrapper div.dataTables_filter label {
  font-size: 0.78rem !important;
}

div.dataTables_wrapper div.dataTables_filter input,
div.dataTables_wrapper div.dataTables_length select {
  font-size: 0.78rem !important;
  padding: 0.25rem 0.5rem !important;
}

.pagination .page-item .page-link,
div.dataTables_wrapper div.dataTables_paginate ul.pagination .page-item .page-link {
  font-size: 0.75rem !important;
  padding: 0.25rem 0.55rem !important;
}

/* Two-column report tables */
.report-table th {
  font-size: 0.75rem !important;
}

.report-table td {
  font-size: 0.78rem !important;
}




